Check-in [a5aaa48037]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Merge wip-gradle-modernization branch into trunk.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | x-date-202003
Files: files | file ages | folders
SHA1: a5aaa48037ec6e03cf18a7509732bbd188620b62
User & Date: stephanie.gawroriski 2020-03-02 05:18:03
Context
2020-03-04
08:02
Backup developer notes. check-in: 2bc18de7ac user: squirreljme tags: trunk
02:09
Create new branch named "wip-publishing" check-in: e61df63ef8 user: stephanie.gawroriski tags: wip-publishing
2020-03-02
22:28
Create new branch named "wip-springcoat-bringup" check-in: f04d19aab5 user: stephanie.gawroriski tags: wip-springcoat-bringup
05:18
Merge wip-gradle-modernization branch into trunk. check-in: a5aaa48037 user: stephanie.gawroriski tags: trunk, x-date-202003
05:05
Correct MIME decoder test for Windows. Closed-Leaf check-in: 8f1816204b user: stephanie.gawroriski tags: wip-gradle-modernization
2020-02-27
08:04
Backup developer notes. check-in: 248ca51558 user: squirreljme tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to .circleci/config.yml.

9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76


77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180


181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264

265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
# DESCRIPTION: CircleCI Build Configuration

version: 2.1
executors:
  buildenv:
    docker:
      - image: circleci/openjdk:8-jdk
    working_directory: ~/squirreljme-build

orbs:
  win: circleci/windows@2.2.0

commands:
  initialize_buildenv:
    description: "Initializes the build environment"
    steps:
      - checkout:
          path: ~/squirreljme
      - run:
          name: Setup directories
          command: mkdir -p ~/squirreljme-build /tmp/summercoat /tmp/summercoat-test
      - run:
          name: Install build-essential
          command: sudo apt-get install --no-install-recommends -y build-essential || true
      - run:
          name: Install crossbuild-essential-powerpc
          command: sudo apt-get install --no-install-recommends -y crossbuild-essential-powerpc || true
      - run:
          name: Install crossbuild-essential-mips
          command: sudo apt-get install --no-install-recommends -y crossbuild-essential-mips || true
      - run:
          name: Install crossbuild-essential-mipsel
          command: sudo apt-get install --no-install-recommends -y crossbuild-essential-mipsel || true
      - run:
          name: Install qemu-user
          command: sudo apt-get install --no-install-recommends -y qemu-user || true
      - run:
          name: Install unzip
          command: sudo apt-get install --no-install-recommends -y unzip || true

jobs:
  build_javase_windows:
    executor:
      name: win/default
      shell: cmd.exe
    steps:
      - checkout:
          path: c:\users\circleci\squirreljme
      - run:
          name: Make build directory
          command: mkdir c:\users\circleci\squirreljme-build
      - run:
          name: Go to build directory
          command: cd c:\users\circleci\squirreljme-build
      - run:
          name: Perform Shaded Java SE Build
          command: c:\users\circleci\squirreljme\build.cmd dist javase
  build_javase:
    executor: buildenv
    steps:
      - initialize_buildenv
      - run:
          name: Shade JavaSE
          command: ~/squirreljme/build.sh dist javase
  build_javame:
    executor: buildenv
    steps:
      - initialize_buildenv


      - run:
          name: Shade JavaME
          command: ~/squirreljme/build.sh dist javame
  build_summercoatrom:
    executor: buildenv
    steps:
      - initialize_buildenv
      - run:
          name: Building SummerCoat ROM
          command: ~/squirreljme/build.sh dist summercoatrom
      - run:
          name: UnZip SummerCoat ROM
          command: unzip -o squirreljme-summercoatrom.zip
      - run:
          name: Copy ROM file
          command: cp -v squirreljme.sqc /tmp/summercoat/squirreljme.sqc
      - persist_to_workspace:
          root: /tmp/summercoat
          paths:
            - squirreljme.sqc
  build_summercoatromtest:
    executor: buildenv
    steps:
      - initialize_buildenv
      - run:
          name: Building SummerCoat Test ROM
          command: ~/squirreljme/build.sh dist summercoatrom-test
      - run:
          name: UnZip SummerCoat ROM
          command: unzip -o squirreljme-summercoatrom-test.zip
      - run:
          name: Copy ROM file
          command: cp -v squirreljme.sqc /tmp/summercoat-test/squirreljme.sqc
      - persist_to_workspace:
          root: /tmp/summercoat-test
          paths:
            - squirreljme.sqc
  tests_baseline:
    executor: buildenv
    steps:
      - initialize_buildenv
      - run:
          name: Clear old test results and snapshot
          command: rm -f bljut/baseline/results.xml baseline.nps
      - run:
          name: Create test directory
          command: mkdir -p bljut/baseline
      - run:
          name: Running Baseline Tests
          command: ~/squirreljme/utils-dev/hostedlaunch.sh tac-runner > bljut/baseline/results.xml
      - store_test_results:
          path: bljut
  tests_springcoat:
    executor: buildenv
    steps:
      - initialize_buildenv
      - run:
          name: Clear old test results and snapshot
          command: rm -f spjut/springcoat/results.xml springcoat.nps
      - run:
          name: Create test directory
          command: mkdir -p spjut/springcoat
      - run:
          name: Running SpringCoat VM
          command: ~/squirreljme/build.sh launch -v springcoat -n springcoat.nps -Dcc.squirreljme.debug=false tac-runner > spjut/springcoat/results.xml
          no_output_timeout: 30m
      - store_test_results:
          path: spjut
      - store_artifacts:
          path: springcoat.nps
          destination: /nps/springcoat.nps
  tests_summercoat:
    executor: buildenv
    steps:
      - initialize_buildenv
      - run:
          name: Clear old test results and snapshot
          command: rm -f sujut/summercoat/results.xml summercoat.nps
      - run:
          name: Create test directory
          command: mkdir -p sujut/summercoat
      - run:
          name: Running SummerCoat VM
          command: ~/squirreljme/build.sh launch -v summercoat -n summercoat.nps -Dcc.squirreljme.debug=false tac-runner > sujut/summercoat/results.xml
      - store_test_results:
          path: sujut
      - store_artifacts:
          path: summercoat.nps
          destination: /nps/summercoat.nps
  tests_summercoatrom:
    executor: buildenv
    steps:
      - initialize_buildenv
      - attach_workspace:
          at: /tmp/summercoat-test
      - run:
          name: Clear old test results and snapshot
          command: rm -f svjut/summercoatrom/results.xml summercoatrom.nps
      - run:
          name: Create test directory
          command: mkdir -p svjut/summercoatrom
      - run:
          name: Take SummerCoat Test ROM
          command: cp -v /tmp/summercoat-test/squirreljme.sqc .


      - run:
          name: Running SummerCoat VM
          command: ~/squirreljme/build.sh launch -v summercoat -n summercoatrom.nps -Dcc.squirreljme.debug=false -Dcc.squirreljme.romfile=squirreljme.sqc tac-runner > svjut/summercoatrom/results.xml
      - store_test_results:
          path: svjut
      - store_artifacts:
          path: summercoatrom.nps
          destination: /nps/summercoatrom.nps
  tests_ratufacoat_default:
    executor: buildenv
    steps:
      - initialize_buildenv
      - attach_workspace:
          at: /tmp/summercoat-test
      - run:
          name: Clear old test results and snapshot
          command: rm -f rdjut/ratufacoatdef/results.xml
      - run:
          name: Create test directory
          command: mkdir -p rdjut/ratufacoatdef
      - run:
          name: Take SummerCoat Test ROM
          command: cp -v /tmp/summercoat-test/squirreljme.sqc .
      - run:
          name: Cleaning RatufaCoat VM (Default)
          command: make -C ~/squirreljme/ratufacoat -f ~/squirreljme/ratufacoat/makefile clean
      - run:
          name: Building RatufaCoat VM (Default)
          command: make -C ~/squirreljme/ratufacoat -f ~/squirreljme/ratufacoat/makefile squirreljme-stdc
      - run:
          name: Running RatufaCoat VM (Default)
          command: ~/squirreljme/ratufacoat/squirreljme-stdc -Dcc.squirreljme.autolaunch=tac-runner > rdjut/ratufacoatdef/results.xml
      - store_test_results:
          path: rdjut
  tests_ratufacoat_ppc:
    executor: buildenv
    steps:
      - initialize_buildenv
      - run:
          name: Halt if compiler not available
          command: if ! which powerpc-linux-gnu-gcc; then circleci-agent step halt; fi
      - attach_workspace:
          at: /tmp/summercoat-test
      - run:
          name: Clear old test results and snapshot
          command: rm -f rpjut/ratufacoatppc/results.xml
      - run:
          name: Create test directory
          command: mkdir -p rpjut/ratufacoatppc
      - run:
          name: Take SummerCoat Test ROM
          command: cp -v /tmp/summercoat-test/squirreljme.sqc .
      - run:
          name: Cleaning RatufaCoat VM (PowerPC)
          command: make -C ~/squirreljme/ratufacoat -f ~/squirreljme/ratufacoat/makefile clean
      - run:
          name: Building RatufaCoat VM (PowerPC)
          command: make -C ~/squirreljme/ratufacoat -f ~/squirreljme/ratufacoat/makefile squirreljme-stdc CC=powerpc-linux-gnu-gcc CFLAGS='-static -DSJME_BIG_ENDIAN'
      - run:
          name: Running RatufaCoat VM (PowerPC)
          command: qemu-ppc ~/squirreljme/ratufacoat/squirreljme-stdc -Dcc.squirreljme.autolaunch=tac-runner > rpjut/ratufacoatppc/results.xml
      - store_test_results:
          path: rpjut
  tests_ratufacoat_mips:
    executor: buildenv
    steps:
      - initialize_buildenv
      - run:
          name: Halt if compiler not available
          command: if ! which mips-linux-gnu-gcc; then circleci-agent step halt; fi
      - attach_workspace:
          at: /tmp/summercoat-test
      - run:
          name: Clear old test results and snapshot
          command: rm -f rmjut/ratufacoatmips/results.xml
      - run:
          name: Create test directory
          command: mkdir -p rmjut/ratufacoatmips
      - run:
          name: Take SummerCoat Test ROM
          command: cp -v /tmp/summercoat-test/squirreljme.sqc .
      - run:
          name: Cleaning RatufaCoat VM (MIPS EB)
          command: make -C ~/squirreljme/ratufacoat -f ~/squirreljme/ratufacoat/makefile clean

      - run:
          name: Building RatufaCoat VM (MIPS EB)
          command: make -C ~/squirreljme/ratufacoat -f ~/squirreljme/ratufacoat/makefile squirreljme-stdc CC=mips-linux-gnu-gcc CFLAGS='-static -DSJME_BIG_ENDIAN'
      - run:
          name: Running RatufaCoat VM (MIPS EB)
          command: qemu-mips ~/squirreljme/ratufacoat/squirreljme-stdc -Dcc.squirreljme.autolaunch=tac-runner > rmjut/ratufacoatmips/results.xml
      - store_test_results:
          path: rmjut
  tests_ratufacoat_mipsel:
    executor: buildenv
    steps:
      - initialize_buildenv
      - run:
          name: Halt if compiler not available
          command: if ! which mipsel-linux-gnu-gcc; then circleci-agent step halt; fi
      - attach_workspace:
          at: /tmp/summercoat-test
      - run:
          name: Clear old test results and snapshot
          command: rm -f rnjut/ratufacoatmipsel/results.xml
      - run:
          name: Create test directory
          command: mkdir -p rnjut/ratufacoatmipsel
      - run:
          name: Take SummerCoat Test ROM
          command: cp -v /tmp/summercoat-test/squirreljme.sqc .
      - run:
          name: Cleaning RatufaCoat VM (MIPS EL)
          command: make -C ~/squirreljme/ratufacoat -f ~/squirreljme/ratufacoat/makefile clean
      - run:
          name: Building RatufaCoat VM (MIPS EL)
          command: make -C ~/squirreljme/ratufacoat -f ~/squirreljme/ratufacoat/makefile squirreljme-stdc CC=mipsel-linux-gnu-gcc CFLAGS='-static -DSJME_LITTLE_ENDIAN'
      - run:
          name: Running RatufaCoat VM (MIPS EL)
          command: qemu-mipsel ~/squirreljme/ratufacoat/squirreljme-stdc -Dcc.squirreljme.autolaunch=tac-runner > rnjut/ratufacoatmipsel/results.xml
      - store_test_results:
          path: rnjut

workflows:
  version: 2
  tests:
    jobs:
      - build_javase
      - build_javame
      - build_javase_windows:
          requires:
            - build_javase
      - tests_baseline:
          requires:
            - build_javase
      - build_summercoatrom:
          requires:
            - build_javase
            - build_javame
      - build_summercoatromtest:
          requires:
            - build_summercoatrom
      - tests_springcoat:
          requires:
            - build_javase
      - tests_summercoat:
          requires:
            - build_javase
      - tests_summercoatrom:
          requires:
            - build_summercoatromtest
      - tests_ratufacoat_default:
          requires:
            - build_summercoatromtest
      - tests_ratufacoat_ppc:
          requires:
            - build_summercoatromtest
      - tests_ratufacoat_mips:
          requires:
            - build_summercoatromtest
      - tests_ratufacoat_mipsel:
          requires:
            - build_summercoatromtest







<




<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<

|




|
<

<
<
<
|
|
<
<
<
<
|
<
<

|
|
<
<
<
<
>
>
|
<
<
<
|
|
<
<
<
<
<
<
<
<
<
<
<
<
|
|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
|
<
|


<
|
<
<

|
|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<

|
|
>
>
|
<
<

|

|
<
<
|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
|
|

<
|
<
<
<
<

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
|
<
<
<
<
<
<
<
<
<
|
<
<

|
|

|
|

|
|
|
<
<
>
|
<
<
<
<
<

|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
|
|





|
|
<
<
|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
9
10
11
12
13
14
15

16
17
18
19




























20
21
22
23
24
25
26

27



28
29




30


31
32
33




34
35
36



37
38












39
40















41

42
43
44

45


46
47
48






















































49
50
51
52
53
54


55
56
57
58


59
























60
61
62

63




64















65









66


67
68
69
70
71
72
73
74
75
76


77
78





79
80



























81
82
83
84
85
86
87
88
89


90































# DESCRIPTION: CircleCI Build Configuration

version: 2.1
executors:
  buildenv:
    docker:
      - image: circleci/openjdk:8-jdk


orbs:
  win: circleci/windows@2.2.0





























jobs:
  build_windows:
    executor:
      name: win/default
      shell: cmd.exe
    steps:
      - checkout

      - run:



          name: Gradle Build
          command: gradlew build --continue --parallel




          shell: cmd.exe


      - run:
          name: Save test results
          command: |




            mkdir -p /c/users/circleci/test-results/junit
            /usr/bin/find . -type f -regex '.*/build/test-results/.*xml' -exec cp {} /c/users/circleci/test-results/junit/ \;
          when: always



          shell: bash.exe
      - store_test_results:












          path: c:\users\circleci\test-results
      - store_artifacts:















          path: c:\users\circleci\test-results

  build_linux:
    executor: buildenv
    steps:

      - checkout


      - run:
          name: Gradle Build
          command: ./gradlew build --continue --parallel






















































      - run:
          name: Save test results
          command: |
            mkdir -p ~/test-results/junit/
            find . -type f -regex '.*/build/test-results/.*xml' -exec cp {} ~/test-results/junit/ \;
          when: always


      - store_test_results:
          path: ~/test-results
      - store_artifacts:
          path: ~/test-results/junit


  build_macosx:
























    macos:
      xcode: 11.3.0
    steps:

      - checkout




      - run:















          name: Update Brew









          command: brew update


      - run:
          name: Install Gradle and OpenJDK 11
          command: brew install gradle openjdk@11
      - run:
          name: Gradle Build
          command: ./gradlew build --continue --parallel
      - run:
          name: Save test results
          command: |
            mkdir -p ~/test-results/junit/


            find . -type f -regex '.*/build/test-results/.*xml' -exec cp {} ~/test-results/junit/ \;
          when: always





      - store_test_results:
          path: ~/test-results



























      - store_artifacts:
          path: ~/test-results/junit

workflows:
  version: 2
  tests:
    jobs:
      - build_windows
      - build_linux


      - build_macosx































Added .fossil-settings/binary-glob.



>
1
gradle/wrapper/gradle-wrapper.jar

Changes to .fossil-settings/ignore-glob.

56
57
58
59
60
61
62
63










64
65
66
67
68
69
70
71
72
73
74
*.a
*.prc
*.dll
*.exe
*.ttyrec
*.patch
*.diff











# Files which should be mime encoded
*.png
*.xcf
*.png
*.bmp
*.mid
*.midi
*.wav
*.aif
*.aiff
*.snd








>
>
>
>
>
>
>
>
>
>

<

<







56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74

75

76
77
78
79
80
81
82
*.a
*.prc
*.dll
*.exe
*.ttyrec
*.patch
*.diff

# Gradle building
.gradle
modules/build
modules/*/build
emulators/build
emulators/*/build
tools/build
tools/*/build
buildSrc/build

# Files which should be mime encoded

*.xcf

*.bmp
*.mid
*.midi
*.wav
*.aif
*.aiff
*.snd

Added .gitattributes.







>
>
>
1
2
3
# Do not automatically adjust line endings so that way the line-feeds are
# the same and consistent
* text=false

Added .github/workflows/build.yaml.

































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
name: Build
on: [push, pull_request]

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - name: Set up JDK 1.8
      uses: actions/setup-java@v1
      with:
        java-version: 1.8
    - name: Grant execute permission for gradlew
      run: chmod +x gradlew
    - name: Build
      run: ./gradlew build --continue --parallel

Added .github/workflows/validate-gradle-wrapper.yaml.





















>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
name: "Validate Gradle Wrapper"
on: [push, pull_request]

jobs:
  validation:
    name: "Validation"
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: gradle/wrapper-validation-action@v1

Changes to .gitignore.

56
57
58
59
60
61
62
63










64
65
66
67
68
69
70
71
72
73
74
*.a
*.prc
*.dll
*.exe
*.ttyrec
*.patch
*.diff











# Files which should be mime encoded
*.png
*.xcf
*.png
*.bmp
*.mid
*.midi
*.wav
*.aif
*.aiff
*.snd








>
>
>
>
>
>
>
>
>
>

<

<







56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74

75

76
77
78
79
80
81
82
*.a
*.prc
*.dll
*.exe
*.ttyrec
*.patch
*.diff

# Gradle building
.gradle
modules/build
modules/*/build
emulators/build
emulators/*/build
tools/build
tools/*/build
buildSrc/build

# Files which should be mime encoded

*.xcf

*.bmp
*.mid
*.midi
*.wav
*.aif
*.aiff
*.snd

Added .idea/checkstyle-idea.xml.



































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
  <component name="CheckStyle-IDEA">
    <option name="configuration">
      <map>
        <entry key="checkstyle-version" value="8.29" />
        <entry key="copy-libs" value="false" />
        <entry key="location-0" value="BUNDLED:(bundled):Sun Checks" />
        <entry key="location-1" value="BUNDLED:(bundled):Google Checks" />
        <entry key="location-2" value="LOCAL_FILE:$PROJECT_DIR$/config/checkstyle/checkstyle.xml:SquirrelJME" />
        <entry key="scan-before-checkin" value="false" />
        <entry key="scanscope" value="JavaOnlyWithTests" />
        <entry key="suppress-errors" value="true" />
      </map>
    </option>
  </component>
</project>

Added .idea/codeStyles/Project.xml.





































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
<component name="ProjectCodeStyleConfiguration">
  <code_scheme name="Project" version="173">
    <option name="OTHER_INDENT_OPTIONS">
      <value>
        <option name="USE_TAB_CHARACTER" value="true" />
      </value>
    </option>
    <option name="LINE_SEPARATOR" value="&#10;" />
    <option name="RIGHT_MARGIN" value="79" />
    <DBN-PSQL>
      <case-options enabled="true">
        <option name="KEYWORD_CASE" value="lower" />
        <option name="FUNCTION_CASE" value="lower" />
        <option name="PARAMETER_CASE" value="lower" />
        <option name="DATATYPE_CASE" value="lower" />
        <option name="OBJECT_CASE" value="preserve" />
      </case-options>
      <formatting-settings enabled="false" />
    </DBN-PSQL>
    <DBN-SQL>
      <case-options enabled="true">
        <option name="KEYWORD_CASE" value="lower" />
        <option name="FUNCTION_CASE" value="lower" />
        <option name="PARAMETER_CASE" value="lower" />
        <option name="DATATYPE_CASE" value="lower" />
        <option name="OBJECT_CASE" value="preserve" />
      </case-options>
      <formatting-settings enabled="false">
        <option name="STATEMENT_SPACING" value="one_line" />
        <option name="CLAUSE_CHOP_DOWN" value="chop_down_if_statement_long" />
        <option name="ITERATION_ELEMENTS_WRAPPING" value="chop_down_if_not_single" />
      </formatting-settings>
    </DBN-SQL>
    <JavaCodeStyleSettings>
      <option name="PARAMETER_NAME_PREFIX" value="__" />
      <option name="TEST_NAME_PREFIX" value="Test" />
      <option name="TEST_NAME_SUFFIX" value="" />
      <option name="SUBCLASS_NAME_SUFFIX" value="" />
      <option name="GENERATE_FINAL_LOCALS" value="true" />
      <option name="REPLACE_NULL_CHECK" value="false" />
      <option name="REPLACE_SUM" value="false" />
      <option name="CLASS_NAMES_IN_JAVADOC" value="3" />
      <option name="CLASS_COUNT_TO_USE_IMPORT_ON_DEMAND" value="99" />
      <option name="NAMES_COUNT_TO_USE_IMPORT_ON_DEMAND" value="99" />
      <option name="PACKAGES_TO_USE_IMPORT_ON_DEMAND">
        <value />
      </option>
      <option name="IMPORT_LAYOUT_TABLE">
        <value>
          <package name="" withSubpackages="true" static="false" />
          <package name="" withSubpackages="true" static="true" />
        </value>
      </option>
      <option name="JD_DO_NOT_WRAP_ONE_LINE_COMMENTS" value="true" />
      <option name="JD_PRESERVE_LINE_FEEDS" value="true" />
      <option name="JD_PARAM_DESCRIPTION_ON_NEW_LINE" value="true" />
    </JavaCodeStyleSettings>
    <codeStyleSettings language="Groovy">
      <indentOptions>
        <option name="CONTINUATION_INDENT_SIZE" value="4" />
        <option name="USE_TAB_CHARACTER" value="true" />
      </indentOptions>
    </codeStyleSettings>
    <codeStyleSettings language="JAVA">
      <option name="KEEP_LINE_BREAKS" value="false" />
      <option name="KEEP_FIRST_COLUMN_COMMENT" value="false" />
      <option name="KEEP_CONTROL_STATEMENT_IN_ONE_LINE" value="false" />
      <option name="BLANK_LINES_BEFORE_PACKAGE" value="1" />
      <option name="BLANK_LINES_AROUND_FIELD" value="1" />
      <option name="BLANK_LINES_AROUND_FIELD_IN_INTERFACE" value="1" />
      <option name="BRACE_STYLE" value="2" />
      <option name="CLASS_BRACE_STYLE" value="2" />
      <option name="METHOD_BRACE_STYLE" value="2" />
      <option name="LAMBDA_BRACE_STYLE" value="3" />
      <option name="ELSE_ON_NEW_LINE" value="true" />
      <option name="CATCH_ON_NEW_LINE" value="true" />
      <option name="FINALLY_ON_NEW_LINE" value="true" />
      <option name="ALIGN_MULTILINE_PARAMETERS" value="false" />
      <option name="SPACE_AFTER_TYPE_CAST" value="false" />
      <option name="SPACE_BEFORE_CLASS_LBRACE" value="false" />
      <option name="SPACE_BEFORE_METHOD_LBRACE" value="false" />
      <option name="SPACE_BEFORE_ARRAY_INITIALIZER_LBRACE" value="true" />
      <option name="CALL_PARAMETERS_WRAP" value="1" />
      <option name="PREFER_PARAMETERS_WRAP" value="true" />
      <option name="METHOD_PARAMETERS_WRAP" value="1" />
      <option name="THROWS_LIST_WRAP" value="1" />
      <option name="EXTENDS_KEYWORD_WRAP" value="2" />
      <option name="THROWS_KEYWORD_WRAP" value="2" />
      <option name="METHOD_CALL_CHAIN_WRAP" value="1" />
      <option name="TERNARY_OPERATION_WRAP" value="1" />
      <option name="ASSIGNMENT_WRAP" value="1" />
      <option name="WRAP_COMMENTS" value="true" />
      <option name="WRAP_LONG_LINES" value="true" />
      <option name="WRAP_ON_TYPING" value="0" />
      <indentOptions>
        <option name="CONTINUATION_INDENT_SIZE" value="4" />
        <option name="USE_TAB_CHARACTER" value="true" />
        <option name="KEEP_INDENTS_ON_EMPTY_LINES" value="true" />
      </indentOptions>
      <arrangement>
        <groups />
        <rules>
          <section>
            <rule>
              <match>
                <AND>
                  <FIELD>true</FIELD>
                  <FINAL>true</FINAL>
                  <PUBLIC>true</PUBLIC>
                  <STATIC>true</STATIC>
                </AND>
              </match>
              <order>BY_NAME</order>
            </rule>
          </section>
          <section>
            <rule>
              <match>
                <AND>
                  <FIELD>true</FIELD>
                  <FINAL>true</FINAL>
                  <PROTECTED>true</PROTECTED>
                  <STATIC>true</STATIC>
                </AND>
              </match>
              <order>BY_NAME</order>
            </rule>
          </section>
          <section>
            <rule>
              <match>
                <AND>
                  <FIELD>true</FIELD>
                  <FINAL>true</FINAL>
                  <PACKAGE_PRIVATE>true</PACKAGE_PRIVATE>
                  <STATIC>true</STATIC>
                </AND>
              </match>
              <order>BY_NAME</order>
            </rule>
          </section>
          <section>
            <rule>
              <match>
                <AND>
                  <FIELD>true</FIELD>
                  <FINAL>true</FINAL>
                  <PRIVATE>true</PRIVATE>
                  <STATIC>true</STATIC>
                </AND>
              </match>
              <order>BY_NAME</order>
            </rule>
          </section>
          <section>
            <rule>
              <match>
                <AND>
                  <FIELD>true</FIELD>
                  <PUBLIC>true</PUBLIC>
                  <STATIC>true</STATIC>
                </AND>
              </match>
              <order>BY_NAME</order>
            </rule>
          </section>
          <section>
            <rule>
              <match>
                <AND>
                  <FIELD>true</FIELD>
                  <PROTECTED>true</PROTECTED>
                  <STATIC>true</STATIC>
                </AND>
              </match>
              <order>BY_NAME</order>
            </rule>
          </section>
          <section>
            <rule>
              <match>
                <AND>
                  <FIELD>true</FIELD>
                  <PACKAGE_PRIVATE>true</PACKAGE_PRIVATE>
                  <STATIC>true</STATIC>
                </AND>
              </match>
              <order>BY_NAME</order>
            </rule>
          </section>
          <section>
            <rule>
              <match>
                <AND>
                  <FIELD>true</FIELD>
                  <PRIVATE>true</PRIVATE>
                  <STATIC>true</STATIC>
                </AND>
              </match>
              <order>BY_NAME</order>
            </rule>
          </section>
          <section>
            <rule>
              <match>
                <AND>
                  <FIELD>true</FIELD>
                  <FINAL>true</FINAL>
                  <PUBLIC>true</PUBLIC>
                </AND>
              </match>
              <order>BY_NAME</order>
            </rule>
          </section>
          <section>
            <rule>
              <match>
                <AND>
                  <FIELD>true</FIELD>
                  <FINAL>true</FINAL>
                  <PROTECTED>true</PROTECTED>
                </AND>
              </match>
              <order>BY_NAME</order>
            </rule>
          </section>
          <section>
            <rule>
              <match>
                <AND>
                  <FIELD>true</FIELD>
                  <FINAL>true</FINAL>
                  <PACKAGE_PRIVATE>true</PACKAGE_PRIVATE>
                </AND>
              </match>
              <order>BY_NAME</order>
            </rule>
          </section>
          <section>
            <rule>
              <match>
                <AND>
                  <FIELD>true</FIELD>
                  <FINAL>true</FINAL>
                  <PRIVATE>true</PRIVATE>
                </AND>
              </match>
              <order>BY_NAME</order>
            </rule>
          </section>
          <section>
            <rule>
              <match>
                <AND>
                  <FIELD>true</FIELD>
                  <PUBLIC>true</PUBLIC>
                </AND>
              </match>
              <order>BY_NAME</order>
            </rule>
          </section>
          <section>
            <rule>
              <match>
                <AND>
                  <FIELD>true</FIELD>
                  <PROTECTED>true</PROTECTED>
                </AND>
              </match>
              <order>BY_NAME</order>
            </rule>
          </section>
          <section>
            <rule>
              <match>
                <AND>
                  <FIELD>true</FIELD>
                  <PACKAGE_PRIVATE>true</PACKAGE_PRIVATE>
                </AND>
              </match>
              <order>BY_NAME</order>
            </rule>
          </section>
          <section>
            <rule>
              <match>
                <AND>
                  <FIELD>true</FIELD>
                  <PRIVATE>true</PRIVATE>
                </AND>
              </match>
              <order>BY_NAME</order>
            </rule>
          </section>
          <section>
            <rule>
              <match>
                <AND>
                  <INITIALIZER_BLOCK>true</INITIALIZER_BLOCK>
                  <STATIC>true</STATIC>
                </AND>
              </match>
            </rule>
          </section>
          <section>
            <rule>
              <match>
                <INITIALIZER_BLOCK>true</INITIALIZER_BLOCK>
              </match>
            </rule>
          </section>
          <section>
            <rule>
              <match>
                <CONSTRUCTOR>true</CONSTRUCTOR>
              </match>
              <order>BY_NAME</order>
            </rule>
          </section>
          <section>
            <rule>
              <match>
                <AND>
                  <ABSTRACT>true</ABSTRACT>
                  <METHOD>true</METHOD>
                  <STATIC>false</STATIC>
                </AND>
              </match>
              <order>BY_NAME</order>
            </rule>
          </section>
          <section>
            <rule>
              <match>
                <AND>
                  <ABSTRACT>false</ABSTRACT>
                  <METHOD>true</METHOD>
                  <PACKAGE_PRIVATE>false</PACKAGE_PRIVATE>
                  <PRIVATE>false</PRIVATE>
                  <STATIC>false</STATIC>
                </AND>
              </match>
              <order>BY_NAME</order>
            </rule>
          </section>
          <section>
            <rule>
              <match>
                <AND>
                  <ABSTRACT>false</ABSTRACT>
                  <METHOD>true</METHOD>
                  <PACKAGE_PRIVATE>true</PACKAGE_PRIVATE>
                  <STATIC>false</STATIC>
                </AND>
              </match>
              <order>BY_NAME</order>
            </rule>
          </section>
          <section>
            <rule>
              <match>
                <AND>
                  <ABSTRACT>false</ABSTRACT>
                  <METHOD>true</METHOD>
                  <PRIVATE>true</PRIVATE>
                  <STATIC>false</STATIC>
                </AND>
              </match>
              <order>BY_NAME</order>
            </rule>
          </section>
          <section>
            <rule>
              <match>
                <AND>
                  <METHOD>true</METHOD>
                  <PUBLIC>true</PUBLIC>
                  <STATIC>true</STATIC>
                </AND>
              </match>
              <order>BY_NAME</order>
            </rule>
          </section>
          <section>
            <rule>
              <match>
                <AND>
                  <METHOD>true</METHOD>
                  <PRIVATE>true</PRIVATE>
                  <STATIC>true</STATIC>
                </AND>
              </match>
              <order>BY_NAME</order>
            </rule>
          </section>
          <section>
            <rule>
              <match>
                <AND>
                  <CLASS>true</CLASS>
                  <STATIC>false</STATIC>
                </AND>
              </match>
              <order>BY_NAME</order>
            </rule>
          </section>
          <section>
            <rule>
              <match>
                <AND>
                  <CLASS>true</CLASS>
                  <STATIC>true</STATIC>
                </AND>
              </match>
              <order>BY_NAME</order>
            </rule>
          </section>
          <section>
            <rule>
              <match>
                <ENUM>true</ENUM>
              </match>
              <order>BY_NAME</order>
            </rule>
          </section>
          <section>
            <rule>
              <match>
                <INTERFACE>true</INTERFACE>
              </match>
              <order>BY_NAME</order>
            </rule>
          </section>
        </rules>
      </arrangement>
    </codeStyleSettings>
    <codeStyleSettings language="Shell Script">
      <indentOptions>
        <option name="INDENT_SIZE" value="4" />
        <option name="TAB_SIZE" value="4" />
        <option name="USE_TAB_CHARACTER" value="true" />
      </indentOptions>
    </codeStyleSettings>
    <codeStyleSettings language="XML">
      <indentOptions>
        <option name="USE_TAB_CHARACTER" value="true" />
      </indentOptions>
    </codeStyleSettings>
  </code_scheme>
</component>

Added .idea/codeStyles/codeStyleConfig.xml.











>
>
>
>
>
1
2
3
4
5
<component name="ProjectCodeStyleConfiguration">
  <state>
    <option name="USE_PER_PROJECT_SETTINGS" value="true" />
  </state>
</component>

Added .idea/compiler.xml.





























































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
  <component name="CompilerConfiguration">
    <bytecodeTargetLevel>
      <module name="squirreljme.emulators.emulator-runner.main" target="8" />
      <module name="squirreljme.emulators.emulator-runner.test" target="8" />
      <module name="squirreljme.main" target="1.7" />
      <module name="squirreljme.modules.all-vms.main" target="1.7" />
      <module name="squirreljme.modules.all-vms.test" target="1.7" />
      <module name="squirreljme.modules.build.main" target="1.7" />
      <module name="squirreljme.modules.build.test" target="1.7" />
      <module name="squirreljme.modules.cldc-compact.testFixtures" target="1.7" />
      <module name="squirreljme.modules.cldc.testFixtures" target="1.7" />
      <module name="squirreljme.modules.collections.testFixtures" target="1.7" />
      <module name="squirreljme.modules.common-vm-stubs.main" target="1.7" />
      <module name="squirreljme.modules.common-vm-stubs.test" target="1.7" />
      <module name="squirreljme.modules.common-vm.testFixtures" target="1.7" />
      <module name="squirreljme.modules.demo-hello.testFixtures" target="1.7" />
      <module name="squirreljme.modules.dio-adc.testFixtures" target="1.7" />
      <module name="squirreljme.modules.dio-atcmd.testFixtures" target="1.7" />
      <module name="squirreljme.modules.dio-counter.testFixtures" target="1.7" />
      <module name="squirreljme.modules.dio-dac.testFixtures" target="1.7" />
      <module name="squirreljme.modules.dio-generic.testFixtures" target="1.7" />
      <module name="squirreljme.modules.dio-gpio.testFixtures" target="1.7" />
      <module name="squirreljme.modules.dio-i2cbus.testFixtures" target="1.7" />
      <module name="squirreljme.modules.dio-mmio.testFixtures" target="1.7" />
      <module name="squirreljme.modules.dio-modem.testFixtures" target="1.7" />
      <module name="squirreljme.modules.dio-pwm.testFixtures" target="1.7" />
      <module name="squirreljme.modules.dio-spibus.testFixtures" target="1.7" />
      <module name="squirreljme.modules.dio-uart.testFixtures" target="1.7" />
      <module name="squirreljme.modules.dio-watchdog.testFixtures" target="1.7" />
      <module name="squirreljme.modules.dio.testFixtures" target="1.7" />
      <module name="squirreljme.modules.gcf.testFixtures" target="1.7" />
      <module name="squirreljme.modules.io.testFixtures" target="1.7" />
      <module name="squirreljme.modules.jblend-api.testFixtures" target="1.7" />
      <module name="squirreljme.modules.launcher.testFixtures" target="1.7" />
      <module name="squirreljme.modules.lcdui-demo.testFixtures" target="1.7" />
      <module name="squirreljme.modules.m3g.testFixtures" target="1.7" />
      <module name="squirreljme.modules.main" target="1.7" />
      <module name="squirreljme.modules.markdown-writer.testFixtures" target="1.7" />
      <module name="squirreljme.modules.media-api.testFixtures" target="1.7" />
      <module name="squirreljme.modules.meep-cellular.testFixtures" target="1.7" />
      <module name="squirreljme.modules.meep-concurrency.testFixtures" target="1.7" />
      <module name="squirreljme.modules.meep-event.testFixtures" target="1.7" />
      <module name="squirreljme.modules.meep-key.testFixtures" target="1.7" />
      <module name="squirreljme.modules.meep-liblets.testFixtures" target="1.7" />
      <module name="squirreljme.modules.meep-lui.testFixtures" target="1.7" />
      <module name="squirreljme.modules.meep-midlet.testFixtures" target="1.7" />
      <module name="squirreljme.modules.meep-power.testFixtures" target="1.7" />
      <module name="squirreljme.modules.meep-provisioning.testFixtures" target="1.7" />
      <module name="squirreljme.modules.meep-rms.testFixtures" target="1.7" />
      <module name="squirreljme.modules.meep-securityframework.testFixtures" target="1.7" />
      <module name="squirreljme.modules.meep-swm.testFixtures" target="1.7" />
      <module name="squirreljme.modules.midp-lcdui.testFixtures" target="1.7" />
      <module name="squirreljme.modules.opengles.testFixtures" target="1.7" />
      <module name="squirreljme.modules.profile-meep.testFixtures" target="1.7" />
      <module name="squirreljme.modules.springcoat-vm.main" target="1.7" />
      <module name="squirreljme.modules.springcoat-vm.test" target="1.7" />
      <module name="squirreljme.modules.squirrel-quarrel.testFixtures" target="1.7" />
      <module name="squirreljme.modules.strings.testFixtures" target="1.7" />
      <module name="squirreljme.modules.summercoat-vm.main" target="1.7" />
      <module name="squirreljme.modules.summercoat-vm.test" target="1.7" />
      <module name="squirreljme.modules.supervisor.main" target="1.7" />
      <module name="squirreljme.modules.supervisor.test" target="1.7" />
      <module name="squirreljme.modules.supervisor.testFixtures" target="1.7" />
      <module name="squirreljme.modules.tac-runner.testFixtures" target="1.7" />
      <module name="squirreljme.modules.tac.testFixtures" target="1.7" />
      <module name="squirreljme.modules.test" target="1.7" />
      <module name="squirreljme.modules.tool-classfile.testFixtures" target="1.7" />
      <module name="squirreljme.modules.tool-compiler.main" target="1.7" />
      <module name="squirreljme.modules.tool-compiler.test" target="1.7" />
      <module name="squirreljme.modules.tool-compiler.testFixtures" target="1.7" />
      <module name="squirreljme.modules.tool-jarfile.testFixtures" target="1.7" />
      <module name="squirreljme.modules.tool-jdwp.testFixtures" target="1.7" />
      <module name="squirreljme.modules.tool-manifest-reader.testFixtures" target="1.7" />
      <module name="squirreljme.modules.tool-manifest-writer.testFixtures" target="1.7" />
      <module name="squirreljme.modules.tool-packfile.testFixtures" target="1.7" />
      <module name="squirreljme.modules.tool-profiler.main" target="1.7" />
      <module name="squirreljme.modules.tool-profiler.test" target="1.7" />
      <module name="squirreljme.modules.tool-profiler.testFixtures" target="1.7" />
      <module name="squirreljme.modules.vodafone-api.testFixtures" target="1.7" />
      <module name="squirreljme.modules.zip.testFixtures" target="1.7" />
      <module name="squirreljme.test" target="1.7" />
      <module name="squirreljme.tools.instruction-popcount.main" target="1.7" />
      <module name="squirreljme.tools.instruction-popcount.test" target="1.7" />
      <module name="squirreljme.tools.javap.main" target="1.7" />
      <module name="squirreljme.tools.javap.test" target="1.7" />
      <module name="squirreljme.tools.sxs.main" target="1.7" />
      <module name="squirreljme.tools.sxs.test" target="1.7" />
      <module name="squirreljme.utilities.main" target="1.7" />
      <module name="squirreljme.utilities.test" target="1.7" />
    </bytecodeTargetLevel>
  </component>
</project>

Added .idea/dictionaries/xer.xml.































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<component name="ProjectDictionaryState">
  <dictionary name="xer">
    <words>
      <w>accel</w>
      <w>backlight</w>
      <w>bootram</w>
      <w>cldc</w>
      <w>endianess</w>
      <w>fprintf</w>
      <w>gawroriski</w>
      <w>ioob</w>
      <w>jarray</w>
      <w>jboolean</w>
      <w>jbyte</w>
      <w>jchar</w>
      <w>jclass</w>
      <w>jdouble</w>
      <w>jfield</w>
      <w>jfloat</w>
      <w>jint</w>
      <w>jlong</w>
      <w>jme's</w>
      <w>jmethod</w>
      <w>jnicall</w>
      <w>jniexport</w>
      <w>jobject</w>
      <w>jshort</w>
      <w>jstring</w>
      <w>jthrowable</w>
      <w>jvalue</w>
      <w>jweak</w>
      <w>multiphasicapps</w>
      <w>narg</w>
      <w>phasic</w>
      <w>siii</w>
      <w>siiii</w>
      <w>siiiii</w>
      <w>siiiiii</w>
      <w>siiiiiii</w>
      <w>siiiiiiii</w>
      <w>squirreljme</w>
      <w>stdint</w>
      <w>targetting</w>
      <w>vtable</w>
    </words>
  </dictionary>
</component>

Added .idea/fileTemplates/includes/File Header.java.

















>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

Added .idea/fileTemplates/internal/AnnotationType.java.

























>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
#parse("File Header.java")

#if (${PACKAGE_NAME} && ${PACKAGE_NAME} != "")package ${PACKAGE_NAME};#end

/**
 * Not Described
 *
 * @since ${YEAR}/${MONTH}/${DAY}
 */
public @interface ${NAME}
{
}

Added .idea/fileTemplates/internal/Class.java.

























>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
#parse("File Header.java")

#if (${PACKAGE_NAME} && ${PACKAGE_NAME} != "")package ${PACKAGE_NAME};#end 

/**
 * Not Described
 *
 * @since ${YEAR}/${MONTH}/${DAY}
 */
public class ${NAME}
{
}

Added .idea/fileTemplates/internal/Enum.java.





























>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#parse("File Header.java")

#if (${PACKAGE_NAME} && ${PACKAGE_NAME} != "")package ${PACKAGE_NAME};#end

/**
 * Not Described
 *
 * @since ${YEAR}/${MONTH}/${DAY}
 */
public enum ${NAME}
{
	/** End. */
	;
}

Added .idea/fileTemplates/internal/Interface.java.

























>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
#parse("File Header.java")

#if (${PACKAGE_NAME} && ${PACKAGE_NAME} != "")package ${PACKAGE_NAME};#end

/**
 * Not Described
 *
 * @since ${YEAR}/${MONTH}/${DAY}
 */
public interface ${NAME}
{
}

Added .idea/fileTemplates/internal/package-info.java.







>
>
>
1
2
3
#parse("File Header.java")

#if (${PACKAGE_NAME} && ${PACKAGE_NAME} != "")package ${PACKAGE_NAME};#end

Added .idea/gradle.xml.



















































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
  <component name="GradleMigrationSettings" migrationVersion="1" />
  <component name="GradleSettings">
    <option name="linkedExternalProjectsSettings">
      <GradleProjectSettings>
        <option name="delegatedBuild" value="true" />
        <option name="testRunner" value="GRADLE" />
        <option name="distributionType" value="DEFAULT_WRAPPED" />
        <option name="externalProjectPath" value="$PROJECT_DIR$" />
        <option name="gradleJvm" value="1.8" />
        <option name="modules">
          <set>
            <option value="$PROJECT_DIR$" />
            <option value="$PROJECT_DIR$/buildSrc" />
            <option value="$PROJECT_DIR$/emulators" />
            <option value="$PROJECT_DIR$/emulators/emulator-base" />
            <option value="$PROJECT_DIR$/emulators/springcoat-vm" />
            <option value="$PROJECT_DIR$/emulators/summercoat-vm" />
            <option value="$PROJECT_DIR$/modules" />
            <option value="$PROJECT_DIR$/modules/cldc" />
            <option value="$PROJECT_DIR$/modules/cldc-compact" />
            <option value="$PROJECT_DIR$/modules/collections" />
            <option value="$PROJECT_DIR$/modules/common-vm" />
            <option value="$PROJECT_DIR$/modules/demo-hello" />
            <option value="$PROJECT_DIR$/modules/dio" />
            <option value="$PROJECT_DIR$/modules/dio-adc" />
            <option value="$PROJECT_DIR$/modules/dio-atcmd" />
            <option value="$PROJECT_DIR$/modules/dio-counter" />
            <option value="$PROJECT_DIR$/modules/dio-dac" />
            <option value="$PROJECT_DIR$/modules/dio-generic" />
            <option value="$PROJECT_DIR$/modules/dio-gpio" />
            <option value="$PROJECT_DIR$/modules/dio-i2cbus" />
            <option value="$PROJECT_DIR$/modules/dio-mmio" />
            <option value="$PROJECT_DIR$/modules/dio-modem" />
            <option value="$PROJECT_DIR$/modules/dio-pwm" />
            <option value="$PROJECT_DIR$/modules/dio-spibus" />
            <option value="$PROJECT_DIR$/modules/dio-uart" />
            <option value="$PROJECT_DIR$/modules/dio-watchdog" />
            <option value="$PROJECT_DIR$/modules/gcf" />
            <option value="$PROJECT_DIR$/modules/io" />
            <option value="$PROJECT_DIR$/modules/jblend-api" />
            <option value="$PROJECT_DIR$/modules/launcher" />
            <option value="$PROJECT_DIR$/modules/lcdui-demo" />
            <option value="$PROJECT_DIR$/modules/m3g" />
            <option value="$PROJECT_DIR$/modules/markdown-writer" />
            <option value="$PROJECT_DIR$/modules/media-api" />
            <option value="$PROJECT_DIR$/modules/meep-cellular" />
            <option value="$PROJECT_DIR$/modules/meep-concurrency" />
            <option value="$PROJECT_DIR$/modules/meep-event" />
            <option value="$PROJECT_DIR$/modules/meep-key" />
            <option value="$PROJECT_DIR$/modules/meep-liblets" />
            <option value="$PROJECT_DIR$/modules/meep-lui" />
            <option value="$PROJECT_DIR$/modules/meep-midlet" />
            <option value="$PROJECT_DIR$/modules/meep-power" />
            <option value="$PROJECT_DIR$/modules/meep-provisioning" />
            <option value="$PROJECT_DIR$/modules/meep-rms" />
            <option value="$PROJECT_DIR$/modules/meep-securityframework" />
            <option value="$PROJECT_DIR$/modules/meep-swm" />
            <option value="$PROJECT_DIR$/modules/midp-lcdui" />
            <option value="$PROJECT_DIR$/modules/opengles" />
            <option value="$PROJECT_DIR$/modules/profile-meep" />
            <option value="$PROJECT_DIR$/modules/squirrel-quarrel" />
            <option value="$PROJECT_DIR$/modules/strings" />
            <option value="$PROJECT_DIR$/modules/tac" />
            <option value="$PROJECT_DIR$/modules/tac-runner" />
            <option value="$PROJECT_DIR$/modules/tool-classfile" />
            <option value="$PROJECT_DIR$/modules/tool-jarfile" />
            <option value="$PROJECT_DIR$/modules/tool-jdwp" />
            <option value="$PROJECT_DIR$/modules/tool-manifest-reader" />
            <option value="$PROJECT_DIR$/modules/tool-manifest-writer" />
            <option value="$PROJECT_DIR$/modules/tool-packfile" />
            <option value="$PROJECT_DIR$/modules/vodafone-api" />
            <option value="$PROJECT_DIR$/modules/zip" />
            <option value="$PROJECT_DIR$/tools" />
            <option value="$PROJECT_DIR$/tools/dump-class" />
            <option value="$PROJECT_DIR$/tools/dump-zip" />
            <option value="$PROJECT_DIR$/tools/pcf-to-sqf" />
            <option value="$PROJECT_DIR$/tools/sqf-to-c" />
            <option value="$PROJECT_DIR$/tools/txt-to-pbm" />
            <option value="$PROJECT_DIR$/tools/uudecode" />
          </set>
        </option>
        <option name="useAutoImport" value="true" />
        <option name="useQualifiedModuleNames" value="true" />
      </GradleProjectSettings>
    </option>
  </component>
</project>

Added .idea/inspectionProfiles/Project_Default.xml.





























































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
<component name="InspectionProjectProfileManager">
  <profile version="1.0">
    <option name="myName" value="Project Default" />
    <inspection_tool class="AbstractClassWithOnlyOneDirectInheritor" enabled="true" level="WARNING" enabled_by_default="true" />
    <inspection_tool class="AbstractMethodOverridesAbstractMethod" enabled="true" level="WARNING" enabled_by_default="true">
      <option name="ignoreJavaDoc" value="true" />
    </inspection_tool>
    <inspection_tool class="Anonymous2MethodRef" enabled="false" level="WARNING" enabled_by_default="false" />
    <inspection_tool class="AnonymousClassComplexity" enabled="true" level="WARNING" enabled_by_default="true">
      <option name="m_limit" value="3" />
    </inspection_tool>
    <inspection_tool class="AnonymousClassMethodCount" enabled="true" level="WARNING" enabled_by_default="true">
      <option name="m_limit" value="1" />
    </inspection_tool>
    <inspection_tool class="AnonymousHasLambdaAlternative" enabled="false" level="WARNING" enabled_by_default="false" />
    <inspection_tool class="AnonymousInnerClass" enabled="true" level="WARNING" enabled_by_default="true" />
    <inspection_tool class="ArrayLengthInLoopCondition" enabled="true" level="WARNING" enabled_by_default="true" />
    <inspection_tool class="AssertEqualsBetweenInconvertibleTypes" enabled="false" level="WARNING" enabled_by_default="false" />
    <inspection_tool class="AssignmentUsedAsCondition" enabled="true" level="WARNING" enabled_by_default="true" />
    <inspection_tool class="AutoCloseableResource" enabled="true" level="WARNING" enabled_by_default="true" />
    <inspection_tool class="BeforeClassOrAfterClassIsPublicStaticVoidNoArg" enabled="false" level="WARNING" enabled_by_default="false" />
    <inspection_tool class="BeforeOrAfterIsPublicVoidNoArg" enabled="false" level="WARNING" enabled_by_default="false" />
    <inspection_tool class="BooleanMethodNameMustStartWithQuestion" enabled="false" level="WEAK WARNING" enabled_by_default="false">
      <option name="ignoreBooleanMethods" value="false" />
      <option name="ignoreInAnnotationInterface" value="true" />
      <option name="onlyWarnOnBaseMethods" value="true" />
      <option name="questionString" value="add,are,can,check,contains,could,endsWith,equals,has,is,matches,must,put,remove,shall,should,startsWith,was,were,will,would" />
    </inspection_tool>
    <inspection_tool class="CheckForOutOfMemoryOnLargeArrayAllocation" enabled="true" level="WARNING" enabled_by_default="true">
      <option name="m_limit" value="64" />
    </inspection_tool>
    <inspection_tool class="ClassComplexity" enabled="true" level="WARNING" enabled_by_default="true">
      <option name="m_limit" value="80" />
    </inspection_tool>
    <inspection_tool class="ClassCoupling" enabled="true" level="WARNING" enabled_by_default="true">
      <option name="m_includeJavaClasses" value="false" />
      <option name="m_includeLibraryClasses" value="false" />
      <option name="m_limit" value="15" />
    </inspection_tool>
    <inspection_tool class="ClassName" enabled="true" level="WEAK WARNING" enabled_by_default="true">
      <option name="namePattern" value="(__)?[A-Z][A-Za-z\d]*(__)?" />
    </inspection_tool>
    <inspection_tool class="ClassNamePrefixedWithPackageName" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
    <inspection_tool class="ClassNameSameAsAncestorName" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
    <inspection_tool class="ClassWithOnlyPrivateConstructors" enabled="true" level="WARNING" enabled_by_default="true" />
    <inspection_tool class="CloneReturnsClassType" enabled="true" level="WARNING" enabled_by_default="true" />
    <inspection_tool class="CodeBlock2Expr" enabled="false" level="WARNING" enabled_by_default="false" />
    <inspection_tool class="ComparatorCombinators" enabled="false" level="WARNING" enabled_by_default="false" />
    <inspection_tool class="ComparisonOfShortAndChar" enabled="true" level="WARNING" enabled_by_default="true" />
    <inspection_tool class="ConfusingMainMethod" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
    <inspection_tool class="ConnectionResource" enabled="true" level="WARNING" enabled_by_default="true" />
    <inspection_tool class="ConstPropertyName" enabled="true" level="WEAK WARNING" enabled_by_default="true">
      <option name="namePattern" value="_?[A-Z][_A-Z\d]*" />
    </inspection_tool>
    <inspection_tool class="ConstructorCount" enabled="true" level="WARNING" enabled_by_default="true">
      <option name="ignoreDeprecatedConstructors" value="true" />
      <option name="m_limit" value="8" />
    </inspection_tool>
    <inspection_tool class="Convert2Diamond" enabled="false" level="WARNING" enabled_by_default="false" />
    <inspection_tool class="Convert2Lambda" enabled="false" level="WARNING" enabled_by_default="false" />
    <inspection_tool class="Convert2MethodRef" enabled="false" level="WARNING" enabled_by_default="false" />
    <inspection_tool class="Convert2streamapi" enabled="false" level="INFORMATION" enabled_by_default="false" />
    <inspection_tool class="DefaultNotLastCaseInSwitch" enabled="true" level="WARNING" enabled_by_default="true" />
    <inspection_tool class="DollarSignInName" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
    <inspection_tool class="EmptyMethod" enabled="true" level="WARNING" enabled_by_default="true">
      <option name="EXCLUDE_ANNOS">
        <value>
          <list size="0" />
        </value>
      </option>
      <option name="commentsAreContent" value="true" />
    </inspection_tool>
    <inspection_tool class="EnhancedSwitchBackwardMigration" enabled="false" level="INFORMATION" enabled_by_default="false" />
    <inspection_tool class="EnhancedSwitchMigration" enabled="false" level="WARNING" enabled_by_default="false" />
    <inspection_tool class="ExceptionNameDoesntEndWithException" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
    <inspection_tool class="ExplicitArgumentCanBeLambda" enabled="false" level="INFORMATION" enabled_by_default="false" />
    <inspection_tool class="ExtendsUtilityClass" enabled="true" level="WARNING" enabled_by_default="true" />
    <inspection_tool class="FeatureEnvy" enabled="true" level="WARNING" enabled_by_default="true">
      <option name="ignoreTestCases" value="false" />
    </inspection_tool>
    <inspection_tool class="FieldNamingConvention" enabled="true" level="WEAK WARNING" enabled_by_default="true">
      <extension name="ConstantNamingConvention" enabled="true">
        <option name="m_regex" value="_?[a-zA-Z][A-Z_\d]*" />
        <option name="m_minLength" value="2" />
        <option name="m_maxLength" value="32" />
      </extension>
      <extension name="ConstantWithMutableFieldTypeNamingConvention" enabled="true">
        <option name="m_regex" value="_?[a-z][a-zA-z_]*" />
        <option name="m_minLength" value="2" />
        <option name="m_maxLength" value="32" />
      </extension>
      <extension name="EnumeratedConstantNamingConvention" enabled="true">
        <option name="m_regex" value="[A-Z][A-Z_\d]*" />
        <option name="m_minLength" value="2" />
        <option name="m_maxLength" value="40" />
      </extension>
      <extension name="InstanceVariableNamingConvention" enabled="true">
        <option name="m_regex" value="_?[a-z][a-zA-z_]*" />
        <option name="m_minLength" value="2" />
        <option name="m_maxLength" value="32" />
      </extension>
      <extension name="StaticVariableNamingConvention" enabled="true">
        <option name="m_regex" value="_?[A-Z][A-Z_\d]*" />
        <option name="m_minLength" value="2" />
        <option name="m_maxLength" value="32" />
      </extension>
    </inspection_tool>
    <inspection_tool class="Finalize" enabled="true" level="ERROR" enabled_by_default="true">
      <option name="ignoreTrivialFinalizers" value="false" />
    </inspection_tool>
    <inspection_tool class="FinalizeNotProtected" enabled="true" level="ERROR" enabled_by_default="true" />
    <inspection_tool class="FoldExpressionIntoStream" enabled="false" level="INFORMATION" enabled_by_default="false" />
    <inspection_tool class="FunctionName" enabled="true" level="WEAK WARNING" enabled_by_default="true">
      <option name="namePattern" value="(__)?[a-z][A-Za-z\d]*" />
    </inspection_tool>
    <inspection_tool class="Guava" enabled="false" level="WARNING" enabled_by_default="false" />
    <inspection_tool class="HtmlTagCanBeJavadocTag" enabled="true" level="WARNING" enabled_by_default="true" />
    <inspection_tool class="IfCanBeSwitch" enabled="false" level="WARNING" enabled_by_default="false">
      <option name="minimumBranches" value="3" />
      <option name="suggestIntSwitches" value="false" />
      <option name="suggestEnumSwitches" value="false" />
    </inspection_tool>
    <inspection_tool class="InconsistentLineSeparators" enabled="true" level="TYPO" enabled_by_default="true" />
    <inspection_tool class="IndexOfReplaceableByContains" enabled="false" level="WARNING" enabled_by_default="false" />
    <inspection_tool class="InterfaceWithOnlyOneDirectInheritor" enabled="true" level="WARNING" enabled_by_default="true" />
    <inspection_tool class="JUnit4AnnotatedMethodInJUnit3TestCase" enabled="false" level="WARNING" enabled_by_default="false" />
    <inspection_tool class="JUnit5MalformedNestedClass" enabled="false" level="WARNING" enabled_by_default="false" />
    <inspection_tool class="JUnit5MalformedParameterized" enabled="false" level="WARNING" enabled_by_default="false" />
    <inspection_tool class="JUnit5MalformedRepeated" enabled="false" level="WARNING" enabled_by_default="false" />
    <inspection_tool class="JUnit5Platform" enabled="false" level="WARNING" enabled_by_default="false" />
    <inspection_tool class="Java8CollectionRemoveIf" enabled="false" level="WARNING" enabled_by_default="false" />
    <inspection_tool class="Java8ListSort" enabled="false" level="WARNING" enabled_by_default="false" />
    <inspection_tool class="Java8MapApi" enabled="false" level="WARNING" enabled_by_default="false" />
    <inspection_tool class="Java8MapForEach" enabled="false" level="WARNING" enabled_by_default="false" />
    <inspection_tool class="Java9CollectionFactory" enabled="false" level="WARNING" enabled_by_default="false" />
    <inspection_tool class="JavaDoc" enabled="true" level="WARNING" enabled_by_default="true">
      <option name="TOP_LEVEL_CLASS_OPTIONS">
        <value>
          <option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
          <option name="REQUIRED_TAGS" value="" />
        </value>
      </option>
      <option name="INNER_CLASS_OPTIONS">
        <value>
          <option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
          <option name="REQUIRED_TAGS" value="" />
        </value>
      </option>
      <option name="METHOD_OPTIONS">
        <value>
          <option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
          <option name="REQUIRED_TAGS" value="@return@param@throws or @exception" />
        </value>
      </option>
      <option name="FIELD_OPTIONS">
        <value>
          <option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
          <option name="REQUIRED_TAGS" value="" />
        </value>
      </option>
      <option name="IGNORE_DEPRECATED" value="false" />
      <option name="IGNORE_JAVADOC_PERIOD" value="true" />
      <option name="IGNORE_DUPLICATED_THROWS" value="false" />
      <option name="IGNORE_POINT_TO_ITSELF" value="false" />
      <option name="myAdditionalJavadocTags" value="squirreljme.syscallparam,squirreljme.syscallreturn,squirreljme.property,squirreljme.error,squirreljme.property" />
    </inspection_tool>
    <inspection_tool class="JavaLangImport" enabled="true" level="WARNING" enabled_by_default="true" />
    <inspection_tool class="JavaModuleNaming" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
    <inspection_tool class="JavaRequiresAutoModule" enabled="false" level="WARNING" enabled_by_default="false" />
    <inspection_tool class="LambdaBodyCanBeCodeBlock" enabled="false" level="INFORMATION" enabled_by_default="false" />
    <inspection_tool class="LambdaCanBeMethodCall" enabled="false" level="INFORMATION" enabled_by_default="false" />
    <inspection_tool class="LambdaCanBeReplacedWithAnonymous" enabled="false" level="INFORMATION" enabled_by_default="false" />
    <inspection_tool class="LambdaParameterNamingConvention" enabled="true" level="WEAK WARNING" enabled_by_default="true">
      <option name="m_regex" value="__[a-z][A-Za-z\d]*" />
    </inspection_tool>
    <inspection_tool class="LambdaParameterTypeCanBeSpecified" enabled="false" level="INFORMATION" enabled_by_default="false" />
    <inspection_tool class="LambdaUnfriendlyMethodOverload" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
    <inspection_tool class="LocalVariableName" enabled="true" level="WEAK WARNING" enabled_by_default="true">
      <option name="namePattern" value="(__)?[a-z][A-Za-z\d]*" />
    </inspection_tool>
    <inspection_tool class="LocalVariableNamingConvention" enabled="true" level="WEAK WARNING" enabled_by_default="true">
      <option name="m_ignoreForLoopParameters" value="true" />
      <option name="m_ignoreCatchParameters" value="true" />
      <option name="m_regex" value="(__)?[a-z][A-Za-z\d]*" />
      <option name="m_minLength" value="1" />
      <option name="m_maxLength" value="20" />
    </inspection_tool>
    <inspection_tool class="LongLine" enabled="true" level="TYPO" enabled_by_default="true" />
    <inspection_tool class="MagicNumber" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
    <inspection_tool class="MethodCallInLoopCondition" enabled="true" level="WARNING" enabled_by_default="true" />
    <inspection_tool class="MethodNameSameAsClassName" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
    <inspection_tool class="MethodNameSameAsParentName" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
    <inspection_tool class="MethodRefCanBeReplacedWithLambda" enabled="false" level="INFORMATION" enabled_by_default="false" />
    <inspection_tool class="MissingOverrideAnnotation" enabled="true" level="ERROR" enabled_by_default="true">
      <option name="ignoreObjectMethods" value="false" />
      <option name="ignoreAnonymousClassMethods" value="false" />
    </inspection_tool>
    <inspection_tool class="MissingPackageInfo" enabled="true" level="WARNING" enabled_by_default="true" />
    <inspection_tool class="MissortedModifiers" enabled="true" level="WARNING" enabled_by_default="true">
      <option name="m_requireAnnotationsFirst" value="true" />
    </inspection_tool>
    <inspection_tool class="MisspelledMethodName" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
    <inspection_tool class="MultiplyOrDivideByPowerOfTwo" enabled="true" level="WARNING" enabled_by_default="true">
      <option name="checkDivision" value="true" />
    </inspection_tool>
    <inspection_tool class="NewClassNamingConvention" enabled="true" level="WARNING" enabled_by_default="true">
      <extension name="AbstractClassNamingConvention" enabled="true">
        <option name="inheritDefaultSettings" value="true" />
        <option name="m_regex" value="[A-Z][A-Za-z\d]*" />
        <option name="m_minLength" value="8" />
        <option name="m_maxLength" value="64" />
      </extension>
      <extension name="AnnotationNamingConvention" enabled="true">
        <option name="inheritDefaultSettings" value="true" />
        <option name="m_regex" value="[A-Z][A-Za-z\d]*" />
        <option name="m_minLength" value="8" />
        <option name="m_maxLength" value="64" />
      </extension>
      <extension name="ClassNamingConvention" enabled="true">
        <option name="m_regex" value="(__)?[A-Z][A-Za-z\d]*(__)?" />
        <option name="m_minLength" value="2" />
        <option name="m_maxLength" value="64" />
      </extension>
      <extension name="EnumeratedClassNamingConvention" enabled="true">
        <option name="inheritDefaultSettings" value="true" />
        <option name="m_regex" value="[A-Z][A-Za-z\d]*" />
        <option name="m_minLength" value="8" />
        <option name="m_maxLength" value="64" />
      </extension>
      <extension name="InterfaceNamingConvention" enabled="true">
        <option name="inheritDefaultSettings" value="true" />
        <option name="m_regex" value="[A-Z][A-Za-z\d]*" />
        <option name="m_minLength" value="8" />
        <option name="m_maxLength" value="64" />
      </extension>
      <extension name="TypeParameterNamingConvention" enabled="true">
        <option name="m_regex" value="[A-Z]" />
        <option name="m_minLength" value="1" />
        <option name="m_maxLength" value="1" />
      </extension>
    </inspection_tool>
    <inspection_tool class="NewMethodNamingConvention" enabled="true" level="WEAK WARNING" enabled_by_default="true">
      <extension name="InstanceMethodNamingConvention" enabled="true">
        <option name="m_regex" value="(__)?[a-z][A-Za-z\d]*" />
        <option name="m_minLength" value="2" />
        <option name="m_maxLength" value="32" />
      </extension>
      <extension name="NativeMethodNamingConvention" enabled="true">
        <option name="m_regex" value="(__)?[a-z][A-Za-z\d]*" />
        <option name="m_minLength" value="2" />
        <option name="m_maxLength" value="32" />
      </extension>
      <extension name="StaticMethodNamingConvention" enabled="true">
        <option name="m_regex" value="(__)?[a-z][A-Za-z\d]*" />
        <option name="m_minLength" value="2" />
        <option name="m_maxLength" value="32" />
      </extension>
    </inspection_tool>
    <inspection_tool class="NoExplicitFinalizeCalls" enabled="true" level="ERROR" enabled_by_default="true" />
    <inspection_tool class="NonBooleanMethodNameMayNotStartWithQuestion" enabled="false" level="WEAK WARNING" enabled_by_default="false">
      <option name="questionString" value="add,are,can,check,contains,could,endsWith,equals,has,is,matches,must,put,remove,shall,should,startsWith,was,were,will,would" />
      <option name="ignoreBooleanMethods" value="false" />
      <option name="onlyWarnOnBaseMethods" value="true" />
    </inspection_tool>
    <inspection_tool class="NonExceptionNameEndsWithException" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
    <inspection_tool class="NonPublicClone" enabled="true" level="WARNING" enabled_by_default="true" />
    <inspection_tool class="NotNullFieldNotInitialized" enabled="false" level="WARNING" enabled_by_default="false" />
    <inspection_tool class="NullableProblems" enabled="false" level="WARNING" enabled_by_default="false">
      <option name="REPORT_NULLABLE_METHOD_OVERRIDES_NOTNULL" value="true" />
      <option name="REPORT_NOT_ANNOTATED_METHOD_OVERRIDES_NOTNULL" value="true" />
      <option name="REPORT_NOTNULL_PARAMETER_OVERRIDES_NULLABLE" value="true" />
      <option name="REPORT_NOT_ANNOTATED_PARAMETER_OVERRIDES_NOTNULL" value="true" />
      <option name="REPORT_NOT_ANNOTATED_GETTER" value="true" />
      <option name="REPORT_NOT_ANNOTATED_SETTER_PARAMETER" value="true" />
      <option name="REPORT_ANNOTATION_NOT_PROPAGATED_TO_OVERRIDERS" value="true" />
      <option name="REPORT_NULLS_PASSED_TO_NON_ANNOTATED_METHOD" value="true" />
    </inspection_tool>
    <inspection_tool class="OctalLiteral" enabled="false" level="WARNING" enabled_by_default="false" />
    <inspection_tool class="OnDemandImport" enabled="true" level="ERROR" enabled_by_default="true" />
    <inspection_tool class="OverloadedMethodsWithSameNumberOfParameters" enabled="false" level="WEAK WARNING" enabled_by_default="false">
      <option name="ignoreInconvertibleTypes" value="true" />
    </inspection_tool>
    <inspection_tool class="OverloadedVarargsMethod" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
    <inspection_tool class="OverlyLargePrimitiveArrayInitializer" enabled="true" level="WARNING" enabled_by_default="true">
      <option name="m_limit" value="64" />
    </inspection_tool>
    <inspection_tool class="PackageInfoWithoutPackage" enabled="true" level="WARNING" enabled_by_default="true" />
    <inspection_tool class="PackageNamingConvention" enabled="true" level="WEAK WARNING" enabled_by_default="true">
      <option name="m_regex" value="[a-z]*" />
      <option name="m_minLength" value="2" />
      <option name="m_maxLength" value="16" />
    </inspection_tool>
    <inspection_tool class="ParameterNameDiffersFromOverriddenParameter" enabled="false" level="WEAK WARNING" enabled_by_default="false">
      <option name="m_ignoreSingleCharacterNames" value="false" />
      <option name="m_ignoreOverridesOfLibraryMethods" value="false" />
    </inspection_tool>
    <inspection_tool class="ParameterNamingConvention" enabled="true" level="WARNING" enabled_by_default="true">
      <option name="m_regex" value="__[a-z][A-Za-z\d]*" />
      <option name="m_minLength" value="3" />
      <option name="m_maxLength" value="20" />
    </inspection_tool>
    <inspection_tool class="ParameterTypePreventsOverriding" enabled="true" level="WARNING" enabled_by_default="true" />
    <inspection_tool class="PrivateMemberAccessBetweenOuterAndInnerClass" enabled="true" level="WARNING" enabled_by_default="true" />
    <inspection_tool class="QuestionableName" enabled="false" level="WEAK WARNING" enabled_by_default="false">
      <option name="nameString" value="aa,abc,bad,bar,bar2,baz,baz1,baz2,baz3,bb,blah,bogus,bool,cc,dd,defau1t,dummy,dummy2,ee,fa1se,ff,foo,foo1,foo2,foo3,foobar,four,fred,fred1,fred2,gg,hh,hello,hello1,hello2,hello3,ii,nu11,one,silly,silly2,string,two,that,then,three,whi1e,var" />
    </inspection_tool>
    <inspection_tool class="ReadWriteStringCanBeUsed" enabled="false" level="WARNING" enabled_by_default="false" />
    <inspection_tool class="RecordStoreResource" enabled="true" level="WARNING" enabled_by_default="true" />
    <inspection_tool class="RedundantExplicitVariableType" enabled="false" level="INFORMATION" enabled_by_default="false" />
    <inspection_tool class="RedundantFieldInitialization" enabled="true" level="WARNING" enabled_by_default="true" />
    <inspection_tool class="RedundantImplements" enabled="true" level="WARNING" enabled_by_default="true">
      <option name="ignoreSerializable" value="false" />
      <option name="ignoreCloneable" value="false" />
    </inspection_tool>
    <inspection_tool class="RedundantTypeArguments" enabled="false" level="WARNING" enabled_by_default="false" />
    <inspection_tool class="ReplaceNullCheck" enabled="false" level="WARNING" enabled_by_default="false" />
    <inspection_tool class="SamePackageImport" enabled="true" level="WARNING" enabled_by_default="true" />
    <inspection_tool class="SimplifiableJUnitAssertion" enabled="false" level="WARNING" enabled_by_default="false" />
    <inspection_tool class="SimplifyForEach" enabled="false" level="INFORMATION" enabled_by_default="false" />
    <inspection_tool class="Since15" enabled="false" level="ERROR" enabled_by_default="false" />
    <inspection_tool class="SingleCharacterStartsWith" enabled="true" level="WARNING" enabled_by_default="true" />
    <inspection_tool class="SizeReplaceableByIsEmpty" enabled="true" level="WARNING" enabled_by_default="true" />
    <inspection_tool class="StandardVariableNames" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
    <inspection_tool class="StaticCallOnSubclass" enabled="true" level="WARNING" enabled_by_default="true" />
    <inspection_tool class="StaticFieldReferenceOnSubclass" enabled="true" level="WARNING" enabled_by_default="true" />
    <inspection_tool class="StaticImport" enabled="true" level="ERROR" enabled_by_default="true" />
    <inspection_tool class="StaticInheritance" enabled="true" level="WARNING" enabled_by_default="true" />
    <inspection_tool class="StaticPseudoFunctionalStyleMethod" enabled="false" level="WARNING" enabled_by_default="false" />
    <inspection_tool class="StaticSuite" enabled="false" level="WARNING" enabled_by_default="false" />
    <inspection_tool class="StaticVariableInitialization" enabled="true" level="WARNING" enabled_by_default="true">
      <option name="m_ignorePrimitives" value="false" />
    </inspection_tool>
    <inspection_tool class="StaticVariableUninitializedUse" enabled="true" level="WARNING" enabled_by_default="true">
      <option name="m_ignorePrimitives" value="false" />
    </inspection_tool>
    <inspection_tool class="StringRepeatCanBeUsed" enabled="false" level="WARNING" enabled_by_default="false" />
    <inspection_tool class="SystemGetenv" enabled="true" level="ERROR" enabled_by_default="true" />
    <inspection_tool class="TestFailedLine" enabled="false" level="WARNING" enabled_by_default="false" />
    <inspection_tool class="TestMethodIsPublicVoidNoArg" enabled="false" level="WARNING" enabled_by_default="false" />
    <inspection_tool class="TextBlockBackwardMigration" enabled="false" level="INFORMATION" enabled_by_default="false" />
    <inspection_tool class="TextBlockMigration" enabled="false" level="WARNING" enabled_by_default="false" />
    <inspection_tool class="ToArrayCallWithZeroLengthArrayArgument" enabled="false" level="WARNING" enabled_by_default="false" />
    <inspection_tool class="TodoComment" enabled="true" level="WARNING" enabled_by_default="true" />
    <inspection_tool class="UnaryPlus" enabled="true" level="WARNING" enabled_by_default="true" />
    <inspection_tool class="UnconstructableTestCase" enabled="false" level="WARNING" enabled_by_default="false" />
    <inspection_tool class="UnnecessaryConstructor" enabled="true" level="WARNING" enabled_by_default="true" />
    <inspection_tool class="UnnecessaryFinalOnLocalVariableOrParameter" enabled="true" level="WARNING" enabled_by_default="true" />
    <inspection_tool class="UnnecessarySuperConstructor" enabled="true" level="WARNING" enabled_by_default="true" />
    <inspection_tool class="UnnecessarySuperQualifier" enabled="true" level="WARNING" enabled_by_default="true" />
    <inspection_tool class="UnqualifiedFieldAccess" enabled="true" level="WARNING" enabled_by_default="true" />
    <inspection_tool class="UnqualifiedInnerClassAccess" enabled="true" level="WARNING" enabled_by_default="true">
      <option name="ignoreReferencesToLocalInnerClasses" value="true" />
    </inspection_tool>
    <inspection_tool class="UnqualifiedMethodAccess" enabled="true" level="WARNING" enabled_by_default="true" />
    <inspection_tool class="UnqualifiedStaticUsage" enabled="true" level="WARNING" enabled_by_default="true">
      <option name="m_ignoreStaticFieldAccesses" value="false" />
      <option name="m_ignoreStaticMethodCalls" value="false" />
      <option name="m_ignoreStaticAccessFromStaticContext" value="false" />
    </inspection_tool>
    <inspection_tool class="UnstableApiUsage" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
    <inspection_tool class="UpperCaseFieldNameNotConstant" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
    <inspection_tool class="UseCompareMethod" enabled="false" level="WARNING" enabled_by_default="false" />
    <inspection_tool class="UseOfAWTPeerClass" enabled="true" level="ERROR" enabled_by_default="true" />
    <inspection_tool class="UseOfClone" enabled="true" level="WARNING" enabled_by_default="true" />
    <inspection_tool class="UseOfJDBCDriverClass" enabled="true" level="ERROR" enabled_by_default="true" />
    <inspection_tool class="UseOfProcessBuilder" enabled="true" level="ERROR" enabled_by_default="true" />
    <inspection_tool class="UseOfSunClasses" enabled="true" level="ERROR" enabled_by_default="true" />
    <inspection_tool class="VariableTypeCanBeExplicit" enabled="false" level="INFORMATION" enabled_by_default="false" />
    <inspection_tool class="unused" enabled="true" level="WARNING" enabled_by_default="true" klass="packageLocal" inner_class="packageLocal" field="packageLocal" method="packageLocal">
      <option name="LOCAL_VARIABLE" value="true" />
      <option name="FIELD" value="true" />
      <option name="METHOD" value="true" />
      <option name="CLASS" value="true" />
      <option name="PARAMETER" value="true" />
      <option name="REPORT_PARAMETER_FOR_PUBLIC_METHODS" value="true" />
      <option name="ADD_MAINS_TO_ENTRIES" value="true" />
      <option name="ADD_APPLET_TO_ENTRIES" value="true" />
      <option name="ADD_SERVLET_TO_ENTRIES" value="true" />
      <option name="ADD_NONJAVA_TO_ENTRIES" value="true" />
    </inspection_tool>
  </profile>
</component>

Added .idea/misc.xml.

















>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
  <component name="ExternalStorageConfigurationManager" enabled="true" />
  <component name="JavaScriptSettings">
    <option name="languageLevel" value="ES6" />
  </component>
  <component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="false" project-jdk-name="1.8" project-jdk-type="JavaSDK" />
</project>

Added .idea/squirreljme.iml.





>
>
1
2
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4" />

Deleted bldt/TIMESPACE.MF.

1
2
3
4
5
6
7
8
Manifest-Version: 1.0
X-SquirrelJME-Timespace-Title: Build Time
X-SquirrelJME-Timespace-Type: build
X-SquirrelJME-Timespace-Description: This contains everything which is 
 only available to the SquirrelJME build system. This means that when 
 target is to be built, no projects which support building for a given 
 target are permitted to be used. This depends on the JIT time projects.

<
<
<
<
<
<
<
<
















Deleted bldt/buildtime.mkd.

1
2
3
4
5
6
7
8
9
# Build-time Projects

These are projects which are only available at build-time to run SquirrelJME
projects.

 * `javase/` -- Pseudo-environment for Java SE.
 * `libs/` -- Support libraries for building.
 * `mids/` -- Building support for platforms.

<
<
<
<
<
<
<
<
<


















Deleted bldt/javase/javase.mkd.

1
2
3
4
5
6
7
# JavaSE Pseudo-Environment

This directory contains the pseudo environment for Java SE host systems. It
still uses the host class libraries but this enables support for simulating a
basic Java ME environment on Java SE which is not completely compatible as
such.

<
<
<
<
<
<
<














Deleted bldt/javase/libs/NAMESPACE.MF.

1
2
3
4
5
6
Manifest-Version: 1.0
X-SquirrelJME-Namespace-Title: JavaSE Builder Libraries
X-SquirrelJME-Namespace-Type: liblet
X-SquirrelJME-Namespace-Description: Libraries which are needed for the 
 builder to operate correctly on Java SE systems.

<
<
<
<
<
<












Deleted bldt/javase/libs/builder-implementation/META-INF/MANIFEST.MF.

1
2
3
4
5
6
7
8
Manifest-Version: 1.0
X-SquirrelJME-UUID: fea37c1c-007d-462b-a417-e77f326cdf73
X-SquirrelJME-Depends: builder-support javase-runtime
X-SquirrelJME-Error: BM
X-SquirrelJME-Description: This contains the builder implementation 
 which is used to allow the builder to run on Java SE systems.
Microedition-Configuration: CLDC-1.8

<
<
<
<
<
<
<
<
















Deleted bldt/javase/libs/builder-implementation/META-INF/services/net.multiphasicapps.javac.CompilerService.

1
cc.squirreljme.builder.javase.javac.HostCompilerService
<


Deleted bldt/javase/libs/builder-implementation/cc/squirreljme/builder/javase/javac/HostCompiler.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.builder.javase.javac;

import java.io.PrintStream;
import java.io.Writer;
import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
import javax.tools.JavaCompiler;
import net.multiphasicapps.io.PrintStreamWriter;
import net.multiphasicapps.javac.Compiler;
import net.multiphasicapps.javac.CompilerException;
import net.multiphasicapps.javac.CompilerInput;
import net.multiphasicapps.javac.CompilerInputLocation;
import net.multiphasicapps.javac.CompilerOptions;
import net.multiphasicapps.javac.CompilerOutput;
import net.multiphasicapps.javac.CompilerPathSet;

/**
 * This is the compiler which utilizes the system Java compiler, if one is
 * available.
 *
 * @since 2017/11/28
 */
public class HostCompiler
	extends Compiler
{
	/** The real Java compiler to use. */
	protected final JavaCompiler javac;
	
	/**
	 * Initializes the host compiler which uses the given Java compiler.
	 *
	 * @param __javac The Java compiler to use.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/11/28
	 */
	public HostCompiler(JavaCompiler __javac)
		throws NullPointerException
	{
		if (__javac == null)
			throw new NullPointerException("NARG");
		
		// Set
		this.javac = __javac;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/11/29
	 */
	@Override
	protected Runnable newCompilerRunnable(CompilerOutput __out,
		PrintStream __log, CompilerOptions __opt,
		CompilerPathSet[][] __paths, CompilerInput[] __input)
		throws CompilerException, NullPointerException
	{
		if (__out == null || __log == null || __opt == null ||
			__paths == null || __input == null)
			throw new NullPointerException("NARG");
		
		JavaCompiler javac = this.javac;
		
		// Decode compilation options
		List<String> options = new ArrayList<>();
		
		// Which Java version to target?
		String targver;
		switch (__opt.version())
		{
			case JAVA_7:
				targver = "1.7";
				break;
			
				// {@squirreljme.error BM01 Unsupported Java version.}
			default:
				throw new CompilerException("BM01");
		}
		options.add("-source");
		options.add(targver);
		options.add("-target");
		options.add(targver);
		
		// Debugging?
		if (__opt.debug())
			options.add("-g");
		
		// Setup file manager lookup of files
		Writer log = new PrintStreamWriter(__log);
		HostFileManager fm = new HostFileManager(__paths, __out);
		
		// Wrap all input to file objects
		Set<InputHostFileObject> input = new LinkedHashSet<>();
		for (CompilerInput i : __input)
			input.add(new InputHostFileObject(i));
		
		// Wrap task
		return new HostCompilerRunnable(javac.getTask(
			log, fm, null, options, null, input));
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
































































































































































































































Deleted bldt/javase/libs/builder-implementation/cc/squirreljme/builder/javase/javac/HostCompilerRunnable.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.builder.javase.javac;

import javax.tools.JavaCompiler;
import net.multiphasicapps.javac.CompilationFailedException;
import net.multiphasicapps.javac.CompilerException;

/**
 * This is the runnable which runs the compilation task.
 *
 * @since 2017/11/29
 */
public class HostCompilerRunnable
	implements Runnable
{
	/** The task to run. */
	protected final JavaCompiler.CompilationTask task;
	
	/**
	 * Initializes the compiler runnable.
	 *
	 * @param __t The task to for running.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/11/29
	 */
	public HostCompilerRunnable(JavaCompiler.CompilationTask __t)
		throws NullPointerException
	{
		if (__t == null)
			throw new NullPointerException("NARG");
		
		this.task = __t;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/11/29
	 */
	@Override
	public void run()
	{
		try
		{
			// {@squirreljme.error BM02 Compilation failed.}
			if (!this.task.call())
				throw new CompilationFailedException("BM02");
		}
		
		// {@squirreljme.error BM03 The compiler has failed.}
		catch (RuntimeException e)
		{
			throw new CompilerException("BM03", e);
		}
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


































































































































Deleted bldt/javase/libs/builder-implementation/cc/squirreljme/builder/javase/javac/HostCompilerService.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.builder.javase.javac;

import javax.tools.JavaCompiler;
import javax.tools.ToolProvider;
import net.multiphasicapps.javac.Compiler;
import net.multiphasicapps.javac.CompilerService;

/**
 * This provides the host compiler as a service.
 *
 * @since 2017/11/28
 */
public class HostCompilerService
	implements CompilerService
{
	/**
	 * {@inheritDoc}
	 * @since 2017/11/28
	 */
	@Override
	public Compiler createInstance()
	{
		JavaCompiler javac = ToolProvider.getSystemJavaCompiler();
		if (javac == null)
			return null;
		return new HostCompiler(javac);
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<














































































Deleted bldt/javase/libs/builder-implementation/cc/squirreljme/builder/javase/javac/HostFileManager.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.builder.javase.javac;

import java.io.File;
import java.io.IOException;
import java.util.Arrays;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.Set;
import javax.tools.FileObject;
import javax.tools.JavaFileManager;
import javax.tools.JavaFileObject;
import javax.tools.StandardJavaFileManager;
import javax.tools.StandardLocation;
import net.multiphasicapps.javac.CompilerInput;
import net.multiphasicapps.javac.CompilerInputLocation;
import net.multiphasicapps.javac.CompilerOutput;
import net.multiphasicapps.javac.CompilerPathSet;
import net.multiphasicapps.javac.NoSuchInputException;

/**
 * This is used by the Java compiler to manage files used by the compiler
 * for compilation and ones which are output.
 *
 * @since 2017/11/29
 */
public class HostFileManager
	implements StandardJavaFileManager
{
	/** Paths to search for input within. */
	protected final CompilerPathSet[][] paths;
	
	/** The output for the compiler. */
	protected final CompilerOutput output;
	
	/**
	 * Initializes the host file manager.
	 *
	 * @param __paths Output paths.
	 * @param __out Compiler output.
	 * @since 2017/11/29
	 */
	public HostFileManager(CompilerPathSet[][] __paths, CompilerOutput __out)
		throws NullPointerException
	{
		if (__paths == null || __out == null)
			throw new NullPointerException("NARG");
		
		this.paths = __paths;
		this.output = __out;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/11/29
	 */
	@Override
	public void close()
		throws IOException
	{
		// Flush the output writer so that any entries which are waiting to
		// be written are written to the ZIP
		this.output.flush();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/11/29
	 */
	@Override
	public void flush()
		throws IOException
	{
		// Forward to output
		this.output.flush();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/11/29
	 */
	@Override
	public ClassLoader getClassLoader(JavaFileManager.Location __a)
	{
		// No plug-ins permitted at all
		return null;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/11/29
	 */
	@Override
	public FileObject getFileForInput(JavaFileManager.Location __a,
		String __b, String __c)
		throws IOException
	{
		throw new todo.TODO();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/11/29
	 */
	@Override
	public FileObject getFileForOutput(JavaFileManager.Location __a,
		String __b, String __c, FileObject __d)
		throws IOException
	{
		throw new todo.TODO();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/11/29
	 */
	@Override
	public JavaFileObject getJavaFileForInput(
		JavaFileManager.Location __a, String __b, JavaFileObject.Kind __c)
		throws IOException
	{
		throw new todo.TODO();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/11/29
	 */
	@Override
	public JavaFileObject getJavaFileForOutput(
		JavaFileManager.Location __loc, String __cn, JavaFileObject.Kind __k,
		FileObject __sib)
		throws IOException
	{
		// {@squirreljme.error BM04 Only class file output is supported.}
		if (JavaFileObject.Kind.CLASS != __k)
			throw new IllegalArgumentException("BM04");
		
		// Convert class to "class" name
		String name = __cn.replace('.', '/') + __k.extension;
		
		// Open output file
		return new OutputHostFileObject(this.output, name);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/11/29
	 */
	@Override
	public Iterable<? extends JavaFileObject> getJavaFileObjects(
		File... __a)
	{
		return getJavaFileObjectsFromFiles(Arrays.<File>asList(__a));
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/11/29
	 */
	@Override
	public Iterable<? extends JavaFileObject> getJavaFileObjects(
		String... __a)
	{
		return getJavaFileObjectsFromStrings(Arrays.<String>asList(__a));
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/11/29
	 */
	@Override
	public Iterable<? extends JavaFileObject>
		getJavaFileObjectsFromFiles(Iterable<? extends File> __a)
	{
		// Forward call to string version
		Set<String> args = new LinkedHashSet<>();
		for (File f : __a)
			args.add(String.valueOf(f));
		return getJavaFileObjectsFromStrings(args);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/11/29
	 */
	@Override
	public Iterable<? extends JavaFileObject>
		getJavaFileObjectsFromStrings(Iterable<String> __a)
	{
		Set<JavaFileObject> rv = new LinkedHashSet<>();
		CompilerPathSet[] srcpaths =
			this.paths[CompilerInputLocation.SOURCE.ordinal()];
		
		// Discover files
		for (String s : __a)
			if (s.endsWith(".java"))
			{
				// Go through sources and try to find the first file
				for (CompilerPathSet ps : srcpaths)
					try
					{
						rv.add(new InputHostFileObject(ps.input(s)));
						break;
					}
					catch (NoSuchInputException e)
					{
					}
			}
			
			// {@squirreljme.error BM05 Do not know how to handle getting a
			// file object from the given file name. (The name of the file)}
			else
				throw new IllegalArgumentException(String.format("BM05 %s",
					s));
		
		// Return
		return rv;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/11/29
	 */
	@Override
	public Iterable<? extends File> getLocation(
		JavaFileManager.Location __l)
	{
		// Ignore null
		if (__l == null)
			return null;
		
		// Standard locations
		if (__l instanceof StandardLocation)
			switch ((StandardLocation)__l)
			{
					// This is required for Java 9's compiler to generate
					// code
				case CLASS_OUTPUT:
					return Arrays.<File>asList(new File("squirreljme$//"));
				
					// Unknown
				default:
					return null;
			}
		
		// Unknown
		return null;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/11/29
	 */
	@Override
	public boolean handleOption(String __a, Iterator<String> __b)
	{
		throw new todo.TODO();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/11/29
	 */
	@Override
	public boolean hasLocation(JavaFileManager.Location __a)
	{
		// Only use standard locations
		if (!(__a instanceof StandardLocation))
			return false;
		
		// Depends
		switch ((StandardLocation)__a)
		{
				// Knows class input and output
			case CLASS_OUTPUT:
			case CLASS_PATH:
			case PLATFORM_CLASS_PATH:
			case SOURCE_PATH:
				return true;
			
				// Unknown
			default:
				return false;
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/11/29
	 */
	@Override
	public String inferBinaryName(JavaFileManager.Location __a,
		JavaFileObject __b)
	{
		// Get name
		String name = __b.getName();
		
		// Try to remove the extension
		int ls = name.lastIndexOf('/'),
			ld = name.lastIndexOf('.');
		
		// Remove everything up to the extension
		if (ld > ls && ld >= 0)
			name = name.substring(0, ld);
		
		// Convert any slashes to dots
		return name.replace('/', '.');
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/11/29
	 */
	@Override
	public boolean isSameFile(FileObject __a, FileObject __b)
	{
		throw new todo.TODO();
	}
		
	/**
	 * {@inheritDoc}
	 * @since 2017/11/29
	 */
	@Override
	public int isSupportedOption(String __o)
	{
		// Ignore nulls
		if (__o == null)
			return -1;
		
		// Depends on the options
		switch (__o)
		{
				// Not supported
			case "--multi-release":		// Java 9 multi-release JARs
			default:
				return -1;
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/11/29
	 */
	@Override
	public Iterable<JavaFileObject> list(JavaFileManager.Location
		__l, String __pk, Set<JavaFileObject.Kind> __kinds, boolean __rec)
		throws IOException
	{
		// Setup target
		Set<JavaFileObject> rv = new LinkedHashSet<>();
		
		// Determine which input file source to use
		CompilerPathSet[][] paths = this.paths;
		CompilerPathSet[] usesets;
		if (!(__l instanceof StandardLocation))
			return rv;
		else
			switch ((StandardLocation)__l)
			{
					// Class inputs
				case CLASS_PATH:
				case PLATFORM_CLASS_PATH:
					usesets = paths[CompilerInputLocation.CLASS.ordinal()];
					break;
				
					// Source inputs
				case SOURCE_PATH:
					usesets = paths[CompilerInputLocation.SOURCE.ordinal()];
					break;
			
					// Unknown, return nothing
				default:
					return rv;
			}
		
		// Load in all files from every set
		Set<CompilerInput> files = new LinkedHashSet<>();
		for (CompilerPathSet set : usesets)
			for (CompilerInput i : set)
				files.add(i);
		
		// Prefix to consider?
		String prefix = (__pk == null ? "" : __pk.replace('.', '/') + "/");
		int prefixn = prefix.length();
		
		// Go through all files
		boolean issource = (__l == StandardLocation.SOURCE_PATH);
		for (CompilerInput f : files)
		{
			String fname = f.fileName();
			
			// Prefix does not match?
			if (!fname.startsWith(prefix))
				continue;
			
			// If not recursive, then the last slash that appears must be
			// at the same length of the prefix
			if (!__rec)
			{
				int ls = Math.max(-1, fname.lastIndexOf('/')) + 1;
				if (ls != prefixn)
					continue;
			}
			
			// Only consider files with these extensions
			boolean hit = false;
			for (JavaFileObject.Kind k : __kinds)
				if (fname.endsWith(k.extension))
				{
					hit = true;
					break;
				}
			
			// Missed extension?
			if (!hit)
				continue;
			
			// Add file
			rv.add(new InputHostFileObject(f));
		}
		
		// Return
		return rv;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/11/29
	 */
	@Override
	public void setLocation(JavaFileManager.Location __a, Iterable<?
		extends File> __b)
		throws IOException
	{
		// Ignore any location setting as all locations are completely
		// internal
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




































































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted bldt/javase/libs/builder-implementation/cc/squirreljme/builder/javase/javac/HostFileObject.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.builder.javase.javac;

import java.net.URI;
import java.net.URISyntaxException;
import javax.lang.model.element.Modifier;
import javax.lang.model.element.NestingKind;
import javax.tools.JavaFileObject;

/**
 * This is the base for file objects.
 *
 * @since 2017/11/29
 */
public abstract class HostFileObject
	implements JavaFileObject
{
	/** The name of the file. */
	protected final String name;
	
	/**
	 * Initializes the base file object.
	 *
	 * @param __name The name of the file.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/11/29
	 */
	public HostFileObject(String __name)
		throws NullPointerException
	{
		if (__name == null)
			throw new NullPointerException("NARG");
		
		this.name = __name;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/11/29
	 */
	@Override
	public final boolean delete()
	{
		// Unsupported
		return false;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/11/29
	 */
	@Override
	public final Modifier getAccessLevel()
	{
		// Unknown
		return null;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/11/29
	 */
	@Override
	public final JavaFileObject.Kind getKind()
	{
		// Depends on the extension
		String name = this.name;
		
		// Java source code
		if (name.endsWith(".java"))
			return JavaFileObject.Kind.SOURCE;
		
		// Java class file
		else if (name.endsWith(".class"))
			return JavaFileObject.Kind.CLASS;
		
		// HTML
		else if (name.endsWith(".htm") || name.endsWith(".html"))
			return JavaFileObject.Kind.HTML;
		
		// Unknoen
		return JavaFileObject.Kind.OTHER;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/11/29
	 */
	@Override
	public final long getLastModified()
	{
		// Unsupported
		return Long.MIN_VALUE;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/11/29
	 */
	@Override
	public final String getName()
	{
		return this.name;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/11/29
	 */
	@Override
	public final NestingKind getNestingKind()
	{
		// Unknown
		return null;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/11/29
	 */
	@Override
	public final boolean isNameCompatible(String __sn,
		JavaFileObject.Kind __k)
	{
		// Get name
		String name = this.name;
		
		// Does not match extension?
		if (!name.endsWith(__k.extension))
			return false;
		
		// Only consider anything after the last slash
		int ls = name.lastIndexOf('/');
		if (ls > 0)
			name = name.substring(ls + 1);
		
		// And remove the extension
		int ld = name.lastIndexOf('.');
		if (ld > 0)
			name = name.substring(0, ld);
		
		// Compare base
		return name.equals(__sn);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/01/22
	 */
	@Override
	public final String toString()
	{
		return this.name;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/11/29
	 */
	@Override
	public final URI toUri()
	{
		// Can fail, but it should not
		try
		{
			return new URI("squirreljme", this.name, null);
		}
		
		// {@squirreljme.error BM06 Could not create a URI for the file.}
		catch (URISyntaxException e)
		{
			throw new RuntimeException("BM06", e);
		}
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


















































































































































































































































































































































































Deleted bldt/javase/libs/builder-implementation/cc/squirreljme/builder/javase/javac/InputHostFileObject.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.builder.javase.javac;

import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.IOException;
import java.io.OutputStream;
import java.io.Reader;
import java.io.Writer;
import net.multiphasicapps.javac.CompilerInput;

/**
 * This is a file object which is used for input.
 *
 * @since 2017/11/29
 */
public class InputHostFileObject
	extends HostFileObject
{
	/** The file to source input from. */
	protected final CompilerInput input;
	
	/**
	 * Initializes the file object for input.
	 *
	 * @param __i The stream for input of classes and sources.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/11/29
	 */
	public InputHostFileObject(CompilerInput __i)
		throws NullPointerException
	{
		super(__i.fileName());
		
		if (__i == null)
			throw new NullPointerException("NARG");
		
		this.input = __i;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/11/29
	 */
	@Override
	public CharSequence getCharContent(boolean __a)
		throws IOException
	{
		// Read in all the characters
		StringBuilder sb = new StringBuilder();
		try (Reader r = new InputStreamReader(openInputStream(), "utf-8"))
		{
			char[] buf = new char[2048];
			for (;;)
			{
				int rc = r.read(buf);
				
				// EOF?
				if (rc < 0)
					break;
				
				// Write
				sb.append(buf, 0, rc);
			}
		}
		
		// Return it
		return sb;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/11/29
	 */
	@Override
	public InputStream openInputStream()
		throws IOException
	{
		return this.input.open();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/11/29
	 */
	@Override
	public OutputStream openOutputStream()
		throws IOException
	{
		// {@squirreljme.error BM07 Attempted to open input file as output.}
		throw new IllegalStateException("BM07");
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/11/29
	 */
	@Override
	public Reader openReader(boolean __a)
		throws IOException
	{
		return new InputStreamReader(openInputStream(), "utf-8");
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/11/29
	 */
	@Override
	public Writer openWriter()
		throws IOException
	{
		// {@squirreljme.error BM08 Cannot open a writer for an input file.}
		throw new IllegalStateException("BM08");
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




























































































































































































































































Deleted bldt/javase/libs/builder-implementation/cc/squirreljme/builder/javase/javac/OutputHostFileObject.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.builder.javase.javac;

import java.io.InputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.Reader;
import java.io.Writer;
import net.multiphasicapps.javac.CompilerOutput;

/**
 * This is a file object which is used for output.
 *
 * @since 2017/11/29
 */
public class OutputHostFileObject
	extends HostFileObject
{
	/** The output to write to. */
	protected final CompilerOutput output;
	
	/**
	 * Initializes the file output.
	 *
	 * @param __out The output to write to.
	 * @param __name The output file name.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/11/29
	 */
	public OutputHostFileObject(CompilerOutput __out, String __name)
		throws NullPointerException
	{
		super(__name);
		
		if (__out == null)
			throw new NullPointerException("NARG");
		
		this.output = __out;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/11/29
	 */
	@Override
	public CharSequence getCharContent(boolean __a)
		throws IOException
	{
		// {@squirreljme.error BM09 Cannot get character content for an output
		// file.}
		throw new IllegalStateException("BM09");
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/11/29
	 */
	@Override
	public InputStream openInputStream()
		throws IOException
	{
		// {@squirreljme.error BM0a Cannot open an input stream for an output
		// file.}
		throw new IllegalStateException("BM0a");
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/11/29
	 */
	@Override
	public OutputStream openOutputStream()
		throws IOException
	{
		return this.output.output(this.name);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/11/29
	 */
	@Override
	public Reader openReader(boolean __a)
		throws IOException
	{
		// {@squirreljme.error BM0b Cannot open a reader for an output
		// file.}
		throw new IllegalStateException("BM0b");
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/11/29
	 */
	@Override
	public Writer openWriter()
		throws IOException
	{
		return new OutputStreamWriter(this.openOutputStream(), "utf-8");
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
































































































































































































































Deleted bldt/javase/libs/builder-implementation/cc/squirreljme/builder/javase/javac/package-info.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

/**
 * This package contains the support for the host Java compiler to run on
 * existing Java SE systems.
 *
 * @since 2017/11/28
 */

package cc.squirreljme.builder.javase.javac;

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






































Deleted bldt/javase/libs/builder-implementation/cc/squirreljme/builder/javase/package-info.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

/**
 * This package contains the support for Java SE based systems.
 *
 * @since 2017/11/09
 */

package cc.squirreljme.builder.javase;

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




































Deleted bldt/javase/libs/javase-runtime/META-INF/MANIFEST.MF.

1
2
3
4
5
6
7
8
9
10
11
12
Manifest-Version: 1.0
X-SquirrelJME-UUID: d354b1ef-6941-4a0a-a20a-cec1191e995f
X-SquirrelJME-Error: AF
X-SquirrelJME-Name: Java SE Run-Time
X-SquirrelJME-Vendor: Stephanie Gawroriski
X-SquirrelJME-Version: 0.3.0
X-SquirrelJME-Description: This project contains the support for using 
 SquirrelJME as a pseudo-runtime in Java SE, which is needed to run 
 programs such as the build environment.
X-SquirrelJME-Depends: midp-lcdui meep-swm io gcf
Microedition-Configuration: CLDC-1.8-Compact

<
<
<
<
<
<
<
<
<
<
<
<
























Deleted bldt/javase/libs/javase-runtime/META-INF/services/cc.squirreljme.runtime.gcf.IPConnectionFactory.

1
cc.squirreljme.runtime.javase.JavaSEIPConnectionFactory
<


Deleted bldt/javase/libs/javase-runtime/cc/squirreljme/jvm/Assembly.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm;

import cc.squirreljme.runtime.cldc.lang.ApiLevel;
import java.io.IOException;
import java.io.OutputStream;
import java.lang.reflect.Array;
import java.util.Arrays;
import java.util.HashMap;
import java.util.IdentityHashMap;
import java.util.Map;

/**
 * This class is used special by the compiler to transform all the various
 * operations into regular instructions rather than method calls.
 *
 * The compiler will take all of the method arguments and instead use their
 * inputs and outputs from the values of registers instead. However due to
 * this, this means that these instructions are purely primitive in that
 * they must not depend on any aspect of the virtual machine.
 *
 * @since 2019/04/20
 */
public final class Assembly
{
	/** Extra call stack depth. */
	private static final int _EXTRA_STACK_DEPTH =
		3;
	
	/** Local thread data. */
	private static final ThreadLocal<ThreadData> _THREAD_DATA =
		new ThreadLocal<>();
	
	/** Unique string map. */
	private static final Map<String, Integer> _STRINGS =
		new HashMap<>();
	
	/** Unique objects. */
	private static final Map<Object, Integer> _OBJECTS =
		new IdentityHashMap<>();
	
	/**
	 * Not used.
	 *
	 * @since 2019/04/20
	 */
	private Assembly()
	{
	}
	
	/**
	 * Returns the array length of the given object.
	 *
	 * @param __o The object to get the length of.
	 * @return The length of the array.
	 * @since 2019/05/24
	 */
	public static final int arrayLength(Object __o)
	{
		return Array.getLength(__o);
	}
	
	/**
	 * Trigger breakpoint within the virtual machine.
	 *
	 * @since 2019/04/21
	 */
	public static final void breakpoint()
	{
		throw new todo.TODO();
	}
	
	/**
	 * Packs the given two integers to a double value.
	 *
	 * @param __hi The high value.
	 * @param __lo The low value.
	 * @return The double value.
	 * @since 2019/06/21
	 */
	public static final double doublePack(int __hi, int __lo)
	{
		return Assembly.longBitsToDouble(Assembly.longPack(__hi, __lo));
	}
	
	/**
	 * Double to raw long bits.
	 *
	 * @param __d The input double.
	 * @return The raw long bits.
	 * @since 2018/11/03
	 */
	public static final long doubleToRawLongBits(double __d)
	{
		return Double.doubleToRawLongBits(__d);
	}
	
	/**
	 * Performs explicit exception handling.
	 *
	 * @since 2019/04/28
	 */
	public static final void exceptionHandle()
	{
		throw new todo.TODO();
	}
	
	/**
	 * Float to raw int bits.
	 *
	 * @param __d The input float.
	 * @return The raw int bits.
	 * @since 2018/11/04
	 */
	public static final int floatToRawIntBits(float __f)
	{
		return Float.floatToRawIntBits(__f);
	}
	
	/**
	 * Integer bits to float.
	 *
	 * @param __b The input bits.
	 * @return The resulting float.
	 * @since 2018/11/04
	 */
	public static final float intBitsToFloat(int __b)
	{
		return Float.intBitsToFloat(__b);
	}
	
	/**
	 * Invoke method at pointer.
	 *
	 * @param __addr The address to invoke.
	 * @since 2019/04/28
	 */
	public static final void invoke(int __addr)
	{
		Assembly.__invoke(__addr);
	}
	
	/**
	 * Invoke method at pointer, with arguments.
	 *
	 * @param __addr The address to invoke.
	 * @param __a Argument.
	 * @since 2019/04/28
	 */
	public static final void invoke(int __addr, int __a)
	{
		Assembly.__invoke(__addr, __a);
	}
	
	/**
	 * Invoke method at pointer, with arguments.
	 *
	 * @param __addr The address to invoke.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @since 2019/04/28
	 */
	public static final void invoke(int __addr, int __a, int __b)
	{
		Assembly.__invoke(__addr, __a, __b);
	}
	
	/**
	 * Invoke method at pointer, with arguments.
	 *
	 * @param __addr The address to invoke.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @since 2019/04/28
	 */
	public static final void invoke(int __addr, int __a, int __b, int __c)
	{
		Assembly.__invoke(__addr, __a, __b, __c);
	}
	
	/**
	 * Invoke method at pointer, with arguments.
	 *
	 * @param __addr The address to invoke.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @since 2019/04/28
	 */
	public static final void invoke(int __addr, int __a, int __b, int __c,
		int __d)
	{
		Assembly.__invoke(__addr, __a, __b, __c, __d);
	}
	
	/**
	 * Invoke method at pointer, with arguments.
	 *
	 * @param __addr The address to invoke.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @param __e Argument.
	 * @since 2019/04/28
	 */
	public static final void invoke(int __addr, int __a, int __b, int __c,
		int __d, int __e)
	{
		Assembly.__invoke(__addr, __a, __b, __c, __d, __e);
	}
	
	/**
	 * Invoke method at pointer, with arguments.
	 *
	 * @param __addr The address to invoke.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @param __e Argument.
	 * @param __f Argument.
	 * @since 2019/04/28
	 */
	public static final void invoke(int __addr, int __a, int __b, int __c,
		int __d, int __e, int __f)
	{
		Assembly.__invoke(__addr, __a, __b, __c, __d, __e, __f);
	}
	
	/**
	 * Invoke method at pointer, with arguments.
	 *
	 * @param __addr The address to invoke.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @param __e Argument.
	 * @param __f Argument.
	 * @param __g Argument.
	 * @since 2019/04/28
	 */
	public static final void invoke(int __addr, int __a, int __b, int __c,
		int __d, int __e, int __f, int __g)
	{
		Assembly.__invoke(__addr, __a, __b, __c, __d, __e, __f, __g);
	}
	
	/**
	 * Invoke method at pointer, with arguments.
	 *
	 * @param __addr The address to invoke.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @param __e Argument.
	 * @param __f Argument.
	 * @param __g Argument.
	 * @param __h Argument.
	 * @since 2019/04/28
	 */
	public static final void invoke(int __addr, int __a, int __b, int __c,
		int __d, int __e, int __f, int __g, int __h)
	{
		Assembly.__invoke(__addr, __a, __b, __c, __d, __e, __f, __g, __h);
	}
	
	/**
	 * Invoke method at pointer.
	 *
	 * @param __addr The address to invoke.
	 * @return The result of the invocation.
	 * @since 2019/04/28
	 */
	public static final int invokeV(int __addr)
	{
		return Assembly.__invoke(__addr);
	}
	
	/**
	 * Invoke method at pointer, with arguments.
	 *
	 * @param __addr The address to invoke.
	 * @param __a Argument.
	 * @return The result of the invocation.
	 * @since 2019/04/28
	 */
	public static final int invokeV(int __addr, int __a)
	{
		return Assembly.__invoke(__addr, __a);
	}
	
	/**
	 * Invoke method at pointer, with arguments.
	 *
	 * @param __addr The address to invoke.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @return The result of the invocation.
	 * @since 2019/04/28
	 */
	public static final int invokeV(int __addr, int __a, int __b)
	{
		return Assembly.__invoke(__addr, __a, __b);
	}
	
	/**
	 * Invoke method at pointer, with arguments.
	 *
	 * @param __addr The address to invoke.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @return The result of the invocation.
	 * @since 2019/04/28
	 */
	public static final int invokeV(int __addr, int __a, int __b, int __c)
	{
		return Assembly.__invoke(__addr, __a, __b, __c);
	}
	
	/**
	 * Invoke method at pointer, with arguments.
	 *
	 * @param __addr The address to invoke.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @return The result of the invocation.
	 * @since 2019/04/28
	 */
	public static final int invokeV(int __addr, int __a, int __b, int __c,
		int __d)
	{
		return Assembly.__invoke(__addr, __a, __b, __c, __d);
	}
	
	/**
	 * Invoke method at pointer, with arguments.
	 *
	 * @param __addr The address to invoke.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @param __e Argument.
	 * @return The result of the invocation.
	 * @since 2019/04/28
	 */
	public static final int invokeV(int __addr, int __a, int __b, int __c,
		int __d, int __e)
	{
		return Assembly.__invoke(__addr, __a, __b, __c, __d, __e);
	}
	
	/**
	 * Invoke method at pointer, with arguments.
	 *
	 * @param __addr The address to invoke.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @param __e Argument.
	 * @param __f Argument.
	 * @return The result of the invocation.
	 * @since 2019/04/28
	 */
	public static final int invokeV(int __addr, int __a, int __b, int __c,
		int __d, int __e, int __f)
	{
		return Assembly.__invoke(__addr, __a, __b, __c, __d, __e, __f);
	}
	
	/**
	 * Invoke method at pointer, with arguments.
	 *
	 * @param __addr The address to invoke.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @param __e Argument.
	 * @param __f Argument.
	 * @param __g Argument.
	 * @return The result of the invocation.
	 * @since 2019/04/28
	 */
	public static final int invokeV(int __addr, int __a, int __b, int __c,
		int __d, int __e, int __f, int __g)
	{
		return Assembly.__invoke(__addr, __a, __b, __c, __d, __e, __f, __g);
	}
	
	/**
	 * Invoke method at pointer, with arguments.
	 *
	 * @param __addr The address to invoke.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @param __e Argument.
	 * @param __f Argument.
	 * @param __g Argument.
	 * @param __h Argument.
	 * @return The result of the invocation.
	 * @since 2019/04/28
	 */
	public static final int invokeV(int __addr, int __a, int __b, int __c,
		int __d, int __e, int __f, int __g, int __h)
	{
		return Assembly.__invoke(__addr, __a, __b, __c, __d, __e, __f, __g,
			__h);
	}
	
	/**
	 * Long bits to double.
	 *
	 * @param __b The input bits.
	 * @return The resulting double.
	 * @since 2018/11/03
	 */
	public static final double longBitsToDouble(long __b)
	{
		return Double.longBitsToDouble(__b);
	}
	
	/**
	 * Packs the given two integers to a long value.
	 *
	 * @param __hi The high value.
	 * @param __lo The low value.
	 * @return The long value.
	 * @since 2019/06/21
	 */
	public static final long longPack(int __hi, int __lo)
	{
		return ((((long)__hi) << 32L) | (((long)__lo) & 0xFFFFFFFFL));
	}
	
	/**
	 * Unpack high value from long.
	 *
	 * @param __v The long value.
	 * @return The unpacked fragment.
	 * @since 2019/06/21
	 */
	public static final int longUnpackHigh(long __v)
	{
		return (int)(__v >>> 32);
	}
	
	/**
	 * Unpack low value from long.
	 *
	 * @param __v The long value.
	 * @return The unpacked fragment.
	 * @since 2019/06/21
	 */
	public static final int longUnpackLow(long __v)
	{
		return (int)__v;
	}
	
	/**
	 * Reads byte from address.
	 *
	 * @param __p The pointer.
	 * @param __o The offset.
	 * @return The result of the read.
	 * @since 2019/04/22
	 */
	public static final int memReadByte(int __p, int __o)
	{
		throw new todo.OOPS();
	}
	
	/**
	 * Reads integer from address.
	 *
	 * @param __p The pointer.
	 * @param __o The offset.
	 * @return The result of the read.
	 * @since 2019/04/21
	 */
	public static final int memReadInt(int __p, int __o)
	{
		throw new todo.OOPS();
	}
	
	/**
	 * Reads big endian Java integer from address.
	 *
	 * @param __p The pointer.
	 * @param __o The offset.
	 * @return The result of the read.
	 * @since 2019/05/29
	 */
	public static final int memReadJavaInt(int __p, int __o)
	{
		throw new todo.OOPS();
	}
	
	/**
	 * Reads big endian Java short from address.
	 *
	 * @param __p The pointer.
	 * @param __o The offset.
	 * @return The result of the read.
	 * @since 2019/05/29
	 */
	public static final int memReadJavaShort(int __p, int __o)
	{
		throw new todo.OOPS();
	}
	
	/**
	 * Reads short from address.
	 *
	 * @param __p The pointer.
	 * @param __o The offset.
	 * @return The result of the read.
	 * @since 2019/04/22
	 */
	public static final int memReadShort(int __p, int __o)
	{
		throw new todo.OOPS();
	}
	
	/**
	 * Writes byte to address.
	 *
	 * @param __p The pointer.
	 * @param __o The offset.
	 * @param __v The value to write.
	 * @since 2019/04/21
	 */
	public static final void memWriteByte(int __p, int __o, int __v)
	{
		throw new todo.OOPS();
	}
	
	/**
	 * Writes integer to address.
	 *
	 * @param __p The pointer.
	 * @param __o The offset.
	 * @param __v The value to write.
	 * @since 2019/04/21
	 */
	public static final void memWriteInt(int __p, int __o, int __v)
	{
		throw new todo.OOPS();
	}
	
	/**
	 * Writes big endian Java integer to address.
	 *
	 * @param __p The pointer.
	 * @param __o The offset.
	 * @param __v The value to write.
	 * @since 2019/05/29
	 */
	public static final void memWriteJavaInt(int __p, int __o, int __v)
	{
		throw new todo.OOPS();
	}
	
	/**
	 * Writes big endian Java short to address.
	 *
	 * @param __p The pointer.
	 * @param __o The offset.
	 * @param __v The value to write.
	 * @since 2019/05/29
	 */
	public static final void memWriteJavaShort(int __p, int __o, int __v)
	{
		throw new todo.OOPS();
	}
	
	/**
	 * Writes short to address.
	 *
	 * @param __p The pointer.
	 * @param __o The offset.
	 * @param __v The value to write.
	 * @since 2019/04/21
	 */
	public static final void memWriteShort(int __p, int __o, int __v)
	{
		throw new todo.OOPS();
	}
	
	/**
	 * Used to convert an object to a pointer.
	 *
	 * @param __o The object.
	 * @return The pointer of the object.
	 * @since 2019/04/21
	 */
	public static final int objectToPointer(Object __o)
	{
		return Assembly.__uniqueObjectId(__o);
	}
	
	/**
	 * Used to convert an object to a pointer, do use reference queing for it
	 * so that if the object is a candidate for reference counting it will
	 * be uncounted.
	 *
	 * @param __o The object.
	 * @return The pointer of the object.
	 * @since 2019/04/21
	 */
	public static final int objectToPointerRefQueue(Object __o)
	{
		return Assembly.__uniqueObjectId(__o);
	}
	
	/**
	 * Used to convert a pointer to an object.
	 *
	 * @param __p The pointer.
	 * @return The object of the pointer.
	 * @since 2019/04/21
	 */
	public static final Object pointerToObject(int __p)
	{
		return Assembly.__uniqueObject(__p);
	}
	
	/**
	 * Used to convert a pointer to a class info type.
	 *
	 * @param __p The pointer.
	 * @return The object of the pointer.
	 * @since 2019/04/21
	 */
	public static final ClassInfo pointerToClassInfo(int __p)
	{
		throw new todo.TODO();
	}
	
	/**
	 * Perform reference counting logic on object.
	 *
	 * @param __p The object to count up.
	 * @since 2019/05/25
	 */
	public static final void refCount(int __p)
	{
		// No work needed
	}
	
	/**
	 * Perform reference uncounting logic on object.
	 *
	 * @param __p The object to count down.
	 * @since 2019/05/25
	 */
	public static final void refUncount(int __p)
	{
		// No work needed
	}
	
	/**
	 * Return from the current frame.
	 *
	 * @since 2019/04/21
	 */
	public static final void returnFrame()
	{
		throw new todo.OOPS();
	}
	
	/**
	 * Returns from the current frame, returning the given value.
	 *
	 * @param __v The value to return.
	 * @since 2019/04/28
	 */
	public static final void returnFrame(int __v)
	{
		throw new todo.OOPS();
	}
	
	/**
	 * Returns from the current frame, returning both values.
	 *
	 * @param __h The high value.
	 * @param __l The low value.
	 * @since 2019/04/28
	 */
	public static final void returnFrame(int __h, int __l)
	{
		throw new todo.OOPS();
	}
	
	/**
	 * Returns the exception register.
	 *
	 * @return The exception register.
	 * @since 2019/04/28
	 */
	public static final int specialGetExceptionRegister()
	{
		throw new todo.OOPS();
	}
	
	/**
	 * Returns the value of the current pool register.
	 *
	 * @return The value of the pool register.
	 * @since 2019/05/01
	 */
	public static final int specialGetPoolRegister()
	{
		throw new todo.OOPS();
	}
	
	/**
	 * Returns the value of the return register, for long return values this
	 * is the first high register.
	 *
	 * @return The value of the return register.
	 * @since 2019/04/28
	 */
	public static final int specialGetReturnRegister()
	{
		throw new todo.OOPS();
	}
	
	/**
	 * Returns the value of the return register, the first high value.
	 *
	 * @return The value of the return register, the first high value.
	 * @since 2019/04/28
	 */
	public static final int specialGetReturnHighRegister()
	{
		throw new todo.OOPS();
	}
	
	/**
	 * Returns the value of the return register, the second low value.
	 *
	 * @return The value of the return register, the second low value.
	 * @since 2019/04/28
	 */
	public static final int specialGetReturnLowRegister()
	{
		throw new todo.OOPS();
	}
	
	/**
	 * Reads the value of the static field register.
	 *
	 * @return The value of the static field register.
	 * @since 2019/04/22
	 */
	public static final int specialGetStaticFieldRegister()
	{
		throw new todo.OOPS();
	}
	
	/**
	 * Returns the register representing the current thread.
	 *
	 * @return The current thread register.
	 * @since 2019/04/22
	 */
	public static final int specialGetThreadRegister()
	{
		throw new todo.OOPS();
	}
	
	/**
	 * Sets the value of the exception register.
	 *
	 * @param __v The value to use.
	 * @since 2019/04/28
	 */
	public static final void specialSetExceptionRegister(int __v)
	{
		throw new todo.OOPS();
	}
	
	/**
	 * Sets the value of the constant pool register.
	 *
	 * @param __v The new value of the constant pool register.
	 * @since 2019/05/01
	 */
	public static final void specialSetPoolRegister(int __v)
	{
		throw new todo.OOPS();
	}
	
	/**
	 * Sets the value of the static field register.
	 *
	 * @param __v The new value of the static field register.
	 * @since 2019/04/22
	 */
	public static final void specialSetStaticFieldRegister(int __v)
	{
		throw new todo.OOPS();
	}
	
	/**
	 * Sets the current thread pointer.
	 *
	 * @param __v The value to use.
	 * @since 2019/04/27
	 */
	public static final void specialSetThreadRegister(int __v)
	{
		throw new todo.OOPS();
	}
	
	/**
	 * Invoke system call at the given index.
	 *
	 * @param __addr The address to invoke.
	 * @since 2019/05/23
	 */
	public static final void sysCall(short __si)
	{
		Assembly.__sysCall(__si);
	}
	
	/**
	 * Invoke system call at the given index, with arguments.
	 *
	 * @param __si System call index.
	 * @param __a Argument.
	 * @since 2019/05/23
	 */
	public static final void sysCall(short __si, int __a)
	{
		Assembly.__sysCall(__si, __a);
	}
	
	/**
	 * Invoke system call at the given index, with arguments.
	 *
	 * @param __si System call index.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @since 2019/05/23
	 */
	public static final void sysCall(short __si, int __a, int __b)
	{
		Assembly.__sysCall(__si, __a, __b);
	}
	
	/**
	 * Invoke system call at the given index, with arguments.
	 *
	 * @param __si System call index.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @since 2019/05/23
	 */
	public static final void sysCall(short __si, int __a, int __b, int __c)
	{
		Assembly.__sysCall(__si, __a, __b, __c);
	}
	
	/**
	 * Invoke system call at the given index, with arguments.
	 *
	 * @param __si System call index.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @since 2019/05/23
	 */
	public static final void sysCall(short __si, int __a, int __b, int __c,
		int __d)
	{
		Assembly.__sysCall(__si, __a, __b, __c, __d);
	}
	
	/**
	 * Invoke system call at the given index, with arguments.
	 *
	 * @param __si System call index.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @param __e Argument.
	 * @since 2019/05/23
	 */
	public static final void sysCall(short __si, int __a, int __b, int __c,
		int __d, int __e)
	{
		Assembly.__sysCall(__si, __a, __b, __c, __d, __e);
	}
	
	/**
	 * Invoke system call at the given index, with arguments.
	 *
	 * @param __si System call index.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @param __e Argument.
	 * @param __f Argument.
	 * @since 2019/05/23
	 */
	public static final void sysCall(short __si, int __a, int __b, int __c,
		int __d, int __e, int __f)
	{
		Assembly.__sysCall(__si, __a, __b, __c, __d, __e, __f);
	}
	
	/**
	 * Invoke system call at the given index, with arguments.
	 *
	 * @param __si System call index.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @param __e Argument.
	 * @param __f Argument.
	 * @param __g Argument.
	 * @since 2019/05/23
	 */
	public static final void sysCall(short __si, int __a, int __b, int __c,
		int __d, int __e, int __f, int __g)
	{
		Assembly.__sysCall(__si, __a, __b, __c, __d, __e, __f, __g);
	}
	
	/**
	 * Invoke system call at the given index, with arguments.
	 *
	 * @param __si System call index.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @param __e Argument.
	 * @param __f Argument.
	 * @param __g Argument.
	 * @param __h Argument.
	 * @since 2019/05/23
	 */
	public static final void sysCall(short __si, int __a, int __b, int __c,
		int __d, int __e, int __f, int __g, int __h)
	{
		Assembly.__sysCall(__si, __a, __b, __c, __d, __e, __f, __g, __h);
	}
	
	/**
	 * Invoke system call at the given index.
	 *
	 * @param __addr The address to invoke.
	 * @since 2019/05/23
	 */
	public static final void sysCallP(short __si)
	{
		Assembly.__sysCall(__si);
	}
	
	/**
	 * Invoke system call at the given index, with arguments.
	 *
	 * @param __si System call index.
	 * @param __a Argument.
	 * @since 2019/05/23
	 */
	public static final void sysCallP(short __si, int __a)
	{
		Assembly.__sysCall(__si, __a);
	}
	
	/**
	 * Invoke system call at the given index, with arguments.
	 *
	 * @param __si System call index.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @since 2019/05/23
	 */
	public static final void sysCallP(short __si, int __a, int __b)
	{
		Assembly.__sysCall(__si, __a, __b);
	}
	
	/**
	 * Invoke system call at the given index, with arguments.
	 *
	 * @param __si System call index.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @since 2019/05/23
	 */
	public static final void sysCallP(short __si, int __a, int __b, int __c)
	{
		Assembly.__sysCall(__si, __a, __b, __c);
	}
	
	/**
	 * Invoke system call at the given index, with arguments.
	 *
	 * @param __si System call index.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @since 2019/05/23
	 */
	public static final void sysCallP(short __si, int __a, int __b, int __c,
		int __d)
	{
		Assembly.__sysCall(__si, __a, __b, __c, __d);
	}
	
	/**
	 * Invoke system call at the given index, with arguments.
	 *
	 * @param __si System call index.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @param __e Argument.
	 * @since 2019/05/23
	 */
	public static final void sysCallP(short __si, int __a, int __b, int __c,
		int __d, int __e)
	{
		Assembly.__sysCall(__si, __a, __b, __c, __d, __e);
	}
	
	/**
	 * Invoke system call at the given index, with arguments.
	 *
	 * @param __si System call index.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @param __e Argument.
	 * @param __f Argument.
	 * @since 2019/05/23
	 */
	public static final void sysCallP(short __si, int __a, int __b, int __c,
		int __d, int __e, int __f)
	{
		Assembly.__sysCall(__si, __a, __b, __c, __d, __e, __f);
	}
	
	/**
	 * Invoke system call at the given index, with arguments.
	 *
	 * @param __si System call index.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @param __e Argument.
	 * @param __f Argument.
	 * @param __g Argument.
	 * @since 2019/05/23
	 */
	public static final void sysCallP(short __si, int __a, int __b, int __c,
		int __d, int __e, int __f, int __g)
	{
		Assembly.__sysCall(__si, __a, __b, __c, __d, __e, __f, __g);
	}
	
	/**
	 * Invoke system call at the given index, with arguments.
	 *
	 * @param __si System call index.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @param __e Argument.
	 * @param __f Argument.
	 * @param __g Argument.
	 * @param __h Argument.
	 * @since 2019/05/23
	 */
	public static final void sysCallP(short __si, int __a, int __b, int __c,
		int __d, int __e, int __f, int __g, int __h)
	{
		Assembly.__sysCall(__si, __a, __b, __c, __d, __e, __f, __g, __h);
	}
	
	/**
	 * Invoke system call at the given index.
	 *
	 * @param __si System call index.
	 * @return The result of the invocation.
	 * @since 2019/05/23
	 */
	public static final int sysCallPV(short __si)
	{
		return (int)Assembly.__sysCall(__si);
	}
	
	/**
	 * Invoke system call at the given index, with arguments.
	 *
	 * @param __si System call index.
	 * @param __a Argument.
	 * @return The result of the invocation.
	 * @since 2019/05/23
	 */
	public static final int sysCallPV(short __si, int __a)
	{
		return (int)Assembly.__sysCall(__si, __a);
	}
	
	/**
	 * Invoke system call at the given index, with arguments.
	 *
	 * @param __si System call index.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @return The result of the invocation.
	 * @since 2019/05/23
	 */
	public static final int sysCallPV(short __si, int __a, int __b)
	{
		return (int)Assembly.__sysCall(__si, __a, __b);
	}
	
	/**
	 * Invoke system call at the given index, with arguments.
	 *
	 * @param __si System call index.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @return The result of the invocation.
	 * @since 2019/05/23
	 */
	public static final int sysCallPV(short __si, int __a, int __b, int __c)
	{
		return (int)Assembly.__sysCall(__si, __a, __b, __c);
	}
	
	/**
	 * Invoke system call at the given index, with arguments.
	 *
	 * @param __si System call index.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @return The result of the invocation.
	 * @since 2019/05/23
	 */
	public static final int sysCallPV(short __si, int __a, int __b, int __c,
		int __d)
	{
		return (int)Assembly.__sysCall(__si, __a, __b, __c, __d);
	}
	
	/**
	 * Invoke system call at the given index, with arguments.
	 *
	 * @param __si System call index.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @param __e Argument.
	 * @return The result of the invocation.
	 * @since 2019/05/23
	 */
	public static final int sysCallPV(short __si, int __a, int __b, int __c,
		int __d, int __e)
	{
		return (int)Assembly.__sysCall(__si, __a, __b, __c, __d, __e);
	}
	
	/**
	 * Invoke system call at the given index, with arguments.
	 *
	 * @param __si System call index.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @param __e Argument.
	 * @param __f Argument.
	 * @return The result of the invocation.
	 * @since 2019/05/23
	 */
	public static final int sysCallPV(short __si, int __a, int __b, int __c,
		int __d, int __e, int __f)
	{
		return (int)Assembly.__sysCall(__si, __a, __b, __c, __d, __e, __f);
	}
	
	/**
	 * Invoke system call at the given index, with arguments.
	 *
	 * @param __si System call index.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @param __e Argument.
	 * @param __f Argument.
	 * @param __g Argument.
	 * @return The result of the invocation.
	 * @since 2019/05/23
	 */
	public static final int sysCallPV(short __si, int __a, int __b, int __c,
		int __d, int __e, int __f, int __g)
	{
		return (int)Assembly.__sysCall(__si, __a, __b, __c, __d, __e, __f, __g);
	}
	
	/**
	 * Invoke system call at the given index, with arguments.
	 *
	 * @param __si System call index.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @param __e Argument.
	 * @param __f Argument.
	 * @param __g Argument.
	 * @param __h Argument.
	 * @return The result of the invocation.
	 * @since 2019/05/23
	 */
	public static final int sysCallPV(short __si, int __a, int __b, int __c,
		int __d, int __e, int __f, int __g, int __h)
	{
		return (int)Assembly.__sysCall(__si, __a, __b, __c, __d, __e, __f, __g,
			__h);
	}
	
	/**
	 * Invoke system call at the given index.
	 *
	 * @param __si System call index.
	 * @return The result of the invocation.
	 * @since 2019/05/23
	 */
	public static final long sysCallPVL(short __si)
	{
		return Assembly.__sysCall(__si);
	}
	
	/**
	 * Invoke system call at the given index, with arguments.
	 *
	 * @param __si System call index.
	 * @param __a Argument.
	 * @return The result of the invocation.
	 * @since 2019/05/23
	 */
	public static final long sysCallPVL(short __si, int __a)
	{
		return Assembly.__sysCall(__si, __a);
	}
	
	/**
	 * Invoke system call at the given index, with arguments.
	 *
	 * @param __si System call index.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @return The result of the invocation.
	 * @since 2019/05/23
	 */
	public static final long sysCallPVL(short __si, int __a, int __b)
	{
		return Assembly.__sysCall(__si, __a, __b);
	}
	
	/**
	 * Invoke system call at the given index, with arguments.
	 *
	 * @param __si System call index.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @return The result of the invocation.
	 * @since 2019/05/23
	 */
	public static final long sysCallPVL(short __si, int __a, int __b, int __c)
	{
		return Assembly.__sysCall(__si, __a, __b, __c);
	}
	
	/**
	 * Invoke system call at the given index, with arguments.
	 *
	 * @param __si System call index.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @return The result of the invocation.
	 * @since 2019/05/23
	 */
	public static final long sysCallPVL(short __si, int __a, int __b, int __c,
		int __d)
	{
		return Assembly.__sysCall(__si, __a, __b, __c, __d);
	}
	
	/**
	 * Invoke system call at the given index, with arguments.
	 *
	 * @param __si System call index.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @param __e Argument.
	 * @return The result of the invocation.
	 * @since 2019/05/23
	 */
	public static final long sysCallPVL(short __si, int __a, int __b, int __c,
		int __d, int __e)
	{
		return Assembly.__sysCall(__si, __a, __b, __c, __d, __e);
	}
	
	/**
	 * Invoke system call at the given index, with arguments.
	 *
	 * @param __si System call index.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @param __e Argument.
	 * @param __f Argument.
	 * @return The result of the invocation.
	 * @since 2019/05/23
	 */
	public static final long sysCallPVL(short __si, int __a, int __b, int __c,
		int __d, int __e, int __f)
	{
		return Assembly.__sysCall(__si, __a, __b, __c, __d, __e, __f);
	}
	
	/**
	 * Invoke system call at the given index, with arguments.
	 *
	 * @param __si System call index.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @param __e Argument.
	 * @param __f Argument.
	 * @param __g Argument.
	 * @return The result of the invocation.
	 * @since 2019/05/23
	 */
	public static final long sysCallPVL(short __si, int __a, int __b, int __c,
		int __d, int __e, int __f, int __g)
	{
		return Assembly.__sysCall(__si, __a, __b, __c, __d, __e, __f, __g);
	}
	
	/**
	 * Invoke system call at the given index, with arguments.
	 *
	 * @param __si System call index.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @param __e Argument.
	 * @param __f Argument.
	 * @param __g Argument.
	 * @param __h Argument.
	 * @return The result of the invocation.
	 * @since 2019/05/23
	 */
	public static final long sysCallPVL(short __si, int __a, int __b, int __c,
		int __d, int __e, int __f, int __g, int __h)
	{
		return Assembly.__sysCall(__si, __a, __b, __c, __d, __e, __f, __g,
			__h);
	}
	
	/**
	 * Invoke system call at the given index.
	 *
	 * @param __si System call index.
	 * @return The result of the invocation.
	 * @since 2019/05/23
	 */
	public static final int sysCallV(short __si)
	{
		return (int)Assembly.__sysCall(__si);
	}
	
	/**
	 * Invoke system call at the given index, with arguments.
	 *
	 * @param __si System call index.
	 * @param __a Argument.
	 * @return The result of the invocation.
	 * @since 2019/05/23
	 */
	public static final int sysCallV(short __si, int __a)
	{
		return (int)Assembly.__sysCall(__si, __a);
	}
	
	/**
	 * Invoke system call at the given index, with arguments.
	 *
	 * @param __si System call index.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @return The result of the invocation.
	 * @since 2019/05/23
	 */
	public static final int sysCallV(short __si, int __a, int __b)
	{
		return (int)Assembly.__sysCall(__si, __a, __b);
	}
	
	/**
	 * Invoke system call at the given index, with arguments.
	 *
	 * @param __si System call index.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @return The result of the invocation.
	 * @since 2019/05/23
	 */
	public static final int sysCallV(short __si, int __a, int __b, int __c)
	{
		return (int)Assembly.__sysCall(__si, __a, __b, __c);
	}
	
	/**
	 * Invoke system call at the given index, with arguments.
	 *
	 * @param __si System call index.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @return The result of the invocation.
	 * @since 2019/05/23
	 */
	public static final int sysCallV(short __si, int __a, int __b, int __c,
		int __d)
	{
		return (int)Assembly.__sysCall(__si, __a, __b, __c, __d);
	}
	
	/**
	 * Invoke system call at the given index, with arguments.
	 *
	 * @param __si System call index.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @param __e Argument.
	 * @return The result of the invocation.
	 * @since 2019/05/23
	 */
	public static final int sysCallV(short __si, int __a, int __b, int __c,
		int __d, int __e)
	{
		return (int)Assembly.__sysCall(__si, __a, __b, __c, __d, __e);
	}
	
	/**
	 * Invoke system call at the given index, with arguments.
	 *
	 * @param __si System call index.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @param __e Argument.
	 * @param __f Argument.
	 * @return The result of the invocation.
	 * @since 2019/05/23
	 */
	public static final int sysCallV(short __si, int __a, int __b, int __c,
		int __d, int __e, int __f)
	{
		return (int)Assembly.__sysCall(__si, __a, __b, __c, __d, __e, __f);
	}
	
	/**
	 * Invoke system call at the given index, with arguments.
	 *
	 * @param __si System call index.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @param __e Argument.
	 * @param __f Argument.
	 * @param __g Argument.
	 * @return The result of the invocation.
	 * @since 2019/05/23
	 */
	public static final int sysCallV(short __si, int __a, int __b, int __c,
		int __d, int __e, int __f, int __g)
	{
		return (int)Assembly.__sysCall(__si, __a, __b, __c, __d, __e, __f, __g);
	}
	
	/**
	 * Invoke system call at the given index, with arguments.
	 *
	 * @param __si System call index.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @param __e Argument.
	 * @param __f Argument.
	 * @param __g Argument.
	 * @param __h Argument.
	 * @return The result of the invocation.
	 * @since 2019/05/23
	 */
	public static final int sysCallV(short __si, int __a, int __b, int __c,
		int __d, int __e, int __f, int __g, int __h)
	{
		return (int)Assembly.__sysCall(__si, __a, __b, __c, __d, __e, __f, __g,
			__h);
	}
	
	/**
	 * Invoke system call at the given index.
	 *
	 * @param __si System call index.
	 * @return The result of the invocation.
	 * @since 2019/05/23
	 */
	public static final long sysCallVL(short __si)
	{
		return Assembly.__sysCall(__si);
	}
	
	/**
	 * Invoke system call at the given index, with arguments.
	 *
	 * @param __si System call index.
	 * @param __a Argument.
	 * @return The result of the invocation.
	 * @since 2019/05/23
	 */
	public static final long sysCallVL(short __si, int __a)
	{
		return Assembly.__sysCall(__si, __a);
	}
	
	/**
	 * Invoke system call at the given index, with arguments.
	 *
	 * @param __si System call index.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @return The result of the invocation.
	 * @since 2019/05/23
	 */
	public static final long sysCallVL(short __si, int __a, int __b)
	{
		return Assembly.__sysCall(__si, __a, __b);
	}
	
	/**
	 * Invoke system call at the given index, with arguments.
	 *
	 * @param __si System call index.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @return The result of the invocation.
	 * @since 2019/05/23
	 */
	public static final long sysCallVL(short __si, int __a, int __b, int __c)
	{
		return Assembly.__sysCall(__si, __a, __b, __c);
	}
	
	/**
	 * Invoke system call at the given index, with arguments.
	 *
	 * @param __si System call index.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @return The result of the invocation.
	 * @since 2019/05/23
	 */
	public static final long sysCallVL(short __si, int __a, int __b, int __c,
		int __d)
	{
		return Assembly.__sysCall(__si, __a, __b, __c, __d);
	}
	
	/**
	 * Invoke system call at the given index, with arguments.
	 *
	 * @param __si System call index.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @param __e Argument.
	 * @return The result of the invocation.
	 * @since 2019/05/23
	 */
	public static final long sysCallVL(short __si, int __a, int __b, int __c,
		int __d, int __e)
	{
		return Assembly.__sysCall(__si, __a, __b, __c, __d, __e);
	}
	
	/**
	 * Invoke system call at the given index, with arguments.
	 *
	 * @param __si System call index.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @param __e Argument.
	 * @param __f Argument.
	 * @return The result of the invocation.
	 * @since 2019/05/23
	 */
	public static final long sysCallVL(short __si, int __a, int __b, int __c,
		int __d, int __e, int __f)
	{
		return Assembly.__sysCall(__si, __a, __b, __c, __d, __e, __f);
	}
	
	/**
	 * Invoke system call at the given index, with arguments.
	 *
	 * @param __si System call index.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @param __e Argument.
	 * @param __f Argument.
	 * @param __g Argument.
	 * @return The result of the invocation.
	 * @since 2019/05/23
	 */
	public static final long sysCallVL(short __si, int __a, int __b, int __c,
		int __d, int __e, int __f, int __g)
	{
		return Assembly.__sysCall(__si, __a, __b, __c, __d, __e, __f, __g);
	}
	
	/**
	 * Invoke system call at the given index, with arguments.
	 *
	 * @param __si System call index.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @param __e Argument.
	 * @param __f Argument.
	 * @param __g Argument.
	 * @param __h Argument.
	 * @return The result of the invocation.
	 * @since 2019/05/23
	 */
	public static final long sysCallVL(short __si, int __a, int __b, int __c,
		int __d, int __e, int __f, int __g, int __h)
	{
		return Assembly.__sysCall(__si, __a, __b, __c, __d, __e, __f, __g,
			__h);
	}
	
	/**
	 * Internal invocation call handling.
	 *
	 * @param __addr Method address.
	 * @param __args Arguments.
	 * @return The result.
	 * @since 2019/05/23
	 */
	private static final int __invoke(int __addr, int... __args)
	{
		throw new todo.TODO();
	}
	
	/**
	 * Internal system call handling.
	 *
	 * @param __si System call index.
	 * @param __args Arguments.
	 * @return The result.
	 * @since 2019/05/23
	 */
	private static final long __sysCall(short __si, int... __args)
	{
		// Make at least 8!
		if (__args == null)
			__args = new int[8];
		else if (__args.length < 8)
			__args = Arrays.copyOf(__args, 8);
		
		// Get thread data
		ThreadData data = _THREAD_DATA.get();
		if (data == null)
			_THREAD_DATA.set((data = new ThreadData()));
			
		// The error ID
		int eid = ((__si < 0 || __si >= SystemCallIndex.NUM_SYSCALLS) ?
			SystemCallIndex.QUERY_INDEX : __si);
		
		// Error state for the last call of this type
		int[] errors = data.errors;
		
		// Try executing it
		try
		{
			// Execute call
			long rv = Assembly.__sysCallInternal(data, __si, __args);
			
			// No error
			errors[eid] = 0;
			
			// Return the result
			return rv;
		}
		
		// Exception was caught
		catch (RuntimeException e)
		{
			// Use thrown error code?
			if (e instanceof SystemCallException)
				errors[eid] = ((SystemCallException)e).code;
			
			// Otherwise set as unknown
			else
				errors[eid] = SystemCallError.UNKNOWN;
			
			// Fail
			return 0;
		}
	}
	
	/**
	 * Internal system call handling.
	 *
	 * @param __data The thread data.
	 * @param __si System call index.
	 * @param __args Arguments.
	 * @return The result.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/12/29
	 */
	private static final long __sysCallInternal(ThreadData __data,
		short __si, int... __args)
		throws NullPointerException
	{
		// Depends on the system call type
		switch (__si)
		{
				// Check if system call is supported
			case SystemCallIndex.QUERY_INDEX:
				switch (__args[0])
				{
					case SystemCallIndex.API_LEVEL:
					case SystemCallIndex.CALL_STACK_HEIGHT:
					case SystemCallIndex.CALL_STACK_ITEM:
					case SystemCallIndex.ERROR_GET:
					case SystemCallIndex.ERROR_SET:
					case SystemCallIndex.EXCEPTION_LOAD:
					case SystemCallIndex.EXCEPTION_STORE:
					case SystemCallIndex.EXIT:
					case SystemCallIndex.FRAMEBUFFER:
					case SystemCallIndex.IPC_CALL:
					case SystemCallIndex.GARBAGE_COLLECT:
					case SystemCallIndex.LOAD_STRING:
					case SystemCallIndex.PD_OF_STDERR:
					case SystemCallIndex.PD_OF_STDIN:
					case SystemCallIndex.PD_OF_STDOUT:
					case SystemCallIndex.PD_WRITE_BYTE:
					case SystemCallIndex.SLEEP:
					case SystemCallIndex.TIME_MILLI_WALL:
					case SystemCallIndex.TIME_NANO_MONO:
					case SystemCallIndex.VMI_MEM_FREE:
					case SystemCallIndex.VMI_MEM_MAX:
					case SystemCallIndex.VMI_MEM_USED:
						return 1;
					
					default:
						return 0;
				}
				
				// API level
			case SystemCallIndex.API_LEVEL:
				return ApiLevel.LEVEL_SQUIRRELJME_0_3_0_DEV;
				
				// Call trace height
			case SystemCallIndex.CALL_STACK_HEIGHT:
				// Remove traces for sysCall() and this method
				return new Throwable().getStackTrace().length -
					_EXTRA_STACK_DEPTH;
				
				// Call trace item
			case SystemCallIndex.CALL_STACK_ITEM:
				{
					// Get the current stack
					StackTraceElement[] stk = new Throwable().getStackTrace();
					
					// Get element trace here
					// Remove traces for sysCall() and this method
					int depth = _EXTRA_STACK_DEPTH + __args[0];
					StackTraceElement ele = (depth < 0 || depth >= stk.length ?
						null : stk[depth]);
					
					// Fail?
					if (ele == null)
						throw new SystemCallException(
							SystemCallError.VALUE_OUT_OF_RANGE);
					
					// Handle normally
					else
					{
						// Depends
						switch (__args[1])
						{
								// Class name
							case CallStackItem.CLASS_NAME:
								return Assembly.__uniqueStringId(
									ele.getClassName().replace('.', '/'));

								// The method name.
							case CallStackItem.METHOD_NAME:
								return Assembly.__uniqueStringId(
									ele.getMethodName());

								// The current file.
							case CallStackItem.SOURCE_FILE:
								return Assembly.__uniqueStringId(
									ele.getFileName());

								// Source line.
							case CallStackItem.SOURCE_LINE:
								return ele.getLineNumber();

							default:
								throw new SystemCallException(
									SystemCallError.VALUE_OUT_OF_RANGE);
						}
					}
				}
				
				// Get error
			case SystemCallIndex.ERROR_GET:
				{
					// If the ID is valid then a bad array access will be used
					int dx = __args[0];
					if (dx < 0 || dx >= SystemCallIndex.NUM_SYSCALLS)
						dx = SystemCallIndex.QUERY_INDEX;
					
					// Return the stored error code
					return __data.errors[dx];
				}
				
				// Set error
			case SystemCallIndex.ERROR_SET:
				{
					// If the ID is valid then a bad array access will be used
					int dx = __args[0];
					if (dx < 0 || dx >= SystemCallIndex.NUM_SYSCALLS)
						dx = SystemCallIndex.QUERY_INDEX;
					
					// Return last error code, and set new one
					long rv = __data.errors[dx];
					__data.errors[dx] = __args[0];
					return rv;
				}
				
				// Load IPC Exception
			case SystemCallIndex.EXCEPTION_LOAD:
				return __data.exception;
				
				// Store IPC Exception
			case SystemCallIndex.EXCEPTION_STORE:
				{
					long rv = __data.exception;
					__data.exception = __args[0];
					return rv;
				}
				
				// Exit the VM
			case SystemCallIndex.EXIT:
				System.exit(__args[0]);
				return 0;
				
				// Property of the framebuffer
			case SystemCallIndex.FRAMEBUFFER:
				try
				{
					return SwingFramebuffer.instance().vfb.
						framebufferControl(__args);
				}
				catch (Throwable t)
				{
					// Print the exception
					t.printStackTrace();
					
					// Drop
					throw new SystemCallException(
						SystemCallError.NO_FRAMEBUFFER);
				}
				
				// Invoke the garbage collector
			case SystemCallIndex.GARBAGE_COLLECT:
				Runtime.getRuntime().gc();
				return 0;
			
				// IPC Call
			case SystemCallIndex.IPC_CALL:
				try
				{
					return IPCManager.ipcCall(0, __args);
				}
				catch (RuntimeException e)
				{
					// Debug this
					e.printStackTrace();
					
					// Store class name caught
					__data.exception = Assembly.__uniqueStringId(
						e.getClass().getName().replace('.', '/'));
					
					// Fail
					throw new SystemCallException(
						SystemCallError.IPC_ERROR);
				}
				
				// Loads a string
			case SystemCallIndex.LOAD_STRING:
				return Assembly.__uniqueObjectId(
					Assembly.__uniqueString(__args[0]));
				
				// Pipe descriptor of standard input
			case SystemCallIndex.PD_OF_STDIN:
				return 0;
				
				// Pipe descriptor of standard output
			case SystemCallIndex.PD_OF_STDOUT:
				return 1;
				
				// Pipe descriptor of standard error
			case SystemCallIndex.PD_OF_STDERR:
				return 2;
				
				// Write single byte to PD
			case SystemCallIndex.PD_WRITE_BYTE:
				{
					// Depends on the stream
					int pd = __args[0];
					OutputStream os = (pd == 1 ? System.out :
						(pd == 2 ? System.err : null));
					
					// Write
					if (os != null)
					{
						try
						{
							os.write(__args[1]);
							
							// Okay
							return 1;
						}
						
						// Failed
						catch (IOException e)
						{
							throw new SystemCallException(
								SystemCallError.PIPE_DESCRIPTOR_BAD_WRITE);
						}
					}
					
					// Failed
					else
					{
						throw new SystemCallException(
							SystemCallError.PIPE_DESCRIPTOR_INVALID);
					}
				}
				
				// Sleep
			case SystemCallIndex.SLEEP:
				try
				{
					Thread.sleep(__args[0], __args[1]);
					return 0;
				}
				catch (InterruptedException e)
				{
					throw new SystemCallException(SystemCallError.INTERRUPTED);
				}
			
				// Current wall clock milliseconds
			case SystemCallIndex.TIME_MILLI_WALL:
				return System.currentTimeMillis();
				
				// Current monotonic clock nanoseconds
			case SystemCallIndex.TIME_NANO_MONO:
				return System.nanoTime();
			
				// VM information: Memory free bytes
			case SystemCallIndex.VMI_MEM_FREE:
				return (int)Math.min(Integer.MAX_VALUE,
					Runtime.getRuntime().freeMemory());
			
				// VM information: Memory used bytes
			case SystemCallIndex.VMI_MEM_USED:
				return (int)Math.min(Integer.MAX_VALUE,
					Runtime.getRuntime().totalMemory());
			
				// VM information: Memory max bytes
			case SystemCallIndex.VMI_MEM_MAX:
				return (int)Math.min(Integer.MAX_VALUE,
					Runtime.getRuntime().maxMemory());
			
			default:
				throw new SystemCallException(
					SystemCallError.UNSUPPORTED_SYSTEM_CALL);
		}
	}
	
	/**
	 * Returns the unique object for the given ID.
	 *
	 * @param __id The ID to get the object of.
	 * @return The object for the given ID.
	 * @since 2019/06/17
	 */
	private static Object __uniqueObject(int __id)
	{
		if (__id == 0)
			return null;
			
		// {@squirreljme.error AF0e Aliased pointer to object. (Value)}
		if (false)
			new Throwable(String.format("AF0e %08x", __id)).printStackTrace();
			
		Map<Object, Integer> objects = Assembly._OBJECTS;
		synchronized (objects)
		{
			for (Map.Entry<Object, Integer> e : objects.entrySet())
				if (__id == e.getValue().intValue())
					return e.getKey();
		}
		
		return null;
	}
	
	/**
	 * Returns the unique ID of the given object.
	 *
	 * @param __o The object to get.
	 * @return The ID of the given object.
	 * @since 2019/06/17
	 */
	private static int __uniqueObjectId(Object __o)
	{
		if (__o == null)
			return 0;
			
		// {@squirreljme.error AF0d Aliased object to pointer. (Value)}
		if (false)
			new Throwable(String.format("AF0d %s@%x", __o.getClass().
				getName(), System.identityHashCode(__o))).printStackTrace();
		
		Map<Object, Integer> objects = Assembly._OBJECTS;
		synchronized (objects)
		{
			Integer rv = objects.get(__o);
			if (rv == null)
				objects.put(__o, (rv = 1 + objects.size()));
			return rv;
		}
	}
	
	/**
	 * Returns the unique string for the given ID.
	 *
	 * @param __id The ID to get.
	 * @return The resulting string.
	 * @since 2019/06/17
	 */
	private static String __uniqueString(int __id)
	{
		if (__id == 0)
			return null;
		
		Map<String, Integer> strings = Assembly._STRINGS;
		synchronized (strings)
		{
			for (Map.Entry<String, Integer> e : strings.entrySet())
				if (__id == e.getValue().intValue())
					return e.getKey();
		}
		
		return null;
	}
	
	/**
	 * Returns an ID for the given unique string.
	 *
	 * @param __s The string to get the ID of.
	 * @return The unique string ID.
	 * @since 2019/06/17
	 */
	private static int __uniqueStringId(String __s)
	{
		if (__s == null)
			return 0;
		
		Map<String, Integer> strings = Assembly._STRINGS;
		synchronized (strings)
		{
			Integer rv = strings.get(__s);
			if (rv == null)
				strings.put(__s, (rv = 1 + strings.size()));
			return rv;
		}
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






















































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted bldt/javase/libs/javase-runtime/cc/squirreljme/jvm/FramebufferPanel.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm;

import javax.swing.JPanel;

/**
 * Panel which acts as the framebuffer.
 *
 * @since 2020/01/18
 */
public class FramebufferPanel
	extends JPanel
{
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<














































Deleted bldt/javase/libs/javase-runtime/cc/squirreljme/jvm/SwingFramebuffer.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm;

import cc.squirreljme.runtime.lcdui.vfb.VirtualFramebuffer;
import java.awt.Dimension;
import java.awt.Image;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.WindowConstants;
import net.multiphasicapps.io.MIMEFileDecoder;

/**
 * This is a framebuffer that uses Java SE's Swing framework.
 *
 * @since 2019/12/28
 */
public final class SwingFramebuffer
{
	/** The singular created instance. */
	private static SwingFramebuffer _INSTANCE;
	
	/** Virtual framebuffer to use. */
	protected final VirtualFramebuffer vfb =
		new VirtualFramebuffer(new DefaultIPCRouter());
	
	/** Main frame for the framebuffer. */
	protected final JFrame frame;
	
	/** The panel for the framebuffer. */
	protected final FramebufferPanel panel;
	
	/**
	 * Sets global Swing settings.
	 *
	 * @since 2018/11/18
	 */
	static
	{
		try
		{
			// Setting this to true greatly increases the speed of the canvas
			// however this breaks on Windows 10 with pointer coordinates
			// being way off when scaling is used. So this must be false.
			JFrame.setDefaultLookAndFeelDecorated(false);
		}
		catch (Throwable t)
		{
			t.printStackTrace();
		}
	}
	
	/**
	 * Initializes the swing framebuffer.
	 *
	 * @since 2020/01/18
	 */
	public SwingFramebuffer()
	{
		// Setup frame and panel
		JFrame frame = new JFrame();
		FramebufferPanel panel = new FramebufferPanel();
		
		// Exit when close is pressed
		frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
		
		// Initial title
		frame.setTitle("SquirrelJME");
		
		// Load icons
		try
		{
			frame.setIconImages(SwingFramebuffer.__loadIcons());
		}
		catch (IOException e)
		{
			e.printStackTrace();
		}
		
		// Use a better panel size
		frame.setMinimumSize(new Dimension(160, 160));
		frame.setPreferredSize(new Dimension(640, 480));
		
		// Panel becomes part of the frame now
		frame.add(panel);
		
		// Pack the frame
		frame.pack();
		
		// Make the frame visible and set its properties
		frame.setLocationRelativeTo(null);
		frame.setVisible(true);
		
		// Set
		this.frame = frame;
		this.panel = panel;
	}
	
	/**
	 * Returns an instance of the framebuffer.
	 *
	 * @return The framebuffer instance.
	 * @since 2019/12/28
	 */
	public static final SwingFramebuffer instance()
	{
		SwingFramebuffer rv = _INSTANCE;
		if (rv == null)
			_INSTANCE = (rv = new SwingFramebuffer());
		return rv;
	}
	
	/**
	 * Loads the program icons.
	 *
	 * @return The icons.
	 * @throws IOException If the icons could not be read.
	 * @since 2020/01/18
	 */
	private static final List<Image> __loadIcons()
		throws IOException
	{
		List<Image> rv = new ArrayList<>();
		
		// Use a fixed set of sizes
		for (int i : new int[]{8, 16, 24, 32, 48, 64})
		{
			// Format of the icons
			String rcname = String.format("head_%dx%d.png", i, i);
			
			// Icon data that has been loaded
			byte[] icondata = null;
			
			// Load data
			try (InputStream rin = SwingFramebuffer.class.
					getResourceAsStream(rcname);
				InputStream min = SwingFramebuffer.class.
					getResourceAsStream(rcname + ".__mime");
				InputStream in = (rin != null ? rin : (min != null ?
					new MIMEFileDecoder(min, "utf-8") : null)))
			{
				if (in == null)
					continue;
					
				// Read
				try (ByteArrayOutputStream baos = new ByteArrayOutputStream())
				{
					// Copu
					byte[] buf = new byte[512];
					for (;;)
					{
						int rc = in.read(buf);
						
						if (rc < 0)
							break;
						
						baos.write(buf, 0, rc);
					}
					
					// Store
					icondata = baos.toByteArray();
				}
			}
			
			// Use the given data
			if (icondata != null)
				rv.add(new ImageIcon(icondata).getImage());
		}
		
		return rv;
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


















































































































































































































































































































































































Deleted bldt/javase/libs/javase-runtime/cc/squirreljme/jvm/SystemCallException.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm;

/**
 * This is an exception for system calls.
 *
 * @since 2019/12/29
 */
public class SystemCallException
	extends RuntimeException
{
	/** The error code. */
	public final int code;
	
	/**
	 * Initializes the exception.
	 *
	 * @param __code The error code.
	 * @throws IllegalArgumentException If this is zero or positive.
	 * @since 2019/12/29
	 */
	public SystemCallException(int __code)
		throws IllegalArgumentException
	{
		// {@squirreljme.error AF0f Invalid system call error code.}
		if (__code >= 0)
			throw new IllegalArgumentException("AF0f");
		
		this.code = __code;
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
















































































Deleted bldt/javase/libs/javase-runtime/cc/squirreljme/jvm/ThreadData.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm;

/**
 * This represents local thread data.
 *
 * @since 2019/12/29
 */
public final class ThreadData
{
	/** Errors used in system calls. */
	public final int[] errors =
		new int[SystemCallIndex.NUM_SYSCALLS];
	
	/** The exception pointer. */
	public int exception;
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




















































Deleted bldt/javase/libs/javase-runtime/cc/squirreljme/jvm/head_128x128.png.__mime.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
begin-base64 644 head_128x128.png
iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAMAAAD04JH5AAADAFBMVEUAAAAA
AQABBAAJAgEOAQoDBgEZAQ0HCgYOCAYiCA8NDwsTDw47AxgzCBwSFBFPAyoW
FxUbFxZZBiBjAjAjGyAhHh0eHx2HABh6Aj2JAB9mDCqUABlrDCgiJCEnIyOO
AzItIi0lJyWXBRaSBT4vJiY5IjFcGTCRB0svKyorLSo0Kys1MTA8MDsyNDGj
FBe1DUKRGi82ODU/NjasFxY8ODfGEBa5FBc5OzjSC0TeDRbPD0hEOkrUEhlB
PTzXDkKeHlrmDhM9Pzz1CxPWFRHNGBRJPz1BQ0BGQkHsFBvtFQ/cGCy4JCZO
Qz6aLD34FAxFR0RKRkVISkjUHlTMJihWSklQTEtMTkuhOUpQUk9SUkpVUVBh
T029M2BaVVRdVFpVV1RXV0+NR27PODeoRVddXVWuQnRnW1ZcX1xiXl3gOWNi
YVlpYGVyX1xiZGLzPDrdQ0JuY2RmZl5qZWSvUHblQHTXSUfaSk9sbGRwbWuC
aWh5bGdwcGh/bGlzdGt+cWx3dHN3d2+HcIv0V1h+eXh7e3PhXl9/f3eCfn2+
a5OWe3uOgXyFhX3mZpiafaCJhYOFh4SMjISPi4mXioWSjIX3b3HdeXmqiImT
j46RkYijjIqVlYyZlJOYmI/kg4LqgbSfm5n2goWdnZTNjarbiqGymZa5lLuh
oZm9mZWkoJ6voK6lpZzck8aqpqSxpaapqaDpmZrZnbfKoM+traWzrKWyrav5
mZjLp6K5ra3IqqSxsai1tay5trTBtLXXrce5ubD4p6i9vbTIvL3Dvr3FvrfY
urPrseXttLvXuN7Bwrniu83ovLnHx77KxsTNxr7RxcXjwMbMyrviws7rwPb6
wsPqyMLS0MHT0M7bzs/nz8bU1cvq0sjh1NXd1s/8z8za2df00s7a2tHc2svl
2dnh3tz+1tTi4NHp3d3o4trt4eHn5dbp5OL049j14fvq5+Xr6drv6OD65ejv
7d7z7OT48On08uP08vD58P3+8vL89O329u359+f8+ur/+vr+/Oz9/vT9//zR
JTWlAAAAAXRSTlMAQObYZgAAAAFiS0dEAIgFHUgAAAAJcEhZcwAADdcAAA3X
AUIom3gAAAAHdElNRQfiChMCMARE69Z9AAAXBklEQVR42s1bf1ibx33Pc/Qt
2ktLoRlquxY62q2GUdwSY6vuQmPhViyNWyArFJNpsI7GjMXNxNKJjjC0QERS
rUTMTVFBmUrnUU1T1E6mdYVdVcRdRyKHKE5kpmFSS7FeI9JK1Y80+H1z9u69
9xXSK70Swk6fZ/cHSHrv7vu57+/73r233fb/ugFwK4930enmBoNi4rcMAOQf
TMgKmRzcAoL8YwlptPa3CgCN7MwzFhBuOFyADEDXTUJAw6SLIA99PYT24gLm
cUpvCgEAJFDTuUcSMgbC8M4zA0Cr0FS7RwCkTrAIK0FOBvghaq07A6iGDpYJ
u2eAG5Z44BzIRd/A0oeWHWUA5qG7DHp2zQJQAWHoMswlA6KewQASBNhRAvBy
CMJdswA4X8MU1EB8Wg/kWu8OdgCGcbfXnLsEAEpf83JLFGUBOcDTh94dnCVi
AO72WunuEIC5kxyP4YwIBUCGkgCggshL38B3O3kC7E4FXzuRpFCVPZJ1Acm2
nE8LQE2y2z+/tis1BH0nk0IWsXVQmkgBgEeJPOsIJ3t5Tip3BeB/709RcGci
IAxp9GGYzOkrtlUVtfv/ZxcAAPnyQBoJpxCBkAEQ2nIIAQBnWq+Bl8nCEYBv
Pz6fTsJNpEMQMgA1bREQI4+CVVqbf/zruwDwiyMhAYmQNIUAlCQyAEC1kAds
XxTJMqY48ouCAQDJek0mDf02guJxmNWMRAoCYNkFgD6zT826pFAE4OHv3S8Y
S8djkUsVHAQAgtkAoFcBigFuJFAcLQaloawu93/v4YIB/Oxrafjp2AbFtkAj
RkC0QtHm0dRKACiV6/xwkaiPMVkd9F/7GSjUC135zLb+0hFEe2WssaREuVaH
ASzCnVoIrFCbdOavzs9cKdAXgfL1cp6DDEt+qZuQ6d3LtW1rKKSBcmZHAAxx
Fg3LRBBE0xYI4O+fI7kxcTTPaj/Rg+NSqLJ7hQDkONy5VZjRwM3MX8nnHigQ
wI9/xBlBDE0zVSJPurNgddMUAN6dOQAbpliliWWawY9+XCCAl791hGf/SkuJ
Jc3pNtSUV0J6ZwDySay214S/tn3r5QIBXHn8fo6+uaRTYE6JXlLDZAJgcgLY
ED66//EroDAjWH9AA2GECgxJMp0uTbi2MgFcywZQO02JINA8sF7YZrJi/T49
kv9qk9SdOfMyScczVkzHRZSwpm1wdpVVxPTO+vsKMwPwhfUjc1vUSo08nDWz
th1mqlZMhAN6nbZHWtRipQTuYO7I+pGCADy8fodt83R5j4i2KXQwkvHTZi6l
9I5I6szpmmi7Y/0fCgLw7fU7TlnJcRHlYkgXzDBvmsptDGGtpGOF2hbR4h3r
3y4IwI/X68aK9WIz+kCC2ciQQCYAOhZJLTrYTk5t+wNn3frJAgFUETOiS7JJ
YSIDQCTje5zaEMjEIlEGIhwzXY3rBXki8LPvEXPiPFW3w6sZBDM8bjzT+KGv
tmaFMwbXHesFxUNwMsv8k02mgZc2MlQgIvyaFYNgoqf8LNZU55ECAZRoc2mV
1Aifz1xxRKgRMRHVHSetrFwWv1AQACBR5VTrUgc8J1S6iJDiBiVqlHrChCRj
e6AgAISMzh3nPfCUEMCGAACTHYN5HyQxbcK5hwsBQEjDORkQRemgWQCAEQZd
WkwCPAJrzPB4AVYACG9uxxIEUdpEpWv5FkXFBV/jucYaCOvXT+4MABCWPGHe
B+jwfFLKDJ8yxQUMuZZzsI7s/tHOjojo5ZciOocLwJApSTHM50yCNW/mSZc0
5HPrj+9UTymLcsZ1LReA6HSSop8zAiEHruVLVbv+aP1rO9WeXRz9DfEp3IBm
JpJ65uGMQACA3bPlztgSdffdlx8A0cfrcjyXDiTgaNLzYKwo50iXVjDJmRzj
JX+QnwHFOAFkNigm14YjBIeSpu7gAaRznc2g8lgRNObfHfLb7lhOY2aAFwHg
HYGFcwNpro+hEaiQP58ayPIWlCrxXNeo3LZELsLjSZIznBtIAxBmQbmDopR5
nvryFZSIed65buRcQdkcHAjwGjJDY7BpANwQsdAu7kjDfHqvLs5jgjTvWmI5
AVSOQ+0S/3wmzG3dELuivKuBKJufz+HJg5xuhItBHg1gsAZSWzkBKNqhbZY1
A4TVGOQAbEGaE7u7C2p9cHE+hwT8nImPFOesSyXoKDdlHmdWBv1YCxFD57xJ
Dni4kk1rH3Tooa9BbGA8EofeRS6e5GABMYAteJMSZhhC36YHUaaDFTsibllO
coArGPiB0e8bgIlKpxiCa9TmltOVr7hMuFjfFs/Y1MbPpxWk6HGCcELlKtJC
RNxpSwLg4td4a8hA9/hga72oF6FR5mBgl5ijcA9KGdqNfXuaEdIbZ6+meZna
SnelBhpMiEfI4D16DkAcGySky2xQDVUjSExiGTVNo3Rxc5hdjvhBF6GGrgR2
LCk3GKdOn0/tc9oJTQL21kLfIOqCFh3UcH4gDvEWwkXSUOsf6Qt7e8mQmBWE
kM2eZ6sbelIMAGljOcmuaCOVYJ59OmnkUTWhCuJ4GIVNiO3zUZjow0kwFY9i
AMMokAeH3cPDsEtxVLSIFUKxe3I5hxqytTcjVxKJbNNfnUx+ni+rV2vdMBiE
5DxUrlAxJ9KXTh6AF+tAJfrrrfa3q9yePtIuhsAe3aQC3bS4DEApZN3YRkoH
ETOGApw0wr2l885SrVodtMtK5dA2Rm360M6llYsFccci9rFRSNdrFLZxRUij
KhXzx4whQVHmE+IyAK0wYeBUIJ5M9qbOcFi8UoXfZTGqLM4+KLeAcKIRdRpB
HEBuI4AAG9kYOIPM3641zmg67Ypwa6tcLCsI6xGH22LQK8YBFfTZEEfXeN+O
HOLKKKeONnKEP5+inaE5unQG9iBvjPYOI0gMqH9M50MP+4bhzFF3GI4MNDjk
bplULSYEp52iTJOQEXHHxDh0LyK2L/FGgKD2r2EGzKSnqYkw7KlkFgepTVUC
GtGDiwjAMMtvqR06O9kP+rJqp0zXQIrubkcuUYGma1CRDYA0QIeL1XvOESPl
sk5iKAaSdWxMPILUYzOGuBMinEzdGnXKCV0aDCAyEOJSlagLm5+3q2RqtIZA
ZiWS0agpasyKEuRsABZoYwFYuXwH+aOOQAzTX8bV2pXTVtPstDWAtv4NCqib
oi6NwyjSwksIVm8Y0s4ynJBg7d08q2wbUpYVaXiHwsRSCqE/R612bC1ne2Ny
DlociO4sdgM0KyqWAQ7kepFgAktTg10txyasU1OBuLvIF0Vq2A5hA4MBdEWh
T69IqnpkacJk6q6S1tQRKj45olcvJpPMRBdSw0siJ85IBBYLjAQmWQ6Er6Je
a8gHeBAuxJYzHQRXiQf1psmlSG0nHFygpv2wz4ddN7IG58AwT39z1jSa7F3U
x+cG186fjvBc0FupqSmYfYZI6uCiEUZWp1k/5N2kzg6iIBNF+QcCNYSm+sOP
fODd73wbmrR/9vQl4Pa3Ua8Y4IwRMsgOu8JwXs6lk8zGlLUc9Xr7O979ex/5
XQBKeUXYWpnlzTvRRq22bcmyABAj0K2HkSWcbSwiE1hCnBhooGF8qQZ89Bv/
8dAnP7Znz57b3w6AzLTU3wCVZ6lR6EPO+DxFHQ+F5qVcSI7NWotA0Tvfi/p+
4t6H/vOPAejjVh5fGQtwXmX8aarxqjpLCUA79A8jACwHwqeQrSCHaCf9kD5T
/tF/u3DhoU9+6q7Hnn32u3e9qwjUmV4hHL4O6hkfRM5nAam1320DPizsM2YC
vO32PXse+8mLP/ire//pwj8WlSq4eB5bGuKcfLCDGrIayOzLApA+inpNsqH2
IrUwRDEJKWLr+apvXLhw4V/u/dS9P3kRtR/sub0IKBdGy6NIC/SsEpyiqFmv
Yw5gMletJeBtaPnfRV2f/fm9D/3XhW9I2ls5HsTODlExGil264p5yC7JDkYJ
2A5jK2MIgJ6iBk+jf9U0jP31f//yl79585E7/+TnL+L2ZRbB9NUSVaSFstIW
AzxHUQsui547XzjfAd7O03/xxZe+89kfvvmbf5eo+YLfpnkUBS6USY2tNT6f
bYfAAzvp+OogAjBOUY2BeJRVoIu/uYHaG9+58yvPvfDCC2jWx/bseReoumQH
yxMm6hTyBKE16hm7UVuJVXABFL33y3ftefZF1PmFl3746UfQ4GfIkSi/dR9D
AnZBFErqLom4Qj3UeOhANzLDYWqthaJ1bGZ1maV/48r6V5sPfPxzn/viX/7t
XUi93gHMUCENNwUWmKMheJq6OGdU40yUVoLb9/zgsQ9/nO37xUe/ggHcOE+q
k9WLjrObjiBsW+l+PtsRADm0GxiqDQFQUU8PbTKVbHrtwgDWH7zz7sPvwe19
H9yz52NFSpgo7Ts1Rp2zzEATFdAZB7Afikl+B9nKB7me72k+tB8DuLFQquZ8
Ymy1cS2ihSemxszZGyRAJMJH4WYLigXHqMnp2DLJqpX7IjvDrx/cf6j5Q/y8
7/vYJ95ZwR7azylXlhKdrBZq5ro6ccYBPvCJD7+P73fg8wcPcABMPmkXp4gb
s/3UnNvXYR4TOUYmHFDGRFC2wyip/tNbA/jwmnmCneHNRw4cbj7IT/z+Q5/6
C4BWpCHOKalzKn94lRq1teIkTFP0Z5/lOfWeDzUf+vS+b2IAT0C/VJbgYlzb
6asqWLfUL3JuQByFw8uxMRN1rYNqW6VJLrvXvM5O8c29+w82H3w/O/Heuw/t
/wm+ltFQccJ03jsOzdTUohwXFoZ+/18PNx/mujXfffjAl15iB59BPipUXctV
dFYaA8PB7rNtTUDsroFzhLYOUVttVOOGu5hjmhuz4MqD+xCC5sP79x/8/N0H
n3yzAldCymTK1XO9tImyuutxbfNv/vzNLx1qbr5z//5Dn0f09z7yJju4h1WA
YGU1ikzR8Mbo5Dnt5GxLh0hSRBroeriGXGAr1RjZjm49r7KTfOeeffsPo7mb
mw8d/uobN7qwUoXInsGAw+JbW3FX41g0M3Fjff/Bu1Gvuw/deWDvg5gBZiOX
lUurUebmiKzVBBTnBlu6xbKySkbljiA97VxrjPWN8Busy+1YC755z94D++88
fPjwp7/66xs3prFAt7zk4Ox5FWOmnFIMIDh948Zzf4p77d+390s/ZUe+0spZ
QNQhlbohrd+cmDzuamnLvs6BQhih1baf6h4903O6KV6vTVZaLMcxgh/+3d69
+w4cuOepN9C3yzhpiUMn0b9yzmGi5vkUkLWZK48eOLBv3957HsXr/5XscjKz
95dIfdBxwlo12lfV2AJS99vAdqv11/umuxcG+qv0xXK9xcupgaEHK+IbP33q
yae+/2us1wxO29HjeaJ/TRu6uFCNdYC5jp/+4vtPPvnUS1j+rzTw52601zBQ
D0q0c63mjkl5XUd3imq6K1g2WK7WUY6xlgTQwvD8sN5gQ2mereHMDUG77qKT
ZWmLZPSZRev5Wmy0Tnhd2HFKzuZEIZtOrXeFDbVoibT/2FJbvbJf/EYNUR9t
jXcvXepoCYEZRqXyJtDgmZnl4JDC9HqKPEzMMShP4vawFnLK6lptwGboRdvv
FIRXJ2QGmlmembGFos7WOTjCSrkXqs40KQeVHeI7ZMI27DYNRerbgsBhawjP
c1HEazQuzx8/PvqEaeHitevJ7X4yy7OXPH3qGWVnKvO9/qvz1tmJoWNDLsZj
NGJV8jl9ZSEVioAEaQl2TCIGNOW4dyP190bqqK5uN7AwnpFUYu2dtwkvrqTV
cp3lZvtsvUhd1Da/XTJUG/1cYYIgo30LTd3dNbnKJDq1e9B6otvJXkFpTd9e
0Q5bKEfdxl81OSvN2gHYHGnD3Si5lAPMZIW7v0nWVpXzmuJy7/Pdz7fNAcRT
GRQWvNz2HBDCjYMVGeTtglPncLAX0lwABMRiw1BNS1XOUplcs9xysXFcglIc
RTCz2uNxilei6Z6S9LIM7fQIn8+70M6viKdQph+taqnIfWBhOGqeUPdIwbLX
qMu6rsK4sVivZ/2uZZl1nfvd68wsEmlGnAk1mXQ7491VLaV5jkx09pZTMgWh
0DMDIiW/qCeMbe36dSGK69exhSJ2e6JZg47p3IvbKQgg22payDwF2/q+6dla
FQEU0DkcFak8+/0pa7+OW9LycTzIHuFFe7hFGZlaoqKuKe996QFdd/8xkgBh
uoHmNtlCySeCiMU3shq7fCYotFY80BBsh8Y0lwvIxjqQ99xqYHJKjryWne4b
rtfr9Qaj0ThjNM5phy08d8PsxNnkIcOZjX9G75qfw4OMBr1WplB70quTaHdV
tcOl/eODjWUANBicDbp5elukl/UVA7wZ0My23LepJ7fnkC6Va130dgl/QK9O
uIrTow5RtcNNDqJsqBFFDiIKgwmZX5fGfG/U6Qznv8ETdjrTjt4ZnX0gREMb
kX7JHpDkToeH5f1tktskLGlvg9wjvLHjw2qeVY7l60hen+CZvlOOi6NEMvBj
AhJyh0v1gKhvKwGgmK35+Kpro4JTMVbTUTS0CqrY16zs3pfxB1O9sAFUsqU0
OEcAwbsGBLHT2wiAaFMStxENrCRpTes21138aoMJesIc2V4pEzFP0Lx5oG/L
2/TrjVnnNADfdtzxfRBANJHoTy+e0atJevbtiw0J5qpy9FW+phl7dVR5FRHm
V+7hAdD28TCXjxJZLN75dRRAIlsFkk6hXev9aQflE3VTr6J1069O102kXxvQ
CF2ht4wo9LUXwe+ghNVcojL9GDBo7PL6gwmG5/va1ODs1auzg1Nr29JgEkGf
zL2cqtQyxiKi0BdvgJg2EEDFB2GvzeGF9emelonH47On0R/hjTEkJ6/DxgH3
1Oe6c1zw+0GgmC230RYuuXLUCmWyNbuQEaEXKxN8ImehnXJA3NJbTtuvMzVo
koYw0CqUcCKDvqs0aQO0saLolsinq4OSVCRVu086t02TdhtPTNvnUxL3q0gH
/2hGWqEE4K0AwPqlhdVBSTtPx1JNtg8bjIbxPlmneXPM9Por4/JWtc5o1A3U
E0d5HXHVlk8GasBtbwEEfE3bRFErHRIdr/5uvapT0fbEGbRX+NXELLtjeMXa
3ne0V2PkMYa6yLEARYFbfdOsop7gxpPn2JMMa4UszQ3gTSsCwG9ZhtL0wFHa
ssIOKL9VBKQcX6oHRGmErQlTa8qS1FZBhas3r0+aMYAzqQe0isR3aqnICayD
gCy76XfNanvLCJIkatky6BaLYZpI1uChh9s1Ty/gXeixbcUMyyvYW82RLSQr
DXvfnGiovEkmIAUK0s4ZS9IXMjGKOl3elXQEnbh0YV7CpbjtpMEnbVqlqOTN
cr9WodCFiZt/2S3jVhmCsFIj5x2Bp4sl/QyG0Z50Dp7S/gAVESYLDgBu8mU3
1DKvNW1trDXVJ+8iWBHpTVYCTyS7uSSD1EbG6X+4GhA3o4rcWxKt4xlpNgpB
bZWctSXkfN3AlGSUXTJBZVxloi2qMuJmjIHrT5AemJmYxwLKMi4/iKpkx0c1
x2W65GmIZDbt7J9Ouk7eH+8SAd+bIMZZpVv2CC4tDkl4mgmfe9nPLznYVWJN
v3uQsLAjXZWpdOwm6LNOgJB11joyLtKaK8hjljTh0B6DgkDeR3D3IdqqaJem
p3/gJuhzylhcZmGE9zgDZmUVkFTJ+3S68Z6GMlBUN7SUcffC30Vkaj/YnQII
EvVqS3rc3dpkHeNZ01hjS0dTx6R5KZA6deb9wQAoBoWmYoWkK4Ao0/rTkyHu
xRe06uSHtOPJhE0BRK/r3FJoBGRRvc7DpGGIoeYy+mn0IZ4y/pClVyJ5izKR
LA6SgJQPzy17g9Fo2OeaUzcQBAmkvXqHJxhOhHxuu66nEiVQvxXqqTfIyCKu
xCkhuWCJcJH8UWkx+dYkQQX56dsK3W3s0P4PGU257ClnlmoAAAAASUVORK5C
YII=
====
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




















































































































































































































































































































Deleted bldt/javase/libs/javase-runtime/cc/squirreljme/jvm/head_16x16.png.__mime.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
begin-base64 644 head_16x16.png
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAACZz
AAAmcwHzbHUKAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNn
VFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8ig
iAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfA
CAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAH
vgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCd
mCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7
AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7
AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkX
KxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G
/yJiYuP+5c+rcEAAAOF0ftH+LC+zGoA7BoBt/qIl7gRoXgugdfeLZrIPQLUA
oOnaV/Nw+H48PEWhkLnZ2eXk5NhKxEJbYcpXff5nwl/AV/1s+X48/Pf14L7i
JIEyXYFHBPjgwsz0TKUcz5IJhGLc5o9H/LcL//wd0yLESWK5WCoU41EScY5E
mozzMqUiiUKSKcUl0v9k4t8s+wM+3zUAsGo+AXuRLahdYwP2SycQWHTA4vcA
APK7b8HUKAgDgGiD4c93/+8//UegJQCAZkmScQAAXkQkLlTKsz/HCAAARKCB
KrBBG/TBGCzABhzBBdzBC/xgNoRCJMTCQhBCCmSAHHJgKayCQiiGzbAdKmAv
1EAdNMBRaIaTcA4uwlW4Dj1wD/phCJ7BKLyBCQRByAgTYSHaiAFiilgjjggX
mYX4IcFIBBKLJCDJiBRRIkuRNUgxUopUIFVIHfI9cgI5h1xGupE7yAAygvyG
vEcxlIGyUT3UDLVDuag3GoRGogvQZHQxmo8WoJvQcrQaPYw2oefQq2gP2o8+
Q8cwwOgYBzPEbDAuxsNCsTgsCZNjy7EirAyrxhqwVqwDu4n1Y8+xdwQSgUXA
CTYEd0IgYR5BSFhMWE7YSKggHCQ0EdoJNwkDhFHCJyKTqEu0JroR+cQYYjIx
h1hILCPWEo8TLxB7iEPENyQSiUMyJ7mQAkmxpFTSEtJG0m5SI+ksqZs0SBoj
k8naZGuyBzmULCAryIXkneTD5DPkG+Qh8lsKnWJAcaT4U+IoUspqShnlEOU0
5QZlmDJBVaOaUt2ooVQRNY9aQq2htlKvUYeoEzR1mjnNgxZJS6WtopXTGmgX
aPdpr+h0uhHdlR5Ol9BX0svpR+iX6AP0dwwNhhWDx4hnKBmbGAcYZxl3GK+Y
TKYZ04sZx1QwNzHrmOeZD5lvVVgqtip8FZHKCpVKlSaVGyovVKmqpqreqgtV
81XLVI+pXlN9rkZVM1PjqQnUlqtVqp1Q61MbU2epO6iHqmeob1Q/pH5Z/YkG
WcNMw09DpFGgsV/jvMYgC2MZs3gsIWsNq4Z1gTXEJrHN2Xx2KruY/R27iz2q
qaE5QzNKM1ezUvOUZj8H45hx+Jx0TgnnKKeX836K3hTvKeIpG6Y0TLkxZVxr
qpaXllirSKtRq0frvTau7aedpr1Fu1n7gQ5Bx0onXCdHZ4/OBZ3nU9lT3acK
pxZNPTr1ri6qa6UbobtEd79up+6Ynr5egJ5Mb6feeb3n+hx9L/1U/W36p/VH
DFgGswwkBtsMzhg8xTVxbzwdL8fb8VFDXcNAQ6VhlWGX4YSRudE8o9VGjUYP
jGnGXOMk423GbcajJgYmISZLTepN7ppSTbmmKaY7TDtMx83MzaLN1pk1mz0x
1zLnm+eb15vft2BaeFostqi2uGVJsuRaplnutrxuhVo5WaVYVVpds0atna0l
1rutu6cRp7lOk06rntZnw7Dxtsm2qbcZsOXYBtuutm22fWFnYhdnt8Wuw+6T
vZN9un2N/T0HDYfZDqsdWh1+c7RyFDpWOt6azpzuP33F9JbpL2dYzxDP2DPj
thPLKcRpnVOb00dnF2e5c4PziIuJS4LLLpc+Lpsbxt3IveRKdPVxXeF60vWd
m7Obwu2o26/uNu5p7ofcn8w0nymeWTNz0MPIQ+BR5dE/C5+VMGvfrH5PQ0+B
Z7XnIy9jL5FXrdewt6V3qvdh7xc+9j5yn+M+4zw33jLeWV/MN8C3yLfLT8Nv
nl+F30N/I/9k/3r/0QCngCUBZwOJgUGBWwL7+Hp8Ib+OPzrbZfay2e1BjKC5
QRVBj4KtguXBrSFoyOyQrSH355jOkc5pDoVQfujW0Adh5mGLw34MJ4WHhVeG
P45wiFga0TGXNXfR3ENz30T6RJZE3ptnMU85ry1KNSo+qi5qPNo3ujS6P8Yu
ZlnM1VidWElsSxw5LiquNm5svt/87fOH4p3iC+N7F5gvyF1weaHOwvSFpxap
LhIsOpZATIhOOJTwQRAqqBaMJfITdyWOCnnCHcJnIi/RNtGI2ENcKh5O8kgq
TXqS7JG8NXkkxTOlLOW5hCepkLxMDUzdmzqeFpp2IG0yPTq9MYOSkZBxQqoh
TZO2Z+pn5mZ2y6xlhbL+xW6Lty8elQfJa7OQrAVZLQq2QqboVFoo1yoHsmdl
V2a/zYnKOZarnivN7cyzytuQN5zvn//tEsIS4ZK2pYZLVy0dWOa9rGo5sjxx
edsK4xUFK4ZWBqw8uIq2Km3VT6vtV5eufr0mek1rgV7ByoLBtQFr6wtVCuWF
fevc1+1dT1gvWd+1YfqGnRs+FYmKrhTbF5cVf9go3HjlG4dvyr+Z3JS0qavE
uWTPZtJm6ebeLZ5bDpaql+aXDm4N2dq0Dd9WtO319kXbL5fNKNu7g7ZDuaO/
PLi8ZafJzs07P1SkVPRU+lQ27tLdtWHX+G7R7ht7vPY07NXbW7z3/T7JvttV
AVVN1WbVZftJ+7P3P66Jqun4lvttXa1ObXHtxwPSA/0HIw6217nU1R3SPVRS
j9Yr60cOxx++/p3vdy0NNg1VjZzG4iNwRHnk6fcJ3/ceDTradox7rOEH0x92
HWcdL2pCmvKaRptTmvtbYlu6T8w+0dbq3nr8R9sfD5w0PFl5SvNUyWna6YLT
k2fyz4ydlZ19fi753GDborZ752PO32oPb++6EHTh0kX/i+c7vDvOXPK4dPKy
2+UTV7hXmq86X23qdOo8/pPTT8e7nLuarrlca7nuer21e2b36RueN87d9L15
8Rb/1tWeOT3dvfN6b/fF9/XfFt1+cif9zsu72Xcn7q28T7xf9EDtQdlD3YfV
P1v+3Njv3H9qwHeg89HcR/cGhYPP/pH1jw9DBY+Zj8uGDYbrnjg+OTniP3L9
6fynQ89kzyaeF/6i/suuFxYvfvjV69fO0ZjRoZfyl5O/bXyl/erA6xmv28bC
xh6+yXgzMV70VvvtwXfcdx3vo98PT+R8IH8o/2j5sfVT0Kf7kxmTk/8EA5jz
/GMzLdsAAAAgY0hSTQAAeiUAAICDAAD5/wAAgOkAAHUwAADqYAAAOpgAABdv
kl/FRgAAAftJREFUeNqkkT9oE2EYh59LIoZrhztSIRSFLgVp0CISkcrhmBPK
ZZIsDiqClyWU4CBCMHBydMoQkGSQIFghWY+C5xwqUnAwYpaidApKhwtizqJc
ziHcR46M/abve/883/v+flIYhpzlpAB2dwooshqOfe8q8CVKKrIa0aWx70Xh
K4qsDgDJtLskosLC5jaKrA6CabAVxTRDRzN0gFCRVYJpsKXI6qCwuQ0QAjMA
wKk/wbRaZJZXDqKfs5cukssXBSSzvHJgWi1O/YlYQQDS8hLtWplSpQqAZuhk
stcByOWLmFYLzdBp18qk5aW4BgDvP+9TqlRRL6yL5N8/P+nYdTRDp++4mFZr
VuvsL05QqlQZHQ/xTo5EsmPXefisLt7eyVEMFAOMjoesrm3QazZiNk1+/xL3
XrOBabVo18qLK0TN957USKdTvHrxXBT1HRfN0Mnli7Rr5RgkMU9/YL/h3bU7
TD95mHZXxDNvP7D+7zIk1YUJBEAzdM5zbibe7Vuw1+GR/TKyEAo67HUgqQqn
5leQ+o4bAtz9dggJGcKAVDCzMPe9CFISpj7ej0N6zQalSlWKaaAZuoD0HVe4
Mq9PqVKNNQvA2PfoO25MsLgbrmiOOWJ3kcIwZHenwOOnVjg6HgqQZujkbt4H
4OvH17H46toGgKRmb8wAZzn/BwDHnNKkHmibPgAAAABJRU5ErkJggg==
====
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






















































































































































Deleted bldt/javase/libs/javase-runtime/cc/squirreljme/jvm/head_24x24.png.__mime.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
begin-base64 644 head_24x24.png
iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAACXBIWXMAACZz
AAAmcwHzbHUKAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNn
VFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8ig
iAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfA
CAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAH
vgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCd
mCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7
AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7
AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkX
KxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G
/yJiYuP+5c+rcEAAAOF0ftH+LC+zGoA7BoBt/qIl7gRoXgugdfeLZrIPQLUA
oOnaV/Nw+H48PEWhkLnZ2eXk5NhKxEJbYcpXff5nwl/AV/1s+X48/Pf14L7i
JIEyXYFHBPjgwsz0TKUcz5IJhGLc5o9H/LcL//wd0yLESWK5WCoU41EScY5E
mozzMqUiiUKSKcUl0v9k4t8s+wM+3zUAsGo+AXuRLahdYwP2SycQWHTA4vcA
APK7b8HUKAgDgGiD4c93/+8//UegJQCAZkmScQAAXkQkLlTKsz/HCAAARKCB
KrBBG/TBGCzABhzBBdzBC/xgNoRCJMTCQhBCCmSAHHJgKayCQiiGzbAdKmAv
1EAdNMBRaIaTcA4uwlW4Dj1wD/phCJ7BKLyBCQRByAgTYSHaiAFiilgjjggX
mYX4IcFIBBKLJCDJiBRRIkuRNUgxUopUIFVIHfI9cgI5h1xGupE7yAAygvyG
vEcxlIGyUT3UDLVDuag3GoRGogvQZHQxmo8WoJvQcrQaPYw2oefQq2gP2o8+
Q8cwwOgYBzPEbDAuxsNCsTgsCZNjy7EirAyrxhqwVqwDu4n1Y8+xdwQSgUXA
CTYEd0IgYR5BSFhMWE7YSKggHCQ0EdoJNwkDhFHCJyKTqEu0JroR+cQYYjIx
h1hILCPWEo8TLxB7iEPENyQSiUMyJ7mQAkmxpFTSEtJG0m5SI+ksqZs0SBoj
k8naZGuyBzmULCAryIXkneTD5DPkG+Qh8lsKnWJAcaT4U+IoUspqShnlEOU0
5QZlmDJBVaOaUt2ooVQRNY9aQq2htlKvUYeoEzR1mjnNgxZJS6WtopXTGmgX
aPdpr+h0uhHdlR5Ol9BX0svpR+iX6AP0dwwNhhWDx4hnKBmbGAcYZxl3GK+Y
TKYZ04sZx1QwNzHrmOeZD5lvVVgqtip8FZHKCpVKlSaVGyovVKmqpqreqgtV
81XLVI+pXlN9rkZVM1PjqQnUlqtVqp1Q61MbU2epO6iHqmeob1Q/pH5Z/YkG
WcNMw09DpFGgsV/jvMYgC2MZs3gsIWsNq4Z1gTXEJrHN2Xx2KruY/R27iz2q
qaE5QzNKM1ezUvOUZj8H45hx+Jx0TgnnKKeX836K3hTvKeIpG6Y0TLkxZVxr
qpaXllirSKtRq0frvTau7aedpr1Fu1n7gQ5Bx0onXCdHZ4/OBZ3nU9lT3acK
pxZNPTr1ri6qa6UbobtEd79up+6Ynr5egJ5Mb6feeb3n+hx9L/1U/W36p/VH
DFgGswwkBtsMzhg8xTVxbzwdL8fb8VFDXcNAQ6VhlWGX4YSRudE8o9VGjUYP
jGnGXOMk423GbcajJgYmISZLTepN7ppSTbmmKaY7TDtMx83MzaLN1pk1mz0x
1zLnm+eb15vft2BaeFostqi2uGVJsuRaplnutrxuhVo5WaVYVVpds0atna0l
1rutu6cRp7lOk06rntZnw7Dxtsm2qbcZsOXYBtuutm22fWFnYhdnt8Wuw+6T
vZN9un2N/T0HDYfZDqsdWh1+c7RyFDpWOt6azpzuP33F9JbpL2dYzxDP2DPj
thPLKcRpnVOb00dnF2e5c4PziIuJS4LLLpc+Lpsbxt3IveRKdPVxXeF60vWd
m7Obwu2o26/uNu5p7ofcn8w0nymeWTNz0MPIQ+BR5dE/C5+VMGvfrH5PQ0+B
Z7XnIy9jL5FXrdewt6V3qvdh7xc+9j5yn+M+4zw33jLeWV/MN8C3yLfLT8Nv
nl+F30N/I/9k/3r/0QCngCUBZwOJgUGBWwL7+Hp8Ib+OPzrbZfay2e1BjKC5
QRVBj4KtguXBrSFoyOyQrSH355jOkc5pDoVQfujW0Adh5mGLw34MJ4WHhVeG
P45wiFga0TGXNXfR3ENz30T6RJZE3ptnMU85ry1KNSo+qi5qPNo3ujS6P8Yu
ZlnM1VidWElsSxw5LiquNm5svt/87fOH4p3iC+N7F5gvyF1weaHOwvSFpxap
LhIsOpZATIhOOJTwQRAqqBaMJfITdyWOCnnCHcJnIi/RNtGI2ENcKh5O8kgq
TXqS7JG8NXkkxTOlLOW5hCepkLxMDUzdmzqeFpp2IG0yPTq9MYOSkZBxQqoh
TZO2Z+pn5mZ2y6xlhbL+xW6Lty8elQfJa7OQrAVZLQq2QqboVFoo1yoHsmdl
V2a/zYnKOZarnivN7cyzytuQN5zvn//tEsIS4ZK2pYZLVy0dWOa9rGo5sjxx
edsK4xUFK4ZWBqw8uIq2Km3VT6vtV5eufr0mek1rgV7ByoLBtQFr6wtVCuWF
fevc1+1dT1gvWd+1YfqGnRs+FYmKrhTbF5cVf9go3HjlG4dvyr+Z3JS0qavE
uWTPZtJm6ebeLZ5bDpaql+aXDm4N2dq0Dd9WtO319kXbL5fNKNu7g7ZDuaO/
PLi8ZafJzs07P1SkVPRU+lQ27tLdtWHX+G7R7ht7vPY07NXbW7z3/T7JvttV
AVVN1WbVZftJ+7P3P66Jqun4lvttXa1ObXHtxwPSA/0HIw6217nU1R3SPVRS
j9Yr60cOxx++/p3vdy0NNg1VjZzG4iNwRHnk6fcJ3/ceDTradox7rOEH0x92
HWcdL2pCmvKaRptTmvtbYlu6T8w+0dbq3nr8R9sfD5w0PFl5SvNUyWna6YLT
k2fyz4ydlZ19fi753GDborZ752PO32oPb++6EHTh0kX/i+c7vDvOXPK4dPKy
2+UTV7hXmq86X23qdOo8/pPTT8e7nLuarrlca7nuer21e2b36RueN87d9L15
8Rb/1tWeOT3dvfN6b/fF9/XfFt1+cif9zsu72Xcn7q28T7xf9EDtQdlD3YfV
P1v+3Njv3H9qwHeg89HcR/cGhYPP/pH1jw9DBY+Zj8uGDYbrnjg+OTniP3L9
6fynQ89kzyaeF/6i/suuFxYvfvjV69fO0ZjRoZfyl5O/bXyl/erA6xmv28bC
xh6+yXgzMV70VvvtwXfcdx3vo98PT+R8IH8o/2j5sfVT0Kf7kxmTk/8EA5jz
/GMzLdsAAAAgY0hSTQAAeiUAAICDAAD5/wAAgOkAAHUwAADqYAAAOpgAABdv
kl/FRgAAAg9JREFUeNq0Vj1rG0EQfXsIB0N6l6muCHetYDGoVyVVJimFEsKp
TyWQEQj0F3SVMSaFCaSQG7t3c+A0BilOELhXlSZBWBBPinjWc3tzJ9mQ7XY+
3tv52l1DRJhnx/AWATB4+sr5RbaDQDOK6m02LgPBtn4+AQU3d//YdRLaIMeD
P5URVJ3YgfjyKmeV4Obkc4EkjK3bCCKSe8WvPIL51dQHyy0pn19Nnf1WBPev
X1SC+0Rsx36VBBr45dlFIbr1aqlG5JMEZafyASR4GFvs7O5Vpk0jIAm+mGVP
mjClZiQJiHPJ4GyYDnpbEYSxdamTkeRS9BzwdNBDOuhhZ3cPYWyxmGW59AYa
ODs1Wk00Wk0AwNF4qKaE9UxSWgMJzo4fD7/g1f47JONT9fTf3hzm9Omgh6je
xmKWuc4L/HAlePfHNV7e/wE+HaHRaqopY/306+9cW3NkTGBY2Gg1EdXbOD8/
AQD8fP+hACo7jPVs7x+ipg0Sr4Pb68ce94YuGU0Q3eb7PhlNCi1eE3qj3Y7r
1dIVT14Lmt6LzvgEhWnlzklGk0L4LGObbn/I4GbTVWEAmMUsQ7c/dKdcr5Zu
3+0PnawKHAAMEWH967tWSOIJlTOQjE+R9t+6PXdLZDuGcThNke3oKeI6cEEF
iCORH4XLswuEsXUPvnycapsedUkyz44R2Y4DV7qv8BsxRIT/uf4OAGHvLPvd
pD6TAAAAAElFTkSuQmCC
====
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
























































































































































Deleted bldt/javase/libs/javase-runtime/cc/squirreljme/jvm/head_32x32.png.__mime.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
begin-base64 644 head_32x32.png
iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAACXBIWXMAACZz
AAAmcwHzbHUKAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNn
VFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8ig
iAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfA
CAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAH
vgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCd
mCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7
AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7
AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkX
KxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G
/yJiYuP+5c+rcEAAAOF0ftH+LC+zGoA7BoBt/qIl7gRoXgugdfeLZrIPQLUA
oOnaV/Nw+H48PEWhkLnZ2eXk5NhKxEJbYcpXff5nwl/AV/1s+X48/Pf14L7i
JIEyXYFHBPjgwsz0TKUcz5IJhGLc5o9H/LcL//wd0yLESWK5WCoU41EScY5E
mozzMqUiiUKSKcUl0v9k4t8s+wM+3zUAsGo+AXuRLahdYwP2SycQWHTA4vcA
APK7b8HUKAgDgGiD4c93/+8//UegJQCAZkmScQAAXkQkLlTKsz/HCAAARKCB
KrBBG/TBGCzABhzBBdzBC/xgNoRCJMTCQhBCCmSAHHJgKayCQiiGzbAdKmAv
1EAdNMBRaIaTcA4uwlW4Dj1wD/phCJ7BKLyBCQRByAgTYSHaiAFiilgjjggX
mYX4IcFIBBKLJCDJiBRRIkuRNUgxUopUIFVIHfI9cgI5h1xGupE7yAAygvyG
vEcxlIGyUT3UDLVDuag3GoRGogvQZHQxmo8WoJvQcrQaPYw2oefQq2gP2o8+
Q8cwwOgYBzPEbDAuxsNCsTgsCZNjy7EirAyrxhqwVqwDu4n1Y8+xdwQSgUXA
CTYEd0IgYR5BSFhMWE7YSKggHCQ0EdoJNwkDhFHCJyKTqEu0JroR+cQYYjIx
h1hILCPWEo8TLxB7iEPENyQSiUMyJ7mQAkmxpFTSEtJG0m5SI+ksqZs0SBoj
k8naZGuyBzmULCAryIXkneTD5DPkG+Qh8lsKnWJAcaT4U+IoUspqShnlEOU0
5QZlmDJBVaOaUt2ooVQRNY9aQq2htlKvUYeoEzR1mjnNgxZJS6WtopXTGmgX
aPdpr+h0uhHdlR5Ol9BX0svpR+iX6AP0dwwNhhWDx4hnKBmbGAcYZxl3GK+Y
TKYZ04sZx1QwNzHrmOeZD5lvVVgqtip8FZHKCpVKlSaVGyovVKmqpqreqgtV
81XLVI+pXlN9rkZVM1PjqQnUlqtVqp1Q61MbU2epO6iHqmeob1Q/pH5Z/YkG
WcNMw09DpFGgsV/jvMYgC2MZs3gsIWsNq4Z1gTXEJrHN2Xx2KruY/R27iz2q
qaE5QzNKM1ezUvOUZj8H45hx+Jx0TgnnKKeX836K3hTvKeIpG6Y0TLkxZVxr
qpaXllirSKtRq0frvTau7aedpr1Fu1n7gQ5Bx0onXCdHZ4/OBZ3nU9lT3acK
pxZNPTr1ri6qa6UbobtEd79up+6Ynr5egJ5Mb6feeb3n+hx9L/1U/W36p/VH
DFgGswwkBtsMzhg8xTVxbzwdL8fb8VFDXcNAQ6VhlWGX4YSRudE8o9VGjUYP
jGnGXOMk423GbcajJgYmISZLTepN7ppSTbmmKaY7TDtMx83MzaLN1pk1mz0x
1zLnm+eb15vft2BaeFostqi2uGVJsuRaplnutrxuhVo5WaVYVVpds0atna0l
1rutu6cRp7lOk06rntZnw7Dxtsm2qbcZsOXYBtuutm22fWFnYhdnt8Wuw+6T
vZN9un2N/T0HDYfZDqsdWh1+c7RyFDpWOt6azpzuP33F9JbpL2dYzxDP2DPj
thPLKcRpnVOb00dnF2e5c4PziIuJS4LLLpc+Lpsbxt3IveRKdPVxXeF60vWd
m7Obwu2o26/uNu5p7ofcn8w0nymeWTNz0MPIQ+BR5dE/C5+VMGvfrH5PQ0+B
Z7XnIy9jL5FXrdewt6V3qvdh7xc+9j5yn+M+4zw33jLeWV/MN8C3yLfLT8Nv
nl+F30N/I/9k/3r/0QCngCUBZwOJgUGBWwL7+Hp8Ib+OPzrbZfay2e1BjKC5
QRVBj4KtguXBrSFoyOyQrSH355jOkc5pDoVQfujW0Adh5mGLw34MJ4WHhVeG
P45wiFga0TGXNXfR3ENz30T6RJZE3ptnMU85ry1KNSo+qi5qPNo3ujS6P8Yu
ZlnM1VidWElsSxw5LiquNm5svt/87fOH4p3iC+N7F5gvyF1weaHOwvSFpxap
LhIsOpZATIhOOJTwQRAqqBaMJfITdyWOCnnCHcJnIi/RNtGI2ENcKh5O8kgq
TXqS7JG8NXkkxTOlLOW5hCepkLxMDUzdmzqeFpp2IG0yPTq9MYOSkZBxQqoh
TZO2Z+pn5mZ2y6xlhbL+xW6Lty8elQfJa7OQrAVZLQq2QqboVFoo1yoHsmdl
V2a/zYnKOZarnivN7cyzytuQN5zvn//tEsIS4ZK2pYZLVy0dWOa9rGo5sjxx
edsK4xUFK4ZWBqw8uIq2Km3VT6vtV5eufr0mek1rgV7ByoLBtQFr6wtVCuWF
fevc1+1dT1gvWd+1YfqGnRs+FYmKrhTbF5cVf9go3HjlG4dvyr+Z3JS0qavE
uWTPZtJm6ebeLZ5bDpaql+aXDm4N2dq0Dd9WtO319kXbL5fNKNu7g7ZDuaO/
PLi8ZafJzs07P1SkVPRU+lQ27tLdtWHX+G7R7ht7vPY07NXbW7z3/T7JvttV
AVVN1WbVZftJ+7P3P66Jqun4lvttXa1ObXHtxwPSA/0HIw6217nU1R3SPVRS
j9Yr60cOxx++/p3vdy0NNg1VjZzG4iNwRHnk6fcJ3/ceDTradox7rOEH0x92
HWcdL2pCmvKaRptTmvtbYlu6T8w+0dbq3nr8R9sfD5w0PFl5SvNUyWna6YLT
k2fyz4ydlZ19fi753GDborZ752PO32oPb++6EHTh0kX/i+c7vDvOXPK4dPKy
2+UTV7hXmq86X23qdOo8/pPTT8e7nLuarrlca7nuer21e2b36RueN87d9L15
8Rb/1tWeOT3dvfN6b/fF9/XfFt1+cif9zsu72Xcn7q28T7xf9EDtQdlD3YfV
P1v+3Njv3H9qwHeg89HcR/cGhYPP/pH1jw9DBY+Zj8uGDYbrnjg+OTniP3L9
6fynQ89kzyaeF/6i/suuFxYvfvjV69fO0ZjRoZfyl5O/bXyl/erA6xmv28bC
xh6+yXgzMV70VvvtwXfcdx3vo98PT+R8IH8o/2j5sfVT0Kf7kxmTk/8EA5jz
/GMzLdsAAAAgY0hSTQAAeiUAAICDAAD5/wAAgOkAAHUwAADqYAAAOpgAABdv
kl/FRgAAB9pJREFUeNrEl2lUlNcZx3/vvLOxyDqRQUUiRjQoRcU1CCrSNi5F
ibF4Yt2jYqqmxeOSqG2OqWlSqsF4mmNda9sTRRv35YSoKNYlCgiBsoggIALD
DrLMMLy8/YAzzITFfGqfc94P89zn3v//We8dQZZl/p+iBNj/4UKrQqPztjAS
TNXlVr2p1cjo0EnofX1oN5sBdgOxwC5gu0qtorSgCF//iXYAQ4MiiN+ySPZw
dSoNmf1Ln28TDlnXYj450UnAFnz5+7+jICuV5GuXZI3OuxsRAHObcf/wMTPW
5DxI5caZYzj2c7Wu+fpPZGhQBADxWxbJfHWUZbGbAAad2PupEdB2i4CtpMXt
Zeym9/HU66ipqLYQEUxPn/yokFrA//nZ2ie/eGc5nnodbjpf0uL29miv6CH0
pMXtxU3ni6deR9iM2QCyi88Qy/IxYE1LYwNjwxcyLWrxtubnDbttDz2+e0Pu
5Dfnv2oBtw0yUNMjAYBJ7iO6Mbzw1VEaDJU0GCplQDa3tS7x9Z+I58AAkOoY
Gx5NxIIVsc2N9buAt0/u3Zg5ISJyuC24xfupw6YDuPSZAgcvb1oN5cR/uA6A
hTGx6IeMAESeZCXi4jEAd70/SKbODVIjQWFRqNSaDxPPJFBWVkFZV957DX2v
BGzlV+u2oPPxA6kNRAerviDjLkNHBXcZSs8JGB9KfVXFbbO5LWTkhDAOf7yZ
wf4jM4fSL9DiWJ81YJFvcpNJLk9hWex2dD5DQDJTX11sXXd27W8PbiMqjTbE
xUOHztuHyBW/fVhT8Szwkbouty8nFT0pV+6Ix81rIEjt1FcXU1NRDVIrji46
ntdV9HqY1tGJopzvARgWNGHMT6PfJXJl7IibZfdJMTwsfimBm/lJtba/LeCe
eh0Az+srEBQiiFoeZSRS8J8bIHa1deDkcKJWb+pqyVHBlBfls3zbbmrKS31v
5icBNPZYAw2GStbu+LOHxtEZZJl6Q6EV3FLNokKJSq3l2eM7uHoOwmtQAEjG
vufCqGAKslJZuSOeI7ti0Tg4vjwFtp7/oI+7SXlJJuUl6QCk3/qWMwfiup3l
qdchSU2s+v0XtJmM3QkYJVEGUIgqclIv2oXd/rAaBKGTs1KlpbI0B1lqx3vw
6F4J2jqgdXKuEEWlB9DSLQLLYjehcnBCoejMSk1FIc+epGNsqQfg7ME9NNYa
EJUqOwBR1fVbVIp9kniceU2/aON2pHazQ8wnJ7qnIC/lPErlC8+FDvoPHI3W
0Y0LR+MpzstE7aClqaGRWkMVotgdTOPgiOFpIft3rOXC0fhu65arvwMF+zYv
6LkGPPU6ZGoZOGQity6cYP+OtQS9MYWYnX/gea2R45/vxFCaj6hU2+17cP0S
uWl3WL51Oz+LXsKzwjzOHrSvB69BIzA8zWbxxm0Acq+TUFSqObnvI5oanxO5
fA2r1tt7M3JSD5tkGUFQMO/tDwDQ9RMJoZDTf/2MWYt/TXV5Hjrv4Xj5BPD0
cWrPXSCqOvmYWowICgVR777HqvXxXEm80PktieJK4gV2H75PY109zY0ttLZU
8iQnBWdXdzIysq12//j6LPNidlJZWsT5Q58z2D+MqrIcAHxeC+69DU/v30PS
6TO8+c5y9L4BVn2TQuTUto9oUohsXRPB11/GodJocNf5YWptBiAoKMDOTj/Y
nxvZrdRWlfGvL3fhNzKC6opHPc+Bv+2Jw9jSDIKC6HWx6LyHISjUXLny985X
0IqVzHz6DPOKlYTMimT0lOlk3UukrrqQkkfpJCYcwsnF3c4O4Pipg8yP2UBD
TRWn/vIxQ0dG9JgCwZZVcX4GJlMLCC/UUh3uhw7g3CHhfugASo0Hb8yMxMV9
APnpWai1GgInTSN8/lI7O6Q6BIUanfcwFrz3G9qMrX3eBcLVs1dpbDYjy3Jp
N0upruuTO1Bq3JkQMQt33WByUzNQWuaBrR2AIGAytVDy+HtMrUZZEAQUNi2s
BNCKEkapS9luNlonXq8id6DUuDEmdAZmk5H6mro+zQVBwGg0Cvs+WN1zBLSi
ZE3FnWv3Bz1MPoWptQEUIpeO7eOPMfMoyOrK3RebVoDcgajqx+SZC8nPeNCV
wrxMPl37FucO7+kEUYiY2zrDr1KKOpVSlC1YCsv73DIaXywID5LukpJ0AoQO
Xp/wOs7u/TE2VYLYeZttiDvSSeIFmQ1xR170sgPGJgNObjoCJweCAtJunuS7
q/8GEMztUo25XbI6Lvzwn1H8lkVdc0Fuk8dNC8Fr8EAEQeDW+cuMDgnnJyFh
IIrcvXSOpNMnCYuMYsrcBdBuJvv+Pb67fpmp8+aALFNVVsH9a7fsCn39n07R
KwGL7Nu8gDlLo+WLxxIYGzaJAUM6L5T05LuUFhRhbjMSOnsu43++mrRrR7lx
9hRqrQN6Xx+Cp09BlmUMJc9IuXGbOUujAYSLxxLswPsk0N5aJD8tTKG8sIrU
W9cZHTKeQa/50WY0YWxpxs1zBL4BYV15z06mviYXraMjaq2WsifFpCXfIzg0
HG+/V/DxGwcgKB1effmDBKnOjlVwaDjptx9QkvfY5v0nUZydbAV3dO7aUvq4
0Apu9/xSu8rW9uyTAAhKtavg4zdO8PZ7RQCE4NBwYepbW4XhwYuEoux87n1z
mXZzGwUZV2k3t3HnykUKs/JITDgnhM7dLFiKuYfvx6XgfyX/HQCsB0HM346M
yAAAAABJRU5ErkJggg==
====
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


























































































































































































































Deleted bldt/javase/libs/javase-runtime/cc/squirreljme/jvm/head_48x48.png.__mime.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
begin-base64 644 head_48x48.png
iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAACZz
AAAmcwHzbHUKAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNn
VFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8ig
iAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfA
CAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAH
vgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCd
mCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7
AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7
AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkX
KxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G
/yJiYuP+5c+rcEAAAOF0ftH+LC+zGoA7BoBt/qIl7gRoXgugdfeLZrIPQLUA
oOnaV/Nw+H48PEWhkLnZ2eXk5NhKxEJbYcpXff5nwl/AV/1s+X48/Pf14L7i
JIEyXYFHBPjgwsz0TKUcz5IJhGLc5o9H/LcL//wd0yLESWK5WCoU41EScY5E
mozzMqUiiUKSKcUl0v9k4t8s+wM+3zUAsGo+AXuRLahdYwP2SycQWHTA4vcA
APK7b8HUKAgDgGiD4c93/+8//UegJQCAZkmScQAAXkQkLlTKsz/HCAAARKCB
KrBBG/TBGCzABhzBBdzBC/xgNoRCJMTCQhBCCmSAHHJgKayCQiiGzbAdKmAv
1EAdNMBRaIaTcA4uwlW4Dj1wD/phCJ7BKLyBCQRByAgTYSHaiAFiilgjjggX
mYX4IcFIBBKLJCDJiBRRIkuRNUgxUopUIFVIHfI9cgI5h1xGupE7yAAygvyG
vEcxlIGyUT3UDLVDuag3GoRGogvQZHQxmo8WoJvQcrQaPYw2oefQq2gP2o8+
Q8cwwOgYBzPEbDAuxsNCsTgsCZNjy7EirAyrxhqwVqwDu4n1Y8+xdwQSgUXA
CTYEd0IgYR5BSFhMWE7YSKggHCQ0EdoJNwkDhFHCJyKTqEu0JroR+cQYYjIx
h1hILCPWEo8TLxB7iEPENyQSiUMyJ7mQAkmxpFTSEtJG0m5SI+ksqZs0SBoj
k8naZGuyBzmULCAryIXkneTD5DPkG+Qh8lsKnWJAcaT4U+IoUspqShnlEOU0
5QZlmDJBVaOaUt2ooVQRNY9aQq2htlKvUYeoEzR1mjnNgxZJS6WtopXTGmgX
aPdpr+h0uhHdlR5Ol9BX0svpR+iX6AP0dwwNhhWDx4hnKBmbGAcYZxl3GK+Y
TKYZ04sZx1QwNzHrmOeZD5lvVVgqtip8FZHKCpVKlSaVGyovVKmqpqreqgtV
81XLVI+pXlN9rkZVM1PjqQnUlqtVqp1Q61MbU2epO6iHqmeob1Q/pH5Z/YkG
WcNMw09DpFGgsV/jvMYgC2MZs3gsIWsNq4Z1gTXEJrHN2Xx2KruY/R27iz2q
qaE5QzNKM1ezUvOUZj8H45hx+Jx0TgnnKKeX836K3hTvKeIpG6Y0TLkxZVxr
qpaXllirSKtRq0frvTau7aedpr1Fu1n7gQ5Bx0onXCdHZ4/OBZ3nU9lT3acK
pxZNPTr1ri6qa6UbobtEd79up+6Ynr5egJ5Mb6feeb3n+hx9L/1U/W36p/VH
DFgGswwkBtsMzhg8xTVxbzwdL8fb8VFDXcNAQ6VhlWGX4YSRudE8o9VGjUYP
jGnGXOMk423GbcajJgYmISZLTepN7ppSTbmmKaY7TDtMx83MzaLN1pk1mz0x
1zLnm+eb15vft2BaeFostqi2uGVJsuRaplnutrxuhVo5WaVYVVpds0atna0l
1rutu6cRp7lOk06rntZnw7Dxtsm2qbcZsOXYBtuutm22fWFnYhdnt8Wuw+6T
vZN9un2N/T0HDYfZDqsdWh1+c7RyFDpWOt6azpzuP33F9JbpL2dYzxDP2DPj
thPLKcRpnVOb00dnF2e5c4PziIuJS4LLLpc+Lpsbxt3IveRKdPVxXeF60vWd
m7Obwu2o26/uNu5p7ofcn8w0nymeWTNz0MPIQ+BR5dE/C5+VMGvfrH5PQ0+B
Z7XnIy9jL5FXrdewt6V3qvdh7xc+9j5yn+M+4zw33jLeWV/MN8C3yLfLT8Nv
nl+F30N/I/9k/3r/0QCngCUBZwOJgUGBWwL7+Hp8Ib+OPzrbZfay2e1BjKC5
QRVBj4KtguXBrSFoyOyQrSH355jOkc5pDoVQfujW0Adh5mGLw34MJ4WHhVeG
P45wiFga0TGXNXfR3ENz30T6RJZE3ptnMU85ry1KNSo+qi5qPNo3ujS6P8Yu
ZlnM1VidWElsSxw5LiquNm5svt/87fOH4p3iC+N7F5gvyF1weaHOwvSFpxap
LhIsOpZATIhOOJTwQRAqqBaMJfITdyWOCnnCHcJnIi/RNtGI2ENcKh5O8kgq
TXqS7JG8NXkkxTOlLOW5hCepkLxMDUzdmzqeFpp2IG0yPTq9MYOSkZBxQqoh
TZO2Z+pn5mZ2y6xlhbL+xW6Lty8elQfJa7OQrAVZLQq2QqboVFoo1yoHsmdl
V2a/zYnKOZarnivN7cyzytuQN5zvn//tEsIS4ZK2pYZLVy0dWOa9rGo5sjxx
edsK4xUFK4ZWBqw8uIq2Km3VT6vtV5eufr0mek1rgV7ByoLBtQFr6wtVCuWF
fevc1+1dT1gvWd+1YfqGnRs+FYmKrhTbF5cVf9go3HjlG4dvyr+Z3JS0qavE
uWTPZtJm6ebeLZ5bDpaql+aXDm4N2dq0Dd9WtO319kXbL5fNKNu7g7ZDuaO/
PLi8ZafJzs07P1SkVPRU+lQ27tLdtWHX+G7R7ht7vPY07NXbW7z3/T7JvttV
AVVN1WbVZftJ+7P3P66Jqun4lvttXa1ObXHtxwPSA/0HIw6217nU1R3SPVRS
j9Yr60cOxx++/p3vdy0NNg1VjZzG4iNwRHnk6fcJ3/ceDTradox7rOEH0x92
HWcdL2pCmvKaRptTmvtbYlu6T8w+0dbq3nr8R9sfD5w0PFl5SvNUyWna6YLT
k2fyz4ydlZ19fi753GDborZ752PO32oPb++6EHTh0kX/i+c7vDvOXPK4dPKy
2+UTV7hXmq86X23qdOo8/pPTT8e7nLuarrlca7nuer21e2b36RueN87d9L15
8Rb/1tWeOT3dvfN6b/fF9/XfFt1+cif9zsu72Xcn7q28T7xf9EDtQdlD3YfV
P1v+3Njv3H9qwHeg89HcR/cGhYPP/pH1jw9DBY+Zj8uGDYbrnjg+OTniP3L9
6fynQ89kzyaeF/6i/suuFxYvfvjV69fO0ZjRoZfyl5O/bXyl/erA6xmv28bC
xh6+yXgzMV70VvvtwXfcdx3vo98PT+R8IH8o/2j5sfVT0Kf7kxmTk/8EA5jz
/GMzLdsAAAAgY0hSTQAAeiUAAICDAAD5/wAAgOkAAHUwAADqYAAAOpgAABdv
kl/FRgAAEtNJREFUeNq0mnd8VVW2x7/n3HtuS7kppBfSSEJIQiCGYlCBISAW
bIMi41im6DgzdkfF8pRngYdt5o2OYpk3OCKgCDhjoSmhl0BCCqRAIL2H1NvO
PeX9kYAEQgR9b30+5/M5n3P2Xnv99l57tb0FXde54+pc/p9IAmTAH+j7v2b+
8cbdiBfZ9kOgF/jjJfAXgVMjNdBH7n8XkH8xg1wMGQG/wRm9GAoBWgHfHyn8
L4F3gauAL38qgHeBOydFRpeOSUi4E3jpIvr0AqPe/PuHp4Xt0weF1ocRfphv
YRaLpfvO9IlclZQcD+z+KQCyU0LD92UFjEq6/fp58YkpqTOBF0doHwmUAoSE
hZ0WrPISVO++sMio+X968CHRpqpYzBYFmPBTAIh2oyQlXjfHmnDlDLvZYtaB
Zwef4agfGPP8a69WAPzHsv8qB5KBYiDiB8b6DfA66IbEqbmhST+/gQS/gISr
MicWAlt+LAAfj6qqlqAgjD7+/PqBP8Y+9PSi4oyJE2YCy85pGwdsBRgzdmwq
QMq4cWOfWPxCCZA5CG4kyrHabB2PPvdssNHqgy0sFBOCb/So0FDg8h8D4L20
0fGNE6NHj9YUBdAIi4iIzsnNHZ+Zne0PPAA8B6CqKg6nM0gQhJyHnl5UeDaT
8Zddljn4+jVgGWacu4FdMXFxMc8sXSJGxcbGgYamKCCAoihewPljAFw3OjQ8
xG6xhp39sfjgwZJP/7EieFCYHFVVGTUqmGtmz+rq6+8nJzd34rmM7n3ooQPA
NKAI2BMWEdFosVoOA3sEeCMiMtJy/+OPp8clJsZcii8w/pD+97tcHkxWAHZ9
u6Vg/coVSltzS4rZYm4bM3bs9qMlJdfouv6FzWrtuCx7gjAlL68UyDiX0VWz
8yZ5PJ59LU1NoqZpxlGhIZFOh0NxOZxy/ubNPakZGf2x8XHZl+rMRgKwOD4s
onRsbFwKPb0cKCwsWL1+XZzRaOzPnTGjJO+6ayOjR4++7POVK/efOHYsvLej
Y56mKHpDVeX2jMtyhmU4+/rrppzzKRaI3bXtu8Pdpzp/lDceSYX+dNmY1Niw
wKCYkobaA6vXr0s0W6ztTy95xfO7xx6dnpiSkmy2WHyunz8/1eN2u7u6u6mv
r+tCFC9ZiF/8+teujvYO8aUnn9pRuP9A8ZCfgsBIPEca7ZS/j49PSUV54bba
6mSz2dyyaMlS42nrcppKCwtPdjS3XJmZNpa6+oaWuQsWTr9UANPnzJl604Lb
LGXFxan//corQWeD0GQZSfEqF5J1JAC92w8fOvmvwn2xZqu18dnX/mxKHBOf
fHaD+pM1lWtWfHTKz8+P6VfkIpktIQCaqtJ0/Bgl+/ei6xcOGjqbGqk6eKDI
2d1VNPmKK3KeWLy4VRAE75svvhj1zrKl+WXlFQcNZjOFVeWxFwpjRgLQcby1
eZrZYmlf/Je3fOLio5JAGNKg6GCB7urvy4uLjab6xAl8fH1DTv+rPVLK9n//
C03TvmfYUI8iywPCNzbQ2dRIf1eXze1w9AFMnDwp40+LX3CFR0Ud27c9P3n5
e8ujtpw4Vni0rcU+4OAuDYCvr59f2UtvveUbFRUad67wAIHBwamx0VFMys6i
oqICgyig6zrt9XV0dnaSMj4LcVB/u1tbKPh2C33dXQAcO3iAwPAIJubNSQmK
ir7yNM+08ePHvbr83akvvPlnlyAIjqMtjROBbcDiSwGQC4x9YNFT5vDwsJjh
hIeBr15Fwe32IEkSiePSURWFqoL9nDh5ktnzb0MQBLrbWjmwZRMuRcVoMgEQ
HB2DxWq94OzFJ8Ylvvr+exKiWC4IQtKgTBcFYLKiqpsNRmOdJEnqxW5EAZ0p
s2ajqyq9fX1DIFfu30tlZSXz7rwbv4BAAMZk5+AXPGpEjmHh4aPf/miFvwYK
sAOY/EMAMlVV3R0yKti27J2/mZPT0lIvFsDpzdrbdYrKqiqi4+PP/HO53YRF
RSO73QDUnTyJo3/ksMjr8eDo7sIkSVHLP1kZAELDIIgLAkjVNL3YIAqGG6+d
i4/F3AfgcTrrHT3dvac33wVzR5OJ1oZ6ju7ZhZ+/nZt+9dsB4fv6KD58mPn3
/g6bnx8Azz38CFVHjoycUHS0c+jbLZTt3C5LktH7t5X/9Nd13TAY2Q4LoFyS
DEzMSEMUdFR1QHsKt25qPfzdVv/O5qZhsypBEBAEAcWr8NU/VwyuxoDl0TWN
om83IxmNuJ0Dsdipzk5MFgsiOorXe0EAwVHRpE6eunv/3j19ZfnfOgRdPyXL
chtQPhyAEE3T+rMz0jCbzeg6XYIoGhRZ7hJFgzkuPTM/bHTc8Evt9eJ0ulDU
4beLcI4XfeHRx/A4nXzz6WrqjlWNuAqh0TG51//yrpaS4pKE/Ru/Fj7buiVC
19GBUefGQm0GUUSWvUyalEXO3Gv7rL5+Y3evX9sUn5HZF5mUPMS7aqqKqir4
2WycrKnnRM1qfK0WIsLDvwcmyxiNxiEhgcftRgdun38TXZ2dKIqCpmlnTO1w
pCqqouu6MzAwwCu7XR2yLFvNZlMrYBiiQjkTMjCZJFRNQ1NVWdc1ta+vTx5E
PET4oj27ePv55zi6bzdPPfYgN1x7NS63G13X0XUdZ38//7NsyZnZNxhEJLOZ
J+//Pc2NjSjKwGp9s/oTqkqKR/TW8amp42cvWFhbXFSUuHPd5+7Vm76xnlWy
+R6Aqqhkjh+Pr68volEKevfFxcVAnNliGRKxfv7+cnZ89SVhYWEkJiXhcbsR
EOjtd7C7oJCKo0cxGo3nqY7BYEBRVX65YD4ho4JJTEoiMDCQzWs/pbzw0Iiq
FB2fkJp364KKmpqTfqIoIsuyCDjOM6Mmk4miwkJMZpPZZJQC0iZN2RscFZ0N
sHvj17z1H88gahpTpk4lJjYWxetF9nqJjY3m9vk343S6EIThnd79C26noa4e
QRgYUlEUklNTCQoKYsu6tZQVHBjS/lhpCZ+8+RrVRYcABKPJJKmqaj+08au6
NZs2aqdX4MzsigaRI2Vl3PX4k/L+r7+q1DR1vF9goEsQReN3G9ZRemA/kVFR
REVH4VR0/vrOxwiCgAjMmnkFIQFWurp7OFR6lKy0FPTBGGhAPQT6+vq4a+F8
goMCz1i4qpNNrP9qJykJEWz7Yj0Fu/dxz8MPApAwNg3Z42F//jZ0TSMpOyf5
2jvuLN+4amWqy+XsGKw9fb8CBlFkf2EJf33+uVZV9mQChsJvt4T0dXftRBCI
jokhKioKg6+dvzz8HJO3NTPhuxMEfFfJB59toK3LycJbb6a/34HRaMQry3z0
+qtDgFitVsblTuOyOXPZX3yMtz/+lIDtx/BdVYBa0Ybc28Ez99/P159/jsFo
JDVrAtkzZ1Gwa6e+998btkfFJ4wFXTCIhpDzMjJJMuKRvSiKEnOWdw3dumaV
b21tLXFxccSkpmMLi+fVl5ciLP+A4IW/wHrVlaz9429YsmoDd187i67uHoqO
lJOVlkpfTzeSJA3x1mabjVeeeZlPt27nkUA7dxzchOdwCU0r/o4nZAbRKZlU
HNhHcKCdyTNnYfXxwePxCKhq7qtPPH6i4viJhLOt25m3wtJyFFXhXBXu7e21
RYSHExISAoKBYHswQvUx8o8epv7DbuxrVyIdqeCu/n6alJ9x2y03smbdBtAh
a1wqZaWlQ0JqXdPpsflwe3U1vjYbnz38B3ocDiKqjzM9ZyJj73gWm9XCwfxt
6JrOlFl55M69tnLfxq9TzJIxIS46kp37Dp4HYEZfv2PbcOZM13VsNhuRSclE
JI4BBLorKrD09kFxKRuAdOAaoHXbTnLXrUR2u9nwzWYQBNJTEtF1kL3egf0g
WvnZzj0EyjLfyTKHdu3mCsAH6CovJ8Tqw7Rr5gEqxXt2caq1mabGpsg9e/Zx
xZRsdE2n3+E842NO74F8URTnAN0XCtQsNh8O786nrqaS0UuWkjB9OnHAvEEA
ktXGnEWLCI1P485HH+H6vJ9RV99IWcVxDAaRjJQxBAcFoamQ98STWO12koEb
gCQgbupU4t94k6aWOg7mbyY1IwNEI+s/X4+PZPSbOf0qDpUcRRCFIY7vbBu/
GXAPB0D2yPiPCsLib6Wu+jhaTBqpH69i1Csv49q5HSU+DvutC7Ddeito/Rgk
nbufeBST1cKGr74BQSBrXAoesw2rnwnDDfNIWP4eQWtWYTh2HNvl0xi16Bma
bAINpXuIjY/BbLEwJimRfoeD/YXF2O12enr7T5tp12D5/byySrgkGTGZTEPs
uSiKeJxO/IKDGJOeysnKKrZ3eXCnRhFou5KsW2/FNC4dXe3B6+lC12XM1hCu
W3AbCAJfbtxCuSTx8/sfwCDqoDkInJeHb1IkJZ+tpT0iFGtlAf42gczJE0GT
EA0SSePS6Xe5lNrGxpryyqoku7/fmUgF+Ow8AKIo/vZEbeP7kREn8coygjCQ
IvoGBrRbbL4hksmKUZJITEsluKMDQ/pojJqIKXL04Ab1oKkezNaAgQgxNo5r
fn4LAN/l78BgNOJw9GCz+SKYDEhZ40gM9SVG1EBV8fG3Y7b4IQgDlssWGIiv
zaYnj45Jam5qXQo8ZRqwasKwhS1RED5o7Thl2LFn/+LYyPAwk9mESZJwutx0
tLcRa7cjiCYEwciosAgQQDRIZ02AhMlsRxBM3xf64xO5fsFtBERF4+fvT09H
K4KP/5n/9ohINM2LrqqIRguCaARdBky4XC6MZrMMPK8oykqvV3mqurYeQRD8
LphSmk3S8pa2Tg+CQHtbOx6Ph5aGeq3y8OHWgahSxmwxYjT5YpR8EUXzmexA
1zwIwkDAdzaNihnNTQsXIggCASHhKF4Xuu4BNARBwmCwYTT5IYoSmuoGfSBP
aG1qajtaUqxERscsEUTB41WU92sbmhEE4YURk3qz2fROe+cpd01NLS6XE8Xr
9YgGQ81AhuYZyIA1+bwcVlE8tNYep6a0GNmtgGAe8qgK1JSV0FxdgaYpnFss
0HUVr8cFhgHFMBiNjYrX6zWbTOi63ioIwr2SZHzj7ArFsACMRnFpTUPzc/XN
Lf1er4IgCLs7mps8jTUnG80WH2SPimDQUFUPHpeLzqYGdE3GKPnhdqgcLyqi
aOcuqopLULwimiZRXXaEwh07qDpUiNuhIopWQKWrpQlnTw+apiC7uzGZJRSP
hqOvt6PicFE/8F7l8Wqk773vYz9Y3NV1sFktr9XUN4l2f7+XokJD8tubm8K2
bVgnzbjhZj0qPj7a63EjmQXaG9oozN/KmAnjSByXRVx6JgGhIdQer6KmdA94
3RgMRk4cKSA4Jobs2bMIDA1H9bqoP1FFZcFhEtOzSMpKx2zzQZFBVfTWVW+9
ddzjcpRs3bH3GYPBgM1mHTZvMI5UZZAk4zKzJIX0OZ3NHo/8HqB+u37t9bNu
nk9kXFw0OkgWMz39Tv710Rry5rvJnDKNgLAIAsLCcaSNpSh/O5rXy6TZedhD
IwYWXVCpKi1m06df4OPnz9gpuQOWR5dQFVfLijder/Z6XIV7DxU/6OvrM6Tq
cV7KOtJBt6IoJCfG0d7ZRWt7J2azaXRCbNRToaGhl992733+4TGxcQAet5tN
a1bR1dFJ5uTxhERE4HI6kCwmepo70HUde3gwqlfFYrPS1dFJ0a6DmCwW8m6Z
T3DYwPlJR0tL0+rl7zS2tbTWnahreBqo+qGD7hEBCIKA7PViEMV4URSDTSbT
MlmWZ0REhOenj00Omnfn3bbAkNCks/t8s+oTqstKsPkHoekQHOCHKAp0dPUh
oNPX1YF/UCDz7/s9vnb7mX5d7e1136z+pPPo0Yr+mrr6XEmSjnq93nsGj2yr
fhSAs2gjMMdssXjv+cPvpWkzZ1J6YN+Wwh07tLm3L4yz2GxW/8Cg2NONy/bs
YnRyFn5hMRRs24giy0ydMw9XVxuHt39F1sw8rD4DqtHb3dXk6u/v37hmVVdY
dIzz6ttun1FaWMRfly6VnQ6HCSgb7sTnNIAfOmI6TRVGo3Hm3Jtu9Ey58koX
4J8xaUqePSh4/6fL3wn287eXzrvrHiSTyexrt4elXz6N6qKDdJ9qJ3vaTBAE
mo+V0lJdSs6cazCaTDj6+tplt9v15ccfNfZ0ncqcPHNWW870GTMGCryZjplz
r9735drPc4GSEUual3DZ42XggfQJEw787tFHsswWi8Vqs/kANNXWlK/74L1U
QRTbf/XEIsnq4xMIUHu0jKbjVei6TkBI6MBmFUXcTmfPiteXtXplOXnmTbcU
pE3MzhncS06X0+la+/HKw/mbNk0BVg+eHfNTVehsehp4MX7MmL3PLHnlTMeW
+vqyL/7xYYJoMHQ+8J8vx8gXKEVKJhPLX3zhiMftSZh5400lYzIyzxRs33n9
9V2H9u67HHgbePBibqsIP+G6zX2D9yjONb81U7PHTwFaLtAvY1dB0ftGg2HK
cAeLwAuXct3mfwcAPCsNeMNZISwAAAAASUVORK5CYII=
====
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






















































































































































































































































































































































Deleted bldt/javase/libs/javase-runtime/cc/squirreljme/jvm/head_64x64.png.__mime.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
begin-base64 644 head_64x64.png
iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAACXBIWXMAACZz
AAAmcwHzbHUKAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNn
VFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8ig
iAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfA
CAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAH
vgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCd
mCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7
AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7
AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkX
KxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G
/yJiYuP+5c+rcEAAAOF0ftH+LC+zGoA7BoBt/qIl7gRoXgugdfeLZrIPQLUA
oOnaV/Nw+H48PEWhkLnZ2eXk5NhKxEJbYcpXff5nwl/AV/1s+X48/Pf14L7i
JIEyXYFHBPjgwsz0TKUcz5IJhGLc5o9H/LcL//wd0yLESWK5WCoU41EScY5E
mozzMqUiiUKSKcUl0v9k4t8s+wM+3zUAsGo+AXuRLahdYwP2SycQWHTA4vcA
APK7b8HUKAgDgGiD4c93/+8//UegJQCAZkmScQAAXkQkLlTKsz/HCAAARKCB
KrBBG/TBGCzABhzBBdzBC/xgNoRCJMTCQhBCCmSAHHJgKayCQiiGzbAdKmAv
1EAdNMBRaIaTcA4uwlW4Dj1wD/phCJ7BKLyBCQRByAgTYSHaiAFiilgjjggX
mYX4IcFIBBKLJCDJiBRRIkuRNUgxUopUIFVIHfI9cgI5h1xGupE7yAAygvyG
vEcxlIGyUT3UDLVDuag3GoRGogvQZHQxmo8WoJvQcrQaPYw2oefQq2gP2o8+
Q8cwwOgYBzPEbDAuxsNCsTgsCZNjy7EirAyrxhqwVqwDu4n1Y8+xdwQSgUXA
CTYEd0IgYR5BSFhMWE7YSKggHCQ0EdoJNwkDhFHCJyKTqEu0JroR+cQYYjIx
h1hILCPWEo8TLxB7iEPENyQSiUMyJ7mQAkmxpFTSEtJG0m5SI+ksqZs0SBoj
k8naZGuyBzmULCAryIXkneTD5DPkG+Qh8lsKnWJAcaT4U+IoUspqShnlEOU0
5QZlmDJBVaOaUt2ooVQRNY9aQq2htlKvUYeoEzR1mjnNgxZJS6WtopXTGmgX
aPdpr+h0uhHdlR5Ol9BX0svpR+iX6AP0dwwNhhWDx4hnKBmbGAcYZxl3GK+Y
TKYZ04sZx1QwNzHrmOeZD5lvVVgqtip8FZHKCpVKlSaVGyovVKmqpqreqgtV
81XLVI+pXlN9rkZVM1PjqQnUlqtVqp1Q61MbU2epO6iHqmeob1Q/pH5Z/YkG
WcNMw09DpFGgsV/jvMYgC2MZs3gsIWsNq4Z1gTXEJrHN2Xx2KruY/R27iz2q
qaE5QzNKM1ezUvOUZj8H45hx+Jx0TgnnKKeX836K3hTvKeIpG6Y0TLkxZVxr
qpaXllirSKtRq0frvTau7aedpr1Fu1n7gQ5Bx0onXCdHZ4/OBZ3nU9lT3acK
pxZNPTr1ri6qa6UbobtEd79up+6Ynr5egJ5Mb6feeb3n+hx9L/1U/W36p/VH
DFgGswwkBtsMzhg8xTVxbzwdL8fb8VFDXcNAQ6VhlWGX4YSRudE8o9VGjUYP
jGnGXOMk423GbcajJgYmISZLTepN7ppSTbmmKaY7TDtMx83MzaLN1pk1mz0x
1zLnm+eb15vft2BaeFostqi2uGVJsuRaplnutrxuhVo5WaVYVVpds0atna0l
1rutu6cRp7lOk06rntZnw7Dxtsm2qbcZsOXYBtuutm22fWFnYhdnt8Wuw+6T
vZN9un2N/T0HDYfZDqsdWh1+c7RyFDpWOt6azpzuP33F9JbpL2dYzxDP2DPj
thPLKcRpnVOb00dnF2e5c4PziIuJS4LLLpc+Lpsbxt3IveRKdPVxXeF60vWd
m7Obwu2o26/uNu5p7ofcn8w0nymeWTNz0MPIQ+BR5dE/C5+VMGvfrH5PQ0+B
Z7XnIy9jL5FXrdewt6V3qvdh7xc+9j5yn+M+4zw33jLeWV/MN8C3yLfLT8Nv
nl+F30N/I/9k/3r/0QCngCUBZwOJgUGBWwL7+Hp8Ib+OPzrbZfay2e1BjKC5
QRVBj4KtguXBrSFoyOyQrSH355jOkc5pDoVQfujW0Adh5mGLw34MJ4WHhVeG
P45wiFga0TGXNXfR3ENz30T6RJZE3ptnMU85ry1KNSo+qi5qPNo3ujS6P8Yu
ZlnM1VidWElsSxw5LiquNm5svt/87fOH4p3iC+N7F5gvyF1weaHOwvSFpxap
LhIsOpZATIhOOJTwQRAqqBaMJfITdyWOCnnCHcJnIi/RNtGI2ENcKh5O8kgq
TXqS7JG8NXkkxTOlLOW5hCepkLxMDUzdmzqeFpp2IG0yPTq9MYOSkZBxQqoh
TZO2Z+pn5mZ2y6xlhbL+xW6Lty8elQfJa7OQrAVZLQq2QqboVFoo1yoHsmdl
V2a/zYnKOZarnivN7cyzytuQN5zvn//tEsIS4ZK2pYZLVy0dWOa9rGo5sjxx
edsK4xUFK4ZWBqw8uIq2Km3VT6vtV5eufr0mek1rgV7ByoLBtQFr6wtVCuWF
fevc1+1dT1gvWd+1YfqGnRs+FYmKrhTbF5cVf9go3HjlG4dvyr+Z3JS0qavE
uWTPZtJm6ebeLZ5bDpaql+aXDm4N2dq0Dd9WtO319kXbL5fNKNu7g7ZDuaO/
PLi8ZafJzs07P1SkVPRU+lQ27tLdtWHX+G7R7ht7vPY07NXbW7z3/T7JvttV
AVVN1WbVZftJ+7P3P66Jqun4lvttXa1ObXHtxwPSA/0HIw6217nU1R3SPVRS
j9Yr60cOxx++/p3vdy0NNg1VjZzG4iNwRHnk6fcJ3/ceDTradox7rOEH0x92
HWcdL2pCmvKaRptTmvtbYlu6T8w+0dbq3nr8R9sfD5w0PFl5SvNUyWna6YLT
k2fyz4ydlZ19fi753GDborZ752PO32oPb++6EHTh0kX/i+c7vDvOXPK4dPKy
2+UTV7hXmq86X23qdOo8/pPTT8e7nLuarrlca7nuer21e2b36RueN87d9L15
8Rb/1tWeOT3dvfN6b/fF9/XfFt1+cif9zsu72Xcn7q28T7xf9EDtQdlD3YfV
P1v+3Njv3H9qwHeg89HcR/cGhYPP/pH1jw9DBY+Zj8uGDYbrnjg+OTniP3L9
6fynQ89kzyaeF/6i/suuFxYvfvjV69fO0ZjRoZfyl5O/bXyl/erA6xmv28bC
xh6+yXgzMV70VvvtwXfcdx3vo98PT+R8IH8o/2j5sfVT0Kf7kxmTk/8EA5jz
/GMzLdsAAAAgY0hSTQAAeiUAAICDAAD5/wAAgOkAAHUwAADqYAAAOpgAABdv
kl/FRgAAHXtJREFUeNrkm3d0XNW1/z/3Tp+RRm3UJavYkuXee8cdGWPAFBtC
IE4IifN+hLzYwSYk5OUFkpAX4hdYCSShGDAJ9iM2xoCNC7Zwr7hhSbbkIlll
eq/33t8fMxpLtgRyQtZv/dY7a83S3Kt7zt37e/bZe5/vPiMoisL/5ibyv7yp
O1+sWb38Zvu3A7cD+/+Bd/8X8APgx8AvvgJdJgCbgJyeHpgRCHS5Hvq7V//f
WUBOccn3y4cMBzAAL3wFQ0rXT+hNW8AUc3avO9Z4rKeAbMDXuV/WoluT30uq
xnbbd83q5W/pjCaxuGogDadO5AHRx5558UvfeeyXT/cky2Tg1Snm7Iwaj9U6
p2Joj4pEPzvwz/uAGo/VPjUzb/B3n/qJH9hc47GOVmIxFEn60r5rVi9/Hliq
1moRBKFDhlhv3ivHoiiSdO0TS3aLAqkAc6uGW7bVn7z6L3OCNR5r09TM/Awl
JqHRak1ACNjzacA5Pmvh/N4M0bewoj8Ll3wTgD5VA5cCj6xZvfypL+s4YsVP
yFo4P/mpfOQhajzW8cBOwAWgSDKA5V8ZBdKUWEwY+r1HAHh09ZMWQAbUgqbr
ErxSf+z62X+nz4BBMxfcczcgIEkyiqLoAC0gfNmLVTodgkad/Ig6XccyVhJy
IAgCcweOVG+rP9n4lQNQ47EeBUwAaoMBAJ3BkPWtJ1YFgDc2rn19YheTlW6w
bJOoUhn1ej0AI0dOpHTQUPLL+wWAn6xZvfyHNyPPn3/1y4nAG996YlVAZzBk
AQTbW1GiMeFLrED/j1pAdnczZTSZspetWKkH1m5c+/rUHtb+b4FbVapOViKI
DBk2nrIhw41FFf2DwNNrVi//SW8ESbxn7bIVK/VGkykbYMh3lqHIcscjKdvq
Tx7ooXv4HwUgfVpu8Q2eLuD3o1ar877x7z/UA3/auPb1Gd30HdCnaiA5JeVd
bmo0WkaPnYpKo0lJWJe+F8rPAP70zZU/Kk0xm/OSY6WkJHAVmTd4NMCQHoZQ
ugVAkeUePzUe6z4gRQ6GVNcrLwC21lZcdnvhHQ89XAH8dOPa12/vNPv/BczT
GY2MGZcwEMl9zRAEFfMXP0RuabkHWLVm9fKfdWNBd61Zvfx/Nq59fWB6VtZH
dz70cDmgCvj9N2gXbG9FDkduPg8w5OT2/KTPXtrZ/IPBIELihr29HUmSOPTJ
ro/9Pt9oYBrwM4CrDScBRhX0q3TklpRnCkIHfjJIHlCZ475Eb+CeZY+ZFUWJ
fvD2S+PXrF7uuk6C94C/AWtuWXi7Vk6E3E4mf20ir4Vj5aYAEFSaL3rWPG/Y
OPyNDQn5ZWzt7fHJjEb5dNu2Gltb6+zZd9558eN3360H/rpx7evVj/38P++0
5OaOLS4pNgwaPCaudJfkrZNHjvsHzYL7H50lJzyoogh+QVBMgiDe+/unvv8B
kNuhvCiKyLJM0O/HYDLF19lD9/P5a28lne62+pM75lQMndkrAL4EMJUcCCYv
HO3tSNEoh/bsrgn4fAOGj59QlFtUVJdbWFiZk1+w/f231w31ulyH1q75nTJs
/ASxcuhQ9AYjSM4vNUtBVIsqUa1NXHb8ZdSUKV87WlMT6ixDZk4OcicrMGRb
kn5g7pAxka2nDk/u4TUaINqr3Hlb/cmt1zun/Tt37g/6/f0c1vYpE2fNbhw8
enSZSh0fzpKXd/+dDz+sd9kdfPL+ZkGlVmEw5YLs7Z2rlT3d3s4tKJgpqlSq
o3s/3TBq0uTF0WgUh9VKZnY24WB8cpR4dknI2o4uy6Lt7PEBdIpCOP5MjJvY
PMyaM3RMiGBYD3BeiRxqudg4YdLsOfW5RUXWwpKSgaKqi280BLw+FFnGlGpG
isVAUIF8XV4gpnajvBeU7lNqlUqtkyWJKxcuLJZjsYhaq902fPyEBQ6rNflM
ZnZ8GyBHk06wi5PYZzAwKhRKmntvw6DUofwFOXykxeseO2XevPpRkydXFJeX
X698PNCGQtja2mhqbKDfkAndz76g7kb5nrcFAb8PnV7P4mXfpKCkVLpUX7/g
8J7dtSf2798djUSIRiI4bbaO0JKcjG31Jzd2XLhEEV0nEqiLBLGAv8dlCVDr
bD9y1ecZPWXuvNoREyf1F4Qvzl7rT59ixMSJmFLTe7X2u1Pe1e5Do9FiytBS
XjWAnIJCcgoKyC0sNKi1mtj+7dv7A/39Xm9TSmrqlYGjRk2QgyFEgx5BVDF7
6Bj/xycPL+wc9w/o9YwIh28EoPyOe7qVa+cLz3rO2pqdTU776Hu/9Xg4rziz
P4LQK9PJzs/v5br33XDLbfUhKGoO7t3BoBFDyS0sxJhIdtQaDSMnTlLnFRVF
XXbHZltry8BThw9PGDR6NOmzpuLZe4iQ3YouI9OU2C0mm12lSlpBFwBMBUVd
BHji4SUAOWq1KlVRlMx7v/V4KMNi1vdWeQApJvXuQSV6nfJ+IqEYp09+iiUn
k9B1bE4HCH369tP06csCKRbTGoymz4/v26saOXVaJYAcTgYMZcDD346HycSN
N370KP174QPKtVr14Qkz52jufGi5JzPbrNcZNV8dLdTNrHe0SCgOSKYlnQxL
NjkFBV80klalVjN2xowBaZmZwROfflp/nR+4oVkTEevLAPijwaDrU33fgxh0
RrPOqP1K9D5Ys4fzp0/HZ1329QiEIIhkZeeQlZOTTHS+MFFRqZhWvWCYyWz2
NUqh81/4bHdLoJPpa4EXDAZt/uJl38VjbSc9O/UrUf7j994jHAxRWTWgW9NP
pp0WE9aWFiRJSq77Xu3vRZFbbrttxA5FPnrxbG39AKgYW9xPe7N8wAMajXre
ogeXDZajClqdgkav4krDhV4JYWtt7fa+xx6gobaeSChCRvYX8486g4ZYLHTT
ANtaWxFEkVmL7hhlHtjf0ei2nwrHoq/0GoAnHl5SotGof7JgyQPFLZeucOzA
bvQmLYc+rcFls/dKCL+3+4wvHIgQ8gfQ6XW9GkcQBCy5uTcFgNflwtbaAkDF
kKHj6tubh0z/t5XLbsYCvl45ZFiJVq3HYWtl4dK7ObLvU1SCiC7BAv1TdHhB
HzTa7h3p8YMHuFhXd41hzs3FZDbf1PhF5eVEAgKfHT5EwOtl6vxbWbN6+Uu9
AuCJh5eYVCrxu5FIlO2b/4fp1XOoO3saZOhbVdXtbLRf7UrAOhI7xJ5aSlpG
t/dPHT1KyB/AkHLN2aXcpPIdGVtKmokLtZ/T3tqCJS8P4JHeWsA4gyklV6vR
0m9gFfa2FoI+P/0GDECn19/giR1WK1qdrsu11+1O7sZUKjXX1x7jafON4enS
hfOkZ2SQW1BIe5Odjzas56P166k9eRKfK9hrAKLRKGod9KsYjrWtFZ/Hw8RZ
s1sSdPwXA2AwaH+hUmtobbrE7EULuNTQQEZmJjq9HikWRaONO1OnzYbH4cDj
dJCelZW853XFOQxFUTh15BitzVfjfeQgiHHwdDo9DpsNvzt8Y9IkSfjdYZov
NnBw936srW2cPnKEoDfcKxDsbW1EwmEUBfpW9aei/wiOHzyE3WrPB77/pQAo
CuNNKSlkWDI5eehoPCEJh5FlGZ0pC7VGg8NqJeDz8dnRw2g1qdcAcToRBAGv
283rL7zM3h27sdtc8b26EkpuyvRGEy6nk4AneIPyAAFPkD0ff0hxWQlT5s5B
VMVFDHrD+N09gxBXXMFltyOKIiqtTL8BVRQUlXGoZh9jpk5rXrN6+bNfCIAk
yQiiGDdTIS6UJS8PRZbQ6Mw4bTaCfj+N5+sw6NPJyLLgstvxOJ1EIxEu1tfz
9p9eIxIOYUoxoQDH9+3H1tYWtwIgLSODWOTG2N/e3EZWbk6SZxwxbjJet4u2
pibCEV8CnHC3u85wKIQUi2FKTUWWZXweD16XG0EVZeSYaWRkZ3D25JlC4IlE
et89AHqjiWg4TMDnR6USyLJkk5Wbi86YSTTkxuN0cvXKZXRaMxWVwzGYtbgd
DmLRKJvXrWPvzj3oDQaysrMRRBU5eQW4HbZkWDKa9VjyCggFQ2g013zHySOH
CYfC5BYWJXJ8LUWlpeTllzN68kw2v/0qkWgcBJ8zDqTfHUpmu6IgJNPeFLMZ
j8uF1+1Co9UhaENMmTkPh81O+YBBbfn5mT/tEQCtTo8sSUixGG0tV8myWJBi
MTT6NKJhFw219Rzcs5fK/iNQG2K4HXYEQeD9t9chqPXIkozeaCKnoJDSvpXY
2tu5fKmVs8eO43W5MKXpycrJQVSpqKv7jIAnhLWlhTPHT6DV6Qj7Y0SjUWRJ
JrswC73RSEn5AEZNuoVNb71CTAogSRJnjh0l4Anhd4fQ6vRodDpam5rZs3U7
5vR0zOnp6DRm6s+eIRoNU1I6kKohw7jceDkXeLpHANIysxAEAYPJiCiKyXUJ
EPAFqD97juI+5aj0URQk3A4nJ/bvx2jOxGFzkF9UTL/+g3BYrQwbO4rs3Dhl
39bcxI5Nm7BdtaPV6TGnmTlz/CCRgExbczPRSBStTovPFaD1amMySKRmGjGa
dZT1G0ROQSEb3/wLuz/6O9v//nfCER8BTyi5LARBoeniJTb/bQN6o5EUs5ld
H3zEpfrzqHUyk6fPw+f1EotJcudl0AUAU6oZUVShVmuRJKkLAEG/n7arLQwf
MwVBVHC0t+N2OPD5ArQ0t1JeUYEsC4ydNgm/z0uffn2YPHsmZZWVXLrYwqXz
9QS8ccIlN78QWRa4fLkuuWXWaDTIRGi6VE9GIrIAmNIMGFJ1zLztLqbNW0Sf
sipK+lXw7tqXiUT9+N1Bgt4IpRWV3LZkMU6bnd0fbkNjBJMpnWMHDhIMuVAU
BVOqiXA4KvRoAW6HDa1ej9ftISMzkwzLtfLa1aYmVCo1Gl083/a4XJw9cZK2
ljZSUszMvn0RFQOrKCwtYNVzz5CalsbQscMpLCli3JQZtLQ4aKj/jIDXzpip
c/E4XZyvO5kMm4IgcOroXgJ+f9IZJhOidAMqUUNRaTmFfSqYseBOisvK2PDa
H4lE/fhcAQKeMDn5BSy8715ampqpP32OeXfchc8TYM/W7fh8DiqqBhONSj07
QVvLFVLMaXg9TrJz88gpKEBR4uGr7sxZcvIKiUS9xKJRLtWf53LjZVQqDVNn
z+O5nzzL7oPH+E7+RB5UW3hUXcgwdSbvvvkOFy/U8uCj/4ePNn7Iib07yMzO
xmgyEfAGEkmTEA+1ej0oIIrXOMaG02d5qPpupuQVszKvkn1vvsWBmkMY0/sQ
DEbZ8Oof8HrsuO1OAp4wGVnZTJo5nQ82bESfomLh3Q9w6ugJ2lov0n/wsA4K
3dh9YUQQMKamEovGkGLxj0ZnxutqJxqNkmJORxBE3ntrLaj0ZFgsmFMzsTvd
/G7dm7D3LK2XVAhaSFdn8tf9H/PHXdshFmHx/V9Pxmu3tZl+VQM4enA/I8eN
Q6VSJZebLCuoEiTr2UNH+c1Pf05tzX5+MGQ+902YjavRgTAwFWFkZVLuD95d
hxQJc8+yf0Ot0lHWv5LyynI2vfk3ps6ax8Dhwzl24DATZ+g6DmUUAXU3WIAg
CAcE4rMR8PkRBNAZM3G0XCYUCJGaloYsSRjNGWRYMvE4PaSkZTH3rsXIXje7
J99PeGQRuX/5ObqXHmfJ3IU8EEqlae9p3ljzW5789W/4aOMH7PrgXYYMn4Ai
KTReOI9Go8HvvZEU2fjamzTtPc0DoVSWzF2I7qXHyf3Lzwleuoj73U8YOWpU
Yn9RTFFZGe+88kKiXCYxfvpUnHY7Z08dYfrseTjtDpx2F6KYBOBGC/D5gt9u
ajz/mahSUXf2HEPGjIs7ImM24VAIc1o6G159FVNaFmq1lrKKSm5dujS+16+r
RZOVRuDgBbat/jGCFvw79jOKHFIlONHSzLE9uwA4c/IsffqeZeL0uRw/VENh
WREet/tadUqA3Ru3YGtp5gEph0rggx3rMT3dhBKB4oYIzu2HyKiewISp09i/
ZzeTZoznkw82EQp50YbTsOQWkpWXRUPdBSy5OZRV9OXMiZMdFpDeQ2mMk0Gf
E1EQuHqlKVlyUhSZSDiCMcWI1xti6NgKDuzey/JVqzuVs0RkUY36b2s5jpNT
xAsTkyhmVBgubd7Oz3ft58P2Bp767mNsfudtlix7BFGlIegPIAgC4VAYnV5P
cVkpK+bdxTSfnyqKOQrsPb4Tju9kCFrKyODzSeOQjhxg7F33MmHqVIIeP7cs
uIMNr77MwKHjKSwppW/lIA6313D5wkUGDR/Kh+++h0ajAjjTIx9gNOo2anTa
mFqt5sS+o8kKbCQcZvt760nPzMDv8zFgyHAs+ZmEE2ytNjOL1BkjSdWLPKoq
4uvaLKbrRLIJUp6Vz9fuu5OZ996LRqth+eqVSJLMX1/5E3q9CpfdiVanxW5z
YDQZGTF+LDPvvZev3Xcn5Vn5ZBNkuk7k69osHlUVkaoXKe5TSrvbTSgYRGdK
QWfQ4HeFuWfZo1y8cJp3Xvk9Ff2HhgYOH8GVxkvEYjFSzKnIsgJQm5w4RVHY
smFdx/VSgJP79ryVnm0h6A8zYtJkBEFk56Z3ybBYyLBYcFitlFZWkZ2fhyXd
gjE9HY1OT25uBmee+AvpL60hO+pEJSi0mIvxfe/fGPT0o/HCR4IAPX/2HH/+
7X+j0ajJLyrA7w+gN+jp178f8++5B8QUENScefqPpLzwe/I9V5AUAasmg6s/
/hHFS2chiFrOnzuDFI2i1qqRYjKKoqBSi7idDqKRCBlZ2dLpw/tVaRkZIEBz
4yXcTpcwpfo2qhcvTS6BuxN/VwFk5haEwqGgPtWUQvP509z3nZXs3LgBj93K
4GGDsF5tZsrUmWQXp7Nr6x6UthZEtRpBHIblBwtwej1cOvwZihKj8N5qBj35
jfhmSAknEp8YRaV9WL56Jete/jPWNisp5lQcVjtKZfk1ylzQMejpZVzQCBz4
2xZig0pJ6VtKZHQxF+rqkWWZqr79MaQaScs2daonRMkuTg+seerHxiugKh08
WpIkSRWLRFCptUypvq1D3/UdAPwHQPXipQMSzFChTq9rqhoyLBIKebWRcDiR
GseISRK5eUVo9fGuM+ZOxWPz43f7OXfqBIIg0Pff7yIlOB9Lahq6gkJQ5GvK
SxJtzc3Y2toYOnYs33vyCd76w8tY29qIhCNY22yd9udhUEQMS2ZSMnc4Da1X
CYgik6bPJRYK4WptwWg2YrZcI2rSsk0427ycPnrEDewDTBdPH5kweNx4j9Pm
Nfs9TqVDX2B9hw8Y0KloAnBVkSXr558d12q0mrAsSR3ek0gohDHFRFp2SlIh
s8WEzqhn8IAhDKio4nxjA43t7fhTzahNqV0YoFAggNftTvKLptQUHln5AybO
mIbBoKWh9gKdj720t7ZRV3eORpuVGQvuZOL0OTiuXMLnsKMz6jFbTF1S9jjp
H2bHxo35jz3z4uyWFsdE4ODpgwfM8YwTarZsTurbU3lciURi1SqV+MnVxkZj
0OcNAgZRFBEEgez8rC4K6Y1GMvOv8Xe5pfFzQLu2foI4YjCWHEuX4oWiKFQN
HdrlhTMW3EpOQS4b31pPW3MLZZX9sLXbOHP8NDPmTk8QFk60OsgttXQhUkKB
AKbUODkTjUSwtlxVcgsL2wB++erbrFm9fEI4HJUdVjuCIApfcEKkSzssSfJm
t9u/4M3//oUJwJiSEqs/+7n67m9+A4fNESckwmFcTjf5hflcXyafMXc6Oz7a
xcx5MzpxDkaqhg3r9oWDRo5i0MhRyevPjp3q0rcLH2lzIMkykVAIUaUiHI6T
LC6HI/rhO+9oHnvmxc5V2axYTGpUoNho1H0eDIa/GIBfvvp2R2F0iSTJgw2p
ae+43G1VGbkFYuO5zzl7qhatVktqWipulwdFURBFEZ1eh5DI4zMy47lGTwr0
pnXu63R0PTN17PAJFDmeNCXL9IpCLBYTjeb0E++vf2viheP7Dj/2zIvRx555
0fbEw0tWyXLLX32+4NBeWcAvX32bLRvWdUxHVvPlrQQcV8X8okJ7c93prElz
ZlNYUoLRZEKlVrNty/bkfgJg9q3dn0vyuFxEwiFS09LRGbqyzOGgH6/bFecM
0tO7/O/IgaNdrrsbv625Wf7rH/+g6jdyUiGwsbBy8P1bNqxzVi9eekSn01zQ
atXnv+SQ1LW2ZcO6YcBWgJotm7PUapUrGIykGfBV6tJz6hVZzmysraW0spIU
s5k51bOuUdORCNFohHAwhNFk6rI0dr23ibrTZxkzbQrjZy1CShynVanUHNix
ncO7a6gcPJDbH/z6tSKyJDFh8hh0hvhusYOd7mitTU2EQyHZabUeBuTqxUsn
JnSwJ/7eEg5Hj4TD0YpOk9tzbXDLhnWDgN3Vi5dmVS9emgUQi0mzIpGoDcgY
MnZc1oGdOwIqtZorDQ04bTZi0WtEZ3vLVVqbmtj0xlr8vq6bnFGTJ9PQ2Mob
L/6Z2mO7CXnbCHnbqD22mzde/DMNja2Mmtz1YJff52PTG2tpbWqivaVrIcZp
s+F2OhVba8uR3R9sSXvsmReT55U7yb97SvVtg3pVGtuyYV05sL968dL0zssB
OBIIhLNbWhwXhk2cx8hJk02Hdu30q1QqpeXyZa5evpwEobCkFLVag8tuJxzq
WuDMK+7Dd370ONkFBdSeOhUvgGxYT+2pU2QXFPCdHz1OXnGfG5hfl92OWq2h
sKQ0fpwnGqXl8mU8Lpfsd7tPfrp1q3n6gtsGdKdkQpf9U6pvK0/o8oW1wQvV
i5f2qiY1cvKUlL3btvq1Oq3idji48PnnycpQfnExM29fxG+e/BkeV5w2j0Wj
iKLIkFHDeOr5XzFp3nx0ej06vZ5J8+bz1PO/YsioYQiiSMehJ4/LyW+e/Bkz
b19EfnFxnJ4LBLjc0ICiKLHWK1eO1Gz9SNuT8p1AMAMXeu0DunOKnduwifP4
bN9HjJ46LXX3R1t90+bPN0mxGJfOnyc7Lw9LXh5Vw4ax8L47eOaHT3L3N+5H
bzAAAhqtBo1Wi0qtTiZEkiTR3tpCNBIhHI4ACpFQiPWvvMXC++5Ihk57ezu2
1lbSMjOjzZcuNhzctdMUziia2SHTTdcS/5HfDf76uWfTVq5Y5U58NwPufhnx
GsH4mbMUWZYFnV5PUVkZer2evR9/zOZ3NnY71txFCwDYuvH9bv9/2z2LmDRn
DpFwmJYrV5AkSQr6vP6d772XkmGxiKOmTGXzzgMAaStXrPJcL19Pbc3q5Tz2
zIs3/yurRHv+1889uyLx/TXAVTlkaLokSZw6fMiuNxot/QYMpK2pCUteHuNm
zGDSnDm4HHY2vfYqk2+9h76DhiUKHfHcf8bt9wNwsfYMx2o+5M6Hl3VhpBtq
a5FlSd79/vuiLMufTKtesFClUlFaUYFu7zEkSVr/6+eeXZro8hzwjV6dKPkH
AfgV0Ao8L4piv289dE96+YABaDQaqoYOs1Tft2Tr6SOHCQWDnD97ltbmZvxe
LynmNEZOmUrzxTr83ngCpdOnotOnoigKfq+Hq5fOY8nL75QbBGltaiIaDnFi
/37n1Pm3CrMW3bFQo9EkD0s/uGQR6Wlpc4DnE3L96l+6BBJm9mPAsOLxbz8h
CILo9/kQgMa6OhRZRpZlmhobaG1qUqbOvxVAKC4rQwH279yOTm+m36BRyeKn
LMmcP3OUaNjLtFvjy8LtdHKpvo66U6eJRaMMHDkSlVpNWeU1QlQBTCkpKIri
f+75l9YAwZUrVv3nl8nfsQSEf+a3w79+7lkP4P7h9x+xJExV35EJNtbWJs8G
7Hxv0yfV9y2ZXlBSgiRJqDUaDuzYwbnPTpCeZUEURRAECktKGDFxIpcbGojF
o4DS2nRFKCorjydTikJZ//5dzhwYTKYQwG9+97It4Qd6FcG+EgASILwGnANY
8fi3/6PjjJAgCMlzMA3nzlF/+rSiycxR+lf0RS2CoiiCIAhIsVicBhcEYtEo
Gq1Wcbg8wtWrLZyvPV8/85bJZYIgMHjMGAJeb1L5jt3fc8+/1PEbo6qVK1Y9
1Fu5vzIAEiB8rcNpd9zrX9m3g3Whtu7CegB10JOLHJsKoJXCGFNSMJnN6HTx
k/hejxu3w0FE1IKo3hEzmF/vPGYPbTPAyhWr3rgZmb9SAP5/bv93AE4g+jcs
IS21AAAAAElFTkSuQmCC
====
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
















































































































































































































































































































































































































































































Deleted bldt/javase/libs/javase-runtime/cc/squirreljme/jvm/head_8x8.png.__mime.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
begin-base64 644 head_8x8.png
iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAACXBIWXMAACZz
AAAmcwHzbHUKAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNn
VFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8ig
iAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfA
CAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAH
vgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCd
mCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7
AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7
AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkX
KxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G
/yJiYuP+5c+rcEAAAOF0ftH+LC+zGoA7BoBt/qIl7gRoXgugdfeLZrIPQLUA
oOnaV/Nw+H48PEWhkLnZ2eXk5NhKxEJbYcpXff5nwl/AV/1s+X48/Pf14L7i
JIEyXYFHBPjgwsz0TKUcz5IJhGLc5o9H/LcL//wd0yLESWK5WCoU41EScY5E
mozzMqUiiUKSKcUl0v9k4t8s+wM+3zUAsGo+AXuRLahdYwP2SycQWHTA4vcA
APK7b8HUKAgDgGiD4c93/+8//UegJQCAZkmScQAAXkQkLlTKsz/HCAAARKCB
KrBBG/TBGCzABhzBBdzBC/xgNoRCJMTCQhBCCmSAHHJgKayCQiiGzbAdKmAv
1EAdNMBRaIaTcA4uwlW4Dj1wD/phCJ7BKLyBCQRByAgTYSHaiAFiilgjjggX
mYX4IcFIBBKLJCDJiBRRIkuRNUgxUopUIFVIHfI9cgI5h1xGupE7yAAygvyG
vEcxlIGyUT3UDLVDuag3GoRGogvQZHQxmo8WoJvQcrQaPYw2oefQq2gP2o8+
Q8cwwOgYBzPEbDAuxsNCsTgsCZNjy7EirAyrxhqwVqwDu4n1Y8+xdwQSgUXA
CTYEd0IgYR5BSFhMWE7YSKggHCQ0EdoJNwkDhFHCJyKTqEu0JroR+cQYYjIx
h1hILCPWEo8TLxB7iEPENyQSiUMyJ7mQAkmxpFTSEtJG0m5SI+ksqZs0SBoj
k8naZGuyBzmULCAryIXkneTD5DPkG+Qh8lsKnWJAcaT4U+IoUspqShnlEOU0
5QZlmDJBVaOaUt2ooVQRNY9aQq2htlKvUYeoEzR1mjnNgxZJS6WtopXTGmgX
aPdpr+h0uhHdlR5Ol9BX0svpR+iX6AP0dwwNhhWDx4hnKBmbGAcYZxl3GK+Y
TKYZ04sZx1QwNzHrmOeZD5lvVVgqtip8FZHKCpVKlSaVGyovVKmqpqreqgtV
81XLVI+pXlN9rkZVM1PjqQnUlqtVqp1Q61MbU2epO6iHqmeob1Q/pH5Z/YkG
WcNMw09DpFGgsV/jvMYgC2MZs3gsIWsNq4Z1gTXEJrHN2Xx2KruY/R27iz2q
qaE5QzNKM1ezUvOUZj8H45hx+Jx0TgnnKKeX836K3hTvKeIpG6Y0TLkxZVxr
qpaXllirSKtRq0frvTau7aedpr1Fu1n7gQ5Bx0onXCdHZ4/OBZ3nU9lT3acK
pxZNPTr1ri6qa6UbobtEd79up+6Ynr5egJ5Mb6feeb3n+hx9L/1U/W36p/VH
DFgGswwkBtsMzhg8xTVxbzwdL8fb8VFDXcNAQ6VhlWGX4YSRudE8o9VGjUYP
jGnGXOMk423GbcajJgYmISZLTepN7ppSTbmmKaY7TDtMx83MzaLN1pk1mz0x
1zLnm+eb15vft2BaeFostqi2uGVJsuRaplnutrxuhVo5WaVYVVpds0atna0l
1rutu6cRp7lOk06rntZnw7Dxtsm2qbcZsOXYBtuutm22fWFnYhdnt8Wuw+6T
vZN9un2N/T0HDYfZDqsdWh1+c7RyFDpWOt6azpzuP33F9JbpL2dYzxDP2DPj
thPLKcRpnVOb00dnF2e5c4PziIuJS4LLLpc+Lpsbxt3IveRKdPVxXeF60vWd
m7Obwu2o26/uNu5p7ofcn8w0nymeWTNz0MPIQ+BR5dE/C5+VMGvfrH5PQ0+B
Z7XnIy9jL5FXrdewt6V3qvdh7xc+9j5yn+M+4zw33jLeWV/MN8C3yLfLT8Nv
nl+F30N/I/9k/3r/0QCngCUBZwOJgUGBWwL7+Hp8Ib+OPzrbZfay2e1BjKC5
QRVBj4KtguXBrSFoyOyQrSH355jOkc5pDoVQfujW0Adh5mGLw34MJ4WHhVeG
P45wiFga0TGXNXfR3ENz30T6RJZE3ptnMU85ry1KNSo+qi5qPNo3ujS6P8Yu
ZlnM1VidWElsSxw5LiquNm5svt/87fOH4p3iC+N7F5gvyF1weaHOwvSFpxap
LhIsOpZATIhOOJTwQRAqqBaMJfITdyWOCnnCHcJnIi/RNtGI2ENcKh5O8kgq
TXqS7JG8NXkkxTOlLOW5hCepkLxMDUzdmzqeFpp2IG0yPTq9MYOSkZBxQqoh
TZO2Z+pn5mZ2y6xlhbL+xW6Lty8elQfJa7OQrAVZLQq2QqboVFoo1yoHsmdl
V2a/zYnKOZarnivN7cyzytuQN5zvn//tEsIS4ZK2pYZLVy0dWOa9rGo5sjxx
edsK4xUFK4ZWBqw8uIq2Km3VT6vtV5eufr0mek1rgV7ByoLBtQFr6wtVCuWF
fevc1+1dT1gvWd+1YfqGnRs+FYmKrhTbF5cVf9go3HjlG4dvyr+Z3JS0qavE
uWTPZtJm6ebeLZ5bDpaql+aXDm4N2dq0Dd9WtO319kXbL5fNKNu7g7ZDuaO/
PLi8ZafJzs07P1SkVPRU+lQ27tLdtWHX+G7R7ht7vPY07NXbW7z3/T7JvttV
AVVN1WbVZftJ+7P3P66Jqun4lvttXa1ObXHtxwPSA/0HIw6217nU1R3SPVRS
j9Yr60cOxx++/p3vdy0NNg1VjZzG4iNwRHnk6fcJ3/ceDTradox7rOEH0x92
HWcdL2pCmvKaRptTmvtbYlu6T8w+0dbq3nr8R9sfD5w0PFl5SvNUyWna6YLT
k2fyz4ydlZ19fi753GDborZ752PO32oPb++6EHTh0kX/i+c7vDvOXPK4dPKy
2+UTV7hXmq86X23qdOo8/pPTT8e7nLuarrlca7nuer21e2b36RueN87d9L15
8Rb/1tWeOT3dvfN6b/fF9/XfFt1+cif9zsu72Xcn7q28T7xf9EDtQdlD3YfV
P1v+3Njv3H9qwHeg89HcR/cGhYPP/pH1jw9DBY+Zj8uGDYbrnjg+OTniP3L9
6fynQ89kzyaeF/6i/suuFxYvfvjV69fO0ZjRoZfyl5O/bXyl/erA6xmv28bC
xh6+yXgzMV70VvvtwXfcdx3vo98PT+R8IH8o/2j5sfVT0Kf7kxmTk/8EA5jz
/GMzLdsAAAAgY0hSTQAAeiUAAICDAAD5/wAAgOkAAHUwAADqYAAAOpgAABdv
kl/FRgAAAJFJREFUeNpivDZvxv+zX64zxGTVMyCDJdMaGYx5NBmYzn65jiKI
DM5+uc7AsHhS/v//f979x0Uz/P/z7v8qOdn/////R5WE8hn+/3n3/6eIMEQR
VBKZz/j/z7v/DHgAs4rIjwYNHU0GZlYehiXTGhkunT7IoGfqwPDr+0uG5bN7
GRhePNwHtxsOoFa9eLjvP2AAtLeFyIil+2IAAAAASUVORK5CYII=
====
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






































































































































Deleted bldt/javase/libs/javase-runtime/cc/squirreljme/runtime/cldc/asm/ConsoleOutput.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.cldc.asm;

import cc.squirreljme.runtime.cldc.annotation.Api;
import cc.squirreljme.runtime.cldc.lang.ApiLevel;
import java.io.IOException;

/**
 * Used for printing to the console.
 *
 * @since 2018/09/21
 */
public final class ConsoleOutput
{
	/** Standard output. */
	public static final int OUTPUT =
		1;
	
	/** Standard error. */
	public static final int ERROR =
		2;
	
	/** End of file. */
	public static final int ERROR_EOF =
		-1;
	
	/** Invalid file descriptor. */
	public static final int ERROR_INVALIDFD =
		-2;
	
	/**
	 * Not used.
	 *
	 * @since 2018/09/21
	 */
	private ConsoleOutput()
	{
	}
	
	/**
	 * Reads the display console, that is anything which was output to the
	 * console itself.
	 *
	 * @param __dim The output dimensions of the console, columns and rows.
	 * This array must always have a length of at least two.
	 * @param __b The output byte array.
	 * @param __o The offset.
	 * @param __l The length.
	 * @return The number of bytes which were read, this will be the minimum
	 * of either {@code __dim[0] * __dim[1]} or {@code __l}. Zero may be
	 * returned if this is not supported.
	 * @since 2018/12/16
	 */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final int displayRead(int[] __dim,
		byte[] __b, int __o, int __l)
	{
		// Not supported so always returns zero as nothing read
		return 0;
	}
	
	/**
	 * Flushes the stream.
	 *
	 * @param __fd The file descriptor to flush.
	 * @return Zero on success, negative values for failure.
	 * @since 2018/12/08
	 */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final int flush(int __fd)
	{
		if (__fd == OUTPUT)
			System.out.flush();
		
		else if (__fd == ERROR)
			System.err.flush();
		
		// Unknown
		else
			return ERROR_INVALIDFD;
		
		return 0;
	}
	
	/**
	 * Writes the character to the console output.
	 *
	 * @param __fd The file descriptor to write to.
	 * @param __c The byte to write, only the lowest 8-bits are used.
	 * @return Zero on success, negative values for EOF.
	 * @since 2018/09/21
	 */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final int write(int __fd, int __c)
	{
		if (__fd == OUTPUT)
			System.out.write(__c);
		
		else if (__fd == ERROR)
			System.err.write(__c);
		
		// Unknown
		else
			return ERROR_INVALIDFD;
		
		return 0;
	}
	
	/**
	 * Writes the given bytes to the console output.
	 *
	 * @param __fd The file descriptor to write to.
	 * @param __b The bytes to write.
	 * @param __o The offset.
	 * @param __l The length.
	 * @return Zero on success, negative values for failure.
	 * @since 2018/12/05
	 */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final int write(int __fd,
		byte[] __b, int __o, int __l)
	{
		if (__fd == OUTPUT)
			System.out.write(__b, __o, __l);
		
		else if (__fd == ERROR)
			System.err.write(__b, __o, __l);
		
		// Unknown
		else
			return ERROR_INVALIDFD;
		
		return 0;
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


































































































































































































































































































Deleted bldt/javase/libs/javase-runtime/cc/squirreljme/runtime/cldc/asm/NativeDisplayAccess.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.cldc.asm;

import cc.squirreljme.runtime.javase.lcdui.ColorInfo;
import cc.squirreljme.runtime.lcdui.event.NonStandardKey;
import cc.squirreljme.runtime.lcdui.ExtendedCapabilities;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ComponentEvent;
import java.awt.event.ComponentListener;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
import java.awt.image.DataBuffer;
import java.awt.image.DataBufferByte;
import java.awt.image.DataBufferInt;
import java.awt.image.DataBufferShort;
import java.awt.Image;
import java.awt.Rectangle;
import java.awt.SystemColor;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.io.IOException;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import javax.microedition.lcdui.Display;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.Timer;
import javax.swing.WindowConstants;
import net.multiphasicapps.io.MIMEFileDecoder;

/**
 * Java SE implementation of the native display system using Swing.
 *
 * @since 2018/11/16
 */
@Deprecated
public final class NativeDisplayAccess
{
	/** The number of parameters available. */
	public static final int NUM_PARAMETERS =
		8;
	
	/** The pixel format. */
	public static final int PARAMETER_PIXELFORMAT =
		0;
	
	/** The buffer width. */
	public static final int PARAMETER_BUFFERWIDTH =
		1;
	
	/** The buffer height. */
	public static final int PARAMETER_BUFFERHEIGHT =
		2;
	
	/** Alpha channel is used? */
	public static final int PARAMETER_ALPHA =
		3;
	
	/** Buffer pitch. */
	public static final int PARAMETER_PITCH =
		4;
	
	/** Buffer offset. */
	public static final int PARAMETER_OFFSET =
		5;
	
	/** Virtual X offset. */
	public static final int PARAMETER_VIRTXOFF =
		6;
	
	/** Virtual Y offset. */
	public static final int PARAMETER_VIRTYOFF =
		7;
	
	/** The callback for events. */
	private static volatile NativeDisplayEventCallback _CALLBACK;
	
	/** The frame to display. */
	private static volatile JFrame _frame;
	
	/** The panel used to display graphics on. */
	private static volatile SwingPanel _panel;
	
	/** State count for this framebuffer. */
	static volatile int _statecount;
	
	/**
	 * Initializes some things
	 *
	 * @since 2018/11/18
	 */
	static
	{
		try
		{
			// Setting this to true greatly increases the speed of the canvas
			// however this breaks on Windows 10 with pointer coordinates
			// being way off when scaling is used. So this must be false.
			JFrame.setDefaultLookAndFeelDecorated(false);
		}
		catch (Throwable t)
		{
			t.printStackTrace();
		}
	}
	
	/**
	 * Initialize and/or reset accelerated graphics operations.
	 *
	 * @param __id The display to initialize for.
	 * @return {@code true} if acceleration is supported.
	 * @since 2018/11/19
	 */
	public static final boolean accelGfx(int __id)
	{
		// Not supported on Swing because graphics operations are pretty
		// fast already
		return false;
	}
	
	/**
	 * Performs accelerated graphics operation.
	 *
	 * @param __id The display ID.
	 * @param __func The function to call.
	 * @param __args Arguments to the operation.
	 * @return The result of the operation.
	 * @since 2018/11/19
	 */
	public static final Object accelGfxFunc(int __id, int __func,
		Object... __args)
	{
		return null;
	}
	
	/**
	 * Returns the capabilities of the display.
	 *
	 * @param __id The display ID.
	 * @return The capabilities of the display.
	 * @since 2018/11/17
	 */
	public static final int capabilities(int __id)
	{
		return Display.SUPPORTS_INPUT_EVENTS |
			Display.SUPPORTS_TITLE |
			Display.SUPPORTS_ORIENTATION_PORTRAIT |
			Display.SUPPORTS_ORIENTATION_LANDSCAPE |
			ExtendedCapabilities.SUPPORTS_POINTER_EVENTS;
	}
	
	/**
	 * Requests that the display should be repainted.
	 *
	 * @param __id The display ID.
	 * @param __x The X coordinate.
	 * @param __y The Y coordinate.
	 * @param __w The width.
	 * @param __h The height.
	 * @since 2018/12/03
	 */
	public static final void displayRepaint(int __id,
		int __x, int __y, int __w, int __h)
	{
		if (__id != 0)
			return;
		
		NativeDisplayAccess.__panel().repaint(__x, __y, __w, __h);
	}
	
	/**
	 * Returns the object representing the framebuffer data.
	 *
	 * @param __id The display ID.
	 * @return The framebuffer array.
	 * @since 2018/11/18
	 */
	public static final Object framebufferObject(int __id)
	{
		if (__id != 0)
			return null;
		
		return ColorInfo.getArray(NativeDisplayAccess.__panel()._image);
	}
	
	/**
	 * Returns the palette of the framebuffer.
	 *
	 * @param __id The display ID.
	 * @return The palette of the framebuffer.
	 * @since 2018/11/18
	 */
	public static final int[] framebufferPalette(int __id)
	{
		if (__id != 0)
			return null;
		
		return ColorInfo.getPalette(NativeDisplayAccess.__panel()._image);
	}
	
	/**
	 * Returns the parameters of the framebuffer.
	 *
	 * @param __id The display ID.
	 * @return The framebuffer parameters.
	 * @since 2018/11/18
	 */
	public static final int[] framebufferParameters(int __id)
	{
		if (__id != 0)
			return null;
		
		BufferedImage image = NativeDisplayAccess.__panel()._image;
		
		// Build parameters
		int[] rv = new int[NativeDisplayAccess.NUM_PARAMETERS];
		rv[NativeDisplayAccess.PARAMETER_PIXELFORMAT] =
			ColorInfo.PIXEL_FORMAT.ordinal();
		rv[NativeDisplayAccess.PARAMETER_BUFFERWIDTH] = image.getWidth();
		rv[NativeDisplayAccess.PARAMETER_BUFFERHEIGHT] = image.getHeight();
		rv[NativeDisplayAccess.PARAMETER_ALPHA] = 0;
		rv[NativeDisplayAccess.PARAMETER_PITCH] = image.getWidth();
		rv[NativeDisplayAccess.PARAMETER_OFFSET] = 0;
		rv[NativeDisplayAccess.PARAMETER_VIRTXOFF] = 0;
		rv[NativeDisplayAccess.PARAMETER_VIRTYOFF] = 0;
		
		return rv;
	}
	
	/**
	 * Returns the state count of this framebuffer which is used to detect
	 * when the parameters have changed, where they must all be recalculated
	 * (that is the framebuffer wrapper must be recreated).
	 *
	 * @param __id The display ID.
	 * @return The state count for the framebuffer.
	 * @since 2018/12/02
	 */
	public static final int framebufferStateCount(int __id)
	{
		if (__id != 0)
			return -1;
		
		return NativeDisplayAccess._statecount;
	}
	
	/**
	 * Is the specified display upsidedown?
	 *
	 * @param __id The ID of the display.
	 * @return If the display is upsidedown.
	 * @since 2018/11/17
	 */
	public static final boolean isUpsideDown(int __id)
	{
		return false;
	}
	
	/**
	 * Returns the number of permanent displays which are currently attached to
	 * the system.
	 *
	 * @return The number of displays attached to the system.
	 * @since 2018/11/16
	 */
	public static final int numDisplays()
	{
		// There is ever only a single display that is supported
		return 1;
	}
	
	/**
	 * Registers the class to be called for when display events are to be
	 * called.
	 *
	 * @param __cb The callback.
	 * @since 2018/12/03
	 */
	public static final void registerEventCallback(
		NativeDisplayEventCallback __cb)
	{
		// Do not change to self!
		NativeDisplayEventCallback old = NativeDisplayAccess._CALLBACK;
		if (old == __cb)
			return;
		
		// Tell the old handler that the callback is now gone
		if (old != null)
			try
			{
				old.lostCallback();
			}
			catch (Throwable e)
			{
				e.printStackTrace();
			}
		
		NativeDisplayAccess._CALLBACK = __cb;
	}
	
	/**
	 * Sets the title of the display.
	 *
	 * @param __id The display ID.
	 * @param __t The title to use.
	 * @since 2018/11/18
	 */
	public static final void setDisplayTitle(int __id, String __t)
	{
		if (__id != 0)
			return;
		
		NativeDisplayAccess.__frame().setTitle(
			(__t == null ? "SquirrelJME" : __t));
	}
	
	/**
	 * Returns the current frame.
	 *
	 * @return The current frame.
	 * @since 2018/11/18
	 */
	static final JFrame __frame()
	{
		// Without the lock, the frame is initialized multiple times
		synchronized (NativeDisplayAccess.class)
		{
			JFrame rv = NativeDisplayAccess._frame;
			if (rv != null)
				return rv;
				
			// Debug
			todo.DEBUG.note("Setting up the frame.");
			
			// Setup frame
			NativeDisplayAccess._frame = (rv = new JFrame());
			
			// Exit when close is pressed
			rv.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
			
			// Initial title
			rv.setTitle("SquirrelJME");
			
			// Use a better panel size
			rv.setMinimumSize(new Dimension(160, 160));
			rv.setPreferredSize(new Dimension(640, 480));
			
			// Load icons, for those that exist anyway
			List<Image> icons = new ArrayList<>();
			for (int i : new int[]{8, 16, 24, 32, 48, 64})
			{
				String rcname = String.format("head_%dx%d.png", i, i);
				URL rc = ColorInfo.class.getResource(rcname);
				
				// If it does not exist, try loading MIME data instead
				// The new bootstrap does not decode these
				if (rc == null)
				{
					try (InputStream in = ColorInfo.class.getResourceAsStream(
						rcname + ".__mime"))
					{
						// Still does not exist
						if (in == null)
							continue;
						
						// Decode MIME data
						try (ByteArrayOutputStream baos = new
							ByteArrayOutputStream();
							InputStream inx = new MIMEFileDecoder(in, "utf-8"))
						{
							byte[] buf = new byte[512];
							for (;;)
							{
								int rcx = inx.read(buf);
								
								if (rcx < 0)
									break;
								
								baos.write(buf, 0, rcx);
							}
							
							// Load icon
							icons.add(new ImageIcon(baos.toByteArray()).
								getImage());
						}
					}
					
					// Ignore
					catch (IOException e)
					{
					}
					
					// Go to the next icon
					continue;
				}
				
				// Add the icon
				icons.add(new ImageIcon(rc).getImage());
			}
			rv.setIconImages(icons);
			
			return rv;
		}
	}
	
	/**
	 * Returns the current panel.
	 *
	 * @return The current panel.
	 * @since 2018/11/18
	 */
	static final SwingPanel __panel()
	{
		// Without the lock, the panel is initialized multiple times
		synchronized (NativeDisplayAccess.class)
		{
			SwingPanel rv = NativeDisplayAccess._panel;
			if (rv != null)
				return rv;
			
			// Debug
			todo.DEBUG.note("Setting up the panel.");
			
			// Setup panel
			NativeDisplayAccess._panel = (rv = new SwingPanel());
			
			// Add to the frame
			JFrame frame = NativeDisplayAccess.__frame();
			frame.add(rv);
			
			// Record some events
			frame.addComponentListener(rv);
			frame.addWindowListener(rv);
			frame.addKeyListener(rv);
			frame.addMouseListener(rv);
			frame.addMouseMotionListener(rv);
			
			// Pack the frame
			frame.pack();
			
			// Make the frame visible and set its properties
			frame.setLocationRelativeTo(null);
			frame.setVisible(true);
			
			return rv;
		}
	}
	
	/**
	 * The panel used to display graphics on.
	 *
	 * @since 2018/11/18
	 */
	public static final class SwingPanel
		extends JPanel
		implements ActionListener, ComponentListener, KeyListener,
			MouseListener, MouseMotionListener, WindowListener
	{
		/** Resize lock timer. */
		final Timer _resizetimer =
			new Timer(100, this);
		
		/** The image to be displayed. */
		volatile BufferedImage _image =
			ColorInfo.create(Math.max(240, this.getWidth()),
				Math.max(320, this.getHeight()), new Color(0xFFFFFFFF));
		
		/** The last mouse button pressed. */
		volatile int _lastbutton =
			Integer.MIN_VALUE;
		
		/**
		 * Initializes more panel details.
		 *
		 * @since 2018/12/03
		 */
		{
			this._resizetimer.setRepeats(false);
		}
		
		/**
		 * {@inheritDoc}
		 * @since 2018/12/03
		 */
		@Override
		public void actionPerformed(ActionEvent __e)
		{
			todo.DEBUG.note("Performed resize!");
			
			BufferedImage image = this._image;
			int oldw = image.getWidth(),
				oldh = image.getHeight(),
				xw = this.getWidth(),
				xh = this.getHeight();
		
			// Recreate the image if the size has changed
			if (xw != oldw || xh != oldh)
			{
				this._image = (image = ColorInfo.create(xw, xh,
					new Color(0xFFFFFFFF)));
				NativeDisplayAccess._statecount++;
			}
			
			// Indicate that the size changed
			NativeDisplayEventCallback cbx = NativeDisplayAccess._CALLBACK;
			if (cbx != null)
				cbx.sizeChanged(0, xw, xh);
		}
		
		/**
		 * {@inheritDoc}
		 * @since 2018/11/18
		 */
		@Override
		public void componentHidden(ComponentEvent __e)
		{
			NativeDisplayEventCallback cbx = NativeDisplayAccess._CALLBACK;
			if (cbx != null)
				cbx.shown(0, 0);
		}
		
		/**
		 * {@inheritDoc}
		 * @since 2018/11/18
		 */
		@Override
		public void componentMoved(ComponentEvent __e)
		{
		}
		
		/**
		 * {@inheritDoc}
		 * @since 2018/11/18
		 */
		@Override
		public void componentResized(ComponentEvent __e)
		{
			// Call the resize code directly
			if (false)
				this.actionPerformed(null);
				
			// Restart the resize timer so that resizes are not flooding
			// everything
			else
				this._resizetimer.restart();
		}
		
		/**
		 * {@inheritDoc}
		 * @since 2018/11/18
		 */
		@Override
		public void componentShown(ComponentEvent __e)
		{
			NativeDisplayEventCallback cbx = NativeDisplayAccess._CALLBACK;
			if (cbx != null)
				cbx.shown(0, 1);
		}
		
		/**
		 * {@inheritDoc}
		 * @since 2018/12/01
		 */
		@Override
		public void keyPressed(KeyEvent __e)
		{
			NativeDisplayEventCallback cbx = NativeDisplayAccess._CALLBACK;
			if (cbx != null)
				cbx.keyEvent(0, NativeDisplayEventCallback.KEY_PRESSED,
					__KeyMap__.__map(__e), __KeyMap__.__char(__e),
					(int)__e.getWhen());
		}
		
		/**
		 * {@inheritDoc}
		 * @since 2018/12/01
		 */
		@Override
		public void keyReleased(KeyEvent __e)
		{
			NativeDisplayEventCallback cbx = NativeDisplayAccess._CALLBACK;
			if (cbx != null)
				cbx.keyEvent(0, NativeDisplayEventCallback.KEY_RELEASED,
					__KeyMap__.__map(__e), __KeyMap__.__char(__e),
					(int)__e.getWhen());
		}
		
		/**
		 * {@inheritDoc}
		 * @since 2018/12/01
		 */
		@Override
		public void keyTyped(KeyEvent __e)
		{
			NativeDisplayEventCallback cbx = NativeDisplayAccess._CALLBACK;
			if (cbx != null)
				cbx.keyEvent(0, NativeDisplayEventCallback.KEY_PRESSED,
					__KeyMap__.__map(__e), __KeyMap__.__char(__e),
					(int)__e.getWhen());
		}
		
		/**
		 * {@inheritDoc}
		 * @since 2018/12/02
		 */
		@Override
		public void mouseClicked(MouseEvent __e)
		{
		}
		
		/**
		 * {@inheritDoc}
		 * @since 2018/12/02
		 */
		@Override
		public void mouseDragged(MouseEvent __e)
		{
			this.__mouseEvent(__e,
				NativeDisplayEventCallback.POINTER_DRAGGED);
		}
		
		/**
		 * {@inheritDoc}
		 * @since 2018/12/02
		 */
		@Override
		public void mouseEntered(MouseEvent __e)
		{
		}
		
		/**
		 * {@inheritDoc}
		 * @since 2018/12/02
		 */
		@Override
		public void mouseExited(MouseEvent __e)
		{
		}
		
		/**
		 * {@inheritDoc}
		 * @since 2018/12/02
		 */
		@Override
		public void mouseMoved(MouseEvent __e)
		{
		}
		
		/**
		 * {@inheritDoc}
		 * @since 2018/12/02
		 */
		@Override
		public void mousePressed(MouseEvent __e)
		{
			this.__mouseEvent(__e,
				NativeDisplayEventCallback.POINTER_PRESSED);
		}
		
		/**
		 * {@inheritDoc}
		 * @since 2018/12/02
		 */
		@Override
		public void mouseReleased(MouseEvent __e)
		{
			this.__mouseEvent(__e,
				NativeDisplayEventCallback.POINTER_RELEASED);
		}
		
		/**
		 * {@inheritDoc}
		 * @since 2018/11/18
		 */
		@Override
		protected void paintComponent(java.awt.Graphics __g)
		{
			// This must always be called
			super.paintComponent(__g);
			
			BufferedImage image = this._image;
			int oldw = image.getWidth(),
				oldh = image.getHeight(),
				xw = this.getWidth(),
				xh = this.getHeight();
		
			// Recreate the image if the size has changed
			if (xw != oldw || xh != oldh)
			{
				this._image = (image = ColorInfo.create(xw, xh,
					new Color(0xFFFFFFFF)));
				NativeDisplayAccess._statecount++;
			}
			
			// Have the display client draw whatever is on this display, but
			// only in the region we are drawing!
			Rectangle rect = __g.getClipBounds();
			NativeDisplayEventCallback cbx = NativeDisplayAccess._CALLBACK;
			if (cbx != null)
				cbx.paintDisplay(0, rect.x, rect.y, rect.width, rect.height);
			
			// Draw the backed buffered image
			__g.drawImage(image, 0, 0, xw, xh,
				0, 0, xw, xh, null);
		}
		
		/**
		 * {@inheritDoc}
		 * @since 2018/11/18
		 */
		@Override
		public void windowActivated(WindowEvent __e)
		{
		}
		
		/**
		 * {@inheritDoc}
		 * @since 2018/11/18
		 */
		@Override
		public void windowClosed(WindowEvent __e)
		{
		}
		
		/**
		 * {@inheritDoc}
		 * @since 2018/11/18
		 */
		@Override
		public void windowClosing(WindowEvent __e)
		{
			todo.DEBUG.note("Window is closing!");
			
			// Post close event
			NativeDisplayEventCallback cbx = NativeDisplayAccess._CALLBACK;
			if (cbx != null)
				cbx.exitRequest(0);
		}
		
		/**
		 * {@inheritDoc}
		 * @since 2018/11/18
		 */
		@Override
		public void windowDeactivated(WindowEvent __e)
		{
		}
		
		/**
		 * {@inheritDoc}
		 * @since 2018/11/18
		 */
		@Override
		public void windowDeiconified(WindowEvent __e)
		{
		}
		
		/**
		 * {@inheritDoc}
		 * @since 2018/11/18
		 */
		@Override
		public void windowIconified(WindowEvent __e)
		{
		}
		
		/**
		 * {@inheritDoc}
		 * @since 2018/11/18
		 */
		@Override
		public void windowOpened(WindowEvent __e)
		{
		}
		
		/**
		 * Handles mouse event.
		 *
		 * @param __e The event.
		 * @param __t The event type.
		 * @since 2018/12/02
		 */
		private final void __mouseEvent(MouseEvent __e, int __t)
		{
			int mybutton = __e.getButton(),
				lastbutton = this._lastbutton;
			
			// Depends on the event
			switch (__t)
			{
				case NativeDisplayEventCallback.POINTER_DRAGGED:
					// For some reason in Swing, the mouse being dragged is
					// always button zero, so just send drag event no matter
					// what without any button filtering
					break;
				
				case NativeDisplayEventCallback.POINTER_PRESSED:
					if (lastbutton < 0 || mybutton == lastbutton)
						this._lastbutton = mybutton;
					else
						return;
					break;
				
				case NativeDisplayEventCallback.POINTER_RELEASED:
					if (mybutton == lastbutton)
						this._lastbutton = Integer.MIN_VALUE;
					else
						return;
					break;
			}
			
			// Post event
			NativeDisplayEventCallback cbx = NativeDisplayAccess._CALLBACK;
			if (cbx != null)
				cbx.pointerEvent(0, __t, __e.getX(), __e.getY(),
					(int)__e.getWhen());
		}
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


















































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted bldt/javase/libs/javase-runtime/cc/squirreljme/runtime/cldc/asm/ObjectAccess.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.cldc.asm;

import cc.squirreljme.runtime.cldc.annotation.Api;
import cc.squirreljme.runtime.cldc.lang.ApiLevel;
import cc.squirreljme.runtime.cldc.lang.ClassData;
import cc.squirreljme.runtime.cldc.ref.PrimitiveReference;
import cc.squirreljme.runtime.cldc.ref.PrimitiveWeakReference;
import java.lang.reflect.Array;

/**
 * This contains accessors for object information.
 *
 * @since 2018/09/22
 */
public final class ObjectAccess
{
	/** Monitor is not owned by this thread. */
	public static final int MONITOR_NOT_OWNED =
		-1;
	
	/** Monitor did not interrupt. */
	public static final int MONITOR_NOT_INTERRUPTED =
		0;
	
	/** Monitor did interrupt. */
	public static final int MONITOR_INTERRUPTED =
		1;
	
	/**
	 * Not used.
	 *
	 * @since 2018/09/22
	 */
	private ObjectAccess()
	{
	}
	
	/**
	 * Allocates an object but does not construct it
	 *
	 * @param __cl The class to allocate.
	 * @return An object for the class, it is not initialized with a
	 * constructor. Returns {@code null} if no more memory is available.
	 * @since 2018/12/04
	 */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final Object allocateObject(String __cl)
	{
		return null;
	}
	
	/**
	 * Creates a new array of the given type, this is the actual array and
	 * not the component.
	 *
	 * @param __t The array type, not the component type.
	 * @param __l The array length.
	 * @return An array allocated to the given length.
	 * @since 2018/09/25
	 */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final Object arrayNew(Class<?> __t, int __l)
	{
		return Array.newInstance(__t.getComponentType(), __l);
	}
	
	/**
	 * Returns the class object for the specified class by its binary name.
	 *
	 * @param __s The class to lookup, the binary name is used.
	 * @return The class for the given binary name, or {@code null} if it
	 * does not exist.
	 * @since 2018/09/23 
	 */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final Class<?> classByName(String __s)
	{
		try
		{
			return Class.forName(__s.replace('/', '.'));
		}
		catch (ClassNotFoundException e)
		{
			return null;
		}
	}
	
	/**
	 * Returns the class data which is attached to the given class object.
	 *
	 * @param __cl The class to get the data from.
	 * @return The resulting class data.
	 * @since 2018/12/04
	 */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final ClassData classData(Class<?> __cl)
	{
		// {@squirreljme.error AF01 Cannot obtain class data.}
		throw new Error("AF01");
	}
	
	/**
	 * Returns the class object for the given object.
	 *
	 * @param __v The object to get the class of.
	 * @return The class of the given object, or {@code null} if it has no
	 * class.
	 * @since 2018/09/22
	 */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final Class<?> classOf(Object __v)
	{
		if (__v == null)
			return null;
		return __v.getClass();
	}
	
	/**
	 * Checks if the given thread holds the given object in a lock.
	 *
	 * @param __ntid The native thread ID.
	 * @param __o The object to check.
	 * @return If the lock is held.
	 * @since 2018/11/21
	 */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final boolean holdsLock(int __ntid, Object __o)
	{
		if (__ntid == Thread.currentThread().getId())
			Thread.holdsLock(__o);
		
		// {@squirreljme.error AF02 Cannot check if another thread holds
		// a lock for an object.}
		throw new Error("AF02");
	}
	
	/**
	 * Returns the identity hashcode of the object.
	 *
	 * @return The identity hashcode.
	 * @since 2018/10/14
	 */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final int identityHashCode(Object __o)
	{
		return System.identityHashCode(__o);
	}
	
	/**
	 * Invokes the specified static method.
	 *
	 * @param __m The method to invoke.
	 * @param __args Arguments to the method, the parameters will be passed
	 * as-is and will not be unboxed, so the method must accept boxed values.
	 * @return The value to return from the method, {@code void} will return
	 * {@code null}.
	 * @since 2018/11/20
	 */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final Object invokeStatic(StaticMethod __m, Object... __args)
	{
		// {@squirreljme.error AF03 Cannot invoke static method.}
		throw new Error("AF03");
	}
	
	/**
	 * Notifies threads waiting on the monitor.
	 *
	 * @param __o The object to notify.
	 * @param __all Notify all threads?
	 * @return If the monitor was a success or not.
	 * @since 2018/11/20
	 */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final int monitorNotify(Object __o, boolean __all)
	{
		try
		{
			if (__all)
				__o.notifyAll();
			else
				__o.notify();
			
			return MONITOR_NOT_INTERRUPTED;
		}
		catch (IllegalMonitorStateException e)
		{
			return MONITOR_NOT_OWNED;
		}
	}
	
	/**
	 * Waits for a notification on a monitor.
	 *
	 * @param __o The object to wait on.
	 * @param __ms The milliseconds.
	 * @param __ns The nanoseconds.
	 * @return The wait status.
	 * @since 2018/11/21
	 */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final int monitorWait(Object __o, long __ms,
		int __ns)
	{
		try
		{
			if (__ms == 0 && __ns == 0)
				__o.wait();
			else
				__o.wait(__ms, __ns);
			
			return MONITOR_NOT_INTERRUPTED;
		}
		catch (IllegalMonitorStateException e)
		{
			return MONITOR_NOT_OWNED;
		}
		catch (InterruptedException e)
		{
			return MONITOR_INTERRUPTED;
		}
	}
	
	/**
	 * Creates a new primitive weak reference. Note that it is not valid to
	 * operate on this object as a normal object, it is a special
	 * representation.
	 *
	 * @return The primitive weak reference.
	 * @since 2018/09/23
	 */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final PrimitiveReference newWeakReference()
	{
		return new __WeakRef__();
	}
	
	/**
	 * Gets the given reference.
	 *
	 * @param __r The reference to read from.
	 * @return The reference value, may be {@code null} if the input reference
	 * is not valid, it was garbage collected, or it was never set.
	 * @since 2018/09/23
	 */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final Object referenceGet(PrimitiveReference __r)
	{
		return ((__WeakRef__)__r).__get();
	}
	
	/**
	 * Sets the given reference to the given value.
	 *
	 * @param __r The reference to set.
	 * @param __v The value to set.
	 * @since 2018/09/23
	 */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final void referenceSet(PrimitiveReference __r,
		Object __v)
	{
		((__WeakRef__)__r).__set(__v);
	}
	
	/**
	 * Returns the class object for the specified class by its binary name.
	 *
	 * @param <C> The class to type this as.
	 * @param __s The class to lookup, the binary name is used.
	 * @return The class for the given binary name, or {@code null} if it
	 * does not exist.
	 * @since 2018/09/23 
	 */
	@SuppressWarnings({"unchecked"})
	public static final <C> Class<C> classByNameType(String __s)
	{
		return (Class<C>)((Object)ObjectAccess.classByName(__s));
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






































































































































































































































































































































































































































































































































































































Deleted bldt/javase/libs/javase-runtime/cc/squirreljme/runtime/cldc/asm/ResourceAccess.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.cldc.asm;

import cc.squirreljme.runtime.cldc.annotation.Api;
import cc.squirreljme.runtime.cldc.lang.ApiLevel;

/**
 * This class provides access to resources and their raw data streams.
 *
 * Access to resources relies on the suites, so the correct suite must be
 * specified. {@link Class#getResourceAsStream(String)} should handle this.
 *
 * @since 2018/10/07
 */
public final class ResourceAccess
{
	/** Resource does not exist. */
	public static final int OPEN_STATUS_NO_RESOURCE =
		-1;
	
	/** JAR does not exist. */
	public static final int OPEN_STATUS_NO_JAR =
		-2;
	
	/** IOException. */
	public static final int OPEN_STATUS_IOEXCEPTION =
		-3;
	
	/** Read returned EOF. */
	public static final int READ_STATUS_EOF =
		-1;
	
	/** Read returned unknown file descriptor. */
	public static final int READ_STATUS_UNKNOWN_FD =
		-2;
	
	/** Read returned IOException. */
	public static final int READ_STATUS_IOEXCEPTION =
		-3;
	
	/** Descriptor was not found. */
	public static final int CLOSE_STATUS_UNKNOWN_FD =
		-2;
	
	/** Close resulted in any IOException. */
	public static final int CLOSE_STATUS_IOEXCEPTION =
		-3;
	
	/**
	 * Returns the number of bytes which are known to be available. This is
	 * not required to be supported but is available for usage if it would
	 * result in optimization.
	 *
	 * If this is not supported by a resource then zero or a negative value
	 * may be returned.
	 *
	 * @param __fd The file descriptor to check.
	 * @return The number of available bytes.
	 * @since 2018/10/07
	 */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final int available(int __fd)
	{
		return READ_STATUS_UNKNOWN_FD;
	}
	
	/**
	 * Closes the given resource.
	 *
	 * @param __fd The resource descriptor to close.
	 * @return A negative value indicating the reason for the failure.
	 * @since 2018/10/07
	 */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final int close(int __fd)
	{
		return CLOSE_STATUS_UNKNOWN_FD;
	}
	
	/**
	 * Opens the specified resource in the given JAR.
	 *
	 * @param __jar The JAR the resource is in, this specifies the name of a
	 * suite.
	 * @param __res The name of the resource to load.
	 * @return The file descriptor or a negative value if it does not exist.
	 * If {@code -2} is returned that means there was an exception trying to
	 * load the resource.
	 * @since 2018/10/07
	 */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final int open(String __jar, String __res)
	{
		return OPEN_STATUS_NO_JAR;
	}
	
	/**
	 * Reads data from the given resource.
	 *
	 * @param __fd The file descriptor to read from.
	 * @param __b The output byte array.
	 * @param __o The offset.
	 * @param __l The length.
	 * @return The number of bytes read or a negative value if the end of
	 * stream was reached.
	 * @since 2018/10/07
	 */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final int read(int __fd, byte[] __b, int __o,
		int __l)
	{
		return READ_STATUS_UNKNOWN_FD;
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
























































































































































































































































Deleted bldt/javase/libs/javase-runtime/cc/squirreljme/runtime/cldc/asm/SuiteAccess.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.cldc.asm;

import cc.squirreljme.runtime.cldc.annotation.Api;
import cc.squirreljme.runtime.cldc.lang.ApiLevel;

/**
 * Access to suites and other suites which are available for usage.
 *
 * @since 2018/10/26
 */
public class SuiteAccess
{
	/**
	 * Returns the suites which are available for usage.
	 *
	 * @return The suites which are available for usage.
	 * @since 2018/10/26
	 */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final String[] availableSuites()
	{
		return new String[0];
	}
	
	/**
	 * Returns the current classpath that is being used.
	 *
	 * @return The current classpath.
	 * @since 2018/12/06
	 */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final String[] currentClassPath()
	{
		return new String[0];
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






























































































Deleted bldt/javase/libs/javase-runtime/cc/squirreljme/runtime/cldc/asm/SystemAccess.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.cldc.asm;

import cc.squirreljme.runtime.cldc.annotation.Api;
import cc.squirreljme.runtime.cldc.lang.ApiLevel;

/**
 * Access to system related details.
 *
 * @since 2018/10/13
 */
public final class SystemAccess
{
	/**
	 * Not used.
	 *
	 * @since 2018/10/13
	 */
	private SystemAccess()
	{
	}
	
	/**
	 * Exits the process with the system exit code.
	 *
	 * @param __code The exit code.
	 * @since 2018/10/13
	 */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final void exit(int __code)
	{
		System.exit(__code);
	}
	
	/**
	 * Returns the specified environment variable, it is unspecified and
	 * system dependent if variables are case sensitive or not. Locale may
	 * be considered by the host system additionally. If environment variables
	 * do not exist in the environment then only {@code null} will be
	 * returned.
	 *
	 * @param __e The environment variable to get.
	 * @return The value of that variable or {@code null} if it is not set.
	 * @since 2018/10/14
	 */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final String getEnv(String __e)
	{
		return System.getenv(__e);
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


























































































































Deleted bldt/javase/libs/javase-runtime/cc/squirreljme/runtime/cldc/asm/SystemProperties.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.cldc.asm;

import cc.squirreljme.runtime.cldc.annotation.Api;
import cc.squirreljme.runtime.cldc.lang.ApiLevel;
import cc.squirreljme.runtime.cldc.lang.OperatingSystemType;
import cc.squirreljme.runtime.cldc.SquirrelJME;
import java.net.URL;
import java.security.CodeSource;
import java.security.ProtectionDomain;

/**
 * Access to system properties.
 *
 * @since 2018/09/20
 */
public final class SystemProperties
{
	/**
	 * Not used.
	 *
	 * @since 2018/09/20
	 */
	private SystemProperties()
	{
	}
	
	/**
	 * Returns the API level of the virtual machine.
	 *
	 * @return The API level.
	 * @since 2018/12/05
	 */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static int apiLevel()
	{
		return ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225;
	}
	
	/**
	 * Returns the approximated path where the VM's executable exists. This
	 * will be the actual JVM's JAR or EXE file.
	 *
	 * @return The approximated executable path or {@code null} if it is not
	 * known.
	 * @since 2018/12/08
	 */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final String executablePath()
	{
		// Try using these methods
		try
		{
			// Try in the protection domain first
			ProtectionDomain pd = SystemProperties.class.getProtectionDomain();
			if (pd != null)
			{
				CodeSource cs = pd.getCodeSource();
				if (cs != null)
				{
					URL loc = cs.getLocation();
					if (loc != null)
					{
						String path = loc.getPath();
						if (path != null)
							return path;
					}
				}
			}
		}
		
		// Could not get
		catch (Throwable t)
		{
			return null;
		}
		
		// Unknown
		return null;
	}
	
	/**
	 * Returns the depth of the guests within the virtual machine.
	 *
	 * @return The number of guests.
	 * @since 2018/11/04
	 */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final int guestDepth()
	{
		return 0;
	}
	
	/**
	 * The class to use for a given implementation of something.
	 *
	 * @param __n The class name to lookup.
	 * @return The class that should get its instance created or {@code null}
	 * if there is no implementation.
	 * @since 2018/12/13
	 */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final String implementationClass(String __n)
	{
		return null;
	}
	
	/**
	 * Returns the e-mail to contact for the virtual machine.
	 *
	 * @return The contact e-mail for the virtual machine.
	 * @since 2017/10/02
	 */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static String javaVMEmail()
	{
		return "xer@multiphasicapps.net";
	}
	
	/**
	 * Returns the name of the Java virtual machine.
	 *
	 * @return The name of the virtual machine.
	 * @since 2017/10/02
	 */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static String javaVMName()
	{
		return "JavaSE Virtual Environment";
	}
	
	/**
	 * Returns the URL to the virtual machine's vendor's URL.
	 *
	 * @return The URL of the JVM's virtual machine.
	 * @since 2017/10/02
	 */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static String javaVMURL()
	{
		return "http://multiphasicapps.net/";
	}
	
	/**
	 * Returns the vendor of the Java virtual machine.
	 *
	 * @return The vendor of the Java virtual machine.
	 * @since 2017/10/02
	 */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static String javaVMVendor()
	{
		return "Stephanie Gawroriski";
	}
	
	/**
	 * Returns the full version of the Java virtual machine.
	 *
	 * @return The full Java virtual machine version.
	 * @since 2017/08/13
	 */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static String javaVMVersion()
	{
		return "0.3.0";
	}
	
	/**
	 * Returns the type of operating SquirrelJME is running on.
	 *
	 * @return The type of operating system SquirrelJME is running on.
	 * @since 2018/10/14
	 */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final int operatingSystemType()
	{
		return OperatingSystemType.UNKNOWN;
	}
	
	/**
	 * Returns a system property for the given value.
	 *
	 * @param __k The key to get.
	 * @return The value of the property, will be {@code null} if it is not
	 * valid.
	 * @since 2018/09/20
	 */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static String systemProperty(String __k)
	{
		return System.getProperty(__k);
	}
	
	/**
	 * Returns the version of the class libraries.
	 *
	 * @return The class library version.
	 * @since 2017/10/02
	 */
	public static String javaRuntimeVersion()
	{
		return SquirrelJME.RUNTIME_VERSION;
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<












































































































































































































































































































































































































































Deleted bldt/javase/libs/javase-runtime/cc/squirreljme/runtime/cldc/asm/TaskAccess.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.cldc.asm;

import cc.squirreljme.runtime.cldc.annotation.Api;
import cc.squirreljme.runtime.cldc.lang.ApiLevel;

/**
 * This class provides access to tasks which are running.
 *
 * @since 2018/11/04
 */
public final class TaskAccess
{
	/** The entry point is not valid. */
	public static final int ERROR_INVALID_ENTRY =
		-2;
	
	/** Library in the classpath is missing. */
	public static final int ERROR_MISSING_LIBRARY =
		-3;
	
	/** Exit code indicating bad task things. */
	public static final int EXIT_CODE_FATAL_EXCEPTION =
		127;
	
	/**
	 * Not used.
	 *
	 * @since 2018/11/04
	 */
	private TaskAccess()
	{
	}
	
	/**
	 * Returns the ID of the current thread.
	 *
	 * @return The current thread ID.
	 * @since 2018/11/20
	 */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final int currentThread()
	{
		return (int)Thread.currentThread().getId();
	}
	
	/**
	 * Sets the priority of the thread.
	 *
	 * @param __tid The thread ID.
	 * @param __p The priority.
	 * @since 2018/12/07
	 */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final void setThreadPriority(int __tid, int __p)
	{
		for (Thread t : Thread.getAllStackTraces().keySet())
			if ((int)t.getId() == __tid)
			{
				t.setPriority(__p);
				break;
			}
	}
	
	/**
	 * Signals a hardware interrupt on the given thread.
	 *
	 * @param __tid The thread to signal.
	 * @since 2018/11/21
	 */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final void signalInterrupt(int __tid)
	{
		for (Thread t : Thread.getAllStackTraces().keySet())
			if ((int)t.getId() == __tid)
			{
				t.interrupt();
				break;
			}
	}
	
	/**
	 * Causes the thread to sleep for the given milliseconds and nanoseconds.
	 *
	 * If both values are zero this means to yield instead.
	 *
	 * @param __ms The milliseconds to sleep for.
	 * @param __ns The nanoseconds to sleep for, in the range of 0-999999.
	 * @return {@code true} if the thread was interrupted, otherwise
	 * {@code false}.
	 * @since 2018/11/04
	 */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final boolean sleep(long __ms, int __ns)
	{
		try
		{
			if (__ms == 0 && __ns == 0)
				Thread.yield();
			else
				Thread.sleep(__ms, __ns);
			
			return true;
		}
		catch (InterruptedException e)
		{
			return false;
		}
	}
	
	/**
	 * Starts the specified task.
	 *
	 * @param __cp The classpath used.
	 * @param __main The main entry point.
	 * @param __args Arguments to start the task with.
	 * @return The task identifier or a negative number if the task could
	 * not start.
	 * @since 2018/11/04
	 */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final int startTask(String[] __cp, String __main,
		String[] __args)
	{
		return -1;
	}
	
	/**
	 * Starts the given thread.
	 *
	 * @param __t The thread which is to run, the execution point of the
	 * thread is the {@link Thread#__start()} method.
	 * @param __n The name hint of this thread.
	 * @return The thread ID.
	 * @since 2018/11/17
	 */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final int startThread(Thread __t, String __n)
	{
		__t.start();
		return (int)__t.getId();
	}
	
	/**
	 * Returns the status of the target task.
	 *
	 * @param __tid The task to get the status of.
	 * @return The status for the given task.
	 * @since 2018/11/04
	 */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final int taskStatus(int __tid)
	{
		return -1;
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<












































































































































































































































































































































Deleted bldt/javase/libs/javase-runtime/cc/squirreljme/runtime/cldc/asm/__KeyMap__.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.cldc.asm;

import cc.squirreljme.runtime.lcdui.event.NonStandardKey;
import java.awt.event.KeyEvent;
import javax.microedition.lcdui.Canvas;

/**
 * Contains key mapping for Swing.
 *
 * @since 2018/12/01
 */
final class __KeyMap__
{
	/**
	 * Gets a character for a key event.
	 *
	 * @param __e The event to look up.
	 * @return The character for the key.
	 * @since 2018/12/02
	 */
	static final char __char(KeyEvent __e)
	{
		char ch = __e.getKeyChar();
		if (ch == KeyEvent.CHAR_UNDEFINED)
			return 0;
		return ch;
	}
	
	/**
	 * Maps the key event to a key.
	 *
	 * @param __e The event to map.
	 * @return The key it should do.
	 * @since 2018/12/01
	 */
	static final int __map(KeyEvent __e)
	{
		int keycode = __e.getExtendedKeyCode();
		switch (keycode)
		{
			case KeyEvent.VK_0:
			case KeyEvent.VK_1:
			case KeyEvent.VK_2:
			case KeyEvent.VK_3:
			case KeyEvent.VK_4:
			case KeyEvent.VK_5:
			case KeyEvent.VK_6:
			case KeyEvent.VK_7:
			case KeyEvent.VK_8:
			case KeyEvent.VK_9:
				return Canvas.KEY_NUM0 + (keycode - KeyEvent.VK_0);
			
			case KeyEvent.VK_NUMPAD0:
			case KeyEvent.VK_NUMPAD1:
			case KeyEvent.VK_NUMPAD2:
			case KeyEvent.VK_NUMPAD3:
			case KeyEvent.VK_NUMPAD4:
			case KeyEvent.VK_NUMPAD5:
			case KeyEvent.VK_NUMPAD6:
			case KeyEvent.VK_NUMPAD7:
			case KeyEvent.VK_NUMPAD8:
			case KeyEvent.VK_NUMPAD9:
				return Canvas.KEY_NUM0 +
					(keycode - KeyEvent.VK_NUMPAD0);
			
			case KeyEvent.VK_F1:
			case KeyEvent.VK_F2:
			case KeyEvent.VK_F3:
			case KeyEvent.VK_F4:
			case KeyEvent.VK_F5:
			case KeyEvent.VK_F6:
			case KeyEvent.VK_F7:
			case KeyEvent.VK_F8:
			case KeyEvent.VK_F9:
			case KeyEvent.VK_F10:
			case KeyEvent.VK_F11:
			case KeyEvent.VK_F12:
			case KeyEvent.VK_F13:
			case KeyEvent.VK_F14:
			case KeyEvent.VK_F15:
			case KeyEvent.VK_F16:
			case KeyEvent.VK_F17:
			case KeyEvent.VK_F18:
			case KeyEvent.VK_F19:
			case KeyEvent.VK_F20:
			case KeyEvent.VK_F21:
			case KeyEvent.VK_F22:
			case KeyEvent.VK_F23:
			case KeyEvent.VK_F24:
				return NonStandardKey.F1 +
					(keycode - KeyEvent.VK_F1);
					
				// Map the keyboard virtually onto a number pad so that
				// those without a number pad (such as myself) can actually
				// use the input in its natural order without
				// [q w e] > [1 2 3]
				// [a s d] > [4 5 6]
				// [z x c] > [7 8 9]
				// [v b n] > [* 0 #]
			case KeyEvent.VK_Q:					return Canvas.KEY_NUM1;
			case KeyEvent.VK_W:					return Canvas.KEY_NUM2;
			case KeyEvent.VK_E:					return Canvas.KEY_NUM3;
			case KeyEvent.VK_A:					return Canvas.KEY_NUM4;
			case KeyEvent.VK_S:					return Canvas.KEY_NUM5;
			case KeyEvent.VK_D:					return Canvas.KEY_NUM6;
			case KeyEvent.VK_Z:					return Canvas.KEY_NUM7;
			case KeyEvent.VK_X:					return Canvas.KEY_NUM8;
			case KeyEvent.VK_C:					return Canvas.KEY_NUM9;
			case KeyEvent.VK_V:					return Canvas.KEY_STAR;
			case KeyEvent.VK_B:					return Canvas.KEY_NUM0;
			case KeyEvent.VK_N:					return Canvas.KEY_POUND;

			case KeyEvent.VK_ADD:				return '+';
			case KeyEvent.VK_AMPERSAND:			return '&';
			case KeyEvent.VK_ASTERISK:			return Canvas.KEY_STAR;
			case KeyEvent.VK_AT:				return '@';
			case KeyEvent.VK_BACK_QUOTE:		return '`';
			case KeyEvent.VK_BACK_SLASH:		return '\\';
			case KeyEvent.VK_BRACELEFT:			return '{';
			case KeyEvent.VK_BRACERIGHT:		return '}';
			case KeyEvent.VK_CIRCUMFLEX:		return '^';
			case KeyEvent.VK_CLOSE_BRACKET:		return ']';
			case KeyEvent.VK_COLON:				return ':';
			case KeyEvent.VK_COMMA:				return ',';
			case KeyEvent.VK_DECIMAL:			return '.';
			case KeyEvent.VK_DIVIDE:			return '/';
			case KeyEvent.VK_DOLLAR:			return '$';
			case KeyEvent.VK_EQUALS:			return '=';
			case KeyEvent.VK_EURO_SIGN:			return 0x20AC;
			case KeyEvent.VK_EXCLAMATION_MARK:	return '!';
			case KeyEvent.VK_GREATER:			return '>';
			case KeyEvent.VK_LEFT_PARENTHESIS:	return '(';
			case KeyEvent.VK_LESS:				return '<';
			case KeyEvent.VK_MINUS:				return '-';
			case KeyEvent.VK_MULTIPLY:			return '*';
			case KeyEvent.VK_NUMBER_SIGN:		return Canvas.KEY_POUND;
			case KeyEvent.VK_OPEN_BRACKET:		return '[';
			case KeyEvent.VK_RIGHT_PARENTHESIS:	return ')';
			case KeyEvent.VK_PERIOD:			return '.';
			case KeyEvent.VK_PLUS:				return '+';
			case KeyEvent.VK_QUOTE:				return '\'';
			case KeyEvent.VK_QUOTEDBL:			return '"';
			case KeyEvent.VK_SEMICOLON:			return ';';
			case KeyEvent.VK_SLASH:				return '/';
			case KeyEvent.VK_SPACE:				return ' ';
			case KeyEvent.VK_SUBTRACT:			return '-';
			case KeyEvent.VK_TAB:				return '\t';
			case KeyEvent.VK_UNDERSCORE:		return '_';

			case KeyEvent.VK_ALT:
				return NonStandardKey.ALT;

			case KeyEvent.VK_BACK_SPACE:
				return Canvas.KEY_BACKSPACE;

			case KeyEvent.VK_CAPS_LOCK:
				return NonStandardKey.CAPSLOCK;

			case KeyEvent.VK_CONTEXT_MENU:
				return NonStandardKey.CONTEXT_MENU;

			case KeyEvent.VK_CONTROL:
				return NonStandardKey.CONTROL;

			case KeyEvent.VK_DELETE:
				return Canvas.KEY_DELETE;

			case KeyEvent.VK_DOWN:
				return Canvas.KEY_DOWN;

			case KeyEvent.VK_END:
				return NonStandardKey.END;

			case KeyEvent.VK_ENTER:
				return Canvas.KEY_ENTER;

			case KeyEvent.VK_ESCAPE:
				return Canvas.KEY_ESCAPE;

			case KeyEvent.VK_HOME:
				return NonStandardKey.HOME;

			case KeyEvent.VK_INSERT:
				return NonStandardKey.INSERT;

			case KeyEvent.VK_KP_DOWN:
				return Canvas.KEY_DOWN;

			case KeyEvent.VK_KP_LEFT:
				return Canvas.KEY_LEFT;

			case KeyEvent.VK_KP_RIGHT:
				return Canvas.KEY_RIGHT;

			case KeyEvent.VK_KP_UP:
				return Canvas.KEY_UP;

			case KeyEvent.VK_LEFT:
				return Canvas.KEY_LEFT;

			case KeyEvent.VK_META:
				return NonStandardKey.META;

			case KeyEvent.VK_NUM_LOCK:
				return NonStandardKey.NUMLOCK;

			case KeyEvent.VK_PAGE_DOWN:
				return NonStandardKey.PAGE_DOWN;

			case KeyEvent.VK_PAGE_UP:
				return NonStandardKey.PAGE_UP;

			case KeyEvent.VK_PAUSE:
				return NonStandardKey.PAUSE;

			case KeyEvent.VK_PRINTSCREEN:
				return NonStandardKey.PRINTSCREEN;

			case KeyEvent.VK_RIGHT:
				return Canvas.KEY_RIGHT;

			case KeyEvent.VK_SCROLL_LOCK:
				return NonStandardKey.SCROLLLOCK;

			case KeyEvent.VK_SHIFT:
				return NonStandardKey.SHIFT;

			case KeyEvent.VK_UP:
				return Canvas.KEY_UP;

			case KeyEvent.VK_WINDOWS:
				return NonStandardKey.LOGO;
			
				// Probably a character
			default:
				// Shift is not handled because these are raw key codes
				if (keycode >= KeyEvent.VK_A && keycode <= KeyEvent.VK_Z)
					return 'A' + (keycode - KeyEvent.VK_A);
				
				// Unknown
				return NonStandardKey.UNKNOWN;
		}
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






























































































































































































































































































































































































































































































































Deleted bldt/javase/libs/javase-runtime/cc/squirreljme/runtime/cldc/asm/__WeakRef__.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.cldc.asm;

import cc.squirreljme.runtime.cldc.ref.PrimitiveWeakReference;
import java.lang.ref.Reference;
import java.lang.ref.WeakReference;

/**
 * Primitive weak reference.
 *
 * @since 2018/12/05
 */
class __WeakRef__
	implements PrimitiveWeakReference
{
	/** The reference. */
	volatile Reference<Object> _ref;
	
	/**
	 * Gets the value.
	 *
	 * @return The value.
	 * @since 2018/12/05
	 */
	final Object __get()
	{
		synchronized (this)
		{
			Reference<Object> ref = this._ref;
			if (ref == null)
				return null;
			return ref.get();
		}
	}
	
	/**
	 * Sets the value.
	 *
	 * @param __v The value.
	 * @since 2018/12/05
	 */
	final void __set(Object __v)
	{
		synchronized (this)
		{
			Reference<Object> ref = this._ref;
			
			// {@squirreljme.error AF04 Cannot set weak reference which has
			// already been set.}
			if (__v == null)
				if (ref == null)
				{
					// Do nothing
				}
				else
					ref.clear();
			else
				if (ref == null)
					this._ref = new WeakReference<>(__v);
				else
					throw new Error("AF04");
		}
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




















































































































































Deleted bldt/javase/libs/javase-runtime/cc/squirreljme/runtime/javase/JavaSEIPConnectionFactory.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.javase;

import cc.squirreljme.runtime.gcf.IPAddress;
import cc.squirreljme.runtime.gcf.IPConnectionFactory;
import cc.squirreljme.runtime.gcf.TCPClientConnection;
import java.io.IOException;
import java.net.InetAddress;
import java.net.Socket;
import java.net.UnknownHostException;
import javax.microedition.io.AccessPoint;
import javax.microedition.io.ConnectionNotFoundException;
import javax.microedition.io.SocketConnection;

/**
 * This is a connection factory for IP based connection which is built on top
 * of Java SE's networking support.
 *
 * @since 2019/05/12
 */
public class JavaSEIPConnectionFactory
	extends IPConnectionFactory
{
	/**
	 * {@inheritDoc}
	 * @since 2019/05/12
	 */
	@Override
	public final IPAddress resolveAddress(IPAddress __addr)
		throws ConnectionNotFoundException, IOException, NullPointerException
	{
		if (__addr == null)
			throw new NullPointerException("NARG");
		
		// Try to resolve it
		try
		{
			// Resolve and build new address
			return new IPAddress(InetAddress.getByName(__addr.hostname).
				getHostAddress(), __addr.port);
		}
		
		// {@squirreljme.error AF05 Unknown host.}
		catch (UnknownHostException e)
		{
			IOException t = new ConnectionNotFoundException("AF05");
			t.initCause(e);
			throw t;
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2019/05/12
	 */
	@Override
	public final TCPClientConnection tcpClientConnect(IPAddress __addr)
		throws ConnectionNotFoundException, IOException, NullPointerException
	{
		if (__addr == null)
			throw new NullPointerException("NARG");
		
		// Create and wrap socket
		return new JavaSETCPClientConnection(__addr,
			new Socket(__addr.hostname, __addr.port));
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
























































































































































Deleted bldt/javase/libs/javase-runtime/cc/squirreljme/runtime/javase/JavaSETCPClientConnection.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.javase;

import cc.squirreljme.runtime.gcf.IPAddress;
import cc.squirreljme.runtime.gcf.IPConnectionFactory;
import cc.squirreljme.runtime.gcf.TCPClientConnection;
import java.io.InputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.net.InetAddress;
import java.net.Socket;
import java.net.SocketException;
import java.net.UnknownHostException;
import javax.microedition.io.AccessPoint;
import javax.microedition.io.ConnectionNotFoundException;
import javax.microedition.io.SocketConnection;

/**
 * This is a TCP client connection that is backed on top of Java SE.
 *
 * @since 2019/05/12
 */
public class JavaSETCPClientConnection
	extends TCPClientConnection
{
	/** The socket this connects through. */
	protected final Socket socket;
	
	/** Default receive buffer size for this socket. */
	protected final int defrbs;
	
	/** Default send buffer size for this socket. */
	protected final int defsbs;
	
	/** Default timeout. */
	protected final int deftim;
	
	/**
	 * Initializes the wrapped socket.
	 *
	 * @param __addr The target address.
	 * @param __sock The socket to use.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/05/12
	 */
	public JavaSETCPClientConnection(IPAddress __addr, Socket __sock)
		throws NullPointerException
	{
		super(__addr);
		
		if (__sock == null)
			throw new NullPointerException("NARG");
		
		this.socket = __sock;
		
		// Get default buffer sizes for setting back
		int defrbs = 512,
			defsbs = 512,
			deftim = 0;
		try
		{
			defrbs = __sock.getReceiveBufferSize();
			defsbs = __sock.getSendBufferSize();
			deftim = __sock.getSoTimeout();
		}
		catch (SocketException e)
		{
		}
		
		// Set
		this.defrbs = defrbs;
		this.defsbs = defsbs;
		this.deftim = deftim;
	}
	
	/**
	 * Performs connection close.
	 *
	 * @throws IOException If it could not be closed.
	 * @since 2019/05/13
	 */
	protected final void doClose()
		throws IOException
	{
		this.socket.close();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2019/05/13
	 */
	@Override
	protected final InputStream doOpenInputStream()
		throws IOException
	{
		return socket.getInputStream();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2019/05/13
	 */
	@Override
	protected final OutputStream doOpenOutputStream()
		throws IOException
	{
		return socket.getOutputStream();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2019/05/12
	 */
	@Override
	protected final void doSetSocketOption(byte __o, int __v)
		throws IllegalArgumentException, IOException
	{
		Socket socket = this.socket;
		switch (__o)
		{
			case DELAY:
				socket.setTcpNoDelay(__v == 0);
				break;
			
			case KEEPALIVE:
				socket.setKeepAlive(__v != 0);
				break;
			
			case LINGER:
				socket.setSoLinger(__v != 0, __v);
				break;
			
			case RCVBUF:
				if (__v == 0)
					socket.setReceiveBufferSize(this.defrbs);
				else
					socket.setReceiveBufferSize(__v);
				break;
			
			case SNDBUF:
				if (__v == 0)
					socket.setSendBufferSize(this.defsbs);
				else
					socket.setSendBufferSize(__v);
				break;
			
			case TIMEOUT:
				if (__v == 0)
					socket.setSoTimeout(this.deftim);
				else
					socket.setSoTimeout(__v);
				break;
			
			default:
				throw new todo.TODO();
		}
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<














































































































































































































































































































































Deleted bldt/javase/libs/javase-runtime/cc/squirreljme/runtime/javase/Main.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.javase;

import cc.squirreljme.runtime.swm.EntryPoint;
import cc.squirreljme.runtime.swm.EntryPoints;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintStream;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.net.URL;
import java.util.Arrays;
import java.util.Collections;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.List;
import java.util.jar.Attributes;
import java.util.jar.Manifest;
import java.util.Objects;
import javax.microedition.midlet.MIDlet;
import net.multiphasicapps.tool.manifest.JavaManifest;

/**
 * This initializes the SquirrelJME CLDC run-time interfaces and provides a
 * bridge so that the run-time functions properly on non-SquirrelJME Java VMs.
 *
 * @since 2017/12/07
 */
public class Main
{
	/** Property which specifies the client main entry point. */
	public static final String CLIENT_MAIN =
		"cc.squirreljme.runtime.javase.clientmain";
	
	/** Property specifying the main entry point for server entries. */
	public static final String SERVER_MAIN =
		"cc.squirreljme.runtime.javase.servermain";
	
	/** The file which was passed. */
	public static final String FILE_PROPERTY =
		"cc.squirreljme.runtime.javase.file";
	
	/**
	 * {@squirreljme.property cc.squirreljme.runtime.javase.program=(id)
	 * The program to run when launching.}
	 */
	public static final String PROGRAM =
		"cc.squirreljme.runtime.javase.program";
	
	/**
	 * Wrapped main entry point.
	 *
	 * @param __args Program arguments, these are forwarded.
	 * @throws Throwable On any kind of throwable.
	 * @since 2017/12/07
	 */
	public static void main(String... __args)
		throws Throwable
	{
		// These are launch parameters which are used by the actual Java SE
		// wrappers to spawn new tasks
		String servermain = System.getProperty(SERVER_MAIN),
			clientmain = System.getProperty(CLIENT_MAIN);
		boolean isclient = (servermain != null ? false : clientmain != null);
		
		// Initialize the run-time which sets up the SquirrelJME specific
		// APIs
		__initializeRunTime(isclient);
		
		// Try to extract from the program
		int pdx = Integer.getInteger(Main.PROGRAM, -1);
		String fprop = System.getProperty(FILE_PROPERTY);
		if (pdx < 0 && fprop != null)
		{
			int col = fprop.lastIndexOf(':');
			if (col >= 0)
				try
				{
					pdx = Integer.valueOf(fprop.substring(col + 1));
				}
				catch (NumberFormatException e)
				{
				}
		}
		
		// Search through programs to find the entry point desired
		String mainclassname;
		if (pdx >= 0)
		{
			// Need to go through all the URLs and find the midlet containing
			// entry points to be parsed. However since there is no way to
			// know which manifest in the classpath refers to the midlet we
			// kinda just have to guess
			List<URL> urls = Collections.<URL>list(Main.class.getClassLoader().
				getResources("META-INF/MANIFEST.MF"));
			EntryPoints entries = null;
			for (int i = 0, n = urls.size(); i < n; i++)
			{
				// Read in the manifest
				JavaManifest man;
				try (InputStream in = urls.get(i).openStream())
				{
					man = new JavaManifest(in);
				}
				
				// If this refers to a midlet then use it
				if (man.getMainAttributes().definesValue("midlet-name"))
				{
					entries = new EntryPoints(man);
					break;
				}
			}
			
			// {@squirreljme.error AF06 No entry points were found.}
			if (entries == null)
				throw new IllegalArgumentException("AF06");
			
			// Print them out for debug
			System.err.println("Entry points:");
			int n = entries.size();
			for (int i = 0; i < n; i++)
				System.err.printf("    %d: %s%n", i, entries.get(i));
			
			// If the entry is out of bounds just use the first one
			if (pdx < 0 || pdx >= n)
				pdx = 0;
			
			// Use that entry point
			mainclassname = entries.get(pdx).entryPoint();
		}
		
		// Using the old standard method of launching
		else
		{
			// The client just uses the specified main class
			if (isclient)
				mainclassname = clientmain;
			
			// Determines the class name via manifest
			else
				if (servermain != null)
					mainclassname = servermain;
				else
					mainclassname = __mainClassByManifest();
		}
		
		// Exceptions generated as of the result of the method call are
		// wrapped so they must be unwrapped
		try
		{
			Class<?> mainclass = Class.forName(mainclassname);
			
			// Try initializing with a main method
			try
			{
				// {@squirreljme.error AF07 The main method is not static.}
				Method mainmethod = mainclass.getMethod("main",
					String[].class);
				if ((mainmethod.getModifiers() & Modifier.STATIC) == 0)
					throw new RuntimeException("AF07");
				
				// Call it
				mainmethod.invoke(null, new Object[]{__args});
				
				// All okay!
				return;
			}
			
			// Does not exist
			catch (NoSuchMethodException e)
			{
			}
			
			// Construct new object but only say start is valid once it
			// has been fully constructed
			MIDlet mid = (MIDlet)mainclass.newInstance();
			
			// startApp is protected so it has to be made callable
			Method startmethod = MIDlet.class.getDeclaredMethod(
				"startApp");
			startmethod.setAccessible(true);
			
			// Invoke the start method
			startmethod.invoke(mid);
		}
		
		// Completely hide call exceptions
		catch (InvocationTargetException e)
		{
			Throwable c = e.getCause();
			if (c != null)
				throw c;
			else
				throw e;
		}
	}
	
	/**
	 * Initializes the run-time.
	 *
	 * @param __client If {@code true} then it is initialized for the client.
	 * @throws Throwable On any throwable.
	 * @since 2017/12/07
	 */
	private static void __initializeRunTime(boolean __client)
		throws Throwable
	{
		// Initialize anything needed for the client
		if (__client)
		{
			System.err.println("SquirrelJME Client Launch!");
		}
	}
	
	/**
	 * Returns the main class obtained by the manifest.
	 *
	 * @return The main manifest class.
	 * @throws Throwable On any throwable
	 * @since 2017/12/07
	 */
	private static String __mainClassByManifest()
		throws Throwable
	{
		// Determine the main class to actually call using the copied
		// manifest
		try (InputStream is = Main.class.getResourceAsStream(
			"/SQUIRRELJME-BOOTSTRAP.MF"))
		{
			// {@squirreljme.error AF08 No manifest is available?}
			if (is == null)
				throw new RuntimeException("AF08");
		
			// {@squirreljme.error AF09 No main class is available?}
			String mainclassname = new Manifest(is).getMainAttributes().
				getValue("Main-Class");
			if (mainclassname == null || mainclassname.isEmpty())
				throw new RuntimeException("AF09");
			return mainclassname;
		}
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






























































































































































































































































































































































































































































































































Deleted bldt/javase/libs/javase-runtime/cc/squirreljme/runtime/javase/SYSTEM.MF.

1
2
3
4
5
6
7
8
9
10
Manifest-Version: 1.0
X-SquirrelJME-API-Name: Java SE Runtime
X-SquirrelJME-API-Vendor: Stephanie Gawroriski
X-SquirrelJME-API-Version: 0.2.0
X-SquirrelJME-API-Description: This permits the SquirrelJME APIs to be 
 ran on a Java SE host virtualizing as best as it can.
X-SquirrelJME-DefinedConfigurations: CLDC-1.8 CLDC-1.8-Compact 
 CLDC-1.1 CLDC-1.0
X-SquirrelJME-DefinedProfiles: MIDP-1.0 MIDP-2.0 MIDP-2.1 MEEP-8.0

<
<
<
<
<
<
<
<
<
<




















Deleted bldt/javase/libs/javase-runtime/cc/squirreljme/runtime/javase/lcdui/ColorInfo.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.javase.lcdui;

import cc.squirreljme.runtime.lcdui.gfx.PixelFormat;
import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
import java.awt.image.DataBuffer;
import java.awt.image.DataBufferByte;
import java.awt.image.DataBufferInt;
import java.awt.image.DataBufferShort;
import java.awt.image.IndexColorModel;
import java.awt.Transparency;

/**
 * The type of color information to use.
 *
 * @since 2018/03/24
 */
@Deprecated
public final class ColorInfo
{
	/**
	 * {@squirreljme.property cc.squirreljme.runtime.javase.lcdui.pixelformat=f
	 * This selects the format to use for the display when creating images.}
	 */
	public static final String PIXEL_FORMAT_PROPERTY =
		"cc.squirreljme.runtime.javase.lcdui.pixelformat";
	
	/** The pixel format of the frame. */
	public static final PixelFormat PIXEL_FORMAT;
	
	/** The type of image to create. */
	public static final int IMAGE_TYPE;
	
	/** The color model to use. */
	public static final IndexColorModel COLOR_MODEL;
	
	/**
	 * Initializes the color information.
	 *
	 * @since 2018/03/24
	 */
	static
	{
		// Set the pixel format
		PixelFormat pf;
		PIXEL_FORMAT = (pf = PixelFormat.valueOf(
			System.getProperty(PIXEL_FORMAT_PROPERTY, "INTEGER_RGB888")));
		
		// Set the type of data to use for buffered images
		int btype;
		IndexColorModel icm;
		switch (pf)
		{
			case BYTE_INDEXED1:
				btype = BufferedImage.TYPE_BYTE_BINARY;
				icm = new IndexColorModel(1, 2, new int[]{
					0xFF000000, 0xFFFFFFFF}, 0, false, Transparency.OPAQUE,
					DataBuffer.TYPE_BYTE);
				break;
				
			case BYTE_INDEXED2:
				btype = BufferedImage.TYPE_BYTE_BINARY;
				icm = new IndexColorModel(2, 4, new int[]{
					0xFF_000000,
					0xFF_55FFFF,
					0xFF_FF55FF,
					0xFF_FFFFFF}, 0, false, Transparency.OPAQUE,
					DataBuffer.TYPE_BYTE);
				break;
				
			case BYTE_INDEXED4:
				btype = BufferedImage.TYPE_BYTE_BINARY;
				icm = new IndexColorModel(4, 16, new int[]{
					0xFF_000000,
					0xFF_808080,
					0xFF_C0C0C0,
					0xFF_FFFFFF,
					0xFF_800000,
					0xFF_FF0000,
					0xFF_808000,
					0xFF_FFFFFF,
					0xFF_008000,
					0xFF_00FF00,
					0xFF_008080,
					0xFF_00FFFF,
					0xFF_000080,
					0xFF_0000FF,
					0xFF_800080,
					0xFF_FF00FF,
					}, 0, false, Transparency.OPAQUE, DataBuffer.TYPE_BYTE);
				break;
				
			case BYTE_INDEXED8:
				btype = BufferedImage.TYPE_BYTE_INDEXED;
				throw new todo.TODO();
				
			case SHORT_RGB565:
				btype = BufferedImage.TYPE_USHORT_565_RGB;
				icm = null;
				break;
				
			case INTEGER_ARGB8888:
				btype = BufferedImage.TYPE_INT_ARGB;
				icm = null;
				break;
				
			case INTEGER_RGB888:
				btype = BufferedImage.TYPE_INT_RGB;
				icm = null;
				break;
			
				// {@squirreljme.error AF0a Cannot use the specified pixel
				// format. (The pixel format to use)}
			case BYTE_RGB332:
			case SHORT_INDEXED16:
			case SHORT_ARGB4444:
				throw new RuntimeException(String.format("AF0a %s", pf));
			
			default:
				throw new todo.OOPS();
		}
		
		// Store
		IMAGE_TYPE = btype;
		COLOR_MODEL = icm;
	}
	
	/**
	 * Creates a buffered image using the color parameters.
	 *
	 * @param __w The width.
	 * @param __h The height.
	 * @param __c The initial color.
	 * @return The resulting image.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/03/24
	 */
	public static BufferedImage create(int __w, int __h, Color __c)
		throws NullPointerException
	{
		BufferedImage rv;
		
		// Setup image
		IndexColorModel icm = ColorInfo.COLOR_MODEL;
		if (icm != null)
			rv = new BufferedImage(__w, __h, ColorInfo.IMAGE_TYPE, icm);
		else
			rv = new BufferedImage(__w, __h, ColorInfo.IMAGE_TYPE);
		
		// Fill the background with the default background color
		Graphics2D g = (Graphics2D)rv.getGraphics();
		g.setColor(__c);
		g.fillRect(0, 0, __w, __h);
		
		return rv;
	}
	
	/**
	 * Returns the array for the given image.
	 *
	 * @param __bi The buffer to read from.
	 * @return The array for the image data.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/03/24
	 */
	public static Object getArray(BufferedImage __bi)
		throws NullPointerException
	{
		if (__bi == null)
			throw new NullPointerException("NARG");
		
		DataBuffer db = __bi.getRaster().getDataBuffer();
		PixelFormat pf;
		switch ((pf = ColorInfo.PIXEL_FORMAT))
		{
			case BYTE_INDEXED1:
			case BYTE_INDEXED2:
			case BYTE_INDEXED4:
			case BYTE_INDEXED8:
			case BYTE_RGB332:
				return ((DataBufferByte)db).getData();
				
			case SHORT_INDEXED16:
			case SHORT_ARGB4444:
			case SHORT_RGB565:
				return ((DataBufferShort)db).getData();
				
			case INTEGER_ARGB8888:
			case INTEGER_RGB888:
				return ((DataBufferInt)db).getData();
			
				// {@squirreljme.error AF0b Unsupported pixel format.
				// (The pixel format to use)}
			default:
				throw new RuntimeException(String.format("AF0b %s", pf));
		}
	}
	
	/**
	 * Returns the palette to be used for the given image.
	 *
	 * @param __bi The palette to get for the image.
	 * @return The resulting palette or {@code null} if there is none.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/02/24
	 */
	public static int[] getPalette(BufferedImage __bi)
		throws NullPointerException
	{
		if (__bi == null)
			throw new NullPointerException("NARG");
		
		IndexColorModel model = ColorInfo.COLOR_MODEL;
		PixelFormat pf;
		switch ((pf = ColorInfo.PIXEL_FORMAT))
		{
			case BYTE_INDEXED1:
			case BYTE_INDEXED2:
			case BYTE_INDEXED4:
			case BYTE_INDEXED8:
			case SHORT_INDEXED16:
				int n = model.getNumColorComponents();
				int[] rv = new int[n];
				model.getRGBs(rv);
				return rv;
				
			case BYTE_RGB332:
			case SHORT_ARGB4444:
			case SHORT_RGB565:
			case INTEGER_ARGB8888:
			case INTEGER_RGB888:
				return null;
			
				// {@squirreljme.error AF0c Unsupported pixel format.
				// (The pixel format to use)}
			default:
				throw new RuntimeException(String.format("AF0c %s", pf));
		}
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
























































































































































































































































































































































































































































































































Deleted bldt/javase/libs/javase-runtime/cc/squirreljme/runtime/javase/lcdui/package-info.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

/**
 * This contains support for the LCDUI API and provides display heads which
 * output to Swing.
 *
 * @since 2017/11/09
 */

package cc.squirreljme.runtime.javase.lcdui;

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






































Deleted bldt/javase/libs/javase-runtime/cc/squirreljme/runtime/javase/package-info.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

/**
 * This package contains the support for SquirrelJME which runs on an existing
 * Java SE run-time by providing basic support for implemented classes and
 * such.
 *
 * @since 2017/11/09
 */

package cc.squirreljme.runtime.javase;

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<








































Deleted bldt/libs/NAMESPACE.MF.

1
2
3
4
5
6
Manifest-Version: 1.0
X-SquirrelJME-Namespace-Title: Build Support Libraries
X-SquirrelJME-Namespace-Type: liblet
X-SquirrelJME-Namespace-Description: This project contains support for the
 build system libraries and their support platform.

<
<
<
<
<
<












Deleted bldt/libs/builder-implementation/META-INF/MANIFEST.MF.

1
2
3
4
5
6
7
8
9
10
11
Manifest-Version: 1.0
X-SquirrelJME-UUID: 77ca1f69-76f9-402f-a7b1-c89d7e312c60
X-SquirrelJME-Error: AG
X-SquirrelJME-Name: Builder Implementation
X-SquirrelJME-Vendor: Stephanie Gawroriski
X-SquirrelJME-Version: 0.3.0
X-SquirrelJME-Description: This contains the entry system which runs 
 on Java ME environments such as SquirrelJME. This allows for example 
 SquirrelJME to build itself.
Microedition-Configuration: CLDC-1.8

<
<
<
<
<
<
<
<
<
<
<






















Deleted bldt/libs/builder-support/META-INF/MANIFEST.MF.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
Manifest-Version: 1.0
X-SquirrelJME-UUID: fda7df14-a58f-4781-8f8f-336111c7aec2
X-SquirrelJME-Error: AU
X-SquirrelJME-Name: Build System Support
X-SquirrelJME-Vendor: Stephanie Gawroriski
X-SquirrelJME-Version: 0.3.0
X-SquirrelJME-Depends: collections tool-manifest-reader meep-swm 
 tool-manifest-writer zip meep-midlet tool-compiler io all-vms 
 tool-packfile palmos-utils
X-SquirrelJME-Description: This contains basic support for the build 
 system and project manager. The interfaces declared by this class 
 must be implemented in order for the build system to be functional.
Microedition-Configuration: CLDC-1.8

<
<
<
<
<
<
<
<
<
<
<
<
<
<




























Deleted bldt/libs/builder-support/META-INF/services/cc.squirreljme.builder.support.dist.DistBuilder.

1
2
3
4
5
6
cc.squirreljme.builder.support.dist.ShadedJavaMEDist
cc.squirreljme.builder.support.dist.ShadedJavaSEDist
cc.squirreljme.builder.support.dist.SummerCoatROM
cc.squirreljme.builder.support.dist.SummerCoatROMTest
cc.squirreljme.builder.support.dist.PalmOSDist

<
<
<
<
<
<












Deleted bldt/libs/builder-support/cc/squirreljme/builder/support/BasicSource.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.builder.support;

import java.io.InputStream;
import java.io.IOException;
import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import java.nio.file.Path;
import net.multiphasicapps.javac.CompilerException;
import net.multiphasicapps.javac.CompilerInput;
import net.multiphasicapps.javac.CompilerPathSet;
import net.multiphasicapps.javac.FilePathSet;
import net.multiphasicapps.tool.manifest.JavaManifest;

/**
 * This represents a project which exists solely in the filesystem and does
 * not have virtually generated parts.
 *
 * @since 2018/03/06
 */
public final class BasicSource
	extends Source
{
	/** The path to the source code root. */
	protected final Path root;
	
	/** The manifest for this source. */
	private Reference<JavaManifest> _manifest;
	
	/**
	 * Initializes the project source.
	 *
	 * @param __name The name of the source.
	 * @param __p The path to the source code.
	 * @param __t The type of project this is.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/10/31
	 */
	public BasicSource(SourceName __name, Path __p, ProjectType __t)
		throws NullPointerException
	{
		super(__name, __t);
		
		if (__p == null)
			throw new NullPointerException("NARG");
		
		// Set
		this.root = __p;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/03/06
	 */
	@Override
	public final CompilerPathSet pathSet(SourcePathSetType __spst)
		throws NullPointerException
	{
		if (__spst == null)
			throw new NullPointerException("NARG");
		
		// The same path set is used for compilation and for sources
		return new FilePathSet(this.root);
	}
	
	/**
	 * Returns the root directory of the project source code.
	 *
	 * @return The project source code root.
	 * @since 2017/11/28
	 */
	public final Path root()
	{
		return this.root;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/03/06
	 */
	@Override
	public final JavaManifest sourceManifest()
	{
		Reference<JavaManifest> ref = this._manifest;
		JavaManifest rv;
		
		if (ref == null || null == (rv = ref.get()))
			try (CompilerPathSet ps = this.pathSet(SourcePathSetType.SOURCE);
				InputStream in = ps.input("META-INF/MANIFEST.MF").open())
			{
				this._manifest = new WeakReference<>(
					(rv = new JavaManifest(in)));
			}
			
			// {@squirreljme.error AU01 Could not read the source manifest.}
			catch (IOException|CompilerException e)
			{
				throw new NoSuchSourceException("AU01", e);
			}
		
		return rv;
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


































































































































































































































Deleted bldt/libs/builder-support/cc/squirreljme/builder/support/Binary.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.builder.support;

import cc.squirreljme.runtime.swm.DependencyInfo;
import cc.squirreljme.runtime.swm.MatchResult;
import cc.squirreljme.runtime.swm.ProvidedInfo;
import cc.squirreljme.runtime.swm.SuiteInfo;
import cc.squirreljme.runtime.swm.SuiteName;
import cc.squirreljme.runtime.swm.SuiteVendor;
import cc.squirreljme.runtime.swm.SuiteVersion;
import java.io.IOException;
import java.io.InputStream;
import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import java.nio.file.Files;
import java.nio.file.NoSuchFileException;
import java.nio.file.Path;
import java.nio.file.StandardOpenOption;
import java.nio.file.attribute.FileTime;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Deque;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
import net.multiphasicapps.collections.SortedTreeSet;
import net.multiphasicapps.javac.CompilerException;
import net.multiphasicapps.javac.CompilerPathSet;
import net.multiphasicapps.javac.ZipPathSet;
import net.multiphasicapps.tool.manifest.JavaManifest;
import net.multiphasicapps.tool.manifest.JavaManifestAttributes;
import net.multiphasicapps.tool.manifest.JavaManifestKey;
import net.multiphasicapps.zip.blockreader.FileChannelBlockAccessor;
import net.multiphasicapps.zip.blockreader.ZipBlockReader;
import net.multiphasicapps.zip.streamreader.ZipStreamReader;

/**
 * This class represents a binary which has been loaded by the binary manager.
 *
 * @since 2017/10/31
 */
public final class Binary
{
	/** The name of this binary. */
	protected final SourceName name;
	
	/** The source code for this binary, may be null if there is none. */
	protected final Source source;
	
	/** The path to the binary for this executable. */
	protected final Path path;
	
	/** The cached manifest for this entry. */
	private Reference<JavaManifest> _manifest;
	
	/** The suite information. */
	private Reference<SuiteInfo> _suiteinfo;
	
	/**
	 * Initializes the binary.
	 *
	 * @param __name The name of this binary.
	 * @param __source The source of this binary, may be {@code null} if there
	 * is no source.
	 * @throws InvalidBinaryException If the tiven 
	 * @throws NoSuchBinaryException If the given binary does not exist.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/11/02
	 */
	Binary(SourceName __name, Source __source, Path __path)
		throws InvalidBinaryException, NoSuchBinaryException,
			NullPointerException
	{
		if (__name == null || __path == null)
			throw new NullPointerException("NARG");
		
		// Set
		this.name = __name;
		this.source = __source;
		this.path = __path;
	}
	
	/**
	 * Returns the input stream over the binary itself.
	 *
	 * @return The input stream over the binary.
	 * @throws IOException On read errors.
	 * @since 2017/11/17
	 */
	public final InputStream inputStream()
		throws IOException
	{
		throw new todo.TODO();
	}
	
	/**
	 * Returns if the binary is newer.
	 *
	 * @return If the binary is newer.
	 * @since 2017/11/06
	 */
	public final boolean isBinaryNewer()
	{
		Source source = this.source;
		return lastModifiedTime() >=
			(source != null ? source.lastModifiedTime() : Long.MIN_VALUE);
	}
	
	/**
	 * Returns if the source code is newer.
	 *
	 * @return If the source is newer.
	 * @since 2017/11/06
	 */
	public final boolean isSourceNewer()
	{
		return !isBinaryNewer();
	}
	
	/**
	 * Returns the time that the binary was last modified.
	 *
	 * @return The time the binary was last modified.
	 * @since 2017/11/06
	 */
	public final long lastModifiedTime()
	{
		// The file might not actually exist if it has not been built
		try
		{
			FileTime t = Files.getLastModifiedTime(this.path);
			if (t != null)
				return t.toMillis();
			return Long.MIN_VALUE;
		}
		
		// File does not exist or another error, so unknown an unknown time
		catch (IOException e)
		{
			return Long.MIN_VALUE;
		}
	}
	
	/**
	 * Returns the manifest for this binary.
	 *
	 * @return The manifest for this project.
	 * @since 2017/11/05
	 */
	public final JavaManifest manifest()
	{
		// Approximate the manifest to use
		if (isSourceNewer())
			return this.source.manifest();
		
		// Open the binary instead
		try (ZipBlockReader zip = zipBlock())
		{
			try (InputStream in = zip.open("META-INF/MANIFEST.MF"))
			{
				return new JavaManifest(in);
			}
		}
		
		// {@squirreljme.error AU02 Could not read the binary manifest.}
		catch (IOException e)
		{
			throw new InvalidBinaryException("AU02", e);
		}
	}
	
	/**
	 * Returns a dependency match result which contains the results of a
	 * dependency match between the provided dependencies and the provided
	 * dependencies for this project.
	 *
	 * @param __d The input dependencies to check.
	 * @return The result of the match.
	 * @throws NullPointerException On null arguments.
	 * @sine 2017/11/30
	 */
	public final MatchResult matchedDependencies(DependencyInfo __d)
		throws NullPointerException
	{
		if (__d == null)
			throw new NullPointerException("NARG");
		
		return __d.match(this.suiteInfo().provided());
	}
	
	/**
	 * Returns the name of the project.
	 *
	 * @return The project name.
	 * @since 2017/11/02
	 */
	public final SourceName name()
	{
		return this.name;
	}
	
	/**
	 * Returns the path to the binary.
	 *
	 * @return The binary path.
	 * @since 2017/11/28
	 */
	public final Path path()
	{
		return this.path;
	}
	
	/**
	 * Returns the path set which represents the binary.
	 *
	 * @return The path set for this binary
	 * @since 2019/06/12
	 */
	public final CompilerPathSet pathSet()
		throws IOException, NullPointerException
	{
		// Just wrap the ZIP
		try
		{
			return new ZipPathSet(this.zipBlock());
		}
		
		// {@squirreljme.error AU03 Could not get the path set for this
		// binary.}
		catch (IOException e)
		{
			throw new CompilerException("AU03", e);
		}
	}
	
	/**
	 * Returns the source project that this binary is built from.
	 *
	 * @return The source project or {@code null} if there is no source.
	 * @since 2017/11/06
	 */
	public final Source source()
	{
		return this.source;
	}
	
	/**
	 * Returns the suite information for this binary.
	 *
	 * @return The binary suite information.
	 * @since 2017/11/29
	 */
	public final SuiteInfo suiteInfo()
	{
		// Use binary information
		if (isBinaryNewer())
		{
			Reference<SuiteInfo> ref = this._suiteinfo;
			SuiteInfo rv;
		
			if (ref == null || null == (rv = ref.get()))
				this._suiteinfo = new WeakReference<>((rv =
					new SuiteInfo(this.manifest())));
			
			return rv;
		}
		
		// {@squirreljme.error AU04 Cannot get suite information for the
		// binary because there is no source code.}
		Source source = this.source;
		if (source == null)
			throw new InvalidBinaryException("AU04");
		return this.source.suiteInfo();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/02/28
	 */
	@Override
	public final String toString()
	{
		return this.name.toString();
	}
	
	/**
	 * Returns the type of project that this is.
	 *
	 * @return The project type.
	 * @since 2017/11/26
	 */
	public final ProjectType type()
	{
		JavaManifestAttributes attr = this.manifest().getMainAttributes();
		
		// Midlet?
		if (attr.definesValue("midlet-name"))
			return ProjectType.MIDLET;
		
		// APIs are like liblets but have a special flag to them
		else if ("true".equals(attr.getValue("x-squirreljme-isapi")))
			return ProjectType.API;
		
		// Otherwise everything else is a liblet
		return ProjectType.LIBLET;
	}
	
	/**
	 * Opens the binary as a ZIP file for reading the contents.
	 *
	 * @return The reader for the ZIP file as a block.
	 * @throws IOException On read errors.
	 * @since 2017/11/06
	 */
	public final ZipBlockReader zipBlock()
		throws IOException
	{
		// {@squirreljme.error AU05 Cannot get the ZIP for this binary because
		// it is out of date. (The name of this binary)}
		if (isSourceNewer())
			throw new OutOfDateBinaryException(
				String.format("AU05 %s", this.name));
		
		// Open it
		return new ZipBlockReader(new FileChannelBlockAccessor(this.path));
	}
	
	/**
	 * Opens the binary as a ZIP stream for reading the contents.
	 *
	 * @return The stream over the ZIP's contents.
	 * @throws IOException On read errors.
	 * @since 2017/11/02
	 */
	public final ZipStreamReader zipStream()
		throws IOException
	{
		// {@squirreljme.error AU06 Cannot get the ZIP for this binary because
		// it is out of date. (The name of this binary)}
		if (isSourceNewer())
			throw new OutOfDateBinaryException(
				String.format("AU06 %s", this.name));
		
		return new ZipStreamReader(Files.newInputStream(this.path,
			StandardOpenOption.READ));
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
















































































































































































































































































































































































































































































































































































































































































































































Deleted bldt/libs/builder-support/cc/squirreljme/builder/support/BinaryManager.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.builder.support;

import cc.squirreljme.runtime.swm.Configuration;
import cc.squirreljme.runtime.swm.DependencyInfo;
import cc.squirreljme.runtime.swm.MarkedProvided;
import cc.squirreljme.runtime.swm.MatchResult;
import cc.squirreljme.runtime.swm.Profile;
import cc.squirreljme.runtime.swm.ProvidedInfo;
import cc.squirreljme.runtime.swm.Standard;
import cc.squirreljme.runtime.swm.SuiteDependency;
import cc.squirreljme.runtime.swm.SuiteDependencyLevel;
import cc.squirreljme.runtime.swm.SuiteDependencyType;
import cc.squirreljme.runtime.swm.SuiteInfo;
import cc.squirreljme.runtime.swm.SuiteName;
import cc.squirreljme.runtime.swm.SuiteVersion;
import cc.squirreljme.runtime.swm.SuiteVersionRange;
import java.io.Closeable;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.IOException;
import java.io.OutputStream;
import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import java.nio.file.DirectoryStream;
import java.nio.file.Files;
import java.nio.file.NoSuchFileException;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardCopyOption;
import java.nio.file.StandardOpenOption;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Deque;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import net.multiphasicapps.collections.CloseableList;
import net.multiphasicapps.collections.SortedTreeMap;
import net.multiphasicapps.collections.UnmodifiableCollection;
import net.multiphasicapps.io.MIMEFileDecoder;
import net.multiphasicapps.javac.Compiler;
import net.multiphasicapps.javac.CompilerException;
import net.multiphasicapps.javac.CompilerInput;
import net.multiphasicapps.javac.CompilerInputLocation;
import net.multiphasicapps.javac.CompilerOutput;
import net.multiphasicapps.javac.CompilerPathSet;
import net.multiphasicapps.javac.DefaultCompiler;
import net.multiphasicapps.javac.FilePathSet;
import net.multiphasicapps.javac.MergedPathSet;
import net.multiphasicapps.javac.ZipCompilerOutput;
import net.multiphasicapps.javac.ZipPathSet;
import net.multiphasicapps.strings.StringUtils;
import net.multiphasicapps.tool.manifest.JavaManifest;
import net.multiphasicapps.tool.manifest.JavaManifestAttributes;
import net.multiphasicapps.tool.manifest.JavaManifestKey;
import net.multiphasicapps.tool.manifest.writer.MutableJavaManifest;
import net.multiphasicapps.tool.manifest.writer.MutableJavaManifestAttributes;
import net.multiphasicapps.zip.streamwriter.ZipStreamWriter;

/**
 * This class is used to manage binaries which are available for running
 * and/or compilation.
 *
 * @since 2017/10/31
 */
public final class BinaryManager
	implements Iterable<Binary>
{
	/** The output directory where built binaries are to be placed. */
	protected final Path output;
	
	/** Projects which may exist that provide access to source code. */
	protected final SourceManager sources;
	
	/** Projects which have been read by the manager. */
	private final Map<SourceName, Binary> _binaries =
		new SortedTreeMap<>();
	
	/**
	 * Initializes the binary manager.
	 *
	 * @param __out The output directory, this directory is scanned for
	 * binaries as requested.
	 * @param __src The source code where projects may be sourced from, may
	 * be {@code null} if there is no source code.
	 * @throws IOException On read/write errors.
	 * @throws NullPointerException If no output path was specified.
	 * @since 2017/10/31
	 */
	public BinaryManager(Path __out, SourceManager __src)
		throws IOException, NullPointerException
	{
		if (__out == null)
			throw new NullPointerException("NARG");
		
		this.output = __out;
		this.sources = __src;
		
		// Load in binaries from source code first
		Map<SourceName, Binary> binaries = this._binaries;
		for (Source src : __src)
		{
			SourceName name = src.name();
			binaries.put(name,
				new Binary(name, src, __out.resolve(name.toFileName())));
		}
		
		// Go through directory containing binaries and try building binaries
		// that have no source
		try (DirectoryStream<Path> ds = Files.newDirectoryStream(__out))
		{
			for (Path p : ds)
			{
				// Ignore directories and non-binary files
				if (Files.isDirectory(p) || !SourceName.isBinaryPath(p))
					continue;
				
				// Only add a binary if it does not exist, this allows one
				// to add external binaries
				SourceName name = SourceName.ofBinaryPath(p);
				Binary bin = binaries.get(name);
				if (bin == null)
					binaries.put(name, new Binary(name, null, p));
			}
		}
		
		// Ignore these
		catch (NoSuchFileException e)
		{
		}
	}
	
	/**
	 * Returns the class path for the given binary.
	 *
	 * @param __b The binary to get the classpath for.
	 * @return The binary class path.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/11/17
	 */
	public final Binary[] classPath(Binary __b)
		throws NullPointerException
	{
		if (__b == null)
			throw new NullPointerException("NARG");
		
		// Return value to use run-time
		Set<Binary> rv = new LinkedHashSet<>();
		
		// Make sure all dependencies are used
		for (Binary dep : this.matchDependencies(
			__b.suiteInfo().dependencies(), false))
			rv.add(dep);
		
		// Include this in the run-time
		rv.add(__b);
		return rv.<Binary>toArray(new Binary[rv.size()]);
	}
	
	/**
	 * Compiles the specified binary and all of their dependencies.
	 *
	 * @param __b The binary to compile.
	 * @return The binaries which were compiled and are part of the class
	 * path.
	 * @throws InvalidBinaryException If the binary is not valid because it
	 * could not be compiled or one of its dependencies could not be compiled.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/11/17
	 */
	public final Binary[] compile(Binary __b)
		throws InvalidBinaryException, NullPointerException
	{
		if (__b == null)
			throw new NullPointerException("NARG");
		
		// Return value to use run-time
		Set<Binary> rv = new LinkedHashSet<>();
		
		// Make sure all dependencies are compiled, this will result in the
		// entire class path being determined aslso for compilation
		for (Binary dep : this.matchDependencies(
			__b.suiteInfo().dependencies(), false))
			try
			{
				for (Binary c : this.compile(dep))
					rv.add(c);
			}
			catch (NoSourceAvailableException e)
			{
				// For no source, just add the class path for the binary
				for (Binary c : this.classPath(dep))
					rv.add(c);
			}
		
		// Always recompile if the source is newer, but go through all
		// dependencies and recompile if any dependency is newer than this
		// binary
		boolean docompile = __b.isSourceNewer();
		if (!docompile)
		{
			// Get the date for this binary
			long mydate = __b.lastModifiedTime();
			
			// If any dependency has a newer binary than this one, compile
			for (Binary dep : rv)
				if (dep.isSourceNewer() || dep.lastModifiedTime() > mydate)
				{
					docompile = true;
					break;
				}
		}
		
		// Compilation needs to be performed
		if (docompile)
		{
			// Temporary output file to be cleaned
			Path temp = null;
			
			// {@squirreljme.error AU07 Cannot compile the specified project
			// because it has no source code. (The name of the project)}
			Source src = __b.source();
			if (src == null)
				throw new NoSourceAvailableException(
					String.format("AU07 %s", __b.name()));
			
			// Need to close everything that is opened
			try (CloseableList<Closeable> closing = new CloseableList<>())
			{
				// {@squirreljme.error AU08 Compiling the given project.
				// (The project name)}
				System.err.printf("AU08 %s%n", __b.name());
			
				// Setup compiler instance
				Compiler javac = DefaultCompiler.createInstance();
				
				// Use the source root to lookup source code
				CompilerPathSet srcps = closing.<CompilerPathSet>addThis(
					src.pathSet(SourcePathSetType.COMPILED),
					CompilerPathSet.class);
				javac.setLocation(CompilerInputLocation.SOURCE, srcps);
				
				// Explicitly compile every source file
				Set<CompilerInput> noninput = new LinkedHashSet<>();
				boolean hasinput = false;
				for (CompilerInput i : srcps)
				{
					String name = i.fileName();
					
					// Is there a dash in this?
					int ls = name.lastIndexOf('/');
					boolean dashname = (ls >= 0 && name.substring(0, ls).
						indexOf('-') >= 0);
					
					// Compile any source file
					if (!dashname && name.endsWith(".java"))
					{
						hasinput = true;
						javac.addInput(i);
					}
					
					// Do not include the manifest ever
					else if (!name.equals("META-INF/MANIFEST.MF"))
						noninput.add(i);
				}
				
				// Go through all binaries and load dependencies into the
				// class path
				int ndeps = rv.size(),
					i = 0;
				CompilerPathSet[] bins = new CompilerPathSet[ndeps];
				for (Binary dep : rv)
					bins[i++] = closing.<ZipPathSet>addThis(
						new ZipPathSet(dep.zipBlock()), ZipPathSet.class);
				javac.setLocation(CompilerInputLocation.CLASS, bins);
				
				// Need temporary file for output
				temp = Files.createTempFile("squirreljme-", ".ja_");
				
				// Output to a temporary ZIP file
				try (ZipCompilerOutput out = new ZipCompilerOutput(
					new ZipStreamWriter(Files.newOutputStream(temp,
						StandardOpenOption.CREATE,
						StandardOpenOption.WRITE,
						StandardOpenOption.TRUNCATE_EXISTING))))
				{
					// Write the resulting actual manifest
					try (OutputStream mos = out.output("META-INF/MANIFEST.MF"))
					{
						__writeRealManifest(mos, rv, __b);
					}
					
					// Run compilation task, but not if there is no input
					if (hasinput)
						javac.compile(out).run();
					
					// Go through non-input and copy all of the data
					byte[] buf = new byte[512];
					for (CompilerInput j : noninput)
					{
						// Detect UUEncoded binary files, that I encode due
						// to the pure text requirements of the repository
						String inname = j.fileName();
						boolean ismime;
						if ((ismime = inname.endsWith(".__mime")))
							inname = inname.substring(0, inname.length() - 7);
						
						// Copy data directly or just decode it
						try (InputStream ei = (!ismime ? j.open() :
							new MIMEFileDecoder(new InputStreamReader(j.open(),
							"utf-8")));
							OutputStream eo = out.output(inname))
						{
							for (;;)
							{
								int rc = ei.read(buf);
								
								if (rc < 0)
									break;
								
								eo.write(buf, 0, rc);
							}
						}
					}
					
					// Flush the ZIP before it is closed
					out.flush();
				}
				
				// Make sure the output directories exist
				Path outpath = __b.path();
				Files.createDirectories(outpath.getParent());
				
				// Replace output file with temporary one
				Files.move(temp, outpath,
					StandardCopyOption.REPLACE_EXISTING);
			}
			
			// {@squirreljme.error AU09 Could not compile the specified
			// project. (The project which failed to compile)}
			catch (CompilerException|IOException e)
			{
				throw new InvalidBinaryException(
					String.format("AU09 %s", __b.name()), e);
			}
			
			// Clean output temporary file as needed
			finally
			{
				if (temp != null)
					try
					{
						Files.deleteIfExists(temp);
					}
					catch (IOException e)
					{
						e.printStackTrace();
					}
			}
		}
		
		// Include this in the run-time
		rv.add(__b);
		return rv.<Binary>toArray(new Binary[rv.size()]);
	}
	
	/**
	 * Obtains the binary which uses the given source name.
	 *
	 * @param __n The name of the project to get.
	 * @return The binary for the given name.
	 * @throws NoSuchBinaryException If no binary with the given name exists.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/11/17
	 */
	public final Binary get(String __n)
		throws NoSuchBinaryException, NullPointerException
	{
		if (__n == null)
			throw new NullPointerException("NARG");
		
		return this.get(new SourceName(__n));
	}
	
	/**
	 * Obtains the binary which uses the given source name.
	 *
	 * @param __n The name of the project to get.
	 * @return The binary for the given name.
	 * @throws NoSuchBinaryException If no binary with the given name exists.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/10/31
	 */
	public final Binary get(SourceName __n)
		throws NoSuchBinaryException, NullPointerException
	{
		if (__n == null)
			throw new NullPointerException("NARG");
		
		// Locate
		Binary rv = this._binaries.get(__n);
		
		// {@squirreljme.error AU0a The specified binary does not exist.
		// (The name of the binary)}
		if (rv == null)
			throw new NoSuchBinaryException(String.format("AU0a %s", __n));
		return rv;
	}
	
	/**
	 * Creates a virtual binary which is sourced from the given JAR file and
	 * where it has no backing in source code.
	 *
	 * @param __p The path to JAR to be opened as a binary.
	 * @return The binary for the given path.
	 * @throws NoSuchBinaryException If no such binary exists.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/10/31
	 */
	public final Binary getVirtual(Path __p)
		throws NoSuchBinaryException, NullPointerException
	{
		if (__p == null)
			throw new NullPointerException("NARG");
		
		// {@squirreljme.error AU0b Cannot open the specified path as a project
		// because it does not exist. (The path to open as a binary)}
		if (!Files.exists(__p))
			throw new NoSuchBinaryException(String.format("AU0b %s", __p));
		
		// Just create the binary
		return new Binary(SourceName.ofBinaryPath(__p), null, __p);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/11/25
	 */
	@Override
	public final Iterator<Binary> iterator()
	{
		return UnmodifiableCollection.<Binary>of(this._binaries.values()).
			iterator();
	}
	
	/**
	 * Returns the binaries which statisfy the given set.
	 *
	 * @param __set The set of dependencies to get.
	 * @param __opt If {@code true} include optional dependencies.
	 * @return Binaries which statisfy the given dependencies.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/11/17
	 */
	public final Binary[] matchDependencies(DependencyInfo __set,
		boolean __opt)
		throws NullPointerException
	{
		if (__set == null)
			throw new NullPointerException("NARG");
		
		// Clear all optionals if they are not included
		if (!__opt)
			__set = __set.noOptionals();
		
		// No dependencies to search for
		if (__set.isEmpty())
			return new Binary[0];
		
		// Remember the original set for recursive dependency checks
		DependencyInfo original = __set;
		
		// The returning set
		Set<Binary> rv = new LinkedHashSet<>();
		
		// Go through all binaries and attempt to match
		for (Binary bin : this)
		{
			// Only consider matches
			MatchResult result = bin.matchedDependencies(__set);
			if (!result.hasMatches())
				continue;
			
			// Use this as a dependency
			rv.add(bin);
			
			// Recursively go down
			for (Binary sub : this.matchDependencies(
				bin.suiteInfo().dependencies(), false))
				rv.add(sub);
			
			// Use remaining unmatched set
			__set = result.unmatched();
			
			// If the set was emptied then it will never have any more matches
			if (__set.isEmpty())
				break;
		}
		
		// {@squirreljme.error AU0c Could not locate the binary which
		// statifies the given dependency. (The dependency to look for)}
		if (rv.isEmpty())
			throw new InvalidBinaryException(
				String.format("AU0c %s", __set));
		
		return rv.<Binary>toArray(new Binary[rv.size()]);
	}
	
	/**
	 * Returns the dependency key to use for the manifest.
	 *
	 * @param __ismidlet Is this a midlet?
	 * @param __i The dependency index.
	 * @return The key to use in the manifest for the dependency.
	 * @since 2018/02/28
	 */
	private static JavaManifestKey __dependencyKey(boolean __ismidlet, int __i)
	{
		return new JavaManifestKey((__ismidlet ?
			"MIDlet-Dependency-" : "LIBlet-Dependency-") + __i);
	}
	
	/**
	 * Writes the real manifest to the output binary with non-proprietary
	 * SquirrelJME dependencies.
	 *
	 * @param __os The stream to write to.
	 * @param __deps The dependencies to use for lookup.
	 * @param __bin The binary to write the manifest for.
	 * @throws IOException On read/write errors.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/11/28
	 */
	private static void __writeRealManifest(OutputStream __os,
		Set<Binary> __deps, Binary __bin)
		throws IOException, NullPointerException
	{
		if (__os == null || __deps == null || __bin == null)
			throw new NullPointerException("NARG");
		
		// Initialize the output manifest with the initial approximated
		// manifest first
		MutableJavaManifest outman = new MutableJavaManifest(
			__bin.source().manifest());
		MutableJavaManifestAttributes outattr = outman.getMainAttributes();
		
		// Is this a midlet? Needed for correct dependency placement
		boolean ismidlet = (__bin.type() == ProjectType.MIDLET);
		
		// Read in all dependency values. Since SquirrelJME uses a rather
		// abstract dependency system, project references will be converted to
		// configurations, profiles, standard, or liblets.
		Set<SuiteDependency> mdeps = new LinkedHashSet<>();
		for (int i = 1; i >= 1; i++)
		{
			JavaManifestKey key = __dependencyKey(ismidlet, i);
			
			// No more values to parse
			String value = outattr.get(key);
			if (value == null)
				break;
			
			// Read in dependency and remove from original set, will be
			// re-added later after being evaluated
			mdeps.add(new SuiteDependency(outattr.remove(key)));
		}
		
		// Go through and remap dependencies
		int next = 1;
		Map<Binary, SuiteDependency> apideps = new LinkedHashMap<>();
		for (SuiteDependency dep : mdeps)
		{
			JavaManifestKey key = __dependencyKey(ismidlet, next);
			
			// Debug
			todo.DEBUG.note("Dep: %s%n", dep);
			
			// Non-proprietary dependency
			String name = Objects.toString(dep.name(), "").trim();
			if (dep.type() != SuiteDependencyType.PROPRIETARY ||
				!name.startsWith("squirreljme.project"))
			{
				// Just directly copy it since it has an unknown translation
				outattr.put(key, dep.toString());
				
				// Next key
				next++;
				continue;
			}
			
			// {@squirreljme.error AU0d Expected at sign in
			// {@code squirreljme.project} type dependency. (This project)}
			int at = name.indexOf('@');
			if (at < 0)
				throw new InvalidBinaryException(
					String.format("AU0d %s", __bin.name()));
			SourceName sname = new SourceName(name.substring(at + 1).trim());
			
			// Find the dependency using the given project
			Binary found = null;
			for (Binary bin : __deps)
				if (sname.equals(bin.name()))
				{
					found = bin;
					break;
				}
			
			// {@squirreljme.error AU0e Could not locate the project with the
			// specified dependency. (This project; The dependency)}
			if (found == null)
				throw new InvalidBinaryException(
					String.format("AU0e %s %s", __bin.name(), sname));
			
			// Depending on an API, use configuration, standard, or profile
			SuiteInfo foundinfo = found.suiteInfo();
			if (found.type() == ProjectType.API)
				apideps.put(found, dep);
			
			// Relying on a liblet
			else
			{
				outattr.put(key, new SuiteDependency(
					SuiteDependencyType.LIBLET,
					dep.level(),
					foundinfo.name(),
					foundinfo.vendor(),
					SuiteVersionRange.exactly(foundinfo.version())).
					toString());
				
				// Use next key
				next++;
			}
		}
		
		// Handle API dependencies since they require a more complex setup
		todo.DEBUG.note("API Depends: %s%n", apideps);
		if (!apideps.isEmpty())
			for (Map.Entry<Binary, SuiteDependency> e : apideps.entrySet())
			{
				Binary bin = e.getKey();
				SuiteDependency dep = e.getValue();
				
				// Go through provided dependencies and try to handle them
				for (MarkedProvided mp : bin.suiteInfo().provided().provided())
				{
					// Standard
					if (mp instanceof Standard)
					{
						Standard s = (Standard)mp;
						SuiteVersion v = s.version();
						outattr.put(__dependencyKey(ismidlet, next++),
							new SuiteDependency(
								SuiteDependencyType.STANDARD,
								dep.level(),
								s.name(),
								s.vendor(),
								(v == null ? null :
									SuiteVersionRange.exactly(v))).
							toString());
					}
					
					// Configuration
					else if (mp instanceof Configuration)
						throw new todo.TODO();
					
					// Profile
					else if (mp instanceof Profile)
						throw new todo.TODO();
					
					// Unknown, ignore
					else
						continue;
				}
			}
		
		// Debug
		todo.DEBUG.note("Manifest: %s",
			outman.write(new StringBuilder()));
		
		// Write it
		outman.write(__os);
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
























































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted bldt/libs/builder-support/cc/squirreljme/builder/support/BuilderFactory.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.builder.support;

import cc.squirreljme.builder.support.dist.DistBuilder;
import cc.squirreljme.builder.support.vm.VMMain;
import cc.squirreljme.builder.support.vmshader.Shader;
import cc.squirreljme.runtime.swm.EntryPoint;
import cc.squirreljme.runtime.swm.EntryPoints;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardCopyOption;
import java.nio.file.StandardOpenOption;
import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.Deque;
import java.util.HashMap;
import java.util.LinkedHashSet;
import java.util.Map;
import java.util.Queue;
import java.util.Set;
import net.multiphasicapps.javac.ZipCompilerOutput;

/**
 * This is a factory which can invoke the build system using a common set
 * of input arguments.
 *
 * @since 2017/11/09
 */
public class BuilderFactory
	implements Runnable
{
	/** The command to execute. */
	protected final String command;
	
	/** The project manager to use. */
	protected final ProjectManager projectmanager;
	
	/** Arguments to the builder command. */
	private final String[] _args;
	
	/**
	 * Initializes the build factory.
	 *
	 * @param __args Program arguments.
	 * @throws IllegalArgumentException If the factory arguments are missing
	 * the primary command.
	 * @since 2017/11/09
	 */
	public BuilderFactory(String... __args)
		throws IllegalArgumentException
	{
		// Copy arguments for processing
		Deque<String> args = new ArrayDeque<>();
		if (__args != null)
			for (String a : __args)
				if (a != null)
					args.addLast(a);
		
		// Parse options and such for the project
		ProjectManager projectmanager = ProjectManager.fromArguments(args);
		this.projectmanager = projectmanager;
		
		// {@squirreljme.error AU0f No command given.}
		String command = args.pollFirst();
		if (command == null)
			throw new IllegalArgumentException("AU0f");
		this.command = command;
		
		// Use remaining arguments as input
		this._args = args.<String>toArray(new String[args.size()]);
	}
	
	/**
	 * Returns the binary manager to use for binary project retrieval.
	 *
	 * @param __t The timespace to build for.
	 * @return The manager for the given timespace.
	 * @throws IOException On read errors.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/11/16
	 */
	public BinaryManager binaryManager(TimeSpaceType __t)
		throws IOException, NullPointerException
	{
		return this.projectmanager.binaryManager(__t);
	}
	
	/**
	 * Builds the specified projects.
	 *
	 * @param __t The timespace to use for projects.
	 * @param __p The projects to be built.
	 * @return The binaries which are associated with the given project.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/11/16
	 */
	public Binary[] build(TimeSpaceType __t, String... __p)
		throws NullPointerException
	{
		return this.projectmanager.build(__t, __p);
	}
	
	/**
	 * Builds every binary.
	 *
	 * @param __t The timespace to build in.
	 * @return The resulting binaries.
	 * @throws NullPointerException On null arguments.
	 */
	public Binary[] buildAll(TimeSpaceType __t, String... __p)
		throws NullPointerException
	{
		return this.projectmanager.buildAll(__t);
	}
	
	/**
	 * Builds the given distributions.
	 *
	 * @param __args The distributions to build.
	 * @since 2018/12/24
	 */
	public void dist(String... __args)
	{
		ProjectManager projectmanager = this.projectmanager;
		
		// Build each requested distribution
		boolean builtone = false;
		for (String d : __args)
		{
			if (d == null)
				continue;
			
			// Get the builder for this
			DistBuilder db = DistBuilder.builder(d);
			
			// Work with a temporary file so nothing breaks
			Path tempfile = null;
			try
			{
				// Need a temporary file
				tempfile = Files.createTempFile("squirreljme-shaded", ".ja_");
				
				// Write to temporary stream first
				try (ZipCompilerOutput zco = new ZipCompilerOutput(
					Files.newOutputStream(tempfile,
					StandardOpenOption.CREATE,
					StandardOpenOption.WRITE,
					StandardOpenOption.TRUNCATE_EXISTING)))
				{
					db.build(projectmanager, zco);
				}
				
				// Move the file to the output since it was built!
				Files.move(tempfile, Paths.get(
					"squirreljme-" + db.name() + ".zip"),
					StandardCopyOption.REPLACE_EXISTING);
			}
			
			// {@squirreljme.error AU0g Could not build the distribution.
			// (The failed distribution)}
			catch (IOException e)
			{
				throw new RuntimeException("AU0g " + d, e);
			}
			
			// Cleanup temp file
			finally
			{
				if (tempfile != null)
					try
					{
						Files.delete(tempfile);
					}
					catch (IOException e)
					{
					}
			}
			
			// Did build one
			builtone = true;
		}
		
		// {@squirreljme.error AU0h No distributions were specified for
		// building.}
		if (!builtone)
			throw new IllegalArgumentException("AU0h");
	}
	
	/**
	 * Builds all distributions.
	 *
	 * @param __args Arguments.
	 * @since 2018/12/24
	 */
	public void distAll(String... __args)
	{
		// {@squirreljme.error AU0i Could not build at least one distribution.}
		RuntimeException fail = new RuntimeException("AU0i");
		boolean failed = false;
		
		// Build them one at a time so all of them are made regardless if they
		// all fail or not
		for (String d : DistBuilder.listBuilders())
			try
			{
				this.dist(d);
			}
			catch (RuntimeException t)
			{
				// Suppress it
				failed = true;
				fail.addSuppressed(t);
			}
		
		// If any failed, we throw the exception we made before
		if (failed)
			throw fail;
	}
	
	/**
	 * Lists distributions available to standard output.
	 *
	 * @since 2018/12/24
	 */
	public void distList()
	{
		PrintStream out = System.out;
		for (String d : DistBuilder.listBuilders())
			out.println(d);
	}
	
	/**
	 * Generate all of the Javadoc.
	 *
	 * @param __args Arguments.
	 * @since 2019/01/17
	 */
	public void javaDoc(String... __args)
	{
		// Defensive copy
		__args = (__args == null ? new String[0] : __args.clone());
		
		throw new todo.TODO();
	}
	
	/**
	 * Launch program.
	 *
	 * @param __args Arguments to use.
	 * @since 2018/12/22
	 */
	public void launch(String... __args)
	{
		// Load arguments into a queue
		Deque<String> args = new ArrayDeque<>();
		if (__args != null)
			for (String a : __args)
				if (a != null)
					args.add(a);
		
		// Allows the VM to be overridden
		String vmname = null;
		
		// Alternative NPS location
		String npspath = null;
		
		// Listing entry points?
		boolean listentry = false;
		
		// Extra system properties
		Map<String, String> sprops = new HashMap<>();
		
		// Determine how shading is to be handled
		String[] parse;
		while (null != (parse = __getopts(":?v:n:D:e", args)))
			switch (parse[0])
			{
					// Use build timespace
				case "v":
					vmname = parse[1];
					break;
					
					// Write NPS somewhere
				case "n":
					npspath = parse[1];
					break;
					
					// System property
				case "D":
					String spl = parse[1];
					int eq = spl.indexOf('=');
					if (eq >= 0)
						sprops.put(spl.substring(0, eq),
							spl.substring(eq + 1));
					else
						sprops.put(spl, "");
					break;
					
					// List entry points of program
				case "e":
					listentry = true;
					break;
				
					// {@squirreljme.error AU0j Unknown argument.
					// Usage: vmshade [-v vmname] [-n NPS path] [-Dkey=value]
					// [-e] (program[:launchid]);
					// -v: The name of the virtual machine to use, this may
					// be springcoat or summercoat.
					// -n: Path to write NPS files to.
					// -D: System property key/value pair.
					// -e: List entry points but do not run program.
					// (The switch)}
				case "?":
				default:
					throw new IllegalArgumentException(
						String.format("AU0j %s", parse[0]));
			}
		
		// {@squirreljme.error AU0k Launch of program using a SquirrelJME
		// VM requires a program to be launched.}
		String program = args.pollFirst();
		if (program == null)
			throw new IllegalArgumentException("AU0k");
		
		// List entry points?
		ProjectManager pm = this.projectmanager;
		if (listentry)
		{
			// A launch ID might accidentally be specified, ignore it
			int col = program.indexOf(':');
			String check = (col >= 0 ? program.substring(0, col) : program);
			
			// Get the binaries to be ran
			Binary[] vclasspath;
			try
			{
				vclasspath = pm.build(check);
			}
			
			// If there is no source for this, just use the classpath then
			catch (NoSourceAvailableException e)
			{
				vclasspath = pm.classPath(check);
			}
			
			// Load entry points
			EntryPoints eps = new EntryPoints(
				vclasspath[vclasspath.length - 1].manifest());
			
			// List them
			System.err.println("Entry points:");
			for (int i = 0, n = eps.size(); i < n; i++)
				System.err.printf("    %d: %s%n", i, eps.get(i));
			
			// Do not continue
			return;
		}
		
		// Run the VM
		VMMain.main(vmname, npspath, sprops, pm, program,
			args.<String>toArray(new String[args.size()]));
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/11/09
	 */
	@Override
	public void run()
	{
		// Load arguments into a queue
		Deque<String> args =
			new ArrayDeque<>(Arrays.<String>asList(this._args));
		
		// Depends on the command
		String command = this.command;
		switch (command)
		{
				// Build the specified project
			case "build":
				{
					TimeSpaceType space = TimeSpaceType.RUNTIME;
					
					// Try to determine the timespace to use, which determines
					// the available projects
					String[] parse;
					while (null != (parse = __getopts(":?rjtbRJTB", args)))
						switch (parse[0])
						{
							case "r":
							case "R":
								space = TimeSpaceType.RUNTIME;
								break;
							
							case "j":
							case "J":
								space = TimeSpaceType.JIT;
								break;
								
							case "t":
							case "T":
								space = TimeSpaceType.TEST;
								break;
							
							case "b":
							case "B":
								space = TimeSpaceType.BUILD;
								break;
							
								// {@squirreljme.error AU0l Unknown argument.
								// Usage: build [-R] [-J] [-T] [-B]
								// (projects...);
								// -R: Build for run-time;
								// -J: Build for jit-time;
								// -T: Build for tests;
								// -B: Build for build-time;
								// (The switch)}
							default:
								throw new IllegalArgumentException(
									String.format("AU0l %s", parse[0]));
						}
					
					// Run the builder
					this.build(space,
						args.<String>toArray(new String[args.size()]));
				}
				break;
				
				// Builds all projects
			case "buildall":
				{
					TimeSpaceType space = TimeSpaceType.RUNTIME;
					
					// Try to determine the timespace to use, which determines
					// the available projects
					String[] parse;
					while (null != (parse = __getopts(":?rjtbRJTB", args)))
						switch (parse[0])
						{
							case "r":
							case "R":
								space = TimeSpaceType.RUNTIME;
								break;
							
							case "j":
							case "J":
								space = TimeSpaceType.JIT;
								break;
								
							case "t":
							case "T":
								space = TimeSpaceType.TEST;
								break;
							
							case "b":
							case "B":
								space = TimeSpaceType.BUILD;
								break;
							
								// {@squirreljme.error AU0m Unknown argument.
								// Usage: build [-R] [-J] [-T] [-B]
								// (projects...);
								// -R: Build for run-time;
								// -J: Build for jit-time;
								// -T: Build for tests;
								// -B: Build for build-time;
								// (The switch)}
							default:
								throw new IllegalArgumentException(
									String.format("AU0m %s", parse[0]));
						}
					
					// Run the builder
					this.buildAll(space,
						args.<String>toArray(new String[args.size()]));
				}
				break;
				
				// Build distribution
			case "dist":
				this.dist(args.<String>toArray(new String[args.size()]));
				break;
			
			case "lsdist":
			case "distlist":
			case "dist-list":
				this.distList();
				break;
				
				// Build all distributions
			case "distall":
			case "dist-all":
				this.distAll(args.<String>toArray(new String[args.size()]));
				break;
				
				// Generate all of the JavaDoc
			case "javadoc":
				this.javaDoc(args.<String>toArray(new String[args.size()]));
				break;
				
				// Launch project within a VM
			case "launch":
				this.launch(args.<String>toArray(new String[args.size()]));
				break;
				
				// Perform SDK actions
			case "sdk":
				this.sdk(args.<String>toArray(new String[args.size()]));
				break;
				
				// Perform suite related operations
			case "suite":
				this.suite(args.<String>toArray(new String[args.size()]));
				break;
				
				// Perform task related operations
			case "task":
				this.task(args.<String>toArray(new String[args.size()]));
				break;
				
				// Shade VM provided JAR
			case "vmshade":
			case "vmshaded":
			case "shadevm":
			case "shadedvm":
				this.vmShade(args.<String>toArray(new String[args.size()]));
				break;
				
				// {@squirreljme.error AU0n Unknown command specified.
				// Usage: command (command arguments...);
				// Valid commands are:
				// build, javadoc, launch, sdk, suite, task, vmshade
				// .(The switch)}
			default:
				throw new IllegalArgumentException(String.format("AU0n %s",
					command));
		}
	}
	
	/**
	 * Returns the source manager to use for source code retrieval.
	 *
	 * @param __t The timespace to build for.
	 * @return The manager for the given timespace.
	 * @throws IOException On read errors.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/11/16
	 */
	public SourceManager sourceManager(TimeSpaceType __t)
		throws IOException, NullPointerException
	{
		return this.projectmanager.sourceManager(__t);
	}
	
	/**
	 * Performs SDK related actions.
	 *
	 * @param __args Arguments to the SDK command.
	 * @since 2018/01/27
	 */
	public void sdk(String... __args)
	{
		try
		{
			new SDKFactory(this.binaryManager(TimeSpaceType.JIT), __args).
				run();
		}
		
		// {@squirreljme.error AU0o Could not initialize the SDK factory.}
		catch (IOException e)
		{
			throw new RuntimeException("AU0o", e);
		}
	}
	
	/**
	 * Performs suite related operations.
	 *
	 * @param __args Arguments to the suite command.
	 * @since 2017/12/08
	 */
	public void suite(String... __args)
	{
		new SuiteFactory(__args).run();
	}
	
	/**
	 * Performs task related operations.
	 *
	 * @param __args Arguments to the task commands.
	 * @since 2017/12/05
	 */
	public void task(String... __args)
	{
		new TaskFactory(__args).run();
	}
	
	/**
	 * Shaded VM output.
	 *
	 * @param __args Shader arguments.
	 * @since 2018/12/22
	 */
	public void vmShade(String... __args)
	{
		// Copy arguments for processing
		Deque<String> args = new ArrayDeque<>();
		if (__args != null)
			for (String a : __args)
				if (a != null)
					args.addLast(a);
		
		// Bootstrap JAR path, for bootstrap variants (not pure ME)
		Path bootstrapjar = Paths.get("bootsjme", "javase-runtime.jar");
		
		// Build with the bootstrap?
		boolean withbootstrap = false;
		
		// Override the timespace?
		ProjectManager pm = this.projectmanager;
		TimeSpaceType pmts = TimeSpaceType.RUNTIME;
		
		// Determine how shading is to be handled
		String[] parse;
		while (null != (parse = __getopts(":?p:bRJTB", args)))
			switch (parse[0])
			{
					// Bootstrap path
				case "p":
					bootstrapjar = Paths.get(parse[1]);
					break;
					
					// Build with bootstrap JAR
				case "b":
					withbootstrap = true;
					break;
					
					// Use run-time timespace
				case "R":
					pmts = TimeSpaceType.RUNTIME;
					break;
					
					// Use JIT timespace
				case "J":
					pmts = TimeSpaceType.JIT;
					break;
					
					// Use test timespace
				case "T":
					pmts = TimeSpaceType.TEST;
					break;
					
					// Use build timespace
				case "B":
					pmts = TimeSpaceType.BUILD;
					break;
				
					// {@squirreljme.error AU0p Unknown argument.
					// Usage: vmshade [-b JAR] [output];
					// -p: Bootstrap JAR Path, defaults to
					// {@code bootsjme/javase-runtime.jar};
					// -b: Build and include the bootstrap;
					// -R: Build with run-time level (the default);
					// -J: Build with jit-time level;
					// -T: Build with tests level;
					// -B: Build with build-time level;
					// (The switch)}
				case "?":
				default:
					throw new IllegalArgumentException(
						String.format("AU0p %s", parse[0]));
			}
		
		// Output file name, which is optional
		String outfile = args.pollFirst();
		if (outfile == null)
			outfile = "squirreljme.jar";
		
		// Need to write to temporary to not kludge files
		Path tempfile = null;
		try
		{
			// Need a temporary file
			tempfile = Files.createTempFile("squirreljme-shaded", ".ja_");
			
			// Write to temporary stream first
			try (OutputStream out = Files.newOutputStream(tempfile,
				StandardOpenOption.CREATE,
				StandardOpenOption.WRITE,
				StandardOpenOption.TRUNCATE_EXISTING))
			{
				Shader.shade(pm, pmts, withbootstrap, bootstrapjar, out);
			}
			
			// Move the file to the output since it was built!
			Files.move(tempfile, Paths.get(outfile),
				StandardCopyOption.REPLACE_EXISTING);
		}
		catch (IOException e)
		{
			// {@squirreljme.error AU0q Could not build the shaded JAR.}
			throw new RuntimeException("AU0q", e);
		}
		finally
		{
			// Delete temporary file if there is one
			if (tempfile != null)
				try
				{
					Files.delete(tempfile);
				}
				catch (IOException e)
				{
					// Ignore
				}
		}
	}
	
	/**
	 * This is mostly similar to the way the POSIX getopts works but with
	 * some limitations.
	 *
	 * @param __optstring The option string, these are single characters. If a
	 * colon is placed after a character then
	 * @param __q The input command line argument queue.
	 * @return The switch which was parsed, it's character followed by the
	 * argument if there is one; {@code null} is returned when there are no
	 * arguments to parse. If the starting character is a colon then unknown
	 * arguments will return a question mark rather than failing.
	 * @throws IllegalArgumentException If an option requires an argument and
	 * it was not specified.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/11/16
	 */
	static String[] __getopts(String __optstring, Queue<String> __q)
		throws IllegalArgumentException, NullPointerException
	{
		if (__optstring == null || __q == null)
			throw new NullPointerException("NARG");
		
		// No more arguments
		if (__q.isEmpty())
			return null;
		
		// Indicate the failed switch
		boolean colonfail = false;
		if (__optstring.startsWith(":"))
		{
			__optstring = __optstring.substring(1);
			colonfail = true;
		}
		int optstrlen = __optstring.length();
		
		// Peek the next argument
		String peek = __q.peek();
		
		// Stop parsing arguments, or nothing to parse
		if (peek.equals("--") || !peek.startsWith("-"))
			return null;
		
		// Parse switch 
		for (int i = 1, n = peek.length(); i < n; i++)
		{
			char c = peek.charAt(i);
			
			// Find the option in the option string
			int odx = __optstring.indexOf(c);
			if (odx < 0)
				return (colonfail ? new String[]{"?", Character.toString(c)} :
					new String[]{"?"});
			
			// Is an argument desired?
			boolean wantsarg = false;
			if (odx + 1 < optstrlen)
				wantsarg = (__optstring.charAt(odx + 1) == ':');
			
			// At this point the argument is consumed
			__q.remove();
			
			// Wants an argument?
			String rva = Character.toString(c);
			if (wantsarg)
			{
				// If this is the last argument then the value is passed
				// in the following switch
				if (i == n - 1)
				{
					// {@squirreljme.error AU0r The specified option argument
					// requires a value set to it. (The option argument)}
					String next = __q.peek();
					if (next == null)
						throw new IllegalArgumentException(
							String.format("AU0r %c", c));
					
					return new String[]{rva, __q.remove()};
				}
				
				// Otherwise it is just anything after the sequence
				else
					return new String[]{rva, peek.substring(i + 1)};
			}
			
			// Otherwise return just that switch
			else
				return new String[]{rva};
		}
		
		// Nothing parsed, indicate failure
		return new String[]{"?"};
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


















































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted bldt/libs/builder-support/cc/squirreljme/builder/support/DefinedTests.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.builder.support;

/**
 * This contains the tests which are defined in total for a given project.
 *
 * @since 2018/03/19
 */
@Deprecated
public final class DefinedTests
{
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<












































Deleted bldt/libs/builder-support/cc/squirreljme/builder/support/InvalidBinaryException.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.builder.support;

/**
 * This is thrown when the specified binary is not valid.
 *
 * @since 2017/11/03
 */
public class InvalidBinaryException
	extends ProjectException
{
	/**
	 * Initialize the exception with no message or cause.
	 *
	 * @since 2017/11/03
	 */
	public InvalidBinaryException()
	{
	}
	
	/**
	 * Initialize the exception with a message and no cause.
	 *
	 * @param __m The message.
	 * @since 2017/11/03
	 */
	public InvalidBinaryException(String __m)
	{
		super(__m);
	}
	
	/**
	 * Initialize the exception with a message and cause.
	 *
	 * @param __m The message.
	 * @param __c The cause.
	 * @since 2017/11/03
	 */
	public InvalidBinaryException(String __m, Throwable __c)
	{
		super(__m, __c);
	}
	
	/**
	 * Initialize the exception with no message and with a cause.
	 *
	 * @param __c The cause.
	 * @since 2017/11/03
	 */
	public InvalidBinaryException(Throwable __c)
	{
		super(__c);
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
































































































































Deleted bldt/libs/builder-support/cc/squirreljme/builder/support/InvalidDependencyException.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.builder.support;

/**
 * This is thrown when the dependency for a project is not valid.
 *
 * @since 2017/11/21
 */
public class InvalidDependencyException
	extends ProjectException
{
	/**
	 * Initialize the exception with no message or cause.
	 *
	 * @since 2017/11/21
	 */
	public InvalidDependencyException()
	{
	}
	
	/**
	 * Initialize the exception with a message and no cause.
	 *
	 * @param __m The message.
	 * @since 2017/11/21
	 */
	public InvalidDependencyException(String __m)
	{
		super(__m);
	}
	
	/**
	 * Initialize the exception with a message and cause.
	 *
	 * @param __m The message.
	 * @param __c The cause.
	 * @since 2017/11/21
	 */
	public InvalidDependencyException(String __m, Throwable __c)
	{
		super(__m, __c);
	}
	
	/**
	 * Initialize the exception with no message and with a cause.
	 *
	 * @param __c The cause.
	 * @since 2017/11/21
	 */
	public InvalidDependencyException(Throwable __c)
	{
		super(__c);
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
































































































































Deleted bldt/libs/builder-support/cc/squirreljme/builder/support/InvalidSourceException.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.builder.support;

/**
 * This is thrown when the source project is not valid.
 *
 * @since 2017/10/31
 */
public class InvalidSourceException
	extends ProjectException
{
	/**
	 * Initialize the exception with no message or cause.
	 *
	 * @since 2017/10/31
	 */
	public InvalidSourceException()
	{
	}
	
	/**
	 * Initialize the exception with a message and no cause.
	 *
	 * @param __m The message.
	 * @since 2017/10/31
	 */
	public InvalidSourceException(String __m)
	{
		super(__m);
	}
	
	/**
	 * Initialize the exception with a message and cause.
	 *
	 * @param __m The message.
	 * @param __c The cause.
	 * @since 2017/10/31
	 */
	public InvalidSourceException(String __m, Throwable __c)
	{
		super(__m, __c);
	}
	
	/**
	 * Initialize the exception with no message and with a cause.
	 *
	 * @param __c The cause.
	 * @since 2017/10/31
	 */
	public InvalidSourceException(Throwable __c)
	{
		super(__c);
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
































































































































Deleted bldt/libs/builder-support/cc/squirreljme/builder/support/InvalidSourceNameException.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.builder.support;


/**
 * This is thrown when the name of a given source is not valid.
 *
 * @since 2017/10/31
 */
public class InvalidSourceNameException
	extends InvalidSourceException
{
	/**
	 * Initialize the exception with no message or cause.
	 *
	 * @since 2017/10/31
	 */
	public InvalidSourceNameException()
	{
	}
	
	/**
	 * Initialize the exception with a message and no cause.
	 *
	 * @param __m The message.
	 * @since 2017/10/31
	 */
	public InvalidSourceNameException(String __m)
	{
		super(__m);
	}
	
	/**
	 * Initialize the exception with a message and cause.
	 *
	 * @param __m The message.
	 * @param __c The cause.
	 * @since 2017/10/31
	 */
	public InvalidSourceNameException(String __m, Throwable __c)
	{
		super(__m, __c);
	}
	
	/**
	 * Initialize the exception with no message and with a cause.
	 *
	 * @param __c The cause.
	 * @since 2017/10/31
	 */
	public InvalidSourceNameException(Throwable __c)
	{
		super(__c);
	}
}


<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




































































































































Deleted bldt/libs/builder-support/cc/squirreljme/builder/support/NoSourceAvailableException.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.builder.support;

/**
 * This is thrown when source code is not available during compilation.
 *
 * @since 2019/05/02
 */
public class NoSourceAvailableException
	extends InvalidBinaryException
{
	/**
	 * Initialize the exception with no message or cause.
	 *
	 * @since 2019/05/02
	 */
	public NoSourceAvailableException()
	{
	}
	
	/**
	 * Initialize the exception with a message and no cause.
	 *
	 * @param __m The message.
	 * @since 2019/05/02
	 */
	public NoSourceAvailableException(String __m)
	{
		super(__m);
	}
	
	/**
	 * Initialize the exception with a message and cause.
	 *
	 * @param __m The message.
	 * @param __c The cause.
	 * @since 2019/05/02
	 */
	public NoSourceAvailableException(String __m, Throwable __c)
	{
		super(__m, __c);
	}
	
	/**
	 * Initialize the exception with no message and with a cause.
	 *
	 * @param __c The cause.
	 * @since 2019/05/02
	 */
	public NoSourceAvailableException(Throwable __c)
	{
		super(__c);
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






























































































































Deleted bldt/libs/builder-support/cc/squirreljme/builder/support/NoSuchBinaryException.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.builder.support;

/**
 * This is thrown when the specified binary does not exist.
 *
 * @since 2017/11/02
 */
public class NoSuchBinaryException
	extends InvalidBinaryException
{
	/**
	 * Initialize the exception with no message or cause.
	 *
	 * @since 2017/11/02
	 */
	public NoSuchBinaryException()
	{
	}
	
	/**
	 * Initialize the exception with a message and no cause.
	 *
	 * @param __m The message.
	 * @since 2017/11/02
	 */
	public NoSuchBinaryException(String __m)
	{
		super(__m);
	}
	
	/**
	 * Initialize the exception with a message and cause.
	 *
	 * @param __m The message.
	 * @param __c The cause.
	 * @since 2017/11/02
	 */
	public NoSuchBinaryException(String __m, Throwable __c)
	{
		super(__m, __c);
	}
	
	/**
	 * Initialize the exception with no message and with a cause.
	 *
	 * @param __c The cause.
	 * @since 2017/11/02
	 */
	public NoSuchBinaryException(Throwable __c)
	{
		super(__c);
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
































































































































Deleted bldt/libs/builder-support/cc/squirreljme/builder/support/NoSuchSourceException.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.builder.support;

/**
 * This is thrown when the specified source project does not exist.
 *
 * @since 2017/10/31
 */
public class NoSuchSourceException
	extends InvalidSourceException
{
	/**
	 * Initialize the exception with no message or cause.
	 *
	 * @since 2017/10/31
	 */
	public NoSuchSourceException()
	{
	}
	
	/**
	 * Initialize the exception with a message and no cause.
	 *
	 * @param __m The message.
	 * @since 2017/10/31
	 */
	public NoSuchSourceException(String __m)
	{
		super(__m);
	}
	
	/**
	 * Initialize the exception with a message and cause.
	 *
	 * @param __m The message.
	 * @param __c The cause.
	 * @since 2017/10/31
	 */
	public NoSuchSourceException(String __m, Throwable __c)
	{
		super(__m, __c);
	}
	
	/**
	 * Initialize the exception with no message and with a cause.
	 *
	 * @param __c The cause.
	 * @since 2017/10/31
	 */
	public NoSuchSourceException(Throwable __c)
	{
		super(__c);
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
































































































































Deleted bldt/libs/builder-support/cc/squirreljme/builder/support/OutOfDateBinaryException.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.builder.support;

/**
 * This is thrown when the specified binary is not valid.
 *
 * @since 2017/11/29
 */
public class OutOfDateBinaryException
	extends InvalidBinaryException
{
	/**
	 * Initialize the exception with no message or cause.
	 *
	 * @since 2017/11/29
	 */
	public OutOfDateBinaryException()
	{
	}
	
	/**
	 * Initialize the exception with a message and no cause.
	 *
	 * @param __m The message.
	 * @since 2017/11/29
	 */
	public OutOfDateBinaryException(String __m)
	{
		super(__m);
	}
	
	/**
	 * Initialize the exception with a message and cause.
	 *
	 * @param __m The message.
	 * @param __c The cause.
	 * @since 2017/11/29
	 */
	public OutOfDateBinaryException(String __m, Throwable __c)
	{
		super(__m, __c);
	}
	
	/**
	 * Initialize the exception with no message and with a cause.
	 *
	 * @param __c The cause.
	 * @since 2017/11/29
	 */
	public OutOfDateBinaryException(Throwable __c)
	{
		super(__c);
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
































































































































Deleted bldt/libs/builder-support/cc/squirreljme/builder/support/ProjectException.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.builder.support;

/**
 * This exception is thrown when there is a problem with the project system.
 *
 * @since 2017/10/31
 */
public class ProjectException
	extends RuntimeException
{
	/**
	 * Initialize the exception with no message or cause.
	 *
	 * @since 2017/10/31
	 */
	public ProjectException()
	{
	}
	
	/**
	 * Initialize the exception with a message and no cause.
	 *
	 * @param __m The message.
	 * @since 2017/10/31
	 */
	public ProjectException(String __m)
	{
		super(__m);
	}
	
	/**
	 * Initialize the exception with a message and cause.
	 *
	 * @param __m The message.
	 * @param __c The cause.
	 * @since 2017/10/31
	 */
	public ProjectException(String __m, Throwable __c)
	{
		super(__m, __c);
	}
	
	/**
	 * Initialize the exception with no message and with a cause.
	 *
	 * @param __c The cause.
	 * @since 2017/10/31
	 */
	public ProjectException(Throwable __c)
	{
		super(__c);
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
































































































































Deleted bldt/libs/builder-support/cc/squirreljme/builder/support/ProjectManager.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.builder.support;

import java.io.InputStream;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.NoSuchFileException;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardOpenOption;
import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.Deque;
import java.util.LinkedHashSet;
import java.util.Queue;
import java.util.Set;
import net.multiphasicapps.io.MIMEFileDecoder;
import net.multiphasicapps.strings.StringUtils;

/**
 * This class is used to initialize and setup source and binary project
 * representations in a common means which does not require
 * {@link BuilderFactory} to be initialized to have a shared setup of the
 * project state.
 *
 * @since 2018/07/29
 */
public final class ProjectManager
{
	/** The directory for the project root (source code). */
	protected final Path sourceroot;
	
	/** The default timespace to use for projects. */
	protected final TimeSpaceType deftimespace;
	
	/** The directory for each timespace binaries. */
	private final Path[] _bin;
	
	/** The source managers for each timespace. */
	private final SourceManager[] _sourcemanagers =
		new SourceManager[TimeSpaceType.values().length];
	
	/** Binary managers for each timespace. */
	private final BinaryManager[] _binarymanagers =
		new BinaryManager[TimeSpaceType.values().length];
	
	/**
	 * Initializes the project manager.
	 *
	 * @param __sr The source root.
	 * @param __brs The binary output roots.
	 * @param __dts Default time space.
	 * @throws IllegalArgumentException If the binary outputs does not match
	 * the number of available timespaces.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/07/29
	 */
	public ProjectManager(Path __sr, Path[] __brs, TimeSpaceType __dts)
		throws IllegalArgumentException, NullPointerException
	{
		if (__sr == null || __brs == null || __dts == null)
			throw new NullPointerException("NARG");
		
		// {@squirreljme.error AU0s Binary paths array count does not match
		// the number of time spaces available.}
		if (__brs.length != TimeSpaceType.values().length)
			throw new IllegalArgumentException("AU0s");
		
		// These cannot be null, that would be bad
		for (Path p : (__brs = __brs.clone()))
			if (p == null)
				throw new NullPointerException("NARG");
		
		this.sourceroot = __sr;
		this._bin = __brs;
		this.deftimespace = __dts;
	}
	
	/**
	 * Initializes a binary manager using the default timespace.
	 *
	 * @return The binary manager with the default timespace.
	 * @throws IOException On read errors.
	 * @since 2018/12/22
	 */
	public BinaryManager binaryManager()
		throws IOException
	{
		return this.binaryManager(this.deftimespace);
	}
	
	/**
	 * Returns the binary manager to use for binary project retrieval.
	 *
	 * @param __t The timespace to build for.
	 * @return The manager for the given timespace.
	 * @throws IOException On read errors.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/11/16
	 */
	public BinaryManager binaryManager(TimeSpaceType __t)
		throws IOException, NullPointerException
	{
		if (__t == null)
			throw new NullPointerException("NARG");
		
		int i = __t.ordinal();
		BinaryManager[] binarymanagers = this._binarymanagers;
		BinaryManager rv = binarymanagers[i];
		if (rv == null)
			binarymanagers[i] =
				(rv = new BinaryManager(this._bin[i], sourceManager(__t)));
		return rv;
	}
	
	/**
	 * Builds the specified projects using the default time-space.
	 *
	 * @param __p The projects to be built.
	 * @return The binaries which are associated with the given project.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/12/22
	 */
	public Binary[] build(String... __p)
		throws NullPointerException
	{
		return this.build(this.deftimespace, __p);
	}
	
	/**
	 * Builds the specified projects.
	 *
	 * @param __t The timespace to use for projects.
	 * @param __p The projects to be built.
	 * @return The binaries which are associated with the given project.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/11/16
	 */
	public Binary[] build(TimeSpaceType __t, String... __p)
		throws NullPointerException
	{
		if (__t == null || __p == null)
			throw new NullPointerException("NARG");
		
		// Need the binary manager to build these projects
		BinaryManager bm;
		try
		{
			bm = this.binaryManager(__t);
		}
		
		// {@squirreljme.error AU0t Could not obtain the binary manager.}
		catch (IOException e)
		{
			throw new RuntimeException("AU0t", e);
		}
		
		// Get binaries
		int n = __p.length;
		Binary[] bins = new Binary[n];
		for (int i = 0; i < n; i++)
			bins[i] = bm.get(__p[i]);
		
		// Do not return duplicate binaries
		Set<Binary> rv = new LinkedHashSet<>();
		
		// Compile all of the project and return required class path for
		// it to operate
		for (Binary i : bins)
			for (Binary b : bm.compile(i))
				rv.add(b);
		
		// Return the completed set
		return rv.<Binary>toArray(new Binary[rv.size()]);
	}
	
	/**
	 * Builds every binary.
	 *
	 * @param __t The timespace to use.
	 * @return All of the built binaries.
	 * @since 2019/04/14
	 */
	public final Binary[] buildAll(TimeSpaceType __t)
	{
		Set<Binary> bin = new LinkedHashSet<>();
		
		try
		{
			// Build everything
			BinaryManager bm = this.binaryManager(__t);
			for (Binary b : bm)
				for (Binary x : bm.compile(b))
					bin.add(x);
		}
		catch (IOException e)
		{
			throw new RuntimeException(e);
		}
		
		return bin.<Binary>toArray(new Binary[bin.size()]);
	}
	
	/**
	 * Returns the class path for the given projects.
	 *
	 * @param __p The projects to lookup.
	 * @return The class path for the projects.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/05/05
	 */
	public final Binary[] classPath(String... __p)
		throws NullPointerException
	{
		return this.classPath(this.deftimespace, __p);
	}
	
	/**
	 * Returns the class path for the given projects in the given timespace.
	 *
	 * @param __t The timespace to use.
	 * @param __p The projects to lookup.
	 * @return The class path for the projects.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/05/05
	 */
	public final Binary[] classPath(TimeSpaceType __t, String... __p)
		throws NullPointerException
	{
		if (__t == null || __p == null)
			throw new NullPointerException("NARG");
		
		// Need the binary manager to get the class path for these
		BinaryManager bm;
		try
		{
			bm = this.binaryManager(__t);
		}
		
		// {@squirreljme.error AU0u Could not obtain the binary manager.}
		catch (IOException e)
		{
			throw new RuntimeException("AU0u", e);
		}
		
		// Get binaries
		int n = __p.length;
		Binary[] bins = new Binary[n];
		for (int i = 0; i < n; i++)
			bins[i] = bm.get(__p[i]);
		
		// Do not return duplicate binaries
		Set<Binary> rv = new LinkedHashSet<>();
		
		// Compile all of the project and return required class path for
		// it to operate
		for (Binary i : bins)
			for (Binary b : bm.classPath(i))
				rv.add(b);
		
		// Return the completed set
		return rv.<Binary>toArray(new Binary[rv.size()]);
	}
	
	/**
	 * Opens the given root file from the source tree. This also handles MIME
	 * encoded files if they exist and decodes them accordingly.
	 *
	 * @param __fn The filename to open.
	 * @return The input file or {@code null} if it does not exist.
	 * @throws IOException On read errors.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/12/23
	 */
	public final InputStream rootFile(String __fn)
		throws IOException, NullPointerException
	{
		if (__fn == null)
			throw new NullPointerException("NARG");
		
		// Handle slashes and 
		Path sourceroot = this.sourceroot,
			open = sourceroot;
		for (String s : StringUtils.basicSplit('/', __fn))
			open = open.resolve(s);
		
		// Try to open a MIME file first and decode that
		try
		{
			return new MIMEFileDecoder(Files.newInputStream(
				open.resolveSibling(open.getFileName() + ".__mime"),
				StandardOpenOption.READ));
		}
		catch (NoSuchFileException e)
		{
			// Otherwise just use a normal file
			try
			{
				return Files.newInputStream(open,
					StandardOpenOption.READ);
			}
			catch (NoSuchFileException f)
			{
				// Does not exist
				return null;
			}
		}
	}
	
	/**
	 * Initializes a source manager using the default timespace.
	 *
	 * @return The source manager with the default timespace.
	 * @throws IOException On read errors.
	 * @since 2018/12/22
	 */
	public SourceManager sourceManager()
		throws IOException
	{
		return this.sourceManager(this.deftimespace);
	}
	
	/**
	 * Returns the source manager to use for source code retrieval.
	 *
	 * @param __t The timespace to build for.
	 * @return The manager for the given timespace.
	 * @throws IOException On read errors.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/11/16
	 */
	public SourceManager sourceManager(TimeSpaceType __t)
		throws IOException, NullPointerException
	{
		if (__t == null)
			throw new NullPointerException("NARG");
		
		int i = __t.ordinal();
		SourceManager[] sourcemanagers = this._sourcemanagers;
		SourceManager rv = sourcemanagers[i];
		if (rv == null)
			sourcemanagers[i] =
				(rv = new SourceManagerFactory(this.sourceroot).get(__t));
		return rv;
	}
	
	/**
	 * Initializes a project manager from the given arguments.
	 *
	 * @param __args The arguments to use.
	 * @return The project manager which was initialized.
	 * @since 2018/07/29
	 */
	public static ProjectManager fromArguments(String... __args)
	{
		// Copy arguments for processing
		Queue<String> args = new ArrayDeque<>();
		if (__args != null)
			for (String a : __args)
				if (a != null)
					args.add(a);
		
		// Forward it
		return ProjectManager.fromArguments(args);
	}
	
	/**
	 * Initializes the project manager from the given queue of arguments.
	 *
	 * @param __args The arguments to parse.
	 * @return The project manager parsed from the given arguments.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/07/29
	 */
	public static ProjectManager fromArguments(Queue<String> __args)
		throws NullPointerException
	{
		if (__args == null)
			throw new NullPointerException("NARG");
		
		// Use default paths based on system properties
		Path sourceroot = Paths.get(
			System.getProperty("cc.squirreljme.builder.root",
				System.getProperty("user.dir", "squirreljme"))),
			binroot = Paths.get(
				System.getProperty(
					"cc.squirreljme.builder.output", "bins")),
			binruntime = null,
			binjit = null,
			bintest = null,
			binbuild = null;
		
		// Default timespace? Default to the build for compatibility purposes
		// since everything does that
		TimeSpaceType deftimespace = TimeSpaceType.BUILD;
		
		// Allow paths to be modified
		String[] parse;
		while (null != (parse = BuilderFactory.__getopts(
			":?RJTBs:o:j:t:b:", __args)))
			switch (parse[0])
			{
					// Change source code root
				case "s":
					sourceroot = Paths.get(parse[1]);
					break;
					
					// Change binary output base root
				case "o":
					binroot = Paths.get(parse[1]);
					break;
					
					// Run-time build path
				case "r":
					binruntime = Paths.get(parse[1]);
					break;
					
					// JIT-time build path
				case "j":
					binjit = Paths.get(parse[1]);
					break;
					
					// Test-time build path
				case "t":
					bintest = Paths.get(parse[1]);
					break;
					
					// Build-time build path
				case "b":
					binbuild = Paths.get(parse[1]);
					break;
					
					// Default RUNTIME
				case "R":
					deftimespace = TimeSpaceType.RUNTIME;
					break;
					
					// Default JIT
				case "J":
					deftimespace = TimeSpaceType.JIT;
					break;
					
					// Default Tests
				case "T":
					deftimespace = TimeSpaceType.TEST;
					break;
					
					// Default build time
				case "B":
					deftimespace = TimeSpaceType.BUILD;
					break;
				
					// {@squirreljme.error AU0v Unknown project argument.
					// Usage: [-s path] [-o path] [-r path] [-j path]
					// [-b path];
					// -s: The project source path;
					// -o: The base directory for binary output;
					// -r: The binary path for the run-time;
					// -j: The binary path for the jit-time;
					// -t: The binary path for the tests;
					// -b: The binary path for the build-time;
					// -R: Default timespace is run-time;
					// -J: Default timespace is JIT;
					// -T: Default timespace is tests;
					// -B: Default timespace is build-time}
				case "?":
				default:
					throw new IllegalArgumentException(
						String.format("AU0v %s", parse[0]));
			}
		
		// Fill with defaults if missing
		if (binruntime == null)
			binruntime = binroot.resolve("brun");
		if (binjit == null)
			binjit = binroot.resolve("bjit");
		if (bintest == null)
			bintest = binroot.resolve("btst");
		if (binbuild == null)
			binbuild = binroot.resolve("bbld");
		
		// Set paths
		return new ProjectManager(sourceroot,
			new Path[]{binruntime, binjit, bintest, binbuild}, deftimespace);
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted bldt/libs/builder-support/cc/squirreljme/builder/support/ProjectType.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.builder.support;

/**
 * This represents the type of library or application that the project is, this
 * determines how it is used and depended upon.
 *
 * @since 2017/10/31
 */
public enum ProjectType
{
	/** APIs which implement configurations, profiles, and standards. */
	API,
	
	/** Liblets which are only included by midlets and APIs. */
	LIBLET,
	
	/** Midlets which are actual applications. */
	MIDLET,
	
	/** End. */
	;
	
	/**
	 * Returns the type of project that should be returned.
	 *
	 * @param __s The string to get the project type for.
	 * @return The project type or {@code null} if it is not valid.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/10/31
	 */
	public static ProjectType ofString(String __s)
		throws NullPointerException
	{
		if (__s == null)
			throw new NullPointerException("NARG");
		
		// Depends
		switch (__s)
		{
			case "api":		return API;
			case "liblet":	return LIBLET;
			case "midlet":	return MIDLET;
			
			default:
				return null;
		}
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






















































































































Deleted bldt/libs/builder-support/cc/squirreljme/builder/support/SDKFactory.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.builder.support;

import java.io.PrintStream;
import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.Deque;

/**
 * This goes through all of the projects and builds the SDK which is used as
 * a base for programs in SquirrelJME.
 *
 * There is the user SDK which only has specific packages which may be
 * referred to. In general, most programs will always use this.
 *
 * Additionally there is the proprietary SDK which can be used if one wants
 * to access the internal classes that exist.
 *
 * @since 2018/01/27
 */
public class SDKFactory
	implements Runnable
{
	/** The binary manager since they need to be accessed for building. */
	protected final BinaryManager binarymanager;
	
	/** The command to execute. */
	protected final String command;
	
	/** Arguments to the task command. */
	private final String[] _args;
	
	/**
	 * Initializes the factory.
	 *
	 * @param __bl The binary manager.
	 * @param __args factory arguments.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/01/27
	 */
	public SDKFactory(BinaryManager __bm, String... __args)
		throws NullPointerException
	{
		if (__bm == null)
			throw new NullPointerException("NARG");
		
		this.binarymanager = __bm;
		
		// Copy arguments for processing
		Deque<String> args = new ArrayDeque<>();
		if (__args != null)
			for (String a : __args)
				if (a != null)
					args.addLast(a);
		
		// {@squirreljme.error AU0w Expected command for SDK operation.}
		String command = args.pollFirst();
		if (command == null)
			throw new IllegalArgumentException("AU0w");
		this.command = command;
		
		// Use remaining arguments as input
		this._args = args.<String>toArray(new String[args.size()]);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/01/27
	 */
	@Override
	public void run()
	{
		// Load arguments into a queue
		Deque<String> args =
			new ArrayDeque<>(Arrays.<String>asList(this._args));
		
		// Depends on the command
		String command = this.command;
		switch (command)
		{
				// Build user SDK (publically available classes)
			case "build":
				throw new todo.TODO();
				
				// Build internal SDK (all classes)
			case "internal":
				throw new todo.TODO();
				
				// {@squirreljme.error AU0x The specified sdk command is not
				// valid. Valid commands are:
				// build, internal
				// .(The command)}
			case "help":
			default:
				throw new IllegalArgumentException(String.format("AU0x %s",
					command));
		}
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


























































































































































































































Deleted bldt/libs/builder-support/cc/squirreljme/builder/support/Source.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.builder.support;

import cc.squirreljme.runtime.swm.InvalidSuiteException;
import cc.squirreljme.runtime.swm.SuiteInfo;
import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import java.util.Map;
import net.multiphasicapps.javac.ByteArrayCompilerInput;
import net.multiphasicapps.javac.CompilerInput;
import net.multiphasicapps.javac.CompilerPathSet;
import net.multiphasicapps.javac.MergedPathSet;
import net.multiphasicapps.strings.StringUtils;
import net.multiphasicapps.tool.manifest.JavaManifest;
import net.multiphasicapps.tool.manifest.JavaManifestAttributes;
import net.multiphasicapps.tool.manifest.JavaManifestKey;
import net.multiphasicapps.tool.manifest.writer.MutableJavaManifest;
import net.multiphasicapps.tool.manifest.writer.MutableJavaManifestAttributes;

/**
 * This represents a single source project which contains the source code for
 * a single project.
 *
 * @since 2017/10/31
 */
public abstract class Source
{
	/** The name of this project. */
	protected final SourceName name;
	
	/** The type of project this is. */
	protected final ProjectType type;
	
	/** The approximate binary manifest. */
	private Reference<JavaManifest> _approxbm;
	
	/** The suite information. */
	private Reference<SuiteInfo> _suiteinfo;
	
	/** Last modified time of the source code. */
	private long _lastmodtime =
		Long.MIN_VALUE;
	
	/**
	 * Initializes the base source.
	 *
	 * @param __n The name of the project.
	 * @param __t The type of project this is.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/03/06
	 */
	public Source(SourceName __n, ProjectType __t)
		throws NullPointerException
	{
		if (__n == null || __t == null)
			throw new NullPointerException("NARG");
		
		this.name = __n;
		this.type = __t;
	}
	
	/**
	 * Returns the path set which is used for the given path set type.
	 *
	 * @param __spst The path set type to get.
	 * @return The path set for the given type.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/04/30
	 */
	public abstract CompilerPathSet pathSet(SourcePathSetType __spst)
		throws NullPointerException;
	
	/**
	 * The source manifest.
	 *
	 * @return The source manifest.
	 * @since 2017/11/17
	 */
	public abstract JavaManifest sourceManifest();
	
	/**
	 * Returns the time that the source code was last modified.
	 *
	 * @return The last modification date of the source code.
	 * @throws IOException On read errors.
	 * @since 2017/11/06
	 */
	public final long lastModifiedTime()
	{
		// Could be pre-cached
		long rv = this._lastmodtime;
		if (rv != Long.MIN_VALUE)
			return rv;
		
		// Go through all input and compare the modified times
		try (CompilerPathSet ps = this.pathSet(SourcePathSetType.SOURCE))
		{
			rv = Long.MIN_VALUE;
			for (CompilerInput ci : ps)
			{
				long now = ci.lastModifiedTime();
				if (now > rv)
					rv = now;
			}
		}
		
		// Cache for next time
		this._lastmodtime = rv;
		return rv;
	}
	
	/**
	 * The approximated manifest which would be used for binary output.
	 *
	 * @return The approximated manifest.
	 * @since 2017/11/17
	 */
	public final JavaManifest manifest()
	{
		Reference<JavaManifest> ref = this._approxbm;
		JavaManifest rv;
		
		if (ref == null || null == (rv = ref.get()))
		{
			// Need the input manifest
			JavaManifest rman = this.sourceManifest();
			JavaManifestAttributes rattr = rman.getMainAttributes();
			MutableJavaManifest wman = new MutableJavaManifest();
			MutableJavaManifestAttributes wattr = wman.getMainAttributes();
			
			// Determine the prefix for the type keys
			ProjectType type = this.type;
			boolean isapi = type == ProjectType.API;
			String prefix = (type == ProjectType.MIDLET ?
				"MIDlet" : "LIBlet");
			
			// Projects might have dependencies, so find the actual base
			// before putting dependencies on top
			int depdx = 1;
			for (; depdx >= 0; depdx++)
				if (!rattr.containsKey(
					new JavaManifestKey(prefix + "-Dependency-" + depdx)))
					break;
			
			// Handle fields for the main attributes
			boolean apidetected = false;
			for (Map.Entry<JavaManifestKey, String> e : rattr.entrySet())
			{
				JavaManifestKey k = e.getKey();
				String v = e.getValue();
				
				// Depends on the key, these are lowercase
				switch (k.toString())
				{
						// Project name
					case "x-squirreljme-name":
						wattr.putValue(prefix + "-Name", v);
						break;
						
						// Project vendor
					case "x-squirreljme-vendor":
						wattr.putValue(prefix + "-Vendor", v);
						break;
						
						// Project version
					case "x-squirreljme-version":
						wattr.putValue(prefix + "-Version", v);
						break;
						
						// Project Description
					case "x-squirreljme-description":
						wattr.putValue(prefix + "-Description", v);
						break;
					
						// Dependencies, these are whitespace separated
					case "x-squirreljme-depends":
						for (String split : StringUtils.basicSplit("\0 \t\r\n",
							v))
							wattr.putValue(
								prefix + "-Dependency-" + (depdx++),
								"proprietary;required;squirreljme.project@" +
									split + ";Stephanie Gawroriski;*");
						break;
						
						// Never copy this flag
					case "x-squirreljme-isapi":
						break;
						
						// Only put API definitions in if these are actual APIs
					case "x-squirreljme-definesconfigurations":
					case "x-squirreljme-definesprofiles":
					case "x-squirreljme-definedstandards":
						if (isapi)
						{
							wattr.put(k, v);
							apidetected = true;
						}
						break;
					
						// Unhandled
					default:
						wattr.put(k, v);
						break;
				}
			}
			
			// Write the project name as it appears in the builder
			wattr.putValue("X-SquirrelJME-InternalProjectName",
				name().toString());
			
			// If an API was detected then flag it
			if (apidetected)
				wattr.putValue("X-SquirrelJME-IsAPI", "true");
			
			// Copy other attributes that may exist
			for (Map.Entry<String, JavaManifestAttributes> e : rman.entrySet())
			{
				// Do not copy the main manifest because that is specially
				// handled before
				String k;
				if (!"".equals((k = e.getKey())))
					wman.put(k,
						new MutableJavaManifestAttributes(e.getValue()));
			}
			
			// Build
			this._approxbm = new WeakReference<>((rv = wman.build()));
		}
		
		return rv;
	}
	
	/**
	 * Returns the name of the source.
	 *
	 * @return The source name.
	 * @since 2017/11/23
	 */
	public final SourceName name()
	{
		return this.name;
	}
	
	/**
	 * Returns the suite information for this source project.
	 *
	 * @return The suite information to use.
	 * @throws InvalidSourceException If the source project is not valid.
	 * @since 2017/12/04
	 */
	public final SuiteInfo suiteInfo()
		throws InvalidSourceException
	{
		Reference<SuiteInfo> ref = this._suiteinfo;
		SuiteInfo rv;
		
		if (ref == null || null == (rv = ref.get()))
			try
			{
				this._suiteinfo = new WeakReference<>(
					(rv = new SuiteInfo(this.manifest())));
			}
			
			// {@squirreljme.error AU0y Could not approximate the binary
			// suite information. (The name of the project)}
			catch (InvalidSuiteException e)
			{
				throw new InvalidSourceException(
					String.format("AU0y %s", this.name), e);
			}
		
		return rv;
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
























































































































































































































































































































































































































































































































































































Deleted bldt/libs/builder-support/cc/squirreljme/builder/support/SourceManager.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.builder.support;

import java.io.InputStream;
import java.io.IOException;
import java.nio.file.DirectoryStream;
import java.nio.file.Files;
import java.nio.file.NoSuchFileException;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardOpenOption;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import net.multiphasicapps.collections.SortedTreeMap;
import net.multiphasicapps.collections.SortedTreeSet;
import net.multiphasicapps.collections.UnmodifiableCollection;
import net.multiphasicapps.tool.manifest.JavaManifest;
import net.multiphasicapps.tool.manifest.JavaManifestAttributes;

/**
 * This class is used to provide access to source code that is available as
 * compilation sources.
 *
 * @since 2017/10/31
 */
public final class SourceManager
	implements Iterable<Source>
{
	/** The timespace used. */
	protected final TimeSpaceType timespace;
	
	/** Sources which are available. */
	private final Map<SourceName, Source> _sources;
	
	/**
	 * Initializes the source code manager.
	 *
	 * @param __t The timespace.
	 * @param __roots The root directories which contain namespaces where
	 * source projects are located.
	 * @throws IOException On read errors.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/10/31
	 */
	public SourceManager(TimeSpaceType __t, Path... __roots)
		throws IOException, NullPointerException
	{
		if (__roots == null)
			throw new NullPointerException("NARG");
		
		this.timespace = __t;
		
		// Go through all the roots and detect the namespaces which are
		// valid
		Map<ProjectType, Set<Path>> namespaces = new SortedTreeMap<>();
		for (Path p : __roots)
			__scanNamespaces(p, namespaces);
		
		// Debug
		todo.DEBUG.note("Found namespaces %s%n", namespaces);
		
		// Go through all namespaces and initialize any projects which may be
		// within directories
		Map<SourceName, Source> sources = new SortedTreeMap<>();
		for (Map.Entry<ProjectType, Set<Path>> e : namespaces.entrySet())
		{
			ProjectType type = e.getKey();
			
			// Go through path and decode projects
			for (Path p : e.getValue())
				__scanSources(__t, p, sources, type);
		}
		
		// Set
		this._sources = sources;
	}
	
	/**
	 * Obtains the source by the given project name.
	 *
	 * @param __n The name of the source project.
	 * @return The source for the given project.
	 * @throws NoSuchSourceException If no source exists for the given name.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/10/31
	 */
	public final Source get(String __n)
		throws NoSuchSourceException, NullPointerException
	{
		if (__n == null)
			throw new NullPointerException("NARG");
		
		return get(new SourceName(__n));
	}
	
	/**
	 * Obtains the source by the given project name.
	 *
	 * @param __n The name of the source project.
	 * @return The source for the given project.
	 * @throws NoSuchSourceException If no source exists for the given name.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/10/31
	 */
	public final Source get(SourceName __n)
		throws NoSuchSourceException, NullPointerException
	{
		if (__n == null)
			throw new NullPointerException("NARG");
		
		// {@squirreljme.error AU0z No such source project exists. (The name
		// of the source project)}
		Source rv = this._sources.get(__n);
		if (rv == null)
			throw new NoSuchSourceException(String.format("AU0z %s", __n));
		return rv;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/11/23
	 */
	@Override
	public final Iterator<Source> iterator()
	{
		return UnmodifiableCollection.<Source>of(this._sources.values()).
			iterator();
	}
	
	/**
	 * This scans the given directory for namespace directories and adds them
	 * to the given output path.
	 *
	 * @param __base The base path to scan for namespaces.
	 * @param __out The output map for namespace scans.
	 * @throws IOException On read errors.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/10/31
	 */
	private static final void __scanNamespaces(Path __base,
		Map<ProjectType, Set<Path>> __out)
		throws IOException, NullPointerException
	{
		if (__base == null || __out == null)
			throw new NullPointerException("NARG");
		
		// Go through directories
		try (DirectoryStream<Path> ds = Files.newDirectoryStream(__base))
		{
			for (Path p : ds)
			{
				// Ignore non-directories
				if (!Files.isDirectory(p))
					continue;
				
				// Obtain the manifest
				JavaManifestAttributes attr;
				try (InputStream in = Files.newInputStream(
					p.resolve("NAMESPACE.MF"), StandardOpenOption.READ))
				{
					attr = new JavaManifest(in).getMainAttributes();
				}
				
				// No file here
				catch (NoSuchFileException e)
				{
					continue;
				}
				
				// Obtain the namespace type, ignore if none was specified
				String type = attr.getValue("X-SquirrelJME-Namespace-Type");
				if (type == null)
					continue;
				
				// See if it is a valid project type
				ProjectType ptype = ProjectType.ofString(type);
				if (ptype == null)
					continue;
				
				// Store into the map this path
				Set<Path> put = __out.get(ptype);
				if (put == null)
					__out.put(ptype, (put = new SortedTreeSet<>()));
				put.add(p);
			}
		}
	}
	
	/**
	 * This scans the given directory for source projects and adds them to the
	 * given map.
	 *
	 * @param __t Timespace type.
	 * @param __base The base directory to scan.
	 * @param __out The output map where projects are placed.
	 * @param __type The type 
	 * @throws IOException On read errors.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/10/31
	 */
	private static final void __scanSources(TimeSpaceType __t, Path __base,
		Map<SourceName, Source> __out, ProjectType __type)
		throws IOException, NullPointerException
	{
		if (__t == null || __base == null || __out == null || __type == null)
			throw new NullPointerException("NARG");
		
		// Go through directories
		try (DirectoryStream<Path> ds = Files.newDirectoryStream(__base))
		{
			for (Path p : ds)
			{
				// Ignore non-directories
				if (!Files.isDirectory(p))
					continue;
				
				// Could fail
				SourceName triedname = null;
				try
				{
					// Determine source name
					SourceName name = new SourceName(
						p.getFileName().toString());
					triedname = name;
					
					// Ignore test projects, they are only referred to once
					// there is a base supporting project
					if (name.isTest())
						continue;
					
					// Initialize source project, check that the manifest
					// exists so invalid projects are not created
					BasicSource src = new BasicSource(name, p, __type);
					if (src.sourceManifest() == null)
						continue;
					
					// Store it
					__out.put(name, src);
					
					// If a test project exists, initialize it
					// But only if this is a the test timespace because
					// otherwise we will just get tons of tests in the way!
					if (__t.ordinal() >= TimeSpaceType.TEST.ordinal())
					{
						SourceName tn = new SourceName(name.name() + ".test");
						Path tr = p.resolveSibling(tn.name());
						if (Files.isRegularFile(tr.resolve("META-INF").resolve(
							"TEST.MF")))
							__out.put(tn, new TestSource(tr, src));
					}
				}
				
				// Ignore
				catch (InvalidSourceException e)
				{
					// {@squirreljme.error AU10 Tried to load a project but
					// it was determined to not be a valid project, ignoring.
					// (The project name; The exception message)}
					System.err.printf("AU10 %s `%s`%n", triedname,
						e.getMessage());
					continue;
				}
			}
		}
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<










































































































































































































































































































































































































































































































































































Deleted bldt/libs/builder-support/cc/squirreljme/builder/support/SourceManagerFactory.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.builder.support;

import java.io.InputStream;
import java.io.IOException;
import java.nio.file.DirectoryStream;
import java.nio.file.Files;
import java.nio.file.NoSuchFileException;
import java.nio.file.Path;
import java.nio.file.StandardOpenOption;
import java.util.HashSet;
import java.util.Set;
import net.multiphasicapps.collections.SortedTreeSet;
import net.multiphasicapps.tool.manifest.JavaManifest;
import net.multiphasicapps.tool.manifest.JavaManifestAttributes;

/**
 * This is the factory which is used to create instances of
 * {@code SourceManager} which provides access to specific timespaces
 * depending on the needed context.
 *
 * @since 2017/11/10
 */
public class SourceManagerFactory
{
	/** The root of the source tree. */
	protected final Path root;
	
	/**
	 * Initializes the source manager.
	 *
	 * @param __root The root of the source tree.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/11/14
	 */
	public SourceManagerFactory(Path __root)
		throws NullPointerException
	{
		if (__root == null)
			throw new NullPointerException("NARG");
		
		this.root = __root;
	}
	
	/**
	 * Obtains the source manager which uses the specified types.
	 *
	 * @param __t The timespace to source projects from.
	 * @return The source manager over those packages.
	 * @throws IOException On read errors.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/11/14
	 */
	public SourceManager get(TimeSpaceType __t)
		throws IOException, NullPointerException
	{
		if (__t == null)
			throw new NullPointerException("NARG");
		
		// Only look for specific timespaces
		Set<TimeSpaceType> want = new HashSet<>();
		int basei = __t.ordinal();
		for (TimeSpaceType t : TimeSpaceType.values())
			if (t.ordinal() <= basei)
				want.add(t);
		
		// Go through root files searching for directories containing timespace
		// manifests
		Set<Path> from = new SortedTreeSet<>();
		try (DirectoryStream<Path> ds = Files.newDirectoryStream(this.root))
		{
			for (Path p : ds)
			{
				// Ignore non-directories
				if (!Files.isDirectory(p))
					continue;
				
				// Read manifest
				JavaManifest man;
				try (InputStream is = Files.newInputStream(
					p.resolve("TIMESPACE.MF"), StandardOpenOption.READ))
				{
					man = new JavaManifest(is);
				}
				
				catch (NoSuchFileException e)
				{
					continue;
				}
				
				// Ignore unspecified timespaces
				String stype = man.getMainAttributes().getValue(
					"X-SquirrelJME-Timespace-Type");
				if (stype == null)
					continue;
				
				// Ignore unknown timespaces
				TimeSpaceType type = TimeSpaceType.ofString(stype);
				if (type == null)
					continue;
				
				// If this is a desired namespace, use that
				if (want.contains(type))
					from.add(p);
			}	
		}
		
		// Setup source manager
		return new SourceManager(__t,
			from.<Path>toArray(new Path[from.size()]));
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




















































































































































































































































Deleted bldt/libs/builder-support/cc/squirreljme/builder/support/SourceName.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.builder.support;

import java.nio.file.Path;
import java.nio.file.Paths;

/**
 * This represents the name of a source project.
 *
 * @since 2017/10/31
 */
public final class SourceName
	implements Comparable<SourceName>
{
	/** The name string. */
	protected final String name;
	
	/**
	 * Initailizes the source name.
	 *
	 * @param __n The name of the source.
	 * @throws InvalidSourceNameException If the name is not valid.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/10/31
	 */
	public SourceName(String __n)
		throws InvalidSourceNameException, NullPointerException
	{
		if (__n == null)
			throw new NullPointerException("NARG");
		
		// Is test
		boolean istest = __n.endsWith(".test");
		if (istest)
			__n = __n.substring(0, __n.length() - ".test".length());
		
		// Check for valid characters and lowercase
		StringBuilder sb = new StringBuilder();
		for (int i = 0, n = __n.length(); i < n; i++)
		{
			char c = __n.charAt(i);
			
			// {@squirreljme.error AU11 The project source name contains an
			// invalid character. (The specified character)}
			if (c <= ' ' || c >= 0x7F)
				throw new InvalidSourceNameException(
					String.format("AU11 %c", c));
			
			// Lowercase
			else if (c >= 'A' && c <= 'Z')
				c = (char)((c - 'A') + 'a');
			
			sb.append(c);
		}
		
		// If this is a test, then add the test
		if (istest)
			sb.append(".test");
		
		// Set
		this.name = sb.toString();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/10/31
	 */
	@Override
	public int compareTo(SourceName __n)
	{
		return this.name.compareTo(__n.name);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/10/31
	 */
	@Override
	public boolean equals(Object __o)
	{
		if (!(__o instanceof SourceName))
			return false;
		
		return this.name.equals(((SourceName)__o).name);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/10/31
	 */
	@Override
	public int hashCode()
	{
		return this.name.hashCode();
	}
	
	/**
	 * Does this refer to a test project?
	 *
	 * @return If this refers to a test project.
	 * @since 2018/03/06
	 */
	public final boolean isTest()
	{
		return this.name().endsWith(".test");
	}
	
	/**
	 * Returns the source name.
	 *
	 * @return The source name.
	 * @since 2018/03/06
	 */
	public final String name()
	{
		return this.name;
	}
	
	/**
	 * Returns the path to the file.
	 *
	 * @return The file name of the path.
	 * @since 2017/11/23
	 */
	public final Path toFileName()
	{
		return Paths.get(this.name + ".jar");
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/10/31
	 */
	@Override
	public String toString()
	{
		return this.name;
	}
	
	/**
	 * Checks whether the the given path refers to a valid binary.
	 *
	 * @param __p The path to check.
	 * @return If the given path is a binary path.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/11/23
	 */
	public static final boolean isBinaryPath(Path __p)
		throws NullPointerException
	{
		if (__p == null)
			throw new NullPointerException("NARG");
		
		// Ignore no file name
		Path fn = __p.getFileName();
		if (fn == null)
			return false;
		
		// Only use certain extensions
		String base = fn.toString();
		return base.endsWith(".jar") || base.endsWith(".JAR");
	}
	
	/**
	 * Returns the source name for this binary path.
	 *
	 * @param __p The path to translate to the source name.
	 * @return The source name for this associated binary path.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/11/05
	 */
	public static final SourceName ofBinaryPath(Path __p)
		throws NullPointerException
	{
		if (__p == null)
			throw new NullPointerException("NARG");
		
		// Try to determine the base name of the path
		String base = __p.getFileName().toString();
		if (isBinaryPath(__p))
			return new SourceName(base.substring(0, base.length() - 4));
		return new SourceName(base);
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




































































































































































































































































































































































































Deleted bldt/libs/builder-support/cc/squirreljme/builder/support/SourcePathSetType.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.builder.support;

/**
 * Represents the source path set that are available for usage.
 *
 * @since 2018/04/30
 */
public enum SourcePathSetType
{
	/** Source code. */
	SOURCE,
	
	/** Compiled code, may include generated code. */
	COMPILED,
	
	/** End. */
	;
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


























































Deleted bldt/libs/builder-support/cc/squirreljme/builder/support/SuiteFactory.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.builder.support;

import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.io.IOException;
import java.io.PrintStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardOpenOption;
import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.Deque;
import java.util.Iterator;
import javax.microedition.swm.InstallErrorCodes;
import javax.microedition.swm.ManagerFactory;
import javax.microedition.swm.Suite;
import javax.microedition.swm.SuiteInstaller;
import javax.microedition.swm.SuiteInstallListener;
import javax.microedition.swm.SuiteInstallStage;
import javax.microedition.swm.SuiteManagementTracker;
import javax.microedition.swm.SuiteManager;
import javax.microedition.swm.SuiteStateFlag;
import javax.microedition.swm.SuiteType;

/**
 * This manages suites which are available to the build system.
 *
 * @since 2017/12/08
 */
public class SuiteFactory
	implements Runnable
{
	/** The command to execute. */
	protected final String command;
	
	/** The manager for suites, which is required. */
	protected final SuiteManager manager;
	
	/** Arguments to the task command. */
	private final String[] _args;
	
	/**
	 * Initializes the suite factory.
	 *
	 * @param __args The argument to the factory.
	 * @since 2017/12/08
	 */
	public SuiteFactory(String... __args)
	{
		// Copy arguments for processing
		Deque<String> args = new ArrayDeque<>();
		if (__args != null)
			for (String a : __args)
				if (a != null)
					args.addLast(a);
		
		// Obtain the manager because it is possible that there are
		// no permissions to do so
		this.manager = ManagerFactory.getSuiteManager();
		
		// {@squirreljme.error AU12 Expected command for suite operation.}
		String command = args.pollFirst();
		if (command == null)
			throw new IllegalArgumentException("AU12");
		this.command = command;
		
		// Use remaining arguments as input
		this._args = args.<String>toArray(new String[args.size()]);
	}
	
	/**
	 * Installs the specified path which points to a JAR.
	 *
	 * @param __p The path to the JAR to install.
	 * @return The suite for the installed JAR.
	 * @throws IOException On read errors.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/12/27
	 */
	public Suite installSuite(Path __p)
		throws IOException, NullPointerException
	{
		if (__p == null)
			throw new NullPointerException("NARG");
		
		// Read in the JAR
		byte[] jardata;
		try (ByteArrayOutputStream baos = new ByteArrayOutputStream();
			InputStream is = Files.newInputStream(__p,
				StandardOpenOption.READ))
		{
			byte[] buf = new byte[512];
			for (;;)
			{
				int rv = is.read(buf);
				
				if (rv < 0)
					break;
				
				baos.write(buf, 0, rv);
			}
			
			baos.flush();
			jardata = baos.toByteArray();
		}
		
		// Obtain installer for the JAR
		SuiteInstaller installer = this.manager.getSuiteInstaller(jardata, 0,
			jardata.length, false);
		
		// Setup a class which nicely waits for the suite to install
		__SuiteInstallWaiter__ waiter = new __SuiteInstallWaiter__(System.out);
		installer.addInstallationListener(waiter);
		
		// Run the installer and then wait for it to finish
		SuiteManagementTracker tracker = installer.start();
		return waiter.get();
	}
	
	/**
	 * Lists the suites which are available for usage.
	 *
	 * @param __out Where the suite list is output.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/12/08
	 */
	public void listSuites(PrintStream __out)
		throws NullPointerException
	{
		if (__out == null)
			throw new NullPointerException("NARG");
		
		// Print application suites
		SuiteManager manager = this.manager;
		for (Suite s : manager.getSuites(SuiteType.APPLICATION))
			printSuite(__out, s);
		
		// Then print libraries
		for (Suite s : manager.getSuites(SuiteType.LIBRARY))
			printSuite(__out, s);
	}
	
	/**
	 * {@inheritDoc}
	 * @sincd 2017/12/08
	 */
	@Override
	public void run()
	{
		// Load arguments into a queue
		Deque<String> args =
			new ArrayDeque<>(Arrays.<String>asList(this._args));
		
		// Depends on the command
		String command = this.command;
		switch (command)
		{
				// List tasks
			case "ls":
			case "list":
				listSuites(System.out);
				break;
				
				// Install a suite
			case "install":
				try
				{
					// {@squirreljme.error AU13 The "suite install" command
					// requires a path to a JAR file to install.}
					String path = args.pollFirst();
					if (path == null)
						throw new IllegalArgumentException("AU13");
					
					// Install and print suite information
					printSuite(System.out, installSuite(Paths.get(path)));
				}
				
				// {@squirreljme.error AU14 Read/write error installing suite.}
				catch (IOException e)
				{
					throw new RuntimeException("AU14", e);
				}
				break;
				
				// {@squirreljme.error AU15 The specified suite command is not
				// valid. Valid commands are:
				// ls, list;
				// install (path);
				// . (The command)}
			case "help":
			default:
				throw new IllegalArgumentException(String.format("AU15 %s",
					command));
		}
	}
	
	/**
	 * Prints the specified suite to the output stream.
	 *
	 * @param __out The stream to print the suite information to.
	 * @param __s The suite to print.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/12/08
	 */
	public static void printSuite(PrintStream __out, Suite __s)
		throws NullPointerException
	{
		if (__out == null || __s == null)
			throw new NullPointerException("NARG");
		
		__out.printf("Suite: %s (%s)%n", __s.getName(), __s.getSuiteType());
		
		__out.printf("\tInstalled ? %s%n", __s.isInstalled());
		__out.printf("\tTrusted   ? %s%n", __s.isTrusted());
		__out.printf("\tVendor    : %s%n", __s.getVendor());
		__out.printf("\tVersion   : %s%n", __s.getVersion());
		__out.printf("\tSource URL: %s%n", __s.getDownloadUrl());
		
		__out.println("\tFlags:");
		for (SuiteStateFlag f : SuiteStateFlag.values())
			__out.printf("\t\tFlag %s is %s%n", f,
				(__s.isSuiteState(f) ? "set" : "not set"));
		
		__out.println("\tMIDlets:");
		for (Iterator<String> it = __s.getMIDlets(); it.hasNext();)
			__out.printf("\t\t%s%n", it.next());
		
		__out.println("\tAttributes:");
		for (Iterator<String> it = __s.getAttributes(); it.hasNext();)
		{
			String key = it.next();
			__out.printf("\t\t%s: %s%n", key, __s.getAttributeValue(key));
		}
			
		__out.println("\tDependencies:");
		for (Iterator<Suite> it = __s.getDependencies(); it.hasNext();)
		{
			Suite dep = it.next();
			__out.printf("\t\t%s %s%n", dep.getName(), dep.getVendor());
		}
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




























































































































































































































































































































































































































































































































Deleted bldt/libs/builder-support/cc/squirreljme/builder/support/TaskFactory.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.builder.support;

import java.io.PrintStream;
import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.Deque;
import javax.microedition.swm.ManagerFactory;
import javax.microedition.swm.Suite;
import javax.microedition.swm.SuiteManager;
import javax.microedition.swm.SuiteType;
import javax.microedition.swm.Task;
import javax.microedition.swm.TaskManager;
import javax.microedition.swm.TaskStatus;

/**
 * This is a factory which is used to handle tasks via the SWM sub-system.
 *
 * @since 2017/12/07
 */
public class TaskFactory
	implements Runnable
{
	/** The command to execute. */
	protected final String command;
	
	/** The manager for tasks, which is required. */
	protected final TaskManager manager;
	
	/** Arguments to the task command. */
	private final String[] _args;
	
	/**
	 * Initializes the SWM task factory.
	 *
	 * @param __args The argument to the factory.
	 * @since 2017/12/07
	 */
	public TaskFactory(String... __args)
	{
		// Copy arguments for processing
		Deque<String> args = new ArrayDeque<>();
		if (__args != null)
			for (String a : __args)
				if (a != null)
					args.addLast(a);
		
		// Obtain the manager because it is possible that there are
		// no permissions to do so
		this.manager = ManagerFactory.getTaskManager();
		
		// {@squirreljme.error AU16 Expected command for task operation.}
		String command = args.pollFirst();
		if (command == null)
			throw new IllegalArgumentException("AU16");
		this.command = command;
		
		// Use remaining arguments as input
		this._args = args.<String>toArray(new String[args.size()]);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/12/07
	 */
	@Override
	public void run()
	{
		// Load arguments into a queue
		Deque<String> args =
			new ArrayDeque<>(Arrays.<String>asList(this._args));
		
		// Depends on the command
		String command = this.command;
		switch (command)
		{
				// Launch a task
			case "launch":
				{
					// Parse arguments
					String[] parse;
					while (null != (parse = BuilderFactory.
						__getopts(":?", args)))
						switch (parse[0])
						{
								// {@squirreljme.error AU17 Unknown argument.
								// Usage: launch [suite] (class name).
								// }
							default:
								throw new IllegalArgumentException("AU17");
						}
					
					// {@squirreljme.error AU18 Expected name of class to
					// start as a system task.}
					String arga = args.pollFirst();
					if (arga == null)
						throw new IllegalArgumentException("AU18");
					
					// Secondary argument is optional
					String argb = args.pollFirst();
					
					// Launch task
					Task task;
					if (argb == null)
						task = launch(null, arga);
					else
						task = launch(arga, argb);
					
					// Wait for the task to terminate
					// There is no non-blocking mechanism which waits until
					// the task terminates, so just keep quering the state
					// until it is not running
					TaskStatus status;
					for (;;)
					{
						status = task.getStatus();
						if (status != TaskStatus.STARTING &&
							status != TaskStatus.RUNNING)
							break;
						
						// Sleep so the CPU is not burnt out
						try
						{
							Thread.sleep(500);
						}
						catch (InterruptedException e)
						{
						}
					}
					
					// {@squirreljme.error AU19 The task exited with the
					// given status. (The status)}
					if (status != TaskStatus.EXITED_REGULAR)
						throw new RuntimeException(String.format(
							"AU19 %s%n", status));
				}
				break;
				
				// List tasks
			case "ls":
			case "list":
				listTasks(System.out);
				break;
				
				// {@squirreljme.error AU1a The specified task command is not
				// valid. Valid commands are:
				// ls, list, launch
				// .(The command)}
			case "help":
			default:
				throw new IllegalArgumentException(String.format("AU1a %s",
					command));
		}
	}
	
	/**
	 * Lists the tasks and prints them to the specified stream.
	 *
	 * @param __ps The stream to print to.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/12/07
	 */
	public void listTasks(PrintStream __ps)
		throws NullPointerException
	{
		if (__ps == null)
			throw new NullPointerException("NARG");
		
		// Go through all tasks
		for (Task t : this.manager.getTaskList(true))
		{
			__ps.printf("Task: %s%n", t.getName());
			
			__ps.printf("\tis system? %s%n", t.isSystemTask());
			__ps.printf("\tpriority : %s%n", t.getPriority());
			__ps.printf("\tstatus   : %s%n", t.getStatus());
			__ps.printf("\tused heap: %d bytes%n", t.getHeapUse());
			
			// Print suite information
			Suite s = t.getSuite();
			if (s != null)
				SuiteFactory.printSuite(__ps, s);
		}
	}
	
	/**
	 * Launches the optional suite and via the given class.
	 *
	 * @param __su The suite to launch, if {@code null} then the system suite
	 * is used.
	 * @param __cl The class to use as the entry point.
	 * @throws NullPointerException If no class was specified.
	 * @since 2017/12/08
	 */
	public Task launch(String __su, String __cl)
		throws NullPointerException
	{
		if (__cl == null)
			throw new NullPointerException("NARG");
		
		// Locate the suite to use
		Suite suite = null;
		if (__su != null)
		{
			// For simplicity have an index lookup
			int wantdx = -1;
			try
			{
				wantdx = Integer.parseInt(__su);
			}
			catch (NumberFormatException e)
			{
			}
			
			// Go through suites and try to find a match
			SuiteManager sm = ManagerFactory.getSuiteManager();
			int atdx = 0;
			for (Suite s : sm.getSuites(SuiteType.APPLICATION))
				if (wantdx == (atdx++) ||
					__su.equals(s.getName()) ||
					__su.equals(s.getVendor()))
				{
					suite = s;
					break;
				}
			
			// {@squirreljme.error AU1b Could not locate a suite with the
			// given name. (The input name)}
			if (suite == null)
				throw new IllegalArgumentException(
					String.format("AU1b %s", __su));
		}
		
		// Use system suite
		else
			suite = Suite.SYSTEM_SUITE;
		
		// Show suite to launch
		SuiteFactory.printSuite(System.out, suite);
		
		// Start the task
		return this.manager.startTask(suite, __cl);
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




























































































































































































































































































































































































































































































































Deleted bldt/libs/builder-support/cc/squirreljme/builder/support/TestParser.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.builder.support;

import java.io.InputStream;
import java.io.IOException;
import net.multiphasicapps.javac.CompilerException;
import net.multiphasicapps.javac.CompilerInput;
import net.multiphasicapps.javac.syntax.CompilationUnitSyntax;
import net.multiphasicapps.javac.token.BufferedTokenSource;

/**
 * This is used to parse classes to look for tests that exist within source
 * code.
 *
 * @since 2018/03/19
 */
@Deprecated
public final class TestParser
	implements Runnable
{
	/** The input to read from. */
	protected final CompilerInput input;
	
	/** The storage area for discovered tests. */
	protected final DefinedTests defined;
	
	/**
	 * Initializes the parser.
	 *
	 * @param __in The input file.
	 * @param __def Where discovered tests will go.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/03/19
	 */
	public TestParser(CompilerInput __in, DefinedTests __def)
		throws NullPointerException
	{
		if (__in == null || __def == null)
			throw new NullPointerException("NARG");
		
		this.input = __in;
		this.defined = __def;
	}
	 
	/**
	 * {@inheritDoc}
	 * @since 2018/03/19
	 */
	@Override
	public void run()
	{
		CompilerInput input = this.input;
		
		// Parse the class layout
		try (InputStream in = input.open())
		{
			// Parse compilation unit
			CompilationUnitSyntax cu = CompilationUnitSyntax.parse(
				new BufferedTokenSource(input.fileName(), in));
			
			//toplevel = TopLevelLayout.parse(input.fileName(), in);
			if (true)
				throw new todo.TODO();
		}
		
		// {@squirreljme.error AU1c Could not parse file for tests.}
		catch (IOException|CompilerException e)
		{
			throw new RuntimeException("AU1c", e);
		}
		
		throw new todo.TODO();
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<








































































































































































Deleted bldt/libs/builder-support/cc/squirreljme/builder/support/TestSource.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.builder.support;

import cc.squirreljme.runtime.swm.SuiteInfo;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.io.IOException;
import java.io.PrintStream;
import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import java.nio.file.Path;
import java.util.Map;
import java.util.Set;
import net.multiphasicapps.collections.SortedTreeSet;
import net.multiphasicapps.javac.ByteArrayCompilerInput;
import net.multiphasicapps.javac.CompilerInput;
import net.multiphasicapps.javac.CompilerPathSet;
import net.multiphasicapps.javac.DistinctPathSet;
import net.multiphasicapps.javac.FilePathSet;
import net.multiphasicapps.javac.MergedPathSet;
import net.multiphasicapps.javac.structure.RuntimeInput;
import net.multiphasicapps.tool.manifest.JavaManifest;
import net.multiphasicapps.tool.manifest.writer.MutableJavaManifest;
import net.multiphasicapps.tool.manifest.writer.MutableJavaManifestAttributes;

/**
 * This represents source code for the tests which are made for a given project
 * which allows the invocation area of the test code to be automatically
 * generated accordingly.
 *
 * @since 2018/03/06
 */
public final class TestSource
	extends Source
{
	/** The root of the source. */
	protected final Path root;
	
	/** The project this is a test for. */
	protected final BasicSource testfor;
	
	/** The virtual main package. */
	protected final String mainpackage;
	
	/** Virtual manifest for this source. */
	private Reference<JavaManifest> _manifest;
	
	/** Last modified time of the source code. */
	private volatile long _lastmodtime =
		Long.MIN_VALUE;
	
	/**
	 * Initializes the source for test projects.
	 *
	 * @param __root The directory for the test.
	 * @param __for The base project this is a test for.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/03/06
	 */
	public TestSource(Path __root, BasicSource __for)
		throws NullPointerException
	{
		super(new SourceName(__for.name() + ".test"), ProjectType.MIDLET);
		
		if (__root == null || __for == null)
			throw new NullPointerException("NARG");
		
		this.root = __root;
		this.testfor = __for;
		
		// Setup virtual main package
		this.mainpackage = "cc.squirreljme.tests._" + __for.name().toString().
			replace('-', '_');
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/03/06
	 */
	@Override
	public final CompilerPathSet pathSet(SourcePathSetType __spst)
		throws NullPointerException
	{
		if (__spst == null)
			throw new NullPointerException("NARG");
		
		// Always use the root source set
		return new FilePathSet(this.root);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/03/06
	 */
	@Override
	public final JavaManifest sourceManifest()
	{
		Reference<JavaManifest> ref = this._manifest;
		JavaManifest rv;
		
		if (ref == null || null == (rv = ref.get()))
		{
			// Build virtual manifest intended to act as tests for the input
			// library
			BasicSource testfor = this.testfor;
			MutableJavaManifest wman = new MutableJavaManifest();
			MutableJavaManifestAttributes wattr = wman.getMainAttributes();
		
			SuiteInfo bs = testfor.suiteInfo();
			
			String coolname = "Tests for " + bs.name().toString();
			
			wattr.putValue("x-squirreljme-name", coolname);
			wattr.putValue("x-squirreljme-vendor", bs.vendor().toString());
			wattr.putValue("x-squirreljme-version", bs.version().toString());
			wattr.putValue("x-squirreljme-description", coolname);
			wattr.putValue("x-squirreljme-depends", testfor.name().name() +
				" meep-midlet tac");
			wattr.putValue("x-squirreljme-tests", "true");
			
			// All of the tests are just MIDlets to be ran accordingly as if
			// they were unique individual programs within the JAR
			Set<String> classes = this.__testClass();
			int next = 1;
			for (String cl : classes)
				wattr.putValue("midlet-" + (next++),
					"TEST " + cl + ",," + cl);
			
			// Finalize
			this._manifest = new WeakReference<>((rv = wman.build()));
		}
		
		return rv;
	}
	
	/**
	 * Returns classes which make up the test classes.
	 *
	 * @return The tests which are available.
	 * @since 2018/10/06
	 */
	private Set<String> __testClass()
	{
		// Classes which are available for testing
		Set<String> classes = new SortedTreeSet<>();
		
		// Parse every input class file and look for tests according to
		// a given file syntax
		for (CompilerInput ci : this.pathSet(SourcePathSetType.SOURCE))
		{
			// Only consider Java source and class files
			String name = ci.fileName();
			if (!name.endsWith(".java") && !name.endsWith(".class") &&
				!name.endsWith(".class.__mime"))
				continue;
			
			// Remove the extension
			name = name.substring(0, name.indexOf('.'));
			
			// Get the basename, because the test could be organized into
			// packages which might mess with parsing. Although generally
			// tests are likely in just the default package
			int ls = name.lastIndexOf('/');
			String base = (ls < 0 ? name : name.substring(ls + 1));
			
			// Ignore classes with dollar signs because that indicates an
			// inner class
			if (base.indexOf('$') >= 0)
				continue;
			
			// Only if the given patterns are matched is the test added
			if (base.startsWith("Do") ||
				base.startsWith("Test") ||
				base.endsWith("Test"))
				classes.add(name.replace('/', '.'));
		}
		
		// Return all the discovered classes
		return classes;
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






























































































































































































































































































































































































Deleted bldt/libs/builder-support/cc/squirreljme/builder/support/TimeSpaceType.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.builder.support;

/**
 * This specifies the type of timespace to select when looking for projects.
 *
 * @since 2017/11/14
 */
public enum TimeSpaceType
{
	/** Runtime. */
	RUNTIME,
	
	/** JIT time. */
	JIT,
	
	/** Testing. */
	TEST,
	
	/** Build time. */
	BUILD,
	
	/** End. */
	;
	
	/**
	 * Returns the timespace type for the given string.
	 *
	 * @param __s The input string.
	 * @return The timespace for the given input or {@code null} if there is
	 * no such timespace.
	 * @since 2017/11/16
	 */
	public static TimeSpaceType ofString(String __s)
		throws NullPointerException
	{
		if (__s == null)
			throw new NullPointerException("NARG");
		
		switch (__s)
		{
			case "runtime":		return RUNTIME;
			case "jit":			return JIT;
			case "test":		return TEST;
			case "build":		return BUILD;
			
			default:
				return null;
		}
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


























































































































Deleted bldt/libs/builder-support/cc/squirreljme/builder/support/__SuiteInstallWaiter__.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.builder.support;

import java.io.PrintStream;
import javax.microedition.swm.InstallErrorCodes;
import javax.microedition.swm.Suite;
import javax.microedition.swm.SuiteInstallListener;
import javax.microedition.swm.SuiteInstallStage;
import javax.microedition.swm.SuiteManagementTracker;

/**
 * This class allows for suites to be waited upon when they are installed.
 *
 * @since 2017/12/27
 */
class __SuiteInstallWaiter__
	implements SuiteInstallListener
{
	/** Where messages on progress are printed to. */
	protected final PrintStream out;
	
	/** The installed suite. */
	private volatile Suite _suite;
	
	/** Installation error code. */
	private volatile InstallErrorCodes _error;
	
	/**
	 * Initializes the waiter.
	 *
	 * @param __out The stream where progress is printed.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/12/27
	 */
	__SuiteInstallWaiter__(PrintStream __out)
		throws NullPointerException
	{
		if (__out == null)
			throw new NullPointerException("NARG");
		
		this.out = __out;
	}
	
	/**
	 * Returns the installed suite.
	 *
	 * @return The installed suite.
	 * @throws RuntimeException If the suite did not install properly.
	 * @since 2017/12/27
	 */
	public Suite get()
	{
		for (;;)
			synchronized (this)
			{
				// If a suite was installed use that
				Suite suite = this._suite;
				if (suite != null)
					return suite;
				
				// {@squirreljme.error AU1d The suite installation failed with
				// the given error code. (The error code)}
				InstallErrorCodes error = this._error;
				if (error != null)
					throw new RuntimeException(String.format("AU1d %s",
						error));
				
				// Installation can be notified from another thread
				try
				{
					this.wait(1_000);
				}
				catch (InterruptedException e)
				{
				}
			}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/12/27
	 */
	@Override
	public void installationDone(InstallErrorCodes __err,
		SuiteManagementTracker __tracker)
	{
		this.out.printf("Finished: %s%n", __err);
		
		// One thread will be locked on this
		synchronized (this)
		{
			// Set suite and code
			this._error = __err;
			this._suite = __tracker.getSuite();
		
			// Signal self that the suite was installed
			this.notify();
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/12/27
	 */
	@Override
	public void updateStatus(SuiteManagementTracker __tracker,
		SuiteInstallStage __stage, int __percent)
	{
		this.out.printf("%s: %d%%%n", __stage, __percent);
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


















































































































































































































































Deleted bldt/libs/builder-support/cc/squirreljme/builder/support/dist/DistBuilder.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.builder.support.dist;

import cc.squirreljme.builder.support.ProjectManager;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.nio.file.NoSuchFileException;
import java.util.Date;
import java.util.ServiceLoader;
import java.util.Set;
import net.multiphasicapps.collections.SortedTreeSet;
import net.multiphasicapps.javac.ZipCompilerOutput;

/**
 * This is the base class which is used to build distributions.
 *
 * The service loader is used.
 *
 * @since 2018/12/24
 */
public abstract class DistBuilder
{
	/** The name of this distribution. */
	protected final String name;
	
	/**
	 * Initializes the base distribution builder.
	 *
	 * @param __n The name of the distribution.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/12/24
	 */
	public DistBuilder(String __n)
		throws NullPointerException
	{
		if (__n == null)
			throw new NullPointerException("NARG");
		
		this.name = __n;
	}
	
	/**
	 * Performs specific build stuff.
	 *
	 * @param __pm The project manager used.
	 * @param __zip The output ZIP.
	 * @throws IOException On read/write errors.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/12/24
	 */
	protected abstract void specific(ProjectManager __pm,
		ZipCompilerOutput __zip)
		throws IOException, NullPointerException;
	
	/**
	 * Builds this distribution.
	 *
	 * @param __pm The project manager, needed to get resources.
	 * @param __zip The output ZIP file.
	 * @throws IOException On read/write errors.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/12/24
	 */
	public final void build(ProjectManager __pm, ZipCompilerOutput __zip)
		throws IOException, NullPointerException
	{
		if (__pm == null || __zip == null)
			throw new NullPointerException("NARG");
		
		// Add some information about the build
		long buildtime = System.currentTimeMillis();
		DistBuilder.copyStrings(__zip, "SQUIRRELJME-BUILD.MF",
			"Manifest-Version: 1.0",
			"Distribution-Name: " + this.name,
			"Build-Date: " + new Date(buildtime),
			"Build-Time: " + buildtime,
			"Build-Host-Java-Version: "
				+ System.getProperty("java.version"),
			"Build-Host-Java-Vendor: "
				+ System.getProperty("java.vendor"),
			"Build-Host-Java-Vendor-EMail: "
				+ System.getProperty("java.vendor.email"),
			"Build-Host-Java-Vendor-URL: "
				+ System.getProperty("java.vendor.url"),
			"Build-Host-Java-VM-Name: "
				+ System.getProperty("java.vm.name"),
			"Build-Host-Java-VM-Version: "
				+ System.getProperty("java.vm.version"),
			"Build-Host-SquirrelJME-APILevel: "
				+ System.getProperty("cc.squirreljme.apilevel"),
			"Build-Host-Java-VM-Vendor: "
				+ System.getProperty("java.vm.vendor"),
			"Build-Host-Java-VM-Vendor-EMail: "
				+ System.getProperty("java.vm.vendor.email"),
			"Build-Host-Java-VM-Vendor-URL: "
				+ System.getProperty("java.vm.vendor.url"),
			"Build-Host-Java-Runtime-Name: "
				+ System.getProperty("java.runtime.name"),
			"Build-Host-Java-Runtime-Version: "
				+ System.getProperty("java.runtime.version"),
			"Build-Host-OS-Name: "
				+ System.getProperty("os.name"),
			"Build-Host-OS-Arch: "
				+ System.getProperty("os.arch"),
			"Build-Host-OS-Version: "
				+ System.getProperty("os.version"));
		
		// Copy a bunch of root files which should always exist
		DistBuilder.copyRootFile(__zip, "asruntime.mkd", __pm);
		DistBuilder.copyRootFile(__zip, "building.mkd", __pm);
		DistBuilder.copyRootFile(__zip, "changelog.mkd", __pm);
		DistBuilder.copyRootFile(__zip, "code-of-conduct.mkd", __pm);
		DistBuilder.copyRootFile(__zip, "compatibility.mkd", __pm);
		DistBuilder.copyRootFile(__zip, "contributing.mkd", __pm);
		DistBuilder.copyRootFile(__zip, "design.mkd", __pm);
		DistBuilder.copyRootFile(__zip, "history.mkd", __pm);
		DistBuilder.copyRootFile(__zip, "license.mkd", __pm);
		DistBuilder.copyRootFile(__zip, "public-key.gpg.mkd", __pm);
		DistBuilder.copyRootFile(__zip, "readme.mkd", __pm);
		DistBuilder.copyRootFile(__zip, "scope.mkd", __pm);
		DistBuilder.copyRootFile(__zip, "squirreljme-version", __pm);
		
		// Fossil specific stuff
		try
		{
			DistBuilder.copyRootFile(__zip, "repo-manifest",
				__pm, "manifest");
			DistBuilder.copyRootFile(__zip, "repo-revision",
				__pm, "manifest.uuid");
		}
		catch (NoSuchFileException e)
		{
		}
		
		// Dist specific usage file
		try
		{
			DistBuilder.copyRootFile(__zip, "usage.mkd",
				__pm, "assets/doc/usage-" + this.name + ".mkd");
		}
		catch (NoSuchFileException e)
		{
		}
		
		// Do specific build stuff, which depends on the distrubution target.
		this.specific(__pm, __zip);
	}
	
	/**
	 * Returns the name of the distribution.
	 *
	 * @return The distribution name.
	 * @since 2018/12/24
	 */
	public final String name()
	{
		return this.name;
	}
	
	/**
	 * Locates the builder for the given name and returns it.
	 *
	 * @param __n The name of the builder to locate.
	 * @return The builder.
	 * @throws IllegalArgumentException If the builder was not found.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/12/24
	 */
	public static DistBuilder builder(String __n)
		throws IllegalArgumentException, NullPointerException
	{
		if (__n == null)
			throw new NullPointerException("NARG");
		
		// Find the one with the given name
		for (DistBuilder b : ServiceLoader.<DistBuilder>load(
			DistBuilder.class))
			if (__n.equals(b.name()))
				return b;
		
		// {@squirreljme.error AU1e No distribution exists under the given
		// name. (The distribution name)}
		throw new IllegalArgumentException("AU1e " + __n);
	}
	
	/**
	 * Copies the given bytes to the output.
	 *
	 * @param __out The output ZIP.
	 * @param __as The name to write the file as
	 * @param __b The bytes to store.
	 * @throws IOException On write errors.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/12/24
	 */
	public static void copyBytes(ZipCompilerOutput __out, String __as,
		byte... __b)
		throws IOException, NullPointerException
	{
		DistBuilder.copyInputStream(__out, __as,
			new ByteArrayInputStream(__b));
	}
	
	/**
	 * Copies the given input stream to the output ZIP.
	 *
	 * @param __out The output ZIP.
	 * @param __as The name to write the file as
	 * @param __in The stream to read from.
	 * @throws IOException On read/write errors.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/12/24
	 */
	public static void copyInputStream(ZipCompilerOutput __out, String __as,
		InputStream __in)
		throws IOException, NullPointerException
	{
		if (__out == null || __in == null || __as == null)
			throw new NullPointerException("NARG");
		
		// Setup output using the name we want to put it under
		try (OutputStream os = __out.output(__as))
		{
			byte[] buf = new byte[4096];
			for (;;)
			{
				int rc = __in.read(buf);
				
				if (rc < 0)
					break;
				
				os.write(buf, 0, rc);
			}
		}
	}
	
	/**
	 * Copies a file from the project manager root to the given ZIP output.
	 *
	 * @param __out The output ZIP.
	 * @param __as The name of the input file to load, it is named the in the
	 * ZIP as the name.
	 * @param __pm The project manager.
	 * @throws IOException On read/write errors.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/12/24
	 */
	public static void copyRootFile(ZipCompilerOutput __out, String __as,
		ProjectManager __pm)
		throws IOException, NullPointerException
	{
		DistBuilder.copyRootFile(__out, __as, __pm, __as);
	}
	
	/**
	 * Copies a file from the project manager root to the given ZIP output.
	 *
	 * @param __out The output ZIP.
	 * @param __as The name the file should be in the target ZIP.
	 * @param __pm The project manager.
	 * @param __name The name of the input file.
	 * @throws IOException On read/write errors.
	 * @throws NoSuchFileException If the root file does not exist.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/12/24
	 */
	public static void copyRootFile(ZipCompilerOutput __out, String __as,
		ProjectManager __pm, String __name)
		throws IOException, NoSuchFileException, NullPointerException
	{
		if (__out == null || __pm == null || __name == null || __as == null)
			throw new NullPointerException("NARG");
		
		// Source the files from the project root always
		try (InputStream in = __pm.rootFile(__name))
		{
			// {@squirreljme.error AU1f The root file does not exist.
			// (The name of the file)}
			if (in == null)
				throw new NoSuchFileException("AU1f " + __name);
			
			// Copy the input
			DistBuilder.copyInputStream(__out, __as, in);
		}
	}
	
	/**
	 * Copies the given strings to the output. A CRLF is added at the end
	 * of each line.
	 *
	 * @param __out The output ZIP.
	 * @param __as The name to write the file as
	 * @param __s The strings to store.
	 * @throws IOException On write errors.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/12/24
	 */
	public static void copyStrings(ZipCompilerOutput __out, String __as,
		String... __s)
		throws IOException, NullPointerException
	{
		DistBuilder.copyStrings("\r\n", __out, __as, __s);
	}
	
	/**
	 * Copies the given strings to the output.
	 *
	 * @param __eol The end of line sequence to use.
	 * @param __out The output ZIP.
	 * @param __as The name to write the file as
	 * @param __s The strings to store.
	 * @throws IOException On write errors.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/12/24
	 */
	public static void copyStrings(String __eol,
		ZipCompilerOutput __out, String __as, String... __s)
		throws IOException, NullPointerException
	{
		if (__eol == null || __out == null || __as == null || __s == null)
			throw new NullPointerException("NARG");
		
		// Setup string which has all the lines
		StringBuilder sb = new StringBuilder();
		for (String s : __s)
			if (s != null)
			{
				sb.append(s);
				sb.append(__eol);
			}
		
		// Treat this file as a bunch of 
		DistBuilder.copyBytes(__out, __as, sb.toString().getBytes("utf-8"));
	}
	
	/**
	 * Returns the list of builders which are available.
	 *
	 * @return The list of available builders.
	 * @since 2018/12/24
	 */
	public static String[] listBuilders()
	{
		// Build list but make sure it is always sorted since that works
		// much better
		Set<String> rv = new SortedTreeSet<>();
		for (DistBuilder b : ServiceLoader.<DistBuilder>load(
			DistBuilder.class))
			rv.add(b.name());
		
		return rv.<String>toArray(new String[rv.size()]);
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


























































































































































































































































































































































































































































































































































































































































































































































Deleted bldt/libs/builder-support/cc/squirreljme/builder/support/dist/PalmOSDist.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.builder.support.dist;

import dev.shadowtail.palmos.PalmDatabaseAttribute;
import dev.shadowtail.palmos.PalmDatabaseBuilder;
import dev.shadowtail.palmos.PalmDatabaseType;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.Calendar;
import net.multiphasicapps.javac.ZipCompilerOutput;

/**
 * Palm OS distribution.
 *
 * @since 2019/07/13
 */
public class PalmOSDist
	extends SummerCoatROM
{
	/** The size of a single fragment of the ROM. */
	public static final int ROM_FRAGMENT_SIZE =
		32768;
	
	/**
	 * Initializes the builder.
	 *
	 * @since 2019/07/13
	 */
	public PalmOSDist()
	{
		super("palmos");
	}
	
	/**
	 * Builds the ROM database.
	 *
	 * @param __out The stream to write to.
	 * @param __bp The build parameters.
	 * @throws IOException On write errors.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/07/13
	 */
	protected void buildRomDatabase(OutputStream __out, BuildParameters __bp)
		throws IOException, NullPointerException
	{
		if (__out == null || __bp == null)
			throw new NullPointerException("NARG");
		
		// Build the ROM first and get its bytes
		byte[] romdata = __bp.minimize();
		int romlen = romdata.length;
		
		// The ROM must be split into multiple fragments due to HotSync
		// limitation
		int numfrags = (romlen / ROM_FRAGMENT_SIZE) + 1;
		
		// Create builder for the database
		PalmDatabaseBuilder db = new PalmDatabaseBuilder(
			PalmDatabaseType.RESOURCE);
		
		// Used to set the version number
		Calendar cal = Calendar.getInstance();
		
		// Set information on the database
		db.setName("SquirrelJME ROM");
		db.setType("mROM");
		db.setCreator("SjME");
		db.setVersion(((((cal.get(Calendar.YEAR) - 2016) * 365) +
			cal.get(Calendar.DAY_OF_YEAR)) * 24) +
			cal.get(Calendar.HOUR_OF_DAY));
		db.setAttributes(PalmDatabaseAttribute.BACKUP,
			PalmDatabaseAttribute.OK_TO_INSTALL_NEWER,
			PalmDatabaseAttribute.BUNDLE);
		
		// Write ROM length
		try (DataOutputStream ent = new DataOutputStream(
			db.addEntry("RlEN", 0)))
		{
			ent.writeInt(romlen);
		}
		
		// Write fragment length
		try (DataOutputStream ent = new DataOutputStream(
			db.addEntry("FlEN", 0)))
		{
			ent.writeInt(ROM_FRAGMENT_SIZE);
		}
		
		// Write fragment count
		try (DataOutputStream ent = new DataOutputStream(
			db.addEntry("FnUM", 0)))
		{
			ent.writeInt(numfrags);
		}
		
		// Write every fragment to the database
		for (int i = 0, p = 0; i < numfrags; i++, p += ROM_FRAGMENT_SIZE)
		{
			// Write individual fragment
			try (DataOutputStream ent = new DataOutputStream(
				db.addEntry("FrOM", i)))
			{
				// Write the fragment data
				ent.write(romdata, p, Math.min(romlen - p, ROM_FRAGMENT_SIZE));
				
				// Make sure all fragments are the same size
				if (ent.size() < ROM_FRAGMENT_SIZE)
					ent.write(0);
			}
		}
		
		// Write the output
		db.writeTo(__out);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2019/07/13
	 */
	@Override
	protected void generate(ZipCompilerOutput __zip, BuildParameters __bp)
		throws IOException, NullPointerException
	{
		if (__zip == null || __bp == null)
			throw new NullPointerException("NARG");
		
		// PalmOS (especially older versions) do not have a concept of a
		// file system so a ROM has to exist as a database
		try (OutputStream out = __zip.output("squirreljme-rom.pdb"))
		{
			this.buildRomDatabase(out, __bp);
		}
		
		// Include the PRC that can run the actual ROM!
		todo.TODO.note("Include RatufaCoat squirreljme.prc for now!");
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






































































































































































































































































































Deleted bldt/libs/builder-support/cc/squirreljme/builder/support/dist/ShadedJavaMEDist.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.builder.support.dist;

import cc.squirreljme.builder.support.ProjectManager;
import cc.squirreljme.builder.support.TimeSpaceType;
import cc.squirreljme.builder.support.vmshader.Shader;
import java.io.IOException;
import java.io.OutputStream;
import net.multiphasicapps.javac.ZipCompilerOutput;

/**
 * Distribution for building shaded Java ME JARs.
 *
 * @since 2018/12/24
 */
public class ShadedJavaMEDist
	extends DistBuilder
{
	/**
	 * Initializes the distribution.
	 *
	 * @since 2018/12/24
	 */
	public ShadedJavaMEDist()
	{
		super("javame");
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/12/24
	 */
	@Override
	protected void specific(ProjectManager __pm, ZipCompilerOutput __zip)
		throws IOException, NullPointerException
	{
		if (__pm == null || __zip == null)
			throw new NullPointerException("NARG");
		
		// Write to the output ZIP
		try (OutputStream out = __zip.output("squirreljme-javame.jar"))
		{
			Shader.shade(__pm, TimeSpaceType.RUNTIME, false,
				null, out);
		}
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


















































































































Deleted bldt/libs/builder-support/cc/squirreljme/builder/support/dist/ShadedJavaSEDist.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.builder.support.dist;

import cc.squirreljme.builder.support.ProjectManager;
import cc.squirreljme.builder.support.TimeSpaceType;
import cc.squirreljme.builder.support.vmshader.Shader;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.io.IOException;
import java.io.OutputStream;
import net.multiphasicapps.javac.ZipCompilerOutput;

/**
 * Distribution for building shaded Java SE JARs.
 *
 * @since 2018/12/24
 */
public class ShadedJavaSEDist
	extends DistBuilder
{
	/**
	 * Initializes the distribution.
	 *
	 * @since 2018/12/24
	 */
	public ShadedJavaSEDist()
	{
		super("javase");
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/12/24
	 */
	@Override
	protected void specific(ProjectManager __pm, ZipCompilerOutput __zip)
		throws IOException, NullPointerException
	{
		if (__pm == null || __zip == null)
			throw new NullPointerException("NARG");
		
		// Write to the output ZIP
		try (OutputStream out = __zip.output("squirreljme-javase.jar"))
		{
			Shader.shade(__pm, TimeSpaceType.RUNTIME, true,
				Paths.get("bootsjme", "javase-runtime.jar"), out);
		}
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






















































































































Deleted bldt/libs/builder-support/cc/squirreljme/builder/support/dist/SummerCoatROM.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.builder.support.dist;

import cc.squirreljme.builder.support.Binary;
import cc.squirreljme.builder.support.ProjectManager;
import cc.squirreljme.builder.support.TimeSpaceType;
import cc.squirreljme.builder.support.vm.BuildClassLibrary;
import cc.squirreljme.runtime.swm.EntryPoint;
import cc.squirreljme.runtime.swm.EntryPoints;
import cc.squirreljme.vm.VMClassLibrary;
import dev.shadowtail.packfile.PackMinimizer;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.io.IOException;
import java.io.OutputStream;
import net.multiphasicapps.tool.manifest.JavaManifest;
import net.multiphasicapps.tool.manifest.JavaManifestAttributes;
import net.multiphasicapps.tool.manifest.JavaManifestKey;
import net.multiphasicapps.javac.ZipCompilerOutput;

/**
 * This is used to build the packed SummerCoat ROM file.
 *
 * @since 2019/05/28
 */
public class SummerCoatROM
	extends DistBuilder
{
	/** The timespace to use. */
	protected final TimeSpaceType timespace;
	
	/**
	 * Initializes the service.
	 *
	 * @since 2019/05/28
	 */
	public SummerCoatROM()
	{
		this("summercoatrom", TimeSpaceType.RUNTIME);
	}
	
	/**
	 * Initializes the service with the given name using the default type.
	 *
	 * @param __name The name to use.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/07/13
	 */
	public SummerCoatROM(String __name)
		throws NullPointerException
	{
		this(__name, TimeSpaceType.RUNTIME);
	}
	
	/**
	 * Initializes the service with the given name and type.
	 *
	 * @param __name The name to use.
	 * @param __ts The timespace type.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/05/29
	 */
	public SummerCoatROM(String __name, TimeSpaceType __ts)
		throws NullPointerException
	{
		super(__name);
		
		if (__ts == null)
			throw new NullPointerException("NARG");
		
		this.timespace = __ts;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2019/05/28
	 */
	@Override
	protected void specific(ProjectManager __pm, ZipCompilerOutput __zip)
		throws IOException, NullPointerException
	{
		// Compile everything and include the launcher bits as well
		Binary[] bins = __pm.buildAll(this.timespace);
		Binary[] lbins = __pm.build(this.timespace, "launcher");
		
		// Bootstrap library used as the kernel entry point
		String boot = null;
		
		// Translate these to VMClassLibraries and find the bootstrap
		int n = bins.length;
		VMClassLibrary[] libs = new VMClassLibrary[n];
		for (int i = 0; i < n; i++)
		{
			Binary b = bins[i];
			
			// Wrap library
			BuildClassLibrary lib;
			libs[i] = (lib = new BuildClassLibrary(b));
			
			// Use the supervisor as the booting point
			String name = lib.name().toString();
			if (name.equals("supervisor") || name.equals("supervisor.jar"))
				boot = name;
		}
		
		// Try to find the starting libraries for the launcher
		int numlbins = lbins.length;
		String[] lstrs = new String[numlbins];
		for (int i = 0; i < numlbins; i++)
		{
			// Get source name
			String name = lbins[i].name().toString();
			
			// Find the library for it
			for (int j = 0; j < n; j++)
			{
				String ln = libs[j].name();
				
				// Matching name?
				if (name.equals(ln) || name.equals(ln + ".jar") ||
					(name + ".jar").equals(ln) ||
					(name + ".jar").equals(ln + ".jar"))
				{
					lstrs[i] = ln;
					break;
				}
			}
		}
		
		// Write SummerCoat ROM file
		EntryPoint entrypoint = new EntryPoints(lbins[numlbins - 1].
			manifest()).get(0);
		this.generate(__zip, new BuildParameters(boot, lstrs,
			entrypoint.entryPoint(), entrypoint.isMidlet(), libs));
	}
	
	/**
	 * Generates the output files as needed.
	 *
	 * @param __zip The ZIP to write to.
	 * @param __bp The build parameters.
	 * @throws IOException On write errors.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/07/13
	 */
	protected void generate(ZipCompilerOutput __zip, BuildParameters __bp)
		throws IOException, NullPointerException
	{
		if (__zip == null || __bp == null)
			throw new NullPointerException("NARG");
		
		// Write SummerCoat ROM file
		try (OutputStream out = __zip.output("squirreljme.sqc"))
		{
			__bp.minimize(out);
		}
	}
	
	/**
	 * This contains the build parameters for the minimizer.
	 *
	 * @since 2019/07/13
	 */
	public static final class BuildParameters
	{
		/** The boot library. */
		public final String bootlib;
		
		/** Starting libraries. */
		public final String[] startlibs;
		
		/** Main boot class. */
		public final String mainbc;
		
		/** Is this a MIDlet? */
		public final boolean ismidlet;
		
		/** Libraries to use. */
		public final VMClassLibrary[] libs;
		
		/**
		 * Initializes the build parameters.
		 *
		 * @param __boot The boot library.
		 * @param __lstrs Starting libraries.
		 * @param __mainbc Main boot class.
		 * @param __ismid Is this a MIDlet?
		 * @param __libs Class Library.
		 * @throws NullPointerException On null arguments.
		 * @since 2019/07/13
		 */
		public BuildParameters(String __boot, String[] __lstrs,
			String __mainbc, boolean __ismid, VMClassLibrary[] __libs)
			throws NullPointerException
		{
			if (__boot == null || __lstrs == null || __mainbc == null ||
				__libs == null)
				throw new NullPointerException("NARG");
			
			this.bootlib = __boot;
			this.startlibs = __lstrs;
			this.mainbc = __mainbc;
			this.ismidlet = __ismid;
			this.libs = __libs;
		}
		
		/**
		 * Minimizes to the given output stream.
		 *
		 * @param __out The stream to write to.
		 * @throws IOException On write errors.
		 * @throws NullPointerException On null arguments.
		 * @since 2019/07/13
		 */
		public final void minimize(OutputStream __out)
			throws IOException, NullPointerException
		{
			if (__out == null)
				throw new NullPointerException("NARG");
			
			PackMinimizer.minimize(__out, this.bootlib, this.startlibs,
				this.mainbc, this.ismidlet, this.libs);
		}
		
		/**
		 * Minimizes to a byte array.
		 *
		 * @return The byte array of the minimized output.
		 * @since 2019/07/13
		 */
		public final byte[] minimize()
			throws IOException
		{
			return PackMinimizer.minimize(this.bootlib, this.startlibs,
				this.mainbc, this.ismidlet, this.libs);
		}
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<














































































































































































































































































































































































































































































































Deleted bldt/libs/builder-support/cc/squirreljme/builder/support/dist/SummerCoatROMTest.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.builder.support.dist;

import cc.squirreljme.builder.support.TimeSpaceType;

/**
 * This builds the SummerCoat ROM except that it completely uses the test
 * projects and is used to make sure SummerCoat and RatufaCoat work properly
 * with all of the tests.
 *
 * @since 2019/05/29
 */
public class SummerCoatROMTest
	extends SummerCoatROM
{
	/**
	 * Initializes the builder.
	 *
	 * @since 2019/05/29
	 */
	public SummerCoatROMTest()
	{
		super("summercoatrom-test", TimeSpaceType.TEST);
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




































































Deleted bldt/libs/builder-support/cc/squirreljme/builder/support/dist/package-info.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

/**
 * This package contains the distribution system.
 *
 * @since 2018/12/24
 */

package cc.squirreljme.builder.support.dist;

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




































Deleted bldt/libs/builder-support/cc/squirreljme/builder/support/package-info.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

/**
 * This package contains the base support for the build system.
 *
 * @since 2017/11/09
 */

package cc.squirreljme.builder.support;

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




































Deleted bldt/libs/builder-support/cc/squirreljme/builder/support/sdk/package-info.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

/**
 * This package contains the SDK support code which can be used to build and
 * construct the SDK as required.
 *
 * @since 2018/01/27
 */

package cc.squirreljme.builder.support.sdk;

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






































Deleted bldt/libs/builder-support/cc/squirreljme/builder/support/testmain.template.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

import java.util.ArrayList;
import java.util.Collection;
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;

/**
 * This is an automatically generated class for running the test framework
 * for a given library.
 *
 * @since 2018/03/06
 */
public final class TestMain
	extends MIDlet
{
	/**
	 * {@inheritDoc}
	 * @since 2018/03/06
	 */
	@Override
	protected final void destroyApp(boolean __uc)
		throws MIDletStateChangeException
	{
		// Does nothing
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/03/06
	 */
	@Override
	protected final void startApp()
		throws MIDletStateChangeException
	{
		throw new todo.TODO();
	}
	
	/**
	 * Main entry point.
	 *
	 * @param __args Program arguments.
	 * @since 2018/03/06
	 */
	public static void main(String... __args)
	{
		// Always make it valid
		if (__args == null)
			__args = new String[0];
		
		throw new todo.TODO();
	}
}

// AUTOMATICALLY GENERATED INTERNAL TEST DATA WILL BE STORED FOLLOWING THIS
// POINT

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


































































































































Deleted bldt/libs/builder-support/cc/squirreljme/builder/support/vm/BuildClassLibrary.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.builder.support.vm;

import cc.squirreljme.builder.support.Binary;
import cc.squirreljme.vm.VMClassLibrary;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import net.multiphasicapps.zip.blockreader.ZipBlockReader;
import net.multiphasicapps.zip.blockreader.ZipBlockEntry;
import net.multiphasicapps.zip.blockreader.ZipEntryNotFoundException;

/**
 * This represents a single library that is layered on top of the binary
 * provided by the build system.
 *
 * @since 2018/09/13
 */
public final class BuildClassLibrary
	implements VMClassLibrary
{
	/** The binary to source from. */
	protected final Binary binary;
	
	/**
	 * Initializes the library.
	 *
	 * @param __b The binary to wrap.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/09/13
	 */
	public BuildClassLibrary(Binary __b)
		throws NullPointerException
	{
		if (__b == null)
			throw new NullPointerException("NARG");
		
		this.binary = __b;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2019/04/21
	 */
	@Override
	public final String[] listResources()
	{
		// Build name list
		List<String> rv = new ArrayList<>();
		try (ZipBlockReader zip = this.binary.zipBlock())
		{
			for (ZipBlockEntry e : zip)
			{
				// Do not consider directories as part of the JAR
				if (e.isDirectory())
					continue;
				
				rv.add(e.name());
			}
		}
		
		// Failed read
		catch (IOException e)
		{
			throw new RuntimeException(e);
		}
		
		// Return it
		return rv.<String>toArray(new String[rv.size()]);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/09/13
	 */
	@Override
	public final String name()
	{
		return this.binary.name().toString() + ".jar";
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/09/13
	 */
	@Override
	public final InputStream resourceAsStream(String __rc)
		throws IOException, NullPointerException
	{
		if (__rc == null)
			throw new NullPointerException("NARG");
		
		try (ZipBlockReader zip = this.binary.zipBlock())
		{
			// Might not exist
			try (InputStream in = zip.open(__rc))
			{
				// Copy all the data
				ByteArrayOutputStream baos = new ByteArrayOutputStream();
				byte[] buf = new byte[512];
				for (;;)
				{
					int rc = in.read(buf);
					
					if (rc < 0)
						break;
					
					baos.write(buf, 0, rc);
				}
				
				// Wrap and return
				return new ByteArrayInputStream(baos.toByteArray());
			}
			
			// No entry exists to be read
			catch (ZipEntryNotFoundException e)
			{
				return null;
			}
		}
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<














































































































































































































































































Deleted bldt/libs/builder-support/cc/squirreljme/builder/support/vm/BuildSuiteManager.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.builder.support.vm;

import cc.squirreljme.builder.support.Binary;
import cc.squirreljme.builder.support.BinaryManager;
import cc.squirreljme.builder.support.ProjectManager;
import cc.squirreljme.builder.support.NoSourceAvailableException;
import cc.squirreljme.builder.support.Source;
import cc.squirreljme.builder.support.TimeSpaceType;
import cc.squirreljme.vm.VMClassLibrary;
import cc.squirreljme.vm.VMSuiteManager;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import net.multiphasicapps.collections.SortedTreeSet;

/**
 * The manager for suites that use the build system.
 *
 * @since 2018/10/26
 */
public final class BuildSuiteManager
	implements VMSuiteManager
{
	/** The project manager which is used. */
	protected final ProjectManager manager;
	
	/** Loaded libraries. */
	private final Map<String, VMClassLibrary> _libraries =
		new HashMap<>();
	
	/**
	 * Initializes the suite manager.
	 *
	 * @param __pm The project manager that is used.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/10/16
	 */
	public BuildSuiteManager(ProjectManager __pm)
		throws NullPointerException
	{
		if (__pm == null)
			throw new NullPointerException("NARG");
		
		this.manager = __pm;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/10/26
	 */
	@Override
	public final String[] listLibraryNames()
	{
		Set<String> rv = new SortedTreeSet<>();
		
		ProjectManager manager = this.manager;
		
		// Could fail
		try
		{
			// Add sources
			for (Source s : manager.sourceManager())
				rv.add(s.name().toString() + ".jar");
			
			// Add binaries
			for (Binary b : manager.binaryManager())
				rv.add(b.name().toString() + ".jar");
		}
		
		// {@squirreljme.error AU1g Could not list suites available.}
		catch (IOException e)
		{
			throw new RuntimeException("AU1g", e);
		}
		
		return rv.<String>toArray(new String[rv.size()]);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/10/26
	 */
	@Override
	public final VMClassLibrary loadLibrary(String __s)
		throws NullPointerException
	{
		if (__s == null)
			throw new NullPointerException("NARG");
		
		// Remove the extension
		if (__s.endsWith(".jar"))
			__s = __s.substring(0, __s.length() - 4);
		
		// Lock
		Map<String, VMClassLibrary> libraries = this._libraries;
		synchronized (libraries)
		{
			// Pre-cached already?
			VMClassLibrary rv = libraries.get(__s);
			if (rv != null)
				return rv;
			
			// Build the binaries for this finding the matching one
			try
			{
				for (Binary b : this.manager.build(__s))
					if (__s.equals(b.name().toString()))
					{
						rv = new BuildClassLibrary(b);
						break;
					}
			}
			
			// If no source exists then just use it directly
			catch (NoSourceAvailableException e)
			{
				try
				{
					rv = new BuildClassLibrary(this.manager.binaryManager().
						get(__s));
				}
				
				// {@squirreljme.error AU1h Could not load the binary manager.}
				catch (IOException x)
				{
					RuntimeException t = new RuntimeException("AU1h", x);
					t.addSuppressed(e);
					throw t;
				}
			}
			
			// Library was found?
			if (rv != null)
			{
				libraries.put(__s, rv);
				return rv;
			}
			
			// {@squirreljme.error AU1i No such library exists. (The requested
			// library)}
			throw new RuntimeException(String.format("AU1i %s", __s));
		}
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




























































































































































































































































































































Deleted bldt/libs/builder-support/cc/squirreljme/builder/support/vm/VMMain.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.builder.support.vm;

import cc.squirreljme.builder.support.Binary;
import cc.squirreljme.builder.support.NoSourceAvailableException;
import cc.squirreljme.builder.support.ProjectManager;
import cc.squirreljme.builder.support.TimeSpaceType;
import cc.squirreljme.vm.VirtualMachine;
import cc.squirreljme.vm.VMFactory;
import java.io.IOException;
import java.io.OutputStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardCopyOption;
import java.nio.file.StandardOpenOption;
import java.util.ArrayDeque;
import java.util.Calendar;
import java.util.HashMap;
import java.util.LinkedHashSet;
import java.util.Map;
import java.util.Queue;
import java.util.Set;
import net.multiphasicapps.profiler.ProfilerSnapshot;

/**
 * Main entry point for the virtual machine which is layered on the build
 * system.
 *
 * @since 2018/09/13
 */
public class VMMain
{
	/**
	 * Main entry point using the given project manager.
	 *
	 * @param __pm The project manager.
	 * @param __pn The project to be launched.
	 * @param __args Program arguments.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/12/29
	 */
	public static void main(ProjectManager __pm, String __pn, String... __args)
		throws NullPointerException
	{
		VMMain.main(null, null, __pm, __pn, __args);
	}
	
	/**
	 * Main entry point using the given project manager.
	 *
	 * @param __vm The name of the VM engine to use, may be blank.
	 * @param __nps Profiler snapshot to use instead.
	 * @param __pm The project manager.
	 * @param __pn The project to be launched.
	 * @param __args Program arguments.
	 * @throws NullPointerException On null arguments, except for {@code __vm}.
	 * @since 2019/01/23
	 */
	public static void main(String __vm, String __nps, ProjectManager __pm,
		String __pn, String... __args)
		throws NullPointerException
	{
		VMMain.main(null, null, null, __pm, __pn, __args);
	}
	
	/**
	 * Main entry point using the given project manager.
	 *
	 * @param __vm The name of the VM engine to use, may be blank.
	 * @param __nps Profiler snapshot to use instead.
	 * @param __sprops System properties to use for the VM.
	 * @param __pm The project manager.
	 * @param __pn The project to be launched.
	 * @param __args Program arguments.
	 * @throws NullPointerException On null arguments, except for {@code __vm}.
	 * @since 2019/01/23
	 */
	public static void main(String __vm, String __nps,
		Map<String, String> __sprops, ProjectManager __pm,
		String __pn, String... __args)
		throws NullPointerException
	{
		if (__pm == null || __pn == null)
			throw new NullPointerException("NARG");
			
		// Copy arguments for processing
		Queue<String> args = new ArrayDeque<>();
		if (__args != null)
			for (String a : __args)
				if (a != null)
					args.add(a);
		
		// Determine the project and launch ID to execute
		String project = __pn;
		int launchid = 0;
		
		// Check if a launch ID was specified, separate with colon because
		// there could be command line arguments to launch with using the
		// classic entry point. So we cannot really specificy the entry point
		// using a switch as we would need to specially handle it. Not to
		// mention the program may require it.
		int col = project.indexOf(':');
		if (col >= 0)
		{
			launchid = Integer.valueOf(project.substring(col + 1));
			project = project.substring(0, col);
		}
		
		// Get the project and all of its dependencies built which forms
		// the class path
		Set<Binary> xclasspath = new LinkedHashSet<>();
		Binary[] vclasspath;
		try
		{
			vclasspath = __pm.build(project);
		}
		
		// If there is no source for this, just use the classpath then
		catch (NoSourceAvailableException e)
		{
			vclasspath = __pm.classPath(project);
		}
		
		// The boot entry always must be last
		Binary bootp = vclasspath[vclasspath.length - 1];
		
		// Merge the sets of classpaths
		Set<Binary> finalclasspath = new LinkedHashSet<>();
		for (Binary b : xclasspath)
			finalclasspath.add(b);
		for (Binary b : vclasspath)
			finalclasspath.add(b);
		
		// Remove and re-add the boot entry so it is always last
		finalclasspath.remove(bootp);
		finalclasspath.add(bootp);
		
		// Need to convert to array because we use direct index references
		// on the array
		Binary[] fcpa = finalclasspath.<Binary>toArray(
			new Binary[finalclasspath.size()]);
		
		// Build class references
		int numlibs = fcpa.length;
		String[] classpath = new String[numlibs];
		for (int i = 0; i < numlibs; i++)
			classpath[i] = fcpa[i].name().toString();
		
		// Profiled class information
		ProfilerSnapshot profiler = new ProfilerSnapshot();
		
		// Initialize the virtual machine with our launch ID
		VirtualMachine machine = VMFactory.main(__vm, profiler,
			new BuildSuiteManager(__pm), classpath,
			null, launchid, -1, __sprops,
			args.<String>toArray(new String[args.size()]));
		
		// Run the VM until it terminates
		int exitcode = -1;
		try
		{
			exitcode = machine.runVm();
		}
		
		// Dump the profiler snapshot somewhere
		finally
		{
			// Exit all frames in the profiler so that it is maybe valid
			// otherwise if the VM crashes mid-frame without a clean exit
			// the exact times will be hard to tell
			profiler.exitAll();
			
			// Dump to file
			try
			{
				// Create temporary file
				Calendar now = Calendar.getInstance();
				Path temp = Files.createTempFile(String.format(
					"squirreljme-vm-%TF_%TH-%TM-%TS-", now, now, now, now),
					".nps");
				
				// Write snapshot to this file
				try (OutputStream os = Files.newOutputStream(temp,
					StandardOpenOption.WRITE, StandardOpenOption.CREATE))
				{
					profiler.writeTo(os);
				}
				
				// Move the NPS somewhere?
				if (__nps != null)
					try
					{
						Files.move(temp, Paths.get(__nps),
							StandardCopyOption.REPLACE_EXISTING);
					}
					catch (IOException e)
					{
						e.printStackTrace();
					}
			}
			
			// Ignore
			catch (IOException e)
			{
				e.printStackTrace();
			}
		}
		
		// Exit with our given code, we cannot exit before the finally
		// because then the profiler would never be generatedg
		System.exit(exitcode);
	}
	
	/**
	 * Main entry point (for old compatibility).
	 *
	 * @param __args Program arguments.
	 * @since 2018/09/13
	 */
	public static void main(String... __args)
	{
		// Copy arguments for processing
		Queue<String> args = new ArrayDeque<>();
		if (__args != null)
			for (String a : __args)
				if (a != null)
					args.add(a);
		
		// Setup project manager
		ProjectManager pm = ProjectManager.fromArguments(args);
		
		// {@squirreljme.error AU1j No project to launch was specified. The
		// format is project-name or project-name:entry-point-id.}
		if (args.isEmpty())
			throw new IllegalArgumentException("AU1j");
		
		// Forward
		VMMain.main(pm, args.remove(),
			args.<String>toArray(new String[args.size()]));
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
























































































































































































































































































































































































































































































































Deleted bldt/libs/builder-support/cc/squirreljme/builder/support/vm/package-info.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

/**
 * This package contains the support for VMs to use the SquirrelJME
 * build system as a class path provider.
 *
 * @since 2018/09/13
 */

package cc.squirreljme.builder.support.vm;

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






































Deleted bldt/libs/builder-support/cc/squirreljme/builder/support/vmshader/ServicesMerge.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.builder.support.vmshader;

import java.util.LinkedHashSet;
import java.util.Set;

/**
 * This is used for merging services together as one.
 *
 * @since 2019/05/19
 */
public final class ServicesMerge
{
	/** Services available. */
	final Set<String> _implementations =
		new LinkedHashSet<>();
	
	/**
	 * Returns the service implementations.
	 *
	 * @return The service implementations.
	 * @since 2019/05/19
	 */
	public final String[] implementations()
	{
		Set<String> impls = this._implementations;
		return impls.<String>toArray(new String[impls.size()]);
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<












































































Deleted bldt/libs/builder-support/cc/squirreljme/builder/support/vmshader/Shader.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.builder.support.vmshader;

import cc.squirreljme.builder.support.Binary;
import cc.squirreljme.builder.support.BinaryManager;
import cc.squirreljme.builder.support.NoSourceAvailableException;
import cc.squirreljme.builder.support.ProjectManager;
import cc.squirreljme.builder.support.TimeSpaceType;
import cc.squirreljme.runtime.cldc.asm.SystemProperties;
import java.io.BufferedReader;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardCopyOption;
import java.nio.file.StandardOpenOption;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Queue;
import java.util.Set;
import net.multiphasicapps.tool.manifest.writer.MutableJavaManifest;
import net.multiphasicapps.tool.manifest.writer.MutableJavaManifestAttributes;
import net.multiphasicapps.zip.blockreader.ZipBlockEntry;
import net.multiphasicapps.zip.blockreader.ZipBlockReader;
import net.multiphasicapps.zip.streamreader.ZipStreamEntry;
import net.multiphasicapps.zip.streamreader.ZipStreamReader;
import net.multiphasicapps.zip.streamwriter.ZipStreamWriter;

/**
 * This class builds a shaded JAR of the virtual machine which contains the
 * classes for every JAR in SquirrelJME. This just uses the build system to
 * produce a JAR that is combined as one.
 *
 * @since 2018/11/16
 */
public class Shader
{
	/**
	 * Shades the JAR.
	 *
	 * @param __pm The project manager to use.
	 * @param __ts The timespace type.
	 * @param __withboot Use the bootstrap?
	 * @param __bootjar Bootstrap JAR to use.
	 * @param __out The stream to write the ZIP to.
	 * @throws IOException On write errors.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/12/22
	 */
	public static void shade(ProjectManager __pm, TimeSpaceType __ts,
		boolean __withboot, Path __bootjar, OutputStream __out)
		throws IOException, NullPointerException
	{
		if (__pm == null || __ts == null ||
			(__withboot && __bootjar == null) || __out == null)
			throw new NullPointerException("NARG");
		
		// Setup output ZIP stream
		ZipStreamWriter zsw = new ZipStreamWriter(__out);
		
		// Files which were put in the JAR, to detect duplicates and
		// such!
		Set<String> putin = new HashSet<>();
		
		// Make sure that the bootstrap is always placed in first, this
		// provides the API and such (for example on Java SE systems we need
		// to provide the Swing code and such)
		if (__withboot)
			Shader.__injectRuntimeJar(zsw, __bootjar, putin);
		
		// Completely shade in the JAR for the entire run-time which we
		// selected
		BinaryManager bm = __pm.binaryManager(__ts);
		Shader.__shadeJar(zsw, bm);
		
		// All of our binaries are going to be merged into one and shaded in
		// the top level JAR. This includes the VM implementation
		Set<Binary> mergebins = new LinkedHashSet<>();
		
		// We might be runnign on a Java SE or Java ME system which does not
		// have the full API available, so in that case provide a bunch of
		// stub APIs so that things still somewhat work.
		// However add these in reverse order so that the stubs are always
		// first!
		Binary[] vmstubs = bm.compile(bm.get("common-vm-stubs"));
		for (int i = vmstubs.length - 1; i >= 0; i--)
			mergebins.add(vmstubs[i]);
		
		// Then we just include every single virtual machine that exists, so
		// that way they can be switched to in the event an older one is
		// desired.
		for (Binary bin : bm.compile(bm.get("all-vms")))
			mergebins.add(bin);
		
		// Merge all of those and those binaries into the output JAR as needed
		Shader.__bootIn(zsw, bm, mergebins.<Binary>toArray(
			new Binary[mergebins.size()]), putin);
		
		// End the stream
		zsw.flush();
		zsw.close();
	}
	
	/**
	 * Builds and loads the classes into.
	 *
	 * @param __zsw The ZIP to write to.
	 * @param __bm The manager for binaries.
	 * @param __bins The binaries to write, the compiled paths.
	 * @param __putin Files already in the JAR.
	 * @throws IOException On read errors.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/11/16
	 */
	private static final void __bootIn(ZipStreamWriter __zsw,
		BinaryManager __bm, Binary[] __bins, Set<String> __putin)
		throws IOException, NullPointerException
	{
		if (__zsw == null || __bm == null || __bins == null || __putin == null)
			throw new NullPointerException("NARG");
		
		// Services that are available
		Map<String, ServicesMerge> services = new LinkedHashMap<>();
		
		// We want to write and merge all the entries
		byte[] buf = new byte[512];
		for (Binary bin : __bins)
		{
			// Will be copying every single entry to the output
			try (ZipBlockReader zbr = bin.zipBlock())
			{
				// Copy every single entry to the output
				for (ZipBlockEntry e : zbr)
				{
					// Merge in services?
					String name = e.name();
					if (name.startsWith("META-INF/services/"))
					{
						// Get just the name of the class
						name = name.substring(18);
						
						// Setup merge for services
						ServicesMerge merge = services.get(name);
						if (merge == null)
							services.put(name, (merge = new ServicesMerge()));
						
						// Merge in service implementations
						try (BufferedReader br = new BufferedReader(
							new InputStreamReader(e.open())))
						{
							for (;;)
							{
								String ln = br.readLine();
								if (ln == null)
									break;
								
								merge._implementations.add(ln);
							}
						}
						
						// Do not process any further
						continue;
					}
					
					// Only add entries once!
					if (__putin.contains(name))
						continue;
					
					// Do not write manifests!
					if (name.equals("META-INF/MANIFEST.MF"))
						continue;
					
					// Not allowed to add stuff under this package?
					if (name.endsWith(".class") &&
						!Shader.__checkPackage(name))
						continue;
					
					// This was added, so it gets ignored
					__putin.add(name);
					
					// Copy the data in here
					try (InputStream is = e.open();
						OutputStream os = __zsw.nextEntry(name))
					{
						for (;;)
						{
							int rc = is.read(buf);
							
							if (rc < 0)
								break;
							
							os.write(buf, 0, rc);
						}
					}
				}
			}
		}
		
		// We need to know the classpath that is used for the launcher so
		// that the shaded entry main knows how to start the actual launcher!
		// Since all classes are needed for it!
		StringBuilder launchercp = new StringBuilder();
		for (Binary bin : __bm.classPath(__bm.get("launcher")))
		{
			if (launchercp.length() > 0)
				launchercp.append(' ');
			
			launchercp.append(bin.name());
		}
		
		// Setup manifest which allows us to run this on SpringCoat along
		// with doing a normal `java -jar` on it!
		MutableJavaManifest man = new MutableJavaManifest();
		MutableJavaManifestAttributes attr = man.getMainAttributes();
		
		// Needed for Java SE
		attr.putValue("Main-Class",
			"cc.squirreljme.vm.VMEntryShadedMain");
		
		// Needed for Java ME
		attr.putValue("MIDlet-1", "SquirrelJME," +
			"squirrejme-vm.png,cc.squirreljme.vm.VMEntryShadedMIDlet");
		attr.putValue("MicroEdition-Configuration", "CLDC-1.8");
		attr.putValue("MicroEdition-Profile", "MEEP-8.0 MIDP-3.1");
		attr.putValue("MIDlet-Name", "SquirrelJME");
		attr.putValue("MIDlet-Vendor", "Stephanie Gawroriski");
		attr.putValue("MIDlet-Version", SystemProperties.javaRuntimeVersion());
		
		// Write manifest to the output
		try (OutputStream os = __zsw.nextEntry("META-INF/MANIFEST.MF"))
		{
			man.write(os);
		}
		
		// Write VM properties into its own manifest as well
		man = new MutableJavaManifest();
		attr = man.getMainAttributes();
		
		// Needed by the VM so it knows the boot classpath for the launcher!
		attr.putValue("ClassPath", launchercp.toString());
		
		// Write manifest to the output
		try (OutputStream os = __zsw.nextEntry(
			"META-INF/SQUIRRELJME-SHADED.MF"))
		{
			man.write(os);
		}
		
		// Write in any services
		for (Map.Entry<String, ServicesMerge> e : services.entrySet())
			try (PrintStream os = new PrintStream(__zsw.nextEntry(
				"META-INF/services/" + e.getKey()), true))
			{
				for (String s : e.getValue().implementations())
					os.println(s);
				os.flush();
			}
	}
	
	/**
	 * Checks to make sure that the given package should be included.
	 *
	 * @param __name The name of the class to check.
	 * @return If the class can be stored.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/11/16
	 */
	private static final boolean __checkPackage(String __name)
		throws NullPointerException
	{
		if (__name == null)
			throw new NullPointerException("NARG");
		
		// There is no slash so this is okay!
		int ls = __name.lastIndexOf('/');
		if (ls < 0)
			return true;
		
		// Do not allow certain names
		switch (__name = __name.substring(0, ls))
		{
				// These will conflict with stuff in the CLDC and such and
				// technically it is not permitted to add these classes so
				// all of these will go away!
			case "java/io":
			case "java/lang":
			case "java/lang/annotation":
			case "java/lang/ref":
			case "java/net":
			case "java/nio":
			case "java/nio/channels":
			case "java/nio/file":
			case "java/nio/file/attribute":
			case "java/security":
			case "java/util":
				return false;
			
				// Can add this class
			default:
				return true;
		}
	}
	
	/**
	 * Injects the run-time support JAR into the classpath.
	 *
	 * @param __zsw The output ZIP.
	 * @param __ertj The support JAR.
	 * @param __putin The files which were already placed in the JAR.
	 * @throws IOException On read/write errors.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/11/16
	 */
	private static final void __injectRuntimeJar(ZipStreamWriter __zsw,
		Path __ertj, Set<String> __putin)
		throws IOException, NullPointerException
	{
		if (__zsw == null || __ertj == null || __putin == null)
			throw new NullPointerException("NARG");
		
		// Before we write the other files, we want to inject everything from
		// this JAR in there
		byte[] buf = new byte[512];
		if (__ertj != null)
			try (ZipStreamReader copy = new ZipStreamReader(
				Files.newInputStream(__ertj, StandardOpenOption.READ)))
			{
				for (;;)
					try (ZipStreamEntry e = copy.nextEntry())
					{
						// No more entries
						if (e == null)
							break;
						
						String name = e.name();
						
						// Already in the JAR?
						if (__putin.contains(name))
							continue;
						
						// Ignore manifests
						if (name.equals("META-INF/MANIFEST.MF"))
							continue;
						
						// Only once this can be added
						__putin.add(name);
						
						// Copy data
						try (OutputStream os = __zsw.nextEntry(name))
						{
							for (;;)
							{
								int rc = e.read(buf);
								
								if (rc < 0)
									break;
								
								os.write(buf, 0, rc);
							}
						}
					}
			}
	}
	
	/**
	 * Shades the JAR to the specified output.
	 *
	 * @param __zsw The output ZIP to write to.
	 * @param __bm The binary manager with classes.
	 * @throws IOException On write errors.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/11/16
	 */
	private static final void __shadeJar(ZipStreamWriter __zsw,
		BinaryManager __bm)
		throws IOException, NullPointerException
	{
		if (__zsw == null || __bm == null)
			throw new NullPointerException("NARG");
		
		// Raw suiite
		ByteArrayOutputStream rawsuites = new ByteArrayOutputStream();
		PrintStream suitelist = new PrintStream(rawsuites, true, "utf-8");
		
		// Go through all the binaries and just place them in the shaded JAR
		// with their associated names and prefixes
		byte[] buf = new byte[512];
		for (Binary bin : __bm)
		{
			// Compile the binary
			try
			{
				__bm.compile(bin);
			}
			
			// If no source code available, just ignore because it would
			// already be in binary form
			catch (NoSourceAvailableException e)
			{
			}
			
			// Use the name for this JAR
			String name = bin.name().toString();
			
			// Write it to the suite list
			suitelist.println(name);
			
			// Base prefix for this JAR
			String base = "__-squirreljme/" + name + "/";
			
			// Will be copying every single entry to the output
			try (ZipBlockReader zbr = bin.zipBlock())
			{
				// List of resources that are available
				List<String> jarresources = new LinkedList<>();
				
				// Copy every single entry to the output
				for (ZipBlockEntry e : zbr)
				{
					// Ignore directories
					if (e.isDirectory())
						continue;
					
					// Add to resource list
					jarresources.add(e.name());
					
					// Copy the data
					try (InputStream is = e.open();
						OutputStream os = __zsw.nextEntry(base + e.name()))
					{
						for (;;)
						{
							int rc = is.read(buf);
							
							if (rc < 0)
								break;
							
							os.write(buf, 0, rc);
						}
					}
				}
				
				// Write resource list into the JAR
				try (PrintStream os = new PrintStream(__zsw.nextEntry(base +
					"META-INF/squirreljme/resources.list"), true, "utf-8"))
				{
					// Write to stream
					for (String rcn : jarresources)
						os.println(rcn);
					
					// Make sure it is there!
					os.flush();
				}
			}
		}
		
		// Write the raw suite list to the JAR since it is needed for shading
		try (OutputStream os = __zsw.nextEntry("__-squirreljme/suites.list"))
		{
			rawsuites.writeTo(os);
		}
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<








































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted bldt/libs/builder-support/cc/squirreljme/builder/support/vmshader/package-info.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

/**
 * This package contains the virtual machine shader.
 *
 * @since 2018/12/22
 */

package cc.squirreljme.builder.support.vmshader;

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




































Deleted bldt/libs/palmos-utils/META-INF/MANIFEST.MF.

1
2
3
4
5
6
7
8
9
10
Manifest-Version: 1.0
X-SquirrelJME-UUID: dfc85dd5-cd8b-40e4-956d-0fc938eb179e
X-SquirrelJME-Error: BP
X-SquirrelJME-Name: PalmOS Utilities
X-SquirrelJME-Vendor: Stephanie Gawroriski
X-SquirrelJME-Version: 0.3.0
X-SquirrelJME-Description: This contains utilities for reading and writing 
 PalmOS PRC and PDB files.
Microedition-Configuration: CLDC-1.8-Compact

<
<
<
<
<
<
<
<
<
<




















Deleted bldt/mids/NAMESPACE.MF.

1
2
3
4
5
6
Manifest-Version: 1.0
X-SquirrelJME-Namespace-Title: Build System MIDlets
X-SquirrelJME-Namespace-Type: midlet
X-SquirrelJME-Namespace-Description: This namespace contains the actual 
 applications which are invoked and initialized for the build system.

<
<
<
<
<
<












Deleted bldt/mids/builder/META-INF/MANIFEST.MF.

1
2
3
4
5
6
7
8
9
10
11
12
Manifest-Version: 1.0
X-SquirrelJME-UUID: a67921b8-7a05-40c2-adc8-c8d09ed4515e
X-SquirrelJME-Depends: builder-support builder-implementation
X-SquirrelJME-Name: Build System
X-SquirrelJME-Error: AO
X-SquirrelJME-Vendor: Stephanie Gawroriski
X-SquirrelJME-Version: 0.3.0
X-SquirrelJME-Description: This contains the build system which is 
 used to generate target SquirrelJME binaries.
Microedition-Configuration: CLDC-1.8
Main-Class: cc.squirreljme.builder.entry.BuilderMain

<
<
<
<
<
<
<
<
<
<
<
<
























Deleted bldt/mids/builder/cc/squirreljme/builder/entry/BuilderMain.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.builder.entry;

import cc.squirreljme.builder.support.BuilderFactory;
import java.io.PrintStream;

/**
 * Main entry point for the builder.
 *
 * @since 2017/11/09
 */
public class BuilderMain
{
	/**
	 * Main entry point.
	 *
	 * @param __args Program arguments.
	 * @since 2017/11/09
	 */
	public static void main(String... __args)
	{
		// Print some basic information about the build system
		PrintStream out = System.err;
		out.println("SquirrelJME Build System");
		
		// Space
		out.println();
		
		// Run the builder
		new BuilderFactory(__args).run();
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




















































































Deleted bldt/mids/builder/cc/squirreljme/builder/entry/package-info.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

/**
 * This package contains the main entry point for the builder.
 *
 * @since 2017/11/09
 */

package cc.squirreljme.builder.entry;

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




































Deleted bldt/mids/instruction-popcount/META-INF/MANIFEST.MF.

1
2
3
4
5
6
7
8
9
10
11
Manifest-Version: 1.0
X-SquirrelJME-UUID: 135ed40b-e019-89f9-d36e-2089616072a7
X-SquirrelJME-Error: AT
X-SquirrelJME-Name: Instruction Population Count
X-SquirrelJME-Vendor: Stephanie Gawroriski
X-SquirrelJME-Version: 0.3.0
X-SquirrelJME-Description: This goes through every library within 
 SquirrelJME and counts all of the instructions which are used.
X-SquirrelJME-Depends: builder-support
Microedition-Configuration: CLDC-1.8-Compact
Main-Class: dev.shadowtail.javapopcount.Main
<
<
<
<
<
<
<
<
<
<
<






















Deleted bldt/mids/instruction-popcount/dev/shadowtail/javapopcount/Main.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package dev.shadowtail.javapopcount;

import cc.squirreljme.builder.support.Binary;
import cc.squirreljme.builder.support.ProjectManager;
import cc.squirreljme.builder.support.TimeSpaceType;
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import net.multiphasicapps.classfile.ByteCode;
import net.multiphasicapps.classfile.ClassFile;
import net.multiphasicapps.classfile.ClassName;
import net.multiphasicapps.classfile.Instruction;
import net.multiphasicapps.classfile.InstructionIndex;
import net.multiphasicapps.classfile.InstructionMnemonics;
import net.multiphasicapps.classfile.Method;
import net.multiphasicapps.zip.streamreader.ZipStreamEntry;
import net.multiphasicapps.zip.streamreader.ZipStreamReader;

/**
 * Main entry point.
 *
 * @since 2019/03/31
 */
public class Main
{
	/**
	 * Counts all of the instructions in the byte code.
	 *
	 * @param __bc The byte code to go through.
	 * @param __c The output count.
	 * @param __p Various progress indicators.
	 * @return The total number of instructions.
	 * @throws NullPointerException
	 * @since 2019/03/31
	 */
	public static int countByteCode(ByteCode __bc, Map<Integer, Counter> __c,
		Progress __p)
		throws NullPointerException
	{
		if (__bc == null || __c == null || __p == null)
			throw new NullPointerException("NARG");
		
		// Total number of instructions
		int rv = 0;
		
		// Go through every instruction
		boolean newtodo = false;
		for (Instruction i : __bc)
		{
			int op = i.operation();
			
			// Is this a todo? Note we cannot count throws because those
			// are objects on the stack, just check how many times TODOs
			// were allocated
			if (op == InstructionIndex.NEW &&
				i.<ClassName>argument(0, ClassName.class).toString().equals(
				"todo/TODO"))
			{
				__p.todos++;
				newtodo = true;
			}
			
			// Get counter
			Counter c = __c.get(op);
			if (c == null)
				__c.put(op, (c = new Counter()));
			
			// Increase the counters
			c.count++;
			rv++;
		}
		
		// Method made a todo, count it
		if (newtodo)
			__p.methodtodos++;
		else
			__p.methodnotodos++;
		
		// Return the total!
		return rv;
	}
	
	/**
	 * Runs the program.
	 *
	 * @param __args Program arguments.
	 * @throws Throwable On any throwable.
	 * @since 2019/03/31
	 */
	public static void main(String... __args)
		throws Throwable
	{
		// Instruction Counts
		Map<Integer, Counter> counts = new LinkedHashMap<>();
		
		// Load project manager
		ProjectManager pm = ProjectManager.fromArguments(__args);
		
		// For a progress indicator
		PrintStream ps = System.err;
		
		// Totals, which might be useful
		long totalclass = 0,
			totalmeths = 0,
			totalnamth = 0,
			totalinsts = 0;
		Progress progress = new Progress();
		
		// Go through every binary that exists
		for (Binary b : pm.binaryManager(TimeSpaceType.BUILD))
		{
			// Compile the binary to make sure it will "run"
			Binary[] deps = pm.build(TimeSpaceType.BUILD, b.toString());
			
			// Go through the entire ZIP
			try (ZipStreamReader zsr = b.zipStream())
			{
				for (;;)
					try (ZipStreamEntry ent = zsr.nextEntry())
					{
						if (ent == null)
							break;
						
						// Only consider class files
						if (!ent.name().endsWith(".class"))
							continue;
						
						// Print the class
						//ps.printf("Class %s%n", ent.name());
						
						// Decode class file
						ClassFile cf = ClassFile.decode(ent);
						totalclass++;
						
						// Go through methods and count instructions
						for (Method m : cf.methods())
						{
							// Print method
							//ps.printf("\tMethod %s%n", m.nameAndType());
							
							// Count
							totalmeths++;
							
							// Must have code
							ByteCode bc = m.byteCode();
							if (bc == null)
								continue;
							
							// Progress indicator
							ps.print('.');
							
							// Count methods with code
							totalnamth++;
							
							// Count it
							totalinsts += Main.countByteCode(bc, counts,
								progress);
						}
					}
			}
		}
		
		// End progress indicator
		ps.println();
		
		// Build reverses
		List<Reverse> revs = new ArrayList<>(counts.size());
		for (Map.Entry<Integer, Counter> e : counts.entrySet())
			revs.add(new Reverse(e.getKey(), e.getValue().count));
		
		// Sort and reverse so higher values are first
		Collections.sort(revs, new CompareReverse());
		Collections.reverse(revs);
		
		// Switch to output
		ps = System.out;
		
		// Used for percentage cuts
		double dtotalinsts = (double)totalinsts,
			dtotalnamth = (double)totalnamth;
		
		// Print total then every instruction
		ps.printf("Total Classes     : %d%n", totalclass);
		ps.printf("Total Methods     : %d%n", totalmeths);
		ps.printf("Total Methods+Code: %d%n", totalnamth);
		ps.printf("Total Instructions: %d%n", totalinsts);
		ps.printf("Total TODOs       : %d%n", progress.todos);
		ps.printf("Total Methods+TODO: %d (~%6.3f%%)%n",
			progress.methodtodos,
			((double)progress.methodtodos / dtotalnamth) * 100.0);
		ps.printf("Total Methods+NoTD: %d (~%6.3f%%)%n",
			progress.methodnotodos,
			((double)progress.methodnotodos / dtotalnamth) * 100.0);
		for (Reverse r : revs)
		{
			long ic = r.count;
			ps.printf("%15s: %-5d (%6.3f%%)%n",
				InstructionMnemonics.toString(r.op), ic,
				((double)ic / dtotalinsts) * 100.0);
		}
	}
	
	/**
	 * Comparator for reverse operations.
	 *
	 * @since 2019/04/01
	 */
	public static final class CompareReverse
		implements Comparator<Reverse>
	{
		/**
		 * {@inheritDoc}
		 * @since 2019/04/01
		 */
		@Override
		public final int compare(Reverse __a, Reverse __b)
		{
			// Compare counts first to group them together
			long lc = __a.count - __b.count;
			if (lc < 0)
				return -1;
			else if (lc > 0)
				return 1;
			
			// Then just compare the opcode mnemonic so the output list
			// appears more stable
			return InstructionMnemonics.toString(__a.op).compareTo(
				InstructionMnemonics.toString(__b.op));
		}
	}
	
	/**
	 * It is faster to use a counter than it is to create integers for
	 * incrementing.
	 *
	 * @since 2019/03/31
	 */
	public static final class Counter
	{
		/** Count. */
		public long count;
		
		/**
		 * {@inheritDoc}
		 * @since 2019/03/31
		 */
		@Override
		public final String toString()
		{
			return Long.toString(count);
		}
	}
	
	/**
	 * Progress indicators.
	 *
	 * @since 2019/04/01
	 */
	public static final class Progress
	{
		/** The number of TODOs initialized. */
		public long todos;
		
		/** The number of methods containing at least one todo. */
		public long methodtodos;
		
		/** Methods not throwing any todo. */
		public long methodnotodos;
	}
	
	/**
	 * Contains reverse instruction information.
	 *
	 * @since 2019/03/31
	 */
	public static final class Reverse
		implements Comparable<Reverse>
	{
		/** The operation. */
		protected final int op;
		
		/** The total count. */
		protected final long count;
		
		/**
		 * Initializes the reverse.
		 *
		 * @param __o The operation.
		 * @param __c The count.
		 * @since 2019/03/31
		 */
		public Reverse(int __o, long __c)
		{
			this.op = __o;
			this.count = __c;
		}
		
		/**
		 * {@inheritDoc}
		 * @since 2019/03/31
		 */
		@Override
		public final int compareTo(Reverse __b)
		{
			return (int)Math.min(Integer.MAX_VALUE,
				Math.max(Integer.MIN_VALUE, this.count - __b.count));
		}
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






































































































































































































































































































































































































































































































































































































































































Deleted bldt/mids/instruction-popcount/dev/shadowtail/javapopcount/package-info.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

/**
 * This package contains the population count program.
 *
 * @since 2019/03/31
 */

package dev.shadowtail.javapopcount;

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


































Deleted bldt/mids/pcf-to-sqf/META-INF/MANIFEST.MF.

1
2
3
4
5
6
7
8
9
10
11
12
13
Manifest-Version: 1.0
X-SquirrelJME-UUID: 913f028e-3ecc-4a95-8a6f-0c7b1dc38d16
X-SquirrelJME-Error: AP
X-SquirrelJME-Name: PCF to SQF Font Conversion
X-SquirrelJME-Vendor: Stephanie Gawroriski
X-SquirrelJME-Version: 0.3.0
X-SquirrelJME-Description: This converts PCF font data into SQF fonts 
 which are smaller, simpler, and faster to read than supporting PCF 
 from within SquirrelJME.
X-SquirrelJME-Depends: io midp-lcdui
Microedition-Configuration: CLDC-1.8
Main-Class: net.multiphasicapps.pcftosqf.Main

<
<
<
<
<
<
<
<
<
<
<
<
<


























Deleted bldt/mids/sqf-to-c/META-INF/MANIFEST.MF.

1
2
3
4
5
6
7
8
9
10
11
12
Manifest-Version: 1.0
X-SquirrelJME-UUID: 759dec0c-46ab-4918-930e-ff39c386d41b
X-SquirrelJME-Error: BO
X-SquirrelJME-Name: SQF to C
X-SquirrelJME-Vendor: Stephanie Gawroriski
X-SquirrelJME-Version: 0.3.0
X-SquirrelJME-Description: Converts a SQF to a C file, so that RatufaCoat 
 can use it to draw a basic console screen and such.
X-SquirrelJME-Depends: midp-lcdui
Main-Class: dev.shadowtail.sqftoc.Main
Microedition-Configuration: CLDC-1.8-Compact

<
<
<
<
<
<
<
<
<
<
<
<
























Deleted bldt/mids/sxs/META-INF/MANIFEST.MF.

1
2
3
4
5
6
7
8
9
10
11
12
13
Manifest-Version: 1.0
X-SquirrelJME-UUID: 62285c91-c4f4-4f61-83fe-ddc2c97e849c
X-SquirrelJME-Error: BL
X-SquirrelJME-Name: Side By Side Code Debug
X-SquirrelJME-Vendor: Stephanie Gawroriski
X-SquirrelJME-Version: 0.3.0
X-SquirrelJME-Description: This utility is used to provide a view into 
 the native code translation by showing a side by side representation 
 of the input source code, the original byte code, and then the 
 generated native code.
Microedition-Configuration: CLDC-1.8-Compact
Main-Class: dev.shadowtail.sxs.Main
X-SquirrelJME-Depends: builder-support
<
<
<
<
<
<
<
<
<
<
<
<
<


























Deleted bldt/mids/sxs/dev/shadowtail/sxs/Main.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package dev.shadowtail.sxs;

import cc.squirreljme.builder.support.Binary;
import cc.squirreljme.builder.support.BinaryManager;
import cc.squirreljme.builder.support.NoSuchSourceException;
import cc.squirreljme.builder.support.ProjectManager;
import cc.squirreljme.builder.support.Source;
import cc.squirreljme.builder.support.SourceManager;
import cc.squirreljme.builder.support.SourceName;
import cc.squirreljme.builder.support.SourcePathSetType;
import cc.squirreljme.builder.support.TimeSpaceType;
import dev.shadowtail.classfile.nncc.NativeInstruction;
import dev.shadowtail.classfile.nncc.NativeInstructionType;
import dev.shadowtail.classfile.nncc.NativeCode;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import net.multiphasicapps.classfile.ByteCode;
import net.multiphasicapps.classfile.ClassFile;
import net.multiphasicapps.classfile.InstructionMnemonics;
import net.multiphasicapps.classfile.Method;
import net.multiphasicapps.javac.CompilerPathSet;
import net.multiphasicapps.javac.NoSuchInputException;

/**
 * Main entry point and dumber for the class code side by side
 *
 * @since 2019/06/12
 */
public class Main
{
	/** The maximum column size. */
	public static final int COLUMN_SIZE =
		44;
	
	/**
	 * Dumps the given method.
	 *
	 * @param __ps The stream to write to.
	 * @param __srclines The source lines.
	 * @param __m The method to dump.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/06/12
	 */
	public static final void dump(PrintStream __ps,
		List<String> __srclines, Method __m)
		throws NullPointerException
	{
		if (__ps == null || __srclines == null || __m == null)
			throw new NullPointerException("NARG");
		
		// Note what is being dumped
		__ps.printf("****** %s ******", __m.nameAndType());
		__ps.println();
		
		// Line population count, to track how many times it changed to them
		Map<Integer, Integer> lnpopcount = new HashMap<>();
		
		// Get byte code and native code
		ByteCode bc = __m.byteCode();
		NativeCode nc = __m.nativeCode();
		
		// Native debug information
		int nijln = -1,
			nijop = -1,
			nijpc = -1;
		
		// Last position information, to detect changes
		int lljln = nijln,
			lljop = nijop,
			lljpc = nijpc;
		
		// Fragment part builder
		StringBuilder sb = new StringBuilder();
		
		// Major order is the native code
		for (int nidx = 0, numni = nc.length(); nidx < numni; nidx++)
		{
			// Get native instruction details
			NativeInstruction ni = nc.get(nidx);
			int niop = ni.operation();
			
			// Update location information?
			if (niop == NativeInstructionType.DEBUG_POINT)
			{
				nijln = ni.intArgument(0);
				nijop = ni.intArgument(1);
				nijpc = ni.intArgument(2);
			}
			
			// Change of source line?
			if (nijln != lljln)
			{
				// Get population of this line
				Integer popcount = lnpopcount.get(nijln);
				if (popcount == null)
					popcount = Integer.valueOf(1);
				lnpopcount.put(nijln, popcount + 1);
				
				// Get the line, turn tabs to spaces to save room
				String ln = (nijln > 0 && nijln <= __srclines.size() ?
					__srclines.get(nijln - 1) : "<INVALID LINE?>").
					replace('\t', ' ');
				
				// Print the line text
				__ps.printf("    L%4d%3s: %s", nijln, (popcount > 1 ?
					String.format("+%-2d", popcount) : "   "), ln);
				__ps.println();
				
				// Set new last line
				lljln = nijln;
			}
			
			// Change of Java instruction? Get its string form
			String jis = "";
			boolean chjpc;
			if ((chjpc = (nijpc != lljpc)))
			{
				// Which string to put here?
				Object jstr = (bc.isValidAddress(nijpc) ?
					bc.getByAddress(nijpc) :
					InstructionMnemonics.toString(nijop));
				
				// Get form
				jis = String.format("J@%3d: %s", nijpc, jstr);
				
				// Set new last address
				lljpc = nijpc;
			}
			
			// Get native instruction form
			String nis = String.format("N@%3d: %s",
				nidx, ni);
			
			// Get string lengths
			int nisl = nis.length(),
				jisl = jis.length();
			
			// Determine row count
			int nirl = Math.max(1, (nisl + COLUMN_SIZE) / COLUMN_SIZE),
				jirl = Math.max(1, (jisl + COLUMN_SIZE) / COLUMN_SIZE),
				mxrl = Math.max(nirl, jirl);
			
			// Print all rows
			for (int i = 0; i < mxrl; i++)
			{
				// Print indent space
				__ps.print("    ");
				
				// New line or continuation?
				__ps.print((i == 0 ? '>' : ' '));
				
				// Determine fragment start and ends
				int nfs = Math.min(nisl, COLUMN_SIZE * i),
					nfe = Math.min(nisl, nfs + COLUMN_SIZE),
					jfs = Math.min(jisl, COLUMN_SIZE * i),
					jfe = Math.min(jisl, jfs + COLUMN_SIZE);
				
				// Print native fragment
				sb.setLength(0);
				sb.append(nis.substring(nfs, nfe));
				while (sb.length() < COLUMN_SIZE)
					sb.append(' ');
				__ps.print(sb);
				
				// Print left splitter
				__ps.print((i == 0 ? '<' : ' '));
				
				// Splitter if a start match
				__ps.print((i == 0 && chjpc ? '=' : '|'));
				
				// Print right splitter?
				__ps.print((chjpc ? '>' : ' '));
				
				// Print Java fragment
				sb.setLength(0);
				sb.append(jis.substring(jfs, jfe));
				while (sb.length() < COLUMN_SIZE)
					sb.append(' ');
				__ps.print(sb);
				
				// New line or continuation?
				__ps.print((chjpc ? '<' : ' '));
				
				// End line
				__ps.println();
			}
		}
		
		// Spacing
		__ps.println();
	}
	
	/**
	 * Main entry points.
	 *
	 * @param __args Arguments.
	 * @throws Throwable On any exception.
	 * @since 2019/06/12
	 */
	public static void main(String... __args)
		throws Throwable
	{
		// Must exist
		if (__args == null)
			__args = new String[0];
		
		// Load project manager
		ProjectManager pm = ProjectManager.fromArguments(__args);
		
		// Get source and binary manager
		SourceManager sm = pm.sourceManager(TimeSpaceType.BUILD);
		BinaryManager bm = pm.binaryManager(TimeSpaceType.BUILD);
		
		// Get project to look in
		SourceName projectname = new SourceName(
			(__args.length > 0 ? __args[0] : "cldc-compact"));
		
		// Get the source code for line lookup
		Source psrc;
		try
		{
			psrc = sm.get(projectname);
		}
		catch (NoSuchSourceException e)
		{
			psrc = null;
		}
		
		// Get up to date binary
		if (psrc != null)
			bm.compile(bm.get(projectname));
		Binary pbin = bm.get(projectname);
		
		// Get the class we want to look at, make sure dots are slashes!
		String wantclass = (__args.length > 1 ? __args[1] :
			"java/lang/Object").replace('.', '/');
		
		// Load the class file itself
		ClassFile classfile;
		try (CompilerPathSet cps = pbin.pathSet())
		{
			// Open source for parsing
			try (InputStream in = cps.input(wantclass + ".class").open())
			{
				classfile = ClassFile.decode(in);
			}
		}
		
		// Source file line information
		List<String> lines = new ArrayList<>();
		
		// If a source file is set, read all of it!
		String sfn = classfile.sourceFile();
		if (psrc != null && sfn != null)
			try (CompilerPathSet cps = psrc.pathSet(SourcePathSetType.SOURCE))
			{
				// Read
				try (BufferedReader br =
					new BufferedReader(new InputStreamReader(
						cps.input(wantclass + ".java").open())))
				{
					// Debug
					System.err.println("Reading lines...");
					
					// Note
					for (;;)
					{
						String ln = br.readLine();
						
						if (ln == null)
							break;
						
						// Add line
						lines.add(ln);
					}
					
					// Debug
					System.err.printf("Read %d lines!%n", lines.size());
				}
			}
			catch (NoSuchInputException e)
			{
				// Ignore
			}
		
		// Want a specific method by name?
		String onemethod = (__args.length > 2 ? __args[2] : "");
		if (onemethod.isEmpty())
			onemethod = null;
		
		// Scan through methods
		for (Method m : classfile.methods())
		{
			// Ignore abstracts/native
			if (m.flags().isAbstract() || m.flags().isNative())
				continue;
			
			// Wanted just one method and it did not match?
			if (onemethod != null && !m.name().toString().equals(onemethod))
				continue;
			
			// Dump it
			Main.dump(System.out, lines, m);
		}
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<








































































































































































































































































































































































































































































































































































































































































Deleted bldt/mids/sxs/dev/shadowtail/sxs/package-info.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

/**
 * This package contains the side by side debug stuff.
 *
 * @since 2019/06/12
 */

package dev.shadowtail.sxs;

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


































Deleted bldt/mids/txt-to-pbm/META-INF/MANIFEST.MF.

1
2
3
4
5
6
7
8
9
10
Manifest-Version: 1.0
X-SquirrelJME-UUID: a0ad1c6a-7826-4f5e-b1f0-e252d9c8dbab
X-SquirrelJME-Error: BN
X-SquirrelJME-Name: txt-to-pbm
X-SquirrelJME-Vendor: Stephanie Gawroriski
X-SquirrelJME-Version: 0.3.0
X-SquirrelJME-Description: txt-to-pbm
X-SquirrelJME-Depends: midp-lcdui
Microedition-Configuration: CLDC-1.8
Main-Class: dev.shadowtail.txttopbm.Main
<
<
<
<
<
<
<
<
<
<




















Deleted bldt/mids/vm-build/META-INF/MANIFEST.MF.

1
2
3
4
5
6
7
8
9
10
11
12
13
Manifest-Version: 1.0
X-SquirrelJME-UUID: 82dcdfbb-27da-48a6-87f7-7a0a8810360f
X-SquirrelJME-Error: BA
X-SquirrelJME-Name: Virtual Machine on the Build System
X-SquirrelJME-Vendor: Stephanie Gawroriski
X-SquirrelJME-Version: 0.3.0
X-SquirrelJME-Depends: builder-support
X-SquirrelJME-Description: This project is for compatibility purposes only 
 as the VM on top of the build system has been moved into the build 
 system.
Microedition-Configuration: CLDC-1.8-Compact
Main-Class: cc.squirreljme.build.vm.Main

<
<
<
<
<
<
<
<
<
<
<
<
<


























Deleted bldt/mids/vm-build/cc/squirreljme/build/vm/Main.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.build.vm;

import cc.squirreljme.builder.support.vm.VMMain;

/**
 * Compatibility entry point.
 *
 * @since 2018/12/22
 */
public class Main
{
	/**
	 * Compatible entry point.
	 *
	 * @param __args Program arguments.
	 * @since 2018/12/22
	 */
	public static void main(String... __args)
	{
		VMMain.main(__args);
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


































































Deleted bldt/mids/vm-build/cc/squirreljme/build/vm/package-info.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

/**
 * Compatibility package for the VM system.
 *
 * @since 2018/12/22
 */

package cc.squirreljme.build.vm;

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




































Deleted build.cmd.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
@ECHO OFF
REM ---------------------------------------------------------------------------
REM Multi-Phasic Applications: SquirrelJME
REM     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
REM     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
REM ---------------------------------------------------------------------------
REM SquirrelJME is under the GNU General Public License v3, or later.
REM See license.mkd for licensing and copyright information.
REM ---------------------------------------------------------------------------
REM DESCRIPTION: Builds whatever is needed to support the builder and then
REM invokes it using the host virtual machine.

REM Location of EXE file (for out of tree builds)
SET __EXEDIR=%~dp0

REM Do NOT give any variable assignments to the calling shell
setlocal
setlocal enableextensions

REM reset error level
SET ERRORLEVEL=
cmd /c "EXIT /b 0"

REM Set some variables
IF NOT DEFINED JAVA SET JAVA=java
IF NOT DEFINED JAVAC SET JAVAC=javac
IF NOT DEFINED BOOTSTRAP_CLASS SET BOOTSTRAP_CLASS=NewBootstrap

REM Make sure commands exist (try to call them)
%JAVA% -version 2> NUL > NUL
IF %ERRORLEVEL% NEQ 0 (
	ECHO The java command is missing, please SET %%JAVA%%.
	EXIT /b 2
)

%JAVAC% -version 2> NUL > NUL
IF %ERRORLEVEL% NEQ 0 (
	ECHO The javac command is missing, please SET %%JAVAC%%.
	EXIT /b 3
)

REM If the build system class does NOT exist, compile it
SET __HB_VCLS=%BOOTSTRAP_CLASS%.class
SET __HB_VSRC=%__EXEDIR%\utils-dev\boot\%BOOTSTRAP_CLASS%.java
IF NOT EXIST %__HB_VCLS% (
	ECHO Compiling the build system...
	%JAVAC% -source 1.7 -target 1.7 -d . %__EXEDIR%\utils-dev\boot\*.java
	IF %ERRORLEVEL% NEQ 0 (
		ECHO Failed to compile the build system.
		EXIT /b 4
	)
)

REM Execute Java
%JAVA% -Dproject.root=%__EXEDIR% ^
	-Dcc.squirreljme.bootstrap.binary=. ^
	-Dcc.squirreljme.builder.root=%__EXEDIR% ^
	%BOOTSTRAP_CLASS% %*

REM Failed to build the bootstrap (stage 1)
IF %ERRORLEVEL% NEQ 0 (
	ECHO Failed to build the build system.
	EXIT /b %ERRORLEVEL%
)

REM Execute Java, since Proxy interfaces are a mess, a double invocation of
REM the JVM is performed.
%JAVA% -Dproject.root=%__EXEDIR% ^
	-Dcc.squirreljme.bootstrap.binary=. ^
	-Dcc.squirreljme.builder.root=%__EXEDIR% ^
	-Dcc.squirreljme.runtime.javase.java=%JAVA% ^
	-Dcc.squirreljme.runtime.javase.bootpath=sjmeboot.jar ^
	-Dcc.squirreljme.home=home ^
	-jar sjmeboot.jar %*

REM Failed?
EXIT /b %ERRORLEVEL%

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




























































































































































Added build.gradle.



































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
group = "cc.squirreljme"
description = "SquirrelJME is a Java ME 8 Virtual Machine for embedded " +
	"and Internet of Things devices. It has the ultimate goal of being " +
	"99.9% compatible with the Java ME standard."
version = "0.3.0"

// Virtual machine version ID
ext.squirreljmeVMVersion = "03"

allprojects
{
	repositories
	{
		mavenCentral()
		jcenter()
	}
}

Deleted build.sh.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#!/bin/sh
# ---------------------------------------------------------------------------
# Multi-Phasic Applications: SquirrelJME
#     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
#     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
# ---------------------------------------------------------------------------
# SquirrelJME is under the GNU General Public License v3, or later.
# See license.mkd for licensing and copyright information.
# ---------------------------------------------------------------------------
# DESCRIPTION: Builds whatever is needed to support hairball and then invokes
# it using the host virtual machine.

# Force C locale
export LC_ALL=C

# Common directories
__exedir="$(dirname -- "$0")"
__tmpdir="$("$__exedir/utils-dev/tmpdir.sh")"

# Default compilers and run-times
: ${JAVA:="$__exedir/utils-dev/java.sh"}
: ${JAVAC:="$__exedir/utils-dev/javac.sh"}

# The class to use for bootstrapping
: ${BOOTSTRAP_CLASS:=NewBootstrap}

# Bootstrap source file
__bootdir="$__exedir/utils-dev/boot"
__bootsrc="$__bootdir/$BOOTSTRAP_CLASS.java"

# If the Java compiler was not detected, try ECJ instead
if ! which "$JAVAC" > /dev/null
then
	__ecj="$(which ecj 2> /dev/null)"
	if [ "$__ecj" != "" ]
	then
		JAVAC="$__ecj"
	fi
fi

# The build class is missing or out of date?
if [ ! -f "$BOOTSTRAP_CLASS.class" ] || \
	[ "$__bootsrc" -nt "$BOOTSTRAP_CLASS.class" ]
then
	# Clear potential old stuff
	rm -f "$BOOTSTRAP_CLASS.class" "$BOOTSTRAP_CLASS\$"*".class"
	
	# Build it
	echo "Building the build system..." 1>&2
	if ! "$JAVAC" -source 1.7 -target 1.7 -d . \
		"$__bootdir/"*.java
	then
		echo "Failed to build the build system." 1>&2
		exit 1
	fi
fi

# JamVM on older Debian versions has trouble when tools.jar is dynamically
# loaded, it cannot find the resources JAR.
__flaw="$("$JAVA" $JAVA_OPTIONS "$BOOTSTRAP_CLASS" "--toolsflaw" |
	grep '\.jar$' | head -n 1)"

# No flaw was detected, operate normally
if [ -z "$__flaw" ]
then
	__cpflaw="."
	__bsflaw="sjmeboot.jar"

# Otherwise use the library which was found
else
	__cpflaw=".:$__flaw"
	__bsflaw="$__flaw:sjmeboot.jar"
	
	# Add a note that the flaw is being worked around
	echo "Working around tools.jar flaw ($__flaw)." 1>&2
fi

# Run it once to build the bootstrap
if ! "$JAVA" $JAVA_OPTIONS \
	"-Dcc.squirreljme.bootstrap.binary=$(pwd)" \
	"-Dcc.squirreljme.builder.root=$__exedir" \
	-classpath "$__cpflaw" "$BOOTSTRAP_CLASS" "$@"
then
	exit 1
fi

# Run it again to run the bootstrap
if ! "$JAVA" $JAVA_OPTIONS \
	"-Dcc.squirreljme.bootstrap.binary=$(pwd)" \
	"-Dcc.squirreljme.builder.root=$__exedir" \
	"-Dcc.squirreljme.runtime.javase.java=$JAVA" \
	"-Dcc.squirreljme.runtime.javase.bootpath=sjmeboot.jar" \
	"-Dcc.squirreljme.home=home" \
	-classpath "$__bsflaw" \
	"cc.squirreljme.runtime.javase.Main" "$@"
then
	exit 1
fi

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






































































































































































































Added buildSrc/build.gradle.





















>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
plugins
{
	id 'java'
}

dependencies
{
	implementation gradleApi()
	implementation localGroovy()
}

Added buildSrc/src/main/java/cc/squirreljme/plugin/ErrorCodeManager.java.



















































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
package cc.squirreljme.plugin;

import java.io.PrintStream;
import java.util.Map;
import java.util.NoSuchElementException;
import java.util.Set;
import java.util.SortedSet;
import java.util.TreeMap;
import java.util.TreeSet;
import org.gradle.api.Project;

/**
 * This is used to manage the list of errors and otherwise.
 *
 * @since 2020/02/22
 */
public final class ErrorCodeManager
{
	/** The project for discovery. */
	protected final Project project;
	
	/** The mapping of error codes to projects. */
	private final Map<String, Project> _codeMap =
		new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
	
	/** Unclaimed error codes. */
	private final SortedSet<String> _unclaimed =
		new TreeSet<>(String.CASE_INSENSITIVE_ORDER);
	
	/**
	 * Initializes the error code manager.
	 *
	 * @param __project The root project to manage.
	 * @throws NullPointerException On null arguments.
	 * @since 2020/02/22
	 */
	public ErrorCodeManager(Project __project)
		throws NullPointerException
	{
		if (__project == null)
			throw new NullPointerException("No project.");
		
		this.project = __project.getRootProject();
		
		// Add all unclaimed codes
		Set<String> unclaimed = this._unclaimed;
		for (char a = 'A'; a <= 'Z'; a++)
			for (char b = 'A'; b <= 'Z'; b++)
				unclaimed.add(a + "" + b);
	}
	
	/**
	 * Returns an error list manager for the given code ID.
	 *
	 * @param __code The code to get.
	 * @return The error list manager.
	 * @since 2020/02/22
	 */
	public final ErrorListManager errorList(String __code)
	{
		return new ErrorListManager(this.projectByCode(__code));
	}
	
	/**
	 * Returns the next available error code.
	 *
	 * @return The next available error code.
	 * @since 2020/02/22
	 */
	public final String next()
	{
		this.__init();
		
		synchronized (this)
		{
			return this._unclaimed.first();
		}
	}
	
	/**
	 * Prints the error codes to the given stream.
	 *
	 * @param __out The stream to print to.
	 * @throws NullPointerException On null arguments.
	 * @since 2020/02/22
	 */
	public final void print(PrintStream __out)
		throws NullPointerException
	{
		if (__out == null)
			throw new NullPointerException("No output stream.");
		
		this.__init();
		
		// Print out every project
		Map<String, Project> codeMap = this._codeMap;
		synchronized (this)
		{
			for (Map.Entry<String, Project> e : codeMap.entrySet())
				__out.printf("%2s: %s%n", e.getKey(), e.getValue().getName());
		}
	}
	
	/**
	 * Returns the project which owns the given code.
	 *
	 * @param __code The code to obtain.
	 * @throws NoSuchElementException If no such project exists.
	 * @return The resulting
	 */
	public final Project projectByCode(String __code)
		throws NoSuchElementException
	{
		this.__init();
		
		// Search
		Map<String, Project> codeMap = this._codeMap;
		synchronized (this)
		{
			Project rv = codeMap.get(__code);
			if (rv == null)
				throw new IllegalArgumentException(
					String.format("No project for code %s", __code));
			
			return rv;
		}
	}
	
	/**
	 * Initializes the code map.
	 *
	 * @since 2020/02/22
	 */
	private void __init()
	{
		Map<String, Project> codeMap = this._codeMap;
		Set<String> unclaimed = this._unclaimed;
		synchronized (this)
		{
			// Already has been loaded?
			if (!codeMap.isEmpty())
				return;
			
			// Add all projects found to the list
			for (Project sub : this.project.getAllprojects())
			{
				// Only choose SquirrelJME projects
				SquirrelJMEPluginConfiguration config = sub.getExtensions()
					.<SquirrelJMEPluginConfiguration>findByType(
						SquirrelJMEPluginConfiguration.class);
				if (config == null)
					continue;
				
				String code = config.javaDocErrorCode;
				if (code == null)
					throw new IllegalStateException(String.format(
						"Project %s has no error code.", sub.getName()));
				
				Project dup = codeMap.put(code.toUpperCase(), sub);
				if (dup != null)
					throw new IllegalStateException(String.format(
						"Project %s shares error code %s with %s.",
						sub.getName(), code, dup.getName()));
				
				unclaimed.remove(code.toUpperCase());
			}
		}
	}
}

Added buildSrc/src/main/java/cc/squirreljme/plugin/ErrorListManager.java.



















































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
package cc.squirreljme.plugin;

import cc.squirreljme.plugin.util.CommentReader;
import cc.squirreljme.plugin.util.ErrorListTokenizer;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintStream;
import java.nio.file.Files;
import java.nio.file.StandardOpenOption;
import java.util.Map;
import java.util.TreeMap;
import org.gradle.api.Project;
import org.gradle.api.file.FileTree;
import org.gradle.api.plugins.JavaPluginConvention;
import org.gradle.api.tasks.SourceSet;

/**
 * This is used to get the error lists from a project.
 *
 * @since 2020/02/22
 */
public final class ErrorListManager
{
	
	/** The project to manage the list for. */
	protected final Project project;
	
	/** The listed errors. */
	private final Map<Integer, SourceError> _errors =
		new TreeMap<>();
	
	/** The error code for this project. */
	private String _projectErrorCode;
	
	/**
	 * Initializes the error code manager.
	 *
	 * @param __project The project to manage.
	 * @throws NullPointerException On null arguments.
	 * @since 2020/02/22
	 */
	public ErrorListManager(Project __project)
		throws NullPointerException
	{
		if (__project == null)
			throw new NullPointerException("No project.");
		
		this.project = __project;
	}
	
	/**
	 * Returns the next available error.
	 *
	 * @return The next available error.
	 * @since 2020/02/22
	 */
	public final String next()
	{
		this.__init();
		
		return this._projectErrorCode +
			SourceError.indexToString(this.nextIndex());
	}
	
	/**
	 * Returns the next available error.
	 *
	 * @return The next available error.
	 * @since 2020/02/22
	 */
	public final int nextIndex()
	{
		this.__init();
		
		Map<Integer, SourceError> errors = this._errors;
		synchronized (this)
		{
			for (int i = 1; i <= SourceError._MAX_ERROR_CODE; i++)
				if (!errors.containsKey(i))
					return i;
			
			throw new IllegalArgumentException("Ran out of error indexes.");
		}
	}
	
	/**
	 * Prints the errors to the given stream.
	 *
	 * @param __out The stream to write to.
	 * @throws NullPointerException On null arguments.
	 * @since 2020/02/22
	 */
	public final void print(PrintStream __out)
		throws NullPointerException
	{
		if (__out == null)
			throw new NullPointerException("No stream specified.");
		
		this.__init();
		
		synchronized (this)
		{
			for (SourceError e : this._errors.values())
				__out.println(e);
		}
	}
	
	/**
	 * Initializes the code map.
	 *
	 * @since 2020/02/22
	 */
	private void __init()
	{
		Project project = this.project;
		Map<Integer, SourceError> errors = this._errors;
		
		synchronized (this)
		{
			// Already loaded?
			if (this._projectErrorCode != null)
				return;
			
			// This must exist
			SquirrelJMEPluginConfiguration config = project.getExtensions()
				.<SquirrelJMEPluginConfiguration>getByType(
					SquirrelJMEPluginConfiguration.class);
			
			// Fail if this is missing
			String projectErrorCode = config.javaDocErrorCode;
			if (projectErrorCode == null)
				throw new IllegalStateException(String.format(
					"Project %s has no error code.", project.getName()));
			
			// Used as a flag and to indicate the group for this
			this._projectErrorCode = projectErrorCode;
			
			// Temporary buffer for data reading
			StringBuilder buffer = new StringBuilder();
			
			// Get source code
			FileTree sources = project.getConvention()
				.getPlugin(JavaPluginConvention.class).getSourceSets()
				.getByName(SourceSet.MAIN_SOURCE_SET_NAME).getAllJava()
				.getAsFileTree();
			
			// Parse source code
			for (File source : sources)
				try (InputStream in = Files.newInputStream(source.toPath(),
					StandardOpenOption.READ);
					ErrorListTokenizer tokenizer = new ErrorListTokenizer(
						source.toPath().getFileName(),
						new CommentReader(in)))
				{
					// Keep reading in errors
					for (;;)
					{
						// Read the next error
						SourceError error = tokenizer.next();
						if (error == null)
							break;
						
						// Store error in the map
						SourceError old = errors.put(error.index, error);
						
						// Check duplicate
						if (old != null)
							System.err.printf("Duplicate error %s and %s.%n",
								error, old);
						
						// Wrong project
						if (!error.projectCode.equals(projectErrorCode))
							System.err.printf("Error has wrong project: %s," +
								"should be: %s%n", error, projectErrorCode);
					}
				}
				catch (IOException e)
				{
					throw new RuntimeException("Could not decode file.", e);
				}
		}
	}
	
}

Added buildSrc/src/main/java/cc/squirreljme/plugin/SourceError.java.































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
package cc.squirreljme.plugin;

import java.nio.file.Path;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Deque;
import java.util.List;

/**
 * A single error that exists in source code.
 *
 * @since 2020/02/22
 */
public final class SourceError
{
	/** The maximum error code index that can exist. */
	static final int _MAX_ERROR_CODE =
		Character.MAX_RADIX * Character.MAX_RADIX;
	
	/** The code for the project. */
	public final String projectCode;
	
	/** The error index. */
	public final int index;
	
	/** The body of the error. */
	public final String body;
	
	/** Extra parameters. */
	public final List<String> parameters;
	
	/** Where is this located? */
	public final Path where;
	
	/**
	 * Decodes the content to tag information.
	 *
	 * @param __content The content to decode.
	 * @param __where Where the file is located.
	 * @throws IllegalArgumentException If the content is not valid.
	 * @throws NullPointerException On null arguments.
	 * @since 2020/02/22
	 */
	public SourceError(Iterable<String> __content, Path __where)
		throws IllegalArgumentException, NullPointerException
	{
		if (__content == null)
			throw new NullPointerException();
		
		// Set file location
		this.where = __where;
		
		// Put items into the queue
		Deque<String> queue = new ArrayDeque<String>();
		for (String item : __content)
			queue.add(item);
		
		// Read the error code
		String errorCode = queue.pollFirst();
		if (errorCode == null)
			throw new IllegalArgumentException("No error code.");
		
		if (errorCode.length() < 4)
			throw new IllegalArgumentException("Error code too short.");
		
		// Project code is the first two characters
		this.projectCode = errorCode.substring(0, 2).toUpperCase();
		this.index = SourceError.stringToIndex(errorCode.substring(2, 4));
		
		// Fill in content description
		StringBuilder body = new StringBuilder();
		while (!queue.isEmpty())
		{
			// Stop when nothing is left, or if there are starting parameters
			String item = queue.peekFirst();
			if (item == null || item.equals("("))
				break;
			
			// Add formatting space
			if (body.length() > 0)
				body.append(' ');
			
			// And append whatever we put in
			body.append(queue.removeFirst());
		}
		
		// Store body in
		this.body = body.toString();
		
		// Parameter list?
		List<String> parameters = new ArrayList<String>();
		if ("(".equals(queue.peekFirst()))
		{
			// Process queue
			StringBuilder buffer = new StringBuilder();
			while (!queue.isEmpty())
			{
				String item = queue.peekFirst();
				
				// End parameter or next?
				boolean isEnd = (item == null || item.equals(")"));
				if (isEnd || item.equals(";"))
				{
					// Consume it
					queue.pollFirst();
					
					// Store into parameter list?
					if (buffer.length() > 0)
					{
						parameters.add(buffer.toString());
						buffer.setLength(0);
					}
					
					// End here?
					if (isEnd)
						break;
				}
				
				// Add formatting space
				if (buffer.length() > 0)
					buffer.append(' ');
				
				// And append whatever we put in
				buffer.append(queue.removeFirst());
			}
		}
		
		// Store parameters
		this.parameters = Collections.<String>unmodifiableList(parameters);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2020/02/22
	 */
	@Override
	public final String toString()
	{
		StringBuilder sb = new StringBuilder();
		
		// Code index
		sb.append(this.projectCode);
		sb.append(SourceError.indexToString(this.index));
		sb.append(": ");
		
		// Content
		sb.append(this.body);
		
		List<String> parameters = this.parameters;
		if (!parameters.isEmpty())
		{
			sb.append(" (");
			
			for (int i = 0, n = parameters.size(); i < n; i++)
			{
				if (i > 0)
					sb.append("; ");
				
				sb.append(parameters.get(0));
			}
			
			sb.append(")");
		}
		
		// Place location of this file
		Path where = this.where;
		if (where != null)
		{
			sb.append(" <");
			sb.append(where);
			sb.append(">");
		}
		
		return sb.toString();
	}
	
	/**
	 * Returns string form of the given index.
	 *
	 * @param __index The index to translate.
	 * @return The translated string to index.
	 * @since 2020/02/22
	 */
	public static String indexToString(int __index)
	{
		StringBuilder sb = new StringBuilder();
		
		sb.append(Character.toUpperCase(Character.forDigit(
			__index / Character.MAX_RADIX, Character.MAX_RADIX)));
		sb.append(Character.toUpperCase(Character.forDigit(
			__index % Character.MAX_RADIX, Character.MAX_RADIX)));
		
		return sb.toString();
	}
	
	/**
	 * Returns the index for the given string.
	 *
	 * @return The resulting index.
	 * @throws IllegalArgumentException If the string is not valid.
	 * @throws NullPointerException On null arguments.
	 * @since 2020/02/22
	 */
	public static int stringToIndex(String __string)
		throws IllegalArgumentException, NullPointerException
	{
		if (__string == null)
			throw new NullPointerException("No string specified.");
		
		if (__string.length() != 2)
			throw new IllegalArgumentException("Invalid string length.");
		
		int rv = (Character.digit(__string.charAt(0), Character.MAX_RADIX) *
			Character.MAX_RADIX) +
			Character.digit(__string.charAt(1), Character.MAX_RADIX);
		
		if (rv < 0 || rv > SourceError._MAX_ERROR_CODE)
			throw new IllegalArgumentException("Out of range index.");
		
		return rv;
	}
}

Added buildSrc/src/main/java/cc/squirreljme/plugin/SquirrelJMEPlugin.java.







































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.plugin;

import cc.squirreljme.plugin.tasks.AdditionalManifestPropertiesTask;
import cc.squirreljme.plugin.tasks.GenerateTestsListTask;
import cc.squirreljme.plugin.tasks.MimeDecodeResourcesTask;
import cc.squirreljme.plugin.tasks.RunEmulatedTask;
import cc.squirreljme.plugin.tasks.RunNativeTask;
import org.gradle.api.Plugin;
import org.gradle.api.Project;
import org.gradle.api.Task;
import org.gradle.api.tasks.SourceSet;

/**
 * Plugin for all SquirrelJME operations that are needed in Gradle in order
 * to provide the correct functionality.
 *
 * @since 2020/02/15
 */
public class SquirrelJMEPlugin
	implements Plugin<Project>
{
	/**
	 * {@inheritDoc}
	 * @since 2020/02/15
	 */
	@Override
	public void apply(Project __project)
	{
		// Add configuration for SquirrelJME
		__project.getExtensions().<SquirrelJMEPluginConfiguration>create(
			"squirreljme", SquirrelJMEPluginConfiguration.class,
			this, __project);
		
		// Resource processing tasks
		Task processResources = __project.getTasks().
			getByName("processResources");
		Task processTestResources = __project.getTasks().
			getByName("processTestResources");
		
		// JAR Tasks
		Task jarTask = __project.getTasks().getByName("jar");
		
		// Run native application
		Task rna = __project.getTasks().create("runNative",
			RunNativeTask.class, jarTask);
		
		// Run emulated program
		Task esp = __project.getTasks().create("runSpringCoat",
			RunEmulatedTask.class,
			jarTask, "springcoat", false);
		Task esu = __project.getTasks().create("runSummerCoat",
			RunEmulatedTask.class,
			jarTask, "summercoat", false);
		
		// Mime Decode Resources
		Task mmr = __project.getTasks().create("mimeDecodeResources",
			MimeDecodeResourcesTask.class, SourceSet.MAIN_SOURCE_SET_NAME,
			processResources);
		Task tmr = __project.getTasks().create("mimeDecodeTestResources",
			MimeDecodeResourcesTask.class, SourceSet.TEST_SOURCE_SET_NAME,
			processTestResources);
		
		// Generate the list of tests that are available
		Task gtl = __project.getTasks().create("generateTestsList",
			GenerateTestsListTask.class, processTestResources);
		
		// Add SquirrelJME properties to the manifest
		Task sjp = __project.getTasks().create("additionalJarProperties",
			AdditionalManifestPropertiesTask.class, jarTask, processResources);
		
		// List error codes used by projects
		Task listErrorCodes = __project.getTasks()
			.create("listErrorCodes");
		listErrorCodes.setGroup("squirreljme");
		listErrorCodes.setDescription("Lists error code prefixes.");
		listErrorCodes.doLast((Task __task) ->
			new ErrorCodeManager(__project.getRootProject())
				.print(System.out));
		
		// Determine the next error code that is available
		Task nextErrorCode = __project.getTasks()
			.create("nextErrorCode");
		nextErrorCode.setGroup("squirreljme");
		nextErrorCode.setDescription("Returns the next free error code.");
		nextErrorCode.doLast((Task __task) ->
			System.out.println(new ErrorCodeManager(__project.getRootProject())
				.next()));
		
		// List errors in single project
		Task listErrors = __project.getTasks()
			.create("listErrors");
		listErrors.setGroup("squirreljme");
		listErrors.setDescription("Lists all of the source error codes.");
		listErrors.doLast((Task __task) ->
			new ErrorListManager(__project).print(System.out));
		
		// Returns the next available error in single project
		Task nextError = __project.getTasks()
			.create("nextError");
		nextError.setGroup("squirreljme");
		nextError.setDescription("Returns the next free error code.");
		nextError.doLast((Task __task) ->
			System.out.println(new ErrorListManager(__project).next()));
	}
}

Added buildSrc/src/main/java/cc/squirreljme/plugin/SquirrelJMEPluginConfiguration.java.



























































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.plugin;

import cc.squirreljme.plugin.swm.JavaMEConfiguration;
import cc.squirreljme.plugin.swm.JavaMEMidlet;
import cc.squirreljme.plugin.swm.JavaMEMidletType;
import cc.squirreljme.plugin.swm.JavaMEProfile;
import cc.squirreljme.plugin.swm.JavaMEStandard;
import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
import org.gradle.api.Project;

/**
 * Allows SquirrelJME specific parts of modules to be configured.
 *
 * @since 2020/02/15
 */
public class SquirrelJMEPluginConfiguration
{
	/** The current plugin. */
	public SquirrelJMEPlugin currentPlugin;
	
	/** The current project. */
	public Project currentProject;
	
	/** The JavaDoc Error Code. */
	public String javaDocErrorCode;
	
	/** The type of program this is. */
	public JavaMEMidletType swmType =
		JavaMEMidletType.APPLICATION;
	
	/** The name of the MIDlet or LIBlet. */
	public String swmName;
	
	/** The vendor of the MIDlet or LIBlet. */
	public String swmVendor;
	
	/** Ignore in the launcher? */
	public boolean ignoreInLauncher;
	
	/** The configurations this defines. */
	public Set<JavaMEConfiguration> definedConfigurations =
		new LinkedHashSet<>();
	
	/** The profiles this defines. */
	public Set<JavaMEProfile> definedProfiles =
		new LinkedHashSet<>();
	
	/** The standards defined. */
	public Set<JavaMEStandard> definedStandards =
		new LinkedHashSet<>();
	
	/** The main class entry point (optional). */
	public String mainClass;
	
	/** MIDlets that are available for entry. */
	public List<JavaMEMidlet> midlets =
		new ArrayList<>();
	
	/**
	 * Initializes the configuration with the contained project.
	 *
	 * @param __plugin The current plugin.
	 * @param __project The project to wrap.
	 * @throws NullPointerException On null arguments.
	 * @since 2020/02/15
	 */
	public SquirrelJMEPluginConfiguration(SquirrelJMEPlugin __plugin,
		Project __project)
		throws NullPointerException
	{
		if (__plugin == null || __project == null)
			throw new NullPointerException("NARG");
		
		this.currentPlugin = __plugin;
		this.currentProject = __project;
	}
	
	/**
	 * Gets the configuration from the given project.
	 *
	 * @param __proj The project to get the config from.
	 * @return The resulting configuration.
	 * @throws NullPointerException On null arguments.
	 * @since 2020/02/28
	 */
	public static SquirrelJMEPluginConfiguration configuration(Project __proj)
		throws NullPointerException
	{
		if (__proj == null)
			throw new NullPointerException("No project specified.");
			
		// Find our config
		return __proj.getExtensions()
			.<SquirrelJMEPluginConfiguration>getByType(
				SquirrelJMEPluginConfiguration.class);
	}
	
	/**
	 * Is this a SquirrelJME application?
	 *
	 * @param __project The project to check.
	 * @return If it is an application.
	 * @throws NullPointerException On null arguments.
	 * @since 2020/02/16
	 */
	public static boolean isApplication(Project __project)
		throws NullPointerException
	{
		return SquirrelJMEPluginConfiguration.configuration(__project).swmType ==
			JavaMEMidletType.APPLICATION;
	}
}

Name change from bldt/libs/palmos-utils/dev/shadowtail/palmos/PalmDatabaseAttribute.java to buildSrc/src/main/java/cc/squirreljme/plugin/palmos/PalmDatabaseAttribute.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package dev.shadowtail.palmos;

/**
 * This represents an attribute for the Palm Database.
 *
 * @since 2019/07/13
 */
public enum PalmDatabaseAttribute









|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.plugin.palmos;

/**
 * This represents an attribute for the Palm Database.
 *
 * @since 2019/07/13
 */
public enum PalmDatabaseAttribute
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
	
	/** The bit used. */
	public final int bit;
	
	/**
	 * Initializes the attribute.
	 *
	 * @param __b The bit used.
	 * @since 2019/07/13
	 */
	private PalmDatabaseAttribute(int __bit)
	{
		this.bit = __bit;
	}
}








|


|





60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
	
	/** The bit used. */
	public final int bit;
	
	/**
	 * Initializes the attribute.
	 *
	 * @param __bit The bit used.
	 * @since 2019/07/13
	 */
	PalmDatabaseAttribute(int __bit)
	{
		this.bit = __bit;
	}
}

Name change from bldt/libs/palmos-utils/dev/shadowtail/palmos/PalmDatabaseBuilder.java to buildSrc/src/main/java/cc/squirreljme/plugin/palmos/PalmDatabaseBuilder.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package dev.shadowtail.palmos;

import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.HashSet;
import java.util.Random;
import java.util.Set;

/**
 * This class is used to build PalmOS databases and resource databases.
 *
 * @since 2019/07/13
 */









|






<

|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16

17
18
19
20
21
22
23
24
25
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.plugin.palmos;

import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.ArrayList;

import java.util.HashSet;
import java.util.List;
import java.util.Set;

/**
 * This class is used to build PalmOS databases and resource databases.
 *
 * @since 2019/07/13
 */
299
300
301
302
303
304
305
306

307
308
309
310
311
312
313
314
315
316
		
		// Open data output to write to
		DataOutputStream dos = new DataOutputStream(__out);
		
		// Write the name bytes
		byte[] namebytes = this._name.getBytes("utf-8");
		int namelen = namebytes.length;
		dos.write(namebytes, 0, Math.min(namelen, _NAME_LIMIT));

		
		// Pad shorter names
		for (int i = namelen; i < _NAME_LIMIT; i++)
			dos.write(0);
		
		// Determine attribute bit-field
		int attrs = 0;
		for (PalmDatabaseAttribute attr : this._attributes)
			attrs |= attr.bit;
		







|
>


|







298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
		
		// Open data output to write to
		DataOutputStream dos = new DataOutputStream(__out);
		
		// Write the name bytes
		byte[] namebytes = this._name.getBytes("utf-8");
		int namelen = namebytes.length;
		dos.write(namebytes, 0, Math.min(namelen,
			PalmDatabaseBuilder._NAME_LIMIT));
		
		// Pad shorter names
		for (int i = namelen; i < PalmDatabaseBuilder._NAME_LIMIT; i++)
			dos.write(0);
		
		// Determine attribute bit-field
		int attrs = 0;
		for (PalmDatabaseAttribute attr : this._attributes)
			attrs |= attr.bit;
		
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
		dos.writeShort(attrs);
		
		// Write version
		dos.writeShort(this._version);
		
		// Creation/Modification/Backup Time (In Mac OS epoch seconds)
		dos.writeInt(
			(int)((this._createtime + _EPOCH_DIFF_MILLISECONDS) / 1000L));
		dos.writeInt(
			(int)((this._modtime + _EPOCH_DIFF_MILLISECONDS) / 1000L));
		dos.writeInt(
			(int)((this._backuptime + _EPOCH_DIFF_MILLISECONDS) / 1000L));
		
		// Modification count
		dos.writeInt(this._modcount);
		
		// Application Info
		dos.writeInt(0);
		







|

|

|







327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
		dos.writeShort(attrs);
		
		// Write version
		dos.writeShort(this._version);
		
		// Creation/Modification/Backup Time (In Mac OS epoch seconds)
		dos.writeInt(
			(int)((this._createtime + PalmDatabaseBuilder._EPOCH_DIFF_MILLISECONDS) / 1000L));
		dos.writeInt(
			(int)((this._modtime + PalmDatabaseBuilder._EPOCH_DIFF_MILLISECONDS) / 1000L));
		dos.writeInt(
			(int)((this._backuptime + PalmDatabaseBuilder._EPOCH_DIFF_MILLISECONDS) / 1000L));
		
		// Modification count
		dos.writeInt(this._modcount);
		
		// Application Info
		dos.writeInt(0);
		

Name change from bldt/libs/palmos-utils/dev/shadowtail/palmos/PalmDatabaseType.java to buildSrc/src/main/java/cc/squirreljme/plugin/palmos/PalmDatabaseType.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package dev.shadowtail.palmos;

/**
 * This represents the database type to use when creating databases.
 *
 * @since 2019/07/13
 */
public enum PalmDatabaseType









|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.plugin.palmos;

/**
 * This represents the database type to use when creating databases.
 *
 * @since 2019/07/13
 */
public enum PalmDatabaseType

Name change from bldt/libs/palmos-utils/dev/shadowtail/palmos/PalmRecord.java to buildSrc/src/main/java/cc/squirreljme/plugin/palmos/PalmRecord.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package dev.shadowtail.palmos;

/**
 * This represents a single record within a database.
 *
 * @since 2019/07/13
 */
public final class PalmRecord









|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.plugin.palmos;

/**
 * This represents a single record within a database.
 *
 * @since 2019/07/13
 */
public final class PalmRecord

Name change from bldt/libs/palmos-utils/dev/shadowtail/palmos/__RecordWriter__.java to buildSrc/src/main/java/cc/squirreljme/plugin/palmos/__RecordWriter__.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package dev.shadowtail.palmos;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.Collection;

/**









|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.plugin.palmos;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.Collection;

/**

Name change from bldt/libs/palmos-utils/dev/shadowtail/palmos/package-info.java to buildSrc/src/main/java/cc/squirreljme/plugin/palmos/package-info.java.

9
10
11
12
13
14
15
16
17

/**
 * This package contains the base for the PalmOS utilities.
 *
 * @since 2019/07/13
 */

package dev.shadowtail.palmos;








|

9
10
11
12
13
14
15
16
17

/**
 * This package contains the base for the PalmOS utilities.
 *
 * @since 2019/07/13
 */

package cc.squirreljme.plugin.palmos;

Added buildSrc/src/main/java/cc/squirreljme/plugin/swm/APIName.java.











































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.plugin.swm;

import cc.squirreljme.plugin.util.StringUtils;

/**
 * This represents the name of an API.
 *
 * @since 2017/11/30
 */
public final class APIName
	implements Comparable<APIName>
{
	/** The name of the API. */
	protected final String string;
	
	/**
	 * Initializes the API name from the given string.
	 *
	 * @param __n The name of the API.
	 * @throws InvalidSuiteException If the suite is not valid.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/11/30
	 */
	public APIName(String __n)
		throws InvalidSuiteException, NullPointerException
	{
		if (__n == null)
			throw new NullPointerException("NARG");
		
		// Force all APIs to be uppercase
		__n = StringUtils.toUpperCaseNoLocale(__n);
		
		// {@squirreljme.error DG01 An illegal character was
		// specified in the API name. (The API name)}
		if (StringUtils.firstIndex("\0\r\n:;", __n) >= 0)
			throw new InvalidSuiteException(String.format("DG01 %s", __n));
		
		// {@squirreljme.error DG02 API name cannot be blank.}
		if (__n.length() <= 0)
			throw new InvalidSuiteException("DG02");
		
		this.string = __n;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/11/30
	 */
	@Override
	public int compareTo(APIName __o)
	{
		return this.string.compareTo(__o.string);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/11/30
	 */
	@Override
	public boolean equals(Object __o)
	{
		if (this == __o)
			return true;
		
		if (!(__o instanceof APIName))
			return false;
		
		return this.string.equals(((APIName)__o).string);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/11/30
	 */
	@Override
	public int hashCode()
	{
		return this.string.hashCode();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/11/30
	 */
	@Override
	public String toString()
	{
		return this.string;
	}
}

Added buildSrc/src/main/java/cc/squirreljme/plugin/swm/InternalName.java.















































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.plugin.swm;

/**
 * This represents an internal project name which is used by SquirrelJME.
 *
 * @since 2017/12/31
 */
public final class InternalName
	implements MarkedProvided
{
	/** The project name. */
	protected final String name;
	
	/**
	 * Initializes the internal name.
	 *
	 * @param __n The name to use.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/12/31
	 */
	public InternalName(String __n)
		throws NullPointerException
	{
		if (__n == null)
			throw new NullPointerException("NARG");
		
		this.name = __n;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/12/31
	 */
	@Override
	public boolean equals(Object __o)
	{
		if (this == __o)
			return true;
		
		if (!(__o instanceof InternalName))
			return false;
		
		return this.name.equals(((InternalName)__o).name);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/12/31
	 */
	@Override
	public int hashCode()
	{
		return this.name.hashCode();
	}
	
	/**
	 * Returns the internal name.
	 *
	 * @return The internal name.
	 * @since 2017/12/31
	 */
	public String name()
	{
		return this.name;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/12/31
	 */
	@Override
	public String toString()
	{
		return this.name;
	}
}

Added buildSrc/src/main/java/cc/squirreljme/plugin/swm/InvalidSuiteException.java.



































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.plugin.swm;

/**
 * This is thrown when a midlet has an invalid property or is otherwise not
 * valid.
 *
 * @since 2017/11/23
 */
public class InvalidSuiteException
	extends IllegalArgumentException
{
	/**
	 * Initialize the exception with no message or cause.
	 *
	 * @since 2017/11/23
	 */
	public InvalidSuiteException()
	{
	}
	
	/**
	 * Initialize the exception with a message and no cause.
	 *
	 * @param __m The message.
	 * @since 2017/11/23
	 */
	public InvalidSuiteException(String __m)
	{
		super(__m);
	}
	
	/**
	 * Initialize the exception with a message and cause.
	 *
	 * @param __m The message.
	 * @param __c The cause.
	 * @since 2017/11/23
	 */
	public InvalidSuiteException(String __m, Throwable __c)
	{
		super(__m, __c);
	}
	
	/**
	 * Initialize the exception with no message and with a cause.
	 *
	 * @param __c The cause.
	 * @since 2017/11/23
	 */
	public InvalidSuiteException(Throwable __c)
	{
		super(__c);
	}
}

Added buildSrc/src/main/java/cc/squirreljme/plugin/swm/JavaMEConfiguration.java.











































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.plugin.swm;

import cc.squirreljme.plugin.util.StringUtils;
import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import java.util.Objects;

/**
 * This represents a configuration such as CLDC which specifies which base
 * classes are available. Configurations may optionally be "compact" in which
 * they are a lighter version.
 *
 * @since 2016/12/14
 */
public final class JavaMEConfiguration
	implements Comparable<JavaMEConfiguration>, MarkedDependency, MarkedProvided
{
	/** Name. */
	protected final APIName name;
	
	/** Version. */
	protected final SuiteVersion version;
	
	/** Is this configuration compact? */
	protected final boolean compact;
	
	/** String representation. */
	private Reference<String> _string;
	
	/**
	 * Initializes the configuration using the given API name and version.
	 *
	 * @param __n The name to use.
	 * @param __v The version of the suite.
	 * @param __c If {@code true} then the configuration is compact.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/11/30
	 */
	public JavaMEConfiguration(APIName __n, SuiteVersion __v, boolean __c)
		throws NullPointerException
	{
		if (__n == null || __v == null)
			throw new NullPointerException("NARG");
		
		// Set
		this.name = __n;
		this.version = __v;
		this.compact = __c;
	}
	
	/**
	 * Initializes the configuration by parsing the given string.
	 *
	 * @param __n The string to parse.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/11/30
	 */
	public JavaMEConfiguration(String __n)
		throws NullPointerException
	{
		if (__n == null)
			throw new NullPointerException("NARG");
		
		// {@squirreljme.error DG02 Expected two or three fields for the
		// configuration. (The input string)}
		String[] fields = StringUtils.fieldSplit('-', __n);
		int fn = fields.length;
		if (fn != 2 && fn != 3)
			throw new InvalidSuiteException(String.format("AR02 %s", __n));
		
		// Potentially compact?
		this.compact = (fn > 2 &&
			0 == fields[2].compareToIgnoreCase("compact"));
		
		// Parse name and version
		this.name = new APIName(fields[0]);
		this.version = new SuiteVersion(fields[1]);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/11/30
	 */
	@Override
	public int compareTo(JavaMEConfiguration __o)
	{
		int rv = this.name.compareTo(__o.name);
		if (rv != 0)
			return rv;
		
		rv = this.version.compareTo(__o.version);
		if (rv != 0)
			return rv;
		
		// Compact is before non-compact
		boolean a = this.compact,
			b = __o.compact;
		if (a != b)
			return (a ? -1 : 1);
		return 0;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/11/30
	 */
	@Override
	public boolean equals(Object __o)
	{
		if (this == __o)
			return true;
		
		if (!(__o instanceof JavaMEConfiguration))
			return false;
		
		JavaMEConfiguration o = (JavaMEConfiguration)__o;
		return this.name.equals(o.name) &&
			this.version.equals(o.version) &&
			this.compact == o.compact;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/11/30
	 */
	@Override
	public int hashCode()
	{
		return this.name.hashCode() ^
			Objects.hashCode(this.version) ^
			(this.compact ? 0xFFFFFFFF : 0);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/12/31
	 */
	@Override
	public boolean isOptional()
	{
		return false;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/12/31
	 */
	@Override
	public boolean matchesProvided(MarkedProvided __mp)
		throws NullPointerException
	{
		if (__mp == null)
			throw new NullPointerException("NARG");
		
		return this.equals(__mp);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/11/30
	 */
	@Override
	public String toString()
	{
		Reference<String> ref = this._string;
		String rv;
		
		if (ref == null || null == (rv = ref.get()))
			this._string = new WeakReference<>((rv = "" +
				this.name + "-" + this.version +
				(this.compact ? "-compact" : "")));
		
		return rv;
	}
	
	/**
	 * Returns the version of this configuration.
	 *
	 * @return The configuration version.
	 * @since 2017/12/05
	 */
	public SuiteVersion version()
	{
		return this.version;
	}
}

Added buildSrc/src/main/java/cc/squirreljme/plugin/swm/JavaMEMidlet.java.





















































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.plugin.swm;

/**
 * Defines a MIDlet that can be launched.
 *
 * @since 2020/02/15
 */
public final class JavaMEMidlet
{
	/** The title. */
	public final String title;
	
	/** The icon. */
	public final String icon;
	
	/** The main class. */
	public final String mainClass;
	
	/**
	 * Initializes the MIDlet information.
	 *
	 * @param __title The title of the MIDlet.
	 * @param __icon The icon of the MIDlet.
	 * @param __main The main class.
	 * @throws NullPointerException If no title or main class was specified.
	 * @since 2020/02/15
	 */
	public JavaMEMidlet(String __title, String __icon, String __main)
		throws NullPointerException
	{
		if (__title == null || __main == null)
			throw new NullPointerException("No title or main specified.");
		
		this.title = __title;
		this.icon = (__icon == null ? "" : __icon);
		this.mainClass = __main;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2020/02/15
	 */
	@Override
	public final boolean equals(Object __o)
	{
		if (this == __o)
			return true;
		
		if (!(__o instanceof JavaMEMidlet))
			return false;
		
		JavaMEMidlet o = (JavaMEMidlet)__o;
		return this.title.equals(o.title) &&
			this.icon.equals(o.icon) &&
			this.mainClass.equals(o.mainClass);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2020/02/15
	 */
	@Override
	public final int hashCode()
	{
		return this.title.hashCode() ^
			this.icon.hashCode() ^
			this.mainClass.hashCode();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2020/02/15
	 */
	@Override
	public final String toString()
	{
		return String.format("%s, %s, %s",
			this.title, this.icon, this.mainClass);
	}
}

Added buildSrc/src/main/java/cc/squirreljme/plugin/swm/JavaMEMidletType.java.































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.plugin.swm;

/**
 * Represents the type of MIDlet a program is.
 *
 * @since 2020/02/15
 */
public enum JavaMEMidletType
{
	/** API. */
	API,
	
	/** Library. */
	LIBRARY,
	
	/** Application. */
	APPLICATION,
	
	/* End. */
	;
	
	/**
	 * Returns the dependency key.
	 *
	 * @param __i The dependency index.
	 * @return The dependency key.
	 * @since 2020/02/28
	 */
	public final String dependencyKey(int __i)
	{
		return this.prefixKey() + "-Dependency-" + __i;
	}
	
	/**
	 * Returns the name key.
	 *
	 * @return The name key.
	 * @since 2020/02/28
	 */
	public final String nameKey()
	{
		return this.prefixKey() + "-Name";
	}
	
	/**
	 * Returns the prefix key.
	 *
	 * @return The prefix key.
	 * @since 2020/02/28
	 */
	public final String prefixKey()
	{
		switch (this)
		{
			case API:			return "X-SquirrelJME-API";
			case LIBRARY:		return "LIBlet";
			case APPLICATION:	return "MIDlet";
			
			default:
				throw new RuntimeException("Unknown project type.");
		}
	}
	
	/**
	 * Returns the vendor key.
	 *
	 * @return The vendor key.
	 * @since 2020/02/28
	 */
	public final String vendorKey()
	{
		return this.prefixKey() + "-Vendor";
	}
	
	/**
	 * Returns the version key.
	 *
	 * @return The version key.
	 * @since 2020/02/28
	 */
	public final String versionKey()
	{
		return this.prefixKey() + "-Version";
	}
}

Added buildSrc/src/main/java/cc/squirreljme/plugin/swm/JavaMEProfile.java.



















































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.plugin.swm;

import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import java.util.Objects;

/**
 * This represents a profile that may be implemented, such as MIDP.
 *
 * @since 2016/12/14
 */
public final class JavaMEProfile
	implements Comparable<JavaMEProfile>, MarkedDependency, MarkedProvided
{
	/** Name. */
	protected final APIName name;
	
	/** Version. */
	protected final SuiteVersion version;
	
	/** String representation. */
	private Reference<String> _string;
	
	/**
	 * Initializes the profile using the given API name and version.
	 *
	 * @param __n The name to use.
	 * @param __v The version of the suite, this is optional.
	 * @throws NullPointerException If no name was specified.
	 * @since 2017/11/30
	 */
	public JavaMEProfile(APIName __n, SuiteVersion __v)
		throws NullPointerException
	{
		if (__n == null)
			throw new NullPointerException("NARG");
		
		this.name = __n;
		this.version = __v;
	}
	
	/**
	 * Initializes the profile by parsing the given string.
	 *
	 * @param __n The string to parse.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/11/30
	 */
	public JavaMEProfile(String __n)
		throws NullPointerException
	{
		if (__n == null)
			throw new NullPointerException("NARG");
		
		// No version specified
		int n = __n.length(),
			dx = __n.lastIndexOf('-');
		char c;
		if (dx < 0 || dx + 1 >= n || (c = __n.charAt(dx + 1)) < '0' || c > '9')
		{
			this.name = new APIName(__n);
			this.version = null;
		}
		
		// There is a version
		else
		{
			this.name = new APIName(__n.substring(0, dx));
			this.version = new SuiteVersion(__n.substring(dx + 1));
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/11/30
	 */
	@Override
	public int compareTo(JavaMEProfile __o)
	{
		int rv = this.name.compareTo(__o.name);
		if (rv != 0)
			return rv;
		
		SuiteVersion a = this.version,
			b = __o.version;
		if ((a == null) != (b == null))
			return (a == null ? -1 : 1);
		else if (a != null)
			return a.compareTo(b);
		return 0;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/11/30
	 */
	@Override
	public boolean equals(Object __o)
	{
		if (this == __o)
			return true;
		
		if (!(__o instanceof JavaMEProfile))
			return false;
		
		JavaMEProfile o = (JavaMEProfile)__o;
		return this.name.equals(o.name) &&
			Objects.equals(this.version, o.version);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/11/30
	 */
	@Override
	public int hashCode()
	{
		return this.name.hashCode() ^
			Objects.hashCode(this.version);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/12/31
	 */
	@Override
	public boolean isOptional()
	{
		return false;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/12/31
	 */
	@Override
	public boolean matchesProvided(MarkedProvided __mp)
		throws NullPointerException
	{
		if (__mp == null)
			throw new NullPointerException("NARG");
		
		return this.equals(__mp);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/11/30
	 */
	@Override
	public String toString()
	{
		
		Reference<String> ref = this._string;
		String rv;
		
		if (ref == null || null == (rv = ref.get()))
			this._string = new WeakReference<>((rv = "Profile " +
				this.name + ":" + this.version));
		
		return rv;
	}
	
	/**
	 * Returns the version of this profile.
	 *
	 * @return The profile version.
	 * @since 2017/12/05
	 */
	public SuiteVersion version()
	{
		return this.version;
	}
}

Added buildSrc/src/main/java/cc/squirreljme/plugin/swm/JavaMEStandard.java.































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.plugin.swm;

import cc.squirreljme.plugin.util.StringUtils;
import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import java.util.Objects;

/**
 * This represents a standard which is provided by an API.
 *
 * @since 2017/12/05
 */
public final class JavaMEStandard
	implements Comparable<JavaMEStandard>, MarkedProvided
{
	/** The standard name. */
	protected final SuiteName name;
	
	/** The vendor of the standard. */
	protected final SuiteVendor vendor;
	
	/** The version of the standard. */
	protected final SuiteVersion version;
	
	/** String representation. */
	private Reference<String> _string;
	
	/**
	 * Initializes the standard using the given fields.
	 *
	 * @param __name The name of the standard.
	 * @param __vend The vendor of the standard.
	 * @param __vers The version of the standard.
	 * @throws NullPointerException If no name was specified.
	 * @since 2020/02/28
	 */
	public JavaMEStandard(String __name, String __vend, String __vers)
		throws NullPointerException
	{
		this(new SuiteName(__name),
			(__vend == null ? null : new SuiteVendor(__vend)),
			(__vers == null ? null : new SuiteVersion(__vers)));
	}
	
	/**
	 * Initializes the standard using the given fields.
	 *
	 * @param __name The name of the standard.
	 * @param __vend The vendor of the standard.
	 * @param __vers The version of the standard.
	 * @throws NullPointerException If no name was specified.
	 * @since 2017/12/30
	 */
	public JavaMEStandard(SuiteName __name, SuiteVendor __vend,
		SuiteVersion __vers)
		throws NullPointerException
	{
		if (__name == null)
			throw new NullPointerException("NARG");
		
		this.name = __name;
		this.vendor = __vend;
		this.version = __vers;
	}
	
	/**
	 * Decodes the standard from the specified string.
	 *
	 * @param __s The string to decode the standard from.
	 * @throws InvalidSuiteException If the input string is not valid.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/12/30
	 */
	public JavaMEStandard(String __s)
		throws InvalidSuiteException, NullPointerException
	{
		if (__s == null)
			throw new NullPointerException("NARG");
		
		// {@squirreljme.error DG04 Expected input standard string to
		// contain three fields separated by semi-colon. (The input string)}
		String[] splice = StringUtils.fieldSplitAndTrim(';', __s);
		if (splice.length != 3)
			throw new InvalidSuiteException(String.format("DG04 %s", __s));
		
		// {@squirreljme.error DG05 Name in standard string is empty. (The
		// input string)}
		String name = splice[0];
		if (name.isEmpty())
			throw new InvalidSuiteException(String.format("DG05 %s", __s));
		this.name = new SuiteName(name);
		
		String vendor = splice[1];
		this.vendor = (vendor.isEmpty() ? null : new SuiteVendor(vendor));
		
		String version = splice[2];
		this.version = (version.isEmpty() ? null : new SuiteVersion(version));
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/12/30
	 */
	@Override
	public int compareTo(JavaMEStandard __o)
	{
		int rv = this.name.compareTo(__o.name);
		if (rv != 0)
			return rv;
		
		SuiteVendor aven = this.vendor,
			bven = __o.vendor;
		if ((aven == null) != (bven == null))
			return (aven == null ? -1 : 1);
		else if (aven != null)
		{
			rv = aven.compareTo(bven);
			if (rv != 0)
				return rv;
		}
			
		SuiteVersion aver = this.version,
			bver = __o.version;
		if ((aver == null) != (bver == null))
			return (aver == null ? -1 : 1);
		else if (aver != null)
			return aver.compareTo(bver);
		return 0;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/12/30
	 */
	@Override
	public boolean equals(Object __o)
	{
		if (this == __o)
			return true;
		
		if (!(__o instanceof JavaMEStandard))
			return false;
		
		JavaMEStandard o = (JavaMEStandard)__o;
		return this.name.equals(o.name) &&
			Objects.equals(this.vendor, o.vendor) &&
			Objects.equals(this.version, o.version);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/12/30
	 */
	@Override
	public int hashCode()
	{
		return this.name.hashCode() ^
			Objects.hashCode(this.vendor) ^
			Objects.hashCode(this.version);
	}
	
	/**
	 * Returns the name of the API which is defined.
	 *
	 * @return The defined API name.
	 * @since 2017/12/30
	 */
	public SuiteName name()
	{
		return this.name;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/12/30
	 */
	@Override
	public String toString()
	{
		Reference<String> ref = this._string;
		String rv;
		
		if (ref == null || null == (rv = ref.get()))
			this._string = new WeakReference<>((rv = this.name + ";" +
				Objects.toString(this.vendor, "") + ";" +
				Objects.toString(this.version, "")));
		
		return rv;
	}
	
	/**
	 * Returns the vendor of the standard.
	 *
	 * @return The vendor, may be {@code null} if no vendor was specified.
	 * @since 2017/12/30
	 */
	public SuiteVendor vendor()
	{
		return this.vendor;
	}
	
	/**
	 * Returns the version of the standard.
	 *
	 * @return The version, may be {@code null} if no version was specified.
	 * @since 2017/12/30
	 */
	public SuiteVersion version()
	{
		return this.version;
	}
}

Added buildSrc/src/main/java/cc/squirreljme/plugin/swm/MarkedDependency.java.



















































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.plugin.swm;

/**
 * This interface is used for anything which represents a dependency and as
 * such can be used to check if a provided meets the conditions for a match.
 *
 * @since 2017/12/31
 */
public interface MarkedDependency
{
	/**
	 * Is this dependency optional?
	 *
	 * @return {@code true} if this dependency is optional.
	 * @since 2017/12/31
	 */
	boolean isOptional();
	
	/**
	 * Checks if this dependency matches the specified provision in that the
	 * provided entry is acceptable to be used for this dependency.
	 *
	 * @param __mp The provided to check.
	 * @return {@code true} if the provided is valid for this dependency.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/12/31
	 */
	boolean matchesProvided(MarkedProvided __mp)
		throws NullPointerException;
}

Added buildSrc/src/main/java/cc/squirreljme/plugin/swm/MarkedProvided.java.













































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.plugin.swm;

/**
 * This interface is associated with anything which can be a provided detail
 * for a dependency.
 *
 * @since 2017/12/31
 */
public interface MarkedProvided
{
}

Added buildSrc/src/main/java/cc/squirreljme/plugin/swm/SuiteDependency.java.















































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.plugin.swm;

import cc.squirreljme.plugin.util.NaturalComparator;
import cc.squirreljme.plugin.util.StringUtils;
import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import java.util.Objects;

/**
 * This represents a dependency that a LIBlet or MIDlet may depend on.
 *
 * @since 2017/02/22
 */
public final class SuiteDependency
	implements Comparable<SuiteDependency>, MarkedDependency
{
	/** The dependency type. */
	protected final SuiteDependencyType type;
	
	/** The dependency level. */
	protected final SuiteDependencyLevel level;
	
	/** The name. */
	protected final SuiteName name;
	
	/** The vendor. */
	protected final SuiteVendor vendor;
	
	/** The version range. */
	protected final SuiteVersionRange version;
	
	/** String representation. */
	private Reference<String> _string;
	
	/**
	 * Initializes the dependency which is parsed from the given input string.
	 *
	 * @param __s The string to parse.
	 * @throws InvalidSuiteException If the string is not valid.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/02/22
	 */
	public SuiteDependency(String __s)
		throws InvalidSuiteException, NullPointerException
	{
		// Check
		if (__s == null)
			throw new NullPointerException("NARG");
		
		// Trim whitespace
		__s = __s.trim();
		
		// Extract all semicolon positions
		int[] sc = StringUtils.multipleIndexOf(';', __s);
		
		// {@squirreljme.error DG06 Expected four semi-colons in the
		// dependency field. (The input dependency)}
		if (sc.length != 4)
			throw new InvalidSuiteException(String.format(
				"AR06 %s", __s));
		
		// Split fields
		String intype = __s.substring(0, sc[0]).trim(),
			inlevel = __s.substring(sc[0] + 1, sc[1]).trim(),
			inname = __s.substring(sc[1] + 1, sc[2]).trim(),
			invendor = __s.substring(sc[2] + 1, sc[3]).trim(),
			inversion = __s.substring(sc[3] + 1).trim();
		
		// Required fields
		SuiteDependencyType type;
		this.type = (type = SuiteDependencyType.of(intype));
		this.level = SuiteDependencyLevel.of(inlevel);
		
		// Optional fields
		SuiteName name;
		SuiteVendor vendor;
		SuiteVersionRange version;
		this.name = (name = (inname.isEmpty() ? null :
			new SuiteName(inname)));
		this.vendor = (vendor = (invendor.isEmpty() ? null :
			new SuiteVendor(invendor)));
		this.version = (version = (inversion.isEmpty() ? null :
			new SuiteVersionRange(inversion)));
		
		// Check
		SuiteDependency.__check(type, this.level, name, vendor, version);
	}
	
	/**
	 * Initializes the depedency with the given type, level, and where the
	 * remainder of the dependencies are parsed from the specified string.
	 *
	 * @param __type The type of dependency this is.
	 * @param __level The level of the dependency.
	 * @param __s The string to decode for the remainder of the dependency.
	 * @throws InvalidSuiteException If the input parameters are not valid.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/11/26
	 */
	public SuiteDependency(SuiteDependencyType __type,
		SuiteDependencyLevel __level, String __s)
		throws InvalidSuiteException, NullPointerException
	{
		if (__type == null || __level == null || __s == null)
			throw new NullPointerException("NARG");
		
		// Trim whitespace
		__s = __s.trim();
		
		// Extract all semicolon positions
		int[] sc = StringUtils.multipleIndexOf(';', __s);
		
		// {@squirreljme.error DG07 Expected two semi-colons in the
		// dependency field. (The input dependency)}
		if (sc.length != 2)
			throw new InvalidSuiteException(String.format(
				"AR07 %s", __s));
		
		// Split fields
		String inname = __s.substring(0, sc[0]).trim(),
			invendor = __s.substring(sc[0] + 1, sc[1]).trim(),
			inversion = __s.substring(sc[1] + 1).trim();
		
		// Parse areas fields
		SuiteName name;
		SuiteVendor vendor;
		SuiteVersionRange version;
		this.name = (name = (inname.isEmpty() ? null :
			new SuiteName(inname)));
		this.vendor = (vendor = (invendor.isEmpty() ? null :
			new SuiteVendor(invendor)));
		this.version = (version = (inversion.isEmpty() ? null :
			new SuiteVersionRange(inversion)));
		
		SuiteDependency.__check(__type, __level, name, vendor, version);
		
		// Set
		this.type = __type;
		this.level = __level;
	}
	
	/**
	 * Initializes the dependency using the given parameters.
	 *
	 * @param __type The type of dependency this is.
	 * @param __level The level of the dependency.
	 * @param __name The name.
	 * @param __vendor The vendor.
	 * @param __version The version.
	 * @throws InvalidSuiteException If the input parameters are not valid.
	 * @throws NullPointerException If no type and/or name were specified.
	 * @since 2017/11/26
	 */
	public SuiteDependency(SuiteDependencyType __type,
		SuiteDependencyLevel __level, SuiteName __name,
		SuiteVendor __vendor, SuiteVersionRange __version)
		throws InvalidSuiteException, NullPointerException
	{
		if (__type == null || __level == null)
			throw new NullPointerException("NARG");
		
		SuiteDependency.__check(__type, __level, __name, __vendor, __version);
		
		// Set
		this.type = __type;
		this.level = __level;
		this.name = __name;
		this.vendor = __vendor;
		this.version = __version;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/11/30
	 */
	@Override
	public final int compareTo(SuiteDependency __d)
		throws NullPointerException
	{
		if (__d == null)
			throw new NullPointerException("NARG");
		
		// Type first
		int rv = this.type.compareTo(__d.type);
		if (rv != 0)
			return rv;
			
		// Optionality
		rv = this.level.compareTo(__d.level);
		if (rv != 0)
			return rv;
		
		// Name
		rv = Objects.<SuiteName>compare(this.name, __d.name,
			NaturalComparator.<SuiteName>instance());
		if (rv != 0)
			return rv;
		
		// Vendor
		rv = Objects.<SuiteVendor>compare(this.vendor, __d.vendor,
			NaturalComparator.<SuiteVendor>instance());
		if (rv != 0)
			return rv;
		
		// Version
		return Objects.<SuiteVersionRange>compare(this.version, __d.version,
			NaturalComparator.<SuiteVersionRange>instance());
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/02/22
	 */
	@Override
	public boolean equals(Object __o)
	{
		if (this == __o)
			return true;
		
		// Check
		if (!(__o instanceof SuiteDependency))
			return false;
		
		// Compare
		SuiteDependency o = (SuiteDependency)__o;
		return this.type.equals(o.type) &&
			this.level.equals(o.level) &&
			Objects.equals(this.name, o.name) &&
			Objects.equals(this.vendor, o.vendor) &&
			Objects.equals(this.version, o.version);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/02/22
	 */
	@Override
	public int hashCode()
	{
		return this.type.hashCode() ^
			this.level.hashCode() ^
			Objects.hashCode(this.name) ^
			Objects.hashCode(this.vendor) ^
			Objects.hashCode(this.version);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/11/22
	 */
	@Override
	public boolean isOptional()
	{
		return this.level.isOptional();
	}
	
	/**
	 * Is this a required dependency?
	 *
	 * @return {@code true} if this is a required dependency.
	 * @since 2017/11/22
	 */
	public boolean isRequired()
	{
		return this.level.isRequired();
	}
	
	/**
	 * Returns the dependency level.
	 *
	 * @return The dependency level.
	 * @since 2017/02/22
	 */
	public SuiteDependencyLevel level()
	{
		return this.level;
	}
	
	/**
	 * Returns the dependency name.
	 *
	 * @return The dependency name, may be {@code null}.
	 * @since 2017/02/22
	 */
	public SuiteName name()
	{
		return this.name;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/12/31
	 */
	@Override
	public boolean matchesProvided(MarkedProvided __mp)
		throws NullPointerException
	{
		if (__mp == null)
			throw new NullPointerException("NARG");
		
		SuiteDependencyType type = this.type;
		Class<?> mpclass = __mp.getClass();
		SuiteName name = this.name;
		SuiteVendor vendor = this.vendor;
		SuiteVersionRange version = this.version;
		
		// Depends
		switch (type)
		{
				// Proprietary match
			case PROPRIETARY:
				// Potential internal project name
				if (__mp instanceof InternalName)
				{
					String myname = name.toString();
					
					// Needs at sign
					int dxat;
					if ((dxat = myname.indexOf('@')) < 0)
						return false;
					
					// Prefix must be project reference
					if (!myname.substring(0, dxat).
						equals("squirreljme.project"))
						return false;
					
					// Otherwise the project name must match
					return myname.substring(dxat + 1).
						equals(((InternalName)__mp).name());
				}
				
				// No matches
				return false;
				
				// Library
			case LIBLET:
				// Typed suite information
				if (__mp instanceof TypedSuite)
				{
					TypedSuite other = (TypedSuite)__mp;
					SuiteIdentifier ident = other.suite();
					
					// Only match other libraries
					if (other.type() != JavaMEMidletType.LIBRARY)
						return false;
					
					// Must match name
					if (!name.equals(ident.name()))
						return false;
					
					// Match vendor if specified
					if (vendor != null)
						if (!vendor.equals(ident.vendor()))
							return false;
					
					// Check if version in range if specified
					if (version != null)
						if (!version.inRange(ident.version()))
							return false;
					
					// Is okay!
					return true;
				}
				
				// Unknown
				else
					return false;
					
				// Standard
			case STANDARD:
				if (__mp instanceof JavaMEStandard)
				{
					JavaMEStandard other = (JavaMEStandard)__mp;
					
					// Must match name
					if (!name.equals(other.name()))
						return false;
					
					// Match vendor if specified
					if (vendor != null)
						if (!vendor.equals(other.vendor()))
							return false;
					
					// Check if version in range if specified
					if (version != null)
						if (!version.inRange(other.version()))
							return false;
					
					// Matches!
					return true;
				}
				
				// Not a standard
				else
					return false;
				
				// {@squirreljme.error DG08 Illegal dependency check.
				// (The dependency type; The target class)}
			default:
				throw new RuntimeException(String.format("AR08 %s %s",
					type, mpclass));
		}
	}
	
	/**
	 * Returns a dependency which is the same as this one except that it is
	 * required.
	 *
	 * @return This dependency but required.
	 * @since 2017/11/26
	 */
	public SuiteDependency toRequired()
	{
		if (this.isRequired())
			return this;
		return new SuiteDependency(this.type, SuiteDependencyLevel.REQUIRED,
			this.name, this.vendor, this.version);
	}
	
	/**
	 * Returns a dependency which is the same as this one except that it is
	 * optional.
	 *
	 * @return This dependency but optional.
	 * @since 2017/11/26
	 */
	public SuiteDependency toOptional()
	{
		if (this.isOptional())
			return this;
		return new SuiteDependency(this.type, SuiteDependencyLevel.OPTIONAL,
			this.name, this.vendor, this.version);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/02/22
	 */
	@Override
	public String toString()
	{
		// Get
		Reference<String> ref = this._string;
		String rv;
		
		// Cache?
		if (ref == null || null == (rv = ref.get()))
		{
			// These are optional
			SuiteName name = this.name;
			SuiteVendor vendor = this.vendor;
			SuiteVersionRange version = this.version;
			
			// Generate
			this._string = new WeakReference<>((rv = String.format(
				"%s;%s;%s;%s;%s", this.type, this.level,
				(name == null ? "" : name),
				(vendor == null ? "" : vendor),
				(version == null ? "" : version))));
		}
		
		// Return it
		return rv;
	}
	
	/**
	 * Returns the dependency type.
	 *
	 * @return The dependency type.
	 * @since 2017/02/22
	 */
	public SuiteDependencyType type()
	{
		return this.type;
	}
	
	/**
	 * Returns the dependency vendor.
	 *
	 * @return The dependency vendor, may be {@code null}.
	 * @since 2017/02/22
	 */
	public SuiteVendor vendor()
	{
		return this.vendor;
	}
	
	/**
	 * Returns the dependency version.
	 *
	 * @return The dependency version, may be {@code null}.
	 * @since 2017/02/22
	 */
	public SuiteVersionRange version()
	{
		return this.version;
	}
	
	/**
	 * Checks whether the provided parameters are correct.
	 *
	 * @param __type The type of dependency this is.
	 * @param __level The level of the dependency.
	 * @param __name The name.
	 * @param __vendor The vendor.
	 * @param __version The version.
	 * @throws InvalidSuiteException If the input parameters are not valid.
	 * @since 2017/11/26
	 */
	private static final void __check(SuiteDependencyType __type,
		SuiteDependencyLevel __level, SuiteName __name,
		SuiteVendor __vendor, SuiteVersionRange __version)
		throws InvalidSuiteException
	{
		// {@squirreljme.error DG09 Dependencies on LIBlets must have the
		// name, vendor, and version set. (The type; The level; The name;
		// The vendor; The version)}
		if (__type == SuiteDependencyType.LIBLET && (__name == null ||
			__vendor == null || __version == null))
			throw new InvalidSuiteException(
				String.format("AR09 %s %s %s %s %s", __type, __level, __name,
					__vendor, __version));
	}
}

Added buildSrc/src/main/java/cc/squirreljme/plugin/swm/SuiteDependencyLevel.java.































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.plugin.swm;

/**
 * This represents the level of the dependency.
 *
 * @since 2017/02/22
 */
public enum SuiteDependencyLevel
{
	/** Required. */
	REQUIRED,
	
	/** Optional. */
	OPTIONAL,
	
	/** End. */
	;
	
	/**
	 * Is this an optional dependency level?
	 *
	 * @return {@code true} if this is an optional dependency level.
	 * @since 2017/11/22
	 */
	public boolean isOptional()
	{
		return this == SuiteDependencyLevel.OPTIONAL;
	}
	
	/**
	 * Is this an required dependency level?
	 *
	 * @return {@code true} if this is an required dependency level.
	 * @since 2017/11/22
	 */
	public boolean isRequired()
	{
		return this == SuiteDependencyLevel.REQUIRED;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/02/22
	 */
	@Override
	public String toString()
	{
		// Convert string
		switch (this)
		{
			case REQUIRED:	return "required";
			case OPTIONAL:	return "optional";
			default:
				throw new RuntimeException(this.toString());
		}
	}
	
	/**
	 * Returns the dependency level based on the input string.
	 *
	 * @param __s The input string to parse.
	 * @return The dependency level for the given string.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/02/22
	 */
	public static SuiteDependencyLevel of(String __s)
		throws NullPointerException
	{
		// Check
		if (__s == null)
			throw new NullPointerException("NARG");
		
		// Depends
		switch (__s.trim())
		{
			case "required":	return SuiteDependencyLevel.REQUIRED;
			case "optional":	return SuiteDependencyLevel.OPTIONAL;
			
				// Should not happen
			default:
				throw new RuntimeException(__s);
		}
	}
}

Added buildSrc/src/main/java/cc/squirreljme/plugin/swm/SuiteDependencyType.java.

















































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.plugin.swm;

/**
 * This represents the type of the dependency that is to be included.
 *
 * @since 2017/02/22
 */
public enum SuiteDependencyType
{
	/** Liblet. */
	LIBLET,
	
	/** Standard. */
	STANDARD,
	
	/** Service. */
	SERVICE,
	
	/** Proprietary. */
	PROPRIETARY,
	
	/** End. */
	;
	
	/**
	 * {@inheritDoc}
	 * @since 2017/02/22
	 */
	@Override
	public String toString()
	{
		// Convert string
		switch (this)
		{
			case LIBLET:		return "liblet";
			case STANDARD:		return "standard";
			case SERVICE:		return "service";
			case PROPRIETARY:	return "proprietary";
			
			default:
				throw new Error("TODO");
		}
	}
	
	/**
	 * Returns the dependency type based on the input string.
	 *
	 * @param __s The input string to parse.
	 * @return The dependency type for the given string.
	 * @throws InvalidSuiteException If the dependency type is not
	 * valid.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/02/22
	 */
	public static SuiteDependencyType of(String __s)
		throws InvalidSuiteException, NullPointerException
	{
		// Check
		if (__s == null)
			throw new NullPointerException("NARG");
		
		// Depends
		switch (__s.trim())
		{
			case "liblet":		return SuiteDependencyType.LIBLET;
			case "standard":	return SuiteDependencyType.STANDARD;
			case "service":		return SuiteDependencyType.SERVICE;
			case "proprietary":	return SuiteDependencyType.PROPRIETARY;
			
				// {@squirreljme.error DG0a The specified string is not a valid
				// dependency type. (The input string)}
			default:
				throw new InvalidSuiteException(
					String.format("AR0a %s", __s));
		}
	}
}

Added buildSrc/src/main/java/cc/squirreljme/plugin/swm/SuiteIdentifier.java.











































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.plugin.swm;

import java.lang.ref.Reference;
import java.lang.ref.WeakReference;

/**
 * This is the identity for a midlet suite which contains a name, vendor,
 * and version.
 *
 * @since 2016/10/12
 */
public final class SuiteIdentifier
	implements Comparable<SuiteIdentifier>
{
	/** The suite name. */
	protected final SuiteName name;
	
	/** The suite vendor. */
	protected final SuiteVendor vendor;
	
	/** The suite version. */
	protected final SuiteVersion version;
	
	/** String representation. */
	private Reference<String> _string;
	
	/**
	 * Initializes the suite identifier.
	 *
	 * @param __name The name of the suite.
	 * @param __ven The vendor of the suite.
	 * @param __ver The version of the suite.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/02/22
	 */
	public SuiteIdentifier(SuiteName __name, SuiteVendor __ven,
		SuiteVersion __ver)
		throws NullPointerException
	{
		this(__ven, __name, __ver);
	}
	
	/**
	 * Initializes the suite identifier.
	 *
	 * @param __ven The vendor of the suite.
	 * @param __name The name of the suite.
	 * @param __ver The version of the suite.
	 * @throws NullPointerException On null arguments.
	 * @since 2016/10/12
	 */
	public SuiteIdentifier(SuiteVendor __ven, SuiteName __name,
		SuiteVersion __ver)
		throws NullPointerException
	{
		// Check
		if (__ven == null || __name == null || __ver == null)
			throw new NullPointerException("NARG");
		
		// Set
		this.name = __name;
		this.vendor = __ven;
		this.version = __ver;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/10/12
	 */
	@Override
	public int compareTo(SuiteIdentifier __o)
	{
		if (this == __o)
			return 0;
		
		// Compare name
		int rv = this.name.compareTo(__o.name);
		if (rv != 0)
			return rv;
		
		// Then vendor
		rv = this.vendor.compareTo(__o.vendor);
		if (rv != 0)
			return rv;
		
		// Then the version last
		return this.version.compareTo(__o.version);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/10/12
	 */
	@Override
	public boolean equals(Object __o)
	{
		if (this == __o)
			return true;
		
		// Check
		if (!(__o instanceof SuiteIdentifier))
			return false;
		
		return 0 == (this.compareTo((SuiteIdentifier)__o));
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/10/12
	 */
	@Override
	public int hashCode()
	{
		return this.name.hashCode() ^ this.vendor.hashCode() ^
			this.version.hashCode();
	}
	
	/**
	 * Returns the suite name.
	 *
	 * @return The suite name.
	 * @since 2016/10/12
	 */
	public SuiteName name()
	{
		return this.name;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/10/12
	 */
	@Override
	public String toString()
	{
		// Get
		Reference<String> ref = this._string;
		String rv;
		
		// Cache?
		if (ref == null || null == (rv = ref.get()))
			this._string = new WeakReference<>((rv = this.vendor + ";" +
				this.name + ";" + this.version));
		
		// Return it
		return rv;
	}
	
	/**
	 * Returns the suite vendor.
	 *
	 * @return The suite vendor.
	 * @since 2016/10/12
	 */
	public SuiteVendor vendor()
	{
		return this.vendor;
	}
	
	/**
	 * Returns the suite version.
	 *
	 * @return The suite version.
	 * @since 2016/10/12
	 */
	public SuiteVersion version()
	{
		return this.version;
	}
}

Added buildSrc/src/main/java/cc/squirreljme/plugin/swm/SuiteName.java.







































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.plugin.swm;

import cc.squirreljme.plugin.util.StringUtils;

/**
 * This represents the name of a midlet suite.
 *
 * @since 2016/10/12
 */
public final class SuiteName
	implements Comparable<SuiteName>
{
	/** String value. */
	protected final String string;
	
	/**
	 * Initializes the suite name.
	 *
	 * @param __v The value to parse.
	 * @throws InvalidSuiteException If the input is not valid.
	 * @throws NullPointerException On null arguments.
	 * @since 2016/10/12
	 */
	public SuiteName(String __v)
		throws InvalidSuiteException, NullPointerException
	{
		// Check
		if (__v == null)
			throw new NullPointerException("NARG");
		
		// {@squirreljme.error DG0e An illegal character was
		// specified in the midlet suite name. (The midlet suite
		// name)}
		if (StringUtils.firstIndex("\0\r\n:;", __v) >= 0)
			throw new InvalidSuiteException(String.format("AR0e %s", __v));
		
		this.string = __v;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/10/12
	 */
	@Override
	public int compareTo(SuiteName __o)
	{
		if (this == __o)
			return 0;
		return this.string.compareTo(__o.string);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/10/12
	 */
	@Override
	public boolean equals(Object __o)
	{
		if (this == __o)
			return true;
		
		// Check
		if (!(__o instanceof SuiteName))
			return false;
		
		return this.string.equals(((SuiteName)__o).string);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/10/12
	 */
	@Override
	public int hashCode()
	{
		return this.string.hashCode();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/10/12
	 */
	@Override
	public String toString()
	{
		return this.string;
	}
}

Added buildSrc/src/main/java/cc/squirreljme/plugin/swm/SuiteVendor.java.





























































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.plugin.swm;

import cc.squirreljme.plugin.util.StringUtils;

/**
 * This represents the vendor of a midlet suite.
 *
 * @since 2016/10/12
 */
public final class SuiteVendor
	implements Comparable<SuiteVendor>
{
	/** String value. */
	protected final String string;
	
	/**
	 * Initializes the suite vendor.
	 *
	 * @param __v The value to parse.
	 * @throws InvalidSuiteException If the input is not valid.
	 * @throws NullPointerException On null arguments.
	 * @since 2016/10/12
	 */
	public SuiteVendor(String __v)
		throws InvalidSuiteException, NullPointerException
	{
		// Check
		if (__v == null)
			throw new NullPointerException("NARG");
		
		// {@squirreljme.error DG0h An illegal character was
		// specified in the midlet suite vendor. (The midlet suite
		// vendor)}
		if (StringUtils.firstIndex("\0\r\n:;", __v) >= 0)
			throw new InvalidSuiteException(String.format("AD0d %s", __v));
		
		this.string = __v;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/10/12
	 */
	@Override
	public int compareTo(SuiteVendor __o)
	{
		return this.string.compareTo(__o.string);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/10/12
	 */
	@Override
	public boolean equals(Object __o)
	{
		// Check
		if (!(__o instanceof SuiteVendor))
			return false;
		
		return this.string.equals(((SuiteVendor)__o).string);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/10/12
	 */
	@Override
	public int hashCode()
	{
		return this.string.hashCode();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/10/12
	 */
	@Override
	public String toString()
	{
		return this.string;
	}
}

Added buildSrc/src/main/java/cc/squirreljme/plugin/swm/SuiteVersion.java.





































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.plugin.swm;

import java.lang.ref.Reference;
import java.lang.ref.WeakReference;

/**
 * This represents a suite version.
 *
 * @since 2016/10/12
 */
public final class SuiteVersion
	implements Comparable<SuiteVersion>
{
	/** The minimum version number. */
	public static final SuiteVersion MIN_VERSION =
		new SuiteVersion(0, 0, 0);
	
	/** The maximum version number. */
	public static final SuiteVersion MAX_VERSION =
		new SuiteVersion(99, 99, 99);
	
	/** The major version. */
	protected final int major;
	
	/** The minor version. */
	protected final int minor;
	
	/** The release version. */
	protected final int release;
	
	/** The string representation. */
	private Reference<String> _string;
	
	/**
	 * Initializes the version.
	 *
	 * @param __v The value to parse.
	 * @throws IllegalArgumentException If there are too many or too little
	 * version fields, they contain illegal charactes, or have an out of range
	 * value.
	 * @throws NullPointerException On null arguments.
	 * @since 2016/10/12
	 */
	public SuiteVersion(String __v)
		throws IllegalArgumentException, NullPointerException
	{
		this(SuiteVersion.__decodeVersion(__v));
	}
	
	/**
	 * Initializes a Midlet version number from the specified array of
	 * integer values.
	 *
	 * @param __v The version triplet, up to the first three elements are
	 * used by the version number.
	 * @throws IllegalArgumentException If the version number has an out of
	 * range value.
	 * @throws NullPointerException On null arguments.
	 * @since 2016/10/12
	 */
	public SuiteVersion(int[] __v)
		throws IllegalArgumentException, NullPointerException
	{
		this((__v.length > 0 ? __v[0] : 0),
			(__v.length > 1 ? __v[1] : 0),
			(__v.length > 2 ? __v[2] : 0));
	}
	
	/**
	 * Decodes the midlet version, optionally allowing it to a reverse
	 * operation of the {@link #hashCode()} method.
	 *
	 * @param __hash If {@code true} then the value to decode is treated as
	 * the hash code returned by this class.
	 * @param __maj If {@code __hash} is {@code true} then this is the hash
	 * code of a SuiteVersion, otherwise it is the major version number.
	 * @throws IllegalArgumentException If the version number has an out of
	 * range value.
	 * @since 2016/10/13
	 */
	public SuiteVersion(boolean __hash, int __maj)
		throws IllegalArgumentException
	{
		this((__hash ? __maj / 10000 : __maj),
			(__hash ? (__maj / 100) % 100 : 0),
			(__hash ? __maj % 100 : 0));
	}
	
	/**
	 * Initializes the version.
	 *
	 * @param __maj The major version.
	 * @throws IllegalArgumentException If any value is out of range.
	 * @since 2016/10/12
	 */
	public SuiteVersion(int __maj)
	{
		this(__maj, 0, 0);
	}
	
	/**
	 * Initializes the version.
	 *
	 * @param __maj The major version.
	 * @param __min The minor version.
	 * @throws IllegalArgumentException If any value is out of range.
	 * @since 2016/10/12
	 */
	public SuiteVersion(int __maj, int __min)
	{
		this(__maj, __min, 0);
	}
	
	/**
	 * Initializes the version.
	 *
	 * @param __maj The major version.
	 * @param __min The minor version.
	 * @param __rel The release version.
	 * @throws IllegalArgumentException If any value is out of range.
	 * @since 2016/10/12
	 */
	public SuiteVersion(int __maj, int __min, int __rel)
		throws IllegalArgumentException
	{
		// Check version ranges
		if (__maj < 0 || __maj > 99 || __min < 0 || __min > 99 ||
			__rel < 0 || __rel > 99)
			throw new IllegalArgumentException(String.format(
				"Input version number is out of range, only 0 through " +
				"99 are valid: (%d, %d, %d)", __maj, __min, __rel));
		
		// Set
		this.major = __maj;
		this.minor = __min;
		this.release = __rel;
	}
	
	/**
	 * Checks if this version at least the specified verison.
	 *
	 * @param __v The version to check against.
	 * @return {@code true} if this version is at least the other.
	 * @throws NullPointerException On nul arguments.
	 */
	public boolean atLeast(SuiteVersion __v)
		throws NullPointerException
	{
		// Check
		if (__v == null)
			throw new NullPointerException("NARG");
		
		// Can compare the hashcodes
		return this.hashCode() >= __v.hashCode();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/10/12
	 */
	@Override
	public int compareTo(SuiteVersion __o)
	{
		// Major first
		int amaj = this.major, bmaj = __o.major;
		int rv = amaj - bmaj;
		if (rv != 0)
			return rv;
		
		// Then minor
		int amin = this.minor, bmin = __o.minor;
		rv = amin - bmin;
		if (rv != 0)
			return rv;
		
		// Then release
		int arel = this.release, brel = __o.release;
		rv = arel - brel;
		if (rv != 0)
			return rv;
		
		// The same
		return 0;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/10/12
	 */
	@Override
	public boolean equals(Object __o)
	{
		// Check
		if (!(__o instanceof SuiteVersion))
			return false;
		
		// Cast
		SuiteVersion o = (SuiteVersion)__o;
		return this.major == o.major &&
			this.minor == o.minor &&
			this.release == o.release;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/10/12
	 */
	@Override
	public int hashCode()
	{
		return (this.major * 10000) +
			(this.minor * 100) +
			this.release;
	}
	
	/**
	 * Returns the major version.
	 *
	 * @return The major version.
	 * @since 2017/02/22
	 */
	public int major()
	{
		return this.major;
	}
	
	/**
	 * Returns the minor version.
	 *
	 * @return The minor version.
	 * @since 2017/02/22
	 */
	public int minor()
	{
		return this.minor;
	}
	
	/**
	 * Returns the release version.
	 *
	 * @return The release version.
	 * @since 2017/02/22
	 */
	public int release()
	{
		return this.release;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/10/12
	 */
	@Override
	public String toString()
	{
		// Get
		Reference<String> ref = this._string;
		String rv;
		
		// Cache?
		if (ref == null || null == (rv = ref.get()))
			this._string = new WeakReference<>((rv = this.major + "." +
				this.minor + "." + this.release));
		
		// Return it
		return rv;
	}
	
	/**
	 * Decodes the string based version number
	 *
	 * @param __v The input string.
	 * @return The version tuplet.
	 * @throws IllegalArgumentException If the input is not valid.
	 * @throws NullPointerException On null arguments.
	 * @since 2016/10/12
	 */
	private static final int[] __decodeVersion(String __v)
		throws IllegalArgumentException, NullPointerException
	{
		// Check
		if (__v == null)
			throw new NullPointerException("NARG");
		
		// Trim whitespace
		__v = __v.trim();
		
		// Output array
		int[] rv = new int[3];
		
		// Parse the input value
		int n = __v.length(), at = 0;
		StringBuilder sb = new StringBuilder();
		for (int i = 0; i <= n; i++)
		{
			int c = (i == n ? -1 : __v.charAt(i));
			
			// Decimal point? or end
			if (c == '.' || c == -1)
			{
				rv[at++] = Integer.parseInt(sb.toString(), 10);
				
				// Too many fields
				if (c != -1 && at >= 4)
					throw new IllegalArgumentException(String.format(
						"Too many version fields in the specified string: %s",
						__v));
				
				// Clear
				sb.setLength(0);
			}
			
			// Add to string
			else if (c >= '0' && c <= '9')
				sb.append((char)c);
			
			// Invalid format
			else
				throw new IllegalArgumentException(String.format(
					"An illegal character is in the version string: %s %c",
					__v, c));
		}
		
		// Return it
		return rv;
	}
}

Added buildSrc/src/main/java/cc/squirreljme/plugin/swm/SuiteVersionRange.java.

















































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.plugin.swm;

import java.lang.ref.Reference;
import java.lang.ref.WeakReference;

/**
 * This is used to handle version ranges that may be used for dependencies.
 *
 * Version ranges are inclusive.
 *
 * @since 2017/02/22
 */
public final class SuiteVersionRange
	implements Comparable<SuiteVersionRange>
{
	/** Any version. */
	public static final SuiteVersionRange ANY_VERSION =
		new SuiteVersionRange(SuiteVersion.MIN_VERSION,
			SuiteVersion.MAX_VERSION);
	
	/** The starting range, inclusive. */
	protected final SuiteVersion from;
	
	/** Tne ending range, inclusive. */
	protected final SuiteVersion to;
	
	/** String representation. */
	private Reference<String> _string;
	
	/**
	 * Initializes the range inclusively between the two given versions.
	 *
	 * @param __from The source version.
	 * @param __to The destination version.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/02/22
	 */
	public SuiteVersionRange(SuiteVersion __from, SuiteVersion __to)
		throws NullPointerException
	{
		// Check
		if (__from == null || __to == null)
			throw new NullPointerException("NARG");
		
		// Make sure from is always first
		if (__from.compareTo(__to) <= 0)
		{
			this.from = __from;
			this.to = __to;
		}
		
		// Swapped
		else
		{
			this.from = __to;
			this.to = __from;
		}
	}
	
	/**
	 * Parses the version range that is specified in the dependency of JAR
	 * files.
	 *
	 * @param __s The string to parse.
	 * @throws InvalidSuiteException If the range is not valid.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/02/22
	 */
	public SuiteVersionRange(String __s)
		throws InvalidSuiteException, NullPointerException
	{
		// Check
		if (__s == null)
			throw new NullPointerException("NARG");
		
		// Trim
		__s = __s.trim();
		
		// {@squirreljme.error DG0l The version range cannot be blank.}
		int sl = __s.length();
		if (sl <= 0)
			throw new IllegalArgumentException("AR0l");
		
		// Get the last character
		char lc = __s.charAt(__s.length() - 1);
		
		// All versions following this.
		if (lc == '+')
		{
			this.from = new SuiteVersion(__s.substring(0, sl - 1));
			this.to = new SuiteVersion(99, 99, 99);
		}
		
		// All versions in the group
		else if (lc == '*')
		{
			// Get the last dot, if any
			int ld = __s.lastIndexOf('.');
			if (ld < 0)
			{
				// Any version, does not matter
				if (sl == 1)
				{
					this.from = new SuiteVersion(0);
					this.to = new SuiteVersion(99, 99, 99);
				}
				
				// {@squirreljme.error DG0m Major only wildcard versions must
				// be a single asterisk. (The input string)}
				else
					throw new InvalidSuiteException(String.format("AR0m %s",
						__s));
			}
			
			// Parse otherwise, just count the number of dots to determine
			// how deep it goes
			else
			{
				// {@squirreljme.error DG0n The last dot in a wildcard must be
				// before the asterisk. (The input string)}
				if (ld != sl - 1)
					throw new InvalidSuiteException(String.format("AR0n %s",
						__s));
				
				// Source range is simple
				SuiteVersion ver = new SuiteVersion(
					__s.substring(0, sl - 2));
				this.from = ver;
				
				// Count dots, determines major/minor
				int numdots = 0;
				for (int i = 0; i < sl; i++)
					if (__s.charAt(i) == '.')
						numdots++;
				
				// minor and release wildcard
				if (numdots == 1)
					this.to = new SuiteVersion(ver.major(), 99, 99);
				
				// release ranged wildcard
				else if (numdots == 2)
					this.to = new SuiteVersion(ver.major(), ver.minor(), 99);
				
				// {@squirreljme.error DG0o There are too many decimal points
				// in the wildcard version string. (The input string)}
				else
					throw new InvalidSuiteException(String.format("AR0o %s",
						__s));
			}
		}
		
		// Only this version
		else
		{
			SuiteVersion ver = new SuiteVersion(__s);
			this.from = ver;
			this.to = ver;
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/11/30
	 */
	@Override
	public int compareTo(SuiteVersionRange __o)
	{
		// From version is always first
		int rv = this.from.compareTo(__o.from);
		if (rv != 0)
			return rv;
		
		return this.to.compareTo(__o.to);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/02/22
	 */
	@Override
	public boolean equals(Object __o)
	{
		// Check
		if (!(__o instanceof SuiteVersionRange))
			return false;
		
		// Compare
		SuiteVersionRange o = (SuiteVersionRange)__o;
		return this.from.equals(o.from) && this.to.equals(o.to);
	}
	
	/**
	 * Returns the start of the range
	 *
	 * @return The range start.
	 * @since 2017/02/22
	 */
	public SuiteVersion from()
	{
		return this.from;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/02/22
	 */
	@Override
	public int hashCode()
	{
		return this.to.hashCode() ^ (~this.from.hashCode());
	}
	
	/**
	 * Checks whether the specified version is in range.
	 *
	 * @param __v The version to check.
	 * @return {@code true} if it is in the range.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/02/22
	 */
	public boolean inRange(SuiteVersion __v)
		throws NullPointerException
	{
		// Check
		if (__v == null)
			throw new NullPointerException("NARG");
		
		return __v.compareTo(this.from) >= 0 &&
			__v.compareTo(this.to) <= 0;
	}
	
	/**
	 * Checks whether the given version is within range of the other version.
	 *
	 * @param __r The other version range to check.
	 * @return If the other version range shares all or part of its range
	 * with this range.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/11/27
	 */
	public boolean inRange(SuiteVersionRange __r)
		throws NullPointerException
	{
		if (__r == null)
			throw new NullPointerException("NARG");
		
		throw new Error("TODO");
	}
	
	/**
	 * Returns the end of the range.
	 *
	 * @return The range end.
	 * @since 2017/02/22
	 */
	public SuiteVersion to()
	{
		return this.to;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/02/22
	 */
	@Override
	public String toString()
	{
		// Get
		Reference<String> ref = this._string;
		String rv;
		
		// Cache?
		if (ref == null || null == (rv = ref.get()))
		{
			// Slowly build version
			StringBuilder sb = new StringBuilder();
			SuiteVersion from = this.from;
			SuiteVersion to = this.to;
			
			// Get all values
			int amaj = from.major(),
				amin = from.minor(),
				arel = from.release(),
				bmaj = to.major(),
				bmin = to.minor(),
				brel = to.release();
			
			// Pure wildcard
			if (amaj == 0 && amin == 0 && arel == 0 &&
				bmaj == 99 && bmin == 99 && brel == 99)
				sb.append('*');
			
			// Exact, subwildcard, or any following
			else
			{
				// Add major version
				sb.append(amaj);
				sb.append('.');
				
				// Wild card minor and release
				if (amin == 0 && arel == 0 && bmin == 99 && brel == 99)
					sb.append('*');
				
				// Not wild
				else
				{
					// Add version
					sb.append(amin);
					sb.append('.');
					
					// Wild card release
					if (arel == 0 && brel == 99)
						sb.append('*');
					
					// Would be exact (or plus)
					else
						sb.append(arel);
				}
			
				// Will be all versions following
				if (bmaj == 99 && bmin == 99 && brel == 99)
					sb.append('+');
			}
			
			// Store
			this._string = new WeakReference<>((rv = sb.toString()));
		}
		
		return rv;
	}
	
	/**
	 * Returns a version which at most implements the given version.
	 *
	 * @param __v The version.
	 * @return The resulting version range.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/11/26
	 */
	public static final SuiteVersionRange atMost(SuiteVersion __v)
		throws NullPointerException
	{
		if (__v == null)
			throw new NullPointerException("NARG");
		
		return new SuiteVersionRange(SuiteVersion.MIN_VERSION, __v);
	}
	
	/**
	 * Returns a version which exactly implements the given version.
	 *
	 * @param __v The version.
	 * @return The resulting version range.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/11/26
	 */
	public static final SuiteVersionRange exactly(SuiteVersion __v)
		throws NullPointerException
	{
		if (__v == null)
			throw new NullPointerException("NARG");
		
		return new SuiteVersionRange(__v, __v);
	}
}

Added buildSrc/src/main/java/cc/squirreljme/plugin/swm/TypedSuite.java.















































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.plugin.swm;

import java.lang.ref.Reference;
import java.lang.ref.WeakReference;

/**
 * This represents a suite with an associated type.
 *
 * @since 2017/12/30
 */
public final class TypedSuite
	implements MarkedProvided
{
	/** The suite type. */
	protected final JavaMEMidletType type;
	
	/** The suite. */
	protected final SuiteIdentifier suite;
	
	/** String representation. */
	private Reference<String> _string;
	
	/**
	 * Initializes the typed suite.
	 *
	 * @param __type The type of suite.
	 * @param __suite The suite information.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/12/30
	 */
	public TypedSuite(JavaMEMidletType __type, SuiteIdentifier __suite)
		throws NullPointerException
	{
		if (__type == null || __suite == null)
			throw new NullPointerException("NARG");
		
		this.type = __type;
		this.suite = __suite;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/12/30
	 */
	@Override
	public boolean equals(Object __o)
	{
		if (this == __o)
			return true;
		
		if (!(__o instanceof TypedSuite))
			return false;
		
		TypedSuite o = (TypedSuite)__o;
		return this.type.equals(o.type) &&
			this.suite.equals(o.suite);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/12/30
	 */
	@Override
	public int hashCode()
	{
		return this.type.hashCode() ^
			this.suite.hashCode();
	}
	
	/**
	 * Returns the suite.
	 *
	 * @return The suite.
	 * @since 2017/12/30
	 */
	public SuiteIdentifier suite()
	{
		return this.suite;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/12/30
	 */
	@Override
	public String toString()
	{
		Reference<String> ref = this._string;
		String rv;
		
		if (ref == null || null == (rv = ref.get()))
			this._string = new WeakReference<>(
				(rv = this.type + " " + this.suite));
		
		return rv;
	}
	
	/**
	 * Returns the type.
	 *
	 * @return The type.
	 * @since 2017/12/30
	 */
	public JavaMEMidletType type()
	{
		return this.type;
	}
}

Added buildSrc/src/main/java/cc/squirreljme/plugin/tasks/AdditionalManifestPropertiesTask.java.

































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.plugin.tasks;

import cc.squirreljme.plugin.SquirrelJMEPluginConfiguration;
import cc.squirreljme.plugin.swm.JavaMEMidlet;
import cc.squirreljme.plugin.swm.JavaMEMidletType;
import cc.squirreljme.plugin.swm.SuiteDependency;
import cc.squirreljme.plugin.swm.SuiteDependencyLevel;
import cc.squirreljme.plugin.swm.SuiteDependencyType;
import cc.squirreljme.plugin.swm.SuiteName;
import cc.squirreljme.plugin.swm.SuiteVendor;
import cc.squirreljme.plugin.swm.SuiteVersion;
import cc.squirreljme.plugin.swm.SuiteVersionRange;
import java.io.IOException;
import java.io.OutputStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.StandardOpenOption;
import java.util.Arrays;
import java.util.Collections;
import java.util.Map;
import java.util.NoSuchElementException;
import java.util.TreeMap;
import java.util.jar.Attributes;
import javax.inject.Inject;
import org.gradle.api.Action;
import org.gradle.api.DefaultTask;
import org.gradle.api.Project;
import org.gradle.api.Task;
import org.gradle.api.artifacts.Configuration;
import org.gradle.api.artifacts.Dependency;
import org.gradle.api.artifacts.ProjectDependency;
import org.gradle.api.file.FileCollection;
import org.gradle.api.java.archives.Manifest;
import org.gradle.jvm.tasks.Jar;
import org.gradle.language.jvm.tasks.ProcessResources;

/**
 * Adds additional properties to the manifest file.
 *
 * @since 2020/02/28
 */
public class AdditionalManifestPropertiesTask
	extends DefaultTask
{
	/**
	 * Initializes the task.
	 *
	 * @param __jar The JAR Task.
	 * @param __pr The process resources task.
	 * @throws NullPointerException On null arguments.
	 * @since 2020/02/28
	 */
	@Inject
	public AdditionalManifestPropertiesTask(Jar __jar, ProcessResources __pr)
		throws NullPointerException
	{
		if (__jar == null)
			throw new NullPointerException("No JAR specified.");
		
		// Set details of this task
		this.setGroup("squirreljme");
		this.setDescription("Builds an additional manifest for this project.");
		
		// Configure inputs and outputs
		Project project = this.getProject();
		this.getInputs().files(
			project.provider(project::getBuildFile));
		this.getOutputs().files(
			project.provider(this::__taskOutputAsFileCollection));
		
		// This action creates the actual manifest file
		this.doLast(new Action<Task>()
			{
				@Override
				public void execute(Task __task)
				{
					AdditionalManifestPropertiesTask.this.__doLast(__task);
				}
			});
		
		// When the JAR is created it gets additional manifests from us
		__jar.manifest(new Action<Manifest>()
			{
				@Override
				public void execute(Manifest __manifest)
				{
					__manifest.from(AdditionalManifestPropertiesTask.this
						.__taskOutput().toFile());
				}
			});
		
		// Jar and resources depend on this task
		__jar.dependsOn(this);
		__pr.dependsOn(this);
	}
	
	/**
	 * Performs the task actions.
	 *
	 * @since 2002/02/28
	 */
	private void __doLast(Task __task)
	{
		// Get the project and the config details
		Project project = this.getProject();
		SquirrelJMEPluginConfiguration config =
			SquirrelJMEPluginConfiguration.configuration(project);
		
		// Setup manifest to write into
		java.util.jar.Manifest javaManifest = new java.util.jar.Manifest();
		Attributes attributes = javaManifest.getMainAttributes();
		
		// Set manifest to 1.0
		attributes.put(Attributes.Name.MANIFEST_VERSION, "1.0");
		
		// Project name is used internally for dependency lookup
		attributes.putValue("X-SquirrelJME-InternalProjectName",
			project.getName());
		
		// Generation really depends on the application type
		JavaMEMidletType type = config.swmType;
		
		// Add common keys
		attributes.putValue(type.nameKey(), config.swmName);
		attributes.putValue(type.vendorKey(), config.swmVendor);
		attributes.putValue(type.versionKey(),
			new SuiteVersion(project.getVersion().toString()).toString());
			
		// Application
		if (type == JavaMEMidletType.APPLICATION)
		{
			// Main class of entry?
			if (config.mainClass != null)
				attributes.putValue("Main-Class", config.mainClass);
			
			// Add any defined MIDlets
			int midletId = 1;
			for (JavaMEMidlet midlet : config.midlets)
				attributes.putValue("MIDlet-" + (midletId++),
					midlet.toString());
			
			// Ignored in the launcher?
			if (config.ignoreInLauncher)
				attributes.putValue("X-SquirrelJME-NoLauncher",
					"true");
		}
		
		// Library
		else if (type == JavaMEMidletType.LIBRARY)
		{
		}
		
		// API
		else if (type == JavaMEMidletType.API)
		{
			// Configurations defined?
			if (!config.definedConfigurations.isEmpty())
				attributes.putValue(
					"X-SquirrelJME-DefinedConfigurations",
					AdditionalManifestPropertiesTask
						.__delimate(config.definedConfigurations, ' '));
			
			// Profiles defined?
			if (!config.definedProfiles.isEmpty())
				attributes.putValue(
					"X-SquirrelJME-DefinedProfiles",
					AdditionalManifestPropertiesTask
						.__delimate(config.definedProfiles, ' '));
			
			// Standards defined?
			if (!config.definedStandards.isEmpty())
				attributes.putValue(
					"X-SquirrelJME-DefinedStandards",
					AdditionalManifestPropertiesTask
						.__delimate(config.definedStandards, ' '));
		}
		
		// Find all module dependencies
		Map<String, ProjectDependency> dependencies = new TreeMap<>();
		for (String configurationName : Arrays.<String>asList(
				"api", "implementation"))
		{
			// The configuration might not even exist
			Configuration buildConfig = project.getConfigurations()
				.findByName(configurationName);
			if (buildConfig == null)
				continue;
			
			// Add all project based dependencies
			for (Dependency dependency : buildConfig.getDependencies())
				if (dependency instanceof ProjectDependency)
				{
					ProjectDependency mod = (ProjectDependency)dependency;
					
					dependencies.put(mod.getName(), mod);
				}
		}
		
		// Put in as many dependencies as possible
		int normalDep = 1;
		for (ProjectDependency dependency : dependencies.values())
		{
			// Find the associated project
			Project subProject = dependency.getDependencyProject();
			
			// Get the project config
			SquirrelJMEPluginConfiguration subConfig =
				SquirrelJMEPluginConfiguration.configuration(subProject);
			
			// The dependency being constructed (which might be added)
			SuiteDependency suiteDependency = null;
			boolean didDepend = false;
			
			// Nothing can depend on a MIDlet!
			if (subConfig.swmType == JavaMEMidletType.APPLICATION)
				throw new RuntimeException(String.format(
					"Project %s cannot depend on application %s.",
						project.getName(), subProject.getName()));
			
			// This is another library
			else if (subConfig.swmType == JavaMEMidletType.LIBRARY)
				suiteDependency = new SuiteDependency(
					SuiteDependencyType.LIBLET,
					SuiteDependencyLevel.REQUIRED,
					new SuiteName(subConfig.swmName),
					new SuiteVendor(subConfig.swmVendor),
					SuiteVersionRange.exactly(new SuiteVersion(
						subProject.getVersion().toString())));
			
			// Is otherwise an API
			else
			{
				// Configuration specified?
				try
				{
					attributes.putValue("Microedition-Configuration",
						Collections.max(subConfig.definedConfigurations)
							.toString());
					didDepend = true;
				}
				catch (NoSuchElementException e)
				{
					// Ignore
				}
				
				// Profile specified?
				try
				{
					attributes.putValue("Microedition-Profile",
						Collections.max(subConfig.definedProfiles).toString());
					didDepend = true;
				}
				catch (NoSuchElementException e)
				{
					// Ignore
				}
			}
			
			// Unknown, do a generic project dependency
			if (!didDepend && suiteDependency == null)
				suiteDependency = new SuiteDependency(
					SuiteDependencyType.PROPRIETARY,
					SuiteDependencyLevel.REQUIRED,
					new SuiteName("squirreljme.project@" +
						subProject.getName()),
					null,
					null);
			
			// Write out the dependency if one was requested
			if (suiteDependency != null)
				attributes.putValue(type.dependencyKey(normalDep++),
					suiteDependency.toString());
		}
		
		// Write the manifest output
		try (OutputStream out = Files.newOutputStream(this.__taskOutput(),
			StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING,
			StandardOpenOption.WRITE))
		{
			javaManifest.write(out);
			
			// Make sure it is really written!
			out.flush();
		}
		catch (IOException e)
		{
			throw new RuntimeException(e);
		}
	}
	
	/**
	 * Returns the output manifest file.
	 *
	 * @return The output manifest file.
	 * @since 2020/02/28
	 */
	private Path __taskOutput()
	{
		return this.getProject().getBuildDir().toPath().
			resolve("SQUIRRELJME.MF");
	}
	
	/**
	 * Returns the output manifest file.
	 *
	 * @return The output manifest file.
	 * @since 2020/02/28
	 */
	private FileCollection __taskOutputAsFileCollection()
	{
		return this.getProject().files(this.__taskOutput().toFile());
	}
	
	/**
	 * Turns an iterable into a string with the given delimeter.
	 *
	 * @param __it The iteration to convert.
	 * @param __delim The delimiter.
	 * @return The converted string.
	 * @throws NullPointerException On null arguments.
	 * @since 2020/02/15
	 */
	private static String __delimate(Iterable<?> __it, char __delim)
		throws NullPointerException
	{
		if (__it == null)
			throw new NullPointerException("NARG");
		
		// Build output string
		StringBuilder sb = new StringBuilder();
		for (Object o : __it)
		{
			// Add delimeter?
			if (sb.length() > 0)
				sb.append(__delim);
			
			// Add object
			sb.append(o);
		}
		
		return sb.toString();
	}
}

Added buildSrc/src/main/java/cc/squirreljme/plugin/tasks/GenerateTestsListTask.java.





































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.plugin.tasks;

import java.io.File;
import java.io.IOException;
import java.io.PrintStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardOpenOption;
import java.util.Collection;
import java.util.LinkedList;
import javax.inject.Inject;
import org.gradle.api.Action;
import org.gradle.api.DefaultTask;
import org.gradle.api.Project;
import org.gradle.api.Task;
import org.gradle.api.file.DirectoryTree;
import org.gradle.api.file.FileCollection;
import org.gradle.api.plugins.JavaPluginConvention;
import org.gradle.api.tasks.SourceSet;
import org.gradle.api.tasks.SourceSetOutput;
import org.gradle.language.jvm.tasks.ProcessResources;

/**
 * This generates the list of tests that are available.
 *
 * @since 2020/02/28
 */
public class GenerateTestsListTask
	extends DefaultTask
{
	/** The service list path. */
	public static final Path SERVICE_LIST_PATH =
		Paths.get("META-INF", "services",
			"net.multiphasicapps.tac.TestInterface");
	
	/**
	 * Initializes the task.
	 *
	 * @param __processTask The resource task.
	 * @since 2020/02/28
	 */
	@Inject
	public GenerateTestsListTask(ProcessResources __processTask)
	{
		// Set details of this task
		this.setGroup("squirreljme");
		this.setDescription("Builds the list of tests which are available.");
		
		// Configure inputs and outputs
		Project project = this.getProject();
		this.getInputs().files(
			project.provider(this::__taskInputsAsFileCollection));
		this.getOutputs().files(
			project.provider(this::__taskOutputsAsFileCollection));
		
		// Only run in this condition
		this.onlyIf(this::__onlyIf);
		
		// Perform our task action
		this.doLast(new Action<Task>() {
				@Override
				public void execute(Task __task)
				{
					GenerateTestsListTask.this.__doLast(__task);
				}
			});
		
		// The process task depends on this task
		__processTask.dependsOn(this);
	}
	
	/**
	 * Runs the actual task.
	 *
	 * @param __task The task to run for.
	 * @since 2020/02/28
	 */
	private void __doLast(Task __task)
	{
		Path outputFile = this.__taskOutput();
		
		// Create list
		try
		{
			// Make sure the output directory exists
			Files.createDirectories(outputFile.getParent());
			
			// Write lines to service file
			try (PrintStream out = new PrintStream(Files.newOutputStream(
				outputFile, StandardOpenOption.CREATE,
				StandardOpenOption.TRUNCATE_EXISTING,
				StandardOpenOption.WRITE)))
			{
				// Write lines for each input
				for (__Input__ input : this.__taskInputs())
				{
					String fileName = input.relative.toString();
					
					// Write here
					out.println(fileName.substring(0,
						fileName.length() - ".java".length())
						.replace('\\', '.')
						.replace('/', '.'));
				}
				
				// Make sure the output is written
				out.flush();
			}
		}
		catch (IOException e)
		{
			throw new RuntimeException(e);
		}
	}
	
	/**
	 * Only run the task if certain conditions are met.
	 *
	 * @param __task The task to run.
	 * @return The result if it should run or not.
	 * @since 2020/02/28
	 */
	private boolean __onlyIf(Task __task)
	{
		// There is no point in running this, if nothing can be done
		return !this.__taskInputsAsFileCollection().isEmpty();
	}
	
	/**
	 * Returns the output path.
	 *
	 * @return The output path.
	 * @since 2020/02/28
	 */
	private Path __outputPath()
	{
		// We might need to set an output potentially
		Project project = this.getProject();
		SourceSetOutput outSet = this.getProject().getConvention().
			getPlugin(JavaPluginConvention.class).
			getSourceSets().getByName(SourceSet.TEST_SOURCE_SET_NAME).
			getOutput();
			
		// The base output directory
		File outDirFile = outSet.getResourcesDir();
		if (outDirFile == null)
			outSet.setResourcesDir((outDirFile = project.getBuildDir().
			toPath().resolve("test-list-resource").toFile()));
		
		return outDirFile.toPath();
	}
	
	/**
	 * Gets the inputs for this task.
	 *
	 * @return The task inputs.
	 * @since 2020/02/28
	 */
	private Iterable<__Input__> __taskInputs()
	{
		Project project = this.getProject();
		
		// Discover all the input files
		Collection<__Input__> result = new LinkedList<>();
		for (DirectoryTree dir : this.getProject().getConvention().
			getPlugin(JavaPluginConvention.class).getSourceSets().
			getByName("test").getJava().getSrcDirTrees())
		{
			Path baseDir = dir.getDir().toPath();
			
			// Process all files in each directory
			for (File file : project.files(dir))
			{
				Path path = file.toPath();
				
				if (GenerateTestsListTask.__isTest(path))
					result.add(new __Input__(path, baseDir.relativize(path)));
			}
		}
		
		return result;
	}
	
	/**
	 * Gets the inputs for the task.
	 *
	 * @return The task inputs.
	 * @since 2020/02/28
	 */
	private FileCollection __taskInputsAsFileCollection()
	{
		Collection<File> result = new LinkedList<>();
		for (__Input__ file : this.__taskInputs())
			result.add(file.absolute.toFile());
		
		return this.getProject().files(result);
	}
	
	/**
	 * Returns the output of this task.
	 *
	 * @return The task output.
	 * @since 2020/02/28
	 */
	private Path __taskOutput()
	{
		return this.__outputPath().resolve(
			GenerateTestsListTask.SERVICE_LIST_PATH);
	}
	
	/**
	 * Gets the outputs for the task.
	 *
	 * @return The task outputs.
	 * @since 2020/02/28
	 */
	private FileCollection __taskOutputsAsFileCollection()
	{
		// There is just a single output file
		return this.getProject().files(this.__taskOutput().toFile());
	}
	
	/**
	 * Is this considered a test?
	 *
	 * @param __path The path to get.
	 * @return If this is considered a test.
	 * @since 2020/02/8
	 */
	private static boolean __isTest(Path __path)
		throws NullPointerException
	{
		if (__path == null)
			throw new NullPointerException();
		
		// Only consider source files
		String fileName = __path.getFileName().toString();
		if (!fileName.endsWith(".java"))
			return false;
		
		// Get base class form
		String className = fileName.substring(0,
			fileName.length() - ".java".length());
		
		return (className.startsWith("Do") || className.startsWith("Test") ||
			className.endsWith("Test"));
	}
}

Added buildSrc/src/main/java/cc/squirreljme/plugin/tasks/MimeDecodeResourcesTask.java.

























































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.plugin.tasks;

import cc.squirreljme.plugin.util.MIMEFileDecoder;
import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.StandardOpenOption;
import java.util.Collection;
import java.util.LinkedList;
import javax.inject.Inject;
import org.gradle.api.Action;
import org.gradle.api.DefaultTask;
import org.gradle.api.Project;
import org.gradle.api.Task;
import org.gradle.api.file.DirectoryTree;
import org.gradle.api.file.FileCollection;
import org.gradle.api.file.FileCopyDetails;
import org.gradle.api.plugins.JavaPluginConvention;
import org.gradle.api.tasks.SourceSetOutput;
import org.gradle.language.jvm.tasks.ProcessResources;

public class MimeDecodeResourcesTask
	extends DefaultTask
{
	/** The extension for MIME files. */
	public static final String EXTENSION =
		".__mime";
	
	/** The source set to modify. */
	protected final String sourceSet;
	
	/**
	 * Initializes the task.
	 *
	 * @param __sourceSet The source set to adjust.
	 * @param __processTask The processing task.
	 * @since 2020/02/28
	 */
	@Inject
	public MimeDecodeResourcesTask(String __sourceSet,
		ProcessResources __processTask)
	{
		// The source set we want to work with
		this.sourceSet = __sourceSet;
		
		// Set details of this task
		this.setGroup("squirreljme");
		this.setDescription("Decodes MIME encoded resource files.");
		
		// Configure tasks and such
		Project project = this.getProject();
		this.getInputs().files(
			project.provider(this::__taskInputsAsFileCollection));
		this.getOutputs().files(
			project.provider(this::__taskOutputsAsFileCollection));
		this.onlyIf(this::__onlyIf);
		
		// The action to do
		this.doLast(new __ActionTask__());
		
		// The process task depends on this task
		__processTask.dependsOn(this);
		
		// However, since we use our own files, we exclude files from this
		// task!
		__processTask.eachFile((FileCopyDetails __fcd) ->
			{
				// Exclude all MIME files from this task
				if (MimeDecodeResourcesTask.
					__isMimeFile(__fcd.getFile().toPath()))
					__fcd.exclude();
			});
	}
	
	/**
	 * Runs the actual task.
	 *
	 * @param __task The task to run for.
	 * @since 2020/02/28
	 */
	private void __doLast(Task __task)
	{
		// Anything here can fail for IO operations
		try
		{
			// Process all outputs
			for (__Output__ output : this.__taskOutputs())
			{
				Path outPath = output.output;
				
				// Make sure the output directory exists!
				Files.createDirectories(outPath.getParent());
				
				// Copy decoded MIME data to the output file
				try (MIMEFileDecoder in = new MIMEFileDecoder(
					Files.newInputStream(output.input.absolute,
							StandardOpenOption.READ));
					OutputStream out = Files.newOutputStream(outPath,
							StandardOpenOption.CREATE,
							StandardOpenOption.TRUNCATE_EXISTING,
							StandardOpenOption.WRITE))
				{
					byte[] buf = new byte[4096];
					for (;;)
					{
						int rc = in.read(buf);
						
						if (rc < 0)
							break;
						
						out.write(buf, 0, rc);
					}
				}
			}
		}
		catch (IOException e)
		{
			throw new RuntimeException(e);
		}
	}
	
	/**
	 * Returns the output path.
	 *
	 * @return The output path.
	 * @since 2020/02/28
	 */
	private Path __outputPath()
	{
		// We might need to set an output potentially
		Project project = this.getProject();
		SourceSetOutput outSet = this.getProject().getConvention().
			getPlugin(JavaPluginConvention.class).
			getSourceSets().getByName(this.sourceSet).getOutput();
		
		// The base output directory
		File outDirFile = outSet.getResourcesDir();
		if (outDirFile == null)
			outSet.setResourcesDir((outDirFile = project.getBuildDir().
			toPath().resolve("mime-decoded-" + this.sourceSet).toFile()));
		
		return outDirFile.toPath();
	}
	
	/**
	 * Only run the task if certain conditions are met.
	 *
	 * @param __task The task to run.
	 * @return The result if it should run or not.
	 * @since 2020/02/28
	 */
	private boolean __onlyIf(Task __task)
	{
		// There is no point in running this, if nothing can be done
		return !this.__taskInputsAsFileCollection().isEmpty();
	}
	
	/**
	 * Gets the inputs for the task as fully informed files.
	 *
	 * @return The task inputs.
	 * @since 2020/02/28
	 */
	private Iterable<__Input__> __taskInputs()
	{
		Project project = this.getProject();
		
		// Discover all the input files
		Collection<__Input__> result = new LinkedList<>();
		for (DirectoryTree dir : this.getProject().getConvention().
			getPlugin(JavaPluginConvention.class).getSourceSets().
			getByName(this.sourceSet).getResources().getSrcDirTrees())
		{
			Path baseDir = dir.getDir().toPath();
			
			// Process all files in each directory
			for (File file : project.files(dir))
			{
				Path path = file.toPath();
				
				// Only consider MIME files
				if (!MimeDecodeResourcesTask.__isMimeFile(path))
					continue;
				
				result.add(new __Input__(path, baseDir.relativize(path)));
			}
		}
		
		return result;
	}
	
	/**
	 * Gets the inputs for the task.
	 *
	 * @return The task inputs.
	 * @since 2020/02/28
	 */
	private FileCollection __taskInputsAsFileCollection()
	{
		Collection<File> result = new LinkedList<>();
		for (__Input__ file : this.__taskInputs())
			result.add(file.absolute.toFile());
		
		return this.getProject().files(result);
	}
	
	/**
	 * Gets the outputs for the task.
	 *
	 * @return The task outputs.
	 * @since 2020/02/28
	 */
	private Iterable<__Output__> __taskOutputs()
	{
		// The output path to process
		Path outDir = this.__outputPath();
		
		// Store output files accordingly
		Collection<__Output__> result = new LinkedList<>();
		for (__Input__ input : this.__taskInputs())
			result.add(new __Output__(input, outDir.resolve(
				MimeDecodeResourcesTask.
					__removeMimeExtension(input.relative))));
		
		return result;
	}
	
	/**
	 * Gets the outputs for the task.
	 *
	 * @return The task outputs.
	 * @since 2020/02/28
	 */
	private FileCollection __taskOutputsAsFileCollection()
	{
		Collection<File> result = new LinkedList<>();
		for (__Output__ output : this.__taskOutputs())
			result.add(output.output.toFile());
		
		return this.getProject().files(result);
	}
	
	/**
	 * Is this a MIME file?
	 *
	 * @param __path The path to get.
	 * @return If this is a MIME file.
	 * @throws NullPointerException On null arguments.
	 * @since 2020/02/28
	 */
	private static boolean __isMimeFile(Path __path)
		throws NullPointerException
	{
		if (__path == null)
			throw new NullPointerException("No path specified.");
		
		return __path.getFileName().toString().endsWith(
			MimeDecodeResourcesTask.EXTENSION);
	}
	
	/**
	 * Removes the extension from the file.
	 *
	 * @param __fn The file name to remove.
	 * @return The file name without the extension.
	 * @throws IllegalArgumentException If the file does not have the
	 * extension.
	 * @throws NullPointerException On null arguments.
	 * @since 2020/02/28
	 */
	private static Path __removeMimeExtension(Path __fn)
		throws IllegalArgumentException, NullPointerException
	{
		if (__fn == null)
			throw new NullPointerException("No file name specified.");
		
		// Must be a MIME file
		String fileName = __fn.getFileName().toString();
		if (!fileName.endsWith(MimeDecodeResourcesTask.EXTENSION))
			throw new IllegalArgumentException("File does not end in MIME.");
		
		// The output will be a sibling of the path
		return __fn.resolveSibling(fileName.substring(0,
			fileName.length() - MimeDecodeResourcesTask.EXTENSION.length()));
	}
	
	/**
	 * The action to perform.
	 *
	 * @since 2020/02/29
	 */
	private class __ActionTask__
		implements Action<Task>
	{
		/**
		 * {@inheritDoc}
		 * @since 2020/02/29
		 */
		@Override
		public void execute(Task __task)
		{
			MimeDecodeResourcesTask.this.__doLast(__task);
		}
	}
}

Added buildSrc/src/main/java/cc/squirreljme/plugin/tasks/RunEmulatedTask.java.











































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.plugin.tasks;

import cc.squirreljme.plugin.SquirrelJMEPluginConfiguration;
import cc.squirreljme.plugin.swm.JavaMEMidlet;
import cc.squirreljme.plugin.swm.JavaMEMidletType;
import groovy.lang.Closure;
import java.io.File;
import java.nio.file.Path;
import java.util.Arrays;
import java.util.Collection;
import java.util.LinkedHashSet;
import java.util.LinkedList;
import java.util.Objects;
import java.util.concurrent.Callable;
import javax.inject.Inject;
import org.gradle.api.Action;
import org.gradle.api.DefaultTask;
import org.gradle.api.Project;
import org.gradle.api.Task;
import org.gradle.api.artifacts.Configuration;
import org.gradle.api.artifacts.Dependency;
import org.gradle.api.artifacts.ProjectDependency;
import org.gradle.jvm.tasks.Jar;
import org.gradle.process.JavaExecSpec;

/**
 * Launches the program but runs it in the Virtual Machine.
 *
 * @since 2020/02/29
 */
public class RunEmulatedTask
	extends DefaultTask
{
	/** Main configurations. */
	private static final String[] _MAIN_CONFIGS =
		new String[]{"api", "implementation"};
	
	/** Test configurations. */
	private static final String[] _TEST_CONFIGS =
		new String[]{"testApi", "testImplementation"};
	
	/** The emulator to use. */
	protected final String emulator;
	
	/** Is this for a test? */
	protected final boolean isTest;
	
	/**
	 * Initializes the task.
	 *
	 * @param __jar The JAR task.
	 * @param __emulator The emulator to use.
	 * @param __test Is this for tests?
	 * @since 2020/02/29
	 */
	@Inject
	public RunEmulatedTask(Jar __jar, String __emulator, boolean __test)
	{
		if (__test)
			throw new IllegalArgumentException("Implement test launching!");
		
		this.emulator = __emulator;
		this.isTest = __test;
		
		// Set details of this task
		this.setGroup("squirreljme");
		this.setDescription((__test ? "Tests the program with " +
			__emulator + "." : "Launches the program with the " +
			__emulator + " virtual machine."));
		
		// The output of this task is the profiling snapshot
		this.getOutputs().files(
			this.getProject().provider(this::__profilerSnapshotPath));
		
		// This only runs if this is an application
		this.onlyIf(this::__onlyIf);
		
		// Run the task accordingly
		this.doLast(new RunEmulatedTask.__ActionTask__());
		
		// This needs the JAR task and the emulation task
		this.dependsOn(__jar,
			(Callable<Object>)this::__findEmulatorJarTask,
			(Callable<Object>)this::__findEmulatorBaseJarTask);
	}
	
	/**
	 * Only runs if these conditions are met.
	 *
	 * @param __task Checks this task.
	 * @return If this can run or not.
	 * @since 2020/02/29
	 */
	private boolean __onlyIf(Task __task)
	{
		// Only allow if an application!
		return SquirrelJMEPluginConfiguration.configuration(this.getProject())
			.swmType == JavaMEMidletType.APPLICATION;
	}
	
	/**
	 * Finds the emulator JAR task.
	 *
	 * @return The emulator JAR task.
	 * @since 2020/02/29
	 */
	private Object __findEmulatorBaseJarTask()
	{
		return Objects.requireNonNull(this.getProject().getRootProject().
			findProject(":emulators:emulator-base"),
			"No emulator base?").getTasks().getByName("jar");
	}
	
	/**
	 * Locates the emulator package to base on.
	 *
	 * @return The emulator base.
	 * @since 2020/02/29
	 */
	private Object __findEmulatorJarTask()
	{
		return Objects.requireNonNull(this.getProject().getRootProject().
			findProject(":emulators:" + this.emulator + "-vm"),
			"No emulator?").getTasks().getByName("jar");
	}
	
	/**
	 * Returns the snapshot path for the profiler.
	 *
	 * @return The profiler snapshot path.
	 * @since 2020/02/29
	 */
	File __profilerSnapshotPath()
	{
		return this.getProject().getBuildDir().toPath()
			.resolve(this.emulator + ".nps").toFile();
	}
	
	/**
	 * Returns the run class path.
	 *
	 * @return The run class path.
	 * @since 2020/02/29
	 */
	Iterable<Path> __runClassPath()
	{
		Collection<Path> result = new LinkedHashSet<>();
		
		this.__recursiveDependencies(result, this.getProject());
		
		return result;
	}
	
	/**
	 * Returns the run class path as a string.
	 *
	 * @return The run class path as a string.
	 * @since 2020/02/29
	 */
	String __runClassPathAsString()
	{
		StringBuilder sb = new StringBuilder();
		
		for (Path path : this.__runClassPath())
		{
			if (sb.length() > 0)
				sb.append(File.pathSeparatorChar);
			sb.append(path);
		}
		
		return sb.toString();
	}
	
	/**
	 * Recursively scans and obtains dependencies.
	 *
	 * @param __out The output collection.
	 * @param __at The current project currently at.
	 * @since 2020/02/29
	 */
	final void __recursiveDependencies(Collection<Path> __out, Project __at)
	{
		// If this is not a SquirrelJME project, ignore
		SquirrelJMEPluginConfiguration config = __at.getExtensions()
			.<SquirrelJMEPluginConfiguration>findByType(
				SquirrelJMEPluginConfiguration.class);
		if (config == null)
			return;
		
		// Look in these configurations for dependencies, done first so what
		// we depend on has higher priority first
		for (String configurationName : (this.isTest ?
				RunEmulatedTask._TEST_CONFIGS : RunEmulatedTask._MAIN_CONFIGS))
		{
			// The configuration might not even exist
			Configuration buildConfig = __at.getConfigurations()
				.findByName(configurationName);
			if (buildConfig == null)
				continue;
			
			// Recursively scan dependencies
			for (Dependency dependency : buildConfig.getDependencies())
			{
				// Only consider modules
				if (!(dependency instanceof ProjectDependency))
					continue;
				
				// Recursive search these dependencies
				this.__recursiveDependencies(__out,
					((ProjectDependency)dependency).getDependencyProject());
			}
		}
		
		// Process the output files for the JAR of this project, use the
		// absolute path since there might be hard to find libraries that are
		// relative
		for (File file : ((Jar)__at.getTasks().getByName("jar"))
			.getOutputs().getFiles())
			__out.add(file.toPath().toAbsolutePath());
		
	}
	
	/**
	 * Used to run the emulator.
	 *
	 * @since 2020/02/29
	 */
	private class __ActionTask__
		implements Action<Task>
	{
		/**
		 * {@inheritDoc}
		 * @since 2020/02/29
		 */
		@Override
		public void execute(Task __task)
		{
			// Get current and emulator projects
			Project project = RunEmulatedTask.this.getProject();
			Project emuBase = project.getRootProject().
				project(":emulators:emulator-base");
			Project emuCore = project.getRootProject().
				project(":emulators:" + RunEmulatedTask.this.emulator + "-vm");
			
			// Need this to get the program details
			SquirrelJMEPluginConfiguration config =
				SquirrelJMEPluginConfiguration.configuration(project);
			
			// Execute program
			project.javaexec((JavaExecSpec __spec) ->
				{
					// Are we launching a MIDlet?
					JavaMEMidlet midlet = null;
					if (!config.midlets.isEmpty())
						midlet = config.midlets.get(0);
					
					// Build arguments to the VM
					Collection<String> args = new LinkedList<>();
					
					// Add emulator
					args.add("-Xemulator:" + RunEmulatedTask.this.emulator);
					
					// Add snapshot path
					args.add("-Xsnapshot:" + RunEmulatedTask.this.
						__profilerSnapshotPath().toPath().toString());
					
					// Determine program classpath
					args.add("-classpath");
					args.add(RunEmulatedTask.this.__runClassPathAsString());
					
					// Add main class to launch
					args.add((midlet != null ?
						"javax.microedition.midlet.__MainHandler__" :
						Objects.requireNonNull(config.mainClass,
						"No main class in project.")));
					
					// We need to tell the MIDlet launcher what our main entry
					// point is going to be
					if (midlet != null)
						args.add(midlet.mainClass);
					
					// Use the given arguments
					__spec.args(args);
					
					// We only need the classpath of the emulator because this
					// runs on it
					__spec.classpath(
						((Jar)emuBase.getTasks().getByName("jar"))
							.getOutputs().getFiles(),
						((Jar)emuCore.getTasks().getByName("jar"))
							.getOutputs().getFiles(),
						RunNativeTask.__projectClassPath(emuBase),
						RunNativeTask.__projectClassPath(emuCore));
					
					// Main entry point for the emulator
					__spec.setMain("cc.squirreljme.emulator.vm.VMFactory");
				});
		}
	}
}

Added buildSrc/src/main/java/cc/squirreljme/plugin/tasks/RunNativeTask.java.



























































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.plugin.tasks;

import cc.squirreljme.plugin.SquirrelJMEPluginConfiguration;
import cc.squirreljme.plugin.swm.JavaMEMidlet;
import cc.squirreljme.plugin.swm.JavaMEMidletType;
import java.util.Objects;
import java.util.concurrent.Callable;
import javax.inject.Inject;
import org.gradle.api.Action;
import org.gradle.api.DefaultTask;
import org.gradle.api.Project;
import org.gradle.api.Task;
import org.gradle.jvm.tasks.Jar;
import org.gradle.process.JavaExecSpec;

/**
 * Launches the program using the host system which is backed by the
 * base emulator.
 *
 * @since 2020/02/29
 */
public class RunNativeTask
	extends DefaultTask
{
	/**
	 * Initializes the task.
	 *
	 * @param __jar The JAR task.
	 * @since 2020/02/29
	 */
	@Inject
	public RunNativeTask(Jar __jar)
	{
		// Set details of this task
		this.setGroup("squirreljme");
		this.setDescription("Runs the program using the emulator.");
		
		// This only runs if this is an application
		this.onlyIf(this::__onlyIf);
		
		// Run the task accordingly
		this.doLast(new __ActionTask__());
		
		// This needs the JAR task and the emulation task
		this.dependsOn(__jar,
			(Callable<Object>)this::__findEmulatorJarTask);
	}
	
	/**
	 * Finds the emulator JAR task.
	 *
	 * @return The emulator JAR task.
	 * @since 2020/02/29
	 */
	private Object __findEmulatorJarTask()
	{
		return Objects.requireNonNull(this.getProject().getRootProject().
			findProject(":emulators:emulator-base"),
			"No emulator base?").getTasks().getByName("jar");
	}
	
	/**
	 * Only runs if these conditions are met.
	 *
	 * @param __task Checks this task.
	 * @return If this can run or not.
	 * @since 2020/02/29
	 */
	private boolean __onlyIf(Task __task)
	{
		// Only allow if an application!
		return SquirrelJMEPluginConfiguration.configuration(this.getProject())
			.swmType == JavaMEMidletType.APPLICATION;
	}
	
	/**
	 * Returns the project classpath.
	 *
	 * @param __project The project.
	 * @return The class path.
	 * @throws NullPointerException On null arguments.
	 * @since 2020/02/29
	 */
	static Object __projectClassPath(Project __project)
		throws NullPointerException
	{
		if (__project == null)
			throw new NullPointerException("No project specified.");
		
		return __project.getConfigurations().
			getByName("runtimeClasspath").getFiles();
	}
	
	/**
	 * Performs the task action.
	 *
	 * @since 2020/02/29
	 */
	private class __ActionTask__
		implements Action<Task>
	{
		/**
		 * {@inheritDoc}
		 * @since 2020/02/29
		 */
		@Override
		public void execute(Task __task)
		{
			// Get current and emulator projects
			Project project = RunNativeTask.this.getProject();
			Project emuBase = project.getRootProject().
				project(":emulators:emulator-base");
			
			// Need this to get the program details
			SquirrelJMEPluginConfiguration config =
				SquirrelJMEPluginConfiguration.configuration(project);
			
			// Execute program
			project.javaexec((JavaExecSpec __spec) ->
				{
					// Are we launching a MIDlet?
					JavaMEMidlet midlet = null;
					if (!config.midlets.isEmpty())
						midlet = config.midlets.get(0);
					
					// Which class do we launch?
					__spec.setMain((midlet != null ?
						"javax.microedition.midlet.__MainHandler__" :
						Objects.requireNonNull(config.mainClass,
						"No main class in project.")));
					
					// We need to tell the MIDlet launcher what our main entry
					// point is going to be
					if (midlet != null)
						__spec.args(midlet.mainClass);
					
					// Set the classpath needed
					__spec.classpath(
						((Jar)project.getTasks().getByName("jar"))
							.getOutputs().getFiles(),
						((Jar)emuBase.getTasks().getByName("jar"))
							.getOutputs().getFiles(),
						RunNativeTask.__projectClassPath(project),
						RunNativeTask.__projectClassPath(emuBase));
				});
		}
	}
}

Added buildSrc/src/main/java/cc/squirreljme/plugin/tasks/__Input__.java.















































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.plugin.tasks;

import java.nio.file.Path;

/**
 * Source file and its input/output.
 *
 * @since 2020/02/28
 */
final class __Input__
{
	/** The absolute path. */
	public final Path absolute;
	
	/** The relative path. */
	public final Path relative;
	
	/**
	 * Initializes the file information.
	 *
	 * @param __absolute The absolute path.
	 * @param __relative The relative path.
	 * @throws NullPointerException On null arguments.
	 * @since 2020/02/28
	 */
	__Input__(Path __absolute, Path __relative)
		throws NullPointerException
	{
		if (__absolute == null || __relative == null)
			throw new NullPointerException();
		
		this.absolute = __absolute;
		this.relative = __relative;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2020/02/28
	 */
	@Override
	public final String toString()
	{
		return String.format("{absolute=%s, relative=%s}",
			this.absolute, this.relative);
	}
}

Added buildSrc/src/main/java/cc/squirreljme/plugin/tasks/__Output__.java.















































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.plugin.tasks;

import java.nio.file.Path;

/**
 * The output for a task.
 *
 * @since 2020/02/28
 */
final class __Output__
{
	/** The input file. */
	public final __Input__ input;
	
	/** The output path. */
	public final Path output;
	
	/**
	 * Initializes the output path.
	 *
	 * @param __input The input path.
	 * @param __output The output path.
	 * @throws NullPointerException On null arguments.
	 * @since 2020/02/28
	 */
	public __Output__(__Input__ __input, Path __output)
		throws NullPointerException
	{
		if (__input == null || __output == null)
			throw new NullPointerException();
		
		this.input = __input;
		this.output = __output;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2020/02/28
	 */
	@Override
	public final String toString()
	{
		return String.format("{input=%s, output=%s}",
			this.input, this.output);
	}
}

Added buildSrc/src/main/java/cc/squirreljme/plugin/tasks/package-info.java.





















>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.plugin.tasks;

Added buildSrc/src/main/java/cc/squirreljme/plugin/util/Base64Alphabet.java.

















































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.plugin.util;

/**
 * This represents the alphabet that is used for Base64.
 *
 * @since 2018/03/05
 */
public enum Base64Alphabet
{
	/** The basic and MIME alphabet. */
	BASIC('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
		'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
		'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
		'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
		'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/', '='),
	
	/** The URL alphabet. */
	URL('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
		'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
		'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
		'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
		'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '-', '_', '='),
	
	/** End. */
	;
	
	/** The alphabet for the characters. */
	final char[] _alphabet;
	
	/**
	 * Initializes the alphabet.
	 *
	 * @param __alphabet The alphabet.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/03/05
	 */
	Base64Alphabet(char... __alphabet)
		throws NullPointerException
	{
		if (__alphabet == null)
			throw new NullPointerException("NARG");
		
		this._alphabet = __alphabet;
	}
}

Added buildSrc/src/main/java/cc/squirreljme/plugin/util/Base64Decoder.java.































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.plugin.util;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.Reader;
import java.io.StringReader;

/**
 * This decodes the base64 character set, ignoring invalid characters, and
 * provides the binary data for the input. If the padding character is reached
 * or if the input stream runs out of characters then EOF is triggered.
 *
 * @since 2018/03/05
 */
public final class Base64Decoder
	extends InputStream
{
	/** The source reader. */
	protected final Reader in;
	
	/** Ignore padding characters. */
	protected final boolean ignorepadding;
	
	/** The alphabet to use for decoding. */
	private final char[] _alphabet;
	
	/** The ASCII map for quick lookup. */
	private final byte[] _ascii;
	
	/** Output bytes to drain. */
	private final byte[] _drain =
		new byte[3];
	
	/** The current fill buffer. */
	private volatile int _buffer;
	
	/** The number of bits which are in the buffer. */
	private volatile int _bits;
	
	/** Has EOF been reached if the pad has been detected? */
	private volatile boolean _readeof;
	
	/** The current output drain position. */
	private volatile int _drained =
		-1;
	
	/** The maximum value for drained values. */
	private volatile int _drainedmax =
		-1;
	
	/**
	 * Initializes the decode the default MIME alphabet.
	 *
	 * @param __in The input set of characters.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/11/23
	 */
	public Base64Decoder(Reader __in)
	{
		this(__in, Base64Alphabet.BASIC);
	}
	
	/**
	 * Initializes the decoder using the specified alphabet.
	 *
	 * @param __in The input set of characters.
	 * @param __chars The pre-defined character set to use for the alphabet.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/03/05
	 */
	public Base64Decoder(Reader __in, Base64Alphabet __chars)
		throws NullPointerException
	{
		this(__in, __chars._alphabet, false);
	}
	
	/**
	 * Initializes the decoder using the specified custom alphabet.
	 *
	 * @param __in The input set of characters.
	 * @param __chars The characters to use for the alphabet.
	 * @throws IllegalArgumentException If the alphabet is of the incorrect
	 * size.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/03/05
	 */
	public Base64Decoder(Reader __in, String __chars)
		throws IllegalArgumentException, NullPointerException
	{
		this(__in, __chars.toCharArray(), false);
	}
	
	/**
	 * Initializes the decoder using the specified custom alphabet.
	 *
	 * @param __in The input set of characters.
	 * @param __chars The characters to use for the alphabet.
	 * @throws IllegalArgumentException If the alphabet is of the incorrect
	 * size.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/03/05
	 */
	public Base64Decoder(Reader __in, char[] __chars)
		throws IllegalArgumentException, NullPointerException
	{
		this(__in, __chars, false);
	}
	
	/**
	 * Initializes the decoder using the default alphabet.
	 *
	 * @param __in The input set of characters.
	 * @param __chars The pre-defined character set to use for the alphabet.
	 * @param __ip Ignore padding characters and do not treat them as the end
	 * of the stream.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/03/05
	 */
	public Base64Decoder(Reader __in, Base64Alphabet __chars, boolean __ip)
		throws NullPointerException
	{
		this(__in, __chars._alphabet, __ip);
	}
	
	/**
	 * Initializes the decoder using the specified custom alphabet.
	 *
	 * @param __in The input set of characters.
	 * @param __chars The characters to use for the alphabet.
	 * @param __ip Ignore padding characters and do not treat them as the end
	 * of the stream.
	 * @throws IllegalArgumentException If the alphabet is of the incorrect
	 * size.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/03/05
	 */
	public Base64Decoder(Reader __in, String __chars, boolean __ip)
		throws IllegalArgumentException, NullPointerException
	{
		this(__in, __chars.toCharArray(), __ip);
	}
	
	/**
	 * Initializes the decoder using the specified custom alphabet.
	 *
	 * @param __in The input set of characters.
	 * @param __chars The characters to use for the alphabet.
	 * @param __ip Ignore padding characters and do not treat them as the end
	 * of the stream.
	 * @throws IllegalArgumentException If the alphabet is of the incorrect
	 * size.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/03/05
	 */
	public Base64Decoder(Reader __in, char[] __chars, boolean __ip)
		throws IllegalArgumentException, NullPointerException
	{
		if (__in == null || __chars == null)
			throw new NullPointerException("NARG");
		
		// {@squirreljme.erorr BD0g The alphabet to use for the base64
		// decoder must be 64 characters plus one padding character.
		// (The character count)}
		int n;
		if ((n = __chars.length) != 65)
			throw new IllegalArgumentException(String.format("BD0g %d", n));
		
		// Set
		this.in = __in;
		this.ignorepadding = __ip;
		this._alphabet = (__chars = __chars.clone());
		
		// Build ASCII map for quick in-range character lookup
		byte[] ascii = new byte[128];
		for (int i = 0; i < 128; i++)
			ascii[i] = -1;
		for (int i = 0; i < 65; i++)
		{
			int dx = __chars[i];
			if (dx < 128)
				ascii[dx] = (byte)i;
		}
		this._ascii = ascii;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/11/25
	 */
	@Override
	public final int available()
		throws IOException
	{
		int drained = this._drained;
		
		// There are bytes which are ready and in the drain that we do not
		// need to block reading them?
		if (drained != -1)
			return this._drainedmax - drained;
		return 0;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/03/05
	 */
	@Override
	public final void close()
		throws IOException
	{
		this.in.close();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/03/05
	 */
	@Override
	public final int read()
		throws IOException
	{
		// If there is stuff to be drained, quickly drain that so we do not
		// need to go deeper into the heavier method
		int drained = this._drained;
		if (drained != -1)
		{
			// Read in drained character
			int rv = this._drain[drained++] & 0xFF;
			
			// Reached the drain limit?
			if (drained == this._drainedmax)
			{
				this._drained = -1;
				this._drainedmax = -1;
			}
			
			// Would still be drain
			else
				this._drained = drained;
			
			// Return the value
			return rv;
		}
		
		// Previously read EOF, so this will just return EOF
		if (this._readeof)
			return -1;
		
		// Otherwise decode and read
		byte[] next = new byte[1];
		for (;;)
		{
			int rc = this.read(next, 0, 1);
			
			// EOF?
			if (rc < 0)
				return -1;
			
			// Missed read
			else if (rc == 0)
				continue;
			
			return (next[0] & 0xFF);
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/11/25
	 */
	@Override
	public final int read(byte[] __b)
		throws IOException, NullPointerException
	{
		if (__b == null)
			throw new NullPointerException("NARG");
		
		return this.read(__b, 0, __b.length);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/03/05
	 */
	@Override
	public final int read(byte[] __b, int __o, int __l)
		throws IndexOutOfBoundsException, IOException, NullPointerException
	{
		if (__b == null)
			throw new NullPointerException("NARG");
		if (__o < 0 || __l < 0 || (__o + __l) > __b.length)
			throw new IndexOutOfBoundsException("IOOB");
		
		// Did a previous read cause a padded EOF?
		boolean readeof = this._readeof;
		
		// Need lookups
		Reader in = this.in;
		boolean ignorepadding = this.ignorepadding;
		char[] alphabet = this._alphabet;
		byte[] ascii = this._ascii;
		byte[] drain = this._drain;
		
		// This buffer is filled into as needed when input characters are read
		int buffer = this._buffer,
			bits = this._bits,
			drained = this._drained,
			drainedmax = this._drainedmax;
		
		// Keep trying to fill bytes in
		int rv = 0;
		while (rv < __l)
		{
			// Still need to drain bytes away
			if (drained != -1 && drained < drainedmax)
			{
				// Drain it
				__b[__o++] = drain[drained++];
				rv++;
				
				// Drained all the characters
				if (drained == drainedmax)
					drained = drainedmax = -1;
				
				// Try again
				else
					continue;
			}
			
			// EOF was reached
			if (readeof)
				break;
			
			// Read in character and decode it
			int ch = in.read();
			
			// Is EOF?
			if (ch < 0)
			{
				// {@squirreljme.error BD01 Read EOF from input when there
				// were expected to be more characters or the ending padding
				// character. (The bits in the buffer)}
				if (bits != 0)
					throw new IOException("BD01 " + bits);
				
				// Did read EOF
				readeof = true;
				break;
			}
			
			// Determine the value of the character
			if (ch < 128)
				ch = ascii[ch];
			else
			{
				ch = -1;
				for (int i = 0; i < 65; i++)
					if (i == alphabet[i])
					{
						ch = i;
						break;
					}
			}
			
			// Invalid, ignore and continue
			if (ch == -1 || (ignorepadding && ch == 64))
				continue;
			
			// Decoded padding character
			else if (ch == 64)
			{
				// {@squirreljme.error BD02 Did not expect a padding character.
				// (The number of decoded bits in queue)}
				if (bits == 0 || bits == 24)
					throw new IOException("BD02 " + bits);
				
				// Only want to store a single extra byte since that is
				// all that is valid
				else if (bits < 16)
				{
					// {@squirreljme.error BD03 Expected another padding
					// character.}
					if (in.read() != alphabet[64])
						throw new IOException("BD03");
					
					drain[0] = (byte)(buffer >>> 4);
					
					drainedmax = 1;
				}
				
				// Otherwise there will be two characters to drain
				else
				{
					drain[0] = (byte)(buffer >>> 10);
					drain[1] = (byte)(buffer >>> 2);
					
					drainedmax = 2;
				}
				
				// Need to drain all
				drained = 0;
					
				// Clear the buffer
				buffer = bits = 0;
				
				// Did read EOF
				readeof = true;
			}
			
			// Normal data
			else
			{
				// Shift in six bits
				buffer <<= 6;
				buffer |= ch;
				bits += 6;
				
				// Drain and empty the buffer
				if (bits == 24)
				{
					// Fill the drain
					drain[0] = (byte)(buffer >>> 16);
					drain[1] = (byte)(buffer >>> 8);
					drain[2] = (byte)buffer;
					
					// Set these to drain
					drained = 0;
					drainedmax = 3;
					
					// Clear the buffer
					buffer = bits = 0;
				}
			}
		}
		
		// Store state for next run
		this._buffer = buffer;
		this._bits = bits;
		this._readeof = readeof;
		this._drained = drained;
		this._drainedmax = drainedmax;
		
		// Return the read count
		if (readeof && rv == 0)
			return -1;
		return rv;
	}
	
	/**
	 * Decodes the input string to byte values.
	 *
	 * @param __in The string to decode.
	 * @param __ab The alphabet to use.
	 * @return The resulting byte array.
	 * @throws IllegalArgumentException If the input string is not valid.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/11/06
	 */
	public static final byte[] decode(String __in, Base64Alphabet __ab)
		throws IllegalArgumentException, NullPointerException
	{
		return Base64Decoder.decode(__in, __ab, false);
	}
	
	/**
	 * Decodes the input string to byte values.
	 *
	 * @param __in The string to decode.
	 * @param __ab The alphabet to use.
	 * @param __ip Is padding ignored?
	 * @return The resulting byte array.
	 * @throws IllegalArgumentException If the input string is not valid.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/11/04
	 */
	public static final byte[] decode(String __in, Base64Alphabet __ab,
		boolean __ip)
		throws IllegalArgumentException, NullPointerException
	{
		if (__in == null || __ab == null)
			throw new NullPointerException("NARG");
		
		// Wrap in a reader to decode
		try (ByteArrayOutputStream baos = new ByteArrayOutputStream())
		{
			byte[] buf = new byte[32];
			
			// Loop handle bytes
			try (InputStream in = new Base64Decoder(
				new StringReader(__in), __ab, __ip))
			{
				for (;;)
				{
					int rc = in.read(buf);
					
					// EOF?
					if (rc < 0)
						break;
					
					// Copy
					baos.write(buf, 0, rc);
				}
			}
			
			// Return resulting byte array
			return baos.toByteArray();
		}
		
		// {@squirreljme.error BD04 Could not decode the input string.}
		catch (IOException e)
		{
			throw new IllegalArgumentException("BD04", e);
		}
	}
}

Added buildSrc/src/main/java/cc/squirreljme/plugin/util/CharSequenceUtils.java.































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.plugin.util;

import java.util.Arrays;

/**
 * This contains utilities which operate on character sequences.
 *
 * @since 2017/11/30
 */
public final class CharSequenceUtils
{
	/**
	 * Not used.
	 *
	 * @since 2017/11/30
	 */
	private CharSequenceUtils()
	{
	}
	
	/**
	 * Splits the specified character sequence using the given delimeter and
	 * returns all of the fields which are contained within. Extra whitespace
	 * within fields are not trimmed.
	 *
	 * @param __delim The delimeter to split fields by.
	 * @param __s The sequence to split.
	 * @return An array containing all of the fields.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/11/30
	 */
	public static final CharSequence[] fieldSplit(char __delim,
		CharSequence __s)
		throws NullPointerException
	{
		if (__s == null)
			throw new NullPointerException("NARG");
		
		// Get all indexes of that given character
		int[] ind = CharSequenceUtils.multipleIndexOf(__delim, __s);
		int delcount = ind.length;
		
		int n = delcount + 1;
		CharSequence[] rv = new CharSequence[n];
		for (int l = -1, r = 0, i = 0; i < n; i++, l++, r++)
			rv[i] = __s.subSequence((l >= 0 ? ind[l] + 1 : 0),
				(r < delcount ? ind[r] : __s.length()));
		
		return rv;
	}
	
	/**
	 * Searches the given sequence for the first occurrence of the specified
	 * character.
	 *
	 * @param __c The character to locate.
	 * @param __s The sequence to look inside.
	 * @return The index of the first occurrence.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/11/30
	 */
	public static final int firstIndex(char __c, CharSequence __s)
		throws NullPointerException
	{
		if (__s == null)
			throw new NullPointerException("NARG");
		
		for (int i = 0, n = __s.length(); i < n; i++)
			if (__c == __s.charAt(i))
				return i;
		return -1;
	}
	
	/**
	 * Searches the given sequence for the first occurrence of the specified
	 * characters.
	 *
	 * @param __c The characters to locate.
	 * @param __s The sequence to look inside.
	 * @return The index of the first occurrence.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/11/30
	 */
	public static final int firstIndex(char[] __c, CharSequence __s)
		throws NullPointerException
	{
		if (__c == null || __s == null)
			throw new NullPointerException("NARG");
		
		// For optimization sort the input array to find characters faster
		__c = __c.clone();
		Arrays.sort(__c);
		
		// Forward to one which assumes sorted input
		return CharSequenceUtils.firstIndexSorted(__c, __s);
	}
	
	/**
	 * Searches the given sequence for the first occurrence of the specified
	 * characters.
	 *
	 * @param __c The characters to locate.
	 * @param __s The sequence to look inside.
	 * @return The index of the first occurrence.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/11/30
	 */
	public static final int firstIndex(String __c, CharSequence __s)
		throws NullPointerException
	{
		if (__c == null || __s == null)
			throw new NullPointerException("NARG");
		
		return CharSequenceUtils.firstIndex(__c.toCharArray(), __s);
	}
	
	/**
	 * Searches the given sequence for the first occurrence of the specified
	 * characters. This assumes that the character set has already been
	 * sorted.
	 *
	 * @param __c The characters to locate, this is required to be sorted.
	 * @param __s The sequence to look inside.
	 * @return The index of the first occurrence.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/11/30
	 */
	public static final int firstIndexSorted(char[] __c, CharSequence __s)
		throws NullPointerException
	{
		if (__c == null || __s == null)
			throw new NullPointerException("NARG");
		
		// Go through ever character
		for (int i = 0, n = __s.length(), y = __c.length; i < n; i++)
		{
			// Use binary search because it is faster than checking each
			// and every element
			char c = __s.charAt(i);
			if (Arrays.binarySearch(__c, c) >= 0)
				return i;
		}
		
		// Not found
		return -1;
	}
	
	/**
	 * Returns an array containing all of the indexes that the specified
	 * character appears in the given sequence.
	 *
	 * @param __c The character to get the indexes for.
	 * @param __s The sequence to check in.
	 * @return An array containing the array indexes for the given character,
	 * if there are none then the array will be empty.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/11/26
	 */
	public static final int[] multipleIndexOf(char __c, CharSequence __s)
		throws NullPointerException
	{
		if (__s == null)
			throw new NullPointerException("NARG");
		
		IntegerList list = new IntegerList();
		
		// Find every character index
		for (int i = 0, n = __s.length(), lastdx = 0; i < n; i++)
		{
			char c = __s.charAt(i);
			
			// Add index to list if found
			if (c == __c)
				list.addInteger(i);
		}
		
		// Finish
		return list.toIntegerArray();
	}
}

Added buildSrc/src/main/java/cc/squirreljme/plugin/util/CommentReader.java.

































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
package cc.squirreljme.plugin.util;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.io.UnsupportedEncodingException;

/**
 * This is used to read comments from a source code file.
 *
 * @since 2020/02/22
 */
public class CommentReader
	extends Reader
{
	/** The source reader. */
	protected final BufferedReader source;
	
	/** Extra character queue. */
	private final StringBuilder _queue =
		new StringBuilder();
	
	/** Line remainder. */
	private final StringBuilder _remainder =
		new StringBuilder();
	
	/** Are we in multi-line comment? */
	private boolean _inMultiLine;
	
	/**
	 * Initializes the comment reader.
	 *
	 * @param __in The input source.
	 * @throws NullPointerException On null arguments.
	 * @since 2020/02/22
	 */
	public CommentReader(InputStream __in)
		throws NullPointerException
	{
		try
		{
			this.source = new BufferedReader(
				new InputStreamReader(__in, "utf-8"));
		}
		catch (UnsupportedEncodingException e)
		{
			throw new RuntimeException("UTF-8 is not supported?", e);
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2020/02/22
	 */
	@Override
	public void close()
		throws IOException
	{
		this.source.close();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2002/02/22
	 */
	@Override
	public int read(char[] __c, int __o, int __l)
		throws IndexOutOfBoundsException, IOException
	{
		if (__o < 0 || __l < 0 || (__o + __l) > __c.length)
			throw new IndexOutOfBoundsException();
		
		BufferedReader source = this.source;
		StringBuilder queue = this._queue;
		StringBuilder remainder = this._remainder;
		boolean inMultiLine = this._inMultiLine;
		
		// Constantly try to fill the output buffer
		int putCount = 0;
		while (putCount < __l)
		{
			// If there are characters in the queue, drain from it
			if (queue.length() > 0)
			{
				// Extract the first character
				char ch = queue.charAt(0);
				queue.deleteCharAt(0);
				
				// Place it in the output
				__c[__o++] = ch;
				putCount++;
				
				// Try again
				continue;
			}
			
			// Read the next source line
			String ln = (remainder.length() > 0 ? remainder.toString() :
				source.readLine());
			if (ln == null)
				return (putCount > 0 ? putCount : -1);
			
			// Always trim lines to remove extra clutter
			ln = ln.trim();
			
			// Always clear the remainder, since we might push it again later
			remainder.setLength(0);
			
			// The length of the line
			int len = ln.length();
			
			// Are we in a multi-line comment still?
			if (inMultiLine)
			{
				// This is likely a JavaDoc continuation so drop that
				if (ln.startsWith("* "))
					ln = ln.substring(2);
				
				// Length may have changed so recalculate it
				len = ln.length();
				
				// Find end of line
				int eml = ln.indexOf("*/");
				
				// There are no ending slashes, use entire line
				if (eml < 0)
					queue.append(ln);
				
				// Otherwise our multi-line is going to end and we need to
				// process the remainder of the line
				else
				{
					// Add starting chunk to the queue for output
					queue.append(ln, 0, eml);
					
					// Store the remainder of the line since we may still have
					// another comment on it
					remainder.append(ln, eml + 2, len);
					
					// Stop being in multi-line mode
					inMultiLine = false;
				}
			}
			
			// Normal line
			else
			{
				// Get potential start positions of lines
				int sng = ln.indexOf("//");
				int mul = ln.indexOf("/*");
				
				// Detect double star for JavaDoc
				if (mul >= 0)
				{
					int jdoc = ln.indexOf("/**", mul);
					if (jdoc >= 0)
						mul = jdoc;
				}
				
				// No comment on this line
				if (sng < 0 && mul < 0)
					continue;
				
				// Single line comment
				if (sng >= 0 && (mul < 0 || sng < mul))
				{
					// Add fragment to the queue
					queue.append(ln, sng + 2, len);
				}
				
				// Multi-line comment
				else
				{
					// Does the multi-line end on the same line?
					int eml = ln.indexOf("*/", mul + 2);
					if (eml > mul)
					{
						// Add the comment area to the queue
						queue.append(ln, mul + 2, eml);
						
						// Add the rest of the line to the remainder for
						// later processing
						remainder.append(ln, eml + 2, len);
					}
					
					// Does not, so keep reading
					else
					{
						// Now in a multi-line
						inMultiLine = true;
						
						// Add our comment into the queue
						queue.append(ln, mul + 2, len);
					}
				}
			}
		}
		
		// Store comment type for later runs
		this._inMultiLine = inMultiLine;
		
		// Return the number out placed characters
		return putCount;
	}
	
	/**
	 * Reads the entire file to a string.
	 *
	 * @param __sb The input buffer to write to.
	 * @return {@code __sb}.
	 * @throws IOException On read errors.
	 * @throws NullPointerException On null arguments.
	 * @since 2020/02/22
	 */
	public final StringBuilder readAll(StringBuilder __sb)
		throws IOException, NullPointerException
	{
		if (__sb == null)
			throw new NullPointerException();
		
		char[] buf = new char[512];
		for (;;)
		{
			int rc = this.read(buf, 0, 512);
			
			if (rc < 0)
				break;
			
			__sb.append(buf, 0, rc);
		}
		
		return __sb;
	}
	
	/**
	 * The type of comment being parsed.
	 *
	 * @since 2020/02/22
	 */
	private enum CommentType
	{
		/** No comment. */
		NONE,
		
		/** Single line comment. */
		SINGLE,
		
		/** Block comment. */
		BLOCK,
		
		/** End. */
		;
	}
}

Added buildSrc/src/main/java/cc/squirreljme/plugin/util/ErrorListTokenizer.java.













































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.plugin.util;

import cc.squirreljme.plugin.SourceError;
import java.io.Closeable;
import java.io.IOException;
import java.io.Reader;
import java.io.StreamTokenizer;
import java.nio.file.Path;
import java.util.ArrayDeque;
import java.util.Deque;

/**
 * This is the tokenizer for error lists.
 *
 * @since 2020/03/01
 */
public class ErrorListTokenizer
	implements Closeable
{
	/** The tag used to detect errors. */
	public static final String _ERROR_TAG =
		"squirreljme.error";
	
	/** The internal tokenizer. */
	protected final StreamTokenizer tokenizer;
	
	/** The original stream. */
	protected final Reader reader;
	
	/** The original file name. */
	protected final Path fileName;
	
	/**
	 * Initializes the error list tokenizer.
	 *
	 * @param __fn The origin file name.
	 * @param __in The input stream.
	 * @throws NullPointerException On null arguments.
	 * @since 2020/03/01
	 */
	public ErrorListTokenizer(Path __fn, Reader __in)
		throws NullPointerException
	{
		if (__in == null)
			throw new NullPointerException("NARG");
		
		// The original reader for input (for closing).
		this.reader = __in;
		this.fileName = __fn;
		
		// Create tokenizer over the stream
		StreamTokenizer tokenizer = new StreamTokenizer(__in);
		this.tokenizer = tokenizer;
		
		// Configure settings
		tokenizer.resetSyntax();
		tokenizer.eolIsSignificant(false);
		tokenizer.slashSlashComments(false);
		tokenizer.slashStarComments(false);
		tokenizer.wordChars('a', 'z');
		tokenizer.wordChars('A', 'Z');
		tokenizer.wordChars('.', '.');
		tokenizer.wordChars('0', '9');
		tokenizer.whitespaceChars('\0', ' ');
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2020/03/01
	 */
	@Override
	public final void close()
		throws IOException
	{
		this.reader.close();
	}
	
	/**
	 * Returns the next error in the stream.
	 *
	 * @return The next error, or {@code null} if none remain.
	 * @throws IOException On read errors.
	 * @since 2020/03/01
	 */
	public final SourceError next()
		throws IOException
	{
		// Token stack for handling tokens
		Deque<String> stack = new ArrayDeque<>();
		
		// Keep reading tokens until we find the sequence as needed
		boolean withinBlock = false;
		boolean withinJavaDocTag = false;
		for (;;)
		{
			// Keep reading tokens until none are left
			String token = this.__nextToken();
			if (token == null)
				return null;
			
			//System.err.printf("Token: %s%n", token);
			
			// If we are not within a block, check for opening brace
			if (!withinBlock)
			{
				if (token.equals("{"))
					withinBlock = true;
				
				// Drop any tokens here, even the closing block
				continue;
			}
			
			// Check to see if this is the JavaDoc tag
			if (!withinJavaDocTag)
			{
				// If this is at then it is a tag definition
				if (token.equals("@"))
					withinJavaDocTag = true;
				
				// Otherwise just stop because it will not be
				else
					withinBlock = false;
				
				// Keep running
				continue;
			}
			
			// End of declared block
			if (token.equals("}"))
			{
				// Build result
				SourceError result = null;
				try
				{
					result = (!stack.isEmpty() &&
						"squirreljme.error".equals(stack.pollFirst()) ?
						new SourceError(stack, this.fileName) : null);
				}
				catch (IllegalArgumentException e)
				{
					// Ignore errors but still report them
					System.err.printf("Invalid error code %s in %s%n",
						stack, this.fileName);
				}
				
				// Reset state for next tag run
				stack.clear();
				withinBlock = withinJavaDocTag = false;
				
				// Return the parsed token
				if (result != null)
					return result;
				continue;
			}
			
			// Put token on the stack to evaluate it later
			stack.addLast(token);
		}
	}
	
	/**
	 * Returns the next token.
	 *
	 * @return The next token or {@code null}.
	 * @since 2020/03/01
	 */
	private String __nextToken()
		throws IOException
	{
		// Read in the next token
		StreamTokenizer tokenizer = this.tokenizer;
		int type = tokenizer.nextToken();
		
		// Single character
		if (type > 0)
			return Character.toString((char)type);
		
		// Quoted string
		else if (type == StreamTokenizer.TT_WORD)
			return tokenizer.sval;
		
		// Number
		else if (type == StreamTokenizer.TT_NUMBER)
			return Double.toString(tokenizer.nval);
		
		// EOF
		return null;
	}
}

Added buildSrc/src/main/java/cc/squirreljme/plugin/util/IntegerList.java.



















































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.plugin.util;

import java.util.AbstractList;
import java.util.Arrays;
import java.util.Collection;
import java.util.RandomAccess;

/**
 * This is a list of integers which is backed by a primitive array rather than
 * boxed types.
 *
 * @since 2017/11/26
 */
public final class IntegerList
	extends AbstractList<Integer>
	implements RandomAccess
{
	/** The array growing size. */
	private static final int _GROW_SIZE =
		8;
	
	/** The internal integer list. */
	private volatile int[] _values;
	
	/** The number of values in the list. */
	private volatile int _size;
	
	/**
	 * Initializes an empty list.
	 *
	 * @since 2017/11/26
	 */
	public IntegerList()
	{
	}
	
	/**
	 * Initializes a list using the given collection of integers.
	 *
	 * @param __v The collection to source values from.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/11/26
	 */
	public IntegerList(Collection<Integer> __v)
		throws NullPointerException
	{
		if (__v == null)
			throw new NullPointerException("NARG");
		
		// Iterate through collections
		int n = __v.size(), i = 0;
		int[] values = new int[n];
		for (Integer v : __v)
			values[i++] = v;
		
		// Set
		this._values = values;
		this._size = n;
	}
	
	/**
	 * Initializes a list using the given integer values from an array.
	 *
	 * @param __v The array of integers to use for values.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/11/26
	 */
	public IntegerList(int... __v)
		throws NullPointerException
	{
		if (__v == null)
			throw new NullPointerException("NARG");
		
		// Defensive copy
		__v = __v.clone();
		
		// Simple set
		this._values = __v;
		this._size = __v.length;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/11/26
	 */
	@Override
	public boolean add(Integer __a)
		throws NullPointerException
	{
		if (__a == null)
			throw new NullPointerException("NARG");
		
		return this.addInteger(__a);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/11/26
	 */
	@Override
	public void add(int __i, Integer __v)
		throws NullPointerException
	{
		if (__v == null)
			throw new NullPointerException("NARG");
		
		this.addInteger(__i, __v);
	}
	
	/**
	 * Adds the specified integer to the list.
	 *
	 * @param __v The value to add.
	 * @return {@code true} if the list has changed.
	 * @since 2017/11/26
	 */
	public boolean addInteger(int __v)
	{
		this.addInteger(this._size, __v);
		return true;
	}
	
	/**
	 * Adds the specified integer to the list at the specified position.
	 *
	 * @param __i The index to add the value at.
	 * @param __v The value to add.
	 * @throws IndexOutOfBoundsException If the index to add it outside of
	 * the array bounds.
	 * @since 2017/11/26
	 */
	public void addInteger(int __i, int __v)
		throws IndexOutOfBoundsException
	{
		if (__i < 0 || __i > this._size)
			throw new IndexOutOfBoundsException("IOOB");
		
		// Existing values
		boolean realloced = false;
		int[] values = this._values;
		int nvalues = (values == null ? 0 : values.length),
			size = this._size;
		
		// Need a larger array?
		if ((realloced = (size + 1 > nvalues)))
			if (values == null)
				values = new int[IntegerList._GROW_SIZE];
			else
				values = Arrays.copyOf(values, nvalues + IntegerList._GROW_SIZE);
		
		// Move all values up
		for (int o = size; o > __i; o++)
			values[o] = values[o - 1];
		
		// Set this index
		values[__i] = __v;
		size++;
		
		// Store new values
		if (realloced)
			this._values = values;
		this._size = size;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/11/26
	 */
	@Override
	public void clear()
	{
		this._values = null;
		this._size = 0;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/11/26
	 */
	@Override
	public boolean contains(Object __a)
	{
		// Only contains integers
		if (!(__a instanceof Integer))
			return false;
		
		return this.containsInteger((Integer)__a);
	}
	
	/**
	 * Checks if the list contains the specified integer.
	 *
	 * @param __v The value to check.
	 * @return {@code true} if the list contains the given integer.
	 * @since 2017/11/26
	 */
	public boolean containsInteger(int __v)
	{
		return this.indexOfInteger(__v) >= 0;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/11/26
	 */
	@Override
	public Integer get(int __i)
		throws IndexOutOfBoundsException
	{
		return this.getInteger(__i);
	}
	
	/**
	 * Obtains the integer at the given index.
	 *
	 * @param __i The index to get.
	 * @return The integer at the given index.
	 * @throws IndexOutOfBoundsException If the index is not within bounds.
	 * @since 2017/11/26
	 */
	public int getInteger(int __i)
		throws IndexOutOfBoundsException
	{
		if (__i < 0 || __i >= this._size)
			throw new IndexOutOfBoundsException("IOOB");
		
		return this._values[__i];
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/11/26
	 */
	@Override
	public int indexOf(Object __a)
	{
		// Will never contain non-integers
		if (!(__a instanceof Integer))
			return -1;
		
		return this.indexOfInteger((Integer)__a);
	}
	
	/**
	 * Returns the index which contains the specified integer.
	 *
	 * @param __v The value to search for.
	 * @return The index of the specified integer or {@code -1} if the list
	 * contains no such value.
	 * @since 2017/11/26
	 */
	public int indexOfInteger(int __v)
	{
		int[] values = this._values;
		for (int i = 0, n = values.length; i < n; i++)
			if (values[i] == __v)
				return i;
		return -1;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/11/26
	 */
	@Override
	public boolean isEmpty()
	{
		return this._size == 0;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/11/26
	 */
	@Override
	public int lastIndexOf(Object __a)
	{
		// Will never contain non-integers
		if (!(__a instanceof Integer))
			return -1;
		
		return this.lastIndexOfInteger((Integer)__a);
	}
	
	/**
	 * Returns the index which contains the specified integer starting from
	 * the end of the list.
	 *
	 * @param __v The value to search for.
	 * @return The index of the specified integer or {@code -1} if the list
	 * contains no such value.
	 * @since 2017/11/26
	 */
	public int lastIndexOfInteger(int __v)
	{
		int[] values = this._values;
		for (int n = values.length, i = n - 1; i >= 0; i--)
			if (values[i] == __v)
				return i;
		return -1;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/11/26
	 */
	@Override
	public boolean remove(Object __a)
	{
		// Will never contain non-integers
		if (!(__a instanceof Integer))
			return false;
		
		int dx = this.indexOf(__a);
		if (dx < 0)
			return false;
		
		this.remove(dx);
		return true;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/11/26
	 */
	@Override
	public Integer remove(int __a)
	{
		throw new Error("TODO");
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/11/26
	 */
	@Override
	public Integer set(int __i, Integer __v)
		throws NullPointerException
	{
		if (__v == null)
			throw new NullPointerException("NARG");
		
		return this.setInteger(__i, __v);
	}
	
	/**
	 * Sets the integer at the specified index to the given value.
	 *
	 * @param __i The index to set.
	 * @param __v The value to set.
	 * @return The old value.
	 * @throws IndexOutOfBoundsException If the index is not within bounds.
	 * @since 2017/11/26
	 */
	public int setInteger(int __i, int __v)
		throws IndexOutOfBoundsException
	{
		if (__i < 0 || __i >= this._size)
			throw new IndexOutOfBoundsException("IOOB");
		
		int[] values = this._values;
		int rv = values[__i];
		values[__i] = __v;
		return rv;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/11/26
	 */
	@Override
	public int size()
	{
		return this._size;
	}
	
	/**
	 * Converts the integer list to an integer array.
	 *
	 * @return This list as an integer array.
	 * @since 2017/11/26
	 */
	public int[] toIntegerArray()
	{
		int[] values = this._values;
		int size = this._size;
		
		// Values would not be allocated
		if (size == 0)
			return new int[0];
		
		// Copy values
		int[] rv = new int[size];
		for (int i = 0; i < size; i++)
			rv[i] = values[i];
		return rv;
	}
}

Added buildSrc/src/main/java/cc/squirreljme/plugin/util/MIMEFileDecoder.java.



















































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.plugin.util;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.io.UnsupportedEncodingException;

/**
 * This class is used to decode input streams which have been encoded in the
 * MIME Base64 format. This file format is genearted by {@code uuencode -m}.
 * This format usually begins with {@code begin-base64 mode filename} and
 * ends with the padding sequence {@code ====}.
 *
 * This class is not thread safe.
 *
 * @since 2018/03/05
 */
public final class MIMEFileDecoder
	extends InputStream
{
	/** The input base64 data. */
	protected Base64Decoder mime;
	
	/** The read mode. */
	private int _mode =
		Integer.MIN_VALUE;
	
	/** The read filename. */
	private String _filename;
	
	/**
	 * Initializes the MIME file decoder using the default encoding.
	 *
	 * @param __in The input source.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/11/30
	 */
	public MIMEFileDecoder(InputStream __in)
		throws NullPointerException
	{
		this(new InputStreamReader(__in));
	}
	
	/**
	 * Initializes the MIME file decoder using the given encoding.
	 *
	 * @param __in The input source.
	 * @param __enc The encoding used.
	 * @throws NullPointerException On null arguments.
	 * @throws UnsupportedEncodingException If the encoding is not supported.
	 * @since 2018/11/30
	 */
	public MIMEFileDecoder(InputStream __in, String __enc)
		throws NullPointerException, UnsupportedEncodingException
	{
		this(new InputStreamReader(__in, __enc));
	}
	
	/**
	 * Initializes the MIME file decoder from the given set of characters.
	 *
	 * @param __in The input source.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/03/05
	 */
	public MIMEFileDecoder(Reader __in)
		throws NullPointerException
	{
		if (__in == null)
			throw new NullPointerException("NARG");
		
		// Directly wrap the reader with the MIME decoder which reads from
		// a source reader that is internally maintained
		this.mime = new Base64Decoder(new __SubReader__(__in));
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/11/25
	 */
	@Override
	public final int available()
		throws IOException
	{
		return this.mime.available();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/03/05
	 */
	@Override
	public final void close()
		throws IOException
	{
		this.mime.close();
	}
	
	/**
	 * Returns the filename which was read.
	 *
	 * @return The read filename, {@code null} will be returned if it has not
	 * been read yet or has not been specified.
	 * @since 2018/03/05
	 */
	public final String filename()
	{
		return this._filename;
	}
	
	/**
	 * Returns the UNIX mode of the stream.
	 *
	 * @return The UNIX mode, a negative value will be returned if it has not
	 * been read yet.
	 * @since 2018/03/05
	 */
	public final int mode()
	{
		return this._mode;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/03/05
	 */
	@Override
	public final int read()
		throws IOException
	{
		return this.mime.read();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/11/25
	 */
	@Override
	public final int read(byte[] __b)
		throws IOException
	{
		return this.mime.read(__b);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/03/05
	 */
	@Override
	public final int read(byte[] __b, int __o, int __l)
		throws IndexOutOfBoundsException, IOException, NullPointerException
	{
		return this.mime.read(__b, __o, __l);
	}
	
	/**
	 * This is a sub-reader which handles parsing of the MIME header and
	 * otherwise just passing the data to the Base64Decoder instance.
	 *
	 * @since 2018/11/25
	 */
	private final class __SubReader__
		extends Reader
	{
		/** The line-by-line reader for data. */
		protected final BufferedReader in;
		
		/** The input character buffer. */
		private final StringBuilder _sb =
			new StringBuilder(80);
		
		/** The current read in the buffer. */
		private int _at;
		
		/** The current limit of the buffer. */
		private int _limit;
		
		/** Did we read the header? */
		private boolean _didheader;
		
		/** Did we read the footer? */
		private boolean _didfooter;
		
		/**
		 * Initializes the sub-reader for the MIME data.
		 *
		 * @param __in The source reader.
		 * @throws NullPointerException On null arguments.
		 * @since 2018/11/24
		 */
		__SubReader__(Reader __in)
			throws NullPointerException
		{
			if (__in == null)
				throw new NullPointerException("NARG");
			
			this.in = new BufferedReader(__in, 80);
		}
		
		/**
		 * {@inheritDoc}
		 * @since 2018/11/25
		 */
		@Override
		public void close()
			throws IOException
		{
			this.in.close();
		}
		
		/**
		 * {@inheritDoc}
		 * @since 2018/11/25
		 */
		@Override
		public int read()
			throws IOException
		{
			// Read header?
			if (!this._didheader)
				this.__readHeader();
			
			// If the footer was read, this means EOF
			if (this._didfooter)
				return -1;
			
			// Need to read more from the buffer
			int at = this._at,
				limit = this._limit;
			if (at >= limit)
			{
				// Read line next
				if (!this.__readNext())
					return -1;
				
				// Re-read
				at = this._at;
				limit = this._limit;
			}
			
			// Read the next character
			int rv = this._sb.charAt(at);
			this._at = at + 1;
			return rv;
		}
		
		/**
		 * {@inheritDoc}
		 * @since 2018/11/25
		 */
		@Override
		public int read(char[] __c)
			throws IOException
		{
			if (__c == null)
				throw new NullPointerException("NARG");
			
			return this.read(__c, 0, __c.length);
		}
		
		/**
		 * {@inheritDoc}
		 * @since 2018/11/25
		 */
		@Override
		public int read(char[] __c, int __o, int __l)
			throws IOException
		{
			if (__c == null)
				throw new NullPointerException("NARG");
			if (__o < 0 || __l < 0 || (__o + __l) > __c.length)
				throw new IndexOutOfBoundsException("IOOB");
			
			// Read header?
			if (!this._didheader)
				this.__readHeader();
			
			// If the footer was read, this means EOF
			if (this._didfooter)
				return -1;
			
			// Where to read from
			StringBuilder sb = this._sb;
			int at = this._at,
				limit = this._limit;
			
			// Read in all characters
			int rv = 0;
			while (rv < __l)
			{
				// Need to read more?
				if (at >= limit)
				{
					// EOF?
					if (!this.__readNext())
						return (rv == 0 ? -1 : rv);
					
					// Re-read
					at = this._at;
					limit = this._limit;
				}
				
				// Read the next character
				__c[__o++] = sb.charAt(at++);
			}
			
			// Store new at position
			this._at = at;
			
			return rv;
		}
		
		/**
		 * Reads the header information.
		 *
		 * @throws IOException On read errors.
		 * @since 2018/11/25
		 */
		private final void __readHeader()
			throws IOException
		{
			BufferedReader in = this.in;
			
			// {@squirreljme.error BD1k Unexpected end of file while trying
			// to read MIME header.}
			String ln = in.readLine();
			if (ln == null)
				throw new IOException("BD1k");
			
			// The header is in this format:
			// begin-base64 <unixmode> <filename>
			// {@squirreljme.error BD1l MIME encoded does not start with
			// MIME header.}
			if (!ln.startsWith("begin-base64"))
				throw new IOException("BD1l");
			
			// UNIX mode?
			int fs = ln.indexOf(' ');
			if (fs >= 0)
			{
				int ss = ln.indexOf(' ', fs + 1);
				
				// Decode octal mode bits
				MIMEFileDecoder.this._mode = Integer.parseInt(
					ln.substring(fs + 1, (ss < 0 ? ln.length() : ss)), 8);
				
				// Filename?
				if (ss >= 0)
					MIMEFileDecoder.this._filename =
						ln.substring(ss + 1);
			}
			
			// Set as read
			this._didheader = true;
		}
		
		/**
		 * Reads the next line into the character.
		 *
		 * @return If a line was read.
		 * @throws IOException On read errors.
		 * @since 2018/11/25
		 */
		private final boolean __readNext()
			throws IOException
		{
			// {@squirreljme.error BD1m Unexpected EOF while read the MIME
			// file data.}
			String ln = this.in.readLine();
			if (ln == null)
				throw new IOException("BD1m");
			
			// End of MIME data?
			if (ln.equals("===="))
			{
				// Footer was read, so EOF now
				this._didfooter = true;
				
				// Was EOF
				return false;
			}
			
			// Fill buffer
			StringBuilder sb = this._sb;
			sb.setLength(0);
			sb.append(ln);
			
			// Set properties
			this._at = 0;
			this._limit = ln.length();
			
			// Was not EOF
			return true;
		}
	}
}

Added buildSrc/src/main/java/cc/squirreljme/plugin/util/NaturalComparator.java.



































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.plugin.util;

import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import java.util.Comparator;

/**
 * This is used to compare two values using their natural comparison.
 *
 * @since 2016/09/06
 */
public final class NaturalComparator<V>
	implements Comparator<V>
{
	/** The single instance. */
	private static Reference<NaturalComparator> _REF;
	
	/**
	 * Only one is ever needed.
	 *
	 * @since 2017/11/30
	 */
	private NaturalComparator()
	{
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/09/06
	 */
	@Override
	@SuppressWarnings({"unchecked"})
	public int compare(V __a, V __b)
	{
		// Consider two nulls to be equal
		boolean na = (__a == null), nb = (__b == null);
		if (na && nb)
			return 0;
		
		// Nulls before non-null
		else if (na && !nb)
			return -1;
		else if (!na && nb)
			return 1;
		
		// Use standard comparison
		return ((Comparable<V>)__a).compareTo(__b);
	}
	
	/**
	 * Returns the natural comparator instance.
	 *
	 * @param <V> The type of value to compare.
	 * @return The instance of the natural comparator.
	 * @since 2016/09/06
	 */
	@SuppressWarnings({"unchecked"})
	public static final <V> NaturalComparator<V> instance()
	{
		Reference<NaturalComparator> ref = NaturalComparator._REF;
		NaturalComparator rv;
		
		// Cache?
		if (ref == null || null == (rv = ref.get()))
			NaturalComparator._REF = new WeakReference<>((rv = new NaturalComparator()));
		
		// Return it
		return (NaturalComparator<V>)rv;
	}
}

Added buildSrc/src/main/java/cc/squirreljme/plugin/util/StringUtils.java.

































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.plugin.util;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;

/**
 * This class contains static methods which can be used for manipulating
 * strings.
 *
 * @since 2017/11/23
 */
public final class StringUtils
{
	/**
	 * Not used.
	 *
	 * @since 2017/11/23
	 */
	private StringUtils()
	{
	}
	
	/**
	 * Splits the given string using the specified delimeters and outputs it
	 * to the given collection.
	 *
	 * @param __delim The delimeters to use.
	 * @param __s The string to split.
	 * @param __out The collection to place split strings into.
	 * @return {@code __out}
	 * @throws NullPointerException On null arguments.
	 * @since 2017/11/23
	 */
	public static final Collection<String> basicSplit(char[] __delim,
		String __s, Collection<String> __out)
		throws NullPointerException
	{
		if (__delim == null || __s == null || __out == null)
			throw new NullPointerException("NARG");
		
		// Parse string
		boolean dows = true;
		int lastdelim = -2;
		for (int i = 0, n = __s.length(), mark = 0; i <= n; i++)
		{
			// -1 is a special delimeter for the end of string because
			// otherwise if the string does not end in a delimeter it will not
			// be found
			int c = (i == n ? -1 : __s.charAt(i));
			
			// Is this a delimeter
			if (c == lastdelim || c == -1 || StringUtils.__indexOf(__delim, (char)c) >= 0)
			{
				// Remember last delimeter for potential speed
				lastdelim = c;
				
				// If reading delimeters, clear flag and mark
				// to remember the current index
				if (dows)
				{
					dows = false;
					mark = i;
				}
				
				// Otherwise end of sequence, generate string
				else
				{
					// Split out
					__out.add(__s.substring(mark, i));
					
					// Switch to handling delimeters
					dows = true;
				}
			}
			
			// If reading delimeters, clear flag and mark
			// to remember the current index, is not delimeters
			// here
			else if (dows)
			{
				dows = false;
				mark = i;
			}
		}
		
		// Return output always
		return __out;
	}
	
	/**
	 * Splits the given string using the specified delimeters and outputs it
	 * to the given collection.
	 *
	 * @param __delim The delimeters to use.
	 * @param __s The string to split.
	 * @param __out The collection to place split strings into.
	 * @return {@code __out}
	 * @throws NullPointerException On null arguments.
	 * @since 2017/11/23
	 */
	public static final Collection<String> basicSplit(String __delim,
		String __s, Collection<String> __out)
		throws NullPointerException
	{
		if (__delim == null || __s == null || __out == null)
			throw new NullPointerException("NARG");
		
		return StringUtils.basicSplit(__delim.toCharArray(), __s, __out);
	}
	
	/**
	 * Splits the given string using the specified delimeter.
	 *
	 * @param __delim The delimeter to use.
	 * @param __s The string to split.
	 * @return The split string.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/12/23
	 */
	public static final String[] basicSplit(char __delim, String __s)
	{
		return StringUtils.basicSplit(new char[]{__delim}, __s);
	}
	
	/**
	 * Splits the given string using the specified delimeters.
	 *
	 * @param __delim The delimeters to use.
	 * @param __s The string to split.
	 * @return The split sequence of strings.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/11/23
	 */
	public static final String[] basicSplit(char[] __delim, String __s)
		throws NullPointerException
	{
		if (__delim == null || __s == null)
			throw new NullPointerException("NARG");
		
		Collection<String> rv = StringUtils.basicSplit(__delim, __s,
			new ArrayList<String>());
		return rv.<String>toArray(new String[rv.size()]);
	}
	
	/**
	 * Splits the given string using the specified delimeters.
	 *
	 * @param __delim The delimeters to use.
	 * @param __s The string to split.
	 * @return The split sequence of strings.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/11/23
	 */
	public static final String[] basicSplit(String __delim, String __s)
		throws NullPointerException
	{
		if (__delim == null || __s == null)
			throw new NullPointerException("NARG");
		
		return StringUtils.basicSplit(__delim.toCharArray(), __s);
	}
	
	/**
	 * Splits the specified string using the given delimeter and returns all
	 * of the fields which are contained within, any leading and trailing
	 * whitespace is trimmed.
	 *
	 * @param __delim The delimeter to split fields by.
	 * @param __s The string to split.
	 * @return An array containing all of the fields.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/11/30
	 */
	public static final String[] fieldSplitAndTrim(char __delim, String __s)
		throws NullPointerException
	{
		if (__s == null)
			throw new NullPointerException("NARG");
		
		// Split and trim
		String[] rv = StringUtils.fieldSplit(__delim, __s);
		for (int i = 0, n = rv.length; i < n; i++)
			rv[i] = rv[i].trim();
		return rv;
	}
	
	/**
	 * Splits the specified string using the given delimeter and returns all
	 * of the fields which are contained within. Extra whitespace within
	 * fields are not trimmed.
	 *
	 * @param __delim The delimeter to split fields by.
	 * @param __s The string to split.
	 * @return An array containing all of the fields.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/11/30
	 */
	public static final String[] fieldSplit(char __delim, String __s)
		throws NullPointerException
	{
		if (__s == null)
			throw new NullPointerException("NARG");
		
		CharSequence[] xrv = CharSequenceUtils.fieldSplit(__delim, __s);
		return Arrays.<String, CharSequence>copyOf(xrv, xrv.length,
			String[].class);
	}
	
	/**
	 * Searches the given sequence for the first occurrence of the specified
	 * character.
	 *
	 * @param __c The character to locate.
	 * @param __s The sequence to look inside.
	 * @return The index of the first occurrence.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/11/30
	 */
	public static final int firstIndex(char __c, String __s)
		throws NullPointerException
	{
		return CharSequenceUtils.firstIndex(__c, __s);
	}
	
	/**
	 * Searches the given string for the first occurrence of the specified
	 * characters.
	 *
	 * @param __c The characters to locate.
	 * @param __s The string to look inside.
	 * @return The index of the first occurrence.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/11/30
	 */
	public static final int firstIndex(char[] __c, String __s)
		throws NullPointerException
	{
		return CharSequenceUtils.firstIndex(__c, __s);
	}
	
	/**
	 * Searches the given string for the first occurrence of the specified
	 * characters.
	 *
	 * @param __c The characters to locate.
	 * @param __s The string to look inside.
	 * @return The index of the first occurrence.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/11/30
	 */
	public static final int firstIndex(String __c, String __s)
		throws NullPointerException
	{
		return CharSequenceUtils.firstIndex(__c, __s);
	}
	
	/**
	 * Searches the given string for the first occurrence of the specified
	 * characters. This assumes that the character set has already been
	 * sorted.
	 *
	 * @param __c The characters to locate, this is required to be sorted.
	 * @param __s The string to look inside.
	 * @return The index of the first occurrence.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/11/30
	 */
	public static final int firstIndexSorted(char[] __c, String __s)
		throws NullPointerException
	{
		return CharSequenceUtils.firstIndexSorted(__c, __s);
	}
	
	/**
	 * Returns an array containing all of the indexes that the specified
	 * character appears in the given string.
	 *
	 * @param __c The character to get the indexes for.
	 * @param __s The string to check in.
	 * @return An array containing the array indexes for the given character,
	 * if there are none then the array will be empty.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/11/26
	 */
	public static final int[] multipleIndexOf(char __c, String __s)
		throws NullPointerException
	{
		return CharSequenceUtils.multipleIndexOf(__c, __s);
	}
	
	/**
	 * Converts the specified string to lowercase ignoring locale, this uses
	 * {@link Character#toLowerCase(char)}.
	 *
	 * @param __s The string to convert.
	 * @return The lowercased string.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/11/30
	 */
	public static final String toLowerCaseNoLocale(String __s)
		throws NullPointerException
	{
		if (__s == null)
			throw new NullPointerException("NARG");
		
		int n = __s.length();
		StringBuilder sb = new StringBuilder(n);
		for (int i = 0; i < n; i++)
			sb.append(Character.toLowerCase(__s.charAt(i)));
		return sb.toString();
	}
	
	/**
	 * Converts the specified string to uppercase ignoring locale, this uses
	 * {@link Character#toUpperCase(char)}.
	 *
	 * @param __s The string to convert.
	 * @return The uppercased string.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/11/30
	 */
	public static final String toUpperCaseNoLocale(String __s)
		throws NullPointerException
	{
		if (__s == null)
			throw new NullPointerException("NARG");
		
		int n = __s.length();
		StringBuilder sb = new StringBuilder(n);
		for (int i = 0; i < n; i++)
			sb.append(Character.toUpperCase(__s.charAt(i)));
		return sb.toString();
	}
	
	/**
	 * Searches the input array to see if the given character is within the
	 * array.
	 *
	 * @param __a The array to check.
	 * @param __c The character to find in the array.
	 * @return The index of the character or {@code -1} if it was not found.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/11/23
	 */
	private static final int __indexOf(char[] __a, char __c)
		throws NullPointerException
	{
		if (__a == null)
			throw new NullPointerException("NARG");
		
		for (int i = 0, n = __a.length; i < n; i++)
			if (__c == __a[i])
				return i;
		return -1;
	}
}

Added buildSrc/src/main/java/cc/squirreljme/plugin/util/package-info.java.





















>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.plugin.util;

Added buildSrc/src/main/resources/META-INF/gradle-plugins/cc.squirreljme.plugin.properties.



>
1
implementation-class=cc.squirreljme.plugin.SquirrelJMEPlugin

Changes to building.mkd.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15




16
17
18
19
20
21
22
23
24
25
26

27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45

46

47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136

137
138
139
140

141
142
143
144
145
146
147
148
149
150
151
152
153
154
155

156
157

158
159
160
161
162
163
164
# Building

------------------------------------------------------------------------------

***Patience is required:***
***Currently SquirrelJME is in active development and although it can***
***run and produce binaries, there are limitations to consider.***
***Currently only a limited set of programs may be ran on SquirrelJME.***

------------------------------------------------------------------------------

SquirrelJME requires the following before it can be built:

 * Java 7 or newer Virtual Machine
 * Java 7 or newer Compiler





## Notes on Running

SquirrelJME uses a simplified error system which starts with a two capital
letter prefix followed by two digits and letters.

 * [List of Error Codes](http://multiphasicapps.net/uv/errors.mkd)

## Installing Java

SquirrelJME requires a Java 7 virtual machine in order to build itself.


### Common Linux Distributions

If you use a common and popular Linux distribution it likely has a JDK
available.

 * Arch
   * See <https://wiki.archlinux.org/index.php/Java>
 * Debian, Ubuntu, and derivatives
   * See <https://wiki.debian.org/Java>
   * One of the following depending on package availability
     * `apt-get install openjdk-7-jdk`
     * `apt-get install openjdk-8-jdk`
     * `apt-get install openjdk-9-jdk`
 * Gentoo
   * See <https://wiki.gentoo.org/wiki/Java>

### Oracle's JDK


Oracle's JDK supports the following (as of this writing):


 * Linux
 * Mac OS X
 * ReactOS (as Windows)
 * Solaris
 * Windows
 * Wine (as Windows)

Oracle's Java JDK can be downloaded from:

 * <http://www.oracle.com/technetwork/java/javase/downloads/index.html>
 
Ensure that you **download and install** the ***JDK***.

If running on ReactOS/Windows/Wine, make sure that the `PATH` environment
variables refers to the JDK's binary directory:

 * `C:\Program Files\Java\jdk1.8.0_131\bin\`

# Bootstrap Build Environment

The main interaction with the SquirrelJME build environment is with the build
bootstrapper which initializes, compiles, and runs the build environment.

## System Specific

Each system has a different interface to the bootstrap environment, beyond this
the remainder of it is the same regardless of the system used.

### ReactOS and Windows

Oracle's Java JDK can be downloaded from:

 * <http://www.oracle.com/technetwork/java/javase/downloads/index.html>

The script used for building is `build.cmd` (referred to as `build` hereafter).
This requires the command prompt which may be accessed by running `cmd`.
This may be found in the start menu or may be accessed via **Windows Key + R**,
typing `cmd`, then hitting enter.

Recommended setup for running the environment, assuming SquirrelJME source
code is located in the example `c:\users\stephanie\desktop\squirreljme`:

 * `cd c:\users\stephanie\temp`
 * `mkdir squirreljme-build`
 * `cd squirreljme-build`
 * `c:\users\stephanie\desktop\squirreljme\build.cmd`

### UNIX-Like: Linux, Mac OS X, Solaris, BSD, etc.

The script used for building is `build.sh` (referred to as `build` hereafter).

Recommended setup for running the environment, assuming SquirrelJME source
code is located in the example `/home/stephanie/squirreljme`:

 * `cd /tmp`
 * `mkdir squirreljme-build`
 * `cd squirreljme-build`
 * `/home/stephanie/squirreljme/build.sh`

# Compiled SummerCoat ROM

This ROM file is required in order to work with SummerCoat or RatufaCoat.

 * `build dist summercoatrom`

This will create a file called `squirreljme-summercoatrom.zip` which will
contain the needed ROM file `squirreljme.sqc`.

Additionally if all tests need to be built then a test ROM can be included as
well.

 * `build dist summercoatrom-test`

# Shaded JARs for Java SE

Shaded SquirrelJME JARs are standalone JARs which can run on an existing
Java SE or Java ME system depending on which target it was built for.
Generally these JARs are just packaged by themselves and include the entire
set of libraries and applications from within SquirrelJME. These shaded JARs
are usually intended for demo projects and such. The JARs additionally are
pure Java code so they require a host Java VM. To contain the SquirrelJME
environment, an implementation of a virtual machine is used which is capable
of using and running the class library. This virtual machine has a speed
penalty because it is running the Java byte code itself however it is a
compatible environment.

## Building For Java SE

 * `build dist javase`  


It is recommended that an out-of-tree build is performed (this means building
from another directory that is not in the SquirrelJME source tree). All the
commands pertain specifically to the build system itself.


## Building for Java ME

***NOTE:*** If the shaded JAR is not running on SquirrelJME, some features
will not be available for use. It should still run however.

 * `build dist javame`

# RatufaCoat

Building the C based virtual machine depends on a C compiler.

Note that you will need to build a separate SummerCoat ROM as above or
use a pre-existing one. If you are building for a standard C setup with no
graphical display or otherwise, to build the project you use make:


 * `make`


## RetroArch

Building for RetroArch uses the `makefilelibretro` makefile. As such building
SquirrelJME for your current system involves using the alternative makefile.

 * `make`













|
|
>
>
>
>










|
>











|
|
|



|

>
|
>

<
<
|
|
<
|

|










|

|
<
|
<
|
<
<
|
<

<
|
<

<
<
<
|

<
<
|
<
<
<
<

<
|
<

<
<
|
<
<
|
<
|
<

<
|
<

<
<
|
<
<
|
<

|
|
<
<
<
<
<
<
<
<
<
<

|

<
>

<
<
<
>

|

|
<
|
<
|
<

<
|
<
<
<
>

<
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54


55
56

57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72

73

74


75

76

77

78



79
80


81




82

83

84


85


86

87

88

89

90


91


92

93
94
95










96
97
98

99
100



101
102
103
104
105

106

107

108

109



110
111

112
113
114
115
116
117
118
119
# Building

------------------------------------------------------------------------------

***Patience is required:***
***Currently SquirrelJME is in active development and although it can***
***run and produce binaries, there are limitations to consider.***
***Currently only a limited set of programs may be ran on SquirrelJME.***

------------------------------------------------------------------------------

SquirrelJME requires the following before it can be built:

 * Java 8 or newer Virtual Machine and Compiler
 * C++ Compiler (Utilized for Testing)
   * Clang
   * GCC
   * Microsoft Visual Studio 2010 or newer
   * XCode

## Notes on Running

SquirrelJME uses a simplified error system which starts with a two capital
letter prefix followed by two digits and letters.

 * [List of Error Codes](http://multiphasicapps.net/uv/errors.mkd)

## Installing Java

SquirrelJME requires a Java 8 virtual machine in order to build itself. Gradle
is used however it is available through Gradle Wrapper.

### Common Linux Distributions

If you use a common and popular Linux distribution it likely has a JDK
available.

 * Arch
   * See <https://wiki.archlinux.org/index.php/Java>
 * Debian, Ubuntu, and derivatives
   * See <https://wiki.debian.org/Java>
   * One of the following depending on package availability
     * `apt-get install openjdk-8-jdk`
     * `apt-get install openjdk-9-jdk`
     * `apt-get install openjdk-11-jdk`
 * Gentoo
   * See <https://wiki.gentoo.org/wiki/Java>

### AdoptOpenJDK

AdoptOpenJDK is the recommended way to build and setup SquirrelJME as it has
long-term support and is easy to setup. You will need at least a Java 8
variant of AdoptOpenJDK.



 * <https://adoptopenjdk.net/releases.html?variant=openjdk8&jvmVariant=hotspot>


### Oracle's JDK

Oracle's JDK supports modern systems and can be downloaded from:

 * <http://www.oracle.com/technetwork/java/javase/downloads/index.html>
 
Ensure that you **download and install** the ***JDK***.

If running on ReactOS/Windows/Wine, make sure that the `PATH` environment
variables refers to the JDK's binary directory:

 * `C:\Program Files\Java\jdk1.8.0_131\bin\`

### IntelliJ IDEA (Optional)

SquirrelJME is developed on IntelliJ Ultimate, however Community Edition may

still be used. This makes development easier and more integrated along with

whatever code you write or contribute will match the style that is set in


SquirrelJME.



 * <https://www.jetbrains.com/idea/>





## Installing C++ Compiler



### Common Linux Distributions






For the C++ Compiler which is needed for testing:




 * Debian, Ubuntu, and derivatives


   * `apt-get install build-essential g++`

   * `apt-get install build-essential clang`



### Windows




For Gradle to detect a C++ compiler, it needs either Microsoft Visual Studio


or a GCC installation via Cygwin.


More information is located at 
<https://docs.gradle.org/current/userguide/building_cpp_projects.html#windows>. 











### Mac OS X


You must install XCode, more information is here:




 * <https://developer.apple.com/xcode/>

# Build Enviromment

The main interaction with the SquirrelJME build environment is with Gradle

which manages anything related to building and testing. All builds are

performed through Gradle Wrapper which is used as the following:



 * Windows: `gradlew`



 * Others: `./gradlew`


Gradle uses tasks of which multiple may be specified accordingly.

## RetroArch

Building for RetroArch uses the `makefilelibretro` makefile. As such building
SquirrelJME for your current system involves using the alternative makefile.

 * `make`

Changes to changelog.mkd.

16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
_Note that this is a work in progress and not everything will run, due to_
_the implementation being incomplete. However it does work and is proven to_
_work, which means progress can continue as such. Later releases of_
_SquirrelJME will always be an improvement over the older versions._

More detailed changes:

 * Build system
   * Builder
     * Allow the build system to launch binaries in a VM even if they have no
       source code.
     * Handle cases during compilation if a dependency has no source code.
     * If an attempt is made to compile a binary with no source code, throw a
       new exception type indicating this rather than the generic failure
       exception because this case can be handled.
     * When shading JARs for distribution, ignore entries in JARs which are
       directories. Directories do not need to appear in the JAR, however they
       may still be implicit within ZIPs.
   * Launching
     * An alternative VM may be specified.
     * Correct cases where `NullPointerException` is thrown when a `Display`
       was initialized but was not yet claimed by any program.
     * The profiler snapshot can be written to a specific file.
     * System properties may be defined and passed to the launched program.
   * Started work on JavaDoc generation.
 * Tests
   * Adjusted the results in the logarithm test to adjust the ulp to what
     SquirrelJME generates. The results are still valid as it is valid to
     be within a 1 ulp range, however the test framework only supports
     exact values.
   * Added the missing _mimemessage_ file for the MIME file decoding test.
   * Allow tests to timeout so that they do not run forever in the event of
     some kind of deadlock.
   * Refactored the test framework to be easier to maintain.
 * Programs and Libraries
   * `cldc-compact`
     * Added a rehash indicator for the internal `__BucketMap__` so that
       `java.util.Hashtable` knows when a reorder was performed.
     * Added `java.util.Vector`, it was missing.
     * Added support for ISO-8859-15, this is the newer encoding with the
       Euro symbol.







|
|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







16
17
18
19
20
21
22
23
24

























25
26
27
28
29
30
31
_Note that this is a work in progress and not everything will run, due to_
_the implementation being incomplete. However it does work and is proven to_
_work, which means progress can continue as such. Later releases of_
_SquirrelJME will always be an improvement over the older versions._

More detailed changes:

 * Modernized the build system to Gradle!
   * This will make it much easier to develop and allow for contributions!

























 * Programs and Libraries
   * `cldc-compact`
     * Added a rehash indicator for the internal `__BucketMap__` so that
       `java.util.Hashtable` knows when a reorder was performed.
     * Added `java.util.Vector`, it was missing.
     * Added support for ISO-8859-15, this is the newer encoding with the
       Euro symbol.
77
78
79
80
81
82
83


84
85
86
87
88
89
90
91

92
93
94
95
96
97
98
     * Implemented `java.util.LinkedList`.
     * Made the stack trace printed by `Throwable` much cleaner so that it
       takes up less screen space and is formatted a bit better.
     * Return values for `line.separator`, `microedition.encoding`,
       `microedition.configuration`, and `microedition.locale`.
   * `demo-hello`
     * Made the system properties array `final`.


   * `launcher`
     * Added the system property `cc.squirreljme.autolaunch` to automatically
       launch a program once the program list is read.
     * When a program is launched, instead of saying just "Loading..." instead
       allow show the program which is being loaded in the title.
   * `media-api`
     * Add null media support for: players, and volume control.
   * `meep-midlet`

     * Handle Konami's Mobile US games using a special system request.
     * Implement `MIDlet.checkPermission()`.
   * `meep-rms`
     * Added basic support for record stores.
   * `meep-swm`
     * Added proprietary `ExtendedTaskManager` interface which can be used
       to specify arguments, system properties, and console output alternatives







>
>








>







52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
     * Implemented `java.util.LinkedList`.
     * Made the stack trace printed by `Throwable` much cleaner so that it
       takes up less screen space and is formatted a bit better.
     * Return values for `line.separator`, `microedition.encoding`,
       `microedition.configuration`, and `microedition.locale`.
   * `demo-hello`
     * Made the system properties array `final`.
   * `jblend-api`
     * Added API Stubs.
   * `launcher`
     * Added the system property `cc.squirreljme.autolaunch` to automatically
       launch a program once the program list is read.
     * When a program is launched, instead of saying just "Loading..." instead
       allow show the program which is being loaded in the title.
   * `media-api`
     * Add null media support for: players, and volume control.
   * `meep-midlet`
     * Allow a multi-threaded
     * Handle Konami's Mobile US games using a special system request.
     * Implement `MIDlet.checkPermission()`.
   * `meep-rms`
     * Added basic support for record stores.
   * `meep-swm`
     * Added proprietary `ExtendedTaskManager` interface which can be used
       to specify arguments, system properties, and console output alternatives
142
143
144
145
146
147
148









149
150
151
152
153
154
155
       using SummerCoat it will result in the wrong class field being read
       from whatever class just happened to be set first.
     * Corrected parsing of the stack map table.
     * Removed `net.multiphasicapps.classfile.ExecutableCode`, it was not used.
   * `tool-profiler`
     * When writing the NPS snapshot, set a limit on how deep the stack can
       traverse in the event an infinite recursive method was profiled.









 * Compiler Backend
   * Added a bunch of string representations for class structures.
   * Created a stack-cached register based compiler for Java byte code.
   * Implemented a new tree based unit system for packages and classes.
   * `MergedPathSet` can be initialized by iterables now.
 * Virtual Machines
   * General







>
>
>
>
>
>
>
>
>







120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
       using SummerCoat it will result in the wrong class field being read
       from whatever class just happened to be set first.
     * Corrected parsing of the stack map table.
     * Removed `net.multiphasicapps.classfile.ExecutableCode`, it was not used.
   * `tool-profiler`
     * When writing the NPS snapshot, set a limit on how deep the stack can
       traverse in the event an infinite recursive method was profiled.
   * `vodafone-api`
     * Added API Stubs.
   * `zip`
     * Added `read(byte[])` which forwards to the more optimal function
       rather than the super-class which only performs single byte reads.
     * When reading entries where the size is fully known, if the uncompressed
       data size is fulfilled but there is still remaining compressed data
       (in the case where a zero byte file is compressed to two bytes),
       continue to read the compressed data to drain it out.
 * Compiler Backend
   * Added a bunch of string representations for class structures.
   * Created a stack-cached register based compiler for Java byte code.
   * Implemented a new tree based unit system for packages and classes.
   * `MergedPathSet` can be initialized by iterables now.
 * Virtual Machines
   * General
175
176
177
178
179
180
181

182
183
184
185
186
187
188
189
190
191
     * New Virtual Machine, register based.
     * Vast improvements over SpringCoat, faster and slimmer.
   * RatufaCoat
     * New Virtual Machine, based off SummerCoat.
     * Fast and slim, written in C.
 * Cleanup
   * Removed the `test.sh` script, it was empty.


# 0.2.0 (December 25, 2018)

SquirrelJME's first release!

Note that this is a work in progress and not everything will run, due to
the implementation being incomplete. However it does work and is proven to
work, which means progress can continue as such. Later releases of SquirrelJME
will always be an improvement over the older versions.








>










162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
     * New Virtual Machine, register based.
     * Vast improvements over SpringCoat, faster and slimmer.
   * RatufaCoat
     * New Virtual Machine, based off SummerCoat.
     * Fast and slim, written in C.
 * Cleanup
   * Removed the `test.sh` script, it was empty.
   * Removed unused scripts due to the Gradle refactor.

# 0.2.0 (December 25, 2018)

SquirrelJME's first release!

Note that this is a work in progress and not everything will run, due to
the implementation being incomplete. However it does work and is proven to
work, which means progress can continue as such. Later releases of SquirrelJME
will always be an improvement over the older versions.

Added config/checkstyle/checkstyle.xml.





















>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE module PUBLIC
    "-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
    "https://checktyle.org/dtds/configuration_1_3.dtd">
<module name="Checker">
	<module name="TreeWalker">
		<property name="tabWidth" value="4" />
		<module name="AvoidStarImport" />
	</module>
</module>

Added emulators/build.gradle.

















>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
group = "cc.squirreljme.squirreljme.emulators"
description = "This module contains all of the emulators available for " +
	"running SquirrelJME. These run on top of Java SE itself."

subprojects
{
	apply plugin: "checkstyle"
}

Added emulators/emulator-base/build.gradle.















































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
plugins
{
	// C++ needs to be first otherwise the build will break
	id "cpp-library"
	id "java-library"
	id "java-test-fixtures"
}

description = "This library provides the base support for testing and " +
	"running SquirrelJME on a Java SE host, which is normally not " +
	"capable of doing as such."

// Due to the combination of C++ and Java these dependencies have to be very
// specific in that they only refer to the Java or C++ portion. So
// "implementation" and "compile" cannot be used because the C++ library will
// try to use them during compilation.
dependencies
{
	// SquirrelJME just uses TestNG here since it is flexible enough to
	// support how SquirrelJME needs to be (testing more as if it were running
	// on the target device). Due to the flexibility it allows easier switching
	// from Java SE, SpringCoat, and SummerCoat
	compileClasspath "org.testng:testng:7.1.0"
	runtimeClasspath "org.testng:testng:7.1.0"

	// We need these two modules to obtain the SquirrelJME specific classes
	compileClasspath project(":modules:cldc-compact")
	compileClasspath project(":modules:cldc")
	compileClasspath project(":modules:common-vm")
	compileClasspath project(":modules:io")
	compileClasspath project(":modules:meep-swm")
	compileClasspath project(":modules:tac")
	compileClasspath project(":modules:tool-manifest-reader")
	compileClasspath project(":modules:zip")

	// And for run-time to be able to be ran
	runtimeClasspath project(":modules:cldc-compact")
	runtimeClasspath project(":modules:cldc")
	runtimeClasspath project(":modules:common-vm")
	runtimeClasspath project(":modules:io")
	runtimeClasspath project(":modules:meep-swm")
	runtimeClasspath project(":modules:tac")
	runtimeClasspath project(":modules:tool-manifest-reader")
	runtimeClasspath project(":modules:zip")
}

// We need the native library in the JAR before we can properly use it
// But we can compile the Java code just fine without it
jar {
	dependsOn "assembleRelease"

	from buildDir.toPath().resolve("lib").resolve("main").
		resolve("release").toFile()
	into "/"
}

Added emulators/emulator-base/enable-testing.gradle.













































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// This script is included so that the simulator and the other modules that
// need testing will work properly with the TestNG-based Simulator

dependencies
{
	// Need TestNG to run our tests
	testImplementation "org.testng:testng:7.1.0"

	// Needed to access all of the testing framework details
	testImplementation project(":modules:cldc-compact")
	testImplementation project(":modules:tac")
	testImplementation project(":modules:meep-midlet")
	testImplementation project(":emulators:emulator-base")
}

test
{
}

// Include Common Testing Configuration
apply from: project.rootProject.findProject(":emulators:emulator-base").
	projectDir.toPath().resolve("internal-shared-test-config.gradle").toFile()

Added emulators/emulator-base/internal-shared-test-config.gradle.















































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// Our tests must be properly configured before they will work
test
{
	// SquirrelJME uses a different test framework, so we cannot rely on
	// Gradle to correctly pick it up
	scanForTestClasses = false
	includes = ['**/*Test', '**/Test*', '**/Do*',
		'*Test', 'Test*', 'Do*']
	
	// Make the standard streams always show
	testLogging.showStandardStreams = true

	// Use TestNG but make sure our custom factory is always picked up
	// so that tests work properly
	useTestNG(
		{ TestNGOptions options ->
			// Need to specify the suite which contains the factory so that
			// it will detect all of the tests and run them accordingly
			options.suiteXmlFiles = [project(":emulators:emulator-base").
				projectDir.toPath().resolve("src").resolve("main").
				resolve("resources").resolve("squirreljme.xml").toFile()]
		})
}

Added emulators/emulator-base/src/main/cpp/assembly.cpp.

















































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
/* ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// --------------------------------------------------------------------------*/

#include <stdio.h>
#include <stdint.h>

#include "jni.h"
#include "cc_squirreljme_jvm_Assembly.h"

// Recycle these methods because they do more advanced handling as needed
#define CAST_JOBJECT(v) \
	Java_cc_squirreljme_jvm_Assembly_pointerToObject(env, classy, (v))
#define CAST_JLONG(v) \
	Java_cc_squirreljme_jvm_Assembly_objectToPointer(env, classy, (v))

JNIEXPORT jint JNICALL Java_cc_squirreljme_jvm_Assembly_arrayLength__J
	(JNIEnv* env, jclass classy, jlong array)
{
	return Java_cc_squirreljme_jvm_Assembly_arrayLength__Ljava_lang_Object_2(
		env, classy, CAST_JOBJECT(array));
}

JNIEXPORT jint JNICALL Java_cc_squirreljme_jvm_Assembly_arrayLength__Ljava_lang_Object_2
	(JNIEnv* env, jclass classy, jobject array)
{
	jint len;

	// Is null pointer
	if (array == NULL)
		return -1;

	// Only if the given class is an actual array can we get the length of it
	if (env->IsInstanceOf(array, env->FindClass("[Ljava/lang/Object;")) ||
		env->IsInstanceOf(array, env->FindClass("[Z")) ||
		env->IsInstanceOf(array, env->FindClass("[B")) ||
		env->IsInstanceOf(array, env->FindClass("[S")) ||
		env->IsInstanceOf(array, env->FindClass("[C")) ||
		env->IsInstanceOf(array, env->FindClass("[I")) ||
		env->IsInstanceOf(array, env->FindClass("[J")) ||
		env->IsInstanceOf(array, env->FindClass("[F")) ||
		env->IsInstanceOf(array, env->FindClass("[D")))
		return env->GetArrayLength((jarray)array);

	// Not an array
	return -1;
}

JNIEXPORT jlong JNICALL Java_cc_squirreljme_jvm_Assembly_longPack
	(JNIEnv* env, jclass classy, jint hi, jint lo)
{
	return ((((jlong)hi) & INT64_C(0xFFFFFFFF)) << INT64_C(32)) |
		((((jlong)lo)) & INT64_C(0xFFFFFFFF));
}

JNIEXPORT jint JNICALL Java_cc_squirreljme_jvm_Assembly_longUnpackHigh
	(JNIEnv* env, jclass classy, jlong value)
{
	return (jint)(value >> INT64_C(32));
}

JNIEXPORT jint JNICALL Java_cc_squirreljme_jvm_Assembly_longUnpackLow
	(JNIEnv* env, jclass classy, jlong value)
{
	return (jint)(value & INT64_C(0xFFFFFFFF));
}

JNIEXPORT jlong JNICALL Java_cc_squirreljme_jvm_Assembly_objectToPointer
	(JNIEnv* env, jclass classy, jobject object)
{
	jobject global;

	// Null references are just zero
	if (object == NULL)
		return (jlong)0;

	// Create global reference to object first
	global = env->NewGlobalRef(object);
	if (global == NULL)
	{
		env->ThrowNew(env->FindClass("java/lang/OutOfMemoryError"),
			"Could not box object as global.");
		return 0;
	}

	// We return the pointer to our global object
	return (jlong)((intptr_t)global);
}

JNIEXPORT jobject JNICALL Java_cc_squirreljme_jvm_Assembly_pointerToObject
	(JNIEnv* env, jclass classy, jlong object)
{
	// A pointer of zero is just NULL
	if (object == (jlong)0)
		return NULL;

	// We will always be returning the global reference because this is an
	// object that has a lifetime outside of the class
	return (jobject)((intptr_t)object);
}

Added emulators/emulator-base/src/main/cpp/nativebinding.cpp.







































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
/* ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// --------------------------------------------------------------------------*/

#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>

#include "jni.h"
#include "cc_squirreljme_emulator_NativeBinding.h"
#include "cc_squirreljme_jvm_Assembly.h"

// Method handler for special functions
JNIEXPORT void JNICALL doNothing(JNIEnv* env, jclass classy);
JNIEXPORT jint JNICALL doNothingZeroI(JNIEnv* env, jclass classy);
JNIEXPORT void JNICALL notImplemented(JNIEnv* env, jclass classy);
JNIEXPORT void JNICALL restrictedFunction(JNIEnv* env, jclass classy);

// Glue for putting names together
#define GLUE_NAME(name) Java_cc_squirreljme_jvm_Assembly_sysCall##name

// Assembly method mappings
static const JNINativeMethod assemblyMethods[] =
{
	{"arrayLength", "(J)I", (void*)Java_cc_squirreljme_jvm_Assembly_arrayLength__J},
	{"arrayLength", "(Ljava/lang/Object;)I", (void*)Java_cc_squirreljme_jvm_Assembly_arrayLength__Ljava_lang_Object_2},
	{"arrayLengthSet", "(JI)V", (void*)restrictedFunction},
	{"arrayLengthSet", "(Ljava/lang/Object;I)V", (void*)restrictedFunction},
	{"atomicCompareGetAndSet", "(IIJ)I", (void*)notImplemented},
	{"atomicDecrementAndGet", "(J)I", (void*)notImplemented},
	{"atomicIncrement", "(J)V", (void*)notImplemented},
	{"breakpoint", "()V", (void*)doNothing},
	{"classInfoOfBoolean", "()Lcc/squirreljme/jvm/ClassInfo;", (void*)restrictedFunction},
	{"classInfoOfBooleanPointer", "()J", (void*)restrictedFunction},
	{"classInfoOfByte", "()Lcc/squirreljme/jvm/ClassInfo;", (void*)restrictedFunction},
	{"classInfoOfBytePointer", "()J", (void*)restrictedFunction},
	{"classInfoOfCharacter", "()Lcc/squirreljme/jvm/ClassInfo;", (void*)restrictedFunction},
	{"classInfoOfCharacterPointer", "()J", (void*)restrictedFunction},
	{"classInfoOfDouble", "()Lcc/squirreljme/jvm/ClassInfo;", (void*)restrictedFunction},
	{"classInfoOfDoublePointer", "()J", (void*)restrictedFunction},
	{"classInfoOfFloat", "()Lcc/squirreljme/jvm/ClassInfo;", (void*)restrictedFunction},
	{"classInfoOfFloatPointer", "()J", (void*)restrictedFunction},
	{"classInfoOfInteger", "()Lcc/squirreljme/jvm/ClassInfo;", (void*)restrictedFunction},
	{"classInfoOfIntegerPointer", "()J", (void*)restrictedFunction},
	{"classInfoOfLong", "()Lcc/squirreljme/jvm/ClassInfo;", (void*)restrictedFunction},
	{"classInfoOfLongPointer", "()J", (void*)restrictedFunction},
	{"classInfoOfShort", "()Lcc/squirreljme/jvm/ClassInfo;", (void*)restrictedFunction},
	{"classInfoOfShortPointer", "()J", (void*)restrictedFunction},
	{"doublePack", "(II)D", (void*)notImplemented},
	{"doubleToRawLongBits", "(D)J", (void*)notImplemented},
	{"doubleUnpackHigh", "(D)I", (void*)notImplemented},
	{"doubleUnpackLow", "(D)I", (void*)notImplemented},
	{"exceptionHandle", "()V", (void*)doNothing},
	{"floatToRawIntBits", "(F)I", (void*)notImplemented},
	{"intBitsToFloat", "(I)F", (void*)notImplemented},
	{"invoke", "(JJ)V", (void*)restrictedFunction},
	{"invoke", "(JJI)V", (void*)restrictedFunction},
	{"invoke", "(JJII)V", (void*)restrictedFunction},
	{"invoke", "(JJIII)V", (void*)restrictedFunction},
	{"invoke", "(JJIIII)V", (void*)restrictedFunction},
	{"invoke", "(JJIIIII)V", (void*)restrictedFunction},
	{"invoke", "(JJIIIIII)V", (void*)restrictedFunction},
	{"invoke", "(JJIIIIIII)V", (void*)restrictedFunction},
	{"invoke", "(JJIIIIIIII)V", (void*)restrictedFunction},
	{"invokeV", "(JJ)I", (void*)restrictedFunction},
	{"invokeV", "(JJI)I", (void*)restrictedFunction},
	{"invokeV", "(JJII)I", (void*)restrictedFunction},
	{"invokeV", "(JJIII)I", (void*)restrictedFunction},
	{"invokeV", "(JJIIII)I", (void*)restrictedFunction},
	{"invokeV", "(JJIIIII)I", (void*)restrictedFunction},
	{"invokeV", "(JJIIIIII)I", (void*)restrictedFunction},
	{"invokeV", "(JJIIIIIII)I", (void*)restrictedFunction},
	{"invokeV", "(JJIIIIIIII)I", (void*)restrictedFunction},
	{"invokeVL", "(JJ)J", (void*)restrictedFunction},
	{"invokeVL", "(JJI)J", (void*)restrictedFunction},
	{"invokeVL", "(JJII)J", (void*)restrictedFunction},
	{"invokeVL", "(JJIII)J", (void*)restrictedFunction},
	{"invokeVL", "(JJIIII)J", (void*)restrictedFunction},
	{"invokeVL", "(JJIIIII)J", (void*)restrictedFunction},
	{"invokeVL", "(JJIIIIII)J", (void*)restrictedFunction},
	{"invokeVL", "(JJIIIIIII)J", (void*)restrictedFunction},
	{"invokeVL", "(JJIIIIIIII)J", (void*)restrictedFunction},
	{"longBitsToDouble", "(J)D", (void*)notImplemented},
	{"longPack", "(II)J", (void*)Java_cc_squirreljme_jvm_Assembly_longPack},
	{"longUnpackHigh", "(J)I", (void*)Java_cc_squirreljme_jvm_Assembly_longUnpackHigh},
	{"longUnpackLow", "(J)I", (void*)Java_cc_squirreljme_jvm_Assembly_longUnpackLow},
	{"memReadByte", "(JI)I", (void*)notImplemented},
	{"memReadInt", "(JI)I", (void*)notImplemented},
	{"memReadJavaInt", "(JI)I", (void*)notImplemented},
	{"memReadJavaLong", "(JI)J", (void*)notImplemented},
	{"memReadJavaShort", "(JI)I", (void*)notImplemented},
	{"memReadPointer", "(JI)J", (void*)notImplemented},
	{"memReadShort", "(JI)I", (void*)notImplemented},
	{"memWriteByte", "(JII)V", (void*)notImplemented},
	{"memWriteInt", "(JII)V", (void*)notImplemented},
	{"memWriteJavaInt", "(JII)V", (void*)notImplemented},
	{"memWriteJavaLong", "(JIJ)V", (void*)notImplemented},
	{"memWriteJavaShort", "(JII)V", (void*)notImplemented},
	{"memWritePointer", "(JIJ)V", (void*)notImplemented},
	{"memWriteShort", "(JII)V", (void*)notImplemented},
	{"monitorCountDecrementAndGetAtomic", "(J)I", (void*)restrictedFunction},
	{"monitorCountDecrementAndGetAtomic", "(Ljava/lang/Object;)I", (void*)restrictedFunction},
	{"monitorCountIncrementAndGetAtomic", "(J)I", (void*)restrictedFunction},
	{"monitorCountIncrementAndGetAtomic", "(Ljava/lang/Object;)I", (void*)restrictedFunction},
	{"monitorCountGetAtomic", "(J)I", (void*)restrictedFunction},
	{"monitorCountGetAtomic", "(Ljava/lang/Object;)I", (void*)restrictedFunction},
	{"monitorCountSetAtomic", "(JI)V", (void*)restrictedFunction},
	{"monitorCountSetAtomic", "(Ljava/lang/Object;I)V", (void*)restrictedFunction},
	{"monitorOwnerCompareGetAndSetAtomic", "(JJJ)Ljava/lang/Thread;", (void*)restrictedFunction},
	{"monitorOwnerCompareGetAndSetAtomic", "(Ljava/lang/Object;JJ)Ljava/lang/Thread;", (void*)restrictedFunction},
	{"monitorOwnerCompareGetAndSetAtomic", "(JLjava/lang/Thread;Ljava/lang/Thread;)Ljava/lang/Thread;", (void*)restrictedFunction},
	{"monitorOwnerCompareGetAndSetAtomic", "(Ljava/lang/Object;Ljava/lang/Thread;Ljava/lang/Thread;)Ljava/lang/Thread;", (void*)restrictedFunction},
	{"monitorOwnerCompareGetAndSetAtomicPointer", "(JJJ)J", (void*)restrictedFunction},
	{"monitorOwnerCompareGetAndSetAtomicPointer", "(Ljava/lang/Object;JJ)J", (void*)restrictedFunction},
	{"monitorOwnerCompareGetAndSetAtomicPointer", "(JLjava/lang/Thread;Ljava/lang/Thread;)J", (void*)restrictedFunction},
	{"monitorOwnerCompareGetAndSetAtomicPointer", "(Ljava/lang/Object;Ljava/lang/Thread;Ljava/lang/Thread;)J", (void*)restrictedFunction},
	{"monitorOwnerGetAtomic", "(J)Ljava/lang/Thread;", (void*)restrictedFunction},
	{"monitorOwnerGetAtomic", "(Ljava/lang/Object;)Ljava/lang/Thread;", (void*)restrictedFunction},
	{"monitorOwnerGetPointerAtomic", "(J)J", (void*)restrictedFunction},
	{"monitorOwnerGetPointerAtomic", "(Ljava/lang/Object;)J", (void*)restrictedFunction},
	{"monitorOwnerSetAtomic", "(JJ)V", (void*)restrictedFunction},
	{"monitorOwnerSetAtomic", "(JLjava/lang/Thread;)V", (void*)restrictedFunction},
	{"monitorOwnerSetAtomic", "(Ljava/lang/Object;J)V", (void*)restrictedFunction},
	{"monitorOwnerSetAtomic", "(Ljava/lang/Object;Ljava/lang/Thread;)V", (void*)restrictedFunction},
	{"objectGetClassInfo", "(J)Lcc/squirreljme/jvm/ClassInfo;", (void*)restrictedFunction},
	{"objectGetClassInfo", "(Ljava/lang/Object;)Lcc/squirreljme/jvm/ClassInfo;", (void*)restrictedFunction},
	{"objectGetClassInfoPointer", "(J)J", (void*)restrictedFunction},
	{"objectGetClassInfoPointer", "(Ljava/lang/Object;)J", (void*)restrictedFunction},
	{"objectSetClassInfo", "(JJ)V", (void*)restrictedFunction},
	{"objectSetClassInfo", "(Ljava/lang/Object;J)V", (void*)restrictedFunction},
	{"objectSetClassInfo", "(JLcc/squirreljme/jvm/ClassInfo;)V", (void*)restrictedFunction},
	{"objectSetClassInfo", "(Ljava/lang/Object;Lcc/squirreljme/jvm/ClassInfo;)V", (void*)restrictedFunction},
	{"objectToPointer", "(Ljava/lang/Object;)J", (void*)Java_cc_squirreljme_jvm_Assembly_objectToPointer},
	{"objectToPointerRefQueue", "(Ljava/lang/Object;)J", (void*)Java_cc_squirreljme_jvm_Assembly_objectToPointer},
	{"pointerToObject", "(J)Ljava/lang/Object;", (void*)Java_cc_squirreljme_jvm_Assembly_pointerToObject},
	{"pointerToClassInfo", "(J)Lcc/squirreljme/jvm/ClassInfo;", (void*)Java_cc_squirreljme_jvm_Assembly_pointerToObject},
	{"poolLoad", "(JI)J", (void*)restrictedFunction},
	{"poolLoad", "(Ljava/lang/Object;I)J", (void*)restrictedFunction},
	{"poolStore", "(JIJ)V", (void*)restrictedFunction},
	{"poolStore", "(Ljava/lang/Object;IJ)V", (void*)restrictedFunction},
	{"refCount", "(J)V", (void*)doNothing},
	{"refCount", "(Ljava/lang/Object;)V", (void*)doNothing},
	{"refGetCount", "(J)I", (void*)restrictedFunction},
	{"refGetCount", "(Ljava/lang/Object;)I", (void*)restrictedFunction},
	{"refSetCount", "(JI)V", (void*)restrictedFunction},
	{"refSetCount", "(Ljava/lang/Object;I)V", (void*)restrictedFunction},
	{"refUncount", "(J)V", (void*)doNothing},
	{"refUncount", "(Ljava/lang/Object;)V", (void*)doNothing},
	{"returnFrame", "()V", (void*)notImplemented},
	{"returnFrame", "(I)V", (void*)notImplemented},
	{"returnFrame", "(II)V", (void*)notImplemented},
	{"returnFrameLong", "(J)V", (void*)notImplemented},
	{"sizeOfBaseArray", "()I", (void*)notImplemented},
	{"sizeOfBaseObject", "()I", (void*)notImplemented},
	{"sizeOfPointer", "()I", (void*)notImplemented},
	{"specialGetExceptionRegister", "()Ljava/lang/Object;", (void*)restrictedFunction},
	{"specialGetExceptionRegisterThrowable", "()Ljava/lang/Throwable;", (void*)restrictedFunction},
	{"specialGetExceptionRegisterPointer", "()J", (void*)restrictedFunction},
	{"specialGetPoolRegister", "()Ljava/lang/Object;", (void*)restrictedFunction},
	{"specialGetPoolRegisterPointer", "()J", (void*)restrictedFunction},
	{"specialGetReturnRegister", "()I", (void*)restrictedFunction},
	{"specialGetReturnRegisterLong", "()J", (void*)restrictedFunction},
	{"specialGetStaticFieldRegister", "()J", (void*)restrictedFunction},
	{"specialGetThreadRegister", "()Ljava/lang/Thread;", (void*)restrictedFunction},
	{"specialGetThreadRegisterPointer", "()J", (void*)restrictedFunction},
	{"specialSetExceptionRegister", "(J)V", (void*)restrictedFunction},
	{"specialSetExceptionRegister", "(Ljava/lang/Object;)V", (void*)restrictedFunction},
	{"specialSetPoolRegister", "(J)V", (void*)restrictedFunction},
	{"specialSetPoolRegister", "(Ljava/lang/Object;)V", (void*)restrictedFunction},
	{"specialSetStaticFieldRegister", "(J)V", (void*)restrictedFunction},
	{"specialSetThreadRegister", "(J)V", (void*)restrictedFunction},
	{"specialSetThreadRegister", "(Ljava/lang/Thread;)V", (void*)restrictedFunction},

	// Un-Pure System Calls
	{"sysCall", "(S)V", (void*)GLUE_NAME(__S)},
	{"sysCall", "(SI)V", (void*)GLUE_NAME(__SI)},
	{"sysCall", "(SII)V", (void*)GLUE_NAME(__SII)},
	{"sysCall", "(SIII)V", (void*)GLUE_NAME(__SIII)},
	{"sysCall", "(SIIII)V", (void*)GLUE_NAME(__SIIII)},
	{"sysCall", "(SIIIII)V", (void*)GLUE_NAME(__SIIIII)},
	{"sysCall", "(SIIIIII)V", (void*)GLUE_NAME(__SIIIIII)},
	{"sysCall", "(SIIIIIII)V", (void*)GLUE_NAME(__SIIIIIII)},
	{"sysCall", "(SIIIIIIII)V", (void*)GLUE_NAME(__SIIIIIIII)},
	{"sysCallV", "(S)I", (void*)GLUE_NAME(V__S)},
	{"sysCallV", "(SI)I", (void*)GLUE_NAME(V__SI)},
	{"sysCallV", "(SII)I", (void*)GLUE_NAME(V__SII)},
	{"sysCallV", "(SIII)I", (void*)GLUE_NAME(V__SIII)},
	{"sysCallV", "(SIIII)I", (void*)GLUE_NAME(V__SIIII)},
	{"sysCallV", "(SIIIII)I", (void*)GLUE_NAME(V__SIIIII)},
	{"sysCallV", "(SIIIIII)I", (void*)GLUE_NAME(V__SIIIIII)},
	{"sysCallV", "(SIIIIIII)I", (void*)GLUE_NAME(V__SIIIIIII)},
	{"sysCallV", "(SIIIIIIII)I", (void*)GLUE_NAME(V__SIIIIIIII)},
	{"sysCallVL", "(S)J", (void*)GLUE_NAME(VL__S)},
	{"sysCallVL", "(SI)J", (void*)GLUE_NAME(VL__SI)},
	{"sysCallVL", "(SII)J", (void*)GLUE_NAME(VL__SII)},
	{"sysCallVL", "(SIII)J", (void*)GLUE_NAME(VL__SIII)},
	{"sysCallVL", "(SIIII)J", (void*)GLUE_NAME(VL__SIIII)},
	{"sysCallVL", "(SIIIII)J", (void*)GLUE_NAME(VL__SIIIII)},
	{"sysCallVL", "(SIIIIII)J", (void*)GLUE_NAME(VL__SIIIIII)},
	{"sysCallVL", "(SIIIIIII)J", (void*)GLUE_NAME(VL__SIIIIIII)},
	{"sysCallVL", "(SIIIIIIII)J", (void*)GLUE_NAME(VL__SIIIIIIII)},

	// Pure System Calls	{"sysCallP", "(S)V", (void*)GLUE_NAME(P__S)},
	{"sysCallP", "(SI)V", (void*)GLUE_NAME(P__SI)},
	{"sysCallP", "(SII)V", (void*)GLUE_NAME(P__SII)},
	{"sysCallP", "(SIII)V", (void*)GLUE_NAME(P__SIII)},
	{"sysCallP", "(SIIII)V", (void*)GLUE_NAME(P__SIIII)},
	{"sysCallP", "(SIIIII)V", (void*)GLUE_NAME(P__SIIIII)},
	{"sysCallP", "(SIIIIII)V", (void*)GLUE_NAME(P__SIIIIII)},
	{"sysCallP", "(SIIIIIII)V", (void*)GLUE_NAME(P__SIIIIIII)},
	{"sysCallP", "(SIIIIIIII)V", (void*)GLUE_NAME(P__SIIIIIIII)},
	{"sysCallPV", "(S)I", (void*)GLUE_NAME(PV__S)},
	{"sysCallPV", "(SI)I", (void*)GLUE_NAME(PV__SI)},
	{"sysCallPV", "(SII)I", (void*)GLUE_NAME(PV__SII)},
	{"sysCallPV", "(SIII)I", (void*)GLUE_NAME(PV__SIII)},
	{"sysCallPV", "(SIIII)I", (void*)GLUE_NAME(PV__SIIII)},
	{"sysCallPV", "(SIIIII)I", (void*)GLUE_NAME(PV__SIIIII)},
	{"sysCallPV", "(SIIIIII)I", (void*)GLUE_NAME(PV__SIIIIII)},
	{"sysCallPV", "(SIIIIIII)I", (void*)GLUE_NAME(PV__SIIIIIII)},
	{"sysCallPV", "(SIIIIIIII)I", (void*)GLUE_NAME(PV__SIIIIIIII)},
	{"sysCallPVL", "(S)J", (void*)GLUE_NAME(PVL__S)},
	{"sysCallPVL", "(SI)J", (void*)GLUE_NAME(PVL__SI)},
	{"sysCallPVL", "(SII)J", (void*)GLUE_NAME(PVL__SII)},
	{"sysCallPVL", "(SIII)J", (void*)GLUE_NAME(PVL__SIII)},
	{"sysCallPVL", "(SIIII)J", (void*)GLUE_NAME(PVL__SIIII)},
	{"sysCallPVL", "(SIIIII)J", (void*)GLUE_NAME(PVL__SIIIII)},
	{"sysCallPVL", "(SIIIIII)J", (void*)GLUE_NAME(PVL__SIIIIII)},
	{"sysCallPVL", "(SIIIIIII)J", (void*)GLUE_NAME(PVL__SIIIIIII)},
	{"sysCallPVL", "(SIIIIIIII)J", (void*)GLUE_NAME(PVL__SIIIIIIII)}
};

JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void* reserved)
{
	JNIEnv* env;

	// Used to indicate that something might be happened
	fprintf(stderr, "SquirrelJME Native Bindings Initializing...\n");

	// Support Java 7!
	return JNI_VERSION_1_6;
}

JNIEXPORT void JNICALL doNothing(JNIEnv* env, jclass classy)
{
}

JNIEXPORT jint JNICALL doNothingZeroI(JNIEnv* env, jclass classy)
{
	return 0;
}

JNIEXPORT void JNICALL notImplemented(JNIEnv* env, jclass classy)
{
	fprintf(stderr, "Not implemented: %s.\n", __func__);
	env->ThrowNew(env->FindClass("java/lang/IllegalArgumentException"),
		__func__);
}

JNIEXPORT void JNICALL restrictedFunction(JNIEnv* env, jclass classy)
{
	fprintf(stderr, "Restricted function: %s.\n", __func__);
	env->ThrowNew(env->FindClass("java/lang/Error"),
		__func__);
}

JNIEXPORT jint JNICALL Java_cc_squirreljme_emulator_NativeBinding__1_1bindMethods
	(JNIEnv* env, jclass classy)
{
	return env->RegisterNatives(env->FindClass("cc/squirreljme/jvm/Assembly"),
		assemblyMethods, sizeof(assemblyMethods) / sizeof(JNINativeMethod));
}

Added emulators/emulator-base/src/main/cpp/syscall.cpp.























































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
/* ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// --------------------------------------------------------------------------*/

#include <stdio.h>

#include "jni.h"
#include "cc_squirreljme_jvm_Assembly.h"

/***************************** ACTUAL SYSTEM CALLS ***************************/

JNIEXPORT jlong JNICALL Java_cc_squirreljme_jvm_Assembly_sysCallVL__SIIIIIIII
	(JNIEnv* env, jclass classy, jshort si, jint a, jint b, jint c, jint d,
	jint e, jint f, jint g, jint h)
{
	jclass jvmFunctionClassy;
	jmethodID jvmSystemCallMethod;

	// Locate class
	jvmFunctionClassy = env->FindClass("cc/squirreljme/jvm/JVMFunction");

	if (jvmFunctionClassy == NULL)
	{
		env->ThrowNew(env->FindClass("java/lang/RuntimeException"),
			"Could not find JVMFunction class.");
		return 0;
	}

	// Locate method
	jvmSystemCallMethod = env->GetStaticMethodID(
		jvmFunctionClassy, "jvmSystemCall", "(SIIIIIIII)J");

	if (jvmSystemCallMethod == NULL)
	{
		env->ThrowNew(env->FindClass("java/lang/RuntimeException"),
			"Could not find JVMFunction.jvmSystemCall method.");
		return 0;
	}

	// These are un-pure system calls and as such will call jvmSystemCall
	// to handle the system call
	return env->CallStaticLongMethod(jvmFunctionClassy, jvmSystemCallMethod,
		si, a, b, c, d, e, f, g, h);
}


JNIEXPORT jlong JNICALL Java_cc_squirreljme_jvm_Assembly_sysCallPVL__SIIIIIIII
	(JNIEnv* env, jclass classy, jshort si, jint a, jint b, jint c, jint d,
	jint e, jint f, jint g, jint h)
{
	jclass emulatorAssemblyClassy;
	jmethodID emulatorSystemCallClassy;

	// Locate class
	emulatorAssemblyClassy = env->FindClass(
		"cc/squirreljme/emulator/EmulatorAssembly");

	if (emulatorAssemblyClassy == NULL)
	{
		env->ThrowNew(env->FindClass("java/lang/RuntimeException"),
			"Could not find EmulatorAssembly class.");
		return 0;
	}

	// Locate method
	emulatorSystemCallClassy = env->GetStaticMethodID(
		emulatorAssemblyClassy, "systemCall", "(SIIIIIIII)J");

	if (emulatorSystemCallClassy == NULL)
	{
		env->ThrowNew(env->FindClass("java/lang/RuntimeException"),
			"Could not find EmulatorAssembly.systemCall method.");
		return 0;
	}

	// Handle system call
	switch (si)
	{
			// System call not implemented in native code, forward to Java
			// based handler.
		default:
			return env->CallStaticLongMethod(emulatorAssemblyClassy,
				emulatorSystemCallClassy, si, a, b, c, d, e, f, g, h);
	}
}

/*************************** FINAL LEVEL FORWARDED ***************************/

JNIEXPORT void JNICALL Java_cc_squirreljme_jvm_Assembly_sysCall__SIIIIIIII
	(JNIEnv* env, jclass classy, jshort si, jint a, jint b, jint c, jint d,
	jint e, jint f, jint g, jint h)
{
	Java_cc_squirreljme_jvm_Assembly_sysCallVL__SIIIIIIII(
		env, classy, si, a, b, c, d, e, f, g, h);
}

JNIEXPORT jint JNICALL Java_cc_squirreljme_jvm_Assembly_sysCallV__SIIIIIIII
	(JNIEnv* env, jclass classy, jshort si, jint a, jint b, jint c, jint d,
	jint e, jint f, jint g, jint h)
{
	return (jint)Java_cc_squirreljme_jvm_Assembly_sysCallVL__SIIIIIIII(
		env, classy, si, a, b, c, d, e, f, g, h);
}

JNIEXPORT void JNICALL Java_cc_squirreljme_jvm_Assembly_sysCallP__SIIIIIIII
	(JNIEnv* env, jclass classy, jshort si, jint a, jint b, jint c, jint d,
	jint e, jint f, jint g, jint h)
{
	Java_cc_squirreljme_jvm_Assembly_sysCallPVL__SIIIIIIII(
		env, classy, si, a, b, c, d, e, f, g, h);
}

JNIEXPORT jint JNICALL Java_cc_squirreljme_jvm_Assembly_sysCallPV__SIIIIIIII
	(JNIEnv* env, jclass classy, jshort si, jint a, jint b, jint c, jint d,
	jint e, jint f, jint g, jint h)
{
	return (jint)Java_cc_squirreljme_jvm_Assembly_sysCallPVL__SIIIIIIII(
		env, classy, si, a, b, c, d, e, f, g, h);
}

/*************************** FORWARDED SYSTEM CALLS **************************/

// Declaration of arguments
#define ARGDECL_ZERO JNIEnv* env, jclass classy, jshort si
#define ARGDECL_ONE ARGDECL_ZERO, jint a
#define ARGDECL_TWO ARGDECL_ONE, jint b
#define ARGDECL_THREE ARGDECL_TWO, jint c
#define ARGDECL_FOUR ARGDECL_THREE, jint d
#define ARGDECL_FIVE ARGDECL_FOUR, jint e
#define ARGDECL_SIX ARGDECL_FIVE, jint f
#define ARGDECL_SEVEN ARGDECL_SIX, jint g
#define ARGDECL_EIGHT ARGDECL_SEVEN, jint h

// Arguments to forward to the other function
#define ARGBASE_BASE	env, classy, si
#define ARGPASS_ZERO	ARGBASE_BASE, 0, 0, 0, 0, 0, 0, 0, 0
#define ARGPASS_ONE		ARGBASE_BASE, a, 0, 0, 0, 0, 0, 0, 0
#define ARGPASS_TWO		ARGBASE_BASE, a, b, 0, 0, 0, 0, 0, 0
#define ARGPASS_THREE	ARGBASE_BASE, a, b, c, 0, 0, 0, 0, 0
#define ARGPASS_FOUR	ARGBASE_BASE, a, b, c, d, 0, 0, 0, 0
#define ARGPASS_FIVE	ARGBASE_BASE, a, b, c, d, e, 0, 0, 0
#define ARGPASS_SIX		ARGBASE_BASE, a, b, c, d, e, f, 0, 0
#define ARGPASS_SEVEN	ARGBASE_BASE, a, b, c, d, e, f, g, 0
#define ARGPASS_EIGHT	ARGBASE_BASE, a, b, c, d, e, f, g, h

// Returning a value or not?
#define RETURN return
#define NO_RETURN

// Glues name together
#define GLUE_NAME(name) Java_cc_squirreljme_jvm_Assembly_sysCall##name

// Builds the entire declaration
#define BUILD(returnToken, returnType, name, toName, argDecl, argPass) \
	JNIEXPORT returnType JNICALL GLUE_NAME(name) \
		(argDecl) \
	{ \
		returnToken GLUE_NAME(toName) (argPass); \
	}

BUILD(NO_RETURN, void, __S, __SIIIIIIII, ARGDECL_ZERO, ARGPASS_ZERO)
BUILD(NO_RETURN, void, __SI, __SIIIIIIII, ARGDECL_ONE, ARGPASS_ONE)
BUILD(NO_RETURN, void, __SII, __SIIIIIIII, ARGDECL_TWO, ARGPASS_TWO)
BUILD(NO_RETURN, void, __SIII, __SIIIIIIII, ARGDECL_THREE, ARGPASS_THREE)
BUILD(NO_RETURN, void, __SIIII, __SIIIIIIII, ARGDECL_FOUR, ARGPASS_FOUR)
BUILD(NO_RETURN, void, __SIIIII, __SIIIIIIII, ARGDECL_FIVE, ARGPASS_FIVE)
BUILD(NO_RETURN, void, __SIIIIII, __SIIIIIIII, ARGDECL_SIX, ARGPASS_SIX)
BUILD(NO_RETURN, void, __SIIIIIII, __SIIIIIIII, ARGDECL_SEVEN, ARGPASS_SEVEN)

BUILD(RETURN, jint, V__S, V__SIIIIIIII, ARGDECL_ZERO, ARGPASS_ZERO)
BUILD(RETURN, jint, V__SI, V__SIIIIIIII, ARGDECL_ONE, ARGPASS_ONE)
BUILD(RETURN, jint, V__SII, V__SIIIIIIII, ARGDECL_TWO, ARGPASS_TWO)
BUILD(RETURN, jint, V__SIII, V__SIIIIIIII, ARGDECL_THREE, ARGPASS_THREE)
BUILD(RETURN, jint, V__SIIII, V__SIIIIIIII, ARGDECL_FOUR, ARGPASS_FOUR)
BUILD(RETURN, jint, V__SIIIII, V__SIIIIIIII, ARGDECL_FIVE, ARGPASS_FIVE)
BUILD(RETURN, jint, V__SIIIIII, V__SIIIIIIII, ARGDECL_SIX, ARGPASS_SIX)
BUILD(RETURN, jint, V__SIIIIIII, V__SIIIIIIII, ARGDECL_SEVEN, ARGPASS_SEVEN)

BUILD(RETURN, jlong, VL__S, VL__SIIIIIIII, ARGDECL_ZERO, ARGPASS_ZERO)
BUILD(RETURN, jlong, VL__SI, VL__SIIIIIIII, ARGDECL_ONE, ARGPASS_ONE)
BUILD(RETURN, jlong, VL__SII, VL__SIIIIIIII, ARGDECL_TWO, ARGPASS_TWO)
BUILD(RETURN, jlong, VL__SIII, VL__SIIIIIIII, ARGDECL_THREE, ARGPASS_THREE)
BUILD(RETURN, jlong, VL__SIIII, VL__SIIIIIIII, ARGDECL_FOUR, ARGPASS_FOUR)
BUILD(RETURN, jlong, VL__SIIIII, VL__SIIIIIIII, ARGDECL_FIVE, ARGPASS_FIVE)
BUILD(RETURN, jlong, VL__SIIIIII, VL__SIIIIIIII, ARGDECL_SIX, ARGPASS_SIX)
BUILD(RETURN, jlong, VL__SIIIIIII, VL__SIIIIIIII, ARGDECL_SEVEN, ARGPASS_SEVEN)

BUILD(NO_RETURN, void, P__S, P__SIIIIIIII, ARGDECL_ZERO, ARGPASS_ZERO)
BUILD(NO_RETURN, void, P__SI, P__SIIIIIIII, ARGDECL_ONE, ARGPASS_ONE)
BUILD(NO_RETURN, void, P__SII, P__SIIIIIIII, ARGDECL_TWO, ARGPASS_TWO)
BUILD(NO_RETURN, void, P__SIII, P__SIIIIIIII, ARGDECL_THREE, ARGPASS_THREE)
BUILD(NO_RETURN, void, P__SIIII, P__SIIIIIIII, ARGDECL_FOUR, ARGPASS_FOUR)
BUILD(NO_RETURN, void, P__SIIIII, P__SIIIIIIII, ARGDECL_FIVE, ARGPASS_FIVE)
BUILD(NO_RETURN, void, P__SIIIIII, P__SIIIIIIII, ARGDECL_SIX, ARGPASS_SIX)
BUILD(NO_RETURN, void, P__SIIIIIII, P__SIIIIIIII, ARGDECL_SEVEN, ARGPASS_SEVEN)

BUILD(RETURN, jint, PV__S, PV__SIIIIIIII, ARGDECL_ZERO, ARGPASS_ZERO)
BUILD(RETURN, jint, PV__SI, PV__SIIIIIIII, ARGDECL_ONE, ARGPASS_ONE)
BUILD(RETURN, jint, PV__SII, PV__SIIIIIIII, ARGDECL_TWO, ARGPASS_TWO)
BUILD(RETURN, jint, PV__SIII, PV__SIIIIIIII, ARGDECL_THREE, ARGPASS_THREE)
BUILD(RETURN, jint, PV__SIIII, PV__SIIIIIIII, ARGDECL_FOUR, ARGPASS_FOUR)
BUILD(RETURN, jint, PV__SIIIII, PV__SIIIIIIII, ARGDECL_FIVE, ARGPASS_FIVE)
BUILD(RETURN, jint, PV__SIIIIII, PV__SIIIIIIII, ARGDECL_SIX, ARGPASS_SIX)
BUILD(RETURN, jint, PV__SIIIIIII, PV__SIIIIIIII, ARGDECL_SEVEN, ARGPASS_SEVEN)

BUILD(RETURN, jlong, PVL__S, PVL__SIIIIIIII, ARGDECL_ZERO, ARGPASS_ZERO)
BUILD(RETURN, jlong, PVL__SI, PVL__SIIIIIIII, ARGDECL_ONE, ARGPASS_ONE)
BUILD(RETURN, jlong, PVL__SII, PVL__SIIIIIIII, ARGDECL_TWO, ARGPASS_TWO)
BUILD(RETURN, jlong, PVL__SIII, PVL__SIIIIIIII, ARGDECL_THREE, ARGPASS_THREE)
BUILD(RETURN, jlong, PVL__SIIII, PVL__SIIIIIIII, ARGDECL_FOUR, ARGPASS_FOUR)
BUILD(RETURN, jlong, PVL__SIIIII, PVL__SIIIIIIII, ARGDECL_FIVE, ARGPASS_FIVE)
BUILD(RETURN, jlong, PVL__SIIIIII, PVL__SIIIIIIII, ARGDECL_SIX, ARGPASS_SIX)
BUILD(RETURN, jlong, PVL__SIIIIIII, PVL__SIIIIIIII,
	ARGDECL_SEVEN, ARGPASS_SEVEN)

Added emulators/emulator-base/src/main/headers/cc_squirreljme_emulator_NativeBinding.h.











































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class cc_squirreljme_emulator_NativeBinding */

#ifndef _Included_cc_squirreljme_emulator_NativeBinding
#define _Included_cc_squirreljme_emulator_NativeBinding
#ifdef __cplusplus
extern "C" {
#endif
/*
 * Class:     cc_squirreljme_emulator_NativeBinding
 * Method:    __bindMethods
 * Signature: ()I
 */
JNIEXPORT jint JNICALL Java_cc_squirreljme_emulator_NativeBinding__1_1bindMethods
  (JNIEnv *, jclass);

#ifdef __cplusplus
}
#endif
#endif

Added emulators/emulator-base/src/main/headers/cc_squirreljme_jvm_Assembly.h.



























































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class cc_squirreljme_jvm_Assembly */

#ifndef _Included_cc_squirreljme_jvm_Assembly
#define _Included_cc_squirreljme_jvm_Assembly
#ifdef __cplusplus
extern "C" {
#endif
/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    arrayLength
 * Signature: (J)I
 */
JNIEXPORT jint JNICALL Java_cc_squirreljme_jvm_Assembly_arrayLength__J
	(JNIEnv* env, jclass classy, jlong);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    arrayLength
 * Signature: (Ljava/lang/Object;)I
 */
JNIEXPORT jint JNICALL Java_cc_squirreljme_jvm_Assembly_arrayLength__Ljava_lang_Object_2
	(JNIEnv* env, jclass classy, jobject);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    arrayLengthSet
 * Signature: (JI)V
 */
JNIEXPORT void JNICALL Java_cc_squirreljme_jvm_Assembly_arrayLengthSet__JI
	(JNIEnv* env, jclass classy, jlong, jint);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    arrayLengthSet
 * Signature: (Ljava/lang/Object;I)V
 */
JNIEXPORT void JNICALL Java_cc_squirreljme_jvm_Assembly_arrayLengthSet__Ljava_lang_Object_2I
	(JNIEnv* env, jclass classy, jobject, jint);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    atomicCompareGetAndSet
 * Signature: (IIJ)I
 */
JNIEXPORT jint JNICALL Java_cc_squirreljme_jvm_Assembly_atomicCompareGetAndSet
	(JNIEnv* env, jclass classy, jint, jint, jlong);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    atomicDecrementAndGet
 * Signature: (J)I
 */
JNIEXPORT jint JNICALL Java_cc_squirreljme_jvm_Assembly_atomicDecrementAndGet
	(JNIEnv* env, jclass classy, jlong);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    atomicIncrement
 * Signature: (J)V
 */
JNIEXPORT void JNICALL Java_cc_squirreljme_jvm_Assembly_atomicIncrement
	(JNIEnv* env, jclass classy, jlong);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    breakpoint
 * Signature: ()V
 */
JNIEXPORT void JNICALL Java_cc_squirreljme_jvm_Assembly_breakpoint
	(JNIEnv* env, jclass classy);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    classInfoOfBoolean
 * Signature: ()Lcc/squirreljme/jvm/ClassInfo;
 */
JNIEXPORT jobject JNICALL Java_cc_squirreljme_jvm_Assembly_classInfoOfBoolean
	(JNIEnv* env, jclass classy);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    classInfoOfBooleanPointer
 * Signature: ()J
 */
JNIEXPORT jlong JNICALL Java_cc_squirreljme_jvm_Assembly_classInfoOfBooleanPointer
	(JNIEnv* env, jclass classy);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    classInfoOfByte
 * Signature: ()Lcc/squirreljme/jvm/ClassInfo;
 */
JNIEXPORT jobject JNICALL Java_cc_squirreljme_jvm_Assembly_classInfoOfByte
	(JNIEnv* env, jclass classy);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    classInfoOfBytePointer
 * Signature: ()J
 */
JNIEXPORT jlong JNICALL Java_cc_squirreljme_jvm_Assembly_classInfoOfBytePointer
	(JNIEnv* env, jclass classy);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    classInfoOfCharacter
 * Signature: ()Lcc/squirreljme/jvm/ClassInfo;
 */
JNIEXPORT jobject JNICALL Java_cc_squirreljme_jvm_Assembly_classInfoOfCharacter
	(JNIEnv* env, jclass classy);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    classInfoOfCharacterPointer
 * Signature: ()J
 */
JNIEXPORT jlong JNICALL Java_cc_squirreljme_jvm_Assembly_classInfoOfCharacterPointer
	(JNIEnv* env, jclass classy);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    classInfoOfDouble
 * Signature: ()Lcc/squirreljme/jvm/ClassInfo;
 */
JNIEXPORT jobject JNICALL Java_cc_squirreljme_jvm_Assembly_classInfoOfDouble
	(JNIEnv* env, jclass classy);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    classInfoOfDoublePointer
 * Signature: ()J
 */
JNIEXPORT jlong JNICALL Java_cc_squirreljme_jvm_Assembly_classInfoOfDoublePointer
	(JNIEnv* env, jclass classy);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    classInfoOfFloat
 * Signature: ()Lcc/squirreljme/jvm/ClassInfo;
 */
JNIEXPORT jobject JNICALL Java_cc_squirreljme_jvm_Assembly_classInfoOfFloat
	(JNIEnv* env, jclass classy);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    classInfoOfFloatPointer
 * Signature: ()J
 */
JNIEXPORT jlong JNICALL Java_cc_squirreljme_jvm_Assembly_classInfoOfFloatPointer
	(JNIEnv* env, jclass classy);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    classInfoOfInteger
 * Signature: ()Lcc/squirreljme/jvm/ClassInfo;
 */
JNIEXPORT jobject JNICALL Java_cc_squirreljme_jvm_Assembly_classInfoOfInteger
	(JNIEnv* env, jclass classy);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    classInfoOfIntegerPointer
 * Signature: ()J
 */
JNIEXPORT jlong JNICALL Java_cc_squirreljme_jvm_Assembly_classInfoOfIntegerPointer
	(JNIEnv* env, jclass classy);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    classInfoOfLong
 * Signature: ()Lcc/squirreljme/jvm/ClassInfo;
 */
JNIEXPORT jobject JNICALL Java_cc_squirreljme_jvm_Assembly_classInfoOfLong
	(JNIEnv* env, jclass classy);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    classInfoOfLongPointer
 * Signature: ()J
 */
JNIEXPORT jlong JNICALL Java_cc_squirreljme_jvm_Assembly_classInfoOfLongPointer
	(JNIEnv* env, jclass classy);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    classInfoOfShort
 * Signature: ()Lcc/squirreljme/jvm/ClassInfo;
 */
JNIEXPORT jobject JNICALL Java_cc_squirreljme_jvm_Assembly_classInfoOfShort
	(JNIEnv* env, jclass classy);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    classInfoOfShortPointer
 * Signature: ()J
 */
JNIEXPORT jlong JNICALL Java_cc_squirreljme_jvm_Assembly_classInfoOfShortPointer
	(JNIEnv* env, jclass classy);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    doublePack
 * Signature: (II)D
 */
JNIEXPORT jdouble JNICALL Java_cc_squirreljme_jvm_Assembly_doublePack
	(JNIEnv* env, jclass classy, jint, jint);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    doubleToRawLongBits
 * Signature: (D)J
 */
JNIEXPORT jlong JNICALL Java_cc_squirreljme_jvm_Assembly_doubleToRawLongBits
	(JNIEnv* env, jclass classy, jdouble);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    doubleUnpackHigh
 * Signature: (D)I
 */
JNIEXPORT jint JNICALL Java_cc_squirreljme_jvm_Assembly_doubleUnpackHigh
	(JNIEnv* env, jclass classy, jdouble);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    doubleUnpackLow
 * Signature: (D)I
 */
JNIEXPORT jint JNICALL Java_cc_squirreljme_jvm_Assembly_doubleUnpackLow
	(JNIEnv* env, jclass classy, jdouble);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    exceptionHandle
 * Signature: ()V
 */
JNIEXPORT void JNICALL Java_cc_squirreljme_jvm_Assembly_exceptionHandle
	(JNIEnv* env, jclass classy);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    floatToRawIntBits
 * Signature: (F)I
 */
JNIEXPORT jint JNICALL Java_cc_squirreljme_jvm_Assembly_floatToRawIntBits
	(JNIEnv* env, jclass classy, jfloat);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    intBitsToFloat
 * Signature: (I)F
 */
JNIEXPORT jfloat JNICALL Java_cc_squirreljme_jvm_Assembly_intBitsToFloat
	(JNIEnv* env, jclass classy, jint);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    invoke
 * Signature: (JJ)V
 */
JNIEXPORT void JNICALL Java_cc_squirreljme_jvm_Assembly_invoke__JJ
	(JNIEnv* env, jclass classy, jlong, jlong);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    invoke
 * Signature: (JJI)V
 */
JNIEXPORT void JNICALL Java_cc_squirreljme_jvm_Assembly_invoke__JJI
	(JNIEnv* env, jclass classy, jlong, jlong, jint);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    invoke
 * Signature: (JJII)V
 */
JNIEXPORT void JNICALL Java_cc_squirreljme_jvm_Assembly_invoke__JJII
	(JNIEnv* env, jclass classy, jlong, jlong, jint, jint);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    invoke
 * Signature: (JJIII)V
 */
JNIEXPORT void JNICALL Java_cc_squirreljme_jvm_Assembly_invoke__JJIII
	(JNIEnv* env, jclass classy, jlong, jlong, jint, jint, jint);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    invoke
 * Signature: (JJIIII)V
 */
JNIEXPORT void JNICALL Java_cc_squirreljme_jvm_Assembly_invoke__JJIIII
	(JNIEnv* env, jclass classy, jlong, jlong, jint, jint, jint, jint);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    invoke
 * Signature: (JJIIIII)V
 */
JNIEXPORT void JNICALL Java_cc_squirreljme_jvm_Assembly_invoke__JJIIIII
	(JNIEnv* env, jclass classy, jlong, jlong, jint, jint, jint, jint, jint);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    invoke
 * Signature: (JJIIIIII)V
 */
JNIEXPORT void JNICALL Java_cc_squirreljme_jvm_Assembly_invoke__JJIIIIII
	(JNIEnv* env, jclass classy, jlong, jlong, jint, jint, jint, jint, jint, jint);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    invoke
 * Signature: (JJIIIIIII)V
 */
JNIEXPORT void JNICALL Java_cc_squirreljme_jvm_Assembly_invoke__JJIIIIIII
	(JNIEnv* env, jclass classy, jlong, jlong, jint, jint, jint, jint, jint, jint, jint);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    invoke
 * Signature: (JJIIIIIIII)V
 */
JNIEXPORT void JNICALL Java_cc_squirreljme_jvm_Assembly_invoke__JJIIIIIIII
	(JNIEnv* env, jclass classy, jlong, jlong, jint, jint, jint, jint, jint, jint, jint, jint);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    invokeV
 * Signature: (JJ)I
 */
JNIEXPORT jint JNICALL Java_cc_squirreljme_jvm_Assembly_invokeV__JJ
	(JNIEnv* env, jclass classy, jlong, jlong);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    invokeV
 * Signature: (JJI)I
 */
JNIEXPORT jint JNICALL Java_cc_squirreljme_jvm_Assembly_invokeV__JJI
	(JNIEnv* env, jclass classy, jlong, jlong, jint);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    invokeV
 * Signature: (JJII)I
 */
JNIEXPORT jint JNICALL Java_cc_squirreljme_jvm_Assembly_invokeV__JJII
	(JNIEnv* env, jclass classy, jlong, jlong, jint, jint);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    invokeV
 * Signature: (JJIII)I
 */
JNIEXPORT jint JNICALL Java_cc_squirreljme_jvm_Assembly_invokeV__JJIII
	(JNIEnv* env, jclass classy, jlong, jlong, jint, jint, jint);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    invokeV
 * Signature: (JJIIII)I
 */
JNIEXPORT jint JNICALL Java_cc_squirreljme_jvm_Assembly_invokeV__JJIIII
	(JNIEnv* env, jclass classy, jlong, jlong, jint, jint, jint, jint);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    invokeV
 * Signature: (JJIIIII)I
 */
JNIEXPORT jint JNICALL Java_cc_squirreljme_jvm_Assembly_invokeV__JJIIIII
	(JNIEnv* env, jclass classy, jlong, jlong, jint, jint, jint, jint, jint);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    invokeV
 * Signature: (JJIIIIII)I
 */
JNIEXPORT jint JNICALL Java_cc_squirreljme_jvm_Assembly_invokeV__JJIIIIII
	(JNIEnv* env, jclass classy, jlong, jlong, jint, jint, jint, jint, jint, jint);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    invokeV
 * Signature: (JJIIIIIII)I
 */
JNIEXPORT jint JNICALL Java_cc_squirreljme_jvm_Assembly_invokeV__JJIIIIIII
	(JNIEnv* env, jclass classy, jlong, jlong, jint, jint, jint, jint, jint, jint, jint);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    invokeV
 * Signature: (JJIIIIIIII)I
 */
JNIEXPORT jint JNICALL Java_cc_squirreljme_jvm_Assembly_invokeV__JJIIIIIIII
	(JNIEnv* env, jclass classy, jlong, jlong, jint, jint, jint, jint, jint, jint, jint, jint);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    invokeVL
 * Signature: (JJ)J
 */
JNIEXPORT jlong JNICALL Java_cc_squirreljme_jvm_Assembly_invokeVL__JJ
	(JNIEnv* env, jclass classy, jlong, jlong);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    invokeVL
 * Signature: (JJI)J
 */
JNIEXPORT jlong JNICALL Java_cc_squirreljme_jvm_Assembly_invokeVL__JJI
	(JNIEnv* env, jclass classy, jlong, jlong, jint);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    invokeVL
 * Signature: (JJII)J
 */
JNIEXPORT jlong JNICALL Java_cc_squirreljme_jvm_Assembly_invokeVL__JJII
	(JNIEnv* env, jclass classy, jlong, jlong, jint, jint);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    invokeVL
 * Signature: (JJIII)J
 */
JNIEXPORT jlong JNICALL Java_cc_squirreljme_jvm_Assembly_invokeVL__JJIII
	(JNIEnv* env, jclass classy, jlong, jlong, jint, jint, jint);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    invokeVL
 * Signature: (JJIIII)J
 */
JNIEXPORT jlong JNICALL Java_cc_squirreljme_jvm_Assembly_invokeVL__JJIIII
	(JNIEnv* env, jclass classy, jlong, jlong, jint, jint, jint, jint);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    invokeVL
 * Signature: (JJIIIII)J
 */
JNIEXPORT jlong JNICALL Java_cc_squirreljme_jvm_Assembly_invokeVL__JJIIIII
	(JNIEnv* env, jclass classy, jlong, jlong, jint, jint, jint, jint, jint);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    invokeVL
 * Signature: (JJIIIIII)J
 */
JNIEXPORT jlong JNICALL Java_cc_squirreljme_jvm_Assembly_invokeVL__JJIIIIII
	(JNIEnv* env, jclass classy, jlong, jlong, jint, jint, jint, jint, jint, jint);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    invokeVL
 * Signature: (JJIIIIIII)J
 */
JNIEXPORT jlong JNICALL Java_cc_squirreljme_jvm_Assembly_invokeVL__JJIIIIIII
	(JNIEnv* env, jclass classy, jlong, jlong, jint, jint, jint, jint, jint, jint, jint);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    invokeVL
 * Signature: (JJIIIIIIII)J
 */
JNIEXPORT jlong JNICALL Java_cc_squirreljme_jvm_Assembly_invokeVL__JJIIIIIIII
	(JNIEnv* env, jclass classy, jlong, jlong, jint, jint, jint, jint, jint, jint, jint, jint);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    longBitsToDouble
 * Signature: (J)D
 */
JNIEXPORT jdouble JNICALL Java_cc_squirreljme_jvm_Assembly_longBitsToDouble
	(JNIEnv* env, jclass classy, jlong);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    longPack
 * Signature: (II)J
 */
JNIEXPORT jlong JNICALL Java_cc_squirreljme_jvm_Assembly_longPack
	(JNIEnv* env, jclass classy, jint, jint);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    longUnpackHigh
 * Signature: (J)I
 */
JNIEXPORT jint JNICALL Java_cc_squirreljme_jvm_Assembly_longUnpackHigh
	(JNIEnv* env, jclass classy, jlong);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    longUnpackLow
 * Signature: (J)I
 */
JNIEXPORT jint JNICALL Java_cc_squirreljme_jvm_Assembly_longUnpackLow
	(JNIEnv* env, jclass classy, jlong);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    memReadByte
 * Signature: (JI)I
 */
JNIEXPORT jint JNICALL Java_cc_squirreljme_jvm_Assembly_memReadByte
	(JNIEnv* env, jclass classy, jlong, jint);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    memReadInt
 * Signature: (JI)I
 */
JNIEXPORT jint JNICALL Java_cc_squirreljme_jvm_Assembly_memReadInt
	(JNIEnv* env, jclass classy, jlong, jint);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    memReadJavaInt
 * Signature: (JI)I
 */
JNIEXPORT jint JNICALL Java_cc_squirreljme_jvm_Assembly_memReadJavaInt
	(JNIEnv* env, jclass classy, jlong, jint);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    memReadJavaLong
 * Signature: (JI)J
 */
JNIEXPORT jlong JNICALL Java_cc_squirreljme_jvm_Assembly_memReadJavaLong
	(JNIEnv* env, jclass classy, jlong, jint);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    memReadJavaShort
 * Signature: (JI)I
 */
JNIEXPORT jint JNICALL Java_cc_squirreljme_jvm_Assembly_memReadJavaShort
	(JNIEnv* env, jclass classy, jlong, jint);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    memReadPointer
 * Signature: (JI)J
 */
JNIEXPORT jlong JNICALL Java_cc_squirreljme_jvm_Assembly_memReadPointer
	(JNIEnv* env, jclass classy, jlong, jint);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    memReadShort
 * Signature: (JI)I
 */
JNIEXPORT jint JNICALL Java_cc_squirreljme_jvm_Assembly_memReadShort
	(JNIEnv* env, jclass classy, jlong, jint);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    memWriteByte
 * Signature: (JII)V
 */
JNIEXPORT void JNICALL Java_cc_squirreljme_jvm_Assembly_memWriteByte
	(JNIEnv* env, jclass classy, jlong, jint, jint);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    memWriteInt
 * Signature: (JII)V
 */
JNIEXPORT void JNICALL Java_cc_squirreljme_jvm_Assembly_memWriteInt
	(JNIEnv* env, jclass classy, jlong, jint, jint);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    memWriteJavaInt
 * Signature: (JII)V
 */
JNIEXPORT void JNICALL Java_cc_squirreljme_jvm_Assembly_memWriteJavaInt
	(JNIEnv* env, jclass classy, jlong, jint, jint);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    memWriteJavaLong
 * Signature: (JIJ)V
 */
JNIEXPORT void JNICALL Java_cc_squirreljme_jvm_Assembly_memWriteJavaLong
	(JNIEnv* env, jclass classy, jlong, jint, jlong);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    memWriteJavaShort
 * Signature: (JII)V
 */
JNIEXPORT void JNICALL Java_cc_squirreljme_jvm_Assembly_memWriteJavaShort
	(JNIEnv* env, jclass classy, jlong, jint, jint);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    memWritePointer
 * Signature: (JIJ)V
 */
JNIEXPORT void JNICALL Java_cc_squirreljme_jvm_Assembly_memWritePointer
	(JNIEnv* env, jclass classy, jlong, jint, jlong);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    memWriteShort
 * Signature: (JII)V
 */
JNIEXPORT void JNICALL Java_cc_squirreljme_jvm_Assembly_memWriteShort
	(JNIEnv* env, jclass classy, jlong, jint, jint);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    monitorCountDecrementAndGetAtomic
 * Signature: (J)I
 */
JNIEXPORT jint JNICALL Java_cc_squirreljme_jvm_Assembly_monitorCountDecrementAndGetAtomic__J
	(JNIEnv* env, jclass classy, jlong);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    monitorCountDecrementAndGetAtomic
 * Signature: (Ljava/lang/Object;)I
 */
JNIEXPORT jint JNICALL Java_cc_squirreljme_jvm_Assembly_monitorCountDecrementAndGetAtomic__Ljava_lang_Object_2
	(JNIEnv* env, jclass classy, jobject);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    monitorCountIncrementAndGetAtomic
 * Signature: (J)I
 */
JNIEXPORT jint JNICALL Java_cc_squirreljme_jvm_Assembly_monitorCountIncrementAndGetAtomic__J
	(JNIEnv* env, jclass classy, jlong);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    monitorCountIncrementAndGetAtomic
 * Signature: (Ljava/lang/Object;)I
 */
JNIEXPORT jint JNICALL Java_cc_squirreljme_jvm_Assembly_monitorCountIncrementAndGetAtomic__Ljava_lang_Object_2
	(JNIEnv* env, jclass classy, jobject);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    monitorCountGetAtomic
 * Signature: (J)I
 */
JNIEXPORT jint JNICALL Java_cc_squirreljme_jvm_Assembly_monitorCountGetAtomic__J
	(JNIEnv* env, jclass classy, jlong);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    monitorCountGetAtomic
 * Signature: (Ljava/lang/Object;)I
 */
JNIEXPORT jint JNICALL Java_cc_squirreljme_jvm_Assembly_monitorCountGetAtomic__Ljava_lang_Object_2
	(JNIEnv* env, jclass classy, jobject);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    monitorCountSetAtomic
 * Signature: (JI)V
 */
JNIEXPORT void JNICALL Java_cc_squirreljme_jvm_Assembly_monitorCountSetAtomic__JI
	(JNIEnv* env, jclass classy, jlong, jint);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    monitorCountSetAtomic
 * Signature: (Ljava/lang/Object;I)V
 */
JNIEXPORT void JNICALL Java_cc_squirreljme_jvm_Assembly_monitorCountSetAtomic__Ljava_lang_Object_2I
	(JNIEnv* env, jclass classy, jobject, jint);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    monitorOwnerCompareGetAndSetAtomic
 * Signature: (JJJ)Ljava/lang/Thread;
 */
JNIEXPORT jobject JNICALL Java_cc_squirreljme_jvm_Assembly_monitorOwnerCompareGetAndSetAtomic__JJJ
	(JNIEnv* env, jclass classy, jlong, jlong, jlong);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    monitorOwnerCompareGetAndSetAtomic
 * Signature: (Ljava/lang/Object;JJ)Ljava/lang/Thread;
 */
JNIEXPORT jobject JNICALL Java_cc_squirreljme_jvm_Assembly_monitorOwnerCompareGetAndSetAtomic__Ljava_lang_Object_2JJ
	(JNIEnv* env, jclass classy, jobject, jlong, jlong);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    monitorOwnerCompareGetAndSetAtomic
 * Signature: (JLjava/lang/Thread;Ljava/lang/Thread;)Ljava/lang/Thread;
 */
JNIEXPORT jobject JNICALL Java_cc_squirreljme_jvm_Assembly_monitorOwnerCompareGetAndSetAtomic__JLjava_lang_Thread_2Ljava_lang_Thread_2
	(JNIEnv* env, jclass classy, jlong, jobject, jobject);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    monitorOwnerCompareGetAndSetAtomic
 * Signature: (Ljava/lang/Object;Ljava/lang/Thread;Ljava/lang/Thread;)Ljava/lang/Thread;
 */
JNIEXPORT jobject JNICALL Java_cc_squirreljme_jvm_Assembly_monitorOwnerCompareGetAndSetAtomic__Ljava_lang_Object_2Ljava_lang_Thread_2Ljava_lang_Thread_2
	(JNIEnv* env, jclass classy, jobject, jobject, jobject);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    monitorOwnerCompareGetAndSetAtomicPointer
 * Signature: (JJJ)J
 */
JNIEXPORT jlong JNICALL Java_cc_squirreljme_jvm_Assembly_monitorOwnerCompareGetAndSetAtomicPointer__JJJ
	(JNIEnv* env, jclass classy, jlong, jlong, jlong);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    monitorOwnerCompareGetAndSetAtomicPointer
 * Signature: (Ljava/lang/Object;JJ)J
 */
JNIEXPORT jlong JNICALL Java_cc_squirreljme_jvm_Assembly_monitorOwnerCompareGetAndSetAtomicPointer__Ljava_lang_Object_2JJ
	(JNIEnv* env, jclass classy, jobject, jlong, jlong);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    monitorOwnerCompareGetAndSetAtomicPointer
 * Signature: (JLjava/lang/Thread;Ljava/lang/Thread;)J
 */
JNIEXPORT jlong JNICALL Java_cc_squirreljme_jvm_Assembly_monitorOwnerCompareGetAndSetAtomicPointer__JLjava_lang_Thread_2Ljava_lang_Thread_2
	(JNIEnv* env, jclass classy, jlong, jobject, jobject);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    monitorOwnerCompareGetAndSetAtomicPointer
 * Signature: (Ljava/lang/Object;Ljava/lang/Thread;Ljava/lang/Thread;)J
 */
JNIEXPORT jlong JNICALL Java_cc_squirreljme_jvm_Assembly_monitorOwnerCompareGetAndSetAtomicPointer__Ljava_lang_Object_2Ljava_lang_Thread_2Ljava_lang_Thread_2
	(JNIEnv* env, jclass classy, jobject, jobject, jobject);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    monitorOwnerGetAtomic
 * Signature: (J)Ljava/lang/Thread;
 */
JNIEXPORT jobject JNICALL Java_cc_squirreljme_jvm_Assembly_monitorOwnerGetAtomic__J
	(JNIEnv* env, jclass classy, jlong);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    monitorOwnerGetAtomic
 * Signature: (Ljava/lang/Object;)Ljava/lang/Thread;
 */
JNIEXPORT jobject JNICALL Java_cc_squirreljme_jvm_Assembly_monitorOwnerGetAtomic__Ljava_lang_Object_2
	(JNIEnv* env, jclass classy, jobject);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    monitorOwnerGetPointerAtomic
 * Signature: (J)J
 */
JNIEXPORT jlong JNICALL Java_cc_squirreljme_jvm_Assembly_monitorOwnerGetPointerAtomic__J
	(JNIEnv* env, jclass classy, jlong);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    monitorOwnerGetPointerAtomic
 * Signature: (Ljava/lang/Object;)J
 */
JNIEXPORT jlong JNICALL Java_cc_squirreljme_jvm_Assembly_monitorOwnerGetPointerAtomic__Ljava_lang_Object_2
	(JNIEnv* env, jclass classy, jobject);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    monitorOwnerSetAtomic
 * Signature: (JJ)V
 */
JNIEXPORT void JNICALL Java_cc_squirreljme_jvm_Assembly_monitorOwnerSetAtomic__JJ
	(JNIEnv* env, jclass classy, jlong, jlong);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    monitorOwnerSetAtomic
 * Signature: (JLjava/lang/Thread;)V
 */
JNIEXPORT void JNICALL Java_cc_squirreljme_jvm_Assembly_monitorOwnerSetAtomic__JLjava_lang_Thread_2
	(JNIEnv* env, jclass classy, jlong, jobject);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    monitorOwnerSetAtomic
 * Signature: (Ljava/lang/Object;J)V
 */
JNIEXPORT void JNICALL Java_cc_squirreljme_jvm_Assembly_monitorOwnerSetAtomic__Ljava_lang_Object_2J
	(JNIEnv* env, jclass classy, jobject, jlong);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    monitorOwnerSetAtomic
 * Signature: (Ljava/lang/Object;Ljava/lang/Thread;)V
 */
JNIEXPORT void JNICALL Java_cc_squirreljme_jvm_Assembly_monitorOwnerSetAtomic__Ljava_lang_Object_2Ljava_lang_Thread_2
	(JNIEnv* env, jclass classy, jobject, jobject);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    objectGetClassInfo
 * Signature: (J)Lcc/squirreljme/jvm/ClassInfo;
 */
JNIEXPORT jobject JNICALL Java_cc_squirreljme_jvm_Assembly_objectGetClassInfo__J
	(JNIEnv* env, jclass classy, jlong);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    objectGetClassInfo
 * Signature: (Ljava/lang/Object;)Lcc/squirreljme/jvm/ClassInfo;
 */
JNIEXPORT jobject JNICALL Java_cc_squirreljme_jvm_Assembly_objectGetClassInfo__Ljava_lang_Object_2
	(JNIEnv* env, jclass classy, jobject);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    objectGetClassInfoPointer
 * Signature: (J)J
 */
JNIEXPORT jlong JNICALL Java_cc_squirreljme_jvm_Assembly_objectGetClassInfoPointer__J
	(JNIEnv* env, jclass classy, jlong);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    objectGetClassInfoPointer
 * Signature: (Ljava/lang/Object;)J
 */
JNIEXPORT jlong JNICALL Java_cc_squirreljme_jvm_Assembly_objectGetClassInfoPointer__Ljava_lang_Object_2
	(JNIEnv* env, jclass classy, jobject);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    objectSetClassInfo
 * Signature: (JJ)V
 */
JNIEXPORT void JNICALL Java_cc_squirreljme_jvm_Assembly_objectSetClassInfo__JJ
	(JNIEnv* env, jclass classy, jlong, jlong);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    objectSetClassInfo
 * Signature: (Ljava/lang/Object;J)V
 */
JNIEXPORT void JNICALL Java_cc_squirreljme_jvm_Assembly_objectSetClassInfo__Ljava_lang_Object_2J
	(JNIEnv* env, jclass classy, jobject, jlong);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    objectSetClassInfo
 * Signature: (JLcc/squirreljme/jvm/ClassInfo;)V
 */
JNIEXPORT void JNICALL Java_cc_squirreljme_jvm_Assembly_objectSetClassInfo__JLcc_squirreljme_jvm_ClassInfo_2
	(JNIEnv* env, jclass classy, jlong, jobject);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    objectSetClassInfo
 * Signature: (Ljava/lang/Object;Lcc/squirreljme/jvm/ClassInfo;)V
 */
JNIEXPORT void JNICALL Java_cc_squirreljme_jvm_Assembly_objectSetClassInfo__Ljava_lang_Object_2Lcc_squirreljme_jvm_ClassInfo_2
	(JNIEnv* env, jclass classy, jobject, jobject);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    objectToPointer
 * Signature: (Ljava/lang/Object;)J
 */
JNIEXPORT jlong JNICALL Java_cc_squirreljme_jvm_Assembly_objectToPointer
	(JNIEnv* env, jclass classy, jobject);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    objectToPointerRefQueue
 * Signature: (Ljava/lang/Object;)J
 */
JNIEXPORT jlong JNICALL Java_cc_squirreljme_jvm_Assembly_objectToPointerRefQueue
	(JNIEnv* env, jclass classy, jobject);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    pointerToObject
 * Signature: (J)Ljava/lang/Object;
 */
JNIEXPORT jobject JNICALL Java_cc_squirreljme_jvm_Assembly_pointerToObject
	(JNIEnv* env, jclass classy, jlong);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    pointerToClassInfo
 * Signature: (J)Lcc/squirreljme/jvm/ClassInfo;
 */
JNIEXPORT jobject JNICALL Java_cc_squirreljme_jvm_Assembly_pointerToClassInfo
	(JNIEnv* env, jclass classy, jlong);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    poolLoad
 * Signature: (JI)J
 */
JNIEXPORT jlong JNICALL Java_cc_squirreljme_jvm_Assembly_poolLoad__JI
	(JNIEnv* env, jclass classy, jlong, jint);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    poolLoad
 * Signature: (Ljava/lang/Object;I)J
 */
JNIEXPORT jlong JNICALL Java_cc_squirreljme_jvm_Assembly_poolLoad__Ljava_lang_Object_2I
	(JNIEnv* env, jclass classy, jobject, jint);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    poolStore
 * Signature: (JIJ)V
 */
JNIEXPORT void JNICALL Java_cc_squirreljme_jvm_Assembly_poolStore__JIJ
	(JNIEnv* env, jclass classy, jlong, jint, jlong);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    poolStore
 * Signature: (Ljava/lang/Object;IJ)V
 */
JNIEXPORT void JNICALL Java_cc_squirreljme_jvm_Assembly_poolStore__Ljava_lang_Object_2IJ
	(JNIEnv* env, jclass classy, jobject, jint, jlong);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    refCount
 * Signature: (J)V
 */
JNIEXPORT void JNICALL Java_cc_squirreljme_jvm_Assembly_refCount__J
	(JNIEnv* env, jclass classy, jlong);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    refCount
 * Signature: (Ljava/lang/Object;)V
 */
JNIEXPORT void JNICALL Java_cc_squirreljme_jvm_Assembly_refCount__Ljava_lang_Object_2
	(JNIEnv* env, jclass classy, jobject);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    refGetCount
 * Signature: (J)I
 */
JNIEXPORT jint JNICALL Java_cc_squirreljme_jvm_Assembly_refGetCount__J
	(JNIEnv* env, jclass classy, jlong);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    refGetCount
 * Signature: (Ljava/lang/Object;)I
 */
JNIEXPORT jint JNICALL Java_cc_squirreljme_jvm_Assembly_refGetCount__Ljava_lang_Object_2
	(JNIEnv* env, jclass classy, jobject);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    refSetCount
 * Signature: (JI)V
 */
JNIEXPORT void JNICALL Java_cc_squirreljme_jvm_Assembly_refSetCount__JI
	(JNIEnv* env, jclass classy, jlong, jint);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    refSetCount
 * Signature: (Ljava/lang/Object;I)V
 */
JNIEXPORT void JNICALL Java_cc_squirreljme_jvm_Assembly_refSetCount__Ljava_lang_Object_2I
	(JNIEnv* env, jclass classy, jobject, jint);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    refUncount
 * Signature: (J)V
 */
JNIEXPORT void JNICALL Java_cc_squirreljme_jvm_Assembly_refUncount__J
	(JNIEnv* env, jclass classy, jlong);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    refUncount
 * Signature: (Ljava/lang/Object;)V
 */
JNIEXPORT void JNICALL Java_cc_squirreljme_jvm_Assembly_refUncount__Ljava_lang_Object_2
	(JNIEnv* env, jclass classy, jobject);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    returnFrame
 * Signature: ()V
 */
JNIEXPORT void JNICALL Java_cc_squirreljme_jvm_Assembly_returnFrame__
	(JNIEnv* env, jclass classy);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    returnFrame
 * Signature: (I)V
 */
JNIEXPORT void JNICALL Java_cc_squirreljme_jvm_Assembly_returnFrame__I
	(JNIEnv* env, jclass classy, jint);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    returnFrame
 * Signature: (II)V
 */
JNIEXPORT void JNICALL Java_cc_squirreljme_jvm_Assembly_returnFrame__II
	(JNIEnv* env, jclass classy, jint, jint);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    returnFrameLong
 * Signature: (J)V
 */
JNIEXPORT void JNICALL Java_cc_squirreljme_jvm_Assembly_returnFrameLong
	(JNIEnv* env, jclass classy, jlong);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    sizeOfBaseArray
 * Signature: ()I
 */
JNIEXPORT jint JNICALL Java_cc_squirreljme_jvm_Assembly_sizeOfBaseArray
	(JNIEnv* env, jclass classy);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    sizeOfBaseObject
 * Signature: ()I
 */
JNIEXPORT jint JNICALL Java_cc_squirreljme_jvm_Assembly_sizeOfBaseObject
	(JNIEnv* env, jclass classy);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    sizeOfPointer
 * Signature: ()I
 */
JNIEXPORT jint JNICALL Java_cc_squirreljme_jvm_Assembly_sizeOfPointer
	(JNIEnv* env, jclass classy);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    specialGetExceptionRegister
 * Signature: ()Ljava/lang/Object;
 */
JNIEXPORT jobject JNICALL Java_cc_squirreljme_jvm_Assembly_specialGetExceptionRegister
	(JNIEnv* env, jclass classy);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    specialGetExceptionRegisterThrowable
 * Signature: ()Ljava/lang/Throwable;
 */
JNIEXPORT jthrowable JNICALL Java_cc_squirreljme_jvm_Assembly_specialGetExceptionRegisterThrowable
	(JNIEnv* env, jclass classy);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    specialGetExceptionRegisterPointer
 * Signature: ()J
 */
JNIEXPORT jlong JNICALL Java_cc_squirreljme_jvm_Assembly_specialGetExceptionRegisterPointer
	(JNIEnv* env, jclass classy);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    specialGetPoolRegister
 * Signature: ()Ljava/lang/Object;
 */
JNIEXPORT jobject JNICALL Java_cc_squirreljme_jvm_Assembly_specialGetPoolRegister
	(JNIEnv* env, jclass classy);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    specialGetPoolRegisterPointer
 * Signature: ()J
 */
JNIEXPORT jlong JNICALL Java_cc_squirreljme_jvm_Assembly_specialGetPoolRegisterPointer
	(JNIEnv* env, jclass classy);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    specialGetReturnRegister
 * Signature: ()I
 */
JNIEXPORT jint JNICALL Java_cc_squirreljme_jvm_Assembly_specialGetReturnRegister
	(JNIEnv* env, jclass classy);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    specialGetReturnRegisterLong
 * Signature: ()J
 */
JNIEXPORT jlong JNICALL Java_cc_squirreljme_jvm_Assembly_specialGetReturnRegisterLong
	(JNIEnv* env, jclass classy);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    specialGetStaticFieldRegister
 * Signature: ()J
 */
JNIEXPORT jlong JNICALL Java_cc_squirreljme_jvm_Assembly_specialGetStaticFieldRegister
	(JNIEnv* env, jclass classy);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    specialGetThreadRegister
 * Signature: ()Ljava/lang/Thread;
 */
JNIEXPORT jobject JNICALL Java_cc_squirreljme_jvm_Assembly_specialGetThreadRegister
	(JNIEnv* env, jclass classy);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    specialGetThreadRegisterPointer
 * Signature: ()J
 */
JNIEXPORT jlong JNICALL Java_cc_squirreljme_jvm_Assembly_specialGetThreadRegisterPointer
	(JNIEnv* env, jclass classy);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    specialSetExceptionRegister
 * Signature: (J)V
 */
JNIEXPORT void JNICALL Java_cc_squirreljme_jvm_Assembly_specialSetExceptionRegister__J
	(JNIEnv* env, jclass classy, jlong);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    specialSetExceptionRegister
 * Signature: (Ljava/lang/Object;)V
 */
JNIEXPORT void JNICALL Java_cc_squirreljme_jvm_Assembly_specialSetExceptionRegister__Ljava_lang_Object_2
	(JNIEnv* env, jclass classy, jobject);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    specialSetPoolRegister
 * Signature: (J)V
 */
JNIEXPORT void JNICALL Java_cc_squirreljme_jvm_Assembly_specialSetPoolRegister__J
	(JNIEnv* env, jclass classy, jlong);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    specialSetPoolRegister
 * Signature: (Ljava/lang/Object;)V
 */
JNIEXPORT void JNICALL Java_cc_squirreljme_jvm_Assembly_specialSetPoolRegister__Ljava_lang_Object_2
	(JNIEnv* env, jclass classy, jobject);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    specialSetStaticFieldRegister
 * Signature: (J)V
 */
JNIEXPORT void JNICALL Java_cc_squirreljme_jvm_Assembly_specialSetStaticFieldRegister
	(JNIEnv* env, jclass classy, jlong);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    specialSetThreadRegister
 * Signature: (J)V
 */
JNIEXPORT void JNICALL Java_cc_squirreljme_jvm_Assembly_specialSetThreadRegister__J
	(JNIEnv* env, jclass classy, jlong);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    specialSetThreadRegister
 * Signature: (Ljava/lang/Thread;)V
 */
JNIEXPORT void JNICALL Java_cc_squirreljme_jvm_Assembly_specialSetThreadRegister__Ljava_lang_Thread_2
	(JNIEnv* env, jclass classy, jobject);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    sysCall
 * Signature: (S)V
 */
JNIEXPORT void JNICALL Java_cc_squirreljme_jvm_Assembly_sysCall__S
	(JNIEnv* env, jclass classy, jshort);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    sysCall
 * Signature: (SI)V
 */
JNIEXPORT void JNICALL Java_cc_squirreljme_jvm_Assembly_sysCall__SI
	(JNIEnv* env, jclass classy, jshort, jint);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    sysCall
 * Signature: (SII)V
 */
JNIEXPORT void JNICALL Java_cc_squirreljme_jvm_Assembly_sysCall__SII
	(JNIEnv* env, jclass classy, jshort, jint, jint);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    sysCall
 * Signature: (SIII)V
 */
JNIEXPORT void JNICALL Java_cc_squirreljme_jvm_Assembly_sysCall__SIII
	(JNIEnv* env, jclass classy, jshort, jint, jint, jint);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    sysCall
 * Signature: (SIIII)V
 */
JNIEXPORT void JNICALL Java_cc_squirreljme_jvm_Assembly_sysCall__SIIII
	(JNIEnv* env, jclass classy, jshort, jint, jint, jint, jint);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    sysCall
 * Signature: (SIIIII)V
 */
JNIEXPORT void JNICALL Java_cc_squirreljme_jvm_Assembly_sysCall__SIIIII
	(JNIEnv* env, jclass classy, jshort, jint, jint, jint, jint, jint);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    sysCall
 * Signature: (SIIIIII)V
 */
JNIEXPORT void JNICALL Java_cc_squirreljme_jvm_Assembly_sysCall__SIIIIII
	(JNIEnv* env, jclass classy, jshort, jint, jint, jint, jint, jint, jint);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    sysCall
 * Signature: (SIIIIIII)V
 */
JNIEXPORT void JNICALL Java_cc_squirreljme_jvm_Assembly_sysCall__SIIIIIII
	(JNIEnv* env, jclass classy, jshort, jint, jint, jint, jint, jint, jint, jint);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    sysCall
 * Signature: (SIIIIIIII)V
 */
JNIEXPORT void JNICALL Java_cc_squirreljme_jvm_Assembly_sysCall__SIIIIIIII
	(JNIEnv* env, jclass classy, jshort, jint, jint, jint, jint, jint, jint, jint, jint);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    sysCallP
 * Signature: (S)V
 */
JNIEXPORT void JNICALL Java_cc_squirreljme_jvm_Assembly_sysCallP__S
	(JNIEnv* env, jclass classy, jshort);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    sysCallP
 * Signature: (SI)V
 */
JNIEXPORT void JNICALL Java_cc_squirreljme_jvm_Assembly_sysCallP__SI
	(JNIEnv* env, jclass classy, jshort, jint);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    sysCallP
 * Signature: (SII)V
 */
JNIEXPORT void JNICALL Java_cc_squirreljme_jvm_Assembly_sysCallP__SII
	(JNIEnv* env, jclass classy, jshort, jint, jint);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    sysCallP
 * Signature: (SIII)V
 */
JNIEXPORT void JNICALL Java_cc_squirreljme_jvm_Assembly_sysCallP__SIII
	(JNIEnv* env, jclass classy, jshort, jint, jint, jint);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    sysCallP
 * Signature: (SIIII)V
 */
JNIEXPORT void JNICALL Java_cc_squirreljme_jvm_Assembly_sysCallP__SIIII
	(JNIEnv* env, jclass classy, jshort, jint, jint, jint, jint);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    sysCallP
 * Signature: (SIIIII)V
 */
JNIEXPORT void JNICALL Java_cc_squirreljme_jvm_Assembly_sysCallP__SIIIII
	(JNIEnv* env, jclass classy, jshort, jint, jint, jint, jint, jint);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    sysCallP
 * Signature: (SIIIIII)V
 */
JNIEXPORT void JNICALL Java_cc_squirreljme_jvm_Assembly_sysCallP__SIIIIII
	(JNIEnv* env, jclass classy, jshort, jint, jint, jint, jint, jint, jint);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    sysCallP
 * Signature: (SIIIIIII)V
 */
JNIEXPORT void JNICALL Java_cc_squirreljme_jvm_Assembly_sysCallP__SIIIIIII
	(JNIEnv* env, jclass classy, jshort, jint, jint, jint, jint, jint, jint, jint);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    sysCallP
 * Signature: (SIIIIIIII)V
 */
JNIEXPORT void JNICALL Java_cc_squirreljme_jvm_Assembly_sysCallP__SIIIIIIII
	(JNIEnv* env, jclass classy, jshort, jint, jint, jint, jint, jint, jint, jint, jint);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    sysCallPV
 * Signature: (S)I
 */
JNIEXPORT jint JNICALL Java_cc_squirreljme_jvm_Assembly_sysCallPV__S
	(JNIEnv* env, jclass classy, jshort);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    sysCallPV
 * Signature: (SI)I
 */
JNIEXPORT jint JNICALL Java_cc_squirreljme_jvm_Assembly_sysCallPV__SI
	(JNIEnv* env, jclass classy, jshort, jint);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    sysCallPV
 * Signature: (SII)I
 */
JNIEXPORT jint JNICALL Java_cc_squirreljme_jvm_Assembly_sysCallPV__SII
	(JNIEnv* env, jclass classy, jshort, jint, jint);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    sysCallPV
 * Signature: (SIII)I
 */
JNIEXPORT jint JNICALL Java_cc_squirreljme_jvm_Assembly_sysCallPV__SIII
	(JNIEnv* env, jclass classy, jshort, jint, jint, jint);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    sysCallPV
 * Signature: (SIIII)I
 */
JNIEXPORT jint JNICALL Java_cc_squirreljme_jvm_Assembly_sysCallPV__SIIII
	(JNIEnv* env, jclass classy, jshort, jint, jint, jint, jint);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    sysCallPV
 * Signature: (SIIIII)I
 */
JNIEXPORT jint JNICALL Java_cc_squirreljme_jvm_Assembly_sysCallPV__SIIIII
	(JNIEnv* env, jclass classy, jshort, jint, jint, jint, jint, jint);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    sysCallPV
 * Signature: (SIIIIII)I
 */
JNIEXPORT jint JNICALL Java_cc_squirreljme_jvm_Assembly_sysCallPV__SIIIIII
	(JNIEnv* env, jclass classy, jshort, jint, jint, jint, jint, jint, jint);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    sysCallPV
 * Signature: (SIIIIIII)I
 */
JNIEXPORT jint JNICALL Java_cc_squirreljme_jvm_Assembly_sysCallPV__SIIIIIII
	(JNIEnv* env, jclass classy, jshort, jint, jint, jint, jint, jint, jint, jint);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    sysCallPV
 * Signature: (SIIIIIIII)I
 */
JNIEXPORT jint JNICALL Java_cc_squirreljme_jvm_Assembly_sysCallPV__SIIIIIIII
	(JNIEnv* env, jclass classy, jshort, jint, jint, jint, jint, jint, jint, jint, jint);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    sysCallPVL
 * Signature: (S)J
 */
JNIEXPORT jlong JNICALL Java_cc_squirreljme_jvm_Assembly_sysCallPVL__S
	(JNIEnv* env, jclass classy, jshort);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    sysCallPVL
 * Signature: (SI)J
 */
JNIEXPORT jlong JNICALL Java_cc_squirreljme_jvm_Assembly_sysCallPVL__SI
	(JNIEnv* env, jclass classy, jshort, jint);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    sysCallPVL
 * Signature: (SII)J
 */
JNIEXPORT jlong JNICALL Java_cc_squirreljme_jvm_Assembly_sysCallPVL__SII
	(JNIEnv* env, jclass classy, jshort, jint, jint);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    sysCallPVL
 * Signature: (SIII)J
 */
JNIEXPORT jlong JNICALL Java_cc_squirreljme_jvm_Assembly_sysCallPVL__SIII
	(JNIEnv* env, jclass classy, jshort, jint, jint, jint);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    sysCallPVL
 * Signature: (SIIII)J
 */
JNIEXPORT jlong JNICALL Java_cc_squirreljme_jvm_Assembly_sysCallPVL__SIIII
	(JNIEnv* env, jclass classy, jshort, jint, jint, jint, jint);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    sysCallPVL
 * Signature: (SIIIII)J
 */
JNIEXPORT jlong JNICALL Java_cc_squirreljme_jvm_Assembly_sysCallPVL__SIIIII
	(JNIEnv* env, jclass classy, jshort, jint, jint, jint, jint, jint);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    sysCallPVL
 * Signature: (SIIIIII)J
 */
JNIEXPORT jlong JNICALL Java_cc_squirreljme_jvm_Assembly_sysCallPVL__SIIIIII
	(JNIEnv* env, jclass classy, jshort, jint, jint, jint, jint, jint, jint);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    sysCallPVL
 * Signature: (SIIIIIII)J
 */
JNIEXPORT jlong JNICALL Java_cc_squirreljme_jvm_Assembly_sysCallPVL__SIIIIIII
	(JNIEnv* env, jclass classy, jshort, jint, jint, jint, jint, jint, jint, jint);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    sysCallPVL
 * Signature: (SIIIIIIII)J
 */
JNIEXPORT jlong JNICALL Java_cc_squirreljme_jvm_Assembly_sysCallPVL__SIIIIIIII
	(JNIEnv* env, jclass classy, jshort, jint, jint, jint, jint, jint, jint, jint, jint);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    sysCallV
 * Signature: (S)I
 */
JNIEXPORT jint JNICALL Java_cc_squirreljme_jvm_Assembly_sysCallV__S
	(JNIEnv* env, jclass classy, jshort);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    sysCallV
 * Signature: (SI)I
 */
JNIEXPORT jint JNICALL Java_cc_squirreljme_jvm_Assembly_sysCallV__SI
	(JNIEnv* env, jclass classy, jshort, jint);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    sysCallV
 * Signature: (SII)I
 */
JNIEXPORT jint JNICALL Java_cc_squirreljme_jvm_Assembly_sysCallV__SII
	(JNIEnv* env, jclass classy, jshort, jint, jint);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    sysCallV
 * Signature: (SIII)I
 */
JNIEXPORT jint JNICALL Java_cc_squirreljme_jvm_Assembly_sysCallV__SIII
	(JNIEnv* env, jclass classy, jshort, jint, jint, jint);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    sysCallV
 * Signature: (SIIII)I
 */
JNIEXPORT jint JNICALL Java_cc_squirreljme_jvm_Assembly_sysCallV__SIIII
	(JNIEnv* env, jclass classy, jshort, jint, jint, jint, jint);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    sysCallV
 * Signature: (SIIIII)I
 */
JNIEXPORT jint JNICALL Java_cc_squirreljme_jvm_Assembly_sysCallV__SIIIII
	(JNIEnv* env, jclass classy, jshort, jint, jint, jint, jint, jint);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    sysCallV
 * Signature: (SIIIIII)I
 */
JNIEXPORT jint JNICALL Java_cc_squirreljme_jvm_Assembly_sysCallV__SIIIIII
	(JNIEnv* env, jclass classy, jshort, jint, jint, jint, jint, jint, jint);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    sysCallV
 * Signature: (SIIIIIII)I
 */
JNIEXPORT jint JNICALL Java_cc_squirreljme_jvm_Assembly_sysCallV__SIIIIIII
	(JNIEnv* env, jclass classy, jshort, jint, jint, jint, jint, jint, jint, jint);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    sysCallV
 * Signature: (SIIIIIIII)I
 */
JNIEXPORT jint JNICALL Java_cc_squirreljme_jvm_Assembly_sysCallV__SIIIIIIII
	(JNIEnv* env, jclass classy, jshort, jint, jint, jint, jint, jint, jint, jint, jint);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    sysCallVL
 * Signature: (S)J
 */
JNIEXPORT jlong JNICALL Java_cc_squirreljme_jvm_Assembly_sysCallVL__S
	(JNIEnv* env, jclass classy, jshort);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    sysCallVL
 * Signature: (SI)J
 */
JNIEXPORT jlong JNICALL Java_cc_squirreljme_jvm_Assembly_sysCallVL__SI
	(JNIEnv* env, jclass classy, jshort, jint);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    sysCallVL
 * Signature: (SII)J
 */
JNIEXPORT jlong JNICALL Java_cc_squirreljme_jvm_Assembly_sysCallVL__SII
	(JNIEnv* env, jclass classy, jshort, jint, jint);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    sysCallVL
 * Signature: (SIII)J
 */
JNIEXPORT jlong JNICALL Java_cc_squirreljme_jvm_Assembly_sysCallVL__SIII
	(JNIEnv* env, jclass classy, jshort, jint, jint, jint);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    sysCallVL
 * Signature: (SIIII)J
 */
JNIEXPORT jlong JNICALL Java_cc_squirreljme_jvm_Assembly_sysCallVL__SIIII
	(JNIEnv* env, jclass classy, jshort, jint, jint, jint, jint);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    sysCallVL
 * Signature: (SIIIII)J
 */
JNIEXPORT jlong JNICALL Java_cc_squirreljme_jvm_Assembly_sysCallVL__SIIIII
	(JNIEnv* env, jclass classy, jshort, jint, jint, jint, jint, jint);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    sysCallVL
 * Signature: (SIIIIII)J
 */
JNIEXPORT jlong JNICALL Java_cc_squirreljme_jvm_Assembly_sysCallVL__SIIIIII
	(JNIEnv* env, jclass classy, jshort, jint, jint, jint, jint, jint, jint);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    sysCallVL
 * Signature: (SIIIIIII)J
 */
JNIEXPORT jlong JNICALL Java_cc_squirreljme_jvm_Assembly_sysCallVL__SIIIIIII
	(JNIEnv* env, jclass classy, jshort, jint, jint, jint, jint, jint, jint, jint);

/*
 * Class:     cc_squirreljme_jvm_Assembly
 * Method:    sysCallVL
 * Signature: (SIIIIIIII)J
 */
JNIEXPORT jlong JNICALL Java_cc_squirreljme_jvm_Assembly_sysCallVL__SIIIIIIII
	(JNIEnv* env, jclass classy, jshort, jint, jint, jint, jint, jint, jint, jint, jint);

#ifdef __cplusplus
}
#endif
#endif

Added emulators/emulator-base/src/main/headers/jni.h.

































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
/*
 * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * This code is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License version 2 only, as
 * published by the Free Software Foundation.  Oracle designates this
 * particular file as subject to the "Classpath" exception as provided
 * by Oracle in the LICENSE file that accompanied this code.
 *
 * This code is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 * version 2 for more details (a copy is included in the LICENSE file that
 * accompanied this code).
 *
 * You should have received a copy of the GNU General Public License version
 * 2 along with this work; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 * or visit www.oracle.com if you need additional information or have any
 * questions.
 */

/*
 * We used part of Netscape's Java Runtime Interface (JRI) as the starting
 * point of our design and implementation.
 */

/******************************************************************************
 * Java Runtime Interface
 * Copyright (c) 1996 Netscape Communications Corporation. All rights reserved.
 *****************************************************************************/

#ifndef _JAVASOFT_JNI_H_
#define _JAVASOFT_JNI_H_

#include <stdio.h>
#include <stdarg.h>

/* jni_md.h contains the machine-dependent typedefs for jbyte, jint
   and jlong */

#if defined(__linux__)
	#include "jni_linux.h"
#elif defined(_WIN32)
	#include "jni_win.h"
#elif defined(__APPLE__)
	#include "jni_mac.h"
#else
	#include "jni_md.h"
#endif

#ifdef __cplusplus
extern "C" {
#endif

/*
 * JNI Types
 */

#ifndef JNI_TYPES_ALREADY_DEFINED_IN_JNI_MD_H

typedef unsigned char   jboolean;
typedef unsigned short  jchar;
typedef short           jshort;
typedef float           jfloat;
typedef double          jdouble;

typedef jint            jsize;

#ifdef __cplusplus

class _jobject {};
class _jclass : public _jobject {};
class _jthrowable : public _jobject {};
class _jstring : public _jobject {};
class _jarray : public _jobject {};
class _jbooleanArray : public _jarray {};
class _jbyteArray : public _jarray {};
class _jcharArray : public _jarray {};
class _jshortArray : public _jarray {};
class _jintArray : public _jarray {};
class _jlongArray : public _jarray {};
class _jfloatArray : public _jarray {};
class _jdoubleArray : public _jarray {};
class _jobjectArray : public _jarray {};

typedef _jobject *jobject;
typedef _jclass *jclass;
typedef _jthrowable *jthrowable;
typedef _jstring *jstring;
typedef _jarray *jarray;
typedef _jbooleanArray *jbooleanArray;
typedef _jbyteArray *jbyteArray;
typedef _jcharArray *jcharArray;
typedef _jshortArray *jshortArray;
typedef _jintArray *jintArray;
typedef _jlongArray *jlongArray;
typedef _jfloatArray *jfloatArray;
typedef _jdoubleArray *jdoubleArray;
typedef _jobjectArray *jobjectArray;

#else

struct _jobject;

typedef struct _jobject *jobject;
typedef jobject jclass;
typedef jobject jthrowable;
typedef jobject jstring;
typedef jobject jarray;
typedef jarray jbooleanArray;
typedef jarray jbyteArray;
typedef jarray jcharArray;
typedef jarray jshortArray;
typedef jarray jintArray;
typedef jarray jlongArray;
typedef jarray jfloatArray;
typedef jarray jdoubleArray;
typedef jarray jobjectArray;

#endif

typedef jobject jweak;

typedef union jvalue {
    jboolean z;
    jbyte    b;
    jchar    c;
    jshort   s;
    jint     i;
    jlong    j;
    jfloat   f;
    jdouble  d;
    jobject  l;
} jvalue;

struct _jfieldID;
typedef struct _jfieldID *jfieldID;

struct _jmethodID;
typedef struct _jmethodID *jmethodID;

/* Return values from jobjectRefType */
typedef enum _jobjectType {
     JNIInvalidRefType    = 0,
     JNILocalRefType      = 1,
     JNIGlobalRefType     = 2,
     JNIWeakGlobalRefType = 3
} jobjectRefType;


#endif /* JNI_TYPES_ALREADY_DEFINED_IN_JNI_MD_H */

/*
 * jboolean constants
 */

#define JNI_FALSE 0
#define JNI_TRUE 1

/*
 * possible return values for JNI functions.
 */

#define JNI_OK           0                 /* success */
#define JNI_ERR          (-1)              /* unknown error */
#define JNI_EDETACHED    (-2)              /* thread detached from the VM */
#define JNI_EVERSION     (-3)              /* JNI version error */
#define JNI_ENOMEM       (-4)              /* not enough memory */
#define JNI_EEXIST       (-5)              /* VM already created */
#define JNI_EINVAL       (-6)              /* invalid arguments */

/*
 * used in ReleaseScalarArrayElements
 */

#define JNI_COMMIT 1
#define JNI_ABORT 2

/*
 * used in RegisterNatives to describe native method name, signature,
 * and function pointer.
 */

typedef struct {
    const char *name;
    const char *signature;
    void *fnPtr;
} JNINativeMethod;

/*
 * JNI Native Method Interface.
 */

struct JNINativeInterface_;

struct JNIEnv_;

#ifdef __cplusplus
typedef JNIEnv_ JNIEnv;
#else
typedef const struct JNINativeInterface_ *JNIEnv;
#endif

/*
 * JNI Invocation Interface.
 */

struct JNIInvokeInterface_;

struct JavaVM_;

#ifdef __cplusplus
typedef JavaVM_ JavaVM;
#else
typedef const struct JNIInvokeInterface_ *JavaVM;
#endif

struct JNINativeInterface_ {
    void *reserved0;
    void *reserved1;
    void *reserved2;

    void *reserved3;
    jint (JNICALL *GetVersion)(JNIEnv *env);

    jclass (JNICALL *DefineClass)
      (JNIEnv *env, const char *name, jobject loader, const jbyte *buf,
       jsize len);
    jclass (JNICALL *FindClass)
      (JNIEnv *env, const char *name);

    jmethodID (JNICALL *FromReflectedMethod)
      (JNIEnv *env, jobject method);
    jfieldID (JNICALL *FromReflectedField)
      (JNIEnv *env, jobject field);

    jobject (JNICALL *ToReflectedMethod)
      (JNIEnv *env, jclass cls, jmethodID methodID, jboolean isStatic);

    jclass (JNICALL *GetSuperclass)
      (JNIEnv *env, jclass sub);
    jboolean (JNICALL *IsAssignableFrom)
      (JNIEnv *env, jclass sub, jclass sup);

    jobject (JNICALL *ToReflectedField)
      (JNIEnv *env, jclass cls, jfieldID fieldID, jboolean isStatic);

    jint (JNICALL *Throw)
      (JNIEnv *env, jthrowable obj);
    jint (JNICALL *ThrowNew)
      (JNIEnv *env, jclass clazz, const char *msg);
    jthrowable (JNICALL *ExceptionOccurred)
      (JNIEnv *env);
    void (JNICALL *ExceptionDescribe)
      (JNIEnv *env);
    void (JNICALL *ExceptionClear)
      (JNIEnv *env);
    void (JNICALL *FatalError)
      (JNIEnv *env, const char *msg);

    jint (JNICALL *PushLocalFrame)
      (JNIEnv *env, jint capacity);
    jobject (JNICALL *PopLocalFrame)
      (JNIEnv *env, jobject result);

    jobject (JNICALL *NewGlobalRef)
      (JNIEnv *env, jobject lobj);
    void (JNICALL *DeleteGlobalRef)
      (JNIEnv *env, jobject gref);
    void (JNICALL *DeleteLocalRef)
      (JNIEnv *env, jobject obj);
    jboolean (JNICALL *IsSameObject)
      (JNIEnv *env, jobject obj1, jobject obj2);
    jobject (JNICALL *NewLocalRef)
      (JNIEnv *env, jobject ref);
    jint (JNICALL *EnsureLocalCapacity)
      (JNIEnv *env, jint capacity);

    jobject (JNICALL *AllocObject)
      (JNIEnv *env, jclass clazz);
    jobject (JNICALL *NewObject)
      (JNIEnv *env, jclass clazz, jmethodID methodID, ...);
    jobject (JNICALL *NewObjectV)
      (JNIEnv *env, jclass clazz, jmethodID methodID, va_list args);
    jobject (JNICALL *NewObjectA)
      (JNIEnv *env, jclass clazz, jmethodID methodID, const jvalue *args);

    jclass (JNICALL *GetObjectClass)
      (JNIEnv *env, jobject obj);
    jboolean (JNICALL *IsInstanceOf)
      (JNIEnv *env, jobject obj, jclass clazz);

    jmethodID (JNICALL *GetMethodID)
      (JNIEnv *env, jclass clazz, const char *name, const char *sig);

    jobject (JNICALL *CallObjectMethod)
      (JNIEnv *env, jobject obj, jmethodID methodID, ...);
    jobject (JNICALL *CallObjectMethodV)
      (JNIEnv *env, jobject obj, jmethodID methodID, va_list args);
    jobject (JNICALL *CallObjectMethodA)
      (JNIEnv *env, jobject obj, jmethodID methodID, const jvalue * args);

    jboolean (JNICALL *CallBooleanMethod)
      (JNIEnv *env, jobject obj, jmethodID methodID, ...);
    jboolean (JNICALL *CallBooleanMethodV)
      (JNIEnv *env, jobject obj, jmethodID methodID, va_list args);
    jboolean (JNICALL *CallBooleanMethodA)
      (JNIEnv *env, jobject obj, jmethodID methodID, const jvalue * args);

    jbyte (JNICALL *CallByteMethod)
      (JNIEnv *env, jobject obj, jmethodID methodID, ...);
    jbyte (JNICALL *CallByteMethodV)
      (JNIEnv *env, jobject obj, jmethodID methodID, va_list args);
    jbyte (JNICALL *CallByteMethodA)
      (JNIEnv *env, jobject obj, jmethodID methodID, const jvalue *args);

    jchar (JNICALL *CallCharMethod)
      (JNIEnv *env, jobject obj, jmethodID methodID, ...);
    jchar (JNICALL *CallCharMethodV)
      (JNIEnv *env, jobject obj, jmethodID methodID, va_list args);
    jchar (JNICALL *CallCharMethodA)
      (JNIEnv *env, jobject obj, jmethodID methodID, const jvalue *args);

    jshort (JNICALL *CallShortMethod)
      (JNIEnv *env, jobject obj, jmethodID methodID, ...);
    jshort (JNICALL *CallShortMethodV)
      (JNIEnv *env, jobject obj, jmethodID methodID, va_list args);
    jshort (JNICALL *CallShortMethodA)
      (JNIEnv *env, jobject obj, jmethodID methodID, const jvalue *args);

    jint (JNICALL *CallIntMethod)
      (JNIEnv *env, jobject obj, jmethodID methodID, ...);
    jint (JNICALL *CallIntMethodV)
      (JNIEnv *env, jobject obj, jmethodID methodID, va_list args);
    jint (JNICALL *CallIntMethodA)
      (JNIEnv *env, jobject obj, jmethodID methodID, const jvalue *args);

    jlong (JNICALL *CallLongMethod)
      (JNIEnv *env, jobject obj, jmethodID methodID, ...);
    jlong (JNICALL *CallLongMethodV)
      (JNIEnv *env, jobject obj, jmethodID methodID, va_list args);
    jlong (JNICALL *CallLongMethodA)
      (JNIEnv *env, jobject obj, jmethodID methodID, const jvalue *args);

    jfloat (JNICALL *CallFloatMethod)
      (JNIEnv *env, jobject obj, jmethodID methodID, ...);
    jfloat (JNICALL *CallFloatMethodV)
      (JNIEnv *env, jobject obj, jmethodID methodID, va_list args);
    jfloat (JNICALL *CallFloatMethodA)
      (JNIEnv *env, jobject obj, jmethodID methodID, const jvalue *args);

    jdouble (JNICALL *CallDoubleMethod)
      (JNIEnv *env, jobject obj, jmethodID methodID, ...);
    jdouble (JNICALL *CallDoubleMethodV)
      (JNIEnv *env, jobject obj, jmethodID methodID, va_list args);
    jdouble (JNICALL *CallDoubleMethodA)
      (JNIEnv *env, jobject obj, jmethodID methodID, const jvalue *args);

    void (JNICALL *CallVoidMethod)
      (JNIEnv *env, jobject obj, jmethodID methodID, ...);
    void (JNICALL *CallVoidMethodV)
      (JNIEnv *env, jobject obj, jmethodID methodID, va_list args);
    void (JNICALL *CallVoidMethodA)
      (JNIEnv *env, jobject obj, jmethodID methodID, const jvalue * args);

    jobject (JNICALL *CallNonvirtualObjectMethod)
      (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, ...);
    jobject (JNICALL *CallNonvirtualObjectMethodV)
      (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
       va_list args);
    jobject (JNICALL *CallNonvirtualObjectMethodA)
      (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
       const jvalue * args);

    jboolean (JNICALL *CallNonvirtualBooleanMethod)
      (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, ...);
    jboolean (JNICALL *CallNonvirtualBooleanMethodV)
      (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
       va_list args);
    jboolean (JNICALL *CallNonvirtualBooleanMethodA)
      (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
       const jvalue * args);

    jbyte (JNICALL *CallNonvirtualByteMethod)
      (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, ...);
    jbyte (JNICALL *CallNonvirtualByteMethodV)
      (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
       va_list args);
    jbyte (JNICALL *CallNonvirtualByteMethodA)
      (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
       const jvalue *args);

    jchar (JNICALL *CallNonvirtualCharMethod)
      (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, ...);
    jchar (JNICALL *CallNonvirtualCharMethodV)
      (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
       va_list args);
    jchar (JNICALL *CallNonvirtualCharMethodA)
      (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
       const jvalue *args);

    jshort (JNICALL *CallNonvirtualShortMethod)
      (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, ...);
    jshort (JNICALL *CallNonvirtualShortMethodV)
      (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
       va_list args);
    jshort (JNICALL *CallNonvirtualShortMethodA)
      (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
       const jvalue *args);

    jint (JNICALL *CallNonvirtualIntMethod)
      (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, ...);
    jint (JNICALL *CallNonvirtualIntMethodV)
      (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
       va_list args);
    jint (JNICALL *CallNonvirtualIntMethodA)
      (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
       const jvalue *args);

    jlong (JNICALL *CallNonvirtualLongMethod)
      (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, ...);
    jlong (JNICALL *CallNonvirtualLongMethodV)
      (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
       va_list args);
    jlong (JNICALL *CallNonvirtualLongMethodA)
      (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
       const jvalue *args);

    jfloat (JNICALL *CallNonvirtualFloatMethod)
      (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, ...);
    jfloat (JNICALL *CallNonvirtualFloatMethodV)
      (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
       va_list args);
    jfloat (JNICALL *CallNonvirtualFloatMethodA)
      (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
       const jvalue *args);

    jdouble (JNICALL *CallNonvirtualDoubleMethod)
      (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, ...);
    jdouble (JNICALL *CallNonvirtualDoubleMethodV)
      (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
       va_list args);
    jdouble (JNICALL *CallNonvirtualDoubleMethodA)
      (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
       const jvalue *args);

    void (JNICALL *CallNonvirtualVoidMethod)
      (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, ...);
    void (JNICALL *CallNonvirtualVoidMethodV)
      (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
       va_list args);
    void (JNICALL *CallNonvirtualVoidMethodA)
      (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
       const jvalue * args);

    jfieldID (JNICALL *GetFieldID)
      (JNIEnv *env, jclass clazz, const char *name, const char *sig);

    jobject (JNICALL *GetObjectField)
      (JNIEnv *env, jobject obj, jfieldID fieldID);
    jboolean (JNICALL *GetBooleanField)
      (JNIEnv *env, jobject obj, jfieldID fieldID);
    jbyte (JNICALL *GetByteField)
      (JNIEnv *env, jobject obj, jfieldID fieldID);
    jchar (JNICALL *GetCharField)
      (JNIEnv *env, jobject obj, jfieldID fieldID);
    jshort (JNICALL *GetShortField)
      (JNIEnv *env, jobject obj, jfieldID fieldID);
    jint (JNICALL *GetIntField)
      (JNIEnv *env, jobject obj, jfieldID fieldID);
    jlong (JNICALL *GetLongField)
      (JNIEnv *env, jobject obj, jfieldID fieldID);
    jfloat (JNICALL *GetFloatField)
      (JNIEnv *env, jobject obj, jfieldID fieldID);
    jdouble (JNICALL *GetDoubleField)
      (JNIEnv *env, jobject obj, jfieldID fieldID);

    void (JNICALL *SetObjectField)
      (JNIEnv *env, jobject obj, jfieldID fieldID, jobject val);
    void (JNICALL *SetBooleanField)
      (JNIEnv *env, jobject obj, jfieldID fieldID, jboolean val);
    void (JNICALL *SetByteField)
      (JNIEnv *env, jobject obj, jfieldID fieldID, jbyte val);
    void (JNICALL *SetCharField)
      (JNIEnv *env, jobject obj, jfieldID fieldID, jchar val);
    void (JNICALL *SetShortField)
      (JNIEnv *env, jobject obj, jfieldID fieldID, jshort val);
    void (JNICALL *SetIntField)
      (JNIEnv *env, jobject obj, jfieldID fieldID, jint val);
    void (JNICALL *SetLongField)
      (JNIEnv *env, jobject obj, jfieldID fieldID, jlong val);
    void (JNICALL *SetFloatField)
      (JNIEnv *env, jobject obj, jfieldID fieldID, jfloat val);
    void (JNICALL *SetDoubleField)
      (JNIEnv *env, jobject obj, jfieldID fieldID, jdouble val);

    jmethodID (JNICALL *GetStaticMethodID)
      (JNIEnv *env, jclass clazz, const char *name, const char *sig);

    jobject (JNICALL *CallStaticObjectMethod)
      (JNIEnv *env, jclass clazz, jmethodID methodID, ...);
    jobject (JNICALL *CallStaticObjectMethodV)
      (JNIEnv *env, jclass clazz, jmethodID methodID, va_list args);
    jobject (JNICALL *CallStaticObjectMethodA)
      (JNIEnv *env, jclass clazz, jmethodID methodID, const jvalue *args);

    jboolean (JNICALL *CallStaticBooleanMethod)
      (JNIEnv *env, jclass clazz, jmethodID methodID, ...);
    jboolean (JNICALL *CallStaticBooleanMethodV)
      (JNIEnv *env, jclass clazz, jmethodID methodID, va_list args);
    jboolean (JNICALL *CallStaticBooleanMethodA)
      (JNIEnv *env, jclass clazz, jmethodID methodID, const jvalue *args);

    jbyte (JNICALL *CallStaticByteMethod)
      (JNIEnv *env, jclass clazz, jmethodID methodID, ...);
    jbyte (JNICALL *CallStaticByteMethodV)
      (JNIEnv *env, jclass clazz, jmethodID methodID, va_list args);
    jbyte (JNICALL *CallStaticByteMethodA)
      (JNIEnv *env, jclass clazz, jmethodID methodID, const jvalue *args);

    jchar (JNICALL *CallStaticCharMethod)
      (JNIEnv *env, jclass clazz, jmethodID methodID, ...);
    jchar (JNICALL *CallStaticCharMethodV)
      (JNIEnv *env, jclass clazz, jmethodID methodID, va_list args);
    jchar (JNICALL *CallStaticCharMethodA)
      (JNIEnv *env, jclass clazz, jmethodID methodID, const jvalue *args);

    jshort (JNICALL *CallStaticShortMethod)
      (JNIEnv *env, jclass clazz, jmethodID methodID, ...);
    jshort (JNICALL *CallStaticShortMethodV)
      (JNIEnv *env, jclass clazz, jmethodID methodID, va_list args);
    jshort (JNICALL *CallStaticShortMethodA)
      (JNIEnv *env, jclass clazz, jmethodID methodID, const jvalue *args);

    jint (JNICALL *CallStaticIntMethod)
      (JNIEnv *env, jclass clazz, jmethodID methodID, ...);
    jint (JNICALL *CallStaticIntMethodV)
      (JNIEnv *env, jclass clazz, jmethodID methodID, va_list args);
    jint (JNICALL *CallStaticIntMethodA)
      (JNIEnv *env, jclass clazz, jmethodID methodID, const jvalue *args);

    jlong (JNICALL *CallStaticLongMethod)
      (JNIEnv *env, jclass clazz, jmethodID methodID, ...);
    jlong (JNICALL *CallStaticLongMethodV)
      (JNIEnv *env, jclass clazz, jmethodID methodID, va_list args);
    jlong (JNICALL *CallStaticLongMethodA)
      (JNIEnv *env, jclass clazz, jmethodID methodID, const jvalue *args);

    jfloat (JNICALL *CallStaticFloatMethod)
      (JNIEnv *env, jclass clazz, jmethodID methodID, ...);
    jfloat (JNICALL *CallStaticFloatMethodV)
      (JNIEnv *env, jclass clazz, jmethodID methodID, va_list args);
    jfloat (JNICALL *CallStaticFloatMethodA)
      (JNIEnv *env, jclass clazz, jmethodID methodID, const jvalue *args);

    jdouble (JNICALL *CallStaticDoubleMethod)
      (JNIEnv *env, jclass clazz, jmethodID methodID, ...);
    jdouble (JNICALL *CallStaticDoubleMethodV)
      (JNIEnv *env, jclass clazz, jmethodID methodID, va_list args);
    jdouble (JNICALL *CallStaticDoubleMethodA)
      (JNIEnv *env, jclass clazz, jmethodID methodID, const jvalue *args);

    void (JNICALL *CallStaticVoidMethod)
      (JNIEnv *env, jclass cls, jmethodID methodID, ...);
    void (JNICALL *CallStaticVoidMethodV)
      (JNIEnv *env, jclass cls, jmethodID methodID, va_list args);
    void (JNICALL *CallStaticVoidMethodA)
      (JNIEnv *env, jclass cls, jmethodID methodID, const jvalue * args);

    jfieldID (JNICALL *GetStaticFieldID)
      (JNIEnv *env, jclass clazz, const char *name, const char *sig);
    jobject (JNICALL *GetStaticObjectField)
      (JNIEnv *env, jclass clazz, jfieldID fieldID);
    jboolean (JNICALL *GetStaticBooleanField)
      (JNIEnv *env, jclass clazz, jfieldID fieldID);
    jbyte (JNICALL *GetStaticByteField)
      (JNIEnv *env, jclass clazz, jfieldID fieldID);
    jchar (JNICALL *GetStaticCharField)
      (JNIEnv *env, jclass clazz, jfieldID fieldID);
    jshort (JNICALL *GetStaticShortField)
      (JNIEnv *env, jclass clazz, jfieldID fieldID);
    jint (JNICALL *GetStaticIntField)
      (JNIEnv *env, jclass clazz, jfieldID fieldID);
    jlong (JNICALL *GetStaticLongField)
      (JNIEnv *env, jclass clazz, jfieldID fieldID);
    jfloat (JNICALL *GetStaticFloatField)
      (JNIEnv *env, jclass clazz, jfieldID fieldID);
    jdouble (JNICALL *GetStaticDoubleField)
      (JNIEnv *env, jclass clazz, jfieldID fieldID);

    void (JNICALL *SetStaticObjectField)
      (JNIEnv *env, jclass clazz, jfieldID fieldID, jobject value);
    void (JNICALL *SetStaticBooleanField)
      (JNIEnv *env, jclass clazz, jfieldID fieldID, jboolean value);
    void (JNICALL *SetStaticByteField)
      (JNIEnv *env, jclass clazz, jfieldID fieldID, jbyte value);
    void (JNICALL *SetStaticCharField)
      (JNIEnv *env, jclass clazz, jfieldID fieldID, jchar value);
    void (JNICALL *SetStaticShortField)
      (JNIEnv *env, jclass clazz, jfieldID fieldID, jshort value);
    void (JNICALL *SetStaticIntField)
      (JNIEnv *env, jclass clazz, jfieldID fieldID, jint value);
    void (JNICALL *SetStaticLongField)
      (JNIEnv *env, jclass clazz, jfieldID fieldID, jlong value);
    void (JNICALL *SetStaticFloatField)
      (JNIEnv *env, jclass clazz, jfieldID fieldID, jfloat value);
    void (JNICALL *SetStaticDoubleField)
      (JNIEnv *env, jclass clazz, jfieldID fieldID, jdouble value);

    jstring (JNICALL *NewString)
      (JNIEnv *env, const jchar *unicode, jsize len);
    jsize (JNICALL *GetStringLength)
      (JNIEnv *env, jstring str);
    const jchar *(JNICALL *GetStringChars)
      (JNIEnv *env, jstring str, jboolean *isCopy);
    void (JNICALL *ReleaseStringChars)
      (JNIEnv *env, jstring str, const jchar *chars);

    jstring (JNICALL *NewStringUTF)
      (JNIEnv *env, const char *utf);
    jsize (JNICALL *GetStringUTFLength)
      (JNIEnv *env, jstring str);
    const char* (JNICALL *GetStringUTFChars)
      (JNIEnv *env, jstring str, jboolean *isCopy);
    void (JNICALL *ReleaseStringUTFChars)
      (JNIEnv *env, jstring str, const char* chars);


    jsize (JNICALL *GetArrayLength)
      (JNIEnv *env, jarray array);

    jobjectArray (JNICALL *NewObjectArray)
      (JNIEnv *env, jsize len, jclass clazz, jobject init);
    jobject (JNICALL *GetObjectArrayElement)
      (JNIEnv *env, jobjectArray array, jsize index);
    void (JNICALL *SetObjectArrayElement)
      (JNIEnv *env, jobjectArray array, jsize index, jobject val);

    jbooleanArray (JNICALL *NewBooleanArray)
      (JNIEnv *env, jsize len);
    jbyteArray (JNICALL *NewByteArray)
      (JNIEnv *env, jsize len);
    jcharArray (JNICALL *NewCharArray)
      (JNIEnv *env, jsize len);
    jshortArray (JNICALL *NewShortArray)
      (JNIEnv *env, jsize len);
    jintArray (JNICALL *NewIntArray)
      (JNIEnv *env, jsize len);
    jlongArray (JNICALL *NewLongArray)
      (JNIEnv *env, jsize len);
    jfloatArray (JNICALL *NewFloatArray)
      (JNIEnv *env, jsize len);
    jdoubleArray (JNICALL *NewDoubleArray)
      (JNIEnv *env, jsize len);

    jboolean * (JNICALL *GetBooleanArrayElements)
      (JNIEnv *env, jbooleanArray array, jboolean *isCopy);
    jbyte * (JNICALL *GetByteArrayElements)
      (JNIEnv *env, jbyteArray array, jboolean *isCopy);
    jchar * (JNICALL *GetCharArrayElements)
      (JNIEnv *env, jcharArray array, jboolean *isCopy);
    jshort * (JNICALL *GetShortArrayElements)
      (JNIEnv *env, jshortArray array, jboolean *isCopy);
    jint * (JNICALL *GetIntArrayElements)
      (JNIEnv *env, jintArray array, jboolean *isCopy);
    jlong * (JNICALL *GetLongArrayElements)
      (JNIEnv *env, jlongArray array, jboolean *isCopy);
    jfloat * (JNICALL *GetFloatArrayElements)
      (JNIEnv *env, jfloatArray array, jboolean *isCopy);
    jdouble * (JNICALL *GetDoubleArrayElements)
      (JNIEnv *env, jdoubleArray array, jboolean *isCopy);

    void (JNICALL *ReleaseBooleanArrayElements)
      (JNIEnv *env, jbooleanArray array, jboolean *elems, jint mode);
    void (JNICALL *ReleaseByteArrayElements)
      (JNIEnv *env, jbyteArray array, jbyte *elems, jint mode);
    void (JNICALL *ReleaseCharArrayElements)
      (JNIEnv *env, jcharArray array, jchar *elems, jint mode);
    void (JNICALL *ReleaseShortArrayElements)
      (JNIEnv *env, jshortArray array, jshort *elems, jint mode);
    void (JNICALL *ReleaseIntArrayElements)
      (JNIEnv *env, jintArray array, jint *elems, jint mode);
    void (JNICALL *ReleaseLongArrayElements)
      (JNIEnv *env, jlongArray array, jlong *elems, jint mode);
    void (JNICALL *ReleaseFloatArrayElements)
      (JNIEnv *env, jfloatArray array, jfloat *elems, jint mode);
    void (JNICALL *ReleaseDoubleArrayElements)
      (JNIEnv *env, jdoubleArray array, jdouble *elems, jint mode);

    void (JNICALL *GetBooleanArrayRegion)
      (JNIEnv *env, jbooleanArray array, jsize start, jsize l, jboolean *buf);
    void (JNICALL *GetByteArrayRegion)
      (JNIEnv *env, jbyteArray array, jsize start, jsize len, jbyte *buf);
    void (JNICALL *GetCharArrayRegion)
      (JNIEnv *env, jcharArray array, jsize start, jsize len, jchar *buf);
    void (JNICALL *GetShortArrayRegion)
      (JNIEnv *env, jshortArray array, jsize start, jsize len, jshort *buf);
    void (JNICALL *GetIntArrayRegion)
      (JNIEnv *env, jintArray array, jsize start, jsize len, jint *buf);
    void (JNICALL *GetLongArrayRegion)
      (JNIEnv *env, jlongArray array, jsize start, jsize len, jlong *buf);
    void (JNICALL *GetFloatArrayRegion)
      (JNIEnv *env, jfloatArray array, jsize start, jsize len, jfloat *buf);
    void (JNICALL *GetDoubleArrayRegion)
      (JNIEnv *env, jdoubleArray array, jsize start, jsize len, jdouble *buf);

    void (JNICALL *SetBooleanArrayRegion)
      (JNIEnv *env, jbooleanArray array, jsize start, jsize l, const jboolean *buf);
    void (JNICALL *SetByteArrayRegion)
      (JNIEnv *env, jbyteArray array, jsize start, jsize len, const jbyte *buf);
    void (JNICALL *SetCharArrayRegion)
      (JNIEnv *env, jcharArray array, jsize start, jsize len, const jchar *buf);
    void (JNICALL *SetShortArrayRegion)
      (JNIEnv *env, jshortArray array, jsize start, jsize len, const jshort *buf);
    void (JNICALL *SetIntArrayRegion)
      (JNIEnv *env, jintArray array, jsize start, jsize len, const jint *buf);
    void (JNICALL *SetLongArrayRegion)
      (JNIEnv *env, jlongArray array, jsize start, jsize len, const jlong *buf);
    void (JNICALL *SetFloatArrayRegion)
      (JNIEnv *env, jfloatArray array, jsize start, jsize len, const jfloat *buf);
    void (JNICALL *SetDoubleArrayRegion)
      (JNIEnv *env, jdoubleArray array, jsize start, jsize len, const jdouble *buf);

    jint (JNICALL *RegisterNatives)
      (JNIEnv *env, jclass clazz, const JNINativeMethod *methods,
       jint nMethods);
    jint (JNICALL *UnregisterNatives)
      (JNIEnv *env, jclass clazz);

    jint (JNICALL *MonitorEnter)
      (JNIEnv *env, jobject obj);
    jint (JNICALL *MonitorExit)
      (JNIEnv *env, jobject obj);

    jint (JNICALL *GetJavaVM)
      (JNIEnv *env, JavaVM **vm);

    void (JNICALL *GetStringRegion)
      (JNIEnv *env, jstring str, jsize start, jsize len, jchar *buf);
    void (JNICALL *GetStringUTFRegion)
      (JNIEnv *env, jstring str, jsize start, jsize len, char *buf);

    void * (JNICALL *GetPrimitiveArrayCritical)
      (JNIEnv *env, jarray array, jboolean *isCopy);
    void (JNICALL *ReleasePrimitiveArrayCritical)
      (JNIEnv *env, jarray array, void *carray, jint mode);

    const jchar * (JNICALL *GetStringCritical)
      (JNIEnv *env, jstring string, jboolean *isCopy);
    void (JNICALL *ReleaseStringCritical)
      (JNIEnv *env, jstring string, const jchar *cstring);

    jweak (JNICALL *NewWeakGlobalRef)
       (JNIEnv *env, jobject obj);
    void (JNICALL *DeleteWeakGlobalRef)
       (JNIEnv *env, jweak ref);

    jboolean (JNICALL *ExceptionCheck)
       (JNIEnv *env);

    jobject (JNICALL *NewDirectByteBuffer)
       (JNIEnv* env, void* address, jlong capacity);
    void* (JNICALL *GetDirectBufferAddress)
       (JNIEnv* env, jobject buf);
    jlong (JNICALL *GetDirectBufferCapacity)
       (JNIEnv* env, jobject buf);

    /* New JNI 1.6 Features */

    jobjectRefType (JNICALL *GetObjectRefType)
        (JNIEnv* env, jobject obj);
};

/*
 * We use inlined functions for C++ so that programmers can write:
 *
 *    env->FindClass("java/lang/String")
 *
 * in C++ rather than:
 *
 *    (*env)->FindClass(env, "java/lang/String")
 *
 * in C.
 */

struct JNIEnv_ {
    const struct JNINativeInterface_ *functions;
#ifdef __cplusplus

    jint GetVersion() {
        return functions->GetVersion(this);
    }
    jclass DefineClass(const char *name, jobject loader, const jbyte *buf,
                       jsize len) {
        return functions->DefineClass(this, name, loader, buf, len);
    }
    jclass FindClass(const char *name) {
        return functions->FindClass(this, name);
    }
    jmethodID FromReflectedMethod(jobject method) {
        return functions->FromReflectedMethod(this,method);
    }
    jfieldID FromReflectedField(jobject field) {
        return functions->FromReflectedField(this,field);
    }

    jobject ToReflectedMethod(jclass cls, jmethodID methodID, jboolean isStatic) {
        return functions->ToReflectedMethod(this, cls, methodID, isStatic);
    }

    jclass GetSuperclass(jclass sub) {
        return functions->GetSuperclass(this, sub);
    }
    jboolean IsAssignableFrom(jclass sub, jclass sup) {
        return functions->IsAssignableFrom(this, sub, sup);
    }

    jobject ToReflectedField(jclass cls, jfieldID fieldID, jboolean isStatic) {
        return functions->ToReflectedField(this,cls,fieldID,isStatic);
    }

    jint Throw(jthrowable obj) {
        return functions->Throw(this, obj);
    }
    jint ThrowNew(jclass clazz, const char *msg) {
        return functions->ThrowNew(this, clazz, msg);
    }
    jthrowable ExceptionOccurred() {
        return functions->ExceptionOccurred(this);
    }
    void ExceptionDescribe() {
        functions->ExceptionDescribe(this);
    }
    void ExceptionClear() {
        functions->ExceptionClear(this);
    }
    void FatalError(const char *msg) {
        functions->FatalError(this, msg);
    }

    jint PushLocalFrame(jint capacity) {
        return functions->PushLocalFrame(this,capacity);
    }
    jobject PopLocalFrame(jobject result) {
        return functions->PopLocalFrame(this,result);
    }

    jobject NewGlobalRef(jobject lobj) {
        return functions->NewGlobalRef(this,lobj);
    }
    void DeleteGlobalRef(jobject gref) {
        functions->DeleteGlobalRef(this,gref);
    }
    void DeleteLocalRef(jobject obj) {
        functions->DeleteLocalRef(this, obj);
    }

    jboolean IsSameObject(jobject obj1, jobject obj2) {
        return functions->IsSameObject(this,obj1,obj2);
    }

    jobject NewLocalRef(jobject ref) {
        return functions->NewLocalRef(this,ref);
    }
    jint EnsureLocalCapacity(jint capacity) {
        return functions->EnsureLocalCapacity(this,capacity);
    }

    jobject AllocObject(jclass clazz) {
        return functions->AllocObject(this,clazz);
    }
    jobject NewObject(jclass clazz, jmethodID methodID, ...) {
        va_list args;
        jobject result;
        va_start(args, methodID);
        result = functions->NewObjectV(this,clazz,methodID,args);
        va_end(args);
        return result;
    }
    jobject NewObjectV(jclass clazz, jmethodID methodID,
                       va_list args) {
        return functions->NewObjectV(this,clazz,methodID,args);
    }
    jobject NewObjectA(jclass clazz, jmethodID methodID,
                       const jvalue *args) {
        return functions->NewObjectA(this,clazz,methodID,args);
    }

    jclass GetObjectClass(jobject obj) {
        return functions->GetObjectClass(this,obj);
    }
    jboolean IsInstanceOf(jobject obj, jclass clazz) {
        return functions->IsInstanceOf(this,obj,clazz);
    }

    jmethodID GetMethodID(jclass clazz, const char *name,
                          const char *sig) {
        return functions->GetMethodID(this,clazz,name,sig);
    }

    jobject CallObjectMethod(jobject obj, jmethodID methodID, ...) {
        va_list args;
        jobject result;
        va_start(args,methodID);
        result = functions->CallObjectMethodV(this,obj,methodID,args);
        va_end(args);
        return result;
    }
    jobject CallObjectMethodV(jobject obj, jmethodID methodID,
                        va_list args) {
        return functions->CallObjectMethodV(this,obj,methodID,args);
    }
    jobject CallObjectMethodA(jobject obj, jmethodID methodID,
                        const jvalue * args) {
        return functions->CallObjectMethodA(this,obj,methodID,args);
    }

    jboolean CallBooleanMethod(jobject obj,
                               jmethodID methodID, ...) {
        va_list args;
        jboolean result;
        va_start(args,methodID);
        result = functions->CallBooleanMethodV(this,obj,methodID,args);
        va_end(args);
        return result;
    }
    jboolean CallBooleanMethodV(jobject obj, jmethodID methodID,
                                va_list args) {
        return functions->CallBooleanMethodV(this,obj,methodID,args);
    }
    jboolean CallBooleanMethodA(jobject obj, jmethodID methodID,
                                const jvalue * args) {
        return functions->CallBooleanMethodA(this,obj,methodID, args);
    }

    jbyte CallByteMethod(jobject obj, jmethodID methodID, ...) {
        va_list args;
        jbyte result;
        va_start(args,methodID);
        result = functions->CallByteMethodV(this,obj,methodID,args);
        va_end(args);
        return result;
    }
    jbyte CallByteMethodV(jobject obj, jmethodID methodID,
                          va_list args) {
        return functions->CallByteMethodV(this,obj,methodID,args);
    }
    jbyte CallByteMethodA(jobject obj, jmethodID methodID,
                          const jvalue * args) {
        return functions->CallByteMethodA(this,obj,methodID,args);
    }

    jchar CallCharMethod(jobject obj, jmethodID methodID, ...) {
        va_list args;
        jchar result;
        va_start(args,methodID);
        result = functions->CallCharMethodV(this,obj,methodID,args);
        va_end(args);
        return result;
    }
    jchar CallCharMethodV(jobject obj, jmethodID methodID,
                          va_list args) {
        return functions->CallCharMethodV(this,obj,methodID,args);
    }
    jchar CallCharMethodA(jobject obj, jmethodID methodID,
                          const jvalue * args) {
        return functions->CallCharMethodA(this,obj,methodID,args);
    }

    jshort CallShortMethod(jobject obj, jmethodID methodID, ...) {
        va_list args;
        jshort result;
        va_start(args,methodID);
        result = functions->CallShortMethodV(this,obj,methodID,args);
        va_end(args);
        return result;
    }
    jshort CallShortMethodV(jobject obj, jmethodID methodID,
                            va_list args) {
        return functions->CallShortMethodV(this,obj,methodID,args);
    }
    jshort CallShortMethodA(jobject obj, jmethodID methodID,
                            const jvalue * args) {
        return functions->CallShortMethodA(this,obj,methodID,args);
    }

    jint CallIntMethod(jobject obj, jmethodID methodID, ...) {
        va_list args;
        jint result;
        va_start(args,methodID);
        result = functions->CallIntMethodV(this,obj,methodID,args);
        va_end(args);
        return result;
    }
    jint CallIntMethodV(jobject obj, jmethodID methodID,
                        va_list args) {
        return functions->CallIntMethodV(this,obj,methodID,args);
    }
    jint CallIntMethodA(jobject obj, jmethodID methodID,
                        const jvalue * args) {
        return functions->CallIntMethodA(this,obj,methodID,args);
    }

    jlong CallLongMethod(jobject obj, jmethodID methodID, ...) {
        va_list args;
        jlong result;
        va_start(args,methodID);
        result = functions->CallLongMethodV(this,obj,methodID,args);
        va_end(args);
        return result;
    }
    jlong CallLongMethodV(jobject obj, jmethodID methodID,
                          va_list args) {
        return functions->CallLongMethodV(this,obj,methodID,args);
    }
    jlong CallLongMethodA(jobject obj, jmethodID methodID,
                          const jvalue * args) {
        return functions->CallLongMethodA(this,obj,methodID,args);
    }

    jfloat CallFloatMethod(jobject obj, jmethodID methodID, ...) {
        va_list args;
        jfloat result;
        va_start(args,methodID);
        result = functions->CallFloatMethodV(this,obj,methodID,args);
        va_end(args);
        return result;
    }
    jfloat CallFloatMethodV(jobject obj, jmethodID methodID,
                            va_list args) {
        return functions->CallFloatMethodV(this,obj,methodID,args);
    }
    jfloat CallFloatMethodA(jobject obj, jmethodID methodID,
                            const jvalue * args) {
        return functions->CallFloatMethodA(this,obj,methodID,args);
    }

    jdouble CallDoubleMethod(jobject obj, jmethodID methodID, ...) {
        va_list args;
        jdouble result;
        va_start(args,methodID);
        result = functions->CallDoubleMethodV(this,obj,methodID,args);
        va_end(args);
        return result;
    }
    jdouble CallDoubleMethodV(jobject obj, jmethodID methodID,
                        va_list args) {
        return functions->CallDoubleMethodV(this,obj,methodID,args);
    }
    jdouble CallDoubleMethodA(jobject obj, jmethodID methodID,
                        const jvalue * args) {
        return functions->CallDoubleMethodA(this,obj,methodID,args);
    }

    void CallVoidMethod(jobject obj, jmethodID methodID, ...) {
        va_list args;
        va_start(args,methodID);
        functions->CallVoidMethodV(this,obj,methodID,args);
        va_end(args);
    }
    void CallVoidMethodV(jobject obj, jmethodID methodID,
                         va_list args) {
        functions->CallVoidMethodV(this,obj,methodID,args);
    }
    void CallVoidMethodA(jobject obj, jmethodID methodID,
                         const jvalue * args) {
        functions->CallVoidMethodA(this,obj,methodID,args);
    }

    jobject CallNonvirtualObjectMethod(jobject obj, jclass clazz,
                                       jmethodID methodID, ...) {
        va_list args;
        jobject result;
        va_start(args,methodID);
        result = functions->CallNonvirtualObjectMethodV(this,obj,clazz,
                                                        methodID,args);
        va_end(args);
        return result;
    }
    jobject CallNonvirtualObjectMethodV(jobject obj, jclass clazz,
                                        jmethodID methodID, va_list args) {
        return functions->CallNonvirtualObjectMethodV(this,obj,clazz,
                                                      methodID,args);
    }
    jobject CallNonvirtualObjectMethodA(jobject obj, jclass clazz,
                                        jmethodID methodID, const jvalue * args) {
        return functions->CallNonvirtualObjectMethodA(this,obj,clazz,
                                                      methodID,args);
    }

    jboolean CallNonvirtualBooleanMethod(jobject obj, jclass clazz,
                                         jmethodID methodID, ...) {
        va_list args;
        jboolean result;
        va_start(args,methodID);
        result = functions->CallNonvirtualBooleanMethodV(this,obj,clazz,
                                                         methodID,args);
        va_end(args);
        return result;
    }
    jboolean CallNonvirtualBooleanMethodV(jobject obj, jclass clazz,
                                          jmethodID methodID, va_list args) {
        return functions->CallNonvirtualBooleanMethodV(this,obj,clazz,
                                                       methodID,args);
    }
    jboolean CallNonvirtualBooleanMethodA(jobject obj, jclass clazz,
                                          jmethodID methodID, const jvalue * args) {
        return functions->CallNonvirtualBooleanMethodA(this,obj,clazz,
                                                       methodID, args);
    }

    jbyte CallNonvirtualByteMethod(jobject obj, jclass clazz,
                                   jmethodID methodID, ...) {
        va_list args;
        jbyte result;
        va_start(args,methodID);
        result = functions->CallNonvirtualByteMethodV(this,obj,clazz,
                                                      methodID,args);
        va_end(args);
        return result;
    }
    jbyte CallNonvirtualByteMethodV(jobject obj, jclass clazz,
                                    jmethodID methodID, va_list args) {
        return functions->CallNonvirtualByteMethodV(this,obj,clazz,
                                                    methodID,args);
    }
    jbyte CallNonvirtualByteMethodA(jobject obj, jclass clazz,
                                    jmethodID methodID, const jvalue * args) {
        return functions->CallNonvirtualByteMethodA(this,obj,clazz,
                                                    methodID,args);
    }

    jchar CallNonvirtualCharMethod(jobject obj, jclass clazz,
                                   jmethodID methodID, ...) {
        va_list args;
        jchar result;
        va_start(args,methodID);
        result = functions->CallNonvirtualCharMethodV(this,obj,clazz,
                                                      methodID,args);
        va_end(args);
        return result;
    }
    jchar CallNonvirtualCharMethodV(jobject obj, jclass clazz,
                                    jmethodID methodID, va_list args) {
        return functions->CallNonvirtualCharMethodV(this,obj,clazz,
                                                    methodID,args);
    }
    jchar CallNonvirtualCharMethodA(jobject obj, jclass clazz,
                                    jmethodID methodID, const jvalue * args) {
        return functions->CallNonvirtualCharMethodA(this,obj,clazz,
                                                    methodID,args);
    }

    jshort CallNonvirtualShortMethod(jobject obj, jclass clazz,
                                     jmethodID methodID, ...) {
        va_list args;
        jshort result;
        va_start(args,methodID);
        result = functions->CallNonvirtualShortMethodV(this,obj,clazz,
                                                       methodID,args);
        va_end(args);
        return result;
    }
    jshort CallNonvirtualShortMethodV(jobject obj, jclass clazz,
                                      jmethodID methodID, va_list args) {
        return functions->CallNonvirtualShortMethodV(this,obj,clazz,
                                                     methodID,args);
    }
    jshort CallNonvirtualShortMethodA(jobject obj, jclass clazz,
                                      jmethodID methodID, const jvalue * args) {
        return functions->CallNonvirtualShortMethodA(this,obj,clazz,
                                                     methodID,args);
    }

    jint CallNonvirtualIntMethod(jobject obj, jclass clazz,
                                 jmethodID methodID, ...) {
        va_list args;
        jint result;
        va_start(args,methodID);
        result = functions->CallNonvirtualIntMethodV(this,obj,clazz,
                                                     methodID,args);
        va_end(args);
        return result;
    }
    jint CallNonvirtualIntMethodV(jobject obj, jclass clazz,
                                  jmethodID methodID, va_list args) {
        return functions->CallNonvirtualIntMethodV(this,obj,clazz,
                                                   methodID,args);
    }
    jint CallNonvirtualIntMethodA(jobject obj, jclass clazz,
                                  jmethodID methodID, const jvalue * args) {
        return functions->CallNonvirtualIntMethodA(this,obj,clazz,
                                                   methodID,args);
    }

    jlong CallNonvirtualLongMethod(jobject obj, jclass clazz,
                                   jmethodID methodID, ...) {
        va_list args;
        jlong result;
        va_start(args,methodID);
        result = functions->CallNonvirtualLongMethodV(this,obj,clazz,
                                                      methodID,args);
        va_end(args);
        return result;
    }
    jlong CallNonvirtualLongMethodV(jobject obj, jclass clazz,
                                    jmethodID methodID, va_list args) {
        return functions->CallNonvirtualLongMethodV(this,obj,clazz,
                                                    methodID,args);
    }
    jlong CallNonvirtualLongMethodA(jobject obj, jclass clazz,
                                    jmethodID methodID, const jvalue * args) {
        return functions->CallNonvirtualLongMethodA(this,obj,clazz,
                                                    methodID,args);
    }

    jfloat CallNonvirtualFloatMethod(jobject obj, jclass clazz,
                                     jmethodID methodID, ...) {
        va_list args;
        jfloat result;
        va_start(args,methodID);
        result = functions->CallNonvirtualFloatMethodV(this,obj,clazz,
                                                       methodID,args);
        va_end(args);
        return result;
    }
    jfloat CallNonvirtualFloatMethodV(jobject obj, jclass clazz,
                                      jmethodID methodID,
                                      va_list args) {
        return functions->CallNonvirtualFloatMethodV(this,obj,clazz,
                                                     methodID,args);
    }
    jfloat CallNonvirtualFloatMethodA(jobject obj, jclass clazz,
                                      jmethodID methodID,
                                      const jvalue * args) {
        return functions->CallNonvirtualFloatMethodA(this,obj,clazz,
                                                     methodID,args);
    }

    jdouble CallNonvirtualDoubleMethod(jobject obj, jclass clazz,
                                       jmethodID methodID, ...) {
        va_list args;
        jdouble result;
        va_start(args,methodID);
        result = functions->CallNonvirtualDoubleMethodV(this,obj,clazz,
                                                        methodID,args);
        va_end(args);
        return result;
    }
    jdouble CallNonvirtualDoubleMethodV(jobject obj, jclass clazz,
                                        jmethodID methodID,
                                        va_list args) {
        return functions->CallNonvirtualDoubleMethodV(this,obj,clazz,
                                                      methodID,args);
    }
    jdouble CallNonvirtualDoubleMethodA(jobject obj, jclass clazz,
                                        jmethodID methodID,
                                        const jvalue * args) {
        return functions->CallNonvirtualDoubleMethodA(this,obj,clazz,
                                                      methodID,args);
    }

    void CallNonvirtualVoidMethod(jobject obj, jclass clazz,
                                  jmethodID methodID, ...) {
        va_list args;
        va_start(args,methodID);
        functions->CallNonvirtualVoidMethodV(this,obj,clazz,methodID,args);
        va_end(args);
    }
    void CallNonvirtualVoidMethodV(jobject obj, jclass clazz,
                                   jmethodID methodID,
                                   va_list args) {
        functions->CallNonvirtualVoidMethodV(this,obj,clazz,methodID,args);
    }
    void CallNonvirtualVoidMethodA(jobject obj, jclass clazz,
                                   jmethodID methodID,
                                   const jvalue * args) {
        functions->CallNonvirtualVoidMethodA(this,obj,clazz,methodID,args);
    }

    jfieldID GetFieldID(jclass clazz, const char *name,
                        const char *sig) {
        return functions->GetFieldID(this,clazz,name,sig);
    }

    jobject GetObjectField(jobject obj, jfieldID fieldID) {
        return functions->GetObjectField(this,obj,fieldID);
    }
    jboolean GetBooleanField(jobject obj, jfieldID fieldID) {
        return functions->GetBooleanField(this,obj,fieldID);
    }
    jbyte GetByteField(jobject obj, jfieldID fieldID) {
        return functions->GetByteField(this,obj,fieldID);
    }
    jchar GetCharField(jobject obj, jfieldID fieldID) {
        return functions->GetCharField(this,obj,fieldID);
    }
    jshort GetShortField(jobject obj, jfieldID fieldID) {
        return functions->GetShortField(this,obj,fieldID);
    }
    jint GetIntField(jobject obj, jfieldID fieldID) {
        return functions->GetIntField(this,obj,fieldID);
    }
    jlong GetLongField(jobject obj, jfieldID fieldID) {
        return functions->GetLongField(this,obj,fieldID);
    }
    jfloat GetFloatField(jobject obj, jfieldID fieldID) {
        return functions->GetFloatField(this,obj,fieldID);
    }
    jdouble GetDoubleField(jobject obj, jfieldID fieldID) {
        return functions->GetDoubleField(this,obj,fieldID);
    }

    void SetObjectField(jobject obj, jfieldID fieldID, jobject val) {
        functions->SetObjectField(this,obj,fieldID,val);
    }
    void SetBooleanField(jobject obj, jfieldID fieldID,
                         jboolean val) {
        functions->SetBooleanField(this,obj,fieldID,val);
    }
    void SetByteField(jobject obj, jfieldID fieldID,
                      jbyte val) {
        functions->SetByteField(this,obj,fieldID,val);
    }
    void SetCharField(jobject obj, jfieldID fieldID,
                      jchar val) {
        functions->SetCharField(this,obj,fieldID,val);
    }
    void SetShortField(jobject obj, jfieldID fieldID,
                       jshort val) {
        functions->SetShortField(this,obj,fieldID,val);
    }
    void SetIntField(jobject obj, jfieldID fieldID,
                     jint val) {
        functions->SetIntField(this,obj,fieldID,val);
    }
    void SetLongField(jobject obj, jfieldID fieldID,
                      jlong val) {
        functions->SetLongField(this,obj,fieldID,val);
    }
    void SetFloatField(jobject obj, jfieldID fieldID,
                       jfloat val) {
        functions->SetFloatField(this,obj,fieldID,val);
    }
    void SetDoubleField(jobject obj, jfieldID fieldID,
                        jdouble val) {
        functions->SetDoubleField(this,obj,fieldID,val);
    }

    jmethodID GetStaticMethodID(jclass clazz, const char *name,
                                const char *sig) {
        return functions->GetStaticMethodID(this,clazz,name,sig);
    }

    jobject CallStaticObjectMethod(jclass clazz, jmethodID methodID,
                             ...) {
        va_list args;
        jobject result;
        va_start(args,methodID);
        result = functions->CallStaticObjectMethodV(this,clazz,methodID,args);
        va_end(args);
        return result;
    }
    jobject CallStaticObjectMethodV(jclass clazz, jmethodID methodID,
                              va_list args) {
        return functions->CallStaticObjectMethodV(this,clazz,methodID,args);
    }
    jobject CallStaticObjectMethodA(jclass clazz, jmethodID methodID,
                              const jvalue *args) {
        return functions->CallStaticObjectMethodA(this,clazz,methodID,args);
    }

    jboolean CallStaticBooleanMethod(jclass clazz,
                                     jmethodID methodID, ...) {
        va_list args;
        jboolean result;
        va_start(args,methodID);
        result = functions->CallStaticBooleanMethodV(this,clazz,methodID,args);
        va_end(args);
        return result;
    }
    jboolean CallStaticBooleanMethodV(jclass clazz,
                                      jmethodID methodID, va_list args) {
        return functions->CallStaticBooleanMethodV(this,clazz,methodID,args);
    }
    jboolean CallStaticBooleanMethodA(jclass clazz,
                                      jmethodID methodID, const jvalue *args) {
        return functions->CallStaticBooleanMethodA(this,clazz,methodID,args);
    }

    jbyte CallStaticByteMethod(jclass clazz,
                               jmethodID methodID, ...) {
        va_list args;
        jbyte result;
        va_start(args,methodID);
        result = functions->CallStaticByteMethodV(this,clazz,methodID,args);
        va_end(args);
        return result;
    }
    jbyte CallStaticByteMethodV(jclass clazz,
                                jmethodID methodID, va_list args) {
        return functions->CallStaticByteMethodV(this,clazz,methodID,args);
    }
    jbyte CallStaticByteMethodA(jclass clazz,
                                jmethodID methodID, const jvalue *args) {
        return functions->CallStaticByteMethodA(this,clazz,methodID,args);
    }

    jchar CallStaticCharMethod(jclass clazz,
                               jmethodID methodID, ...) {
        va_list args;
        jchar result;
        va_start(args,methodID);
        result = functions->CallStaticCharMethodV(this,clazz,methodID,args);
        va_end(args);
        return result;
    }
    jchar CallStaticCharMethodV(jclass clazz,
                                jmethodID methodID, va_list args) {
        return functions->CallStaticCharMethodV(this,clazz,methodID,args);
    }
    jchar CallStaticCharMethodA(jclass clazz,
                                jmethodID methodID, const jvalue *args) {
        return functions->CallStaticCharMethodA(this,clazz,methodID,args);
    }

    jshort CallStaticShortMethod(jclass clazz,
                                 jmethodID methodID, ...) {
        va_list args;
        jshort result;
        va_start(args,methodID);
        result = functions->CallStaticShortMethodV(this,clazz,methodID,args);
        va_end(args);
        return result;
    }
    jshort CallStaticShortMethodV(jclass clazz,
                                  jmethodID methodID, va_list args) {
        return functions->CallStaticShortMethodV(this,clazz,methodID,args);
    }
    jshort CallStaticShortMethodA(jclass clazz,
                                  jmethodID methodID, const jvalue *args) {
        return functions->CallStaticShortMethodA(this,clazz,methodID,args);
    }

    jint CallStaticIntMethod(jclass clazz,
                             jmethodID methodID, ...) {
        va_list args;
        jint result;
        va_start(args,methodID);
        result = functions->CallStaticIntMethodV(this,clazz,methodID,args);
        va_end(args);
        return result;
    }
    jint CallStaticIntMethodV(jclass clazz,
                              jmethodID methodID, va_list args) {
        return functions->CallStaticIntMethodV(this,clazz,methodID,args);
    }
    jint CallStaticIntMethodA(jclass clazz,
                              jmethodID methodID, const jvalue *args) {
        return functions->CallStaticIntMethodA(this,clazz,methodID,args);
    }

    jlong CallStaticLongMethod(jclass clazz,
                               jmethodID methodID, ...) {
        va_list args;
        jlong result;
        va_start(args,methodID);
        result = functions->CallStaticLongMethodV(this,clazz,methodID,args);
        va_end(args);
        return result;
    }
    jlong CallStaticLongMethodV(jclass clazz,
                                jmethodID methodID, va_list args) {
        return functions->CallStaticLongMethodV(this,clazz,methodID,args);
    }
    jlong CallStaticLongMethodA(jclass clazz,
                                jmethodID methodID, const jvalue *args) {
        return functions->CallStaticLongMethodA(this,clazz,methodID,args);
    }

    jfloat CallStaticFloatMethod(jclass clazz,
                                 jmethodID methodID, ...) {
        va_list args;
        jfloat result;
        va_start(args,methodID);
        result = functions->CallStaticFloatMethodV(this,clazz,methodID,args);
        va_end(args);
        return result;
    }
    jfloat CallStaticFloatMethodV(jclass clazz,
                                  jmethodID methodID, va_list args) {
        return functions->CallStaticFloatMethodV(this,clazz,methodID,args);
    }
    jfloat CallStaticFloatMethodA(jclass clazz,
                                  jmethodID methodID, const jvalue *args) {
        return functions->CallStaticFloatMethodA(this,clazz,methodID,args);
    }

    jdouble CallStaticDoubleMethod(jclass clazz,
                                   jmethodID methodID, ...) {
        va_list args;
        jdouble result;
        va_start(args,methodID);
        result = functions->CallStaticDoubleMethodV(this,clazz,methodID,args);
        va_end(args);
        return result;
    }
    jdouble CallStaticDoubleMethodV(jclass clazz,
                                    jmethodID methodID, va_list args) {
        return functions->CallStaticDoubleMethodV(this,clazz,methodID,args);
    }
    jdouble CallStaticDoubleMethodA(jclass clazz,
                                    jmethodID methodID, const jvalue *args) {
        return functions->CallStaticDoubleMethodA(this,clazz,methodID,args);
    }

    void CallStaticVoidMethod(jclass cls, jmethodID methodID, ...) {
        va_list args;
        va_start(args,methodID);
        functions->CallStaticVoidMethodV(this,cls,methodID,args);
        va_end(args);
    }
    void CallStaticVoidMethodV(jclass cls, jmethodID methodID,
                               va_list args) {
        functions->CallStaticVoidMethodV(this,cls,methodID,args);
    }
    void CallStaticVoidMethodA(jclass cls, jmethodID methodID,
                               const jvalue * args) {
        functions->CallStaticVoidMethodA(this,cls,methodID,args);
    }

    jfieldID GetStaticFieldID(jclass clazz, const char *name,
                              const char *sig) {
        return functions->GetStaticFieldID(this,clazz,name,sig);
    }
    jobject GetStaticObjectField(jclass clazz, jfieldID fieldID) {
        return functions->GetStaticObjectField(this,clazz,fieldID);
    }
    jboolean GetStaticBooleanField(jclass clazz, jfieldID fieldID) {
        return functions->GetStaticBooleanField(this,clazz,fieldID);
    }
    jbyte GetStaticByteField(jclass clazz, jfieldID fieldID) {
        return functions->GetStaticByteField(this,clazz,fieldID);
    }
    jchar GetStaticCharField(jclass clazz, jfieldID fieldID) {
        return functions->GetStaticCharField(this,clazz,fieldID);
    }
    jshort GetStaticShortField(jclass clazz, jfieldID fieldID) {
        return functions->GetStaticShortField(this,clazz,fieldID);
    }
    jint GetStaticIntField(jclass clazz, jfieldID fieldID) {
        return functions->GetStaticIntField(this,clazz,fieldID);
    }
    jlong GetStaticLongField(jclass clazz, jfieldID fieldID) {
        return functions->GetStaticLongField(this,clazz,fieldID);
    }
    jfloat GetStaticFloatField(jclass clazz, jfieldID fieldID) {
        return functions->GetStaticFloatField(this,clazz,fieldID);
    }
    jdouble GetStaticDoubleField(jclass clazz, jfieldID fieldID) {
        return functions->GetStaticDoubleField(this,clazz,fieldID);
    }

    void SetStaticObjectField(jclass clazz, jfieldID fieldID,
                        jobject value) {
      functions->SetStaticObjectField(this,clazz,fieldID,value);
    }
    void SetStaticBooleanField(jclass clazz, jfieldID fieldID,
                        jboolean value) {
      functions->SetStaticBooleanField(this,clazz,fieldID,value);
    }
    void SetStaticByteField(jclass clazz, jfieldID fieldID,
                        jbyte value) {
      functions->SetStaticByteField(this,clazz,fieldID,value);
    }
    void SetStaticCharField(jclass clazz, jfieldID fieldID,
                        jchar value) {
      functions->SetStaticCharField(this,clazz,fieldID,value);
    }
    void SetStaticShortField(jclass clazz, jfieldID fieldID,
                        jshort value) {
      functions->SetStaticShortField(this,clazz,fieldID,value);
    }
    void SetStaticIntField(jclass clazz, jfieldID fieldID,
                        jint value) {
      functions->SetStaticIntField(this,clazz,fieldID,value);
    }
    void SetStaticLongField(jclass clazz, jfieldID fieldID,
                        jlong value) {
      functions->SetStaticLongField(this,clazz,fieldID,value);
    }
    void SetStaticFloatField(jclass clazz, jfieldID fieldID,
                        jfloat value) {
      functions->SetStaticFloatField(this,clazz,fieldID,value);
    }
    void SetStaticDoubleField(jclass clazz, jfieldID fieldID,
                        jdouble value) {
      functions->SetStaticDoubleField(this,clazz,fieldID,value);
    }

    jstring NewString(const jchar *unicode, jsize len) {
        return functions->NewString(this,unicode,len);
    }
    jsize GetStringLength(jstring str) {
        return functions->GetStringLength(this,str);
    }
    const jchar *GetStringChars(jstring str, jboolean *isCopy) {
        return functions->GetStringChars(this,str,isCopy);
    }
    void ReleaseStringChars(jstring str, const jchar *chars) {
        functions->ReleaseStringChars(this,str,chars);
    }

    jstring NewStringUTF(const char *utf) {
        return functions->NewStringUTF(this,utf);
    }
    jsize GetStringUTFLength(jstring str) {
        return functions->GetStringUTFLength(this,str);
    }
    const char* GetStringUTFChars(jstring str, jboolean *isCopy) {
        return functions->GetStringUTFChars(this,str,isCopy);
    }
    void ReleaseStringUTFChars(jstring str, const char* chars) {
        functions->ReleaseStringUTFChars(this,str,chars);
    }

    jsize GetArrayLength(jarray array) {
        return functions->GetArrayLength(this,array);
    }

    jobjectArray NewObjectArray(jsize len, jclass clazz,
                                jobject init) {
        return functions->NewObjectArray(this,len,clazz,init);
    }
    jobject GetObjectArrayElement(jobjectArray array, jsize index) {
        return functions->GetObjectArrayElement(this,array,index);
    }
    void SetObjectArrayElement(jobjectArray array, jsize index,
                               jobject val) {
        functions->SetObjectArrayElement(this,array,index,val);
    }

    jbooleanArray NewBooleanArray(jsize len) {
        return functions->NewBooleanArray(this,len);
    }
    jbyteArray NewByteArray(jsize len) {
        return functions->NewByteArray(this,len);
    }
    jcharArray NewCharArray(jsize len) {
        return functions->NewCharArray(this,len);
    }
    jshortArray NewShortArray(jsize len) {
        return functions->NewShortArray(this,len);
    }
    jintArray NewIntArray(jsize len) {
        return functions->NewIntArray(this,len);
    }
    jlongArray NewLongArray(jsize len) {
        return functions->NewLongArray(this,len);
    }
    jfloatArray NewFloatArray(jsize len) {
        return functions->NewFloatArray(this,len);
    }
    jdoubleArray NewDoubleArray(jsize len) {
        return functions->NewDoubleArray(this,len);
    }

    jboolean * GetBooleanArrayElements(jbooleanArray array, jboolean *isCopy) {
        return functions->GetBooleanArrayElements(this,array,isCopy);
    }
    jbyte * GetByteArrayElements(jbyteArray array, jboolean *isCopy) {
        return functions->GetByteArrayElements(this,array,isCopy);
    }
    jchar * GetCharArrayElements(jcharArray array, jboolean *isCopy) {
        return functions->GetCharArrayElements(this,array,isCopy);
    }
    jshort * GetShortArrayElements(jshortArray array, jboolean *isCopy) {
        return functions->GetShortArrayElements(this,array,isCopy);
    }
    jint * GetIntArrayElements(jintArray array, jboolean *isCopy) {
        return functions->GetIntArrayElements(this,array,isCopy);
    }
    jlong * GetLongArrayElements(jlongArray array, jboolean *isCopy) {
        return functions->GetLongArrayElements(this,array,isCopy);
    }
    jfloat * GetFloatArrayElements(jfloatArray array, jboolean *isCopy) {
        return functions->GetFloatArrayElements(this,array,isCopy);
    }
    jdouble * GetDoubleArrayElements(jdoubleArray array, jboolean *isCopy) {
        return functions->GetDoubleArrayElements(this,array,isCopy);
    }

    void ReleaseBooleanArrayElements(jbooleanArray array,
                                     jboolean *elems,
                                     jint mode) {
        functions->ReleaseBooleanArrayElements(this,array,elems,mode);
    }
    void ReleaseByteArrayElements(jbyteArray array,
                                  jbyte *elems,
                                  jint mode) {
        functions->ReleaseByteArrayElements(this,array,elems,mode);
    }
    void ReleaseCharArrayElements(jcharArray array,
                                  jchar *elems,
                                  jint mode) {
        functions->ReleaseCharArrayElements(this,array,elems,mode);
    }
    void ReleaseShortArrayElements(jshortArray array,
                                   jshort *elems,
                                   jint mode) {
        functions->ReleaseShortArrayElements(this,array,elems,mode);
    }
    void ReleaseIntArrayElements(jintArray array,
                                 jint *elems,
                                 jint mode) {
        functions->ReleaseIntArrayElements(this,array,elems,mode);
    }
    void ReleaseLongArrayElements(jlongArray array,
                                  jlong *elems,
                                  jint mode) {
        functions->ReleaseLongArrayElements(this,array,elems,mode);
    }
    void ReleaseFloatArrayElements(jfloatArray array,
                                   jfloat *elems,
                                   jint mode) {
        functions->ReleaseFloatArrayElements(this,array,elems,mode);
    }
    void ReleaseDoubleArrayElements(jdoubleArray array,
                                    jdouble *elems,
                                    jint mode) {
        functions->ReleaseDoubleArrayElements(this,array,elems,mode);
    }

    void GetBooleanArrayRegion(jbooleanArray array,
                               jsize start, jsize len, jboolean *buf) {
        functions->GetBooleanArrayRegion(this,array,start,len,buf);
    }
    void GetByteArrayRegion(jbyteArray array,
                            jsize start, jsize len, jbyte *buf) {
        functions->GetByteArrayRegion(this,array,start,len,buf);
    }
    void GetCharArrayRegion(jcharArray array,
                            jsize start, jsize len, jchar *buf) {
        functions->GetCharArrayRegion(this,array,start,len,buf);
    }
    void GetShortArrayRegion(jshortArray array,
                             jsize start, jsize len, jshort *buf) {
        functions->GetShortArrayRegion(this,array,start,len,buf);
    }
    void GetIntArrayRegion(jintArray array,
                           jsize start, jsize len, jint *buf) {
        functions->GetIntArrayRegion(this,array,start,len,buf);
    }
    void GetLongArrayRegion(jlongArray array,
                            jsize start, jsize len, jlong *buf) {
        functions->GetLongArrayRegion(this,array,start,len,buf);
    }
    void GetFloatArrayRegion(jfloatArray array,
                             jsize start, jsize len, jfloat *buf) {
        functions->GetFloatArrayRegion(this,array,start,len,buf);
    }
    void GetDoubleArrayRegion(jdoubleArray array,
                              jsize start, jsize len, jdouble *buf) {
        functions->GetDoubleArrayRegion(this,array,start,len,buf);
    }

    void SetBooleanArrayRegion(jbooleanArray array, jsize start, jsize len,
                               const jboolean *buf) {
        functions->SetBooleanArrayRegion(this,array,start,len,buf);
    }
    void SetByteArrayRegion(jbyteArray array, jsize start, jsize len,
                            const jbyte *buf) {
        functions->SetByteArrayRegion(this,array,start,len,buf);
    }
    void SetCharArrayRegion(jcharArray array, jsize start, jsize len,
                            const jchar *buf) {
        functions->SetCharArrayRegion(this,array,start,len,buf);
    }
    void SetShortArrayRegion(jshortArray array, jsize start, jsize len,
                             const jshort *buf) {
        functions->SetShortArrayRegion(this,array,start,len,buf);
    }
    void SetIntArrayRegion(jintArray array, jsize start, jsize len,
                           const jint *buf) {
        functions->SetIntArrayRegion(this,array,start,len,buf);
    }
    void SetLongArrayRegion(jlongArray array, jsize start, jsize len,
                            const jlong *buf) {
        functions->SetLongArrayRegion(this,array,start,len,buf);
    }
    void SetFloatArrayRegion(jfloatArray array, jsize start, jsize len,
                             const jfloat *buf) {
        functions->SetFloatArrayRegion(this,array,start,len,buf);
    }
    void SetDoubleArrayRegion(jdoubleArray array, jsize start, jsize len,
                              const jdouble *buf) {
        functions->SetDoubleArrayRegion(this,array,start,len,buf);
    }

    jint RegisterNatives(jclass clazz, const JNINativeMethod *methods,
                         jint nMethods) {
        return functions->RegisterNatives(this,clazz,methods,nMethods);
    }
    jint UnregisterNatives(jclass clazz) {
        return functions->UnregisterNatives(this,clazz);
    }

    jint MonitorEnter(jobject obj) {
        return functions->MonitorEnter(this,obj);
    }
    jint MonitorExit(jobject obj) {
        return functions->MonitorExit(this,obj);
    }

    jint GetJavaVM(JavaVM **vm) {
        return functions->GetJavaVM(this,vm);
    }

    void GetStringRegion(jstring str, jsize start, jsize len, jchar *buf) {
        functions->GetStringRegion(this,str,start,len,buf);
    }
    void GetStringUTFRegion(jstring str, jsize start, jsize len, char *buf) {
        functions->GetStringUTFRegion(this,str,start,len,buf);
    }

    void * GetPrimitiveArrayCritical(jarray array, jboolean *isCopy) {
        return functions->GetPrimitiveArrayCritical(this,array,isCopy);
    }
    void ReleasePrimitiveArrayCritical(jarray array, void *carray, jint mode) {
        functions->ReleasePrimitiveArrayCritical(this,array,carray,mode);
    }

    const jchar * GetStringCritical(jstring string, jboolean *isCopy) {
        return functions->GetStringCritical(this,string,isCopy);
    }
    void ReleaseStringCritical(jstring string, const jchar *cstring) {
        functions->ReleaseStringCritical(this,string,cstring);
    }

    jweak NewWeakGlobalRef(jobject obj) {
        return functions->NewWeakGlobalRef(this,obj);
    }
    void DeleteWeakGlobalRef(jweak ref) {
        functions->DeleteWeakGlobalRef(this,ref);
    }

    jboolean ExceptionCheck() {
        return functions->ExceptionCheck(this);
    }

    jobject NewDirectByteBuffer(void* address, jlong capacity) {
        return functions->NewDirectByteBuffer(this, address, capacity);
    }
    void* GetDirectBufferAddress(jobject buf) {
        return functions->GetDirectBufferAddress(this, buf);
    }
    jlong GetDirectBufferCapacity(jobject buf) {
        return functions->GetDirectBufferCapacity(this, buf);
    }
    jobjectRefType GetObjectRefType(jobject obj) {
        return functions->GetObjectRefType(this, obj);
    }

#endif /* __cplusplus */
};

typedef struct JavaVMOption {
    char *optionString;
    void *extraInfo;
} JavaVMOption;

typedef struct JavaVMInitArgs {
    jint version;

    jint nOptions;
    JavaVMOption *options;
    jboolean ignoreUnrecognized;
} JavaVMInitArgs;

typedef struct JavaVMAttachArgs {
    jint version;

    char *name;
    jobject group;
} JavaVMAttachArgs;

/* These will be VM-specific. */

#define JDK1_2
#define JDK1_4

/* End VM-specific. */

struct JNIInvokeInterface_ {
    void *reserved0;
    void *reserved1;
    void *reserved2;

    jint (JNICALL *DestroyJavaVM)(JavaVM *vm);

    jint (JNICALL *AttachCurrentThread)(JavaVM *vm, void **penv, void *args);

    jint (JNICALL *DetachCurrentThread)(JavaVM *vm);

    jint (JNICALL *GetEnv)(JavaVM *vm, void **penv, jint version);

    jint (JNICALL *AttachCurrentThreadAsDaemon)(JavaVM *vm, void **penv, void *args);
};

struct JavaVM_ {
    const struct JNIInvokeInterface_ *functions;
#ifdef __cplusplus

    jint DestroyJavaVM() {
        return functions->DestroyJavaVM(this);
    }
    jint AttachCurrentThread(void **penv, void *args) {
        return functions->AttachCurrentThread(this, penv, args);
    }
    jint DetachCurrentThread() {
        return functions->DetachCurrentThread(this);
    }

    jint GetEnv(void **penv, jint version) {
        return functions->GetEnv(this, penv, version);
    }
    jint AttachCurrentThreadAsDaemon(void **penv, void *args) {
        return functions->AttachCurrentThreadAsDaemon(this, penv, args);
    }
#endif
};

#ifdef _JNI_IMPLEMENTATION_
#define _JNI_IMPORT_OR_EXPORT_ JNIEXPORT
#else
#define _JNI_IMPORT_OR_EXPORT_ JNIIMPORT
#endif
_JNI_IMPORT_OR_EXPORT_ jint JNICALL
JNI_GetDefaultJavaVMInitArgs(void *args);

_JNI_IMPORT_OR_EXPORT_ jint JNICALL
JNI_CreateJavaVM(JavaVM **pvm, void **penv, void *args);

_JNI_IMPORT_OR_EXPORT_ jint JNICALL
JNI_GetCreatedJavaVMs(JavaVM **, jsize, jsize *);

/* Defined by native libraries. */
JNIEXPORT jint JNICALL
JNI_OnLoad(JavaVM *vm, void *reserved);

JNIEXPORT void JNICALL
JNI_OnUnload(JavaVM *vm, void *reserved);

#define JNI_VERSION_1_1 0x00010001
#define JNI_VERSION_1_2 0x00010002
#define JNI_VERSION_1_4 0x00010004
#define JNI_VERSION_1_6 0x00010006
#define JNI_VERSION_1_8 0x00010008

#ifdef __cplusplus
} /* extern "C" */
#endif /* __cplusplus */

#endif /* !_JAVASOFT_JNI_H_ */

Added emulators/emulator-base/src/main/headers/jni_linux.h.







































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/*
 * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * This code is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License version 2 only, as
 * published by the Free Software Foundation.  Oracle designates this
 * particular file as subject to the "Classpath" exception as provided
 * by Oracle in the LICENSE file that accompanied this code.
 *
 * This code is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 * version 2 for more details (a copy is included in the LICENSE file that
 * accompanied this code).
 *
 * You should have received a copy of the GNU General Public License version
 * 2 along with this work; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 * or visit www.oracle.com if you need additional information or have any
 * questions.
 */

#ifndef _JAVASOFT_JNI_MD_H_
#define _JAVASOFT_JNI_MD_H_

#ifndef __has_attribute
  #define __has_attribute(x) 0
#endif
#if (defined(__GNUC__) && ((__GNUC__ > 4) || (__GNUC__ == 4) && (__GNUC_MINOR__ > 2))) || __has_attribute(visibility)
  #define JNIEXPORT     __attribute__((visibility("default")))
  #define JNIIMPORT     __attribute__((visibility("default")))
#else
  #define JNIEXPORT
  #define JNIIMPORT
#endif

#define JNICALL

typedef int jint;
#ifdef _LP64 /* 64-bit Solaris */
typedef long jlong;
#else
typedef long long jlong;
#endif

typedef signed char jbyte;

#endif /* !_JAVASOFT_JNI_MD_H_ */

Added emulators/emulator-base/src/main/headers/jni_mac.h.





















































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/*
 * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * This code is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License version 2 only, as
 * published by the Free Software Foundation.  Oracle designates this
 * particular file as subject to the "Classpath" exception as provided
 * by Oracle in the LICENSE file that accompanied this code.
 *
 * This code is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 * version 2 for more details (a copy is included in the LICENSE file that
 * accompanied this code).
 *
 * You should have received a copy of the GNU General Public License version
 * 2 along with this work; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 * or visit www.oracle.com if you need additional information or have any
 * questions.
 */

#ifndef _JAVASOFT_JNI_MD_H_
#define _JAVASOFT_JNI_MD_H_

#define JNIEXPORT     __attribute__((visibility("default")))
#define JNIIMPORT     __attribute__((visibility("default")))
#define JNICALL

typedef int jint;
#ifdef _LP64 /* 64-bit */
typedef long jlong;
#else
typedef long long jlong;
#endif

typedef signed char jbyte;

#endif /* !_JAVASOFT_JNI_MD_H_ */

Added emulators/emulator-base/src/main/headers/jni_win.h.











































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/*
 * Copyright (c) 1996, 1998, Oracle and/or its affiliates. All rights reserved.
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * This code is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License version 2 only, as
 * published by the Free Software Foundation.  Oracle designates this
 * particular file as subject to the "Classpath" exception as provided
 * by Oracle in the LICENSE file that accompanied this code.
 *
 * This code is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 * version 2 for more details (a copy is included in the LICENSE file that
 * accompanied this code).
 *
 * You should have received a copy of the GNU General Public License version
 * 2 along with this work; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 * or visit www.oracle.com if you need additional information or have any
 * questions.
 */

#ifndef _JAVASOFT_JNI_MD_H_
#define _JAVASOFT_JNI_MD_H_

#define JNIEXPORT __declspec(dllexport)
#define JNIIMPORT __declspec(dllimport)
#define JNICALL __stdcall

typedef long jint;
typedef __int64 jlong;
typedef signed char jbyte;

#endif /* !_JAVASOFT_JNI_MD_H_ */

Added emulators/emulator-base/src/main/java/cc/squirreljme/emulator/AbstractSystemCallHandler.java.





































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.emulator;

/**
 * This class handles system calls.
 *
 * @since 2020/02/22
 */
public class AbstractSystemCallHandler {
}

Added emulators/emulator-base/src/main/java/cc/squirreljme/emulator/EmulatorAssembly.java.







































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.emulator;

import cc.squirreljme.emulator.fb.NativeFramebuffer;
import cc.squirreljme.jvm.SystemCallError;
import cc.squirreljme.jvm.SystemCallIndex;

/**
 * This contains the implementation of some system calls in the event that the
 * JNI emulation layer does not have a C-based implementation of a method.
 *
 * @since 2020/02/26
 */
public final class EmulatorAssembly
{
	/** The thread contexts, storing thread specific information. */
	private static final ThreadLocal<EmulatorThreadContext> _CONTEXT =
		new ThreadLocal<>();
	
	/**
	 * Not used.
	 *
	 * @since 2020/02/26
	 */
	private EmulatorAssembly()
	{
	}
	
	/**
	 * Handles system calls in Java.
	 *
	 * @param __si System call index.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @param __e Argument.
	 * @param __f Argument.
	 * @param __g Argument.
	 * @param __h Argument.
	 * @return The result.
	 * @since 2020/02/26
	 */
	public static long systemCall(short __si, int __a, int __b,
		int __c, int __d, int __e, int __f, int __g, int __h)
	{
		// We need the context for thread based info
		EmulatorThreadContext context = EmulatorAssembly.threadContext();
		
		// Depends on the system call
		switch (__si)
		{
				// System calls that are supported?
			case SystemCallIndex.QUERY_INDEX:
				{
					// Always succeeds
					context.setError(__si, 0);
					
					// Depends on the system call requested
					switch (__a)
					{
							// Implemented here
						case SystemCallIndex.ERROR_GET:
						case SystemCallIndex.ERROR_SET:
						case SystemCallIndex.FRAMEBUFFER:
						case SystemCallIndex.QUERY_INDEX:
						case SystemCallIndex.TIME_MILLI_WALL:
						case SystemCallIndex.TIME_NANO_MONO:
							return 1;
						
							// Not-implemented
						default:
							return 0;
					}
				}
			
				// Get error
			case SystemCallIndex.ERROR_GET:
				{
					context.setError(__si, 0);
					
					return context.getError((short)__a);
				}
			
				// Set error
			case SystemCallIndex.ERROR_SET:
				{
					context.setError(__si, 0);
					
					int oldError = context.getError((short)__a);
					context.setError((short)__a, __b);
					return oldError;
				}
			
				// Access the framebuffer
			case SystemCallIndex.FRAMEBUFFER:
				return NativeFramebuffer.getInstance().systemCall(context,
					__a, __b, __c, __d, __e, __f, __g, __h);
				
				// Current wall clock
			case SystemCallIndex.TIME_MILLI_WALL:
				{
					context.setError(__si, 0);
					
					return System.currentTimeMillis();
				}
			
				// Current monotonic clock
			case SystemCallIndex.TIME_NANO_MONO:
				{
					context.setError(__si, 0);
					
					return System.nanoTime();
				}
			
				// Un-handled, set as not supported and return a default value
			default:
				// Debug
				System.err.printf(
					"SysCall?: %d(%d, %d, %d, %d, %d, %d, %d, %d)%n",
					__si, __a, __b, __c, __d, __e, __f, __g, __h);
				
				// Set error
				context.setError(__si,
					SystemCallError.UNSUPPORTED_SYSTEM_CALL);
				return 0;
		}
	}
	
	/**
	 * Returns the current thread context.
	 *
	 * @return The thread context.
	 * @since 2020/02/26
	 */
	public static EmulatorThreadContext threadContext()
	{
		// Has this been created already?
		EmulatorThreadContext rv = EmulatorAssembly._CONTEXT.get();
		if (rv != null)
			return rv;
		
		// Does not exist, needs to be created
		synchronized (EmulatorAssembly.class)
		{
			// Check again
			rv = EmulatorAssembly._CONTEXT.get();
			if (rv != null)
				return rv;
			
			EmulatorAssembly._CONTEXT.set((rv = new EmulatorThreadContext()));
			return rv;
		}
	}
}

Added emulators/emulator-base/src/main/java/cc/squirreljme/emulator/EmulatorThreadContext.java.









































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package cc.squirreljme.emulator;

// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

import cc.squirreljme.jvm.SystemCallIndex;

/**
 * This contains the needed context for emulator threads.
 *
 * @since 2020/02/26
 */
public final class EmulatorThreadContext
{
	/** Error codes that are available. */
	public final int[] errorCodes =
		new int[SystemCallIndex.NUM_SYSCALLS];
	
	/**
	 * Gets the error for the given system call.
	 *
	 * @param __si The system call error to get.
	 * @return The error code.
	 * @since 2020/02/26
	 */
	public final int getError(short __si)
	{
		// If the index is out of bounds, write to the first system call
		return this.errorCodes[((__si < 0 ||
			__si >= SystemCallIndex.NUM_SYSCALLS) ? 0 : __si)];
	}
	
	/**
	 * Sets the error for the given system call.
	 *
	 * @param __si The system call error to set.
	 * @param __code The new code.
	 * @since 2020/02/26
	 */
	public final void setError(short __si, int __code)
	{
		// If the index is out of bounds, write to the first system call
		this.errorCodes[((__si < 0 ||
			__si >= SystemCallIndex.NUM_SYSCALLS) ? 0 : __si)] = __code;
	}
}

Added emulators/emulator-base/src/main/java/cc/squirreljme/emulator/NativeBinding.java.





































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.emulator;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.StandardOpenOption;

/**
 * This class manages the native bindings.
 *
 * @since 2020/02/25
 */
public final class NativeBinding
{
	static
	{
		// Find the library to load
		String libName = System.mapLibraryName("emulator-base");
		
		// Copy resource to the output
		Path tempDir = null,
			libFile = null;
		try (InputStream in = NativeBinding.class.
			getResourceAsStream("/" + libName))
		{
			if (in == null)
				throw new RuntimeException(String.format(
					"Library %s not found in resource.", libName));
			
			// Store the library as a given file
			tempDir = Files.createTempDirectory("squirreljme-lib");
			libFile = tempDir.resolve(libName);
			
			// Write to the disk as we can only load there
			try (OutputStream out = Files.newOutputStream(libFile,
					StandardOpenOption.CREATE,
					StandardOpenOption.TRUNCATE_EXISTING,
					StandardOpenOption.WRITE))
			{
				// Store here
				byte[] buf = new byte[4096];
				for (;;)
				{
					int rc = in.read(buf);
					
					if (rc < 0)
						break;
					
					out.write(buf, 0, rc);
				}
				
				// Make sure it is on the disk
				out.flush();
			}
		}
		catch (IOException e)
		{
			// Try to clear the file
			try
			{
				if (libFile != null)
					Files.delete(libFile);
				
				if (tempDir != null)
					Files.delete(tempDir);
			}
			catch (IOException f)
			{
				e.addSuppressed(f);
			}
			
			throw new RuntimeException("Could not copy native library.", e);
		}
		
		// Attempt cleanup at shutdown.
		final Path[] paths = new Path[]{libFile, tempDir};
		Runtime.getRuntime().addShutdownHook(new Thread(() ->
			{
				try
				{
					for (Path p : paths)
						Files.delete(p);
				}
				catch (IOException e)
				{
				}
			}, "SquirrelJME-LibraryCleanupThread"));
		
		// Try loading the library now
		System.load(libFile.toString());
		
		// Bind methods
		if (NativeBinding.__bindMethods() != 0)
			throw new RuntimeException("Could not bind methods!");
	}
	
	/**
	 * Binds methods accordingly.
	 *
	 * @since 2020/02/26
	 */
	private static native int __bindMethods();
}

Added emulators/emulator-base/src/main/java/cc/squirreljme/emulator/SquirrelJMEAlterSuiteListener.java.



























































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.emulator;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.Collection;
import java.util.Enumeration;
import java.util.LinkedList;
import java.util.List;
import org.testng.IAlterSuiteListener;
import org.testng.xml.XmlClass;
import org.testng.xml.XmlSuite;
import org.testng.xml.XmlTest;

/**
 * Alters suite names.
 *
 * @since 2020/02/26
 */
public class SquirrelJMEAlterSuiteListener
	implements IAlterSuiteListener
{
	/** The service resource file. */
	public static final String SERVICE_RESOURCE =
		"META-INF/services/net.multiphasicapps.tac.TestInterface";
	
	/**
	 * {@inheritDoc}
	 * @since 2020/02/26
	 */
	@Override
	public void alter(List<XmlSuite> suites)
	{
		// Poke the native bindings class so it gets initializes and setup
		new NativeBinding();
		
		// Go through our test suites
		for (XmlSuite suite : suites)
		{
			// Only adjust SquirrelJME suites
			if (!"squirreljme".equals(suite.getName()))
				continue;
			
			// Get pre-existing test group
			XmlTest test = null;
			for (XmlTest sub : suite.getTests())
				if ("tests".equals(sub.getName()))
				{
					test = sub;
					break;
				}
			
			// Create one?
			if (test == null)
			{
				test = new XmlTest();
				test.setSuite(suite);
				test.setName("tests");
				
				suite.addTest(test);
			}
			
			// Add tests for every test class (each class has just one)
			List<XmlClass> classies = new LinkedList<>();
			for (String testClass : SquirrelJMEAlterSuiteListener
				.findTestClasses())
				try
				{
					XmlClass classy = new XmlClass();
					
					// It needs to point to our class!
					classy.setName(testClass);
					classy.setClass(Class.forName(testClass));
					
					// Use this test
					classies.add(classy);
				}
				catch (ClassNotFoundException e)
				{
					// Ignore
				}
			
			// Use these classes
			test.setClasses(classies);
		}
	}
	
	/**
	 * Returns the base name for the class.
	 *
	 * @param __name The name of the class.
	 * @return The base name.
	 * @since 2020/02/26
	 */
	public static String baseClassName(String __name)
		throws NullPointerException
	{
		if (__name == null)
			throw new NullPointerException("No name specified.");
		
		int ld = __name.lastIndexOf('.');
		return (ld < 0 ? __name : __name.substring(ld + 1));
	}
	
	/**
	 * Returns the base package for the class.
	 *
	 * @param __name The name of the class.
	 * @return The base package.
	 * @since 2020/02/26
	 */
	public static String basePackage(String __name)
		throws NullPointerException
	{
		if (__name == null)
			throw new NullPointerException("No name specified.");
		
		int ld = __name.lastIndexOf('.');
		return (ld < 0 ? __name : __name.substring(0, ld));
	}
	
	/**
	 * Collects all of the test classes that are known about.
	 *
	 * @return The test classes.
	 * @since 2020/02/26
	 */
	public static Iterable<String> findTestClasses()
	{
		Collection<String> rv = new LinkedList<>();
		
		// Process resources
		try
		{
			// Get all resource files
			Enumeration<URL> urls = SquirrelJMEAlterSuiteListener.class.
				getClassLoader().getResources(
				SquirrelJMEAlterSuiteListener.SERVICE_RESOURCE);
			
			// Process them all
			while (urls.hasMoreElements())
			{
				URL url = urls.nextElement();
				
				// Read in files
				try (BufferedReader br = new BufferedReader(
					new InputStreamReader(url.openStream(),
					"utf-8")))
				{
					for (;;)
					{
						String ln = br.readLine();
						
						// EOF?
						if (ln == null)
							break;
						
						// Ignore blank lines
						if (ln.isEmpty())
							continue;
						
						// Store test name
						rv.add(ln.replace('/', '.'));
					}
				}
				catch (IOException e)
				{
					// Ignore
				}
			}
		}
		catch (IOException e)
		{
			// Ignore
		}
		
		return rv;
	}
}

Added emulators/emulator-base/src/main/java/cc/squirreljme/emulator/SquirrelJMETest.java.

































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.emulator;

import net.multiphasicapps.tac.TestExecution;
import net.multiphasicapps.tac.TestInterface;
import org.testng.Assert;
import org.testng.SkipException;
import org.testng.TestException;
import org.testng.annotations.Test;

/**
 * Used to wrap SquirrelJME tests.
 *
 * @since 2020/02/23
 */
public class SquirrelJMETest
{
	/** The test class to execute. */
	protected final Class<?> testClass;
	
	/**
	 * Initializes the test information.
	 *
	 * @param __test The test class.
	 * @throws NullPointerException On null arguments.
	 * @since 2020/02/23
	 */
	public SquirrelJMETest(Class<?> __test)
		throws NullPointerException
	{
		if (__test == null)
			throw new NullPointerException("No test class specified.");
		
		this.testClass = __test;
	}
	
	/**
	 * Runs the SquirrelJME test.
	 *
	 * @since 2020/02/23
	 */
	@Test
	public void test()
	{
		// Create instance of test
		TestInterface instance;
		try
		{
			instance = (TestInterface)this.testClass.newInstance();
		}
		catch (ClassCastException|InstantiationException|
			IllegalAccessException e)
		{
			throw new RuntimeException("Failed to run test.", e);
		}
		
		// Print name of test as debug
		System.err.printf("Running test %s...%n",
			instance.getClass().getName());
		
		// Run the test with no parameters passed
		TestExecution execution = instance.runExecution();
		
		// Depends on the result
		switch (execution.status)
		{
			case SUCCESS:
				System.err.println(execution.result);
				break;
				
			case FAILED:
				execution.expected.printComparison(System.err,
					execution.result);
				Assert.fail(execution.result.toString());
				break;
				
			case TEST_EXCEPTION:
				throw new TestException("Error in test.",
					((execution.tossed instanceof Throwable) ?
						(Throwable)execution.tossed : (Throwable)null));
			
			case UNTESTABLE:
				throw new SkipException("Skipping test.",
					((execution.tossed instanceof Throwable) ?
						(Throwable)execution.tossed : (Throwable)null));
		}
	}
}

Added emulators/emulator-base/src/main/java/cc/squirreljme/emulator/SquirrelJMETestFactory.java.















































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.emulator;

import java.util.Collection;
import java.util.LinkedList;
import org.testng.ITestContext;
import org.testng.annotations.Factory;

/**
 * The factory for SquirrelJME Tests.
 *
 * @since 2020/02/23
 */
public class SquirrelJMETestFactory
{
	/** The name of the service. */
	public static final String SERVICE_NAME =
		"META-INF/services/net.multiphasicapps.tac.TestInterface";
	
	/**
	 * Produces the tests to run.
	 *
	 * @return The tests to run.
	 * @since 2020/02/23
	 */
	@Factory
	public Object[] createInstance(ITestContext __context)
		throws Exception
	{
		// Poke the native bindings class so it gets initializes and setup
		new NativeBinding();
		
		// Collect tests
		Collection<Object> tests = new LinkedList<>();
		for (String testName : SquirrelJMEAlterSuiteListener.findTestClasses())
			try
			{
				tests.add(Class.forName(testName));
			}
			catch (ClassNotFoundException e)
			{
				// Ignore
			}
		
		return tests.<Object>toArray(new Object[tests.size()]);
	}
}

Added emulators/emulator-base/src/main/java/cc/squirreljme/emulator/fb/NativeFramebuffer.java.



















































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.emulator.fb;

import cc.squirreljme.emulator.EmulatorThreadContext;
import cc.squirreljme.jvm.Assembly;
import cc.squirreljme.jvm.Framebuffer;
import cc.squirreljme.jvm.SystemCallError;
import cc.squirreljme.jvm.SystemCallIndex;

/**
 * Contains the support for the framebuffer.
 *
 * @since 2020/02/29
 */
public final class NativeFramebuffer
{
	/** Framebuffer instance. */
	private static NativeFramebuffer _FRAMEBUFFER =
		null;
	
	/** The framebuffer title. */
	protected String title;
	
	/**
	 * Performs system call with the framebuffer.
	 *
	 * @param __ctx The emulator context.
	 * @param __func The function to perform.
	 * @param __a A.
	 * @param __b B.
	 * @param __c C.
	 * @param __d D.
	 * @param __e E.
	 * @param __f F.
	 * @param __g G.
	 * @return The result of the system call.
	 * @since 2020/02/29
	 */
	public final long systemCall(EmulatorThreadContext __ctx, int __func,
		int __a, int __b, int __c, int __d, int __e, int __f, int __g)
	{
		// Depends on the function
		switch (__func)
		{
				// The format of the framebuffer
			case Framebuffer.CONTROL_FORMAT:
				return Framebuffer.FORMAT_INTEGER_RGB888;
			
				// The capabilities of the framebuffer
			case Framebuffer.CONTROL_GET_CAPABILITIES:
				return Framebuffer.CAPABILITY_COLOR |
					Framebuffer.CAPABILITY_IPC_EVENTS |
					Framebuffer.CAPABILITY_KEYBOARD |
					Framebuffer.CAPABILITY_TOUCH;
			
				// Set title of the framebuffer
			case Framebuffer.CONTROL_SET_TITLE:
				this.title = String.valueOf((char[])Assembly.pointerToObject(
					Assembly.longPack(__a, __b)));
				return 0;
			
			default:
				// So it is more easily known
				System.err.printf("FB?: %d(%d, %d, %d, %d, %d, %d, %d)\n",
					__func, __a, __b, __c, __d, __e, __f, __g);
				
				// Return as not supported
				__ctx.setError(SystemCallIndex.FRAMEBUFFER,
					SystemCallError.UNSUPPORTED_SYSTEM_CALL);
				return 0;
		}
	}
	
	/**
	 * Returns instance of the framebuffer.
	 *
	 * @return The framebuffer instance.
	 * @since 2020/02/29
	 */
	public static NativeFramebuffer getInstance()
	{
		NativeFramebuffer rv = NativeFramebuffer._FRAMEBUFFER;
		
		if (rv == null)
			synchronized (NativeFramebuffer.class)
			{
				rv = NativeFramebuffer._FRAMEBUFFER;
				if (rv == null)
				{
					rv = new NativeFramebuffer();
					NativeFramebuffer._FRAMEBUFFER = rv;
				}
			}
		
		return rv;
	}
}

Added emulators/emulator-base/src/main/java/cc/squirreljme/emulator/fb/package-info.java.





















>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.emulator.fb;

Added emulators/emulator-base/src/main/java/cc/squirreljme/emulator/package-info.java.





































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

/**
 * This package contains the base classes needed to support the emulator
 * sub-system.
 *
 * @since 2020/02/17
 */

package cc.squirreljme.emulator;

Name change from runt/libs/tool-profiler/net/multiphasicapps/profiler/FrameLocation.java to emulators/emulator-base/src/main/java/cc/squirreljme/emulator/profiler/FrameLocation.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.profiler;

import java.lang.ref.Reference;
import java.lang.ref.WeakReference;

/**
 * This represents the location of a frame.
 *










|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.emulator.profiler;

import java.lang.ref.Reference;
import java.lang.ref.WeakReference;

/**
 * This represents the location of a frame.
 *

Name change from runt/libs/tool-profiler/net/multiphasicapps/profiler/ProfiledFrame.java to emulators/emulator-base/src/main/java/cc/squirreljme/emulator/profiler/ProfiledFrame.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.profiler;

import java.util.LinkedHashMap;
import java.util.Map;

/**
 * This contains information and statistics for a single frame within the
 * thread stack.










|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.emulator.profiler;

import java.util.LinkedHashMap;
import java.util.Map;

/**
 * This contains information and statistics for a single frame within the
 * thread stack.

Name change from runt/libs/tool-profiler/net/multiphasicapps/profiler/ProfiledThread.java to emulators/emulator-base/src/main/java/cc/squirreljme/emulator/profiler/ProfiledThread.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.profiler;

import java.util.ArrayDeque;
import java.util.Deque;
import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.Map;

/**
 * This stores information along with the thread information along with the










|

<







1
2
3
4
5
6
7
8
9
10
11
12

13
14
15
16
17
18
19
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.emulator.profiler;


import java.util.Deque;
import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.Map;

/**
 * This stores information along with the thread information along with the

Name change from runt/libs/tool-profiler/net/multiphasicapps/profiler/ProfilerSnapshot.java to emulators/emulator-base/src/main/java/cc/squirreljme/emulator/profiler/ProfilerSnapshot.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.profiler;

import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintStream;
import java.util.Date;










|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.emulator.profiler;

import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintStream;
import java.util.Date;

Name change from runt/libs/tool-profiler/net/multiphasicapps/profiler/__NodeTable__.java to emulators/emulator-base/src/main/java/cc/squirreljme/emulator/profiler/__NodeTable__.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.profiler;

import java.io.DataOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;










|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.emulator.profiler;

import java.io.DataOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;

Name change from runt/libs/tool-profiler/net/multiphasicapps/profiler/package-info.java to emulators/emulator-base/src/main/java/cc/squirreljme/emulator/profiler/package-info.java.

12
13
14
15
16
17
18
19
20
 * This package contains the profiler or rather the code which supports the
 * generation of profiling snapshots which can be used to measure performance
 * and such.
 *
 * @since 2018/11/10
 */

package net.multiphasicapps.profiler;








|

12
13
14
15
16
17
18
19
20
 * This package contains the profiler or rather the code which supports the
 * generation of profiling snapshots which can be used to measure performance
 * and such.
 *
 * @since 2018/11/10
 */

package cc.squirreljme.emulator.profiler;

Added emulators/emulator-base/src/main/java/cc/squirreljme/emulator/vm/ArraySuiteManager.java.





































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.emulator.vm;

import cc.squirreljme.vm.VMClassLibrary;
import java.util.Collection;
import java.util.LinkedList;

/**
 * This is a suite manager which is just a group of already specified
 * libraries.
 *
 * @since 2020/02/29
 */
public final class ArraySuiteManager
	implements VMSuiteManager
{
	/** Local libraries. */
	private final VMClassLibrary[] _libraries;
	
	/**
	 * Initializes the library manager.
	 *
	 * @param __libs Libraries to use.
	 * @since 2020/02/29
	 */
	public ArraySuiteManager(VMClassLibrary... __libs)
	{
		this._libraries = (__libs == null ? new VMClassLibrary[0] :
			__libs.clone());
			
		for (VMClassLibrary lib : this._libraries)
			if (lib == null)
				throw new NullPointerException("NARG");
	}
	
	/**
	 * Initializes the library manager.
	 *
	 * @param __libs Libraries to use.
	 * @since 2020/02/29
	 */
	public ArraySuiteManager(Iterable<VMClassLibrary> __libs)
	{
		Collection<VMClassLibrary> copy = new LinkedList<>();
		for (VMClassLibrary lib : __libs)
			copy.add(lib);
		
		this._libraries = copy.<VMClassLibrary>toArray(
			new VMClassLibrary[copy.size()]);
		
		for (VMClassLibrary lib : this._libraries)
			if (lib == null)
				throw new NullPointerException("NARG");
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2020/02/29
	 */
	@Override
	public String[] listLibraryNames()
	{
		VMClassLibrary[] libraries = this._libraries;
		int n = libraries.length;
		
		String[] rv = new String[n];
		for (int i = 0; i < n; i++)
			rv[i] = libraries[i].name();
		
		return rv;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2020/02/29
	 */
	@Override
	public VMClassLibrary loadLibrary(String __s)
		throws NullPointerException
	{
		if (__s == null)
			throw new NullPointerException("NARG");
		
		for (VMClassLibrary lib : this._libraries)
			if (__s.equals(lib.name()))
				return lib;
		
		return null;
	}
}

Name change from runt/libs/common-vm/cc/squirreljme/vm/InMemoryClassLibrary.java to emulators/emulator-base/src/main/java/cc/squirreljme/emulator/vm/InMemoryClassLibrary.java.

1
2
3
4
5
6
7
8
9
10
11
12

13
14
15
16
17
18
19
20
21
22
23
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.vm;


import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.io.IOException;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import net.multiphasicapps.zip.streamreader.ZipStreamEntry;
import net.multiphasicapps.zip.streamreader.ZipStreamReader;

/**










|

>


|
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.emulator.vm;

import cc.squirreljme.vm.VMClassLibrary;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import net.multiphasicapps.zip.streamreader.ZipStreamEntry;
import net.multiphasicapps.zip.streamreader.ZipStreamReader;

/**
99
100
101
102
103
104
105

106
107
108
109
110
111
112
113
114
115




116



117


118

119

120
121
122
123
124
125
126
127
128
	 * @param __n The library name.
	 * @param __in The input stream.
	 * @return The class library.
	 * @throws IOException On read errors.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/12/08
	 */

	public static final InMemoryClassLibrary loadZip(String __n,
		ZipStreamReader __in)
		throws IOException, NullPointerException
	{
		if (__n == null || __in == null)
			throw new NullPointerException("NARG");
		
		// Target map
		Map<String, byte[]> rv = new HashMap<>();
		




		ZipStreamEntry zse;



		while (null != (zse = __in.nextEntry()))


		{

			try (ByteArrayOutputStream baos = new ByteArrayOutputStream(1024))

			{
				byte[] buf = new byte[512];
				for (;;)
				{
					int rc = zse.read(buf);
					
					if (rc < 0)
						break;
					







>










>
>
>
>

>
>
>
|
>
>
|
>
|
>

<







100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133

134
135
136
137
138
139
140
	 * @param __n The library name.
	 * @param __in The input stream.
	 * @return The class library.
	 * @throws IOException On read errors.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/12/08
	 */
	@SuppressWarnings("resource")
	public static final InMemoryClassLibrary loadZip(String __n,
		ZipStreamReader __in)
		throws IOException, NullPointerException
	{
		if (__n == null || __in == null)
			throw new NullPointerException("NARG");
		
		// Target map
		Map<String, byte[]> rv = new HashMap<>();
		
		// Temporary buffer to reading class data
		byte[] buf = new byte[4096];
		
		// Process all entries
		ZipStreamEntry zse;
		while (true)
		{
			// No more entries?
			zse = __in.nextEntry();
			if (zse == null)
				break;
			
			// Copy data over
			try (ByteArrayOutputStream baos =
				new ByteArrayOutputStream(8192))
			{

				for (;;)
				{
					int rc = zse.read(buf);
					
					if (rc < 0)
						break;
					

Name change from runt/libs/common-vm/cc/squirreljme/vm/MergedSuiteManager.java to emulators/emulator-base/src/main/java/cc/squirreljme/emulator/vm/MergedSuiteManager.java.

1
2
3
4
5
6
7
8
9
10
11
12

13
14
15
16
17
18
19
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.vm;


import java.util.LinkedHashSet;
import java.util.Set;

/**
 * This is a suite manager which merges multiple suite managers into one so
 * that more libraries from different sources may be included.
 *










|

>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.emulator.vm;

import cc.squirreljme.vm.VMClassLibrary;
import java.util.LinkedHashSet;
import java.util.Set;

/**
 * This is a suite manager which merges multiple suite managers into one so
 * that more libraries from different sources may be included.
 *

Name change from runt/libs/common-vm/cc/squirreljme/vm/PathSuiteManager.java to emulators/emulator-base/src/main/java/cc/squirreljme/emulator/vm/PathSuiteManager.java.

1
2
3
4
5
6
7
8
9
10
11
12

13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.vm;


import java.io.InputStream;
import java.io.IOException;
import java.nio.file.DirectoryStream;
import java.nio.file.Files;
import java.nio.file.NoSuchFileException;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardOpenOption;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import net.multiphasicapps.zip.streamreader.ZipStreamReader;

/**
 * This is a suite manager which uses the filesystem.
 *










|

>
|
|




<

<


<







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19

20

21
22

23
24
25
26
27
28
29
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.emulator.vm;

import cc.squirreljme.vm.VMClassLibrary;
import java.io.IOException;
import java.io.InputStream;
import java.nio.file.DirectoryStream;
import java.nio.file.Files;
import java.nio.file.NoSuchFileException;
import java.nio.file.Path;

import java.nio.file.StandardOpenOption;

import java.util.HashMap;
import java.util.LinkedHashSet;

import java.util.Map;
import java.util.Set;
import net.multiphasicapps.zip.streamreader.ZipStreamReader;

/**
 * This is a suite manager which uses the filesystem.
 *

Name change from runt/libs/common-vm/cc/squirreljme/vm/ResourceBasedClassLibrary.java to emulators/emulator-base/src/main/java/cc/squirreljme/emulator/vm/ResourceBasedClassLibrary.java.

1
2
3
4
5
6
7
8
9
10
11
12

13
14
15
16
17
18
19
20
21
22
23
24
25
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.vm;


import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.IOException;
import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import java.util.LinkedList;
import java.util.List;

/**
 * This is a class library resource which is based on class resources.
 *
 * @since 2018/11/14










|

>

|
|
|
<
<







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17


18
19
20
21
22
23
24
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.emulator.vm;

import cc.squirreljme.vm.VMClassLibrary;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;


import java.util.LinkedList;
import java.util.List;

/**
 * This is a class library resource which is based on class resources.
 *
 * @since 2018/11/14

Name change from runt/libs/common-vm/cc/squirreljme/vm/ResourceBasedSuiteManager.java to emulators/emulator-base/src/main/java/cc/squirreljme/emulator/vm/ResourceBasedSuiteManager.java.

1
2
3
4
5
6
7
8
9
10
11
12

13
14
15
16
17
18
19
20
21
22
23
24
25
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.vm;


import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.IOException;
import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * This is a suite manager which is based on resources for accessing various










|

>

|
|
|
<
<







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17


18
19
20
21
22
23
24
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.emulator.vm;

import cc.squirreljme.vm.VMClassLibrary;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;


import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * This is a suite manager which is based on resources for accessing various

Name change from runt/libs/common-vm/cc/squirreljme/vm/VMException.java to emulators/emulator-base/src/main/java/cc/squirreljme/emulator/vm/VMException.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.vm;

/**
 * Base class for exceptions in the virtual machine.
 *
 * @since 2018/11/17
 */
public class VMException










|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.emulator.vm;

/**
 * Base class for exceptions in the virtual machine.
 *
 * @since 2018/11/17
 */
public class VMException

Name change from runt/libs/common-vm/cc/squirreljme/vm/VMFactory.java to emulators/emulator-base/src/main/java/cc/squirreljme/emulator/vm/VMFactory.java.

1
2
3
4
5
6
7
8
9
10
11
12


13
14
15
16

17
18

19

20
21
22


23



24

25
26

27
28
29
30
31
32
33
34
35
36
37
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.vm;



import cc.squirreljme.runtime.cldc.asm.SystemProperties;
import cc.squirreljme.runtime.cldc.lang.GuestDepth;
import cc.squirreljme.runtime.swm.EntryPoint;
import cc.squirreljme.runtime.swm.EntryPoints;

import java.io.InputStream;
import java.io.IOException;

import java.io.OutputStream;

import java.nio.file.InvalidPathException;
import java.nio.file.Path;
import java.nio.file.Paths;


import java.util.ArrayList;



import java.util.HashMap;

import java.util.List;
import java.util.Map;

import java.util.ServiceLoader;
import net.multiphasicapps.profiler.ProfilerSnapshot;
import net.multiphasicapps.tool.manifest.JavaManifest;
import net.multiphasicapps.tool.manifest.JavaManifestAttributes;

/**
 * This class is used to initialize virtual machines based on a set of factory
 * classes.
 *
 * This was added because there were many cases where tons of code was
 * duplicated to initialize the virtual machine, which were effectively










|

>
>




>
|

>

>



>
>

>
>
>

>


>

|
|
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.emulator.vm;

import cc.squirreljme.emulator.profiler.ProfilerSnapshot;
import cc.squirreljme.runtime.cldc.Poking;
import cc.squirreljme.runtime.cldc.asm.SystemProperties;
import cc.squirreljme.runtime.cldc.lang.GuestDepth;
import cc.squirreljme.runtime.swm.EntryPoint;
import cc.squirreljme.runtime.swm.EntryPoints;
import cc.squirreljme.vm.VMClassLibrary;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.nio.file.Files;
import java.nio.file.InvalidPathException;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardOpenOption;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Deque;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.ServiceLoader;
import net.multiphasicapps.tool.manifest.JavaManifest;
import net.multiphasicapps.tool.manifest.JavaManifestAttributes;
import net.multiphasicapps.zip.streamreader.ZipStreamReader;

/**
 * This class is used to initialize virtual machines based on a set of factory
 * classes.
 *
 * This was added because there were many cases where tons of code was
 * duplicated to initialize the virtual machine, which were effectively
80
81
82
83
84
85
86

























































































































































87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103

104
105
106
107
108
109
110
111
112

113
114
115
116
117
118
119
	 * @since 2018/11/17
	 */
	protected abstract VirtualMachine createVM(ProfilerSnapshot __ps,
		VMSuiteManager __sm, VMClassLibrary[] __cp, String __maincl,
		boolean __ismid, int __gd, Map<String, String> __sprops,
		String[] __args)
		throws IllegalArgumentException, NullPointerException, VMException;

























































































































































	
	/**
	 * Main entry point for the virtual machine using the given properties.
	 *
	 * @param __vm The name of the virtual machine to use, if {@code null}
	 * then this is automatically determined.
	 * @param __ps The profiler snapshot to use.
	 * @param __sm The suite manager used.
	 * @param __cp The starting class path.
	 * @param __bootcl The booting class, if {@code null} then {@code __bootid}
	 * is used instead.
	 * @param __bootid The booting index, if negative then {@code __bootcl}
	 * is used instead. This value takes priority.
	 * @param __gd The guest depth of the virtual machine, if negative this
	 * is automatically determined.
	 * @param __sprops System properties to pass to the target VM.
	 * @param __args Arguments to the program which is running.

	 * @throws IllegalArgumentException If neither a boot class or boot ID
	 * were specified.
	 * @throws NullPointerException On null arguments.
	 * @throws VMException If the virtual machine failed to initialize.
	 * @since 2018/11/17
	 */
	public static final VirtualMachine main(String __vm, ProfilerSnapshot __ps,
		VMSuiteManager __sm, String[] __cp, String __bootcl, int __bootid,
		int __gd, Map<String, String> __sprops, String... __args)

		throws IllegalArgumentException, NullPointerException, VMException
	{
		if (__sm == null || __cp == null)
			throw new NullPointerException("NARG");
		
		// {@squirreljme.error AK02 Neither the boot class or boot ID was
		// specified, one must be specified.}







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

















>






|
|
|
>







92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
	 * @since 2018/11/17
	 */
	protected abstract VirtualMachine createVM(ProfilerSnapshot __ps,
		VMSuiteManager __sm, VMClassLibrary[] __cp, String __maincl,
		boolean __ismid, int __gd, Map<String, String> __sprops,
		String[] __args)
		throws IllegalArgumentException, NullPointerException, VMException;
	
	/**
	 * Main entry point for general programs.
	 *
	 * @param __args Arguments.
	 * @since 2020/02/29
	 */
	public static void main(String... __args)
	{
		// Poke the VM to initialize some probably important parts of it
		Poking.poke();
		
		// Default settings
		String vmName = "springcoat";
		Path snapshotPath = null;
		Collection<String> suiteClasspath = new LinkedList<>();
		
		// There always is a profiler being run, just differs if we save it
		ProfilerSnapshot profilerSnapshot = new ProfilerSnapshot();
		
		// Command line format is:
		// -Xemulator:(vm)
		// -Xsnapshot:(path-to-nps)
		// -classpath (class:path:...)
		// Main-class
		// Arguments...
		Deque<String> queue = new ArrayDeque<>(Arrays.<String>asList(__args));
		while (!queue.isEmpty())
		{
			// End of our items?
			String item = queue.peekFirst();
			if (item == null || item.isEmpty() || item.charAt(0) != '-')
				break;
			
			// Eat it up
			queue.removeFirst();
			
			// Select a VM
			if (item.startsWith("-Xemulator:"))
				vmName = item.substring("-Xemulator:".length());
			
			// VisualVM Snapshot Dump path
			else if (item.startsWith("-Xsnapshot:"))
				snapshotPath = Paths.get(
					item.substring("-Xsnapshot:".length()));
			
			// JARs to load
			else if (item.equals("-classpath") || item.equals("-cp"))
			{
				// Get argument attached to this
				String strings = queue.pollFirst();
				if (strings == null)
					throw new NullPointerException("Classpath missing.");
				
				// Extract path elements
				for (int i = 0, n = strings.length(); i < n; i++)
				{
					// Get location of the next colon
					int dx = strings.indexOf(File.pathSeparatorChar, i);
					if (dx < 0)
						dx = n;
					
					// Add to path
					suiteClasspath.add(strings.substring(i, dx));
					
					// Go to next colon
					i = dx;
				}
			}
			
			// Unknown
			else
				throw new IllegalArgumentException(String.format(
					"Unknown command line switch: %s", item));
		}
		
		// Main class is here
		String mainClass = Objects.<String>requireNonNull(queue.pollFirst(),
			"No main class specified.");
		
		// Fill in the rest with the main argument calls
		Collection<String> mainArgs = new LinkedList<>();
		while (!queue.isEmpty())
			mainArgs.add(queue.removeFirst());
		
		// Collect all the suites together
		Collection<String> classpath = new LinkedList<>();
		Collection<VMClassLibrary> suites = new LinkedList<>();
		for (String classitem : suiteClasspath)
		{
			Path path = Paths.get(classitem);
			
			// Load it into memory
			try (InputStream in = Files.newInputStream(path,
					StandardOpenOption.READ);
				ZipStreamReader zip = new ZipStreamReader(in))
			{
				String normalName = VMFactory.__normalizeName(
					path.getFileName().toString());
				
				System.err.printf("Loading %s (%s)...%n", normalName, path);
				suites.add(InMemoryClassLibrary.loadZip(
					normalName, zip));
				
				// Use the true name here
				classpath.add(normalName);
			}
			catch (IOException e)
			{
				throw new RuntimeException("Could not load library.", e);
			}
		}
		
		// Run the VM, but always make sure we can
		int exitCode = -1;
		try
		{
			// Debug
			System.err.println("Starting virtual machine...");
			
			// Run the VM
			VirtualMachine vm = VMFactory.mainVm(vmName,
				profilerSnapshot,
				new ArraySuiteManager(suites),
				classpath.<String>toArray(new String[classpath.size()]),
				mainClass,
				0, 0, null,
				mainArgs.<String>toArray(new String[mainArgs.size()]));
			
			// Run the virtual machine until it exits
			exitCode = vm.runVm();
			System.exit(vm.runVm());
		}
		
		// Always write the snapshot file
		finally
		{
			if (snapshotPath != null)
				try (OutputStream out = Files.newOutputStream(snapshotPath,
					StandardOpenOption.WRITE, StandardOpenOption.CREATE,
					StandardOpenOption.TRUNCATE_EXISTING))
				{
					profilerSnapshot.writeTo(out);
				}
				catch (IOException e)
				{
					// Ignore
				}
		}
		
		// Exit with the exit code the VM gave us back
		System.exit(exitCode);
	}
	
	/**
	 * Main entry point for the virtual machine using the given properties.
	 *
	 * @param __vm The name of the virtual machine to use, if {@code null}
	 * then this is automatically determined.
	 * @param __ps The profiler snapshot to use.
	 * @param __sm The suite manager used.
	 * @param __cp The starting class path.
	 * @param __bootcl The booting class, if {@code null} then {@code __bootid}
	 * is used instead.
	 * @param __bootid The booting index, if negative then {@code __bootcl}
	 * is used instead. This value takes priority.
	 * @param __gd The guest depth of the virtual machine, if negative this
	 * is automatically determined.
	 * @param __sprops System properties to pass to the target VM.
	 * @param __args Arguments to the program which is running.
	 * @return The created virtual machine.
	 * @throws IllegalArgumentException If neither a boot class or boot ID
	 * were specified.
	 * @throws NullPointerException On null arguments.
	 * @throws VMException If the virtual machine failed to initialize.
	 * @since 2018/11/17
	 */
	public static final VirtualMachine mainVm(String __vm,
		ProfilerSnapshot __ps, VMSuiteManager __sm, String[] __cp,
		String __bootcl, int __bootid, int __gd, Map<String, String> __sprops,
		String... __args)
		throws IllegalArgumentException, NullPointerException, VMException
	{
		if (__sm == null || __cp == null)
			throw new NullPointerException("NARG");
		
		// {@squirreljme.error AK02 Neither the boot class or boot ID was
		// specified, one must be specified.}
168
169
170
171
172
173
174






175

176
177
178
179
180
181
182
		if (__ps == null)
			__ps = new ProfilerSnapshot();
		
		// Go through the suites and load the classpath that we are using
		int numlibs = __cp.length;
		VMClassLibrary[] classpath = new VMClassLibrary[numlibs];
		for (int i = 0; i < numlibs; i++)






			classpath[i] = __sm.loadLibrary(__cp[i]);

		
		// Need to load the manifest where the entry points will be
		VMClassLibrary bl = classpath[numlibs - 1];
		EntryPoints entries;
		try (InputStream in = bl.resourceAsStream("META-INF/MANIFEST.MF"))
		{
			// {@squirreljme.error AK04 Entry point JAR has no manifest.}







>
>
>
>
>
>
|
>







335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
		if (__ps == null)
			__ps = new ProfilerSnapshot();
		
		// Go through the suites and load the classpath that we are using
		int numlibs = __cp.length;
		VMClassLibrary[] classpath = new VMClassLibrary[numlibs];
		for (int i = 0; i < numlibs; i++)
		{
			VMClassLibrary lib = __sm.loadLibrary(__cp[i]);
			if (lib == null)
				throw new IllegalArgumentException(String.format(
					"Library %s not in classpath!", __cp[i]));
			
			classpath[i] = lib;
		}
		
		// Need to load the manifest where the entry points will be
		VMClassLibrary bl = classpath[numlibs - 1];
		EntryPoints entries;
		try (InputStream in = bl.resourceAsStream("META-INF/MANIFEST.MF"))
		{
			// {@squirreljme.error AK04 Entry point JAR has no manifest.}
229
230
231
232
233
234
235

236
237
238
239
240
241
242
243
244
245
246
247

248
249
250
251
252
253
254
	
	/**
	 * Shaded main entry point.
	 *
	 * @param __args Arguments to the program.
	 * @since 2018/11/17
	 */

	public static final void shadedMain(String... __args)
	{
		VMFactory.shadedMain((Map<String, String>)null, __args);
	}
	
	/**
	 * Shaded main entry point, with extra properties map.
	 *
	 * @param __sprops Properties map to use.
	 * @param __args Arguments to the program.
	 * @since 2018/11/17
	 */

	public static final void shadedMain(Map<String, String> __sprops,
		String... __args)
	{
		// Defensive copy and force to exist
		__args = (__args == null ? new String[0] : __args.clone());
		__sprops = (__sprops == null ? new HashMap<String, String>() :
			new HashMap<String, String>(__sprops));







>












>







403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
	
	/**
	 * Shaded main entry point.
	 *
	 * @param __args Arguments to the program.
	 * @since 2018/11/17
	 */
	@Deprecated
	public static final void shadedMain(String... __args)
	{
		VMFactory.shadedMain((Map<String, String>)null, __args);
	}
	
	/**
	 * Shaded main entry point, with extra properties map.
	 *
	 * @param __sprops Properties map to use.
	 * @param __args Arguments to the program.
	 * @since 2018/11/17
	 */
	@Deprecated
	public static final void shadedMain(Map<String, String> __sprops,
		String... __args)
	{
		// Defensive copy and force to exist
		__args = (__args == null ? new String[0] : __args.clone());
		__sprops = (__sprops == null ? new HashMap<String, String>() :
			new HashMap<String, String>(__sprops));
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
		
		// Do the merge?
		if (mergesm.size() > 1)
			sm = new MergedSuiteManager(mergesm.<VMSuiteManager>toArray(
				new VMSuiteManager[mergesm.size()]));
		
		// Create the VM
		VirtualMachine vm = VMFactory.main(null, null,
			sm, classpath.<String>toArray(new String[classpath.size()]),
			usemain, bootid, -1, null, __args);
		
		// Run the VM and exit with the code it generates
		System.exit(vm.runVm());
	}
	







|







577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
		
		// Do the merge?
		if (mergesm.size() > 1)
			sm = new MergedSuiteManager(mergesm.<VMSuiteManager>toArray(
				new VMSuiteManager[mergesm.size()]));
		
		// Create the VM
		VirtualMachine vm = VMFactory.mainVm(null, null,
			sm, classpath.<String>toArray(new String[classpath.size()]),
			usemain, bootid, -1, null, __args);
		
		// Run the VM and exit with the code it generates
		System.exit(vm.runVm());
	}
	
462
463
464
465
466
467
468
469


470


































			return __def;
		}
		catch (SecurityException e)
		{
			return __def;
		}
	}
}












































|
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
			return __def;
		}
		catch (SecurityException e)
		{
			return __def;
		}
	}
	
	/**
	 * Normalizes the name of the library.
	 *
	 * @param __name The name of the JAR.
	 * @return The normalized name.
	 * @throws NullPointerException On null arguments.
	 * @since 2020/03/01
	 */
	private static String __normalizeName(String __name)
		throws NullPointerException
	{
		if (__name == null)
			throw new NullPointerException("NARG");
		
		// Get the base name of the JAR
		if (__name.endsWith(".jar"))
			__name = __name.substring(0, __name.length() - ".jar".length());
		
		// Chop down potential foo"-0.4.0" from the end
		for (int n = __name.length(), i = n - 1; i >= 0; i--)
		{
			char c = __name.charAt(i);
			
			// Still potentially a version bit
			if (c == '.' || c == '-' || (c >= '0' && c <= '9'))
				__name = __name.substring(0, i);
			
			// Do not need
			else
				break;
		}
		
		// Use this name
		return __name + ".jar";
	}
}

Name change from runt/libs/common-vm/cc/squirreljme/vm/VMResourceAccess.java to emulators/emulator-base/src/main/java/cc/squirreljme/emulator/vm/VMResourceAccess.java.

1
2
3
4
5
6
7
8
9
10
11
12

13
14
15
16
17
18
19
20
21
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.vm;


import java.io.InputStream;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

/**
 * This class manages access to resources within the virtual machine.
 *
 * @since 2018/10/07










|

>
|
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.emulator.vm;

import cc.squirreljme.vm.VMClassLibrary;
import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.Map;

/**
 * This class manages access to resources within the virtual machine.
 *
 * @since 2018/10/07

Name change from runt/libs/common-vm/cc/squirreljme/vm/VMSuiteManager.java to emulators/emulator-base/src/main/java/cc/squirreljme/emulator/vm/VMSuiteManager.java.

1
2
3
4
5
6
7
8
9
10
11


12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.vm;



/**
 * This is the suite manager which represents the.
 *
 * @since 2018/10/26
 */
public interface VMSuiteManager
{
	/**
	 * Lists the names of libraries which are available for usage.
	 *
	 * @return The list of available libraries.
	 * @since 2018/10/26
	 */
	public abstract String[] listLibraryNames();
	
	/**
	 * Loads the specified library by the given string.
	 *
	 * It is recommended that this caches the library internally so that it may
	 * be reused accordingly as such.
	 *
	 * @param __s The name of the library to load.
	 * @return The loaded library, or {@code null} if it does not exist.
	 * @since 2018/10/16
	 */
	public abstract VMClassLibrary loadLibrary(String __s)
		throws NullPointerException;
}











|
>
>














|











|



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.emulator.vm;

import cc.squirreljme.vm.VMClassLibrary;

/**
 * This is the suite manager which represents the.
 *
 * @since 2018/10/26
 */
public interface VMSuiteManager
{
	/**
	 * Lists the names of libraries which are available for usage.
	 *
	 * @return The list of available libraries.
	 * @since 2018/10/26
	 */
	String[] listLibraryNames();
	
	/**
	 * Loads the specified library by the given string.
	 *
	 * It is recommended that this caches the library internally so that it may
	 * be reused accordingly as such.
	 *
	 * @param __s The name of the library to load.
	 * @return The loaded library, or {@code null} if it does not exist.
	 * @since 2018/10/16
	 */
	VMClassLibrary loadLibrary(String __s)
		throws NullPointerException;
}

Name change from runt/libs/common-vm/cc/squirreljme/vm/VirtualMachine.java to emulators/emulator-base/src/main/java/cc/squirreljme/emulator/vm/VirtualMachine.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.vm;

/**
 * This interface represents the virtual machine which may be executed
 * accordingly.
 *
 * @since 2018/11/17
 */
public interface VirtualMachine
{
	/**
	 * Runs the virtual machine.
	 *
	 * @return The exit code of the virtual machine.
	 * @throws VMException If the VM threw an exception.
	 * @since 2018/11/17
	 */
	public abstract int runVm()
		throws VMException;
}











|
















|



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.emulator.vm;

/**
 * This interface represents the virtual machine which may be executed
 * accordingly.
 *
 * @since 2018/11/17
 */
public interface VirtualMachine
{
	/**
	 * Runs the virtual machine.
	 *
	 * @return The exit code of the virtual machine.
	 * @throws VMException If the VM threw an exception.
	 * @since 2018/11/17
	 */
	int runVm()
		throws VMException;
}

Added emulators/emulator-base/src/main/java/cc/squirreljme/emulator/vm/package-info.java.





















>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.emulator.vm;

Added emulators/emulator-base/src/main/resources/META-INF/services/org.testng.IAlterSuiteListener.



>
1
cc.squirreljme.emulator.SquirrelJMEAlterSuiteListener

Added emulators/emulator-base/src/main/resources/squirreljme.xml.





























>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="squirreljme">
    <listeners>
        <listener
            class-name="cc.squirreljme.emulator.SquirrelJMEAlterSuiteListener"
            />
    </listeners>
    <test name="tests">
        <classes>
            <class name="cc.squirreljme.emulator.SquirrelJMETestFactory"/>
        </classes>
    </test>
</suite>

Added emulators/springcoat-vm/build.gradle.











































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
plugins
{
	id "java-library"
}

description = "This is a SpringCoat virtual machine which " +
	"is an unoptimized pure interpreter aimed for the purpose of being an " +
	"educational stepping stone to other future virtual machines."

dependencies
{
	api project(":emulators:emulator-base")

	api project(":modules:cldc-compact")
	api project(":modules:tool-classfile")
	api project(":modules:tool-manifest-reader")
	api project(":modules:meep-swm")
	api project(":modules:meep-midlet")
	api project(":modules:common-vm")
	api project(":modules:collections")
}

Name change from runt/libs/springcoat-vm/cc/squirreljme/vm/springcoat/SpringArithmeticException.java to emulators/springcoat-vm/src/main/java/cc/squirreljme/vm/springcoat/SpringArithmeticException.java.

Name change from runt/libs/springcoat-vm/cc/squirreljme/vm/springcoat/SpringArrayIndexOutOfBoundsException.java to emulators/springcoat-vm/src/main/java/cc/squirreljme/vm/springcoat/SpringArrayIndexOutOfBoundsException.java.

Name change from runt/libs/springcoat-vm/cc/squirreljme/vm/springcoat/SpringArrayObject.java to emulators/springcoat-vm/src/main/java/cc/squirreljme/vm/springcoat/SpringArrayObject.java.

8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.vm.springcoat;

import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import net.multiphasicapps.classfile.PrimitiveType;

/**
 * This is an object which acts as an array, which stores some kind of data.
 *
 * @since 2018/09/15
 */
public abstract class SpringArrayObject







<







8
9
10
11
12
13
14

15
16
17
18
19
20
21
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.vm.springcoat;

import java.lang.ref.Reference;
import java.lang.ref.WeakReference;


/**
 * This is an object which acts as an array, which stores some kind of data.
 *
 * @since 2018/09/15
 */
public abstract class SpringArrayObject

Name change from runt/libs/springcoat-vm/cc/squirreljme/vm/springcoat/SpringArrayObjectBoolean.java to emulators/springcoat-vm/src/main/java/cc/squirreljme/vm/springcoat/SpringArrayObjectBoolean.java.

84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
		}
		
		// {@squirreljme.error BK02 Out of bounds access to array. (The index;
		// The length of the array)}
		catch (IndexOutOfBoundsException e)
		{
			throw new SpringArrayIndexOutOfBoundsException(
				String.format("BK02 %d %d", __dx, length), e);
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/11/14
	 */







|







84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
		}
		
		// {@squirreljme.error BK02 Out of bounds access to array. (The index;
		// The length of the array)}
		catch (IndexOutOfBoundsException e)
		{
			throw new SpringArrayIndexOutOfBoundsException(
				String.format("BK02 %d %d", __dx, this.length), e);
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/11/14
	 */

Name change from runt/libs/springcoat-vm/cc/squirreljme/vm/springcoat/SpringArrayObjectByte.java to emulators/springcoat-vm/src/main/java/cc/squirreljme/vm/springcoat/SpringArrayObjectByte.java.

85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
		}
		
		// {@squirreljme.error BK05 Out of bounds access to array. (The index;
		// The length of the array)}
		catch (IndexOutOfBoundsException e)
		{
			throw new SpringArrayIndexOutOfBoundsException(
				String.format("BK05 %d %d", __dx, length), e);
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/11/14
	 */







|







85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
		}
		
		// {@squirreljme.error BK05 Out of bounds access to array. (The index;
		// The length of the array)}
		catch (IndexOutOfBoundsException e)
		{
			throw new SpringArrayIndexOutOfBoundsException(
				String.format("BK05 %d %d", __dx, this.length), e);
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/11/14
	 */

Name change from runt/libs/springcoat-vm/cc/squirreljme/vm/springcoat/SpringArrayObjectChar.java to emulators/springcoat-vm/src/main/java/cc/squirreljme/vm/springcoat/SpringArrayObjectChar.java.

85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
		}
		
		// {@squirreljme.error BK08 Out of bounds access to array. (The index;
		// The length of the array)}
		catch (IndexOutOfBoundsException e)
		{
			throw new SpringArrayIndexOutOfBoundsException(
				String.format("BK08 %d %d", __dx, length), e);
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/11/14
	 */







|







85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
		}
		
		// {@squirreljme.error BK08 Out of bounds access to array. (The index;
		// The length of the array)}
		catch (IndexOutOfBoundsException e)
		{
			throw new SpringArrayIndexOutOfBoundsException(
				String.format("BK08 %d %d", __dx, this.length), e);
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/11/14
	 */

Name change from runt/libs/springcoat-vm/cc/squirreljme/vm/springcoat/SpringArrayObjectDouble.java to emulators/springcoat-vm/src/main/java/cc/squirreljme/vm/springcoat/SpringArrayObjectDouble.java.

85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
		}
		
		// {@squirreljme.error BK0b Out of bounds access to array. (The index;
		// The length of the array)}
		catch (IndexOutOfBoundsException e)
		{
			throw new SpringArrayIndexOutOfBoundsException(
				String.format("BK0b %d %d", __dx, length), e);
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/11/14
	 */







|







85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
		}
		
		// {@squirreljme.error BK0b Out of bounds access to array. (The index;
		// The length of the array)}
		catch (IndexOutOfBoundsException e)
		{
			throw new SpringArrayIndexOutOfBoundsException(
				String.format("BK0b %d %d", __dx, this.length), e);
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/11/14
	 */

Name change from runt/libs/springcoat-vm/cc/squirreljme/vm/springcoat/SpringArrayObjectFloat.java to emulators/springcoat-vm/src/main/java/cc/squirreljme/vm/springcoat/SpringArrayObjectFloat.java.

85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
		}
		
		// {@squirreljme.error BK0e Out of bounds access to array. (The index;
		// The length of the array)}
		catch (IndexOutOfBoundsException e)
		{
			throw new SpringArrayIndexOutOfBoundsException(
				String.format("BK0e %d %d", __dx, length), e);
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/11/14
	 */







|







85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
		}
		
		// {@squirreljme.error BK0e Out of bounds access to array. (The index;
		// The length of the array)}
		catch (IndexOutOfBoundsException e)
		{
			throw new SpringArrayIndexOutOfBoundsException(
				String.format("BK0e %d %d", __dx, this.length), e);
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/11/14
	 */

Name change from runt/libs/springcoat-vm/cc/squirreljme/vm/springcoat/SpringArrayObjectGeneric.java to emulators/springcoat-vm/src/main/java/cc/squirreljme/vm/springcoat/SpringArrayObjectGeneric.java.

Name change from runt/libs/springcoat-vm/cc/squirreljme/vm/springcoat/SpringArrayObjectInteger.java to emulators/springcoat-vm/src/main/java/cc/squirreljme/vm/springcoat/SpringArrayObjectInteger.java.

85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
		}
		
		// {@squirreljme.error BK0k Out of bounds access to array. (The index;
		// The length of the array)}
		catch (IndexOutOfBoundsException e)
		{
			throw new SpringArrayIndexOutOfBoundsException(
				String.format("BK0k %d %d", __dx, length), e);
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/11/14
	 */







|







85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
		}
		
		// {@squirreljme.error BK0k Out of bounds access to array. (The index;
		// The length of the array)}
		catch (IndexOutOfBoundsException e)
		{
			throw new SpringArrayIndexOutOfBoundsException(
				String.format("BK0k %d %d", __dx, this.length), e);
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/11/14
	 */

Name change from runt/libs/springcoat-vm/cc/squirreljme/vm/springcoat/SpringArrayObjectLong.java to emulators/springcoat-vm/src/main/java/cc/squirreljme/vm/springcoat/SpringArrayObjectLong.java.

85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
		}
		
		// {@squirreljme.error BK0n Out of bounds access to array. (The index;
		// The length of the array)}
		catch (IndexOutOfBoundsException e)
		{
			throw new SpringArrayIndexOutOfBoundsException(
				String.format("BK0n %d %d", __dx, length), e);
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/11/14
	 */







|







85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
		}
		
		// {@squirreljme.error BK0n Out of bounds access to array. (The index;
		// The length of the array)}
		catch (IndexOutOfBoundsException e)
		{
			throw new SpringArrayIndexOutOfBoundsException(
				String.format("BK0n %d %d", __dx, this.length), e);
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/11/14
	 */

Name change from runt/libs/springcoat-vm/cc/squirreljme/vm/springcoat/SpringArrayObjectShort.java to emulators/springcoat-vm/src/main/java/cc/squirreljme/vm/springcoat/SpringArrayObjectShort.java.

85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
		}
		
		// {@squirreljme.error BK0q Out of bounds access to array. (The index;
		// The length of the array)}
		catch (IndexOutOfBoundsException e)
		{
			throw new SpringArrayIndexOutOfBoundsException(
				String.format("BK0q %d %d", __dx, length), e);
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/11/14
	 */







|







85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
		}
		
		// {@squirreljme.error BK0q Out of bounds access to array. (The index;
		// The length of the array)}
		catch (IndexOutOfBoundsException e)
		{
			throw new SpringArrayIndexOutOfBoundsException(
				String.format("BK0q %d %d", __dx, this.length), e);
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/11/14
	 */

Name change from runt/libs/springcoat-vm/cc/squirreljme/vm/springcoat/SpringArrayStoreException.java to emulators/springcoat-vm/src/main/java/cc/squirreljme/vm/springcoat/SpringArrayStoreException.java.

Name change from runt/libs/springcoat-vm/cc/squirreljme/vm/springcoat/SpringClass.java to emulators/springcoat-vm/src/main/java/cc/squirreljme/vm/springcoat/SpringClass.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.vm.springcoat;

import cc.squirreljme.jvm.Constants;
import java.io.DataInputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.HashMap;
import java.util.Map;
import net.multiphasicapps.classfile.ClassName;
import net.multiphasicapps.classfile.ClassFile;
import net.multiphasicapps.classfile.ClassFlags;
import net.multiphasicapps.classfile.Field;
import net.multiphasicapps.classfile.FieldDescriptor;
import net.multiphasicapps.classfile.FieldName;
import net.multiphasicapps.classfile.FieldNameAndType;
import net.multiphasicapps.classfile.HasAccessibleFlags;
import net.multiphasicapps.classfile.Method;
import net.multiphasicapps.classfile.MethodDescriptor;













<
<

|

<

|
|
|







1
2
3
4
5
6
7
8
9
10
11
12
13


14
15
16

17
18
19
20
21
22
23
24
25
26
27
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.vm.springcoat;

import cc.squirreljme.jvm.Constants;


import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

import java.util.Map;
import net.multiphasicapps.classfile.ClassFile;
import net.multiphasicapps.classfile.ClassFlags;
import net.multiphasicapps.classfile.ClassName;
import net.multiphasicapps.classfile.Field;
import net.multiphasicapps.classfile.FieldDescriptor;
import net.multiphasicapps.classfile.FieldName;
import net.multiphasicapps.classfile.FieldNameAndType;
import net.multiphasicapps.classfile.HasAccessibleFlags;
import net.multiphasicapps.classfile.Method;
import net.multiphasicapps.classfile.MethodDescriptor;
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
		}
		
		// {@squirreljme.error BK0w The specified field exists in the class
		// however it does not match being static. (The class the field is in;
		// The name and type of the method; If a static field was requested)}
		if (rv.isStatic() != __static)
			throw new SpringIncompatibleClassChangeException(String.format(
				"BK0w %s %s", this.name, __nat, __static));
		
		return rv;
	}
	
	/**
	 * Locates the given method in the class.
	 *







|







597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
		}
		
		// {@squirreljme.error BK0w The specified field exists in the class
		// however it does not match being static. (The class the field is in;
		// The name and type of the method; If a static field was requested)}
		if (rv.isStatic() != __static)
			throw new SpringIncompatibleClassChangeException(String.format(
				"BK0w %s %s %s", this.name, __nat, __static));
		
		return rv;
	}
	
	/**
	 * Locates the given method in the class.
	 *

Name change from runt/libs/springcoat-vm/cc/squirreljme/vm/springcoat/SpringClassCastException.java to emulators/springcoat-vm/src/main/java/cc/squirreljme/vm/springcoat/SpringClassCastException.java.

Name change from runt/libs/springcoat-vm/cc/squirreljme/vm/springcoat/SpringClassFormatException.java to emulators/springcoat-vm/src/main/java/cc/squirreljme/vm/springcoat/SpringClassFormatException.java.

Name change from runt/libs/springcoat-vm/cc/squirreljme/vm/springcoat/SpringClassLoader.java to emulators/springcoat-vm/src/main/java/cc/squirreljme/vm/springcoat/SpringClassLoader.java.

9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// ---------------------------------------------------------------------------

package cc.squirreljme.vm.springcoat;

import cc.squirreljme.vm.VMClassLibrary;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import net.multiphasicapps.classfile.ClassFile;
import net.multiphasicapps.classfile.ClassName;
import net.multiphasicapps.classfile.InvalidClassFormatException;

/**







|
|







9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// ---------------------------------------------------------------------------

package cc.squirreljme.vm.springcoat;

import cc.squirreljme.vm.VMClassLibrary;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.Map;
import net.multiphasicapps.classfile.ClassFile;
import net.multiphasicapps.classfile.ClassName;
import net.multiphasicapps.classfile.InvalidClassFormatException;

/**

Name change from runt/libs/springcoat-vm/cc/squirreljme/vm/springcoat/SpringClassNotFoundException.java to emulators/springcoat-vm/src/main/java/cc/squirreljme/vm/springcoat/SpringClassNotFoundException.java.

Name change from runt/libs/springcoat-vm/cc/squirreljme/vm/springcoat/SpringCoatFactory.java to emulators/springcoat-vm/src/main/java/cc/squirreljme/vm/springcoat/SpringCoatFactory.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.vm.springcoat;

import cc.squirreljme.vm.VirtualMachine;
import cc.squirreljme.vm.VMClassLibrary;
import cc.squirreljme.vm.VMException;
import cc.squirreljme.vm.VMFactory;
import cc.squirreljme.vm.VMSuiteManager;
import java.util.HashMap;
import java.util.Map;
import net.multiphasicapps.profiler.ProfilerSnapshot;

/**
 * Factory which creates instances of the SpringCoat virtual machine.
 *
 * @since 2018/11/17
 */
public class SpringCoatFactory












|
|
|
|
|
<

|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

18
19
20
21
22
23
24
25
26
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.vm.springcoat;

import cc.squirreljme.vm.VMClassLibrary;
import cc.squirreljme.emulator.vm.VMException;
import cc.squirreljme.emulator.vm.VMFactory;
import cc.squirreljme.emulator.vm.VMSuiteManager;
import cc.squirreljme.emulator.vm.VirtualMachine;

import java.util.Map;
import cc.squirreljme.emulator.profiler.ProfilerSnapshot;

/**
 * Factory which creates instances of the SpringCoat virtual machine.
 *
 * @since 2018/11/17
 */
public class SpringCoatFactory
48
49
50
51
52
53
54
55
56
57
58
		String[] __args)
		throws IllegalArgumentException, NullPointerException, VMException
	{
		// Create a new instance of the VM
		SpringTaskManager tm = new SpringTaskManager(__sm, __ps, __sprops);
		return new SpringMachine(__sm, new SpringClassLoader(__cp),
			tm, __maincl, __ismid, -1,
			__gd, __ps, tm.nativedisplay, __sprops, __args);
	}
}








|



47
48
49
50
51
52
53
54
55
56
57
		String[] __args)
		throws IllegalArgumentException, NullPointerException, VMException
	{
		// Create a new instance of the VM
		SpringTaskManager tm = new SpringTaskManager(__sm, __ps, __sprops);
		return new SpringMachine(__sm, new SpringClassLoader(__cp),
			tm, __maincl, __ismid, -1,
			__gd, __ps, __sprops, __args);
	}
}

Name change from runt/libs/springcoat-vm/cc/squirreljme/vm/springcoat/SpringConvertableThrowable.java to emulators/springcoat-vm/src/main/java/cc/squirreljme/vm/springcoat/SpringConvertableThrowable.java.

19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
{
	/**
	 * Returns the message.
	 *
	 * @return The message.
	 * @since 2018/12/04
	 */
	public abstract String getMessage();
	
	/**
	 * Returns the class this throwable converts to.
	 *
	 * @return The target class this converts to.
	 * @since 2018/12/04
	 */
	public abstract String targetClass();
}








|







|


19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
{
	/**
	 * Returns the message.
	 *
	 * @return The message.
	 * @since 2018/12/04
	 */
	String getMessage();
	
	/**
	 * Returns the class this throwable converts to.
	 *
	 * @return The target class this converts to.
	 * @since 2018/12/04
	 */
	String targetClass();
}

Name change from runt/libs/springcoat-vm/cc/squirreljme/vm/springcoat/SpringDisplayEventCallback.java to emulators/springcoat-vm/src/main/java/cc/squirreljme/vm/springcoat/SpringDisplayEventCallback.java.

186
187
188
189
190
191
192
193

194
195
196
197
198
199
200
		SpringThreadWorker worker = this.worker;
		Object rv;
		try
		{
			// Only allow a single call to be performed at a time
			synchronized (this)
			{
				rv = worker.invokeMethod(false, _CALLBACK_CLASS,

					new MethodNameAndType(__func, __desc), args);
			}
		}
		
		// The VM is exiting from the method, we cannot propogate the method
		// up we could just do nothing, just cancel what has happened.
		catch (SpringMachineExitException e)







|
>







186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
		SpringThreadWorker worker = this.worker;
		Object rv;
		try
		{
			// Only allow a single call to be performed at a time
			synchronized (this)
			{
				rv = worker.invokeMethod(false,
					SpringDisplayEventCallback._CALLBACK_CLASS,
					new MethodNameAndType(__func, __desc), args);
			}
		}
		
		// The VM is exiting from the method, we cannot propogate the method
		// up we could just do nothing, just cancel what has happened.
		catch (SpringMachineExitException e)

Name change from runt/libs/springcoat-vm/cc/squirreljme/vm/springcoat/SpringException.java to emulators/springcoat-vm/src/main/java/cc/squirreljme/vm/springcoat/SpringException.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.vm.springcoat;

import cc.squirreljme.vm.VMException;

/**
 * This is the base class for all exceptions within the spring machine.
 *
 * @since 2018/08/05
 */
public class SpringException
	extends RuntimeException












<
<







1
2
3
4
5
6
7
8
9
10
11
12


13
14
15
16
17
18
19
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.vm.springcoat;



/**
 * This is the base class for all exceptions within the spring machine.
 *
 * @since 2018/08/05
 */
public class SpringException
	extends RuntimeException

Name change from runt/libs/springcoat-vm/cc/squirreljme/vm/springcoat/SpringFatalException.java to emulators/springcoat-vm/src/main/java/cc/squirreljme/vm/springcoat/SpringFatalException.java.

Name change from runt/libs/springcoat-vm/cc/squirreljme/vm/springcoat/SpringField.java to emulators/springcoat-vm/src/main/java/cc/squirreljme/vm/springcoat/SpringField.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.vm.springcoat;

import net.multiphasicapps.classfile.ByteCode;
import net.multiphasicapps.classfile.ClassName;
import net.multiphasicapps.classfile.Field;
import net.multiphasicapps.classfile.FieldDescriptor;
import net.multiphasicapps.classfile.FieldFlags;
import net.multiphasicapps.classfile.FieldNameAndType;

/**
 * This contains and stores the definition of a single field.
 *
 * @since 2018/07/22












<


<







1
2
3
4
5
6
7
8
9
10
11
12

13
14

15
16
17
18
19
20
21
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.vm.springcoat;


import net.multiphasicapps.classfile.ClassName;
import net.multiphasicapps.classfile.Field;

import net.multiphasicapps.classfile.FieldFlags;
import net.multiphasicapps.classfile.FieldNameAndType;

/**
 * This contains and stores the definition of a single field.
 *
 * @since 2018/07/22

Name change from runt/libs/springcoat-vm/cc/squirreljme/vm/springcoat/SpringFieldStorage.java to emulators/springcoat-vm/src/main/java/cc/squirreljme/vm/springcoat/SpringFieldStorage.java.

8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.vm.springcoat;

import net.multiphasicapps.classfile.ClassName;
import net.multiphasicapps.classfile.ConstantValue;
import net.multiphasicapps.classfile.FieldFlags;
import net.multiphasicapps.classfile.FieldNameAndType;

/**
 * Contains storage and other information for fields.
 *
 * @since 2018/09/09
 */







<







8
9
10
11
12
13
14

15
16
17
18
19
20
21
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.vm.springcoat;

import net.multiphasicapps.classfile.ClassName;
import net.multiphasicapps.classfile.ConstantValue;

import net.multiphasicapps.classfile.FieldNameAndType;

/**
 * Contains storage and other information for fields.
 *
 * @since 2018/09/09
 */

Name change from runt/libs/springcoat-vm/cc/squirreljme/vm/springcoat/SpringIllegalAccessException.java to emulators/springcoat-vm/src/main/java/cc/squirreljme/vm/springcoat/SpringIllegalAccessException.java.

Name change from runt/libs/springcoat-vm/cc/squirreljme/vm/springcoat/SpringIllegalMonitorStateException.java to emulators/springcoat-vm/src/main/java/cc/squirreljme/vm/springcoat/SpringIllegalMonitorStateException.java.

Name change from runt/libs/springcoat-vm/cc/squirreljme/vm/springcoat/SpringIncompatibleClassChangeException.java to emulators/springcoat-vm/src/main/java/cc/squirreljme/vm/springcoat/SpringIncompatibleClassChangeException.java.

Name change from runt/libs/springcoat-vm/cc/squirreljme/vm/springcoat/SpringInstance.java to emulators/springcoat-vm/src/main/java/cc/squirreljme/vm/springcoat/SpringInstance.java.

Name change from runt/libs/springcoat-vm/cc/squirreljme/vm/springcoat/SpringMachine.java to emulators/springcoat-vm/src/main/java/cc/squirreljme/vm/springcoat/SpringMachine.java.

10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44

package cc.squirreljme.vm.springcoat;

import cc.squirreljme.runtime.cldc.asm.TaskAccess;
import cc.squirreljme.runtime.cldc.lang.GuestDepth;
import cc.squirreljme.runtime.swm.EntryPoint;
import cc.squirreljme.runtime.swm.EntryPoints;
import cc.squirreljme.vm.VirtualMachine;
import cc.squirreljme.vm.VMClassLibrary;
import cc.squirreljme.vm.VMNativeDisplayAccess;
import cc.squirreljme.vm.VMResourceAccess;
import cc.squirreljme.vm.VMSuiteManager;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.io.IOException;
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import net.multiphasicapps.classfile.ClassFile;
import net.multiphasicapps.classfile.ClassName;
import net.multiphasicapps.classfile.ConstantValueString;
import net.multiphasicapps.classfile.InvalidClassFormatException;
import net.multiphasicapps.classfile.MethodDescriptor;
import net.multiphasicapps.classfile.MethodNameAndType;
import net.multiphasicapps.profiler.ProfilerSnapshot;
import net.multiphasicapps.tool.manifest.JavaManifest;

/**
 * This class contains the instance of the SpringCoat virtual machine and has
 * a classpath along with all the needed storage for variables and such.
 *
 * @since 2018/07/29







|
|
<
|
|
<
<
|
|





<


<


|







10
11
12
13
14
15
16
17
18

19
20


21
22
23
24
25
26
27

28
29

30
31
32
33
34
35
36
37
38
39

package cc.squirreljme.vm.springcoat;

import cc.squirreljme.runtime.cldc.asm.TaskAccess;
import cc.squirreljme.runtime.cldc.lang.GuestDepth;
import cc.squirreljme.runtime.swm.EntryPoint;
import cc.squirreljme.runtime.swm.EntryPoints;
import cc.squirreljme.vm.VMClassLibrary;
import cc.squirreljme.emulator.vm.VMResourceAccess;

import cc.squirreljme.emulator.vm.VMSuiteManager;
import cc.squirreljme.emulator.vm.VirtualMachine;


import java.io.IOException;
import java.io.InputStream;
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import net.multiphasicapps.classfile.ClassName;
import net.multiphasicapps.classfile.ConstantValueString;

import net.multiphasicapps.classfile.MethodDescriptor;
import net.multiphasicapps.classfile.MethodNameAndType;
import cc.squirreljme.emulator.profiler.ProfilerSnapshot;
import net.multiphasicapps.tool.manifest.JavaManifest;

/**
 * This class contains the instance of the SpringCoat virtual machine and has
 * a classpath along with all the needed storage for variables and such.
 *
 * @since 2018/07/29
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
	
	/** The depth of this machine. */
	protected final int guestdepth;
	
	/** The profiling information. */
	protected final ProfilerSnapshot profiler;
	
	/** Access to the native display. */
	protected final VMNativeDisplayAccess nativedisplay;
	
	/** Pointer manager. */
	protected final SpringPointerManager pointers =
		new SpringPointerManager();
	
	/** Threads which are available. */
	private final List<SpringThread> _threads =
		new ArrayList<>();







<
<
<







68
69
70
71
72
73
74



75
76
77
78
79
80
81
	
	/** The depth of this machine. */
	protected final int guestdepth;
	
	/** The profiling information. */
	protected final ProfilerSnapshot profiler;
	



	/** Pointer manager. */
	protected final SpringPointerManager pointers =
		new SpringPointerManager();
	
	/** Threads which are available. */
	private final List<SpringThread> _threads =
		new ArrayList<>();
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
	 * @param __args Main entry point arguments.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/09/03
	 */
	public SpringMachine(VMSuiteManager __sm, SpringClassLoader __cl,
		SpringTaskManager __tm, String __bootcl, boolean __bootmid,
		int __bootdx, int __gd, ProfilerSnapshot __profiler,
		VMNativeDisplayAccess __nda, Map<String, String> __sprops,
		String... __args)
		throws NullPointerException
	{
		if (__cl == null || __sm == null || __nda == null)
			throw new NullPointerException("NARG");
		
		this.suites = __sm;
		this.classloader = __cl;
		this.tasks = __tm;
		this.bootcl = __bootcl;
		this.bootmid = __bootmid;
		this.bootdx = __bootdx;
		this.guestdepth = __gd;
		this.nativedisplay = __nda;
		this._args = (__args == null ? new String[0] : __args.clone());
		this.profiler = (__profiler != null ? __profiler :
			new ProfilerSnapshot());
		this._sysproperties = (__sprops == null ?
			new HashMap<String, String>() : new HashMap<>(__sprops));
		
		// Setup resource accessor







|
<


|









<







139
140
141
142
143
144
145
146

147
148
149
150
151
152
153
154
155
156
157
158

159
160
161
162
163
164
165
	 * @param __args Main entry point arguments.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/09/03
	 */
	public SpringMachine(VMSuiteManager __sm, SpringClassLoader __cl,
		SpringTaskManager __tm, String __bootcl, boolean __bootmid,
		int __bootdx, int __gd, ProfilerSnapshot __profiler,
		Map<String, String> __sprops, String... __args)

		throws NullPointerException
	{
		if (__cl == null || __sm == null)
			throw new NullPointerException("NARG");
		
		this.suites = __sm;
		this.classloader = __cl;
		this.tasks = __tm;
		this.bootcl = __bootcl;
		this.bootmid = __bootmid;
		this.bootdx = __bootdx;
		this.guestdepth = __gd;

		this._args = (__args == null ? new String[0] : __args.clone());
		this.profiler = (__profiler != null ? __profiler :
			new ProfilerSnapshot());
		this._sysproperties = (__sprops == null ?
			new HashMap<String, String>() : new HashMap<>(__sprops));
		
		// Setup resource accessor

Name change from runt/libs/springcoat-vm/cc/squirreljme/vm/springcoat/SpringMachineExitException.java to emulators/springcoat-vm/src/main/java/cc/squirreljme/vm/springcoat/SpringMachineExitException.java.

Name change from runt/libs/springcoat-vm/cc/squirreljme/vm/springcoat/SpringMember.java to emulators/springcoat-vm/src/main/java/cc/squirreljme/vm/springcoat/SpringMember.java.

24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
{
	/**
	 * Returns the class this is a member of.
	 *
	 * @return The class which owns the method.
	 * @since 2018/09/09
	 */
	public abstract ClassName inClass();
	
	/**
	 * Returns the name and type of the member.
	 *
	 * @return The member name and type.
	 * @since 2018/09/09
	 */
	public abstract MemberNameAndType nameAndType();
}








|







|


24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
{
	/**
	 * Returns the class this is a member of.
	 *
	 * @return The class which owns the method.
	 * @since 2018/09/09
	 */
	ClassName inClass();
	
	/**
	 * Returns the name and type of the member.
	 *
	 * @return The member name and type.
	 * @since 2018/09/09
	 */
	MemberNameAndType nameAndType();
}

Name change from runt/libs/springcoat-vm/cc/squirreljme/vm/springcoat/SpringMethod.java to emulators/springcoat-vm/src/main/java/cc/squirreljme/vm/springcoat/SpringMethod.java.

Name change from runt/libs/springcoat-vm/cc/squirreljme/vm/springcoat/SpringMonitor.java to emulators/springcoat-vm/src/main/java/cc/squirreljme/vm/springcoat/SpringMonitor.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.vm.springcoat;

import cc.squirreljme.runtime.cldc.asm.ObjectAccess;
import java.util.LinkedHashSet;
import java.util.Set;

/**
 * This is a monitor which is associated with an object.
 *
 * @since 2018/09/15
 */
public final class SpringMonitor













<
<







1
2
3
4
5
6
7
8
9
10
11
12
13


14
15
16
17
18
19
20
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.vm.springcoat;

import cc.squirreljme.runtime.cldc.asm.ObjectAccess;



/**
 * This is a monitor which is associated with an object.
 *
 * @since 2018/09/15
 */
public final class SpringMonitor
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
	
	/**
	 * Notifies on this monitor and returns the status.
	 *
	 * @param __by The thread that is doing the notify.
	 * @param __all Notify all threads?
	 * @return The notification status.
	 * @throws NullPointerException
	 * @since 2018/11/20
	 */
	public final int monitorNotify(SpringThread __by, boolean __all)
		throws NullPointerException
	{
		if (__by == null)
			throw new NullPointerException("NARG");







|







133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
	
	/**
	 * Notifies on this monitor and returns the status.
	 *
	 * @param __by The thread that is doing the notify.
	 * @param __all Notify all threads?
	 * @return The notification status.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/11/20
	 */
	public final int monitorNotify(SpringThread __by, boolean __all)
		throws NullPointerException
	{
		if (__by == null)
			throw new NullPointerException("NARG");

Name change from runt/libs/springcoat-vm/cc/squirreljme/vm/springcoat/SpringNegativeArraySizeException.java to emulators/springcoat-vm/src/main/java/cc/squirreljme/vm/springcoat/SpringNegativeArraySizeException.java.

Name change from runt/libs/springcoat-vm/cc/squirreljme/vm/springcoat/SpringNoSuchFieldException.java to emulators/springcoat-vm/src/main/java/cc/squirreljme/vm/springcoat/SpringNoSuchFieldException.java.

Name change from runt/libs/springcoat-vm/cc/squirreljme/vm/springcoat/SpringNoSuchMethodException.java to emulators/springcoat-vm/src/main/java/cc/squirreljme/vm/springcoat/SpringNoSuchMethodException.java.

Name change from runt/libs/springcoat-vm/cc/squirreljme/vm/springcoat/SpringNullObject.java to emulators/springcoat-vm/src/main/java/cc/squirreljme/vm/springcoat/SpringNullObject.java.

Name change from runt/libs/springcoat-vm/cc/squirreljme/vm/springcoat/SpringNullPointerException.java to emulators/springcoat-vm/src/main/java/cc/squirreljme/vm/springcoat/SpringNullPointerException.java.

Name change from runt/libs/springcoat-vm/cc/squirreljme/vm/springcoat/SpringObject.java to emulators/springcoat-vm/src/main/java/cc/squirreljme/vm/springcoat/SpringObject.java.

21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
{
	/**
	 * Returns the monitor for this object.
	 *
	 * @return This object's monitor.
	 * @since 2018/09/15
	 */
	public abstract SpringMonitor monitor();
	
	/**
	 * Returns the pointer area for this object.
	 *
	 * @return The pointer area for this object.
	 * @since 2019/12/21
	 */
	public abstract SpringPointerArea pointerArea();
	
	/**
	 * Returns the object type.
	 *
	 * @return The object type.
	 * @since 2018/09/09
	 */
	public abstract SpringClass type();
}








|







|







|


21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
{
	/**
	 * Returns the monitor for this object.
	 *
	 * @return This object's monitor.
	 * @since 2018/09/15
	 */
	SpringMonitor monitor();
	
	/**
	 * Returns the pointer area for this object.
	 *
	 * @return The pointer area for this object.
	 * @since 2019/12/21
	 */
	SpringPointerArea pointerArea();
	
	/**
	 * Returns the object type.
	 *
	 * @return The object type.
	 * @since 2018/09/09
	 */
	SpringClass type();
}

Name change from runt/libs/springcoat-vm/cc/squirreljme/vm/springcoat/SpringPointerArea.java to emulators/springcoat-vm/src/main/java/cc/squirreljme/vm/springcoat/SpringPointerArea.java.

Name change from runt/libs/springcoat-vm/cc/squirreljme/vm/springcoat/SpringPointerManager.java to emulators/springcoat-vm/src/main/java/cc/squirreljme/vm/springcoat/SpringPointerManager.java.

10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package cc.squirreljme.vm.springcoat;

import java.lang.ref.Reference;
import java.lang.ref.ReferenceQueue;
import java.lang.ref.WeakReference;
import java.util.HashMap;
import java.util.Map;
import net.multiphasicapps.collections.SortedTreeMap;

/**
 * This is used to manage pointers within SpringCoat.
 *
 * @since 2019/12/21
 */
public final class SpringPointerManager







<







10
11
12
13
14
15
16

17
18
19
20
21
22
23
package cc.squirreljme.vm.springcoat;

import java.lang.ref.Reference;
import java.lang.ref.ReferenceQueue;
import java.lang.ref.WeakReference;
import java.util.HashMap;
import java.util.Map;


/**
 * This is used to manage pointers within SpringCoat.
 *
 * @since 2019/12/21
 */
public final class SpringPointerManager

Name change from runt/libs/springcoat-vm/cc/squirreljme/vm/springcoat/SpringPrimitiveReference.java to emulators/springcoat-vm/src/main/java/cc/squirreljme/vm/springcoat/SpringPrimitiveReference.java.

Name change from runt/libs/springcoat-vm/cc/squirreljme/vm/springcoat/SpringPrimitiveWeakReference.java to emulators/springcoat-vm/src/main/java/cc/squirreljme/vm/springcoat/SpringPrimitiveWeakReference.java.

Name change from runt/libs/springcoat-vm/cc/squirreljme/vm/springcoat/SpringSimpleObject.java to emulators/springcoat-vm/src/main/java/cc/squirreljme/vm/springcoat/SpringSimpleObject.java.

Name change from runt/libs/springcoat-vm/cc/squirreljme/vm/springcoat/SpringStackTop.java to emulators/springcoat-vm/src/main/java/cc/squirreljme/vm/springcoat/SpringStackTop.java.

Name change from runt/libs/springcoat-vm/cc/squirreljme/vm/springcoat/SpringTask.java to emulators/springcoat-vm/src/main/java/cc/squirreljme/vm/springcoat/SpringTask.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.vm.springcoat;

import cc.squirreljme.runtime.cldc.asm.TaskAccess;
import java.io.PrintStream;

/**
 * This represents a task which can be run.
 *
 * @since 2018/11/04
 */
public final class SpringTask
	implements Runnable












<
<
<







1
2
3
4
5
6
7
8
9
10
11
12



13
14
15
16
17
18
19
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.vm.springcoat;




/**
 * This represents a task which can be run.
 *
 * @since 2018/11/04
 */
public final class SpringTask
	implements Runnable

Name change from runt/libs/springcoat-vm/cc/squirreljme/vm/springcoat/SpringTaskManager.java to emulators/springcoat-vm/src/main/java/cc/squirreljme/vm/springcoat/SpringTaskManager.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.vm.springcoat;

import cc.squirreljme.runtime.cldc.asm.TaskAccess;
import cc.squirreljme.runtime.swm.EntryPoint;
import cc.squirreljme.runtime.swm.EntryPoints;
import cc.squirreljme.vm.VMClassLibrary;
import cc.squirreljme.vm.VMNativeDisplayAccess;
import cc.squirreljme.vm.VMSuiteManager;
import java.io.InputStream;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import javax.microedition.swm.TaskStatus;
import net.multiphasicapps.profiler.ProfilerSnapshot;
import net.multiphasicapps.tool.manifest.JavaManifest;

/**
 * This class manages tasks within SpringCoat and is used to launch and
 * provide access to those that are running.
 *
 * @since 2018/11/04













<


<
|
|
|



|







1
2
3
4
5
6
7
8
9
10
11
12
13

14
15

16
17
18
19
20
21
22
23
24
25
26
27
28
29
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.vm.springcoat;

import cc.squirreljme.runtime.cldc.asm.TaskAccess;

import cc.squirreljme.runtime.swm.EntryPoints;
import cc.squirreljme.vm.VMClassLibrary;

import cc.squirreljme.emulator.vm.VMSuiteManager;
import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.Map;
import javax.microedition.swm.TaskStatus;
import cc.squirreljme.emulator.profiler.ProfilerSnapshot;
import net.multiphasicapps.tool.manifest.JavaManifest;

/**
 * This class manages tasks within SpringCoat and is used to launch and
 * provide access to those that are running.
 *
 * @since 2018/11/04
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
	/** Tasks that are used. */
	private final Map<Integer, SpringTask> _tasks =
		new HashMap<>();
	
	/** System properties. */
	private final Map<String, String> _sysprops;
	
	/** Access to the native display. */
	protected final VMNativeDisplayAccess nativedisplay =
		new VMNativeDisplayAccess();
	
	/** Next task ID. */
	private int _nextid;
	
	/**
	 * Initializes the task manager.
	 *
	 * @param __sm The suite manager.







<
<
<
<







39
40
41
42
43
44
45




46
47
48
49
50
51
52
	/** Tasks that are used. */
	private final Map<Integer, SpringTask> _tasks =
		new HashMap<>();
	
	/** System properties. */
	private final Map<String, String> _sysprops;
	




	/** Next task ID. */
	private int _nextid;
	
	/**
	 * Initializes the task manager.
	 *
	 * @param __sm The suite manager.
142
143
144
145
146
147
148
149

150
151
152
153
154
155
156
157
		
		// Could not find the boot point
		if (bootdx < 0)
			return TaskAccess.ERROR_INVALID_ENTRY;
		
		// Build machine for the task
		SpringMachine machine = new SpringMachine(suites,
			new SpringClassLoader(scl), this, null, false, bootdx, __gd + 1,

			this.profiler, this.nativedisplay, this._sysprops, __args);
		
		// Lock on tasks
		Map<Integer, SpringTask> tasks = this._tasks;
		synchronized (tasks)
		{
			// Next task ID
			int tid = ++this._nextid;







|
>
|







136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
		
		// Could not find the boot point
		if (bootdx < 0)
			return TaskAccess.ERROR_INVALID_ENTRY;
		
		// Build machine for the task
		SpringMachine machine = new SpringMachine(suites,
			new SpringClassLoader(scl), this, null,
			false, bootdx, __gd + 1,
			this.profiler, this._sysprops, __args);
		
		// Lock on tasks
		Map<Integer, SpringTask> tasks = this._tasks;
		synchronized (tasks)
		{
			// Next task ID
			int tid = ++this._nextid;

Name change from runt/libs/springcoat-vm/cc/squirreljme/vm/springcoat/SpringThread.java to emulators/springcoat-vm/src/main/java/cc/squirreljme/vm/springcoat/SpringThread.java.

11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package cc.squirreljme.vm.springcoat;

import cc.squirreljme.jvm.SystemCallIndex;
import java.io.PrintStream;
import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import net.multiphasicapps.classfile.ByteCode;
import net.multiphasicapps.profiler.ProfiledThread;

/**
 * This class contains information about a thread within the virtual machine.
 *
 * @since 2018/09/01
 */
public final class SpringThread







<


|







11
12
13
14
15
16
17

18
19
20
21
22
23
24
25
26
27
package cc.squirreljme.vm.springcoat;

import cc.squirreljme.jvm.SystemCallIndex;
import java.io.PrintStream;
import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import java.util.ArrayList;

import java.util.List;
import net.multiphasicapps.classfile.ByteCode;
import cc.squirreljme.emulator.profiler.ProfiledThread;

/**
 * This class contains information about a thread within the virtual machine.
 *
 * @since 2018/09/01
 */
public final class SpringThread
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
	public final SpringThread.Frame enterBlankFrame()
	{
		// Setup blank frame
		SpringThread.Frame rv = new SpringThread.Frame();
		
		// {@squirreljme.error BK1j Stack overflow.}
		List<SpringThread.Frame> frames = this._frames;
		if (frames.size() >= MAX_STACK_DEPTH)
			throw new SpringVirtualMachineException("BK1j");
		
		// Lock on frames as a new one is added
		synchronized (frames)
		{
			frames.add(rv);
		}







|







111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
	public final SpringThread.Frame enterBlankFrame()
	{
		// Setup blank frame
		SpringThread.Frame rv = new SpringThread.Frame();
		
		// {@squirreljme.error BK1j Stack overflow.}
		List<SpringThread.Frame> frames = this._frames;
		if (frames.size() >= SpringThread.MAX_STACK_DEPTH)
			throw new SpringVirtualMachineException("BK1j");
		
		// Lock on frames as a new one is added
		synchronized (frames)
		{
			frames.add(rv);
		}
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
				// instance method with no arguments passed.}
				if (__args.length <= 0)
					throw new SpringVirtualMachineException("BK1m");
				
				// {@squirreljme.error BK1n Cannot enter a monitor of nothing
				// or a non-object.}
				Object argzero = __args[0];
				if (argzero == null || !(argzero instanceof SpringObject))
					throw new SpringVirtualMachineException("BK1n");
				
				// Use this as the monitor
				monitor = (SpringObject)argzero;
			}
			
			// Set to unlock later on







|







215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
				// instance method with no arguments passed.}
				if (__args.length <= 0)
					throw new SpringVirtualMachineException("BK1m");
				
				// {@squirreljme.error BK1n Cannot enter a monitor of nothing
				// or a non-object.}
				Object argzero = __args[0];
				if (!(argzero instanceof cc.squirreljme.vm.springcoat.SpringObject))
					throw new SpringVirtualMachineException("BK1n");
				
				// Use this as the monitor
				monitor = (SpringObject)argzero;
			}
			
			// Set to unlock later on
532
533
534
535
536
537
538

539
540
541
542
543
544
545
		{
			this._stacktop = 0;
		}
		
		/**
		 * Increments the execution counter for this frame.
		 *

		 * @since 2018/10/12
		 */
		public final int incrementExecCount()
		{
			return this._execcount++;
		}
		







>







531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
		{
			this._stacktop = 0;
		}
		
		/**
		 * Increments the execution counter for this frame.
		 *
		 * @return The original execution count.
		 * @since 2018/10/12
		 */
		public final int incrementExecCount()
		{
			return this._execcount++;
		}
		

Name change from runt/libs/springcoat-vm/cc/squirreljme/vm/springcoat/SpringThreadWorker.java to emulators/springcoat-vm/src/main/java/cc/squirreljme/vm/springcoat/SpringThreadWorker.java.

13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import cc.squirreljme.jvm.CallStackItem;
import cc.squirreljme.jvm.SystemCallError;
import cc.squirreljme.jvm.SystemCallIndex;
import cc.squirreljme.runtime.cldc.asm.ConsoleOutput;
import cc.squirreljme.runtime.cldc.asm.SystemAccess;
import cc.squirreljme.runtime.cldc.asm.SystemProperties;
import cc.squirreljme.runtime.cldc.lang.ApiLevel;
import cc.squirreljme.runtime.cldc.lang.GuestDepth;
import cc.squirreljme.runtime.cldc.lang.OperatingSystemType;
import cc.squirreljme.vm.VMClassLibrary;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintStream;
import java.util.Arrays;
import java.util.Formatter;
import java.util.Map;
import net.multiphasicapps.classfile.ByteCode;
import net.multiphasicapps.classfile.ClassFlags;
import net.multiphasicapps.classfile.ClassName;
import net.multiphasicapps.classfile.ConstantValue;
import net.multiphasicapps.classfile.ConstantValueClass;
import net.multiphasicapps.classfile.ConstantValueString;
import net.multiphasicapps.classfile.ExceptionHandler;
import net.multiphasicapps.classfile.FieldNameAndType;
import net.multiphasicapps.classfile.FieldReference;
import net.multiphasicapps.classfile.Instruction;
import net.multiphasicapps.classfile.InstructionIndex;
import net.multiphasicapps.classfile.InstructionJumpTarget;
import net.multiphasicapps.classfile.IntMatchingJumpTable;
import net.multiphasicapps.classfile.InvalidClassFormatException;
import net.multiphasicapps.classfile.MemberFlags;
import net.multiphasicapps.classfile.MethodDescriptor;
import net.multiphasicapps.classfile.MethodName;
import net.multiphasicapps.classfile.MethodNameAndType;
import net.multiphasicapps.classfile.MethodReference;
import net.multiphasicapps.classfile.PrimitiveType;








<






<








<





<







13
14
15
16
17
18
19

20
21
22
23
24
25

26
27
28
29
30
31
32
33

34
35
36
37
38

39
40
41
42
43
44
45
import cc.squirreljme.jvm.CallStackItem;
import cc.squirreljme.jvm.SystemCallError;
import cc.squirreljme.jvm.SystemCallIndex;
import cc.squirreljme.runtime.cldc.asm.ConsoleOutput;
import cc.squirreljme.runtime.cldc.asm.SystemAccess;
import cc.squirreljme.runtime.cldc.asm.SystemProperties;
import cc.squirreljme.runtime.cldc.lang.ApiLevel;

import cc.squirreljme.runtime.cldc.lang.OperatingSystemType;
import cc.squirreljme.vm.VMClassLibrary;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintStream;
import java.util.Arrays;

import java.util.Map;
import net.multiphasicapps.classfile.ByteCode;
import net.multiphasicapps.classfile.ClassFlags;
import net.multiphasicapps.classfile.ClassName;
import net.multiphasicapps.classfile.ConstantValue;
import net.multiphasicapps.classfile.ConstantValueClass;
import net.multiphasicapps.classfile.ConstantValueString;
import net.multiphasicapps.classfile.ExceptionHandler;

import net.multiphasicapps.classfile.FieldReference;
import net.multiphasicapps.classfile.Instruction;
import net.multiphasicapps.classfile.InstructionIndex;
import net.multiphasicapps.classfile.InstructionJumpTarget;
import net.multiphasicapps.classfile.IntMatchingJumpTable;

import net.multiphasicapps.classfile.MemberFlags;
import net.multiphasicapps.classfile.MethodDescriptor;
import net.multiphasicapps.classfile.MethodName;
import net.multiphasicapps.classfile.MethodNameAndType;
import net.multiphasicapps.classfile.MethodReference;
import net.multiphasicapps.classfile.PrimitiveType;

103
104
105
106
107
108
109

110
111
112
113
114
115
116
	
	/**
	 * Allocates the memory needed to store an array of the given class and
	 * of the given length.
	 *
	 * @param __cl The component type.
	 * @param __l The length of the array.

	 * @throws NullPointerException On null arguments.
	 * @throws SpringNegativeArraySizeException If the array size is negative.
	 * @since 2018/09/15
	 */
	public final SpringArrayObject allocateArray(SpringClass __cl, int __l)
		throws NullPointerException, SpringNegativeArraySizeException
	{







>







99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
	
	/**
	 * Allocates the memory needed to store an array of the given class and
	 * of the given length.
	 *
	 * @param __cl The component type.
	 * @param __l The length of the array.
	 * @return The allocated array.
	 * @throws NullPointerException On null arguments.
	 * @throws SpringNegativeArraySizeException If the array size is negative.
	 * @since 2018/09/15
	 */
	public final SpringArrayObject allocateArray(SpringClass __cl, int __l)
		throws NullPointerException, SpringNegativeArraySizeException
	{
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
	/**
	 * Converts the specified virtual machine object to a native object.
	 *
	 * @param <C> The class type.
	 * @param __cl The class type.
	 * @param __in The input object.
	 * @return The resulting native object.
	 * @throw NullPointerException On null arguments.
	 * @since 2018/09/20
	 */
	public final <C> C asNativeObject(Class<C> __cl, Object __in)
		throws NullPointerException
	{
		if (__cl == null)
			throw new NullPointerException("NARG");







|







307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
	/**
	 * Converts the specified virtual machine object to a native object.
	 *
	 * @param <C> The class type.
	 * @param __cl The class type.
	 * @param __in The input object.
	 * @return The resulting native object.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/09/20
	 */
	public final <C> C asNativeObject(Class<C> __cl, Object __in)
		throws NullPointerException
	{
		if (__cl == null)
			throw new NullPointerException("NARG");
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
							(Integer)__args[3]);
						return 0;
					}
					else
						return ConsoleOutput.ERROR_INVALIDFD;
				}
				
				// Accelerated graphics
			case "cc/squirreljme/runtime/cldc/asm/NativeDisplayAccess::" +
				"accelGfx:(I)Z":
				return this.machine.nativedisplay.accelGfx(
					(Integer)__args[0]);
				
				// Accelerated graphics operation
			case "cc/squirreljme/runtime/cldc/asm/NativeDisplayAccess::" +
				"accelGfxFunc:(II[Ljava/lang/Object;)Ljava/lang/Object;":
				{
					// The original array to be adapted
					SpringArrayObject sao = (SpringArrayObject)__args[2];
					int n = sao.length();
					
					// Wrap arrays or convert to native
					Object[] rawr = new Object[n];
					for (int i = 0; i < n; i++)
						rawr[i] = this.<Object>asNativeObjectUnwrapArray(
							Object.class, sao.<Object>get(Object.class, i));
					
					// Forward
					return this.asVMObjectBoxedOrWrappedArray(
						this.machine.nativedisplay.
						accelGfxFunc((Integer)__args[0], (Integer)__args[1],
						rawr));
				}
				
				// Capabilities of a display
			case "cc/squirreljme/runtime/cldc/asm/NativeDisplayAccess::" +
				"capabilities:(I)I":
				return this.machine.nativedisplay.capabilities(
					(Integer)__args[0]);
					
				// Repaint display
			case "cc/squirreljme/runtime/cldc/asm/NativeDisplayAccess::" +
				"displayRepaint:(IIIII)V":
				this.machine.nativedisplay.displayRepaint(
					(Integer)__args[0],
					(Integer)__args[1],
					(Integer)__args[2],
					(Integer)__args[3],
					(Integer)__args[4]);
				return null;
			
				// Framebuffer object
			case "cc/squirreljme/runtime/cldc/asm/NativeDisplayAccess::" +
				"framebufferObject:(I)Ljava/lang/Object;":
				return this.asWrappedArray(this.machine.nativedisplay.
					framebufferObject((Integer)__args[0]));
				
				// Framebuffer palette
			case "cc/squirreljme/runtime/cldc/asm/NativeDisplayAccess::" +
				"framebufferPalette:(I)[I":
				return this.asWrappedArray(this.machine.nativedisplay.
					framebufferPalette((Integer)__args[0]));
					
				// Framebuffer parameters
			case "cc/squirreljme/runtime/cldc/asm/NativeDisplayAccess::" +
				"framebufferParameters:(I)[I":
				return this.asWrappedArray(this.machine.nativedisplay.
					framebufferParameters((Integer)__args[0]));
					
				// Framebuffer state count
			case "cc/squirreljme/runtime/cldc/asm/NativeDisplayAccess::" +
				"framebufferStateCount:(I)I":
				return this.machine.nativedisplay.
					framebufferStateCount((Integer)__args[0]);
				
				// Capabilities of a display
			case "cc/squirreljme/runtime/cldc/asm/NativeDisplayAccess::" +
				"isUpsideDown:(I)Z":
				return this.machine.nativedisplay.isUpsideDown(
					(Integer)__args[0]);
				
				// Number of displays
			case "cc/squirreljme/runtime/cldc/asm/NativeDisplayAccess::" +
				"numDisplays:()I":
				return this.machine.nativedisplay.numDisplays();
				
				// Register event callback
			case "cc/squirreljme/runtime/cldc/asm/NativeDisplayAccess::" +
				"registerEventCallback:(Lcc/squirreljme/runtime/cldc/" +
				"asm/NativeDisplayEventCallback;)V":
				this.machine.nativedisplay.registerEventCallback(
					new SpringDisplayEventCallback(this.machine,
					(SpringObject)__args[0]));
				return null;
				
				// Sets the display title
			case "cc/squirreljme/runtime/cldc/asm/NativeDisplayAccess::" +
				"setDisplayTitle:(ILjava/lang/String;)V":
				this.machine.nativedisplay.setDisplayTitle(
					((Integer)__args[0]).intValue(),
					this.<String>asNativeObject(String.class, __args[1]));
				return null;
				
				// Allocate object but do not construct it
			case "cc/squirreljme/runtime/cldc/asm/ObjectAccess::" +
				"allocateObject:(Ljava/lang/String;)Ljava/lang/Object;":
				return this.allocateObject(this.loadClass(
					new ClassName(this.<String>asNativeObject(
					String.class, ((SpringObject)__args[0])))));
			







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







1398
1399
1400
1401
1402
1403
1404
































































































1405
1406
1407
1408
1409
1410
1411
							(Integer)__args[3]);
						return 0;
					}
					else
						return ConsoleOutput.ERROR_INVALIDFD;
				}
				
































































































				// Allocate object but do not construct it
			case "cc/squirreljme/runtime/cldc/asm/ObjectAccess::" +
				"allocateObject:(Ljava/lang/String;)Ljava/lang/Object;":
				return this.allocateObject(this.loadClass(
					new ClassName(this.<String>asNativeObject(
					String.class, ((SpringObject)__args[0])))));
			
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
		this._stepcount++;
		
		SpringThread.Frame frame = thread.currentFrame();
		ByteCode code = frame.byteCode();
		
		// Frame is execution
		int iec = frame.incrementExecCount();
		if (iec > 0 && (iec % _EXECUTION_THRESHOLD) == 0)
		{
			// {@squirreljme.error BK2c Execution seems to be stuck in this
			// method.}
			System.err.println("BK2c");
			this.thread.printStackTrace(System.err);
		}
		







|







2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
		this._stepcount++;
		
		SpringThread.Frame frame = thread.currentFrame();
		ByteCode code = frame.byteCode();
		
		// Frame is execution
		int iec = frame.incrementExecCount();
		if (iec > 0 && (iec % SpringThreadWorker._EXECUTION_THRESHOLD) == 0)
		{
			// {@squirreljme.error BK2c Execution seems to be stuck in this
			// method.}
			System.err.println("BK2c");
			this.thread.printStackTrace(System.err);
		}
		
4539
4540
4541
4542
4543
4544
4545
4546

4547
4548
4549
4550
4551
4552
4553
			return null;
		return this.machine.debugResolveString((int)__id);
	}
	
	/**
	 * Returns a unique ID for the given string.
	 *
	 * @param __s The String to get the ID od.

	 * @throws NullPointerException On null arguments.
	 * @since 2019/06/16
	 */
	public final int uniqueStringId(String __s)
		throws NullPointerException
	{
		if (__s == null)







|
>







4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
			return null;
		return this.machine.debugResolveString((int)__id);
	}
	
	/**
	 * Returns a unique ID for the given string.
	 *
	 * @param __s The String to get the ID of.
	 * @return The unique string ID.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/06/16
	 */
	public final int uniqueStringId(String __s)
		throws NullPointerException
	{
		if (__s == null)

Name change from runt/libs/springcoat-vm/cc/squirreljme/vm/springcoat/SpringVMStaticMethod.java to emulators/springcoat-vm/src/main/java/cc/squirreljme/vm/springcoat/SpringVMStaticMethod.java.

Name change from runt/libs/springcoat-vm/cc/squirreljme/vm/springcoat/SpringVirtualMachineException.java to emulators/springcoat-vm/src/main/java/cc/squirreljme/vm/springcoat/SpringVirtualMachineException.java.

Name change from runt/libs/springcoat-vm/cc/squirreljme/vm/springcoat/package-info.java to emulators/springcoat-vm/src/main/java/cc/squirreljme/vm/springcoat/package-info.java.

Name change from runt/libs/springcoat-vm/META-INF/services/cc.squirreljme.vm.VMFactory to emulators/springcoat-vm/src/main/resources/META-INF/services/cc.squirreljme.emulator.vm.VMFactory.

Added emulators/summercoat-vm/build.gradle.

















































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
plugins
{
	id "java-library"
}

description = "This is the SummerCoat VM which is a more " +
	"optimized register based virtual machine which should result in faster" +
	"code execution."

dependencies
{
	api project(":emulators:emulator-base")

	api project(":modules:cldc-compact")
	api project(":modules:collections")
	api project(":modules:common-vm")
	api project(":modules:io")
	api project(":modules:meep-midlet")
	api project(":modules:meep-swm")
	api project(":modules:tool-classfile")
	api project(":modules:tool-jarfile")
	api project(":modules:tool-manifest-reader")
	api project(":modules:tool-packfile")
}

Name change from runt/libs/summercoat-vm/cc/squirreljme/vm/summercoat/AbstractReadableMemory.java to emulators/summercoat-vm/src/main/java/cc/squirreljme/vm/summercoat/AbstractReadableMemory.java.

Name change from runt/libs/summercoat-vm/cc/squirreljme/vm/summercoat/AbstractWritableMemory.java to emulators/summercoat-vm/src/main/java/cc/squirreljme/vm/summercoat/AbstractWritableMemory.java.

Name change from runt/libs/summercoat-vm/cc/squirreljme/vm/summercoat/ByteArrayMemory.java to emulators/summercoat-vm/src/main/java/cc/squirreljme/vm/summercoat/ByteArrayMemory.java.

Name change from runt/libs/summercoat-vm/cc/squirreljme/vm/summercoat/ConfigRomWriter.java to emulators/summercoat-vm/src/main/java/cc/squirreljme/vm/summercoat/ConfigRomWriter.java.

Name change from runt/libs/summercoat-vm/cc/squirreljme/vm/summercoat/ExecutionSlice.java to emulators/summercoat-vm/src/main/java/cc/squirreljme/vm/summercoat/ExecutionSlice.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.vm.summercoat;

import cc.squirreljme.runtime.cldc.debug.CallTraceElement;
import dev.shadowtail.classfile.nncc.ArgumentFormat;
import dev.shadowtail.classfile.nncc.NativeCode;
import dev.shadowtail.classfile.nncc.NativeInstruction;
import dev.shadowtail.classfile.nncc.NativeInstructionType;
import java.io.PrintStream;
import net.multiphasicapps.classfile.InstructionMnemonics;

/**
 * This represents a single slice of execution.
 *
 * @since 2019/10/27












<


<







1
2
3
4
5
6
7
8
9
10
11
12

13
14

15
16
17
18
19
20
21
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.vm.summercoat;

import cc.squirreljme.runtime.cldc.debug.CallTraceElement;

import dev.shadowtail.classfile.nncc.NativeCode;
import dev.shadowtail.classfile.nncc.NativeInstruction;

import java.io.PrintStream;
import net.multiphasicapps.classfile.InstructionMnemonics;

/**
 * This represents a single slice of execution.
 *
 * @since 2019/10/27
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
	 *
	 * @param __cte Call trace information.
	 * @param __rreg CPU registers stored here.
	 * @param __op The operand.
	 * @param __args The arguments.
	 * @param __argslen Number of arguments available.
	 * @param __reglist The register list for method calls.
	 * @return The execution slice.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/11/03
	 */
	public ExecutionSlice(CallTraceElement __cte, int[] __rreg,
		int __op, int[] __args, int __argslen, int[] __reglist)
		throws NullPointerException
	{







<







42
43
44
45
46
47
48

49
50
51
52
53
54
55
	 *
	 * @param __cte Call trace information.
	 * @param __rreg CPU registers stored here.
	 * @param __op The operand.
	 * @param __args The arguments.
	 * @param __argslen Number of arguments available.
	 * @param __reglist The register list for method calls.

	 * @throws NullPointerException On null arguments.
	 * @since 2019/11/03
	 */
	public ExecutionSlice(CallTraceElement __cte, int[] __rreg,
		int __op, int[] __args, int __argslen, int[] __reglist)
		throws NullPointerException
	{

Name change from runt/libs/summercoat-vm/cc/squirreljme/vm/summercoat/MachineState.java to emulators/summercoat-vm/src/main/java/cc/squirreljme/vm/summercoat/MachineState.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.vm.summercoat;

import net.multiphasicapps.profiler.ProfilerSnapshot;

/**
 * This contains the machine state.
 *
 * @since 2019/06/19
 */
public final class MachineState











|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.vm.summercoat;

import cc.squirreljme.emulator.profiler.ProfilerSnapshot;

/**
 * This contains the machine state.
 *
 * @since 2019/06/19
 */
public final class MachineState

Name change from runt/libs/summercoat-vm/cc/squirreljme/vm/summercoat/Memory.java to emulators/summercoat-vm/src/main/java/cc/squirreljme/vm/summercoat/Memory.java.

18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
{
	/**
	 * The starting region of this memory.
	 *
	 * @return The starting region of this memory.
	 * @since 2019/04/21
	 */
	public abstract int memRegionOffset();
	
	/**
	 * The length of this memory region.
	 *
	 * @return The memory region length.
	 * @since 2019/04/21
	 */
	public abstract int memRegionSize();
}








|







|


18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
{
	/**
	 * The starting region of this memory.
	 *
	 * @return The starting region of this memory.
	 * @since 2019/04/21
	 */
	int memRegionOffset();
	
	/**
	 * The length of this memory region.
	 *
	 * @return The memory region length.
	 * @since 2019/04/21
	 */
	int memRegionSize();
}

Name change from runt/libs/summercoat-vm/cc/squirreljme/vm/summercoat/NativeCPU.java to emulators/summercoat-vm/src/main/java/cc/squirreljme/vm/summercoat/NativeCPU.java.

11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57

import cc.squirreljme.jvm.CallStackItem;
import cc.squirreljme.jvm.Constants;
import cc.squirreljme.jvm.SupervisorPropertyIndex;
import cc.squirreljme.jvm.SystemCallError;
import cc.squirreljme.jvm.SystemCallIndex;
import cc.squirreljme.runtime.cldc.debug.CallTraceElement;
import cc.squirreljme.vm.VMException;
import dev.shadowtail.classfile.nncc.ArgumentFormat;
import dev.shadowtail.classfile.nncc.InvalidInstructionException;
import dev.shadowtail.classfile.nncc.NativeCode;
import dev.shadowtail.classfile.nncc.NativeInstruction;
import dev.shadowtail.classfile.nncc.NativeInstructionType;
import dev.shadowtail.classfile.xlate.CompareType;
import dev.shadowtail.classfile.xlate.DataType;
import dev.shadowtail.classfile.xlate.MathType;
import dev.shadowtail.classfile.xlate.StackJavaType;
import java.io.DataInputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintStream;
import java.util.Deque;
import java.util.LinkedList;
import java.util.List;
import net.multiphasicapps.collections.IntegerList;
import net.multiphasicapps.io.HexDumpOutputStream;
import net.multiphasicapps.profiler.ProfilerSnapshot;
import net.multiphasicapps.profiler.ProfiledThread;

/**
 * This represents a native CPU which may run within its own thread to
 * execute code that is running from within the virtual machine.
 *
 * @since 2019/04/21
 */
public final class NativeCPU
	implements Runnable
{
	/**
	 * {@squirreljme.properly cc.squirreljme.summercoat.debug=boolean
	 * Should SummerCoat print lots of debugging information?}
	 */
	public static final boolean ENABLE_DEBUG =
		Boolean.getBoolean("cc.squirreljme.summercoat.debug");
	
	/** Maximum amount of CPU registers. */
	public static final int MAX_REGISTERS =







|








<



<


|
<
<
|
<











|







11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26

27
28
29

30
31
32


33

34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52

import cc.squirreljme.jvm.CallStackItem;
import cc.squirreljme.jvm.Constants;
import cc.squirreljme.jvm.SupervisorPropertyIndex;
import cc.squirreljme.jvm.SystemCallError;
import cc.squirreljme.jvm.SystemCallIndex;
import cc.squirreljme.runtime.cldc.debug.CallTraceElement;
import cc.squirreljme.emulator.vm.VMException;
import dev.shadowtail.classfile.nncc.ArgumentFormat;
import dev.shadowtail.classfile.nncc.InvalidInstructionException;
import dev.shadowtail.classfile.nncc.NativeCode;
import dev.shadowtail.classfile.nncc.NativeInstruction;
import dev.shadowtail.classfile.nncc.NativeInstructionType;
import dev.shadowtail.classfile.xlate.CompareType;
import dev.shadowtail.classfile.xlate.DataType;
import dev.shadowtail.classfile.xlate.MathType;

import java.io.DataInputStream;
import java.io.IOException;
import java.io.OutputStream;

import java.util.Deque;
import java.util.LinkedList;
import cc.squirreljme.emulator.profiler.ProfiledThread;


import cc.squirreljme.emulator.profiler.ProfilerSnapshot;


/**
 * This represents a native CPU which may run within its own thread to
 * execute code that is running from within the virtual machine.
 *
 * @since 2019/04/21
 */
public final class NativeCPU
	implements Runnable
{
	/**
	 * {@squirreljme.property cc.squirreljme.summercoat.debug=boolean
	 * Should SummerCoat print lots of debugging information?}
	 */
	public static final boolean ENABLE_DEBUG =
		Boolean.getBoolean("cc.squirreljme.summercoat.debug");
	
	/** Maximum amount of CPU registers. */
	public static final int MAX_REGISTERS =
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
	
	/** Super visor properties. */
	private final int[] _supervisorproperties =
		new int[SupervisorPropertyIndex.NUM_PROPERTIES];
	
	/** Execution slices which came from the popped frame. */
	private final Deque<Deque<ExecutionSlice>> _sopf =
		(ENABLE_DEBUG ? new LinkedList<Deque<ExecutionSlice>>() : null);
	
	/** IPC Exception register. */
	private int _ipcexception;
	
	/**
	 * Initializes the native CPU.
	 *







|







94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
	
	/** Super visor properties. */
	private final int[] _supervisorproperties =
		new int[SupervisorPropertyIndex.NUM_PROPERTIES];
	
	/** Execution slices which came from the popped frame. */
	private final Deque<Deque<ExecutionSlice>> _sopf =
		(NativeCPU.ENABLE_DEBUG ? new LinkedList<Deque<ExecutionSlice>>() : null);
	
	/** IPC Exception register. */
	private int _ipcexception;
	
	/**
	 * Initializes the native CPU.
	 *
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
		// Failed
		catch (VMException|InvalidInstructionException e)
		{
			// Spacer
			System.err.println("********************************************");
			
			// Only print execution slices if debugging is enabled
			if (ENABLE_DEBUG)
			{
				// Each frame has its own slices
				for (Frame l : this._frames)
				{
					// Traces for this frame
					System.err.print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
					System.err.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");







|







205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
		// Failed
		catch (VMException|InvalidInstructionException e)
		{
			// Spacer
			System.err.println("********************************************");
			
			// Only print execution slices if debugging is enabled
			if (NativeCPU.ENABLE_DEBUG)
			{
				// Each frame has its own slices
				for (Frame l : this._frames)
				{
					// Traces for this frame
					System.err.print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
					System.err.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
		int[] lr = null;
		int pc = -1;
		
		// Per operation handling
		final int[] args = new int[6];
		
		// Method cache to reduce tons of method reads
		final byte[] icache = new byte[METHOD_CACHE];
		int lasticache = -(METHOD_CACHE_SPILL + 1);
		
		// Debug point counter
		int pointcounter = 0;
		
		// Execution is effectively an infinite loop
		LinkedList<Frame> frames = this._frames;
		for (int frameat = frames.size(), lastframe = -1; frameat >= __fl;







|
|







300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
		int[] lr = null;
		int pc = -1;
		
		// Per operation handling
		final int[] args = new int[6];
		
		// Method cache to reduce tons of method reads
		final byte[] icache = new byte[NativeCPU.METHOD_CACHE];
		int lasticache = -(NativeCPU.METHOD_CACHE_SPILL + 1);
		
		// Debug point counter
		int pointcounter = 0;
		
		// Execution is effectively an infinite loop
		LinkedList<Frame> frames = this._frames;
		for (int frameat = frames.size(), lastframe = -1; frameat >= __fl;
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
			}
			
			// For a bit faster execution of the method, cache a bunch of
			// the code that is being executed in memory. Constantly performing
			// the method calls to read single bytes of memory is a bit so, so
			// this should hopefully improve performance slightly.
			int pcdiff = pc - lasticache;
			if (pcdiff < 0 || pcdiff >= METHOD_CACHE_SPILL)
			{
				memory.memReadBytes(pc, icache, 0, METHOD_CACHE);
				lasticache = pc;
			}
			
			// Calculate last PC base address
			int bpc = pc - lasticache;
			
			// Always set PC address for debugging frames







|

|







340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
			}
			
			// For a bit faster execution of the method, cache a bunch of
			// the code that is being executed in memory. Constantly performing
			// the method calls to read single bytes of memory is a bit so, so
			// this should hopefully improve performance slightly.
			int pcdiff = pc - lasticache;
			if (pcdiff < 0 || pcdiff >= NativeCPU.METHOD_CACHE_SPILL)
			{
				memory.memReadBytes(pc, icache, 0, NativeCPU.METHOD_CACHE);
				lasticache = pc;
			}
			
			// Calculate last PC base address
			int bpc = pc - lasticache;
			
			// Always set PC address for debugging frames
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
			int encoding = NativeInstruction.encoding(op);
			
			// Set first point flag
			if (encoding == NativeInstructionType.DEBUG_ENTRY)
				pointcounter = 0;
			
			// Only track slices if we are debugging
			if (ENABLE_DEBUG)
			{
				// Get slice for this instruction
				ExecutionSlice el = ExecutionSlice.of(this.trace(nowframe),
					nowframe, op, args, af.length, reglist);
				
				// Add to previous instructions, do not exceed slice limits
				Deque<ExecutionSlice> execslices = nowframe._execslices;
				if (execslices.size() >= MAX_EXECUTION_SLICES)
					execslices.removeFirst();
				execslices.addLast(el);
			
				// In debug points check to see if the execution seems to
				// be stuck in here (really long methods)
				if (encoding == NativeInstructionType.DEBUG_POINT)
				{
					// Seems to be stuck?
					boolean doprint = false;
					if (pointcounter++ >= _POINT_THRESHOLD)
					{
						doprint = true;
						pointcounter = 0;
					}
					
					// Print the point?
					if (doprint)







|







|









|







449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
			int encoding = NativeInstruction.encoding(op);
			
			// Set first point flag
			if (encoding == NativeInstructionType.DEBUG_ENTRY)
				pointcounter = 0;
			
			// Only track slices if we are debugging
			if (NativeCPU.ENABLE_DEBUG)
			{
				// Get slice for this instruction
				ExecutionSlice el = ExecutionSlice.of(this.trace(nowframe),
					nowframe, op, args, af.length, reglist);
				
				// Add to previous instructions, do not exceed slice limits
				Deque<ExecutionSlice> execslices = nowframe._execslices;
				if (execslices.size() >= NativeCPU.MAX_EXECUTION_SLICES)
					execslices.removeFirst();
				execslices.addLast(el);
			
				// In debug points check to see if the execution seems to
				// be stuck in here (really long methods)
				if (encoding == NativeInstructionType.DEBUG_POINT)
				{
					// Seems to be stuck?
					boolean doprint = false;
					if (pointcounter++ >= NativeCPU._POINT_THRESHOLD)
					{
						doprint = true;
						pointcounter = 0;
					}
					
					// Print the point?
					if (doprint)
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
			
			// Handle the operation
			switch (encoding)
			{
					// CPU Breakpoint
				case NativeInstructionType.BREAKPOINT:
					// Breakpoints only function when debugging is enabled
					if (ENABLE_DEBUG)
					{
						// If profiling, immediately enter the frame to signal
						// a break point then exit it
						if (profiler != null)
						{
							profiler.enterFrame("<breakpoint>", "<breakpoint>",
								"<breakpoint>");







|







489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
			
			// Handle the operation
			switch (encoding)
			{
					// CPU Breakpoint
				case NativeInstructionType.BREAKPOINT:
					// Breakpoints only function when debugging is enabled
					if (NativeCPU.ENABLE_DEBUG)
					{
						// If profiling, immediately enter the frame to signal
						// a break point then exit it
						if (profiler != null)
						{
							profiler.enterFrame("<breakpoint>", "<breakpoint>",
								"<breakpoint>");
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
						Deque<Deque<ExecutionSlice>> sopf = this._sopf;
						if (sopf != null)
						{
							// Add these slices
							sopf.addLast(was._execslices);
							
							// If there are too many, remove them
							if (sopf.size() > MAX_POPPED_SLICE_STORE)
								sopf.removeFirst();
						}
						
						// We are going back onto a frame so copy all
						// the globals which were set since they are meant to
						// be global!
						int[] wr = was._registers,







|







851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
						Deque<Deque<ExecutionSlice>> sopf = this._sopf;
						if (sopf != null)
						{
							// Add these slices
							sopf.addLast(was._execslices);
							
							// If there are too many, remove them
							if (sopf.size() > NativeCPU.MAX_POPPED_SLICE_STORE)
								sopf.removeFirst();
						}
						
						// We are going back onto a frame so copy all
						// the globals which were set since they are meant to
						// be global!
						int[] wr = was._registers,
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
	{
		if (__f == null)
			throw new NullPointerException("NARG");
		
		// Get the pool address
		int pooladdr = __f._registers[NativeCode.POOL_REGISTER];
		
		int icl = memory.memReadInt(pooladdr + (__pcl * 4)),
			imn = memory.memReadInt(pooladdr + (__pmn * 4)),
			imt = memory.memReadInt(pooladdr + (__pmt * 4)),
			isf = memory.memReadInt(pooladdr + (__psf * 4));
		
		// Store in state
		__f._inclassp = icl;
		__f._inmethodnamep = imn;
		__f._inmethodtypep = imt;
		__f._insourcefilep = isf;
		







|
|
|
|







1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
	{
		if (__f == null)
			throw new NullPointerException("NARG");
		
		// Get the pool address
		int pooladdr = __f._registers[NativeCode.POOL_REGISTER];
		
		int icl = this.memory.memReadInt(pooladdr + (__pcl * 4)),
			imn = this.memory.memReadInt(pooladdr + (__pmn * 4)),
			imt = this.memory.memReadInt(pooladdr + (__pmt * 4)),
			isf = this.memory.memReadInt(pooladdr + (__psf * 4));
		
		// Store in state
		__f._inclassp = icl;
		__f._inmethodnamep = imn;
		__f._inmethodtypep = imt;
		__f._insourcefilep = isf;
		
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
	public static final class Frame
	{
		/** Execution slices. */
		final Deque<ExecutionSlice> _execslices;
		
		/** Registers for this frame. */
		final int[] _registers =
			new int[MAX_REGISTERS];
		
		/** The entry PC address. */
		int _entrypc;
		
		/** The PC address for this frame. */
		volatile int _pc;
		







|







1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
	public static final class Frame
	{
		/** Execution slices. */
		final Deque<ExecutionSlice> _execslices;
		
		/** Registers for this frame. */
		final int[] _registers =
			new int[NativeCPU.MAX_REGISTERS];
		
		/** The entry PC address. */
		int _entrypc;
		
		/** The PC address for this frame. */
		volatile int _pc;
		
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
		/** The current task ID. */
		int _taskid;
		
		/**
		 * Potential initialization.
		 */
		{
			this._execslices = (ENABLE_DEBUG ?
				new LinkedList<ExecutionSlice>() :
				(Deque<ExecutionSlice>)null);
		}
	}
}








|






1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
		/** The current task ID. */
		int _taskid;
		
		/**
		 * Potential initialization.
		 */
		{
			this._execslices = (NativeCPU.ENABLE_DEBUG ?
				new LinkedList<ExecutionSlice>() :
				(Deque<ExecutionSlice>)null);
		}
	}
}

Name change from runt/libs/summercoat-vm/cc/squirreljme/vm/summercoat/RawMemory.java to emulators/summercoat-vm/src/main/java/cc/squirreljme/vm/summercoat/RawMemory.java.

Name change from runt/libs/summercoat-vm/cc/squirreljme/vm/summercoat/ReadableMemory.java to emulators/summercoat-vm/src/main/java/cc/squirreljme/vm/summercoat/ReadableMemory.java.

21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
	/**
	 * Reads the memory at the specified address.
	 *
	 * @param __addr The address to read from.
	 * @return The read value.
	 * @since 2019/04/21
	 */
	public abstract int memReadByte(int __addr);
	
	/**
	 * Bulk read of memory bytes.
	 *
	 * @param __ad The address to read from.
	 * @param __b The output bytes.
	 * @param __o The offset.
	 * @param __l The length.
	 * @throws IndexOutOfBoundsException If the offset and/or length are
	 * negative or exceed the array bounds.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/04/21
	 */
	public abstract void memReadBytes(int __ad, byte[] __b, int __o, int __l)
		throws IndexOutOfBoundsException, NullPointerException;
	
	/**
	 * Reads the memory at the specified address.
	 *
	 * @param __addr The address to read from.
	 * @return The read value.
	 * @since 2019/04/21
	 */
	public abstract int memReadInt(int __addr);
	
	/**
	 * Reads the memory at the specified address.
	 *
	 * @param __addr The address to read from.
	 * @return The read value.
	 * @since 2019/04/21
	 */
	public abstract int memReadShort(int __addr);
}








|













|









|








|


21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
	/**
	 * Reads the memory at the specified address.
	 *
	 * @param __addr The address to read from.
	 * @return The read value.
	 * @since 2019/04/21
	 */
	int memReadByte(int __addr);
	
	/**
	 * Bulk read of memory bytes.
	 *
	 * @param __ad The address to read from.
	 * @param __b The output bytes.
	 * @param __o The offset.
	 * @param __l The length.
	 * @throws IndexOutOfBoundsException If the offset and/or length are
	 * negative or exceed the array bounds.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/04/21
	 */
	void memReadBytes(int __ad, byte[] __b, int __o, int __l)
		throws IndexOutOfBoundsException, NullPointerException;
	
	/**
	 * Reads the memory at the specified address.
	 *
	 * @param __addr The address to read from.
	 * @return The read value.
	 * @since 2019/04/21
	 */
	int memReadInt(int __addr);
	
	/**
	 * Reads the memory at the specified address.
	 *
	 * @param __addr The address to read from.
	 * @return The read value.
	 * @since 2019/04/21
	 */
	int memReadShort(int __addr);
}

Name change from runt/libs/summercoat-vm/cc/squirreljme/vm/summercoat/ReadableMemoryInputStream.java to emulators/summercoat-vm/src/main/java/cc/squirreljme/vm/summercoat/ReadableMemoryInputStream.java.

Name change from runt/libs/summercoat-vm/cc/squirreljme/vm/summercoat/StaticAllocator.java to emulators/summercoat-vm/src/main/java/cc/squirreljme/vm/summercoat/StaticAllocator.java.

Name change from runt/libs/summercoat-vm/cc/squirreljme/vm/summercoat/SuiteMemory.java to emulators/summercoat-vm/src/main/java/cc/squirreljme/vm/summercoat/SuiteMemory.java.

1
2
3
4
5
6
7
8
9
10
11
12


13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.vm.summercoat;

import dev.shadowtail.classfile.mini.Minimizer;


import dev.shadowtail.jarfile.JarMinimizer;
import dev.shadowtail.jarfile.MinimizedJarHeader;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.io.InputStream;
import java.io.IOException;
import cc.squirreljme.vm.VMClassLibrary;
import cc.squirreljme.vm.VMException;
import cc.squirreljme.vm.VMSuiteManager;
import net.multiphasicapps.classfile.ClassFile;

/**
 * This represents the single virtual memory space for suite memory.
 *
 * @since 2019/04/21
 */
public final class SuiteMemory











|
>
>


<
<
<

<
<
<
<







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16



17




18
19
20
21
22
23
24
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.vm.summercoat;

import cc.squirreljme.vm.VMClassLibrary;
import cc.squirreljme.emulator.vm.VMException;
import cc.squirreljme.emulator.vm.VMSuiteManager;
import dev.shadowtail.jarfile.JarMinimizer;
import dev.shadowtail.jarfile.MinimizedJarHeader;



import java.io.IOException;





/**
 * This represents the single virtual memory space for suite memory.
 *
 * @since 2019/04/21
 */
public final class SuiteMemory
194
195
196
197
198
199
200
201

202
203
204
205
206
207
208
209
		String libname = this.libname;
		VMClassLibrary clib = this.__loadLibrary(libname);
		
		// Debug
		todo.DEBUG.note("Initialize suite %s @%08d", libname, this.offset);
		
		// Minimize and format the JAR
		byte[] jf = JarMinimizer.minimize((libname.equals("supervisor") ||

			libname.equals("supervisor.jar")), clib);
		
		// {@squirreljme.error AE09 Suite chunk size limit was exceeded.
		// (The required chunk size; The limit; More space that is needed)}
		if (jf.length > SuitesMemory.SUITE_CHUNK_SIZE)
			throw new RuntimeException("AE09 " + jf.length + " " +
				SuitesMemory.SUITE_CHUNK_SIZE + " " +
				(jf.length - SuitesMemory.SUITE_CHUNK_SIZE));







|
>
|







189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
		String libname = this.libname;
		VMClassLibrary clib = this.__loadLibrary(libname);
		
		// Debug
		todo.DEBUG.note("Initialize suite %s @%08d", libname, this.offset);
		
		// Minimize and format the JAR
		byte[] jf = JarMinimizer.minimize(
			(libname.startsWith("cldc-compact.") ||
			libname.startsWith("cldc-compact-")), clib);
		
		// {@squirreljme.error AE09 Suite chunk size limit was exceeded.
		// (The required chunk size; The limit; More space that is needed)}
		if (jf.length > SuitesMemory.SUITE_CHUNK_SIZE)
			throw new RuntimeException("AE09 " + jf.length + " " +
				SuitesMemory.SUITE_CHUNK_SIZE + " " +
				(jf.length - SuitesMemory.SUITE_CHUNK_SIZE));

Name change from runt/libs/summercoat-vm/cc/squirreljme/vm/summercoat/SuitesMemory.java to emulators/summercoat-vm/src/main/java/cc/squirreljme/vm/summercoat/SuitesMemory.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.vm.summercoat;

import cc.squirreljme.vm.VMClassLibrary;
import cc.squirreljme.vm.VMException;
import cc.squirreljme.vm.VMSuiteManager;
import dev.shadowtail.jarfile.MinimizedJarHeader;
import dev.shadowtail.packfile.MinimizedPackHeader;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.Map;
import net.multiphasicapps.classfile.MethodFlags;

/**
 * This class contains the memory information for every single suite which
 * exists within the VM.
 *
 * @since 2019/04/21
 */











<
|
|
<







<







1
2
3
4
5
6
7
8
9
10
11

12
13

14
15
16
17
18
19
20

21
22
23
24
25
26
27
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.vm.summercoat;


import cc.squirreljme.emulator.vm.VMException;
import cc.squirreljme.emulator.vm.VMSuiteManager;

import dev.shadowtail.packfile.MinimizedPackHeader;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.Map;


/**
 * This class contains the memory information for every single suite which
 * exists within the VM.
 *
 * @since 2019/04/21
 */
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
		int n = libnames.length;
		
		// Setup suite memory area
		SuiteMemory[] suitemem = new SuiteMemory[n];
		Map<String, SuiteMemory> suitemap = new LinkedHashMap<>();
		
		// Setup memory regions for the various suites
		int off = CONFIG_TABLE_SIZE;
		for (int i = 0; i < n; i++, off += SUITE_CHUNK_SIZE)
		{
			// Need the suite name for later lookup on init
			String libname = libnames[i];
			
			// Normalize and add JAR
			if (!libname.endsWith(".jar"))
				libname = libname + ".jar";







|
|







80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
		int n = libnames.length;
		
		// Setup suite memory area
		SuiteMemory[] suitemem = new SuiteMemory[n];
		Map<String, SuiteMemory> suitemap = new LinkedHashMap<>();
		
		// Setup memory regions for the various suites
		int off = SuitesMemory.CONFIG_TABLE_SIZE;
		for (int i = 0; i < n; i++, off += SuitesMemory.SUITE_CHUNK_SIZE)
		{
			// Need the suite name for later lookup on init
			String libname = libnames[i];
			
			// Normalize and add JAR
			if (!libname.endsWith(".jar"))
				libname = libname + ".jar";
115
116
117
118
119
120
121



































122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138

139
140
141
142
143
144
145
146
		this._suitemem = suitemem;
		this._suitemap = suitemap;
		
		// Store final memory parameters
		this.offset = __off;
		this.size = off;
	}



































	
	/**
	 * {@inheritDoc}
	 * @since 2019/04/21
	 */
	@Override
	public int memReadByte(int __addr)
	{
		// Needs to be initialized?
		if (!this._didconfiginit)
			this.__init();
		
		// Reading from the config table?
		if (__addr < CONFIG_TABLE_SIZE)
			return this._configtable.memReadByte(__addr);
		
		// Determine the suite index we are wanting to look in memory

		int si = (__addr - CONFIG_TABLE_SIZE) / SUITE_CHUNK_SIZE;
		
		// Instead of failing, return some invalid values
		SuiteMemory[] suitemem = this._suitemem;
		if (si < 0 || si >= suitemem.length)
			return 0xFF;
		
		// Read from suite memory







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>













|



>
|







112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
		this._suitemem = suitemem;
		this._suitemap = suitemap;
		
		// Store final memory parameters
		this.offset = __off;
		this.size = off;
	}
	
	/**
	 * Finds the specified library.
	 *
	 * @param __name The library to locate.
	 * @return The located library.
	 * @throws NullPointerException On null arguments.
	 * @since 2020/03/01
	 */
	public final SuiteMemory findLibrary(String __name)
		throws NullPointerException
	{
		if (__name == null)
			throw new NullPointerException("NARG");
		
		Map<String, SuiteMemory> suitemap = this._suitemap;
		
		// Direct name match?
		SuiteMemory rv = suitemap.get(__name);
		if (rv != null)
			return rv;
		
		// With JAR attached?
		rv = suitemap.get(__name + ".jar");
		if (rv != null)
			return rv;
		
		// Try one last time with JAR removed
		if (__name.endsWith(".jar"))
			return suitemap.get(__name.substring(
				0, __name.length() - ".jar".length()));
		
		// Not found, give up
		return null;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2019/04/21
	 */
	@Override
	public int memReadByte(int __addr)
	{
		// Needs to be initialized?
		if (!this._didconfiginit)
			this.__init();
		
		// Reading from the config table?
		if (__addr < SuitesMemory.CONFIG_TABLE_SIZE)
			return this._configtable.memReadByte(__addr);
		
		// Determine the suite index we are wanting to look in memory
		int si = (__addr - SuitesMemory.CONFIG_TABLE_SIZE) /
			SuitesMemory.SUITE_CHUNK_SIZE;
		
		// Instead of failing, return some invalid values
		SuiteMemory[] suitemem = this._suitemem;
		if (si < 0 || si >= suitemem.length)
			return 0xFF;
		
		// Read from suite memory
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
	{
		// Do not initialize twice!
		if (this._didconfiginit)
			return;
		this._didconfiginit = true;
		
		// Initialize the bootstrap
		SuiteMemory superv = this._suitemap.get("supervisor.jar");
		try
		{
			superv.__init();
		}
		
		// {@squirreljme.error AE0a Could not initialize the supervisor.}
		catch (IOException e)







|







209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
	{
		// Do not initialize twice!
		if (this._didconfiginit)
			return;
		this._didconfiginit = true;
		
		// Initialize the bootstrap
		SuiteMemory superv = this.findLibrary("cldc-compact");
		try
		{
			superv.__init();
		}
		
		// {@squirreljme.error AE0a Could not initialize the supervisor.}
		catch (IOException e)
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
			// Count and table of contents position
			dos.writeInt(numsuites);
			dos.writeInt(MinimizedPackHeader.HEADER_SIZE_WITH_MAGIC);
			
			// Boot properties
			dos.writeInt(Arrays.asList(suitemem).indexOf(superv));
			dos.writeInt(superv.offset);
			dos.writeInt(SUITE_CHUNK_SIZE);
			dos.writeInt(0);
			dos.writeInt(0);
			dos.writeInt(0);
			dos.writeInt(0);
			
			// Class and run-time constant pools
			dos.writeInt(0);







|







245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
			// Count and table of contents position
			dos.writeInt(numsuites);
			dos.writeInt(MinimizedPackHeader.HEADER_SIZE_WITH_MAGIC);
			
			// Boot properties
			dos.writeInt(Arrays.asList(suitemem).indexOf(superv));
			dos.writeInt(superv.offset);
			dos.writeInt(SuitesMemory.SUITE_CHUNK_SIZE);
			dos.writeInt(0);
			dos.writeInt(0);
			dos.writeInt(0);
			dos.writeInt(0);
			
			// Class and run-time constant pools
			dos.writeInt(0);
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
				dos.writeInt(reloff + ndos.size());
				
				// Write name
				ndos.writeUTF(suite.libname);
				
				// Offset and size of the chunk
				dos.writeInt(suite.offset);
				dos.writeInt(SUITE_CHUNK_SIZE);
				
				// The manifest is not known, must be searched
				dos.writeInt(0);
				dos.writeInt(0);
			}
			
			// Write name table







|







278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
				dos.writeInt(reloff + ndos.size());
				
				// Write name
				ndos.writeUTF(suite.libname);
				
				// Offset and size of the chunk
				dos.writeInt(suite.offset);
				dos.writeInt(SuitesMemory.SUITE_CHUNK_SIZE);
				
				// The manifest is not known, must be searched
				dos.writeInt(0);
				dos.writeInt(0);
			}
			
			// Write name table

Name change from runt/libs/summercoat-vm/cc/squirreljme/vm/summercoat/SummerCoatFactory.java to emulators/summercoat-vm/src/main/java/cc/squirreljme/vm/summercoat/SummerCoatFactory.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.vm.summercoat;

import cc.squirreljme.jvm.ConfigRomType;
import cc.squirreljme.jvm.Constants;
import dev.shadowtail.classfile.mini.MinimizedClassFile;
import dev.shadowtail.classfile.mini.MinimizedField;
import dev.shadowtail.classfile.mini.MinimizedMethod;
import dev.shadowtail.classfile.mini.MinimizedPool;
import dev.shadowtail.classfile.nncc.NativeCode;
import dev.shadowtail.jarfile.MinimizedJarHeader;
import dev.shadowtail.packfile.MinimizedPackHeader;
import cc.squirreljme.vm.VirtualMachine;
import cc.squirreljme.vm.VMClassLibrary;
import cc.squirreljme.vm.VMException;
import cc.squirreljme.vm.VMFactory;
import cc.squirreljme.vm.VMSuiteManager;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardOpenOption;
import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.InputStream;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.HashMap;
import java.util.Map;
import net.multiphasicapps.io.HexDumpOutputStream;
import net.multiphasicapps.profiler.ProfilerSnapshot;

/**
 * This is the factory which is capable of creating instances of the
 * SummerCoat virtual machine.
 *
 * @since 2018/12/29
 */













|
|
|
|
|



|
|
|
|
|




<
<
<
<
<
<
<

<
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30







31

32
33
34
35
36
37
38
39
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.vm.summercoat;

import cc.squirreljme.jvm.ConfigRomType;
import cc.squirreljme.vm.VMClassLibrary;
import cc.squirreljme.emulator.vm.VMException;
import cc.squirreljme.emulator.vm.VMFactory;
import cc.squirreljme.emulator.vm.VMSuiteManager;
import cc.squirreljme.emulator.vm.VirtualMachine;
import dev.shadowtail.classfile.nncc.NativeCode;
import dev.shadowtail.jarfile.MinimizedJarHeader;
import dev.shadowtail.packfile.MinimizedPackHeader;
import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardOpenOption;







import java.util.Map;

import cc.squirreljme.emulator.profiler.ProfilerSnapshot;

/**
 * This is the factory which is capable of creating instances of the
 * SummerCoat virtual machine.
 *
 * @since 2018/12/29
 */
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
		String[] __args)
		throws IllegalArgumentException, NullPointerException, VMException
	{
		// Virtual memory which provides access to many parts of memory
		VirtualMemory vmem = new VirtualMemory();
		
		// The ROM always starts here
		int rombase = SUITE_BASE_ADDR,
			romsize = 0;
		
		// Try to load a specific ROM file instead of the dynamically
		// generate one?
		String romfile = __sprops.get("cc.squirreljme.romfile");
		if (romfile == null)
			try







|







81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
		String[] __args)
		throws IllegalArgumentException, NullPointerException, VMException
	{
		// Virtual memory which provides access to many parts of memory
		VirtualMemory vmem = new VirtualMemory();
		
		// The ROM always starts here
		int rombase = SummerCoatFactory.SUITE_BASE_ADDR,
			romsize = 0;
		
		// Try to load a specific ROM file instead of the dynamically
		// generate one?
		String romfile = __sprops.get("cc.squirreljme.romfile");
		if (romfile == null)
			try
161
162
163
164
165
166
167
168
169
170
171
172

173
174
175
176
177
178
179
			
			// Rom size is derived from the chunk size
			romsize = sm.size;
		}
		
		// Initialize RAM
		int ramsize = SummerCoatFactory.DEFAULT_RAM_SIZE,
			ramstart = RAM_START_ADDRESS;
		vmem.mapRegion(new RawMemory(ramstart, ramsize));
		
		// Initialize configuration memory
		WritableMemory cmem = new RawMemory(CONFIG_BASE_ADDR, CONFIG_SIZE);

		vmem.mapRegion(cmem);
		
		// Read the boot JAR offset of this packfile
		int bootjaroff = rombase + vmem.memReadInt(rombase +
				MinimizedPackHeader.OFFSET_OF_BOOTJAROFFSET),
			bootjarsize = vmem.memReadInt(rombase +
				MinimizedPackHeader.OFFSET_OF_BOOTJARSIZE);







|



|
>







153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
			
			// Rom size is derived from the chunk size
			romsize = sm.size;
		}
		
		// Initialize RAM
		int ramsize = SummerCoatFactory.DEFAULT_RAM_SIZE,
			ramstart = SummerCoatFactory.RAM_START_ADDRESS;
		vmem.mapRegion(new RawMemory(ramstart, ramsize));
		
		// Initialize configuration memory
		WritableMemory cmem = new RawMemory(SummerCoatFactory.CONFIG_BASE_ADDR,
			SummerCoatFactory.CONFIG_SIZE);
		vmem.mapRegion(cmem);
		
		// Read the boot JAR offset of this packfile
		int bootjaroff = rombase + vmem.memReadInt(rombase +
				MinimizedPackHeader.OFFSET_OF_BOOTJAROFFSET),
			bootjarsize = vmem.memReadInt(rombase +
				MinimizedPackHeader.OFFSET_OF_BOOTJARSIZE);
190
191
192
193
194
195
196
197

198
199
200
201
202
203
204
		catch (IOException e)
		{
			throw new RuntimeException("AE0e", e);
		}
		
		// Write configuration information
		try (DataOutputStream dos = new DataOutputStream(
			new WritableMemoryOutputStream(cmem, 0, CONFIG_SIZE)))

		{
			// Version
			ConfigRomWriter.writeString(dos, ConfigRomType.JAVA_VM_VERSION,
				"0.3.0");
			
			// Name
			ConfigRomWriter.writeString(dos, ConfigRomType.JAVA_VM_NAME,







|
>







183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
		catch (IOException e)
		{
			throw new RuntimeException("AE0e", e);
		}
		
		// Write configuration information
		try (DataOutputStream dos = new DataOutputStream(
			new WritableMemoryOutputStream(cmem, 0,
				SummerCoatFactory.CONFIG_SIZE)))
		{
			// Version
			ConfigRomWriter.writeString(dos, ConfigRomType.JAVA_VM_VERSION,
				"0.3.0");
			
			// Name
			ConfigRomWriter.writeString(dos, ConfigRomType.JAVA_VM_NAME,
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
		// Setup non-cpu VM state
		MachineState ms = new MachineState(vmem, __ps);
		
		// Setup virtual execution CPU
		NativeCPU cpu = new NativeCPU(ms, vmem, 0, __ps);
		NativeCPU.Frame iframe = cpu.enterFrame(bootjaroff + bjh.bootstart,
			ramstart, ramsize, rombase, romsize,
			CONFIG_BASE_ADDR, CONFIG_SIZE);
		
		// Seed initial frame registers
		iframe._registers[NativeCode.POOL_REGISTER] =
			ramstart + bjh.bootpool;
		iframe._registers[NativeCode.STATIC_FIELD_REGISTER] =
			ramstart + bjh.bootsfieldbase;
		







|







367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
		// Setup non-cpu VM state
		MachineState ms = new MachineState(vmem, __ps);
		
		// Setup virtual execution CPU
		NativeCPU cpu = new NativeCPU(ms, vmem, 0, __ps);
		NativeCPU.Frame iframe = cpu.enterFrame(bootjaroff + bjh.bootstart,
			ramstart, ramsize, rombase, romsize,
			SummerCoatFactory.CONFIG_BASE_ADDR, SummerCoatFactory.CONFIG_SIZE);
		
		// Seed initial frame registers
		iframe._registers[NativeCode.POOL_REGISTER] =
			ramstart + bjh.bootpool;
		iframe._registers[NativeCode.STATIC_FIELD_REGISTER] =
			ramstart + bjh.bootsfieldbase;
		

Name change from runt/libs/summercoat-vm/cc/squirreljme/vm/summercoat/SummerCoatVirtualMachine.java to emulators/summercoat-vm/src/main/java/cc/squirreljme/vm/summercoat/SummerCoatVirtualMachine.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.vm.summercoat;

import cc.squirreljme.vm.VirtualMachine;
import cc.squirreljme.vm.VMException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

/**
 * This represents a virtual machine within SummerCoat.
 *











|
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.vm.summercoat;

import cc.squirreljme.emulator.vm.VMException;
import cc.squirreljme.emulator.vm.VirtualMachine;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

/**
 * This represents a virtual machine within SummerCoat.
 *

Name change from runt/libs/summercoat-vm/cc/squirreljme/vm/summercoat/VMRuntimeException.java to emulators/summercoat-vm/src/main/java/cc/squirreljme/vm/summercoat/VMRuntimeException.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.vm.summercoat;

import cc.squirreljme.vm.VMException;

/**
 * This is an exception in SummerCoat which is translated to an exception
 * for the virtual machine itself when it has a chance to do so.
 *
 * @since 2019/01/11
 */












|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.vm.summercoat;

import cc.squirreljme.emulator.vm.VMException;

/**
 * This is an exception in SummerCoat which is translated to an exception
 * for the virtual machine itself when it has a chance to do so.
 *
 * @since 2019/01/11
 */

Name change from runt/libs/summercoat-vm/cc/squirreljme/vm/summercoat/VMToDoException.java to emulators/summercoat-vm/src/main/java/cc/squirreljme/vm/summercoat/VMToDoException.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.vm.summercoat;

import cc.squirreljme.vm.VMException;

/**
 * This is thrown when incomplete code has been reached.
 *
 * @since 2019/11/09
 */
public class VMToDoException











|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.vm.summercoat;

import cc.squirreljme.emulator.vm.VMException;

/**
 * This is thrown when incomplete code has been reached.
 *
 * @since 2019/11/09
 */
public class VMToDoException

Name change from runt/libs/summercoat-vm/cc/squirreljme/vm/summercoat/VirtualMemory.java to emulators/summercoat-vm/src/main/java/cc/squirreljme/vm/summercoat/VirtualMemory.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.vm.summercoat;

import cc.squirreljme.jvm.Constants;
import cc.squirreljme.vm.VMException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
 * This class contains the entirety of virtual memory, this includes access
 * to the various on-demand minification of suites and classes.
 *
 * @since 2019/04/21











|
<

<







1
2
3
4
5
6
7
8
9
10
11
12

13

14
15
16
17
18
19
20
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.vm.summercoat;

import cc.squirreljme.emulator.vm.VMException;

import java.util.ArrayList;

import java.util.List;

/**
 * This class contains the entirety of virtual memory, this includes access
 * to the various on-demand minification of suites and classes.
 *
 * @since 2019/04/21
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
	private volatile Memory[] _cache =
		new Memory[0];
	
	/**
	 * Maps the given region of memory.
	 *
	 * @param __mem The region to map.
	 * @param __off The region offset.
	 * @param __len Th
	 * @since 2019/04/21
	 */
	public final void mapRegion(Memory __mem)
		throws NullPointerException
	{
		if (__mem == null)
			throw new NullPointerException("NARG");







<
<







30
31
32
33
34
35
36


37
38
39
40
41
42
43
	private volatile Memory[] _cache =
		new Memory[0];
	
	/**
	 * Maps the given region of memory.
	 *
	 * @param __mem The region to map.


	 * @since 2019/04/21
	 */
	public final void mapRegion(Memory __mem)
		throws NullPointerException
	{
		if (__mem == null)
			throw new NullPointerException("NARG");

Name change from runt/libs/summercoat-vm/cc/squirreljme/vm/summercoat/WritableMemory.java to emulators/summercoat-vm/src/main/java/cc/squirreljme/vm/summercoat/WritableMemory.java.

20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
	/**
	 * Writes a value to memory.
	 *
	 * @param __addr The address to write to.
	 * @param __v The value to write.
	 * @since 2019/04/21
	 */
	public abstract void memWriteByte(int __addr, int __v);
	
	/**
	 * Writes multiple bytes to memory
	 *
	 * @param __a The address to write to.
	 * @param __b The input bytes.
	 * @param __o The offset.
	 * @param __l The length.
	 * @throws IndexOutOfBoundsException If the offset and/or length are
	 * negative or exceed the array bounds.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/04/21
	 */
	public abstract void memWriteBytes(int __a, byte[] __b, int __o, int __l);
	
	/**
	 * Writes a value to memory.
	 *
	 * @param __addr The address to write to.
	 * @param __v The value to write.
	 * @since 2019/04/21
	 */
	public abstract void memWriteInt(int __addr, int __v);
	
	/**
	 * Writes a value to memory.
	 *
	 * @param __addr The address to write to.
	 * @param __v The value to write.
	 * @since 2019/04/21
	 */
	public abstract void memWriteShort(int __addr, int __v);
}








|













|








|








|


20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
	/**
	 * Writes a value to memory.
	 *
	 * @param __addr The address to write to.
	 * @param __v The value to write.
	 * @since 2019/04/21
	 */
	void memWriteByte(int __addr, int __v);
	
	/**
	 * Writes multiple bytes to memory
	 *
	 * @param __a The address to write to.
	 * @param __b The input bytes.
	 * @param __o The offset.
	 * @param __l The length.
	 * @throws IndexOutOfBoundsException If the offset and/or length are
	 * negative or exceed the array bounds.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/04/21
	 */
	void memWriteBytes(int __a, byte[] __b, int __o, int __l);
	
	/**
	 * Writes a value to memory.
	 *
	 * @param __addr The address to write to.
	 * @param __v The value to write.
	 * @since 2019/04/21
	 */
	void memWriteInt(int __addr, int __v);
	
	/**
	 * Writes a value to memory.
	 *
	 * @param __addr The address to write to.
	 * @param __v The value to write.
	 * @since 2019/04/21
	 */
	void memWriteShort(int __addr, int __v);
}

Name change from runt/libs/summercoat-vm/cc/squirreljme/vm/summercoat/WritableMemoryOutputStream.java to emulators/summercoat-vm/src/main/java/cc/squirreljme/vm/summercoat/WritableMemoryOutputStream.java.

50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
		
		this.memory = __mem;
		this.address = __ad;
		this.length = __ln;
	}
	
	/**
	 * {@inheritDoc)
	 * @since 2019/06/14
	 */
	@Override
	public final void close()
	{
		// Does nothing
	}
	
	/**
	 * {@inheritDoc)
	 * @since 2019/06/14
	 */
	@Override
	public final void flush()
	{
		// Does nothing
	}
	
	/**
	 * {@inheritDoc)
	 * @since 2019/06/14
	 */
	@Override
	public final void write(int __b)
		throws IOException
	{
		// {@squirreljme.error AE0k Reached end of memory.}
		int at = this._at;
		if (at >= this.length)
			throw new EOFException("AE0k");
		
		// Write
		this.memory.memWriteByte(this.address + at, __b);
		this._at = at + 1;
	}
	
	/**
	 * {@inheritDoc)
	 * @since 2019/06/14
	 */
	@Override
	public final void write(byte[] __b)
		throws IOException, NullPointerException
	{
		this.write(__b, 0, __b.length);
	}
	
	/**
	 * {@inheritDoc)
	 * @since 2019/06/14
	 */
	@Override
	public final void write(byte[] __b, int __o, int __l)
		throws IOException, NullPointerException
	{
		if (__b == null)







|









|









|

















|










|







50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
		
		this.memory = __mem;
		this.address = __ad;
		this.length = __ln;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2019/06/14
	 */
	@Override
	public final void close()
	{
		// Does nothing
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2019/06/14
	 */
	@Override
	public final void flush()
	{
		// Does nothing
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2019/06/14
	 */
	@Override
	public final void write(int __b)
		throws IOException
	{
		// {@squirreljme.error AE0k Reached end of memory.}
		int at = this._at;
		if (at >= this.length)
			throw new EOFException("AE0k");
		
		// Write
		this.memory.memWriteByte(this.address + at, __b);
		this._at = at + 1;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2019/06/14
	 */
	@Override
	public final void write(byte[] __b)
		throws IOException, NullPointerException
	{
		this.write(__b, 0, __b.length);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2019/06/14
	 */
	@Override
	public final void write(byte[] __b, int __o, int __l)
		throws IOException, NullPointerException
	{
		if (__b == null)
125
126
127
128
129
130
131
132
133
134
135
136
137
138
			throw new EOFException("AE0l");
		
		// Do not write past the bounds
		if (__l > left)
			__l = left;
		
		// Write to memory
		this.memory.memWriteBytes(address + at, __b, __o, __l);
		
		// Increase pointer
		this._at = at + __l;
	}
}








|






125
126
127
128
129
130
131
132
133
134
135
136
137
138
			throw new EOFException("AE0l");
		
		// Do not write past the bounds
		if (__l > left)
			__l = left;
		
		// Write to memory
		this.memory.memWriteBytes(this.address + at, __b, __o, __l);
		
		// Increase pointer
		this._at = at + __l;
	}
}

Name change from runt/libs/summercoat-vm/cc/squirreljme/vm/summercoat/package-info.java to emulators/summercoat-vm/src/main/java/cc/squirreljme/vm/summercoat/package-info.java.

Name change from runt/libs/summercoat-vm/META-INF/services/cc.squirreljme.vm.VMFactory to emulators/summercoat-vm/src/main/resources/META-INF/services/cc.squirreljme.emulator.vm.VMFactory.

Added gradle/wrapper/gradle-wrapper.jar.

cannot compute difference between binary files

Added gradle/wrapper/gradle-wrapper.properties.











>
>
>
>
>
1
2
3
4
5
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

Added gradlew.















































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
#!/usr/bin/env sh

#
# Copyright 2015 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

##############################################################################
##
##  Gradle start up script for UN*X
##
##############################################################################

# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
    ls=`ls -ld "$PRG"`
    link=`expr "$ls" : '.*-> \(.*\)$'`
    if expr "$link" : '/.*' > /dev/null; then
        PRG="$link"
    else
        PRG=`dirname "$PRG"`"/$link"
    fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null

APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"

warn () {
    echo "$*"
}

die () {
    echo
    echo "$*"
    echo
    exit 1
}

# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
  CYGWIN* )
    cygwin=true
    ;;
  Darwin* )
    darwin=true
    ;;
  MINGW* )
    msys=true
    ;;
  NONSTOP* )
    nonstop=true
    ;;
esac

CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar

# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
    if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
        # IBM's JDK on AIX uses strange locations for the executables
        JAVACMD="$JAVA_HOME/jre/sh/java"
    else
        JAVACMD="$JAVA_HOME/bin/java"
    fi
    if [ ! -x "$JAVACMD" ] ; then
        die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME

Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
    fi
else
    JAVACMD="java"
    which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.

Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi

# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
    MAX_FD_LIMIT=`ulimit -H -n`
    if [ $? -eq 0 ] ; then
        if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
            MAX_FD="$MAX_FD_LIMIT"
        fi
        ulimit -n $MAX_FD
        if [ $? -ne 0 ] ; then
            warn "Could not set maximum file descriptor limit: $MAX_FD"
        fi
    else
        warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
    fi
fi

# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
    GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi

# For Cygwin or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
    APP_HOME=`cygpath --path --mixed "$APP_HOME"`
    CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
    JAVACMD=`cygpath --unix "$JAVACMD"`

    # We build the pattern for arguments to be converted via cygpath
    ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
    SEP=""
    for dir in $ROOTDIRSRAW ; do
        ROOTDIRS="$ROOTDIRS$SEP$dir"
        SEP="|"
    done
    OURCYGPATTERN="(^($ROOTDIRS))"
    # Add a user-defined pattern to the cygpath arguments
    if [ "$GRADLE_CYGPATTERN" != "" ] ; then
        OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
    fi
    # Now convert the arguments - kludge to limit ourselves to /bin/sh
    i=0
    for arg in "$@" ; do
        CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
        CHECK2=`echo "$arg"|egrep -c "^-"`                                 ### Determine if an option

        if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then                    ### Added a condition
            eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
        else
            eval `echo args$i`="\"$arg\""
        fi
        i=`expr $i + 1`
    done
    case $i in
        0) set -- ;;
        1) set -- "$args0" ;;
        2) set -- "$args0" "$args1" ;;
        3) set -- "$args0" "$args1" "$args2" ;;
        4) set -- "$args0" "$args1" "$args2" "$args3" ;;
        5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
        6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
        7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
        8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
        9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
    esac
fi

# Escape application args
save () {
    for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
    echo " "
}
APP_ARGS=`save "$@"`

# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"

exec "$JAVACMD" "$@"

Added gradlew.bat.









































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem      https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem

@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem  Gradle startup script for Windows
@rem
@rem ##########################################################################

@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal

set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"

@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome

set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.

goto fail

:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto init

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.

goto fail

:init
@rem Get command-line arguments, handling Windows variants

if not "%OS%" == "Windows_NT" goto win9xME_args

:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2

:win9xME_args_slurp
if "x%~1" == "x" goto execute

set CMD_LINE_ARGS=%*

:execute
@rem Setup the command line

set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar

@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%

:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd

:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if  not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1

:mainEnd
if "%OS%"=="Windows_NT" endlocal

:omega

Deleted jitt/TIMESPACE.MF.

1
2
3
4
5
6
7
Manifest-Version: 1.0
X-SquirrelJME-Timespace-Title: JIT Time
X-SquirrelJME-Timespace-Type: jit
X-SquirrelJME-Timespace-Description: This contains everything that 
 should be visible if the JIT is enabled. This depends on the run-time 
 but the build-time is not required in any way.

<
<
<
<
<
<
<














Deleted jitt/jittime.mkd.

1
2
3
4
5
6
7
# JIT-time Projects

These are projects which are available if a JIT is enabled and as such contain
all of the JIT code.

 * `libs/` -- JIT Libraries.

<
<
<
<
<
<
<














Deleted jitt/libs/NAMESPACE.MF.

1
2
3
4
5
6
Manifest-Version: 1.0
X-SquirrelJME-Namespace-Title: JIT Libraries
X-SquirrelJME-Namespace-Type: liblet
X-SquirrelJME-Namespace-Description: This namespace contains all of the 
 JIT libraries which are needed for the JIT compiler to properly operate.

<
<
<
<
<
<












Added modules/build.gradle.



















































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
plugins
{
	id "de.set.ecj" version "1.4.1" apply false
}

group = "cc.squirreljme.modules"
description = "Modules which are a part of SquirrelJME."

// Every sub-project needs SquirrelJME specific pieces
subprojects
{
	//apply plugin: "de.set.ecj"
	apply plugin: "java"
	apply plugin: "checkstyle"
	apply plugin: "cc.squirreljme.plugin"

	// Configure the compiler
	java
	{
		// Java ME 8 is effectively Java 7
        compileJava.sourceCompatibility = JavaVersion.VERSION_1_7
		compileJava.targetCompatibility = JavaVersion.VERSION_1_7

		// All files are always in UTF-8 format
		compileJava.options.encoding = "utf-8"

		// Copy to tests
		compileTestJava.sourceCompatibility = compileJava.sourceCompatibility
		compileTestJava.targetCompatibility = compileJava.targetCompatibility
		compileTestJava.options.encoding = compileJava.options.encoding
		compileTestJava.options.verbose = compileJava.options.verbose

		// Copy to JavaDoc
		javadoc.options.source = "1.7"
		javadoc.options.tags = [ "squirreljme.property",
			"squirreljme.env",
			"squirreljme.error",
			"squirreljme.syscallparam",
			"squirreljme.syscallreturn" ]
	}

	// Enable SquirrelJME Tests
	apply from: project.rootProject.findProject(":emulators:emulator-base").
		projectDir.toPath().resolve("enable-testing.gradle").toFile()
}

// Properties for every sub-project, except for cldc-compact as it is special
configure(subprojects
	- project(":modules:cldc-compact"))
{
	apply plugin: "java"

	// All projects use the base classpath
    java
    {
		// Only use SquirrelJME's boot classes, not the system SDK
		Project cldcCompactProject = project(":modules:cldc-compact")
		compileJava.options.bootstrapClasspath = project.objects.
			fileCollection().from(cldcCompactProject.buildDir.toPath().
			resolve("classes").resolve("java").resolve("main")).getAsFileTree()

		// Copy to JavaDoc
		javadoc.options.bootClasspath = compileJava.options.bootstrapClasspath
			.collect()
    }

	dependencies
	{
		// All projects depend on the Compact CLDC Library
		implementation project(":modules:cldc-compact")
		testImplementation project(":modules:cldc-compact")
	}
}

Added modules/cldc-compact/build.gradle.





































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import cc.squirreljme.plugin.swm.JavaMEConfiguration
import cc.squirreljme.plugin.swm.JavaMEMidletType

// Setup plugins
plugins
{
	id "java"
}

version = "1.8.${rootProject.ext.squirreljmeVMVersion}"
description = "This is the standard JavaME 8 Connection " +
	"Limited  Device Configuration which contains the core classes used " +
	"by Java ME."

squirreljme
{
	javaDocErrorCode = "ZZ"
	swmType = JavaMEMidletType.API
	swmName = "Connection Limited Device Configuration (Compact)"
	swmVendor = "Stephanie Gawroriski"
	definedConfigurations += new JavaMEConfiguration("CLDC-1.8-Compact")
	definedConfigurations += new JavaMEConfiguration("CLDC-1.1")
	definedConfigurations += new JavaMEConfiguration("CLDC-1.0")
}

java
{
	// No classes are available for this project
	compileJava.options.bootstrapClasspath = project.objects.fileCollection()
}

dependencies
{
}

Name change from runt/apis/cldc-compact/cc/squirreljme/jvm/Assembly.java to modules/cldc-compact/src/main/java/cc/squirreljme/jvm/Assembly.java.

16
17
18
19
20
21
22

23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38











39
40
41
42


















43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
















86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102








103
104
105
106
107
108
109
110








111
112
113
114
115
116
117
118








119
120
121
122
123
124
125
126








127
128
129
130
131
132
133
134








135
136
137
138
139
140
141
142








143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162


















163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191

192
193
194










195
196
197
198
199

200

201
202
203

204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224

225
226
227
228
229

230
231
232
233
234
235
236
237
238
239
240
241
242

243
244
245
246
247
248
249
250
251
252
253
254
255
256

257
258
259
260
261
262
263
264
265
266
267
268
269
270
271

272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287

288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304

305
306
307
308
309
310
311
312
313

314
315
316
317
318
319
320
321
322
323

324
325
326
327
328
329

330
331
332
333
334

335
336
337
338
339
340
341

342
343
344
345
346

347
348
349
350
351
352
353
354
355
356
357
358
359
360

361
362
363
364
365
366
367
368
369
370
371
372
373
374
375

376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391

392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408

409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426

427
428
429
430
431
432
433
434
435

436
437
438
439
440
441
442
443
444
445

446
447
448
449
450
451
452
453
454
455
456
457

458
459
460
461
462
463
464
465
466
467
468
469
470

471
472
473
474
475
476
477
478
479
480
481
482
483
484

485
486
487
488
489
490
491
492
493
494
495
496
497
498
499

500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515

516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
 * The compiler will take all of the method arguments and instead use their
 * inputs and outputs from the values of registers instead. However due to
 * this, this means that these instructions are purely primitive in that
 * they must not depend on any aspect of the virtual machine.
 *
 * @since 2019/04/20
 */

public final class Assembly
{
	/**
	 * Not used.
	 *
	 * @since 2019/04/20
	 */
	private Assembly()
	{
	}
	
	/**
	 * Returns the array length of the given object.
	 *
	 * @param __o The object to get the length of.
	 * @return The length of the array.











	 * @since 2019/05/24
	 */
	public static native int arrayLength(Object __o);
	


















	/**
	 * Atomic comparison and set.
	 *
	 * @param __comp The value to compare and if matches, {@code __set} is
	 * written.
	 * @param __set The value to set if matched.
	 * @param __addr The address to write to.
	 * @return The value that was read before the set.
	 * @since 2019/07/01
	 */
	public static native int atomicCompareGetAndSet(int __comp, int __set,
		int __addr);
	
	/**
	 * Atomically decrements a value and returns the result.
	 *
	 * @param __addr The address to decrement.
	 * @return The get value.
	 * @since 2019/07/01
	 */
	public static native int atomicDecrementAndGet(int __addr);
	
	/**
	 * Atomically increments a value.
	 *
	 * @param __addr The address to increment.
	 * @since 2019/07/01
	 */
	public static native void atomicIncrement(int __addr);
	
	/**
	 * Trigger breakpoint within the virtual machine.
	 *
	 * @since 2019/04/21
	 */
	public static native void breakpoint();
	
	/**
	 * Returns the class info pointer of {@code boolean}.
	 *
	 * @return The class info pointer.
	 * @since 2020/01/19
	 */
















	public static native int classInfoOfBoolean();
	
	/**
	 * Returns the class info pointer of {@code byte}.
	 *
	 * @return The class info pointer.
	 * @since 2020/01/19
	 */
	public static native int classInfoOfByte();
	
	/**
	 * Returns the class info pointer of {@code char}.
	 *
	 * @return The class info pointer.
	 * @since 2020/01/19
	 */
	public static native int classInfoOfCharacter();








	
	/**
	 * Returns the class info pointer of {@code double}.
	 *
	 * @return The class info pointer.
	 * @since 2020/01/19
	 */
	public static native int classInfoOfDouble();








	
	/**
	 * Returns the class info pointer of {@code float}.
	 *
	 * @return The class info pointer.
	 * @since 2020/01/19
	 */
	public static native int classInfoOfFloat();








	
	/**
	 * Returns the class info pointer of {@code int}.
	 *
	 * @return The class info pointer.
	 * @since 2020/01/19
	 */
	public static native int classInfoOfInteger();








	
	/**
	 * Returns the class info pointer of {@code long}.
	 *
	 * @return The class info pointer.
	 * @since 2020/01/19
	 */
	public static native int classInfoOfLong();








	
	/**
	 * Returns the class info pointer of {@code short}.
	 *
	 * @return The class info pointer.
	 * @since 2020/01/19
	 */
	public static native int classInfoOfShort();








	
	/**
	 * Packs the given two integers to a double value.
	 *
	 * @param __hi The high value.
	 * @param __lo The low value.
	 * @return The double value.
	 * @since 2019/06/21
	 */
	public static native double doublePack(int __hi, int __lo);
	
	/**
	 * Double to raw long bits.
	 *
	 * @param __d The input double.
	 * @return The raw long bits.
	 * @since 2018/11/03
	 */
	public static native long doubleToRawLongBits(double __d);
	


















	/**
	 * Performs explicit exception handling.
	 *
	 * @since 2019/04/28
	 */
	public static native void exceptionHandle();
	
	/**
	 * Float to raw int bits.
	 *
	 * @param __d The input float.
	 * @return The raw int bits.
	 * @since 2018/11/04
	 */
	public static native int floatToRawIntBits(float __f);
	
	/**
	 * Integer bits to float.
	 *
	 * @param __b The input bits.
	 * @return The resulting float.
	 * @since 2018/11/04
	 */
	public static native float intBitsToFloat(int __b);
	
	/**
	 * Invoke method at pointer.
	 *
	 * @param __addr The address to invoke.

	 * @since 2019/04/28
	 */
	public static native void invoke(int __addr);










	
	/**
	 * Invoke method at pointer, with arguments.
	 *
	 * @param __addr The address to invoke.

	 * @param __a Argument.

	 * @since 2019/04/28
	 */
	public static native void invoke(int __addr, int __a);

	
	/**
	 * Invoke method at pointer, with arguments.
	 *
	 * @param __addr The address to invoke.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @since 2019/04/28
	 */
	public static native void invoke(int __addr, int __a, int __b);
	
	/**
	 * Invoke method at pointer, with arguments.
	 *
	 * @param __addr The address to invoke.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @since 2019/04/28
	 */
	public static native void invoke(int __addr, int __a, int __b, int __c);

	
	/**
	 * Invoke method at pointer, with arguments.
	 *
	 * @param __addr The address to invoke.

	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @since 2019/04/28
	 */
	public static native void invoke(int __addr, int __a, int __b, int __c,
		int __d);
	
	/**
	 * Invoke method at pointer, with arguments.
	 *
	 * @param __addr The address to invoke.

	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @param __e Argument.
	 * @since 2019/04/28
	 */
	public static native void invoke(int __addr, int __a, int __b, int __c,
		int __d, int __e);
	
	/**
	 * Invoke method at pointer, with arguments.
	 *
	 * @param __addr The address to invoke.

	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @param __e Argument.
	 * @param __f Argument.
	 * @since 2019/04/28
	 */
	public static native void invoke(int __addr, int __a, int __b, int __c,
		int __d, int __e, int __f);
	
	/**
	 * Invoke method at pointer, with arguments.
	 *
	 * @param __addr The address to invoke.

	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @param __e Argument.
	 * @param __f Argument.
	 * @param __g Argument.
	 * @since 2019/04/28
	 */
	public static native void invoke(int __addr, int __a, int __b, int __c,
		int __d, int __e, int __f, int __g);
	
	/**
	 * Invoke method at pointer, with arguments.
	 *
	 * @param __addr The address to invoke.

	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @param __e Argument.
	 * @param __f Argument.
	 * @param __g Argument.
	 * @param __h Argument.
	 * @since 2019/04/28
	 */
	public static native void invoke(int __addr, int __a, int __b, int __c,
		int __d, int __e, int __f, int __g, int __h);
	
	/**
	 * Invoke method at pointer.
	 *
	 * @param __addr The address to invoke.

	 * @return The result of the invocation.
	 * @since 2019/04/28
	 */
	public static native int invokeV(int __addr);
	
	/**
	 * Invoke method at pointer, with arguments.
	 *
	 * @param __addr The address to invoke.

	 * @param __a Argument.
	 * @return The result of the invocation.
	 * @since 2019/04/28
	 */
	public static native int invokeV(int __addr, int __a);
	
	/**
	 * Invoke method at pointer, with arguments.
	 *
	 * @param __addr The address to invoke.

	 * @param __a Argument.
	 * @param __b Argument.
	 * @return The result of the invocation.
	 * @since 2019/04/28
	 */
	public static native int invokeV(int __addr, int __a, int __b);

	
	/**
	 * Invoke method at pointer, with arguments.
	 *
	 * @param __addr The address to invoke.

	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @return The result of the invocation.
	 * @since 2019/04/28
	 */
	public static native int invokeV(int __addr, int __a, int __b, int __c);

	
	/**
	 * Invoke method at pointer, with arguments.
	 *
	 * @param __addr The address to invoke.

	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @return The result of the invocation.
	 * @since 2019/04/28
	 */
	public static native int invokeV(int __addr, int __a, int __b, int __c,
		int __d);
	
	/**
	 * Invoke method at pointer, with arguments.
	 *
	 * @param __addr The address to invoke.

	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @param __e Argument.
	 * @return The result of the invocation.
	 * @since 2019/04/28
	 */
	public static native int invokeV(int __addr, int __a, int __b, int __c,
		int __d, int __e);
	
	/**
	 * Invoke method at pointer, with arguments.
	 *
	 * @param __addr The address to invoke.

	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @param __e Argument.
	 * @param __f Argument.
	 * @return The result of the invocation.
	 * @since 2019/04/28
	 */
	public static native int invokeV(int __addr, int __a, int __b, int __c,
		int __d, int __e, int __f);
	
	/**
	 * Invoke method at pointer, with arguments.
	 *
	 * @param __addr The address to invoke.

	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @param __e Argument.
	 * @param __f Argument.
	 * @param __g Argument.
	 * @return The result of the invocation.
	 * @since 2019/04/28
	 */
	public static native int invokeV(int __addr, int __a, int __b, int __c,
		int __d, int __e, int __f, int __g);
	
	/**
	 * Invoke method at pointer, with arguments.
	 *
	 * @param __addr The address to invoke.

	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @param __e Argument.
	 * @param __f Argument.
	 * @param __g Argument.
	 * @param __h Argument.
	 * @return The result of the invocation.
	 * @since 2019/04/28
	 */
	public static native int invokeV(int __addr, int __a, int __b, int __c,
		int __d, int __e, int __f, int __g, int __h);
	
	/**
	 * Invoke method at pointer.
	 *
	 * @param __addr The address to invoke.

	 * @return The result of the invocation.
	 * @since 2019/12/08
	 */
	public static native long invokeVL(int __addr, int __pool);
	
	/**
	 * Invoke method at pointer, with arguments.
	 *
	 * @param __addr The address to invoke.

	 * @param __a Argument.
	 * @return The result of the invocation.
	 * @since 2019/12/08
	 */
	public static native long invokeVL(int __addr, int __pool, int __a);
	
	/**
	 * Invoke method at pointer, with arguments.
	 *
	 * @param __addr The address to invoke.

	 * @param __a Argument.
	 * @param __b Argument.
	 * @return The result of the invocation.
	 * @since 2019/12/08
	 */
	public static native long invokeVL(int __addr, int __pool, int __a,
		int __b);
	
	/**
	 * Invoke method at pointer, with arguments.
	 *
	 * @param __addr The address to invoke.

	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @return The result of the invocation.
	 * @since 2019/12/08
	 */
	public static native long invokeVL(int __addr, int __pool, int __a,
		int __b, int __c);
	
	/**
	 * Invoke method at pointer, with arguments.
	 *
	 * @param __addr The address to invoke.

	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @return The result of the invocation.
	 * @since 2019/12/08
	 */
	public static native long invokeVL(int __addr, int __pool, int __a, 
		int __b, int __c, int __d);
	
	/**
	 * Invoke method at pointer, with arguments.
	 *
	 * @param __addr The address to invoke.

	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @param __e Argument.
	 * @return The result of the invocation.
	 * @since 2019/12/08
	 */
	public static native long invokeVL(int __addr, int __pool, int __a, 
		int __b, int __c, int __d, int __e);
	
	/**
	 * Invoke method at pointer, with arguments.
	 *
	 * @param __addr The address to invoke.

	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @param __e Argument.
	 * @param __f Argument.
	 * @return The result of the invocation.
	 * @since 2019/12/08
	 */
	public static native long invokeVL(int __addr, int __pool, int __a, 
		int __b, int __c, int __d, int __e, int __f);
	
	/**
	 * Invoke method at pointer, with arguments.
	 *
	 * @param __addr The address to invoke.

	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @param __e Argument.
	 * @param __f Argument.
	 * @param __g Argument.
	 * @return The result of the invocation.
	 * @since 2019/12/08
	 */
	public static native long invokeVL(int __addr, int __pool, int __a, 
		int __b, int __c, int __d, int __e, int __f, int __g);
	
	/**
	 * Invoke method at pointer, with arguments.
	 *
	 * @param __addr The address to invoke.
	 * @param __pool The pool pointer to load.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @param __e Argument.
	 * @param __f Argument.
	 * @param __g Argument.
	 * @param __h Argument.
	 * @return The result of the invocation.
	 * @since 2019/12/08
	 */
	public static native long invokeVL(int __addr, int __pool, int __a, 
		int __b, int __c, int __d, int __e, int __f, int __g, int __h);
	
	/**
	 * Loads a value from the constant pool at the given index.
	 *
	 * @return The index of the value in the constant pool.
	 * @since 2019/04/28
	 */
	public static native int loadPool(int __i);
	
	/**
	 * Long bits to double.
	 *
	 * @param __b The input bits.
	 * @return The resulting double.
	 * @since 2018/11/03
	 */







>















|
>
>
>
>
>
>
>
>
>
>
>




>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>











|








|







|














>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|





|

|







|
>
>
>
>
>
>
>
>







|
>
>
>
>
>
>
>
>







|
>
>
>
>
>
>
>
>







|
>
>
>
>
>
>
>
>







|
>
>
>
>
>
>
>
>







|
>
>
>
>
>
>
>
>




















>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>










|


















>


|
>
>
>
>
>
>
>
>
>
>





>

>


|
>





|
<
<
<
<
<
<
<
<
<





|
>





>






|
|





>







|
|





>








|
|





>









|
|





>










|
|





>



|





>




|





>





|
>





>






|
>





>







|
|





>








|
|





>









|
|





>










|
|





>











|
|





>



|





>




|





>





|






>






|






>







|






>








|






>









|






>










|


















|


<
<
<
<
<
<
<
<







16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335









336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689








690
691
692
693
694
695
696
 * The compiler will take all of the method arguments and instead use their
 * inputs and outputs from the values of registers instead. However due to
 * this, this means that these instructions are purely primitive in that
 * they must not depend on any aspect of the virtual machine.
 *
 * @since 2019/04/20
 */
@SuppressWarnings("NewMethodNamingConvention")
public final class Assembly
{
	/**
	 * Not used.
	 *
	 * @since 2019/04/20
	 */
	private Assembly()
	{
	}
	
	/**
	 * Returns the array length of the given object.
	 *
	 * @param __o The object to get the length of.
	 * @return The length of the array, will return a negative value if not
	 * an array.
	 * @since 2020/02/23
	 */
	public static native int arrayLength(long __o);
	
	/**
	 * Returns the array length of the given object.
	 *
	 * @param __o The object to get the length of.
	 * @return The length of the array, will return a negative value if not
	 * an array.
	 * @since 2019/05/24
	 */
	public static native int arrayLength(Object __o);
	
	/**
	 * Sets the array length of an array.
	 *
	 * @param __o The object to set.
	 * @param __l The length to set.
	 * @since 2020/02/23
	 */
	public static native void arrayLengthSet(long __o, int __l);
	
	/**
	 * Sets the array length of an array.
	 *
	 * @param __o The object to set.
	 * @param __l The length to set.
	 * @since 2020/02/23
	 */
	public static native void arrayLengthSet(Object __o, int __l);
	
	/**
	 * Atomic comparison and set.
	 *
	 * @param __comp The value to compare and if matches, {@code __set} is
	 * written.
	 * @param __set The value to set if matched.
	 * @param __addr The address to write to.
	 * @return The value that was read before the set.
	 * @since 2019/07/01
	 */
	public static native int atomicCompareGetAndSet(int __comp, int __set,
		long __addr);
	
	/**
	 * Atomically decrements a value and returns the result.
	 *
	 * @param __addr The address to decrement.
	 * @return The get value.
	 * @since 2019/07/01
	 */
	public static native int atomicDecrementAndGet(long __addr);
	
	/**
	 * Atomically increments a value.
	 *
	 * @param __addr The address to increment.
	 * @since 2019/07/01
	 */
	public static native void atomicIncrement(long __addr);
	
	/**
	 * Trigger breakpoint within the virtual machine.
	 *
	 * @since 2019/04/21
	 */
	public static native void breakpoint();
	
	/**
	 * Returns the class info pointer of {@code boolean}.
	 *
	 * @return The class info pointer.
	 * @since 2020/01/19
	 */
	public static native ClassInfo classInfoOfBoolean();
	
	/**
	 * Returns the class info pointer of {@code boolean}.
	 *
	 * @return The class info pointer.
	 * @since 2020/02/24
	 */
	public static native long classInfoOfBooleanPointer();
	
	/**
	 * Returns the class info pointer of {@code byte}.
	 *
	 * @return The class info pointer.
	 * @since 2020/01/19
	 */
	public static native ClassInfo classInfoOfByte();
	
	/**
	 * Returns the class info pointer of {@code byte}.
	 *
	 * @return The class info pointer.
	 * @since 2020/02/24
	 */
	public static native long classInfoOfBytePointer();
	
	/**
	 * Returns the class info pointer of {@code char}.
	 *
	 * @return The class info pointer.
	 * @since 2020/01/19
	 */
	public static native ClassInfo classInfoOfCharacter();
	
	/**
	 * Returns the class info pointer of {@code char}.
	 *
	 * @return The class info pointer.
	 * @since 2020/02/24
	 */
	public static native long classInfoOfCharacterPointer();
	
	/**
	 * Returns the class info pointer of {@code double}.
	 *
	 * @return The class info pointer.
	 * @since 2020/01/19
	 */
	public static native ClassInfo classInfoOfDouble();
	
	/**
	 * Returns the class info pointer of {@code double}.
	 *
	 * @return The class info pointer.
	 * @since 2020/02/24
	 */
	public static native long classInfoOfDoublePointer();
	
	/**
	 * Returns the class info pointer of {@code float}.
	 *
	 * @return The class info pointer.
	 * @since 2020/01/19
	 */
	public static native ClassInfo classInfoOfFloat();
	
	/**
	 * Returns the class info pointer of {@code float}.
	 *
	 * @return The class info pointer.
	 * @since 2020/02/24
	 */
	public static native long classInfoOfFloatPointer();
	
	/**
	 * Returns the class info pointer of {@code int}.
	 *
	 * @return The class info pointer.
	 * @since 2020/01/19
	 */
	public static native ClassInfo classInfoOfInteger();
	
	/**
	 * Returns the class info pointer of {@code int}.
	 *
	 * @return The class info pointer.
	 * @since 2020/02/24
	 */
	public static native long classInfoOfIntegerPointer();
	
	/**
	 * Returns the class info pointer of {@code long}.
	 *
	 * @return The class info pointer.
	 * @since 2020/01/19
	 */
	public static native ClassInfo classInfoOfLong();
	
	/**
	 * Returns the class info pointer of {@code long}.
	 *
	 * @return The class info pointer.
	 * @since 2020/02/24
	 */
	public static native long classInfoOfLongPointer();
	
	/**
	 * Returns the class info pointer of {@code short}.
	 *
	 * @return The class info pointer.
	 * @since 2020/01/19
	 */
	public static native ClassInfo classInfoOfShort();
	
	/**
	 * Returns the class info pointer of {@code short}.
	 *
	 * @return The class info pointer.
	 * @since 2020/02/24
	 */
	public static native long classInfoOfShortPointer();
	
	/**
	 * Packs the given two integers to a double value.
	 *
	 * @param __hi The high value.
	 * @param __lo The low value.
	 * @return The double value.
	 * @since 2019/06/21
	 */
	public static native double doublePack(int __hi, int __lo);
	
	/**
	 * Double to raw long bits.
	 *
	 * @param __d The input double.
	 * @return The raw long bits.
	 * @since 2018/11/03
	 */
	public static native long doubleToRawLongBits(double __d);
	
	/**
	 * Unpacks the high value of a double.
	 *
	 * @param __d The double to unpack.
	 * @return The unpacked high value.
	 * @since 2020/02/24
	 */
	public static native int doubleUnpackHigh(double __d);
	
	/**
	 * Unpacks the low value of a double.
	 *
	 * @param __d The double to unpack.
	 * @return The unpacked low value.
	 * @since 2020/02/24
	 */
	public static native int doubleUnpackLow(double __d);
	
	/**
	 * Performs explicit exception handling.
	 *
	 * @since 2019/04/28
	 */
	public static native void exceptionHandle();
	
	/**
	 * Float to raw int bits.
	 *
	 * @param __f The input float.
	 * @return The raw int bits.
	 * @since 2018/11/04
	 */
	public static native int floatToRawIntBits(float __f);
	
	/**
	 * Integer bits to float.
	 *
	 * @param __b The input bits.
	 * @return The resulting float.
	 * @since 2018/11/04
	 */
	public static native float intBitsToFloat(int __b);
	
	/**
	 * Invoke method at pointer.
	 *
	 * @param __addr The address to invoke.
	 * @param __pool The pool address to load.
	 * @since 2019/04/28
	 */
	public static native void invoke(long __addr, long __pool);
	
	/**
	 * Invoke method at pointer, with arguments.
	 *
	 * @param __addr The address to invoke.
	 * @param __pool The pool address to load.
	 * @param __a Argument.
	 * @since 2019/04/28
	 */
	public static native void invoke(long __addr, long __pool, int __a);
	
	/**
	 * Invoke method at pointer, with arguments.
	 *
	 * @param __addr The address to invoke.
	 * @param __pool The pool address to load.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @since 2019/04/28
	 */
	public static native void invoke(long __addr, long __pool, int __a,
		int __b);
	
	/**
	 * Invoke method at pointer, with arguments.
	 *
	 * @param __addr The address to invoke.
	 * @param __pool The pool address to load.









	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @since 2019/04/28
	 */
	public static native void invoke(long __addr, long __pool, int __a,
		int __b, int __c);
	
	/**
	 * Invoke method at pointer, with arguments.
	 *
	 * @param __addr The address to invoke.
	 * @param __pool The pool address to load.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @since 2019/04/28
	 */
	public static native void invoke(long __addr, long __pool, int __a,
		int __b, int __c, int __d);
	
	/**
	 * Invoke method at pointer, with arguments.
	 *
	 * @param __addr The address to invoke.
	 * @param __pool The pool address to load.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @param __e Argument.
	 * @since 2019/04/28
	 */
	public static native void invoke(long __addr, long __pool, int __a,
		int __b, int __c, int __d, int __e);
	
	/**
	 * Invoke method at pointer, with arguments.
	 *
	 * @param __addr The address to invoke.
	 * @param __pool The pool address to load.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @param __e Argument.
	 * @param __f Argument.
	 * @since 2019/04/28
	 */
	public static native void invoke(long __addr, long __pool, int __a,
		int __b, int __c, int __d, int __e, int __f);
	
	/**
	 * Invoke method at pointer, with arguments.
	 *
	 * @param __addr The address to invoke.
	 * @param __pool The pool address to load.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @param __e Argument.
	 * @param __f Argument.
	 * @param __g Argument.
	 * @since 2019/04/28
	 */
	public static native void invoke(long __addr, long __pool, int __a,
		int __b, int __c, int __d, int __e, int __f, int __g);
	
	/**
	 * Invoke method at pointer, with arguments.
	 *
	 * @param __addr The address to invoke.
	 * @param __pool The pool address to load.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @param __e Argument.
	 * @param __f Argument.
	 * @param __g Argument.
	 * @param __h Argument.
	 * @since 2019/04/28
	 */
	public static native void invoke(long __addr, long __pool, int __a,
		int __b, int __c, int __d, int __e, int __f, int __g, int __h);
	
	/**
	 * Invoke method at pointer.
	 *
	 * @param __addr The address to invoke.
	 * @param __pool The pool address to load.
	 * @return The result of the invocation.
	 * @since 2019/04/28
	 */
	public static native int invokeV(long __addr, long __pool);
	
	/**
	 * Invoke method at pointer, with arguments.
	 *
	 * @param __addr The address to invoke.
	 * @param __pool The pool address to load.
	 * @param __a Argument.
	 * @return The result of the invocation.
	 * @since 2019/04/28
	 */
	public static native int invokeV(long __addr, long __pool, int __a);
	
	/**
	 * Invoke method at pointer, with arguments.
	 *
	 * @param __addr The address to invoke.
	 * @param __pool The pool address to load.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @return The result of the invocation.
	 * @since 2019/04/28
	 */
	public static native int invokeV(long __addr, long __pool, int __a,
		int __b);
	
	/**
	 * Invoke method at pointer, with arguments.
	 *
	 * @param __addr The address to invoke.
	 * @param __pool The pool address to load.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @return The result of the invocation.
	 * @since 2019/04/28
	 */
	public static native int invokeV(long __addr, long __pool, int __a,
		int __b, int __c);
	
	/**
	 * Invoke method at pointer, with arguments.
	 *
	 * @param __addr The address to invoke.
	 * @param __pool The pool address to load.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @return The result of the invocation.
	 * @since 2019/04/28
	 */
	public static native int invokeV(long __addr, long __pool, int __a,
		int __b, int __c, int __d);
	
	/**
	 * Invoke method at pointer, with arguments.
	 *
	 * @param __addr The address to invoke.
	 * @param __pool The pool address to load.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @param __e Argument.
	 * @return The result of the invocation.
	 * @since 2019/04/28
	 */
	public static native int invokeV(long __addr, long __pool, int __a,
		int __b, int __c, int __d, int __e);
	
	/**
	 * Invoke method at pointer, with arguments.
	 *
	 * @param __addr The address to invoke.
	 * @param __pool The pool address to load.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @param __e Argument.
	 * @param __f Argument.
	 * @return The result of the invocation.
	 * @since 2019/04/28
	 */
	public static native int invokeV(long __addr, long __pool, int __a,
		int __b, int __c, int __d, int __e, int __f);
	
	/**
	 * Invoke method at pointer, with arguments.
	 *
	 * @param __addr The address to invoke.
	 * @param __pool The pool address to load.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @param __e Argument.
	 * @param __f Argument.
	 * @param __g Argument.
	 * @return The result of the invocation.
	 * @since 2019/04/28
	 */
	public static native int invokeV(long __addr, long __pool, int __a,
		int __b, int __c, int __d, int __e, int __f, int __g);
	
	/**
	 * Invoke method at pointer, with arguments.
	 *
	 * @param __addr The address to invoke.
	 * @param __pool The pool address to load.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @param __e Argument.
	 * @param __f Argument.
	 * @param __g Argument.
	 * @param __h Argument.
	 * @return The result of the invocation.
	 * @since 2019/04/28
	 */
	public static native int invokeV(long __addr, long __pool, int __a,
		int __b, int __c, int __d, int __e, int __f, int __g, int __h);
	
	/**
	 * Invoke method at pointer.
	 *
	 * @param __addr The address to invoke.
	 * @param __pool The pool address to load.
	 * @return The result of the invocation.
	 * @since 2019/12/08
	 */
	public static native long invokeVL(long __addr, long __pool);
	
	/**
	 * Invoke method at pointer, with arguments.
	 *
	 * @param __addr The address to invoke.
	 * @param __pool The pool address to load.
	 * @param __a Argument.
	 * @return The result of the invocation.
	 * @since 2019/12/08
	 */
	public static native long invokeVL(long __addr, long __pool, int __a);
	
	/**
	 * Invoke method at pointer, with arguments.
	 *
	 * @param __addr The address to invoke.
	 * @param __pool The pool address to load.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @return The result of the invocation.
	 * @since 2019/12/08
	 */
	public static native long invokeVL(long __addr, long __pool, int __a,
		int __b);
	
	/**
	 * Invoke method at pointer, with arguments.
	 *
	 * @param __addr The address to invoke.
	 * @param __pool The pool address to load.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @return The result of the invocation.
	 * @since 2019/12/08
	 */
	public static native long invokeVL(long __addr, long __pool, int __a,
		int __b, int __c);
	
	/**
	 * Invoke method at pointer, with arguments.
	 *
	 * @param __addr The address to invoke.
	 * @param __pool The pool address to load.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @return The result of the invocation.
	 * @since 2019/12/08
	 */
	public static native long invokeVL(long __addr, long __pool, int __a, 
		int __b, int __c, int __d);
	
	/**
	 * Invoke method at pointer, with arguments.
	 *
	 * @param __addr The address to invoke.
	 * @param __pool The pool address to load.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @param __e Argument.
	 * @return The result of the invocation.
	 * @since 2019/12/08
	 */
	public static native long invokeVL(long __addr, long __pool, int __a, 
		int __b, int __c, int __d, int __e);
	
	/**
	 * Invoke method at pointer, with arguments.
	 *
	 * @param __addr The address to invoke.
	 * @param __pool The pool address to load.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @param __e Argument.
	 * @param __f Argument.
	 * @return The result of the invocation.
	 * @since 2019/12/08
	 */
	public static native long invokeVL(long __addr, long __pool, int __a, 
		int __b, int __c, int __d, int __e, int __f);
	
	/**
	 * Invoke method at pointer, with arguments.
	 *
	 * @param __addr The address to invoke.
	 * @param __pool The pool address to load.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @param __e Argument.
	 * @param __f Argument.
	 * @param __g Argument.
	 * @return The result of the invocation.
	 * @since 2019/12/08
	 */
	public static native long invokeVL(long __addr, long __pool, int __a, 
		int __b, int __c, int __d, int __e, int __f, int __g);
	
	/**
	 * Invoke method at pointer, with arguments.
	 *
	 * @param __addr The address to invoke.
	 * @param __pool The pool pointer to load.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @param __e Argument.
	 * @param __f Argument.
	 * @param __g Argument.
	 * @param __h Argument.
	 * @return The result of the invocation.
	 * @since 2019/12/08
	 */
	public static native long invokeVL(long __addr, long __pool, int __a, 
		int __b, int __c, int __d, int __e, int __f, int __g, int __h);
	








	/**
	 * Long bits to double.
	 *
	 * @param __b The input bits.
	 * @return The resulting double.
	 * @since 2018/11/03
	 */
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621










622
623
624
625
626
627
628
629
630
631










632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671










672
673
674
675
676
677
678
679
680
681










682
683
684
685
686
687
688
689
690
691
































































































































































































































































































































692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731










































732
733
734
735
736
737




















































738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
	 * Reads byte from address.
	 *
	 * @param __p The pointer.
	 * @param __o The offset.
	 * @return The result of the read.
	 * @since 2019/04/22
	 */
	public static native int memReadByte(int __p, int __o);
	
	/**
	 * Reads integer from address.
	 *
	 * @param __p The pointer.
	 * @param __o The offset.
	 * @return The result of the read.
	 * @since 2019/04/21
	 */
	public static native int memReadInt(int __p, int __o);
	
	/**
	 * Reads big endian Java integer from address.
	 *
	 * @param __p The pointer.
	 * @param __o The offset.
	 * @return The result of the read.
	 * @since 2019/05/29
	 */
	public static native int memReadJavaInt(int __p, int __o);










	
	/**
	 * Reads big endian Java short from address.
	 *
	 * @param __p The pointer.
	 * @param __o The offset.
	 * @return The result of the read.
	 * @since 2019/05/29
	 */
	public static native int memReadJavaShort(int __p, int __o);










	
	/**
	 * Reads short from address.
	 *
	 * @param __p The pointer.
	 * @param __o The offset.
	 * @return The result of the read.
	 * @since 2019/04/22
	 */
	public static native int memReadShort(int __p, int __o);
	
	/**
	 * Writes byte to address.
	 *
	 * @param __p The pointer.
	 * @param __o The offset.
	 * @param __v The value to write.
	 * @since 2019/04/21
	 */
	public static native void memWriteByte(int __p, int __o, int __v);
	
	/**
	 * Writes integer to address.
	 *
	 * @param __p The pointer.
	 * @param __o The offset.
	 * @param __v The value to write.
	 * @since 2019/04/21
	 */
	public static native void memWriteInt(int __p, int __o, int __v);
	
	/**
	 * Writes big endian Java integer to address.
	 *
	 * @param __p The pointer.
	 * @param __o The offset.
	 * @param __v The value to write.
	 * @since 2019/05/29
	 */
	public static native void memWriteJavaInt(int __p, int __o, int __v);










	
	/**
	 * Writes big endian Java short to address.
	 *
	 * @param __p The pointer.
	 * @param __o The offset.
	 * @param __v The value to write.
	 * @since 2019/05/29
	 */
	public static native void memWriteJavaShort(int __p, int __o, int __v);










	
	/**
	 * Writes short to address.
	 *
	 * @param __p The pointer.
	 * @param __o The offset.
	 * @param __v The value to write.
	 * @since 2019/04/21
	 */
	public static native void memWriteShort(int __p, int __o, int __v);
































































































































































































































































































































	
	/**
	 * Used to convert an object to a pointer.
	 *
	 * @param __o The object.
	 * @return The pointer of the object.
	 * @since 2019/04/21
	 */
	public static native int objectToPointer(Object __o);
	
	/**
	 * Used to convert an object to a pointer, do use reference queing for it
	 * so that if the object is a candidate for reference counting it will
	 * be uncounted.
	 *
	 * @param __o The object.
	 * @return The pointer of the object.
	 * @since 2019/04/21
	 */
	public static native int objectToPointerRefQueue(Object __o);
	
	/**
	 * Used to convert a pointer to an object.
	 *
	 * @param __p The pointer.
	 * @return The object of the pointer.
	 * @since 2019/04/21
	 */
	public static native Object pointerToObject(int __p);
	
	/**
	 * Used to convert a pointer to a class info type.
	 *
	 * @param __p The pointer.
	 * @return The object of the pointer.
	 * @since 2019/04/21
	 */
	public static native ClassInfo pointerToClassInfo(int __p);
	
	/**










































	 * Perform reference counting logic on object.
	 *
	 * @param __p The object to count up.
	 * @since 2019/05/25
	 */
	public static native void refCount(int __p);




















































	
	/**
	 * Perform reference uncounting logic on object.
	 *
	 * @param __p The object to count down.
	 * @since 2019/05/25
	 */
	public static native void refUncount(int __p);
	
	/**
	 * Return from the current frame.
	 *
	 * @since 2019/04/21
	 */
	public static native void returnFrame();







|









|









|
>
>
>
>
>
>
>
>
>
>









|
>
>
>
>
>
>
>
>
>
>









|









|









|









|
>
>
>
>
>
>
>
>
>
>









|
>
>
>
>
>
>
>
>
>
>









|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>








|










|








|








|


>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>





|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>





|

|







728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
	 * Reads byte from address.
	 *
	 * @param __p The pointer.
	 * @param __o The offset.
	 * @return The result of the read.
	 * @since 2019/04/22
	 */
	public static native int memReadByte(long __p, int __o);
	
	/**
	 * Reads integer from address.
	 *
	 * @param __p The pointer.
	 * @param __o The offset.
	 * @return The result of the read.
	 * @since 2019/04/21
	 */
	public static native int memReadInt(long __p, int __o);
	
	/**
	 * Reads big endian Java integer from address.
	 *
	 * @param __p The pointer.
	 * @param __o The offset.
	 * @return The result of the read.
	 * @since 2019/05/29
	 */
	public static native int memReadJavaInt(long __p, int __o);
	
	/**
	 * Reads big endian Java long from address.
	 *
	 * @param __p The pointer.
	 * @param __o The offset.
	 * @return The result of the read.
	 * @since 2020/02/24
	 */
	public static native long memReadJavaLong(long __p, int __o);
	
	/**
	 * Reads big endian Java short from address.
	 *
	 * @param __p The pointer.
	 * @param __o The offset.
	 * @return The result of the read.
	 * @since 2019/05/29
	 */
	public static native int memReadJavaShort(long __p, int __o);
	
	/**
	 * Reads pointer from address.
	 *
	 * @param __p The pointer.
	 * @param __o The offset.
	 * @return The result of the read.
	 * @since 2019/04/22
	 */
	public static native long memReadPointer(long __p, int __o);
	
	/**
	 * Reads short from address.
	 *
	 * @param __p The pointer.
	 * @param __o The offset.
	 * @return The result of the read.
	 * @since 2019/04/22
	 */
	public static native int memReadShort(long __p, int __o);
	
	/**
	 * Writes byte to address.
	 *
	 * @param __p The pointer.
	 * @param __o The offset.
	 * @param __v The value to write.
	 * @since 2019/04/21
	 */
	public static native void memWriteByte(long __p, int __o, int __v);
	
	/**
	 * Writes integer to address.
	 *
	 * @param __p The pointer.
	 * @param __o The offset.
	 * @param __v The value to write.
	 * @since 2019/04/21
	 */
	public static native void memWriteInt(long __p, int __o, int __v);
	
	/**
	 * Writes big endian Java integer to address.
	 *
	 * @param __p The pointer.
	 * @param __o The offset.
	 * @param __v The value to write.
	 * @since 2019/05/29
	 */
	public static native void memWriteJavaInt(long __p, int __o, int __v);
	
	/**
	 * Writes big endian Java long to address.
	 *
	 * @param __p The pointer.
	 * @param __o The offset.
	 * @param __v The value to write.
	 * @since 2020/02/24
	 */
	public static native void memWriteJavaLong(long __p, int __o, long __v);
	
	/**
	 * Writes big endian Java short to address.
	 *
	 * @param __p The pointer.
	 * @param __o The offset.
	 * @param __v The value to write.
	 * @since 2019/05/29
	 */
	public static native void memWriteJavaShort(long __p, int __o, int __v);
	
	/**
	 * Writes a pointer to address.
	 *
	 * @param __p The pointer.
	 * @param __o The offset.
	 * @param __v The value to write.
	 * @since 2020/02/24
	 */
	public static native void memWritePointer(long __p, int __o, long __v);
	
	/**
	 * Writes short to address.
	 *
	 * @param __p The pointer.
	 * @param __o The offset.
	 * @param __v The value to write.
	 * @since 2019/04/21
	 */
	public static native void memWriteShort(long __p, int __o, int __v);
	
	/**
	 * Atomically decrements an object's monitor count.
	 * 
	 * @param __p The object to count.
	 * @return The resulting value.
	 * @since 2020/02/24
	 */
	public static native int monitorCountDecrementAndGetAtomic(long __p);
	
	/**
	 * Atomically decrements an object's monitor count.
	 * 
	 * @param __p The object to count.
	 * @return The resulting value.
	 * @since 2020/02/24
	 */
	public static native int monitorCountDecrementAndGetAtomic(Object __p);
	
	/**
	 * Atomically increments an object's monitor count.
	 * 
	 * @param __p The object to count.
	 * @return The resulting value.
	 * @since 2020/02/24
	 */
	public static native int monitorCountIncrementAndGetAtomic(long __p);
	
	/**
	 * Atomically increments an object's monitor count.
	 * 
	 * @param __p The object to count.
	 * @return The resulting value.
	 * @since 2020/02/24
	 */
	public static native int monitorCountIncrementAndGetAtomic(Object __p);
	
	/**
	 * Atomically reads the object's monitor count.
	 * 
	 * @param __p The object to read.
	 * @return The current monitor count.
	 * @since 2020/02/24
	 */
	public static native int monitorCountGetAtomic(long __p);
	
	/**
	 * Atomically reads the object's monitor count.
	 * 
	 * @param __p The object to read.
	 * @return The current monitor count.
	 * @since 2020/02/24
	 */
	public static native int monitorCountGetAtomic(Object __p);
	
	/**
	 * Atomically writes the object's monitor count.
	 * 
	 * @param __p The object to write.
	 * @param __v The count to write.
	 * @since 2020/02/24
	 */
	public static native void monitorCountSetAtomic(long __p, int __v);
	
	/**
	 * Atomically writes the object's monitor count.
	 * 
	 * @param __p The object to write.
	 * @param __v The count to write.
	 * @since 2020/02/24
	 */
	public static native void monitorCountSetAtomic(Object __p, int __v);
	
	/**
	 * Atomically compares the owner of the object's monitor and sets it,
	 * returning the value before it was set (or was unchanged).
	 * 
	 * @param __p The object to potentially modify.
	 * @param __comp The owner to compare against.
	 * @param __set The owner to set to, if the comparison succeeds.
	 * @return The owner that originally was set.
	 * @since 2020/02/24
	 */
	public static native Thread monitorOwnerCompareGetAndSetAtomic(
		long __p, long __comp, long __set);
	
	/**
	 * Atomically compares the owner of the object's monitor and sets it,
	 * returning the value before it was set (or was unchanged).
	 * 
	 * @param __p The object to potentially modify.
	 * @param __comp The owner to compare against.
	 * @param __set The owner to set to, if the comparison succeeds.
	 * @return The owner that originally was set.
	 * @since 2020/02/24
	 */
	public static native Thread monitorOwnerCompareGetAndSetAtomic(
		Object __p, long __comp, long __set);
	
	/**
	 * Atomically compares the owner of the object's monitor and sets it,
	 * returning the value before it was set (or was unchanged).
	 * 
	 * @param __p The object to potentially modify.
	 * @param __comp The owner to compare against.
	 * @param __set The owner to set to, if the comparison succeeds.
	 * @return The owner that originally was set.
	 * @since 2020/02/24
	 */
	public static native Thread monitorOwnerCompareGetAndSetAtomic(
		long __p, Thread __comp, Thread __set);
	
	/**
	 * Atomically compares the owner of the object's monitor and sets it,
	 * returning the value before it was set (or was unchanged).
	 * 
	 * @param __p The object to potentially modify.
	 * @param __comp The owner to compare against.
	 * @param __set The owner to set to, if the comparison succeeds.
	 * @return The owner that originally was set.
	 * @since 2020/02/24
	 */
	public static native Thread monitorOwnerCompareGetAndSetAtomic(
		Object __p, Thread __comp, Thread __set);
	
	/**
	 * Atomically compares the owner of the object's monitor and sets it,
	 * returning the value before it was set (or was unchanged).
	 * 
	 * @param __p The object to potentially modify.
	 * @param __comp The owner to compare against.
	 * @param __set The owner to set to, if the comparison succeeds.
	 * @return The owner that originally was set.
	 * @since 2020/02/24
	 */
	public static native long monitorOwnerCompareGetAndSetAtomicPointer(
		long __p, long __comp, long __set);
	
	/**
	 * Atomically compares the owner of the object's monitor and sets it,
	 * returning the value before it was set (or was unchanged).
	 * 
	 * @param __p The object to potentially modify.
	 * @param __comp The owner to compare against.
	 * @param __set The owner to set to, if the comparison succeeds.
	 * @return The owner that originally was set.
	 * @since 2020/02/24
	 */
	public static native long monitorOwnerCompareGetAndSetAtomicPointer(
		Object __p, long __comp, long __set);
	
	/**
	 * Atomically compares the owner of the object's monitor and sets it,
	 * returning the value before it was set (or was unchanged).
	 * 
	 * @param __p The object to potentially modify.
	 * @param __comp The owner to compare against.
	 * @param __set The owner to set to, if the comparison succeeds.
	 * @return The owner that originally was set.
	 * @since 2020/02/24
	 */
	public static native long monitorOwnerCompareGetAndSetAtomicPointer(
		long __p, Thread __comp, Thread __set);
	
	/**
	 * Atomically compares the owner of the object's monitor and sets it,
	 * returning the value before it was set (or was unchanged).
	 * 
	 * @param __p The object to potentially modify.
	 * @param __comp The owner to compare against.
	 * @param __set The owner to set to, if the comparison succeeds.
	 * @return The owner that originally was set.
	 * @since 2020/02/24
	 */
	public static native long monitorOwnerCompareGetAndSetAtomicPointer(
		Object __p, Thread __comp, Thread __set);
	
	/**
	 * Returns the owner of an object's monitor.
	 * 
	 * @param __p The object to get the owner from.
	 * @return The owner of the object's monitor.
	 * @since 2020/02/24
	 */
	public static native Thread monitorOwnerGetAtomic(long __p);
	
	/**
	 * Returns the owner of an object's monitor.
	 * 
	 * @param __p The object to get the owner from.
	 * @return The owner of the object's monitor.
	 * @since 2020/02/24
	 */
	public static native Thread monitorOwnerGetAtomic(Object __p);
	
	/**
	 * Returns the owner of an object's monitor.
	 * 
	 * @param __p The object to get the owner from.
	 * @return The owner of the object's monitor.
	 * @since 2020/02/24
	 */
	public static native long monitorOwnerGetPointerAtomic(long __p);
	
	/**
	 * Returns the owner of an object's monitor.
	 * 
	 * @param __p The object to get the owner from.
	 * @return The owner of the object's monitor.
	 * @since 2020/02/24
	 */
	public static native long monitorOwnerGetPointerAtomic(Object __p);
	
	/**
	 * Sets the owner of an object's monitor.
	 * 
	 * @param __p The object which will be set the new owner.
	 * @param __t The owner to set.
	 * @since 2020/02/24
	 */
	public static native void monitorOwnerSetAtomic(long __p, long __t);
	
	/**
	 * Sets the owner of an object's monitor.
	 * 
	 * @param __p The object which will be set the new owner.
	 * @param __t The owner to set.
	 * @since 2020/02/24
	 */
	public static native void monitorOwnerSetAtomic(long __p, Thread __t);
	
	/**
	 * Sets the owner of an object's monitor.
	 * 
	 * @param __p The object which will be set the new owner.
	 * @param __t The owner to set.
	 * @since 2020/02/24
	 */
	public static native void monitorOwnerSetAtomic(Object __p, long __t);
	
	/**
	 * Sets the owner of an object's monitor.
	 * 
	 * @param __p The object which will be set the new owner.
	 * @param __t The owner to set.
	 * @since 2020/02/24
	 */
	public static native void monitorOwnerSetAtomic(Object __p, Thread __t);
	
	/**
	 * Gets the ClassInfo of an object.
	 *
	 * @param __o The object to read from.
	 * @return The resulting class info.
	 * @since 2020/02/23
	 */
	public static native ClassInfo objectGetClassInfo(long __o);
	
	/**
	 * Gets the ClassInfo of an object.
	 *
	 * @param __o The object to read from.
	 * @return The resulting class info.
	 * @since 2020/02/23
	 */
	public static native ClassInfo objectGetClassInfo(Object __o);
	
	/**
	 * Gets the ClassInfo of an object.
	 *
	 * @param __o The object to read from.
	 * @return The resulting class info.
	 * @since 2020/02/23
	 */
	public static native long objectGetClassInfoPointer(long __o);
	
	/**
	 * Gets the ClassInfo of an object.
	 *
	 * @param __o The object to read from.
	 * @return The resulting class info.
	 * @since 2020/02/23
	 */
	public static native long objectGetClassInfoPointer(Object __o);
	
	/**
	 * Sets the ClassInfo of an object.
	 *
	 * @param __o The object to set the class of.
	 * @param __v The class info to set.
	 * @since 2020/02/23
	 */
	public static native void objectSetClassInfo(long __o, long __v);
	
	/**
	 * Sets the ClassInfo of an object.
	 *
	 * @param __o The object to set the class of.
	 * @param __v The class info to set.
	 * @since 2020/02/23
	 */
	public static native void objectSetClassInfo(Object __o, long __v);
	
	/**
	 * Sets the ClassInfo of an object.
	 *
	 * @param __o The object to set the class of.
	 * @param __v The class info to set.
	 * @since 2020/02/23
	 */
	public static native void objectSetClassInfo(long __o, ClassInfo __v);
	
	/**
	 * Sets the ClassInfo of an object.
	 *
	 * @param __o The object to set the class of.
	 * @param __v The class info to set.
	 * @since 2020/02/23
	 */
	public static native void objectSetClassInfo(Object __o, ClassInfo __v);
	
	/**
	 * Used to convert an object to a pointer.
	 *
	 * @param __o The object.
	 * @return The pointer of the object.
	 * @since 2019/04/21
	 */
	public static native long objectToPointer(Object __o);
	
	/**
	 * Used to convert an object to a pointer, do use reference queing for it
	 * so that if the object is a candidate for reference counting it will
	 * be uncounted.
	 *
	 * @param __o The object.
	 * @return The pointer of the object.
	 * @since 2019/04/21
	 */
	public static native long objectToPointerRefQueue(Object __o);
	
	/**
	 * Used to convert a pointer to an object.
	 *
	 * @param __p The pointer.
	 * @return The object of the pointer.
	 * @since 2019/04/21
	 */
	public static native Object pointerToObject(long __p);
	
	/**
	 * Used to convert a pointer to a class info type.
	 *
	 * @param __p The pointer.
	 * @return The object of the pointer.
	 * @since 2019/04/21
	 */
	public static native ClassInfo pointerToClassInfo(long __p);
	
	/**
	 * Loads a value from the constant pool at the given index.
	 *
	 * @param __p The memory address of the pool to access.
	 * @param __i The index to load.
	 * @return The read value, this may be truncated to 32-bits on 32-bit
	 * systems.
	 * @since 2020/02/24
	 */
	public static native long poolLoad(long __p, int __i);
	
	/**
	 * Loads a value from the constant pool at the given index.
	 *
	 * @param __p The object representation of the pool to access.
	 * @param __i The index to load.
	 * @return The read value, this may be truncated to 32-bits on 32-bit
	 * systems
	 * @since 2020/02/24
	 */
	public static native long poolLoad(Object __p, int __i);
	
	/**
	 * Writes a value to the constant pool of a class.
	 * 
	 * @param __p The address of the constant pool.
	 * @param __i The index to write.
	 * @param __v The value to write, note that on 32-bit .
	 * @since 2019/02/24
	 */
	public static native void poolStore(long __p, int __i, long __v);
	
	/**
	 * Writes a value to the constant pool of a class.
	 * 
	 * @param __p The object representation of the pool to access.
	 * @param __i The index to write.
	 * @param __v The value to write, note that on 32-bit .
	 * @since 2019/02/24
	 */
	public static native void poolStore(Object __p, int __i, long __v);
	
	/**
	 * Perform reference counting logic on object.
	 *
	 * @param __p The object to count up.
	 * @since 2019/05/25
	 */
	public static native void refCount(long __p);
	
	/**
	 * Perform reference counting logic on object.
	 *
	 * @param __p The object to count up.
	 * @since 2020/02/24
	 */
	public static native void refCount(Object __p);
	
	/**
	 * Get reference count of object.
	 * 
	 * @param __p The object to get the count for.
	 * @return The reference count of the object.
	 * @since 2020/02/24
	 */
	public static native int refGetCount(long __p);
	
	/**
	 * Get reference count of object.
	 * 
	 * @param __p The object to get the count for.
	 * @return The reference count of the object.
	 * @since 2020/02/24
	 */
	public static native int refGetCount(Object __p);
	
	/**
	 * Set reference count of object.
	 * 
	 * @param __p The object to set the count for.
	 * @param __v The value to set.
	 * @since 2020/02/24
	 */
	public static native void refSetCount(long __p, int __v);
	
	/**
	 * Set reference count of object.
	 * 
	 * @param __p The object to set the count for.
	 * @param __v The value to set.
	 * @since 2020/02/24
	 */
	public static native void refSetCount(Object __p, int __v);
	
	/**
	 * Perform reference uncounting logic on object.
	 *
	 * @param __p The object to count down.
	 * @since 2019/05/25
	 */
	public static native void refUncount(long __p);
	
	/**
	 * Perform reference uncounting logic on object.
	 *
	 * @param __p The object to count down.
	 * @since 2020/02/24
	 */
	public static native void refUncount(Object __p);
	
	/**
	 * Return from the current frame.
	 *
	 * @since 2019/04/21
	 */
	public static native void returnFrame();
764
765
766
767
768
769
770
771
































772
773
774
















775
776








777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826








827
828
829
830
831
832
833








834
835
836
837
838
839
840
841
842








843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858








859
860
861
862
863
864
865
866
867
868
869
870
	 *
	 * @param __h The high value.
	 * @param __l The low value.
	 * @since 2019/04/28
	 */
	public static native void returnFrame(int __h, int __l);
	
	/**
































	 * Returns the exception register.
	 *
	 * @return The exception register.
















	 * @since 2019/04/28
	 */








	public static native int specialGetExceptionRegister();
	
	/**
	 * Returns the value of the current pool register.
	 *
	 * @return The value of the pool register.
	 * @since 2019/05/01
	 */
	public static native int specialGetPoolRegister();
	
	/**
	 * Returns the value of the return register, for long return values this
	 * is the first high register.
	 *
	 * @return The value of the return register.
	 * @since 2019/04/28
	 */
	public static native int specialGetReturnRegister();
	
	/**
	 * Returns the value of the return register, the first high value.
	 *
	 * @return The value of the return register, the first high value.
	 * @since 2019/04/28
	 */
	public static native int specialGetReturnHighRegister();
	
	/**
	 * Returns the value of the return register, the second low value.
	 *
	 * @return The value of the return register, the second low value.
	 * @since 2019/04/28
	 */
	public static native int specialGetReturnLowRegister();
	
	/**
	 * Reads the value of the static field register.
	 *
	 * @return The value of the static field register.
	 * @since 2019/04/22
	 */
	public static native int specialGetStaticFieldRegister();
	
	/**
	 * Returns the register representing the current thread.
	 *
	 * @return The current thread register.
	 * @since 2019/04/22
	 */
	public static native int specialGetThreadRegister();








	
	/**
	 * Sets the value of the exception register.
	 *
	 * @param __v The value to use.
	 * @since 2019/04/28
	 */








	public static native void specialSetExceptionRegister(int __v);
	
	/**
	 * Sets the value of the constant pool register.
	 *
	 * @param __v The new value of the constant pool register.
	 * @since 2019/05/01
	 */
	public static native void specialSetPoolRegister(int __v);








	
	/**
	 * Sets the value of the static field register.
	 *
	 * @param __v The new value of the static field register.
	 * @since 2019/04/22
	 */
	public static native void specialSetStaticFieldRegister(int __v);
	
	/**
	 * Sets the current thread pointer.
	 *
	 * @param __v The value to use.
	 * @since 2019/04/27
	 */
	public static native void specialSetThreadRegister(int __v);








	
	/**
	 * Invoke system call at the given index.
	 *
	 * @param __addr The address to invoke.
	 * @since 2019/05/23
	 */
	public static native void sysCall(short __si);
	
	/**
	 * Invoke system call at the given index, with arguments.
	 *








>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>



>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>


>
>
>
>
>
>
>
>
|







|











<
<
<
<
<
<
|
|
<

|
|

|







|







|
>
>
>
>
>
>
>
>







>
>
>
>
>
>
>
>
|







|
>
>
>
>
>
>
>
>







|







|
>
>
>
>
>
>
>
>




|







1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440






1441
1442

1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
	 *
	 * @param __h The high value.
	 * @param __l The low value.
	 * @since 2019/04/28
	 */
	public static native void returnFrame(int __h, int __l);
	
	/**
	 * Returns from the current frame, returning a long value.
	 *
	 * @param __v The value.
	 * @since 2020/02/24
	 */
	public static native void returnFrameLong(long __v);
	
	/**
	 * Returns the size of base arrays.
	 * 
	 * @return The base array size.
	 * @since 2020/02/24
	 */
	public static native int sizeOfBaseArray();
	
	/**
	 * Returns the size of base objects.
	 * 
	 * @return The base object size.
	 * @since 2020/02/24
	 */
	public static native int sizeOfBaseObject();
	
	/**
	 * Returns the size of pointers and object references.
	 * 
	 * @return The pointer size.
	 * @since 2020/02/24
	 */
	public static native int sizeOfPointer();
	
	/**
	 * Returns the exception register.
	 *
	 * @return The exception register.
	 * @since 2020/02/24
	 */
	public static native Object specialGetExceptionRegister();
	
	/**
	 * Returns the exception register.
	 *
	 * @return The exception register.
	 * @since 2020/02/24
	 */
	public static native Throwable specialGetExceptionRegisterThrowable();
	
	/**
	 * Returns the exception register.
	 *
	 * @return The exception register.
	 * @since 2019/04/28
	 */
	public static native long specialGetExceptionRegisterPointer();
	
	/**
	 * Returns the value of the current pool register.
	 *
	 * @return The value of the pool register.
	 * @since 2020/02/24
	 */
	public static native Object specialGetPoolRegister();
	
	/**
	 * Returns the value of the current pool register.
	 *
	 * @return The value of the pool register.
	 * @since 2019/05/01
	 */
	public static native long specialGetPoolRegisterPointer();
	
	/**
	 * Returns the value of the return register, for long return values this
	 * is the first high register.
	 *
	 * @return The value of the return register.
	 * @since 2019/04/28
	 */
	public static native int specialGetReturnRegister();
	
	/**






	 * Reads the long value from the return register, treating it as a long
	 * value.

	 *
	 * @return The value of the return register.
	 * @since 2020/02/24
	 */
	public static native long specialGetReturnRegisterLong();
	
	/**
	 * Reads the value of the static field register.
	 *
	 * @return The value of the static field register.
	 * @since 2019/04/22
	 */
	public static native long specialGetStaticFieldRegister();
	
	/**
	 * Returns the register representing the current thread.
	 *
	 * @return The current thread register.
	 * @since 2019/04/22
	 */
	public static native Thread specialGetThreadRegister();
	
	/**
	 * Returns the register representing the current thread.
	 *
	 * @return The current thread register.
	 * @since 2020/02/24
	 */
	public static native long specialGetThreadRegisterPointer();
	
	/**
	 * Sets the value of the exception register.
	 *
	 * @param __v The value to use.
	 * @since 2019/04/28
	 */
	public static native void specialSetExceptionRegister(long __v);
	
	/**
	 * Sets the value of the exception register.
	 *
	 * @param __v The value to use.
	 * @since 2020/02/24
	 */
	public static native void specialSetExceptionRegister(Object __v);
	
	/**
	 * Sets the value of the constant pool register.
	 *
	 * @param __v The new value of the constant pool register.
	 * @since 2019/05/01
	 */
	public static native void specialSetPoolRegister(long __v);
	
	/**
	 * Sets the value of the constant pool register.
	 *
	 * @param __v The new value of the constant pool register.
	 * @since 2020/02/24
	 */
	public static native void specialSetPoolRegister(Object __v);
	
	/**
	 * Sets the value of the static field register.
	 *
	 * @param __v The new value of the static field register.
	 * @since 2019/04/22
	 */
	public static native void specialSetStaticFieldRegister(long __v);
	
	/**
	 * Sets the current thread pointer.
	 *
	 * @param __v The value to use.
	 * @since 2019/04/27
	 */
	public static native void specialSetThreadRegister(long __v);
	
	/**
	 * Sets the current thread pointer.
	 *
	 * @param __v The value to use.
	 * @since 2020/02/24
	 */
	public static native void specialSetThreadRegister(Thread __v);
	
	/**
	 * Invoke system call at the given index.
	 *
	 * @param __si The address to invoke.
	 * @since 2019/05/23
	 */
	public static native void sysCall(short __si);
	
	/**
	 * Invoke system call at the given index, with arguments.
	 *
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
	 */
	public static native void sysCall(short __si, int __a, int __b, int __c,
		int __d, int __e, int __f, int __g, int __h);
	
	/**
	 * Invoke pure system call at the given index.
	 *
	 * @param __addr The address to invoke.
	 * @since 2019/05/27
	 */
	public static native void sysCallP(short __si);
	
	/**
	 * Invoke pure system call at the given index, with arguments.
	 *







|







1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
	 */
	public static native void sysCall(short __si, int __a, int __b, int __c,
		int __d, int __e, int __f, int __g, int __h);
	
	/**
	 * Invoke pure system call at the given index.
	 *
	 * @param __si The address to invoke.
	 * @since 2019/05/27
	 */
	public static native void sysCallP(short __si);
	
	/**
	 * Invoke pure system call at the given index, with arguments.
	 *

Name change from runt/apis/cldc-compact/cc/squirreljme/jvm/CallStackItem.java to modules/cldc-compact/src/main/java/cc/squirreljme/jvm/CallStackItem.java.

13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
 * This represents a single item within the call stack request.
 *
 * @since 2019/06/16
 */
public interface CallStackItem
{
	/** The class name. */
	public static final byte CLASS_NAME =
		0;
	
	/** The method name. */
	public static final byte METHOD_NAME =
		1;
	
	/** The method type. */
	public static final byte METHOD_TYPE =
		2;
	
	/** The current file. */
	public static final byte SOURCE_FILE =
		3;
	
	/** Source line. */
	public static final byte SOURCE_LINE =
		4;
	
	/** The PC address. */
	public static final byte PC_ADDRESS =
		5;
	
	/** Java operation. */
	public static final byte JAVA_OPERATION =
		6;
	
	/** Java PC address. */
	public static final byte JAVA_PC_ADDRESS =
		7;
	
	/** The current task ID. */
	public static final byte TASK_ID =
		8;
	
	/** The number of supported items. */
	public static final byte NUM_ITEMS =
		9;
}








|



|



|



|



|



|



|



|



|



|



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
 * This represents a single item within the call stack request.
 *
 * @since 2019/06/16
 */
public interface CallStackItem
{
	/** The class name. */
	byte CLASS_NAME =
		0;
	
	/** The method name. */
	byte METHOD_NAME =
		1;
	
	/** The method type. */
	byte METHOD_TYPE =
		2;
	
	/** The current file. */
	byte SOURCE_FILE =
		3;
	
	/** Source line. */
	byte SOURCE_LINE =
		4;
	
	/** The PC address. */
	byte PC_ADDRESS =
		5;
	
	/** Java operation. */
	byte JAVA_OPERATION =
		6;
	
	/** Java PC address. */
	byte JAVA_PC_ADDRESS =
		7;
	
	/** The current task ID. */
	byte TASK_ID =
		8;
	
	/** The number of supported items. */
	byte NUM_ITEMS =
		9;
}

Name change from runt/apis/cldc-compact/cc/squirreljme/jvm/ClassInfo.java to modules/cldc-compact/src/main/java/cc/squirreljme/jvm/ClassInfo.java.

116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
	public ClassInfo(int __sp, int __fl, int __minip, int __namep, int __sz,
		int __bz, int __no, int __dim, int __csz, ClassInfo __scl,
		ClassInfo[] __icl, ClassInfo __ccl, Class<?> __cop, int[] __vtv,
		int[] __vtp, int __pool, int __jardx, int __nm, int __cd, int __sfp,
		int __dn)
	{
		// Always implicitly set magic
		this.magic = MAGIC_NUMBER;
		
		// Set
		this.selfptr = __sp;
		this.flags = __fl;
		this.miniptr = __minip;
		this.namep = __namep;
		this.size = __sz;







|







116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
	public ClassInfo(int __sp, int __fl, int __minip, int __namep, int __sz,
		int __bz, int __no, int __dim, int __csz, ClassInfo __scl,
		ClassInfo[] __icl, ClassInfo __ccl, Class<?> __cop, int[] __vtv,
		int[] __vtp, int __pool, int __jardx, int __nm, int __cd, int __sfp,
		int __dn)
	{
		// Always implicitly set magic
		this.magic = ClassInfo.MAGIC_NUMBER;
		
		// Set
		this.selfptr = __sp;
		this.flags = __fl;
		this.miniptr = __minip;
		this.namep = __namep;
		this.size = __sz;

Name change from runt/apis/cldc-compact/cc/squirreljme/jvm/ClassLoadingAdjustments.java to modules/cldc-compact/src/main/java/cc/squirreljme/jvm/ClassLoadingAdjustments.java.

Name change from runt/apis/cldc-compact/cc/squirreljme/jvm/ConfigRomType.java to modules/cldc-compact/src/main/java/cc/squirreljme/jvm/ConfigRomType.java.

13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
 * This represents an option in the configuration ROM.
 *
 * @since 2019/06/14
 */
public interface ConfigRomType
{
	/** End of configuration. */
	public static final byte END =
		0;
	
	/** Java VM Version. */
	public static final byte JAVA_VM_VERSION =
		1;
	
	/** Java VM Name. */
	public static final byte JAVA_VM_NAME =
		2;
	
	/** Java VM Vendor. */
	public static final byte JAVA_VM_VENDOR =
		3;
	
	/** Java VM E-Mail. */
	public static final byte JAVA_VM_EMAIL =
		4;
	
	/** Java VM URL. */
	public static final byte JAVA_VM_URL =
		5;
	
	/** The guest depth. */
	public static final byte GUEST_DEPTH =
		6;
	
	/** Main class. */
	public static final byte MAIN_CLASS =
		7;
	
	/** Main program arguments. */
	public static final byte MAIN_ARGUMENTS =
		8;
	
	/** Is this a MIDlet? */
	public static final byte IS_MIDLET =
		9;
	
	/** Define system propertly. */
	public static final byte DEFINE_PROPERTY =
		10;
	
	/** Classpath to use. */
	public static final byte CLASS_PATH =
		11;
	
	/** System call static field pointer. */
	public static final byte SYSCALL_STATIC_FIELD_POINTER =
		12;
	
	/** System call method pointer. */
	public static final byte SYSCALL_CODE_POINTER =
		13;
	
	/** System call pool pointer. */
	public static final byte SYSCALL_POOL_POINTER =
		14;
	
	/** Number of available options. */
	public static final byte NUM_OPTIONS =
		15;
}








|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
 * This represents an option in the configuration ROM.
 *
 * @since 2019/06/14
 */
public interface ConfigRomType
{
	/** End of configuration. */
	byte END =
		0;
	
	/** Java VM Version. */
	byte JAVA_VM_VERSION =
		1;
	
	/** Java VM Name. */
	byte JAVA_VM_NAME =
		2;
	
	/** Java VM Vendor. */
	byte JAVA_VM_VENDOR =
		3;
	
	/** Java VM E-Mail. */
	byte JAVA_VM_EMAIL =
		4;
	
	/** Java VM URL. */
	byte JAVA_VM_URL =
		5;
	
	/** The guest depth. */
	byte GUEST_DEPTH =
		6;
	
	/** Main class. */
	byte MAIN_CLASS =
		7;
	
	/** Main program arguments. */
	byte MAIN_ARGUMENTS =
		8;
	
	/** Is this a MIDlet? */
	byte IS_MIDLET =
		9;
	
	/** Define system propertly. */
	byte DEFINE_PROPERTY =
		10;
	
	/** Classpath to use. */
	byte CLASS_PATH =
		11;
	
	/** System call static field pointer. */
	byte SYSCALL_STATIC_FIELD_POINTER =
		12;
	
	/** System call method pointer. */
	byte SYSCALL_CODE_POINTER =
		13;
	
	/** System call pool pointer. */
	byte SYSCALL_POOL_POINTER =
		14;
	
	/** Number of available options. */
	byte NUM_OPTIONS =
		15;
}

Name change from runt/apis/cldc-compact/cc/squirreljme/jvm/Constants.java to modules/cldc-compact/src/main/java/cc/squirreljme/jvm/Constants.java.

13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
 * Virtual machine constants.
 *
 * @since 2019/05/26
 */
public interface Constants
{
	/** The offset for the object's class type. */
	public static final byte OBJECT_CLASS_OFFSET =
		0;
	
	/** The offset for the object's reference count. */
	public static final byte OBJECT_COUNT_OFFSET =
		4;
	
	/** Object monitor owner offset. */
	public static final byte OBJECT_MONITOR_OFFSET =
		8;
	
	/** Object monitor count offset. */
	public static final byte OBJECT_MONITOR_COUNT_OFFSET =
		12;
	
	/** Base size for object types. */
	public static final byte OBJECT_BASE_SIZE =
		16;
	
	/** The offset for array length. */
	public static final byte ARRAY_LENGTH_OFFSET =
		16;
	
	/** The base size for arrays. */
	public static final byte ARRAY_BASE_SIZE =
		20;
	
	/** Constant pool cell size. */
	public static final byte POOL_CELL_SIZE =
		4;
	
	/** Bad magic number. */
	public static final int BAD_MAGIC =
		0xE7E5E7E4;
	
	/** Class info flag: Is array type? */
	public static final short CIF_IS_ARRAY =
		0x0001;
	
	/** Class info flag: Is array of objects? */
	public static final short CIF_IS_ARRAY_OF_OBJECTS =
		0x0002;
	
	/** Is this a primitive type? */
	public static final short CIF_IS_PRIMITIVE =
		0x0004;
	
	/** Offset for the configuration key. */
	public static final byte CONFIG_KEY_OFFSET =
		0;
	
	/** Offset for the configuration size. */
	public static final byte CONFIG_SIZE_OFFSET =
		2;
	
	/** Size of the header for configuration items. */
	public static final byte CONFIG_HEADER_SIZE =
		4;
	
	/** The thread ID for out-of-bound IPC events. */
	public static final int OOB_IPC_THREAD =
		0xFFFFFFFF;
}








|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
 * Virtual machine constants.
 *
 * @since 2019/05/26
 */
public interface Constants
{
	/** The offset for the object's class type. */
	byte OBJECT_CLASS_OFFSET =
		0;
	
	/** The offset for the object's reference count. */
	byte OBJECT_COUNT_OFFSET =
		4;
	
	/** Object monitor owner offset. */
	byte OBJECT_MONITOR_OFFSET =
		8;
	
	/** Object monitor count offset. */
	byte OBJECT_MONITOR_COUNT_OFFSET =
		12;
	
	/** Base size for object types. */
	byte OBJECT_BASE_SIZE =
		16;
	
	/** The offset for array length. */
	byte ARRAY_LENGTH_OFFSET =
		16;
	
	/** The base size for arrays. */
	byte ARRAY_BASE_SIZE =
		20;
	
	/** Constant pool cell size. */
	byte POOL_CELL_SIZE =
		4;
	
	/** Bad magic number. */
	int BAD_MAGIC =
		0xE7E5E7E4;
	
	/** Class info flag: Is array type? */
	short CIF_IS_ARRAY =
		0x0001;
	
	/** Class info flag: Is array of objects? */
	short CIF_IS_ARRAY_OF_OBJECTS =
		0x0002;
	
	/** Is this a primitive type? */
	short CIF_IS_PRIMITIVE =
		0x0004;
	
	/** Offset for the configuration key. */
	byte CONFIG_KEY_OFFSET =
		0;
	
	/** Offset for the configuration size. */
	byte CONFIG_SIZE_OFFSET =
		2;
	
	/** Size of the header for configuration items. */
	byte CONFIG_HEADER_SIZE =
		4;
	
	/** The thread ID for out-of-bound IPC events. */
	int OOB_IPC_THREAD =
		0xFFFFFFFF;
}

Name change from runt/apis/cldc-compact/cc/squirreljme/jvm/DefaultIPCRouter.java to modules/cldc-compact/src/main/java/cc/squirreljme/jvm/DefaultIPCRouter.java.

Name change from runt/apis/cldc-compact/cc/squirreljme/jvm/DeviceFeedbackType.java to modules/cldc-compact/src/main/java/cc/squirreljme/jvm/DeviceFeedbackType.java.

13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
 * This represents the type of feedback to perform for a device.
 *
 * @since 2019/10/05
 */
public interface DeviceFeedbackType
{
	/** Vibrate. */
	public static final byte VIBRATE =
		1;
	
	/** Blink/Pulse LED, be aware of conditions such as epilepsy. */
	public static final byte BLINK_LED =
		2;
	
	/** The number of feedback types. */
	public static final byte NUM_FEEDBACK_TYPES =
		3;
}








|



|



|



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
 * This represents the type of feedback to perform for a device.
 *
 * @since 2019/10/05
 */
public interface DeviceFeedbackType
{
	/** Vibrate. */
	byte VIBRATE =
		1;
	
	/** Blink/Pulse LED, be aware of conditions such as epilepsy. */
	byte BLINK_LED =
		2;
	
	/** The number of feedback types. */
	byte NUM_FEEDBACK_TYPES =
		3;
}

Name change from runt/apis/cldc-compact/cc/squirreljme/jvm/Framebuffer.java to modules/cldc-compact/src/main/java/cc/squirreljme/jvm/Framebuffer.java.

15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187

188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
 * @since 2019/06/20
 */
public interface Framebuffer
{
	/**
	 * Returns the address of the framebuffer.
	 *
	 * @return The framebuffer address.
	 */
	public static final byte CONTROL_ADDRESS =
		1;
	
	/**
	 * Returns the width of the framebuffer.
	 *
	 * @return The framebuffer width.
	 */
	public static final byte CONTROL_WIDTH =
		2;
	
	/**
	 * Returns the height of the framebuffer.
	 *
	 * @return The framebuffer height.
	 */
	public static final byte CONTROL_HEIGHT =
		3;
	
	/**
	 * Returns the scanline length.
	 *
	 * @return The framebuffer scanline length.
	 */
	public static final byte CONTROL_SCANLEN =
		4;
	
	/**
	 * Flush the display because it has been drawn.
	 */
	public static final byte CONTROL_FLUSH =
		5;
	
	/**
	 * Returns the pixel format of the screen.
	 *
	 * @return The pixel format of the screen.
	 */
	public static final byte CONTROL_FORMAT =
		6;
	
	/**
	 * Returns the scanline length in bytes.
	 *
	 * @return The scanline length in bytes.
	 */
	public static final byte CONTROL_SCANLEN_BYTES =
		7;
	
	/**
	 * Returns the number of bytes per pixel.
	 *
	 * @return The bytes per pixel.
	 */
	public static final byte CONTROL_BYTES_PER_PIXEL =
		8;
	
	/**
	 * Returns the number of available pixels.
	 *
	 * @return The number of pixels.
	 */
	public static final byte CONTROL_NUM_PIXELS =
		9;
	
	/**
	 * Bits per pixel.
	 *
	 * @return The bits per pixel.
	 */
	public static final byte CONTROL_BITS_PER_PIXEL =
		10;
	
	/**
	 * Get backlight level.
	 *
	 * @return The current backlight level.
	 */
	public static final byte CONTROL_BACKLIGHT_LEVEL_GET =
		11;
	
	/**
	 * Set backlight level.
	 *
	 * @param 1 The level to set.
	 */
	public static final byte CONTROL_BACKLIGHT_LEVEL_SET =
		12;
	
	/**
	 * Maximum backlight level.
	 *
	 * @return The maximum backlight level.
	 */
	public static final byte CONTROL_BACKLIGHT_LEVEL_MAX =
		13;
	
	/**
	 * Uploads an integer array of pixel data to the framebuffer.
	 *
	 * @param 1 The address of the array to upload.
	 * @since 2019/12/21
	 */
	public static final byte CONTROL_UPLOAD_ARRAY_INT =
		14;
	
	/**
	 * The array which backs the framebuffer, if there is one.
	 *
	 * @return The backing array object, if there is one.
	 * @since 2019/12/28
	 */
	public static final byte CONTROL_BACKING_ARRAY_OBJECT =
		15;
		
	/**
	 * Returns the capabilities of the display.
	 *
	 * @return The display capabilities.
	 * @since 2020/01/10
	 */
	public static final byte CONTROL_GET_CAPABILITIES =
		16;
	
	/**
	 * Query acceleration function.
	 *
	 * @param 1 The graphics function.
	 * @return A non-zero value if this is supported.
	 * @since 2020/01/10
	 */
	public static final byte CONTROL_ACCEL_FUNC_QUERY =
		17;
	
	/**
	 * Perform acceleration function.
	 *
	 * @param 1 The graphics function.
	 * @param ... Parameters to the function.
	 * @return A value that is according to the invoked function, if it is
	 * supported or possible.
	 * @since 2020/01/10
	 */
	public static final byte CONTROL_ACCEL_FUNC_INVOKE =
		18;
	
	/**
	 * Requests that the framebuffer be repainted.
	 *
	 * @param 1 The X coordinate.
	 * @param 2 The Y coordinate.
	 * @param 3 The width.
	 * @param 4 The height.
	 * @return Returns {@code 0} if the repaint was not queued and it must be
	 * handled by the code running the application, 
	 * @since 2020/01/15
	 */
	public static final byte CONTROL_REPAINT_REQUEST =
		19;
	
	/**
	 * Sets the title of the framebuffer if applicable.
	 *
	 * @param 1 Character array buffer pointer.

	 * @since 2020/01/15
	 */
	public static final byte CONTROL_SET_TITLE =
		20;
	
	/** The number of framebuffer controls. */
	public static final byte NUM_CONTROLS =
		21;
	
	/** Screen is RGB 32-bit. */
	public static final byte FORMAT_INTEGER_RGB888 =
		0;
	
	/** Screen is 8-bit indexed. */
	public static final byte FORMAT_BYTE_INDEXED =
		1;
	
	/** Screen is 16-bit RGB565. */
	public static final byte FORMAT_SHORT_RGB565 =
		2;
	
	/** Screen is packed 1 bit values. */
	public static final byte FORMAT_PACKED_ONE =
		3;
	
	/** Screen is packed 2 bit values. */
	public static final byte FORMAT_PACKED_TWO =
		4;
	
	/** Screen is packed 4 bit values. */
	public static final byte FORMAT_PACKED_FOUR =
		5;
	
	/** Has touch-screen. */
	public static final byte CAPABILITY_TOUCH =
		0x01;
	
	/** Has keyboard. */
	public static final byte CAPABILITY_KEYBOARD =
		0x02;
	
	/** The JVM pushes to the IPC handler when events happen. */
	public static final byte CAPABILITY_IPC_EVENTS =
		0x04;
	
	/** Has screen flipping? */
	public static final byte CAPABILITY_SCREEN_FLIP =
		0x08;
	
	/** Screen has color that is not just a single shade. */
	public static final byte CAPABILITY_COLOR =
		0x10;
	
	/** Set color. */
	public static final byte ACCEL_FUNC_SET_COLOR =
		0;
	
	/** Draw line. */
	public static final byte ACCEL_FUNC_DRAW_LINE =
		1;
	
	/** Get the X clip. */
	public static final byte ACCEL_FUNC_GET_CLIP_X =
		2;
	
	/** Get the Y clip. */
	public static final byte ACCEL_FUNC_GET_CLIP_Y =
		3;
	
	/** Get the width clip. */
	public static final byte ACCEL_FUNC_GET_CLIP_WIDTH =
		4;
	
	/** Get the height clip. */
	public static final byte ACCEL_FUNC_GET_CLIP_HEIGHT =
		5;
	
	/** Set the clip. */
	public static final byte ACCEL_FUNC_SET_CLIP =
		6;
	
	/** Draw rectangle. */
	public static final byte ACCEL_FUNC_DRAW_RECT =
		7;
	
	/** Get the alpha color. */
	public static final byte ACCEL_FUNC_GET_ALPHA_COLOR =
		8;
	
	/** Set the alpha color. */
	public static final byte ACCEL_FUNC_SET_ALPHA_COLOR =
		9;
	
	/** Fill rectangle. */
	public static final byte ACCEL_FUNC_FILL_RECT =
		10;
	
	/** Sets the fonts for the graphics. */
	public static final byte ACCEL_FUNC_SET_FONT =
		11;
	
	/** Gets the font to use for drawing. */
	public static final byte ACCEL_FUNC_GET_FONT =
		12;
	
	/** Draw sub-characters. */
	public static final byte ACCEL_FUNC_DRAW_SUB_CHARS =
		13;
	
	/** Draw text. */
	public static final byte ACCEL_FUNC_DRAW_TEXT =
		14;
	
	/** Get stroke style. */
	public static final byte ACCEL_FUNC_GET_STROKE_STYLE =
		15;
	
	/** Set stroke style. */
	public static final byte ACCEL_FUNC_SET_STROKE_STYLE =
		16;
	
	/** Copy area. */
	public static final byte ACCEL_FUNC_COPY_AREA =
		17;
	
	/** Draw arc. */
	public static final byte ACCEL_FUNC_DRAW_ARC =
		18;
	
	/** Draw ARGB16. */
	public static final byte ACCEL_FUNC_DRAW_ARGB16 =
		19;
	
	/** Draw character. */
	public static final byte ACCEL_FUNC_DRAW_CHAR =
		20;
	
	/** Draw characters. */
	public static final byte ACCEL_FUNC_DRAW_CHARS =
		21;
	
	/** Draw RGB. */
	public static final byte ACCEL_FUNC_DRAW_RGB =
		22;
	
	/** Draw RGB16. */
	public static final byte ACCEL_FUNC_DRAW_RGB16 =
		23;
	
	/** Draw round rectangle. */
	public static final byte ACCEL_FUNC_DRAW_ROUND_RECT =
		24;
	
	/** Fill arc. */
	public static final byte ACCEL_FUNC_FILL_ARC =
		25;
	
	/** Fill round rectangle. */
	public static final byte ACCEL_FUNC_FILL_ROUND_RECT =
		26;
	
	/** Fill triangle. */
	public static final byte ACCEL_FUNC_FILL_TRIANGLE =
		27;
	
	/** Get blending mode. */
	public static final byte ACCEL_FUNC_GET_BLENDING_MODE =
		28;
	
	/** Get display color. */
	public static final byte ACCEL_FUNC_GET_DISPLAY_COLOR =
		29;
	
	/** Set blending mode. */
	public static final byte ACCEL_FUNC_SET_BLENDING_MODE =
		30;
	
	/** Draw region. */
	public static final byte ACCEL_FUNC_DRAW_REGION =
		31;
	
	/** Number of acceleration functions. */
	public static final byte NUM_ACCEL_FUNC =
		32;
	
	/** The IPC ID for the graphics callbacks. */
	public static final int IPC_ID =
		0x47665821;
}








|

|





|

|





|

|





|

|





|





|

|





|

|





|

|





|

|





|

|





|

|





|

|





|

|





|


|





|


|





|


|





|
|


|





|
|
|
|


|





|
|
|
|
|
|


|





|
>


|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
 * @since 2019/06/20
 */
public interface Framebuffer
{
	/**
	 * Returns the address of the framebuffer.
	 *
	 * @squirreljme.syscallreturn The framebuffer address.
	 */
	byte CONTROL_ADDRESS =
		1;
	
	/**
	 * Returns the width of the framebuffer.
	 *
	 * @squirreljme.syscallreturn The framebuffer width.
	 */
	byte CONTROL_WIDTH =
		2;
	
	/**
	 * Returns the height of the framebuffer.
	 *
	 * @squirreljme.syscallreturn The framebuffer height.
	 */
	byte CONTROL_HEIGHT =
		3;
	
	/**
	 * Returns the scanline length.
	 *
	 * @squirreljme.syscallreturn The framebuffer scanline length.
	 */
	byte CONTROL_SCANLEN =
		4;
	
	/**
	 * Flush the display because it has been drawn.
	 */
	byte CONTROL_FLUSH =
		5;
	
	/**
	 * Returns the pixel format of the screen.
	 *
	 * @squirreljme.syscallreturn The pixel format of the screen.
	 */
	byte CONTROL_FORMAT =
		6;
	
	/**
	 * Returns the scanline length in bytes.
	 *
	 * @squirreljme.syscallreturn The scanline length in bytes.
	 */
	byte CONTROL_SCANLEN_BYTES =
		7;
	
	/**
	 * Returns the number of bytes per pixel.
	 *
	 * @squirreljme.syscallreturn The bytes per pixel.
	 */
	byte CONTROL_BYTES_PER_PIXEL =
		8;
	
	/**
	 * Returns the number of available pixels.
	 *
	 * @squirreljme.syscallreturn The number of pixels.
	 */
	byte CONTROL_NUM_PIXELS =
		9;
	
	/**
	 * Bits per pixel.
	 *
	 * @squirreljme.syscallreturn The bits per pixel.
	 */
	byte CONTROL_BITS_PER_PIXEL =
		10;
	
	/**
	 * Get backlight level.
	 *
	 * @squirreljme.syscallreturn The current backlight level.
	 */
	byte CONTROL_BACKLIGHT_LEVEL_GET =
		11;
	
	/**
	 * Set backlight level.
	 *
	 * @squirreljme.syscallparam 1 The level to set.
	 */
	byte CONTROL_BACKLIGHT_LEVEL_SET =
		12;
	
	/**
	 * Maximum backlight level.
	 *
	 * @squirreljme.syscallreturn The maximum backlight level.
	 */
	byte CONTROL_BACKLIGHT_LEVEL_MAX =
		13;
	
	/**
	 * Uploads an integer array of pixel data to the framebuffer.
	 *
	 * @squirreljme.syscallparam 1 The address of the array to upload.
	 * @since 2019/12/21
	 */
	byte CONTROL_UPLOAD_ARRAY_INT =
		14;
	
	/**
	 * The array which backs the framebuffer, if there is one.
	 *
	 * @squirreljme.syscallreturn The backing array object, if there is one.
	 * @since 2019/12/28
	 */
	byte CONTROL_BACKING_ARRAY_OBJECT =
		15;
		
	/**
	 * Returns the capabilities of the display.
	 *
	 * @squirreljme.syscallreturn The display capabilities.
	 * @since 2020/01/10
	 */
	byte CONTROL_GET_CAPABILITIES =
		16;
	
	/**
	 * Query acceleration function.
	 *
	 * @squirreljme.syscallparam 1 The graphics function.
	 * @squirreljme.syscallreturn A non-zero value if this is supported.
	 * @since 2020/01/10
	 */
	byte CONTROL_ACCEL_FUNC_QUERY =
		17;
	
	/**
	 * Perform acceleration function.
	 *
	 * @squirreljme.syscallparam 1 The graphics function.
	 * @squirreljme.syscallparam ... Parameters to the function.
	 * @squirreljme.syscallreturn A value that is according to the invoked
	 * function, if it is supported or possible.
	 * @since 2020/01/10
	 */
	byte CONTROL_ACCEL_FUNC_INVOKE =
		18;
	
	/**
	 * Requests that the framebuffer be repainted.
	 *
	 * @squirreljme.syscallparam 1 The X coordinate.
	 * @squirreljme.syscallparam 2 The Y coordinate.
	 * @squirreljme.syscallparam 3 The width.
	 * @squirreljme.syscallparam 4 The height.
	 * @squirreljme.syscallreturn Returns {@code 0} if the repaint was not
	 * queued and it must be handled by the code running the application,
	 * @since 2020/01/15
	 */
	byte CONTROL_REPAINT_REQUEST =
		19;
	
	/**
	 * Sets the title of the framebuffer if applicable.
	 *
	 * @squirreljme.syscallparam 1 Char buffer pointer (high).
	 * @squirreljme.syscallparam 2 Char buffer pointer (low).
	 * @since 2020/01/15
	 */
	byte CONTROL_SET_TITLE =
		20;
	
	/** The number of framebuffer controls. */
	byte NUM_CONTROLS =
		21;
	
	/** Screen is RGB 32-bit. */
	byte FORMAT_INTEGER_RGB888 =
		0;
	
	/** Screen is 8-bit indexed. */
	byte FORMAT_BYTE_INDEXED =
		1;
	
	/** Screen is 16-bit RGB565. */
	byte FORMAT_SHORT_RGB565 =
		2;
	
	/** Screen is packed 1 bit values. */
	byte FORMAT_PACKED_ONE =
		3;
	
	/** Screen is packed 2 bit values. */
	byte FORMAT_PACKED_TWO =
		4;
	
	/** Screen is packed 4 bit values. */
	byte FORMAT_PACKED_FOUR =
		5;
	
	/** Has touch-screen. */
	byte CAPABILITY_TOUCH =
		0x01;
	
	/** Has keyboard. */
	byte CAPABILITY_KEYBOARD =
		0x02;
	
	/** The JVM pushes to the IPC handler when events happen. */
	byte CAPABILITY_IPC_EVENTS =
		0x04;
	
	/** Has screen flipping? */
	byte CAPABILITY_SCREEN_FLIP =
		0x08;
	
	/** Screen has color that is not just a single shade. */
	byte CAPABILITY_COLOR =
		0x10;
	
	/** Set color. */
	byte ACCEL_FUNC_SET_COLOR =
		0;
	
	/** Draw line. */
	byte ACCEL_FUNC_DRAW_LINE =
		1;
	
	/** Get the X clip. */
	byte ACCEL_FUNC_GET_CLIP_X =
		2;
	
	/** Get the Y clip. */
	byte ACCEL_FUNC_GET_CLIP_Y =
		3;
	
	/** Get the width clip. */
	byte ACCEL_FUNC_GET_CLIP_WIDTH =
		4;
	
	/** Get the height clip. */
	byte ACCEL_FUNC_GET_CLIP_HEIGHT =
		5;
	
	/** Set the clip. */
	byte ACCEL_FUNC_SET_CLIP =
		6;
	
	/** Draw rectangle. */
	byte ACCEL_FUNC_DRAW_RECT =
		7;
	
	/** Get the alpha color. */
	byte ACCEL_FUNC_GET_ALPHA_COLOR =
		8;
	
	/** Set the alpha color. */
	byte ACCEL_FUNC_SET_ALPHA_COLOR =
		9;
	
	/** Fill rectangle. */
	byte ACCEL_FUNC_FILL_RECT =
		10;
	
	/** Sets the fonts for the graphics. */
	byte ACCEL_FUNC_SET_FONT =
		11;
	
	/** Gets the font to use for drawing. */
	byte ACCEL_FUNC_GET_FONT =
		12;
	
	/** Draw sub-characters. */
	byte ACCEL_FUNC_DRAW_SUB_CHARS =
		13;
	
	/** Draw text. */
	byte ACCEL_FUNC_DRAW_TEXT =
		14;
	
	/** Get stroke style. */
	byte ACCEL_FUNC_GET_STROKE_STYLE =
		15;
	
	/** Set stroke style. */
	byte ACCEL_FUNC_SET_STROKE_STYLE =
		16;
	
	/** Copy area. */
	byte ACCEL_FUNC_COPY_AREA =
		17;
	
	/** Draw arc. */
	byte ACCEL_FUNC_DRAW_ARC =
		18;
	
	/** Draw ARGB16. */
	byte ACCEL_FUNC_DRAW_ARGB16 =
		19;
	
	/** Draw character. */
	byte ACCEL_FUNC_DRAW_CHAR =
		20;
	
	/** Draw characters. */
	byte ACCEL_FUNC_DRAW_CHARS =
		21;
	
	/** Draw RGB. */
	byte ACCEL_FUNC_DRAW_RGB =
		22;
	
	/** Draw RGB16. */
	byte ACCEL_FUNC_DRAW_RGB16 =
		23;
	
	/** Draw round rectangle. */
	byte ACCEL_FUNC_DRAW_ROUND_RECT =
		24;
	
	/** Fill arc. */
	byte ACCEL_FUNC_FILL_ARC =
		25;
	
	/** Fill round rectangle. */
	byte ACCEL_FUNC_FILL_ROUND_RECT =
		26;
	
	/** Fill triangle. */
	byte ACCEL_FUNC_FILL_TRIANGLE =
		27;
	
	/** Get blending mode. */
	byte ACCEL_FUNC_GET_BLENDING_MODE =
		28;
	
	/** Get display color. */
	byte ACCEL_FUNC_GET_DISPLAY_COLOR =
		29;
	
	/** Set blending mode. */
	byte ACCEL_FUNC_SET_BLENDING_MODE =
		30;
	
	/** Draw region. */
	byte ACCEL_FUNC_DRAW_REGION =
		31;
	
	/** Number of acceleration functions. */
	byte NUM_ACCEL_FUNC =
		32;
	
	/** The IPC ID for the graphics callbacks. */
	int IPC_ID =
		0x47665821;
}

Name change from runt/apis/cldc-compact/cc/squirreljme/jvm/IPCCallback.java to modules/cldc-compact/src/main/java/cc/squirreljme/jvm/IPCCallback.java.

29
30
31
32
33
34
35
36
37
38
39
	 * @param __e Argument E.
	 * @param __f Argument F.
	 * @param __g Argument G.
	 * @param __h Argument H.
	 * @return The result of the IPC call.
	 * @since 2019/12/28
	 */
	public abstract long ipcCall(int __tid, int __ipcid, int __a, int __b,
		int __c, int __d, int __e, int __f, int __g, int __h);
}








|
|


29
30
31
32
33
34
35
36
37
38
39
	 * @param __e Argument E.
	 * @param __f Argument F.
	 * @param __g Argument G.
	 * @param __h Argument H.
	 * @return The result of the IPC call.
	 * @since 2019/12/28
	 */
	long ipcCall(int __tid, int __ipcid, int __a, int __b, int __c, int __d,
		int __e, int __f, int __g, int __h);
}

Name change from runt/apis/cldc-compact/cc/squirreljme/jvm/IPCException.java to modules/cldc-compact/src/main/java/cc/squirreljme/jvm/IPCException.java.

Name change from runt/apis/cldc-compact/cc/squirreljme/jvm/IPCManager.java to modules/cldc-compact/src/main/java/cc/squirreljme/jvm/IPCManager.java.

51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
	 */
	public static final long ipcCall(int __tid, int __ipcid, int __a, int __b,
		int __c, int __d, int __e, int __f, int __g, int __h)
	{
		IPCCallback handler = null;
		
		// Find the IPC Callback handler
		Map<Integer, IPCCallback> ipcmap = _IPC_MAP;
		synchronized (ipcmap)
		{
			handler = ipcmap.get(__ipcid);
		}
		
		// Drop the call if there is no handler
		if (handler == null)







|







51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
	 */
	public static final long ipcCall(int __tid, int __ipcid, int __a, int __b,
		int __c, int __d, int __e, int __f, int __g, int __h)
	{
		IPCCallback handler = null;
		
		// Find the IPC Callback handler
		Map<Integer, IPCCallback> ipcmap = IPCManager._IPC_MAP;
		synchronized (ipcmap)
		{
			handler = ipcmap.get(__ipcid);
		}
		
		// Drop the call if there is no handler
		if (handler == null)
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
		
		// {@squirreljme.error ZZ3u It is not valid to register the zero
		// IPC ID.}
		if (__ipcid == 0)
			throw new IllegalArgumentException("ZZ3u");
		
		// Lock and register
		Map<Integer, IPCCallback> ipcmap = _IPC_MAP;
		synchronized (ipcmap)
		{
			ipcmap.put(__ipcid, __cb);
		}
	}
}








|







146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
		
		// {@squirreljme.error ZZ3u It is not valid to register the zero
		// IPC ID.}
		if (__ipcid == 0)
			throw new IllegalArgumentException("ZZ3u");
		
		// Lock and register
		Map<Integer, IPCCallback> ipcmap = IPCManager._IPC_MAP;
		synchronized (ipcmap)
		{
			ipcmap.put(__ipcid, __cb);
		}
	}
}

Name change from runt/apis/cldc-compact/cc/squirreljme/jvm/JVMFunction.java to modules/cldc-compact/src/main/java/cc/squirreljme/jvm/JVMFunction.java.

143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
	 * if none has been created yet then it will be created as needed.
	 *
	 * @param <T> The class type.
	 * @param __cldx The class index pointer.
	 * @return The resulting class.
	 * @since 2019/05/26
	 */
	public static final <T> Class<T> jvmLoadClass(int __cldx)
	{
		Assembly.breakpoint();
		throw new todo.TODO();
	}
	
	/**
	 * Loads a string from memory and returns an `intern()` string value.







|







143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
	 * if none has been created yet then it will be created as needed.
	 *
	 * @param <T> The class type.
	 * @param __cldx The class index pointer.
	 * @return The resulting class.
	 * @since 2019/05/26
	 */
	public static final <T> Class<T> jvmLoadClass(ClassInfo __cldx)
	{
		Assembly.breakpoint();
		throw new todo.TODO();
	}
	
	/**
	 * Loads a string from memory and returns an `intern()` string value.

Name change from runt/apis/cldc-compact/cc/squirreljme/jvm/SoftDouble.java to modules/cldc-compact/src/main/java/cc/squirreljme/jvm/SoftDouble.java.

Name change from runt/apis/cldc-compact/cc/squirreljme/jvm/SoftFloat.java to modules/cldc-compact/src/main/java/cc/squirreljme/jvm/SoftFloat.java.

Name change from runt/apis/cldc-compact/cc/squirreljme/jvm/SoftInteger.java to modules/cldc-compact/src/main/java/cc/squirreljme/jvm/SoftInteger.java.

Name change from runt/apis/cldc-compact/cc/squirreljme/jvm/SoftLong.java to modules/cldc-compact/src/main/java/cc/squirreljme/jvm/SoftLong.java.

258
259
260
261
262
263
264
265

266
267
268
269
270
271
272
		return SoftLong.add(__ah, __al,
			Assembly.longUnpackHigh(nb), Assembly.longUnpackLow(nb));
	}
	
	/**
	 * Converts to double.
	 *
	 * @param __a A.

	 * @return The result.
	 * @since 2019/05/24
	 */
	public static double toDouble(int __ah, int __al)
	{
		Assembly.breakpoint();
		throw new todo.TODO();







|
>







258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
		return SoftLong.add(__ah, __al,
			Assembly.longUnpackHigh(nb), Assembly.longUnpackLow(nb));
	}
	
	/**
	 * Converts to double.
	 *
	 * @param __ah High value.
	 * @param __al Low value.
	 * @return The result.
	 * @since 2019/05/24
	 */
	public static double toDouble(int __ah, int __al)
	{
		Assembly.breakpoint();
		throw new todo.TODO();

Name change from runt/apis/cldc-compact/cc/squirreljme/jvm/SupervisorPropertyIndex.java to modules/cldc-compact/src/main/java/cc/squirreljme/jvm/SupervisorPropertyIndex.java.

15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
 * otherwise.
 *
 * @since 2019/10/04
 */
public interface SupervisorPropertyIndex
{
	/** The static field register of the task syscall handler. */
	public static final byte TASK_SYSCALL_STATIC_FIELD_POINTER =
		1;
	
	/** The method pointer of the task syscall method. */
	public static final byte TASK_SYSCALL_METHOD_HANDLER =
		2;
	
	/** The pool pointer of the task syscall method. */
	public static final byte TASK_SYSCALL_METHOD_POOL_POINTER =
		3;
	
	/** The number of available properties. */
	public static final byte NUM_PROPERTIES =
		4;
}








|



|



|



|



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
 * otherwise.
 *
 * @since 2019/10/04
 */
public interface SupervisorPropertyIndex
{
	/** The static field register of the task syscall handler. */
	byte TASK_SYSCALL_STATIC_FIELD_POINTER =
		1;
	
	/** The method pointer of the task syscall method. */
	byte TASK_SYSCALL_METHOD_HANDLER =
		2;
	
	/** The pool pointer of the task syscall method. */
	byte TASK_SYSCALL_METHOD_POOL_POINTER =
		3;
	
	/** The number of available properties. */
	byte NUM_PROPERTIES =
		4;
}

Name change from runt/apis/cldc-compact/cc/squirreljme/jvm/SystemCallError.java to modules/cldc-compact/src/main/java/cc/squirreljme/jvm/SystemCallError.java.

76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
	 * @throws SystemCallException If there was an error.
	 * @since 2020/01/12
	 */
	public static final void checkError(short __si)
		throws SystemCallException
	{
		int code = SystemCallError.getError(__si);
		if (code != NO_ERROR)
			throw new SystemCallException(__si, code);
	}
	
	/**
	 * Returns the error state.
	 *
	 * @param __si The system call index.







|







76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
	 * @throws SystemCallException If there was an error.
	 * @since 2020/01/12
	 */
	public static final void checkError(short __si)
		throws SystemCallException
	{
		int code = SystemCallError.getError(__si);
		if (code != SystemCallError.NO_ERROR)
			throw new SystemCallException(__si, code);
	}
	
	/**
	 * Returns the error state.
	 *
	 * @param __si The system call index.
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
	 * @return The resulting string.
	 * @since 2020/01/12
	 */
	public static final String toString(int __err)
	{
		switch (__err)
		{
			case NO_ERROR:					return "NoError";
			case UNSUPPORTED_SYSTEM_CALL:	return "UnsupportedSystemCall";
			case PIPE_DESCRIPTOR_INVALID:	return "PDInvalid";
			case PIPE_DESCRIPTOR_BAD_WRITE:	return "PDBadWrite";
			case VALUE_OUT_OF_RANGE:		return "ValueOutOfRange";
			case NO_FRAMEBUFFER:			return "NoFramebuffer";
			case PERMISSION_DENIED:			return "PermissionDenied";
			case INTERRUPTED:				return "Interrupted";
			case UNKNOWN:					return "Unknown";
			case END_OF_FILE:				return "EndOfFile";
			case IPC_ERROR:					return "IPCError";
			
				// Some Other ID?
			default:
				return "ERROR" + __err;
		}
	}
}








|
|
|
|
|
|
|
|
|
|
|








103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
	 * @return The resulting string.
	 * @since 2020/01/12
	 */
	public static final String toString(int __err)
	{
		switch (__err)
		{
			case SystemCallError.NO_ERROR:					return "NoError";
			case SystemCallError.UNSUPPORTED_SYSTEM_CALL:	return "UnsupportedSystemCall";
			case SystemCallError.PIPE_DESCRIPTOR_INVALID:	return "PDInvalid";
			case SystemCallError.PIPE_DESCRIPTOR_BAD_WRITE:	return "PDBadWrite";
			case SystemCallError.VALUE_OUT_OF_RANGE:		return "ValueOutOfRange";
			case SystemCallError.NO_FRAMEBUFFER:			return "NoFramebuffer";
			case SystemCallError.PERMISSION_DENIED:			return "PermissionDenied";
			case SystemCallError.INTERRUPTED:				return "Interrupted";
			case SystemCallError.UNKNOWN:					return "Unknown";
			case SystemCallError.END_OF_FILE:				return "EndOfFile";
			case SystemCallError.IPC_ERROR:					return "IPCError";
			
				// Some Other ID?
			default:
				return "ERROR" + __err;
		}
	}
}

Name change from runt/apis/cldc-compact/cc/squirreljme/jvm/SystemCallException.java to modules/cldc-compact/src/main/java/cc/squirreljme/jvm/SystemCallException.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28


29
30
31
32
33
34
35
36
37
38
39


40
41
42
43
44
45
46
47
48
49
50
51
52
53


54
55
56
57
58
59
60
61
62
63
64
65
66
67
68


69
70
71
72
73
74
75
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm;

/**
 * Exception that may be thrown by {@link SystemCallError.checkError(int)}.
 *
 * @since 2020/01/12
 */
public class SystemCallException
	extends RuntimeException
{
	/** The system call ID. */
	public final int callid;
	
	/** The error code. */
	public final int code;
	
	/**
	 * Initializes the exception with no message or cause.
	 *


	 * @since 2019/10/21
	 */
	public SystemCallException(int __sid, int __ec)
	{
		this.callid = __sid;
		this.code = __ec;
	}
	
	/**
	 * Initializes the exception with the given message and no cause.
	 *


	 * @param __m The message.
	 * @since 2019/10/21
	 */
	public SystemCallException(int __sid, int __ec, String __m)
	{
		super(__m);
		
		this.callid = __sid;
		this.code = __ec;
	}
	
	/**
	 * Initializes the exception with the given message and cause.
	 *


	 * @param __m The message.
	 * @param __t The cause.
	 * @since 2019/10/21
	 */
	public SystemCallException(int __sid, int __ec, String __m, Throwable __t)
	{
		super(__m, __t);
		
		this.callid = __sid;
		this.code = __ec;
	}
	
	/**
	 * Initializes the exception with the given cause and no message.
	 *


	 * @param __t The cause.
	 * @since 2019/10/21
	 */
	public SystemCallException(int __sid, int __ec, Throwable __t)
	{
		super(__t);
		












|















>
>











>
>














>
>















>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm;

/**
 * Exception that may be thrown by {@link SystemCallError#checkError(short)}.
 *
 * @since 2020/01/12
 */
public class SystemCallException
	extends RuntimeException
{
	/** The system call ID. */
	public final int callid;
	
	/** The error code. */
	public final int code;
	
	/**
	 * Initializes the exception with no message or cause.
	 *
	 * @param __sid The call ID.
	 * @param __ec The error code.
	 * @since 2019/10/21
	 */
	public SystemCallException(int __sid, int __ec)
	{
		this.callid = __sid;
		this.code = __ec;
	}
	
	/**
	 * Initializes the exception with the given message and no cause.
	 *
	 * @param __sid The call ID.
	 * @param __ec The error code.
	 * @param __m The message.
	 * @since 2019/10/21
	 */
	public SystemCallException(int __sid, int __ec, String __m)
	{
		super(__m);
		
		this.callid = __sid;
		this.code = __ec;
	}
	
	/**
	 * Initializes the exception with the given message and cause.
	 *
	 * @param __sid The call ID.
	 * @param __ec The error code.
	 * @param __m The message.
	 * @param __t The cause.
	 * @since 2019/10/21
	 */
	public SystemCallException(int __sid, int __ec, String __m, Throwable __t)
	{
		super(__m, __t);
		
		this.callid = __sid;
		this.code = __ec;
	}
	
	/**
	 * Initializes the exception with the given cause and no message.
	 *
	 * @param __sid The call ID.
	 * @param __ec The error code.
	 * @param __t The cause.
	 * @since 2019/10/21
	 */
	public SystemCallException(int __sid, int __ec, Throwable __t)
	{
		super(__t);
		

Name change from runt/apis/cldc-compact/cc/squirreljme/jvm/SystemCallIndex.java to modules/cldc-compact/src/main/java/cc/squirreljme/jvm/SystemCallIndex.java.

15
16
17
18
19
20
21
22
23

24
25
26
27
28
29
30
31
32
33
34
35
36
37
38

39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54

55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95

96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128

129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182

183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210

211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230

231
232
233
234
235
236
237
238
239
240

241
242
243
244
245
246
247
248
249
250

251
252
253
254
255
256
257
258
259

260
261
262
263
264
265
266
267
268
269

270

271
272
273
274
275
276
277
278
279

280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298

299
300
301
302
303
304
305
306
307
308

309
310
311
312
313
314
315
316

317

318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398

399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
 * @since 2019/05/23
 */
public interface SystemCallIndex
{
	/**
	 * Checks if the system call is supported.
	 *
	 * @param 1 The system call index to query.
	 * @return Zero if not supported, otherwise a non-zero value.

	 */
	public static final byte QUERY_INDEX =
		0;
	
	/**
	 * Gets the last error code.
	 *
	 * This value that stores the error state is thread-local and it may be
	 * stored with a precision of at least 16-bits.
	 *
	 * If the system call index is not valid then it is assumed to be
	 * {@link #QUERY_INDEX}.
	 *
	 * @param 1 The system call index to query.
	 * @return The last error code, will be zero if the last command succeeded.

	 */
	public static final byte ERROR_GET =
		1;
	
	/**
	 * Sets the last error code.
	 *
	 * This value that stores the error state is thread-local and it may be
	 * stored with a precision of at least 16-bits.
	 *
	 * If the system call index is not valid then it is assumed to be
	 * {@link #QUERY_INDEX}.
	 *
	 * @param 1 The system call index to query.
	 * @param 2 The value to set error register to.
	 * @return Zero on success

	 */
	public static final byte ERROR_SET =
		2;
	
	/**
	 * Current wall clock milliseconds.
	 *
	 * @return The current milliseconds time.
	 */
	public static final byte TIME_MILLI_WALL =
		3;
	
	/**
	 * Returns the cross-IPC exception class which has been stored.
	 *
	 * This system call should have the same effect regardless of whether it
	 * is a supervisor thread or user thread, it does not get forwarded
	 * to the task system call handler.
	 *
	 * @return The exception which has been stored.
	 */
	public static final byte EXCEPTION_LOAD =
		4;
	
	/**
	 * Current monotonic clock nanoseconds (low).
	 *
	 * @return The monotonic nanoseconds time.
	 */
	public static final byte TIME_NANO_MONO =
		5;
	
	/**
	 * Stores the cross-IPC exception class for system call errors.
	 *
	 * This system call should have the same effect regardless of whether it
	 * is a supervisor thread or user thread, it does not get forwarded
	 * to the task system call handler.
	 *
	 * @param 1 The exception to store.
	 * @return The old value that was stored in the register.

	 */
	public static final byte EXCEPTION_STORE =
		6;
	
	/**
	 * VM Information: Free memory in bytes.
	 *
	 * @return The free memory amount in bytes.
	 */
	public static final byte VMI_MEM_FREE =
		7;
	
	/**
	 * VM Information: Used memory in bytes.
	 *
	 * @return The used memory amount in bytes.
	 */
	public static final byte VMI_MEM_USED =
		8;
	
	/**
	 * VM Information: Max memory in bytes.
	 *
	 * @return The max memory amount in bytes.
	 */
	public static final byte VMI_MEM_MAX =
		9;
	
	/**
	 * Suggests that the garbage collector should run, note that this may be
	 * a deferred operation and might not be immediate.
	 *
	 * @return Generally zero although any other value could be returned.

	 */
	public static final byte GARBAGE_COLLECT =
		10;
	
	/**
	 * Exits the VM with the given exit code.
	 *
	 * @param 1 The exit code to exit the process with.
	 * @return This generally does not return, if it does then the error code
	 * will likely specify why this failed.
	 */
	public static final byte EXIT =
		11;
	
	/**
	 * The API Level of the VM, this has been deprecated since the current
	 * SquirrelJME API specified in these system calls better handles various
	 * features.
	 *
	 * @return The API level of the virtual machine.
	 */
	@Deprecated
	public static final byte API_LEVEL =
		12;
	
	/**
	 * The pipe descriptor for stdin.
	 *
	 * @return The pipe descriptor for standard input.
	 */
	public static final byte PD_OF_STDIN =
		13;
	
	/**
	 * The pipe descriptor for stdout.
	 *
	 * @return The pipe descriptor for standard output.
	 */
	public static final byte PD_OF_STDOUT =
		14;
	
	/**
	 * The pipe descriptor for stderr.
	 *
	 * @return The pipe descriptor for standard error.
	 */
	public static final byte PD_OF_STDERR =
		15;
	
	/**
	 * Pipe descriptor: Write single byte.
	 *
	 * @param 1 The pipe descriptor.
	 * @param 2 The value of the byte to write, only the lowest 8-bits is used.

	 * @return The number of bytes written to the output, if this returns
	 * a value lower than zero then it indicates an error.
	 */
	public static final byte PD_WRITE_BYTE =
		16;
	
	/**
	 * Bulk sets the memory inside of a region, this follows the same pattern
	 * as C's {@code memset()} operation.
	 *
	 * @param 1 The address to set.
	 * @param 2 The value to set the region with.
	 * @param 3 The number of bytes to set.
	 * @return The number of bytes actually written, if this is zero then
	 * it is likely the system call is not supported.
	 */
	public static final byte MEM_SET =
		17;
	
	/**
	 * Bulk sets the memory inside of a region writing full integer values at
	 * a time which is generally faster, this follows the same pattern as C's
	 * {@code memset()} operation.
	 *
	 * @param 1 The address to set.
	 * @param 2 The value to set the region with.
	 * @param 3 The number of bytes to set, the lower 2-bits ({@code 0x3}) will
	 * be masked off so the length is always a multiple of four.

	 * @return The number of bytes actually written, if this is zero then
	 * it is likely the system call is not supported.
	 */
	public static final byte MEM_SET_INT =
		18;
	
	/**
	 * Get the height of the call stack.
	 *
	 * @return The height of the call stack.
	 */
	public static final byte CALL_STACK_HEIGHT =
		19;
	
	/**
	 * Gets the specified call stack item.
	 *
	 * @param 1 The number of frames from the top of the call stack to get the
	 * items for, zero will be the top-most item.
	 * @param 2 The item to obtain as specified in {@link CallStackItem}.

	 * @return The value of the item, if it is undefined or not supported
	 * then zero will be returned.
	 */
	public static final byte CALL_STACK_ITEM =
		20;
	
	/**
	 * Returns the string of the given pointer.
	 *
	 * @param 1 The pointer to the modified UTF encoded string.

	 * @return An instance of {@link String}.
	 */
	public static final byte LOAD_STRING =
		21;
	
	/**
	 * Fatal ToDo hit.
	 *
	 * @param 1 The code to use for the To Do.
	 * @return This should not return unless it is not supported.

	 */
	public static final byte FATAL_TODO =
		22;
	
	/**
	 * This is used to indicate that the supervisor booted correctly and that
	 * execution control is normal.
	 *
	 * @return Generally zero as no value is intended to be returned.

	 */
	public static final byte SUPERVISOR_BOOT_OKAY =
		23;
	
	/**
	 * Get, set, or change a property of the framebuffer, the properties which
	 * are defined are specified in {@link Framebuffer}.
	 *
	 * @param 1 The frame buffer property to select.
	 * @param ... Undefined, this depends on the property selected.

	 * @return Whatever value the frame buffer property will return.

	 */
	public static final byte FRAMEBUFFER =
		24;
	
	/**
	 * Returns the native byte order of the system the virtual machine is
	 * running on.
	 *
	 * @return Non-zero if little endian, otherwise zero will be big endian.

	 */
	public static final byte BYTE_ORDER_LITTLE =
		25;
	
	/**
	 * Returns the pointer to the option JAR data.
	 *
	 * @param 1 The option JAR slot to request.
	 * @return A pointer to the data or zero if there is no option JAR defined
	 * in the requested slot.
	 */
	public static final byte OPTION_JAR_DATA =
		26;
	
	/**
	 * Returns the size of the option JAR data.
	 *
	 * @param 1 The option JAR slot to request.
	 * @return The size of the specified option JAR or zero if there is no

	 * option JAR defined in the requested slot.
	 */
	public static final byte OPTION_JAR_SIZE =
		27;
	
	/**
	 * Loads the specified class.
	 *
	 * @param 1 The Modified UTF specifying the class name.
	 * @return The pointer to the loaded class info, will be zero on failure.

	 */
	public static final byte LOAD_CLASS_UTF =
		28;
	
	/**
	 * Loads the specified class.
	 *
	 * @param 1 A byte array encoded in UTF-8 which contains the class name.

	 * @return The pointer to the loaded class info, will be zero on failure.

	 */
	public static final byte LOAD_CLASS_BYTES =
		29;
	
	/**
	 * Sets the value of a supervisor property.
	 *
	 * Supervisor properties are local to a thread.
	 *
	 * Only the supervisor is allowed to set these properties.
	 *
	 * @param 1 The supervisor property to set.
	 * @param 2 The new value of the property.
	 * @return A non-zero value if this was successful.
	 */
	public static final byte SUPERVISOR_PROPERTY_SET =
		30;
	
	/**
	 * Gets the value of a supervisor property.
	 *
	 * Supervisor properties are local to a thread.
	 *
	 * @param 1 The supervisor property to get.
	 * @return The value of that property, error should be checked to ensure
	 * that it did not fail.
	 */
	public static final byte SUPERVISOR_PROPERTY_GET =
		31;
	
	/**
	 * Sets the task ID of the current thread frame.
	 *
	 * Only the supervisor is allowed to set tihus.
	 *
	 * @param 1 The task ID to set.
	 * @return A non-zero value if this was successful.
	 */
	public static final byte FRAME_TASK_ID_SET =
		32;
	
	/**
	 * Gets the value of a thread register.
	 *
	 * @return The value of the task ID.
	 */
	public static final byte FRAME_TASK_ID_GET =
		33;
	
	/**
	 * Perform a feedback operation.
	 *
	 * @param 1 The type of feedback to perform.
	 * @param 2 The duration of the feedback.
	 * @return Non-zero on success.
	 */
	public static final byte DEVICE_FEEDBACK =
		34;
	
	/**
	 * Sleep for the given number of nanoseconds.
	 *
	 * @param 1 The number of milliseconds to sleep for.
	 * @param 2 The number of nanoseconds to sleep for.
	 * @return Returns zero unless sleep was interrupted.
	 */
	public static final byte SLEEP =
		35;
	
	/**
	 * If the framebuffer is shared with the console, this tells the console
	 * printer to not send messages to the screen as it will corrupt the
	 * display on the screen.
	 */
	public static final byte SQUELCH_FB_CONSOLE =
		36;
	
	/**
	 * Perform IPC call.
	 *
	 * @param 1 The task to call, {@code 0} is the supervisor.

	 * @param 2 The IPC identifier which specifies which service this was
	 * associated with.
	 * @param ... Any arguments to the call.
	 * @return The value returned from the remote call.
	 */
	public static final byte IPC_CALL =
		37;
	
	/**
	 * The number of system calls that are defined in this run-time.
	 *
	 * One must NEVER utilize this value in a system call as it will have
	 * unintended consequences of requesting future API values.
	 */
	public static final byte NUM_SYSCALLS =
		38;
}








|
|
>

|











|
|
>

|











|
|
|
>

|





|

|









|

|





|

|









|
|
>

|





|

|





|

|





|

|






|
>

|





|
|
|

|







|


|





|

|





|

|





|

|





|
|
>
|
|

|






|
|
|
|
|

|







|
|
|
|
>
|
|

|





|

|





|
|
|
>
|
|

|





|
>
|

|





|
|
>

|






|
>

|






|
|
>
|
>

|






|
>

|





|
|
|

|





|
|
>


|





|
|
>

|





|
>
|
>

|









|
|
|

|







|
|
|

|







|
|

|





|

|





|
|
|

|





|
|
|

|







|





|
>
|
|
|
|

|








|



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
 * @since 2019/05/23
 */
public interface SystemCallIndex
{
	/**
	 * Checks if the system call is supported.
	 *
	 * @squirreljme.syscallparam 1 The system call index to query.
	 * @squirreljme.syscallreturn Zero if not supported, otherwise a non-zero
	 * value.
	 */
	byte QUERY_INDEX =
		0;
	
	/**
	 * Gets the last error code.
	 *
	 * This value that stores the error state is thread-local and it may be
	 * stored with a precision of at least 16-bits.
	 *
	 * If the system call index is not valid then it is assumed to be
	 * {@link #QUERY_INDEX}.
	 *
	 * @squirreljme.syscallparam 1 The system call index to query.
	 * @squirreljme.syscallreturn The last error code, will be zero if the last
	 * command succeeded.
	 */
	byte ERROR_GET =
		1;
	
	/**
	 * Sets the last error code.
	 *
	 * This value that stores the error state is thread-local and it may be
	 * stored with a precision of at least 16-bits.
	 *
	 * If the system call index is not valid then it is assumed to be
	 * {@link #QUERY_INDEX}.
	 *
	 * @squirreljme.syscallparam 1 The system call index to query.
	 * @squirreljme.syscallparam 2 The value to set error register to.
	 * @squirreljme.syscallreturn The value which was previously in the
	 * register.
	 */
	byte ERROR_SET =
		2;
	
	/**
	 * Current wall clock milliseconds.
	 *
	 * @squirreljme.syscallreturn The current milliseconds time.
	 */
	byte TIME_MILLI_WALL =
		3;
	
	/**
	 * Returns the cross-IPC exception class which has been stored.
	 *
	 * This system call should have the same effect regardless of whether it
	 * is a supervisor thread or user thread, it does not get forwarded
	 * to the task system call handler.
	 *
	 * @squirreljme.syscallreturn The exception which has been stored.
	 */
	byte EXCEPTION_LOAD =
		4;
	
	/**
	 * Current monotonic clock nanoseconds (low).
	 *
	 * @squirreljme.syscallreturn The monotonic nanoseconds time.
	 */
	byte TIME_NANO_MONO =
		5;
	
	/**
	 * Stores the cross-IPC exception class for system call errors.
	 *
	 * This system call should have the same effect regardless of whether it
	 * is a supervisor thread or user thread, it does not get forwarded
	 * to the task system call handler.
	 *
	 * @squirreljme.syscallparam 1 The exception to store.
	 * @squirreljme.syscallreturn The old value that was stored in the
	 * register.
	 */
	byte EXCEPTION_STORE =
		6;
	
	/**
	 * VM Information: Free memory in bytes.
	 *
	 * @squirreljme.syscallreturn The free memory amount in bytes.
	 */
	byte VMI_MEM_FREE =
		7;
	
	/**
	 * VM Information: Used memory in bytes.
	 *
	 * @squirreljme.syscallreturn The used memory amount in bytes.
	 */
	byte VMI_MEM_USED =
		8;
	
	/**
	 * VM Information: Max memory in bytes.
	 *
	 * @squirreljme.syscallreturn The max memory amount in bytes.
	 */
	byte VMI_MEM_MAX =
		9;
	
	/**
	 * Suggests that the garbage collector should run, note that this may be
	 * a deferred operation and might not be immediate.
	 *
	 * @squirreljme.syscallreturn Generally zero although any other value could
	 * be returned.
	 */
	byte GARBAGE_COLLECT =
		10;
	
	/**
	 * Exits the VM with the given exit code.
	 *
	 * @squirreljme.syscallparam 1 The exit code to exit the process with.
	 * @squirreljme.syscallreturn This generally does not return, if it does
	 * then the error code will likely specify why this failed.
	 */
	byte EXIT =
		11;
	
	/**
	 * The API Level of the VM, this has been deprecated since the current
	 * SquirrelJME API specified in these system calls better handles various
	 * features.
	 *
	 * @squirreljme.syscallreturn The API level of the virtual machine.
	 */
	@Deprecated
	byte API_LEVEL =
		12;
	
	/**
	 * The pipe descriptor for stdin.
	 *
	 * @squirreljme.syscallreturn The pipe descriptor for standard input.
	 */
	byte PD_OF_STDIN =
		13;
	
	/**
	 * The pipe descriptor for stdout.
	 *
	 * @squirreljme.syscallreturn The pipe descriptor for standard output.
	 */
	byte PD_OF_STDOUT =
		14;
	
	/**
	 * The pipe descriptor for stderr.
	 *
	 * @squirreljme.syscallreturn The pipe descriptor for standard error.
	 */
	byte PD_OF_STDERR =
		15;
	
	/**
	 * Pipe descriptor: Write single byte.
	 *
	 * @squirreljme.syscallparam 1 The pipe descriptor.
	 * @squirreljme.syscallparam 2 The value of the byte to write, only the
	 * lowest 8-bits is used.
	 * @squirreljme.syscallreturn The number of bytes written to the output,
	 * if this returns a value lower than zero then it indicates an error.
	 */
	byte PD_WRITE_BYTE =
		16;
	
	/**
	 * Bulk sets the memory inside of a region, this follows the same pattern
	 * as C's {@code memset()} operation.
	 *
	 * @squirreljme.syscallparam 1 The address to set.
	 * @squirreljme.syscallparam 2 The value to set the region with.
	 * @squirreljme.syscallparam 3 The number of bytes to set.
	 * @squirreljme.syscallreturn The number of bytes actually written, if this
	 * is zero then it is likely the system call is not supported.
	 */
	byte MEM_SET =
		17;
	
	/**
	 * Bulk sets the memory inside of a region writing full integer values at
	 * a time which is generally faster, this follows the same pattern as C's
	 * {@code memset()} operation.
	 *
	 * @squirreljme.syscallparam 1 The address to set.
	 * @squirreljme.syscallparam 2 The value to set the region with.
	 * @squirreljme.syscallparam 3 The number of bytes to set, the lower 2-bits
	 * ({@code 0x3}) will be masked off so the length is always a multiple of
	 * four.
	 * @squirreljme.syscallreturn The number of bytes actually written,
	 * if this is zero then it is likely the system call is not supported.
	 */
	byte MEM_SET_INT =
		18;
	
	/**
	 * Get the height of the call stack.
	 *
	 * @squirreljme.syscallreturn The height of the call stack.
	 */
	byte CALL_STACK_HEIGHT =
		19;
	
	/**
	 * Gets the specified call stack item.
	 *
	 * @squirreljme.syscallparam 1 The number of frames from the top of the
	 * call stack to get the items for, zero will be the top-most item.
	 * @squirreljme.syscallparam 2 The item to obtain as specified in
	 * {@link CallStackItem}.
	 * @squirreljme.syscallreturn The value of the item, if it is undefined or
	 * not supported then zero will be returned.
	 */
	byte CALL_STACK_ITEM =
		20;
	
	/**
	 * Returns the string of the given pointer.
	 *
	 * @squirreljme.syscallparam 1 The pointer to the modified UTF encoded
	 * string.
	 * @squirreljme.syscallreturn An instance of {@link String}.
	 */
	byte LOAD_STRING =
		21;
	
	/**
	 * Fatal ToDo hit.
	 *
	 * @squirreljme.syscallparam 1 The code to use for the To Do.
	 * @squirreljme.syscallreturn This should not return unless it is not
	 * supported.
	 */
	byte FATAL_TODO =
		22;
	
	/**
	 * This is used to indicate that the supervisor booted correctly and that
	 * execution control is normal.
	 *
	 * @squirreljme.syscallreturn Generally zero as no value is intended to be
	 * returned.
	 */
	byte SUPERVISOR_BOOT_OKAY =
		23;
	
	/**
	 * Get, set, or change a property of the framebuffer, the properties which
	 * are defined are specified in {@link Framebuffer}.
	 *
	 * @squirreljme.syscallparam 1 The frame buffer property to select.
	 * @squirreljme.syscallparam ... Undefined, this depends on the property
	 * selected.
	 * @squirreljme.syscallreturn Whatever value the frame buffer property will
	 * return.
	 */
	byte FRAMEBUFFER =
		24;
	
	/**
	 * Returns the native byte order of the system the virtual machine is
	 * running on.
	 *
	 * @squirreljme.syscallreturn Non-zero if little endian, otherwise zero
	 * will be big endian.
	 */
	byte BYTE_ORDER_LITTLE =
		25;
	
	/**
	 * Returns the pointer to the option JAR data.
	 *
	 * @squirreljme.syscallparam 1 The option JAR slot to request.
	 * @squirreljme.syscallreturn A pointer to the data or zero if there is no
	 * option JAR defined in the requested slot.
	 */
	byte OPTION_JAR_DATA =
		26;
	
	/**
	 * Returns the size of the option JAR data.
	 *
	 * @squirreljme.syscallparam 1 The option JAR slot to request.
	 * @squirreljme.syscallreturn The size of the specified option JAR or zero
	 * if there is no
	 * option JAR defined in the requested slot.
	 */
	byte OPTION_JAR_SIZE =
		27;
	
	/**
	 * Loads the specified class.
	 *
	 * @squirreljme.syscallparam 1 The Modified UTF specifying the class name.
	 * @squirreljme.syscallreturn The pointer to the loaded class info, will be
	 * zero on failure.
	 */
	byte LOAD_CLASS_UTF =
		28;
	
	/**
	 * Loads the specified class.
	 *
	 * @squirreljme.syscallparam 1 A byte array encoded in UTF-8 which contains
	 * the class name.
	 * @squirreljme.syscallreturn The pointer to the loaded class info, will be
	 * zero on failure.
	 */
	byte LOAD_CLASS_BYTES =
		29;
	
	/**
	 * Sets the value of a supervisor property.
	 *
	 * Supervisor properties are local to a thread.
	 *
	 * Only the supervisor is allowed to set these properties.
	 *
	 * @squirreljme.syscallparam 1 The supervisor property to set.
	 * @squirreljme.syscallparam 2 The new value of the property.
	 * @squirreljme.syscallreturn A non-zero value if this was successful.
	 */
	byte SUPERVISOR_PROPERTY_SET =
		30;
	
	/**
	 * Gets the value of a supervisor property.
	 *
	 * Supervisor properties are local to a thread.
	 *
	 * @squirreljme.syscallparam 1 The supervisor property to get.
	 * @squirreljme.syscallreturn The value of that property, error should be
	 * checked to ensure that it did not fail.
	 */
	byte SUPERVISOR_PROPERTY_GET =
		31;
	
	/**
	 * Sets the task ID of the current thread frame.
	 *
	 * Only the supervisor is allowed to set tihus.
	 *
	 * @squirreljme.syscallparam 1 The task ID to set.
	 * @squirreljme.syscallreturn A non-zero value if this was successful.
	 */
	byte FRAME_TASK_ID_SET =
		32;
	
	/**
	 * Gets the value of a thread register.
	 *
	 * @squirreljme.syscallreturn The value of the task ID.
	 */
	byte FRAME_TASK_ID_GET =
		33;
	
	/**
	 * Perform a feedback operation.
	 *
	 * @squirreljme.syscallparam 1 The type of feedback to perform.
	 * @squirreljme.syscallparam 2 The duration of the feedback.
	 * @squirreljme.syscallreturn Non-zero on success.
	 */
	byte DEVICE_FEEDBACK =
		34;
	
	/**
	 * Sleep for the given number of nanoseconds.
	 *
	 * @squirreljme.syscallparam 1 The number of milliseconds to sleep for.
	 * @squirreljme.syscallparam 2 The number of nanoseconds to sleep for.
	 * @squirreljme.syscallreturn Returns zero unless sleep was interrupted.
	 */
	byte SLEEP =
		35;
	
	/**
	 * If the framebuffer is shared with the console, this tells the console
	 * printer to not send messages to the screen as it will corrupt the
	 * display on the screen.
	 */
	byte SQUELCH_FB_CONSOLE =
		36;
	
	/**
	 * Perform IPC call.
	 *
	 * @squirreljme.syscallparam 1 The task to call, {@code 0} is the
	 * supervisor.
	 * @squirreljme.syscallparam 2 The IPC identifier which specifies which
	 * service this was associated with.
	 * @squirreljme.syscallparam ... Any arguments to the call.
	 * @squirreljme.syscallreturn The value returned from the remote call.
	 */
	byte IPC_CALL =
		37;
	
	/**
	 * The number of system calls that are defined in this run-time.
	 *
	 * One must NEVER utilize this value in a system call as it will have
	 * unintended consequences of requesting future API values.
	 */
	byte NUM_SYSCALLS =
		38;
}

Name change from runt/klib/supervisor/cc/squirreljme/jvm/Allocator.java to modules/cldc-compact/src/main/java/cc/squirreljme/jvm/boot/Allocator.java.

1
2
3
4
5
6
7
8
9
10





11
12
13
14
15
16

17
18
19
20
21
22
23
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm;






/**
 * This contains the static memory allocator.
 *
 * @since 2019/05/26
 */

public final class Allocator
{
	/** Chunk is an object. */
	public static final byte CHUNK_BIT_IS_OBJECT =
		0x01;
	
	/** Constant pool. */









|
>
>
>
>
>






>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm.boot;

import cc.squirreljme.jvm.Assembly;
import cc.squirreljme.jvm.Constants;
import cc.squirreljme.jvm.SystemCallError;
import cc.squirreljme.jvm.SystemCallIndex;

/**
 * This contains the static memory allocator.
 *
 * @since 2019/05/26
 */
@SuppressWarnings("FeatureEnvy")
public final class Allocator
{
	/** Chunk is an object. */
	public static final byte CHUNK_BIT_IS_OBJECT =
		0x01;
	
	/** Constant pool. */
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
		finally
		{
			// Clear out lock, if not matched then something is wrong!
			int old;
			if (key != (old = Assembly.atomicCompareGetAndSet(key, 0, lp)))
			{
				// Another allocation took our lock??
				todo.DEBUG.code('a', 'l', old);
				Assembly.breakpoint();
				
				// {@squirreljme.error SV0j Another allocation took the lock
				// from us?}
				throw new VirtualMachineError("SV0j");
			}
		}
	}
	
	/**
	 * Allocates the given number of bytes, no locking is performed at all.
	 *
	 * @param __tag The tag to use, only the lowest 8-bits are used.
	 * @param __sz The number of bytes to allocate.
	 * @return The address of the allocated data or {@code 0} if there is
	 * not enough memory remaining.
	 * @since 2019/05/26
	 */
	public static final int allocateWithoutLock(int __tag, int __sz)
	{
		// The number of desired bytes
		int want = CHUNK_LENGTH + (__sz <= 4 ? 4 : ((__sz + 3) & (~3)));
		
		// Negative size or too big?
		if (__sz < 0 || want > CHUNK_SIZE_LIMIT)
			return 0;
		
		// Go through the memory chunks to locate a free chunk
		int seeker = Allocator._rambase;
		while (seeker != 0)
		{
			// Read chunk properties
			int csz = Assembly.memReadInt(seeker, CHUNK_SIZE_OFFSET),
				cnx = Assembly.memReadInt(seeker, CHUNK_NEXT_OFFSET);
			
			// Is this a free block? And can we fit in it?
			if ((csz & CHUNK_TAG_MASK) == CHUNK_TAG_FREE &&
				want <= (csz & CHUNK_SIZE_MASK))
				return Allocator.__claim(__tag, want, seeker, csz, cnx);
			
			// Go to the next chunk
			seeker = cnx;
		}
		
		// Did not find a free chunk







<




|
















|


|







|
|


|
|







116
117
118
119
120
121
122

123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
		finally
		{
			// Clear out lock, if not matched then something is wrong!
			int old;
			if (key != (old = Assembly.atomicCompareGetAndSet(key, 0, lp)))
			{
				// Another allocation took our lock??

				Assembly.breakpoint();
				
				// {@squirreljme.error SV0j Another allocation took the lock
				// from us?}
				throw new BootstrapMachineError("SV0j");
			}
		}
	}
	
	/**
	 * Allocates the given number of bytes, no locking is performed at all.
	 *
	 * @param __tag The tag to use, only the lowest 8-bits are used.
	 * @param __sz The number of bytes to allocate.
	 * @return The address of the allocated data or {@code 0} if there is
	 * not enough memory remaining.
	 * @since 2019/05/26
	 */
	public static final int allocateWithoutLock(int __tag, int __sz)
	{
		// The number of desired bytes
		int want = Allocator.CHUNK_LENGTH + (__sz <= 4 ? 4 : ((__sz + 3) & (~3)));
		
		// Negative size or too big?
		if (__sz < 0 || want > Allocator.CHUNK_SIZE_LIMIT)
			return 0;
		
		// Go through the memory chunks to locate a free chunk
		int seeker = Allocator._rambase;
		while (seeker != 0)
		{
			// Read chunk properties
			int csz = Assembly.memReadInt(seeker, Allocator.CHUNK_SIZE_OFFSET),
				cnx = Assembly.memReadInt(seeker, Allocator.CHUNK_NEXT_OFFSET);
			
			// Is this a free block? And can we fit in it?
			if ((csz & Allocator.CHUNK_TAG_MASK) == Allocator.CHUNK_TAG_FREE &&
				want <= (csz & Allocator.CHUNK_SIZE_MASK))
				return Allocator.__claim(__tag, want, seeker, csz, cnx);
			
			// Go to the next chunk
			seeker = cnx;
		}
		
		// Did not find a free chunk
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362



363
364
365
366
367
368

369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421

422
423
424
425
426
427
428
429
430
431
432
433

434
435
436
437
438
439
440
		finally
		{
			// Clear out lock, if not matched then something is wrong!
			int old;
			if (key != (old = Assembly.atomicCompareGetAndSet(key, 0, lp)))
			{
				// Another free took our lock??
				todo.DEBUG.code('f', 'l', old);
				Assembly.breakpoint();
				
				// {@squirreljme.error SV0k Another free took the lock
				// from us?}
				throw new VirtualMachineError("SV0k");
			}
		}
	}
	
	/**
	 * Frees the specified memory pointer, making it available for later use,
	 * without using a lock.
	 *
	 * @param __p The pointer to free.
	 * @since 2019/05/27
	 */
	public static final void freeWithoutLock(int __p)
	{
		// This should never happen
		if (__p == 0 || __p == Constants.BAD_MAGIC)
			Assembly.breakpoint();
		
		// Determine the seeker position for this chunk
		int seeker = __p - CHUNK_LENGTH;
		
		// Read chunk properties
		int csz = Assembly.memReadInt(seeker, CHUNK_SIZE_OFFSET),
			cnx = Assembly.memReadInt(seeker, CHUNK_NEXT_OFFSET);
		
		// Actual logically used space
		int usedspace = (csz & CHUNK_SIZE_MASK);
		
		// Clear out memory with invalid data, that is BAD_MAGIC
		int bm = Constants.BAD_MAGIC;
		Assembly.sysCallP(SystemCallIndex.MEM_SET_INT,
			__p, bm, usedspace - CHUNK_LENGTH);
		if (Assembly.sysCallPV(SystemCallIndex.ERROR_GET,
			SystemCallIndex.MEM_SET_INT) != SystemCallError.NO_ERROR)
		{
			// Fast memsetint() is not supported, so manually wipe
			// all the bytes!
			for (int i = CHUNK_LENGTH; i < usedspace; i += 4)
				Assembly.memWriteInt(seeker, i, bm);
		}
		
		// Make sure the reference count index is zero, to detect uncount
		// after free
		int rci = CHUNK_LENGTH + Constants.OBJECT_COUNT_OFFSET;
		if (rci + 4 <= csz)
			Assembly.memWriteInt(seeker, rci, 0);
		
		// See if we can merge this with the following chunk
		if (cnx != 0)
		{
			// Get properties of the next chunk
			int nsz = Assembly.memReadInt(cnx, CHUNK_SIZE_OFFSET),
				nnx = Assembly.memReadInt(cnx, CHUNK_NEXT_OFFSET);
			
			// Free space? Merge into it!
			if ((nsz & CHUNK_TAG_MASK) == CHUNK_TAG_FREE)
			{
				// Calculate the would be new size
				int newsize = usedspace + (nsz & CHUNK_SIZE_MASK);
				
				// Only merge chunks which are within the size limit, otherwise
				// a large portion of memory will not able to be reclaimed
				// because it would logically have a small size
				if (newsize <= CHUNK_SIZE_LIMIT)
				{
					// New size of our current chunk
					Assembly.memWriteInt(seeker, CHUNK_SIZE_OFFSET,
						newsize | CHUNK_TAG_FREE);
					
					// Our chunk's next becomes the right side's next
					Assembly.memWriteInt(seeker, CHUNK_NEXT_OFFSET,
						nnx);
					
					// Do not use normal free set
					return;
				}
			}
		}
		
		// Set chunk as free now, keep the original size
		Assembly.memWriteInt(seeker, CHUNK_SIZE_OFFSET,
			csz | CHUNK_TAG_FREE);
	}
	
	/**
	 * Claims the given block and returns it.
	 *
	 * @param __tag The tag to use, only 8-bits are used.
	 * @param __want The wanted size.
	 * @param __seeker The current chunk position.
	 * @param __csz The chunk size.
	 * @param __cnx The chunk next pointer.
	 * @return The allocation pointer.
	 * @since 2019/06/21
	 */
	private static final int __claim(int __tag, int __want, int __seeker,
		int __csz, int __cnx)
	{
		// Calculate free space in this chunk
		int freespace = (__csz & CHUNK_SIZE_MASK);
		
		// This chunk will be split into a used and free chunk
		if (__want + SPLIT_REQUIREMENT <= freespace)
		{
			// The size of the right side chunk is cut by our wanted
			// size
			int nextsize = freespace - __want;
			
			// The position of the next chunk
			int nextpos = __seeker + __want;
			
			// Setup new chunk
			Assembly.memWriteInt(__seeker, CHUNK_SIZE_OFFSET,
				(__want & CHUNK_SIZE_MASK) | (__tag << CHUNK_TAG_SHIFT));
			Assembly.memWriteInt(__seeker, CHUNK_NEXT_OFFSET,
				nextpos);
			
			// Setup the split chunk, points to the original next
			Assembly.memWriteInt(nextpos, CHUNK_SIZE_OFFSET,
				(nextsize & CHUNK_SIZE_MASK) | CHUNK_TAG_FREE);
			Assembly.memWriteInt(nextpos, CHUNK_NEXT_OFFSET,
				__cnx);
		}
		
		// Not being split, so the block gets claimed
		else
		{
			// Keep the originally passed size, but set the tag
			Assembly.memWriteInt(__seeker, CHUNK_SIZE_OFFSET,
				freespace | (__tag << CHUNK_TAG_SHIFT));
		}
		
		// The returning pointer
		int rv = __seeker + CHUNK_LENGTH;
		
		// Clear out memory since Java expects the data to be
		// initialized to zero always
		Assembly.sysCallP(SystemCallIndex.MEM_SET,
			rv, 0, __want - CHUNK_LENGTH);
		if (Assembly.sysCallPV(SystemCallIndex.ERROR_GET,
			SystemCallIndex.MEM_SET) != SystemCallError.NO_ERROR)
		{
			// Fast memset() is not supported, so manually wipe
			// all the bytes!
			for (int i = CHUNK_LENGTH; i < __want; i += 4)
				Assembly.memWriteInt(__seeker, i, 0);
		}
		
		// Return the used pointer
		return rv;
	}
	
	/**
	 * Returns a locking key.
	 *
	 * @return The locking key.
	 * @since 2019/11/22
	 */
	static final int __giveLockKey()
	{



		// Use the thread register so we know the thread that is performing
		// the allocation/free, but never allow it to be zero
		int rv = Assembly.specialGetThreadRegister();
		if (rv == 0)
			return 0x506F4C79;
		return rv;

	}
	
	/**
	 * Initializes the RAM links.
	 *
	 * @param __rambase The base of RAM.
	 * @param __ramsize The amount of RAM available.
	 * @since 2019/05/26
	 */
	static final void __initRamLinks(int __rambase, int __ramsize)
	{
		// Loops through all blocks
		for (int seeker = __rambase;;)
		{
			// Read current and next offset
			int csz = Assembly.memReadInt(seeker, CHUNK_SIZE_OFFSET),
				cnx = Assembly.memReadInt(seeker, CHUNK_NEXT_OFFSET);
			
			// Reached the terminator which has been initialized to zero by
			// the BootROM, so this block and whatever is left becomes free
			// allocation space
			if (csz == 0 || cnx == 0)
			{
				// Since there is an allocation limit of 16MiB, if there is
				// more than 16MiB of memory available then there will be the
				// problem of having one gigantic chunk that is too small, or
				// keeping total memory capped at 16MiB. So to avoid this,
				// this will create as many chunks as needed to fill the
				// remainder of memory!
				
				// Create chunks as big as possible across a span
				int sizeleft = __ramsize - seeker;
				while (sizeleft > 0)
				{
					// Determine how big this chunk becomes
					int usesize = (sizeleft > CHUNK_SIZE_LIMIT ?
						CHUNK_SIZE_LIMIT : sizeleft);
					
					// Reduce used size
					sizeleft -= usesize;
					
					// Create free block here
					Assembly.memWriteInt(seeker, CHUNK_SIZE_OFFSET,
						usesize | CHUNK_TAG_FREE);
					
					// Set pointer and seeker to the next block
					if (sizeleft > SPLIT_REQUIREMENT)
					{
						// Where is this located?
						int nextp = seeker + usesize;
						
						// Write next block position
						Assembly.memWriteInt(seeker, CHUNK_NEXT_OFFSET,

							nextp);
						
						// Go here next
						seeker = nextp;
					}
					
					// Too small to really be considered a block, so just
					// drop the next one
					else
					{
						// Always ensure the next block is zero!
						Assembly.memWriteInt(seeker, CHUNK_NEXT_OFFSET,

							0);
						
						// Stop
						break;
					}
				}
				







<




|


















|


|
|


|




|





|





|







|
|


|


|




|


|
|


|









|
|

















|


|









|
|
|



|
|
|







|
|



|




|





|















>
>
>






>















|
|


















|
|





|
|


|





|
>











|
>







196
197
198
199
200
201
202

203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
		finally
		{
			// Clear out lock, if not matched then something is wrong!
			int old;
			if (key != (old = Assembly.atomicCompareGetAndSet(key, 0, lp)))
			{
				// Another free took our lock??

				Assembly.breakpoint();
				
				// {@squirreljme.error SV0k Another free took the lock
				// from us?}
				throw new BootstrapMachineError("SV0k");
			}
		}
	}
	
	/**
	 * Frees the specified memory pointer, making it available for later use,
	 * without using a lock.
	 *
	 * @param __p The pointer to free.
	 * @since 2019/05/27
	 */
	public static final void freeWithoutLock(int __p)
	{
		// This should never happen
		if (__p == 0 || __p == Constants.BAD_MAGIC)
			Assembly.breakpoint();
		
		// Determine the seeker position for this chunk
		int seeker = __p - Allocator.CHUNK_LENGTH;
		
		// Read chunk properties
		int csz = Assembly.memReadInt(seeker, Allocator.CHUNK_SIZE_OFFSET),
			cnx = Assembly.memReadInt(seeker, Allocator.CHUNK_NEXT_OFFSET);
		
		// Actual logically used space
		int usedspace = (csz & Allocator.CHUNK_SIZE_MASK);
		
		// Clear out memory with invalid data, that is BAD_MAGIC
		int bm = Constants.BAD_MAGIC;
		Assembly.sysCallP(SystemCallIndex.MEM_SET_INT,
			__p, bm, usedspace - Allocator.CHUNK_LENGTH);
		if (Assembly.sysCallPV(SystemCallIndex.ERROR_GET,
			SystemCallIndex.MEM_SET_INT) != SystemCallError.NO_ERROR)
		{
			// Fast memsetint() is not supported, so manually wipe
			// all the bytes!
			for (int i = Allocator.CHUNK_LENGTH; i < usedspace; i += 4)
				Assembly.memWriteInt(seeker, i, bm);
		}
		
		// Make sure the reference count index is zero, to detect uncount
		// after free
		int rci = Allocator.CHUNK_LENGTH + Constants.OBJECT_COUNT_OFFSET;
		if (rci + 4 <= csz)
			Assembly.memWriteInt(seeker, rci, 0);
		
		// See if we can merge this with the following chunk
		if (cnx != 0)
		{
			// Get properties of the next chunk
			int nsz = Assembly.memReadInt(cnx, Allocator.CHUNK_SIZE_OFFSET),
				nnx = Assembly.memReadInt(cnx, Allocator.CHUNK_NEXT_OFFSET);
			
			// Free space? Merge into it!
			if ((nsz & Allocator.CHUNK_TAG_MASK) == Allocator.CHUNK_TAG_FREE)
			{
				// Calculate the would be new size
				int newsize = usedspace + (nsz & Allocator.CHUNK_SIZE_MASK);
				
				// Only merge chunks which are within the size limit, otherwise
				// a large portion of memory will not able to be reclaimed
				// because it would logically have a small size
				if (newsize <= Allocator.CHUNK_SIZE_LIMIT)
				{
					// New size of our current chunk
					Assembly.memWriteInt(seeker, Allocator.CHUNK_SIZE_OFFSET,
						newsize | Allocator.CHUNK_TAG_FREE);
					
					// Our chunk's next becomes the right side's next
					Assembly.memWriteInt(seeker, Allocator.CHUNK_NEXT_OFFSET,
						nnx);
					
					// Do not use normal free set
					return;
				}
			}
		}
		
		// Set chunk as free now, keep the original size
		Assembly.memWriteInt(seeker, Allocator.CHUNK_SIZE_OFFSET,
			csz | Allocator.CHUNK_TAG_FREE);
	}
	
	/**
	 * Claims the given block and returns it.
	 *
	 * @param __tag The tag to use, only 8-bits are used.
	 * @param __want The wanted size.
	 * @param __seeker The current chunk position.
	 * @param __csz The chunk size.
	 * @param __cnx The chunk next pointer.
	 * @return The allocation pointer.
	 * @since 2019/06/21
	 */
	private static final int __claim(int __tag, int __want, int __seeker,
		int __csz, int __cnx)
	{
		// Calculate free space in this chunk
		int freespace = (__csz & Allocator.CHUNK_SIZE_MASK);
		
		// This chunk will be split into a used and free chunk
		if (__want + Allocator.SPLIT_REQUIREMENT <= freespace)
		{
			// The size of the right side chunk is cut by our wanted
			// size
			int nextsize = freespace - __want;
			
			// The position of the next chunk
			int nextpos = __seeker + __want;
			
			// Setup new chunk
			Assembly.memWriteInt(__seeker, Allocator.CHUNK_SIZE_OFFSET,
				(__want & Allocator.CHUNK_SIZE_MASK) | (__tag << Allocator.CHUNK_TAG_SHIFT));
			Assembly.memWriteInt(__seeker, Allocator.CHUNK_NEXT_OFFSET,
				nextpos);
			
			// Setup the split chunk, points to the original next
			Assembly.memWriteInt(nextpos, Allocator.CHUNK_SIZE_OFFSET,
				(nextsize & Allocator.CHUNK_SIZE_MASK) | Allocator.CHUNK_TAG_FREE);
			Assembly.memWriteInt(nextpos, Allocator.CHUNK_NEXT_OFFSET,
				__cnx);
		}
		
		// Not being split, so the block gets claimed
		else
		{
			// Keep the originally passed size, but set the tag
			Assembly.memWriteInt(__seeker, Allocator.CHUNK_SIZE_OFFSET,
				freespace | (__tag << Allocator.CHUNK_TAG_SHIFT));
		}
		
		// The returning pointer
		int rv = __seeker + Allocator.CHUNK_LENGTH;
		
		// Clear out memory since Java expects the data to be
		// initialized to zero always
		Assembly.sysCallP(SystemCallIndex.MEM_SET,
			rv, 0, __want - Allocator.CHUNK_LENGTH);
		if (Assembly.sysCallPV(SystemCallIndex.ERROR_GET,
			SystemCallIndex.MEM_SET) != SystemCallError.NO_ERROR)
		{
			// Fast memset() is not supported, so manually wipe
			// all the bytes!
			for (int i = Allocator.CHUNK_LENGTH; i < __want; i += 4)
				Assembly.memWriteInt(__seeker, i, 0);
		}
		
		// Return the used pointer
		return rv;
	}
	
	/**
	 * Returns a locking key.
	 *
	 * @return The locking key.
	 * @since 2019/11/22
	 */
	static final int __giveLockKey()
	{
		Assembly.breakpoint();
		throw new Error("TODO");
		/*
		// Use the thread register so we know the thread that is performing
		// the allocation/free, but never allow it to be zero
		int rv = Assembly.specialGetThreadRegister();
		if (rv == 0)
			return 0x506F4C79;
		return rv;
		*/
	}
	
	/**
	 * Initializes the RAM links.
	 *
	 * @param __rambase The base of RAM.
	 * @param __ramsize The amount of RAM available.
	 * @since 2019/05/26
	 */
	static final void __initRamLinks(int __rambase, int __ramsize)
	{
		// Loops through all blocks
		for (int seeker = __rambase;;)
		{
			// Read current and next offset
			int csz = Assembly.memReadInt(seeker, Allocator.CHUNK_SIZE_OFFSET),
				cnx = Assembly.memReadInt(seeker, Allocator.CHUNK_NEXT_OFFSET);
			
			// Reached the terminator which has been initialized to zero by
			// the BootROM, so this block and whatever is left becomes free
			// allocation space
			if (csz == 0 || cnx == 0)
			{
				// Since there is an allocation limit of 16MiB, if there is
				// more than 16MiB of memory available then there will be the
				// problem of having one gigantic chunk that is too small, or
				// keeping total memory capped at 16MiB. So to avoid this,
				// this will create as many chunks as needed to fill the
				// remainder of memory!
				
				// Create chunks as big as possible across a span
				int sizeleft = __ramsize - seeker;
				while (sizeleft > 0)
				{
					// Determine how big this chunk becomes
					int usesize = (sizeleft > Allocator.CHUNK_SIZE_LIMIT ?
						Allocator.CHUNK_SIZE_LIMIT : sizeleft);
					
					// Reduce used size
					sizeleft -= usesize;
					
					// Create free block here
					Assembly.memWriteInt(seeker, Allocator.CHUNK_SIZE_OFFSET,
						usesize | Allocator.CHUNK_TAG_FREE);
					
					// Set pointer and seeker to the next block
					if (sizeleft > Allocator.SPLIT_REQUIREMENT)
					{
						// Where is this located?
						int nextp = seeker + usesize;
						
						// Write next block position
						Assembly.memWriteInt(seeker,
							Allocator.CHUNK_NEXT_OFFSET,
							nextp);
						
						// Go here next
						seeker = nextp;
					}
					
					// Too small to really be considered a block, so just
					// drop the next one
					else
					{
						// Always ensure the next block is zero!
						Assembly.memWriteInt(seeker,
							Allocator.CHUNK_NEXT_OFFSET,
							0);
						
						// Stop
						break;
					}
				}
				

Name change from runt/klib/supervisor/cc/squirreljme/jvm/Bootstrap.java to modules/cldc-compact/src/main/java/cc/squirreljme/jvm/boot/Bootstrap.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm;

import cc.squirreljme.jvm.lib.BootRom;
import cc.squirreljme.jvm.lib.BootRomLibrary;
import cc.squirreljme.jvm.task.Task;
import cc.squirreljme.jvm.task.TaskCreateResult;
import cc.squirreljme.jvm.task.TaskManager;
import cc.squirreljme.jvm.task.TaskSysCallHandler;
import cc.squirreljme.jvm.task.TaskThread;
import cc.squirreljme.jvm.task.ThreadManager;

/**
 * This is the bootstrap entry point for the supervisor.
 *
 * @since 2019/05/25
 */
public final class Bootstrap









|

|
|
|
|
|
|
|
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm.boot;

import cc.squirreljme.jvm.Assembly;
import cc.squirreljme.jvm.ConfigRomType;
import cc.squirreljme.jvm.SystemCallIndex;
import cc.squirreljme.jvm.boot.lib.BootRom;
import cc.squirreljme.jvm.boot.task.TaskCreateResult;
import cc.squirreljme.jvm.boot.task.TaskManager;
import cc.squirreljme.jvm.boot.task.TaskSysCallHandler;
import cc.squirreljme.jvm.boot.task.ThreadManager;

/**
 * This is the bootstrap entry point for the supervisor.
 *
 * @since 2019/05/25
 */
public final class Bootstrap
41
42
43
44
45
46
47

48
49
50
51
52
53
54
	 * @param __ramsize The size of RAM.
	 * @param __rombase Base address of the ROM (for offset calculation).
	 * @param __romsize The size of ROM.
	 * @param __confbase The configuration memory base.
	 * @param __confsize The configuration memory size.
	 * @since 2019/05/25
	 */

	static final void __start(int __rambase, int __ramsize,
		int __rombase, int __romsize, int __confbase, int __confsize)
	{
		// Initialize the RAM links to setup dirty bits and initialize the
		// last block of memory with anything that remains. This makes it so
		// the RAM is actually useable.
		Allocator.__initRamLinks(__rambase, __ramsize);







>







41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
	 * @param __ramsize The size of RAM.
	 * @param __rombase Base address of the ROM (for offset calculation).
	 * @param __romsize The size of ROM.
	 * @param __confbase The configuration memory base.
	 * @param __confsize The configuration memory size.
	 * @since 2019/05/25
	 */
	@SuppressWarnings("unused")
	static final void __start(int __rambase, int __ramsize,
		int __rombase, int __romsize, int __confbase, int __confsize)
	{
		// Initialize the RAM links to setup dirty bits and initialize the
		// last block of memory with anything that remains. This makes it so
		// the RAM is actually useable.
		Allocator.__initRamLinks(__rambase, __ramsize);
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
			todo.DEBUG.note("Main program finished execution, terminating!");
			Assembly.sysCallP(SystemCallIndex.EXIT, 0);
		}
		
		// It crashes
		catch (Throwable t)
		{
			// Put code in saying this happened
			todo.DEBUG.code('X', 'X');
			
			// Print the trace
			try
			{
				// Print stack trace for this class
				t.printStackTrace();
			}
			
			// Double fault?!?!?! SOMETHING IS VERY WRONG!
			catch (Throwable u)
			{
				// Show double fault info
				todo.DEBUG.code('D', 'F',
					Assembly.specialGetExceptionRegister());
				todo.DEBUG.code('x', 'T',
					Assembly.objectToPointer(t));
			}
			
			// Try to exit the VM
			Assembly.sysCallP(SystemCallIndex.EXIT, 1);
			
			// If that did not work, just break and return!
			Assembly.breakpoint();
			return;
		}
	}
}








<
<
<










|
<
<
<
<












107
108
109
110
111
112
113



114
115
116
117
118
119
120
121
122
123
124




125
126
127
128
129
130
131
132
133
134
135
136
			todo.DEBUG.note("Main program finished execution, terminating!");
			Assembly.sysCallP(SystemCallIndex.EXIT, 0);
		}
		
		// It crashes
		catch (Throwable t)
		{



			// Print the trace
			try
			{
				// Print stack trace for this class
				t.printStackTrace();
			}
			
			// Double fault?!?!?! SOMETHING IS VERY WRONG!
			catch (Throwable u)
			{
				// Ignore




			}
			
			// Try to exit the VM
			Assembly.sysCallP(SystemCallIndex.EXIT, 1);
			
			// If that did not work, just break and return!
			Assembly.breakpoint();
			return;
		}
	}
}

Added modules/cldc-compact/src/main/java/cc/squirreljme/jvm/boot/BootstrapMachineError.java.















































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm.boot;

/**
 * This is thrown when the bootstrap has errors.
 *
 * @since 2020/03/01
 */
public class BootstrapMachineError
	extends VirtualMachineError
{
	/**
	 * Initializes the exception with no message or cause.
	 *
	 * @since 2020/03/01
	 */
	public BootstrapMachineError()
	{
	}
	
	/**
	 * Initializes the exception with the given message and no cause.
	 *
	 * @param __m The message.
	 * @since 2020/03/01
	 */
	public BootstrapMachineError(String __m)
	{
		super(__m);
	}
}

Name change from runt/klib/supervisor/cc/squirreljme/jvm/ConfigReader.java to modules/cldc-compact/src/main/java/cc/squirreljme/jvm/boot/ConfigReader.java.

1
2
3
4
5
6
7
8
9
10





11
12
13
14
15
16
17
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm;






/**
 * This is a helper class used to read the configuration.
 *
 * @since 2019/06/22
 */
public final class ConfigReader









|
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm.boot;

import cc.squirreljme.jvm.Assembly;
import cc.squirreljme.jvm.ConfigRomType;
import cc.squirreljme.jvm.Constants;
import cc.squirreljme.jvm.JVMFunction;

/**
 * This is a helper class used to read the configuration.
 *
 * @since 2019/06/22
 */
public final class ConfigReader

Added modules/cldc-compact/src/main/java/cc/squirreljme/jvm/boot/Globals.java.



































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm.boot;

import cc.squirreljme.jvm.boot.task.TaskManager;
import cc.squirreljme.jvm.boot.task.ThreadManager;

/**
 * This class contains all of the globals which are used by the supervisor.
 *
 * @since 2019/10/06
 */
public final class Globals
{
	/** Manager for tasks. */
	private static TaskManager _TASK_MANAGER;
	
	/** The thread manager. */
	private static ThreadManager _THREAD_MANAGER;
	
	/**
	 * Not used.
	 *
	 * @since 2019/10/06
	 */
	private Globals()
	{
	}
	
	/**
	 * Gets the task manager.
	 *
	 * @return The task manager.
	 * @since 2019/10/06
	 */
	public static final TaskManager getTaskManager()
	{
		TaskManager rv = Globals._TASK_MANAGER;
		if (rv == null)
			Globals._TASK_MANAGER = (rv = new TaskManager());
		return rv;
	}
	
	/**
	 * Gets the thread manager.
	 *
	 * @return The thread manager.
	 * @since 2019/10/13
	 */
	public static final ThreadManager getThreadManager()
	{
		ThreadManager rv = Globals._THREAD_MANAGER;
		if (rv == null)
			Globals._THREAD_MANAGER = (rv = new ThreadManager());
		return rv;
	}
}

Name change from runt/klib/supervisor/cc/squirreljme/jvm/io/BinaryBlob.java to modules/cldc-compact/src/main/java/cc/squirreljme/jvm/boot/io/BinaryBlob.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm.io;

/**
 * This is a binary blob which provides memory and I/O access.
 *
 * Sub-classes only need to implement reading of a single byte, however
 * implementing the other methods will result in faster code.
 *









|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm.boot.io;

/**
 * This is a binary blob which provides memory and I/O access.
 *
 * Sub-classes only need to implement reading of a single byte, however
 * implementing the other methods will result in faster code.
 *

Name change from runt/klib/supervisor/cc/squirreljme/jvm/io/MemoryBlob.java to modules/cldc-compact/src/main/java/cc/squirreljme/jvm/boot/io/MemoryBlob.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm.io;

import cc.squirreljme.jvm.Assembly;

/**
 * This is a blob of data which is sourced from memory.
 *
 * @since 2019/09/22









|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm.boot.io;

import cc.squirreljme.jvm.Assembly;

/**
 * This is a blob of data which is sourced from memory.
 *
 * @since 2019/09/22

Name change from runt/klib/supervisor/cc/squirreljme/jvm/io/package-info.java to modules/cldc-compact/src/main/java/cc/squirreljme/jvm/boot/io/package-info.java.

9
10
11
12
13
14
15
16
17

/**
 * This package contains extra utilities for input/output.
 *
 * @since 2019/09/22
 */

package cc.squirreljme.jvm.io;








|

9
10
11
12
13
14
15
16
17

/**
 * This package contains extra utilities for input/output.
 *
 * @since 2019/09/22
 */

package cc.squirreljme.jvm.boot.io;

Name change from runt/klib/supervisor/cc/squirreljme/jvm/lib/AbstractPoolParser.java to modules/cldc-compact/src/main/java/cc/squirreljme/jvm/boot/lib/AbstractPoolParser.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm.lib;

import cc.squirreljme.jvm.io.BinaryBlob;

/**
 * This is the base class for a pool parser.
 *
 * @since 2019/10/13
 */
public abstract class AbstractPoolParser









|

|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm.boot.lib;

import cc.squirreljme.jvm.boot.io.BinaryBlob;

/**
 * This is the base class for a pool parser.
 *
 * @since 2019/10/13
 */
public abstract class AbstractPoolParser

Name change from runt/klib/supervisor/cc/squirreljme/jvm/lib/AliasedPoolParser.java to modules/cldc-compact/src/main/java/cc/squirreljme/jvm/boot/lib/AliasedPoolParser.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm.lib;

import cc.squirreljme.jvm.io.BinaryBlob;

/**
 * This class is used to provide access to the aliased pool where entries are.
 *
 * @since 2019/10/13
 */
public final class AliasedPoolParser









|

|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm.boot.lib;

import cc.squirreljme.jvm.boot.io.BinaryBlob;

/**
 * This class is used to provide access to the aliased pool where entries are.
 *
 * @since 2019/10/13
 */
public final class AliasedPoolParser

Name change from runt/klib/supervisor/cc/squirreljme/jvm/lib/BootRom.java to modules/cldc-compact/src/main/java/cc/squirreljme/jvm/boot/lib/BootRom.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm.lib;

import cc.squirreljme.jvm.Assembly;
import cc.squirreljme.jvm.ConfigReader;
import cc.squirreljme.jvm.ConfigRomType;
import cc.squirreljme.jvm.JVMFunction;

/**
 * This contains boot ROM information.
 *
 * @since 2019/06/23









|


|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm.boot.lib;

import cc.squirreljme.jvm.Assembly;
import cc.squirreljme.jvm.boot.ConfigReader;
import cc.squirreljme.jvm.ConfigRomType;
import cc.squirreljme.jvm.JVMFunction;

/**
 * This contains boot ROM information.
 *
 * @since 2019/06/23
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
		else
		{
			// Debug
			todo.DEBUG.note("Using firmware class path!");
			
			// Get offset to the table and its length
			int icpoff = __rombase + Assembly.memReadJavaInt(__rombase,
					ROM_BOOTICPOFFSET_OFFSET),
				icpsize = Assembly.memReadJavaInt(__rombase,
					ROM_BOOTICPSIZE_OFFSET);
			
			// Read all of them
			usecp = new ClassLibrary[icpsize];
			for (int i = 0; i < icpsize; i++)
				usecp[i] = bootlibs[Assembly.memReadJavaInt(icpoff,
					i * 4)];
		}







|

|







153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
		else
		{
			// Debug
			todo.DEBUG.note("Using firmware class path!");
			
			// Get offset to the table and its length
			int icpoff = __rombase + Assembly.memReadJavaInt(__rombase,
				BootRom.ROM_BOOTICPOFFSET_OFFSET),
				icpsize = Assembly.memReadJavaInt(__rombase,
					BootRom.ROM_BOOTICPSIZE_OFFSET);
			
			// Read all of them
			usecp = new ClassLibrary[icpsize];
			for (int i = 0; i < icpsize; i++)
				usecp[i] = bootlibs[Assembly.memReadJavaInt(icpoff,
					i * 4)];
		}
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213

214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231

232
233
234

235
236
237
238
239
240
241
242
243
244
245
246
247

248
249
250

251
252
253
254
255
256
257
258
259
260
261
262

263

264
265
266

267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
	{
		// Get from configuration first
		int rv = __config.loadInteger(ConfigRomType.IS_MIDLET);
		if (rv != 0)
			return (rv > 0);
		
		return Assembly.memReadJavaInt(
			__rombase, ROM_BOOTMAINMIDLET_OFFSET) > 0;
	}
	
	/**
	 * Returns the initial main class.
	 *
	 * @param __rombase The base of the ROM.
	 * @param __config The configuration to use.
	 * @return The initial main class.
	 * @since 2019/06/23
	 */
	public static final String initialMain(int __rombase,
		ConfigReader __config)
	{
		// Use main user class
		String usermain = __config.loadString(ConfigRomType.MAIN_CLASS);
		if (usermain != null)
			return usermain;
		
		// Otherwise read it from the boot ROM
		return JVMFunction.jvmLoadString(__rombase +
			Assembly.memReadJavaInt(__rombase, ROM_BOOTMAINCLASS_OFFSET));

	}
	
	/**
	 * Returns all of the libraries which are available to the bootstrap.
	 *
	 * @param __rombase The ROM base.
	 * @return The available bootstrap libraries.
	 * @since 2019/06/14
	 */
	public static final BootRomLibrary[] bootLibraries(int __rombase)
	{
		// Already exists?
		BootRomLibrary[] bootlibs = BOOT_LIBRARIES;
		if (bootlibs != null)
			return bootlibs;
		
		// Number of JARs in the ROM
		int numjars = Assembly.memReadJavaInt(__rombase, ROM_NUMJARS_OFFSET);

		
		// Offset to table of contents
		int tocoff = Assembly.memReadJavaInt(__rombase, ROM_TOCOFFSET_OFFSET);

		
		// Debug
		todo.DEBUG.note("Scanning %d libraries...", numjars);
		
		// Seeker for the table of contents
		int seeker = __rombase + tocoff;
		
		// This is used to contain the constant pool data offset and size which
		// is then used when we initialize classes
		BootRomPoolInfo brpi = new BootRomPoolInfo(
			__rombase + Assembly.memReadJavaInt(__rombase,
				ROM_STATICPOOLOFF_OFFSET),
			Assembly.memReadJavaInt(__rombase, ROM_STATICPOOLSIZE_OFFSET),

			__rombase + Assembly.memReadJavaInt(__rombase,
				ROM_RUNTIMEPOOLOFF_OFFSET),
			Assembly.memReadJavaInt(__rombase, ROM_RUNTIMEPOOLSIZE_OFFSET));

		
		// Load all the JAR informations
		bootlibs = new BootRomLibrary[numjars];
		for (int i = 0; i < numjars; i++)
		{
			// Manifest address is optional
			int ma = Assembly.memReadJavaInt(seeker,
				TOC_MANIFEST_LENGTH_OFFSET);
			
			// Load library info
			BootRomLibrary bl = new BootRomLibrary(JVMFunction.jvmLoadString(
				__rombase + Assembly.memReadJavaInt(seeker, TOC_NAME_OFFSET)),

				__rombase + Assembly.memReadJavaInt(seeker, TOC_JAR_OFFSET),

				Assembly.memReadJavaInt(seeker, TOC_JARLEN_OFFSET),
				(ma == 0 ? 0 : __rombase + ma),
				Assembly.memReadJavaInt(seeker, TOC_MANIFEST_LENGTH_OFFSET),

				brpi);
			
			// Store it
			bootlibs[i] = bl;
			
			// Go to the next entry
			seeker += TOC_ENTRY_SIZE;
		}
		
		// Store for later usage
		BOOT_LIBRARIES = bootlibs;
		
		// Debug
		todo.DEBUG.note("Okay.");
		
		// Return the libraries
		return bootlibs;
	}
}








|




















|
>












|




|
>


|
>











|
|
>

|
|
>







|



|
>
|
>
|

|
>






|



|









185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
	{
		// Get from configuration first
		int rv = __config.loadInteger(ConfigRomType.IS_MIDLET);
		if (rv != 0)
			return (rv > 0);
		
		return Assembly.memReadJavaInt(
			__rombase, BootRom.ROM_BOOTMAINMIDLET_OFFSET) > 0;
	}
	
	/**
	 * Returns the initial main class.
	 *
	 * @param __rombase The base of the ROM.
	 * @param __config The configuration to use.
	 * @return The initial main class.
	 * @since 2019/06/23
	 */
	public static final String initialMain(int __rombase,
		ConfigReader __config)
	{
		// Use main user class
		String usermain = __config.loadString(ConfigRomType.MAIN_CLASS);
		if (usermain != null)
			return usermain;
		
		// Otherwise read it from the boot ROM
		return JVMFunction.jvmLoadString(__rombase +
			Assembly.memReadJavaInt(__rombase,
				BootRom.ROM_BOOTMAINCLASS_OFFSET));
	}
	
	/**
	 * Returns all of the libraries which are available to the bootstrap.
	 *
	 * @param __rombase The ROM base.
	 * @return The available bootstrap libraries.
	 * @since 2019/06/14
	 */
	public static final BootRomLibrary[] bootLibraries(int __rombase)
	{
		// Already exists?
		BootRomLibrary[] bootlibs = BootRom.BOOT_LIBRARIES;
		if (bootlibs != null)
			return bootlibs;
		
		// Number of JARs in the ROM
		int numjars = Assembly.memReadJavaInt(__rombase,
			BootRom.ROM_NUMJARS_OFFSET);
		
		// Offset to table of contents
		int tocoff = Assembly.memReadJavaInt(__rombase,
			BootRom.ROM_TOCOFFSET_OFFSET);
		
		// Debug
		todo.DEBUG.note("Scanning %d libraries...", numjars);
		
		// Seeker for the table of contents
		int seeker = __rombase + tocoff;
		
		// This is used to contain the constant pool data offset and size which
		// is then used when we initialize classes
		BootRomPoolInfo brpi = new BootRomPoolInfo(
			__rombase + Assembly.memReadJavaInt(__rombase,
				BootRom.ROM_STATICPOOLOFF_OFFSET),
			Assembly.memReadJavaInt(__rombase,
				BootRom.ROM_STATICPOOLSIZE_OFFSET),
			__rombase + Assembly.memReadJavaInt(__rombase,
				BootRom.ROM_RUNTIMEPOOLOFF_OFFSET),
			Assembly.memReadJavaInt(__rombase,
				BootRom.ROM_RUNTIMEPOOLSIZE_OFFSET));
		
		// Load all the JAR informations
		bootlibs = new BootRomLibrary[numjars];
		for (int i = 0; i < numjars; i++)
		{
			// Manifest address is optional
			int ma = Assembly.memReadJavaInt(seeker,
				BootRom.TOC_MANIFEST_LENGTH_OFFSET);
			
			// Load library info
			BootRomLibrary bl = new BootRomLibrary(JVMFunction.jvmLoadString(
				__rombase + Assembly.memReadJavaInt(seeker,
					BootRom.TOC_NAME_OFFSET)),
				__rombase + Assembly.memReadJavaInt(seeker,
					BootRom.TOC_JAR_OFFSET),
				Assembly.memReadJavaInt(seeker, BootRom.TOC_JARLEN_OFFSET),
				(ma == 0 ? 0 : __rombase + ma),
				Assembly.memReadJavaInt(seeker,
					BootRom.TOC_MANIFEST_LENGTH_OFFSET),
				brpi);
			
			// Store it
			bootlibs[i] = bl;
			
			// Go to the next entry
			seeker += BootRom.TOC_ENTRY_SIZE;
		}
		
		// Store for later usage
		BootRom.BOOT_LIBRARIES = bootlibs;
		
		// Debug
		todo.DEBUG.note("Okay.");
		
		// Return the libraries
		return bootlibs;
	}
}

Name change from runt/klib/supervisor/cc/squirreljme/jvm/lib/BootRomLibrary.java to modules/cldc-compact/src/main/java/cc/squirreljme/jvm/boot/lib/BootRomLibrary.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm.lib;

import cc.squirreljme.jvm.Assembly;
import cc.squirreljme.jvm.io.BinaryBlob;
import cc.squirreljme.jvm.io.MemoryBlob;
import cc.squirreljme.jvm.JVMFunction;

/**
 * This represents a single boot library.
 *
 * @since 2019/06/14
 */
public final class BootRomLibrary









|


|
|
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm.boot.lib;

import cc.squirreljme.jvm.Assembly;
import cc.squirreljme.jvm.JVMFunction;
import cc.squirreljme.jvm.boot.io.BinaryBlob;
import cc.squirreljme.jvm.boot.io.MemoryBlob;

/**
 * This represents a single boot library.
 *
 * @since 2019/06/14
 */
public final class BootRomLibrary
179
180
181
182
183
184
185
186

187

188
189
190
191

192
193
194
195
196

197
198
199
200
201
202
203
			throw new NullPointerException("NARG");
		
		// Hash code for this string
		int hash = __name.hashCode();
		
		// Scan through the table of contents
		int bp = this.address,
			sp = bp + Assembly.memReadJavaInt(bp, JAR_TOC_OFFSET_OFFSET);

		for (int i = 0, n = Assembly.memReadJavaInt(bp, JAR_NUMRC_OFFSET); i < n;

			i++, sp += TOC_ENTRY_SIZE)
		{
			// Hash code does not match
			if (hash != Assembly.memReadJavaInt(sp, TOC_HASHCODE_OFFSET))

				continue;
			
			// Is at this index
			if (__name.equals(JVMFunction.jvmLoadString(
				bp + Assembly.memReadJavaInt(sp, TOC_NAME_OFFSET))))

				return i;
		}
		
		// Not found
		return -1;
	}
	







|
>
|
>
|


|
>




|
>







179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
			throw new NullPointerException("NARG");
		
		// Hash code for this string
		int hash = __name.hashCode();
		
		// Scan through the table of contents
		int bp = this.address,
			sp = bp + Assembly.memReadJavaInt(bp,
				BootRomLibrary.JAR_TOC_OFFSET_OFFSET);
		for (int i = 0, n = Assembly.memReadJavaInt(bp,
			BootRomLibrary.JAR_NUMRC_OFFSET); i < n;
			 i++, sp += BootRomLibrary.TOC_ENTRY_SIZE)
		{
			// Hash code does not match
			if (hash != Assembly.memReadJavaInt(sp,
				BootRomLibrary.TOC_HASHCODE_OFFSET))
				continue;
			
			// Is at this index
			if (__name.equals(JVMFunction.jvmLoadString(
				bp + Assembly.memReadJavaInt(sp,
					BootRomLibrary.TOC_NAME_OFFSET))))
				return i;
		}
		
		// Not found
		return -1;
	}
	
220
221
222
223
224
225
226
227

228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
		throws IndexOutOfBoundsException
	{
		// Get base address of the library
		int bp = this.address;
		
		// {@squirreljme.error SV07 Attempt to access resource which was not
		// in range of the boot library.}
		if (__dx < 0 || __dx >= Assembly.memReadJavaInt(bp, JAR_NUMRC_OFFSET))

			throw new IndexOutOfBoundsException("SV07");
		
		// Read from the table of contents, the offset to the data.
		int tocoffset = bp + Assembly.memReadJavaInt(bp,
			JAR_TOC_OFFSET_OFFSET);
		return new MemoryBlob(bp + Assembly.memReadJavaInt(tocoffset,
				(TOC_ENTRY_SIZE * __dx) + TOC_DATA_OFFSET),
			Assembly.memReadJavaInt(tocoffset,
				(TOC_ENTRY_SIZE * __dx) + TOC_SIZE_OFFSET));
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2019/11/18
	 */
	@Override
	public AbstractPoolParser splitPool(boolean __rt)
	{
		BinaryBlob blob = this.blob;
		
		// Static
		int jpo, jps;
		if (__rt)
		{
			jpo = blob.readJavaInt(JAR_RUNTIMEPOOLOFF_OFFSET);
			jps = blob.readJavaInt(JAR_RUNTIMEPOOLSIZE_OFFSET);
		}
		
		// Run-time
		else
		{
			jpo = blob.readJavaInt(JAR_STATICPOOLOFF_OFFSET);
			jps = blob.readJavaInt(JAR_STATICPOOLSIZE_OFFSET);
		}
		
		// This JAR has a pool in it
		AbstractPoolParser rv;
		if (jpo >= 0 && jps >= 0)
			rv = new ClassPoolParser(blob.subSection(jpo, jps));
		







|
>




|

|

|















|
|





|
|







224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
		throws IndexOutOfBoundsException
	{
		// Get base address of the library
		int bp = this.address;
		
		// {@squirreljme.error SV07 Attempt to access resource which was not
		// in range of the boot library.}
		if (__dx < 0 || __dx >= Assembly.memReadJavaInt(bp,
			BootRomLibrary.JAR_NUMRC_OFFSET))
			throw new IndexOutOfBoundsException("SV07");
		
		// Read from the table of contents, the offset to the data.
		int tocoffset = bp + Assembly.memReadJavaInt(bp,
			BootRomLibrary.JAR_TOC_OFFSET_OFFSET);
		return new MemoryBlob(bp + Assembly.memReadJavaInt(tocoffset,
				(BootRomLibrary.TOC_ENTRY_SIZE * __dx) + BootRomLibrary.TOC_DATA_OFFSET),
			Assembly.memReadJavaInt(tocoffset,
				(BootRomLibrary.TOC_ENTRY_SIZE * __dx) + BootRomLibrary.TOC_SIZE_OFFSET));
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2019/11/18
	 */
	@Override
	public AbstractPoolParser splitPool(boolean __rt)
	{
		BinaryBlob blob = this.blob;
		
		// Static
		int jpo, jps;
		if (__rt)
		{
			jpo = blob.readJavaInt(BootRomLibrary.JAR_RUNTIMEPOOLOFF_OFFSET);
			jps = blob.readJavaInt(BootRomLibrary.JAR_RUNTIMEPOOLSIZE_OFFSET);
		}
		
		// Run-time
		else
		{
			jpo = blob.readJavaInt(BootRomLibrary.JAR_STATICPOOLOFF_OFFSET);
			jps = blob.readJavaInt(BootRomLibrary.JAR_STATICPOOLSIZE_OFFSET);
		}
		
		// This JAR has a pool in it
		AbstractPoolParser rv;
		if (jpo >= 0 && jps >= 0)
			rv = new ClassPoolParser(blob.subSection(jpo, jps));
		

Name change from runt/klib/supervisor/cc/squirreljme/jvm/lib/BootRomPoolInfo.java to modules/cldc-compact/src/main/java/cc/squirreljme/jvm/boot/lib/BootRomPoolInfo.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm.lib;

/**
 * This class contains the information on the boot pool addresses.
 *
 * @since 2019/11/17
 */
public final class BootRomPoolInfo









|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm.boot.lib;

/**
 * This class contains the information on the boot pool addresses.
 *
 * @since 2019/11/17
 */
public final class BootRomPoolInfo

Name change from runt/klib/supervisor/cc/squirreljme/jvm/lib/ClassDualPoolParser.java to modules/cldc-compact/src/main/java/cc/squirreljme/jvm/boot/lib/ClassDualPoolParser.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm.lib;

import cc.squirreljme.jvm.Assembly;
import cc.squirreljme.jvm.io.BinaryBlob;

/**
 * This class manages the parsing of the standard individual constant pools
 * to the combined run-time and static dual-pool setup.
 *
 * @see ClassPoolParser
 * @since 2019/10/12









|

|
<







1
2
3
4
5
6
7
8
9
10
11
12

13
14
15
16
17
18
19
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm.boot.lib;

import cc.squirreljme.jvm.boot.io.BinaryBlob;


/**
 * This class manages the parsing of the standard individual constant pools
 * to the combined run-time and static dual-pool setup.
 *
 * @see ClassPoolParser
 * @since 2019/10/12

Name change from runt/klib/supervisor/cc/squirreljme/jvm/lib/ClassFieldsParser.java to modules/cldc-compact/src/main/java/cc/squirreljme/jvm/boot/lib/ClassFieldsParser.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm.lib;

import cc.squirreljme.jvm.io.BinaryBlob;

/**
 * This class is used to parse the fields of a class.
 *
 * @since 2019/11/17
 */
public final class ClassFieldsParser









|

|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm.boot.lib;

import cc.squirreljme.jvm.boot.io.BinaryBlob;

/**
 * This class is used to parse the fields of a class.
 *
 * @since 2019/11/17
 */
public final class ClassFieldsParser
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
	 * @throws IndexOutOfBoundsException If the index is not within bounds.
	 * @throws InvalidClassFormatException If the class is not valid.
	 * @since 2019/11/24
	 */
	public final int flags(int __dx)
		throws IndexOutOfBoundsException, InvalidClassFormatException
	{
		return this.blob.readJavaInt(this.tocOffset(__dx) +
			FLAGS_INT_OFFSET);
	}
	
	/**
	 * Returns the name of the field.
	 *
	 * @param __dx The index of the field.
	 * @return The name of the field.
	 * @throws IndexOutOfBoundsException If the index is not within bounds.
	 * @throws InvalidClassFormatException If the class is not valid.
	 * @since 2019/11/24
	 */
	public final String name(int __dx)
		throws IndexOutOfBoundsException, InvalidClassFormatException
	{
		return this.pool.entryAsString(false, this.blob.readJavaUnsignedShort(
			this.tocOffset(__dx) + NAME_USHORT_OFFSET));
	}
	
	/**
	 * Returns the offset for the field.
	 *
	 * @param __dx The index of the field.
	 * @return The field offset.
	 * @throws IndexOutOfBoundsException If the index is not within bounds.
	 * @throws InvalidClassFormatException If the class is not valid.
	 * @since 2019/11/24
	 */
	public final int offset(int __dx)
		throws IndexOutOfBoundsException, InvalidClassFormatException
	{
		return this.blob.readJavaUnsignedShort(this.tocOffset(__dx) +
			OFFSET_USHORT_OFFSET);
	}
	
	/**
	 * Returns the size for the field.
	 *
	 * @param __dx The index of the field.
	 * @return The size offset.
	 * @throws IndexOutOfBoundsException If the index is not within bounds.
	 * @throws InvalidClassFormatException If the class is not valid.
	 * @since 2019/11/24
	 */
	public final int size(int __dx)
		throws IndexOutOfBoundsException, InvalidClassFormatException
	{
		return this.blob.readJavaUnsignedShort(this.tocOffset(__dx) +
			SIZE_USHORT_OFFSET);
	}
	
	/**
	 * Index of the entry in the table of contents.
	 *
	 * @param __dx The index.
	 * @return The table of contents offset.
	 * @throws IndexOutOfBoundsException If the index is not within bounds.
	 * @throws InvalidClassFormatException If the class is not valid.
	 * @since 2019/11/24
	 */
	public final int tocOffset(int __dx)
		throws IndexOutOfBoundsException, InvalidClassFormatException
	{
		if (__dx < 0 || __dx > this.count)
			throw new IndexOutOfBoundsException("IOOB");
		
		return __dx * ENTRY_SIZE;
	}
	
	/**
	 * Returns the type of the field.
	 *
	 * @param __dx The index of the field.
	 * @return The type of the field.
	 * @throws IndexOutOfBoundsException If the index is not within bounds.
	 * @throws InvalidClassFormatException If the class is not valid.
	 * @since 2019/11/25
	 */
	public final PoolClassName type(int __dx)
		throws IndexOutOfBoundsException, InvalidClassFormatException
	{
		return this.pool.entryAsClassName(false,
			this.blob.readJavaUnsignedShort(this.tocOffset(__dx) +
				TYPE_USHORT_OFFSET));
	}
}








|
<















|














|
<














|
<

















|















|
<



98
99
100
101
102
103
104
105

106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136

137
138
139
140
141
142
143
144
145
146
147
148
149
150
151

152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185

186
187
188
	 * @throws IndexOutOfBoundsException If the index is not within bounds.
	 * @throws InvalidClassFormatException If the class is not valid.
	 * @since 2019/11/24
	 */
	public final int flags(int __dx)
		throws IndexOutOfBoundsException, InvalidClassFormatException
	{
		return this.blob.readJavaInt(this.tocOffset(__dx) + ClassFieldsParser.FLAGS_INT_OFFSET);

	}
	
	/**
	 * Returns the name of the field.
	 *
	 * @param __dx The index of the field.
	 * @return The name of the field.
	 * @throws IndexOutOfBoundsException If the index is not within bounds.
	 * @throws InvalidClassFormatException If the class is not valid.
	 * @since 2019/11/24
	 */
	public final String name(int __dx)
		throws IndexOutOfBoundsException, InvalidClassFormatException
	{
		return this.pool.entryAsString(false, this.blob.readJavaUnsignedShort(
			this.tocOffset(__dx) + ClassFieldsParser.NAME_USHORT_OFFSET));
	}
	
	/**
	 * Returns the offset for the field.
	 *
	 * @param __dx The index of the field.
	 * @return The field offset.
	 * @throws IndexOutOfBoundsException If the index is not within bounds.
	 * @throws InvalidClassFormatException If the class is not valid.
	 * @since 2019/11/24
	 */
	public final int offset(int __dx)
		throws IndexOutOfBoundsException, InvalidClassFormatException
	{
		return this.blob.readJavaUnsignedShort(this.tocOffset(__dx) + ClassFieldsParser.OFFSET_USHORT_OFFSET);

	}
	
	/**
	 * Returns the size for the field.
	 *
	 * @param __dx The index of the field.
	 * @return The size offset.
	 * @throws IndexOutOfBoundsException If the index is not within bounds.
	 * @throws InvalidClassFormatException If the class is not valid.
	 * @since 2019/11/24
	 */
	public final int size(int __dx)
		throws IndexOutOfBoundsException, InvalidClassFormatException
	{
		return this.blob.readJavaUnsignedShort(this.tocOffset(__dx) + ClassFieldsParser.SIZE_USHORT_OFFSET);

	}
	
	/**
	 * Index of the entry in the table of contents.
	 *
	 * @param __dx The index.
	 * @return The table of contents offset.
	 * @throws IndexOutOfBoundsException If the index is not within bounds.
	 * @throws InvalidClassFormatException If the class is not valid.
	 * @since 2019/11/24
	 */
	public final int tocOffset(int __dx)
		throws IndexOutOfBoundsException, InvalidClassFormatException
	{
		if (__dx < 0 || __dx > this.count)
			throw new IndexOutOfBoundsException("IOOB");
		
		return __dx * ClassFieldsParser.ENTRY_SIZE;
	}
	
	/**
	 * Returns the type of the field.
	 *
	 * @param __dx The index of the field.
	 * @return The type of the field.
	 * @throws IndexOutOfBoundsException If the index is not within bounds.
	 * @throws InvalidClassFormatException If the class is not valid.
	 * @since 2019/11/25
	 */
	public final PoolClassName type(int __dx)
		throws IndexOutOfBoundsException, InvalidClassFormatException
	{
		return this.pool.entryAsClassName(false,
			this.blob.readJavaUnsignedShort(this.tocOffset(__dx) + ClassFieldsParser.TYPE_USHORT_OFFSET));

	}
}

Name change from runt/klib/supervisor/cc/squirreljme/jvm/lib/ClassFileConstants.java to modules/cldc-compact/src/main/java/cc/squirreljme/jvm/boot/lib/ClassFileConstants.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm.lib;

/**
 * This interface defines all of the class file constants which is used to
 * remove the usages of magic numbers.
 *
 * @since 2019/10/12
 */
public interface ClassFileConstants
{
	/** The magic number for the header. */
	public static final int MAGIC_NUMBER =
		0x00586572;
	
	/** Magic number for the end of file. */
	public static final int END_MAGIC_NUMBER =
		0x42796521;
	
	/** The size of the header without the magic number. */
	public static final byte HEADER_SIZE_WITHOUT_MAGIC =
		108;
	
	/** The size of the header with the magic number. */
	public static final byte HEADER_SIZE_WITH_MAGIC =
		112;
		
	/** Unused A. */
	public static final byte OFFSET_OF_USHORT_UNUSEDA =
		4;
	
	/** The index of the method which is __start. */
	public static final byte OFFSET_OF_UBYTE_STARTMETHODINDEX =
		6;
	
	/** The data type of the class. */
	public static final byte OFFSET_OF_UBYTE_DATATYPE =
		7;
	
	/** Not used. */
	public static final byte OFFSET_OF_USHORT_UNUSEDB =
		8;
	
	/** Class flags. */
	public static final byte OFFSET_OF_INT_CLASSFLAGS =
		10;
	
	/** Name of class. */
	public static final byte OFFSET_OF_USHORT_CLASSNAME =
		14;
	
	/** Super class name. */
	public static final byte OFFSET_OF_USHORT_CLASSSUPER =
		16;
	
	/** Interfaces in class. */
	public static final byte OFFSET_OF_USHORT_CLASSINTS =
		18;
	
	/** Class type. */
	public static final byte OFFSET_OF_UBYTE_CLASSTYPE =
		20;
	
	/** Class version. */
	public static final byte OFFSET_OF_UBYTE_CLASSVERS =
		21;
	
	/** Class source filename. */
	public static final byte OFFSET_OF_USHORT_CLASSSFN =
		22;
	
	/** Static field count. */
	public static final byte OFFSET_OF_USHORT_SFCOUNT =
		24;
	
	/** Static field bytes. */
	public static final byte OFFSET_OF_USHORT_SFBYTES =
		26;
	
	/** Static field objects. */
	public static final byte OFFSET_OF_USHORT_SFOBJS =
		28;
	
	/** Instance field count. */
	public static final byte OFFSET_OF_USHORT_IFCOUNT =
		30;
	
	/** Instance field bytes. */
	public static final byte OFFSET_OF_USHORT_IFBYTES =
		32;
	
	/** Instance field objects. */
	public static final byte OFFSET_OF_USHORT_IFOBJS =
		34;
	
	/** Static method count. */
	public static final byte OFFSET_OF_USHORT_SMCOUNT =
		36;
	
	/** Instance method count. */
	public static final byte OFFSET_OF_USHORT_IMCOUNT =
		38;
	
	/** Not used. */
	public static final byte OFFSET_OF_INT_UNUSEDC =
		40;
	
	/** Not used. */
	public static final byte OFFSET_OF_INT_UNUSEDD =
		44;
	
	/** Static field data offset. */
	public static final byte OFFSET_OF_INT_SFOFF =
		48;
	
	/** Static field data size. */
	public static final byte OFFSET_OF_INT_SFSIZE =
		52;
	
	/** Interface field data offset. */
	public static final byte OFFSET_OF_INT_IFOFF =
		56;
	
	/** Interface field data size. */
	public static final byte OFFSET_OF_INT_IFSIZE =
		60;
	
	/** Static method data offset. */
	public static final byte OFFSET_OF_INT_SMOFF =
		64;
	
	/** Static method data size. */
	public static final byte OFFSET_OF_INT_SMSIZE =
		68;
	
	/** Instance method data offset. */
	public static final byte OFFSET_OF_INT_IMOFF =
		72;
	
	/** Instance method data size. */
	public static final byte OFFSET_OF_INT_IMSIZE =
		76;
	
	/** High bits for UUID. */
	public static final byte OFFSET_OF_INT_UUIDHI =
		80;
	
	/** Low bits for UUID. */
	public static final byte OFFSET_OF_INT_UUIDLO =
		84;
	
	/** File size. */
	public static final byte OFFSET_OF_INT_FILESIZE =
		88;
	
	/** Not used. */
	public static final byte OFFSET_OF_INT_UNUSEDE =
		92;
	
	/** Static constant pool offset. */
	public static final byte OFFSET_OF_INT_STATICPOOLOFF =
		96;
	
	/** Static constant pool size. */
	public static final byte OFFSET_OF_INT_STATICPOOLSIZE =
		100;
	
	/** Runtime constant pool offset. */
	public static final byte OFFSET_OF_INT_RUNTIMEPOOLOFF =
		104;
	
	/** Runtime constant pool size. */
	public static final byte OFFSET_OF_INT_RUNTIMEPOOLSIZE =
		108;
	
	/** Public class. */
	public static final short FLAG_PUBLIC =
		0x0001;
	
	/** Final class. */
	public static final short FLAG_FINAL =
		0x0010;
	
	/** Super class. */
	public static final short FLAG_SUPER =
		0x0020;
	
	/** Interface class. */
	public static final short FLAG_INTERFACE =
		0x0200;
	
	/** Abstract. */
	public static final short FLAG_ABSTRACT =
		0x0400;
	
	/** Synthetic. */
	public static final short FLAG_SYNTHETIC =
		0x1000;
	
	/** Annotation. */
	public static final short FLAG_ANNOTATION =
		0x2000;
	
	/** Enum. */
	public static final short FLAG_ENUM =
		0x4000;
}










|










|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm.boot.lib;

/**
 * This interface defines all of the class file constants which is used to
 * remove the usages of magic numbers.
 *
 * @since 2019/10/12
 */
public interface ClassFileConstants
{
	/** The magic number for the header. */
	int MAGIC_NUMBER =
		0x00586572;
	
	/** Magic number for the end of file. */
	int END_MAGIC_NUMBER =
		0x42796521;
	
	/** The size of the header without the magic number. */
	byte HEADER_SIZE_WITHOUT_MAGIC =
		108;
	
	/** The size of the header with the magic number. */
	byte HEADER_SIZE_WITH_MAGIC =
		112;
		
	/** Unused A. */
	byte OFFSET_OF_USHORT_UNUSEDA =
		4;
	
	/** The index of the method which is __start. */
	byte OFFSET_OF_UBYTE_STARTMETHODINDEX =
		6;
	
	/** The data type of the class. */
	byte OFFSET_OF_UBYTE_DATATYPE =
		7;
	
	/** Not used. */
	byte OFFSET_OF_USHORT_UNUSEDB =
		8;
	
	/** Class flags. */
	byte OFFSET_OF_INT_CLASSFLAGS =
		10;
	
	/** Name of class. */
	byte OFFSET_OF_USHORT_CLASSNAME =
		14;
	
	/** Super class name. */
	byte OFFSET_OF_USHORT_CLASSSUPER =
		16;
	
	/** Interfaces in class. */
	byte OFFSET_OF_USHORT_CLASSINTS =
		18;
	
	/** Class type. */
	byte OFFSET_OF_UBYTE_CLASSTYPE =
		20;
	
	/** Class version. */
	byte OFFSET_OF_UBYTE_CLASSVERS =
		21;
	
	/** Class source filename. */
	byte OFFSET_OF_USHORT_CLASSSFN =
		22;
	
	/** Static field count. */
	byte OFFSET_OF_USHORT_SFCOUNT =
		24;
	
	/** Static field bytes. */
	byte OFFSET_OF_USHORT_SFBYTES =
		26;
	
	/** Static field objects. */
	byte OFFSET_OF_USHORT_SFOBJS =
		28;
	
	/** Instance field count. */
	byte OFFSET_OF_USHORT_IFCOUNT =
		30;
	
	/** Instance field bytes. */
	byte OFFSET_OF_USHORT_IFBYTES =
		32;
	
	/** Instance field objects. */
	byte OFFSET_OF_USHORT_IFOBJS =
		34;
	
	/** Static method count. */
	byte OFFSET_OF_USHORT_SMCOUNT =
		36;
	
	/** Instance method count. */
	byte OFFSET_OF_USHORT_IMCOUNT =
		38;
	
	/** Not used. */
	byte OFFSET_OF_INT_UNUSEDC =
		40;
	
	/** Not used. */
	byte OFFSET_OF_INT_UNUSEDD =
		44;
	
	/** Static field data offset. */
	byte OFFSET_OF_INT_SFOFF =
		48;
	
	/** Static field data size. */
	byte OFFSET_OF_INT_SFSIZE =
		52;
	
	/** Interface field data offset. */
	byte OFFSET_OF_INT_IFOFF =
		56;
	
	/** Interface field data size. */
	byte OFFSET_OF_INT_IFSIZE =
		60;
	
	/** Static method data offset. */
	byte OFFSET_OF_INT_SMOFF =
		64;
	
	/** Static method data size. */
	byte OFFSET_OF_INT_SMSIZE =
		68;
	
	/** Instance method data offset. */
	byte OFFSET_OF_INT_IMOFF =
		72;
	
	/** Instance method data size. */
	byte OFFSET_OF_INT_IMSIZE =
		76;
	
	/** High bits for UUID. */
	byte OFFSET_OF_INT_UUIDHI =
		80;
	
	/** Low bits for UUID. */
	byte OFFSET_OF_INT_UUIDLO =
		84;
	
	/** File size. */
	byte OFFSET_OF_INT_FILESIZE =
		88;
	
	/** Not used. */
	byte OFFSET_OF_INT_UNUSEDE =
		92;
	
	/** Static constant pool offset. */
	byte OFFSET_OF_INT_STATICPOOLOFF =
		96;
	
	/** Static constant pool size. */
	byte OFFSET_OF_INT_STATICPOOLSIZE =
		100;
	
	/** Runtime constant pool offset. */
	byte OFFSET_OF_INT_RUNTIMEPOOLOFF =
		104;
	
	/** Runtime constant pool size. */
	byte OFFSET_OF_INT_RUNTIMEPOOLSIZE =
		108;
	
	/** Public class. */
	short FLAG_PUBLIC =
		0x0001;
	
	/** Final class. */
	short FLAG_FINAL =
		0x0010;
	
	/** Super class. */
	short FLAG_SUPER =
		0x0020;
	
	/** Interface class. */
	short FLAG_INTERFACE =
		0x0200;
	
	/** Abstract. */
	short FLAG_ABSTRACT =
		0x0400;
	
	/** Synthetic. */
	short FLAG_SYNTHETIC =
		0x1000;
	
	/** Annotation. */
	short FLAG_ANNOTATION =
		0x2000;
	
	/** Enum. */
	short FLAG_ENUM =
		0x4000;
}

Name change from runt/klib/supervisor/cc/squirreljme/jvm/lib/ClassFileParser.java to modules/cldc-compact/src/main/java/cc/squirreljme/jvm/boot/lib/ClassFileParser.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm.lib;

import cc.squirreljme.jvm.io.BinaryBlob;
import cc.squirreljme.jvm.io.MemoryBlob;

/**
 * This utility exists for the parsing of SquirrelJME's class files and allows
 * the bootstrap and class loaders the ability to read them.
 *
 * @since 2019/10/06
 */









|

|
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm.boot.lib;

import cc.squirreljme.jvm.boot.io.BinaryBlob;
import cc.squirreljme.jvm.boot.io.MemoryBlob;

/**
 * This utility exists for the parsing of SquirrelJME's class files and allows
 * the bootstrap and class loaders the ability to read them.
 *
 * @since 2019/10/06
 */

Name change from runt/klib/supervisor/cc/squirreljme/jvm/lib/ClassInfoProperty.java to modules/cldc-compact/src/main/java/cc/squirreljme/jvm/boot/lib/ClassInfoProperty.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm.lib;

/**
 * This contains properties of class info.
 *
 * @since 2019/11/30
 */
public interface ClassInfoProperty
{
	/** Self pointer. */
	public static final byte INT_SELFPTR =
		0;
	
	/** Magic number used to detect corruption. */
	public static final byte INT_MAGIC =
		1;
	
	/** Class information flags. */
	public static final byte INT_FLAGS =
		2;
	
	/** The pointer to the minimized class file. */
	public static final byte INT_MINIPTR =
		3;
	
	/** The pointer to the class name. */
	public static final byte INT_NAMEP =
		4;
	
	/** The allocation size of this class. */
	public static final byte INT_SIZE =
		5;
	
	/** The base offset for fields in this class. */
	public static final byte INT_BASE =
		6;
	
	/** The number of objects in the instance fields, for GC. */
	public static final byte INT_NUMOBJECTS =
		7;
	
	/** The dimensions this class uses, if it is an array. */
	public static final byte INT_DIMENSIONS =
		8;
	
	/** The cell size of components if this is an array. */
	public static final byte INT_CELLSIZE =
		9;
	
	/** The super class data. */
	public static final byte CLASSINFO_SUPERCLASS =
		10;
	
	/** Interfaces. */
	public static final byte CLASSINFO_ARRAY_INTERFACECLASSES =
		11;
	
	/** The component class. */
	public static final byte CLASSINFO_COMPONENTCLASS =
		12;
	
	/** Pointer to the class object. */
	public static final byte CLASS_CLASSOBJPTR =
		13;
	
	/** Virtual invoke VTable. */
	public static final byte INT_ARRAY_VTABLEVIRTUAL =
		14;
	
	/** Virtual invoke VTable pool entries. */
	public static final byte INT_ARRAY_VTABLEPOOL =
		15;
	
	/** The pointer to the constant pool of this class. */
	public static final byte INT_POOL =
		16;
	
	/** The JAR Index. */
	public static final byte INT_JARDX =
		17;
	
	/** The number of methods the class has. */
	public static final byte INT_NUMMETHODS =
		18;
	
	/** The depth of this class. */
	public static final byte INT_CLASSDEPTH =
		19;
	
	/** Static field offset. */
	public static final byte INT_SFOFFSET =
		20;
	
	/** New instance method. */
	public static final byte INT_DEFAULTNEW =
		21;
	
	/** The number of properties available. */
	public static final byte NUM_PROPERTIES =
		22;
}










|









|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm.boot.lib;

/**
 * This contains properties of class info.
 *
 * @since 2019/11/30
 */
public interface ClassInfoProperty
{
	/** Self pointer. */
	byte INT_SELFPTR =
		0;
	
	/** Magic number used to detect corruption. */
	byte INT_MAGIC =
		1;
	
	/** Class information flags. */
	byte INT_FLAGS =
		2;
	
	/** The pointer to the minimized class file. */
	byte INT_MINIPTR =
		3;
	
	/** The pointer to the class name. */
	byte INT_NAMEP =
		4;
	
	/** The allocation size of this class. */
	byte INT_SIZE =
		5;
	
	/** The base offset for fields in this class. */
	byte INT_BASE =
		6;
	
	/** The number of objects in the instance fields, for GC. */
	byte INT_NUMOBJECTS =
		7;
	
	/** The dimensions this class uses, if it is an array. */
	byte INT_DIMENSIONS =
		8;
	
	/** The cell size of components if this is an array. */
	byte INT_CELLSIZE =
		9;
	
	/** The super class data. */
	byte CLASSINFO_SUPERCLASS =
		10;
	
	/** Interfaces. */
	byte CLASSINFO_ARRAY_INTERFACECLASSES =
		11;
	
	/** The component class. */
	byte CLASSINFO_COMPONENTCLASS =
		12;
	
	/** Pointer to the class object. */
	byte CLASS_CLASSOBJPTR =
		13;
	
	/** Virtual invoke VTable. */
	byte INT_ARRAY_VTABLEVIRTUAL =
		14;
	
	/** Virtual invoke VTable pool entries. */
	byte INT_ARRAY_VTABLEPOOL =
		15;
	
	/** The pointer to the constant pool of this class. */
	byte INT_POOL =
		16;
	
	/** The JAR Index. */
	byte INT_JARDX =
		17;
	
	/** The number of methods the class has. */
	byte INT_NUMMETHODS =
		18;
	
	/** The depth of this class. */
	byte INT_CLASSDEPTH =
		19;
	
	/** Static field offset. */
	byte INT_SFOFFSET =
		20;
	
	/** New instance method. */
	byte INT_DEFAULTNEW =
		21;
	
	/** The number of properties available. */
	byte NUM_PROPERTIES =
		22;
}

Name change from runt/klib/supervisor/cc/squirreljme/jvm/lib/ClassInfoUtility.java to modules/cldc-compact/src/main/java/cc/squirreljme/jvm/boot/lib/ClassInfoUtility.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm.lib;

import cc.squirreljme.jvm.Assembly;
import cc.squirreljme.jvm.Constants;
import cc.squirreljme.jvm.task.TaskClass;

/**
 * This is a utility which allows access to the various fields within
 * {@link cc.squirreljme.jvm.ClassInfo}.
 *
 * @since 2019/11/30
 */









|



|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm.boot.lib;

import cc.squirreljme.jvm.Assembly;
import cc.squirreljme.jvm.Constants;
import cc.squirreljme.jvm.boot.task.TaskClass;

/**
 * This is a utility which allows access to the various fields within
 * {@link cc.squirreljme.jvm.ClassInfo}.
 *
 * @since 2019/11/30
 */

Name change from runt/klib/supervisor/cc/squirreljme/jvm/lib/ClassLibrary.java to modules/cldc-compact/src/main/java/cc/squirreljme/jvm/boot/lib/ClassLibrary.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm.lib;

import cc.squirreljme.jvm.io.BinaryBlob;

/**
 * This class represents a class library which makes classes available for
 * usage and such. It allows one to obtain class library information and
 * pointers.
 *
 * @since 2019/09/22









|

|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm.boot.lib;

import cc.squirreljme.jvm.boot.io.BinaryBlob;

/**
 * This class represents a class library which makes classes available for
 * usage and such. It allows one to obtain class library information and
 * pointers.
 *
 * @since 2019/09/22

Name change from runt/klib/supervisor/cc/squirreljme/jvm/lib/ClassMethodsParser.java to modules/cldc-compact/src/main/java/cc/squirreljme/jvm/boot/lib/ClassMethodsParser.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm.lib;

import cc.squirreljme.jvm.io.BinaryBlob;

/**
 * This is a parser for methods within a class.
 *
 * @since 2019/11/29
 */
public final class ClassMethodsParser









|

|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm.boot.lib;

import cc.squirreljme.jvm.boot.io.BinaryBlob;

/**
 * This is a parser for methods within a class.
 *
 * @since 2019/11/29
 */
public final class ClassMethodsParser
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
	public final BinaryBlob code(int __dx)
		throws IndexOutOfBoundsException, InvalidClassFormatException
	{
		BinaryBlob blob = this.blob;
		int offset = this.tocOffset(__dx);
		
		return blob.subSection(
			blob.readJavaInt(offset + CODE_ADDRESS_INT_OFFSET),
			blob.readJavaInt(offset + CODE_SIZE_INT_OFFSET));
	}
	
	/**
	 * Finds the given method and returns the index of it.
	 *
	 * @param __name The method name.
	 * @param __type The method type, may be {@code null} if not needed.







|
|







88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
	public final BinaryBlob code(int __dx)
		throws IndexOutOfBoundsException, InvalidClassFormatException
	{
		BinaryBlob blob = this.blob;
		int offset = this.tocOffset(__dx);
		
		return blob.subSection(
			blob.readJavaInt(offset + ClassMethodsParser.CODE_ADDRESS_INT_OFFSET),
			blob.readJavaInt(offset + ClassMethodsParser.CODE_SIZE_INT_OFFSET));
	}
	
	/**
	 * Finds the given method and returns the index of it.
	 *
	 * @param __name The method name.
	 * @param __type The method type, may be {@code null} if not needed.
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
	 * @throws InvalidClassFormatException If the class is not valid.
	 * @since 2019/12/14
	 */
	public final String name(int __dx)
		throws IndexOutOfBoundsException, InvalidClassFormatException
	{
		return this.pool.entryAsString(false, this.blob.readJavaUnsignedShort(
			this.tocOffset(__dx) + NAME_USHORT_OFFSET));
	}
	
	/**
	 * Index of the entry in the table of contents.
	 *
	 * @param __dx The index.
	 * @return The table of contents offset.
	 * @throws IndexOutOfBoundsException If the index is not within bounds.
	 * @throws InvalidClassFormatException If the class is not valid.
	 * @since 2019/12/14
	 */
	public final int tocOffset(int __dx)
		throws IndexOutOfBoundsException, InvalidClassFormatException
	{
		if (__dx < 0 || __dx > this.count)
			throw new IndexOutOfBoundsException("IOOB");
		
		return __dx * ENTRY_SIZE;
	}
	
	/**
	 * Returns the tyoe of the method.
	 *
	 * @param __dx The index of the method.
	 * @return The method type.
	 * @throws IndexOutOfBoundsException If the method is out of bounds.
	 * @throws InvalidClassFormatException If the class is not valid.
	 * @since 2019/12/14
	 */
	public final PoolMethodDescriptor type(int __dx)
		throws IndexOutOfBoundsException, InvalidClassFormatException
	{
		return this.pool.entryAsMethodDescriptor(false,
			this.blob.readJavaUnsignedShort(this.tocOffset(__dx) +
				TYPE_USHORT_OFFSET));
	}
}








|

















|















|
<



138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179

180
181
182
	 * @throws InvalidClassFormatException If the class is not valid.
	 * @since 2019/12/14
	 */
	public final String name(int __dx)
		throws IndexOutOfBoundsException, InvalidClassFormatException
	{
		return this.pool.entryAsString(false, this.blob.readJavaUnsignedShort(
			this.tocOffset(__dx) + ClassMethodsParser.NAME_USHORT_OFFSET));
	}
	
	/**
	 * Index of the entry in the table of contents.
	 *
	 * @param __dx The index.
	 * @return The table of contents offset.
	 * @throws IndexOutOfBoundsException If the index is not within bounds.
	 * @throws InvalidClassFormatException If the class is not valid.
	 * @since 2019/12/14
	 */
	public final int tocOffset(int __dx)
		throws IndexOutOfBoundsException, InvalidClassFormatException
	{
		if (__dx < 0 || __dx > this.count)
			throw new IndexOutOfBoundsException("IOOB");
		
		return __dx * ClassMethodsParser.ENTRY_SIZE;
	}
	
	/**
	 * Returns the tyoe of the method.
	 *
	 * @param __dx The index of the method.
	 * @return The method type.
	 * @throws IndexOutOfBoundsException If the method is out of bounds.
	 * @throws InvalidClassFormatException If the class is not valid.
	 * @since 2019/12/14
	 */
	public final PoolMethodDescriptor type(int __dx)
		throws IndexOutOfBoundsException, InvalidClassFormatException
	{
		return this.pool.entryAsMethodDescriptor(false,
			this.blob.readJavaUnsignedShort(this.tocOffset(__dx) + ClassMethodsParser.TYPE_USHORT_OFFSET));

	}
}

Name change from runt/klib/supervisor/cc/squirreljme/jvm/lib/ClassNameUtils.java to modules/cldc-compact/src/main/java/cc/squirreljme/jvm/boot/lib/ClassNameUtils.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm.lib;

/**
 * Utilities for working with class names.
 *
 * @since 2019/11/04
 */
public final class ClassNameUtils









|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm.boot.lib;

/**
 * Utilities for working with class names.
 *
 * @since 2019/11/04
 */
public final class ClassNameUtils

Name change from runt/klib/supervisor/cc/squirreljme/jvm/lib/ClassPath.java to modules/cldc-compact/src/main/java/cc/squirreljme/jvm/boot/lib/ClassPath.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm.lib;

import cc.squirreljme.jvm.io.BinaryBlob;

/**
 * This represents a class path which contains multiple class libraries.
 *
 * @since 2019/09/22
 */
public final class ClassPath









|

|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm.boot.lib;

import cc.squirreljme.jvm.boot.io.BinaryBlob;

/**
 * This represents a class path which contains multiple class libraries.
 *
 * @since 2019/09/22
 */
public final class ClassPath
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
		throws IllegalArgumentException, NullPointerException
	{
		if (__cp == null)
			throw new NullPointerException("NARG");
		
		// {@squirreljme.error SV0a Too many entries on the class path.}
		int n = __cp.length;
		if (n > (_JAR_MASK >>> _INDEX_SHIFT))
			throw new IllegalArgumentException("SV0a");
		
		// Defensive copy and check
		ClassLibrary[] classpath = new ClassLibrary[n];
		for (int i = 0; i < n; i++)
		{
			// Make sure this is not null!







|







46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
		throws IllegalArgumentException, NullPointerException
	{
		if (__cp == null)
			throw new NullPointerException("NARG");
		
		// {@squirreljme.error SV0a Too many entries on the class path.}
		int n = __cp.length;
		if (n > (ClassPath._JAR_MASK >>> ClassPath._INDEX_SHIFT))
			throw new IllegalArgumentException("SV0a");
		
		// Defensive copy and check
		ClassLibrary[] classpath = new ClassLibrary[n];
		for (int i = 0; i < n; i++)
		{
			// Make sure this is not null!
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
	 * library.
	 * @since 2019/07/11
	 */
	public final BinaryBlob resourceData(int __dx)
		throws IndexOutOfBoundsException
	{
		// {@squirreljme.error SV08 Out of range resource.}
		int cpdx = __dx >>> _INDEX_SHIFT;
		ClassLibrary[] classpath = this.classpath;
		if (cpdx < 0 || cpdx >= classpath.length)
			throw new IndexOutOfBoundsException("SV08");
		
		// Get resource pointer from this
		return classpath[cpdx].resourceData(__dx & _INDEX_MASK);
	}
	
	/**
	 * Searches for the given resource in this client task.
	 *
	 * @param __name The name of the resource.
	 * @return A negative value if not found, otherwise the class path index







|





|







130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
	 * library.
	 * @since 2019/07/11
	 */
	public final BinaryBlob resourceData(int __dx)
		throws IndexOutOfBoundsException
	{
		// {@squirreljme.error SV08 Out of range resource.}
		int cpdx = __dx >>> ClassPath._INDEX_SHIFT;
		ClassLibrary[] classpath = this.classpath;
		if (cpdx < 0 || cpdx >= classpath.length)
			throw new IndexOutOfBoundsException("SV08");
		
		// Get resource pointer from this
		return classpath[cpdx].resourceData(__dx & ClassPath._INDEX_MASK);
	}
	
	/**
	 * Searches for the given resource in this client task.
	 *
	 * @param __name The name of the resource.
	 * @return A negative value if not found, otherwise the class path index
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
		for (int i = 0, n = classpath.length; i < n; i++)
		{
			// Locate resource
			int rv = classpath[i].indexOf(__name);
			
			// Was found?
			if (rv >= 0)
				return (i << _INDEX_SHIFT) | rv;
		}
		
		// Not found
		return -1;
	}
	
	/**







|







164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
		for (int i = 0, n = classpath.length; i < n; i++)
		{
			// Locate resource
			int rv = classpath[i].indexOf(__name);
			
			// Was found?
			if (rv >= 0)
				return (i << ClassPath._INDEX_SHIFT) | rv;
		}
		
		// Not found
		return -1;
	}
	
	/**
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
			return -1;
		
		// Locate resource
		int rv = classpath[__in].indexOf(__name);
		
		// If it was found shift in
		if (rv >= 0)
			return (__in << _INDEX_SHIFT) | rv;
		
		// Otherwise does not exist
		return -1;
	}
	
	/**
	 * Searches for the given resource in this client task in the given







|







199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
			return -1;
		
		// Locate resource
		int rv = classpath[__in].indexOf(__name);
		
		// If it was found shift in
		if (rv >= 0)
			return (__in << ClassPath._INDEX_SHIFT) | rv;
		
		// Otherwise does not exist
		return -1;
	}
	
	/**
	 * Searches for the given resource in this client task in the given
242
243
244
245
246
247
248
249
250
251
252
	 *
	 * @param __rcid The resource index.
	 * @return The JAR index of the given resource.
	 * @since 2019/10/27
	 */
	public static final int resourceIndexToJarIndex(int __rcid)
	{
		return (__rcid & _JAR_MASK) >>> _INDEX_SHIFT;
	}
}








|



242
243
244
245
246
247
248
249
250
251
252
	 *
	 * @param __rcid The resource index.
	 * @return The JAR index of the given resource.
	 * @since 2019/10/27
	 */
	public static final int resourceIndexToJarIndex(int __rcid)
	{
		return (__rcid & ClassPath._JAR_MASK) >>> ClassPath._INDEX_SHIFT;
	}
}

Name change from runt/klib/supervisor/cc/squirreljme/jvm/lib/ClassPoolConstants.java to modules/cldc-compact/src/main/java/cc/squirreljme/jvm/boot/lib/ClassPoolConstants.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm.lib;

/**
 * Constants used when parsing the constant pool and such.
 *
 * @since 2019/10/13
 */
public interface ClassPoolConstants
{
	/** Offset to the tag type. */
	public static final byte OFFSET_OF_BYTE_ENTRY_TAG =
		0;
	
	/** Offset to the number of parts. */
	public static final byte OFFSET_OF_BYTE_ENTRY_NUMPARTS =
		1;
	
	/** Offset to the length of the data. */
	public static final byte OFFSET_OF_USHORT_ENTRY_LENGTH =
		2;
	
	/** Offset to the entry. */
	public static final byte OFFSET_OF_INT_ENTRY_OFFSET =
		4;
	
	/** Size of entries. */
	public static final byte ENTRY_SIZE =
		8;
	
	/** String type. */
	public static final byte TYPE_STRING =
		1;
	
	/** Class name. */
	public static final byte TYPE_CLASSNAME =
		2;
	
	/** Class names. */
	public static final byte TYPE_CLASSNAMES =
		3;
	
	/** Class pool pointer. */
	public static final byte TYPE_CLASS_POOL_POINTER =
		4;
	
	/** Method descriptor. */
	public static final byte TYPE_METHOD_DESCRIPTOR =
		7;
	
	/** A string that is used as a constant (cached). */
	public static final byte TYPE_USED_STRING =
		12;
	
	/** Class information pointer. */
	public static final byte TYPE_CLASS_INFO_POINTER =
		14;
	
	/** Noted string. */
	public static final byte TYPE_NOTED_STRING =
		15;
}










|









|



|



|



|



|



|



|



|



|



|



|



|



|



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm.boot.lib;

/**
 * Constants used when parsing the constant pool and such.
 *
 * @since 2019/10/13
 */
public interface ClassPoolConstants
{
	/** Offset to the tag type. */
	byte OFFSET_OF_BYTE_ENTRY_TAG =
		0;
	
	/** Offset to the number of parts. */
	byte OFFSET_OF_BYTE_ENTRY_NUMPARTS =
		1;
	
	/** Offset to the length of the data. */
	byte OFFSET_OF_USHORT_ENTRY_LENGTH =
		2;
	
	/** Offset to the entry. */
	byte OFFSET_OF_INT_ENTRY_OFFSET =
		4;
	
	/** Size of entries. */
	byte ENTRY_SIZE =
		8;
	
	/** String type. */
	byte TYPE_STRING =
		1;
	
	/** Class name. */
	byte TYPE_CLASSNAME =
		2;
	
	/** Class names. */
	byte TYPE_CLASSNAMES =
		3;
	
	/** Class pool pointer. */
	byte TYPE_CLASS_POOL_POINTER =
		4;
	
	/** Method descriptor. */
	byte TYPE_METHOD_DESCRIPTOR =
		7;
	
	/** A string that is used as a constant (cached). */
	byte TYPE_USED_STRING =
		12;
	
	/** Class information pointer. */
	byte TYPE_CLASS_INFO_POINTER =
		14;
	
	/** Noted string. */
	byte TYPE_NOTED_STRING =
		15;
}

Name change from runt/klib/supervisor/cc/squirreljme/jvm/lib/ClassPoolParser.java to modules/cldc-compact/src/main/java/cc/squirreljme/jvm/boot/lib/ClassPoolParser.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm.lib;

import cc.squirreljme.jvm.io.BinaryBlob;

/**
 * This class is used to parse individual pool treads.
 *
 * @see ClassDualPoolParser
 * @since 2019/10/12
 */
public final class ClassPoolParser
	extends AbstractPoolParser
{
	/** The blob for this pool. */
	protected final BinaryBlob blob;
	
	/** The size of this pool. */
	private int _size =
		-1;
	
	/**
	 * Initializes the constant pool parser.
	 *
	 * @param __b The blob data for the pool.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/10/12
	 */
	public ClassPoolParser(BinaryBlob __blob)
		throws NullPointerException
	{
		if (__blob == null)









|

|




















|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm.boot.lib;

import cc.squirreljme.jvm.boot.io.BinaryBlob;

/**
 * This class is used to parse individual pool treads.
 *
 * @see ClassDualPoolParser
 * @since 2019/10/12
 */
public final class ClassPoolParser
	extends AbstractPoolParser
{
	/** The blob for this pool. */
	protected final BinaryBlob blob;
	
	/** The size of this pool. */
	private int _size =
		-1;
	
	/**
	 * Initializes the constant pool parser.
	 *
	 * @param __blob The blob data for the pool.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/10/12
	 */
	public ClassPoolParser(BinaryBlob __blob)
		throws NullPointerException
	{
		if (__blob == null)

Name change from runt/klib/supervisor/cc/squirreljme/jvm/lib/DataType.java to modules/cldc-compact/src/main/java/cc/squirreljme/jvm/boot/lib/DataType.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm.lib;

/**
 * This contains the various data types classes and fields may be.
 *
 * @since 2019/10/12
 */
public interface DataType
{
	/** Object. */
	public static final byte OBJECT =
		0;
	
	/** Byte. */
	public static final byte BYTE =
		1;
	
	/** Short. */
	public static final byte SHORT =
		2;
	
	/** Character. */
	public static final byte CHARACTER =
		3;
	
	/** Integer. */
	public static final byte INTEGER =
		4;
	
	/** Float. */
	public static final byte FLOAT =
		5;
	
	/** Long. */
	public static final byte LONG =
		6;
	
	/** Double. */
	public static final byte DOUBLE =
		7;
}










|









|



|



|



|



|



|



|



|



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm.boot.lib;

/**
 * This contains the various data types classes and fields may be.
 *
 * @since 2019/10/12
 */
public interface DataType
{
	/** Object. */
	byte OBJECT =
		0;
	
	/** Byte. */
	byte BYTE =
		1;
	
	/** Short. */
	byte SHORT =
		2;
	
	/** Character. */
	byte CHARACTER =
		3;
	
	/** Integer. */
	byte INTEGER =
		4;
	
	/** Float. */
	byte FLOAT =
		5;
	
	/** Long. */
	byte LONG =
		6;
	
	/** Double. */
	byte DOUBLE =
		7;
}

Name change from runt/klib/supervisor/cc/squirreljme/jvm/lib/InvalidClassFormatException.java to modules/cldc-compact/src/main/java/cc/squirreljme/jvm/boot/lib/InvalidClassFormatException.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm.lib;

/**
 * This is thrown when a class is not valid.
 *
 * @since 2019/11/17
 */
public class InvalidClassFormatException









|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm.boot.lib;

/**
 * This is thrown when a class is not valid.
 *
 * @since 2019/11/17
 */
public class InvalidClassFormatException

Name change from runt/klib/supervisor/cc/squirreljme/jvm/lib/PoolClassInfoPointer.java to modules/cldc-compact/src/main/java/cc/squirreljme/jvm/boot/lib/PoolClassInfoPointer.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm.lib;

/**
 * This is a reference to a Class's information pointer.
 *
 * @since 2019/12/15
 */
public final class PoolClassInfoPointer









|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm.boot.lib;

/**
 * This is a reference to a Class's information pointer.
 *
 * @since 2019/12/15
 */
public final class PoolClassInfoPointer

Name change from runt/klib/supervisor/cc/squirreljme/jvm/lib/PoolClassName.java to modules/cldc-compact/src/main/java/cc/squirreljme/jvm/boot/lib/PoolClassName.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm.lib;

import java.util.Objects;

/**
 * This represents a class name within the constant pool.
 *
 * @since 2019/11/25









|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm.boot.lib;

import java.util.Objects;

/**
 * This represents a class name within the constant pool.
 *
 * @since 2019/11/25

Name change from runt/klib/supervisor/cc/squirreljme/jvm/lib/PoolClassPoolPointer.java to modules/cldc-compact/src/main/java/cc/squirreljme/jvm/boot/lib/PoolClassPoolPointer.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm.lib;

/**
 * This is a reference to a Class's pool pointer.
 *
 * @since 2019/12/15
 */
public final class PoolClassPoolPointer









|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm.boot.lib;

/**
 * This is a reference to a Class's pool pointer.
 *
 * @since 2019/12/15
 */
public final class PoolClassPoolPointer

Name change from runt/klib/supervisor/cc/squirreljme/jvm/lib/PoolMethodDescriptor.java to modules/cldc-compact/src/main/java/cc/squirreljme/jvm/boot/lib/PoolMethodDescriptor.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm.lib;

/**
 * This represents a method descriptor.
 *
 * @since 2019/12/14
 */
public final class PoolMethodDescriptor









|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm.boot.lib;

/**
 * This represents a method descriptor.
 *
 * @since 2019/12/14
 */
public final class PoolMethodDescriptor

Name change from runt/klib/supervisor/cc/squirreljme/jvm/lib/PoolNotedString.java to modules/cldc-compact/src/main/java/cc/squirreljme/jvm/boot/lib/PoolNotedString.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm.lib;

import cc.squirreljme.jvm.io.BinaryBlob;

/**
 * This represents a noted string.
 *
 * @since 2019/12/14
 */
public final class PoolNotedString









|

|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm.boot.lib;

import cc.squirreljme.jvm.boot.io.BinaryBlob;

/**
 * This represents a noted string.
 *
 * @since 2019/12/14
 */
public final class PoolNotedString

Name change from runt/klib/supervisor/cc/squirreljme/jvm/lib/package-info.java to modules/cldc-compact/src/main/java/cc/squirreljme/jvm/boot/lib/package-info.java.

10
11
12
13
14
15
16
17
18
/**
 * This package contains the information and classes for handling the class
 * library within the SquirrelJME JVM instance.
 *
 * @since 2019/09/22
 */

package cc.squirreljme.jvm.lib;








|

10
11
12
13
14
15
16
17
18
/**
 * This package contains the information and classes for handling the class
 * library within the SquirrelJME JVM instance.
 *
 * @since 2019/09/22
 */

package cc.squirreljme.jvm.boot.lib;

Added modules/cldc-compact/src/main/java/cc/squirreljme/jvm/boot/package-info.java.





















>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm.boot;

Name change from runt/klib/supervisor/cc/squirreljme/jvm/task/NoSuchMethodTaskException.java to modules/cldc-compact/src/main/java/cc/squirreljme/jvm/boot/task/NoSuchMethodTaskException.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm.task;

/**
 * This is thrown when there is no such method.
 *
 * @since 2019/12/14
 */
public class NoSuchMethodTaskException









|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm.boot.task;

/**
 * This is thrown when there is no such method.
 *
 * @since 2019/12/14
 */
public class NoSuchMethodTaskException

Name change from runt/klib/supervisor/cc/squirreljme/jvm/task/NoSuchTaskException.java to modules/cldc-compact/src/main/java/cc/squirreljme/jvm/boot/task/NoSuchTaskException.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm.task;

/**
 * This is thrown when there is no such given task.
 *
 * @since 2019/12/14
 */
public class NoSuchTaskException









|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm.boot.task;

/**
 * This is thrown when there is no such given task.
 *
 * @since 2019/12/14
 */
public class NoSuchTaskException

Name change from runt/klib/supervisor/cc/squirreljme/jvm/task/Task.java to modules/cldc-compact/src/main/java/cc/squirreljme/jvm/boot/task/Task.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm.task;

import cc.squirreljme.jvm.Allocator;
import cc.squirreljme.jvm.Assembly;
import cc.squirreljme.jvm.Constants;
import cc.squirreljme.jvm.io.BinaryBlob;
import cc.squirreljme.jvm.Globals;
import cc.squirreljme.jvm.lib.ClassFileParser;
import cc.squirreljme.jvm.lib.ClassInfoUtility;
import cc.squirreljme.jvm.lib.ClassLibrary;
import cc.squirreljme.jvm.lib.ClassNameUtils;
import cc.squirreljme.jvm.lib.ClassPath;
import java.util.HashMap;

/**
 * This represents a single task which has information on what it is running
 * along with its ID and such.
 *
 * @since 2019/06/22









|

|
|
|
<
|
<
<
<
<
<







1
2
3
4
5
6
7
8
9
10
11
12
13
14

15





16
17
18
19
20
21
22
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm.boot.task;

import cc.squirreljme.jvm.boot.Globals;
import cc.squirreljme.jvm.boot.lib.ClassInfoUtility;
import cc.squirreljme.jvm.boot.lib.ClassNameUtils;

import cc.squirreljme.jvm.boot.lib.ClassPath;





import java.util.HashMap;

/**
 * This represents a single task which has information on what it is running
 * along with its ID and such.
 *
 * @since 2019/06/22

Name change from runt/klib/supervisor/cc/squirreljme/jvm/task/TaskAllocator.java to modules/cldc-compact/src/main/java/cc/squirreljme/jvm/boot/task/TaskAllocator.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm.task;

import cc.squirreljme.jvm.Allocator;
import cc.squirreljme.jvm.Assembly;
import cc.squirreljme.jvm.Constants;

/**
 * This is an allocator which uses a pre-set tag value for any allocations.
 *
 * @since 2019/09/23









|

|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm.boot.task;

import cc.squirreljme.jvm.boot.Allocator;
import cc.squirreljme.jvm.Assembly;
import cc.squirreljme.jvm.Constants;

/**
 * This is an allocator which uses a pre-set tag value for any allocations.
 *
 * @since 2019/09/23
254
255
256
257
258
259
260
261

262
263
264
265
266
267
268
269
270
271
272
		{
			// Double-get in case we ran into this twice!
			rv = this._staticfieldptr;
			if (rv != 0)
				return rv;
			
			// Allocate and store this space
			this._staticfieldptr = (rv = this.allocate(0, STATIC_FIELD_SIZE));

			
			// Could not allocate for this task!
			if (rv == 0)
				throw new TaskOutOfMemoryError();
			
			// And use it
			return rv;
		}
	}
}








|
>











254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
		{
			// Double-get in case we ran into this twice!
			rv = this._staticfieldptr;
			if (rv != 0)
				return rv;
			
			// Allocate and store this space
			this._staticfieldptr = (rv = this.allocate(0,
				TaskAllocator.STATIC_FIELD_SIZE));
			
			// Could not allocate for this task!
			if (rv == 0)
				throw new TaskOutOfMemoryError();
			
			// And use it
			return rv;
		}
	}
}

Name change from runt/klib/supervisor/cc/squirreljme/jvm/task/TaskClass.java to modules/cldc-compact/src/main/java/cc/squirreljme/jvm/boot/task/TaskClass.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm.task;

import cc.squirreljme.jvm.Assembly;
import cc.squirreljme.jvm.ClassLoadingAdjustments;
import cc.squirreljme.jvm.Constants;
import cc.squirreljme.jvm.io.BinaryBlob;
import cc.squirreljme.jvm.io.MemoryBlob;
import cc.squirreljme.jvm.lib.ClassDualPoolParser;
import cc.squirreljme.jvm.lib.ClassFieldsParser;
import cc.squirreljme.jvm.lib.ClassFileParser;
import cc.squirreljme.jvm.lib.ClassInfoProperty;
import cc.squirreljme.jvm.lib.ClassInfoUtility;
import cc.squirreljme.jvm.lib.ClassMethodsParser;
import cc.squirreljme.jvm.lib.ClassNameUtils;
import cc.squirreljme.jvm.lib.ClassPath;
import cc.squirreljme.jvm.lib.ClassPoolConstants;
import cc.squirreljme.jvm.lib.PoolClassName;
import java.util.Objects;

/**
 * This represents a class of a task.
 *
 * @since 2019/10/19
 */









|




|
|
<
|
|
<
|
<
|
|
|
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16

17
18

19

20
21
22
23
24
25
26
27
28
29
30
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm.boot.task;

import cc.squirreljme.jvm.Assembly;
import cc.squirreljme.jvm.ClassLoadingAdjustments;
import cc.squirreljme.jvm.Constants;
import cc.squirreljme.jvm.boot.io.BinaryBlob;
import cc.squirreljme.jvm.boot.io.MemoryBlob;

import cc.squirreljme.jvm.boot.lib.ClassDualPoolParser;
import cc.squirreljme.jvm.boot.lib.ClassFileParser;

import cc.squirreljme.jvm.boot.lib.ClassInfoUtility;

import cc.squirreljme.jvm.boot.lib.ClassNameUtils;
import cc.squirreljme.jvm.boot.lib.ClassPath;
import cc.squirreljme.jvm.boot.lib.ClassPoolConstants;
import cc.squirreljme.jvm.boot.lib.PoolClassName;
import java.util.Objects;

/**
 * This represents a class of a task.
 *
 * @since 2019/10/19
 */
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
	}
	
	/**
	 * Performs the main initialization of this class.
	 *
	 * @param __task The creating task.
	 * @param __cl The class name being initialized.
	 * @param __cip The parser for {@code ClassInfo}.
	 * @return {@code this}.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/10/27
	 */
	public final TaskClass initializeClassInfo(Task __task, String __cl)
		throws NullPointerException
	{







<







67
68
69
70
71
72
73

74
75
76
77
78
79
80
	}
	
	/**
	 * Performs the main initialization of this class.
	 *
	 * @param __task The creating task.
	 * @param __cl The class name being initialized.

	 * @return {@code this}.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/10/27
	 */
	public final TaskClass initializeClassInfo(Task __task, String __cl)
		throws NullPointerException
	{

Name change from runt/klib/supervisor/cc/squirreljme/jvm/task/TaskCreateResult.java to modules/cldc-compact/src/main/java/cc/squirreljme/jvm/boot/task/TaskCreateResult.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm.task;

/**
 * This is the result of a created task
 *
 * @since 2019/12/08
 */
public final class TaskCreateResult









|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm.boot.task;

/**
 * This is the result of a created task
 *
 * @since 2019/12/08
 */
public final class TaskCreateResult

Name change from runt/klib/supervisor/cc/squirreljme/jvm/task/TaskException.java to modules/cldc-compact/src/main/java/cc/squirreljme/jvm/boot/task/TaskException.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm.task;

/**
 * This is the base for any exception thrown when processing tasks.
 *
 * @since 2019/10/21
 */
public class TaskException









|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm.boot.task;

/**
 * This is the base for any exception thrown when processing tasks.
 *
 * @since 2019/10/21
 */
public class TaskException

Name change from runt/klib/supervisor/cc/squirreljme/jvm/task/TaskManager.java to modules/cldc-compact/src/main/java/cc/squirreljme/jvm/boot/task/TaskManager.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm.task;

import cc.squirreljme.jvm.Assembly;
import cc.squirreljme.jvm.Constants;
import cc.squirreljme.jvm.lib.ClassLibrary;
import cc.squirreljme.jvm.lib.ClassPath;

/**
 * This manages multiple tasks.
 *
 * @since 2019/06/22
 */
public final class TaskManager









|

|
|
<
<







1
2
3
4
5
6
7
8
9
10
11
12
13


14
15
16
17
18
19
20
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm.boot.task;

import cc.squirreljme.jvm.boot.lib.ClassLibrary;
import cc.squirreljme.jvm.boot.lib.ClassPath;



/**
 * This manages multiple tasks.
 *
 * @since 2019/06/22
 */
public final class TaskManager
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
	
	/** The low mask for tasks. */
	private static final byte _TASK_MASK =
		0xF;
	
	/** The tasks which are available. */
	public final Task[] tasks =
		new Task[MAX_TASKS];
	
	/** The next logical task ID. */
	private volatile int _nextlid =
		1;
	
	/**
	 * Initializes the client task manager.







|







29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
	
	/** The low mask for tasks. */
	private static final byte _TASK_MASK =
		0xF;
	
	/** The tasks which are available. */
	public final Task[] tasks =
		new Task[TaskManager.MAX_TASKS];
	
	/** The next logical task ID. */
	private volatile int _nextlid =
		1;
	
	/**
	 * Initializes the client task manager.
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
	 */
	public final Task getTask(int __lid)
		throws NoSuchTaskException
	{
		synchronized (this)
		{
			// The lower bits are used to quickly obtain the PID slot
			Task rv = this.tasks[__lid & _TASK_MASK];
			if (rv != null && rv.lid == __lid)
				return rv;
		}
		
		// {@squirreljme.error SV10 No such task exists. (The task)}
		throw new NoSuchTaskException("SV10 " + __lid);
	}







|







60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
	 */
	public final Task getTask(int __lid)
		throws NoSuchTaskException
	{
		synchronized (this)
		{
			// The lower bits are used to quickly obtain the PID slot
			Task rv = this.tasks[__lid & TaskManager._TASK_MASK];
			if (rv != null && rv.lid == __lid)
				return rv;
		}
		
		// {@squirreljme.error SV10 No such task exists. (The task)}
		throw new NoSuchTaskException("SV10 " + __lid);
	}
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
		int pid;
		
		// One a single process may make tasks at a time, so we need to lock
		// here to prevent the entire system from collapsing
		synchronized (this)
		{
			// Find a free task spot
			for (pid = 1; pid < MAX_TASKS; pid++)
				if (tasks[pid] == null)
					break;
			
			// {@squirreljme.error SV01 Task limit reached.}
			if (pid >= MAX_TASKS)
				throw new TooManyTasksException("SV01");
			
			// Setup and store task now
			rv = new Task(pid, ((this._nextlid++) << _TASK_SHIFT) | pid,
				new ClassPath(__cp));
			tasks[pid] = rv;
		}
		
		// Create main thread to initialize
		TaskThread thread = rv.createThread();
		







|




|



|







101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
		int pid;
		
		// One a single process may make tasks at a time, so we need to lock
		// here to prevent the entire system from collapsing
		synchronized (this)
		{
			// Find a free task spot
			for (pid = 1; pid < TaskManager.MAX_TASKS; pid++)
				if (tasks[pid] == null)
					break;
			
			// {@squirreljme.error SV01 Task limit reached.}
			if (pid >= TaskManager.MAX_TASKS)
				throw new TooManyTasksException("SV01");
			
			// Setup and store task now
			rv = new Task(pid, ((this._nextlid++) << TaskManager._TASK_SHIFT) | pid,
				new ClassPath(__cp));
			tasks[pid] = rv;
		}
		
		// Create main thread to initialize
		TaskThread thread = rv.createThread();
		

Name change from runt/klib/supervisor/cc/squirreljme/jvm/task/TaskNoSuchClassException.java to modules/cldc-compact/src/main/java/cc/squirreljme/jvm/boot/task/TaskNoSuchClassException.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm.task;

/**
 * This is thrown when a class does not exist for a task.
 *
 * @since 2019/10/27
 */
public class TaskNoSuchClassException









|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm.boot.task;

/**
 * This is thrown when a class does not exist for a task.
 *
 * @since 2019/10/27
 */
public class TaskNoSuchClassException

Name change from runt/klib/supervisor/cc/squirreljme/jvm/task/TaskOutOfMemoryError.java to modules/cldc-compact/src/main/java/cc/squirreljme/jvm/boot/task/TaskOutOfMemoryError.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm.task;

/**
 * This is thrown when a task has ran out of memory.
 *
 * @since 2019/11/25
 */
public class TaskOutOfMemoryError









|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm.boot.task;

/**
 * This is thrown when a task has ran out of memory.
 *
 * @since 2019/11/25
 */
public class TaskOutOfMemoryError

Name change from runt/klib/supervisor/cc/squirreljme/jvm/task/TaskSysCallHandler.java to modules/cldc-compact/src/main/java/cc/squirreljme/jvm/boot/task/TaskSysCallHandler.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm.task;

import cc.squirreljme.jvm.Assembly;
import cc.squirreljme.jvm.ConfigReader;
import cc.squirreljme.jvm.ConfigRomType;
import cc.squirreljme.jvm.SupervisorPropertyIndex;
import cc.squirreljme.jvm.SystemCallIndex;

/**
 * This is the handler for system calls within tasks.
 *









|


|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm.boot.task;

import cc.squirreljme.jvm.Assembly;
import cc.squirreljme.jvm.boot.ConfigReader;
import cc.squirreljme.jvm.ConfigRomType;
import cc.squirreljme.jvm.SupervisorPropertyIndex;
import cc.squirreljme.jvm.SystemCallIndex;

/**
 * This is the handler for system calls within tasks.
 *
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
	 * @param __h Argument.
	 * @return The result.
	 * @since 2019/10/05
	 */
	public static final long taskSysCall(int __tid, int __oldsfp, short __si,
		int __a, int __b, int __c, int __d, int __e, int __f, int __g, int __h)
	{
		todo.DEBUG.code('H', 't', __tid);
		todo.DEBUG.code('H', 's', __oldsfp);
		todo.DEBUG.code('H', 'd', __si);
		
		return Assembly.sysCallPVL(__si, __a, __b, __c, __d, __e, __f, __g,
			__h);
	}
}








<
<
<
<





78
79
80
81
82
83
84




85
86
87
88
89
	 * @param __h Argument.
	 * @return The result.
	 * @since 2019/10/05
	 */
	public static final long taskSysCall(int __tid, int __oldsfp, short __si,
		int __a, int __b, int __c, int __d, int __e, int __f, int __g, int __h)
	{




		return Assembly.sysCallPVL(__si, __a, __b, __c, __d, __e, __f, __g,
			__h);
	}
}

Name change from runt/klib/supervisor/cc/squirreljme/jvm/task/TaskThread.java to modules/cldc-compact/src/main/java/cc/squirreljme/jvm/boot/task/TaskThread.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm.task;

import cc.squirreljme.jvm.Assembly;
import cc.squirreljme.jvm.Globals;
import cc.squirreljme.jvm.io.BinaryBlob;
import cc.squirreljme.jvm.io.MemoryBlob;
import cc.squirreljme.jvm.lib.ClassFileParser;
import cc.squirreljme.jvm.lib.ClassInfoUtility;
import cc.squirreljme.jvm.lib.ClassNameUtils;
import cc.squirreljme.jvm.SystemCallIndex;

/**
 * This represents a single thread, which is associated with a task.
 *
 * Every thread has a controller thread, this is the thread which is
 * actually executing the given thread even if the IDs are different. This
 * allows other threads to execute within the contexts of other threads









|


|
|
|
<
<
<
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15



16
17
18
19
20
21
22
23
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm.boot.task;

import cc.squirreljme.jvm.Assembly;
import cc.squirreljme.jvm.SystemCallIndex;
import cc.squirreljme.jvm.boot.Globals;
import cc.squirreljme.jvm.boot.io.MemoryBlob;



import cc.squirreljme.jvm.boot.lib.ClassNameUtils;

/**
 * This represents a single thread, which is associated with a task.
 *
 * Every thread has a controller thread, this is the thread which is
 * actually executing the given thread even if the IDs are different. This
 * allows other threads to execute within the contexts of other threads
146
147
148
149
150
151
152



153
154
155
156
157
158
159
160
161
162
163
164
165
	 * @throws TaskThrownException If the task threw an exception.
	 * @since 2019/12/08
	 */
	public final long execute(int __meth, int __pool, int... __args)
		throws IllegalArgumentException, IllegalStateException,
			NullPointerException, TaskThrownException
	{



		if (__args == null)
			throw new NullPointerException("NARG");
		
		// {@squirreljme.error SV11 Cannot execute method with the given
		// number of arguments.}
		if (__args.length > MAX_CALL_ARGUMENTS)
			throw new IllegalArgumentException("SV11");
		
		// Get the owning task
		Task task = Globals.getTaskManager().getTask(this.pid);
		
		// Set the task and enter user mode now
		Assembly.sysCallP(SystemCallIndex.FRAME_TASK_ID_SET, task.lid);







>
>
>





|







143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
	 * @throws TaskThrownException If the task threw an exception.
	 * @since 2019/12/08
	 */
	public final long execute(int __meth, int __pool, int... __args)
		throws IllegalArgumentException, IllegalStateException,
			NullPointerException, TaskThrownException
	{
		Assembly.breakpoint();
		throw new Error("TODO");
		/*
		if (__args == null)
			throw new NullPointerException("NARG");
		
		// {@squirreljme.error SV11 Cannot execute method with the given
		// number of arguments.}
		if (__args.length > TaskThread.MAX_CALL_ARGUMENTS)
			throw new IllegalArgumentException("SV11");
		
		// Get the owning task
		Task task = Globals.getTaskManager().getTask(this.pid);
		
		// Set the task and enter user mode now
		Assembly.sysCallP(SystemCallIndex.FRAME_TASK_ID_SET, task.lid);
236
237
238
239
240
241
242

243
244
245
246
247
248
249
			Assembly.specialSetStaticFieldRegister(oldsfp);
		}
		
		// Return the result or throw exception
		if (exception != 0)
			throw new TaskThrownException(exception);
		return rv;

	}
	
	/**
	 * Returns the process ID of this task.
	 *
	 * @return The process ID.
	 * @since 2019/12/14







>







236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
			Assembly.specialSetStaticFieldRegister(oldsfp);
		}
		
		// Return the result or throw exception
		if (exception != 0)
			throw new TaskThrownException(exception);
		return rv;
		*/
	}
	
	/**
	 * Returns the process ID of this task.
	 *
	 * @return The process ID.
	 * @since 2019/12/14

Name change from runt/klib/supervisor/cc/squirreljme/jvm/task/TaskThrownException.java to modules/cldc-compact/src/main/java/cc/squirreljme/jvm/boot/task/TaskThrownException.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm.task;

/**
 * This exception is thrown when a task throws an exception, it just points
 * to the exception register pointer itself.
 *
 * @since 2019/10/13
 */









|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm.boot.task;

/**
 * This exception is thrown when a task throws an exception, it just points
 * to the exception register pointer itself.
 *
 * @since 2019/10/13
 */

Name change from runt/klib/supervisor/cc/squirreljme/jvm/task/TaskVirtualMachineError.java to modules/cldc-compact/src/main/java/cc/squirreljme/jvm/boot/task/TaskVirtualMachineError.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm.task;

/**
 * This is thrown when there is something wrong with the task's virtual
 * machine.
 *
 * @since 2019/10/21
 */









|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm.boot.task;

/**
 * This is thrown when there is something wrong with the task's virtual
 * machine.
 *
 * @since 2019/10/21
 */

Name change from runt/klib/supervisor/cc/squirreljme/jvm/task/ThreadManager.java to modules/cldc-compact/src/main/java/cc/squirreljme/jvm/boot/task/ThreadManager.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm.task;

/**
 * This class manages threads within the system.
 *
 * @since 2019/10/13
 */
public final class ThreadManager









|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm.boot.task;

/**
 * This class manages threads within the system.
 *
 * @since 2019/10/13
 */
public final class ThreadManager
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
	
	/** This is the bootstrap main thread. */
	public final TaskThread BOOT_THREAD =
		new TaskThread(0, 0, 0);
	
	/** Threads that currently exist. */
	private TaskThread[] _threads =
		new TaskThread[_DEFAULT_THREAD_COUNT];
	
	/** The next logical thread id. */
	private int _nextlid;
	
	/**
	 * Always fills in the boot thread.
	 *
	 * @since 2019/10/19
	 */
	{
		this._threads[0] = BOOT_THREAD;
	}
	
	/**
	 * Returns any thread that is owned by the given task.
	 *
	 * @param __pid The process ID.
	 * @return The thread owned by the given task or {@code null}.







|










|







26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
	
	/** This is the bootstrap main thread. */
	public final TaskThread BOOT_THREAD =
		new TaskThread(0, 0, 0);
	
	/** Threads that currently exist. */
	private TaskThread[] _threads =
		new TaskThread[ThreadManager._DEFAULT_THREAD_COUNT];
	
	/** The next logical thread id. */
	private int _nextlid;
	
	/**
	 * Always fills in the boot thread.
	 *
	 * @since 2019/10/19
	 */
	{
		this._threads[0] = this.BOOT_THREAD;
	}
	
	/**
	 * Returns any thread that is owned by the given task.
	 *
	 * @param __pid The process ID.
	 * @return The thread owned by the given task or {@code null}.
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
				}
			
			// If we ran out of free spots then we need to grow the array to
			// fit more threads
			if (freespot < 0)
			{
				// Setup and copy source
				TaskThread[] newthreads = new TaskThread[n + _GROW_SIZE];
				for (int i = 0; i < n; i++)
					newthreads[i] = threads[i];
				
				// Set as new
				this._threads = (threads = newthreads);
				
				// Use the old size as the end point







|







105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
				}
			
			// If we ran out of free spots then we need to grow the array to
			// fit more threads
			if (freespot < 0)
			{
				// Setup and copy source
				TaskThread[] newthreads = new TaskThread[n + ThreadManager._GROW_SIZE];
				for (int i = 0; i < n; i++)
					newthreads[i] = threads[i];
				
				// Set as new
				this._threads = (threads = newthreads);
				
				// Use the old size as the end point

Name change from runt/klib/supervisor/cc/squirreljme/jvm/task/TooManyTasksException.java to modules/cldc-compact/src/main/java/cc/squirreljme/jvm/boot/task/TooManyTasksException.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm.task;

/**
 * This is thrown when there are too many tasks remaining..
 *
 * @since 2019/12/14
 */
public class TooManyTasksException









|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm.boot.task;

/**
 * This is thrown when there are too many tasks remaining..
 *
 * @since 2019/12/14
 */
public class TooManyTasksException

Name change from runt/klib/supervisor/cc/squirreljme/jvm/task/package-info.java to modules/cldc-compact/src/main/java/cc/squirreljme/jvm/boot/task/package-info.java.

9
10
11
12
13
14
15
16
17

/**
 * This package contains the classes and utilities regarding client tasks.
 *
 * @since 2019/09/22
 */

package cc.squirreljme.jvm.task;








|

9
10
11
12
13
14
15
16
17

/**
 * This package contains the classes and utilities regarding client tasks.
 *
 * @since 2019/09/22
 */

package cc.squirreljme.jvm.boot.task;

Name change from runt/apis/cldc-compact/cc/squirreljme/jvm/package-info.java to modules/cldc-compact/src/main/java/cc/squirreljme/jvm/package-info.java.

Added modules/cldc-compact/src/main/java/cc/squirreljme/runtime/cldc/Poking.java.



































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.cldc;

/**
 * Not Described
 *
 * @since 2020/02/29
 */
public final class Poking
{
	/** Has this been poked? */
	private static volatile boolean _POKED =
		false;
	
	/**
	 * Attempts to poke some native portions of SquirrelJME so that they start.
	 *
	 * @since 2020/02/29
	 */
	public static void poke()
	{
		// Only poke once!
		if (Poking._POKED)
			return;
		Poking._POKED = true;
		
		// We might be running on the emulator, if we are try to poke the
		// NativeBinding class so that way our native calls can be initialized
		try
		{
			Class.forName("cc.squirreljme.emulator.NativeBinding")
				.newInstance();
		}
		catch (ClassNotFoundException|IllegalAccessException|
			InstantiationException e)
		{
			// Ignore
			e.printStackTrace(System.err);
		}
	}
}

Name change from runt/apis/cldc-compact/cc/squirreljme/runtime/cldc/SquirrelJME.java to modules/cldc-compact/src/main/java/cc/squirreljme/runtime/cldc/SquirrelJME.java.

14
15
16
17
18
19
20
21
22
23
24
 * Contains information on SquirrelJME.
 *
 * @since 2018/12/05
 */
public interface SquirrelJME
{
	/** The version of this SquirrelJME runtime. */
	public static final String RUNTIME_VERSION =
		"0.3.0";
}








|



14
15
16
17
18
19
20
21
22
23
24
 * Contains information on SquirrelJME.
 *
 * @since 2018/12/05
 */
public interface SquirrelJME
{
	/** The version of this SquirrelJME runtime. */
	String RUNTIME_VERSION =
		"0.3.0";
}

Name change from runt/apis/cldc-compact/cc/squirreljme/runtime/cldc/annotation/Api.java to modules/cldc-compact/src/main/java/cc/squirreljme/runtime/cldc/annotation/Api.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.cldc.annotation;

import java.lang.annotation.Annotation;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * Indicates the API level of the native call.
 *
 * @since 2018/12/05
 */
@Documented
@Retention(value=RetentionPolicy.SOURCE)
@Target(value={ElementType.CONSTRUCTOR, ElementType.FIELD,
	ElementType.LOCAL_VARIABLE, ElementType.METHOD, ElementType.PACKAGE,
	ElementType.PARAMETER, ElementType.TYPE})
public @interface Api
{
	/** The API level. */
	int value();
}













<


















|



1
2
3
4
5
6
7
8
9
10
11
12

13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.cldc.annotation;


import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * Indicates the API level of the native call.
 *
 * @since 2018/12/05
 */
@Documented
@Retention(value=RetentionPolicy.SOURCE)
@Target(value={ElementType.CONSTRUCTOR, ElementType.FIELD,
	ElementType.LOCAL_VARIABLE, ElementType.METHOD, ElementType.PACKAGE,
	ElementType.PARAMETER, ElementType.TYPE})
public @interface Api
{
	/** @return The API level. */
	int value();
}

Name change from runt/apis/cldc-compact/cc/squirreljme/runtime/cldc/annotation/ImplementationNote.java to modules/cldc-compact/src/main/java/cc/squirreljme/runtime/cldc/annotation/ImplementationNote.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.cldc.annotation;

import java.lang.annotation.Annotation;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * This is an implementation note annotation.
 *
 * @since 2018/09/09
 */
@Documented
@Retention(value=RetentionPolicy.SOURCE)
@Target(value={ElementType.CONSTRUCTOR, ElementType.FIELD,
	ElementType.LOCAL_VARIABLE, ElementType.METHOD, ElementType.PACKAGE,
	ElementType.PARAMETER, ElementType.TYPE})
public @interface ImplementationNote
{
	/** The note to be stored. */
	String value() default "";
}













<


















|



1
2
3
4
5
6
7
8
9
10
11
12

13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.cldc.annotation;


import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * This is an implementation note annotation.
 *
 * @since 2018/09/09
 */
@Documented
@Retention(value=RetentionPolicy.SOURCE)
@Target(value={ElementType.CONSTRUCTOR, ElementType.FIELD,
	ElementType.LOCAL_VARIABLE, ElementType.METHOD, ElementType.PACKAGE,
	ElementType.PARAMETER, ElementType.TYPE})
public @interface ImplementationNote
{
	/** @return The note to be stored. */
	String value() default "";
}

Name change from runt/apis/cldc-compact/cc/squirreljme/runtime/cldc/annotation/ProgrammerTip.java to modules/cldc-compact/src/main/java/cc/squirreljme/runtime/cldc/annotation/ProgrammerTip.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.cldc.annotation;

import java.lang.annotation.Annotation;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * This is a tip to the programmer (along with the developers of SquirrelJME)
 * so things can be remembered easier.
 *
 * @since 2018/10/29
 */
@Documented
@Retention(value=RetentionPolicy.SOURCE)
@Target(value={ElementType.CONSTRUCTOR, ElementType.FIELD,
	ElementType.LOCAL_VARIABLE, ElementType.METHOD, ElementType.PACKAGE,
	ElementType.PARAMETER, ElementType.TYPE})
public @interface ProgrammerTip
{
	/** The note to be stored. */
	String value() default "";
}













<



















|



1
2
3
4
5
6
7
8
9
10
11
12

13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.cldc.annotation;


import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * This is a tip to the programmer (along with the developers of SquirrelJME)
 * so things can be remembered easier.
 *
 * @since 2018/10/29
 */
@Documented
@Retention(value=RetentionPolicy.SOURCE)
@Target(value={ElementType.CONSTRUCTOR, ElementType.FIELD,
	ElementType.LOCAL_VARIABLE, ElementType.METHOD, ElementType.PACKAGE,
	ElementType.PARAMETER, ElementType.TYPE})
public @interface ProgrammerTip
{
	/** @return The note to be stored. */
	String value() default "";
}

Name change from runt/apis/cldc-compact/cc/squirreljme/runtime/cldc/annotation/package-info.java to modules/cldc-compact/src/main/java/cc/squirreljme/runtime/cldc/annotation/package-info.java.

Name change from runt/apis/cldc-compact/cc/squirreljme/runtime/cldc/asm/ConsoleCallback.java to modules/cldc-compact/src/main/java/cc/squirreljme/runtime/cldc/asm/ConsoleCallback.java.

21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
{
	/**
	 * This is called when the stream has been closed.
	 *
	 * @return {@code false} if an {@link IOException} occurred.
	 * @since 2019/02/02
	 */
	public abstract boolean close();
	
	/**
	 * This is called when the callback is flushed.
	 *
	 * @return {@code false} if an {@link IOException} occurred.
	 * @since 2019/02/02
	 */
	public abstract boolean flush();
	
	/**
	 * Writes the specified bytes to the output.
	 *
	 * @param __b The bytes to write.
	 * @param __o The offset.
	 * @param __l The length.
	 * @return {@code false} if an {@link IOException} occurred.
	 * @since 2019/02/02
	 */
	public abstract boolean write(byte[] __b, int __o, int __l);
}







|







|










|

21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
{
	/**
	 * This is called when the stream has been closed.
	 *
	 * @return {@code false} if an {@link IOException} occurred.
	 * @since 2019/02/02
	 */
	boolean close();
	
	/**
	 * This is called when the callback is flushed.
	 *
	 * @return {@code false} if an {@link IOException} occurred.
	 * @since 2019/02/02
	 */
	boolean flush();
	
	/**
	 * Writes the specified bytes to the output.
	 *
	 * @param __b The bytes to write.
	 * @param __o The offset.
	 * @param __l The length.
	 * @return {@code false} if an {@link IOException} occurred.
	 * @since 2019/02/02
	 */
	boolean write(byte[] __b, int __o, int __l);
}

Name change from runt/apis/cldc-compact/cc/squirreljme/runtime/cldc/asm/ConsoleOutput.java to modules/cldc-compact/src/main/java/cc/squirreljme/runtime/cldc/asm/ConsoleOutput.java.

Name change from runt/apis/cldc-compact/cc/squirreljme/runtime/cldc/asm/NativeDisplayAccess.java to modules/cldc-compact/src/main/java/cc/squirreljme/runtime/cldc/asm/NativeDisplayAccess.java.

Name change from runt/apis/cldc-compact/cc/squirreljme/runtime/cldc/asm/NativeDisplayEventCallback.java to modules/cldc-compact/src/main/java/cc/squirreljme/runtime/cldc/asm/NativeDisplayEventCallback.java.

20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
 * @since 2018/12/03
 */
@Deprecated
public interface NativeDisplayEventCallback
{
	/** Key pressed. */
	@Deprecated
	public static final int KEY_PRESSED =
		1;
	
	/** Key repeated. */
	@Deprecated
	public static final int KEY_REPEATED =
		2;
	
	/** Key released. */
	@Deprecated
	public static final int KEY_RELEASED =
		3;
	
	/** Pointer pressed. */
	@Deprecated
	public static final int POINTER_PRESSED =
		4;
	
	/** Pointer dragged. */
	@Deprecated
	public static final int POINTER_DRAGGED =
		5;
	
	/** Pointer released. */
	@Deprecated
	public static final int POINTER_RELEASED =
		6;
	
	/**
	 * Executes the numbered command on the given display.
	 *
	 * @param __d The display to run the command on.
	 * @param __c The command to execute.
	 * @since 2018/12/03
	 */
	public abstract void command(int __d, int __c);
	
	/**
	 * Exit request generated for a display, this likely means the close
	 * button was pressed.
	 *
	 * Note that an exit might not happen if it is caught (like an exit
	 * dialog question or similar).
	 *
	 * @param __d The display which the close was performed on.
	 * @since 2018/12/03
	 */
	@Deprecated
	public abstract void exitRequest(int __d);
	
	/**
	 * Key action has been performed.
	 *
	 * @param __d The display ID.
	 * @param __ty The type of key event.
	 * @param __kc The key code.
	 * @param __ch The key character, {@code -1} is not valid.
	 * @param __time Timecode.
	 * @since 2018/12/03
	 */
	@Deprecated
	public abstract void keyEvent(int __d, int __ty, int __kc, int __ch,
		int __time);
	
	/**
	 * This is called when the callback has been lost, another task has claimed
	 * access to the display event handler. This should be called before
	 * a registration occurs.
	 *
	 * @since 2018/12/10
	 */
	@Deprecated
	public abstract void lostCallback();
	
	/**
	 * Paints the display.
	 *
	 * @param __d The display.
	 * @param __x The X coordinate.
	 * @param __y The Y coordinate.
	 * @param __w The width.
	 * @param __h The height.
	 * @since 2018/12/03
	 */
	@Deprecated
	public abstract void paintDisplay(int __d, int __x, int __y,
		int __w, int __h);
	
	/**
	 * Pointer event has occured.
	 *
	 * @param __d The display to have the end.
	 * @param __ty The type of pointer event.
	 * @param __x The X coordinate.
	 * @param __y The Y coordinate.
	 * @param __time Timecode.
	 * @since 2018/12/03
	 */
	@Deprecated
	public abstract void pointerEvent(int __d, int __ty, int __x, int __y,
		int __time);
	
	/**
	 * Display has been shown or hidden.
	 *
	 * @param __d The display.
	 * @param __shown If this is non-zero the display is shown.
	 * @since 2018/12/03
	 */
	@Deprecated
	public abstract void shown(int __d, int __shown);
	
	/**
	 * Display size has changed.
	 *
	 * @param __d The display which has changed.
	 * @param __w The width of the display.
	 * @param __h The height of the display.
	 * @since 2018/12/03
	 */
	@Deprecated
	public abstract void sizeChanged(int __d, int __w, int __h);
}








|




|




|




|




|




|









|












|












|
<









|












|
<












|
<









|










|


20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88

89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111

112
113
114
115
116
117
118
119
120
121
122
123
124

125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
 * @since 2018/12/03
 */
@Deprecated
public interface NativeDisplayEventCallback
{
	/** Key pressed. */
	@Deprecated
	int KEY_PRESSED =
		1;
	
	/** Key repeated. */
	@Deprecated
	int KEY_REPEATED =
		2;
	
	/** Key released. */
	@Deprecated
	int KEY_RELEASED =
		3;
	
	/** Pointer pressed. */
	@Deprecated
	int POINTER_PRESSED =
		4;
	
	/** Pointer dragged. */
	@Deprecated
	int POINTER_DRAGGED =
		5;
	
	/** Pointer released. */
	@Deprecated
	int POINTER_RELEASED =
		6;
	
	/**
	 * Executes the numbered command on the given display.
	 *
	 * @param __d The display to run the command on.
	 * @param __c The command to execute.
	 * @since 2018/12/03
	 */
	void command(int __d, int __c);
	
	/**
	 * Exit request generated for a display, this likely means the close
	 * button was pressed.
	 *
	 * Note that an exit might not happen if it is caught (like an exit
	 * dialog question or similar).
	 *
	 * @param __d The display which the close was performed on.
	 * @since 2018/12/03
	 */
	@Deprecated
	void exitRequest(int __d);
	
	/**
	 * Key action has been performed.
	 *
	 * @param __d The display ID.
	 * @param __ty The type of key event.
	 * @param __kc The key code.
	 * @param __ch The key character, {@code -1} is not valid.
	 * @param __time Timecode.
	 * @since 2018/12/03
	 */
	@Deprecated
	void keyEvent(int __d, int __ty, int __kc, int __ch, int __time);

	
	/**
	 * This is called when the callback has been lost, another task has claimed
	 * access to the display event handler. This should be called before
	 * a registration occurs.
	 *
	 * @since 2018/12/10
	 */
	@Deprecated
	void lostCallback();
	
	/**
	 * Paints the display.
	 *
	 * @param __d The display.
	 * @param __x The X coordinate.
	 * @param __y The Y coordinate.
	 * @param __w The width.
	 * @param __h The height.
	 * @since 2018/12/03
	 */
	@Deprecated
	void paintDisplay(int __d, int __x, int __y, int __w, int __h);

	
	/**
	 * Pointer event has occured.
	 *
	 * @param __d The display to have the end.
	 * @param __ty The type of pointer event.
	 * @param __x The X coordinate.
	 * @param __y The Y coordinate.
	 * @param __time Timecode.
	 * @since 2018/12/03
	 */
	@Deprecated
	void pointerEvent(int __d, int __ty, int __x, int __y, int __time);

	
	/**
	 * Display has been shown or hidden.
	 *
	 * @param __d The display.
	 * @param __shown If this is non-zero the display is shown.
	 * @since 2018/12/03
	 */
	@Deprecated
	void shown(int __d, int __shown);
	
	/**
	 * Display size has changed.
	 *
	 * @param __d The display which has changed.
	 * @param __w The width of the display.
	 * @param __h The height of the display.
	 * @since 2018/12/03
	 */
	@Deprecated
	void sizeChanged(int __d, int __w, int __h);
}

Name change from runt/apis/cldc-compact/cc/squirreljme/runtime/cldc/asm/ObjectAccess.java to modules/cldc-compact/src/main/java/cc/squirreljme/runtime/cldc/asm/ObjectAccess.java.

10
11
12
13
14
15
16
17
18
19
20
21
22
23

24
25
26

27
28
29
30

31
32
33
34

35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54

55
56
57
58
59
60
61
62
63
64
65
66

67
68
69
70
71
72
73
74
75
76
77

78
79
80
81
82
83
84
85
86
87

88
89
90
91
92
93
94
95
96
97
98

99
100
101
102
103
104
105
106
107
108
109

110
111
112
113
114
115

116
117
118

119
120
121
122
123
124
125
126
127
128
129
130
131

132
133
134
135
136
137
138
139
140
141
142
143

144
145
146
147
148
149
150
151
152
153
154
155

156
157
158
159
160
161
162
163
164
165
166
167

168
169
170
171
172
173
174
175
176
177
178

179
180
181
182
183
184
185
186
187
188

189
190
191
192
193
194
195
196
197
198
199
200
201
202

203
204
205
206
207
208

package cc.squirreljme.runtime.cldc.asm;

import cc.squirreljme.runtime.cldc.annotation.Api;
import cc.squirreljme.runtime.cldc.lang.ApiLevel;
import cc.squirreljme.runtime.cldc.lang.ClassData;
import cc.squirreljme.runtime.cldc.ref.PrimitiveReference;
import cc.squirreljme.runtime.cldc.ref.PrimitiveWeakReference;

/**
 * This contains accessors for object information.
 *
 * @since 2018/09/22
 */

public final class ObjectAccess
{
	/** Monitor is not owned by this thread. */

	public static final int MONITOR_NOT_OWNED =
		-1;
	
	/** Monitor did not interrupt. */

	public static final int MONITOR_NOT_INTERRUPTED =
		0;
	
	/** Monitor did interrupt. */

	public static final int MONITOR_INTERRUPTED =
		1;
	
	/**
	 * Not used.
	 *
	 * @since 2018/09/22
	 */
	private ObjectAccess()
	{
	}
	
	/**
	 * Allocates an object but does not construct it
	 *
	 * @param __cl The class to allocate.
	 * @return An object for the class, it is not initialized with a
	 * constructor. Returns {@code null} if no more memory is available.
	 * @since 2018/12/04
	 */

	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final native Object allocateObject(String __cl);
	
	/**
	 * Creates a new array of the given type, this is the actual array and
	 * not the component.
	 *
	 * @param __t The array type, not the component type.
	 * @param __l The array length.
	 * @return An array allocated to the given length.
	 * @since 2018/09/25
	 */

	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final native Object arrayNew(Class<?> __t, int __l);
	
	/**
	 * Returns the class object for the specified class by its binary name.
	 *
	 * @param __s The class to lookup, the binary name is used.
	 * @return The class for the given binary name, or {@code null} if it
	 * does not exist.
	 * @since 2018/09/23 
	 */

	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final native Class<?> classByName(String __s);
	
	/**
	 * Returns the class data which is attached to the given class object.
	 *
	 * @param __cl The class to get the data from.
	 * @return The resulting class data.
	 * @since 2018/12/04
	 */

	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final native ClassData classData(Class<?> __cl);
	
	/**
	 * Returns the class object for the given object.
	 *
	 * @param __v The object to get the class of.
	 * @return The class of the given object, or {@code null} if it has no
	 * class.
	 * @since 2018/09/22
	 */

	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final native Class<?> classOf(Object __v);
	
	/**
	 * Checks if the given thread holds the given object in a lock.
	 *
	 * @param __ntid The native thread ID.
	 * @param __o The object to check.
	 * @return If the lock is held.
	 * @since 2018/11/21
	 */

	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final native boolean holdsLock(int __ntid, Object __o);
	
	/**
	 * Returns the identity hashcode of the object.
	 *

	 * @return The identity hashcode.
	 * @since 2018/10/14
	 */

	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final native int identityHashCode(Object __o);
	
	/**
	 * Invokes the specified static method.
	 *
	 * @param __m The method to invoke.
	 * @param __args Arguments to the method, the parameters will be passed
	 * as-is and will not be unboxed, so the method must accept boxed values.
	 * @return The value to return from the method, {@code void} will return
	 * {@code null}.
	 * @since 2018/11/20
	 */

	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final native Object invokeStatic(StaticMethod __m,
		Object... __args);
	
	/**
	 * Notifies threads waiting on the monitor.
	 *
	 * @param __o The object to notify.
	 * @param __all Notify all threads?
	 * @return If the monitor was a success or not.
	 * @since 2018/11/20
	 */

	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final native int monitorNotify(Object __o, boolean __all);
	
	/**
	 * Waits for a notification on a monitor.
	 *
	 * @param __o The object to wait on.
	 * @param __ms The milliseconds.
	 * @param __ns The nanoseconds.
	 * @return The wait status.
	 * @since 2018/11/21
	 */

	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final native int monitorWait(Object __o, long __ms,
		int __ns);
	
	/**
	 * Creates a new primitive weak reference. Note that it is not valid to
	 * operate on this object as a normal object, it is a special
	 * representation.
	 *
	 * @return The primitive weak reference.
	 * @since 2018/09/23
	 */

	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final native PrimitiveReference newWeakReference();
	
	/**
	 * Gets the given reference.
	 *
	 * @param __r The reference to read from.
	 * @return The reference value, may be {@code null} if the input reference
	 * is not valid, it was garbage collected, or it was never set.
	 * @since 2018/09/23
	 */

	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final native Object referenceGet(PrimitiveReference __r);
	
	/**
	 * Sets the given reference to the given value.
	 *
	 * @param __r The reference to set.
	 * @param __v The value to set.
	 * @since 2018/09/23
	 */

	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final native void referenceSet(PrimitiveReference __r,
		Object __v);
	
	/**
	 * Returns the class object for the specified class by its binary name.
	 *
	 * @param <C> The class to type this as.
	 * @param __s The class to lookup, the binary name is used.
	 * @return The class for the given binary name, or {@code null} if it
	 * does not exist.
	 * @since 2018/09/23 
	 */
	@SuppressWarnings({"unchecked"})

	public static final <C> Class<C> classByNameType(String __s)
	{
		return (Class<C>)((Object)ObjectAccess.classByName(__s));
	}
}








<






>



>




>




>




















>












>











>










>











>











>






>



>













>












>












>












>











>










>














>






10
11
12
13
14
15
16

17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226

package cc.squirreljme.runtime.cldc.asm;

import cc.squirreljme.runtime.cldc.annotation.Api;
import cc.squirreljme.runtime.cldc.lang.ApiLevel;
import cc.squirreljme.runtime.cldc.lang.ClassData;
import cc.squirreljme.runtime.cldc.ref.PrimitiveReference;


/**
 * This contains accessors for object information.
 *
 * @since 2018/09/22
 */
@Deprecated
public final class ObjectAccess
{
	/** Monitor is not owned by this thread. */
	@Deprecated
	public static final int MONITOR_NOT_OWNED =
		-1;
	
	/** Monitor did not interrupt. */
	@Deprecated
	public static final int MONITOR_NOT_INTERRUPTED =
		0;
	
	/** Monitor did interrupt. */
	@Deprecated
	public static final int MONITOR_INTERRUPTED =
		1;
	
	/**
	 * Not used.
	 *
	 * @since 2018/09/22
	 */
	private ObjectAccess()
	{
	}
	
	/**
	 * Allocates an object but does not construct it
	 *
	 * @param __cl The class to allocate.
	 * @return An object for the class, it is not initialized with a
	 * constructor. Returns {@code null} if no more memory is available.
	 * @since 2018/12/04
	 */
	@Deprecated
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final native Object allocateObject(String __cl);
	
	/**
	 * Creates a new array of the given type, this is the actual array and
	 * not the component.
	 *
	 * @param __t The array type, not the component type.
	 * @param __l The array length.
	 * @return An array allocated to the given length.
	 * @since 2018/09/25
	 */
	@Deprecated
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final native Object arrayNew(Class<?> __t, int __l);
	
	/**
	 * Returns the class object for the specified class by its binary name.
	 *
	 * @param __s The class to lookup, the binary name is used.
	 * @return The class for the given binary name, or {@code null} if it
	 * does not exist.
	 * @since 2018/09/23 
	 */
	@Deprecated
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final native Class<?> classByName(String __s);
	
	/**
	 * Returns the class data which is attached to the given class object.
	 *
	 * @param __cl The class to get the data from.
	 * @return The resulting class data.
	 * @since 2018/12/04
	 */
	@Deprecated
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final native ClassData classData(Class<?> __cl);
	
	/**
	 * Returns the class object for the given object.
	 *
	 * @param __v The object to get the class of.
	 * @return The class of the given object, or {@code null} if it has no
	 * class.
	 * @since 2018/09/22
	 */
	@Deprecated
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final native Class<?> classOf(Object __v);
	
	/**
	 * Checks if the given thread holds the given object in a lock.
	 *
	 * @param __ntid The native thread ID.
	 * @param __o The object to check.
	 * @return If the lock is held.
	 * @since 2018/11/21
	 */
	@Deprecated
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final native boolean holdsLock(int __ntid, Object __o);
	
	/**
	 * Returns the identity hashcode of the object.
	 *
	 * @param __o The object to get the hashCode for.
	 * @return The identity hashcode.
	 * @since 2018/10/14
	 */
	@Deprecated
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final native int identityHashCode(Object __o);
	
	/**
	 * Invokes the specified static method.
	 *
	 * @param __m The method to invoke.
	 * @param __args Arguments to the method, the parameters will be passed
	 * as-is and will not be unboxed, so the method must accept boxed values.
	 * @return The value to return from the method, {@code void} will return
	 * {@code null}.
	 * @since 2018/11/20
	 */
	@Deprecated
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final native Object invokeStatic(StaticMethod __m,
		Object... __args);
	
	/**
	 * Notifies threads waiting on the monitor.
	 *
	 * @param __o The object to notify.
	 * @param __all Notify all threads?
	 * @return If the monitor was a success or not.
	 * @since 2018/11/20
	 */
	@Deprecated
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final native int monitorNotify(Object __o, boolean __all);
	
	/**
	 * Waits for a notification on a monitor.
	 *
	 * @param __o The object to wait on.
	 * @param __ms The milliseconds.
	 * @param __ns The nanoseconds.
	 * @return The wait status.
	 * @since 2018/11/21
	 */
	@Deprecated
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final native int monitorWait(Object __o, long __ms,
		int __ns);
	
	/**
	 * Creates a new primitive weak reference. Note that it is not valid to
	 * operate on this object as a normal object, it is a special
	 * representation.
	 *
	 * @return The primitive weak reference.
	 * @since 2018/09/23
	 */
	@Deprecated
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final native PrimitiveReference newWeakReference();
	
	/**
	 * Gets the given reference.
	 *
	 * @param __r The reference to read from.
	 * @return The reference value, may be {@code null} if the input reference
	 * is not valid, it was garbage collected, or it was never set.
	 * @since 2018/09/23
	 */
	@Deprecated
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final native Object referenceGet(PrimitiveReference __r);
	
	/**
	 * Sets the given reference to the given value.
	 *
	 * @param __r The reference to set.
	 * @param __v The value to set.
	 * @since 2018/09/23
	 */
	@Deprecated
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final native void referenceSet(PrimitiveReference __r,
		Object __v);
	
	/**
	 * Returns the class object for the specified class by its binary name.
	 *
	 * @param <C> The class to type this as.
	 * @param __s The class to lookup, the binary name is used.
	 * @return The class for the given binary name, or {@code null} if it
	 * does not exist.
	 * @since 2018/09/23 
	 */
	@SuppressWarnings({"unchecked"})
	@Deprecated
	public static final <C> Class<C> classByNameType(String __s)
	{
		return (Class<C>)((Object)ObjectAccess.classByName(__s));
	}
}

Name change from runt/apis/cldc-compact/cc/squirreljme/runtime/cldc/asm/ResourceAccess.java to modules/cldc-compact/src/main/java/cc/squirreljme/runtime/cldc/asm/ResourceAccess.java.

Name change from runt/apis/cldc-compact/cc/squirreljme/runtime/cldc/asm/StaticMethod.java to modules/cldc-compact/src/main/java/cc/squirreljme/runtime/cldc/asm/StaticMethod.java.

Name change from runt/apis/cldc-compact/cc/squirreljme/runtime/cldc/asm/SuiteAccess.java to modules/cldc-compact/src/main/java/cc/squirreljme/runtime/cldc/asm/SuiteAccess.java.

Name change from runt/apis/cldc-compact/cc/squirreljme/runtime/cldc/asm/SystemAccess.java to modules/cldc-compact/src/main/java/cc/squirreljme/runtime/cldc/asm/SystemAccess.java.

Name change from runt/apis/cldc-compact/cc/squirreljme/runtime/cldc/asm/SystemProperties.java to modules/cldc-compact/src/main/java/cc/squirreljme/runtime/cldc/asm/SystemProperties.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.cldc.asm;

import cc.squirreljme.runtime.cldc.annotation.Api;
import cc.squirreljme.runtime.cldc.lang.ApiLevel;
import cc.squirreljme.runtime.cldc.lang.OperatingSystemType;
import cc.squirreljme.runtime.cldc.SquirrelJME;

/**
 * Access to system properties.
 *
 * @since 2018/09/20
 */
public final class SystemProperties












|
|
|
<







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

16
17
18
19
20
21
22
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.cldc.asm;

import cc.squirreljme.runtime.cldc.SquirrelJME;
import cc.squirreljme.runtime.cldc.annotation.Api;
import cc.squirreljme.runtime.cldc.lang.ApiLevel;


/**
 * Access to system properties.
 *
 * @since 2018/09/20
 */
public final class SystemProperties

Name change from runt/apis/cldc-compact/cc/squirreljme/runtime/cldc/asm/TaskAccess.java to modules/cldc-compact/src/main/java/cc/squirreljme/runtime/cldc/asm/TaskAccess.java.

Name change from runt/apis/cldc-compact/cc/squirreljme/runtime/cldc/asm/package-info.java to modules/cldc-compact/src/main/java/cc/squirreljme/runtime/cldc/asm/package-info.java.

Name change from runt/apis/cldc-compact/cc/squirreljme/runtime/cldc/debug/CallTraceElement.java to modules/cldc-compact/src/main/java/cc/squirreljme/runtime/cldc/debug/CallTraceElement.java.

Name change from runt/apis/cldc-compact/cc/squirreljme/runtime/cldc/debug/package-info.java to modules/cldc-compact/src/main/java/cc/squirreljme/runtime/cldc/debug/package-info.java.

Name change from runt/apis/cldc-compact/cc/squirreljme/runtime/cldc/i18n/BasicLocale.java to modules/cldc-compact/src/main/java/cc/squirreljme/runtime/cldc/i18n/BasicLocale.java.

Name change from runt/apis/cldc-compact/cc/squirreljme/runtime/cldc/i18n/DefaultLocale.java to modules/cldc-compact/src/main/java/cc/squirreljme/runtime/cldc/i18n/DefaultLocale.java.

Name change from runt/apis/cldc-compact/cc/squirreljme/runtime/cldc/i18n/Locale.java to modules/cldc-compact/src/main/java/cc/squirreljme/runtime/cldc/i18n/Locale.java.

20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
	/**
	 * Converts the specified character to lowercase.
	 *
	 * @param __c The input character.
	 * @return The lowercased character.
	 * @since 2018/09/20
	 */
	public abstract char toLowerCase(char __c);
	
	/**
	 * Converts the specified character to uppercase.
	 *
	 * @param __c The input character.
	 * @return The uppercased character.
	 * @since 2018/09/28
	 */
	public abstract char toUpperCase(char __c);
}








|








|


20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
	/**
	 * Converts the specified character to lowercase.
	 *
	 * @param __c The input character.
	 * @return The lowercased character.
	 * @since 2018/09/20
	 */
	char toLowerCase(char __c);
	
	/**
	 * Converts the specified character to uppercase.
	 *
	 * @param __c The input character.
	 * @return The uppercased character.
	 * @since 2018/09/28
	 */
	char toUpperCase(char __c);
}

Name change from runt/apis/cldc-compact/cc/squirreljme/runtime/cldc/i18n/LocaleEn.java to modules/cldc-compact/src/main/java/cc/squirreljme/runtime/cldc/i18n/LocaleEn.java.

Name change from runt/apis/cldc-compact/cc/squirreljme/runtime/cldc/i18n/LocaleEnUs.java to modules/cldc-compact/src/main/java/cc/squirreljme/runtime/cldc/i18n/LocaleEnUs.java.

Name change from runt/apis/cldc-compact/cc/squirreljme/runtime/cldc/i18n/package-info.java to modules/cldc-compact/src/main/java/cc/squirreljme/runtime/cldc/i18n/package-info.java.

Name change from runt/apis/cldc-compact/cc/squirreljme/runtime/cldc/io/ASCIIDecoder.java to modules/cldc-compact/src/main/java/cc/squirreljme/runtime/cldc/io/ASCIIDecoder.java.

49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
		byte b = __b[__o];
		if (b < 0)
			return 0x1_0000 | 0xFFFD;
		return 0x1_0000 | (b & 0xFF);
	}
	
	/**
	 * {@inheritDc}
	 * @since 2018/12/23
	 */
	@Override
	public final String encodingName()
	{
		return "ascii";
	}
	
	/**
	 * {@inheritDc}
	 * @since 2018/12/23
	 */
	@Override
	public final int maximumSequenceLength()
	{
		return 1;
	}







|









|







49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
		byte b = __b[__o];
		if (b < 0)
			return 0x1_0000 | 0xFFFD;
		return 0x1_0000 | (b & 0xFF);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/12/23
	 */
	@Override
	public final String encodingName()
	{
		return "ascii";
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/12/23
	 */
	@Override
	public final int maximumSequenceLength()
	{
		return 1;
	}

Name change from runt/apis/cldc-compact/cc/squirreljme/runtime/cldc/io/ASCIIEncoder.java to modules/cldc-compact/src/main/java/cc/squirreljme/runtime/cldc/io/ASCIIEncoder.java.

56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
			__b[__o] = (byte)__c;
		
		// Only single characters written
		return 1;
	}
	
	/**
	 * {@inheritDc}
	 * @since 2018/12/23
	 */
	@Override
	public final String encodingName()
	{
		return "ascii";
	}







|







56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
			__b[__o] = (byte)__c;
		
		// Only single characters written
		return 1;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/12/23
	 */
	@Override
	public final String encodingName()
	{
		return "ascii";
	}

Name change from runt/apis/cldc-compact/cc/squirreljme/runtime/cldc/io/CodecFactory.java to modules/cldc-compact/src/main/java/cc/squirreljme/runtime/cldc/io/CodecFactory.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.cldc.io;

import java.io.UnsupportedEncodingException;
import java.lang.ref.Reference;
import java.lang.ref.WeakReference;

/**
 * This contains the code used to obtain the default encoding as well as
 * obtaining the encoder or decoder as needed.
 *
 * @since 2018/09/16
 */













<
<







1
2
3
4
5
6
7
8
9
10
11
12
13


14
15
16
17
18
19
20
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.cldc.io;

import java.io.UnsupportedEncodingException;



/**
 * This contains the code used to obtain the default encoding as well as
 * obtaining the encoder or decoder as needed.
 *
 * @since 2018/09/16
 */

Name change from runt/apis/cldc-compact/cc/squirreljme/runtime/cldc/io/ConsoleOutputStream.java to modules/cldc-compact/src/main/java/cc/squirreljme/runtime/cldc/io/ConsoleOutputStream.java.

Name change from runt/apis/cldc-compact/cc/squirreljme/runtime/cldc/io/Decoder.java to modules/cldc-compact/src/main/java/cc/squirreljme/runtime/cldc/io/Decoder.java.

35
36
37
38
39
40
41
42
43
44
45
	 * characters, so incomplete sequences will always be negative. When
	 * casting the result to {@code char} the upper bits will be truncated.
	 * @throws IndexOutOfBoundsException If the offset and or length are
	 * negative or exceed the array bounds.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/10/13
	 */
	public abstract int decode(byte[] __b, int __o, int __l)
		throws IndexOutOfBoundsException, NullPointerException;
}








|



35
36
37
38
39
40
41
42
43
44
45
	 * characters, so incomplete sequences will always be negative. When
	 * casting the result to {@code char} the upper bits will be truncated.
	 * @throws IndexOutOfBoundsException If the offset and or length are
	 * negative or exceed the array bounds.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/10/13
	 */
	int decode(byte[] __b, int __o, int __l)
		throws IndexOutOfBoundsException, NullPointerException;
}

Name change from runt/apis/cldc-compact/cc/squirreljme/runtime/cldc/io/Encoder.java to modules/cldc-compact/src/main/java/cc/squirreljme/runtime/cldc/io/Encoder.java.

29
30
31
32
33
34
35
36
37
38
39
	 * @return The number of bytes written, {@code -1} means the character
	 * cannot be encoded because it will not fit in the buffer.
	 * @throws IndexOutOfBoundsException If the offset and or length are
	 * negative or exceed the array bounds.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/09/21
	 */
	public abstract int encode(char __c, byte[] __b, int __o, int __l)
		throws IndexOutOfBoundsException, NullPointerException;
}








|



29
30
31
32
33
34
35
36
37
38
39
	 * @return The number of bytes written, {@code -1} means the character
	 * cannot be encoded because it will not fit in the buffer.
	 * @throws IndexOutOfBoundsException If the offset and or length are
	 * negative or exceed the array bounds.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/09/21
	 */
	int encode(char __c, byte[] __b, int __o, int __l)
		throws IndexOutOfBoundsException, NullPointerException;
}

Name change from runt/apis/cldc-compact/cc/squirreljme/runtime/cldc/io/IBM037Encoder.java to modules/cldc-compact/src/main/java/cc/squirreljme/runtime/cldc/io/IBM037Encoder.java.

72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
			return -1;
		
		// Invalid characters are turned into question marks
		if (__c >= 0x100)
			__c = '?';
		
		// Map
		__b[__o] = _MAP[__c];
		
		// Only single characters written
		return 1;
	}
	
	/**
	 * {@inheritDc}
	 * @since 2018/10/13
	 */
	@Override
	public final String encodingName()
	{
		return "ibm037";
	}







|






|







72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
			return -1;
		
		// Invalid characters are turned into question marks
		if (__c >= 0x100)
			__c = '?';
		
		// Map
		__b[__o] = IBM037Encoder._MAP[__c];
		
		// Only single characters written
		return 1;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/10/13
	 */
	@Override
	public final String encodingName()
	{
		return "ibm037";
	}

Name change from runt/apis/cldc-compact/cc/squirreljme/runtime/cldc/io/ISO885915Decoder.java to modules/cldc-compact/src/main/java/cc/squirreljme/runtime/cldc/io/ISO885915Decoder.java.

58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
			case 0x00BE:	c = 0x0178; break;
		}
		
		return 0x1_0000 | c;
	}
	
	/**
	 * {@inheritDc}
	 * @since 2019/04/29
	 */
	@Override
	public final String encodingName()
	{
		return "iso-8859-15";
	}
	
	/**
	 * {@inheritDc}
	 * @since 2019/04/29
	 */
	@Override
	public final int maximumSequenceLength()
	{
		return 1;
	}







|









|







58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
			case 0x00BE:	c = 0x0178; break;
		}
		
		return 0x1_0000 | c;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2019/04/29
	 */
	@Override
	public final String encodingName()
	{
		return "iso-8859-15";
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2019/04/29
	 */
	@Override
	public final int maximumSequenceLength()
	{
		return 1;
	}

Name change from runt/apis/cldc-compact/cc/squirreljme/runtime/cldc/io/ISO885915Encoder.java to modules/cldc-compact/src/main/java/cc/squirreljme/runtime/cldc/io/ISO885915Encoder.java.

79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
			__b[__o] = (byte)__c;
		
		// Only single characters written
		return 1;
	}
	
	/**
	 * {@inheritDc}
	 * @since 2019/04/29
	 */
	@Override
	public final String encodingName()
	{
		return "iso-8859-15";
	}







|







79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
			__b[__o] = (byte)__c;
		
		// Only single characters written
		return 1;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2019/04/29
	 */
	@Override
	public final String encodingName()
	{
		return "iso-8859-15";
	}

Name change from runt/apis/cldc-compact/cc/squirreljme/runtime/cldc/io/ISO88591Decoder.java to modules/cldc-compact/src/main/java/cc/squirreljme/runtime/cldc/io/ISO88591Decoder.java.

45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
		if (__l <= 0)
			return -1;
		
		return 0x1_0000 | (__b[__o] & 0xFF);
	}
	
	/**
	 * {@inheritDc}
	 * @since 2018/11/11
	 */
	@Override
	public final String encodingName()
	{
		return "iso-8859-1";
	}
	
	/**
	 * {@inheritDc}
	 * @since 2018/11/11
	 */
	@Override
	public final int maximumSequenceLength()
	{
		return 1;
	}







|









|







45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
		if (__l <= 0)
			return -1;
		
		return 0x1_0000 | (__b[__o] & 0xFF);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/11/11
	 */
	@Override
	public final String encodingName()
	{
		return "iso-8859-1";
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/11/11
	 */
	@Override
	public final int maximumSequenceLength()
	{
		return 1;
	}

Name change from runt/apis/cldc-compact/cc/squirreljme/runtime/cldc/io/ISO88591Encoder.java to modules/cldc-compact/src/main/java/cc/squirreljme/runtime/cldc/io/ISO88591Encoder.java.

56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
			__b[__o] = (byte)__c;
		
		// Only single characters written
		return 1;
	}
	
	/**
	 * {@inheritDc}
	 * @since 2018/10/13
	 */
	@Override
	public final String encodingName()
	{
		return "iso-8859-1";
	}







|







56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
			__b[__o] = (byte)__c;
		
		// Only single characters written
		return 1;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/10/13
	 */
	@Override
	public final String encodingName()
	{
		return "iso-8859-1";
	}

Name change from runt/apis/cldc-compact/cc/squirreljme/runtime/cldc/io/NamedCodec.java to modules/cldc-compact/src/main/java/cc/squirreljme/runtime/cldc/io/NamedCodec.java.

20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
	/**
	 * The average sequence length used for characters, used to estimate how
	 * big of an array to allocate for characters.
	 *
	 * @return The average sequence length.
	 * @since 2018/11/06
	 */
	public abstract double averageSequenceLength();
	
	/**
	 * Returns the name of the encoding.
	 *
	 * @return The encoding name.
	 * @since 2018/10/13
	 */
	public abstract String encodingName();
	
	/**
	 * Returns a hint which specifies the maximum length of a byte sequence
	 * for decoding.
	 *
	 * @return The maximum sequence length for decoding.
	 * @since 2018/10/13
	 */
	public abstract int maximumSequenceLength();
}








|







|








|


20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
	/**
	 * The average sequence length used for characters, used to estimate how
	 * big of an array to allocate for characters.
	 *
	 * @return The average sequence length.
	 * @since 2018/11/06
	 */
	double averageSequenceLength();
	
	/**
	 * Returns the name of the encoding.
	 *
	 * @return The encoding name.
	 * @since 2018/10/13
	 */
	String encodingName();
	
	/**
	 * Returns a hint which specifies the maximum length of a byte sequence
	 * for decoding.
	 *
	 * @return The maximum sequence length for decoding.
	 * @since 2018/10/13
	 */
	int maximumSequenceLength();
}

Name change from runt/apis/cldc-compact/cc/squirreljme/runtime/cldc/io/ResourceInputStream.java to modules/cldc-compact/src/main/java/cc/squirreljme/runtime/cldc/io/ResourceInputStream.java.

1
2
3
4
5
6
7
8
9
10
11
12

13
14
15
16
17
18
19
20
21
22
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.cldc.io;


import java.io.InputStream;
import java.io.IOException;
import cc.squirreljme.runtime.cldc.asm.ResourceAccess;

/**
 * This input stream handles reading of resources.
 *
 * @since 2018/10/07
 */
public final class ResourceInputStream












>
|
|
<







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

16
17
18
19
20
21
22
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.cldc.io;

import cc.squirreljme.runtime.cldc.asm.ResourceAccess;
import java.io.IOException;
import java.io.InputStream;


/**
 * This input stream handles reading of resources.
 *
 * @since 2018/10/07
 */
public final class ResourceInputStream

Name change from runt/apis/cldc-compact/cc/squirreljme/runtime/cldc/io/SecureByteArrayOutputStream.java to modules/cldc-compact/src/main/java/cc/squirreljme/runtime/cldc/io/SecureByteArrayOutputStream.java.

26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
	/**
	 * Initializes using the default capacity.
	 *
	 * @since 2018/01/15
	 */
	public SecureByteArrayOutputStream()
	{
		super();
	}
	
	/**
	 * Initializes using the specified capacity.
	 *
	 * @param __n The number of bytes to store.
	 * @since 2018/01/15







<







26
27
28
29
30
31
32

33
34
35
36
37
38
39
	/**
	 * Initializes using the default capacity.
	 *
	 * @since 2018/01/15
	 */
	public SecureByteArrayOutputStream()
	{

	}
	
	/**
	 * Initializes using the specified capacity.
	 *
	 * @param __n The number of bytes to store.
	 * @since 2018/01/15

Name change from runt/apis/cldc-compact/cc/squirreljme/runtime/cldc/io/UTF8Decoder.java to modules/cldc-compact/src/main/java/cc/squirreljme/runtime/cldc/io/UTF8Decoder.java.

85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
				// Should not occur
			default:
				throw new todo.OOPS();
		}
	}
	
	/**
	 * {@inheritDc}
	 * @since 2018/10/13
	 */
	@Override
	public final String encodingName()
	{
		return "utf-8";
	}
	
	/**
	 * {@inheritDc}
	 * @since 2018/10/13
	 */
	@Override
	public final int maximumSequenceLength()
	{
		return 4;
	}







|









|







85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
				// Should not occur
			default:
				throw new todo.OOPS();
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/10/13
	 */
	@Override
	public final String encodingName()
	{
		return "utf-8";
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/10/13
	 */
	@Override
	public final int maximumSequenceLength()
	{
		return 4;
	}

Name change from runt/apis/cldc-compact/cc/squirreljme/runtime/cldc/io/UTF8Encoder.java to modules/cldc-compact/src/main/java/cc/squirreljme/runtime/cldc/io/UTF8Encoder.java.

77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
			__b[__o + 2] = (byte)((__c & 0b111111) | 0b10_000000);
			
			return 3;
		}
	}
	
	/**
	 * {@inheritDc}
	 * @since 2018/10/13
	 */
	@Override
	public final String encodingName()
	{
		return "utf-8";
	}







|







77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
			__b[__o + 2] = (byte)((__c & 0b111111) | 0b10_000000);
			
			return 3;
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/10/13
	 */
	@Override
	public final String encodingName()
	{
		return "utf-8";
	}

Name change from runt/apis/cldc-compact/cc/squirreljme/runtime/cldc/io/package-info.java to modules/cldc-compact/src/main/java/cc/squirreljme/runtime/cldc/io/package-info.java.

Name change from runt/apis/cldc-compact/cc/squirreljme/runtime/cldc/lang/ApiLevel.java to modules/cldc-compact/src/main/java/cc/squirreljme/runtime/cldc/lang/ApiLevel.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27

28
29
30

31
32
33
34

35
36
37
38

39
40
41
42

43
44
45
46

47
48
49
50
51
52
53
54

55
56
57
58
59
60
61
62
63
64
65

66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82

83
84
85
86
87
88
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.cldc.lang;

import cc.squirreljme.jvm.Assembly;
import cc.squirreljme.jvm.SystemCallError;
import cc.squirreljme.jvm.SystemCallIndex;

/**
 * Provides access to the current API level.
 *
 * This is used for backwards compatibility.
 *
 * Levels are in the form of {@code 0M_mm_R_yyDDD} (Major version, minor
 * version, release version, year (20yy), day of year). This means they are
 * limited to the form of {@code [0-9].[0-99].[0-9] (Day [0-999] of 20[0-99])}.
 *
 * @since 2018/12/05
 */

public final class ApiLevel
{
	/** The current API level. */

	public static final int CURRENT_LEVEL =
		Assembly.sysCallV(SystemCallIndex.API_LEVEL);
	
	/** Undefined. */

	public static final int UNDEFINED =
		0x7FFFFFFF;
	
	/** SquirrelJME 0.2.0 (December 25, 2018). */

	public static final int LEVEL_SQUIRRELJME_0_2_0_20181225 =
		2_0_18359;
	
	/** SquirrelJME 0.3.0 (Development). */

	public static final int LEVEL_SQUIRRELJME_0_3_0_DEV =
		3_0_19001;
	
	/** SquirrelJME 0.4.0 (July 4, 2019). */

	public static final int LEVEL_SQUIRRELJME_0_4_0_20190704 =
		4_0_19185;
	
	/**
	 * Not used.
	 *
	 * @since 2018/12/05
	 */

	private ApiLevel()
	{
	}
	
	/**
	 * Converts an API level to a string.
	 *
	 * @param __l The input level.
	 * @return The string.
	 * @since 2018/12/05
	 */

	public static String levelToString(int __l)
	{
		return String.format("%d.%d.%d (Day %d of %d)",
			(__l / 100000000) % 10,
			(__l / 1000000) % 100,
			(__l / 100000) % 10,
			__l % 1000,
			2000 + ((__l / 1000) % 100));
	}
	
	/**
	 * Checks if the runtime API level is at a minimum this given level.
	 *
	 * @param __l The level to check.
	 * @return If the minimum level is met.
	 * @since 2019/02/02
	 */

	public static boolean minimumLevel(int __l)
	{
		return (CURRENT_LEVEL >= __l);
	}
}














<













>



>




>




>




>




>








>











>

















>


|



1
2
3
4
5
6
7
8
9
10
11
12
13

14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.cldc.lang;

import cc.squirreljme.jvm.Assembly;

import cc.squirreljme.jvm.SystemCallIndex;

/**
 * Provides access to the current API level.
 *
 * This is used for backwards compatibility.
 *
 * Levels are in the form of {@code 0M_mm_R_yyDDD} (Major version, minor
 * version, release version, year (20yy), day of year). This means they are
 * limited to the form of {@code [0-9].[0-99].[0-9] (Day [0-999] of 20[0-99])}.
 *
 * @since 2018/12/05
 */
@Deprecated
public final class ApiLevel
{
	/** The current API level. */
	@Deprecated
	public static final int CURRENT_LEVEL =
		Assembly.sysCallV(SystemCallIndex.API_LEVEL);
	
	/** Undefined. */
	@Deprecated
	public static final int UNDEFINED =
		0x7FFFFFFF;
	
	/** SquirrelJME 0.2.0 (December 25, 2018). */
	@Deprecated
	public static final int LEVEL_SQUIRRELJME_0_2_0_20181225 =
		2_0_18359;
	
	/** SquirrelJME 0.3.0 (Development). */
	@Deprecated
	public static final int LEVEL_SQUIRRELJME_0_3_0_DEV =
		3_0_19001;
	
	/** SquirrelJME 0.4.0 (July 4, 2019). */
	@Deprecated
	public static final int LEVEL_SQUIRRELJME_0_4_0_20190704 =
		4_0_19185;
	
	/**
	 * Not used.
	 *
	 * @since 2018/12/05
	 */
	@Deprecated
	private ApiLevel()
	{
	}
	
	/**
	 * Converts an API level to a string.
	 *
	 * @param __l The input level.
	 * @return The string.
	 * @since 2018/12/05
	 */
	@Deprecated
	public static String levelToString(int __l)
	{
		return String.format("%d.%d.%d (Day %d of %d)",
			(__l / 100000000) % 10,
			(__l / 1000000) % 100,
			(__l / 100000) % 10,
			__l % 1000,
			2000 + ((__l / 1000) % 100));
	}
	
	/**
	 * Checks if the runtime API level is at a minimum this given level.
	 *
	 * @param __l The level to check.
	 * @return If the minimum level is met.
	 * @since 2019/02/02
	 */
	@Deprecated
	public static boolean minimumLevel(int __l)
	{
		return (ApiLevel.CURRENT_LEVEL >= __l);
	}
}

Name change from runt/apis/cldc-compact/cc/squirreljme/runtime/cldc/lang/ArrayUtils.java to modules/cldc-compact/src/main/java/cc/squirreljme/runtime/cldc/lang/ArrayUtils.java.

104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156

157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
	{
		if (__a == null)
			throw new NullPointerException("NARG");
		
		// Depends on the type
		switch (__type)
		{
			case ARRAY_BOOLEAN:
				((boolean[])__a)[__dx] = ((Boolean)__v).booleanValue();
				break;
				
			case ARRAY_BYTE:
				((byte[])__a)[__dx] = ((Byte)__v).byteValue();
				break;
				
			case ARRAY_SHORT:
				((short[])__a)[__dx] = ((Short)__v).shortValue();
				break;
				
			case ARRAY_CHARACTER:
				((char[])__a)[__dx] = ((Character)__v).charValue();
				break;
				
			case ARRAY_INTEGER:
				((int[])__a)[__dx] = ((Integer)__v).intValue();
				break;
				
			case ARRAY_LONG:
				((long[])__a)[__dx] = ((Long)__v).longValue();
				break;
				
			case ARRAY_FLOAT:
				((float[])__a)[__dx] = ((Float)__v).floatValue();
				break;
				
			case ARRAY_DOUBLE:
				((double[])__a)[__dx] = ((Double)__v).doubleValue();
				break;
				
			case ARRAY_OBJECT:
				((Object[])__a)[__dx] = __v;
				break;
			
				// {@squirreljme.error ZZ0c Invalid array type.}
			default:
				throw new IllegalArgumentException("ZZ0c");
		}
	}
	
	/**
	 * Returns the type of array the object is.
	 *
	 * @param __a The array type.

	 * @throws IllegalArgumentException If not an array.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/12/13
	 */
	public static final int arrayType(Object __a)
		throws IllegalArgumentException, NullPointerException
	{
		if (__a == null)
			throw new NullPointerException("NARG");
		
		if (__a instanceof Object[])
			return ARRAY_OBJECT;
		else if (__a instanceof boolean[])
			return ARRAY_BOOLEAN;
		else if (__a instanceof byte[])
			return ARRAY_BYTE;
		else if (__a instanceof short[])
			return ARRAY_SHORT;
		else if (__a instanceof char[])
			return ARRAY_CHARACTER;
		else if (__a instanceof int[])
			return ARRAY_INTEGER;
		else if (__a instanceof long[])
			return ARRAY_LONG;
		else if (__a instanceof float[])
			return ARRAY_FLOAT;
		else if (__a instanceof double[])
			return ARRAY_DOUBLE;
		
		// {@squirreljme.error ZZ0d Invalid array type.}
		throw new IllegalArgumentException("ZZ0d");
	}
	
	/**
	 * Allocates a new multi-dimensional array.







|



|



|



|



|



|



|



|



|













>











|

|

|

|

|

|

|

|

|







104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
	{
		if (__a == null)
			throw new NullPointerException("NARG");
		
		// Depends on the type
		switch (__type)
		{
			case ArrayUtils.ARRAY_BOOLEAN:
				((boolean[])__a)[__dx] = ((Boolean)__v).booleanValue();
				break;
				
			case ArrayUtils.ARRAY_BYTE:
				((byte[])__a)[__dx] = ((Byte)__v).byteValue();
				break;
				
			case ArrayUtils.ARRAY_SHORT:
				((short[])__a)[__dx] = ((Short)__v).shortValue();
				break;
				
			case ArrayUtils.ARRAY_CHARACTER:
				((char[])__a)[__dx] = ((Character)__v).charValue();
				break;
				
			case ArrayUtils.ARRAY_INTEGER:
				((int[])__a)[__dx] = ((Integer)__v).intValue();
				break;
				
			case ArrayUtils.ARRAY_LONG:
				((long[])__a)[__dx] = ((Long)__v).longValue();
				break;
				
			case ArrayUtils.ARRAY_FLOAT:
				((float[])__a)[__dx] = ((Float)__v).floatValue();
				break;
				
			case ArrayUtils.ARRAY_DOUBLE:
				((double[])__a)[__dx] = ((Double)__v).doubleValue();
				break;
				
			case ArrayUtils.ARRAY_OBJECT:
				((Object[])__a)[__dx] = __v;
				break;
			
				// {@squirreljme.error ZZ0c Invalid array type.}
			default:
				throw new IllegalArgumentException("ZZ0c");
		}
	}
	
	/**
	 * Returns the type of array the object is.
	 *
	 * @param __a The array type.
	 * @return The type of array this is.
	 * @throws IllegalArgumentException If not an array.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/12/13
	 */
	public static final int arrayType(Object __a)
		throws IllegalArgumentException, NullPointerException
	{
		if (__a == null)
			throw new NullPointerException("NARG");
		
		if (__a instanceof Object[])
			return ArrayUtils.ARRAY_OBJECT;
		else if (__a instanceof boolean[])
			return ArrayUtils.ARRAY_BOOLEAN;
		else if (__a instanceof byte[])
			return ArrayUtils.ARRAY_BYTE;
		else if (__a instanceof short[])
			return ArrayUtils.ARRAY_SHORT;
		else if (__a instanceof char[])
			return ArrayUtils.ARRAY_CHARACTER;
		else if (__a instanceof int[])
			return ArrayUtils.ARRAY_INTEGER;
		else if (__a instanceof long[])
			return ArrayUtils.ARRAY_LONG;
		else if (__a instanceof float[])
			return ArrayUtils.ARRAY_FLOAT;
		else if (__a instanceof double[])
			return ArrayUtils.ARRAY_DOUBLE;
		
		// {@squirreljme.error ZZ0d Invalid array type.}
		throw new IllegalArgumentException("ZZ0d");
	}
	
	/**
	 * Allocates a new multi-dimensional array.

Name change from runt/apis/cldc-compact/cc/squirreljme/runtime/cldc/lang/BasicStaticMethod.java to modules/cldc-compact/src/main/java/cc/squirreljme/runtime/cldc/lang/BasicStaticMethod.java.

12
13
14
15
16
17
18

19
20
21
22
23
24
25
import cc.squirreljme.runtime.cldc.asm.StaticMethod;

/**
 * This represents a basic static method.
 *
 * @since 2019/04/19
 */

public final class BasicStaticMethod
	implements StaticMethod
{
	/** The method index this refers to. */
	private final int _index;
	
	/**







>







12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import cc.squirreljme.runtime.cldc.asm.StaticMethod;

/**
 * This represents a basic static method.
 *
 * @since 2019/04/19
 */
@Deprecated
public final class BasicStaticMethod
	implements StaticMethod
{
	/** The method index this refers to. */
	private final int _index;
	
	/**

Name change from runt/apis/cldc-compact/cc/squirreljme/runtime/cldc/lang/ClassData.java to modules/cldc-compact/src/main/java/cc/squirreljme/runtime/cldc/lang/ClassData.java.

Name change from runt/apis/cldc-compact/cc/squirreljme/runtime/cldc/lang/ClassDataV1.java to modules/cldc-compact/src/main/java/cc/squirreljme/runtime/cldc/lang/ClassDataV1.java.

57
58
59
60
61
62
63

64
65
66
67
68
69
70
	/**
	 * Version 1 constructor.
	 *
	 * @param __csi Class special index.
	 * @param __bn The binary name of this class.
	 * @param __sc Super classes.
	 * @param __ic Interface classes.

	 * @param __ij The JAR this class is in.
	 * @param __flags Class flags.
	 * @param __dcf Default constructor flag.
	 * @param __dcm Default constructor method.
	 * @param __efm The method used to fill enumerations.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/12/04







>







57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
	/**
	 * Version 1 constructor.
	 *
	 * @param __csi Class special index.
	 * @param __bn The binary name of this class.
	 * @param __sc Super classes.
	 * @param __ic Interface classes.
	 * @param __ct The class type.
	 * @param __ij The JAR this class is in.
	 * @param __flags Class flags.
	 * @param __dcf Default constructor flag.
	 * @param __dcm Default constructor method.
	 * @param __efm The method used to fill enumerations.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/12/04

Name change from runt/apis/cldc-compact/cc/squirreljme/runtime/cldc/lang/ClassFlag.java to modules/cldc-compact/src/main/java/cc/squirreljme/runtime/cldc/lang/ClassFlag.java.

14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
 * This represent class flags and their values.
 *
 * @since 2018/12/04
 */
public interface ClassFlag
{
	/** Public. */
	public static final int PUBLIC =
		0x0001;
	
	/** Final. */
	public static final int FINAL =
		0x0010;
	
	/** Super. */
	public static final int SUPER =
		0x0020;
	
	/** Interface. */
	public static final int INTERFACE =
		0x0200;
	
	/** Abstract. */
	public static final int ABSTRACT =
		0x0400;
	
	/** Synthetic. */
	public static final int SYNTHETIC =
		0x1000;
	
	/** Annotation. */
	public static final int ANNOTATION =
		0x2000;
	
	/** Enum. */
	public static final int ENUM =
		0x4000;
}








|



|



|



|



|



|



|



|



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
 * This represent class flags and their values.
 *
 * @since 2018/12/04
 */
public interface ClassFlag
{
	/** Public. */
	int PUBLIC =
		0x0001;
	
	/** Final. */
	int FINAL =
		0x0010;
	
	/** Super. */
	int SUPER =
		0x0020;
	
	/** Interface. */
	int INTERFACE =
		0x0200;
	
	/** Abstract. */
	int ABSTRACT =
		0x0400;
	
	/** Synthetic. */
	int SYNTHETIC =
		0x1000;
	
	/** Annotation. */
	int ANNOTATION =
		0x2000;
	
	/** Enum. */
	int ENUM =
		0x4000;
}

Name change from runt/apis/cldc-compact/cc/squirreljme/runtime/cldc/lang/GuestDepth.java to modules/cldc-compact/src/main/java/cc/squirreljme/runtime/cldc/lang/GuestDepth.java.

Name change from runt/apis/cldc-compact/cc/squirreljme/runtime/cldc/lang/ImplementationClass.java to modules/cldc-compact/src/main/java/cc/squirreljme/runtime/cldc/lang/ImplementationClass.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21

22
23
24
25
26
27
28

29
30
31
32
33
34
35
36
37
38
39
40
41

42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.cldc.lang;

import cc.squirreljme.runtime.cldc.asm.SystemProperties;

/**
 * This is used to return an appropriate class to use for the implemenation
 * of something. This is similar to {@link java.util.ServiceLoader} except
 * that it is specific to the virtual machine itself.
 *
 * @since 2018/12/13
 */

public final class ImplementationClass
{
	/**
	 * Not used.
	 *
	 * @since 2018/12/17
	 */

	private ImplementationClass()
	{
	}
	
	/**
	 * The class to use for a given implementation of something.
	 *
	 * @param __n The class name to lookup.
	 * @return The class that should get its instance created or {@code null}
	 * if there is no implementation.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/12/13
	 */

	public static final String implementationClass(String __n)
		throws NullPointerException
	{
		if (__n == null)
			throw new NullPointerException("NARG");
		
		// Check to see if there is a system property for the implementation
		// to allow it to be replaced
		try
		{
			String rv = System.getProperty("cc.squirreljme.implclass." + __n);
			if (rv != null)
				return rv;
		}
		catch (SecurityException e)
		{
		}
		
		// Otherwise use whatever the VM says to use
		return SystemProperties.implementationClass(__n);
	}
}













<
<







>







>













>


















|
|



1
2
3
4
5
6
7
8
9
10
11
12


13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.cldc.lang;



/**
 * This is used to return an appropriate class to use for the implemenation
 * of something. This is similar to {@link java.util.ServiceLoader} except
 * that it is specific to the virtual machine itself.
 *
 * @since 2018/12/13
 */
@Deprecated
public final class ImplementationClass
{
	/**
	 * Not used.
	 *
	 * @since 2018/12/17
	 */
	@Deprecated
	private ImplementationClass()
	{
	}
	
	/**
	 * The class to use for a given implementation of something.
	 *
	 * @param __n The class name to lookup.
	 * @return The class that should get its instance created or {@code null}
	 * if there is no implementation.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/12/13
	 */
	@Deprecated
	public static final String implementationClass(String __n)
		throws NullPointerException
	{
		if (__n == null)
			throw new NullPointerException("NARG");
		
		// Check to see if there is a system property for the implementation
		// to allow it to be replaced
		try
		{
			String rv = System.getProperty("cc.squirreljme.implclass." + __n);
			if (rv != null)
				return rv;
		}
		catch (SecurityException e)
		{
		}
		
		// No implementation
		return null;
	}
}

Name change from runt/apis/cldc-compact/cc/squirreljme/runtime/cldc/lang/OperatingSystemType.java to modules/cldc-compact/src/main/java/cc/squirreljme/runtime/cldc/lang/OperatingSystemType.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.cldc.lang;

import cc.squirreljme.runtime.cldc.asm.SystemAccess;
import java.lang.ref.Reference;
import java.lang.ref.WeakReference;

/**
 * This represents the type of operating system SquirrelJME is running on.
 *
 * This enumeration is intended to make OS detection standard.
 *
 * @since 2018/01/13
 */
public interface OperatingSystemType
{
	/** Unknown. */
	public static final int UNKNOWN =
		0;
	
	/** Amiga. */
	public static final int AMIGA =
		1;
	
	/** Linux. */
	public static final int LINUX =
		2;
	
	/** Class Mac OS. */
	public static final int MAC_OS_CLASSIC =
		3;
	
	/** Mac OS X. */
	public static final int MAC_OS_X =
		4;
	
	/** MS-DOS and compatibles. */
	public static final int MS_DOS =
		5;
	
	/** Palm OS. */
	public static final int PALM_OS =
		6;
		
	/** Solaris. */
	public static final int SOLARIS =
		7;
	
	/** Windows 16-bit. */
	public static final int WINDOWS_WIN16 =
		8;
	
	/** Windows CE. */
	public static final int WINDOWS_CE =
		9;
	
	/** Windows 9x. */
	public static final int WINDOWS_9X =
		10;
	
	/** Windows NT. */
	public static final int WINDOWS_NT =
		11;
}













<
<
<
<










|



|



|



|



|



|



|



|



|



|



|



|



1
2
3
4
5
6
7
8
9
10
11
12




13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.cldc.lang;





/**
 * This represents the type of operating system SquirrelJME is running on.
 *
 * This enumeration is intended to make OS detection standard.
 *
 * @since 2018/01/13
 */
public interface OperatingSystemType
{
	/** Unknown. */
	int UNKNOWN =
		0;
	
	/** Amiga. */
	int AMIGA =
		1;
	
	/** Linux. */
	int LINUX =
		2;
	
	/** Class Mac OS. */
	int MAC_OS_CLASSIC =
		3;
	
	/** Mac OS X. */
	int MAC_OS_X =
		4;
	
	/** MS-DOS and compatibles. */
	int MS_DOS =
		5;
	
	/** Palm OS. */
	int PALM_OS =
		6;
		
	/** Solaris. */
	int SOLARIS =
		7;
	
	/** Windows 16-bit. */
	int WINDOWS_WIN16 =
		8;
	
	/** Windows CE. */
	int WINDOWS_CE =
		9;
	
	/** Windows 9x. */
	int WINDOWS_9X =
		10;
	
	/** Windows NT. */
	int WINDOWS_NT =
		11;
}

Name change from runt/apis/cldc-compact/cc/squirreljme/runtime/cldc/lang/UncaughtExceptionHandler.java to modules/cldc-compact/src/main/java/cc/squirreljme/runtime/cldc/lang/UncaughtExceptionHandler.java.

Name change from runt/apis/cldc-compact/cc/squirreljme/runtime/cldc/lang/package-info.java to modules/cldc-compact/src/main/java/cc/squirreljme/runtime/cldc/lang/package-info.java.

Name change from runt/apis/cldc-compact/cc/squirreljme/runtime/cldc/package-info.java to modules/cldc-compact/src/main/java/cc/squirreljme/runtime/cldc/package-info.java.

Name change from runt/apis/cldc-compact/cc/squirreljme/runtime/cldc/ref/PrimitiveReference.java to modules/cldc-compact/src/main/java/cc/squirreljme/runtime/cldc/ref/PrimitiveReference.java.

Name change from runt/apis/cldc-compact/cc/squirreljme/runtime/cldc/ref/PrimitiveWeakReference.java to modules/cldc-compact/src/main/java/cc/squirreljme/runtime/cldc/ref/PrimitiveWeakReference.java.

Name change from runt/apis/cldc-compact/cc/squirreljme/runtime/cldc/ref/package-info.java to modules/cldc-compact/src/main/java/cc/squirreljme/runtime/cldc/ref/package-info.java.

Name change from runt/apis/cldc-compact/cc/squirreljme/runtime/cldc/util/ByteIntegerArray.java to modules/cldc-compact/src/main/java/cc/squirreljme/runtime/cldc/util/ByteIntegerArray.java.

Name change from runt/apis/cldc-compact/cc/squirreljme/runtime/cldc/util/CharacterIntegerArray.java to modules/cldc-compact/src/main/java/cc/squirreljme/runtime/cldc/util/CharacterIntegerArray.java.

Name change from runt/apis/cldc-compact/cc/squirreljme/runtime/cldc/util/DoubleArrayList.java to modules/cldc-compact/src/main/java/cc/squirreljme/runtime/cldc/util/DoubleArrayList.java.

86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
	 * @return The old value.
	 * @throws IndexOutOfBoundsException If the index is not within bounds.
	 * @since 2020/01/01
	 */
	public double set(int __i, double __v)
		throws IndexOutOfBoundsException
	{
		return this.set(__i, __v);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2020/01/01
	 */
	@Override







|







86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
	 * @return The old value.
	 * @throws IndexOutOfBoundsException If the index is not within bounds.
	 * @since 2020/01/01
	 */
	public double set(int __i, double __v)
		throws IndexOutOfBoundsException
	{
		return this.set(__i, Double.valueOf(__v));
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2020/01/01
	 */
	@Override

Name change from runt/apis/cldc-compact/cc/squirreljme/runtime/cldc/util/FDMLMath.java to modules/cldc-compact/src/main/java/cc/squirreljme/runtime/cldc/util/FDMLMath.java.

106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
	 * @param __v The input value.
	 * @return The resulting logarithm value.
	 * @since 2018/11/02
	 */
	@ImplementationNote("Source http://www.netlib.org/fdlibm/e_log.c")
	public static double log(double __v)
	{
		double hfsq, f, s, z, R, w, t1, t2, dk;
		int k, hx, i, j;
		int uulx;

		// high and low word of __v
		hx = __hi(__v);
		uulx = __lo(__v);

		k = 0;
		
		// x < 2**-1022
		if (hx < 0x00100000)
		{
			// log(+-0)=-inf
			if (((hx & 0x7FFFFFFF) | uulx) == 0) 
				return -_TWO54 / _ZERO;
			
			// log(-#) = NaN
			if (hx < 0)
				return (__v - __v) / _ZERO;
			
			// subnormal number, scale up __v
			k -= 54;
			__v *= _TWO54;
			
			// high word of __v
			hx = __hi(__v);
		} 
		
		if (hx >= 0x7FF00000)
			return __v + __v;
		
		k += (hx >> 20) - 1023;
		hx &= 0x000FFFFF;
		i = (hx + 0x95F64) & 0x100000;
		
		// normalize x or x/2
		// __HI(__v) = hx | (i^0x3FF00000);
		__v = __compose(hx | (i ^ 0x3FF00000), __lo(__v));
		k += (i >> 20);
		f = __v - 1.0;
		
		// |f| < 2**-20
		if ((0x000FFFFF & (2 + hx)) < 3)
		{
			if (f == _ZERO)
				if (k == 0)
					return _ZERO;
				else
				{
					dk = (double)k;
					return dk * _LN2_HI + dk * _LN2_LO;
				}
			
			R = f * f * (0.5 - 0.33333333333333333 * f);
			if (k == 0)
				return f - R;
			else
			{
				dk = (double)k;
				return dk * _LN2_HI - ((R - dk * _LN2_LO) - f);
			}
		}
		
		s = f / (2.0 + f); 
		dk = (double)k;
		z = s * s;
		i = hx - 0x6147A;
		w = z * z;
		j = 0x6B851 - hx;
		t1 = w * (_LG2 + w * (_LG4 + w * _LG6)); 
		t2 = z * (_LG1 + w * (_LG3 + w * (_LG5 + w * _LG7))); 
		i |= j;
		R = t2 + t1;
		
		if (i > 0)
		{
			hfsq = 0.5 * f * f;
			if (k == 0)
				return f - (hfsq - s * (hfsq + R));
			else
				return dk * _LN2_HI -
					((hfsq - (s * (hfsq + R) + dk * _LN2_LO)) - f);
		}
		else
		{
			if (k == 0)
				return f - s * (f - R);
			else
				return dk * _LN2_HI - (( s * (f - R) - dk * _LN2_LO) - f);
		}
	}

	/**
	 * Square root of a number.
	 *
	 * @param __v The input value.
	 * @return The resulting square root value.
	 * @since 2018/11/02
	 */
	@ImplementationNote("Source: http://www.netlib.org/fdlibm/e_sqrt.c")
	public static double sqrt(double __v)
	{
		double z;
		int uur, uut1, uus1, uuix1, uuq1;
		int ix0, s0, q, m, t, i;

		// high and low word of __v
		ix0 = __hi(__v);
		uuix1 = __lo(__v);

		// Take care of Inf and NaN
		if ((ix0 & 0x7FF00000) == 0x7FF00000)
		{
			// sqrt(NaN)=NaN, sqrt(+inf)=+inf
			// sqrt(-inf)=sNaN
			return __v * __v + __v;
		}
		
		// take care of zero
		if (ix0 <= 0)
		{
			// sqrt(+-0) = +-0
			if (((ix0 & (~_SIGN)) | uuix1) == 0)
				return __v;
			
			// sqrt(-ve) = sNaN
			else if (ix0 < 0)
				return (__v - __v) / (__v - __v);
		}
		







|




|
|








|



|



|


|











|






|

|



|


|

|



|









|
|

|





|

|
|




|

|


















|
|













|







106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
	 * @param __v The input value.
	 * @return The resulting logarithm value.
	 * @since 2018/11/02
	 */
	@ImplementationNote("Source http://www.netlib.org/fdlibm/e_log.c")
	public static double log(double __v)
	{
		double hfsq, f, s, z, r, w, t1, t2, dk;
		int k, hx, i, j;
		int uulx;

		// high and low word of __v
		hx = FDMLMath.__hi(__v);
		uulx = FDMLMath.__lo(__v);

		k = 0;
		
		// x < 2**-1022
		if (hx < 0x00100000)
		{
			// log(+-0)=-inf
			if (((hx & 0x7FFFFFFF) | uulx) == 0) 
				return -FDMLMath._TWO54 / FDMLMath._ZERO;
			
			// log(-#) = NaN
			if (hx < 0)
				return (__v - __v) / FDMLMath._ZERO;
			
			// subnormal number, scale up __v
			k -= 54;
			__v *= FDMLMath._TWO54;
			
			// high word of __v
			hx = FDMLMath.__hi(__v);
		} 
		
		if (hx >= 0x7FF00000)
			return __v + __v;
		
		k += (hx >> 20) - 1023;
		hx &= 0x000FFFFF;
		i = (hx + 0x95F64) & 0x100000;
		
		// normalize x or x/2
		// __HI(__v) = hx | (i^0x3FF00000);
		__v = FDMLMath.__compose(hx | (i ^ 0x3FF00000), FDMLMath.__lo(__v));
		k += (i >> 20);
		f = __v - 1.0;
		
		// |f| < 2**-20
		if ((0x000FFFFF & (2 + hx)) < 3)
		{
			if (f == FDMLMath._ZERO)
				if (k == 0)
					return FDMLMath._ZERO;
				else
				{
					dk = (double)k;
					return dk * FDMLMath._LN2_HI + dk * FDMLMath._LN2_LO;
				}
			
			r = f * f * (0.5 - 0.33333333333333333 * f);
			if (k == 0)
				return f - r;
			else
			{
				dk = (double)k;
				return dk * FDMLMath._LN2_HI - ((r - dk * FDMLMath._LN2_LO) - f);
			}
		}
		
		s = f / (2.0 + f); 
		dk = (double)k;
		z = s * s;
		i = hx - 0x6147A;
		w = z * z;
		j = 0x6B851 - hx;
		t1 = w * (FDMLMath._LG2 + w * (FDMLMath._LG4 + w * FDMLMath._LG6));
		t2 = z * (FDMLMath._LG1 + w * (FDMLMath._LG3 + w * (FDMLMath._LG5 + w * FDMLMath._LG7)));
		i |= j;
		r = t2 + t1;
		
		if (i > 0)
		{
			hfsq = 0.5 * f * f;
			if (k == 0)
				return f - (hfsq - s * (hfsq + r));
			else
				return dk * FDMLMath._LN2_HI -
					((hfsq - (s * (hfsq + r) + dk * FDMLMath._LN2_LO)) - f);
		}
		else
		{
			if (k == 0)
				return f - s * (f - r);
			else
				return dk * FDMLMath._LN2_HI - (( s * (f - r) - dk * FDMLMath._LN2_LO) - f);
		}
	}

	/**
	 * Square root of a number.
	 *
	 * @param __v The input value.
	 * @return The resulting square root value.
	 * @since 2018/11/02
	 */
	@ImplementationNote("Source: http://www.netlib.org/fdlibm/e_sqrt.c")
	public static double sqrt(double __v)
	{
		double z;
		int uur, uut1, uus1, uuix1, uuq1;
		int ix0, s0, q, m, t, i;

		// high and low word of __v
		ix0 = FDMLMath.__hi(__v);
		uuix1 = FDMLMath.__lo(__v);

		// Take care of Inf and NaN
		if ((ix0 & 0x7FF00000) == 0x7FF00000)
		{
			// sqrt(NaN)=NaN, sqrt(+inf)=+inf
			// sqrt(-inf)=sNaN
			return __v * __v + __v;
		}
		
		// take care of zero
		if (ix0 <= 0)
		{
			// sqrt(+-0) = +-0
			if (((ix0 & (~FDMLMath._SIGN)) | uuix1) == 0)
				return __v;
			
			// sqrt(-ve) = sNaN
			else if (ix0 < 0)
				return (__v - __v) / (__v - __v);
		}
		
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
		// unbias exponent
		m -= 1023;
		ix0 = (ix0 & 0x000FFFFF) | 0x00100000;
		
		// odd m, double __v to make it even
		if ((m & 1) != 0)
		{
			ix0 += ix0 + ((uuix1 & _SIGN) >>> 31);
			uuix1 += uuix1;
		}
		
		// m = [m/2]
		m >>= 1;

		// generate sqrt(__v) bit by bit
		ix0 += ix0 + ((uuix1 & _SIGN) >>> 31);
		uuix1 += uuix1;
		
		// [q,q1] = sqrt(__v)
		q = uuq1 = s0 = uus1 = 0;
		
		// r = moving bit from right to left
		uur = 0x00200000;
		while (uur != 0)
		{
			t = s0 + uur;
			if (t <= ix0)
			{
				s0 = t + uur;
				ix0 -= t;
				q += uur;
			}
			ix0 += ix0 + ((uuix1 & _SIGN) >>> 31);
			uuix1 += uuix1;
			uur >>>= 1;
		}

		uur = _SIGN;
		while (uur != 0)
		{
			uut1 = uus1 + uur;
			t = s0;
			
			if ((t < ix0) || ((t == ix0) &&
				UnsignedInteger.compareSignedUnsigned(uut1, uuix1) <= 0))
			{
				uus1 = uut1 + uur;
				
				if (((uut1 & _SIGN) == _SIGN) && (uus1 & _SIGN) == 0)
					s0 += 1;
				
				ix0 -= t;
				
				if (UnsignedInteger.compareUnsigned(uuix1, uut1) < 0)
					ix0 -= 1;
				
				uuix1 -= uut1;
				uuq1 += uur;
			}
			
			ix0 += ix0 + ((uuix1 & _SIGN) >>> 31);
			uuix1 += uuix1;
			uur >>>= 1;
		}

		// use floating add to find out rounding direction
		if ((ix0 | uuix1) != 0)
		{
			// trigger inexact flag
			z = _ONE - _TINY;
			
			if (z >= _ONE)
			{
				z = _ONE + _TINY;
				if (uuq1 == 0xFFFFFFFF)
				{
					uuq1 = 0;
					q += 1;
				}
				else if (z > _ONE)
				{
					if (uuq1 == 0xFFFFFFFE)
						q += 1;
					uuq1 += 2;
				}
				else
					uuq1 += (uuq1 & 1);
			}
		}
		
		ix0 = (q >> 1) + 0x3FE00000;
		uuix1 = uuq1 >>> 1;
		
		if ((q & 1) == 1)
			uuix1 |= _SIGN;
		
		ix0 += (m << 20);
		
		return __compose(ix0, uuix1);
	}
	
	/**
	 * Compose high and low value to double.
	 *
	 * @param __hi The high value.
	 * @param __lo The low value.







|







|
















|




|










|











|








|

|

|





|














|



|







265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
		// unbias exponent
		m -= 1023;
		ix0 = (ix0 & 0x000FFFFF) | 0x00100000;
		
		// odd m, double __v to make it even
		if ((m & 1) != 0)
		{
			ix0 += ix0 + ((uuix1 & FDMLMath._SIGN) >>> 31);
			uuix1 += uuix1;
		}
		
		// m = [m/2]
		m >>= 1;

		// generate sqrt(__v) bit by bit
		ix0 += ix0 + ((uuix1 & FDMLMath._SIGN) >>> 31);
		uuix1 += uuix1;
		
		// [q,q1] = sqrt(__v)
		q = uuq1 = s0 = uus1 = 0;
		
		// r = moving bit from right to left
		uur = 0x00200000;
		while (uur != 0)
		{
			t = s0 + uur;
			if (t <= ix0)
			{
				s0 = t + uur;
				ix0 -= t;
				q += uur;
			}
			ix0 += ix0 + ((uuix1 & FDMLMath._SIGN) >>> 31);
			uuix1 += uuix1;
			uur >>>= 1;
		}

		uur = FDMLMath._SIGN;
		while (uur != 0)
		{
			uut1 = uus1 + uur;
			t = s0;
			
			if ((t < ix0) || ((t == ix0) &&
				UnsignedInteger.compareSignedUnsigned(uut1, uuix1) <= 0))
			{
				uus1 = uut1 + uur;
				
				if (((uut1 & FDMLMath._SIGN) == FDMLMath._SIGN) && (uus1 & FDMLMath._SIGN) == 0)
					s0 += 1;
				
				ix0 -= t;
				
				if (UnsignedInteger.compareUnsigned(uuix1, uut1) < 0)
					ix0 -= 1;
				
				uuix1 -= uut1;
				uuq1 += uur;
			}
			
			ix0 += ix0 + ((uuix1 & FDMLMath._SIGN) >>> 31);
			uuix1 += uuix1;
			uur >>>= 1;
		}

		// use floating add to find out rounding direction
		if ((ix0 | uuix1) != 0)
		{
			// trigger inexact flag
			z = FDMLMath._ONE - FDMLMath._TINY;
			
			if (z >= FDMLMath._ONE)
			{
				z = FDMLMath._ONE + FDMLMath._TINY;
				if (uuq1 == 0xFFFFFFFF)
				{
					uuq1 = 0;
					q += 1;
				}
				else if (z > FDMLMath._ONE)
				{
					if (uuq1 == 0xFFFFFFFE)
						q += 1;
					uuq1 += 2;
				}
				else
					uuq1 += (uuq1 & 1);
			}
		}
		
		ix0 = (q >> 1) + 0x3FE00000;
		uuix1 = uuq1 >>> 1;
		
		if ((q & 1) == 1)
			uuix1 |= FDMLMath._SIGN;
		
		ix0 += (m << 20);
		
		return FDMLMath.__compose(ix0, uuix1);
	}
	
	/**
	 * Compose high and low value to double.
	 *
	 * @param __hi The high value.
	 * @param __lo The low value.

Name change from runt/apis/cldc-compact/cc/squirreljme/runtime/cldc/util/FloatArrayList.java to modules/cldc-compact/src/main/java/cc/squirreljme/runtime/cldc/util/FloatArrayList.java.

86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
	 * @return The old value.
	 * @throws IndexOutOfBoundsException If the index is not within bounds.
	 * @since 2020/01/01
	 */
	public float set(int __i, float __v)
		throws IndexOutOfBoundsException
	{
		return this.set(__i, __v);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2020/01/01
	 */
	@Override







|







86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
	 * @return The old value.
	 * @throws IndexOutOfBoundsException If the index is not within bounds.
	 * @since 2020/01/01
	 */
	public float set(int __i, float __v)
		throws IndexOutOfBoundsException
	{
		return this.set(__i, Float.valueOf(__v));
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2020/01/01
	 */
	@Override

Name change from runt/apis/cldc-compact/cc/squirreljme/runtime/cldc/util/IntegerArray.java to modules/cldc-compact/src/main/java/cc/squirreljme/runtime/cldc/util/IntegerArray.java.

21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
	 * Gets the value at the given index.
	 *
	 * @param __i The index to get.
	 * @return The value at the given index.
	 * @throws IndexOutOfBoundsException If the index is outside of bounds.
	 * @since 2018/10/28
	 */
	public abstract int get(int __i);
	
	/**
	 * Sets the value at the given index.
	 *
	 * @param __i The index to set.
	 * @param __v The value to set.
	 * @throws IndexOutOfBoundsException If the index is outside of bounds.
	 * @since 2018/10/28
	 */
	public abstract void set(int __i, int __v);
	
	/**
	 * Returns the size of the array.
	 *
	 * @return The array size.
	 * @since 2018/10/28
	 */
	public abstract int size();
}








|









|







|


21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
	 * Gets the value at the given index.
	 *
	 * @param __i The index to get.
	 * @return The value at the given index.
	 * @throws IndexOutOfBoundsException If the index is outside of bounds.
	 * @since 2018/10/28
	 */
	int get(int __i);
	
	/**
	 * Sets the value at the given index.
	 *
	 * @param __i The index to set.
	 * @param __v The value to set.
	 * @throws IndexOutOfBoundsException If the index is outside of bounds.
	 * @since 2018/10/28
	 */
	void set(int __i, int __v);
	
	/**
	 * Returns the size of the array.
	 *
	 * @return The array size.
	 * @since 2018/10/28
	 */
	int size();
}

Name change from runt/apis/cldc-compact/cc/squirreljme/runtime/cldc/util/IntegerArrays.java to modules/cldc-compact/src/main/java/cc/squirreljme/runtime/cldc/util/IntegerArrays.java.

Name change from runt/apis/cldc-compact/cc/squirreljme/runtime/cldc/util/IntegerIntegerArray.java to modules/cldc-compact/src/main/java/cc/squirreljme/runtime/cldc/util/IntegerIntegerArray.java.

Name change from runt/apis/cldc-compact/cc/squirreljme/runtime/cldc/util/IteratorToEnumeration.java to modules/cldc-compact/src/main/java/cc/squirreljme/runtime/cldc/util/IteratorToEnumeration.java.

Name change from runt/apis/cldc-compact/cc/squirreljme/runtime/cldc/util/LongArrayList.java to modules/cldc-compact/src/main/java/cc/squirreljme/runtime/cldc/util/LongArrayList.java.

86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
	 * @return The old value.
	 * @throws IndexOutOfBoundsException If the index is not within bounds.
	 * @since 2020/01/01
	 */
	public long set(int __i, long __v)
		throws IndexOutOfBoundsException
	{
		return this.set(__i, __v);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2020/01/01
	 */
	@Override







|







86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
	 * @return The old value.
	 * @throws IndexOutOfBoundsException If the index is not within bounds.
	 * @since 2020/01/01
	 */
	public long set(int __i, long __v)
		throws IndexOutOfBoundsException
	{
		return this.set(__i, Long.valueOf(__v));
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2020/01/01
	 */
	@Override

Name change from runt/apis/cldc-compact/cc/squirreljme/runtime/cldc/util/NaturalComparator.java to modules/cldc-compact/src/main/java/cc/squirreljme/runtime/cldc/util/NaturalComparator.java.

63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
	 * @param <V> The type of value to compare.
	 * @return The instance of the natural comparator.
	 * @since 2016/09/06
	 */
	@SuppressWarnings({"unchecked"})
	public static final <V> NaturalComparator<V> instance()
	{
		Reference<NaturalComparator> ref = _REF;
		NaturalComparator rv;
		
		// Cache?
		if (ref == null || null == (rv = ref.get()))
			_REF = new WeakReference<>((rv = new NaturalComparator()));
		
		// Return it
		return (NaturalComparator<V>)rv;
	}
}








|




|






63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
	 * @param <V> The type of value to compare.
	 * @return The instance of the natural comparator.
	 * @since 2016/09/06
	 */
	@SuppressWarnings({"unchecked"})
	public static final <V> NaturalComparator<V> instance()
	{
		Reference<NaturalComparator> ref = NaturalComparator._REF;
		NaturalComparator rv;
		
		// Cache?
		if (ref == null || null == (rv = ref.get()))
			NaturalComparator._REF = new WeakReference<>((rv = new NaturalComparator()));
		
		// Return it
		return (NaturalComparator<V>)rv;
	}
}

Name change from runt/apis/cldc-compact/cc/squirreljme/runtime/cldc/util/ShellSort.java to modules/cldc-compact/src/main/java/cc/squirreljme/runtime/cldc/util/ShellSort.java.

25
26
27
28
29
30
31

32
33
34
35
36
37
38
	/** Gaps used in shell sort. */
	static final int[] _GAPS =
		new int[]{701, 301, 132, 57, 23, 10, 4, 1};
	
	/**
	 * Sorts the specified collection.
	 *

	 * @param __a The collection to sort.
	 * @param __from The from index.
	 * @param __to The to index.
	 * @param __comp The comparator to use.
	 * @throws IndexOutOfBoundsException If the from or to index are
	 * outside of bounds.
	 * @throws IllegalArgumentException If the from address is greater than







>







25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
	/** Gaps used in shell sort. */
	static final int[] _GAPS =
		new int[]{701, 301, 132, 57, 23, 10, 4, 1};
	
	/**
	 * Sorts the specified collection.
	 *
	 * @param <T> The type to sort.
	 * @param __a The collection to sort.
	 * @param __from The from index.
	 * @param __to The to index.
	 * @param __comp The comparator to use.
	 * @throws IndexOutOfBoundsException If the from or to index are
	 * outside of bounds.
	 * @throws IllegalArgumentException If the from address is greater than

Name change from runt/apis/cldc-compact/cc/squirreljme/runtime/cldc/util/ShortIntegerArray.java to modules/cldc-compact/src/main/java/cc/squirreljme/runtime/cldc/util/ShortIntegerArray.java.

Name change from runt/apis/cldc-compact/cc/squirreljme/runtime/cldc/util/SynchronizedEntrySet.java to modules/cldc-compact/src/main/java/cc/squirreljme/runtime/cldc/util/SynchronizedEntrySet.java.

Name change from runt/apis/cldc-compact/cc/squirreljme/runtime/cldc/util/SynchronizedEntrySetIterator.java to modules/cldc-compact/src/main/java/cc/squirreljme/runtime/cldc/util/SynchronizedEntrySetIterator.java.

Name change from runt/apis/cldc-compact/cc/squirreljme/runtime/cldc/util/SynchronizedEntrySetIteratorNotNull.java to modules/cldc-compact/src/main/java/cc/squirreljme/runtime/cldc/util/SynchronizedEntrySetIteratorNotNull.java.

Name change from runt/apis/cldc-compact/cc/squirreljme/runtime/cldc/util/SynchronizedEntrySetNotNull.java to modules/cldc-compact/src/main/java/cc/squirreljme/runtime/cldc/util/SynchronizedEntrySetNotNull.java.

Name change from runt/apis/cldc-compact/cc/squirreljme/runtime/cldc/util/SynchronizedIterator.java to modules/cldc-compact/src/main/java/cc/squirreljme/runtime/cldc/util/SynchronizedIterator.java.

Name change from runt/apis/cldc-compact/cc/squirreljme/runtime/cldc/util/SynchronizedMapEntry.java to modules/cldc-compact/src/main/java/cc/squirreljme/runtime/cldc/util/SynchronizedMapEntry.java.

Name change from runt/apis/cldc-compact/cc/squirreljme/runtime/cldc/util/SynchronizedMapEntryNotNull.java to modules/cldc-compact/src/main/java/cc/squirreljme/runtime/cldc/util/SynchronizedMapEntryNotNull.java.

Name change from runt/apis/cldc-compact/cc/squirreljme/runtime/cldc/util/SynchronizedSet.java to modules/cldc-compact/src/main/java/cc/squirreljme/runtime/cldc/util/SynchronizedSet.java.

Name change from runt/apis/cldc-compact/cc/squirreljme/runtime/cldc/util/UnsignedInteger.java to modules/cldc-compact/src/main/java/cc/squirreljme/runtime/cldc/util/UnsignedInteger.java.

121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
			return 1;
	}
	
	/**
	 * Compares a signed and unsigned value.
	 *
	 * @param __a The first value.
	 * @param __b The second value.
	 * @return The resulting comparison.
	 * @since 2018/11/03
	 */
	public static final int compareSignedUnsigned(int __a, int __ub)
	{
		throw new todo.TODO();
	}







|







121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
			return 1;
	}
	
	/**
	 * Compares a signed and unsigned value.
	 *
	 * @param __a The first value.
	 * @param __ub The second value.
	 * @return The resulting comparison.
	 * @since 2018/11/03
	 */
	public static final int compareSignedUnsigned(int __a, int __ub)
	{
		throw new todo.TODO();
	}

Name change from runt/apis/cldc-compact/cc/squirreljme/runtime/cldc/util/package-info.java to modules/cldc-compact/src/main/java/cc/squirreljme/runtime/cldc/util/package-info.java.

Name change from runt/apis/cldc-compact/java/io/BufferedReader.java to modules/cldc-compact/src/main/java/java/io/BufferedReader.java.

8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.io;

import cc.squirreljme.runtime.cldc.annotation.ImplementationNote;
import cc.squirreljme.runtime.cldc.annotation.ProgrammerTip;
import java.util.Arrays;

/**
 * This is a reader which is backed by a buffer which should increase the
 * efficiency of read operations by allowing for bulk reads for easily.
 *
 * It is recommended to wrap these around {@link InputStreamReader} for
 * example due to that class not being efficient due to character conversions.







<







8
9
10
11
12
13
14

15
16
17
18
19
20
21
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.io;

import cc.squirreljme.runtime.cldc.annotation.ImplementationNote;
import cc.squirreljme.runtime.cldc.annotation.ProgrammerTip;


/**
 * This is a reader which is backed by a buffer which should increase the
 * efficiency of read operations by allowing for bulk reads for easily.
 *
 * It is recommended to wrap these around {@link InputStreamReader} for
 * example due to that class not being efficient due to character conversions.
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
	 * @param __r The reader to source from.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/11/22
	 */
	public BufferedReader(Reader __r)
		throws NullPointerException
	{
		this(__r, _DEFAULT_SIZE);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/11/22
	 */
	@Override







|







78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
	 * @param __r The reader to source from.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/11/22
	 */
	public BufferedReader(Reader __r)
		throws NullPointerException
	{
		this(__r, BufferedReader._DEFAULT_SIZE);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/11/22
	 */
	@Override

Name change from runt/apis/cldc-compact/java/io/BufferedWriter.java to modules/cldc-compact/src/main/java/java/io/BufferedWriter.java.

Name change from runt/apis/cldc-compact/java/io/ByteArrayInputStream.java to modules/cldc-compact/src/main/java/java/io/ByteArrayInputStream.java.

Name change from runt/apis/cldc-compact/java/io/ByteArrayOutputStream.java to modules/cldc-compact/src/main/java/java/io/ByteArrayOutputStream.java.

33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
	/**
	 * Initializes the output stream using the default capacity of 32 bytes.
	 *
	 * @since 2018/11/06
	 */
	public ByteArrayOutputStream()
	{
		this(_CAPACITY);
	}
	
	/**
	 * Initializes the output stream using the given capacity.
	 *
	 * @param __cap The capacity to use.
	 * @throws IllegalArgumentException If the capacity is negative.







|







33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
	/**
	 * Initializes the output stream using the default capacity of 32 bytes.
	 *
	 * @since 2018/11/06
	 */
	public ByteArrayOutputStream()
	{
		this(ByteArrayOutputStream._CAPACITY);
	}
	
	/**
	 * Initializes the output stream using the given capacity.
	 *
	 * @param __cap The capacity to use.
	 * @throws IllegalArgumentException If the capacity is negative.
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
		byte[] buf = this.buf;
		int count = this.count;
		
		synchronized (this)
		{
			// Not enough room? Increase buffer size
			if (count == buf.length)
				this.buf = (buf = Arrays.copyOf(buf, count + _CAPACITY));
			
			// Write byte at end position
			buf[count] = (byte)__b;
			this.count = count + 1;
		}
	}
	







|







133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
		byte[] buf = this.buf;
		int count = this.count;
		
		synchronized (this)
		{
			// Not enough room? Increase buffer size
			if (count == buf.length)
				this.buf = (buf = Arrays.copyOf(buf, count + ByteArrayOutputStream._CAPACITY));
			
			// Write byte at end position
			buf[count] = (byte)__b;
			this.count = count + 1;
		}
	}
	
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
		int count = this.count;
		
		synchronized (this)
		{
			// Reallocate buffer if it cannot be store data
			int endcount = count + __l;
			if (endcount > buf.length)
				this.buf = (buf = Arrays.copyOf(buf, endcount + _CAPACITY));
			
			// Write bytes
			for (int i = 0; i < __l; i++)
				buf[count++] = __b[__o++];
			
			this.count = endcount;
		}







|







163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
		int count = this.count;
		
		synchronized (this)
		{
			// Reallocate buffer if it cannot be store data
			int endcount = count + __l;
			if (endcount > buf.length)
				this.buf = (buf = Arrays.copyOf(buf, endcount + ByteArrayOutputStream._CAPACITY));
			
			// Write bytes
			for (int i = 0; i < __l; i++)
				buf[count++] = __b[__o++];
			
			this.count = endcount;
		}

Name change from runt/apis/cldc-compact/java/io/Closeable.java to modules/cldc-compact/src/main/java/java/io/Closeable.java.

34
35
36
37
38
39
40
41
42
43
44
	 * this case should only be considered if this is a top level resource
	 * which relies on no other {@link Closeable} resources.
	 *
	 * @throws IOException If there was an error closing this resource.
	 * @since 2016/04/12
	 */
	@Override
	public abstract void close()
		throws IOException;
}








|



34
35
36
37
38
39
40
41
42
43
44
	 * this case should only be considered if this is a top level resource
	 * which relies on no other {@link Closeable} resources.
	 *
	 * @throws IOException If there was an error closing this resource.
	 * @since 2016/04/12
	 */
	@Override
	void close()
		throws IOException;
}

Name change from runt/apis/cldc-compact/java/io/DataInput.java to modules/cldc-compact/src/main/java/java/io/DataInput.java.

8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.io;

public interface DataInput
{
	public abstract boolean readBoolean()
		throws IOException;
	
	public abstract byte readByte()
		throws IOException;
	
	public abstract char readChar()
		throws IOException;
	
	public abstract double readDouble()
		throws IOException;
	
	public abstract float readFloat()
		throws IOException;
	
	public abstract void readFully(byte[] __a)
		throws IOException;
	
	public abstract void readFully(byte[] __a, int __b, int __c)
		throws IOException;
	
	public abstract int readInt()
		throws IOException;
	
	public abstract long readLong()
		throws IOException;
	
	public abstract short readShort()
		throws IOException;
	
	public abstract String readUTF()
		throws IOException;
	
	public abstract int readUnsignedByte()
		throws IOException;
	
	public abstract int readUnsignedShort()
		throws IOException;
	
	public abstract int skipBytes(int __a)
		throws IOException;
}








|


|


|


|


|


|


|


|


|


|


|


|


|


|



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.io;

public interface DataInput
{
	boolean readBoolean()
		throws IOException;
	
	byte readByte()
		throws IOException;
	
	char readChar()
		throws IOException;
	
	double readDouble()
		throws IOException;
	
	float readFloat()
		throws IOException;
	
	void readFully(byte[] __a)
		throws IOException;
	
	void readFully(byte[] __a, int __b, int __c)
		throws IOException;
	
	int readInt()
		throws IOException;
	
	long readLong()
		throws IOException;
	
	short readShort()
		throws IOException;
	
	String readUTF()
		throws IOException;
	
	int readUnsignedByte()
		throws IOException;
	
	int readUnsignedShort()
		throws IOException;
	
	int skipBytes(int __a)
		throws IOException;
}

Name change from runt/apis/cldc-compact/java/io/DataInputStream.java to modules/cldc-compact/src/main/java/java/io/DataInputStream.java.

35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
		throws NullPointerException
	{
		// Check
		if (__in == null)
			throw new NullPointerException();
		
		// Set
		in = __in;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/12/03
	 */
	@Override







|







35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
		throws NullPointerException
	{
		// Check
		if (__in == null)
			throw new NullPointerException();
		
		// Set
		this.in = __in;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/12/03
	 */
	@Override

Name change from runt/apis/cldc-compact/java/io/DataOutput.java to modules/cldc-compact/src/main/java/java/io/DataOutput.java.

8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.io;

public interface DataOutput
{
	public abstract void write(int __b)
		throws IOException;
	
	public abstract void write(byte[] __b)
		throws IOException, NullPointerException;
	
	public abstract void write(byte[] __b, int __o, int __l)
		throws IndexOutOfBoundsException, IOException, NullPointerException;
	
	public abstract void writeBoolean(boolean __v)
		throws IOException;
	
	public abstract void writeByte(int __v)
		throws IOException;
	
	public abstract void writeBytes(String __v)
		throws IOException, NullPointerException;
	
	public abstract void writeChar(int __v)
		throws IOException;
	
	public abstract void writeChars(String __v)
		throws IOException, NullPointerException;
	
	public abstract void writeDouble(double __v)
		throws IOException;
	
	public abstract void writeFloat(float __v)
		throws IOException;
	
	public abstract void writeInt(int __v)
		throws IOException;
	
	public abstract void writeLong(long __v)
		throws IOException;
	
	public abstract void writeShort(int __v)
		throws IOException;
	
	public abstract void writeUTF(String __v)
		throws IOException;
}








|


|


|


|


|


|


|


|


|


|


|


|


|


|



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.io;

public interface DataOutput
{
	void write(int __b)
		throws IOException;
	
	void write(byte[] __b)
		throws IOException, NullPointerException;
	
	void write(byte[] __b, int __o, int __l)
		throws IndexOutOfBoundsException, IOException, NullPointerException;
	
	void writeBoolean(boolean __v)
		throws IOException;
	
	void writeByte(int __v)
		throws IOException;
	
	void writeBytes(String __v)
		throws IOException, NullPointerException;
	
	void writeChar(int __v)
		throws IOException;
	
	void writeChars(String __v)
		throws IOException, NullPointerException;
	
	void writeDouble(double __v)
		throws IOException;
	
	void writeFloat(float __v)
		throws IOException;
	
	void writeInt(int __v)
		throws IOException;
	
	void writeLong(long __v)
		throws IOException;
	
	void writeShort(int __v)
		throws IOException;
	
	void writeUTF(String __v)
		throws IOException;
}

Name change from runt/apis/cldc-compact/java/io/DataOutputStream.java to modules/cldc-compact/src/main/java/java/io/DataOutputStream.java.

Name change from runt/apis/cldc-compact/java/io/EOFException.java to modules/cldc-compact/src/main/java/java/io/EOFException.java.

Name change from runt/apis/cldc-compact/java/io/IOException.java to modules/cldc-compact/src/main/java/java/io/IOException.java.

Name change from runt/apis/cldc-compact/java/io/InputStream.java to modules/cldc-compact/src/main/java/java/io/InputStream.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.io;

import cc.squirreljme.runtime.cldc.annotation.ImplementationNote;
import cc.squirreljme.runtime.cldc.annotation.ProgrammerTip;

/**
 * This is the base class for any input stream which is used for reading a
 * stream of bytes.
 *
 * @since 2019/01/20
 */
public abstract class InputStream
	implements Closeable
{
	/** The number of bytes to skip at a time. */
	private static final int _SKIP_LEN =
		256;
	
	/**
	 * Initializes the base input stream.
	 *
	 * @since 2018/10/13
	 */
	public InputStream()
	{
	}
	
	/**
	 * Reads a single byte from the input stream.
	 *
	 * @return The read unsigned byte value ({@code 0-255}) or {@code -1} if
	 * the end of stream has been reached.
	 * @throws IOException On read errors.
	 * @since 2018/11/06












<















<
<
<
<
<
<
<
<
<







1
2
3
4
5
6
7
8
9
10
11
12

13
14
15
16
17
18
19
20
21
22
23
24
25
26
27









28
29
30
31
32
33
34
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.io;


import cc.squirreljme.runtime.cldc.annotation.ProgrammerTip;

/**
 * This is the base class for any input stream which is used for reading a
 * stream of bytes.
 *
 * @since 2019/01/20
 */
public abstract class InputStream
	implements Closeable
{
	/** The number of bytes to skip at a time. */
	private static final int _SKIP_LEN =
		256;
	









	/**
	 * Reads a single byte from the input stream.
	 *
	 * @return The read unsigned byte value ({@code 0-255}) or {@code -1} if
	 * the end of stream has been reached.
	 * @throws IOException On read errors.
	 * @since 2018/11/06
210
211
212
213
214
215
216
217
218
219
220
221

222
223
224
225
226
227
228
229
		throws IOException
	{
		// Not doing anything
		if (__n <= 0)
			return 0;
		
		// Keep reading bytes
		byte[] buf = new byte[_SKIP_LEN];
		long actual = 0;
		while (__n > 0)
		{
			// Only skip the small group

			int now = (int)(_SKIP_LEN < __n ? _SKIP_LEN : __n);
			
			// Try to skip these bytes
			int rv = this.read(buf, 0, now);
			
			// EOF?
			if (rv < 0)
				return actual;







|




>
|







200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
		throws IOException
	{
		// Not doing anything
		if (__n <= 0)
			return 0;
		
		// Keep reading bytes
		byte[] buf = new byte[InputStream._SKIP_LEN];
		long actual = 0;
		while (__n > 0)
		{
			// Only skip the small group
			int now = (int)(InputStream._SKIP_LEN < __n ?
				InputStream._SKIP_LEN : __n);
			
			// Try to skip these bytes
			int rv = this.read(buf, 0, now);
			
			// EOF?
			if (rv < 0)
				return actual;

Name change from runt/apis/cldc-compact/java/io/InputStreamReader.java to modules/cldc-compact/src/main/java/java/io/InputStreamReader.java.

Name change from runt/apis/cldc-compact/java/io/InterruptedIOException.java to modules/cldc-compact/src/main/java/java/io/InterruptedIOException.java.

Name change from runt/apis/cldc-compact/java/io/OutputStream.java to modules/cldc-compact/src/main/java/java/io/OutputStream.java.

14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
 * This class is the base class for all byte oriented output streams.
 *
 * @since 2016/04/16
 */
public abstract class OutputStream
	implements Closeable
{
	/**
	 * Initializes the base output stream.
	 *
	 * @since 2016/04/16
	 */
	public OutputStream()
	{
	}
	
	/**
	 * Writes a single byte to the output stream, the byte is in the range of
	 * 0 and 255. If the byte exceeds that range, then it must take the low
	 * order value and write that {@code __a & 0xFF}.
	 *
	 * @param __b The value the low order byte is derived from for output to







<
<
<
<
<
<
<
<







14
15
16
17
18
19
20








21
22
23
24
25
26
27
 * This class is the base class for all byte oriented output streams.
 *
 * @since 2016/04/16
 */
public abstract class OutputStream
	implements Closeable
{








	
	/**
	 * Writes a single byte to the output stream, the byte is in the range of
	 * 0 and 255. If the byte exceeds that range, then it must take the low
	 * order value and write that {@code __a & 0xFF}.
	 *
	 * @param __b The value the low order byte is derived from for output to
55
56
57
58
59
60
61

62
63
64
65
66
67
68
	}
	
	/**
	 * This is used to indicate that the stream should be flushed.
	 *
	 * If this method is not overridden by a sub-class then this does nothing.
	 *

	 * @since 2016/04/16
	 */
	public void flush()
		throws IOException
	{
		// Does nothing
	}







>







47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
	}
	
	/**
	 * This is used to indicate that the stream should be flushed.
	 *
	 * If this method is not overridden by a sub-class then this does nothing.
	 *
	 * @throws IOException If flushing failed.
	 * @since 2016/04/16
	 */
	public void flush()
		throws IOException
	{
		// Does nothing
	}

Name change from runt/apis/cldc-compact/java/io/OutputStreamWriter.java to modules/cldc-compact/src/main/java/java/io/OutputStreamWriter.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.io;

import cc.squirreljme.runtime.cldc.io.CodecFactory;
import cc.squirreljme.runtime.cldc.io.Encoder;

public class OutputStreamWriter
	extends Writer
{
	public OutputStreamWriter(OutputStream __a, String __b)
		throws UnsupportedEncodingException
	{
		super();
		if (false)
			throw new UnsupportedEncodingException();
		throw new todo.TODO();
	}
	
	public OutputStreamWriter(OutputStream __a)
	{
		super();
		throw new todo.TODO();
	}
	
	@Override
	public void close()
		throws IOException
	{












<
<
<






<







<







1
2
3
4
5
6
7
8
9
10
11
12



13
14
15
16
17
18

19
20
21
22
23
24
25

26
27
28
29
30
31
32
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.io;




public class OutputStreamWriter
	extends Writer
{
	public OutputStreamWriter(OutputStream __a, String __b)
		throws UnsupportedEncodingException
	{

		if (false)
			throw new UnsupportedEncodingException();
		throw new todo.TODO();
	}
	
	public OutputStreamWriter(OutputStream __a)
	{

		throw new todo.TODO();
	}
	
	@Override
	public void close()
		throws IOException
	{

Name change from runt/apis/cldc-compact/java/io/PrintStream.java to modules/cldc-compact/src/main/java/java/io/PrintStream.java.

67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
	
	/** Mini-byte buffer for encoded characters. */
	private final byte[] _minienc =
		new byte[8];
	
	/** The internal buffer. */
	private final byte[] _buf =
		new byte[_BUFFER_SIZE];
	
	/** The position the buffer is at. */
	private int _bat;
	
	/** Error state? */
	private boolean _inerror;
	







|







67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
	
	/** Mini-byte buffer for encoded characters. */
	private final byte[] _minienc =
		new byte[8];
	
	/** The internal buffer. */
	private final byte[] _buf =
		new byte[PrintStream._BUFFER_SIZE];
	
	/** The position the buffer is at. */
	private int _bat;
	
	/** Error state? */
	private boolean _inerror;
	
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
	{
		return this.__printf(__fmt, __args);
	}
	
	/**
	 * Prints the end of line sequence that is used for the current platform.
	 *
	 * @return The end of line sequence.
	 * @since 2018/09/21
	 */
	public void println()
	{
		synchronized (this)
		{
			this.__println();







<







433
434
435
436
437
438
439

440
441
442
443
444
445
446
	{
		return this.__printf(__fmt, __args);
	}
	
	/**
	 * Prints the end of line sequence that is used for the current platform.
	 *

	 * @since 2018/09/21
	 */
	public void println()
	{
		synchronized (this)
		{
			this.__println();
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
			buf[bat++] = b;
			
			// Auto-flushing on newline?
			if (autoflush && b == '\n')
				flush = true;
			
			// Force a flush?
			if (bat >= _THRESHOLD)
			{
				// Store at location, flush then reload it
				this._bat = bat;
				this.__flush();
				bat = this._bat;
			}
		}
		
		// Store changes
		this._bat = bat;
		
		// Perform a flush?
		if (flush || bat >= _THRESHOLD)
			this.__flush();
	}
	
	/**
	 * Writes a single character to the output, encoding it as required.
	 *
	 * @param __c The character to write.







|












|







823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
			buf[bat++] = b;
			
			// Auto-flushing on newline?
			if (autoflush && b == '\n')
				flush = true;
			
			// Force a flush?
			if (bat >= PrintStream._THRESHOLD)
			{
				// Store at location, flush then reload it
				this._bat = bat;
				this.__flush();
				bat = this._bat;
			}
		}
		
		// Store changes
		this._bat = bat;
		
		// Perform a flush?
		if (flush || bat >= PrintStream._THRESHOLD)
			this.__flush();
	}
	
	/**
	 * Writes a single character to the output, encoding it as required.
	 *
	 * @param __c The character to write.

Name change from runt/apis/cldc-compact/java/io/Reader.java to modules/cldc-compact/src/main/java/java/io/Reader.java.

Name change from runt/apis/cldc-compact/java/io/UTFDataFormatException.java to modules/cldc-compact/src/main/java/java/io/UTFDataFormatException.java.

Name change from runt/apis/cldc-compact/java/io/UnsupportedEncodingException.java to modules/cldc-compact/src/main/java/java/io/UnsupportedEncodingException.java.

Name change from runt/apis/cldc-compact/java/io/Writer.java to modules/cldc-compact/src/main/java/java/io/Writer.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.io;

import cc.squirreljme.runtime.cldc.annotation.ImplementationNote;

public abstract class Writer
	implements Appendable, Closeable
{
	protected Object lock;
	
	protected Writer()
	{
		super();
		throw new todo.TODO();
	}
	
	protected Writer(Object __a)
	{
		super();
		throw new todo.TODO();
	}
	
	@Override
	public abstract void close()
		throws IOException;
	












<
<







<





<







1
2
3
4
5
6
7
8
9
10
11
12


13
14
15
16
17
18
19

20
21
22
23
24

25
26
27
28
29
30
31
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.io;



public abstract class Writer
	implements Appendable, Closeable
{
	protected Object lock;
	
	protected Writer()
	{

		throw new todo.TODO();
	}
	
	protected Writer(Object __a)
	{

		throw new todo.TODO();
	}
	
	@Override
	public abstract void close()
		throws IOException;
	

Name change from runt/apis/cldc-compact/java/lang/Appendable.java to modules/cldc-compact/src/main/java/java/lang/Appendable.java.

20
21
22
23
24
25
26

27
28
29
30
31
32
33
34
35
36
37
38

39
40
41
42
43
44
45
46
47
48
49
50

51
52
53
54
55
56
57
 */
public interface Appendable
{
	/**
	 * Appends a character sequence to the output.
	 *
	 * @param __c The sequence to append.

	 * @throws IOException On write errors.
	 * @since 2018/12/07
	 */
	public abstract Appendable append(CharSequence __c)
		throws IOException;
	
	/**
	 * Appends a character sequence to the output.
	 *
	 * @param __c The sequence to append.
	 * @param __s The start index.
	 * @param __e The end index.

	 * @throws IndexOutOfBoundsException If the start or end is outside of
	 * the bounds of the sequence, or the start exceeds the end.
	 * @throws IOException On write errors.
	 * @since 2018/12/07
	 */
	public abstract Appendable append(CharSequence __c, int __s, int __e)
		throws IndexOutOfBoundsException, IOException;
	
	/**
	 * Appends a single character to the output.
	 *
	 * @param __c The character to append.

	 * @throws IOException On write errors.
	 * @since 2018/12/07
	 */
	public abstract Appendable append(char __c)
		throws IOException;
}








>



|








>





|






>



|



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
 */
public interface Appendable
{
	/**
	 * Appends a character sequence to the output.
	 *
	 * @param __c The sequence to append.
	 * @return {@code this}.
	 * @throws IOException On write errors.
	 * @since 2018/12/07
	 */
	Appendable append(CharSequence __c)
		throws IOException;
	
	/**
	 * Appends a character sequence to the output.
	 *
	 * @param __c The sequence to append.
	 * @param __s The start index.
	 * @param __e The end index.
	 * @return {@code this}.
	 * @throws IndexOutOfBoundsException If the start or end is outside of
	 * the bounds of the sequence, or the start exceeds the end.
	 * @throws IOException On write errors.
	 * @since 2018/12/07
	 */
	Appendable append(CharSequence __c, int __s, int __e)
		throws IndexOutOfBoundsException, IOException;
	
	/**
	 * Appends a single character to the output.
	 *
	 * @param __c The character to append.
	 * @return {@code this}.
	 * @throws IOException On write errors.
	 * @since 2018/12/07
	 */
	Appendable append(char __c)
		throws IOException;
}

Name change from runt/apis/cldc-compact/java/lang/ArithmeticException.java to modules/cldc-compact/src/main/java/java/lang/ArithmeticException.java.

26
27
28
29
30
31
32

33
34
35
36
37
38
39
	public ArithmeticException()
	{
	}
	
	/**
	 * Initializes the exception with the given message and no cause.
	 *

	 * @since 2018/12/04
	 */
	public ArithmeticException(String __m)
	{
		super(__m);
	}
}







>







26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
	public ArithmeticException()
	{
	}
	
	/**
	 * Initializes the exception with the given message and no cause.
	 *
	 * @param __m The message.
	 * @since 2018/12/04
	 */
	public ArithmeticException(String __m)
	{
		super(__m);
	}
}

Name change from runt/apis/cldc-compact/java/lang/ArrayIndexOutOfBoundsException.java to modules/cldc-compact/src/main/java/java/lang/ArrayIndexOutOfBoundsException.java.

Name change from runt/apis/cldc-compact/java/lang/ArrayStoreException.java to modules/cldc-compact/src/main/java/java/lang/ArrayStoreException.java.

27
28
29
30
31
32
33

34
35
36
37
38
39
40
	public ArrayStoreException()
	{
	}
	
	/**
	 * Initializes the exception with the given message and no cause.
	 *

	 * @since 2018/12/04
	 */
	public ArrayStoreException(String __m)
	{
		super(__m);
	}
}







>







27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
	public ArrayStoreException()
	{
	}
	
	/**
	 * Initializes the exception with the given message and no cause.
	 *
	 * @param __m The message.
	 * @since 2018/12/04
	 */
	public ArrayStoreException(String __m)
	{
		super(__m);
	}
}

Name change from runt/apis/cldc-compact/java/lang/AssertionError.java to modules/cldc-compact/src/main/java/java/lang/AssertionError.java.

Name change from runt/apis/cldc-compact/java/lang/AutoCloseable.java to modules/cldc-compact/src/main/java/java/lang/AutoCloseable.java.

35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
 *     // Other things to do regardless of success or an exception.
 * }
 * // The variable fis is NOT VISIBLE here and when this point of code has
 * // been reached, fis.close() would have been called.
 * 
 * }
 *
 * @see Closeable
 * @since 2015/03/23
 */
public interface AutoCloseable
{
	/**
	 * This releases all (or most) of the resources associated with
	 * an implementing class. When used with a try-with-resources block, this







<







35
36
37
38
39
40
41

42
43
44
45
46
47
48
 *     // Other things to do regardless of success or an exception.
 * }
 * // The variable fis is NOT VISIBLE here and when this point of code has
 * // been reached, fis.close() would have been called.
 * 
 * }
 *

 * @since 2015/03/23
 */
public interface AutoCloseable
{
	/**
	 * This releases all (or most) of the resources associated with
	 * an implementing class. When used with a try-with-resources block, this
58
59
60
61
62
63
64
65
66
67
68
	 * produce side effects rather than doing nothing on a closed resource.
	 * However, it is stronly recommended and encouraged to follow the "do
	 * nothing when closed" behavior of {@link java.io.Closeable}.
	 *
	 * @throws Exception If there was an error closing the specified object.
	 * @since 2015/03/23
	 */
	public abstract void close()
		throws Exception;
}








|



57
58
59
60
61
62
63
64
65
66
67
	 * produce side effects rather than doing nothing on a closed resource.
	 * However, it is stronly recommended and encouraged to follow the "do
	 * nothing when closed" behavior of {@link java.io.Closeable}.
	 *
	 * @throws Exception If there was an error closing the specified object.
	 * @since 2015/03/23
	 */
	void close()
		throws Exception;
}

Name change from runt/apis/cldc-compact/java/lang/Boolean.java to modules/cldc-compact/src/main/java/java/lang/Boolean.java.

175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
	 * @param __a The boolean to box.
	 * @return Either {@link #TRUE} or {@link #FALSE}.
	 * @since 2016/03/21
	 */
	public static Boolean valueOf(boolean __a)
	{
		if (__a)
			return TRUE;
		return FALSE;
	}
	
	/**
	 * Returns the value of the given boolean.
	 *
	 * @param __v The value to parse.
	 * @return The boolean value.
	 * @since 2018/12/07
	 */
	public static Boolean valueOf(String __v)
	{
		if (__v != null && __v.equalsIgnoreCase("true"))
			return TRUE;
		return FALSE;
	}
}








|
|












|
|



175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
	 * @param __a The boolean to box.
	 * @return Either {@link #TRUE} or {@link #FALSE}.
	 * @since 2016/03/21
	 */
	public static Boolean valueOf(boolean __a)
	{
		if (__a)
			return Boolean.TRUE;
		return Boolean.FALSE;
	}
	
	/**
	 * Returns the value of the given boolean.
	 *
	 * @param __v The value to parse.
	 * @return The boolean value.
	 * @since 2018/12/07
	 */
	public static Boolean valueOf(String __v)
	{
		if (__v != null && __v.equalsIgnoreCase("true"))
			return Boolean.TRUE;
		return Boolean.FALSE;
	}
}

Name change from runt/apis/cldc-compact/java/lang/Byte.java to modules/cldc-compact/src/main/java/java/lang/Byte.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.lang;

import cc.squirreljme.runtime.cldc.annotation.ImplementationNote;
import cc.squirreljme.runtime.cldc.asm.ObjectAccess;
import java.lang.ref.Reference;
import java.lang.ref.WeakReference;

/**
 * This represents a boxed byte value.
 *












<







1
2
3
4
5
6
7
8
9
10
11
12

13
14
15
16
17
18
19
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.lang;


import cc.squirreljme.runtime.cldc.asm.ObjectAccess;
import java.lang.ref.Reference;
import java.lang.ref.WeakReference;

/**
 * This represents a boxed byte value.
 *
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
		throws NumberFormatException, NullPointerException
	{
		if (__s == null)
			throw new NullPointerException("NARG");
		
		// {@squirreljme.error ZZ0t Byte value out of bounds.}
		int val = Integer.decode(__s);
		if (val < MIN_VALUE || val > MAX_VALUE)
			throw new NumberFormatException("ZZ0t");
		
		return Byte.valueOf((byte)val);
	}
	
	/**
	 * Parses the given byte using the given radix.







|







200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
		throws NumberFormatException, NullPointerException
	{
		if (__s == null)
			throw new NullPointerException("NARG");
		
		// {@squirreljme.error ZZ0t Byte value out of bounds.}
		int val = Integer.decode(__s);
		if (val < Byte.MIN_VALUE || val > Byte.MAX_VALUE)
			throw new NumberFormatException("ZZ0t");
		
		return Byte.valueOf((byte)val);
	}
	
	/**
	 * Parses the given byte using the given radix.
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
		throws NumberFormatException, NullPointerException
	{
		if (__s == null)
			throw new NullPointerException("NARG");
		
		// {@squirreljme.error ZZ0u Byte value out of range.}
		int val = Integer.parseInt(__s, __r);
		if (val < MIN_VALUE || val > MAX_VALUE)
			throw new NumberFormatException("ZZ0u");
		
		return (byte)val;
	}
	
	/**
	 * Parses the given string to a byte.







|







224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
		throws NumberFormatException, NullPointerException
	{
		if (__s == null)
			throw new NullPointerException("NARG");
		
		// {@squirreljme.error ZZ0u Byte value out of range.}
		int val = Integer.parseInt(__s, __r);
		if (val < Byte.MIN_VALUE || val > Byte.MAX_VALUE)
			throw new NumberFormatException("ZZ0u");
		
		return (byte)val;
	}
	
	/**
	 * Parses the given string to a byte.

Name change from runt/apis/cldc-compact/java/lang/CharSequence.java to modules/cldc-compact/src/main/java/java/lang/CharSequence.java.

17
18
19
20
21
22
23

24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42

43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
 */
public interface CharSequence
{
	/**
	 * Returns the character at the given index.
	 *
	 * @param __i The index to get.

	 * @throws IndexOutOfBoundsException If the index is out of bounds.
	 * @since 2018/12/07
	 */
	public abstract char charAt(int __i)
		throws IndexOutOfBoundsException;
	
	/**
	 * Returns the length of the character sequence.
	 *
	 * @return The length of the sequence.
	 * @since 2018/12/07
	 */
	public abstract int length();
	
	/**
	 * Returns a sub-sequence of this character sequence.
	 *
	 * @param __s The start index.
	 * @param __e The end index.

	 * @throws IndexOutOfBoundsException If the start or end exceed the
	 * sequence bounds or start is greater than end.
	 * @since 2018/12/07
	 */
	public abstract CharSequence subSequence(int __s, int __e)
		throws IndexOutOfBoundsException;
	
	/**
	 * {@inheritDoc}
	 * @since 2018/12/07
	 */
	@Override
	public abstract String toString();
}








>



|








|






>




|







|


17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
 */
public interface CharSequence
{
	/**
	 * Returns the character at the given index.
	 *
	 * @param __i The index to get.
	 * @return The character at the given index.
	 * @throws IndexOutOfBoundsException If the index is out of bounds.
	 * @since 2018/12/07
	 */
	char charAt(int __i)
		throws IndexOutOfBoundsException;
	
	/**
	 * Returns the length of the character sequence.
	 *
	 * @return The length of the sequence.
	 * @since 2018/12/07
	 */
	int length();
	
	/**
	 * Returns a sub-sequence of this character sequence.
	 *
	 * @param __s The start index.
	 * @param __e The end index.
	 * @return The sub sequence of this one.
	 * @throws IndexOutOfBoundsException If the start or end exceed the
	 * sequence bounds or start is greater than end.
	 * @since 2018/12/07
	 */
	CharSequence subSequence(int __s, int __e)
		throws IndexOutOfBoundsException;
	
	/**
	 * {@inheritDoc}
	 * @since 2018/12/07
	 */
	@Override
	String toString();
}

Name change from runt/apis/cldc-compact/java/lang/Character.java to modules/cldc-compact/src/main/java/java/lang/Character.java.

Name change from runt/apis/cldc-compact/java/lang/Class.java to modules/cldc-compact/src/main/java/java/lang/Class.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

19
20
21
22
23
24
25
26
27
28
29
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.lang;

import cc.squirreljme.runtime.cldc.asm.ObjectAccess;
import cc.squirreljme.runtime.cldc.asm.ResourceAccess;
import cc.squirreljme.runtime.cldc.asm.StaticMethod;
import cc.squirreljme.runtime.cldc.asm.SuiteAccess;
import cc.squirreljme.runtime.cldc.io.ResourceInputStream;
import cc.squirreljme.runtime.cldc.lang.ClassData;

import java.io.InputStream;
import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import cc.squirreljme.runtime.cldc.lang.ClassFlag;

/**
 * This class is the in-language representation of a Java class, the CLDC
 * allows for minimal reflection via {@link Class#forName(String)} and
 * {@link Class#newInstance()}.
 *
 * @since 2018/12/08













<




>



<







1
2
3
4
5
6
7
8
9
10
11
12
13

14
15
16
17
18
19
20
21

22
23
24
25
26
27
28
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.lang;

import cc.squirreljme.runtime.cldc.asm.ObjectAccess;

import cc.squirreljme.runtime.cldc.asm.StaticMethod;
import cc.squirreljme.runtime.cldc.asm.SuiteAccess;
import cc.squirreljme.runtime.cldc.io.ResourceInputStream;
import cc.squirreljme.runtime.cldc.lang.ClassData;
import cc.squirreljme.runtime.cldc.lang.ClassFlag;
import java.io.InputStream;
import java.lang.ref.Reference;
import java.lang.ref.WeakReference;


/**
 * This class is the in-language representation of a Java class, the CLDC
 * allows for minimal reflection via {@link Class#forName(String)} and
 * {@link Class#newInstance()}.
 *
 * @since 2018/12/08
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
	public boolean desiredAssertionStatus()
	{
		// If assertions have been checked, they do not have to be rechecked
		if (this._checkedassert)
			return this._useassert;
		
		// Otherwise check it
		return __checkAssertionStatus();
	}
	
	/**
	 * Returns the name of this class.
	 *
	 * @return The name of this class.
	 * @since 2018/09/22







|







139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
	public boolean desiredAssertionStatus()
	{
		// If assertions have been checked, they do not have to be rechecked
		if (this._checkedassert)
			return this._useassert;
		
		// Otherwise check it
		return this.__checkAssertionStatus();
	}
	
	/**
	 * Returns the name of this class.
	 *
	 * @return The name of this class.
	 * @since 2018/09/22
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
		// Guess what! Every array starts with with brackets so this is quite
		// easily something which can be determined from the classname
		return this._data.binaryName().startsWith("[");
	}
	
	/**
	 * Checks if the given class can be assigned to this one, the check is
	 * in the same order as {@link #instanceOf(Object)} that is
	 * {@code a.getClass().isAssignableFrom(b.getClass()) == (a instanceof b)}.
	 *
	 * @param __cl The other class type.
	 * @return If the otehr class can be assigned to this one.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/09/27
	 */







|







268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
		// Guess what! Every array starts with with brackets so this is quite
		// easily something which can be determined from the classname
		return this._data.binaryName().startsWith("[");
	}
	
	/**
	 * Checks if the given class can be assigned to this one, the check is
	 * in the same order as {code instanceOf Object} that is
	 * {@code a.getClass().isAssignableFrom(b.getClass()) == (a instanceof b)}.
	 *
	 * @param __cl The other class type.
	 * @return If the otehr class can be assigned to this one.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/09/27
	 */
343
344
345
346
347
348
349

350
351
352
353
354
355
356
	/**
	 * Constructs a new instance of this class.
	 *
	 * @throws InstantiationException If the default constructor cannot be
	 * accessed by the calling method.
	 * @throws IllegalAccessException If the class or constructor could not
	 * be accessed.

	 * @since 2018/12/04
	 */
	@SuppressWarnings({"unchecked"})
	public T newInstance()
		throws InstantiationException, IllegalAccessException
	{
		todo.TODO.note("Implement newInstance() access checks.");







>







342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
	/**
	 * Constructs a new instance of this class.
	 *
	 * @throws InstantiationException If the default constructor cannot be
	 * accessed by the calling method.
	 * @throws IllegalAccessException If the class or constructor could not
	 * be accessed.
	 * @return The newly created instance.
	 * @since 2018/12/04
	 */
	@SuppressWarnings({"unchecked"})
	public T newInstance()
		throws InstantiationException, IllegalAccessException
	{
		todo.TODO.note("Implement newInstance() access checks.");

Name change from runt/apis/cldc-compact/java/lang/ClassCastException.java to modules/cldc-compact/src/main/java/java/lang/ClassCastException.java.

26
27
28
29
30
31
32

33
34
35
36
37
38
39
	public ClassCastException()
	{
	}
	
	/**
	 * Initializes the exception with the given message and no cause.
	 *

	 * @since 2018/12/04
	 */
	public ClassCastException(String __m)
	{
		super(__m);
	}
}







>







26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
	public ClassCastException()
	{
	}
	
	/**
	 * Initializes the exception with the given message and no cause.
	 *
	 * @param __m The message.
	 * @since 2018/12/04
	 */
	public ClassCastException(String __m)
	{
		super(__m);
	}
}

Name change from runt/apis/cldc-compact/java/lang/ClassFormatError.java to modules/cldc-compact/src/main/java/java/lang/ClassFormatError.java.

26
27
28
29
30
31
32

33
34
35
36
37
38
39
	public ClassFormatError()
	{
	}
	
	/**
	 * Initializes the exception with the given message and no cause.
	 *

	 * @since 2018/12/04
	 */
	public ClassFormatError(String __m)
	{
		super(__m);
	}
}







>







26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
	public ClassFormatError()
	{
	}
	
	/**
	 * Initializes the exception with the given message and no cause.
	 *
	 * @param __m The message.
	 * @since 2018/12/04
	 */
	public ClassFormatError(String __m)
	{
		super(__m);
	}
}

Name change from runt/apis/cldc-compact/java/lang/ClassNotFoundException.java to modules/cldc-compact/src/main/java/java/lang/ClassNotFoundException.java.

Name change from runt/apis/cldc-compact/java/lang/CloneNotSupportedException.java to modules/cldc-compact/src/main/java/java/lang/CloneNotSupportedException.java.

26
27
28
29
30
31
32

33
34
35
36
37
38
39
	public CloneNotSupportedException()
	{
	}
	
	/**
	 * Initializes the exception with the given message and no cause.
	 *

	 * @since 2018/12/04
	 */
	public CloneNotSupportedException(String __m)
	{
		super(__m);
	}
}







>







26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
	public CloneNotSupportedException()
	{
	}
	
	/**
	 * Initializes the exception with the given message and no cause.
	 *
	 * @param __m The message.
	 * @since 2018/12/04
	 */
	public CloneNotSupportedException(String __m)
	{
		super(__m);
	}
}

Name change from runt/apis/cldc-compact/java/lang/Cloneable.java to modules/cldc-compact/src/main/java/java/lang/Cloneable.java.

Name change from runt/apis/cldc-compact/java/lang/Comparable.java to modules/cldc-compact/src/main/java/java/lang/Comparable.java.

37
38
39
40
41
42
43
44
45
46
47
	 *
	 * @param __b The object to compare against.
	 * @return The result of the comparison, negative values mean
	 * {@code this < __b}, zero means {@code this == __b}, and positive values
	 * mean {@code this > __b}.
	 * @since 2018/09/19
	 */
	public abstract int compareTo(T __b);
}









|



37
38
39
40
41
42
43
44
45
46
47
	 *
	 * @param __b The object to compare against.
	 * @return The result of the comparison, negative values mean
	 * {@code this < __b}, zero means {@code this == __b}, and positive values
	 * mean {@code this > __b}.
	 * @since 2018/09/19
	 */
	int compareTo(T __b);
}


Name change from runt/apis/cldc-compact/java/lang/Deprecated.java to modules/cldc-compact/src/main/java/java/lang/Deprecated.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.lang;

import java.lang.annotation.Annotation;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**












<







1
2
3
4
5
6
7
8
9
10
11
12

13
14
15
16
17
18
19
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.lang;


import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**

Name change from runt/apis/cldc-compact/java/lang/Double.java to modules/cldc-compact/src/main/java/java/lang/Double.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.lang;

import cc.squirreljme.jvm.Assembly;
import cc.squirreljme.runtime.cldc.annotation.ProgrammerTip;
import cc.squirreljme.runtime.cldc.asm.ObjectAccess;

public final class Double
	extends Number
	implements Comparable<Double>
{
	public static final int MAX_EXPONENT =













<







1
2
3
4
5
6
7
8
9
10
11
12
13

14
15
16
17
18
19
20
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.lang;

import cc.squirreljme.jvm.Assembly;

import cc.squirreljme.runtime.cldc.asm.ObjectAccess;

public final class Double
	extends Number
	implements Comparable<Double>
{
	public static final int MAX_EXPONENT =
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
	public static final double MIN_NORMAL =
		+0x1.0p-1022D;
	
	public static final double MIN_VALUE =
		+0x0.0000000000001p-1022D;
	
	public static final double NEGATIVE_INFINITY =
		-1.0D / 0.0D;
	
	public static final double NaN =
		0.0D / 0.0D;
	
	public static final double POSITIVE_INFINITY =
		1.0D / 0.0D;
	
	/** The number of bits double requires for storage. */
	public static final int SIZE =
		64;
	
	/** The class representing the primitive type. */
	public static final Class<Double> TYPE =
		ObjectAccess.<Double>classByNameType("double");
	
	/** The mask for NaN values. */
	private static final long _NAN_MASK =
		0b0111111111111000000000000000000000000000000000000000000000000000L;
	
	/** The value for this double. */
	private final double _value;
	
	public Double(double __a)
	{
		super();
		throw new todo.TODO();
	}
	
	public Double(String __a)
		throws NumberFormatException
	{
		super();
		if (false)
			throw new NumberFormatException();
		throw new todo.TODO();
	}
	
	@Override
	public byte byteValue()







|


|


|


















<






<







29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60

61
62
63
64
65
66

67
68
69
70
71
72
73
	public static final double MIN_NORMAL =
		+0x1.0p-1022D;
	
	public static final double MIN_VALUE =
		+0x0.0000000000001p-1022D;
	
	public static final double NEGATIVE_INFINITY =
		Double.longBitsToDouble(-4503599627370496L);
	
	public static final double NaN =
		Double.longBitsToDouble(9221120237041090560L);
	
	public static final double POSITIVE_INFINITY =
		Double.longBitsToDouble(9218868437227405312L);
	
	/** The number of bits double requires for storage. */
	public static final int SIZE =
		64;
	
	/** The class representing the primitive type. */
	public static final Class<Double> TYPE =
		ObjectAccess.<Double>classByNameType("double");
	
	/** The mask for NaN values. */
	private static final long _NAN_MASK =
		0b0111111111111000000000000000000000000000000000000000000000000000L;
	
	/** The value for this double. */
	private final double _value;
	
	public Double(double __a)
	{

		throw new todo.TODO();
	}
	
	public Double(String __a)
		throws NumberFormatException
	{

		if (false)
			throw new NumberFormatException();
		throw new todo.TODO();
	}
	
	@Override
	public byte byteValue()
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
	 * @since 2018/11/04
	 */
	public static long doubleToLongBits(double __v)
	{
		long raw = Double.doubleToRawLongBits(__v);
		
		// Collapse all NaN values to a single form
		if ((raw & _NAN_MASK) == (_NAN_MASK))
			return _NAN_MASK;
		
		return raw;
	}
	
	/**
	 * Returns the raw bits which represent the double value.
	 *







|
|







157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
	 * @since 2018/11/04
	 */
	public static long doubleToLongBits(double __v)
	{
		long raw = Double.doubleToRawLongBits(__v);
		
		// Collapse all NaN values to a single form
		if ((raw & Double._NAN_MASK) == (Double._NAN_MASK))
			return Double._NAN_MASK;
		
		return raw;
	}
	
	/**
	 * Returns the raw bits which represent the double value.
	 *

Name change from runt/apis/cldc-compact/java/lang/Enum.java to modules/cldc-compact/src/main/java/java/lang/Enum.java.

Name change from runt/apis/cldc-compact/java/lang/Error.java to modules/cldc-compact/src/main/java/java/lang/Error.java.

49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
	{
		super(__m);
	}
	
	/**
	 * Initializes the error with no message and the given cause.
	 *
	 * @param __m The message to use.
	 * @param __t The cause of this error.
	 * @since 2018/09/16
	 */
	public Error(Throwable __t)
	{
		super(__t);
	}







<







49
50
51
52
53
54
55

56
57
58
59
60
61
62
	{
		super(__m);
	}
	
	/**
	 * Initializes the error with no message and the given cause.
	 *

	 * @param __t The cause of this error.
	 * @since 2018/09/16
	 */
	public Error(Throwable __t)
	{
		super(__t);
	}

Name change from runt/apis/cldc-compact/java/lang/Exception.java to modules/cldc-compact/src/main/java/java/lang/Exception.java.

Name change from runt/apis/cldc-compact/java/lang/Float.java to modules/cldc-compact/src/main/java/java/lang/Float.java.

9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// ---------------------------------------------------------------------------

package java.lang;

import cc.squirreljme.jvm.Assembly;
import cc.squirreljme.jvm.JVMFunction;
import cc.squirreljme.runtime.cldc.annotation.ProgrammerTip;
import cc.squirreljme.runtime.cldc.asm.ObjectAccess;

public final class Float
	extends Number
	implements Comparable<Float>
{
	public static final int MAX_EXPONENT =
		127;







<







9
10
11
12
13
14
15

16
17
18
19
20
21
22
// ---------------------------------------------------------------------------

package java.lang;

import cc.squirreljme.jvm.Assembly;
import cc.squirreljme.jvm.JVMFunction;
import cc.squirreljme.runtime.cldc.annotation.ProgrammerTip;


public final class Float
	extends Number
	implements Comparable<Float>
{
	public static final int MAX_EXPONENT =
		127;
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
	public static final float MIN_NORMAL =
		+0x1.0p-126F;
	
	public static final float MIN_VALUE =
		+0x1.0p-149F;
	
	public static final float NEGATIVE_INFINITY =
		-1.0F / 0.0F;
	
	public static final float NaN =
		0.0F / 0.0F;
	
	public static final float POSITIVE_INFINITY =
		1.0F / 0.0F;
	
	/** The number of bits float requires for storage. */
	public static final int SIZE =
		32;
	
	/** The mask for NaN values. */
	private static final int _NAN_MASK =







|


|


|







30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
	public static final float MIN_NORMAL =
		+0x1.0p-126F;
	
	public static final float MIN_VALUE =
		+0x1.0p-149F;
	
	public static final float NEGATIVE_INFINITY =
		Float.intBitsToFloat(-8388608);
	
	public static final float NaN =
		Float.intBitsToFloat(2143289344);
	
	public static final float POSITIVE_INFINITY =
		Float.intBitsToFloat(2139095040);
	
	/** The number of bits float requires for storage. */
	public static final int SIZE =
		32;
	
	/** The mask for NaN values. */
	private static final int _NAN_MASK =
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
	public Float(float __v)
	{
		this._value = __v;
	}
	
	public Float(double __a)
	{
		super();
		throw new todo.TODO();
	}
	
	public Float(String __a)
		throws NumberFormatException
	{
		super();
		if (false)
			throw new NumberFormatException();
		throw new todo.TODO();
	}
	
	@Override
	public byte byteValue()







<






<







66
67
68
69
70
71
72

73
74
75
76
77
78

79
80
81
82
83
84
85
	public Float(float __v)
	{
		this._value = __v;
	}
	
	public Float(double __a)
	{

		throw new todo.TODO();
	}
	
	public Float(String __a)
		throws NumberFormatException
	{

		if (false)
			throw new NumberFormatException();
		throw new todo.TODO();
	}
	
	@Override
	public byte byteValue()
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
	 * @since 2018/11/04
	 */
	public static int floatToIntBits(float __v)
	{
		int raw = Float.floatToRawIntBits(__v);
		
		// Collapse all NaN values to a single form
		if ((raw & _NAN_MASK) == (_NAN_MASK))
			return _NAN_MASK;
		
		return raw;
	}
	
	/**
	 * Converts the specified float into its raw integer bit form.
	 *







|
|







204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
	 * @since 2018/11/04
	 */
	public static int floatToIntBits(float __v)
	{
		int raw = Float.floatToRawIntBits(__v);
		
		// Collapse all NaN values to a single form
		if ((raw & Float._NAN_MASK) == (Float._NAN_MASK))
			return Float._NAN_MASK;
		
		return raw;
	}
	
	/**
	 * Converts the specified float into its raw integer bit form.
	 *
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
	 *
	 * @param __v The value to check.
	 * @return If it is NaN or not.
	 * @since 2018/11/04
	 */
	public static boolean isNaN(float __v)
	{
		return (Float.floatToRawIntBits(__v) & _NAN_MASK) == _NAN_MASK;
	}
	
	public static float parseFloat(String __a)
		throws NumberFormatException
	{
		if (false)
			throw new NumberFormatException();







|







252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
	 *
	 * @param __v The value to check.
	 * @return If it is NaN or not.
	 * @since 2018/11/04
	 */
	public static boolean isNaN(float __v)
	{
		return (Float.floatToRawIntBits(__v) & Float._NAN_MASK) == Float._NAN_MASK;
	}
	
	public static float parseFloat(String __a)
		throws NumberFormatException
	{
		if (false)
			throw new NumberFormatException();

Name change from runt/apis/cldc-compact/java/lang/IllegalAccessException.java to modules/cldc-compact/src/main/java/java/lang/IllegalAccessException.java.

26
27
28
29
30
31
32

33
34
35
36
37
38
39
	public IllegalAccessException()
	{
	}
	
	/**
	 * Initializes the exception with the given message and no cause.
	 *

	 * @since 2018/12/04
	 */
	public IllegalAccessException(String __m)
	{
		super(__m);
	}
}







>







26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
	public IllegalAccessException()
	{
	}
	
	/**
	 * Initializes the exception with the given message and no cause.
	 *
	 * @param __m The message.
	 * @since 2018/12/04
	 */
	public IllegalAccessException(String __m)
	{
		super(__m);
	}
}

Name change from runt/apis/cldc-compact/java/lang/IllegalArgumentException.java to modules/cldc-compact/src/main/java/java/lang/IllegalArgumentException.java.

Name change from runt/apis/cldc-compact/java/lang/IllegalMonitorStateException.java to modules/cldc-compact/src/main/java/java/lang/IllegalMonitorStateException.java.

27
28
29
30
31
32
33

34
35
36
37
38
39
40
	public IllegalMonitorStateException()
	{
	}
	
	/**
	 * Initializes the exception with the given message and no cause.
	 *

	 * @since 2018/12/04
	 */
	public IllegalMonitorStateException(String __m)
	{
		super(__m);
	}
}







>







27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
	public IllegalMonitorStateException()
	{
	}
	
	/**
	 * Initializes the exception with the given message and no cause.
	 *
	 * @param __m The message.
	 * @since 2018/12/04
	 */
	public IllegalMonitorStateException(String __m)
	{
		super(__m);
	}
}

Name change from runt/apis/cldc-compact/java/lang/IllegalStateException.java to modules/cldc-compact/src/main/java/java/lang/IllegalStateException.java.

Name change from runt/apis/cldc-compact/java/lang/IllegalThreadStateException.java to modules/cldc-compact/src/main/java/java/lang/IllegalThreadStateException.java.

Name change from runt/apis/cldc-compact/java/lang/IncompatibleClassChangeError.java to modules/cldc-compact/src/main/java/java/lang/IncompatibleClassChangeError.java.

27
28
29
30
31
32
33

34
35
36
37
38
39
40
	public IncompatibleClassChangeError()
	{
	}
	
	/**
	 * Initializes the exception with the given message and no cause.
	 *

	 * @since 2018/12/04
	 */
	public IncompatibleClassChangeError(String __m)
	{
		super(__m);
	}
}







>







27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
	public IncompatibleClassChangeError()
	{
	}
	
	/**
	 * Initializes the exception with the given message and no cause.
	 *
	 * @param __m The message.
	 * @since 2018/12/04
	 */
	public IncompatibleClassChangeError(String __m)
	{
		super(__m);
	}
}

Name change from runt/apis/cldc-compact/java/lang/IndexOutOfBoundsException.java to modules/cldc-compact/src/main/java/java/lang/IndexOutOfBoundsException.java.

21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
	/**
	 * Initializes the exception with no message or cause.
	 *
	 * @since 2018/09/16
	 */
	public IndexOutOfBoundsException()
	{
		super();
	}
	
	/**
	 * Initializes the exception with the given message and no cause.
	 *
	 * @param __m The message.
	 * @since 2018/09/16







<







21
22
23
24
25
26
27

28
29
30
31
32
33
34
	/**
	 * Initializes the exception with no message or cause.
	 *
	 * @since 2018/09/16
	 */
	public IndexOutOfBoundsException()
	{

	}
	
	/**
	 * Initializes the exception with the given message and no cause.
	 *
	 * @param __m The message.
	 * @since 2018/09/16

Name change from runt/apis/cldc-compact/java/lang/InstantiationException.java to modules/cldc-compact/src/main/java/java/lang/InstantiationException.java.

26
27
28
29
30
31
32

33
34
35
36
37
38
39
	public InstantiationException()
	{
	}
	
	/**
	 * Initializes the exception with the given message and no cause.
	 *

	 * @since 2018/12/04
	 */
	public InstantiationException(String __m)
	{
		super(__m);
	}
}







>







26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
	public InstantiationException()
	{
	}
	
	/**
	 * Initializes the exception with the given message and no cause.
	 *
	 * @param __m The message.
	 * @since 2018/12/04
	 */
	public InstantiationException(String __m)
	{
		super(__m);
	}
}

Name change from runt/apis/cldc-compact/java/lang/Integer.java to modules/cldc-compact/src/main/java/java/lang/Integer.java.

89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
	 * {@inheritDoc}
	 * @since 2019/05/10
	 */
	@Override
	public int compareTo(Integer __b)
	{
		int a = this._value,
			b = __b._value;
			
		if (a == b)
			return 0;
		else if (a < b)
			return -1;
		else
			return 1;
	}







|
|







89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
	 * {@inheritDoc}
	 * @since 2019/05/10
	 */
	@Override
	public int compareTo(Integer __b)
	{
		int a = this._value,
			b = __b;
		
		if (a == b)
			return 0;
		else if (a < b)
			return -1;
		else
			return 1;
	}
411
412
413
414
415
416
417

418
419
420
421
422
423
424
	}
	
	/**
	 * Returns the value of the specified string using the given radix.
	 *
	 * @param __v The String to decode.
	 * @param __r The radix to use.

	 * @throws NumberFormatException If the string is not valid or the radix
	 * is outside of the valid bounds.
	 * @since 2018/10/12
	 */
	public static int parseInt(String __v, int __r)
		throws NumberFormatException
	{







>







411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
	}
	
	/**
	 * Returns the value of the specified string using the given radix.
	 *
	 * @param __v The String to decode.
	 * @param __r The radix to use.
	 * @return The resulting integer.
	 * @throws NumberFormatException If the string is not valid or the radix
	 * is outside of the valid bounds.
	 * @since 2018/10/12
	 */
	public static int parseInt(String __v, int __r)
		throws NumberFormatException
	{
470
471
472
473
474
475
476

477
478
479
480
481
482
483
		return rv;
	}
	
	/**
	 * Returns the value of the specified string.
	 *
	 * @param __v The String to decode.

	 * @throws NumberFormatException If the string is not valid.
	 * @since 2018/10/12
	 */
	public static int parseInt(String __v)
		throws NumberFormatException
	{
		return Integer.parseInt(__v, 10);







>







471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
		return rv;
	}
	
	/**
	 * Returns the value of the specified string.
	 *
	 * @param __v The String to decode.
	 * @return The parsed integer.
	 * @throws NumberFormatException If the string is not valid.
	 * @since 2018/10/12
	 */
	public static int parseInt(String __v)
		throws NumberFormatException
	{
		return Integer.parseInt(__v, 10);
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626

627
628
629
630
631
632
633
634
635
636
637
638
639
640

641
642
643
644
645
646
647
		// Because the values are added in the opposite order, reverse it
		sb.reverse();
		
		return sb.toString();
	}
	
	/**
	 * Calls {@link Integer#toStirng(long, int)} with a radix of 10.
	 *
	 * @param __v The input value.
	 * @return The resulting string.
	 * @since 2018/09/23
	 */
	public static String toString(int __v)
	{
		return Integer.toString(__v, 10);
	}
	
	/**
	 * Returns the value of the specified string using the given radix.
	 *
	 * @param __v The String to decode.
	 * @param __r The radix to use.

	 * @throws NumberFormatException If the string is not valid or the radix
	 * is outside of the valid bounds.
	 * @since 2018/10/12
	 */
	public static Integer valueOf(String __v, int __r)
		throws NumberFormatException
	{
		return Integer.parseInt(__v, __r);
	}
	
	/**
	 * Returns the value of the specified string.
	 *
	 * @param __v The String to decode.

	 * @throws NumberFormatException If the string is not valid.
	 * @since 2018/10/12
	 */
	public static Integer valueOf(String __v)
		throws NumberFormatException
	{
		return Integer.parseInt(__v, 10);







|















>














>







606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
		// Because the values are added in the opposite order, reverse it
		sb.reverse();
		
		return sb.toString();
	}
	
	/**
	 * Calls {@link Integer#toString(int, int)} with a radix of 10.
	 *
	 * @param __v The input value.
	 * @return The resulting string.
	 * @since 2018/09/23
	 */
	public static String toString(int __v)
	{
		return Integer.toString(__v, 10);
	}
	
	/**
	 * Returns the value of the specified string using the given radix.
	 *
	 * @param __v The String to decode.
	 * @param __r The radix to use.
	 * @return The boxed value.
	 * @throws NumberFormatException If the string is not valid or the radix
	 * is outside of the valid bounds.
	 * @since 2018/10/12
	 */
	public static Integer valueOf(String __v, int __r)
		throws NumberFormatException
	{
		return Integer.parseInt(__v, __r);
	}
	
	/**
	 * Returns the value of the specified string.
	 *
	 * @param __v The String to decode.
	 * @return The boxed value.
	 * @throws NumberFormatException If the string is not valid.
	 * @since 2018/10/12
	 */
	public static Integer valueOf(String __v)
		throws NumberFormatException
	{
		return Integer.parseInt(__v, 10);

Name change from runt/apis/cldc-compact/java/lang/InterruptedException.java to modules/cldc-compact/src/main/java/java/lang/InterruptedException.java.

Name change from runt/apis/cldc-compact/java/lang/Iterable.java to modules/cldc-compact/src/main/java/java/lang/Iterable.java.

23
24
25
26
27
28
29
30
31
32
{
	/**
	 * Returns the iterator over the object.
	 *
	 * @return The object iterator.
	 * @since 2018/12/08
	 */
	public abstract Iterator<T> iterator();
}








|


23
24
25
26
27
28
29
30
31
32
{
	/**
	 * Returns the iterator over the object.
	 *
	 * @return The object iterator.
	 * @since 2018/12/08
	 */
	Iterator<T> iterator();
}

Name change from runt/apis/cldc-compact/java/lang/LinkageError.java to modules/cldc-compact/src/main/java/java/lang/LinkageError.java.

26
27
28
29
30
31
32

33
34
35
36
37
38
39
	public LinkageError()
	{
	}
	
	/**
	 * Initializes the exception with the given message and no cause.
	 *

	 * @since 2018/12/04
	 */
	public LinkageError(String __m)
	{
		super(__m);
	}
}







>







26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
	public LinkageError()
	{
	}
	
	/**
	 * Initializes the exception with the given message and no cause.
	 *
	 * @param __m The message.
	 * @since 2018/12/04
	 */
	public LinkageError(String __m)
	{
		super(__m);
	}
}

Name change from runt/apis/cldc-compact/java/lang/Long.java to modules/cldc-compact/src/main/java/java/lang/Long.java.

51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
	{
		this._value = __v;
	}
	
	public Long(String __a)
		throws NumberFormatException
	{
		super();
		if (false)
			throw new NumberFormatException();
		throw new todo.TODO();
	}
	
	@Override
	public byte byteValue()







<







51
52
53
54
55
56
57

58
59
60
61
62
63
64
	{
		this._value = __v;
	}
	
	public Long(String __a)
		throws NumberFormatException
	{

		if (false)
			throw new NumberFormatException();
		throw new todo.TODO();
	}
	
	@Override
	public byte byteValue()
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
		// Because the values are added in the opposite order, reverse it
		sb.reverse();
		
		return sb.toString();
	}
	
	/**
	 * Calls {@link Long#toStirng(long, int)} with a radix of 10.
	 *
	 * @param __v The input value.
	 * @return The resulting string.
	 * @since 2018/09/23
	 */
	public static String toString(long __v)
	{







|







327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
		// Because the values are added in the opposite order, reverse it
		sb.reverse();
		
		return sb.toString();
	}
	
	/**
	 * Calls {@link Long#toString(long, int)} with a radix of 10.
	 *
	 * @param __v The input value.
	 * @return The resulting string.
	 * @since 2018/09/23
	 */
	public static String toString(long __v)
	{

Name change from runt/apis/cldc-compact/java/lang/Math.java to modules/cldc-compact/src/main/java/java/lang/Math.java.

14
15
16
17
18
19
20

21
22
23
24
25
26
27
28
29
import cc.squirreljme.runtime.cldc.util.FDMLMath;

/**
 * This class contains mathematical functions.
 *
 * @since 2018/12/08
 */

@ImplementationNote("This class uses strict floating point.")
public strictfp final class Math
{
	/** E. */
	public static final double E =
		+0x1.5BF0A8B145769p1D;
	
	/** Pi. */
	public static final double PI =







>

|







14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import cc.squirreljme.runtime.cldc.util.FDMLMath;

/**
 * This class contains mathematical functions.
 *
 * @since 2018/12/08
 */
@SuppressWarnings("FieldNamingConvention")
@ImplementationNote("This class uses strict floating point.")
public final strictfp class Math
{
	/** E. */
	public static final double E =
		+0x1.5BF0A8B145769p1D;
	
	/** Pi. */
	public static final double PI =
37
38
39
40
41
42
43

44
45
46
47
48
49
50
51
52
53
54

55
56
57
58
59
60
61
62
63
64
65

66
67
68
69
70
71
72
73
74
75
76

77
78
79
80
81
82
83
	private Math()
	{
	}
	
	/**
	 * Returns the absolute value.
	 *

	 * @return The absolute value.
	 * @since 2019/04/14
	 */
	public static int abs(int __v)
	{
		return (__v < 0 ? -__v : __v);
	}
	
	/**
	 * Returns the absolute value.
	 *

	 * @return The absolute value.
	 * @since 2019/04/14
	 */
	public static long abs(long __v)
	{
		return (__v < 0 ? -__v : __v);
	}
	
	/**
	 * Returns the absolute value.
	 *

	 * @return The absolute value.
	 * @since 2019/04/14
	 */
	public static float abs(float __v)
	{
		return Float.intBitsToFloat(0x7FFFFFFF & Float.floatToIntBits(__v));
	}
	
	/**
	 * Returns the absolute value.
	 *

	 * @return The absolute value.
	 * @since 2019/04/14
	 */
	public static double abs(double __v)
	{
		return Double.longBitsToDouble(0x7FFFFFFFFFFFFFFFL &
			Double.doubleToLongBits(__v));







>











>











>











>







38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
	private Math()
	{
	}
	
	/**
	 * Returns the absolute value.
	 *
	 * @param __v The input value.
	 * @return The absolute value.
	 * @since 2019/04/14
	 */
	public static int abs(int __v)
	{
		return (__v < 0 ? -__v : __v);
	}
	
	/**
	 * Returns the absolute value.
	 *
	 * @param __v The input value.
	 * @return The absolute value.
	 * @since 2019/04/14
	 */
	public static long abs(long __v)
	{
		return (__v < 0 ? -__v : __v);
	}
	
	/**
	 * Returns the absolute value.
	 *
	 * @param __v The input value.
	 * @return The absolute value.
	 * @since 2019/04/14
	 */
	public static float abs(float __v)
	{
		return Float.intBitsToFloat(0x7FFFFFFF & Float.floatToIntBits(__v));
	}
	
	/**
	 * Returns the absolute value.
	 *
	 * @param __v The input value.
	 * @return The absolute value.
	 * @since 2019/04/14
	 */
	public static double abs(double __v)
	{
		return Double.longBitsToDouble(0x7FFFFFFFFFFFFFFFL &
			Double.doubleToLongBits(__v));
273
274
275
276
277
278
279

280
281
282
283
284
285
286
287
	{
		throw new todo.TODO();
	}
	
	/**
	 * Returns the square root of the given number.
	 *

	 * @return __v The value to get the square root for.
	 * @since 2018/11/03
	 */
	public static double sqrt(double __v)
	{
		return FDMLMath.sqrt(__v);
	}
	







>
|







278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
	{
		throw new todo.TODO();
	}
	
	/**
	 * Returns the square root of the given number.
	 *
	 * @param __v The input value.
	 * @return The square root.
	 * @since 2018/11/03
	 */
	public static double sqrt(double __v)
	{
		return FDMLMath.sqrt(__v);
	}
	

Name change from runt/apis/cldc-compact/java/lang/NegativeArraySizeException.java to modules/cldc-compact/src/main/java/java/lang/NegativeArraySizeException.java.

Name change from runt/apis/cldc-compact/java/lang/NoClassDefFoundError.java to modules/cldc-compact/src/main/java/java/lang/NoClassDefFoundError.java.

26
27
28
29
30
31
32

33
34
35
36
37
38
39
	public NoClassDefFoundError()
	{
	}
	
	/**
	 * Initializes the exception with the given message and no cause.
	 *

	 * @since 2018/12/04
	 */
	public NoClassDefFoundError(String __m)
	{
		super(__m);
	}
}







>







26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
	public NoClassDefFoundError()
	{
	}
	
	/**
	 * Initializes the exception with the given message and no cause.
	 *
	 * @param __m The message.
	 * @since 2018/12/04
	 */
	public NoClassDefFoundError(String __m)
	{
		super(__m);
	}
}

Name change from runt/apis/cldc-compact/java/lang/NoSuchFieldError.java to modules/cldc-compact/src/main/java/java/lang/NoSuchFieldError.java.

26
27
28
29
30
31
32

33
34
35
36
37
38
39
	public NoSuchFieldError()
	{
	}
	
	/**
	 * Initializes the exception with the given message and no cause.
	 *

	 * @since 2018/12/04
	 */
	public NoSuchFieldError(String __m)
	{
		super(__m);
	}
}







>







26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
	public NoSuchFieldError()
	{
	}
	
	/**
	 * Initializes the exception with the given message and no cause.
	 *
	 * @param __m The message.
	 * @since 2018/12/04
	 */
	public NoSuchFieldError(String __m)
	{
		super(__m);
	}
}

Name change from runt/apis/cldc-compact/java/lang/NullPointerException.java to modules/cldc-compact/src/main/java/java/lang/NullPointerException.java.

27
28
29
30
31
32
33

34
35
36
37
38
39
40
	public NullPointerException()
	{
	}
	
	/**
	 * Initializes the exception with the given message and no cause.
	 *

	 * @since 2018/12/04
	 */
	public NullPointerException(String __m)
	{
		super(__m);
	}
}







>







27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
	public NullPointerException()
	{
	}
	
	/**
	 * Initializes the exception with the given message and no cause.
	 *
	 * @param __m The message.
	 * @since 2018/12/04
	 */
	public NullPointerException(String __m)
	{
		super(__m);
	}
}

Name change from runt/apis/cldc-compact/java/lang/Number.java to modules/cldc-compact/src/main/java/java/lang/Number.java.

18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
 * significant bits, or the value itself. Most classes will likely implement
 * these using narrowing conversions that match the Java language.
 *
 * @since 2018/09/23
 */
public abstract class Number
{
	/**
	 * Initializes the base number.
	 *
	 * @since 2018/09/23
	 */
	public Number()
	{
	}
	
	/**
	 * Returns the value of this number converted as a double.
	 *
	 * @return The converted value of this number.
	 * @since 2018/09/23
	 */







<
<
<
<
<
<
<
<







18
19
20
21
22
23
24








25
26
27
28
29
30
31
 * significant bits, or the value itself. Most classes will likely implement
 * these using narrowing conversions that match the Java language.
 *
 * @since 2018/09/23
 */
public abstract class Number
{








	
	/**
	 * Returns the value of this number converted as a double.
	 *
	 * @return The converted value of this number.
	 * @since 2018/09/23
	 */

Name change from runt/apis/cldc-compact/java/lang/NumberFormatException.java to modules/cldc-compact/src/main/java/java/lang/NumberFormatException.java.

Name change from runt/apis/cldc-compact/java/lang/Object.java to modules/cldc-compact/src/main/java/java/lang/Object.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48

49
50
51
52
53
54
55
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.lang;

import cc.squirreljme.jvm.Assembly;
import cc.squirreljme.jvm.SystemCallError;
import cc.squirreljme.jvm.SystemCallIndex;
import cc.squirreljme.runtime.cldc.annotation.ImplementationNote;
import cc.squirreljme.runtime.cldc.asm.ObjectAccess;

/**
 * This class is the root of all class trees in Java.
 *
 * @since 2016/02/08
 */
@ImplementationNote("The Java compiler does not allow any final fields to " +
	"exist in Object and if they are set via assignment no code will be " +
	"generated for them, so as such Object effectively has no fields.")
public class Object
{
	/**
	 * Initializes the base object.
	 *
	 * @since 2018/09/09
	 */
	@ImplementationNote("The Java compiler does not allow final fields " +
		"in Object to be set, they are already treated as already being " +
		"set.")
	public Object()
	{
	}
	
	/**
	 * Clones the current copy creating a shallow copy of it if
	 * {@code Cloneable} is implemented, unless this method is overridden to
	 * perform class specific cloning.
	 *
	 * @throws CloneNotSupportedException If cloning is not supported by the
	 * current class, the default implementation always throws this if the
	 * {@link Cloneable} interface does not exist.

	 * @since 2016/02/08
	 */
	protected Object clone()
		throws CloneNotSupportedException
	{
		// If this is an array copy elements around
		Class<?> cl = this.getClass();













<
<













<
<
<
<
<
<
<
<
<
<
<









>







1
2
3
4
5
6
7
8
9
10
11
12
13


14
15
16
17
18
19
20
21
22
23
24
25
26











27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.lang;

import cc.squirreljme.jvm.Assembly;


import cc.squirreljme.runtime.cldc.annotation.ImplementationNote;
import cc.squirreljme.runtime.cldc.asm.ObjectAccess;

/**
 * This class is the root of all class trees in Java.
 *
 * @since 2016/02/08
 */
@ImplementationNote("The Java compiler does not allow any final fields to " +
	"exist in Object and if they are set via assignment no code will be " +
	"generated for them, so as such Object effectively has no fields.")
public class Object
{











	
	/**
	 * Clones the current copy creating a shallow copy of it if
	 * {@code Cloneable} is implemented, unless this method is overridden to
	 * perform class specific cloning.
	 *
	 * @throws CloneNotSupportedException If cloning is not supported by the
	 * current class, the default implementation always throws this if the
	 * {@link Cloneable} interface does not exist.
	 * @return The cloned object.
	 * @since 2016/02/08
	 */
	protected Object clone()
		throws CloneNotSupportedException
	{
		// If this is an array copy elements around
		Class<?> cl = this.getClass();
77
78
79
80
81
82
83

84
85
86
87
88
89
90
	 * reflexive (equal to self), symmetric (a is equal to b as b is equal to
	 * a), transitive (a is equal to b, and b is equal to c, then a must be
	 * equal to c), and consistent (if no modifications to the object were made
	 * then it should return the same value returned as the previous call).
	 *
	 * If this method is overriden, then also override {@code hashCode()}.
	 *

	 * @return {@code true} if the two objects are equal.
	 * @since 2016/02/08
	 */
	public boolean equals(Object __o)
	{
		return this == __o;
	}







>







65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
	 * reflexive (equal to self), symmetric (a is equal to b as b is equal to
	 * a), transitive (a is equal to b, and b is equal to c, then a must be
	 * equal to c), and consistent (if no modifications to the object were made
	 * then it should return the same value returned as the previous call).
	 *
	 * If this method is overriden, then also override {@code hashCode()}.
	 *
	 * @param __o The object to check equality against.
	 * @return {@code true} if the two objects are equal.
	 * @since 2016/02/08
	 */
	public boolean equals(Object __o)
	{
		return this == __o;
	}

Name change from runt/apis/cldc-compact/java/lang/OutOfMemoryError.java to modules/cldc-compact/src/main/java/java/lang/OutOfMemoryError.java.

26
27
28
29
30
31
32

33
34
35
36
37
38
39
	public OutOfMemoryError()
	{
	}
	
	/**
	 * Initializes the exception with the given message and no cause.
	 *

	 * @since 2018/12/04
	 */
	public OutOfMemoryError(String __m)
	{
		super(__m);
	}
}







>







26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
	public OutOfMemoryError()
	{
	}
	
	/**
	 * Initializes the exception with the given message and no cause.
	 *
	 * @param __m The message.
	 * @since 2018/12/04
	 */
	public OutOfMemoryError(String __m)
	{
		super(__m);
	}
}

Name change from runt/apis/cldc-compact/java/lang/Override.java to modules/cldc-compact/src/main/java/java/lang/Override.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.lang;

import java.lang.annotation.Annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * This is a flagging annotation which is attached to a method to indicate that












<







1
2
3
4
5
6
7
8
9
10
11
12

13
14
15
16
17
18
19
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.lang;


import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * This is a flagging annotation which is attached to a method to indicate that

Name change from runt/apis/cldc-compact/java/lang/Runnable.java to modules/cldc-compact/src/main/java/java/lang/Runnable.java.

8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.lang;

/**
 * This interface should be used by any class which is intended and capable
 * of being run in its own thread (via {@link Thread(Runnable)}.
 *
 * When used with {@link Thread}, the method {@link #run()} will be executed
 * when the thread is started.
 *
 * @since 2018/09/19
 */
public interface Runnable
{
	/**
	 * Performs any action that is required as needed.
	 *
	 * @since 2018/09/19
	 */
	public abstract void run();
}








|













|


8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.lang;

/**
 * This interface should be used by any class which is intended and capable
 * of being run in its own thread (via {@link Thread#Thread(Runnable)}.
 *
 * When used with {@link Thread}, the method {@link #run()} will be executed
 * when the thread is started.
 *
 * @since 2018/09/19
 */
public interface Runnable
{
	/**
	 * Performs any action that is required as needed.
	 *
	 * @since 2018/09/19
	 */
	void run();
}

Name change from runt/apis/cldc-compact/java/lang/Runtime.java to modules/cldc-compact/src/main/java/java/lang/Runtime.java.

113
114
115
116
117
118
119

120
121
122
123
124
125
126
	}
	
	/**
	 * Returns the single instance of this class.
	 *
	 * Only a single runtime is valid and there will only be one.
	 *

	 * @since 2018/03/01
	 */
	public static Runtime getRuntime()
	{
		return Runtime._INSTANCE;
	}
}







>







113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
	}
	
	/**
	 * Returns the single instance of this class.
	 *
	 * Only a single runtime is valid and there will only be one.
	 *
	 * @return The current run-time.
	 * @since 2018/03/01
	 */
	public static Runtime getRuntime()
	{
		return Runtime._INSTANCE;
	}
}

Name change from runt/apis/cldc-compact/java/lang/RuntimeException.java to modules/cldc-compact/src/main/java/java/lang/RuntimeException.java.

Name change from runt/apis/cldc-compact/java/lang/RuntimePermission.java to modules/cldc-compact/src/main/java/java/lang/RuntimePermission.java.

Name change from runt/apis/cldc-compact/java/lang/SecurityException.java to modules/cldc-compact/src/main/java/java/lang/SecurityException.java.

Name change from runt/apis/cldc-compact/java/lang/SecurityManager.java to modules/cldc-compact/src/main/java/java/lang/SecurityManager.java.

Name change from runt/apis/cldc-compact/java/lang/Short.java to modules/cldc-compact/src/main/java/java/lang/Short.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.lang;

import cc.squirreljme.runtime.cldc.annotation.ImplementationNote;
import cc.squirreljme.runtime.cldc.asm.ObjectAccess;
import java.lang.ref.Reference;
import java.lang.ref.WeakReference;

public final class Short
	extends Number
	implements Comparable<Short>












<







1
2
3
4
5
6
7
8
9
10
11
12

13
14
15
16
17
18
19
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.lang;


import cc.squirreljme.runtime.cldc.asm.ObjectAccess;
import java.lang.ref.Reference;
import java.lang.ref.WeakReference;

public final class Short
	extends Number
	implements Comparable<Short>
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
	{
		this._value = __v;
	}
	
	public Short(String __a)
		throws NumberFormatException
	{
		super();
		if (false)
			throw new NumberFormatException();
		throw new todo.TODO();
	}
	
	@Override
	public byte byteValue()







<







47
48
49
50
51
52
53

54
55
56
57
58
59
60
	{
		this._value = __v;
	}
	
	public Short(String __a)
		throws NumberFormatException
	{

		if (false)
			throw new NumberFormatException();
		throw new todo.TODO();
	}
	
	@Override
	public byte byteValue()
200
201
202
203
204
205
206
207
208
209
210
	 * The {@link #TYPE} field is magically initialized by the virtual machine.
	 *
	 * @return {@link #TYPE}.
	 * @since 2016/06/16
	 */
	private static Class<Short> __getType()
	{
		return TYPE;
	}
}








|



198
199
200
201
202
203
204
205
206
207
208
	 * The {@link #TYPE} field is magically initialized by the virtual machine.
	 *
	 * @return {@link #TYPE}.
	 * @since 2016/06/16
	 */
	private static Class<Short> __getType()
	{
		return Short.TYPE;
	}
}

Name change from runt/apis/cldc-compact/java/lang/String.java to modules/cldc-compact/src/main/java/java/lang/String.java.

20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import java.util.Arrays;
import java.util.Collection;
import java.util.Comparator;
import java.util.Formatter;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Map;
import java.util.WeakHashMap;

/**
 * A {@link String} represents a sequence of characters which make up a group
 * of alphanumeric or other symbols and represents text.
 *
 * Note that only {@link #toLowerCase()} and {@link #toUpperCase()} take
 * locale into considering during their conversion.







<



<
<







20
21
22
23
24
25
26

27
28
29


30
31
32
33
34
35
36
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import java.util.Arrays;
import java.util.Collection;

import java.util.Formatter;
import java.util.Iterator;
import java.util.LinkedList;



/**
 * A {@link String} represents a sequence of characters which make up a group
 * of alphanumeric or other symbols and represents text.
 *
 * Note that only {@link #toLowerCase()} and {@link #toUpperCase()} take
 * locale into considering during their conversion.
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
	 * Initializes a new empty string.
	 *
	 * @since 2018/02/24
	 */
	public String()
	{
		this._chars = new char[0];
		this._quickflags = _QUICK_ISLOWER | _QUICK_ISUPPER;
		this._hashcode = 0;
	}
	
	/**
	 * Initializes a string which is an exact copy of the other string.
	 *
	 * @param __s The other string.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/05/24
	 */
	public String(String __s)
		throws NullPointerException
	{
		if (__s == null)
			throw new NullPointerException("NARG");
		
		// Just copies all the fields since they were pre-calculated already
		this._chars = __s._chars;
		this._quickflags = ((short)(__s._quickflags & (~_QUICK_INTERN)));
		this._hashcode = __s._hashcode;
	}
	
	/**
	 * Initializes a string which uses characters which are a copy of the given
	 * character array.
	 *







|


















|







73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
	 * Initializes a new empty string.
	 *
	 * @since 2018/02/24
	 */
	public String()
	{
		this._chars = new char[0];
		this._quickflags = String._QUICK_ISLOWER | String._QUICK_ISUPPER;
		this._hashcode = 0;
	}
	
	/**
	 * Initializes a string which is an exact copy of the other string.
	 *
	 * @param __s The other string.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/05/24
	 */
	public String(String __s)
		throws NullPointerException
	{
		if (__s == null)
			throw new NullPointerException("NARG");
		
		// Just copies all the fields since they were pre-calculated already
		this._chars = __s._chars;
		this._quickflags = ((short)(__s._quickflags & (~String._QUICK_INTERN)));
		this._hashcode = __s._hashcode;
	}
	
	/**
	 * Initializes a string which uses characters which are a copy of the given
	 * character array.
	 *
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
	 *
	 * @param __b The input bytes to decode.
	 * @param __o The offset into the array.
	 * @param __l The number of bytes to code.
	 * @throws IndexOutOfBoundsException If offset and/or length are negative
	 * or exceed the array bounds.
	 * @throws NullPointerException On null arguments.
	 * @throws UnsupportedEncodingException If the encoding is not supported.
	 * @since 2018/11/06
	 */
	public String(byte[] __b, int __o, int __l)
		throws IndexOutOfBoundsException, NullPointerException
	{
		this(__b, __o, __l, CodecFactory.defaultDecoder());
	}
	
	/**
	 * Decodes the given bytes to a string using the specified encoding.
	 *
	 * @param __b The input bytes to decode.
	 * @param __e The encoding to use when decoding the bytes.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/11/06
	 */
	public String(byte[] __b)
		throws NullPointerException
	{
		this(__b, 0, __b.length, CodecFactory.defaultDecoder());







<












<







183
184
185
186
187
188
189

190
191
192
193
194
195
196
197
198
199
200
201

202
203
204
205
206
207
208
	 *
	 * @param __b The input bytes to decode.
	 * @param __o The offset into the array.
	 * @param __l The number of bytes to code.
	 * @throws IndexOutOfBoundsException If offset and/or length are negative
	 * or exceed the array bounds.
	 * @throws NullPointerException On null arguments.

	 * @since 2018/11/06
	 */
	public String(byte[] __b, int __o, int __l)
		throws IndexOutOfBoundsException, NullPointerException
	{
		this(__b, __o, __l, CodecFactory.defaultDecoder());
	}
	
	/**
	 * Decodes the given bytes to a string using the specified encoding.
	 *
	 * @param __b The input bytes to decode.

	 * @throws NullPointerException On null arguments.
	 * @since 2018/11/06
	 */
	public String(byte[] __b)
		throws NullPointerException
	{
		this(__b, 0, __b.length, CodecFactory.defaultDecoder());
359
360
361
362
363
364
365

366
367
368
369
370
371
372
		throws NullPointerException
	{
		// Check
		if (__o == null)
			throw new NullPointerException("NARG");
		
		// Refers to the same exact string?

		if (this == __o)
			return 0;
		
		// Characters of both
		char[] ac = this._chars,
			bc = __o._chars;
		







>







354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
		throws NullPointerException
	{
		// Check
		if (__o == null)
			throw new NullPointerException("NARG");
		
		// Refers to the same exact string?
		//noinspection StringEquality
		if (this == __o)
			return 0;
		
		// Characters of both
		char[] ac = this._chars,
			bc = __o._chars;
		
405
406
407
408
409
410
411

412
413
414
415
416
417
418
	public int compareToIgnoreCase(String __o)
		throws NullPointerException
	{
		if (__o == null)
			throw new NullPointerException("NARG");
		
		// Refers to the same exact string?

		if (this == __o)
			return 0;
		
		// Characters of both
		char[] ac = this._chars,
			bc = __o._chars;
		







>







401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
	public int compareToIgnoreCase(String __o)
		throws NullPointerException
	{
		if (__o == null)
			throw new NullPointerException("NARG");
		
		// Refers to the same exact string?
		//noinspection StringEquality
		if (this == __o)
			return 0;
		
		// Characters of both
		char[] ac = this._chars,
			bc = __o._chars;
		
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
	{
		// Check
		if (__s == null)
			throw new NullPointerException("NARG");
		
		// Synchronize on StringBuffers
		if (__s instanceof StringBuffer)
			return contentEquals((StringBuffer)__s);
		
		return __contentEquals(__s);
	}
	
	/**
	 * Tests if this string ends with the given string.
	 *
	 * @param __s The string to test.
	 * @return If this string ends with the other string.







|

|







547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
	{
		// Check
		if (__s == null)
			throw new NullPointerException("NARG");
		
		// Synchronize on StringBuffers
		if (__s instanceof StringBuffer)
			return this.contentEquals((StringBuffer)__s);
		
		return this.__contentEquals(__s);
	}
	
	/**
	 * Tests if this string ends with the given string.
	 *
	 * @param __s The string to test.
	 * @return If this string ends with the other string.
702
703
704
705
706
707
708
709

710
711
712
713
714
715
716
	 * Translates this string using into a byte array using the specified
	 * character encoding.
	 *
	 * @param __enc The character encoding to use.
	 * @return A byte array with the characters of this string converted to
	 * bytes.
	 * @throws NullPointerException If no encoding was specified.
	 * @throws UnsupportedEncodingException 

	 */
	public byte[] getBytes(String __enc)
		throws NullPointerException, UnsupportedEncodingException
	{
		// Check
		if (__enc == null)
			throw new NullPointerException("NARG");







|
>







699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
	 * Translates this string using into a byte array using the specified
	 * character encoding.
	 *
	 * @param __enc The character encoding to use.
	 * @return A byte array with the characters of this string converted to
	 * bytes.
	 * @throws NullPointerException If no encoding was specified.
	 * @throws UnsupportedEncodingException If the encoding is unknown.
	 * @since 2018/12/08
	 */
	public byte[] getBytes(String __enc)
		throws NullPointerException, UnsupportedEncodingException
	{
		// Check
		if (__enc == null)
			throw new NullPointerException("NARG");
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
		"since the __BucketMap__ is a complicated class. But do note that " +
		"String.equals() checks the hashCode() so in-depth searches will " +
		"only be performed for strings with the same hashCode().")
	public String intern()
	{
		// If this string is already interned then use this one instead
		// of searching through the map
		if ((this._quickflags & _QUICK_INTERN) != 0)
			return this;
		
		// Search for string in the collection
		Collection<Reference<String>> interns = _INTERNS;
		synchronized (interns)
		{
			// Same string that was internalized?
			Iterator<Reference<String>> it = interns.iterator();
			while (it.hasNext())
			{
				Reference<String> ref = it.next();







|



|







851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
		"since the __BucketMap__ is a complicated class. But do note that " +
		"String.equals() checks the hashCode() so in-depth searches will " +
		"only be performed for strings with the same hashCode().")
	public String intern()
	{
		// If this string is already interned then use this one instead
		// of searching through the map
		if ((this._quickflags & String._QUICK_INTERN) != 0)
			return this;
		
		// Search for string in the collection
		Collection<Reference<String>> interns = String._INTERNS;
		synchronized (interns)
		{
			// Same string that was internalized?
			Iterator<Reference<String>> it = interns.iterator();
			while (it.hasNext())
			{
				Reference<String> ref = it.next();
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
					return oth;
			}
			
			// Not in the table, so add it
			interns.add(new WeakReference<>(this));
			
			// Also flag that this has been interned
			this._quickflags |= _QUICK_INTERN;
			
			// This will be the intern string
			return this;
		}
	}
	
	/**







|







881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
					return oth;
			}
			
			// Not in the table, so add it
			interns.add(new WeakReference<>(this));
			
			// Also flag that this has been interned
			this._quickflags |= String._QUICK_INTERN;
			
			// This will be the intern string
			return this;
		}
	}
	
	/**
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
		// Not found
		return -1;
	}
	
	/**
	 * Returns the last occurance of the given string.
	 *
	 * @param __c The string to find.
	 * @return The last occurance of the string or {@code -1} if it was
	 * not found.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/12/25
	 */
	public int lastIndexOf(String __s)
		throws NullPointerException







|







947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
		// Not found
		return -1;
	}
	
	/**
	 * Returns the last occurance of the given string.
	 *
	 * @param __s The string to find.
	 * @return The last occurance of the string or {@code -1} if it was
	 * not found.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/12/25
	 */
	public int lastIndexOf(String __s)
		throws NullPointerException
1054
1055
1056
1057
1058
1059
1060

1061
1062
1063
1064
1065
1066
1067
	
	/**
	 * Returns a string with all characters which match the starting character
	 * which are then replaced with the replacement character.
	 *
	 * @param __a The starting character.
	 * @param __b The replacement character.

	 * @since 2018/09/22
	 */
	public String replace(char __a, char __b)
	{
		// If a character is going to be replaced with itself then no
		// replacement has to actually be performed. Or if the original
		// character is not even in the string.







>







1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
	
	/**
	 * Returns a string with all characters which match the starting character
	 * which are then replaced with the replacement character.
	 *
	 * @param __a The starting character.
	 * @param __b The replacement character.
	 * @return The resulting string.
	 * @since 2018/09/22
	 */
	public String replace(char __a, char __b)
	{
		// If a character is going to be replaced with itself then no
		// replacement has to actually be performed. Or if the original
		// character is not even in the string.
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
	
	/**
	 * Checks if this string starts with the other string at the given index.
	 *
	 * @param __s The string to check for a starting match.
	 * @param __sdx The starting index to start checking at.
	 * @return If this string starts with the given string.
	 * @throws IndexOutOfBoundsException
	 * @throws NullPointerException On null arguments.
	 * @since 2018/09/22
	 */
	public boolean startsWith(String __s, int __sdx)
		throws IndexOutOfBoundsException, NullPointerException
	{
		if (__s == null)







|







1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
	
	/**
	 * Checks if this string starts with the other string at the given index.
	 *
	 * @param __s The string to check for a starting match.
	 * @param __sdx The starting index to start checking at.
	 * @return If this string starts with the given string.
	 * @throws IndexOutOfBoundsException If the index is outside of bounds.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/09/22
	 */
	public boolean startsWith(String __s, int __sdx)
		throws IndexOutOfBoundsException, NullPointerException
	{
		if (__s == null)
1177
1178
1179
1180
1181
1182
1183

1184
1185
1186
1187
1188
1189
1190
	}
	
	/**
	 * Returns a substring of this string.
	 *
	 * @param __s The starting index.
	 * @param __e The ending index.

	 * @throws IndexOutOfBoundsException If the string region is outside of
	 * bounds.
	 * @since 2018/09/29
	 */
	public String substring(int __s, int __e)
		throws IndexOutOfBoundsException
	{







>







1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
	}
	
	/**
	 * Returns a substring of this string.
	 *
	 * @param __s The starting index.
	 * @param __e The ending index.
	 * @return The resulting string.
	 * @throws IndexOutOfBoundsException If the string region is outside of
	 * bounds.
	 * @since 2018/09/29
	 */
	public String substring(int __s, int __e)
		throws IndexOutOfBoundsException
	{
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
		char[] ch = this._chars;
		int n = ch.length;
		if (n <= 0)
			return this;
		
		// Find starting trim position
		int s;
		for (s = 0; s < n && ch[s] <= _MIN_TRIM_CHAR; s++)
			;
		
		// Find ending trim position
		int e;
		for (e = n; e > s && ch[e - 1] <= _MIN_TRIM_CHAR; e--)
			;
		
		// Return trimmed variant of it
		return this.substring(s, e);
	}
	
	/**







|




|







1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
		char[] ch = this._chars;
		int n = ch.length;
		if (n <= 0)
			return this;
		
		// Find starting trim position
		int s;
		for (s = 0; s < n && ch[s] <= String._MIN_TRIM_CHAR; s++)
			;
		
		// Find ending trim position
		int e;
		for (e = n; e > s && ch[e - 1] <= String._MIN_TRIM_CHAR; e--)
			;
		
		// Return trimmed variant of it
		return this.substring(s, e);
	}
	
	/**
1525
1526
1527
1528
1529
1530
1531

1532
1533
1534
1535
1536
1537
1538
	
	/**
	 * Returns a formatted string using a temporary instance of the
	 * {@link Formatter} class.
	 *
	 * @param __fmt The format specifiers.
	 * @param __args The arguments to the formatter.

	 * @throws IllegalArgumentException If the format is not correct.
	 * @throws NullPointerException On null arguments.
	 * @see java.util.Formatter
	 * @since 2018/11/02
	 */
	public static String format(String __fmt, Object... __args)
		throws IllegalArgumentException, NullPointerException







>







1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
	
	/**
	 * Returns a formatted string using a temporary instance of the
	 * {@link Formatter} class.
	 *
	 * @param __fmt The format specifiers.
	 * @param __args The arguments to the formatter.
	 * @return The formatted string.
	 * @throws IllegalArgumentException If the format is not correct.
	 * @throws NullPointerException On null arguments.
	 * @see java.util.Formatter
	 * @since 2018/11/02
	 */
	public static String format(String __fmt, Object... __args)
		throws IllegalArgumentException, NullPointerException
1579
1580
1581
1582
1583
1584
1585

1586
1587
1588
1589
1590
1591
1592
	
	/**
	 * Returns a string representation of the given character array.
	 *
	 * @param __c The input array.
	 * @param __o The offset.
	 * @param __l The number of characters to set.

	 * @throws IndexOutOfBoundsException If the offset and/or length
	 * are negative or exceed the array bounds.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/12/25
	 */
	public static String valueOf(char[] __c, int __o, int __l)
		throws IndexOutOfBoundsException, NullPointerException







>







1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
	
	/**
	 * Returns a string representation of the given character array.
	 *
	 * @param __c The input array.
	 * @param __o The offset.
	 * @param __l The number of characters to set.
	 * @return The resulting string.
	 * @throws IndexOutOfBoundsException If the offset and/or length
	 * are negative or exceed the array bounds.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/12/25
	 */
	public static String valueOf(char[] __c, int __o, int __l)
		throws IndexOutOfBoundsException, NullPointerException

Name change from runt/apis/cldc-compact/java/lang/StringBuffer.java to modules/cldc-compact/src/main/java/java/lang/StringBuffer.java.

359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
	/**
	 * See {@link StringBuffer#getChars(int, int, char[], int)}.
	 *
	 * @param __a Same as linked documentation.
	 * @param __b Same as linked documentation.
	 * @param __c Same as linked documentation.
	 * @param __d Same as linked documentation.
	 * @return Same as linked documentation.
	 * @since 2018/12/08
	 */
	public void getChars(int __a, int __b, char[] __c, int __d)
	{
		synchronized (this)
		{
			this.builder.getChars(__a, __b, __c, __d);







<







359
360
361
362
363
364
365

366
367
368
369
370
371
372
	/**
	 * See {@link StringBuffer#getChars(int, int, char[], int)}.
	 *
	 * @param __a Same as linked documentation.
	 * @param __b Same as linked documentation.
	 * @param __c Same as linked documentation.
	 * @param __d Same as linked documentation.

	 * @since 2018/12/08
	 */
	public void getChars(int __a, int __b, char[] __c, int __d)
	{
		synchronized (this)
		{
			this.builder.getChars(__a, __b, __c, __d);
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
			return this.builder.toString();
		}
	}
	
	/**
	 * See {@link StringBuffer#trimToSize()}.
	 *
	 * @return Same as linked documentation.
	 * @since 2018/12/08
	 */
	public void trimToSize()
	{
		synchronized (this)
		{
			this.builder.trimToSize();
		}
	}
}








<











780
781
782
783
784
785
786

787
788
789
790
791
792
793
794
795
796
797
			return this.builder.toString();
		}
	}
	
	/**
	 * See {@link StringBuffer#trimToSize()}.
	 *

	 * @since 2018/12/08
	 */
	public void trimToSize()
	{
		synchronized (this)
		{
			this.builder.trimToSize();
		}
	}
}

Name change from runt/apis/cldc-compact/java/lang/StringBuilder.java to modules/cldc-compact/src/main/java/java/lang/StringBuilder.java.

84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
	}
	
	/**
	 * Initializes with the initial characters given by the input sequence,
	 * the internal buffer is the default capacity plus the input string
	 * length.
	 *
	 * @param __s The characters to copy.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/09/22
	 */
	public StringBuilder(CharSequence __cs)
	{
		if (__cs == null)
			throw new NullPointerException("NARG");







|







84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
	}
	
	/**
	 * Initializes with the initial characters given by the input sequence,
	 * the internal buffer is the default capacity plus the input string
	 * length.
	 *
	 * @param __cs The characters to copy.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/09/22
	 */
	public StringBuilder(CharSequence __cs)
	{
		if (__cs == null)
			throw new NullPointerException("NARG");

Name change from runt/apis/cldc-compact/java/lang/StringIndexOutOfBoundsException.java to modules/cldc-compact/src/main/java/java/lang/StringIndexOutOfBoundsException.java.

Name change from runt/apis/cldc-compact/java/lang/SuppressWarnings.java to modules/cldc-compact/src/main/java/java/lang/SuppressWarnings.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.lang;

import java.lang.annotation.Annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * Suppresses warnings that are generated by the compiler so that they do not












<







1
2
3
4
5
6
7
8
9
10
11
12

13
14
15
16
17
18
19
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.lang;


import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * Suppresses warnings that are generated by the compiler so that they do not
33
34
35
36
37
38
39
40
41
42
43
 */
@Target(value={ElementType.TYPE, ElementType.FIELD, ElementType.METHOD,
	ElementType.PARAMETER, ElementType.CONSTRUCTOR,
	ElementType.LOCAL_VARIABLE})
@Retention(value=RetentionPolicy.SOURCE)
public @interface SuppressWarnings
{
	/** The warnings that should be suppressed. */
	String[] value();
}








|



32
33
34
35
36
37
38
39
40
41
42
 */
@Target(value={ElementType.TYPE, ElementType.FIELD, ElementType.METHOD,
	ElementType.PARAMETER, ElementType.CONSTRUCTOR,
	ElementType.LOCAL_VARIABLE})
@Retention(value=RetentionPolicy.SOURCE)
public @interface SuppressWarnings
{
	/** @return The warnings that should be suppressed. */
	String[] value();
}

Name change from runt/apis/cldc-compact/java/lang/System.java to modules/cldc-compact/src/main/java/java/lang/System.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.lang;

import cc.squirreljme.jvm.Assembly;
import cc.squirreljme.jvm.SystemCallError;
import cc.squirreljme.jvm.SystemCallIndex;
import cc.squirreljme.runtime.cldc.asm.ConsoleOutput;
import cc.squirreljme.runtime.cldc.asm.ObjectAccess;
import cc.squirreljme.runtime.cldc.asm.SystemAccess;
import cc.squirreljme.runtime.cldc.asm.SystemProperties;
import cc.squirreljme.runtime.cldc.io.CodecFactory;
import cc.squirreljme.runtime.cldc.io.ConsoleOutputStream;
import cc.squirreljme.runtime.cldc.lang.ApiLevel;
import cc.squirreljme.runtime.cldc.SquirrelJME;
import java.io.OutputStream;
import java.io.PrintStream;
import java.security.Permission;

/**
 * This class contains methods which are used to interact with the system and
 * the environment.
 *
 * @since 2018/10/14
 */













<

|
|
|




<
<

<







1
2
3
4
5
6
7
8
9
10
11
12
13

14
15
16
17
18
19
20
21


22

23
24
25
26
27
28
29
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.lang;

import cc.squirreljme.jvm.Assembly;

import cc.squirreljme.jvm.SystemCallIndex;
import cc.squirreljme.runtime.cldc.SquirrelJME;
import cc.squirreljme.runtime.cldc.asm.ConsoleOutput;
import cc.squirreljme.runtime.cldc.asm.ObjectAccess;
import cc.squirreljme.runtime.cldc.asm.SystemProperties;
import cc.squirreljme.runtime.cldc.io.CodecFactory;
import cc.squirreljme.runtime.cldc.io.ConsoleOutputStream;
import cc.squirreljme.runtime.cldc.lang.ApiLevel;


import java.io.PrintStream;


/**
 * This class contains methods which are used to interact with the system and
 * the environment.
 *
 * @since 2018/10/14
 */
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
			throw new IllegalArgumentException("ZZ1z");
		
		// Short circuit for run-time detection
		if (__k.equals("cc.squirreljme.isruntime"))
			return "true";
		
		// Not allowed to do this?
		getSecurityManager().checkPropertyAccess(__k);
		
		// Depends on the property
		String rv;
		switch (__k)
		{
				// API level of SquirrelJME
			case "cc.squirreljme.apilevel":







|







270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
			throw new IllegalArgumentException("ZZ1z");
		
		// Short circuit for run-time detection
		if (__k.equals("cc.squirreljme.isruntime"))
			return "true";
		
		// Not allowed to do this?
		System.getSecurityManager().checkPropertyAccess(__k);
		
		// Depends on the property
		String rv;
		switch (__k)
		{
				// API level of SquirrelJME
			case "cc.squirreljme.apilevel":
404
405
406
407
408
409
410

411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
	/**
	 * Obtains the specified system property and if it has not been set then
	 * the default value will be returned instead.
	 *
	 * @param __k The system property to get.
	 * @param __d If the system property is not set (returns {@code null}
	 * then this value will be returned instead.

	 * @throws IllegalArgumentException If the requested system property is
	 * not valid (it is blank).
	 * @throws NullPointerException If no key was specified.
	 * @throws SecurityException If obtaining the given system property is
	 * not permitted.
	 * @since 2017/08/13
	 */
	public static String getProperty(String __k, String __d)
		throws IllegalArgumentException, NullPointerException,
			SecurityException
	{
		// Get it
		String rv = getProperty(__k);
		
		// If not set, return the default, otherwise the read value
		if (rv == null)
			return __d;
		return rv;
	}
	







>












|







400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
	/**
	 * Obtains the specified system property and if it has not been set then
	 * the default value will be returned instead.
	 *
	 * @param __k The system property to get.
	 * @param __d If the system property is not set (returns {@code null}
	 * then this value will be returned instead.
	 * @return The system property.
	 * @throws IllegalArgumentException If the requested system property is
	 * not valid (it is blank).
	 * @throws NullPointerException If no key was specified.
	 * @throws SecurityException If obtaining the given system property is
	 * not permitted.
	 * @since 2017/08/13
	 */
	public static String getProperty(String __k, String __d)
		throws IllegalArgumentException, NullPointerException,
			SecurityException
	{
		// Get it
		String rv = System.getProperty(__k);
		
		// If not set, return the default, otherwise the read value
		if (rv == null)
			return __d;
		return rv;
	}
	
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
		throws NullPointerException
	{
		// Check
		if (__a == null)
			throw new NullPointerException("NARG");
		
		// Not allowed to do this?
		getSecurityManager().checkPermission(new RuntimePermission("setIO"));
		
		// Use a wrapped class to prevent final abuse.
		((__CanSetPrintStream__)err).__set(__a);
	}
	
	/**
	 * Sets the new destination for standard output.
	 *
	 * Note that the {@link System#out} field is not changed, a wrapper class
	 * is used to prevent reflective abuse.







|


|







504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
		throws NullPointerException
	{
		// Check
		if (__a == null)
			throw new NullPointerException("NARG");
		
		// Not allowed to do this?
		System.getSecurityManager().checkPermission(new RuntimePermission("setIO"));
		
		// Use a wrapped class to prevent final abuse.
		((__CanSetPrintStream__)System.err).__set(__a);
	}
	
	/**
	 * Sets the new destination for standard output.
	 *
	 * Note that the {@link System#out} field is not changed, a wrapper class
	 * is used to prevent reflective abuse.
533
534
535
536
537
538
539
540
541
542
543
544
545
546
		throws NullPointerException
	{
		// Check
		if (__a == null)
			throw new NullPointerException("NARG");
		
		// Not allowed to do this?
		getSecurityManager().checkPermission(new RuntimePermission("setIO"));
		
		// Use a wrapped class to prevent final abuse.
		((__CanSetPrintStream__)out).__set(__a);
	}
}








|


|



530
531
532
533
534
535
536
537
538
539
540
541
542
543
		throws NullPointerException
	{
		// Check
		if (__a == null)
			throw new NullPointerException("NARG");
		
		// Not allowed to do this?
		System.getSecurityManager().checkPermission(new RuntimePermission("setIO"));
		
		// Use a wrapped class to prevent final abuse.
		((__CanSetPrintStream__)System.out).__set(__a);
	}
}

Name change from runt/apis/cldc-compact/java/lang/Thread.java to modules/cldc-compact/src/main/java/java/lang/Thread.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.lang;

import cc.squirreljme.jvm.Assembly;
import cc.squirreljme.jvm.SystemCallError;
import cc.squirreljme.jvm.SystemCallIndex;
import cc.squirreljme.runtime.cldc.annotation.ImplementationNote;
import cc.squirreljme.runtime.cldc.asm.ObjectAccess;
import cc.squirreljme.runtime.cldc.asm.StaticMethod;
import cc.squirreljme.runtime.cldc.asm.SystemAccess;
import cc.squirreljme.runtime.cldc.asm.TaskAccess;
import cc.squirreljme.runtime.cldc.lang.UncaughtExceptionHandler;
import java.util.HashMap;
import java.util.Map;

/**
 * A thread represents literally a single stream of execution that can
 * execute concurrently (or not).
 *
 * SquirrelJME may be running with multiple threads executing at once or it
 * may also be executing cooperatively (only a single thread at a time). If
 * SquirrelJME is running cooperatively then only locking,
 * {@link Thread.sleep(long, int)}, or {@link Thread.yield()} will allow
 * another thread to run.
 *
 * @since 2018/12/07
 */
@ImplementationNote("Internally all threads start in the Thread.__start() " +
	"method which sets up the thread and such.")
public class Thread













<




<












|







1
2
3
4
5
6
7
8
9
10
11
12
13

14
15
16
17

18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.lang;

import cc.squirreljme.jvm.Assembly;

import cc.squirreljme.jvm.SystemCallIndex;
import cc.squirreljme.runtime.cldc.annotation.ImplementationNote;
import cc.squirreljme.runtime.cldc.asm.ObjectAccess;
import cc.squirreljme.runtime.cldc.asm.StaticMethod;

import cc.squirreljme.runtime.cldc.asm.TaskAccess;
import cc.squirreljme.runtime.cldc.lang.UncaughtExceptionHandler;
import java.util.HashMap;
import java.util.Map;

/**
 * A thread represents literally a single stream of execution that can
 * execute concurrently (or not).
 *
 * SquirrelJME may be running with multiple threads executing at once or it
 * may also be executing cooperatively (only a single thread at a time). If
 * SquirrelJME is running cooperatively then only locking,
 * {@link Thread#sleep(long, int)}, or {@link Thread#yield()} will allow
 * another thread to run.
 *
 * @since 2018/12/07
 */
@ImplementationNote("Internally all threads start in the Thread.__start() " +
	"method which sets up the thread and such.")
public class Thread
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
	/** Has this thread been started? */
	private volatile boolean _started;
	
	/** Is this thread alive? */
	private volatile boolean _isalive;
	
	/** The priority of the thread. */
	private volatile int _priority =
		NORM_PRIORITY;
	
	/** Is this thread interrupted? */
	volatile boolean _interrupted;
	
	/**
	 * Initializes the thread which invokes this object's {@link #run()} and
	 * uses a default thread name.
	 *
	 * @since 2018/11/17
	 */
	public Thread()
	{
		this(null, _USE_FAKE_NAME);
	}
	
	/**
	 * Initializes the thread which invokes this object's {@link #run()} and
	 * uses a default thread name.
	 *
	 * @param __r The runnable to execute.
	 * @since 2018/11/17
	 */
	public Thread(Runnable __r)
	{
		this(__r, _USE_FAKE_NAME);
	}
	
	/**
	 * Initializes the thread which invokes this object's {@link #run()} and
	 * uses the specified thread name.
	 *
	 * @param __n The thread's name.







|
<












|











|







106
107
108
109
110
111
112
113

114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
	/** Has this thread been started? */
	private volatile boolean _started;
	
	/** Is this thread alive? */
	private volatile boolean _isalive;
	
	/** The priority of the thread. */
	private volatile int _priority = Thread.NORM_PRIORITY;

	
	/** Is this thread interrupted? */
	volatile boolean _interrupted;
	
	/**
	 * Initializes the thread which invokes this object's {@link #run()} and
	 * uses a default thread name.
	 *
	 * @since 2018/11/17
	 */
	public Thread()
	{
		this(null, Thread._USE_FAKE_NAME);
	}
	
	/**
	 * Initializes the thread which invokes this object's {@link #run()} and
	 * uses a default thread name.
	 *
	 * @param __r The runnable to execute.
	 * @since 2018/11/17
	 */
	public Thread(Runnable __r)
	{
		this(__r, Thread._USE_FAKE_NAME);
	}
	
	/**
	 * Initializes the thread which invokes this object's {@link #run()} and
	 * uses the specified thread name.
	 *
	 * @param __n The thread's name.
163
164
165
166
167
168
169

170
171
172
173
174
175
176
177
	 * @param __n The thread's name.
	 * @throws NullPointerException If the thread name is null.
	 * @since 2018/11/17
	 */
	public Thread(Runnable __r, String __n)
		throws NullPointerException
	{

		this(__n, (__r == null ? _START_SELF_RUNNABLE : _START_GIVEN_RUNNABLE),
			null, __r);
	}
	
	/**
	 * Initializes a thread which is registered in this constructor and
	 * additionally has the given name and real ID.
	 *







>
|







160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
	 * @param __n The thread's name.
	 * @throws NullPointerException If the thread name is null.
	 * @since 2018/11/17
	 */
	public Thread(Runnable __r, String __n)
		throws NullPointerException
	{
		this(__n, (__r == null ? Thread._START_SELF_RUNNABLE :
				Thread._START_GIVEN_RUNNABLE),
			null, __r);
	}
	
	/**
	 * Initializes a thread which is registered in this constructor and
	 * additionally has the given name and real ID.
	 *
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
		this._started = true;
		this._isalive = true;
		
		// Obtain the next virtual ID to use
		int virtid;
		synchronized (Thread.class)
		{
			this._virtid = (virtid = _NEXT_VIRTUAL_ID++);
		}
		
		// Now register this thread in the main objects
		this.__registerThread();
	}
	
	/**







|







193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
		this._started = true;
		this._isalive = true;
		
		// Obtain the next virtual ID to use
		int virtid;
		synchronized (Thread.class)
		{
			this._virtid = (virtid = Thread._NEXT_VIRTUAL_ID++);
		}
		
		// Now register this thread in the main objects
		this.__registerThread();
	}
	
	/**
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
		if (__n == null)
			throw new NullPointerException("NARG");
		
		// Obtain the next virtual ID to use
		int virtid;
		synchronized (Thread.class)
		{
			this._virtid = (virtid = _NEXT_VIRTUAL_ID++);
		}
		
		// Set
		this._name = (__n == _USE_FAKE_NAME ? "Thread-" + virtid : __n);
		this._startkind = __rk;
		this._runmethod = __mm;
		this._runargument = __ma;
		
		// The main thread is implicitly started
		boolean implicitstart = (__rk == _START_MAIN || __rk == _START_MIDLET);
		this._started = implicitstart;
	}
	
	/**
	 * Checks that the thread has access to perform some operations.
	 *
	 * @throws SecurityException If access is denied.







|



|





|







220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
		if (__n == null)
			throw new NullPointerException("NARG");
		
		// Obtain the next virtual ID to use
		int virtid;
		synchronized (Thread.class)
		{
			this._virtid = (virtid = Thread._NEXT_VIRTUAL_ID++);
		}
		
		// Set
		this._name = (__n == Thread._USE_FAKE_NAME ? "Thread-" + virtid : __n);
		this._startkind = __rk;
		this._runmethod = __mm;
		this._runargument = __ma;
		
		// The main thread is implicitly started
		boolean implicitstart = (__rk == Thread._START_MAIN || __rk == Thread._START_MIDLET);
		this._started = implicitstart;
	}
	
	/**
	 * Checks that the thread has access to perform some operations.
	 *
	 * @throws SecurityException If access is denied.
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461

462
463
464
465
466
467
468
	 * @throws SecurityException If setting the priority is not permitted.
	 * @since 2018/12/07
	 */
	public final void setPriority(int __p)
		throws IllegalArgumentException, SecurityException
	{
		// {@squirreljme.error ZZ20 Invalid priority.}
		if (__p < MIN_PRIORITY || __p > MAX_PRIORITY)
			throw new IllegalArgumentException("ZZ20");
		
		// Check access
		this.checkAccess();
		
		// Store for later
		this._priority = __p;
		
		// Only set the priority if the thread is active
		int realid = this._realid;
		if (realid >= 0)
			TaskAccess.setThreadPriority(realid, __p);
	}
	
	/**
	 * Starts the specified thread.
	 *
	 * @throws IllegalThreadStateException 

	 * @since 2018/11/17
	 */
	public void start()
		throws IllegalThreadStateException
	{
		synchronized (this)
		{







|

















|
>







434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
	 * @throws SecurityException If setting the priority is not permitted.
	 * @since 2018/12/07
	 */
	public final void setPriority(int __p)
		throws IllegalArgumentException, SecurityException
	{
		// {@squirreljme.error ZZ20 Invalid priority.}
		if (__p < Thread.MIN_PRIORITY || __p > Thread.MAX_PRIORITY)
			throw new IllegalArgumentException("ZZ20");
		
		// Check access
		this.checkAccess();
		
		// Store for later
		this._priority = __p;
		
		// Only set the priority if the thread is active
		int realid = this._realid;
		if (realid >= 0)
			TaskAccess.setThreadPriority(realid, __p);
	}
	
	/**
	 * Starts the specified thread.
	 *
	 * @throws IllegalThreadStateException If the thread was already started
	 * or failed to start.
	 * @since 2018/11/17
	 */
	public void start()
		throws IllegalThreadStateException
	{
		synchronized (this)
		{
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
	 * @since 2018/11/20
	 */
	public static Thread currentThread()
	{
		int rid = TaskAccess.currentThread();
		
		// If the map is not initialized yet, ignore
		Map<Integer, Thread> byrealid = _BY_REALID;
		if (byrealid == null)
			return null;
		
		// Lock, it should be in the map
		synchronized (Thread.class)
		{
			return byrealid.get(rid);







|







514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
	 * @since 2018/11/20
	 */
	public static Thread currentThread()
	{
		int rid = TaskAccess.currentThread();
		
		// If the map is not initialized yet, ignore
		Map<Integer, Thread> byrealid = Thread._BY_REALID;
		if (byrealid == null)
			return null;
		
		// Lock, it should be in the map
		synchronized (Thread.class)
		{
			return byrealid.get(rid);
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
		{
			this.notifyAll();
		}
		
		// Signal anything waiting on the class itself, to indicate that
		// a thread has finished
		int startkind = this._startkind;
		if (startkind != _START_MAIN && startkind != _START_MIDLET)
			synchronized (Thread.class)
			{
				Thread.class.notifyAll();
			}
	}
	
	/**
	 * This is the starting point for all threads, including the main thread
	 * and such.
	 *
	 * @throws IllegalThreadStateException If the thread has already been
	 * started.
	 * @since 2018/11/20
	 */
	@ImplementationNote("This is the starting point of all threads.")
	final void __start()
		throws IllegalThreadStateException
	{
		// Get the kind and determine if this is a main entry point
		int startkind = this._startkind;
		boolean ismain = (startkind == _START_MAIN ||
			startkind == _START_MIDLET);
		
		// We need to lock because the real ID might just not get assigned
		// yet here.
		int realid;
		int virtid = this._virtid;
		if (!ismain)
			synchronized (this)







|




















|
|







670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
		{
			this.notifyAll();
		}
		
		// Signal anything waiting on the class itself, to indicate that
		// a thread has finished
		int startkind = this._startkind;
		if (startkind != Thread._START_MAIN && startkind != Thread._START_MIDLET)
			synchronized (Thread.class)
			{
				Thread.class.notifyAll();
			}
	}
	
	/**
	 * This is the starting point for all threads, including the main thread
	 * and such.
	 *
	 * @throws IllegalThreadStateException If the thread has already been
	 * started.
	 * @since 2018/11/20
	 */
	@ImplementationNote("This is the starting point of all threads.")
	final void __start()
		throws IllegalThreadStateException
	{
		// Get the kind and determine if this is a main entry point
		int startkind = this._startkind;
		boolean ismain = (startkind == Thread._START_MAIN ||
			startkind == Thread._START_MIDLET);
		
		// We need to lock because the real ID might just not get assigned
		// yet here.
		int realid;
		int virtid = this._virtid;
		if (!ismain)
			synchronized (this)
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
			StaticMethod runmethod = this._runmethod;
			Object runargument = this._runargument;
			
			// How do we run this thread?
			switch (this._startkind)
			{
					// Start Runnable in this instance (extended from)
				case _START_SELF_RUNNABLE:
					this.run();
					break;
					
					// Start the given runnable
				case _START_GIVEN_RUNNABLE:
					((Runnable)runargument).run();
					break;
					
					// Start MIDlet, construct then startApp()
				case _START_MIDLET:
					ObjectAccess.invokeStatic(runmethod,
						ObjectAccess.classByName((String)runargument).
						__newInstance());
					break;
					
					// Start main(String[]) method
				case _START_MAIN:
					ObjectAccess.invokeStatic(runmethod, runargument);
					break;
					
					// Unknown
				default:
					throw new todo.OOPS();
			}







|




|




|






|







737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
			StaticMethod runmethod = this._runmethod;
			Object runargument = this._runargument;
			
			// How do we run this thread?
			switch (this._startkind)
			{
					// Start Runnable in this instance (extended from)
				case Thread._START_SELF_RUNNABLE:
					this.run();
					break;
					
					// Start the given runnable
				case Thread._START_GIVEN_RUNNABLE:
					((Runnable)runargument).run();
					break;
					
					// Start MIDlet, construct then startApp()
				case Thread._START_MIDLET:
					ObjectAccess.invokeStatic(runmethod,
						ObjectAccess.classByName((String)runargument).
						__newInstance());
					break;
					
					// Start main(String[]) method
				case Thread._START_MAIN:
					ObjectAccess.invokeStatic(runmethod, runargument);
					break;
					
					// Unknown
				default:
					throw new todo.OOPS();
			}

Name change from runt/apis/cldc-compact/java/lang/Throwable.java to modules/cldc-compact/src/main/java/java/lang/Throwable.java.

8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.lang;

import cc.squirreljme.runtime.cldc.debug.CallTraceElement;
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.List;

/**
 * This class is the base class for all types which are thrown, itself being a
 * checked exception handled by the compiler.
 *
 * Each {@link Throwable} contains internal stack trace information which is
 * initialized when the {@link Throwable} is.







<
<







8
9
10
11
12
13
14


15
16
17
18
19
20
21
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.lang;

import cc.squirreljme.runtime.cldc.debug.CallTraceElement;
import java.io.PrintStream;



/**
 * This class is the base class for all types which are thrown, itself being a
 * checked exception handled by the compiler.
 *
 * Each {@link Throwable} contains internal stack trace information which is
 * initialized when the {@link Throwable} is.
282
283
284
285
286
287
288
289

290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
	/**
	 * Prints the stack trace to the standard error stream.
	 *
	 * @since 2018/09/15
	 */
	public void printStackTrace()
	{
		Throwable.__printStackTrace(this, System.err, 0, _TYPE_EXCEPTION);

	}
	
	/**
	 * Prints the stack trace to the specified stream.
	 *
	 * @param __ps The stream to print to.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/09/15
	 */
	public void printStackTrace(PrintStream __ps)
		throws NullPointerException
	{
		if (__ps == null)
			throw new NullPointerException("NARG");
		
		Throwable.__printStackTrace(this, __ps, 0, _TYPE_EXCEPTION);
	}
	
	/**
	 * Returns a string representation of this throwable.
	 *
	 * If there is a localized message, the form is `<class>: <message>`.
	 * If there is no message, the form is `<class>`. 
	 *
	 * @return A string representing this throwable.
	 * @since 2018/09/15
	 */
	@Override
	public String toString()
	{







|
>















|





|
|







280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
	/**
	 * Prints the stack trace to the standard error stream.
	 *
	 * @since 2018/09/15
	 */
	public void printStackTrace()
	{
		Throwable.__printStackTrace(this, System.err, 0,
			Throwable._TYPE_EXCEPTION);
	}
	
	/**
	 * Prints the stack trace to the specified stream.
	 *
	 * @param __ps The stream to print to.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/09/15
	 */
	public void printStackTrace(PrintStream __ps)
		throws NullPointerException
	{
		if (__ps == null)
			throw new NullPointerException("NARG");
		
		Throwable.__printStackTrace(this, __ps, 0, Throwable._TYPE_EXCEPTION);
	}
	
	/**
	 * Returns a string representation of this throwable.
	 *
	 * If there is a localized message, the form is {@code <class>: <message>}.
	 * If there is no message, the form is {@code <class>}.
	 *
	 * @return A string representing this throwable.
	 * @since 2018/09/15
	 */
	@Override
	public String toString()
	{
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
		// Resolve the stack trace so it is easier to work with
		CallTraceElement[] stack = CallTraceElement.traceResolve(rawstack);
		
		// Indent and print exception type
		Throwable.__printStackIndent(__ps, __indent);
		switch (__type)
		{
			case _TYPE_CAUSED_BY:
				__ps.print("> CAUSED BY ");
				break;
			
			case _TYPE_SUPPRESSED:
				__ps.print("> SUPPRESSED ");
				break;
			
			case _TYPE_EXCEPTION:
			default:
				__ps.print("EXCEPTION ");
				break;
		}
		
		// Then the string representation of it, which may be replaced
		__ps.println(__t.toString());







|



|



|







408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
		// Resolve the stack trace so it is easier to work with
		CallTraceElement[] stack = CallTraceElement.traceResolve(rawstack);
		
		// Indent and print exception type
		Throwable.__printStackIndent(__ps, __indent);
		switch (__type)
		{
			case Throwable._TYPE_CAUSED_BY:
				__ps.print("> CAUSED BY ");
				break;
			
			case Throwable._TYPE_SUPPRESSED:
				__ps.print("> SUPPRESSED ");
				break;
			
			case Throwable._TYPE_EXCEPTION:
			default:
				__ps.print("EXCEPTION ");
				break;
		}
		
		// Then the string representation of it, which may be replaced
		__ps.println(__t.toString());
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
			__ps.println(e.toAtLineString());
		}
		
		// Print cause of the exception
		Throwable cause = __t.getCause();
		if (cause != null)
			Throwable.__printStackTrace(cause, __ps, __indent,
				_TYPE_CAUSED_BY);
		
		// Print suppressed exceptions
		for (Throwable sup : __t.getSuppressed())
			Throwable.__printStackTrace(sup, __ps, __indent,
				_TYPE_SUPPRESSED);
	}
}








|




|



466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
			__ps.println(e.toAtLineString());
		}
		
		// Print cause of the exception
		Throwable cause = __t.getCause();
		if (cause != null)
			Throwable.__printStackTrace(cause, __ps, __indent,
				Throwable._TYPE_CAUSED_BY);
		
		// Print suppressed exceptions
		for (Throwable sup : __t.getSuppressed())
			Throwable.__printStackTrace(sup, __ps, __indent,
				Throwable._TYPE_SUPPRESSED);
	}
}

Name change from runt/apis/cldc-compact/java/lang/UnsupportedClassVersionError.java to modules/cldc-compact/src/main/java/java/lang/UnsupportedClassVersionError.java.

26
27
28
29
30
31
32

33
34
35
36
37
38
39
	public UnsupportedClassVersionError()
	{
	}
	
	/**
	 * Initializes the exception with the given message and no cause.
	 *

	 * @since 2018/12/04
	 */
	public UnsupportedClassVersionError(String __m)
	{
		super(__m);
	}
}







>







26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
	public UnsupportedClassVersionError()
	{
	}
	
	/**
	 * Initializes the exception with the given message and no cause.
	 *
	 * @param __m The message.
	 * @since 2018/12/04
	 */
	public UnsupportedClassVersionError(String __m)
	{
		super(__m);
	}
}

Name change from runt/apis/cldc-compact/java/lang/UnsupportedOperationException.java to modules/cldc-compact/src/main/java/java/lang/UnsupportedOperationException.java.

Name change from runt/apis/cldc-compact/java/lang/VirtualMachineError.java to modules/cldc-compact/src/main/java/java/lang/VirtualMachineError.java.

26
27
28
29
30
31
32

33
34
35
36
37
38
39
	public VirtualMachineError()
	{
	}
	
	/**
	 * Initializes the exception with the given message and no cause.
	 *

	 * @since 2018/12/04
	 */
	public VirtualMachineError(String __m)
	{
		super(__m);
	}
}







>







26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
	public VirtualMachineError()
	{
	}
	
	/**
	 * Initializes the exception with the given message and no cause.
	 *
	 * @param __m The message.
	 * @since 2018/12/04
	 */
	public VirtualMachineError(String __m)
	{
		super(__m);
	}
}

Name change from runt/apis/cldc-compact/java/lang/__CanSetPrintStream__.java to modules/cldc-compact/src/main/java/java/lang/__CanSetPrintStream__.java.

46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
		super(__def, true);
		
		// Check
		if (__def == null)
			throw new NullPointerException("NARG");
		
		// Set
		_target = __def;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/03/17
	 */
	@Override
	public PrintStream append(CharSequence __a)
	{
		// Lock
		synchronized (lock)
		{
			return _target.append(__a);
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/03/17
	 */
	@Override
	public PrintStream append(CharSequence __a, int __b, int __c)
	{
		// Lock
		synchronized (lock)
		{
			return _target.append(__a, __b, __c);
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/03/17
	 */
	@Override
	public PrintStream append(char __a)
	{
		// Lock
		synchronized (lock)
		{
			return _target.append(__a);
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/03/17
	 */
	@Override
	public boolean checkError()
	{
		// Lock
		synchronized (lock)
		{
			return _target.checkError();
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/03/17
	 */
	@Override
	public void close()
	{
		// Lock
		synchronized (lock)
		{
			_target.close();
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/03/17
	 */
	@Override
	public void flush()
	{
		// Lock
		synchronized (lock)
		{
			_target.flush();
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/03/17
	 */
	@Override
	public PrintStream format(String __a, Object... __b)
	{
		// Lock
		synchronized (lock)
		{
			return _target.format(__a, __b);
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/03/17
	 */
	@Override
	public void print(boolean __a)
	{
		// Lock
		synchronized (lock)
		{
			_target.print(__a);
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/03/17
	 */
	@Override
	public void print(char __a)
	{
		// Lock
		synchronized (lock)
		{
			_target.print(__a);
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/03/17
	 */
	@Override
	public void print(int __a)
	{
		// Lock
		synchronized (lock)
		{
			_target.print(__a);
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/03/17
	 */
	@Override
	public void print(long __a)
	{
		// Lock
		synchronized (lock)
		{
			_target.print(__a);
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/03/17
	 */
	@Override
	public void print(float __a)
	{
		// Lock
		synchronized (lock)
		{
			_target.print(__a);
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/03/17
	 */
	@Override
	public void print(double __a)
	{
		// Lock
		synchronized (lock)
		{
			_target.print(__a);
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/03/17
	 */
	@Override
	public void print(char[] __a)
	{
		// Lock
		synchronized (lock)
		{
			_target.print(__a);
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/03/17
	 */
	@Override
	public void print(String __a)
	{
		// Lock
		synchronized (lock)
		{
			_target.print(__a);
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/03/17
	 */
	@Override
	public void print(Object __a)
	{
		// Lock
		synchronized (lock)
		{
			_target.print(__a);
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/03/17
	 */
	@Override
	public PrintStream printf(String __a, Object... __b)
	{
		// Lock
		synchronized (lock)
		{
			return _target.printf(__a, __b);
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/03/17
	 */
	@Override
	public void println()
	{
		// Lock
		synchronized (lock)
		{
			_target.println();
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/03/17
	 */
	@Override
	public void println(boolean __a)
	{
		// Lock
		synchronized (lock)
		{
			_target.println(__a);
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/03/17
	 */
	@Override
	public void println(char __a)
	{
		// Lock
		synchronized (lock)
		{
			_target.println(__a);
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/03/17
	 */
	@Override
	public void println(int __a)
	{
		// Lock
		synchronized (lock)
		{
			_target.println(__a);
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/03/17
	 */
	@Override
	public void println(long __a)
	{
		// Lock
		synchronized (lock)
		{
			_target.println(__a);
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/03/17
	 */
	@Override
	public void println(float __a)
	{
		// Lock
		synchronized (lock)
		{
			_target.println(__a);
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/03/17
	 */
	@Override
	public void println(double __a)
	{
		// Lock
		synchronized (lock)
		{
			_target.println(__a);
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/03/17
	 */
	@Override
	public void println(char[] __a)
	{
		// Lock
		synchronized (lock)
		{
			_target.println(__a);
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/03/17
	 */
	@Override
	public void println(String __a)
	{
		// Lock
		synchronized (lock)
		{
			_target.println(__a);
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/03/17
	 */
	@Override
	public void println(Object __a)
	{
		// Lock
		synchronized (lock)
		{
			_target.println(__a);
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/03/17
	 */
	@Override
	public void write(int __a)
	{
		// Lock
		synchronized (lock)
		{
			_target.write(__a);
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/03/17
	 */
	@Override
	public void write(byte[] __a, int __b, int __c)
	{
		// Lock
		synchronized (lock)
		{
			_target.write(__a, __b, __c);
		}
	}
	
	/**
	 * Sets the new stream to target.
	 *
	 * @param __ps The stream to target.







|










|

|











|

|











|

|











|

|











|

|











|

|











|

|











|

|











|

|











|

|











|

|











|

|











|

|











|

|











|

|











|

|











|

|











|

|











|

|











|

|











|

|











|

|











|

|











|

|











|

|











|

|











|

|











|

|











|

|







46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
		super(__def, true);
		
		// Check
		if (__def == null)
			throw new NullPointerException("NARG");
		
		// Set
		this._target = __def;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/03/17
	 */
	@Override
	public PrintStream append(CharSequence __a)
	{
		// Lock
		synchronized (this.lock)
		{
			return this._target.append(__a);
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/03/17
	 */
	@Override
	public PrintStream append(CharSequence __a, int __b, int __c)
	{
		// Lock
		synchronized (this.lock)
		{
			return this._target.append(__a, __b, __c);
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/03/17
	 */
	@Override
	public PrintStream append(char __a)
	{
		// Lock
		synchronized (this.lock)
		{
			return this._target.append(__a);
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/03/17
	 */
	@Override
	public boolean checkError()
	{
		// Lock
		synchronized (this.lock)
		{
			return this._target.checkError();
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/03/17
	 */
	@Override
	public void close()
	{
		// Lock
		synchronized (this.lock)
		{
			this._target.close();
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/03/17
	 */
	@Override
	public void flush()
	{
		// Lock
		synchronized (this.lock)
		{
			this._target.flush();
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/03/17
	 */
	@Override
	public PrintStream format(String __a, Object... __b)
	{
		// Lock
		synchronized (this.lock)
		{
			return this._target.format(__a, __b);
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/03/17
	 */
	@Override
	public void print(boolean __a)
	{
		// Lock
		synchronized (this.lock)
		{
			this._target.print(__a);
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/03/17
	 */
	@Override
	public void print(char __a)
	{
		// Lock
		synchronized (this.lock)
		{
			this._target.print(__a);
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/03/17
	 */
	@Override
	public void print(int __a)
	{
		// Lock
		synchronized (this.lock)
		{
			this._target.print(__a);
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/03/17
	 */
	@Override
	public void print(long __a)
	{
		// Lock
		synchronized (this.lock)
		{
			this._target.print(__a);
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/03/17
	 */
	@Override
	public void print(float __a)
	{
		// Lock
		synchronized (this.lock)
		{
			this._target.print(__a);
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/03/17
	 */
	@Override
	public void print(double __a)
	{
		// Lock
		synchronized (this.lock)
		{
			this._target.print(__a);
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/03/17
	 */
	@Override
	public void print(char[] __a)
	{
		// Lock
		synchronized (this.lock)
		{
			this._target.print(__a);
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/03/17
	 */
	@Override
	public void print(String __a)
	{
		// Lock
		synchronized (this.lock)
		{
			this._target.print(__a);
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/03/17
	 */
	@Override
	public void print(Object __a)
	{
		// Lock
		synchronized (this.lock)
		{
			this._target.print(__a);
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/03/17
	 */
	@Override
	public PrintStream printf(String __a, Object... __b)
	{
		// Lock
		synchronized (this.lock)
		{
			return this._target.printf(__a, __b);
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/03/17
	 */
	@Override
	public void println()
	{
		// Lock
		synchronized (this.lock)
		{
			this._target.println();
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/03/17
	 */
	@Override
	public void println(boolean __a)
	{
		// Lock
		synchronized (this.lock)
		{
			this._target.println(__a);
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/03/17
	 */
	@Override
	public void println(char __a)
	{
		// Lock
		synchronized (this.lock)
		{
			this._target.println(__a);
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/03/17
	 */
	@Override
	public void println(int __a)
	{
		// Lock
		synchronized (this.lock)
		{
			this._target.println(__a);
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/03/17
	 */
	@Override
	public void println(long __a)
	{
		// Lock
		synchronized (this.lock)
		{
			this._target.println(__a);
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/03/17
	 */
	@Override
	public void println(float __a)
	{
		// Lock
		synchronized (this.lock)
		{
			this._target.println(__a);
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/03/17
	 */
	@Override
	public void println(double __a)
	{
		// Lock
		synchronized (this.lock)
		{
			this._target.println(__a);
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/03/17
	 */
	@Override
	public void println(char[] __a)
	{
		// Lock
		synchronized (this.lock)
		{
			this._target.println(__a);
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/03/17
	 */
	@Override
	public void println(String __a)
	{
		// Lock
		synchronized (this.lock)
		{
			this._target.println(__a);
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/03/17
	 */
	@Override
	public void println(Object __a)
	{
		// Lock
		synchronized (this.lock)
		{
			this._target.println(__a);
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/03/17
	 */
	@Override
	public void write(int __a)
	{
		// Lock
		synchronized (this.lock)
		{
			this._target.write(__a);
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/03/17
	 */
	@Override
	public void write(byte[] __a, int __b, int __c)
	{
		// Lock
		synchronized (this.lock)
		{
			this._target.write(__a, __b, __c);
		}
	}
	
	/**
	 * Sets the new stream to target.
	 *
	 * @param __ps The stream to target.
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
		// If this is a can set stream then we likely tried to restore the
		// old output stream, so if we ever print anything again this will
		// fail completely with infinite recursion.
		while (__ps instanceof __CanSetPrintStream__)
			__ps = ((__CanSetPrintStream__)__ps)._target;
		
		// Lock
		synchronized (lock)
		{
			// Flush the current stream so any written bytes are written to
			// the output, so that they are not lost forever. However some
			// trickery could be done which causes flush to fail.
			try
			{
				this.flush();







|







476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
		// If this is a can set stream then we likely tried to restore the
		// old output stream, so if we ever print anything again this will
		// fail completely with infinite recursion.
		while (__ps instanceof __CanSetPrintStream__)
			__ps = ((__CanSetPrintStream__)__ps)._target;
		
		// Lock
		synchronized (this.lock)
		{
			// Flush the current stream so any written bytes are written to
			// the output, so that they are not lost forever. However some
			// trickery could be done which causes flush to fail.
			try
			{
				this.flush();

Name change from runt/apis/cldc-compact/java/lang/annotation/Annotation.java to modules/cldc-compact/src/main/java/java/lang/annotation/Annotation.java.

23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
{
	/**
	 * Returns the annotation type used for this annotation.
	 *
	 * @return The annotation type.
	 * @since 2014/10/13
	 */
	public abstract Class<? extends Annotation> annotationType();
	
	/**
	 * Checks the logical equality to another annotation type, they are both
	 * considered to be equal when all of their members are equal and they are
	 * of the same type.
	 *
	 * Primitive types are checked directly except for floating point types







|







23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
{
	/**
	 * Returns the annotation type used for this annotation.
	 *
	 * @return The annotation type.
	 * @since 2014/10/13
	 */
	Class<? extends Annotation> annotationType();
	
	/**
	 * Checks the logical equality to another annotation type, they are both
	 * considered to be equal when all of their members are equal and they are
	 * of the same type.
	 *
	 * Primitive types are checked directly except for floating point types
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
	 * Two arrays are equal if {@code Arrays.equals(a, b)} evaluates to
	 * {@code true}.
	 *
	 * @param __o The other object to check against.
	 * @return {@code true} if they are logically equivalent.
	 * @since 2014/10/13
	 */
	public abstract boolean equals(Object __o);
	
	/**
	 * Calculates the hash code which is a sum of the hash codes of its members
	 * in a specifically defined pattern.
	 *
	 * The base hash code for a member is {@code (127 *
	 * ((String)memberName).hashCode()) ^ specialValue}. The variable
	 * {@code specialValue} is defined depending on the
	 * context. If it is a primitive type, then the hash code that would be
	 * returned if they were object types (their wrapper classes) is used. If
	 * an array then {@code Arrays.hashCode()} is used. Otherwise, it is the
	 * normal hashCode of the specified value.
	 *
	 * @return The hash code for this annotation.
	 * @since 2014/10/13
	 */
	public abstract int hashCode();
	
	/**
	 * Returns an implementation dependent string which represents the
	 * annotation and all of its values.
	 *
	 * @return The string representation of this annotation.
	 * @since 2014/10/13
	 */
	public abstract String toString();
}








|
















|








|


46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
	 * Two arrays are equal if {@code Arrays.equals(a, b)} evaluates to
	 * {@code true}.
	 *
	 * @param __o The other object to check against.
	 * @return {@code true} if they are logically equivalent.
	 * @since 2014/10/13
	 */
	boolean equals(Object __o);
	
	/**
	 * Calculates the hash code which is a sum of the hash codes of its members
	 * in a specifically defined pattern.
	 *
	 * The base hash code for a member is {@code (127 *
	 * ((String)memberName).hashCode()) ^ specialValue}. The variable
	 * {@code specialValue} is defined depending on the
	 * context. If it is a primitive type, then the hash code that would be
	 * returned if they were object types (their wrapper classes) is used. If
	 * an array then {@code Arrays.hashCode()} is used. Otherwise, it is the
	 * normal hashCode of the specified value.
	 *
	 * @return The hash code for this annotation.
	 * @since 2014/10/13
	 */
	int hashCode();
	
	/**
	 * Returns an implementation dependent string which represents the
	 * annotation and all of its values.
	 *
	 * @return The string representation of this annotation.
	 * @since 2014/10/13
	 */
	String toString();
}

Name change from runt/apis/cldc-compact/java/lang/annotation/Documented.java to modules/cldc-compact/src/main/java/java/lang/annotation/Documented.java.

Name change from runt/apis/cldc-compact/java/lang/annotation/ElementType.java to modules/cldc-compact/src/main/java/java/lang/annotation/ElementType.java.

Name change from runt/apis/cldc-compact/java/lang/annotation/Inherited.java to modules/cldc-compact/src/main/java/java/lang/annotation/Inherited.java.

Name change from runt/apis/cldc-compact/java/lang/annotation/Retention.java to modules/cldc-compact/src/main/java/java/lang/annotation/Retention.java.

Name change from runt/apis/cldc-compact/java/lang/annotation/RetentionPolicy.java to modules/cldc-compact/src/main/java/java/lang/annotation/RetentionPolicy.java.

Name change from runt/apis/cldc-compact/java/lang/annotation/Target.java to modules/cldc-compact/src/main/java/java/lang/annotation/Target.java.

Name change from runt/apis/cldc-compact/java/lang/ref/Reference.java to modules/cldc-compact/src/main/java/java/lang/ref/Reference.java.

36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
	 * Initializes a reference pointing to the given object and an optionally
	 * specified queue to place this reference into when garbage collection
	 * occurs.
	 *
	 * @param __r The primitive reference storage.
	 * @param __v The object to point to, may be {@code null}.
	 * @param __q When the given object is garbage collected the specified
	 * queue will be given this reference (not {@link __v} itself}, may be
	 * {@code null}
	 * @since 2018/09/23
	 */
	Reference(PrimitiveReference __r, T __v, ReferenceQueue<? super T> __q)
	{
		// Set
		this._ref = __r;







|







36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
	 * Initializes a reference pointing to the given object and an optionally
	 * specified queue to place this reference into when garbage collection
	 * occurs.
	 *
	 * @param __r The primitive reference storage.
	 * @param __v The object to point to, may be {@code null}.
	 * @param __q When the given object is garbage collected the specified
	 * queue will be given this reference (not {@code __v} itself}, may be
	 * {@code null}
	 * @since 2018/09/23
	 */
	Reference(PrimitiveReference __r, T __v, ReferenceQueue<? super T> __q)
	{
		// Set
		this._ref = __r;

Name change from runt/apis/cldc-compact/java/lang/ref/ReferenceQueue.java to modules/cldc-compact/src/main/java/java/lang/ref/ReferenceQueue.java.

22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
 */
public class ReferenceQueue<T>
{
	/** Internal queue of references. */
	private final Deque<Reference<? extends T>> _queue =
		new LinkedList<>();
	
	/**
	 * Initializes the queue.
	 *
	 * @since 2018/09/23
	 */
	public ReferenceQueue()
	{
	}
	
	/**
	 * Checks the queue and returns a reference immedietely if one is
	 * available.
	 *
	 * @return The next removed reference or {@code null} if there is none.
	 * @since 2018/09/23
	 */







<
<
<
<
<
<
<
<
<







22
23
24
25
26
27
28









29
30
31
32
33
34
35
 */
public class ReferenceQueue<T>
{
	/** Internal queue of references. */
	private final Deque<Reference<? extends T>> _queue =
		new LinkedList<>();
	









	/**
	 * Checks the queue and returns a reference immedietely if one is
	 * available.
	 *
	 * @return The next removed reference or {@code null} if there is none.
	 * @since 2018/09/23
	 */

Name change from runt/apis/cldc-compact/java/lang/ref/WeakReference.java to modules/cldc-compact/src/main/java/java/lang/ref/WeakReference.java.

36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
	/**
	 * Initializes a reference pointing to the given object and an optionally
	 * specified queue to place this reference into when garbage collection
	 * occurs.
	 *
	 * @param __v The object to point to, may be {@code null}.
	 * @param __q When the given object is garbage collected the specified
	 * queue will be given this reference (not {@link __v} itself}, may be
	 * {@code null}
	 * @since 2018/09/23
	 */
	public WeakReference(T __v, ReferenceQueue<? super T> __q)
	{
		super(ObjectAccess.newWeakReference(), __v, __q);
	}







|







36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
	/**
	 * Initializes a reference pointing to the given object and an optionally
	 * specified queue to place this reference into when garbage collection
	 * occurs.
	 *
	 * @param __v The object to point to, may be {@code null}.
	 * @param __q When the given object is garbage collected the specified
	 * queue will be given this reference (not {@code __v} itself}, may be
	 * {@code null}
	 * @since 2018/09/23
	 */
	public WeakReference(T __v, ReferenceQueue<? super T> __q)
	{
		super(ObjectAccess.newWeakReference(), __v, __q);
	}

Name change from runt/apis/cldc-compact/java/lang/ref/package-info.java to modules/cldc-compact/src/main/java/java/lang/ref/package-info.java.

Name change from runt/apis/cldc-compact/java/net/BindException.java to modules/cldc-compact/src/main/java/java/net/BindException.java.

Name change from runt/apis/cldc-compact/java/net/ConnectException.java to modules/cldc-compact/src/main/java/java/net/ConnectException.java.

Name change from runt/apis/cldc-compact/java/net/NoRouteToHostException.java to modules/cldc-compact/src/main/java/java/net/NoRouteToHostException.java.

Name change from runt/apis/cldc-compact/java/net/PortUnreachableException.java to modules/cldc-compact/src/main/java/java/net/PortUnreachableException.java.

Name change from runt/apis/cldc-compact/java/net/SocketException.java to modules/cldc-compact/src/main/java/java/net/SocketException.java.

Name change from runt/apis/cldc-compact/java/net/UnknownHostException.java to modules/cldc-compact/src/main/java/java/net/UnknownHostException.java.

Name change from runt/apis/cldc-compact/java/security/AccessControlException.java to modules/cldc-compact/src/main/java/java/security/AccessControlException.java.

23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
	private final Permission _permission;
	
	/**
	 * Initializes the exception with the given message with no permission or
	 * cause.
	 *
	 * @param __s The message.
	 * @param __p The permission.
	 * @since 2018/09/18
	 */
	public AccessControlException(String __s)
	{
		super(__s);
		
		this._permission = null;







<







23
24
25
26
27
28
29

30
31
32
33
34
35
36
	private final Permission _permission;
	
	/**
	 * Initializes the exception with the given message with no permission or
	 * cause.
	 *
	 * @param __s The message.

	 * @since 2018/09/18
	 */
	public AccessControlException(String __s)
	{
		super(__s);
		
		this._permission = null;

Name change from runt/apis/cldc-compact/java/security/AccessController.java to modules/cldc-compact/src/main/java/java/security/AccessController.java.

Name change from runt/apis/cldc-compact/java/security/BasicPermission.java to modules/cldc-compact/src/main/java/java/security/BasicPermission.java.

Name change from runt/apis/cldc-compact/java/security/Permission.java to modules/cldc-compact/src/main/java/java/security/Permission.java.

Name change from runt/apis/cldc-compact/java/security/PermissionCollection.java to modules/cldc-compact/src/main/java/java/security/PermissionCollection.java.

12
13
14
15
16
17
18
19
20
21
22
23
24
25
26

import java.util.Enumeration;

public abstract class PermissionCollection
{
	public PermissionCollection()
	{
		super();
		throw new todo.TODO();
	}
	
	public abstract void add(Permission __a);
	
	public abstract Enumeration<Permission> elements();
	







<







12
13
14
15
16
17
18

19
20
21
22
23
24
25

import java.util.Enumeration;

public abstract class PermissionCollection
{
	public PermissionCollection()
	{

		throw new todo.TODO();
	}
	
	public abstract void add(Permission __a);
	
	public abstract Enumeration<Permission> elements();
	

Name change from runt/apis/cldc-compact/java/util/AbstractCollection.java to modules/cldc-compact/src/main/java/java/util/AbstractCollection.java.

Name change from runt/apis/cldc-compact/java/util/AbstractList.java to modules/cldc-compact/src/main/java/java/util/AbstractList.java.

Name change from runt/apis/cldc-compact/java/util/AbstractMap.java to modules/cldc-compact/src/main/java/java/util/AbstractMap.java.

Name change from runt/apis/cldc-compact/java/util/AbstractSequentialList.java to modules/cldc-compact/src/main/java/java/util/AbstractSequentialList.java.

Name change from runt/apis/cldc-compact/java/util/AbstractSet.java to modules/cldc-compact/src/main/java/java/util/AbstractSet.java.

Name change from runt/apis/cldc-compact/java/util/ArrayDeque.java to modules/cldc-compact/src/main/java/java/util/ArrayDeque.java.

12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38

public class ArrayDeque<E>
	extends AbstractCollection<E>
	implements Deque<E>, Cloneable
{
	public ArrayDeque()
	{
		super();
		throw new todo.TODO();
	}
	
	public ArrayDeque(int __a)
	{
		super();
		throw new todo.TODO();
	}
	
	public ArrayDeque(Collection<? extends E> __a)
	{
		super();
		throw new todo.TODO();
	}
	
	@Override
	public boolean add(E __a)
	{
		throw new todo.TODO();







<





<





<







12
13
14
15
16
17
18

19
20
21
22
23

24
25
26
27
28

29
30
31
32
33
34
35

public class ArrayDeque<E>
	extends AbstractCollection<E>
	implements Deque<E>, Cloneable
{
	public ArrayDeque()
	{

		throw new todo.TODO();
	}
	
	public ArrayDeque(int __a)
	{

		throw new todo.TODO();
	}
	
	public ArrayDeque(Collection<? extends E> __a)
	{

		throw new todo.TODO();
	}
	
	@Override
	public boolean add(E __a)
	{
		throw new todo.TODO();

Name change from runt/apis/cldc-compact/java/util/ArrayList.java to modules/cldc-compact/src/main/java/java/util/ArrayList.java.

12
13
14
15
16
17
18
19
20
21
22
23
24
25
26

/**
 * This is a resizeable list which is backed by an array.
 *
 * This class is not thread safe, for a thread safe version see {@link Vector}.
 *
 * If a modification is detected in the iterator then
 * {@link #ConcurrentModificationException} is thrown as soon as possible.
 *
 * @param <E> The element type.
 * @see Vector
 * @since 2018/09/15
 */
public class ArrayList<E>
	extends AbstractList<E>







|







12
13
14
15
16
17
18
19
20
21
22
23
24
25
26

/**
 * This is a resizeable list which is backed by an array.
 *
 * This class is not thread safe, for a thread safe version see {@link Vector}.
 *
 * If a modification is detected in the iterator then
 * {@link ConcurrentModificationException} is thrown as soon as possible.
 *
 * @param <E> The element type.
 * @see Vector
 * @since 2018/09/15
 */
public class ArrayList<E>
	extends AbstractList<E>
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
			nextsize = size + 1;
		
		// Cannot fit in this array
		E[] source = elements;
		if (nextsize > cap)
		{
			// Grow the list by a bit
			int newcap = nextsize + _GROWTH;
			elements = (E[])new Object[newcap];
			
			// Copy old stuff over, but only up to the index as needed
			for (int i = 0; i < __i; i++)
				elements[i] = source[i];
		}
		







|







106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
			nextsize = size + 1;
		
		// Cannot fit in this array
		E[] source = elements;
		if (nextsize > cap)
		{
			// Grow the list by a bit
			int newcap = nextsize + ArrayList._GROWTH;
			elements = (E[])new Object[newcap];
			
			// Copy old stuff over, but only up to the index as needed
			for (int i = 0; i < __i; i++)
				elements[i] = source[i];
		}
		

Name change from runt/apis/cldc-compact/java/util/Arrays.java to modules/cldc-compact/src/main/java/java/util/Arrays.java.

11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package java.util;

import cc.squirreljme.runtime.cldc.asm.ObjectAccess;
import cc.squirreljme.runtime.cldc.util.ByteIntegerArray;
import cc.squirreljme.runtime.cldc.util.CharacterIntegerArray;
import cc.squirreljme.runtime.cldc.util.DoubleArrayList;
import cc.squirreljme.runtime.cldc.util.FloatArrayList;
import cc.squirreljme.runtime.cldc.util.IntegerArray;
import cc.squirreljme.runtime.cldc.util.IntegerArrays;
import cc.squirreljme.runtime.cldc.util.IntegerIntegerArray;
import cc.squirreljme.runtime.cldc.util.LongArrayList;
import cc.squirreljme.runtime.cldc.util.ShellSort;
import cc.squirreljme.runtime.cldc.util.ShortIntegerArray;

/**







<







11
12
13
14
15
16
17

18
19
20
21
22
23
24
package java.util;

import cc.squirreljme.runtime.cldc.asm.ObjectAccess;
import cc.squirreljme.runtime.cldc.util.ByteIntegerArray;
import cc.squirreljme.runtime.cldc.util.CharacterIntegerArray;
import cc.squirreljme.runtime.cldc.util.DoubleArrayList;
import cc.squirreljme.runtime.cldc.util.FloatArrayList;

import cc.squirreljme.runtime.cldc.util.IntegerArrays;
import cc.squirreljme.runtime.cldc.util.IntegerIntegerArray;
import cc.squirreljme.runtime.cldc.util.LongArrayList;
import cc.squirreljme.runtime.cldc.util.ShellSort;
import cc.squirreljme.runtime.cldc.util.ShortIntegerArray;

/**
349
350
351
352
353
354
355

356
357
358
359
360
361
362
	}
	
	/**
	 * Returns a new copy of the given array of the given length.
	 *
	 * @param __src The array to copy.
	 * @param __newlen The new length of the array.

	 * @throws NegativeArraySizeException If the new length is negative.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/11/06
	 */
	public static byte[] copyOf(byte[] __src, int __newlen)
		throws NegativeArraySizeException, NullPointerException
	{







>







348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
	}
	
	/**
	 * Returns a new copy of the given array of the given length.
	 *
	 * @param __src The array to copy.
	 * @param __newlen The new length of the array.
	 * @return The copied array.
	 * @throws NegativeArraySizeException If the new length is negative.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/11/06
	 */
	public static byte[] copyOf(byte[] __src, int __newlen)
		throws NegativeArraySizeException, NullPointerException
	{
373
374
375
376
377
378
379

380
381
382
383
384
385
386
	}
	
	/**
	 * Returns a new copy of the given array of the given length.
	 *
	 * @param __src The array to copy.
	 * @param __newlen The new length of the array.

	 * @throws NegativeArraySizeException If the new length is negative.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/11/06
	 */
	public static short[] copyOf(short[] __src, int __newlen)
		throws NegativeArraySizeException, NullPointerException
	{







>







373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
	}
	
	/**
	 * Returns a new copy of the given array of the given length.
	 *
	 * @param __src The array to copy.
	 * @param __newlen The new length of the array.
	 * @return The copied array.
	 * @throws NegativeArraySizeException If the new length is negative.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/11/06
	 */
	public static short[] copyOf(short[] __src, int __newlen)
		throws NegativeArraySizeException, NullPointerException
	{
397
398
399
400
401
402
403

404
405
406
407
408
409
410
	}
	
	/**
	 * Returns a new copy of the given array of the given length.
	 *
	 * @param __src The array to copy.
	 * @param __newlen The new length of the array.

	 * @throws NegativeArraySizeException If the new length is negative.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/11/06
	 */
	public static int[] copyOf(int[] __src, int __newlen)
		throws NegativeArraySizeException, NullPointerException
	{







>







398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
	}
	
	/**
	 * Returns a new copy of the given array of the given length.
	 *
	 * @param __src The array to copy.
	 * @param __newlen The new length of the array.
	 * @return The copied array.
	 * @throws NegativeArraySizeException If the new length is negative.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/11/06
	 */
	public static int[] copyOf(int[] __src, int __newlen)
		throws NegativeArraySizeException, NullPointerException
	{
421
422
423
424
425
426
427

428
429
430
431
432
433
434
	}
	
	/**
	 * Returns a new copy of the given array of the given length.
	 *
	 * @param __src The array to copy.
	 * @param __newlen The new length of the array.

	 * @throws NegativeArraySizeException If the new length is negative.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/11/06
	 */
	public static long[] copyOf(long[] __src, int __newlen)
		throws NegativeArraySizeException, NullPointerException
	{







>







423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
	}
	
	/**
	 * Returns a new copy of the given array of the given length.
	 *
	 * @param __src The array to copy.
	 * @param __newlen The new length of the array.
	 * @return The copied array.
	 * @throws NegativeArraySizeException If the new length is negative.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/11/06
	 */
	public static long[] copyOf(long[] __src, int __newlen)
		throws NegativeArraySizeException, NullPointerException
	{
445
446
447
448
449
450
451

452
453
454
455
456
457
458
	}
	
	/**
	 * Returns a new copy of the given array of the given length.
	 *
	 * @param __src The array to copy.
	 * @param __newlen The new length of the array.

	 * @throws NegativeArraySizeException If the new length is negative.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/11/06
	 */
	public static char[] copyOf(char[] __src, int __newlen)
		throws NegativeArraySizeException, NullPointerException
	{







>







448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
	}
	
	/**
	 * Returns a new copy of the given array of the given length.
	 *
	 * @param __src The array to copy.
	 * @param __newlen The new length of the array.
	 * @return The copied array.
	 * @throws NegativeArraySizeException If the new length is negative.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/11/06
	 */
	public static char[] copyOf(char[] __src, int __newlen)
		throws NegativeArraySizeException, NullPointerException
	{
469
470
471
472
473
474
475

476
477
478
479
480
481
482
	}
	
	/**
	 * Returns a new copy of the given array of the given length.
	 *
	 * @param __src The array to copy.
	 * @param __newlen The new length of the array.

	 * @throws NegativeArraySizeException If the new length is negative.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/11/06
	 */
	public static float[] copyOf(float[] __src, int __newlen)
		throws NegativeArraySizeException, NullPointerException
	{







>







473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
	}
	
	/**
	 * Returns a new copy of the given array of the given length.
	 *
	 * @param __src The array to copy.
	 * @param __newlen The new length of the array.
	 * @return The copied array.
	 * @throws NegativeArraySizeException If the new length is negative.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/11/06
	 */
	public static float[] copyOf(float[] __src, int __newlen)
		throws NegativeArraySizeException, NullPointerException
	{
493
494
495
496
497
498
499

500
501
502
503
504
505
506
	}
	
	/**
	 * Returns a new copy of the given array of the given length.
	 *
	 * @param __src The array to copy.
	 * @param __newlen The new length of the array.

	 * @throws NegativeArraySizeException If the new length is negative.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/11/06
	 */
	public static double[] copyOf(double[] __src, int __newlen)
		throws NegativeArraySizeException, NullPointerException
	{







>







498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
	}
	
	/**
	 * Returns a new copy of the given array of the given length.
	 *
	 * @param __src The array to copy.
	 * @param __newlen The new length of the array.
	 * @return The copied array.
	 * @throws NegativeArraySizeException If the new length is negative.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/11/06
	 */
	public static double[] copyOf(double[] __src, int __newlen)
		throws NegativeArraySizeException, NullPointerException
	{
517
518
519
520
521
522
523

524
525
526
527
528
529
530
	}
	
	/**
	 * Returns a new copy of the given array of the given length.
	 *
	 * @param __src The array to copy.
	 * @param __newlen The new length of the array.

	 * @throws NegativeArraySizeException If the new length is negative.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/11/06
	 */
	public static boolean[] copyOf(boolean[] __src, int __newlen)
		throws NegativeArraySizeException, NullPointerException
	{







>







523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
	}
	
	/**
	 * Returns a new copy of the given array of the given length.
	 *
	 * @param __src The array to copy.
	 * @param __newlen The new length of the array.
	 * @return The copied array.
	 * @throws NegativeArraySizeException If the new length is negative.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/11/06
	 */
	public static boolean[] copyOf(boolean[] __src, int __newlen)
		throws NegativeArraySizeException, NullPointerException
	{
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
	 * @since 2016/09/30
	 */
	public static void sort(short[] __a)
		throws NullPointerException
	{
		// Check
		if (__a == null)
			throw new NullPointerException("NARG");	
		
		sort(__a, 0, __a.length);
	}
	
	/**
	 * Sorts the specified array.
	 *
	 * @param __a The array to sort.
	 * @param __from The from index.







|

|







1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
	 * @since 2016/09/30
	 */
	public static void sort(short[] __a)
		throws NullPointerException
	{
		// Check
		if (__a == null)
			throw new NullPointerException("NARG");
		
		Arrays.sort(__a, 0, __a.length);
	}
	
	/**
	 * Sorts the specified array.
	 *
	 * @param __a The array to sort.
	 * @param __from The from index.
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
	 * @since 2016/09/30
	 */
	public static void sort(char[] __a)
		throws NullPointerException
	{
		// Check
		if (__a == null)
			throw new NullPointerException("NARG");	
		
		sort(__a, 0, __a.length);
	}
	
	/**
	 * Sorts the specified array.
	 *
	 * @param __a The array to sort.
	 * @param __from The source array.







|

|







1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
	 * @since 2016/09/30
	 */
	public static void sort(char[] __a)
		throws NullPointerException
	{
		// Check
		if (__a == null)
			throw new NullPointerException("NARG");
		
		Arrays.sort(__a, 0, __a.length);
	}
	
	/**
	 * Sorts the specified array.
	 *
	 * @param __a The array to sort.
	 * @param __from The source array.
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
	 * @since 2016/09/30
	 */
	public static void sort(byte[] __a)
		throws NullPointerException
	{
		// Check
		if (__a == null)
			throw new NullPointerException("NARG");	
		
		sort(__a, 0, __a.length);
	}
	
	/**
	 * Sorts the specified array.
	 *
	 * @param __a The array to sort.
	 * @param __from The from index.







|

|







1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
	 * @since 2016/09/30
	 */
	public static void sort(byte[] __a)
		throws NullPointerException
	{
		// Check
		if (__a == null)
			throw new NullPointerException("NARG");
		
		Arrays.sort(__a, 0, __a.length);
	}
	
	/**
	 * Sorts the specified array.
	 *
	 * @param __a The array to sort.
	 * @param __from The from index.
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
	 * @since 2016/09/30
	 */
	public static void sort(float[] __a)
		throws NullPointerException
	{
		// Check
		if (__a == null)
			throw new NullPointerException("NARG");	
		
		sort(__a, 0, __a.length);
	}
	
	/**
	 * Sorts the specified array.
	 *
	 * @param __a The array to sort.
	 * @param __from The from index.







|

|







1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
	 * @since 2016/09/30
	 */
	public static void sort(float[] __a)
		throws NullPointerException
	{
		// Check
		if (__a == null)
			throw new NullPointerException("NARG");
		
		Arrays.sort(__a, 0, __a.length);
	}
	
	/**
	 * Sorts the specified array.
	 *
	 * @param __a The array to sort.
	 * @param __from The from index.
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
	 * @since 2016/09/30
	 */
	public static void sort(double[] __a)
		throws NullPointerException
	{
		// Check
		if (__a == null)
			throw new NullPointerException("NARG");	
		
		sort(__a, 0, __a.length);
	}
	
	/**
	 * Sorts the specified array.
	 *
	 * @param __a The array to sort.
	 * @param __from The from index.







|

|







1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
	 * @since 2016/09/30
	 */
	public static void sort(double[] __a)
		throws NullPointerException
	{
		// Check
		if (__a == null)
			throw new NullPointerException("NARG");
		
		Arrays.sort(__a, 0, __a.length);
	}
	
	/**
	 * Sorts the specified array.
	 *
	 * @param __a The array to sort.
	 * @param __from The from index.
1330
1331
1332
1333
1334
1335
1336

1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
	{
		Arrays.<Object>sort(__a, __from, __to, null);
	}
	
	/**
	 * Sorts the specified array.
	 *

	 * @param __a The array to sort.
	 * @param __from The from index.
	 * @param __to The to index.
	 * @param __comp The comparator to use.
	 * @throws ArrayIndexOutOfBoundsException If the from or to index are
	 * outside of bounds.
	 * @throws IllegalArgumentException If the from address is greater than
	 * the to address.
	 * @throws NullPointerException If no array was specified.
	 * @since 2019/05/09







>

<
<







1337
1338
1339
1340
1341
1342
1343
1344
1345


1346
1347
1348
1349
1350
1351
1352
	{
		Arrays.<Object>sort(__a, __from, __to, null);
	}
	
	/**
	 * Sorts the specified array.
	 *
	 * @param <T> The type to sort.
	 * @param __a The array to sort.


	 * @param __comp The comparator to use.
	 * @throws ArrayIndexOutOfBoundsException If the from or to index are
	 * outside of bounds.
	 * @throws IllegalArgumentException If the from address is greater than
	 * the to address.
	 * @throws NullPointerException If no array was specified.
	 * @since 2019/05/09
1354
1355
1356
1357
1358
1359
1360

1361
1362
1363
1364
1365
1366
1367
		
		Arrays.<T>sort(__a, 0, __a.length, __comp);
	}
	
	/**
	 * Sorts the specified array.
	 *

	 * @param __a The array to sort.
	 * @param __from The from index.
	 * @param __to The to index.
	 * @param __comp The comparator to use.
	 * @throws ArrayIndexOutOfBoundsException If the from or to index are
	 * outside of bounds.
	 * @throws IllegalArgumentException If the from address is greater than







>







1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
		
		Arrays.<T>sort(__a, 0, __a.length, __comp);
	}
	
	/**
	 * Sorts the specified array.
	 *
	 * @param <T> The type to sort.
	 * @param __a The array to sort.
	 * @param __from The from index.
	 * @param __to The to index.
	 * @param __comp The comparator to use.
	 * @throws ArrayIndexOutOfBoundsException If the from or to index are
	 * outside of bounds.
	 * @throws IllegalArgumentException If the from address is greater than

Name change from runt/apis/cldc-compact/java/util/Calendar.java to modules/cldc-compact/src/main/java/java/util/Calendar.java.

144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
	
	protected boolean isTimeSet;
	
	protected long time;
	
	protected Calendar()
	{
		super();
		throw new todo.TODO();
	}
	
	public abstract void add(int __a, int __b);
	
	protected abstract void computeFields();
	







<







144
145
146
147
148
149
150

151
152
153
154
155
156
157
	
	protected boolean isTimeSet;
	
	protected long time;
	
	protected Calendar()
	{

		throw new todo.TODO();
	}
	
	public abstract void add(int __a, int __b);
	
	protected abstract void computeFields();
	

Name change from runt/apis/cldc-compact/java/util/Collection.java to modules/cldc-compact/src/main/java/java/util/Collection.java.

9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// ---------------------------------------------------------------------------

package java.util;

public interface Collection<E>
	extends Iterable<E>
{
	public abstract boolean add(E __a);
	
	public abstract boolean addAll(Collection<? extends E> __a);
	
	public abstract void clear();
	
	public abstract boolean contains(Object __a);
	
	public abstract boolean containsAll(Collection<?> __a);
	
	@Override
	public abstract boolean equals(Object __a);
	
	@Override
	public abstract int hashCode();
	
	public abstract boolean isEmpty();
	
	public abstract Iterator<E> iterator();
	
	public abstract boolean remove(Object __a);
	
	public abstract boolean removeAll(Collection<?> __a);
	
	public abstract boolean retainAll(Collection<?> __a);
	
	public abstract int size();
	
	public abstract Object[] toArray();
	
	public abstract <T> T[] toArray(T[] __v)
		throws NullPointerException;
}








|

|

|

|

|


|


|

|

|

|

|

|

|

|

|



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// ---------------------------------------------------------------------------

package java.util;

public interface Collection<E>
	extends Iterable<E>
{
	boolean add(E __a);
	
	boolean addAll(Collection<? extends E> __a);
	
	void clear();
	
	boolean contains(Object __a);
	
	boolean containsAll(Collection<?> __a);
	
	@Override
	boolean equals(Object __a);
	
	@Override
	int hashCode();
	
	boolean isEmpty();
	
	Iterator<E> iterator();
	
	boolean remove(Object __a);
	
	boolean removeAll(Collection<?> __a);
	
	boolean retainAll(Collection<?> __a);
	
	int size();
	
	Object[] toArray();
	
	<T> T[] toArray(T[] __v)
		throws NullPointerException;
}

Name change from runt/apis/cldc-compact/java/util/Collections.java to modules/cldc-compact/src/main/java/java/util/Collections.java.

12
13
14
15
16
17
18
19
20
21
22
23
24
25
26

import cc.squirreljme.runtime.cldc.util.ShellSort;

public class Collections
{
	private Collections()
	{
		super();
		throw new todo.TODO();
	}
	
	@SuppressWarnings({"unchecked"})
	public static <T> boolean addAll(Collection<? super T> __a, T... __b)
	{
		throw new todo.TODO();







<







12
13
14
15
16
17
18

19
20
21
22
23
24
25

import cc.squirreljme.runtime.cldc.util.ShellSort;

public class Collections
{
	private Collections()
	{

		throw new todo.TODO();
	}
	
	@SuppressWarnings({"unchecked"})
	public static <T> boolean addAll(Collection<? super T> __a, T... __b)
	{
		throw new todo.TODO();

Name change from runt/apis/cldc-compact/java/util/Comparator.java to modules/cldc-compact/src/main/java/java/util/Comparator.java.

8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.util;

public interface Comparator<T>
{
	public abstract int compare(T __a, T __b);
	
	/**
	 * Generally this should return {@code true} if a given comparison results
	 * in a value of {@code 0}.
	 *
	 * {@inheritDoc}
	 * @since 2016/04/12
	 */
	@Override
	public abstract boolean equals(Object __a);
}








|









|


8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.util;

public interface Comparator<T>
{
	int compare(T __a, T __b);
	
	/**
	 * Generally this should return {@code true} if a given comparison results
	 * in a value of {@code 0}.
	 *
	 * {@inheritDoc}
	 * @since 2016/04/12
	 */
	@Override
	boolean equals(Object __a);
}

Name change from runt/apis/cldc-compact/java/util/ConcurrentModificationException.java to modules/cldc-compact/src/main/java/java/util/ConcurrentModificationException.java.

Name change from runt/apis/cldc-compact/java/util/Date.java to modules/cldc-compact/src/main/java/java/util/Date.java.

Name change from runt/apis/cldc-compact/java/util/Deque.java to modules/cldc-compact/src/main/java/java/util/Deque.java.

9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
// ---------------------------------------------------------------------------

package java.util;

public interface Deque<E>
	extends Queue<E>
{
	public abstract boolean add(E __a);
	
	public abstract void addFirst(E __a);
	
	public abstract void addLast(E __a);
	
	public abstract boolean contains(Object __a);
	
	public abstract Iterator<E> descendingIterator();
	
	public abstract E element();
	
	public abstract E getFirst();
	
	public abstract E getLast();
	
	public abstract Iterator<E> iterator();
	
	public abstract boolean offer(E __a);
	
	public abstract boolean offerFirst(E __a);
	
	public abstract boolean offerLast(E __a);
	
	public abstract E peek();
	
	public abstract E peekFirst();
	
	public abstract E peekLast();
	
	public abstract E poll();
	
	public abstract E pollFirst();
	
	public abstract E pollLast();
	
	public abstract E pop();
	
	public abstract void push(E __a);
	
	public abstract E remove();
	
	public abstract boolean remove(Object __a);
	
	public abstract E removeFirst();
	
	public abstract boolean removeFirstOccurrence(Object __a);
	
	public abstract E removeLast();
	
	public abstract boolean removeLastOccurrence(Object __a);
	
	public abstract int size();
}








|

|

|

|

|

|

|

|

|

|

|

|

|

|

|

|

|

|

|

|

|

|

|

|

|

|

|


9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
// ---------------------------------------------------------------------------

package java.util;

public interface Deque<E>
	extends Queue<E>
{
	boolean add(E __a);
	
	void addFirst(E __a);
	
	void addLast(E __a);
	
	boolean contains(Object __a);
	
	Iterator<E> descendingIterator();
	
	E element();
	
	E getFirst();
	
	E getLast();
	
	Iterator<E> iterator();
	
	boolean offer(E __a);
	
	boolean offerFirst(E __a);
	
	boolean offerLast(E __a);
	
	E peek();
	
	E peekFirst();
	
	E peekLast();
	
	E poll();
	
	E pollFirst();
	
	E pollLast();
	
	E pop();
	
	void push(E __a);
	
	E remove();
	
	boolean remove(Object __a);
	
	E removeFirst();
	
	boolean removeFirstOccurrence(Object __a);
	
	E removeLast();
	
	boolean removeLastOccurrence(Object __a);
	
	int size();
}

Name change from runt/apis/cldc-compact/java/util/EmptyStackException.java to modules/cldc-compact/src/main/java/java/util/EmptyStackException.java.

Name change from runt/apis/cldc-compact/java/util/Enumeration.java to modules/cldc-compact/src/main/java/java/util/Enumeration.java.

27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
{
	/**
	 * Returns {@code true} if there are more elements in the enumeration.
	 *
	 * @return {@code true} if there are more elements available.
	 * @since 2016/04/12
	 */
	public abstract boolean hasMoreElements();
	
	/**
	 * Returns the next element in the enumeration.
	 *
	 * @return The next element.
	 * @throws NoSuchElementException If no more elements remain.
	 * @since 2016/04/12
	 */
	public abstract E nextElement()
		throws NoSuchElementException;
}








|








|



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
{
	/**
	 * Returns {@code true} if there are more elements in the enumeration.
	 *
	 * @return {@code true} if there are more elements available.
	 * @since 2016/04/12
	 */
	boolean hasMoreElements();
	
	/**
	 * Returns the next element in the enumeration.
	 *
	 * @return The next element.
	 * @throws NoSuchElementException If no more elements remain.
	 * @since 2016/04/12
	 */
	E nextElement()
		throws NoSuchElementException;
}

Name change from runt/apis/cldc-compact/java/util/EventListener.java to modules/cldc-compact/src/main/java/java/util/EventListener.java.

Name change from runt/apis/cldc-compact/java/util/EventObject.java to modules/cldc-compact/src/main/java/java/util/EventObject.java.

Name change from runt/apis/cldc-compact/java/util/Formatter.java to modules/cldc-compact/src/main/java/java/util/Formatter.java.

11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package java.util;

import cc.squirreljme.runtime.cldc.annotation.ImplementationNote;
import java.io.Closeable;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintStream;
import java.io.UnsupportedEncodingException;
import java.io.Writer;

/**
 * This class implements C-style {@code printf()} formatted for text, it is
 * inspired by the C language but it does not match it exactly and this is
 * far more strict in what it requires.
 *







<







11
12
13
14
15
16
17

18
19
20
21
22
23
24
package java.util;

import cc.squirreljme.runtime.cldc.annotation.ImplementationNote;
import java.io.Closeable;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintStream;

import java.io.Writer;

/**
 * This class implements C-style {@code printf()} formatted for text, it is
 * inspired by the C language but it does not match it exactly and this is
 * far more strict in what it requires.
 *

Name change from runt/apis/cldc-compact/java/util/HashMap.java to modules/cldc-compact/src/main/java/java/util/HashMap.java.

Name change from runt/apis/cldc-compact/java/util/HashSet.java to modules/cldc-compact/src/main/java/java/util/HashSet.java.

Name change from runt/apis/cldc-compact/java/util/Hashtable.java to modules/cldc-compact/src/main/java/java/util/Hashtable.java.

8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.util;

import cc.squirreljme.runtime.cldc.annotation.ImplementationNote;
import cc.squirreljme.runtime.cldc.util.IteratorToEnumeration;
import cc.squirreljme.runtime.cldc.util.SynchronizedEntrySet;
import cc.squirreljme.runtime.cldc.util.SynchronizedEntrySetNotNull;
import cc.squirreljme.runtime.cldc.util.SynchronizedSet;

/**
 * This is similar to {@link HashMap} except that it is thread safe and does
 * not permit null keys or values.
 *
 * @since 2019/05/05
 */







<

<







8
9
10
11
12
13
14

15

16
17
18
19
20
21
22
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.util;

import cc.squirreljme.runtime.cldc.annotation.ImplementationNote;
import cc.squirreljme.runtime.cldc.util.IteratorToEnumeration;

import cc.squirreljme.runtime.cldc.util.SynchronizedEntrySetNotNull;


/**
 * This is similar to {@link HashMap} except that it is thread safe and does
 * not permit null keys or values.
 *
 * @since 2019/05/05
 */
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
		}
	}
	
	/**
	 * Returns an enumeration over the elements.
	 *
	 * @return The enumerator over the elements.
	 * @sine 2019/05/05
	 */
	public Enumeration<V> elements()
	{
		synchronized (this)
		{
			return new IteratorToEnumeration<V>(this.values().iterator());
		}







|







175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
		}
	}
	
	/**
	 * Returns an enumeration over the elements.
	 *
	 * @return The enumerator over the elements.
	 * @since 2019/05/05
	 */
	public Enumeration<V> elements()
	{
		synchronized (this)
		{
			return new IteratorToEnumeration<V>(this.values().iterator());
		}

Name change from runt/apis/cldc-compact/java/util/Iterator.java to modules/cldc-compact/src/main/java/java/util/Iterator.java.

27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
	 * Returns {@code true} if there are more elements in the iteration
	 * sequence.
	 *
	 * @return {@code true} if more elements are available, otherwise
	 * {@code false}.
	 * @since 2016/04/12
	 */
	public abstract boolean hasNext();
	
	/**
	 * Returns the next element in the iteration or throws an exception if
	 * there are none remaining.
	 *
	 * @return The next element in the iteration.
	 * @throws NoSuchElementException If no more elements are available.
	 * @since 2016/04/12
	 */
	public abstract E next()
		throws NoSuchElementException;
	
	/**
	 * This removes the last element which was returned by {@link #next()}. If
	 * removal is supported then it may only be performed once per call to
	 * {@link #next()}.
	 *
	 * @throws IllegalStateException If the object returned by {@code #next()}
	 * was already removed or said method was never called.
	 * @throws UnsupportedOperationException If removal of elements is not
	 * supported by this iteration.
	 * @since 2016/04/12
	 */
	public abstract void remove()
		throws IllegalStateException, UnsupportedOperationException;
}







|









|













|


27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
	 * Returns {@code true} if there are more elements in the iteration
	 * sequence.
	 *
	 * @return {@code true} if more elements are available, otherwise
	 * {@code false}.
	 * @since 2016/04/12
	 */
	boolean hasNext();
	
	/**
	 * Returns the next element in the iteration or throws an exception if
	 * there are none remaining.
	 *
	 * @return The next element in the iteration.
	 * @throws NoSuchElementException If no more elements are available.
	 * @since 2016/04/12
	 */
	E next()
		throws NoSuchElementException;
	
	/**
	 * This removes the last element which was returned by {@link #next()}. If
	 * removal is supported then it may only be performed once per call to
	 * {@link #next()}.
	 *
	 * @throws IllegalStateException If the object returned by {@code #next()}
	 * was already removed or said method was never called.
	 * @throws UnsupportedOperationException If removal of elements is not
	 * supported by this iteration.
	 * @since 2016/04/12
	 */
	void remove()
		throws IllegalStateException, UnsupportedOperationException;
}

Name change from runt/apis/cldc-compact/java/util/LinkedHashMap.java to modules/cldc-compact/src/main/java/java/util/LinkedHashMap.java.

123
124
125
126
127
128
129
130

131
132
133
134
135
136
137
	 * be used for cache purposes.
	 *
	 * The default implementation returns {@code false}.
	 *
	 * If the implementation of this method modifies the map then this should
	 * always return {@code null}.
	 *
	 * @param __e The entry being 

	 * @since 2019/05/09
	 */
	protected boolean removeEldestEntry(Map.Entry<K, V> __e)
	{
		return false;
	}
}







|
>







123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
	 * be used for cache purposes.
	 *
	 * The default implementation returns {@code false}.
	 *
	 * If the implementation of this method modifies the map then this should
	 * always return {@code null}.
	 *
	 * @param __e The entry being
	 * @return If the map was modified.
	 * @since 2019/05/09
	 */
	protected boolean removeEldestEntry(Map.Entry<K, V> __e)
	{
		return false;
	}
}

Name change from runt/apis/cldc-compact/java/util/LinkedHashSet.java to modules/cldc-compact/src/main/java/java/util/LinkedHashSet.java.

23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
public class LinkedHashSet<E>
	extends HashSet<E>
	implements Set<E>, Cloneable
{
	/**
	 * Initializes the set with the given capacity and load factor.
	 *
	 * @param __cap The capacity used.
	 * @param __load The load factor used.
	 * @throws IllegalArgumentException If the capacity is negative or the
	 * load factor is not positive.
	 * @since 2018/11/01
	 */
	public LinkedHashSet(int __initcap, float __load)
		throws IllegalArgumentException
	{
		super(__initcap, __load);
	}
	
	/**
	 * Initializes the set with the given capacity and the default load factor.
	 *
	 * @param __cap The capacity used.
	 * @throws IllegalArgumentException If the capacity is negative.
	 * @since 2018/11/01
	 */
	public LinkedHashSet(int __initcap)
		throws IllegalArgumentException
	{
		super(__initcap);
	}
	
	/**
	 * Initializes the set with the default capacity and load factor.
	 *
	 * @since 2018/11/01
	 */
	public LinkedHashSet()
	{
		super();
	}
	
	/**
	 * Initializes a set which is a copy of the other set.
	 *
	 * The default load factor is used and the capacity is set to the
	 * capacity of the input set.







|














|
















<







23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61

62
63
64
65
66
67
68
public class LinkedHashSet<E>
	extends HashSet<E>
	implements Set<E>, Cloneable
{
	/**
	 * Initializes the set with the given capacity and load factor.
	 *
	 * @param __initcap The capacity used.
	 * @param __load The load factor used.
	 * @throws IllegalArgumentException If the capacity is negative or the
	 * load factor is not positive.
	 * @since 2018/11/01
	 */
	public LinkedHashSet(int __initcap, float __load)
		throws IllegalArgumentException
	{
		super(__initcap, __load);
	}
	
	/**
	 * Initializes the set with the given capacity and the default load factor.
	 *
	 * @param __initcap The capacity used.
	 * @throws IllegalArgumentException If the capacity is negative.
	 * @since 2018/11/01
	 */
	public LinkedHashSet(int __initcap)
		throws IllegalArgumentException
	{
		super(__initcap);
	}
	
	/**
	 * Initializes the set with the default capacity and load factor.
	 *
	 * @since 2018/11/01
	 */
	public LinkedHashSet()
	{

	}
	
	/**
	 * Initializes a set which is a copy of the other set.
	 *
	 * The default load factor is used and the capacity is set to the
	 * capacity of the input set.

Name change from runt/apis/cldc-compact/java/util/LinkedList.java to modules/cldc-compact/src/main/java/java/util/LinkedList.java.

193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
	/**
	 * {@inheritDoc}
	 * @since 2016/09/05
	 */
	@Override
	public boolean offer(E __v)
	{
		return offerLast(__v);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/09/05
	 */
	@Override







|







193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
	/**
	 * {@inheritDoc}
	 * @since 2016/09/05
	 */
	@Override
	public boolean offer(E __v)
	{
		return this.offerLast(__v);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/09/05
	 */
	@Override
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
	 * @since 2016/09/05
	 */
	@Override
	public E peekLast()
	{
		// Return null if the list is empty
		int sz;
		if ((sz = _size) == 0)
			return null;
		
		// Just one back from the tail
		return this._tail._prev._value;
	}
	
	/**







|







254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
	 * @since 2016/09/05
	 */
	@Override
	public E peekLast()
	{
		// Return null if the list is empty
		int sz;
		if ((sz = this._size) == 0)
			return null;
		
		// Just one back from the tail
		return this._tail._prev._value;
	}
	
	/**
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
	 * {@inheritDoc}
	 * @since 2016/09/05
	 */
	@Override
	public boolean removeFirstOccurrence(Object __a)
	{
		// Start at the start of the list and remove the first match
		Iterator<E> rover = iterator();
		while (rover.hasNext())
		{
			E v = rover.next();
			
			// If this is the same object then remove it
			if (Objects.equals(v, __a))
			{







|







364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
	 * {@inheritDoc}
	 * @since 2016/09/05
	 */
	@Override
	public boolean removeFirstOccurrence(Object __a)
	{
		// Start at the start of the list and remove the first match
		Iterator<E> rover = this.iterator();
		while (rover.hasNext())
		{
			E v = rover.next();
			
			// If this is the same object then remove it
			if (Objects.equals(v, __a))
			{
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
	 * {@inheritDoc}
	 * @since 2016/09/05
	 */
	@Override
	public boolean removeLastOccurrence(Object __a)
	{
		// Start at the end of the list and remove the first match
		ListIterator<E> rover = listIterator(_size);
		while (rover.hasPrevious())
		{
			E v = rover.previous();
			
			// If this is the same object then remove it
			if (Objects.equals(v, __a))
			{







|







407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
	 * {@inheritDoc}
	 * @since 2016/09/05
	 */
	@Override
	public boolean removeLastOccurrence(Object __a)
	{
		// Start at the end of the list and remove the first match
		ListIterator<E> rover = this.listIterator(this._size);
		while (rover.hasPrevious())
		{
			E v = rover.previous();
			
			// If this is the same object then remove it
			if (Objects.equals(v, __a))
			{

Name change from runt/apis/cldc-compact/java/util/List.java to modules/cldc-compact/src/main/java/java/util/List.java.

9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
// ---------------------------------------------------------------------------

package java.util;

public interface List<E>
	extends Collection<E>
{
	public abstract boolean add(E __a);
	
	public abstract void add(int __a, E __b);
	
	public abstract boolean addAll(Collection<? extends E> __a);
	
	public abstract boolean addAll(int __a, Collection<? extends E> __b);
	
	public abstract void clear();
	
	public abstract boolean contains(Object __a);
	
	public abstract boolean containsAll(Collection<?> __a);
	
	@Override
	public abstract boolean equals(Object __a);
	
	/**
	 * Gets the value at the specified index.
	 *
	 * @param __i The index to get.
	 * @return The value at this index.
	 * @throws IndexOutOfBoundsException If the index it out of bounds for the
	 * list.
	 * @since 2018/12/07
	 */
	public abstract E get(int __i)
		throws IndexOutOfBoundsException;
	
	@Override
	public abstract int hashCode();
	
	public abstract int indexOf(Object __a);
	
	public abstract boolean isEmpty();
	
	public abstract Iterator<E> iterator();
	
	public abstract int lastIndexOf(Object __a);
	
	public abstract ListIterator<E> listIterator();
	
	public abstract ListIterator<E> listIterator(int __a);
	
	public abstract boolean remove(Object __a);
	
	public abstract E remove(int __a);
	
	public abstract boolean removeAll(Collection<?> __a);
	
	public abstract boolean retainAll(Collection<?> __a);
	
	public abstract E set(int __a, E __b);
	
	public abstract int size();
	
	public abstract List<E> subList(int __a, int __b);
	
	public abstract Object[] toArray();
	
	public abstract <T> T[] toArray(T[] __a);
}








|

|

|

|

|

|

|


|










|



|

|

|

|

|

|

|

|

|

|

|

|

|

|

|

|


9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
// ---------------------------------------------------------------------------

package java.util;

public interface List<E>
	extends Collection<E>
{
	boolean add(E __a);
	
	void add(int __a, E __b);
	
	boolean addAll(Collection<? extends E> __a);
	
	boolean addAll(int __a, Collection<? extends E> __b);
	
	void clear();
	
	boolean contains(Object __a);
	
	boolean containsAll(Collection<?> __a);
	
	@Override
	boolean equals(Object __a);
	
	/**
	 * Gets the value at the specified index.
	 *
	 * @param __i The index to get.
	 * @return The value at this index.
	 * @throws IndexOutOfBoundsException If the index it out of bounds for the
	 * list.
	 * @since 2018/12/07
	 */
	E get(int __i)
		throws IndexOutOfBoundsException;
	
	@Override
	int hashCode();
	
	int indexOf(Object __a);
	
	boolean isEmpty();
	
	Iterator<E> iterator();
	
	int lastIndexOf(Object __a);
	
	ListIterator<E> listIterator();
	
	ListIterator<E> listIterator(int __a);
	
	boolean remove(Object __a);
	
	E remove(int __a);
	
	boolean removeAll(Collection<?> __a);
	
	boolean retainAll(Collection<?> __a);
	
	E set(int __a, E __b);
	
	int size();
	
	List<E> subList(int __a, int __b);
	
	Object[] toArray();
	
	<T> T[] toArray(T[] __a);
}

Name change from runt/apis/cldc-compact/java/util/ListIterator.java to modules/cldc-compact/src/main/java/java/util/ListIterator.java.

9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// ---------------------------------------------------------------------------

package java.util;

public interface ListIterator<E>
	extends Iterator<E>
{
	public abstract void add(E __v);
	
	/**
	 * {@inheritDoc}
	 * @since 2018/10/28
	 */
	@Override
	public abstract boolean hasNext();
	
	public abstract boolean hasPrevious();
	
	/**
	 * {@inheritDoc}
	 * @since 2018/10/28
	 */
	@Override
	public abstract E next();
	
	public abstract int nextIndex();
	
	public abstract E previous();
	
	public abstract int previousIndex();
	
	/**
	 * {@inheritDoc}
	 * @since 2018/10/28
	 */
	@Override
	public abstract void remove();
	
	public abstract void set(E __v);
}








|






|

|






|

|

|

|






|

|


9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// ---------------------------------------------------------------------------

package java.util;

public interface ListIterator<E>
	extends Iterator<E>
{
	void add(E __v);
	
	/**
	 * {@inheritDoc}
	 * @since 2018/10/28
	 */
	@Override
	boolean hasNext();
	
	boolean hasPrevious();
	
	/**
	 * {@inheritDoc}
	 * @since 2018/10/28
	 */
	@Override
	E next();
	
	int nextIndex();
	
	E previous();
	
	int previousIndex();
	
	/**
	 * {@inheritDoc}
	 * @since 2018/10/28
	 */
	@Override
	void remove();
	
	void set(E __v);
}

Name change from runt/apis/cldc-compact/java/util/Map.java to modules/cldc-compact/src/main/java/java/util/Map.java.

8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.util;

public interface Map<K, V>
{
	public abstract void clear();
	
	public abstract boolean containsKey(Object __a);
	
	public abstract boolean containsValue(Object __a);
	
	public abstract Set<Map.Entry<K, V>> entrySet();
	
	@Override
	public abstract boolean equals(Object __a);
	
	public abstract V get(Object __a);
	
	@Override
	public abstract int hashCode();
	
	public abstract boolean isEmpty();
	
	public abstract Set<K> keySet();
	
	public abstract V put(K __a, V __b);
	
	public abstract void putAll(Map<? extends K, ? extends V> __a);
	
	public abstract V remove(Object __a);
	
	public abstract int size();
	
	public abstract Collection<V> values();
	
	public static interface Entry<K, V>
	{
		@Override
		public abstract boolean equals(Object __a);
		
		public abstract K getKey();
		
		public abstract V getValue();
		
		@Override
		public abstract int hashCode();
		
		public abstract V setValue(V __a);
	}
}








|

|

|

|


|

|


|

|

|

|

|

|

|

|

|


|

|

|


|

|



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.util;

public interface Map<K, V>
{
	void clear();
	
	boolean containsKey(Object __a);
	
	boolean containsValue(Object __a);
	
	Set<Map.Entry<K, V>> entrySet();
	
	@Override
	boolean equals(Object __a);
	
	V get(Object __a);
	
	@Override
	int hashCode();
	
	boolean isEmpty();
	
	Set<K> keySet();
	
	V put(K __a, V __b);
	
	void putAll(Map<? extends K, ? extends V> __a);
	
	V remove(Object __a);
	
	int size();
	
	Collection<V> values();
	
	interface Entry<K, V>
	{
		@Override
		boolean equals(Object __a);
		
		K getKey();
		
		V getValue();
		
		@Override
		int hashCode();
		
		V setValue(V __a);
	}
}

Name change from runt/apis/cldc-compact/java/util/NoSuchElementException.java to modules/cldc-compact/src/main/java/java/util/NoSuchElementException.java.

Name change from runt/apis/cldc-compact/java/util/Objects.java to modules/cldc-compact/src/main/java/java/util/Objects.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.util;

import cc.squirreljme.runtime.cldc.annotation.ImplementationNote;

/**
 * This class provides utility methods which are usually able to handle null
 * values.
 *
 * @since 2016/04/12
 */
public final class Objects












<
<







1
2
3
4
5
6
7
8
9
10
11
12


13
14
15
16
17
18
19
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.util;



/**
 * This class provides utility methods which are usually able to handle null
 * values.
 *
 * @since 2016/04/12
 */
public final class Objects
124
125
126
127
128
129
130

131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
	/**
	 * Checks whether the given input value is not {@code null} and then
	 * returns it, otherwise this throws a {@link NullPointerException} with
	 * the given message.
	 *
	 * @param <T> The type of value to return.
	 * @param __a The value to return.

	 * @return {@code __a}.
	 * @throws NullPointerException On null arguments.
	 * @since 2016/04/12
	 */
	public static <T> T requireNonNull(T __a, String __b)
	{
		// Check
		if (__a == null)
			throw new NullPointerException((__b != null ? __b : "NARG"));
		return __a;
	}
	
	/**
	 * Converts the specified object to a string, if the input value is
	 * {@code null} then {@code "null"} is returned.
	 *







>




|



|







122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
	/**
	 * Checks whether the given input value is not {@code null} and then
	 * returns it, otherwise this throws a {@link NullPointerException} with
	 * the given message.
	 *
	 * @param <T> The type of value to return.
	 * @param __a The value to return.
	 * @param __m The exception message.
	 * @return {@code __a}.
	 * @throws NullPointerException On null arguments.
	 * @since 2016/04/12
	 */
	public static <T> T requireNonNull(T __a, String __m)
	{
		// Check
		if (__a == null)
			throw new NullPointerException((__m != null ? __m : "NARG"));
		return __a;
	}
	
	/**
	 * Converts the specified object to a string, if the input value is
	 * {@code null} then {@code "null"} is returned.
	 *

Name change from runt/apis/cldc-compact/java/util/PropertyPermission.java to modules/cldc-compact/src/main/java/java/util/PropertyPermission.java.

Name change from runt/apis/cldc-compact/java/util/Queue.java to modules/cldc-compact/src/main/java/java/util/Queue.java.

9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// ---------------------------------------------------------------------------

package java.util;

public interface Queue<E>
	extends Collection<E>
{
	public abstract boolean add(E __a);
	
	public abstract E element();
	
	public abstract boolean offer(E __a);
	
	public abstract E peek();
	
	public abstract E poll();
	
	public abstract E remove();
}








|

|

|

|

|

|


9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// ---------------------------------------------------------------------------

package java.util;

public interface Queue<E>
	extends Collection<E>
{
	boolean add(E __a);
	
	E element();
	
	boolean offer(E __a);
	
	E peek();
	
	E poll();
	
	E remove();
}

Name change from runt/apis/cldc-compact/java/util/Random.java to modules/cldc-compact/src/main/java/java/util/Random.java.

61
62
63
64
65
66
67

68
69
70
71
72
73
74
	
	/**
	 * Generates the next pseudorandom number, this method is used by every
	 * other method in this class. As such this is the only method that has
	 * to be changed if the internal algorithm is to be changed.
	 *
	 * @param __bits The number of bits to return.

	 * @since 2018/11/02
	 */
	protected int next(int __bits)
	{
		// This has to be atomic
		synchronized (this)
		{







>







61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
	
	/**
	 * Generates the next pseudorandom number, this method is used by every
	 * other method in this class. As such this is the only method that has
	 * to be changed if the internal algorithm is to be changed.
	 *
	 * @param __bits The number of bits to return.
	 * @return The produced value.
	 * @since 2018/11/02
	 */
	protected int next(int __bits)
	{
		// This has to be atomic
		synchronized (this)
		{
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
			// Otherwise generate it
			else
			{
				double v1, v2, s;
				do
				{
					// Between -1.0 and 1.0
					v1 = 2 * nextDouble() - 1;
					v2 = 2 * nextDouble() - 1;

					s = v1 * v1 + v2 * v2;
				} while (s >= 1 || s == 0);
				
				double multiplier =
					FDMLMath.sqrt(-2 * FDMLMath.log(s) / s);
				







|
|







155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
			// Otherwise generate it
			else
			{
				double v1, v2, s;
				do
				{
					// Between -1.0 and 1.0
					v1 = 2 * this.nextDouble() - 1;
					v2 = 2 * this.nextDouble() - 1;

					s = v1 * v1 + v2 * v2;
				} while (s >= 1 || s == 0);
				
				double multiplier =
					FDMLMath.sqrt(-2 * FDMLMath.log(s) / s);
				

Name change from runt/apis/cldc-compact/java/util/RandomAccess.java to modules/cldc-compact/src/main/java/java/util/RandomAccess.java.

Name change from runt/apis/cldc-compact/java/util/ServiceConfigurationError.java to modules/cldc-compact/src/main/java/java/util/ServiceConfigurationError.java.

Name change from runt/apis/cldc-compact/java/util/ServiceLoader.java to modules/cldc-compact/src/main/java/java/util/ServiceLoader.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.util;

import cc.squirreljme.runtime.cldc.asm.ResourceAccess;
import cc.squirreljme.runtime.cldc.asm.SuiteAccess;
import cc.squirreljme.runtime.cldc.io.ResourceInputStream;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.Set;
import java.util.LinkedHashSet;

/**
 * The service loader is used to lookup services which may be defined in the
 * classpath.
 *
 * Services are stored as a list of class in resources within the JAR, these
 * services lists are declared in files specifying the class name. So the












<



|
|
|
<
<







1
2
3
4
5
6
7
8
9
10
11
12

13
14
15
16
17
18


19
20
21
22
23
24
25
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.util;


import cc.squirreljme.runtime.cldc.asm.SuiteAccess;
import cc.squirreljme.runtime.cldc.io.ResourceInputStream;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;



/**
 * The service loader is used to lookup services which may be defined in the
 * classpath.
 *
 * Services are stored as a list of class in resources within the JAR, these
 * services lists are declared in files specifying the class name. So the
100
101
102
103
104
105
106

107
108
109
110
111
112
113
		// Just matches what Java SE gives
		return "java.util.ServiceLoader[" + this._search.getName() + "]";
	}
	
	/**
	 * Create a service loader for the given class.
	 *

	 * @param __cl The class to load a service for.
	 * @return The service loader for this class.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/12/06
	 */
	public static <S> ServiceLoader<S> load(Class<S> __cl)
		throws NullPointerException







>







97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
		// Just matches what Java SE gives
		return "java.util.ServiceLoader[" + this._search.getName() + "]";
	}
	
	/**
	 * Create a service loader for the given class.
	 *
	 * @param <S> The class to handle services for.
	 * @param __cl The class to load a service for.
	 * @return The service loader for this class.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/12/06
	 */
	public static <S> ServiceLoader<S> load(Class<S> __cl)
		throws NullPointerException

Name change from runt/apis/cldc-compact/java/util/Set.java to modules/cldc-compact/src/main/java/java/util/Set.java.

10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62

package java.util;

public interface Set<E>
	extends Collection<E>
{
	@Override
	public abstract boolean add(E __a);
	
	@Override
	public abstract boolean addAll(Collection<? extends E> __a);
	
	@Override
	public abstract void clear();
	
	@Override
	public abstract boolean contains(Object __a);
	
	@Override
	public abstract boolean containsAll(Collection<?> __a);
	
	@Override
	public abstract boolean equals(Object __a);
	
	@Override
	public abstract int hashCode();
	
	@Override
	public abstract boolean isEmpty();
	
	@Override
	public abstract Iterator<E> iterator();
	
	@Override
	public abstract boolean remove(Object __a);
	
	@Override
	public abstract boolean removeAll(Collection<?> __a);
	
	@Override
	public abstract boolean retainAll(Collection<?> __a);
	
	@Override
	public abstract int size();
	
	@Override
	public abstract Object[] toArray();
	
	@Override
	public abstract <T> T[] toArray(T[] __a);
}









|


|


|


|


|


|


|


|


|


|


|


|


|


|


|



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62

package java.util;

public interface Set<E>
	extends Collection<E>
{
	@Override
	boolean add(E __a);
	
	@Override
	boolean addAll(Collection<? extends E> __a);
	
	@Override
	void clear();
	
	@Override
	boolean contains(Object __a);
	
	@Override
	boolean containsAll(Collection<?> __a);
	
	@Override
	boolean equals(Object __a);
	
	@Override
	int hashCode();
	
	@Override
	boolean isEmpty();
	
	@Override
	Iterator<E> iterator();
	
	@Override
	boolean remove(Object __a);
	
	@Override
	boolean removeAll(Collection<?> __a);
	
	@Override
	boolean retainAll(Collection<?> __a);
	
	@Override
	int size();
	
	@Override
	Object[] toArray();
	
	@Override
	<T> T[] toArray(T[] __a);
}


Name change from runt/apis/cldc-compact/java/util/Stack.java to modules/cldc-compact/src/main/java/java/util/Stack.java.

Name change from runt/apis/cldc-compact/java/util/StringTokenizer.java to modules/cldc-compact/src/main/java/java/util/StringTokenizer.java.

11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package java.util;

public class StringTokenizer
	implements Enumeration<Object>
{
	public StringTokenizer(String __a, String __b, boolean __c)
	{
		super();
		throw new todo.TODO();
	}
	
	public StringTokenizer(String __a, String __b)
	{
		super();
		throw new todo.TODO();
	}
	
	public StringTokenizer(String __a)
	{
		super();
		throw new todo.TODO();
	}
	
	public int countTokens()
	{
		throw new todo.TODO();
	}







<





<





<







11
12
13
14
15
16
17

18
19
20
21
22

23
24
25
26
27

28
29
30
31
32
33
34
package java.util;

public class StringTokenizer
	implements Enumeration<Object>
{
	public StringTokenizer(String __a, String __b, boolean __c)
	{

		throw new todo.TODO();
	}
	
	public StringTokenizer(String __a, String __b)
	{

		throw new todo.TODO();
	}
	
	public StringTokenizer(String __a)
	{

		throw new todo.TODO();
	}
	
	public int countTokens()
	{
		throw new todo.TODO();
	}

Name change from runt/apis/cldc-compact/java/util/TimeZone.java to modules/cldc-compact/src/main/java/java/util/TimeZone.java.

17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
		1;
	
	public static final int SHORT =
		0;
	
	public TimeZone()
	{
		super();
		throw new todo.TODO();
	}
	
	public abstract int getOffset(int __a, int __b, int __c, int __d, int __e
		, int __f);
	
	public abstract int getRawOffset();







<







17
18
19
20
21
22
23

24
25
26
27
28
29
30
		1;
	
	public static final int SHORT =
		0;
	
	public TimeZone()
	{

		throw new todo.TODO();
	}
	
	public abstract int getOffset(int __a, int __b, int __c, int __d, int __e
		, int __f);
	
	public abstract int getRawOffset();

Name change from runt/apis/cldc-compact/java/util/Timer.java to modules/cldc-compact/src/main/java/java/util/Timer.java.

176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197

198
199
200
201
202
203
204
	
	/**
	 * Schedules a task to run multiple times starting at the given date and
	 * executing every period, the tasks are scheduled again at the start of
	 * each execution rather than the end.
	 *
	 * @param __task The task to run.
	 * @param __time The time when the task should run.
	 * @param __period The duration of time between each invocation.
	 * @throws IllegalArgumentException If the date is negative or the period
	 * is zero or negative.
	 * @throws IllegalStateException If a task was already scheduled, a task
	 * was cancelled, or this timer was cancelled.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/12/11
	 */
	public void scheduleAtFixedRate(TimerTask __task, Date __first,
		long __period)
		throws IllegalArgumentException, IllegalStateException,
			NullPointerException
	{
		this._thread.__schedule(__task, __first, true, true, __period);

	}
	
	/**
	 * Schedules a task to run once at the given time repeating for the given
	 * period, execution is scheduled from the start of execution.
	 *
	 * @param __task The task to run.







|













|
>







176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
	
	/**
	 * Schedules a task to run multiple times starting at the given date and
	 * executing every period, the tasks are scheduled again at the start of
	 * each execution rather than the end.
	 *
	 * @param __task The task to run.
	 * @param __first The time when the task should run.
	 * @param __period The duration of time between each invocation.
	 * @throws IllegalArgumentException If the date is negative or the period
	 * is zero or negative.
	 * @throws IllegalStateException If a task was already scheduled, a task
	 * was cancelled, or this timer was cancelled.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/12/11
	 */
	public void scheduleAtFixedRate(TimerTask __task, Date __first,
		long __period)
		throws IllegalArgumentException, IllegalStateException,
			NullPointerException
	{
		this._thread.__schedule(__task, __first, true, true,
			__period);
	}
	
	/**
	 * Schedules a task to run once at the given time repeating for the given
	 * period, execution is scheduled from the start of execution.
	 *
	 * @param __task The task to run.

Name change from runt/apis/cldc-compact/java/util/TimerTask.java to modules/cldc-compact/src/main/java/java/util/TimerTask.java.

Name change from runt/apis/cldc-compact/java/util/Vector.java to modules/cldc-compact/src/main/java/java/util/Vector.java.

73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
	public Vector()
	{
		this(10, 0);
	}
	
	public Vector(Collection<? extends E> __a)
	{
		super();
		throw new todo.TODO();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2019/05/14
	 */







<







73
74
75
76
77
78
79

80
81
82
83
84
85
86
	public Vector()
	{
		this(10, 0);
	}
	
	public Vector(Collection<? extends E> __a)
	{

		throw new todo.TODO();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2019/05/14
	 */
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
			// Return old
			return rv;
		}
	}
	
	/**
	 * Sets the element at the given index, note that compared to
	 * {@link #set(int, E)} the parameters are reversed.
	 *
	 * @param __v The value to set.
	 * @param __i The index to set.
	 * @throws ArrayIndexOutOfBoundsException If the index is out of bounds.
	 * @since 2019/05/14
	 */
	public void setElementAt(E __v, int __i)







|







582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
			// Return old
			return rv;
		}
	}
	
	/**
	 * Sets the element at the given index, note that compared to
	 * {@link #set(int, Object)} the parameters are reversed.
	 *
	 * @param __v The value to set.
	 * @param __i The index to set.
	 * @throws ArrayIndexOutOfBoundsException If the index is out of bounds.
	 * @since 2019/05/14
	 */
	public void setElementAt(E __v, int __i)

Name change from runt/apis/cldc-compact/java/util/WeakHashMap.java to modules/cldc-compact/src/main/java/java/util/WeakHashMap.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.util;

import java.lang.ref.Reference;
import java.lang.ref.ReferenceQueue;
import java.lang.ref.WeakReference;

public class WeakHashMap<K, V>
	extends AbstractMap<K, V>
	implements Map<K, V>
{
	/** The default capacity. */
	private static final int _DEFAULT_CAPACITY =












<

<







1
2
3
4
5
6
7
8
9
10
11
12

13

14
15
16
17
18
19
20
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.util;


import java.lang.ref.ReferenceQueue;


public class WeakHashMap<K, V>
	extends AbstractMap<K, V>
	implements Map<K, V>
{
	/** The default capacity. */
	private static final int _DEFAULT_CAPACITY =
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
		// {@squirreljme.error ZZ34 The load factor of the weak hash map is
		// not positive. (The non-positive load factor)}
		if (__load <= 0.0F)
			throw new IllegalArgumentException(String.format("ZZ34 %f",
				__load));
		
		// Setup
		_load = __load;
	}
	
	/**
	 * Initializes the weak hash map with the given initial capacity.
	 *
	 * @param __icap The initial weak hash map capacity.
	 * @throws IllegalArgumentException If the capacity is negative.
	 * @since 2016/04/19
	 */
	public WeakHashMap(int __icap)
		throws IllegalArgumentException
	{
		this(__icap, _DEFAULT_LOAD);
	}
	
	/**
	 * Initializes the weak hash map with the default initial capacity and load
	 * factor.
	 *
	 * @since 2016/04/19
	 */
	public WeakHashMap()
	{
		this(_DEFAULT_CAPACITY, _DEFAULT_LOAD);
	}
	
	/**
	 * Initializes the weak hash map with the default initial capacity and load
	 * factor and then copies the keys and values of the given map to this one.
	 *
	 * @param __a The map to source entries from.
	 * @throws NullPointerException If no map was specified.
	 * @since 2016/04/19
	 */
	public WeakHashMap(Map<? extends K, ? extends V> __a)
	{
		// {@squirreljme.error ZZ35 No map to copy data from was specified.}
		if (__a == null)
			throw new NullPointerException("ZZ35");
		
		// Setup initial map
		_load = _DEFAULT_LOAD;
		
		// Add all entries to it
		for (Map.Entry<? extends K, ? extends V> e : __a.entrySet())
			put(e.getKey(), e.getValue());
	}
	
	@Override
	public void clear()
	{
		throw new todo.TODO();
	}







|












|










|

















|



|







53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
		// {@squirreljme.error ZZ34 The load factor of the weak hash map is
		// not positive. (The non-positive load factor)}
		if (__load <= 0.0F)
			throw new IllegalArgumentException(String.format("ZZ34 %f",
				__load));
		
		// Setup
		this._load = __load;
	}
	
	/**
	 * Initializes the weak hash map with the given initial capacity.
	 *
	 * @param __icap The initial weak hash map capacity.
	 * @throws IllegalArgumentException If the capacity is negative.
	 * @since 2016/04/19
	 */
	public WeakHashMap(int __icap)
		throws IllegalArgumentException
	{
		this(__icap, WeakHashMap._DEFAULT_LOAD);
	}
	
	/**
	 * Initializes the weak hash map with the default initial capacity and load
	 * factor.
	 *
	 * @since 2016/04/19
	 */
	public WeakHashMap()
	{
		this(WeakHashMap._DEFAULT_CAPACITY, WeakHashMap._DEFAULT_LOAD);
	}
	
	/**
	 * Initializes the weak hash map with the default initial capacity and load
	 * factor and then copies the keys and values of the given map to this one.
	 *
	 * @param __a The map to source entries from.
	 * @throws NullPointerException If no map was specified.
	 * @since 2016/04/19
	 */
	public WeakHashMap(Map<? extends K, ? extends V> __a)
	{
		// {@squirreljme.error ZZ35 No map to copy data from was specified.}
		if (__a == null)
			throw new NullPointerException("ZZ35");
		
		// Setup initial map
		this._load = WeakHashMap._DEFAULT_LOAD;
		
		// Add all entries to it
		for (Map.Entry<? extends K, ? extends V> e : __a.entrySet())
			this.put(e.getKey(), e.getValue());
	}
	
	@Override
	public void clear()
	{
		throw new todo.TODO();
	}

Name change from runt/apis/cldc-compact/java/util/__AbstractListListIterator__.java to modules/cldc-compact/src/main/java/java/util/__AbstractListListIterator__.java.

Name change from runt/apis/cldc-compact/java/util/__AbstractListSubList__.java to modules/cldc-compact/src/main/java/java/util/__AbstractListSubList__.java.

Name change from runt/apis/cldc-compact/java/util/__AbstractMapKeySet__.java to modules/cldc-compact/src/main/java/java/util/__AbstractMapKeySet__.java.

Name change from runt/apis/cldc-compact/java/util/__AbstractMapValues__.java to modules/cldc-compact/src/main/java/java/util/__AbstractMapValues__.java.

Name change from runt/apis/cldc-compact/java/util/__ArraysList__.java to modules/cldc-compact/src/main/java/java/util/__ArraysList__.java.

Name change from runt/apis/cldc-compact/java/util/__BlockSort__.java to modules/cldc-compact/src/main/java/java/util/__BlockSort__.java.

Name change from runt/apis/cldc-compact/java/util/__BucketMapEntry__.java to modules/cldc-compact/src/main/java/java/util/__BucketMapEntry__.java.

Name change from runt/apis/cldc-compact/java/util/__BucketMap__.java to modules/cldc-compact/src/main/java/java/util/__BucketMap__.java.

Name change from runt/apis/cldc-compact/java/util/__DescendingIteratorViaListIterator__.java to modules/cldc-compact/src/main/java/java/util/__DescendingIteratorViaListIterator__.java.

Name change from runt/apis/cldc-compact/java/util/__Link__.java to modules/cldc-compact/src/main/java/java/util/__Link__.java.

Name change from runt/apis/cldc-compact/java/util/__LinkedListListIterator__.java to modules/cldc-compact/src/main/java/java/util/__LinkedListListIterator__.java.

Name change from runt/apis/cldc-compact/java/util/__PrintFCategory__.java to modules/cldc-compact/src/main/java/java/util/__PrintFCategory__.java.

100
101
102
103
104
105
106
107
108
109
110
	 * Is the width valid?
	 *
	 * @return If the width is valid.
	 * @since 2018/09/29
	 */
	final boolean __hasWidth()
	{
		return this != LINE_SEPARATOR;
	}
}








|



100
101
102
103
104
105
106
107
108
109
110
	 * Is the width valid?
	 *
	 * @return If the width is valid.
	 * @since 2018/09/29
	 */
	final boolean __hasWidth()
	{
		return this != __PrintFCategory__.LINE_SEPARATOR;
	}
}

Name change from runt/apis/cldc-compact/java/util/__PrintFConversion__.java to modules/cldc-compact/src/main/java/java/util/__PrintFConversion__.java.

226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
		
		// Only this category has exclusions
		if (cat == __PrintFCategory__.INTEGRAL)
			switch (__f)
			{
					// Only valid for octal and hex ints
				case ALTERNATIVE_FORM:
					return this == OCTAL_INTEGER ||
						this == HEXADECIMAL_INTEGER;
				
					// Only valid for decimal ints
				case LOCALE_GROUPING:
					return this == DECIMAL_INTEGER;
				
				default:
					break;
			}
		
		// Is valid!
		return true;







|
|



|







226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
		
		// Only this category has exclusions
		if (cat == __PrintFCategory__.INTEGRAL)
			switch (__f)
			{
					// Only valid for octal and hex ints
				case ALTERNATIVE_FORM:
					return this == __PrintFConversion__.OCTAL_INTEGER ||
						this == __PrintFConversion__.HEXADECIMAL_INTEGER;
				
					// Only valid for decimal ints
				case LOCALE_GROUPING:
					return this == __PrintFConversion__.DECIMAL_INTEGER;
				
				default:
					break;
			}
		
		// Is valid!
		return true;
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
	static final __PrintFConversion__ __decode(int __f, int __s)
	{
		// There are a ton of date formats, so just if a date is used do
		// not bother
		if (__f != 't' && __f != 'T')
			switch (__f)
			{
				case '%':	return PERCENT;
				case 'n':	return NEWLINE;
				case 'B':
				case 'b':	return BOOLEAN;
				case 'H':
				case 'h':	return HASHCODE;
				case 'S':
				case 's':	return STRING;
				case 'C':
				case 'c':	return CHARACTER;
				case 'd':	return DECIMAL_INTEGER;
				case 'o':	return OCTAL_INTEGER;
				case 'X':
				case 'x':	return HEXADECIMAL_INTEGER;
				case 'E':
				case 'e':	return SCIENTIFIC_DECIMAL_FLOAT;
				case 'f':	return NORMAL_DECIMAL_FLOAT;
				case 'G':
				case 'g':	return SCIENTIFIC_OR_NORMAL_DECIMAL_FLOAT;
				
				default:
					return null;
			}
		
		// A date format
		switch (__s)
		{
			case 'H':	return TIME_MILITARY_HOUR_TWO_DIGIT_LEADING_ZERO;
			case 'I':	return TIME_STANDARD_HOUR_TWO_DIGIT_LEADING_ZERO;
			case 'k':	return TIME_MILITARY_HOUR;
			case 'l':	return TIME_STANDARD_HOUR;
			case 'M':	return TIME_MINUTE;
			case 'S':	return TIME_SECONDS;
			case 'L':	return TIME_MILLISECONDS;
			case 'p':	return TIME_AM_PM;
			case 'z':	return TIME_ZONE_RFC822_OFFSET;
			case 'Z':	return TIME_ZONE_ABBREVIATION;
			case 's':	return TIME_UNIX_SECONDS;
			case 'Q':	return TIME_UNIX_MILLISECONDS;
			case 'h':
			case 'b':	return DATE_ABBREVIATED_MONTH_NAME;
			case 'a':	return DATE_ABBREVIATED_DAY_NAME;
			case 'C':	return DATE_CENTURY_TWO_DIGIT_LEADING_ZERO;
			case 'Y':	return DATE_YEAR_FOUR_DIGITS;
			case 'y':	return DATE_YEAR_LAST_TWO_DIGITS;
			case 'j':	return DATE_DAY_OF_YEAR;
			case 'm':	return DATE_MONTH_TWO_DIGIT_LEADING_ZERO;
			case 'd':	return DATE_DAY_TWO_DIGIT_LEADING_ZERO;
			case 'e':	return DATE_DAY;
			case 'R':	return DATE_TIME_MILITARY;
			case 'T':	return DATE_TIME_MILITARY_WITH_SECONDS;
			case 'r':	return DATE_TIME_STANDARD;
			case 'D':	return DATE_MONTH_DAY_YEAR;
			case 'F':	return DATE_ISO8601;
			case 'c':	return DATE_LONG_FORMAT;
		
			default:
				return null;
		}
	}
}








|
|

|

|

|

|
|
|

|

|
|

|








|
|
|
|
|
|
|
|
|
|
|
|

|
|
|
|
|
|
|
|
|
|
|
|
|
|
|







256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
	static final __PrintFConversion__ __decode(int __f, int __s)
	{
		// There are a ton of date formats, so just if a date is used do
		// not bother
		if (__f != 't' && __f != 'T')
			switch (__f)
			{
				case '%':	return __PrintFConversion__.PERCENT;
				case 'n':	return __PrintFConversion__.NEWLINE;
				case 'B':
				case 'b':	return __PrintFConversion__.BOOLEAN;
				case 'H':
				case 'h':	return __PrintFConversion__.HASHCODE;
				case 'S':
				case 's':	return __PrintFConversion__.STRING;
				case 'C':
				case 'c':	return __PrintFConversion__.CHARACTER;
				case 'd':	return __PrintFConversion__.DECIMAL_INTEGER;
				case 'o':	return __PrintFConversion__.OCTAL_INTEGER;
				case 'X':
				case 'x':	return __PrintFConversion__.HEXADECIMAL_INTEGER;
				case 'E':
				case 'e':	return __PrintFConversion__.SCIENTIFIC_DECIMAL_FLOAT;
				case 'f':	return __PrintFConversion__.NORMAL_DECIMAL_FLOAT;
				case 'G':
				case 'g':	return __PrintFConversion__.SCIENTIFIC_OR_NORMAL_DECIMAL_FLOAT;
				
				default:
					return null;
			}
		
		// A date format
		switch (__s)
		{
			case 'H':	return __PrintFConversion__.TIME_MILITARY_HOUR_TWO_DIGIT_LEADING_ZERO;
			case 'I':	return __PrintFConversion__.TIME_STANDARD_HOUR_TWO_DIGIT_LEADING_ZERO;
			case 'k':	return __PrintFConversion__.TIME_MILITARY_HOUR;
			case 'l':	return __PrintFConversion__.TIME_STANDARD_HOUR;
			case 'M':	return __PrintFConversion__.TIME_MINUTE;
			case 'S':	return __PrintFConversion__.TIME_SECONDS;
			case 'L':	return __PrintFConversion__.TIME_MILLISECONDS;
			case 'p':	return __PrintFConversion__.TIME_AM_PM;
			case 'z':	return __PrintFConversion__.TIME_ZONE_RFC822_OFFSET;
			case 'Z':	return __PrintFConversion__.TIME_ZONE_ABBREVIATION;
			case 's':	return __PrintFConversion__.TIME_UNIX_SECONDS;
			case 'Q':	return __PrintFConversion__.TIME_UNIX_MILLISECONDS;
			case 'h':
			case 'b':	return __PrintFConversion__.DATE_ABBREVIATED_MONTH_NAME;
			case 'a':	return __PrintFConversion__.DATE_ABBREVIATED_DAY_NAME;
			case 'C':	return __PrintFConversion__.DATE_CENTURY_TWO_DIGIT_LEADING_ZERO;
			case 'Y':	return __PrintFConversion__.DATE_YEAR_FOUR_DIGITS;
			case 'y':	return __PrintFConversion__.DATE_YEAR_LAST_TWO_DIGITS;
			case 'j':	return __PrintFConversion__.DATE_DAY_OF_YEAR;
			case 'm':	return __PrintFConversion__.DATE_MONTH_TWO_DIGIT_LEADING_ZERO;
			case 'd':	return __PrintFConversion__.DATE_DAY_TWO_DIGIT_LEADING_ZERO;
			case 'e':	return __PrintFConversion__.DATE_DAY;
			case 'R':	return __PrintFConversion__.DATE_TIME_MILITARY;
			case 'T':	return __PrintFConversion__.DATE_TIME_MILITARY_WITH_SECONDS;
			case 'r':	return __PrintFConversion__.DATE_TIME_STANDARD;
			case 'D':	return __PrintFConversion__.DATE_MONTH_DAY_YEAR;
			case 'F':	return __PrintFConversion__.DATE_ISO8601;
			case 'c':	return __PrintFConversion__.DATE_LONG_FORMAT;
		
			default:
				return null;
		}
	}
}

Name change from runt/apis/cldc-compact/java/util/__PrintFFlag__.java to modules/cldc-compact/src/main/java/java/util/__PrintFFlag__.java.

Name change from runt/apis/cldc-compact/java/util/__PrintFGlobal__.java to modules/cldc-compact/src/main/java/java/util/__PrintFGlobal__.java.

Name change from runt/apis/cldc-compact/java/util/__PrintFState__.java to modules/cldc-compact/src/main/java/java/util/__PrintFState__.java.

Name change from runt/apis/cldc-compact/java/util/__TaskSchedComparator__.java to modules/cldc-compact/src/main/java/java/util/__TaskSchedComparator__.java.

Name change from runt/apis/cldc-compact/java/util/__TimerThread__.java to modules/cldc-compact/src/main/java/java/util/__TimerThread__.java.

Name change from runt/apis/cldc-compact/todo/DEBUG.java to modules/cldc-compact/src/main/java/todo/DEBUG.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21






22
23
24
25
26
27
28
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package todo;

import java.io.PrintStream;

/**
 * This class contains static methods for debug printing messages as needed.
 *
 * @since 2018/04/09
 */
public final class DEBUG
{






	/**
	 * Not used.
	 *
	 * @since 2018/04/09
	 */
	private DEBUG()
	{












|








>
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package todo;

import cc.squirreljme.runtime.cldc.Poking;

/**
 * This class contains static methods for debug printing messages as needed.
 *
 * @since 2018/04/09
 */
public final class DEBUG
{
	static
	{
		// Poke native VM stuff to make sure it exists before we try to use it
		Poking.poke();
	}
	
	/**
	 * Not used.
	 *
	 * @since 2018/04/09
	 */
	private DEBUG()
	{

Name change from runt/apis/cldc-compact/todo/OOPS.java to modules/cldc-compact/src/main/java/todo/OOPS.java.

8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package todo;

import cc.squirreljme.jvm.Assembly;
import cc.squirreljme.jvm.SystemCallIndex;
import cc.squirreljme.runtime.cldc.debug.CallTraceElement;
import java.io.PrintStream;

/**
 * This is an error which is thrown when a condition which should not occur
 * occurs.
 *
 * @since 2018/11/25







<







8
9
10
11
12
13
14

15
16
17
18
19
20
21
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package todo;

import cc.squirreljme.jvm.Assembly;
import cc.squirreljme.jvm.SystemCallIndex;

import java.io.PrintStream;

/**
 * This is an error which is thrown when a condition which should not occur
 * occurs.
 *
 * @since 2018/11/25

Name change from runt/apis/cldc-compact/todo/TODO.java to modules/cldc-compact/src/main/java/todo/TODO.java.

8
9
10
11
12
13
14

15
16
17
18
19
20
21
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package todo;

import cc.squirreljme.jvm.Assembly;
import cc.squirreljme.jvm.SystemCallIndex;

import cc.squirreljme.runtime.cldc.debug.CallTraceElement;
import cc.squirreljme.runtime.cldc.lang.GuestDepth;
import java.io.PrintStream;

/**
 * This exception is thrown.
 *







>







8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package todo;

import cc.squirreljme.jvm.Assembly;
import cc.squirreljme.jvm.SystemCallIndex;
import cc.squirreljme.runtime.cldc.Poking;
import cc.squirreljme.runtime.cldc.debug.CallTraceElement;
import cc.squirreljme.runtime.cldc.lang.GuestDepth;
import java.io.PrintStream;

/**
 * This exception is thrown.
 *
45
46
47
48
49
50
51




52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
	/**
	 * Checks if debug messages should be printed.
	 *
	 * @since 2018/11/04
	 */
	static
	{




		boolean debug;
		try
		{
			// {@squirreljme.property cc.squirreljme.debug Set to a boolean
			// value (true or false) which specifies whether todo and debug
			// messages should be printed to the console.}
			debug = Boolean.valueOf(
				System.getProperty("cc.squirreljme.debug",
				Boolean.valueOf(_DEFAULT_DEBUG).toString()));
		}
		
		// Cannot access properties so use the default
		catch (SecurityException e)
		{
			debug = _DEFAULT_DEBUG;
		}
		
		// Squelch based on reverse debug
		_SQUELCH = !debug;
	}
	
	/**







>
>
>
>








|





|







46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
	/**
	 * Checks if debug messages should be printed.
	 *
	 * @since 2018/11/04
	 */
	static
	{
		// Poke native VM stuff to make sure it exists before we try to use it
		Poking.poke();
		
		// Debugging?
		boolean debug;
		try
		{
			// {@squirreljme.property cc.squirreljme.debug Set to a boolean
			// value (true or false) which specifies whether todo and debug
			// messages should be printed to the console.}
			debug = Boolean.valueOf(
				System.getProperty("cc.squirreljme.debug",
				Boolean.valueOf(TODO._DEFAULT_DEBUG).toString()));
		}
		
		// Cannot access properties so use the default
		catch (SecurityException e)
		{
			debug = TODO._DEFAULT_DEBUG;
		}
		
		// Squelch based on reverse debug
		_SQUELCH = !debug;
	}
	
	/**
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
	 * @param __fmt The format string.
	 * @param __args The arguments to the call.
	 * @since 2018/04/02
	 */
	static final void __note(String __pfx, String __fmt, Object... __args)
	{
		// If messages are squelched, ignore anything output
		if (_SQUELCH)
			return;
		
		// Only print if the stream is valid
		PrintStream ps = System.err;
		if (ps == null)
			return;
		







|







370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
	 * @param __fmt The format string.
	 * @param __args The arguments to the call.
	 * @since 2018/04/02
	 */
	static final void __note(String __pfx, String __fmt, Object... __args)
	{
		// If messages are squelched, ignore anything output
		if (TODO._SQUELCH)
			return;
		
		// Only print if the stream is valid
		PrintStream ps = System.err;
		if (ps == null)
			return;
		

Name change from runt/apis/cldc-compact/todo/package-info.java to modules/cldc-compact/src/main/java/todo/package-info.java.

Name change from runt/apis/cldc-compact.test/io/TestReadLineEOF.java to modules/cldc-compact/src/test/java/io/TestReadLineEOF.java.

1
2
3
4
5
6
7
8
9
10
11
12

13
14
15
16
17
18
19
20
21
22
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package io;


import java.io.ByteArrayInputStream;
import java.io.InputStreamReader;
import java.io.BufferedReader;
import net.multiphasicapps.tac.TestSupplier;

/**
 * Tests read line on EOF.
 *
 * @since 2018/12/08
 */












>


<







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

16
17
18
19
20
21
22
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package io;

import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.InputStreamReader;

import net.multiphasicapps.tac.TestSupplier;

/**
 * Tests read line on EOF.
 *
 * @since 2018/12/08
 */

Name change from runt/apis/cldc-compact.test/io/package-info.java to modules/cldc-compact/src/test/java/io/package-info.java.

Name change from runt/apis/cldc-compact.test/lang/TestArray.java to modules/cldc-compact/src/test/java/lang/TestArray.java.

Name change from runt/apis/cldc-compact.test/lang/TestArrayClone.java to modules/cldc-compact/src/test/java/lang/TestArrayClone.java.

Name change from runt/apis/cldc-compact.test/lang/TestBitCount.java to modules/cldc-compact/src/test/java/lang/TestBitCount.java.

Name change from runt/apis/cldc-compact.test/lang/TestDivideByZero.java to modules/cldc-compact/src/test/java/lang/TestDivideByZero.java.

Name change from runt/apis/cldc-compact.test/lang/TestEnumValueOf.java to modules/cldc-compact/src/test/java/lang/TestEnumValueOf.java.

Name change from runt/apis/cldc-compact.test/lang/TestExceptionCatchUp.java to modules/cldc-compact/src/test/java/lang/TestExceptionCatchUp.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14

15
16
17
18
19
20
21
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package lang;

import net.multiphasicapps.tac.TestSupplier;
import java.util.NoSuchElementException;


/**
 * Tests exceptions being caught in higher stack frames.
 *
 * @since 2018/12/06
 */
public class TestExceptionCatchUp












<

>







1
2
3
4
5
6
7
8
9
10
11
12

13
14
15
16
17
18
19
20
21
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package lang;


import java.util.NoSuchElementException;
import net.multiphasicapps.tac.TestSupplier;

/**
 * Tests exceptions being caught in higher stack frames.
 *
 * @since 2018/12/06
 */
public class TestExceptionCatchUp

Name change from runt/apis/cldc-compact.test/lang/TestHoldLock.java to modules/cldc-compact/src/test/java/lang/TestHoldLock.java.

Name change from runt/apis/cldc-compact.test/lang/TestInnerClassOnProtected.java to modules/cldc-compact/src/test/java/lang/TestInnerClassOnProtected.java.

Name change from runt/apis/cldc-compact.test/lang/TestIntegerDecode.java to modules/cldc-compact/src/test/java/lang/TestIntegerDecode.java.

Name change from runt/apis/cldc-compact.test/lang/TestIntegerParseIntOverflow.java to modules/cldc-compact/src/test/java/lang/TestIntegerParseIntOverflow.java.

Name change from runt/apis/cldc-compact.test/lang/TestIntegerParseIntOverflowMax.java to modules/cldc-compact/src/test/java/lang/TestIntegerParseIntOverflowMax.java.

Name change from runt/apis/cldc-compact.test/lang/TestInvokePrivate.java to modules/cldc-compact/src/test/java/lang/TestInvokePrivate.java.

Name change from runt/apis/cldc-compact.test/lang/TestInvokePrivateInSuper.java to modules/cldc-compact/src/test/java/lang/TestInvokePrivateInSuper.java.

Name change from runt/apis/cldc-compact.test/lang/TestInvokeSuper.java to modules/cldc-compact/src/test/java/lang/TestInvokeSuper.java.

Name change from runt/apis/cldc-compact.test/lang/TestMathLog.java to modules/cldc-compact/src/test/java/lang/TestMathLog.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14

15
16
17
18
19
20
21
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package lang;

import net.multiphasicapps.tac.TestRunnable;
import java.util.Random;


/**
 * Tests the log of a number.
 *
 * @since 2018/11/03
 */
public class TestMathLog












<

>







1
2
3
4
5
6
7
8
9
10
11
12

13
14
15
16
17
18
19
20
21
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package lang;


import java.util.Random;
import net.multiphasicapps.tac.TestRunnable;

/**
 * Tests the log of a number.
 *
 * @since 2018/11/03
 */
public class TestMathLog

Name change from runt/apis/cldc-compact.test/lang/TestMathSqrt.java to modules/cldc-compact/src/test/java/lang/TestMathSqrt.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14

15
16
17
18
19
20
21
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package lang;

import net.multiphasicapps.tac.TestRunnable;
import java.util.Random;


/**
 * Tests the square root of a number.
 *
 * @since 2018/11/03
 */
public class TestMathSqrt












<

>







1
2
3
4
5
6
7
8
9
10
11
12

13
14
15
16
17
18
19
20
21
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package lang;


import java.util.Random;
import net.multiphasicapps.tac.TestRunnable;

/**
 * Tests the square root of a number.
 *
 * @since 2018/11/03
 */
public class TestMathSqrt

Name change from runt/apis/cldc-compact.test/lang/TestMonitorNotify.java to modules/cldc-compact/src/test/java/lang/TestMonitorNotify.java.

Name change from runt/apis/cldc-compact.test/lang/TestMultiANewArray.java to modules/cldc-compact/src/test/java/lang/TestMultiANewArray.java.

Name change from runt/apis/cldc-compact.test/lang/TestNewInstance.java to modules/cldc-compact/src/test/java/lang/TestNewInstance.java.

Name change from runt/apis/cldc-compact.test/lang/TestStringIntern.java to modules/cldc-compact/src/test/java/lang/TestStringIntern.java.

Name change from runt/apis/cldc-compact.test/lang/TestStringRegionMatches.java to modules/cldc-compact/src/test/java/lang/TestStringRegionMatches.java.

Name change from runt/apis/cldc-compact.test/lang/TestStringTrim.java to modules/cldc-compact/src/test/java/lang/TestStringTrim.java.

Name change from runt/apis/cldc-compact.test/lang/TestSynchronizedMethod.java to modules/cldc-compact/src/test/java/lang/TestSynchronizedMethod.java.

Name change from runt/apis/cldc-compact.test/lang/TestThreadNew.java to modules/cldc-compact/src/test/java/lang/TestThreadNew.java.

Name change from runt/apis/cldc-compact.test/lang/TestThrowInSynchronized.java to modules/cldc-compact/src/test/java/lang/TestThrowInSynchronized.java.

Name change from runt/apis/cldc-compact.test/lang/TestTrailingZeros.java to modules/cldc-compact/src/test/java/lang/TestTrailingZeros.java.

Name change from runt/apis/cldc-compact.test/lang/TestVMIndexOutOfBounds.java to modules/cldc-compact/src/test/java/lang/TestVMIndexOutOfBounds.java.

Name change from runt/apis/cldc-compact.test/lang/TestVMInterrupt.java to modules/cldc-compact/src/test/java/lang/TestVMInterrupt.java.

Name change from runt/apis/cldc-compact.test/lang/__InvokePrivateInSuper__.java to modules/cldc-compact/src/test/java/lang/__InvokePrivateInSuper__.java.

Name change from runt/apis/cldc-compact.test/lang/__InvokeSuper__.java to modules/cldc-compact/src/test/java/lang/__InvokeSuper__.java.

Name change from runt/apis/cldc-compact.test/lang/extra/ABasicEnum.java to modules/cldc-compact/src/test/java/lang/extra/ABasicEnum.java.

Name change from runt/apis/cldc-compact.test/lang/extra/AClassEnum.java to modules/cldc-compact/src/test/java/lang/extra/AClassEnum.java.

Name change from runt/apis/cldc-compact.test/lang/extra/package-info.java to modules/cldc-compact/src/test/java/lang/extra/package-info.java.

Name change from runt/apis/cldc-compact.test/lang/package-info.java to modules/cldc-compact/src/test/java/lang/package-info.java.

Added modules/cldc-compact/src/test/java/squirreljme/TestArrayLength.java.



























































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
package squirreljme;

import cc.squirreljme.jvm.Assembly;
import net.multiphasicapps.tac.TestRunnable;

public class TestArrayLength
	extends TestRunnable
{
	/**
	 * {@inheritDoc}
	 * @since 2020/02/23
	 */
	@Override
	public final void test()
	{
		Object z = new boolean[1],
			b = new byte[2],
			s = new short[3],
			c = new char[4],
			i = new int[5],
			j = new long[6],
			f = new float[7],
			d = new double[8],
			l = new Object[9],
			o = new Object();
		
		// As pointers
		this.secondary("zp",
			Assembly.arrayLength(Assembly.objectToPointer(z)));
		this.secondary("bp",
			Assembly.arrayLength(Assembly.objectToPointer(b)));
		this.secondary("sp",
			Assembly.arrayLength(Assembly.objectToPointer(s)));
		this.secondary("cp",
			Assembly.arrayLength(Assembly.objectToPointer(c)));
		this.secondary("ip",
			Assembly.arrayLength(Assembly.objectToPointer(i)));
		this.secondary("jp",
			Assembly.arrayLength(Assembly.objectToPointer(j)));
		this.secondary("fp",
			Assembly.arrayLength(Assembly.objectToPointer(f)));
		this.secondary("dp",
			Assembly.arrayLength(Assembly.objectToPointer(d)));
		this.secondary("lp",
			Assembly.arrayLength(Assembly.objectToPointer(l)));
		this.secondary("op",
			Assembly.arrayLength(Assembly.objectToPointer(o)));
		
		// As objects
		this.secondary("z", Assembly.arrayLength(z));
		this.secondary("b", Assembly.arrayLength(b));
		this.secondary("s", Assembly.arrayLength(s));
		this.secondary("c", Assembly.arrayLength(c));
		this.secondary("i", Assembly.arrayLength(i));
		this.secondary("j", Assembly.arrayLength(j));
		this.secondary("f", Assembly.arrayLength(f));
		this.secondary("d", Assembly.arrayLength(d));
		this.secondary("l", Assembly.arrayLength(l));
		this.secondary("o", Assembly.arrayLength(o));
	}
}

Added modules/cldc-compact/src/test/java/squirreljme/TestErrorGetSet.java.















































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package squirreljme;

import cc.squirreljme.jvm.Assembly;
import cc.squirreljme.jvm.SystemCallIndex;
import net.multiphasicapps.tac.TestRunnable;

/**
 * Tests that error getting and setting works properly.
 *
 * @since 2020/02/26
 */
public class TestErrorGetSet
	extends TestRunnable
{
	/** The error code to use. */
	private static final int _ERROR_CODE =
		12;
	
	/**
	 * {@inheritDoc}
	 * @since 2020/02/26
	 */
	@Override
	public void test() throws Throwable
	{
		int orig = Assembly.sysCallV(SystemCallIndex.ERROR_GET,
			SystemCallIndex.GARBAGE_COLLECT);
		
		int fset = Assembly.sysCallV(SystemCallIndex.ERROR_SET,
			SystemCallIndex.GARBAGE_COLLECT, _ERROR_CODE);
		
		this.secondary("sameasorig", (orig == fset));
		
		int fnow = Assembly.sysCallV(SystemCallIndex.ERROR_GET,
			SystemCallIndex.GARBAGE_COLLECT);
		
		this.secondary("isset", (fnow == _ERROR_CODE));
	}
}

Name change from runt/apis/cldc-compact.test/squirreljme/TestPointerAccess.java to modules/cldc-compact/src/test/java/squirreljme/TestPointerAccess.java.

27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
	@Override
	public void test()
	{
		// Create a new object which we will get a pointer of
		Object object = new Object();
		
		// This object cannot be null
		int pointer = Assembly.objectToPointer(object);
		this.secondary("otpnotnull", pointer != 0); 
		
		// Reversing this operation should return the original object
		Object from = Assembly.pointerToObject(pointer);
		this.secondary("sameobject", object == from);
		
		// The zero pointer must be null
		Object ozero = Assembly.pointerToObject(0);
		this.secondary("zeroisnull", ozero == null);
		
		// The null object must be zero
		int pnull = Assembly.objectToPointer(null);
		this.secondary("nulliszero", pnull == 0);
	}
}








|











|
|



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
	@Override
	public void test()
	{
		// Create a new object which we will get a pointer of
		Object object = new Object();
		
		// This object cannot be null
		long pointer = Assembly.objectToPointer(object);
		this.secondary("otpnotnull", pointer != 0); 
		
		// Reversing this operation should return the original object
		Object from = Assembly.pointerToObject(pointer);
		this.secondary("sameobject", object == from);
		
		// The zero pointer must be null
		Object ozero = Assembly.pointerToObject(0);
		this.secondary("zeroisnull", ozero == null);
		
		// The null object must be zero
		long pnull = Assembly.objectToPointer(null);
		this.secondary("nulliszero", pnull == 0L);
	}
}

Name change from runt/apis/cldc-compact.test/squirreljme/TestSystemTime.java to modules/cldc-compact/src/test/java/squirreljme/TestSystemTime.java.

Name change from runt/apis/cldc-compact.test/squirreljme/package-info.java to modules/cldc-compact/src/test/java/squirreljme/package-info.java.

Name change from runt/apis/cldc-compact.test/util/TestArrayBinarySearch.java to modules/cldc-compact/src/test/java/util/TestArrayBinarySearch.java.

Name change from runt/apis/cldc-compact.test/util/TestArrayDequeDeque.java to modules/cldc-compact/src/test/java/util/TestArrayDequeDeque.java.

23
24
25
26
27
28
29
30
31
32
	/**
	 * Initializes the test.
	 *
	 * @since 2019/01/20
	 */
	public TestArrayDequeDeque()
	{
		super(new ArrayDeque<Number>());
	}
}







|


23
24
25
26
27
28
29
30
31
32
	/**
	 * Initializes the test.
	 *
	 * @since 2019/01/20
	 */
	public TestArrayDequeDeque()
	{
		super(new ArrayDeque<Number>(), false);
	}
}

Name change from runt/apis/cldc-compact.test/util/TestArrayList.java to modules/cldc-compact/src/test/java/util/TestArrayList.java.

Name change from runt/apis/cldc-compact.test/util/TestHashMap.java to modules/cldc-compact/src/test/java/util/TestHashMap.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16

17
18
19
20
21
22
23
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package util;

import net.multiphasicapps.tac.TestRunnable;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;


/**
 * Tests that {@link HashMap} works properly.
 *
 * @since 2018/10/07
 */
public class TestHashMap












<



>







1
2
3
4
5
6
7
8
9
10
11
12

13
14
15
16
17
18
19
20
21
22
23
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package util;


import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import net.multiphasicapps.tac.TestRunnable;

/**
 * Tests that {@link HashMap} works properly.
 *
 * @since 2018/10/07
 */
public class TestHashMap

Name change from runt/apis/cldc-compact.test/util/TestHashMapNaN.java to modules/cldc-compact/src/test/java/util/TestHashMapNaN.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14

15
16
17
18
19
20
21
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package util;

import net.multiphasicapps.tac.TestSupplier;
import java.util.HashMap;


/**
 * {@link HashMap}s can contain NaN.
 *
 * @since 2018/10/10
 */
public class TestHashMapNaN












<

>







1
2
3
4
5
6
7
8
9
10
11
12

13
14
15
16
17
18
19
20
21
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package util;


import java.util.HashMap;
import net.multiphasicapps.tac.TestSupplier;

/**
 * {@link HashMap}s can contain NaN.
 *
 * @since 2018/10/10
 */
public class TestHashMapNaN

Name change from runt/apis/cldc-compact.test/util/TestHashtable.java to modules/cldc-compact/src/test/java/util/TestHashtable.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package util;

import net.multiphasicapps.tac.TestRunnable;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.Map;

/**
 * This is a test for {@link Hashtable}.
 *
 * @since 2019/05/05
 */











<

<







1
2
3
4
5
6
7
8
9
10
11

12

13
14
15
16
17
18
19
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package util;


import java.util.Hashtable;

import java.util.Map;

/**
 * This is a test for {@link Hashtable}.
 *
 * @since 2019/05/05
 */

Name change from runt/apis/cldc-compact.test/util/TestLinkedHashMap.java to modules/cldc-compact/src/test/java/util/TestLinkedHashMap.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16

17
18
19
20
21
22
23
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package util;

import net.multiphasicapps.tac.TestRunnable;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Map;


/**
 * This is used to test that LinkedHashMap works.
 *
 * @since 2019/05/11
 */
public class TestLinkedHashMap











<
<



>







1
2
3
4
5
6
7
8
9
10
11


12
13
14
15
16
17
18
19
20
21
22
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package util;



import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Map;
import net.multiphasicapps.tac.TestRunnable;

/**
 * This is used to test that LinkedHashMap works.
 *
 * @since 2019/05/11
 */
public class TestLinkedHashMap

Name change from runt/apis/cldc-compact.test/util/TestLinkedHashMapEldest.java to modules/cldc-compact/src/test/java/util/TestLinkedHashMapEldest.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14

15
16
17
18
19
20
21
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package util;

import net.multiphasicapps.tac.TestRunnable;
import java.util.LinkedHashMap;
import java.util.Map;


/**
 * Tests to ensure that the eldest entry removal works correctly.
 *
 * @since 2019/05/09
 */
public class TestLinkedHashMapEldest











<


>







1
2
3
4
5
6
7
8
9
10
11

12
13
14
15
16
17
18
19
20
21
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package util;


import java.util.LinkedHashMap;
import java.util.Map;
import net.multiphasicapps.tac.TestRunnable;

/**
 * Tests to ensure that the eldest entry removal works correctly.
 *
 * @since 2019/05/09
 */
public class TestLinkedHashMapEldest

Name change from runt/apis/cldc-compact.test/util/TestLinkedHashSet.java to modules/cldc-compact/src/test/java/util/TestLinkedHashSet.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16

17
18
19
20
21
22
23
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package util;

import net.multiphasicapps.tac.TestSupplier;
import java.util.LinkedHashSet;
import java.util.Random;
import java.util.Set;


/**
 * This tests that linked hash set works properly.
 *
 * @since 2018/11/02
 */
public class TestLinkedHashSet












<



>







1
2
3
4
5
6
7
8
9
10
11
12

13
14
15
16
17
18
19
20
21
22
23
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package util;


import java.util.LinkedHashSet;
import java.util.Random;
import java.util.Set;
import net.multiphasicapps.tac.TestSupplier;

/**
 * This tests that linked hash set works properly.
 *
 * @since 2018/11/02
 */
public class TestLinkedHashSet

Name change from runt/apis/cldc-compact.test/util/TestLinkedList.java to modules/cldc-compact/src/test/java/util/TestLinkedList.java.

Name change from runt/apis/cldc-compact.test/util/TestLinkedListDeque.java to modules/cldc-compact/src/test/java/util/TestLinkedListDeque.java.

23
24
25
26
27
28
29
30
31
32
33
	/**
	 * Initializes the test.
	 *
	 * @since 2019/01/20
	 */
	public TestLinkedListDeque()
	{
		super(new LinkedList<Number>());
	}
}








|



23
24
25
26
27
28
29
30
31
32
33
	/**
	 * Initializes the test.
	 *
	 * @since 2019/01/20
	 */
	public TestLinkedListDeque()
	{
		super(new LinkedList<Number>(), true);
	}
}

Name change from runt/apis/cldc-compact.test/util/TestRandom.java to modules/cldc-compact/src/test/java/util/TestRandom.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14

15
16
17
18
19
20
21
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package util;

import net.multiphasicapps.tac.TestRunnable;
import java.util.Random;


/**
 * Tests the random number generator, integer values only.
 *
 * @since 2018/11/02
 */
public class TestRandom












<

>







1
2
3
4
5
6
7
8
9
10
11
12

13
14
15
16
17
18
19
20
21
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package util;


import java.util.Random;
import net.multiphasicapps.tac.TestRunnable;

/**
 * Tests the random number generator, integer values only.
 *
 * @since 2018/11/02
 */
public class TestRandom

Name change from runt/apis/cldc-compact.test/util/TestRandomFloat.java to modules/cldc-compact/src/test/java/util/TestRandomFloat.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14

15
16
17
18
19
20
21
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package util;

import net.multiphasicapps.tac.TestRunnable;
import java.util.Random;


/**
 * Test random number generator, floating point values only.
 *
 * @since 2018/11/02
 */
public class TestRandomFloat












<

>







1
2
3
4
5
6
7
8
9
10
11
12

13
14
15
16
17
18
19
20
21
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package util;


import java.util.Random;
import net.multiphasicapps.tac.TestRunnable;

/**
 * Test random number generator, floating point values only.
 *
 * @since 2018/11/02
 */
public class TestRandomFloat

Name change from runt/apis/cldc-compact.test/util/TestServiceLoader.java to modules/cldc-compact/src/test/java/util/TestServiceLoader.java.

Name change from runt/apis/cldc-compact.test/util/TestSorting.java to modules/cldc-compact/src/test/java/util/TestSorting.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package util;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import java.util.Random;
import net.multiphasicapps.tac.TestRunnable;

/**













<







1
2
3
4
5
6
7
8
9
10
11
12
13

14
15
16
17
18
19
20
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package util;

import java.util.ArrayList;
import java.util.Arrays;

import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import java.util.Random;
import net.multiphasicapps.tac.TestRunnable;

/**

Name change from runt/apis/cldc-compact.test/util/TestStackAsList.java to modules/cldc-compact/src/test/java/util/TestStackAsList.java.

Name change from runt/apis/cldc-compact.test/util/TestVector.java to modules/cldc-compact/src/test/java/util/TestVector.java.

Name change from runt/apis/cldc-compact.test/util/__TestDeque__.java to modules/cldc-compact/src/test/java/util/__TestDeque__.java.

21
22
23
24
25
26
27



28
29
30
31
32
33
34
35
36

37
38
39
40
41
42
43
 */
abstract class __TestDeque__
	extends TestRunnable
{
	/** The deque to test. */
	protected final Deque<Number> deque;
	



	/**
	 * Initializes the base test.
	 *
	 * @param __d The deque to test on.
	 * @since 2019/01/20
	 */
	public __TestDeque__(Deque<Number> __d)
	{
		this.deque = __d;

	}
	
	/**
	 * {@inheritDoc}
	 * @since 2019/01/20
	 */
	@Override







>
>
>






|


>







21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
 */
abstract class __TestDeque__
	extends TestRunnable
{
	/** The deque to test. */
	protected final Deque<Number> deque;
	
	/** Can we hash code? */
	private final boolean _canHashCode;
	
	/**
	 * Initializes the base test.
	 *
	 * @param __d The deque to test on.
	 * @since 2019/01/20
	 */
	public __TestDeque__(Deque<Number> __d, boolean __canHash)
	{
		this.deque = __d;
		this._canHashCode = __canHash;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2019/01/20
	 */
	@Override
80
81
82
83
84
85
86
87

88
89
90
91
92
93
94
95
		
		// And descend it
		it = q.descendingIterator();
		for (int i = 0; it.hasNext(); i++)
			ita[i] = it.next().intValue();
		this.secondary("iterator-descending", ita);
		
		// Hashcode

		this.secondary("hashcode", q.hashCode());
		
		// As array form
		this.secondary("array", q.<Integer>toArray(new Integer[q.size()]));
		this.secondary("arraygrow",
			q.<Integer>toArray(new Integer[q.size() / 2]));
		this.secondary("arrayover",
			q.<Integer>toArray(new Integer[q.size() + 17]));







|
>
|







84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
		
		// And descend it
		it = q.descendingIterator();
		for (int i = 0; it.hasNext(); i++)
			ita[i] = it.next().intValue();
		this.secondary("iterator-descending", ita);
		
		// Hashcode, but not all collections have a valid hashcode
		if (this._canHashCode)
			this.secondary("hashcode", q.hashCode());
		
		// As array form
		this.secondary("array", q.<Integer>toArray(new Integer[q.size()]));
		this.secondary("arraygrow",
			q.<Integer>toArray(new Integer[q.size() / 2]));
		this.secondary("arrayover",
			q.<Integer>toArray(new Integer[q.size() + 17]));

Name change from runt/apis/cldc-compact.test/util/__TestList__.java to modules/cldc-compact/src/test/java/util/__TestList__.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package util;

import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
import java.util.Objects;
import net.multiphasicapps.tac.TestRunnable;

/**
 * This tests that lists work correctly and do all the things they should do.











<







1
2
3
4
5
6
7
8
9
10
11

12
13
14
15
16
17
18
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package util;


import java.util.List;
import java.util.ListIterator;
import java.util.Objects;
import net.multiphasicapps.tac.TestRunnable;

/**
 * This tests that lists work correctly and do all the things they should do.

Name change from runt/apis/cldc-compact.test/util/serviceloader/ServiceThingy.java to modules/cldc-compact/src/test/java/util/serviceloader/ServiceThingy.java.

Name change from runt/apis/cldc-compact.test/util/serviceloader/impls/ComfortableDrey.java to modules/cldc-compact/src/test/java/util/serviceloader/impls/ComfortableDrey.java.

Name change from runt/apis/cldc-compact.test/util/serviceloader/impls/CuteSquirrels.java to modules/cldc-compact/src/test/java/util/serviceloader/impls/CuteSquirrels.java.

Name change from runt/apis/cldc-compact.test/util/serviceloader/impls/StashTheAcorns.java to modules/cldc-compact/src/test/java/util/serviceloader/impls/StashTheAcorns.java.

Name change from runt/apis/cldc-compact.test/util/serviceloader/impls/package-info.java to modules/cldc-compact/src/test/java/util/serviceloader/impls/package-info.java.

Name change from runt/apis/cldc-compact.test/util/serviceloader/package-info.java to modules/cldc-compact/src/test/java/util/serviceloader/package-info.java.

Name change from runt/apis/cldc-compact.test/META-INF/services/util.serviceloader.ServiceThingy to modules/cldc-compact/src/test/resources/META-INF/services/util.serviceloader.ServiceThingy.

Name change from runt/apis/cldc-compact.test/io/TestReadLineEOF.in to modules/cldc-compact/src/test/resources/io/TestReadLineEOF.in.

Name change from runt/apis/cldc-compact.test/lang/TestArray.in to modules/cldc-compact/src/test/resources/lang/TestArray.in.

Name change from runt/apis/cldc-compact.test/lang/TestArrayClone.in to modules/cldc-compact/src/test/resources/lang/TestArrayClone.in.

Name change from runt/apis/cldc-compact.test/lang/TestBitCount.in to modules/cldc-compact/src/test/resources/lang/TestBitCount.in.

Name change from runt/apis/cldc-compact.test/lang/TestDivideByZero.in to modules/cldc-compact/src/test/resources/lang/TestDivideByZero.in.

Name change from runt/apis/cldc-compact.test/lang/TestEnumValueOf.in to modules/cldc-compact/src/test/resources/lang/TestEnumValueOf.in.

Name change from runt/apis/cldc-compact.test/lang/TestExceptionCatchUp.in to modules/cldc-compact/src/test/resources/lang/TestExceptionCatchUp.in.

Name change from runt/apis/cldc-compact.test/lang/TestHoldLock.in to modules/cldc-compact/src/test/resources/lang/TestHoldLock.in.

Name change from runt/apis/cldc-compact.test/lang/TestInnerClassOnProtected.in to modules/cldc-compact/src/test/resources/lang/TestInnerClassOnProtected.in.

Name change from runt/apis/cldc-compact.test/lang/TestIntegerDecode.in to modules/cldc-compact/src/test/resources/lang/TestIntegerDecode.in.

Name change from runt/apis/cldc-compact.test/lang/TestIntegerParseIntOverflow.in to modules/cldc-compact/src/test/resources/lang/TestIntegerParseIntOverflow.in.

Name change from runt/apis/cldc-compact.test/lang/TestIntegerParseIntOverflowMax.in to modules/cldc-compact/src/test/resources/lang/TestIntegerParseIntOverflowMax.in.

Name change from runt/apis/cldc-compact.test/lang/TestInvokePrivate.in to modules/cldc-compact/src/test/resources/lang/TestInvokePrivate.in.

Name change from runt/apis/cldc-compact.test/lang/TestInvokePrivateInSuper.in to modules/cldc-compact/src/test/resources/lang/TestInvokePrivateInSuper.in.

Name change from runt/apis/cldc-compact.test/lang/TestInvokeSuper.in to modules/cldc-compact/src/test/resources/lang/TestInvokeSuper.in.

Name change from runt/apis/cldc-compact.test/lang/TestMathLog.in to modules/cldc-compact/src/test/resources/lang/TestMathLog.in.

33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
secondary-random--8572265387981001411: long:4648579681512836525
secondary-random--9133131972231561590: long:4649338522149113304
secondary-value----01: long:-2251799813685248
secondary-value----02: long:-2251799813685248
secondary-value--000: long:-4503599627370496
secondary-value--001: long:0
secondary-value--002: long:4604418534313441775
secondary-value--003: long:4607626529066517258
original-ulp-secondary-value--003: long:4607626529066517259
secondary-value--004: long:4608922133940812271
secondary-value--005: long:4609927083155361075
secondary-value--006: long:4610748186450599938
secondary-value--007: long:4611442419394828887
secondary-value--008: long:4611864904876141427
secondary-value--009: long:4612130128693887755
secondary-value--010: long:4612367379483415830







|
<







33
34
35
36
37
38
39
40

41
42
43
44
45
46
47
secondary-random--8572265387981001411: long:4648579681512836525
secondary-random--9133131972231561590: long:4649338522149113304
secondary-value----01: long:-2251799813685248
secondary-value----02: long:-2251799813685248
secondary-value--000: long:-4503599627370496
secondary-value--001: long:0
secondary-value--002: long:4604418534313441775
secondary-value--003: long-fudge:4607626529066517258:1

secondary-value--004: long:4608922133940812271
secondary-value--005: long:4609927083155361075
secondary-value--006: long:4610748186450599938
secondary-value--007: long:4611442419394828887
secondary-value--008: long:4611864904876141427
secondary-value--009: long:4612130128693887755
secondary-value--010: long:4612367379483415830
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
secondary-value--041: long:4615544639687928910
secondary-value--042: long:4615598902550084909
secondary-value--043: long:4615651888519769105
secondary-value--044: long:4615703656312624195
secondary-value--045: long:4615754260685244836
secondary-value--046: long:4615803752783299180
secondary-value--047: long:4615852180452208822
secondary-value--048: long:4615899588515117940
original-ulp-secondary-value--048: long:4615899588515117941
secondary-value--049: long:4615946019022199383
secondary-value--050: long:4615991511474772911
secondary-value--051: long:4616036103027228927
secondary-value--052: long:4616079828669344073
secondary-value--053: long:4616122721391230123
secondary-value--054: long:4616164812332864268
secondary-value--055: long:4616197874487328499







|
<







78
79
80
81
82
83
84
85

86
87
88
89
90
91
92
secondary-value--041: long:4615544639687928910
secondary-value--042: long:4615598902550084909
secondary-value--043: long:4615651888519769105
secondary-value--044: long:4615703656312624195
secondary-value--045: long:4615754260685244836
secondary-value--046: long:4615803752783299180
secondary-value--047: long:4615852180452208822
secondary-value--048: long-fudge:4615899588515117940:1

secondary-value--049: long:4615946019022199383
secondary-value--050: long:4615991511474772911
secondary-value--051: long:4616036103027228927
secondary-value--052: long:4616079828669344073
secondary-value--053: long:4616122721391230123
secondary-value--054: long:4616164812332864268
secondary-value--055: long:4616197874487328499
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
secondary-value--067: long:4616420081455862061
secondary-value--068: long:4616436761759567417
secondary-value--069: long:4616453198546475707
secondary-value--070: long:4616469398824632609
secondary-value--071: long:4616485369303848649
secondary-value--072: long:4616501116412385087
secondary-value--073: long:4616516646312488934
secondary-value--074: long:4616531964914871068
original-ulp-secondary-value--074: long:4616531964914871069
secondary-value--075: long:4616547077892212572
secondary-value--076: long:4616561990691776530
secondary-value--077: long:4616576708547195452
secondary-value--078: long:4616591236489498153
secondary-value--079: long:4616605579357434227
secondary-value--080: long:4616619741807149124
secondary-value--081: long:4616633728321258251







|
<







104
105
106
107
108
109
110
111

112
113
114
115
116
117
118
secondary-value--067: long:4616420081455862061
secondary-value--068: long:4616436761759567417
secondary-value--069: long:4616453198546475707
secondary-value--070: long:4616469398824632609
secondary-value--071: long:4616485369303848649
secondary-value--072: long:4616501116412385087
secondary-value--073: long:4616516646312488934
secondary-value--074: long-fudge:4616531964914871068:1

secondary-value--075: long:4616547077892212572
secondary-value--076: long:4616561990691776530
secondary-value--077: long:4616576708547195452
secondary-value--078: long:4616591236489498153
secondary-value--079: long:4616605579357434227
secondary-value--080: long:4616619741807149124
secondary-value--081: long:4616633728321258251

Name change from runt/apis/cldc-compact.test/lang/TestMathSqrt.in to modules/cldc-compact/src/test/resources/lang/TestMathSqrt.in.

Name change from runt/apis/cldc-compact.test/lang/TestMonitorNotify.in to modules/cldc-compact/src/test/resources/lang/TestMonitorNotify.in.

Name change from runt/apis/cldc-compact.test/lang/TestMultiANewArray.in to modules/cldc-compact/src/test/resources/lang/TestMultiANewArray.in.

Name change from runt/apis/cldc-compact.test/lang/TestNewInstance.in to modules/cldc-compact/src/test/resources/lang/TestNewInstance.in.

Name change from runt/apis/cldc-compact.test/lang/TestStringIntern.in to modules/cldc-compact/src/test/resources/lang/TestStringIntern.in.

Name change from runt/apis/cldc-compact.test/lang/TestStringRegionMatches.in to modules/cldc-compact/src/test/resources/lang/TestStringRegionMatches.in.

Name change from runt/apis/cldc-compact.test/lang/TestStringTrim.in to modules/cldc-compact/src/test/resources/lang/TestStringTrim.in.

Name change from runt/apis/cldc-compact.test/lang/TestSynchronizedMethod.in to modules/cldc-compact/src/test/resources/lang/TestSynchronizedMethod.in.

Name change from runt/apis/cldc-compact.test/lang/TestThreadNew.in to modules/cldc-compact/src/test/resources/lang/TestThreadNew.in.

Name change from runt/apis/cldc-compact.test/lang/TestThrowInSynchronized.in to modules/cldc-compact/src/test/resources/lang/TestThrowInSynchronized.in.

Name change from runt/apis/cldc-compact.test/lang/TestTrailingZeros.in to modules/cldc-compact/src/test/resources/lang/TestTrailingZeros.in.

Name change from runt/apis/cldc-compact.test/lang/TestVMIndexOutOfBounds.in to modules/cldc-compact/src/test/resources/lang/TestVMIndexOutOfBounds.in.

Name change from runt/apis/cldc-compact.test/lang/TestVMInterrupt.in to modules/cldc-compact/src/test/resources/lang/TestVMInterrupt.in.

Name change from runt/apis/cldc-compact.test/lang/bytecode/TestDup.class.__mime to modules/cldc-compact/src/test/resources/lang/bytecode/TestDup.class.__mime.

Name change from runt/apis/cldc-compact.test/lang/bytecode/TestDup.in to modules/cldc-compact/src/test/resources/lang/bytecode/TestDup.in.

Name change from runt/apis/cldc-compact.test/lang/bytecode/TestDup.j to modules/cldc-compact/src/test/resources/lang/bytecode/TestDup.j.

Name change from runt/apis/cldc-compact.test/lang/bytecode/TestDupXOne.class.__mime to modules/cldc-compact/src/test/resources/lang/bytecode/TestDupXOne.class.__mime.

Name change from runt/apis/cldc-compact.test/lang/bytecode/TestDupXOne.in to modules/cldc-compact/src/test/resources/lang/bytecode/TestDupXOne.in.

Name change from runt/apis/cldc-compact.test/lang/bytecode/TestDupXOne.j to modules/cldc-compact/src/test/resources/lang/bytecode/TestDupXOne.j.

Name change from runt/apis/cldc-compact.test/lang/bytecode/TestDupXTwoIII.class.__mime to modules/cldc-compact/src/test/resources/lang/bytecode/TestDupXTwoIII.class.__mime.

Name change from runt/apis/cldc-compact.test/lang/bytecode/TestDupXTwoIII.in to modules/cldc-compact/src/test/resources/lang/bytecode/TestDupXTwoIII.in.

Name change from runt/apis/cldc-compact.test/lang/bytecode/TestDupXTwoIII.j to modules/cldc-compact/src/test/resources/lang/bytecode/TestDupXTwoIII.j.

Name change from runt/apis/cldc-compact.test/lang/bytecode/TestDupXTwoJI.class.__mime to modules/cldc-compact/src/test/resources/lang/bytecode/TestDupXTwoJI.class.__mime.

Name change from runt/apis/cldc-compact.test/lang/bytecode/TestDupXTwoJI.in to modules/cldc-compact/src/test/resources/lang/bytecode/TestDupXTwoJI.in.

Name change from runt/apis/cldc-compact.test/lang/bytecode/TestDupXTwoJI.j to modules/cldc-compact/src/test/resources/lang/bytecode/TestDupXTwoJI.j.

Name change from runt/apis/cldc-compact.test/lang/bytecode/TestSwap.class.__mime to modules/cldc-compact/src/test/resources/lang/bytecode/TestSwap.class.__mime.

Name change from runt/apis/cldc-compact.test/lang/bytecode/TestSwap.in to modules/cldc-compact/src/test/resources/lang/bytecode/TestSwap.in.

Name change from runt/apis/cldc-compact.test/lang/bytecode/TestSwap.j to modules/cldc-compact/src/test/resources/lang/bytecode/TestSwap.j.

Added modules/cldc-compact/src/test/resources/squirreljme/TestArrayLength.in.













































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
result: NoResult
thrown: NoExceptionThrown
secondary-o: int:-1
secondary-op: int:-1
secondary-z: int:1
secondary-b: int:2
secondary-s: int:3
secondary-c: int:4
secondary-i: int:5
secondary-j: int:6
secondary-f: int:7
secondary-d: int:8
secondary-l: int:9
secondary-zp: int:1
secondary-bp: int:2
secondary-sp: int:3
secondary-cp: int:4
secondary-ip: int:5
secondary-jp: int:6
secondary-fp: int:7
secondary-dp: int:8
secondary-lp: int:9

Added modules/cldc-compact/src/test/resources/squirreljme/TestErrorGetSet.in.









>
>
>
>
1
2
3
4
result: NoResult
thrown: NoExceptionThrown
secondary-sameasorig: true
secondary-isset: true

Name change from runt/apis/cldc-compact.test/squirreljme/TestPointerAccess.in to modules/cldc-compact/src/test/resources/squirreljme/TestPointerAccess.in.

Name change from runt/apis/cldc-compact.test/squirreljme/TestSystemTime.in to modules/cldc-compact/src/test/resources/squirreljme/TestSystemTime.in.

Name change from runt/apis/cldc-compact.test/util/TestArrayBinarySearch.in to modules/cldc-compact/src/test/resources/util/TestArrayBinarySearch.in.

Name change from runt/apis/cldc-compact.test/util/TestArrayDequeDeque.in to modules/cldc-compact/src/test/resources/util/TestArrayDequeDeque.in.

1
secondary-hashcode: int:1789447862
<


Name change from runt/apis/cldc-compact.test/util/TestHashMap.in to modules/cldc-compact/src/test/resources/util/TestHashMap.in.

Name change from runt/apis/cldc-compact.test/util/TestHashMapNaN.in to modules/cldc-compact/src/test/resources/util/TestHashMapNaN.in.

Name change from runt/apis/cldc-compact.test/util/TestHashtable.in to modules/cldc-compact/src/test/resources/util/TestHashtable.in.

Name change from runt/apis/cldc-compact.test/util/TestLinkedHashMap.in to modules/cldc-compact/src/test/resources/util/TestLinkedHashMap.in.

Name change from runt/apis/cldc-compact.test/util/TestLinkedHashMapEldest.in to modules/cldc-compact/src/test/resources/util/TestLinkedHashMapEldest.in.

Name change from runt/apis/cldc-compact.test/util/TestLinkedHashSet.in to modules/cldc-compact/src/test/resources/util/TestLinkedHashSet.in.

Name change from runt/apis/cldc-compact.test/util/TestLinkedListDeque.in to modules/cldc-compact/src/test/resources/util/TestLinkedListDeque.in.

Name change from runt/apis/cldc-compact.test/util/TestRandom.in to modules/cldc-compact/src/test/resources/util/TestRandom.in.

Name change from runt/apis/cldc-compact.test/util/TestRandomFloat.in to modules/cldc-compact/src/test/resources/util/TestRandomFloat.in.

Name change from runt/apis/cldc-compact.test/util/TestServiceLoader.in to modules/cldc-compact/src/test/resources/util/TestServiceLoader.in.

Name change from runt/apis/cldc-compact.test/util/TestSorting.in to modules/cldc-compact/src/test/resources/util/TestSorting.in.

Name change from runt/apis/cldc-compact.test/util/__TestDeque__.in to modules/cldc-compact/src/test/resources/util/__TestDeque__.in.

Name change from runt/apis/cldc-compact.test/util/__TestList__.in to modules/cldc-compact/src/test/resources/util/__TestList__.in.

Added modules/cldc/build.gradle.











































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import cc.squirreljme.plugin.swm.JavaMEConfiguration
import cc.squirreljme.plugin.swm.JavaMEMidletType

version = "1.8.${rootProject.ext.squirreljmeVMVersion}"
description = "This is the standard Java ME 8 Connection " +
	"Limited Device Configuration which contains the full set of classes " +
	"used by JavaME."

squirreljme
{
	javaDocErrorCode = "ZY"
	swmType = JavaMEMidletType.API
	swmName = "Connection Limited Device Configuration"
	swmVendor = "Stephanie Gawroriski"
	definedConfigurations += new JavaMEConfiguration("CLDC-1.8")
}

dependencies
{
	implementation project(":modules:cldc-compact")
}

Name change from runt/apis/cldc/cc/squirreljme/runtime/cldc/full/NullFileSystem.java to modules/cldc/src/main/java/cc/squirreljme/runtime/cldc/full/NullFileSystem.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.cldc.full;

import java.io.Closeable;
import java.io.IOException;
import java.nio.file.FileStore;
import java.nio.file.FileSystem;
import java.nio.file.InvalidPathException;
import java.nio.file.Path;
import java.util.Arrays;
import java.util.HashSet;











<







1
2
3
4
5
6
7
8
9
10
11

12
13
14
15
16
17
18
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.cldc.full;


import java.io.IOException;
import java.nio.file.FileStore;
import java.nio.file.FileSystem;
import java.nio.file.InvalidPathException;
import java.nio.file.Path;
import java.util.Arrays;
import java.util.HashSet;

Name change from runt/apis/cldc/cc/squirreljme/runtime/cldc/full/NullPath.java to modules/cldc/src/main/java/cc/squirreljme/runtime/cldc/full/NullPath.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.cldc.full;

import java.io.IOException;
import java.nio.file.FileSystem;
import java.nio.file.Path;
import java.nio.file.LinkOption;
import java.util.Iterator;

/**
 * This represents a null path.
 *
 * @since 2019/12/22
 */













|
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.cldc.full;

import java.io.IOException;
import java.nio.file.FileSystem;
import java.nio.file.LinkOption;
import java.nio.file.Path;
import java.util.Iterator;

/**
 * This represents a null path.
 *
 * @since 2019/12/22
 */

Name change from runt/apis/cldc/cc/squirreljme/runtime/cldc/full/StandardPaths.java to modules/cldc/src/main/java/cc/squirreljme/runtime/cldc/full/StandardPaths.java.

8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.cldc.full;

import cc.squirreljme.runtime.cldc.asm.SystemAccess;
import cc.squirreljme.runtime.cldc.asm.SystemProperties;
import cc.squirreljme.runtime.cldc.lang.OperatingSystemType;
import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Objects;

/**







<







8
9
10
11
12
13
14

15
16
17
18
19
20
21
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.cldc.full;

import cc.squirreljme.runtime.cldc.asm.SystemAccess;
import cc.squirreljme.runtime.cldc.asm.SystemProperties;

import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Objects;

/**
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
	 * {@squirreljme.env SQUIRRELJME_CACHE_PATH=path
	 * This specifies the location where cache files are stored.}
	 */
	public static final String CACHE_PATH_ENV =
		"SQUIRRELJME_CACHE_PATH";
	
	/** Determines the default paths to use. */
	public static final StandardPaths DEFAULT =
		__defaultPaths();
	
	/** The configuration path. */
	protected final Path config;
	
	/** The data path. */
	protected final Path data;
	







|
<







80
81
82
83
84
85
86
87

88
89
90
91
92
93
94
	 * {@squirreljme.env SQUIRRELJME_CACHE_PATH=path
	 * This specifies the location where cache files are stored.}
	 */
	public static final String CACHE_PATH_ENV =
		"SQUIRRELJME_CACHE_PATH";
	
	/** Determines the default paths to use. */
	public static final StandardPaths DEFAULT = StandardPaths.__defaultPaths();

	
	/** The configuration path. */
	protected final Path config;
	
	/** The data path. */
	protected final Path data;
	
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
	/**
	 * Initializes the standard path set.
	 *
	 * @param __conf The configuration directory.
	 * @param __data The data directory.
	 * @param __cache The cache directory.
	 * @throws NullPointerException On null arguments.
	 * @sicne 2018/01/13
	 */
	public StandardPaths(Path __conf, Path __data, Path __cache)
		throws NullPointerException
	{
		if (__conf == null || __data == null || __cache == null)
			throw new NullPointerException("NARG");
		







|







115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
	/**
	 * Initializes the standard path set.
	 *
	 * @param __conf The configuration directory.
	 * @param __data The data directory.
	 * @param __cache The cache directory.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/01/13
	 */
	public StandardPaths(Path __conf, Path __data, Path __cache)
		throws NullPointerException
	{
		if (__conf == null || __data == null || __cache == null)
			throw new NullPointerException("NARG");
		
159
160
161
162
163
164
165
166

167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
	 * @since 2018/01/13
	 */
	private static StandardPaths __defaultPaths()
	{
		Path[] rv = null;
		
		// Using a basic home path
		String basichome = Objects.toString(System.getProperty(HOME_PROPERTY),

			SystemAccess.getEnv(HOME_ENV));
		if (basichome != null)
			rv = new Path[]{Paths.get(basichome)};
		
		// If no basic path was used, detect more paths
		if (rv == null)
		{
			rv = __defaultPathsOs();
			
			// Still could not be used?
			if (rv == null)
				rv = new Path[]{StandardPaths.__getPropertyPath("user.dir").
					resolve("squirreljme")};
		}
		







|
>
|






|







157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
	 * @since 2018/01/13
	 */
	private static StandardPaths __defaultPaths()
	{
		Path[] rv = null;
		
		// Using a basic home path
		String basichome = Objects.toString(System.getProperty(
			StandardPaths.HOME_PROPERTY),
			SystemAccess.getEnv(StandardPaths.HOME_ENV));
		if (basichome != null)
			rv = new Path[]{Paths.get(basichome)};
		
		// If no basic path was used, detect more paths
		if (rv == null)
		{
			rv = StandardPaths.__defaultPathsOs();
			
			// Still could not be used?
			if (rv == null)
				rv = new Path[]{StandardPaths.__getPropertyPath("user.dir").
					resolve("squirreljme")};
		}
		
189
190
191
192
193
194
195
196
197
198
199

200
201

202
203
204
205
206
207
208
209
					base.resolve("config"),
					base.resolve("data"),
					base.resolve("cache"),
				};
		}
		
		// Setup paths
		return new StandardPaths(
			__triple(rv[0], System.getProperty(CONFIG_PATH_PROPERTY),
				SystemAccess.getEnv(CONFIG_PATH_ENV)),
			__triple(rv[1], System.getProperty(DATA_PATH_PROPERTY),

				SystemAccess.getEnv(DATA_PATH_ENV)),
			__triple(rv[2], System.getProperty(CACHE_PATH_PROPERTY),

				SystemAccess.getEnv(CACHE_PATH_ENV)));
	}
	
	/**
	 * Use paths specific to the operation system.
	 *
	 * @return The set of paths, either 1 for singular or 3 for config, data,
	 * and cache.







|
|
|
|
>
|
|
>
|







188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
					base.resolve("config"),
					base.resolve("data"),
					base.resolve("cache"),
				};
		}
		
		// Setup paths
		return new StandardPaths(StandardPaths.__triple(rv[0], System.getProperty(
			StandardPaths.CONFIG_PATH_PROPERTY),
				SystemAccess.getEnv(StandardPaths.CONFIG_PATH_ENV)),
			StandardPaths.__triple(rv[1], System.getProperty(
				StandardPaths.DATA_PATH_PROPERTY),
				SystemAccess.getEnv(StandardPaths.DATA_PATH_ENV)),
			StandardPaths.__triple(rv[2], System.getProperty(
				StandardPaths.CACHE_PATH_PROPERTY),
				SystemAccess.getEnv(StandardPaths.CACHE_PATH_ENV)));
	}
	
	/**
	 * Use paths specific to the operation system.
	 *
	 * @return The set of paths, either 1 for singular or 3 for config, data,
	 * and cache.

Name change from runt/apis/cldc/cc/squirreljme/runtime/cldc/full/package-info.java to modules/cldc/src/main/java/cc/squirreljme/runtime/cldc/full/package-info.java.

Name change from runt/apis/cldc/java/nio/Buffer.java to modules/cldc/src/main/java/java/nio/Buffer.java.

10
11
12
13
14
15
16
17
18
19
20
21
22
23
24

package java.nio;

public abstract class Buffer
{
	Buffer()
	{
		super();
		throw new todo.TODO();
	}
	
	public final int capacity()
	{
		throw new todo.TODO();
	}







<







10
11
12
13
14
15
16

17
18
19
20
21
22
23

package java.nio;

public abstract class Buffer
{
	Buffer()
	{

		throw new todo.TODO();
	}
	
	public final int capacity()
	{
		throw new todo.TODO();
	}

Name change from runt/apis/cldc/java/nio/ByteBuffer.java to modules/cldc/src/main/java/java/nio/ByteBuffer.java.

12
13
14
15
16
17
18
19
20
21
22
23
24
25
26

public abstract class ByteBuffer
	extends Buffer
	implements Comparable<ByteBuffer>
{
	ByteBuffer()
	{
		super();
		throw new todo.TODO();
	}
	
	public abstract FloatBuffer asFloatBuffer();
	
	public abstract IntBuffer asIntBuffer();
	







<







12
13
14
15
16
17
18

19
20
21
22
23
24
25

public abstract class ByteBuffer
	extends Buffer
	implements Comparable<ByteBuffer>
{
	ByteBuffer()
	{

		throw new todo.TODO();
	}
	
	public abstract FloatBuffer asFloatBuffer();
	
	public abstract IntBuffer asIntBuffer();
	

Name change from runt/apis/cldc/java/nio/ByteOrder.java to modules/cldc/src/main/java/java/nio/ByteOrder.java.

39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
		throws NullPointerException
	{
		// Check
		if (__str == null)
			throw new NullPointerException();
		
		// Set
		_string = __str;
	}
	
	/**
	 * Returns the string representing the byte order, either
	 * {@code BIG_ENDIAN} or {@code LITTLE_ENDIAN}.
	 *
	 * @return The byte order's string.
	 * @since 2016/02/27
	 */
	@Override
	public String toString()
	{
		return _string;
	}
	
	public static ByteOrder nativeOrder()
	{
		throw new todo.TODO();
	}
}







|












|







39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
		throws NullPointerException
	{
		// Check
		if (__str == null)
			throw new NullPointerException();
		
		// Set
		this._string = __str;
	}
	
	/**
	 * Returns the string representing the byte order, either
	 * {@code BIG_ENDIAN} or {@code LITTLE_ENDIAN}.
	 *
	 * @return The byte order's string.
	 * @since 2016/02/27
	 */
	@Override
	public String toString()
	{
		return this._string;
	}
	
	public static ByteOrder nativeOrder()
	{
		throw new todo.TODO();
	}
}

Name change from runt/apis/cldc/java/nio/FloatBuffer.java to modules/cldc/src/main/java/java/nio/FloatBuffer.java.

Name change from runt/apis/cldc/java/nio/IntBuffer.java to modules/cldc/src/main/java/java/nio/IntBuffer.java.

Name change from runt/apis/cldc/java/nio/ShortBuffer.java to modules/cldc/src/main/java/java/nio/ShortBuffer.java.

Name change from runt/apis/cldc/java/nio/channels/ByteChannel.java to modules/cldc/src/main/java/java/nio/channels/ByteChannel.java.

Name change from runt/apis/cldc/java/nio/channels/Channel.java to modules/cldc/src/main/java/java/nio/channels/Channel.java.

12
13
14
15
16
17
18
19
20
21
22
23
24

import java.io.Closeable;
import java.io.IOException;

public interface Channel
	extends Closeable
{
	public abstract void close()
		throws IOException;
	
	public abstract boolean isOpen();
}








|


|


12
13
14
15
16
17
18
19
20
21
22
23
24

import java.io.Closeable;
import java.io.IOException;

public interface Channel
	extends Closeable
{
	void close()
		throws IOException;
	
	boolean isOpen();
}

Name change from runt/apis/cldc/java/nio/channels/Channels.java to modules/cldc/src/main/java/java/nio/channels/Channels.java.

13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import java.io.InputStream;
import java.io.OutputStream;

public final class Channels
{
	private Channels()
	{
		super();
		throw new todo.TODO();
	}
	
	public static ReadableByteChannel newChannel(InputStream __a)
	{
		throw new todo.TODO();
	}







<







13
14
15
16
17
18
19

20
21
22
23
24
25
26
import java.io.InputStream;
import java.io.OutputStream;

public final class Channels
{
	private Channels()
	{

		throw new todo.TODO();
	}
	
	public static ReadableByteChannel newChannel(InputStream __a)
	{
		throw new todo.TODO();
	}

Name change from runt/apis/cldc/java/nio/channels/ClosedChannelException.java to modules/cldc/src/main/java/java/nio/channels/ClosedChannelException.java.

13
14
15
16
17
18
19
20
21
22
23
import java.io.IOException;

public class ClosedChannelException
	extends IOException
{
	public ClosedChannelException()
	{
		super();
		throw new todo.TODO();
	}
}







<



13
14
15
16
17
18
19

20
21
22
import java.io.IOException;

public class ClosedChannelException
	extends IOException
{
	public ClosedChannelException()
	{

		throw new todo.TODO();
	}
}

Name change from runt/apis/cldc/java/nio/channels/FileChannel.java to modules/cldc/src/main/java/java/nio/channels/FileChannel.java.

8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.nio.channels;

import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.file.attribute.FileAttribute;
import java.nio.file.OpenOption;
import java.nio.file.Path;
import java.util.Set;

public abstract class FileChannel
	extends Object
	implements SeekableByteChannel
{
	protected FileChannel()
	{
		throw new todo.TODO();
	}
	







|
|
|



<







8
9
10
11
12
13
14
15
16
17
18
19
20

21
22
23
24
25
26
27
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.nio.channels;

import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.file.OpenOption;
import java.nio.file.Path;
import java.nio.file.attribute.FileAttribute;
import java.util.Set;

public abstract class FileChannel

	implements SeekableByteChannel
{
	protected FileChannel()
	{
		throw new todo.TODO();
	}
	

Name change from runt/apis/cldc/java/nio/channels/ReadableByteChannel.java to modules/cldc/src/main/java/java/nio/channels/ReadableByteChannel.java.

12
13
14
15
16
17
18
19
20
21
22
23

import java.io.IOException;
import java.nio.ByteBuffer;

public interface ReadableByteChannel
	extends Channel
{
	public abstract int read(ByteBuffer __a)
		throws IOException;
}









|




12
13
14
15
16
17
18
19
20
21
22
23

import java.io.IOException;
import java.nio.ByteBuffer;

public interface ReadableByteChannel
	extends Channel
{
	int read(ByteBuffer __a)
		throws IOException;
}


Name change from runt/apis/cldc/java/nio/channels/SeekableByteChannel.java to modules/cldc/src/main/java/java/nio/channels/SeekableByteChannel.java.

12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38

import java.io.IOException;
import java.nio.ByteBuffer;

public interface SeekableByteChannel
	extends ByteChannel
{
	public abstract long position()
		throws IOException;
	
	public abstract SeekableByteChannel position(long __a)
		throws IOException;
	
	public abstract int read(ByteBuffer __a)
		throws IOException;
	
	public abstract long size()
		throws IOException;
	
	public abstract SeekableByteChannel truncate(long __a)
		throws IOException;
	
	public abstract int write(ByteBuffer __a)
		throws IOException;
}









|


|


|


|


|


|




12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38

import java.io.IOException;
import java.nio.ByteBuffer;

public interface SeekableByteChannel
	extends ByteChannel
{
	long position()
		throws IOException;
	
	SeekableByteChannel position(long __a)
		throws IOException;
	
	int read(ByteBuffer __a)
		throws IOException;
	
	long size()
		throws IOException;
	
	SeekableByteChannel truncate(long __a)
		throws IOException;
	
	int write(ByteBuffer __a)
		throws IOException;
}


Name change from runt/apis/cldc/java/nio/channels/WritableByteChannel.java to modules/cldc/src/main/java/java/nio/channels/WritableByteChannel.java.

12
13
14
15
16
17
18
19
20
21
22

import java.io.IOException;
import java.nio.ByteBuffer;

public interface WritableByteChannel
	extends Channel
{
	public abstract int write(ByteBuffer __a)
		throws IOException;
}








|



12
13
14
15
16
17
18
19
20
21
22

import java.io.IOException;
import java.nio.ByteBuffer;

public interface WritableByteChannel
	extends Channel
{
	int write(ByteBuffer __a)
		throws IOException;
}

Name change from runt/apis/cldc/java/nio/file/CopyOption.java to modules/cldc/src/main/java/java/nio/file/CopyOption.java.

Name change from runt/apis/cldc/java/nio/file/DirectoryStream.java to modules/cldc/src/main/java/java/nio/file/DirectoryStream.java.

13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import java.io.Closeable;
import java.io.IOException;
import java.util.Iterator;

public interface DirectoryStream<T>
	extends Closeable, Iterable<T>
{
	public abstract Iterator<T> iterator();
	
	public static interface Filter<T>
	{
		public abstract boolean accept(T __a)
			throws IOException;
	}
}








|

|

|




13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import java.io.Closeable;
import java.io.IOException;
import java.util.Iterator;

public interface DirectoryStream<T>
	extends Closeable, Iterable<T>
{
	Iterator<T> iterator();
	
	interface Filter<T>
	{
		boolean accept(T __a)
			throws IOException;
	}
}

Name change from runt/apis/cldc/java/nio/file/FileAlreadyExistsException.java to modules/cldc/src/main/java/java/nio/file/FileAlreadyExistsException.java.

Name change from runt/apis/cldc/java/nio/file/FileStore.java to modules/cldc/src/main/java/java/nio/file/FileStore.java.

Name change from runt/apis/cldc/java/nio/file/FileSystem.java to modules/cldc/src/main/java/java/nio/file/FileSystem.java.

Name change from runt/apis/cldc/java/nio/file/FileSystemException.java to modules/cldc/src/main/java/java/nio/file/FileSystemException.java.

13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import java.io.IOException;

public class FileSystemException
	extends IOException
{
	public FileSystemException(String __a)
	{
		super();
		throw new todo.TODO();
	}
	
	public FileSystemException(String __a, String __b, String __c)
	{
		super();
		throw new todo.TODO();
	}
	
	public String getFile()
	{
		throw new todo.TODO();
	}







<





<







13
14
15
16
17
18
19

20
21
22
23
24

25
26
27
28
29
30
31
import java.io.IOException;

public class FileSystemException
	extends IOException
{
	public FileSystemException(String __a)
	{

		throw new todo.TODO();
	}
	
	public FileSystemException(String __a, String __b, String __c)
	{

		throw new todo.TODO();
	}
	
	public String getFile()
	{
		throw new todo.TODO();
	}

Name change from runt/apis/cldc/java/nio/file/FileSystems.java to modules/cldc/src/main/java/java/nio/file/FileSystems.java.

Name change from runt/apis/cldc/java/nio/file/Files.java to modules/cldc/src/main/java/java/nio/file/Files.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.nio.file;

import java.io.InputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.nio.channels.SeekableByteChannel;
import java.nio.file.attribute.BasicFileAttributes;
import java.nio.file.attribute.FileAttribute;
import java.nio.file.attribute.FileTime;
import java.util.List;
import java.util.Map;
import java.util.Set;

public final class Files
{
	private Files()
	{
		super();
		throw new todo.TODO();
	}
	
	public static Path copy(Path __a, Path __b, CopyOption... __c)
		throws IOException
	{
		if (false)












|
|





<







<







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19

20
21
22
23
24
25
26

27
28
29
30
31
32
33
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.nio.file;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.nio.channels.SeekableByteChannel;
import java.nio.file.attribute.BasicFileAttributes;
import java.nio.file.attribute.FileAttribute;
import java.nio.file.attribute.FileTime;

import java.util.Map;
import java.util.Set;

public final class Files
{
	private Files()
	{

		throw new todo.TODO();
	}
	
	public static Path copy(Path __a, Path __b, CopyOption... __c)
		throws IOException
	{
		if (false)

Name change from runt/apis/cldc/java/nio/file/InvalidPathException.java to modules/cldc/src/main/java/java/nio/file/InvalidPathException.java.

15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
 *
 * @since 2019/12/22
 */
public class InvalidPathException
	extends IllegalArgumentException
{
	/** The input. */
	private transient final String _input;
	
	/** The reason. */
	private transient final String _reason;
	
	/** The index. */
	private transient final int _index;
	
	/**
	 * Initializes the exception.
	 *
	 * @param __in The input string.
	 * @param __reason The reason for the failure.
	 * @param __index The index of the failure, {@code -1} if not known.
	 * @throws IllegalArgumentException If the index is less than {@code -1}.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/12/22
	 */
	public InvalidPathException(String __in, String __reason, int __index)
		throws IllegalArgumentException, NullPointerException
	{
		if (__in == null || __reason == null)
			throw new NullPointerException("NARG");
		
		// @{squirreljme.error ZY04 Invalid path index specified for
		// exception. (Index)}
		if (__index < -1)
			throw new IllegalArgumentException("ZY04 " + __index);
		
		this._input = __in;
		this._reason = __reason;
		this._index = __index;







|


|


|

















|







15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
 *
 * @since 2019/12/22
 */
public class InvalidPathException
	extends IllegalArgumentException
{
	/** The input. */
	private final transient String _input;
	
	/** The reason. */
	private final transient String _reason;
	
	/** The index. */
	private final transient int _index;
	
	/**
	 * Initializes the exception.
	 *
	 * @param __in The input string.
	 * @param __reason The reason for the failure.
	 * @param __index The index of the failure, {@code -1} if not known.
	 * @throws IllegalArgumentException If the index is less than {@code -1}.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/12/22
	 */
	public InvalidPathException(String __in, String __reason, int __index)
		throws IllegalArgumentException, NullPointerException
	{
		if (__in == null || __reason == null)
			throw new NullPointerException("NARG");
		
		// {@squirreljme.error ZY04 Invalid path index specified for
		// exception. (Index)}
		if (__index < -1)
			throw new IllegalArgumentException("ZY04 " + __index);
		
		this._input = __in;
		this._reason = __reason;
		this._index = __index;

Name change from runt/apis/cldc/java/nio/file/LinkOption.java to modules/cldc/src/main/java/java/nio/file/LinkOption.java.

14
15
16
17
18
19
20
21
22
23
24
25
26
	implements OpenOption, CopyOption
{
	NOFOLLOW_LINKS(),
	
	/** End. */
	;
	
	private LinkOption()
	{
		throw new todo.TODO();
	}
}








|





14
15
16
17
18
19
20
21
22
23
24
25
26
	implements OpenOption, CopyOption
{
	NOFOLLOW_LINKS(),
	
	/** End. */
	;
	
	LinkOption()
	{
		throw new todo.TODO();
	}
}

Name change from runt/apis/cldc/java/nio/file/NoSuchFileException.java to modules/cldc/src/main/java/java/nio/file/NoSuchFileException.java.

Name change from runt/apis/cldc/java/nio/file/OpenOption.java to modules/cldc/src/main/java/java/nio/file/OpenOption.java.

Name change from runt/apis/cldc/java/nio/file/Path.java to modules/cldc/src/main/java/java/nio/file/Path.java.

12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73

import java.io.IOException;
import java.util.Iterator;

public interface Path
	extends Comparable<Path>, Iterable<Path>
{
	public abstract int compareTo(Path __a);
	
	public abstract boolean endsWith(Path __a);
	
	public abstract boolean endsWith(String __a);
	
	@Override
	public abstract boolean equals(Object __a);
	
	public abstract Path getFileName();
	
	public abstract FileSystem getFileSystem();
	
	public abstract Path getName(int __a);
	
	public abstract int getNameCount();
	
	public abstract Path getParent();
	
	public abstract Path getRoot();
	
	@Override
	public abstract int hashCode();
	
	public abstract boolean isAbsolute();
	
	public abstract Iterator<Path> iterator();
	
	public abstract Path normalize();
	
	public abstract Path relativize(Path __a);
	
	public abstract Path resolve(Path __a);
	
	public abstract Path resolve(String __a);
	
	public abstract Path resolveSibling(Path __a);
	
	public abstract Path resolveSibling(String __a);
	
	public abstract boolean startsWith(Path __a);
	
	public abstract boolean startsWith(String __a);
	
	public abstract Path subpath(int __a, int __b);
	
	public abstract Path toAbsolutePath();
	
	public abstract Path toRealPath(LinkOption... __a)
		throws IOException;
	
	@Override
	public abstract String toString();
}








|

|

|


|

|

|

|

|

|

|


|

|

|

|

|

|

|

|

|

|

|

|

|

|



|


12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73

import java.io.IOException;
import java.util.Iterator;

public interface Path
	extends Comparable<Path>, Iterable<Path>
{
	int compareTo(Path __a);
	
	boolean endsWith(Path __a);
	
	boolean endsWith(String __a);
	
	@Override
	boolean equals(Object __a);
	
	Path getFileName();
	
	FileSystem getFileSystem();
	
	Path getName(int __a);
	
	int getNameCount();
	
	Path getParent();
	
	Path getRoot();
	
	@Override
	int hashCode();
	
	boolean isAbsolute();
	
	Iterator<Path> iterator();
	
	Path normalize();
	
	Path relativize(Path __a);
	
	Path resolve(Path __a);
	
	Path resolve(String __a);
	
	Path resolveSibling(Path __a);
	
	Path resolveSibling(String __a);
	
	boolean startsWith(Path __a);
	
	boolean startsWith(String __a);
	
	Path subpath(int __a, int __b);
	
	Path toAbsolutePath();
	
	Path toRealPath(LinkOption... __a)
		throws IOException;
	
	@Override
	String toString();
}

Name change from runt/apis/cldc/java/nio/file/Paths.java to modules/cldc/src/main/java/java/nio/file/Paths.java.

25
26
27
28
29
30
31
32

33
34
35
36
37
38
39
	 */
	private Paths()
	{
	}
	
	/**
	 * This creates a representation of a native filesystem path. It has the
	 * same function and rules as {@link FileSystem#getPath(String, String)}.

	 *
	 * @param __a The first path fragment.
	 * @param __b The optional remaining path fragments.
	 * @return The native representation of the native filesystem path.
	 * @throws InvalidPathException If the specified path cannot be represented
	 * on the native system.
	 * @since 2017/06/12







|
>







25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
	 */
	private Paths()
	{
	}
	
	/**
	 * This creates a representation of a native filesystem path. It has the
	 * same function and rules
	 * as {@link FileSystem#getPath(String, String...)}.
	 *
	 * @param __a The first path fragment.
	 * @param __b The optional remaining path fragments.
	 * @return The native representation of the native filesystem path.
	 * @throws InvalidPathException If the specified path cannot be represented
	 * on the native system.
	 * @since 2017/06/12

Name change from runt/apis/cldc/java/nio/file/StandardCopyOption.java to modules/cldc/src/main/java/java/nio/file/StandardCopyOption.java.

Name change from runt/apis/cldc/java/nio/file/StandardOpenOption.java to modules/cldc/src/main/java/java/nio/file/StandardOpenOption.java.

32
33
34
35
36
37
38
39
40
41
42
43
44
	TRUNCATE_EXISTING(),
	
	WRITE(),
	
	/** End. */
	;
	
	private StandardOpenOption()
	{
		throw new todo.TODO();
	}
}








|





32
33
34
35
36
37
38
39
40
41
42
43
44
	TRUNCATE_EXISTING(),
	
	WRITE(),
	
	/** End. */
	;
	
	StandardOpenOption()
	{
		throw new todo.TODO();
	}
}

Name change from runt/apis/cldc/java/nio/file/attribute/BasicFileAttributes.java to modules/cldc/src/main/java/java/nio/file/attribute/BasicFileAttributes.java.

8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.nio.file.attribute;

public interface BasicFileAttributes
{
	public abstract FileTime creationTime();
	
	public abstract boolean isDirectory();
	
	public abstract boolean isOther();
	
	public abstract boolean isRegularFile();
	
	public abstract boolean isSymbolicLink();
	
	public abstract FileTime lastAccessTime();
	
	public abstract FileTime lastModifiedTime();
	
	public abstract long size();
}









|

|

|

|

|

|

|

|



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.nio.file.attribute;

public interface BasicFileAttributes
{
	FileTime creationTime();
	
	boolean isDirectory();
	
	boolean isOther();
	
	boolean isRegularFile();
	
	boolean isSymbolicLink();
	
	FileTime lastAccessTime();
	
	FileTime lastModifiedTime();
	
	long size();
}


Name change from runt/apis/cldc/java/nio/file/attribute/FileAttribute.java to modules/cldc/src/main/java/java/nio/file/attribute/FileAttribute.java.

8
9
10
11
12
13
14
15
16
17
18
19
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.nio.file.attribute;

public interface FileAttribute<T>
{
	public abstract String name();
	
	public abstract T value();
}








|

|


8
9
10
11
12
13
14
15
16
17
18
19
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.nio.file.attribute;

public interface FileAttribute<T>
{
	String name();
	
	T value();
}

Name change from runt/apis/cldc/java/nio/file/attribute/FileTime.java to modules/cldc/src/main/java/java/nio/file/attribute/FileTime.java.

11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package java.nio.file.attribute;

public final class FileTime
	implements Comparable<FileTime>
{
	private FileTime()
	{
		super();
		throw new todo.TODO();
	}
	
	public int compareTo(FileTime __a)
	{
		throw new todo.TODO();
	}







<







11
12
13
14
15
16
17

18
19
20
21
22
23
24
package java.nio.file.attribute;

public final class FileTime
	implements Comparable<FileTime>
{
	private FileTime()
	{

		throw new todo.TODO();
	}
	
	public int compareTo(FileTime __a)
	{
		throw new todo.TODO();
	}

Added modules/collections/build.gradle.





































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import cc.squirreljme.plugin.swm.JavaMEMidletType

description = "This class contains various collections " +
	"which can be used to store objects."
version = rootProject.version

squirreljme
{
	javaDocErrorCode = "AC"
	swmType = JavaMEMidletType.LIBRARY
	swmName = "Collections"
	swmVendor = "Stephanie Gawroriski"
}

dependencies
{
	implementation project(":modules:cldc-compact")
}

Name change from runt/libs/collections/net/multiphasicapps/collections/ArrayUtils.java to modules/collections/src/main/java/net/multiphasicapps/collections/ArrayUtils.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.collections;

import java.util.Arrays;
import java.util.Collection;
import java.util.Comparator;
import java.util.List;

/**
 * This contains some utilities for arrays.
 *
 * @since 2017/11/30
 */












<
<
<







1
2
3
4
5
6
7
8
9
10
11
12



13
14
15
16
17
18
19
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.collections;




import java.util.List;

/**
 * This contains some utilities for arrays.
 *
 * @since 2017/11/30
 */

Name change from runt/libs/collections/net/multiphasicapps/collections/CloseableList.java to modules/collections/src/main/java/net/multiphasicapps/collections/CloseableList.java.

Name change from runt/libs/collections/net/multiphasicapps/collections/EmptyIterator.java to modules/collections/src/main/java/net/multiphasicapps/collections/EmptyIterator.java.

75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
	 * @return The empty iterator.
	 * @since 2016/04/10
	 */
	@SuppressWarnings({"unchecked"})
	public static <V> Iterator<V> empty()
	{
		// Get reference
		Reference<Iterator> ref = _EMPTY_ITERATOR;
		Iterator rv;
		
		// Needs creation?
		if (ref == null || null == (rv = ref.get()))
			_EMPTY_ITERATOR = new WeakReference<>(
				(rv = new EmptyIterator()));
		
		// Return it
		return (Iterator<V>)rv;
	}
}








|




|







75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
	 * @return The empty iterator.
	 * @since 2016/04/10
	 */
	@SuppressWarnings({"unchecked"})
	public static <V> Iterator<V> empty()
	{
		// Get reference
		Reference<Iterator> ref = EmptyIterator._EMPTY_ITERATOR;
		Iterator rv;
		
		// Needs creation?
		if (ref == null || null == (rv = ref.get()))
			EmptyIterator._EMPTY_ITERATOR = new WeakReference<>(
				(rv = new EmptyIterator()));
		
		// Return it
		return (Iterator<V>)rv;
	}
}

Name change from runt/libs/collections/net/multiphasicapps/collections/EmptyList.java to modules/collections/src/main/java/net/multiphasicapps/collections/EmptyList.java.

127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
	 * @return The empty list.
	 * @since 2016/04/10
	 */
	@SuppressWarnings({"unchecked"})
	public static <V> List<V> empty()
	{
		// Get reference
		Reference<List> ref = _EMPTY_LIST;
		List rv;
		
		// Needs creation?
		if (ref == null || null == (rv = ref.get()))
			_EMPTY_LIST = new WeakReference<>(
				(rv = new EmptyList()));
		
		// Return it
		return (List<V>)rv;
	}
}








|




|







127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
	 * @return The empty list.
	 * @since 2016/04/10
	 */
	@SuppressWarnings({"unchecked"})
	public static <V> List<V> empty()
	{
		// Get reference
		Reference<List> ref = EmptyList._EMPTY_LIST;
		List rv;
		
		// Needs creation?
		if (ref == null || null == (rv = ref.get()))
			EmptyList._EMPTY_LIST = new WeakReference<>(
				(rv = new EmptyList()));
		
		// Return it
		return (List<V>)rv;
	}
}

Name change from runt/libs/collections/net/multiphasicapps/collections/EmptyMap.java to modules/collections/src/main/java/net/multiphasicapps/collections/EmptyMap.java.

115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
	 * @return The unmodifiable and empty map.
	 * @since 2016/05/12
	 */
	@SuppressWarnings({"unchecked"})
	public static <K, V> Map<K, V> empty()
	{
		// Get reference
		Reference<Map> ref = _EMPTY_MAP;
		Map rv;
		
		// Needs creation?
		if (ref == null || null == (rv = ref.get()))
			_EMPTY_MAP = new WeakReference<>((rv = new EmptyMap()));
		
		// Return it
		return (Map<K, V>)rv;
	}
}








|




|






115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
	 * @return The unmodifiable and empty map.
	 * @since 2016/05/12
	 */
	@SuppressWarnings({"unchecked"})
	public static <K, V> Map<K, V> empty()
	{
		// Get reference
		Reference<Map> ref = EmptyMap._EMPTY_MAP;
		Map rv;
		
		// Needs creation?
		if (ref == null || null == (rv = ref.get()))
			EmptyMap._EMPTY_MAP = new WeakReference<>((rv = new EmptyMap()));
		
		// Return it
		return (Map<K, V>)rv;
	}
}

Name change from runt/libs/collections/net/multiphasicapps/collections/EmptySet.java to modules/collections/src/main/java/net/multiphasicapps/collections/EmptySet.java.

94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
	 * @return The unmodifiable and empty set.
	 * @since 2016/04/10
	 */
	@SuppressWarnings({"unchecked"})
	public static <V> Set<V> empty()
	{
		// Get reference
		Reference<Set> ref = _EMPTY_SET;
		Set rv;
		
		// Needs creation?
		if (ref == null || null == (rv = ref.get()))
			_EMPTY_SET = new WeakReference<>((rv = new EmptySet()));
		
		// Return it
		return (Set<V>)rv;
	}
}








|




|






94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
	 * @return The unmodifiable and empty set.
	 * @since 2016/04/10
	 */
	@SuppressWarnings({"unchecked"})
	public static <V> Set<V> empty()
	{
		// Get reference
		Reference<Set> ref = EmptySet._EMPTY_SET;
		Set rv;
		
		// Needs creation?
		if (ref == null || null == (rv = ref.get()))
			EmptySet._EMPTY_SET = new WeakReference<>((rv = new EmptySet()));
		
		// Return it
		return (Set<V>)rv;
	}
}

Name change from runt/libs/collections/net/multiphasicapps/collections/EnumSet.java to modules/collections/src/main/java/net/multiphasicapps/collections/EnumSet.java.

9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// ---------------------------------------------------------------------------

package net.multiphasicapps.collections;

import java.util.AbstractSet;
import java.util.Collection;
import java.util.Iterator;
import java.util.Set;

/**
 * This is a set which allows enumeration values to be stored in it efficiently
 * using only a bit field.
 *
 * @since 2018/03/21
 */







<







9
10
11
12
13
14
15

16
17
18
19
20
21
22
// ---------------------------------------------------------------------------

package net.multiphasicapps.collections;

import java.util.AbstractSet;
import java.util.Collection;
import java.util.Iterator;


/**
 * This is a set which allows enumeration values to be stored in it efficiently
 * using only a bit field.
 *
 * @since 2018/03/21
 */

Name change from runt/libs/collections/net/multiphasicapps/collections/IdentityHashSet.java to modules/collections/src/main/java/net/multiphasicapps/collections/IdentityHashSet.java.

Name change from runt/libs/collections/net/multiphasicapps/collections/IdentityLinkedHashSet.java to modules/collections/src/main/java/net/multiphasicapps/collections/IdentityLinkedHashSet.java.

Name change from runt/libs/collections/net/multiphasicapps/collections/IntegerList.java to modules/collections/src/main/java/net/multiphasicapps/collections/IntegerList.java.

9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// ---------------------------------------------------------------------------

package net.multiphasicapps.collections;

import java.util.AbstractList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.RandomAccess;

/**
 * This is a list of integers which is backed by a primitive array rather than
 * boxed types.
 *
 * @since 2017/11/26







<
<







9
10
11
12
13
14
15


16
17
18
19
20
21
22
// ---------------------------------------------------------------------------

package net.multiphasicapps.collections;

import java.util.AbstractList;
import java.util.Arrays;
import java.util.Collection;


import java.util.RandomAccess;

/**
 * This is a list of integers which is backed by a primitive array rather than
 * boxed types.
 *
 * @since 2017/11/26
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
		int[] values = this._values;
		int nvalues = (values == null ? 0 : values.length),
			size = this._size;
		
		// Need a larger array?
		if ((realloced = (size + 1 > nvalues)))
			if (values == null)
				values = new int[_GROW_SIZE];
			else
				values = Arrays.copyOf(values, nvalues + _GROW_SIZE);
		
		// Move all values up
		for (int o = size; o > __i; o++)
			values[o] = values[o - 1];
		
		// Set this index
		values[__i] = __v;







|

|







150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
		int[] values = this._values;
		int nvalues = (values == null ? 0 : values.length),
			size = this._size;
		
		// Need a larger array?
		if ((realloced = (size + 1 > nvalues)))
			if (values == null)
				values = new int[IntegerList._GROW_SIZE];
			else
				values = Arrays.copyOf(values, nvalues + IntegerList._GROW_SIZE);
		
		// Move all values up
		for (int o = size; o > __i; o++)
			values[o] = values[o - 1];
		
		// Set this index
		values[__i] = __v;

Name change from runt/libs/collections/net/multiphasicapps/collections/MultiSetDeque.java to modules/collections/src/main/java/net/multiphasicapps/collections/MultiSetDeque.java.

40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
	private final List<__Sub__<V>> _subs =
		new ArrayList<>();
	
	/** The master set of added elements. */
	final Set<V> _master =
		new HashSet<>();
	
	/**
	 * Initializes the multi set deque with the specified number of internal
	 * queues.
	 *
	 * @since 2016/09/03
	 */
	public MultiSetDeque()
	{
	}
	
	/**
	 * Clears the multi-set deque and every sub-deque so that all are empty.
	 *
	 * @since 2017/03/25
	 */
	public final void clear()
	{







<
<
<
<
<
<
<
<
<
<







40
41
42
43
44
45
46










47
48
49
50
51
52
53
	private final List<__Sub__<V>> _subs =
		new ArrayList<>();
	
	/** The master set of added elements. */
	final Set<V> _master =
		new HashSet<>();
	










	/**
	 * Clears the multi-set deque and every sub-deque so that all are empty.
	 *
	 * @since 2017/03/25
	 */
	public final void clear()
	{
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
	 * Returns a new sub-{@link Deque} which acts as part of the multi-deque.
	 *
	 * @return A new deque which shares the set restrictions.
	 * @since 2016/09/03
	 */
	public final Deque<V> subDeque()
	{
		return subDeque(Integer.MAX_VALUE);
	}
	
	/**
	 * Returns a new sub-{@link Deque} which acts as part of the multi-deque
	 * which is initialized using the given collection.
	 *
	 * @param __c The collection to add to the resulting {@link Deque}.
	 * @return A new deque which shares the set restrictions.
	 * @throws NullPointerException On null arguments.
	 * @since 2016/09/15
	 */
	public final Deque<V> subDeque(Collection<V> __c)
		throws NullPointerException
	{
		// Check
		if (__c == null)
			throw new NullPointerException("NARG");
		
		// Create
		Deque<V> rv = subDeque();
		rv.addAll(__c);
		return rv;
	}
	
	/**
	 * Returns a new sub-{@link Deque} which acts as part of the multi-deque
	 * which is limited to the given number of elements.







|



















|







131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
	 * Returns a new sub-{@link Deque} which acts as part of the multi-deque.
	 *
	 * @return A new deque which shares the set restrictions.
	 * @since 2016/09/03
	 */
	public final Deque<V> subDeque()
	{
		return this.subDeque(Integer.MAX_VALUE);
	}
	
	/**
	 * Returns a new sub-{@link Deque} which acts as part of the multi-deque
	 * which is initialized using the given collection.
	 *
	 * @param __c The collection to add to the resulting {@link Deque}.
	 * @return A new deque which shares the set restrictions.
	 * @throws NullPointerException On null arguments.
	 * @since 2016/09/15
	 */
	public final Deque<V> subDeque(Collection<V> __c)
		throws NullPointerException
	{
		// Check
		if (__c == null)
			throw new NullPointerException("NARG");
		
		// Create
		Deque<V> rv = this.subDeque();
		rv.addAll(__c);
		return rv;
	}
	
	/**
	 * Returns a new sub-{@link Deque} which acts as part of the multi-deque
	 * which is limited to the given number of elements.

Name change from runt/libs/collections/net/multiphasicapps/collections/NaturalComparator.java to modules/collections/src/main/java/net/multiphasicapps/collections/NaturalComparator.java.

63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
	 * @param <V> The type of value to compare.
	 * @return The instance of the natural comparator.
	 * @since 2016/09/06
	 */
	@SuppressWarnings({"unchecked"})
	public static final <V> NaturalComparator<V> instance()
	{
		Reference<NaturalComparator> ref = _REF;
		NaturalComparator rv;
		
		// Cache?
		if (ref == null || null == (rv = ref.get()))
			_REF = new WeakReference<>((rv = new NaturalComparator()));
		
		// Return it
		return (NaturalComparator<V>)rv;
	}
}








|




|






63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
	 * @param <V> The type of value to compare.
	 * @return The instance of the natural comparator.
	 * @since 2016/09/06
	 */
	@SuppressWarnings({"unchecked"})
	public static final <V> NaturalComparator<V> instance()
	{
		Reference<NaturalComparator> ref = NaturalComparator._REF;
		NaturalComparator rv;
		
		// Cache?
		if (ref == null || null == (rv = ref.get()))
			NaturalComparator._REF = new WeakReference<>((rv = new NaturalComparator()));
		
		// Return it
		return (NaturalComparator<V>)rv;
	}
}

Name change from runt/libs/collections/net/multiphasicapps/collections/SortedTreeMap.java to modules/collections/src/main/java/net/multiphasicapps/collections/SortedTreeMap.java.

9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// ---------------------------------------------------------------------------

package net.multiphasicapps.collections;

import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import java.util.AbstractMap;
import java.util.Collection;
import java.util.Comparator;
import java.util.Map;
import java.util.Set;

/**
 * This is a sorted map which is internally implemented by using
 * {@link SortedTreeSet} and special handlers.







<







9
10
11
12
13
14
15

16
17
18
19
20
21
22
// ---------------------------------------------------------------------------

package net.multiphasicapps.collections;

import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import java.util.AbstractMap;

import java.util.Comparator;
import java.util.Map;
import java.util.Set;

/**
 * This is a sorted map which is internally implemented by using
 * {@link SortedTreeSet} and special handlers.
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
		if (__comp == null || __m == null)
			throw new NullPointerException("NARG");
		
		// Set
		this._compare = (Comparator<K>)__comp;
		
		// Put everything
		putAll(__m);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/09/07
	 */
	@Override







|







115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
		if (__comp == null || __m == null)
			throw new NullPointerException("NARG");
		
		// Set
		this._compare = (Comparator<K>)__comp;
		
		// Put everything
		this.putAll(__m);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/09/07
	 */
	@Override
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
	/**
	 * {@inheritDoc}
	 * @since 2016/09/07
	 */
	@Override
	public boolean containsKey(Object __o)
	{
		return (null != __findNode(__o));
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/09/06
	 */
	@Override







|







137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
	/**
	 * {@inheritDoc}
	 * @since 2016/09/07
	 */
	@Override
	public boolean containsKey(Object __o)
	{
		return (null != this.__findNode(__o));
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/09/06
	 */
	@Override
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
	/**
	 * {@inheritDoc}
	 * @since 2016/09/07
	 */
	@Override
	public V get(Object __k)
	{
		__Node__<K, V> node = __findNode(__k);
		if (node == null)
			return null;
		return node._data._value;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/09/06
	 */
	@Override
	@SuppressWarnings({"unchecked"})
	public V put(K __k, V __v)
	{
		// Insert node
		__Found__ found = new __Found__();
		__Node__<K, V> now = __insert(null, this._root, found, __k, __v);
		
		// The root of the tree always becomes black
		now.__makeBlack();
		this._root = now;
		
		// Old value
		return found._oldvalue;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/03/29
	 */
	@Override
	@SuppressWarnings({"unchecked"})
	public V remove(Object __k)
	{
		// Delete node
		__Found__ found = new __Found__();
		__Node__<K, V> newroot = __remove(this._root, found, (K)__k);
		
		// The root of the tree is always black
		this._root = newroot;
		if (newroot != null)
			newroot._isred = false;
		
		// Old value







|















|



















|







167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
	/**
	 * {@inheritDoc}
	 * @since 2016/09/07
	 */
	@Override
	public V get(Object __k)
	{
		__Node__<K, V> node = this.__findNode(__k);
		if (node == null)
			return null;
		return node._data._value;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/09/06
	 */
	@Override
	@SuppressWarnings({"unchecked"})
	public V put(K __k, V __v)
	{
		// Insert node
		__Found__ found = new __Found__();
		__Node__<K, V> now = this.__insert(null, this._root, found, __k, __v);
		
		// The root of the tree always becomes black
		now.__makeBlack();
		this._root = now;
		
		// Old value
		return found._oldvalue;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/03/29
	 */
	@Override
	@SuppressWarnings({"unchecked"})
	public V remove(Object __k)
	{
		// Delete node
		__Found__ found = new __Found__();
		__Node__<K, V> newroot = this.__remove(this._root, found, (K)__k);
		
		// The root of the tree is always black
		this._root = newroot;
		if (newroot != null)
			newroot._isred = false;
		
		// Old value
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
		throws NullPointerException
	{
		// Check
		if (__at == null)
			throw new NullPointerException("NARG");
		
		// Rotate right side value to the left
		if (__isRed(__at._right))
			__at = __rotate(__at, _LEFT);
		
		// If there are a bunch of dangling red nodes on the left balance
		// them
		if (__isRed(__at._left) && __isRed(__at._left._left))
			__at = __rotate(__at, _RIGHT);
		
		// If both side nodes are red then flip the color of this node
		if (__isRed(__at._left) && __isRed(__at._right))
			__flipColor(__at);
		
		// Return current node
		return __at;
	}
	
	/**
	 * Finds the node with the given value.
	 *
	 * @param __o The object to find.
	 * @return The node for the given object or {@code null} if it was not
	 * found.
	 * @since 2016/09/06
	 */
	final __Node__<K, V> __findNode(Object __o)
	{
		// If there are no nodes then the tree is empty
		__Node__<K, V> rover = this._root;
		if (rover == null)
			return null;
		
		return __findNode(rover, __o);
	}
	
	/**
	 * Finds the node with the given key starting at the specified node.
	 *
	 * @param __at The node to start at.
	 * @param __k The key to find.







|
|



|
|


|
|




















|







240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
		throws NullPointerException
	{
		// Check
		if (__at == null)
			throw new NullPointerException("NARG");
		
		// Rotate right side value to the left
		if (this.__isRed(__at._right))
			__at = this.__rotate(__at, SortedTreeMap._LEFT);
		
		// If there are a bunch of dangling red nodes on the left balance
		// them
		if (this.__isRed(__at._left) && this.__isRed(__at._left._left))
			__at = this.__rotate(__at, SortedTreeMap._RIGHT);
		
		// If both side nodes are red then flip the color of this node
		if (this.__isRed(__at._left) && this.__isRed(__at._right))
			this.__flipColor(__at);
		
		// Return current node
		return __at;
	}
	
	/**
	 * Finds the node with the given value.
	 *
	 * @param __o The object to find.
	 * @return The node for the given object or {@code null} if it was not
	 * found.
	 * @since 2016/09/06
	 */
	final __Node__<K, V> __findNode(Object __o)
	{
		// If there are no nodes then the tree is empty
		__Node__<K, V> rover = this._root;
		if (rover == null)
			return null;
		
		return this.__findNode(rover, __o);
	}
	
	/**
	 * Finds the node with the given key starting at the specified node.
	 *
	 * @param __at The node to start at.
	 * @param __k The key to find.
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
		{
			__found._oldvalue = __at._data._value;
			__at._data._value = __v;
		}
		
		// Less than
		else if (comp < 0)
			__at._left = __insert(__at, __at._left, __found, __k, __v);
		
		// Greater
		else
			__at._right = __insert(__at, __at._right, __found, __k, __v);
		
		// Correct nodes going back up
		return __correctNodes(__at);
	}
	
	/**
	 * Returns {@code true} if the given node is red.
	 *
	 * @param __n The node to see if it is red.
	 * @return {@code true} if the node is red.







|



|


|







423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
		{
			__found._oldvalue = __at._data._value;
			__at._data._value = __v;
		}
		
		// Less than
		else if (comp < 0)
			__at._left = this.__insert(__at, __at._left, __found, __k, __v);
		
		// Greater
		else
			__at._right = this.__insert(__at, __at._right, __found, __k, __v);
		
		// Correct nodes going back up
		return this.__correctNodes(__at);
	}
	
	/**
	 * Returns {@code true} if the given node is red.
	 *
	 * @param __n The node to see if it is red.
	 * @return {@code true} if the node is red.
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
	 * @param __at The node to move.
	 * @return The node that is not a side node.
	 * @since 2017/03/30
	 */
	private final __Node__<K, V> __moveRed(__Node__<K, V> __at, boolean __r)
	{
		// Flip the node color
		__flipColor(__at);
		
		// Move to the right
		if (__r)
		{
			if (__isRed(__at._left._left))
			{
				__at = __rotate(__at, _RIGHT);
			
				__flipColor(__at);
			}
		}
		
		// Move to the left
		else
		{
			if (__isRed(__at._right._left))
			{
				__at._right = __rotate(__at._right, _RIGHT);
				__at = __rotate(__at, _LEFT);
				
				__flipColor(__at);
			}
		}
		
		// This would be the node at the top
		return __at;
	}
	







|




|

|
|
|






|

|
|

|







470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
	 * @param __at The node to move.
	 * @return The node that is not a side node.
	 * @since 2017/03/30
	 */
	private final __Node__<K, V> __moveRed(__Node__<K, V> __at, boolean __r)
	{
		// Flip the node color
		this.__flipColor(__at);
		
		// Move to the right
		if (__r)
		{
			if (this.__isRed(__at._left._left))
			{
				__at = this.__rotate(__at, SortedTreeMap._RIGHT);
				
				this.__flipColor(__at);
			}
		}
		
		// Move to the left
		else
		{
			if (this.__isRed(__at._right._left))
			{
				__at._right = this.__rotate(__at._right, SortedTreeMap._RIGHT);
				__at = this.__rotate(__at, SortedTreeMap._LEFT);
				
				this.__flipColor(__at);
			}
		}
		
		// This would be the node at the top
		return __at;
	}
	
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
	{
		// Key is lower?
		Comparator<K> compare = this._compare;
		int comp = compare.compare(__k, __at._data._key);
		if (comp < 0)
		{
			// Move red node to the left
			if (!__isRed(__at._left) && !__isRed(__at._left._left))
				__at = __moveRed(__at, _LEFT);
			
			// Delete left side
			__at._left = __remove(__at._left, __found, __k);
		}
		
		// Equal or higher
		else
		{
			// If the left is red then rotate it to the right
			if (__isRed(__at._left))
			{
				__at = __rotate(__at, _RIGHT);
				
				// Compare value is trashed, recompute
				comp = compare.compare(__k, __at._data._key);
			}
			
			// If this is the key and there is no right then no values need
			// to be shifted in
			if (comp == 0 && __at._right == null)
			{
				__unlink(__at, __found);
				
				// Return no key
				return null;
			}
			
			// If the red side contains a black chain move red nodes to the
			// right
			if (!__isRed(__at._right) && !__isRed(__at._right._left))
			{
				__at = __moveRed(__at, _RIGHT);
				
				// Comparison is trashed
				comp = compare.compare(__k, __at._data._key);
			}
			
			// Keys are the same
			if (comp == 0)
			{
				// Get the node with the minimum value on the right side
				__Node__<K, V> right = __at._right;
				__Node__<K, V> minright = __min(right);
				
				// Unlink the current data because that is getting destroyed
				__unlink(__at, __found);
				
				// The current node gets the data for that key
				__at._data = minright._data;
				
				// Remove the minimum without unlinking (because it gets
				// re-associated)
				__removeMin(right, null, false);
			}
			
			// Delete right side of the tree
			else
				__at._right = __remove(__at._right, __found, __k);
		}
		
		// Correct tree on the way up
		return __correctNodes(__at);
	}
	
	/**
	 * Removes the minimum node.
	 *
	 * @param __at Current node.
	 * @param __found The found node information.
	 * @param __unlink If {@code true} the node is unlinked.
	 * @return The top node.
	 * @since 2017/03/30
	 */
	private final __Node__<K, V> __removeMin(__Node__<K, V> __at,
		__Found__ __found, boolean __unlink)
	{
		// If there is no left, remove the left node
		if (__at._left == null)
		{
			// Unlink our node
			if (__unlink)
				__unlink(__at, __found);
			
			// No left node
			return null;
		}
		
		// If the left side is black move red to the left
		if (!__isRed(__at._left) && !__isRed(__at._left._left))
			__at = __moveRed(__at, _LEFT);
		
		// Continue deleting the minimum
		__at._left = __removeMin(__at, __found, __unlink);
		
		// Correct nodes back up the tree
		return __correctNodes(__at);
	}
	
	/**
	 * Rotates the nodes in the given direction.
	 *
	 * @param __at The node to rotate.
	 * @param __r If {@code true} then rotation is to the right, otherwise it







|
|


|






|

|









|







|

|










|


|






|




|



|



















|






|
|


|


|







517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
	{
		// Key is lower?
		Comparator<K> compare = this._compare;
		int comp = compare.compare(__k, __at._data._key);
		if (comp < 0)
		{
			// Move red node to the left
			if (!this.__isRed(__at._left) && !this.__isRed(__at._left._left))
				__at = this.__moveRed(__at, SortedTreeMap._LEFT);
			
			// Delete left side
			__at._left = this.__remove(__at._left, __found, __k);
		}
		
		// Equal or higher
		else
		{
			// If the left is red then rotate it to the right
			if (this.__isRed(__at._left))
			{
				__at = this.__rotate(__at, SortedTreeMap._RIGHT);
				
				// Compare value is trashed, recompute
				comp = compare.compare(__k, __at._data._key);
			}
			
			// If this is the key and there is no right then no values need
			// to be shifted in
			if (comp == 0 && __at._right == null)
			{
				this.__unlink(__at, __found);
				
				// Return no key
				return null;
			}
			
			// If the red side contains a black chain move red nodes to the
			// right
			if (!this.__isRed(__at._right) && !this.__isRed(__at._right._left))
			{
				__at = this.__moveRed(__at, SortedTreeMap._RIGHT);
				
				// Comparison is trashed
				comp = compare.compare(__k, __at._data._key);
			}
			
			// Keys are the same
			if (comp == 0)
			{
				// Get the node with the minimum value on the right side
				__Node__<K, V> right = __at._right;
				__Node__<K, V> minright = this.__min(right);
				
				// Unlink the current data because that is getting destroyed
				this.__unlink(__at, __found);
				
				// The current node gets the data for that key
				__at._data = minright._data;
				
				// Remove the minimum without unlinking (because it gets
				// re-associated)
				this.__removeMin(right, null, false);
			}
			
			// Delete right side of the tree
			else
				__at._right = this.__remove(__at._right, __found, __k);
		}
		
		// Correct tree on the way up
		return this.__correctNodes(__at);
	}
	
	/**
	 * Removes the minimum node.
	 *
	 * @param __at Current node.
	 * @param __found The found node information.
	 * @param __unlink If {@code true} the node is unlinked.
	 * @return The top node.
	 * @since 2017/03/30
	 */
	private final __Node__<K, V> __removeMin(__Node__<K, V> __at,
		__Found__ __found, boolean __unlink)
	{
		// If there is no left, remove the left node
		if (__at._left == null)
		{
			// Unlink our node
			if (__unlink)
				this.__unlink(__at, __found);
			
			// No left node
			return null;
		}
		
		// If the left side is black move red to the left
		if (!this.__isRed(__at._left) && !this.__isRed(__at._left._left))
			__at = this.__moveRed(__at, SortedTreeMap._LEFT);
		
		// Continue deleting the minimum
		__at._left = this.__removeMin(__at, __found, __unlink);
		
		// Correct nodes back up the tree
		return this.__correctNodes(__at);
	}
	
	/**
	 * Rotates the nodes in the given direction.
	 *
	 * @param __at The node to rotate.
	 * @param __r If {@code true} then rotation is to the right, otherwise it
704
705
706
707
708
709
710




711
712
713
	 * The data which used to be at the given position.
	 *
	 * @since 2017/03/30
	 */
	private final class __Found__
	{
		V _oldvalue;




	}
}








>
>
>
>



703
704
705
706
707
708
709
710
711
712
713
714
715
716
	 * The data which used to be at the given position.
	 *
	 * @since 2017/03/30
	 */
	private final class __Found__
	{
		V _oldvalue;
		
		__Found__()
		{
		}
	}
}

Name change from runt/libs/collections/net/multiphasicapps/collections/SortedTreeSet.java to modules/collections/src/main/java/net/multiphasicapps/collections/SortedTreeSet.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.collections;

import java.util.AbstractSet;
import java.util.ArrayDeque;
import java.util.Collection;
import java.util.Comparator;
import java.util.Deque;
import java.util.Iterator;
import java.util.Objects;
import java.util.Set;

/**
 * This is a sorted {@link Set} which internally uses a red-black tree to sort
 * the entries.
 *
 * The algorithm is derived from Robert Sedgewick's (of Princeton University)













<


<

<







1
2
3
4
5
6
7
8
9
10
11
12
13

14
15

16

17
18
19
20
21
22
23
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.collections;

import java.util.AbstractSet;

import java.util.Collection;
import java.util.Comparator;

import java.util.Iterator;

import java.util.Set;

/**
 * This is a sorted {@link Set} which internally uses a red-black tree to sort
 * the entries.
 *
 * The algorithm is derived from Robert Sedgewick's (of Princeton University)
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118

119
120
121
122
123
124
125
		if (__comp == null || __s == null)
			throw new NullPointerException("NARG");
		
		// Set
		this._map = new SortedTreeMap<>(__comp);
		
		// Just call add all from collection
		addAll(__s);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/09/06
	 */
	@Override
	public boolean add(V __v)
	{
		return (_HAS_VALUE != this._map.put(__v, _HAS_VALUE));

	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/09/06
	 */
	@Override







|









|
>







98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
		if (__comp == null || __s == null)
			throw new NullPointerException("NARG");
		
		// Set
		this._map = new SortedTreeMap<>(__comp);
		
		// Just call add all from collection
		this.addAll(__s);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/09/06
	 */
	@Override
	public boolean add(V __v)
	{
		return (SortedTreeSet._HAS_VALUE != this._map.put(__v,
			SortedTreeSet._HAS_VALUE));
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/09/06
	 */
	@Override
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
	 * {@inheritDoc}
	 * @since 2016/09/06
	 */
	@Override
	public boolean remove(Object __o)
	{
		Object q = this._map.remove(__o);
		return (q == _HAS_VALUE);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/09/06
	 */
	@Override
	public int size()
	{
		return this._map.size();
	}
}








|













150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
	 * {@inheritDoc}
	 * @since 2016/09/06
	 */
	@Override
	public boolean remove(Object __o)
	{
		Object q = this._map.remove(__o);
		return (q == SortedTreeSet._HAS_VALUE);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/09/06
	 */
	@Override
	public int size()
	{
		return this._map.size();
	}
}

Name change from runt/libs/collections/net/multiphasicapps/collections/UnmodifiableArrayIterator.java to modules/collections/src/main/java/net/multiphasicapps/collections/UnmodifiableArrayIterator.java.

97
98
99
100
101
102
103

104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121

122
123
124
125
126
127
128
	{
		throw new UnsupportedOperationException("RORO");
	}
	
	/**
	 * Wraps the given array.
	 *

	 * @param __a The array to wrap.
	 * @return The iterator for the array.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/05/13
	 */
	@SuppressWarnings({"unchecked"})
	public static <T> Iterator<T> of(T... __a)
		throws NullPointerException
	{
		if (__a == null)
			throw new NullPointerException("NARG");
		
		return new UnmodifiableArrayIterator<T>(__a, 0, __a.length);
	}
	
	/**
	 * Wraps the given array.
	 *

	 * @param __a The input array.
	 * @param __o The offset into the array.
	 * @param __l The number of elements to read.
	 * @throws ArrayIndexOutOfBoundsException If the offset and/or length are
	 * negative or exceed the array bounds.
	 * @return The iterator for the array.
	 * @throws NullPointerException On null arguments.







>


















>







97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
	{
		throw new UnsupportedOperationException("RORO");
	}
	
	/**
	 * Wraps the given array.
	 *
	 * @param <T> The iterator type.
	 * @param __a The array to wrap.
	 * @return The iterator for the array.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/05/13
	 */
	@SuppressWarnings({"unchecked"})
	public static <T> Iterator<T> of(T... __a)
		throws NullPointerException
	{
		if (__a == null)
			throw new NullPointerException("NARG");
		
		return new UnmodifiableArrayIterator<T>(__a, 0, __a.length);
	}
	
	/**
	 * Wraps the given array.
	 *
	 * @param <T> The iterator type.
	 * @param __a The input array.
	 * @param __o The offset into the array.
	 * @param __l The number of elements to read.
	 * @throws ArrayIndexOutOfBoundsException If the offset and/or length are
	 * negative or exceed the array bounds.
	 * @return The iterator for the array.
	 * @throws NullPointerException On null arguments.

Name change from runt/libs/collections/net/multiphasicapps/collections/UnmodifiableArrayList.java to modules/collections/src/main/java/net/multiphasicapps/collections/UnmodifiableArrayList.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.collections;

import java.util.AbstractList;
import java.util.RandomAccess;
import java.util.List;

/**
 * This is a list representation of an array which cannot be modified.
 *
 * @param <T> The type of values to store.
 * @since 2018/05/13
 */













|
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.collections;

import java.util.AbstractList;
import java.util.List;
import java.util.RandomAccess;

/**
 * This is a list representation of an array which cannot be modified.
 *
 * @param <T> The type of values to store.
 * @since 2018/05/13
 */
80
81
82
83
84
85
86

87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104

105
106
107
108
109
110
111
	{
		return this.length;
	}
	
	/**
	 * Wraps the given array.
	 *

	 * @param __a The array to wrap.
	 * @return The iterator for the array.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/05/13
	 */
	@SuppressWarnings({"unchecked"})
	public static <T> List<T> of(T... __a)
		throws NullPointerException
	{
		if (__a == null)
			throw new NullPointerException("NARG");
		
		return new UnmodifiableArrayList<T>(__a, 0, __a.length);
	}
	
	/**
	 * Wraps the given array.
	 *

	 * @param __a The input array.
	 * @param __o The offset into the array.
	 * @param __l The number of elements to read.
	 * @throws ArrayIndexOutOfBoundsException If the offset and/or length are
	 * negative or exceed the array bounds.
	 * @return The iterator for the array.
	 * @throws NullPointerException On null arguments.







>


















>







80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
	{
		return this.length;
	}
	
	/**
	 * Wraps the given array.
	 *
	 * @param <T> The list type.
	 * @param __a The array to wrap.
	 * @return The iterator for the array.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/05/13
	 */
	@SuppressWarnings({"unchecked"})
	public static <T> List<T> of(T... __a)
		throws NullPointerException
	{
		if (__a == null)
			throw new NullPointerException("NARG");
		
		return new UnmodifiableArrayList<T>(__a, 0, __a.length);
	}
	
	/**
	 * Wraps the given array.
	 *
	 * @param <T> The list type.
	 * @param __a The input array.
	 * @param __o The offset into the array.
	 * @param __l The number of elements to read.
	 * @throws ArrayIndexOutOfBoundsException If the offset and/or length are
	 * negative or exceed the array bounds.
	 * @return The iterator for the array.
	 * @throws NullPointerException On null arguments.

Name change from runt/libs/collections/net/multiphasicapps/collections/UnmodifiableCollection.java to modules/collections/src/main/java/net/multiphasicapps/collections/UnmodifiableCollection.java.

38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
		throws NullPointerException
	{
		// Check
		if (__w == null)
			throw new NullPointerException("NARG");
		
		// Wrap it
		wrapped = __w;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/10/09
	 */
	@Override
	public boolean contains(Object __o)
	{
		return wrapped.contains(__o);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/10/09
	 */
	@Override
	public boolean isEmpty()
	{
		return wrapped.isEmpty();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/10/09
	 */
	@Override
	public Iterator<T> iterator()
	{
		return new Iterator<T>()
			{
				/** The base iterator. */
				final Iterator<T> _base =
					wrapped.iterator();
				
				/**
				 * {@inheritDoc}
				 * @since 2017/10/09
				 */
				@Override
				public boolean hasNext()
				{
					return _base.hasNext();
				}
				
				/**
				 * {@inheritDoc}
				 * @since 2017/10/09
				 */
				@Override
				public T next()
				{
					return _base.next();
				}
				
				/**
				 * {@inheritDoc}
				 * @since 2017/10/09
				 */
				@Override







|









|









|












|
<








|









|







38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78

79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
		throws NullPointerException
	{
		// Check
		if (__w == null)
			throw new NullPointerException("NARG");
		
		// Wrap it
		this.wrapped = __w;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/10/09
	 */
	@Override
	public boolean contains(Object __o)
	{
		return this.wrapped.contains(__o);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/10/09
	 */
	@Override
	public boolean isEmpty()
	{
		return this.wrapped.isEmpty();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/10/09
	 */
	@Override
	public Iterator<T> iterator()
	{
		return new Iterator<T>()
			{
				/** The base iterator. */
				final Iterator<T> _base = UnmodifiableCollection.this.wrapped.iterator();

				
				/**
				 * {@inheritDoc}
				 * @since 2017/10/09
				 */
				@Override
				public boolean hasNext()
				{
					return this._base.hasNext();
				}
				
				/**
				 * {@inheritDoc}
				 * @since 2017/10/09
				 */
				@Override
				public T next()
				{
					return this._base.next();
				}
				
				/**
				 * {@inheritDoc}
				 * @since 2017/10/09
				 */
				@Override
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
	/**
	 * {@inheritDoc}
	 * @since 2017/10/09
	 */
	@Override
	public int size()
	{
		return wrapped.size();
	}
	
	/**
	 * This creates a view of the specified collection which cannot be
	 * modified.
	 *
	 * @param <T> The type of value the set stores.







|







112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
	/**
	 * {@inheritDoc}
	 * @since 2017/10/09
	 */
	@Override
	public int size()
	{
		return this.wrapped.size();
	}
	
	/**
	 * This creates a view of the specified collection which cannot be
	 * modified.
	 *
	 * @param <T> The type of value the set stores.

Name change from runt/libs/collections/net/multiphasicapps/collections/UnmodifiableIterator.java to modules/collections/src/main/java/net/multiphasicapps/collections/UnmodifiableIterator.java.

73
74
75
76
77
78
79

80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96

97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113

114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131

132
133
134
135
136
137
138
	{
		throw new UnsupportedOperationException("RORO");
	}
	
	/**
	 * Wraps the given iterable.
	 *

	 * @param __i The iterable to wrap.
	 * @return The wrapped iterator.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/05/13
	 */
	public static <T> Iterator<T> of(Iterable<T> __i)
		throws NullPointerException
	{
		if (__i == null)
			throw new NullPointerException("NARG");
		
		return new UnmodifiableIterator<T>(__i.iterator());
	}
	
	/**
	 * Wraps the given iterator.
	 *

	 * @param __i The iterator to wrap.
	 * @return The wrapped iterator.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/05/13
	 */
	public static <T> Iterator<T> of(Iterator<T> __i)
		throws NullPointerException
	{
		if (__i == null)
			throw new NullPointerException("NARG");
		
		return new UnmodifiableIterator<T>(__i);
	}
	
	/**
	 * Wraps the given array.
	 *

	 * @param __a The array to wrap.
	 * @return The iterator for the array.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/05/13
	 */
	@SuppressWarnings({"unchecked"})
	public static <T> Iterator<T> of(T... __a)
		throws NullPointerException
	{
		if (__a == null)
			throw new NullPointerException("NARG");
		
		return new UnmodifiableArrayIterator<T>(__a, 0, __a.length);
	}
	
	/**
	 * Wraps the given array.
	 *

	 * @param __a The input array.
	 * @param __o The offset into the array.
	 * @param __l The number of elements to read.
	 * @throws ArrayIndexOutOfBoundsException If the offset and/or length are
	 * negative or exceed the array bounds.
	 * @return The iterator for the array.
	 * @throws NullPointerException On null arguments.







>

















>

















>


















>







73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
	{
		throw new UnsupportedOperationException("RORO");
	}
	
	/**
	 * Wraps the given iterable.
	 *
	 * @param <T> The iterator type.
	 * @param __i The iterable to wrap.
	 * @return The wrapped iterator.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/05/13
	 */
	public static <T> Iterator<T> of(Iterable<T> __i)
		throws NullPointerException
	{
		if (__i == null)
			throw new NullPointerException("NARG");
		
		return new UnmodifiableIterator<T>(__i.iterator());
	}
	
	/**
	 * Wraps the given iterator.
	 *
	 * @param <T> The iterator type.
	 * @param __i The iterator to wrap.
	 * @return The wrapped iterator.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/05/13
	 */
	public static <T> Iterator<T> of(Iterator<T> __i)
		throws NullPointerException
	{
		if (__i == null)
			throw new NullPointerException("NARG");
		
		return new UnmodifiableIterator<T>(__i);
	}
	
	/**
	 * Wraps the given array.
	 *
	 * @param <T> The iterator type.
	 * @param __a The array to wrap.
	 * @return The iterator for the array.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/05/13
	 */
	@SuppressWarnings({"unchecked"})
	public static <T> Iterator<T> of(T... __a)
		throws NullPointerException
	{
		if (__a == null)
			throw new NullPointerException("NARG");
		
		return new UnmodifiableArrayIterator<T>(__a, 0, __a.length);
	}
	
	/**
	 * Wraps the given array.
	 *
	 * @param <T> The iterator type.
	 * @param __a The input array.
	 * @param __o The offset into the array.
	 * @param __l The number of elements to read.
	 * @throws ArrayIndexOutOfBoundsException If the offset and/or length are
	 * negative or exceed the array bounds.
	 * @return The iterator for the array.
	 * @throws NullPointerException On null arguments.

Name change from runt/libs/collections/net/multiphasicapps/collections/UnmodifiableList.java to modules/collections/src/main/java/net/multiphasicapps/collections/UnmodifiableList.java.

39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112

113
114
115
116
117
118
119
		throws NullPointerException
	{
		// Check
		if (__l == null)
			throw new NullPointerException("NARG");
		
		// Set
		wrapped = __l;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/05/12
	 */
	@Override
	public boolean contains(Object __o)
	{
		return wrapped.contains(__o);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/03/03
	 */
	@Override
	public final V get(int __i)
	{
		return wrapped.get(__i);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/05/12
	 */
	@Override
	public int indexOf(Object __o)
	{
		return wrapped.indexOf(__o);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/05/12
	 */
	@Override
	public boolean isEmpty()
	{
		return wrapped.isEmpty();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/05/12
	 */
	@Override
	public int lastIndexOf(Object __o)
	{
		return wrapped.lastIndexOf(__o);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/03/03
	 */
	@Override
	public final int size()
	{
		return wrapped.size();
	}
	
	/**
	 * This creates a view of the specified list which cannot be modified.
	 *
	 * @param <V> The type of value stored in the list.

	 * @return An unmodifiable view of the list.
	 * @since 2016/03/03
	 */
	public static <V> List<V> of(List<V> __l)
	{
		// If already one, return it
		if (__l instanceof UnmodifiableList)







|









|









|









|









|









|









|






>







39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
		throws NullPointerException
	{
		// Check
		if (__l == null)
			throw new NullPointerException("NARG");
		
		// Set
		this.wrapped = __l;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/05/12
	 */
	@Override
	public boolean contains(Object __o)
	{
		return this.wrapped.contains(__o);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/03/03
	 */
	@Override
	public final V get(int __i)
	{
		return this.wrapped.get(__i);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/05/12
	 */
	@Override
	public int indexOf(Object __o)
	{
		return this.wrapped.indexOf(__o);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/05/12
	 */
	@Override
	public boolean isEmpty()
	{
		return this.wrapped.isEmpty();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/05/12
	 */
	@Override
	public int lastIndexOf(Object __o)
	{
		return this.wrapped.lastIndexOf(__o);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/03/03
	 */
	@Override
	public final int size()
	{
		return this.wrapped.size();
	}
	
	/**
	 * This creates a view of the specified list which cannot be modified.
	 *
	 * @param <V> The type of value stored in the list.
	 * @param __l The list to view.
	 * @return An unmodifiable view of the list.
	 * @since 2016/03/03
	 */
	public static <V> List<V> of(List<V> __l)
	{
		// If already one, return it
		if (__l instanceof UnmodifiableList)
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
			throws NullPointerException
		{
			// Check
			if (__li == null)
				throw new NullPointerException("NARG");
			
			// Set
			li = __li;
		}
		
		/**
		 * {@inheritDoc}
		 * @since 2016/05/12
		 */
		@Override
		public void add(V __e)
		{
			throw new UnsupportedOperationException("RORO");
		}
		
		/**
		 * {@inheritDoc}
		 * @since 2016/05/12
		 */
		@Override
		public boolean hasNext()
		{
			return li.hasNext();
		}
		
		/**
		 * {@inheritDoc}
		 * @since 2016/05/12
		 */
		@Override
		public boolean hasPrevious()
		{
			return li.hasPrevious();
		}
		
		/**
		 * {@inheritDoc}
		 * @since 2016/05/12
		 */
		@Override
		public V next()
		{
			return li.next();
		}
		
		/**
		 * {@inheritDoc}
		 * @since 2016/05/12
		 */
		@Override
		public int nextIndex()
		{
			return li.nextIndex();
		}
		
		/**
		 * {@inheritDoc}
		 * @since 2016/05/12
		 */
		@Override
		public V previous()
		{
			return li.previous();
		}
		
		/**
		 * {@inheritDoc}
		 * @since 2016/05/12
		 */
		@Override
		public int previousIndex()
		{
			return li.previousIndex();
		}
		
		/**
		 * {@inheritDoc}
		 * @since 2016/05/12
		 */
		@Override







|



















|









|









|









|









|









|







150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
			throws NullPointerException
		{
			// Check
			if (__li == null)
				throw new NullPointerException("NARG");
			
			// Set
			this.li = __li;
		}
		
		/**
		 * {@inheritDoc}
		 * @since 2016/05/12
		 */
		@Override
		public void add(V __e)
		{
			throw new UnsupportedOperationException("RORO");
		}
		
		/**
		 * {@inheritDoc}
		 * @since 2016/05/12
		 */
		@Override
		public boolean hasNext()
		{
			return this.li.hasNext();
		}
		
		/**
		 * {@inheritDoc}
		 * @since 2016/05/12
		 */
		@Override
		public boolean hasPrevious()
		{
			return this.li.hasPrevious();
		}
		
		/**
		 * {@inheritDoc}
		 * @since 2016/05/12
		 */
		@Override
		public V next()
		{
			return this.li.next();
		}
		
		/**
		 * {@inheritDoc}
		 * @since 2016/05/12
		 */
		@Override
		public int nextIndex()
		{
			return this.li.nextIndex();
		}
		
		/**
		 * {@inheritDoc}
		 * @since 2016/05/12
		 */
		@Override
		public V previous()
		{
			return this.li.previous();
		}
		
		/**
		 * {@inheritDoc}
		 * @since 2016/05/12
		 */
		@Override
		public int previousIndex()
		{
			return this.li.previousIndex();
		}
		
		/**
		 * {@inheritDoc}
		 * @since 2016/05/12
		 */
		@Override
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
		/**
		 * {@inheritDoc}
		 * @since 2016/05/12
		 */
		@Override
		public Iterator<V> iterator()
		{
			return listIterator();
		}
		
		/**
		 * {@inheritDoc}
		 * @since 2016/05/12
		 */
		@Override
		public ListIterator<V> listIterator()
		{
			return listIterator(0);
		}
		
		/**
		 * {@inheritDoc}
		 * @since 2016/05/12
		 */
		@Override
		public ListIterator<V> listIterator(int __i)
		{
			return new __ListIterator__<V>(wrapped.listIterator(__i));
		}
	}
}








|









|









|




297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
		/**
		 * {@inheritDoc}
		 * @since 2016/05/12
		 */
		@Override
		public Iterator<V> iterator()
		{
			return this.listIterator();
		}
		
		/**
		 * {@inheritDoc}
		 * @since 2016/05/12
		 */
		@Override
		public ListIterator<V> listIterator()
		{
			return this.listIterator(0);
		}
		
		/**
		 * {@inheritDoc}
		 * @since 2016/05/12
		 */
		@Override
		public ListIterator<V> listIterator(int __i)
		{
			return new __ListIterator__<V>(this.wrapped.listIterator(__i));
		}
	}
}

Name change from runt/libs/collections/net/multiphasicapps/collections/UnmodifiableMap.java to modules/collections/src/main/java/net/multiphasicapps/collections/UnmodifiableMap.java.

12
13
14
15
16
17
18
19
20
21
22
23
24
25
26

import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import java.util.AbstractMap;
import java.util.AbstractSet;
import java.util.Iterator;
import java.util.Map;
import java.util.NoSuchElementException;
import java.util.Set;

/**
 * This is a map which cannot be modified.
 *
 * @param <K> Key type to use.
 * @param <V> Value type to store.







<







12
13
14
15
16
17
18

19
20
21
22
23
24
25

import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import java.util.AbstractMap;
import java.util.AbstractSet;
import java.util.Iterator;
import java.util.Map;

import java.util.Set;

/**
 * This is a map which cannot be modified.
 *
 * @param <K> Key type to use.
 * @param <V> Value type to store.
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
		throws NullPointerException
	{
		// Check
		if (__w == null)
			throw new NullPointerException("NARG");
		
		// Set
		wrapped = __w;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/02/29
	 */
	@Override
	public boolean containsKey(Object __o)
	{
		return wrapped.containsKey(__o);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/05/12
	 */
	@Override
	public boolean containsValue(Object __o)
	{
		return wrapped.containsValue(__o);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/02/29
	 */
	@Override
	public Set<Map.Entry<K, V>> entrySet()
	{
		// Get reference to the map
		Reference<Set<Map.Entry<K, V>>> ref = _escache;
		Set<Map.Entry<K, V>> rv = null;
		
		// In reference?
		if (ref != null)
			rv = ref.get();
		
		// Needs initialization?
		if (rv == null)
			_escache = new WeakReference<>((rv = new __SetView__()));
		
		// Return it
		return rv;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/02/29
	 */
	@Override
	public V get(Object __k)
	{
		return wrapped.get(__k);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/05/12
	 */
	@Override
	public boolean isEmpty()
	{
		return wrapped.isEmpty();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/02/29
	 */
	@Override
	public int size()
	{
		return wrapped.size();
	}
	
	/**
	 * This creates a view of the specified map which cannot be modified.
	 *
	 * @param <K> The map key.
	 * @param <V> The map value.







|









|









|










|








|












|









|









|







45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
		throws NullPointerException
	{
		// Check
		if (__w == null)
			throw new NullPointerException("NARG");
		
		// Set
		this.wrapped = __w;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/02/29
	 */
	@Override
	public boolean containsKey(Object __o)
	{
		return this.wrapped.containsKey(__o);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/05/12
	 */
	@Override
	public boolean containsValue(Object __o)
	{
		return this.wrapped.containsValue(__o);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/02/29
	 */
	@Override
	public Set<Map.Entry<K, V>> entrySet()
	{
		// Get reference to the map
		Reference<Set<Map.Entry<K, V>>> ref = this._escache;
		Set<Map.Entry<K, V>> rv = null;
		
		// In reference?
		if (ref != null)
			rv = ref.get();
		
		// Needs initialization?
		if (rv == null)
			this._escache = new WeakReference<>((rv = new __SetView__()));
		
		// Return it
		return rv;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/02/29
	 */
	@Override
	public V get(Object __k)
	{
		return this.wrapped.get(__k);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/05/12
	 */
	@Override
	public boolean isEmpty()
	{
		return this.wrapped.isEmpty();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/02/29
	 */
	@Override
	public int size()
	{
		return this.wrapped.size();
	}
	
	/**
	 * This creates a view of the specified map which cannot be modified.
	 *
	 * @param <K> The map key.
	 * @param <V> The map value.
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
	 * @since 2016/02/29
	 */
	private final class __SetIterator__
		implements Iterator<Map.Entry<K, V>>
	{
		/** The base iterator. */
		protected final Iterator<Map.Entry<K, V>> from =
			wrapped.entrySet().iterator();
		
		/**
		 * Initializes the iterator.
		 *
		 * @since 2016/02/29
		 */
		private __SetIterator__()
		{
		}
	
		/**	
		 * {@inheritDoc}
		 * @since 2016/02/29
		 */
		@Override
		public boolean hasNext()
		{
			return from.hasNext();
		}
	
		/**	
		 * {@inheritDoc}
		 * @since 2016/02/29
		 */
		@Override
		public Map.Entry<K, V> next()
		{
			// Get the next entry
			Map.Entry<K, V> ent = from.next();
			
			// If null, this is a bad map but possibly might be valid
			if (ent == null)
				return null;
			
			// Wrap it
			return new __SetEntry__<K, V>(ent);







|


<
<
<
<
<
<
<
<
<






|










|







150
151
152
153
154
155
156
157
158
159









160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
	 * @since 2016/02/29
	 */
	private final class __SetIterator__
		implements Iterator<Map.Entry<K, V>>
	{
		/** The base iterator. */
		protected final Iterator<Map.Entry<K, V>> from =
			UnmodifiableMap.this.wrapped.entrySet().iterator();
		
		/**









		 * {@inheritDoc}
		 * @since 2016/02/29
		 */
		@Override
		public boolean hasNext()
		{
			return this.from.hasNext();
		}
	
		/**	
		 * {@inheritDoc}
		 * @since 2016/02/29
		 */
		@Override
		public Map.Entry<K, V> next()
		{
			// Get the next entry
			Map.Entry<K, V> ent = this.from.next();
			
			// If null, this is a bad map but possibly might be valid
			if (ent == null)
				return null;
			
			// Wrap it
			return new __SetEntry__<K, V>(ent);
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
	 * This implements the unmodifiable set view.
	 *
	 * @since 2016/02/29
	 */
	private final class __SetView__
		extends AbstractSet<Map.Entry<K, V>>
	{
		/**
		 * Initializes the set view.
		 *
		 * @since 2016/02/29
		 */
		private __SetView__()
		{
		}
	
		/**	
		 * {@inheritDoc}
		 * @since 2016/02/29
		 */
		@Override
		public Iterator<Map.Entry<K, V>> iterator()
		{
			return new __SetIterator__();
		}
	
		/**
		 * {@inheritDoc}
		 * @since 2016/02/29
		 */
		@Override
		public int size()
		{
			return wrapped.size();
		}
	}
	
	/**
	 * This is a single entry in the set.
	 *
	 * @param <K> The key type.







<
<
|
<
<
<
<
<
<

















|







199
200
201
202
203
204
205


206






207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
	 * This implements the unmodifiable set view.
	 *
	 * @since 2016/02/29
	 */
	private final class __SetView__
		extends AbstractSet<Map.Entry<K, V>>
	{


		






		/**	
		 * {@inheritDoc}
		 * @since 2016/02/29
		 */
		@Override
		public Iterator<Map.Entry<K, V>> iterator()
		{
			return new __SetIterator__();
		}
	
		/**
		 * {@inheritDoc}
		 * @since 2016/02/29
		 */
		@Override
		public int size()
		{
			return UnmodifiableMap.this.wrapped.size();
		}
	}
	
	/**
	 * This is a single entry in the set.
	 *
	 * @param <K> The key type.
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
			throws NullPointerException
		{
			// Check
			if (__e == null)
				throw new NullPointerException("NARG");
			
			// Set
			base = __e;
		}
		
		/**
		 * {@inheritDoc}
		 * @since 2016/02/29
		 */
		@Override
		public boolean equals(Object __a)
		{
			return base.equals(__a);
		}
		
		/**
		 * {@inheritDoc}
		 * @since 2016/02/29
		 */
		@Override
		public K getKey()
		{
			return base.getKey();
		}
		
		/**
		 * {@inheritDoc}
		 * @since 2016/02/29
		 */
		@Override
		public V getValue()
		{
			return base.getValue();
		}
		
		/**
		 * {@inheritDoc}
		 * @since 2016/02/29
		 */
		@Override
		public int hashCode()
		{
			return base.hashCode();
		}
		
		/**
		 * {@inheritDoc}
		 * @since 2016/02/29
		 */
		@Override







|









|









|









|









|







249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
			throws NullPointerException
		{
			// Check
			if (__e == null)
				throw new NullPointerException("NARG");
			
			// Set
			this.base = __e;
		}
		
		/**
		 * {@inheritDoc}
		 * @since 2016/02/29
		 */
		@Override
		public boolean equals(Object __a)
		{
			return this.base.equals(__a);
		}
		
		/**
		 * {@inheritDoc}
		 * @since 2016/02/29
		 */
		@Override
		public K getKey()
		{
			return this.base.getKey();
		}
		
		/**
		 * {@inheritDoc}
		 * @since 2016/02/29
		 */
		@Override
		public V getValue()
		{
			return this.base.getValue();
		}
		
		/**
		 * {@inheritDoc}
		 * @since 2016/02/29
		 */
		@Override
		public int hashCode()
		{
			return this.base.hashCode();
		}
		
		/**
		 * {@inheritDoc}
		 * @since 2016/02/29
		 */
		@Override

Name change from runt/libs/collections/net/multiphasicapps/collections/UnmodifiableSet.java to modules/collections/src/main/java/net/multiphasicapps/collections/UnmodifiableSet.java.

37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
		throws NullPointerException
	{
		// Check
		if (__w == null)
			throw new NullPointerException("NARG");
		
		// Wrap it
		wrapped = __w;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/02/28
	 */
	@Override
	public boolean contains(Object __o)
	{
		return wrapped.contains(__o);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/05/12
	 */
	@Override
	public boolean isEmpty()
	{
		return wrapped.isEmpty();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/02/28
	 */
	@Override
	public Iterator<T> iterator()
	{
		return new Iterator<T>()
			{
				/** The base iterator. */
				final Iterator<T> _base =
					wrapped.iterator();
				
				/**
				 * {@inheritDoc}
				 * @since 2016/02/28
				 */
				@Override
				public boolean hasNext()
				{
					return _base.hasNext();
				}
				
				/**
				 * {@inheritDoc}
				 * @since 2016/02/28
				 */
				@Override
				public T next()
				{
					return _base.next();
				}
				
				/**
				 * {@inheritDoc}
				 * @since 2016/02/28
				 */
				@Override







|









|









|












|
<








|









|







37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77

78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
		throws NullPointerException
	{
		// Check
		if (__w == null)
			throw new NullPointerException("NARG");
		
		// Wrap it
		this.wrapped = __w;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/02/28
	 */
	@Override
	public boolean contains(Object __o)
	{
		return this.wrapped.contains(__o);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/05/12
	 */
	@Override
	public boolean isEmpty()
	{
		return this.wrapped.isEmpty();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/02/28
	 */
	@Override
	public Iterator<T> iterator()
	{
		return new Iterator<T>()
			{
				/** The base iterator. */
				final Iterator<T> _base = UnmodifiableSet.this.wrapped.iterator();

				
				/**
				 * {@inheritDoc}
				 * @since 2016/02/28
				 */
				@Override
				public boolean hasNext()
				{
					return this._base.hasNext();
				}
				
				/**
				 * {@inheritDoc}
				 * @since 2016/02/28
				 */
				@Override
				public T next()
				{
					return this._base.next();
				}
				
				/**
				 * {@inheritDoc}
				 * @since 2016/02/28
				 */
				@Override
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
	/**
	 * {@inheritDoc}
	 * @since 2016/02/28
	 */
	@Override
	public int size()
	{
		return wrapped.size();
	}
	
	/**
	 * This creates a view of the specified set which cannot be modified.
	 *
	 * @param <T> The type of value the set stores.
	 * @param __s The set to wrap to disable modifications of.







|







111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
	/**
	 * {@inheritDoc}
	 * @since 2016/02/28
	 */
	@Override
	public int size()
	{
		return this.wrapped.size();
	}
	
	/**
	 * This creates a view of the specified set which cannot be modified.
	 *
	 * @param <T> The type of value the set stores.
	 * @param __s The set to wrap to disable modifications of.

Name change from runt/libs/collections/net/multiphasicapps/collections/__Data__.java to modules/collections/src/main/java/net/multiphasicapps/collections/__Data__.java.

147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
	 *
	 * @param __n The data to compare against.
	 * @return The comparison result.
	 * @since 2017/03/30
	 */
	final int __compare(__Data__<K, V> __d)
	{
		return __compare(__d._key);
	}
	
	/**
	 * Compares this data against the given node.
	 *
	 * @param __n The node to compare against.
	 * @return The comparison result.
	 * @since 2017/03/30
	 */
	final int __compare(__Node__<K, V> __n)
	{
		return __compare(__n._data);
	}
}








|











|



147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
	 *
	 * @param __n The data to compare against.
	 * @return The comparison result.
	 * @since 2017/03/30
	 */
	final int __compare(__Data__<K, V> __d)
	{
		return this.__compare(__d._key);
	}
	
	/**
	 * Compares this data against the given node.
	 *
	 * @param __n The node to compare against.
	 * @return The comparison result.
	 * @since 2017/03/30
	 */
	final int __compare(__Node__<K, V> __n)
	{
		return this.__compare(__n._data);
	}
}

Name change from runt/libs/collections/net/multiphasicapps/collections/__EntrySet__.java to modules/collections/src/main/java/net/multiphasicapps/collections/__EntrySet__.java.

Name change from runt/libs/collections/net/multiphasicapps/collections/__IdentityBaseSet__.java to modules/collections/src/main/java/net/multiphasicapps/collections/__IdentityBaseSet__.java.

Name change from runt/libs/collections/net/multiphasicapps/collections/__IdentityWrapper__.java to modules/collections/src/main/java/net/multiphasicapps/collections/__IdentityWrapper__.java.

Name change from runt/libs/collections/net/multiphasicapps/collections/__MapIterator__.java to modules/collections/src/main/java/net/multiphasicapps/collections/__MapIterator__.java.

56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
	 */
	@Override
	public boolean hasNext()
	{
		__Data__<K, V> at = this._at;
		if (at == null)
			return false;
		return (__detect(at) != null);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/09/06
	 */
	@Override
	public Map.Entry<K, V> next()
	{
		// {@squirreljme.error AC06 No more elements to iterate over.}
		__Data__<K, V> rv = this._at;
		if (rv == null)
			throw new NoSuchElementException("AC06");
		
		// Make sure the value was not removed
		rv = __detect(rv);
		
		// Store last node (for removal) and iterate to the next node value
		this._last = rv;
		this._at = rv._next;
		
		return rv;
	}







|















|







56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
	 */
	@Override
	public boolean hasNext()
	{
		__Data__<K, V> at = this._at;
		if (at == null)
			return false;
		return (this.__detect(at) != null);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/09/06
	 */
	@Override
	public Map.Entry<K, V> next()
	{
		// {@squirreljme.error AC06 No more elements to iterate over.}
		__Data__<K, V> rv = this._at;
		if (rv == null)
			throw new NoSuchElementException("AC06");
		
		// Make sure the value was not removed
		rv = this.__detect(rv);
		
		// Store last node (for removal) and iterate to the next node value
		this._last = rv;
		this._at = rv._next;
		
		return rv;
	}

Name change from runt/libs/collections/net/multiphasicapps/collections/__Node__.java to modules/collections/src/main/java/net/multiphasicapps/collections/__Node__.java.

Name change from runt/libs/collections/net/multiphasicapps/collections/__Sub__.java to modules/collections/src/main/java/net/multiphasicapps/collections/__Sub__.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.collections;

import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Deque;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.NoSuchElementException;












<







1
2
3
4
5
6
7
8
9
10
11
12

13
14
15
16
17
18
19
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.collections;


import java.util.ArrayList;
import java.util.Collection;
import java.util.Deque;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.NoSuchElementException;
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
		throws NullPointerException
	{
		// Remember old size
		List<V> deque = this._deque;
		int was = deque.size();
		
		// Add it
		addLast(__a);
		
		// If the size changed then it was added
		return deque.size() != was;
	}

	/**
	 * {@inheritDoc}
	 * @since 2016/09/03
	 */
	@Override
	public boolean addAll(Collection<? extends V> __a)
		throws NullPointerException
	{
		// Check
		if (__a == null)
			throw new NullPointerException("NARG");
		
		// Add everything
		boolean rv = false;
		for (V v : __a)
			rv |= add(v);
		
		// Has this changed?
		return rv;
	}

	/**
	 * {@inheritDoc}







|




















|







72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
		throws NullPointerException
	{
		// Remember old size
		List<V> deque = this._deque;
		int was = deque.size();
		
		// Add it
		this.addLast(__a);
		
		// If the size changed then it was added
		return deque.size() != was;
	}

	/**
	 * {@inheritDoc}
	 * @since 2016/09/03
	 */
	@Override
	public boolean addAll(Collection<? extends V> __a)
		throws NullPointerException
	{
		// Check
		if (__a == null)
			throw new NullPointerException("NARG");
		
		// Add everything
		boolean rv = false;
		for (V v : __a)
			rv |= this.add(v);
		
		// Has this changed?
		return rv;
	}

	/**
	 * {@inheritDoc}
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
	/**
	 * {@inheritDoc}
	 * @since 2016/09/03
	 */
	@Override
	public V element()
	{
		return getFirst();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/09/03
	 */
	@Override







|







183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
	/**
	 * {@inheritDoc}
	 * @since 2016/09/03
	 */
	@Override
	public V element()
	{
		return this.getFirst();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/09/03
	 */
	@Override
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
	/**
	 * {@inheritDoc}
	 * @since 2016/09/03
	 */
	@Override
	public boolean offer(V __a)
	{
		return offerLast(__a);
	}

	/**
	 * {@inheritDoc}
	 * @since 2016/09/03
	 */
	@Override
	public boolean offerFirst(V __a)
	{
		try
		{
			addFirst(__a);
			return true;
		}
		
		// Exceeds capacity
		catch (IllegalStateException e)
		{
			return false;
		}
	}

	/**
	 * {@inheritDoc}
	 * @since 2016/09/03
	 */
	@Override
	public boolean offerLast(V __a)
	{
		try
		{
			addLast(__a);
			return true;
		}
		
		// Exceeds capacity
		catch (IllegalStateException e)
		{
			return false;
		}
	}

	/**
	 * {@inheritDoc}
	 * @since 2016/09/03
	 */
	@Override
	public V peek()
	{
		return peekFirst();
	}

	/**
	 * {@inheritDoc}
	 * @since 2016/09/03
	 */
	@Override
	public V peekFirst()
	{
		try
		{
			return getFirst();
		}
		
		// Empty
		catch (NoSuchElementException e)
		{
			return null;
		}
	}

	/**
	 * {@inheritDoc}
	 * @since 2016/09/03
	 */
	@Override
	public V peekLast()
	{
		try
		{
			return getLast();
		}
		
		// Empty
		catch (NoSuchElementException e)
		{
			return null;
		}
	}

	/**
	 * {@inheritDoc}
	 * @since 2016/09/03
	 */
	@Override
	public V poll()
	{
		return pollFirst();
	}

	/**
	 * {@inheritDoc}
	 * @since 2016/09/03
	 */
	@Override
	public V pollFirst()
	{
		try
		{
			return removeFirst();
		}
		
		// Empty
		catch (NoSuchElementException e)
		{
			return null;
		}
	}

	/**
	 * {@inheritDoc}
	 * @since 2016/09/03
	 */
	@Override
	public V pollLast()
	{
		try
		{
			return removeLast();
		}
		
		// Empty
		catch (NoSuchElementException e)
		{
			return null;
		}
	}

	/**
	 * {@inheritDoc}
	 * @since 2016/09/03
	 */
	@Override
	public V pop()
	{
		return removeFirst();
	}

	/**
	 * {@inheritDoc}
	 * @since 2016/09/03
	 */
	@Override
	public void push(V __a)
	{
		addFirst(__a);
	}

	/**
	 * {@inheritDoc}
	 * @since 2016/09/03
	 */
	@Override
	public boolean remove(Object __a)
	{
		throw new todo.TODO();
	}

	/**
	 * {@inheritDoc}
	 * @since 2016/09/03
	 */
	@Override
	public V remove()
	{
		return removeFirst();
	}

	/**
	 * {@inheritDoc}
	 * @since 2016/09/03
	 */
	@Override







|











|



















|

















|











|


















|
















|











|


















|
















|









|



















|







260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
	/**
	 * {@inheritDoc}
	 * @since 2016/09/03
	 */
	@Override
	public boolean offer(V __a)
	{
		return this.offerLast(__a);
	}

	/**
	 * {@inheritDoc}
	 * @since 2016/09/03
	 */
	@Override
	public boolean offerFirst(V __a)
	{
		try
		{
			this.addFirst(__a);
			return true;
		}
		
		// Exceeds capacity
		catch (IllegalStateException e)
		{
			return false;
		}
	}

	/**
	 * {@inheritDoc}
	 * @since 2016/09/03
	 */
	@Override
	public boolean offerLast(V __a)
	{
		try
		{
			this.addLast(__a);
			return true;
		}
		
		// Exceeds capacity
		catch (IllegalStateException e)
		{
			return false;
		}
	}

	/**
	 * {@inheritDoc}
	 * @since 2016/09/03
	 */
	@Override
	public V peek()
	{
		return this.peekFirst();
	}

	/**
	 * {@inheritDoc}
	 * @since 2016/09/03
	 */
	@Override
	public V peekFirst()
	{
		try
		{
			return this.getFirst();
		}
		
		// Empty
		catch (NoSuchElementException e)
		{
			return null;
		}
	}

	/**
	 * {@inheritDoc}
	 * @since 2016/09/03
	 */
	@Override
	public V peekLast()
	{
		try
		{
			return this.getLast();
		}
		
		// Empty
		catch (NoSuchElementException e)
		{
			return null;
		}
	}

	/**
	 * {@inheritDoc}
	 * @since 2016/09/03
	 */
	@Override
	public V poll()
	{
		return this.pollFirst();
	}

	/**
	 * {@inheritDoc}
	 * @since 2016/09/03
	 */
	@Override
	public V pollFirst()
	{
		try
		{
			return this.removeFirst();
		}
		
		// Empty
		catch (NoSuchElementException e)
		{
			return null;
		}
	}

	/**
	 * {@inheritDoc}
	 * @since 2016/09/03
	 */
	@Override
	public V pollLast()
	{
		try
		{
			return this.removeLast();
		}
		
		// Empty
		catch (NoSuchElementException e)
		{
			return null;
		}
	}

	/**
	 * {@inheritDoc}
	 * @since 2016/09/03
	 */
	@Override
	public V pop()
	{
		return this.removeFirst();
	}

	/**
	 * {@inheritDoc}
	 * @since 2016/09/03
	 */
	@Override
	public void push(V __a)
	{
		this.addFirst(__a);
	}

	/**
	 * {@inheritDoc}
	 * @since 2016/09/03
	 */
	@Override
	public boolean remove(Object __a)
	{
		throw new todo.TODO();
	}

	/**
	 * {@inheritDoc}
	 * @since 2016/09/03
	 */
	@Override
	public V remove()
	{
		return this.removeFirst();
	}

	/**
	 * {@inheritDoc}
	 * @since 2016/09/03
	 */
	@Override

Name change from runt/libs/collections/net/multiphasicapps/collections/package-info.java to modules/collections/src/main/java/net/multiphasicapps/collections/package-info.java.

Added modules/common-vm/build.gradle.



















































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import cc.squirreljme.plugin.swm.JavaMEMidletType

description = "This contains classes which are common across " +
 "the various SquirrelJME VMs, and these only need to be written once " +
 "as such."
version = rootProject.version

squirreljme
{
	javaDocErrorCode = "AK"
	swmType = JavaMEMidletType.LIBRARY
	swmName = "Common Virtual Machine Classes"
	swmVendor = "Stephanie Gawroriski"
}

dependencies
{
	implementation project(":modules:cldc")

	implementation project(":modules:midp-lcdui")
	implementation project(":modules:meep-swm")
	implementation project(":modules:meep-midlet")
	implementation project(":modules:tool-manifest-reader")
	implementation project(":modules:zip")
}

Name change from runt/libs/common-vm/cc/squirreljme/vm/VMClassLibrary.java to modules/common-vm/src/main/java/cc/squirreljme/vm/VMClassLibrary.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.vm;

import java.io.InputStream;
import java.io.IOException;

/**
 * This class represents a class library which represents a single JAR file
 * whether it exists on the disk or is virtually provided.
 *
 * @since 2018/09/13
 */
public interface VMClassLibrary
{
	/**
	 * Lists the names of the resources in this library.
	 *
	 * @return The resource names.
	 * @since 2019/04/21
	 */
	public abstract String[] listResources();
	
	/**
	 * Returns the name of this library.
	 *
	 * @return The library name.
	 * @since 2018/09/13
	 */
	public abstract String name();
	
	/**
	 * Opens the specified resource as a stream.
	 *
	 * @param __rc The name of the resource to open.
	 * @return The stream to the resource data or {@code null} if it is not
	 * valid.
	 * @throws IOException On read errors.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/09/13
	 */
	public abstract InputStream resourceAsStream(String __rc)
		throws IOException, NullPointerException;
}













|
|















|







|











|



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.vm;

import java.io.IOException;
import java.io.InputStream;

/**
 * This class represents a class library which represents a single JAR file
 * whether it exists on the disk or is virtually provided.
 *
 * @since 2018/09/13
 */
public interface VMClassLibrary
{
	/**
	 * Lists the names of the resources in this library.
	 *
	 * @return The resource names.
	 * @since 2019/04/21
	 */
	String[] listResources();
	
	/**
	 * Returns the name of this library.
	 *
	 * @return The library name.
	 * @since 2018/09/13
	 */
	String name();
	
	/**
	 * Opens the specified resource as a stream.
	 *
	 * @param __rc The name of the resource to open.
	 * @return The stream to the resource data or {@code null} if it is not
	 * valid.
	 * @throws IOException On read errors.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/09/13
	 */
	InputStream resourceAsStream(String __rc)
		throws IOException, NullPointerException;
}

Name change from runt/libs/common-vm/cc/squirreljme/vm/package-info.java to modules/common-vm/src/main/java/cc/squirreljme/vm/package-info.java.

Name change from runt/libs/common-vm/squirreljme-vm.png.__mime to modules/common-vm/src/main/resources/squirreljme-vm.png.__mime.

Added modules/demo-hello/build.gradle.







































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import cc.squirreljme.plugin.swm.JavaMEMidletType

description = "This is a basic demo which prints a hello " +
	"message and prints some details about the virtual machine."
version = rootProject.version

squirreljme
{
	javaDocErrorCode = "BT"
	swmType = JavaMEMidletType.APPLICATION
	swmName = "Hello (Demo)"
	swmVendor = "Stephanie Gawroriski"
	mainClass = "net.multiphasicapps.demo.hello.Hello"
}

dependencies
{
	project(":modules:cldc-compact")
}

Name change from runt/mids/demo-hello/net/multiphasicapps/demo/hello/Hello.java to modules/demo-hello/src/main/java/net/multiphasicapps/demo/hello/Hello.java.

Name change from runt/mids/demo-hello/net/multiphasicapps/demo/hello/package-info.java to modules/demo-hello/src/main/java/net/multiphasicapps/demo/hello/package-info.java.

Added modules/dio-adc/build.gradle.











































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import cc.squirreljme.plugin.swm.JavaMEMidletType
import cc.squirreljme.plugin.swm.JavaMEStandard

description = "This provides access to analog to digital converters."
version = rootProject.version

squirreljme
{
	javaDocErrorCode = "CV"
	swmType = JavaMEMidletType.API
	swmName = "JavaME 8 Device I/O (ADC)"
	swmVendor = "Stephanie Gawroriski"
	definedStandards += new JavaMEStandard("dio.adc;;1.0.1")
}

dependencies
{
	implementation project(":modules:cldc")

	implementation project(":modules:dio")
}

Name change from runt/apis/dio-adc/jdk/dio/adc/ADCChannel.java to modules/dio-adc/src/main/java/jdk/dio/adc/ADCChannel.java.

17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
import jdk.dio.Device;
import jdk.dio.UnavailableDeviceException;
import jdk.dio.UnsupportedByteOrderException;

public interface ADCChannel
	extends Device<ADCChannel>, BufferAccess<IntBuffer>
{
	public abstract int acquire()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	public abstract void acquire(IntBuffer __a)
		throws IOException, UnavailableDeviceException, 
			UnsupportedByteOrderException, ClosedDeviceException;
	
	public abstract int getMaxSamplingInterval()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	public abstract int getMaxValue()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	public abstract int getMinSamplingInterval()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	public abstract int getMinValue()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	public abstract int getSamplingInterval()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	public abstract double getScaleFactor()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	public abstract double getVRefValue()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	public abstract void setSamplingInterval(int __a)
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	public abstract void setScaleFactor(double __a)
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	public abstract void startAcquisition(IntBuffer __a, 
		AcquisitionRoundListener __b)
		throws IOException, UnavailableDeviceException, 
			UnsupportedByteOrderException, ClosedDeviceException;
	
	public abstract void startAcquisition(IntBuffer __a, IntBuffer __b, 
		AcquisitionRoundListener __c)
		throws IOException, UnavailableDeviceException, 
			UnsupportedByteOrderException, ClosedDeviceException;
	
	public abstract void startMonitoring(int __a, int __b, MonitoringListener
		__c)
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	public abstract void stopAcquisition()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	public abstract void stopMonitoring()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
}









|



|



|



|



|



|



|



|



|



|



|



<
|



|




|
<



|



|





17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67

68
69
70
71
72
73
74
75
76
77

78
79
80
81
82
83
84
85
86
87
88
89
90
import jdk.dio.Device;
import jdk.dio.UnavailableDeviceException;
import jdk.dio.UnsupportedByteOrderException;

public interface ADCChannel
	extends Device<ADCChannel>, BufferAccess<IntBuffer>
{
	int acquire()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	void acquire(IntBuffer __a)
		throws IOException, UnavailableDeviceException, 
			UnsupportedByteOrderException, ClosedDeviceException;
	
	int getMaxSamplingInterval()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	int getMaxValue()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	int getMinSamplingInterval()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	int getMinValue()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	int getSamplingInterval()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	double getScaleFactor()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	double getVRefValue()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	void setSamplingInterval(int __a)
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	void setScaleFactor(double __a)
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	

	void startAcquisition(IntBuffer __a, AcquisitionRoundListener __b)
		throws IOException, UnavailableDeviceException, 
			UnsupportedByteOrderException, ClosedDeviceException;
	
	void startAcquisition(IntBuffer __a, IntBuffer __b,
		AcquisitionRoundListener __c)
		throws IOException, UnavailableDeviceException, 
			UnsupportedByteOrderException, ClosedDeviceException;
	
	void startMonitoring(int __a, int __b, MonitoringListener __c)

		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	void stopAcquisition()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	void stopMonitoring()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
}


Name change from runt/apis/dio-adc/jdk/dio/adc/ADCChannelConfig.java to modules/dio-adc/src/main/java/jdk/dio/adc/ADCChannelConfig.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package jdk.dio.adc;

import java.io.InputStream;
import java.io.IOException;
import java.io.OutputStream;
import jdk.dio.DeviceConfig;

public final class ADCChannelConfig
	implements DeviceConfig<ADCChannel>, DeviceConfig.HardwareAddressing
{
	@Deprecated
	public ADCChannelConfig(int __a, int __b, int __c, int __d, int __e)
	{
		super();
		throw new todo.TODO();
	}
	
	@Deprecated
	public ADCChannelConfig(String __a, int __b, int __c, int __d, int __e)
	{
		super();
		throw new todo.TODO();
	}
	
	public boolean equals(Object __a)
	{
		throw new todo.TODO();
	}












|
|









<






<







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23

24
25
26
27
28
29

30
31
32
33
34
35
36
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package jdk.dio.adc;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import jdk.dio.DeviceConfig;

public final class ADCChannelConfig
	implements DeviceConfig<ADCChannel>, DeviceConfig.HardwareAddressing
{
	@Deprecated
	public ADCChannelConfig(int __a, int __b, int __c, int __d, int __e)
	{

		throw new todo.TODO();
	}
	
	@Deprecated
	public ADCChannelConfig(String __a, int __b, int __c, int __d, int __e)
	{

		throw new todo.TODO();
	}
	
	public boolean equals(Object __a)
	{
		throw new todo.TODO();
	}
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
		throw new todo.TODO();
	}
	
	public static final class Builder
	{
		public Builder()
		{
			super();
			throw new todo.TODO();
		}
		
		public ADCChannelConfig build()
		{
			throw new todo.TODO();
		}







<







96
97
98
99
100
101
102

103
104
105
106
107
108
109
		throw new todo.TODO();
	}
	
	public static final class Builder
	{
		public Builder()
		{

			throw new todo.TODO();
		}
		
		public ADCChannelConfig build()
		{
			throw new todo.TODO();
		}

Name change from runt/apis/dio-adc/jdk/dio/adc/ADCPermission.java to modules/dio-adc/src/main/java/jdk/dio/adc/ADCPermission.java.

Name change from runt/apis/dio-adc/jdk/dio/adc/AcquisitionRoundListener.java to modules/dio-adc/src/main/java/jdk/dio/adc/AcquisitionRoundListener.java.

13
14
15
16
17
18
19
20
21
22
23
24
25
26
import java.nio.IntBuffer;
import jdk.dio.InputRoundListener;
import jdk.dio.RoundCompletionEvent;

public interface AcquisitionRoundListener
	extends InputRoundListener<ADCChannel, IntBuffer>
{
	public abstract void failed(Throwable __a, ADCChannel __b);
	
	public abstract void inputRoundCompleted(RoundCompletionEvent<ADCChannel,
		IntBuffer> __a);
}









|

|
<



13
14
15
16
17
18
19
20
21
22

23
24
25
import java.nio.IntBuffer;
import jdk.dio.InputRoundListener;
import jdk.dio.RoundCompletionEvent;

public interface AcquisitionRoundListener
	extends InputRoundListener<ADCChannel, IntBuffer>
{
	void failed(Throwable __a, ADCChannel __b);
	
	void inputRoundCompleted(RoundCompletionEvent<ADCChannel, IntBuffer> __a);

}


Name change from runt/apis/dio-adc/jdk/dio/adc/InvalidInputSamplingRateException.java to modules/dio-adc/src/main/java/jdk/dio/adc/InvalidInputSamplingRateException.java.

12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30


public class InvalidInputSamplingRateException
	extends RuntimeException
{
	public InvalidInputSamplingRateException()
	{
		super();
		throw new todo.TODO();
	}
	
	public InvalidInputSamplingRateException(String __a)
	{
		super();
		throw new todo.TODO();
	}
}









<





<





12
13
14
15
16
17
18

19
20
21
22
23

24
25
26
27
28


public class InvalidInputSamplingRateException
	extends RuntimeException
{
	public InvalidInputSamplingRateException()
	{

		throw new todo.TODO();
	}
	
	public InvalidInputSamplingRateException(String __a)
	{

		throw new todo.TODO();
	}
}


Name change from runt/apis/dio-adc/jdk/dio/adc/MonitoringEvent.java to modules/dio-adc/src/main/java/jdk/dio/adc/MonitoringEvent.java.

19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
		1;
	
	public static final int OUT_OF_RANGE =
		0;
	
	public MonitoringEvent(ADCChannel __a, int __b, int __c)
	{
		super();
		throw new todo.TODO();
	}
	
	public MonitoringEvent(ADCChannel __a, int __b, int __c, long __d, int 
		__e)
	{
		super();
		throw new todo.TODO();
	}
	
	public int getType()
	{
		throw new todo.TODO();
	}







<






<







19
20
21
22
23
24
25

26
27
28
29
30
31

32
33
34
35
36
37
38
		1;
	
	public static final int OUT_OF_RANGE =
		0;
	
	public MonitoringEvent(ADCChannel __a, int __b, int __c)
	{

		throw new todo.TODO();
	}
	
	public MonitoringEvent(ADCChannel __a, int __b, int __c, long __d, int 
		__e)
	{

		throw new todo.TODO();
	}
	
	public int getType()
	{
		throw new todo.TODO();
	}

Name change from runt/apis/dio-adc/jdk/dio/adc/MonitoringListener.java to modules/dio-adc/src/main/java/jdk/dio/adc/MonitoringListener.java.

12
13
14
15
16
17
18
19
20
21
22
23
24

import jdk.dio.AsyncErrorHandler;
import jdk.dio.DeviceEventListener;

public interface MonitoringListener
	extends DeviceEventListener, AsyncErrorHandler<ADCChannel>
{
	public abstract void failed(Throwable __a, ADCChannel __b);
	
	public abstract void thresholdReached(MonitoringEvent __a);
}









|

|



12
13
14
15
16
17
18
19
20
21
22
23
24

import jdk.dio.AsyncErrorHandler;
import jdk.dio.DeviceEventListener;

public interface MonitoringListener
	extends DeviceEventListener, AsyncErrorHandler<ADCChannel>
{
	void failed(Throwable __a, ADCChannel __b);
	
	void thresholdReached(MonitoringEvent __a);
}


Name change from runt/apis/dio-adc/jdk/dio/adc/package-info.java to modules/dio-adc/src/main/java/jdk/dio/adc/package-info.java.

Added modules/dio-atcmd/build.gradle.















































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import cc.squirreljme.plugin.swm.JavaMEMidletType
import cc.squirreljme.plugin.swm.JavaMEStandard

description = "This provides access to devices which use the " +
	"standard AT command set."
version = rootProject.version

squirreljme
{
	javaDocErrorCode = "CZ"
	swmType = JavaMEMidletType.API
	swmName = "JavaME 8 Device I/O (AT Device)"
	swmVendor = "Stephanie Gawroriski"
	definedStandards += new JavaMEStandard("dio.atcmd;;1.0.1")
}

dependencies
{
	implementation project(":modules:cldc")

	implementation project(":modules:dio")
	implementation project(":modules:dio-modem")
}

Name change from runt/apis/dio-atcmd/jdk/dio/atcmd/ATDevice.java to modules/dio-atcmd/src/main/java/jdk/dio/atcmd/ATDevice.java.

15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
import jdk.dio.Device;
import jdk.dio.UnavailableDeviceException;

public interface ATDevice
	extends Device<ATDevice>
{
	@Deprecated
	public abstract void abortCommand(String __a)
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	public abstract void close()
		throws IOException;
	
	@Deprecated
	public abstract void escapeToCommandMode()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	public abstract int getMaxCommandLength()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	public abstract boolean isConnected()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	public abstract boolean isInCommandMode()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	public abstract DataConnection openDataConnection(String __a, 
		CommandResponseHandler __b, DataConnectionHandler __c)
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	public abstract String sendCommand(String __a)
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	public abstract void sendCommand(String __a, CommandResponseHandler __b)
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	public abstract void setUnsolicitedResponseHandler(
		UnsolicitedResponseHandler __a)
		throws IOException, ClosedDeviceException;
	
	public abstract String tryAbortCommand(String __a)
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	public abstract String tryEscapeToCommandMode()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
}









|



|



|



|



|



|



|
|



|



|



<
|


|



|





15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58

59
60
61
62
63
64
65
66
67
68
69
70
71
import jdk.dio.Device;
import jdk.dio.UnavailableDeviceException;

public interface ATDevice
	extends Device<ATDevice>
{
	@Deprecated
	void abortCommand(String __a)
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	void close()
		throws IOException;
	
	@Deprecated
	void escapeToCommandMode()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	int getMaxCommandLength()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	boolean isConnected()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	boolean isInCommandMode()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	DataConnection openDataConnection(String __a, CommandResponseHandler __b,
		DataConnectionHandler __c)
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	String sendCommand(String __a)
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	void sendCommand(String __a, CommandResponseHandler __b)
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	

	void setUnsolicitedResponseHandler(UnsolicitedResponseHandler __a)
		throws IOException, ClosedDeviceException;
	
	String tryAbortCommand(String __a)
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	String tryEscapeToCommandMode()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
}


Name change from runt/apis/dio-atcmd/jdk/dio/atcmd/ATDeviceConfig.java to modules/dio-atcmd/src/main/java/jdk/dio/atcmd/ATDeviceConfig.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package jdk.dio.atcmd;

import java.io.InputStream;
import java.io.IOException;
import java.io.OutputStream;
import jdk.dio.DeviceConfig;

public final class ATDeviceConfig
	implements DeviceConfig<ATDevice>, DeviceConfig.HardwareAddressing
{
	public ATDeviceConfig(String __a, int __b)
	{
		super();
		throw new todo.TODO();
	}
	
	public ATDeviceConfig(int __a, int __b)
	{
		super();
		throw new todo.TODO();
	}
	
	public boolean equals(Object __a)
	{
		throw new todo.TODO();
	}












|
|








<





<







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22

23
24
25
26
27

28
29
30
31
32
33
34
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package jdk.dio.atcmd;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import jdk.dio.DeviceConfig;

public final class ATDeviceConfig
	implements DeviceConfig<ATDevice>, DeviceConfig.HardwareAddressing
{
	public ATDeviceConfig(String __a, int __b)
	{

		throw new todo.TODO();
	}
	
	public ATDeviceConfig(int __a, int __b)
	{

		throw new todo.TODO();
	}
	
	public boolean equals(Object __a)
	{
		throw new todo.TODO();
	}

Name change from runt/apis/dio-atcmd/jdk/dio/atcmd/ATModem.java to modules/dio-atcmd/src/main/java/jdk/dio/atcmd/ATModem.java.

Name change from runt/apis/dio-atcmd/jdk/dio/atcmd/ATPermission.java to modules/dio-atcmd/src/main/java/jdk/dio/atcmd/ATPermission.java.

Name change from runt/apis/dio-atcmd/jdk/dio/atcmd/CommandResponseHandler.java to modules/dio-atcmd/src/main/java/jdk/dio/atcmd/CommandResponseHandler.java.

9
10
11
12
13
14
15
16
17
18
19
// ---------------------------------------------------------------------------

package jdk.dio.atcmd;


public interface CommandResponseHandler
{
	public abstract String processResponse(ATDevice __a, String __b);
}









|



9
10
11
12
13
14
15
16
17
18
19
// ---------------------------------------------------------------------------

package jdk.dio.atcmd;


public interface CommandResponseHandler
{
	String processResponse(ATDevice __a, String __b);
}


Name change from runt/apis/dio-atcmd/jdk/dio/atcmd/DataConnection.java to modules/dio-atcmd/src/main/java/jdk/dio/atcmd/DataConnection.java.

11
12
13
14
15
16
17
18
19
20
21
package jdk.dio.atcmd;

import java.nio.channels.ByteChannel;

public interface DataConnection
	extends ByteChannel
{
	public abstract ATDevice getDevice();
}









|



11
12
13
14
15
16
17
18
19
20
21
package jdk.dio.atcmd;

import java.nio.channels.ByteChannel;

public interface DataConnection
	extends ByteChannel
{
	ATDevice getDevice();
}


Name change from runt/apis/dio-atcmd/jdk/dio/atcmd/DataConnectionHandler.java to modules/dio-atcmd/src/main/java/jdk/dio/atcmd/DataConnectionHandler.java.

9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// ---------------------------------------------------------------------------

package jdk.dio.atcmd;


public interface DataConnectionHandler
{
	public abstract void handleClosedDataConnection(ATDevice __a, 
		DataConnection __b);
	
	public abstract void handleOpenedDataConnection(ATDevice __a, 
		DataConnection __b);
}









|
<

|
<



9
10
11
12
13
14
15
16

17
18

19
20
21
// ---------------------------------------------------------------------------

package jdk.dio.atcmd;


public interface DataConnectionHandler
{
	void handleClosedDataConnection(ATDevice __a, DataConnection __b);

	
	void handleOpenedDataConnection(ATDevice __a, DataConnection __b);

}


Name change from runt/apis/dio-atcmd/jdk/dio/atcmd/UnsolicitedResponseHandler.java to modules/dio-atcmd/src/main/java/jdk/dio/atcmd/UnsolicitedResponseHandler.java.

9
10
11
12
13
14
15
16
17
18
19
// ---------------------------------------------------------------------------

package jdk.dio.atcmd;


public interface UnsolicitedResponseHandler
{
	public abstract void processResponse(ATDevice __a, String __b);
}









|



9
10
11
12
13
14
15
16
17
18
19
// ---------------------------------------------------------------------------

package jdk.dio.atcmd;


public interface UnsolicitedResponseHandler
{
	void processResponse(ATDevice __a, String __b);
}


Name change from runt/apis/dio-atcmd/jdk/dio/atcmd/package-info.java to modules/dio-atcmd/src/main/java/jdk/dio/atcmd/package-info.java.

Added modules/dio-counter/build.gradle.















































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import cc.squirreljme.plugin.swm.JavaMEMidletType
import cc.squirreljme.plugin.swm.JavaMEStandard

description = "This provides access to hardware counters."
version = rootProject.version

squirreljme
{
	javaDocErrorCode = "DQ"
	swmType = JavaMEMidletType.API
	swmName = "JavaME 8 Device I/O (Counters)"
	swmVendor = "Stephanie Gawroriski"
	definedStandards += new JavaMEStandard("dio.counter;;1.0.1")
}

dependencies
{
	implementation project(":modules:cldc-compact")
	implementation project(":modules:cldc")

	implementation project(":modules:dio")
	implementation project(":modules:dio-gpio")
}

Name change from runt/apis/dio-counter/jdk/dio/counter/CounterPermission.java to modules/dio-counter/src/main/java/jdk/dio/counter/CounterPermission.java.

Name change from runt/apis/dio-counter/jdk/dio/counter/CountingEvent.java to modules/dio-counter/src/main/java/jdk/dio/counter/CountingEvent.java.

19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
		1;
	
	public static final int TERMINAL_VALUE_REACHED =
		0;
	
	public CountingEvent(PulseCounter __a, int __b, int __c, long __d)
	{
		super();
		throw new todo.TODO();
	}
	
	public CountingEvent(PulseCounter __a, int __b, int __c, long __d, long 
		__e, int __f)
	{
		super();
		throw new todo.TODO();
	}
	
	public long getInterval()
	{
		throw new todo.TODO();
	}







<






<







19
20
21
22
23
24
25

26
27
28
29
30
31

32
33
34
35
36
37
38
		1;
	
	public static final int TERMINAL_VALUE_REACHED =
		0;
	
	public CountingEvent(PulseCounter __a, int __b, int __c, long __d)
	{

		throw new todo.TODO();
	}
	
	public CountingEvent(PulseCounter __a, int __b, int __c, long __d, long 
		__e, int __f)
	{

		throw new todo.TODO();
	}
	
	public long getInterval()
	{
		throw new todo.TODO();
	}

Name change from runt/apis/dio-counter/jdk/dio/counter/CountingListener.java to modules/dio-counter/src/main/java/jdk/dio/counter/CountingListener.java.

12
13
14
15
16
17
18
19
20
21
22
23
24

import jdk.dio.AsyncErrorHandler;
import jdk.dio.DeviceEventListener;

public interface CountingListener
	extends DeviceEventListener, AsyncErrorHandler<PulseCounter>
{
	public abstract void countValueAvailable(CountingEvent __a);
	
	public abstract void failed(Throwable __a, PulseCounter __b);
}









|

|



12
13
14
15
16
17
18
19
20
21
22
23
24

import jdk.dio.AsyncErrorHandler;
import jdk.dio.DeviceEventListener;

public interface CountingListener
	extends DeviceEventListener, AsyncErrorHandler<PulseCounter>
{
	void countValueAvailable(CountingEvent __a);
	
	void failed(Throwable __a, PulseCounter __b);
}


Name change from runt/apis/dio-counter/jdk/dio/counter/PulseCounter.java to modules/dio-counter/src/main/java/jdk/dio/counter/PulseCounter.java.

9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// ---------------------------------------------------------------------------

package jdk.dio.counter;

import java.io.IOException;
import jdk.dio.ClosedDeviceException;
import jdk.dio.Device;
import jdk.dio.gpio.GPIOPin;
import jdk.dio.UnavailableDeviceException;

public interface PulseCounter
	extends Device<PulseCounter>
{
	public abstract int getCount()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	public abstract GPIOPin getSource();
	
	public abstract void resetCounting()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	public abstract void resumeCounting()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	public abstract void startCounting()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	public abstract void startCounting(int __a, long __b, CountingListener 
		__c)
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	public abstract void stopCounting()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	public abstract void suspendCounting()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
}









|
|




|



|

|



|



|



|
<



|



|





9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40

41
42
43
44
45
46
47
48
49
50
51
52
53
// ---------------------------------------------------------------------------

package jdk.dio.counter;

import java.io.IOException;
import jdk.dio.ClosedDeviceException;
import jdk.dio.Device;
import jdk.dio.UnavailableDeviceException;
import jdk.dio.gpio.GPIOPin;

public interface PulseCounter
	extends Device<PulseCounter>
{
	int getCount()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	GPIOPin getSource();
	
	void resetCounting()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	void resumeCounting()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	void startCounting()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	void startCounting(int __a, long __b, CountingListener __c)

		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	void stopCounting()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	void suspendCounting()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
}


Name change from runt/apis/dio-counter/jdk/dio/counter/PulseCounterConfig.java to modules/dio-counter/src/main/java/jdk/dio/counter/PulseCounterConfig.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package jdk.dio.counter;

import java.io.InputStream;
import java.io.IOException;
import java.io.OutputStream;
import jdk.dio.DeviceConfig;
import jdk.dio.gpio.GPIOPin;
import jdk.dio.gpio.GPIOPinConfig;

public final class PulseCounterConfig
	implements DeviceConfig<PulseCounter>, DeviceConfig.HardwareAddressing












|
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package jdk.dio.counter;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import jdk.dio.DeviceConfig;
import jdk.dio.gpio.GPIOPin;
import jdk.dio.gpio.GPIOPinConfig;

public final class PulseCounterConfig
	implements DeviceConfig<PulseCounter>, DeviceConfig.HardwareAddressing
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
	
	public static final int TYPE_RISING_EDGE_ONLY =
		1;
	
	@Deprecated
	public PulseCounterConfig(int __a, int __b, int __c)
	{
		super();
		throw new todo.TODO();
	}
	
	@Deprecated
	public PulseCounterConfig(int __a, int __b, int __c, GPIOPinConfig __d)
	{
		super();
		throw new todo.TODO();
	}
	
	@Deprecated
	public PulseCounterConfig(String __a, int __b, int __c)
	{
		super();
		throw new todo.TODO();
	}
	
	@Deprecated
	public PulseCounterConfig(String __a, int __b, int __c, GPIOPinConfig __d
		)
	{
		super();
		throw new todo.TODO();
	}
	
	public boolean equals(Object __a)
	{
		throw new todo.TODO();
	}







<






<






<







<







31
32
33
34
35
36
37

38
39
40
41
42
43

44
45
46
47
48
49

50
51
52
53
54
55
56

57
58
59
60
61
62
63
	
	public static final int TYPE_RISING_EDGE_ONLY =
		1;
	
	@Deprecated
	public PulseCounterConfig(int __a, int __b, int __c)
	{

		throw new todo.TODO();
	}
	
	@Deprecated
	public PulseCounterConfig(int __a, int __b, int __c, GPIOPinConfig __d)
	{

		throw new todo.TODO();
	}
	
	@Deprecated
	public PulseCounterConfig(String __a, int __b, int __c)
	{

		throw new todo.TODO();
	}
	
	@Deprecated
	public PulseCounterConfig(String __a, int __b, int __c, GPIOPinConfig __d
		)
	{

		throw new todo.TODO();
	}
	
	public boolean equals(Object __a)
	{
		throw new todo.TODO();
	}
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
		throw new todo.TODO();
	}
	
	public static final class Builder
	{
		public Builder()
		{
			super();
			throw new todo.TODO();
		}
		
		public PulseCounterConfig build()
		{
			throw new todo.TODO();
		}







<







114
115
116
117
118
119
120

121
122
123
124
125
126
127
		throw new todo.TODO();
	}
	
	public static final class Builder
	{
		public Builder()
		{

			throw new todo.TODO();
		}
		
		public PulseCounterConfig build()
		{
			throw new todo.TODO();
		}

Name change from runt/apis/dio-counter/jdk/dio/counter/package-info.java to modules/dio-counter/src/main/java/jdk/dio/counter/package-info.java.

Added modules/dio-dac/build.gradle.











































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import cc.squirreljme.plugin.swm.JavaMEMidletType
import cc.squirreljme.plugin.swm.JavaMEStandard

description = "This provides access to digital to analog converters."
version = rootProject.version

squirreljme
{
	javaDocErrorCode = "CW"
	swmType = JavaMEMidletType.API
	swmName = "JavaME 8 Device I/O (DAC)"
	swmVendor = "Stephanie Gawroriski"
	definedStandards += new JavaMEStandard("dio.dac;;1.0.1")
}

dependencies
{
	implementation project(":modules:cldc")

	implementation project(":modules:dio")
}

Name change from runt/apis/dio-dac/jdk/dio/dac/DACChannel.java to modules/dio-dac/src/main/java/jdk/dio/dac/DACChannel.java.

17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
import jdk.dio.Device;
import jdk.dio.UnavailableDeviceException;
import jdk.dio.UnsupportedByteOrderException;

public interface DACChannel
	extends Device<DACChannel>, BufferAccess<IntBuffer>
{
	public abstract void generate(int __a)
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	public abstract void generate(IntBuffer __a)
		throws IOException, UnavailableDeviceException, 
			UnsupportedByteOrderException, ClosedDeviceException;
	
	public abstract int getMaxSamplingInterval()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	public abstract int getMaxValue()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	public abstract int getMinSamplingInterval()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	public abstract int getMinValue()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	public abstract int getSamplingInterval()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	public abstract double getScaleFactor()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	public abstract double getVRefValue()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	public abstract void setSamplingInterval(int __a)
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	public abstract void setScaleFactor(double __a)
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	public abstract void startGeneration(IntBuffer __a, 
		GenerationRoundListener __b)
		throws IOException, UnavailableDeviceException, 
			UnsupportedByteOrderException, ClosedDeviceException;
	
	public abstract void startGeneration(IntBuffer __a, IntBuffer __b, 
		GenerationRoundListener __c)
		throws IOException, UnavailableDeviceException, 
			UnsupportedByteOrderException, ClosedDeviceException;
	
	public abstract void stopGeneration()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
}









|



|



|



|



|



|



|



|



|



|



|



|
<



|




|





17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68

69
70
71
72
73
74
75
76
77
78
79
80
81
82
import jdk.dio.Device;
import jdk.dio.UnavailableDeviceException;
import jdk.dio.UnsupportedByteOrderException;

public interface DACChannel
	extends Device<DACChannel>, BufferAccess<IntBuffer>
{
	void generate(int __a)
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	void generate(IntBuffer __a)
		throws IOException, UnavailableDeviceException, 
			UnsupportedByteOrderException, ClosedDeviceException;
	
	int getMaxSamplingInterval()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	int getMaxValue()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	int getMinSamplingInterval()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	int getMinValue()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	int getSamplingInterval()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	double getScaleFactor()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	double getVRefValue()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	void setSamplingInterval(int __a)
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	void setScaleFactor(double __a)
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	void startGeneration(IntBuffer __a, GenerationRoundListener __b)

		throws IOException, UnavailableDeviceException, 
			UnsupportedByteOrderException, ClosedDeviceException;
	
	void startGeneration(IntBuffer __a, IntBuffer __b,
		GenerationRoundListener __c)
		throws IOException, UnavailableDeviceException, 
			UnsupportedByteOrderException, ClosedDeviceException;
	
	void stopGeneration()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
}


Name change from runt/apis/dio-dac/jdk/dio/dac/DACChannelConfig.java to modules/dio-dac/src/main/java/jdk/dio/dac/DACChannelConfig.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package jdk.dio.dac;

import java.io.InputStream;
import java.io.IOException;
import java.io.OutputStream;
import jdk.dio.DeviceConfig;

public final class DACChannelConfig
	implements DeviceConfig<DACChannel>, DeviceConfig.HardwareAddressing
{
	@Deprecated
	public DACChannelConfig(int __a, int __b, int __c, int __d)
	{
		super();
		throw new todo.TODO();
	}
	
	@Deprecated
	public DACChannelConfig(String __a, int __b, int __c, int __d)
	{
		super();
		throw new todo.TODO();
	}
	
	public boolean equals(Object __a)
	{
		throw new todo.TODO();
	}












|
|









<






<







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23

24
25
26
27
28
29

30
31
32
33
34
35
36
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package jdk.dio.dac;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import jdk.dio.DeviceConfig;

public final class DACChannelConfig
	implements DeviceConfig<DACChannel>, DeviceConfig.HardwareAddressing
{
	@Deprecated
	public DACChannelConfig(int __a, int __b, int __c, int __d)
	{

		throw new todo.TODO();
	}
	
	@Deprecated
	public DACChannelConfig(String __a, int __b, int __c, int __d)
	{

		throw new todo.TODO();
	}
	
	public boolean equals(Object __a)
	{
		throw new todo.TODO();
	}
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
		throw new todo.TODO();
	}
	
	public static final class Builder
	{
		public Builder()
		{
			super();
			throw new todo.TODO();
		}
		
		public DACChannelConfig build()
		{
			throw new todo.TODO();
		}







<







91
92
93
94
95
96
97

98
99
100
101
102
103
104
		throw new todo.TODO();
	}
	
	public static final class Builder
	{
		public Builder()
		{

			throw new todo.TODO();
		}
		
		public DACChannelConfig build()
		{
			throw new todo.TODO();
		}

Name change from runt/apis/dio-dac/jdk/dio/dac/DACPermission.java to modules/dio-dac/src/main/java/jdk/dio/dac/DACPermission.java.

Name change from runt/apis/dio-dac/jdk/dio/dac/GenerationRoundListener.java to modules/dio-dac/src/main/java/jdk/dio/dac/GenerationRoundListener.java.

13
14
15
16
17
18
19
20
21
22
23
24
25
26
import java.nio.IntBuffer;
import jdk.dio.OutputRoundListener;
import jdk.dio.RoundCompletionEvent;

public interface GenerationRoundListener
	extends OutputRoundListener<DACChannel, IntBuffer>
{
	public abstract void failed(Throwable __a, DACChannel __b);
	
	public abstract void outputRoundCompleted(RoundCompletionEvent<DACChannel
		, IntBuffer> __a);
}









|

|
<



13
14
15
16
17
18
19
20
21
22

23
24
25
import java.nio.IntBuffer;
import jdk.dio.OutputRoundListener;
import jdk.dio.RoundCompletionEvent;

public interface GenerationRoundListener
	extends OutputRoundListener<DACChannel, IntBuffer>
{
	void failed(Throwable __a, DACChannel __b);
	
	void outputRoundCompleted(RoundCompletionEvent<DACChannel, IntBuffer> __a);

}


Name change from runt/apis/dio-dac/jdk/dio/dac/InvalidOutputSamplingRateException.java to modules/dio-dac/src/main/java/jdk/dio/dac/InvalidOutputSamplingRateException.java.

12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30


public class InvalidOutputSamplingRateException
	extends RuntimeException
{
	public InvalidOutputSamplingRateException()
	{
		super();
		throw new todo.TODO();
	}
	
	public InvalidOutputSamplingRateException(String __a)
	{
		super();
		throw new todo.TODO();
	}
}









<





<





12
13
14
15
16
17
18

19
20
21
22
23

24
25
26
27
28


public class InvalidOutputSamplingRateException
	extends RuntimeException
{
	public InvalidOutputSamplingRateException()
	{

		throw new todo.TODO();
	}
	
	public InvalidOutputSamplingRateException(String __a)
	{

		throw new todo.TODO();
	}
}


Name change from runt/apis/dio-dac/jdk/dio/dac/package-info.java to modules/dio-dac/src/main/java/jdk/dio/dac/package-info.java.

Added modules/dio-generic/build.gradle.











































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import cc.squirreljme.plugin.swm.JavaMEMidletType
import cc.squirreljme.plugin.swm.JavaMEStandard

description = "This provides access to generic devices."
version = rootProject.version

squirreljme
{
	javaDocErrorCode = "DS"
	swmType = JavaMEMidletType.API
	swmName = "JavaME 8 Device I/O (Generic)"
	swmVendor = "Stephanie Gawroriski"
	definedStandards += new JavaMEStandard("dio.generic;;1.0.1")
}

dependencies
{
	implementation project(":modules:cldc")

	implementation project(":modules:dio")
}

Name change from runt/apis/dio-generic/jdk/dio/generic/GenericBufferIODevice.java to modules/dio-generic/src/main/java/jdk/dio/generic/GenericBufferIODevice.java.

17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import jdk.dio.ClosedDeviceException;
import jdk.dio.UnavailableDeviceException;
import jdk.dio.UnsupportedByteOrderException;

public interface GenericBufferIODevice
	extends GenericDevice, ByteChannel, BufferAccess<ByteBuffer>
{
	public abstract int read(ByteBuffer __a)
		throws IOException, UnavailableDeviceException, 
			UnsupportedByteOrderException, ClosedDeviceException;
	
	public abstract int read(int __a, ByteBuffer __b)
		throws IOException, UnavailableDeviceException, 
			UnsupportedByteOrderException, ClosedDeviceException;
	
	public abstract int write(ByteBuffer __a)
		throws IOException, UnavailableDeviceException, 
			UnsupportedByteOrderException, ClosedDeviceException;
}









|



|



|





17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import jdk.dio.ClosedDeviceException;
import jdk.dio.UnavailableDeviceException;
import jdk.dio.UnsupportedByteOrderException;

public interface GenericBufferIODevice
	extends GenericDevice, ByteChannel, BufferAccess<ByteBuffer>
{
	int read(ByteBuffer __a)
		throws IOException, UnavailableDeviceException, 
			UnsupportedByteOrderException, ClosedDeviceException;
	
	int read(int __a, ByteBuffer __b)
		throws IOException, UnavailableDeviceException, 
			UnsupportedByteOrderException, ClosedDeviceException;
	
	int write(ByteBuffer __a)
		throws IOException, UnavailableDeviceException, 
			UnsupportedByteOrderException, ClosedDeviceException;
}


Name change from runt/apis/dio-generic/jdk/dio/generic/GenericDevice.java to modules/dio-generic/src/main/java/jdk/dio/generic/GenericDevice.java.

14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import jdk.dio.ClosedDeviceException;
import jdk.dio.Device;
import jdk.dio.UnavailableDeviceException;

public interface GenericDevice
	extends Device<GenericDevice>
{
	public abstract <T> T getControl(GenericDeviceControl<T> __a)
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	public abstract <T> void setControl(GenericDeviceControl<T> __a, T __b)
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	public abstract void setEventListener(int __a, GenericEventListener __b)
		throws IOException, ClosedDeviceException;
}









|



|



|




14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import jdk.dio.ClosedDeviceException;
import jdk.dio.Device;
import jdk.dio.UnavailableDeviceException;

public interface GenericDevice
	extends Device<GenericDevice>
{
	<T> T getControl(GenericDeviceControl<T> __a)
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	<T> void setControl(GenericDeviceControl<T> __a, T __b)
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	void setEventListener(int __a, GenericEventListener __b)
		throws IOException, ClosedDeviceException;
}


Name change from runt/apis/dio-generic/jdk/dio/generic/GenericDeviceConfig.java to modules/dio-generic/src/main/java/jdk/dio/generic/GenericDeviceConfig.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package jdk.dio.generic;

import java.io.InputStream;
import java.io.IOException;
import java.io.OutputStream;
import jdk.dio.DeviceConfig;

public final class GenericDeviceConfig
	implements DeviceConfig<GenericDevice>, DeviceConfig.HardwareAddressing
{
	@Deprecated
	public GenericDeviceConfig(int __a, int __b)
	{
		super();
		throw new todo.TODO();
	}
	
	@Deprecated
	public GenericDeviceConfig(String __a, int __b)
	{
		super();
		throw new todo.TODO();
	}
	
	public boolean equals(Object __a)
	{
		throw new todo.TODO();
	}












|
|









<






<







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23

24
25
26
27
28
29

30
31
32
33
34
35
36
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package jdk.dio.generic;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import jdk.dio.DeviceConfig;

public final class GenericDeviceConfig
	implements DeviceConfig<GenericDevice>, DeviceConfig.HardwareAddressing
{
	@Deprecated
	public GenericDeviceConfig(int __a, int __b)
	{

		throw new todo.TODO();
	}
	
	@Deprecated
	public GenericDeviceConfig(String __a, int __b)
	{

		throw new todo.TODO();
	}
	
	public boolean equals(Object __a)
	{
		throw new todo.TODO();
	}
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
		throw new todo.TODO();
	}
	
	public static final class Builder
	{
		public Builder()
		{
			super();
			throw new todo.TODO();
		}
		
		public GenericDeviceConfig build()
		{
			throw new todo.TODO();
		}







<







81
82
83
84
85
86
87

88
89
90
91
92
93
94
		throw new todo.TODO();
	}
	
	public static final class Builder
	{
		public Builder()
		{

			throw new todo.TODO();
		}
		
		public GenericDeviceConfig build()
		{
			throw new todo.TODO();
		}

Name change from runt/apis/dio-generic/jdk/dio/generic/GenericDeviceControl.java to modules/dio-generic/src/main/java/jdk/dio/generic/GenericDeviceControl.java.

11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package jdk.dio.generic;


public class GenericDeviceControl<T>
{
	public GenericDeviceControl(int __a, Class<T> __b)
	{
		super();
		throw new todo.TODO();
	}
	
	public int getID()
	{
		throw new todo.TODO();
	}







<







11
12
13
14
15
16
17

18
19
20
21
22
23
24
package jdk.dio.generic;


public class GenericDeviceControl<T>
{
	public GenericDeviceControl(int __a, Class<T> __b)
	{

		throw new todo.TODO();
	}
	
	public int getID()
	{
		throw new todo.TODO();
	}

Name change from runt/apis/dio-generic/jdk/dio/generic/GenericEvent.java to modules/dio-generic/src/main/java/jdk/dio/generic/GenericEvent.java.

22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
		0;
	
	public static final int OUTPUT_BUFFER_EMPTY =
		2;
	
	public GenericEvent(GenericDevice __a, int __b)
	{
		super();
		throw new todo.TODO();
	}
	
	public GenericEvent(GenericDevice __a, int __b, long __c, int __d)
	{
		super();
		throw new todo.TODO();
	}
	
	public int getID()
	{
		throw new todo.TODO();
	}







<





<







22
23
24
25
26
27
28

29
30
31
32
33

34
35
36
37
38
39
40
		0;
	
	public static final int OUTPUT_BUFFER_EMPTY =
		2;
	
	public GenericEvent(GenericDevice __a, int __b)
	{

		throw new todo.TODO();
	}
	
	public GenericEvent(GenericDevice __a, int __b, long __c, int __d)
	{

		throw new todo.TODO();
	}
	
	public int getID()
	{
		throw new todo.TODO();
	}

Name change from runt/apis/dio-generic/jdk/dio/generic/GenericEventListener.java to modules/dio-generic/src/main/java/jdk/dio/generic/GenericEventListener.java.

11
12
13
14
15
16
17
18
19
20
21
package jdk.dio.generic;

import jdk.dio.DeviceEventListener;

public interface GenericEventListener
	extends DeviceEventListener
{
	public abstract void eventDispatched(GenericEvent __a);
}









|



11
12
13
14
15
16
17
18
19
20
21
package jdk.dio.generic;

import jdk.dio.DeviceEventListener;

public interface GenericEventListener
	extends DeviceEventListener
{
	void eventDispatched(GenericEvent __a);
}


Name change from runt/apis/dio-generic/jdk/dio/generic/GenericPermission.java to modules/dio-generic/src/main/java/jdk/dio/generic/GenericPermission.java.

Name change from runt/apis/dio-generic/jdk/dio/generic/package-info.java to modules/dio-generic/src/main/java/jdk/dio/generic/package-info.java.

Added modules/dio-gpio/build.gradle.











































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import cc.squirreljme.plugin.swm.JavaMEMidletType
import cc.squirreljme.plugin.swm.JavaMEStandard

description = "This provides access to GPIO pins."
version = rootProject.version

squirreljme
{
	javaDocErrorCode = "CS"
	swmType = JavaMEMidletType.API
	swmName = "JavaME 8 Device I/O (GPIO)"
	swmVendor = "Stephanie Gawroriski"
	definedStandards += new JavaMEStandard("dio.gpio;;1.0.1")
}

dependencies
{
	implementation project(":modules:cldc")

	implementation project(":modules:dio")
}

Name change from runt/apis/dio-gpio/jdk/dio/gpio/GPIOPin.java to modules/dio-gpio/src/main/java/jdk/dio/gpio/GPIOPin.java.

14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import jdk.dio.ClosedDeviceException;
import jdk.dio.Device;
import jdk.dio.UnavailableDeviceException;

public interface GPIOPin
	extends Device<GPIOPin>
{
	public static final int INPUT =
		0;
	
	public static final int OUTPUT =
		1;
	
	public abstract int getDirection()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	public abstract int getTrigger()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	public abstract boolean getValue()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	public abstract void setDirection(int __a)
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	public abstract void setInputListener(PinListener __a)
		throws IOException, ClosedDeviceException;
	
	public abstract void setTrigger(int __a)
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	public abstract void setValue(boolean __a)
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
}









|


|


|



|



|



|



|


|



|





14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import jdk.dio.ClosedDeviceException;
import jdk.dio.Device;
import jdk.dio.UnavailableDeviceException;

public interface GPIOPin
	extends Device<GPIOPin>
{
	int INPUT =
		0;
	
	int OUTPUT =
		1;
	
	int getDirection()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	int getTrigger()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	boolean getValue()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	void setDirection(int __a)
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	void setInputListener(PinListener __a)
		throws IOException, ClosedDeviceException;
	
	void setTrigger(int __a)
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	void setValue(boolean __a)
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
}


Name change from runt/apis/dio-gpio/jdk/dio/gpio/GPIOPinConfig.java to modules/dio-gpio/src/main/java/jdk/dio/gpio/GPIOPinConfig.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package jdk.dio.gpio;

import java.io.InputStream;
import java.io.IOException;
import java.io.OutputStream;
import jdk.dio.DeviceConfig;

public final class GPIOPinConfig
	implements DeviceConfig<GPIOPin>, DeviceConfig.HardwareAddressing
{
	public static final int DIR_BOTH_INIT_INPUT =












|
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package jdk.dio.gpio;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import jdk.dio.DeviceConfig;

public final class GPIOPinConfig
	implements DeviceConfig<GPIOPin>, DeviceConfig.HardwareAddressing
{
	public static final int DIR_BOTH_INIT_INPUT =
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
	public static final int TRIGGER_RISING_EDGE =
		2;
	
	@Deprecated
	public GPIOPinConfig(int __a, int __b, int __c, int __d, int __e, boolean
		__f)
	{
		super();
		throw new todo.TODO();
	}
	
	@Deprecated
	public GPIOPinConfig(String __a, int __b, int __c, int __d, int __e, 
		boolean __f)
	{
		super();
		throw new todo.TODO();
	}
	
	public boolean equals(Object __a)
	{
		throw new todo.TODO();
	}







<







<







63
64
65
66
67
68
69

70
71
72
73
74
75
76

77
78
79
80
81
82
83
	public static final int TRIGGER_RISING_EDGE =
		2;
	
	@Deprecated
	public GPIOPinConfig(int __a, int __b, int __c, int __d, int __e, boolean
		__f)
	{

		throw new todo.TODO();
	}
	
	@Deprecated
	public GPIOPinConfig(String __a, int __b, int __c, int __d, int __e, 
		boolean __f)
	{

		throw new todo.TODO();
	}
	
	public boolean equals(Object __a)
	{
		throw new todo.TODO();
	}
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
		throw new todo.TODO();
	}
	
	public static final class Builder
	{
		public Builder()
		{
			super();
			throw new todo.TODO();
		}
		
		public GPIOPinConfig build()
		{
			throw new todo.TODO();
		}







<







138
139
140
141
142
143
144

145
146
147
148
149
150
151
		throw new todo.TODO();
	}
	
	public static final class Builder
	{
		public Builder()
		{

			throw new todo.TODO();
		}
		
		public GPIOPinConfig build()
		{
			throw new todo.TODO();
		}

Name change from runt/apis/dio-gpio/jdk/dio/gpio/GPIOPinPermission.java to modules/dio-gpio/src/main/java/jdk/dio/gpio/GPIOPinPermission.java.

Name change from runt/apis/dio-gpio/jdk/dio/gpio/GPIOPort.java to modules/dio-gpio/src/main/java/jdk/dio/gpio/GPIOPort.java.

14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import jdk.dio.ClosedDeviceException;
import jdk.dio.Device;
import jdk.dio.UnavailableDeviceException;

public interface GPIOPort
	extends Device<GPIOPort>
{
	public static final int INPUT =
		0;
	
	public static final int OUTPUT =
		1;
	
	public abstract int getDirection()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	public abstract int getMaxValue()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	public abstract GPIOPin[] getPins();
	
	public abstract int getValue()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	public abstract void setDirection(int __a)
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	public abstract void setInputListener(PortListener __a)
		throws IOException, ClosedDeviceException;
	
	public abstract void setValue(int __a)
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
}









|


|


|



|



|

|



|



|


|





14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import jdk.dio.ClosedDeviceException;
import jdk.dio.Device;
import jdk.dio.UnavailableDeviceException;

public interface GPIOPort
	extends Device<GPIOPort>
{
	int INPUT =
		0;
	
	int OUTPUT =
		1;
	
	int getDirection()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	int getMaxValue()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	GPIOPin[] getPins();
	
	int getValue()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	void setDirection(int __a)
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	void setInputListener(PortListener __a)
		throws IOException, ClosedDeviceException;
	
	void setValue(int __a)
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
}


Name change from runt/apis/dio-gpio/jdk/dio/gpio/GPIOPortConfig.java to modules/dio-gpio/src/main/java/jdk/dio/gpio/GPIOPortConfig.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package jdk.dio.gpio;

import java.io.InputStream;
import java.io.IOException;
import java.io.OutputStream;
import jdk.dio.DeviceConfig;

public final class GPIOPortConfig
	implements DeviceConfig<GPIOPort>
{
	public static final int DIR_BOTH_INIT_INPUT =
		2;
	
	public static final int DIR_BOTH_INIT_OUTPUT =
		3;
	
	public static final int DIR_INPUT_ONLY =
		0;
	
	public static final int DIR_OUTPUT_ONLY =
		1;
	
	public GPIOPortConfig(int __a, int __b, GPIOPinConfig... __c)
	{
		super();
		throw new todo.TODO();
	}
	
	public boolean equals(Object __a)
	{
		throw new todo.TODO();
	}












|
|




















<







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34

35
36
37
38
39
40
41
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package jdk.dio.gpio;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import jdk.dio.DeviceConfig;

public final class GPIOPortConfig
	implements DeviceConfig<GPIOPort>
{
	public static final int DIR_BOTH_INIT_INPUT =
		2;
	
	public static final int DIR_BOTH_INIT_OUTPUT =
		3;
	
	public static final int DIR_INPUT_ONLY =
		0;
	
	public static final int DIR_OUTPUT_ONLY =
		1;
	
	public GPIOPortConfig(int __a, int __b, GPIOPinConfig... __c)
	{

		throw new todo.TODO();
	}
	
	public boolean equals(Object __a)
	{
		throw new todo.TODO();
	}

Name change from runt/apis/dio-gpio/jdk/dio/gpio/GPIOPortPermission.java to modules/dio-gpio/src/main/java/jdk/dio/gpio/GPIOPortPermission.java.

Name change from runt/apis/dio-gpio/jdk/dio/gpio/PinEvent.java to modules/dio-gpio/src/main/java/jdk/dio/gpio/PinEvent.java.

13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import jdk.dio.DeviceEvent;

public class PinEvent
	extends DeviceEvent<GPIOPin>
{
	public PinEvent(GPIOPin __a, boolean __b)
	{
		super();
		throw new todo.TODO();
	}
	
	public PinEvent(GPIOPin __a, boolean __b, long __c, int __d)
	{
		super();
		throw new todo.TODO();
	}
	
	public boolean getValue()
	{
		throw new todo.TODO();
	}







<





<







13
14
15
16
17
18
19

20
21
22
23
24

25
26
27
28
29
30
31
import jdk.dio.DeviceEvent;

public class PinEvent
	extends DeviceEvent<GPIOPin>
{
	public PinEvent(GPIOPin __a, boolean __b)
	{

		throw new todo.TODO();
	}
	
	public PinEvent(GPIOPin __a, boolean __b, long __c, int __d)
	{

		throw new todo.TODO();
	}
	
	public boolean getValue()
	{
		throw new todo.TODO();
	}

Name change from runt/apis/dio-gpio/jdk/dio/gpio/PinListener.java to modules/dio-gpio/src/main/java/jdk/dio/gpio/PinListener.java.

11
12
13
14
15
16
17
18
19
20
21
package jdk.dio.gpio;

import jdk.dio.DeviceEventListener;

public interface PinListener
	extends DeviceEventListener
{
	public abstract void valueChanged(PinEvent __a);
}









|



11
12
13
14
15
16
17
18
19
20
21
package jdk.dio.gpio;

import jdk.dio.DeviceEventListener;

public interface PinListener
	extends DeviceEventListener
{
	void valueChanged(PinEvent __a);
}


Name change from runt/apis/dio-gpio/jdk/dio/gpio/PortEvent.java to modules/dio-gpio/src/main/java/jdk/dio/gpio/PortEvent.java.

13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import jdk.dio.DeviceEvent;

public class PortEvent
	extends DeviceEvent<GPIOPort>
{
	public PortEvent(GPIOPort __a, int __b)
	{
		super();
		throw new todo.TODO();
	}
	
	public PortEvent(GPIOPort __a, int __b, long __c, int __d)
	{
		super();
		throw new todo.TODO();
	}
	
	public int getValue()
	{
		throw new todo.TODO();
	}







<





<







13
14
15
16
17
18
19

20
21
22
23
24

25
26
27
28
29
30
31
import jdk.dio.DeviceEvent;

public class PortEvent
	extends DeviceEvent<GPIOPort>
{
	public PortEvent(GPIOPort __a, int __b)
	{

		throw new todo.TODO();
	}
	
	public PortEvent(GPIOPort __a, int __b, long __c, int __d)
	{

		throw new todo.TODO();
	}
	
	public int getValue()
	{
		throw new todo.TODO();
	}

Name change from runt/apis/dio-gpio/jdk/dio/gpio/PortListener.java to modules/dio-gpio/src/main/java/jdk/dio/gpio/PortListener.java.

9
10
11
12
13
14
15
16
17
18
19
// ---------------------------------------------------------------------------

package jdk.dio.gpio;


public interface PortListener
{
	public abstract void valueChanged(PortEvent __a);
}









|



9
10
11
12
13
14
15
16
17
18
19
// ---------------------------------------------------------------------------

package jdk.dio.gpio;


public interface PortListener
{
	void valueChanged(PortEvent __a);
}


Name change from runt/apis/dio-gpio/jdk/dio/gpio/package-info.java to modules/dio-gpio/src/main/java/jdk/dio/gpio/package-info.java.

Added modules/dio-i2cbus/build.gradle.











































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import cc.squirreljme.plugin.swm.JavaMEMidletType
import cc.squirreljme.plugin.swm.JavaMEStandard

description = "This provides access to the I2C bus."
version = rootProject.version

squirreljme
{
	javaDocErrorCode = "CT"
	swmType = JavaMEMidletType.API
	swmName = "JavaME 8 Device I/O (I2C)"
	swmVendor = "Stephanie Gawroriski"
	definedStandards += new JavaMEStandard("dio.i2cbus;;1.0.1")
}

dependencies
{
	implementation project(":modules:cldc")

	implementation project(":modules:dio")
}

Name change from runt/apis/dio-i2cbus/jdk/dio/i2cbus/I2CCombinedMessage.java to modules/dio-i2cbus/src/main/java/jdk/dio/i2cbus/I2CCombinedMessage.java.

13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import java.io.IOException;
import java.nio.ByteBuffer;
import jdk.dio.ClosedDeviceException;
import jdk.dio.UnavailableDeviceException;

public interface I2CCombinedMessage
{
	public abstract I2CCombinedMessage appendRead(I2CDevice __a, ByteBuffer 
		__b)
		throws IOException, ClosedDeviceException;
	
	public abstract I2CCombinedMessage appendRead(I2CDevice __a, int __b, 
		ByteBuffer __c)
		throws IOException, ClosedDeviceException;
	
	public abstract I2CCombinedMessage appendWrite(I2CDevice __a, ByteBuffer 
		__b)
		throws IOException, ClosedDeviceException;
	
	public abstract int[] transfer()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
}









|
<


|
<


|
<


|





13
14
15
16
17
18
19
20

21
22
23

24
25
26

27
28
29
30
31
32
33
34
import java.io.IOException;
import java.nio.ByteBuffer;
import jdk.dio.ClosedDeviceException;
import jdk.dio.UnavailableDeviceException;

public interface I2CCombinedMessage
{
	I2CCombinedMessage appendRead(I2CDevice __a, ByteBuffer __b)

		throws IOException, ClosedDeviceException;
	
	I2CCombinedMessage appendRead(I2CDevice __a, int __b, ByteBuffer __c)

		throws IOException, ClosedDeviceException;
	
	I2CCombinedMessage appendWrite(I2CDevice __a, ByteBuffer __b)

		throws IOException, ClosedDeviceException;
	
	int[] transfer()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
}


Name change from runt/apis/dio-i2cbus/jdk/dio/i2cbus/I2CDevice.java to modules/dio-i2cbus/src/main/java/jdk/dio/i2cbus/I2CDevice.java.

17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import jdk.dio.ClosedDeviceException;
import jdk.dio.Device;
import jdk.dio.UnavailableDeviceException;

public interface I2CDevice
	extends Device<I2CDevice>, ByteChannel, BufferAccess<ByteBuffer>
{
	public abstract I2CDevice.Bus getBus()
		throws IOException;
	
	public abstract int read()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	public abstract int read(ByteBuffer __a)
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	public abstract int read(int __a, ByteBuffer __b)
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	public abstract int read(int __a, int __b, ByteBuffer __c)
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	public abstract int read(int __a, int __b, int __c, ByteBuffer __d)
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	public abstract int write(ByteBuffer __a)
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	public abstract void write(int __a)
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	public abstract int write(int __a, int __b, ByteBuffer __c)
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	public static interface Bus
	{
		public abstract I2CCombinedMessage createCombinedMessage();
	}
}









|


|



|



|



|



|



|



|



|



|

|




17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import jdk.dio.ClosedDeviceException;
import jdk.dio.Device;
import jdk.dio.UnavailableDeviceException;

public interface I2CDevice
	extends Device<I2CDevice>, ByteChannel, BufferAccess<ByteBuffer>
{
	I2CDevice.Bus getBus()
		throws IOException;
	
	int read()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	int read(ByteBuffer __a)
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	int read(int __a, ByteBuffer __b)
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	int read(int __a, int __b, ByteBuffer __c)
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	int read(int __a, int __b, int __c, ByteBuffer __d)
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	int write(ByteBuffer __a)
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	void write(int __a)
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	int write(int __a, int __b, ByteBuffer __c)
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	interface Bus
	{
		I2CCombinedMessage createCombinedMessage();
	}
}


Name change from runt/apis/dio-i2cbus/jdk/dio/i2cbus/I2CDeviceConfig.java to modules/dio-i2cbus/src/main/java/jdk/dio/i2cbus/I2CDeviceConfig.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package jdk.dio.i2cbus;

import java.io.InputStream;
import java.io.IOException;
import java.io.OutputStream;
import jdk.dio.DeviceConfig;

public final class I2CDeviceConfig
	implements DeviceConfig<I2CDevice>, DeviceConfig.HardwareAddressing
{
	public static final int ADDR_SIZE_10 =
		10;
	
	public static final int ADDR_SIZE_7 =
		7;
	
	@Deprecated
	public I2CDeviceConfig(int __a, int __b, int __c, int __d)
	{
		super();
		throw new todo.TODO();
	}
	
	@Deprecated
	public I2CDeviceConfig(String __a, int __b, int __c, int __d)
	{
		super();
		throw new todo.TODO();
	}
	
	public boolean equals(Object __a)
	{
		throw new todo.TODO();
	}












|
|















<






<







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29

30
31
32
33
34
35

36
37
38
39
40
41
42
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package jdk.dio.i2cbus;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import jdk.dio.DeviceConfig;

public final class I2CDeviceConfig
	implements DeviceConfig<I2CDevice>, DeviceConfig.HardwareAddressing
{
	public static final int ADDR_SIZE_10 =
		10;
	
	public static final int ADDR_SIZE_7 =
		7;
	
	@Deprecated
	public I2CDeviceConfig(int __a, int __b, int __c, int __d)
	{

		throw new todo.TODO();
	}
	
	@Deprecated
	public I2CDeviceConfig(String __a, int __b, int __c, int __d)
	{

		throw new todo.TODO();
	}
	
	public boolean equals(Object __a)
	{
		throw new todo.TODO();
	}
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
		throw new todo.TODO();
	}
	
	public static final class Builder
	{
		public Builder()
		{
			super();
			throw new todo.TODO();
		}
		
		public I2CDeviceConfig build()
		{
			throw new todo.TODO();
		}







<







97
98
99
100
101
102
103

104
105
106
107
108
109
110
		throw new todo.TODO();
	}
	
	public static final class Builder
	{
		public Builder()
		{

			throw new todo.TODO();
		}
		
		public I2CDeviceConfig build()
		{
			throw new todo.TODO();
		}

Name change from runt/apis/dio-i2cbus/jdk/dio/i2cbus/I2CPermission.java to modules/dio-i2cbus/src/main/java/jdk/dio/i2cbus/I2CPermission.java.

Name change from runt/apis/dio-i2cbus/jdk/dio/i2cbus/package-info.java to modules/dio-i2cbus/src/main/java/jdk/dio/i2cbus/package-info.java.

Added modules/dio-mmio/build.gradle.











































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import cc.squirreljme.plugin.swm.JavaMEMidletType
import cc.squirreljme.plugin.swm.JavaMEStandard

description = "This provides access to memory mapped I/O devices."
version = rootProject.version

squirreljme
{
	javaDocErrorCode = "DT"
	swmType = JavaMEMidletType.API
	swmName = "JavaME 8 Device I/O (MMIO)"
	swmVendor = "Stephanie Gawroriski"
	definedStandards += new JavaMEStandard("dio.mmio;;1.0.1")
}

dependencies
{
	implementation project(":modules:cldc")

	implementation project(":modules:dio")
}

Name change from runt/apis/dio-mmio/jdk/dio/mmio/AccessOutOfBoundsException.java to modules/dio-mmio/src/main/java/jdk/dio/mmio/AccessOutOfBoundsException.java.

Name change from runt/apis/dio-mmio/jdk/dio/mmio/MMIODevice.java to modules/dio-mmio/src/main/java/jdk/dio/mmio/MMIODevice.java.

15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36


37
38
39
40
import jdk.dio.ClosedDeviceException;
import jdk.dio.Device;
import jdk.dio.UnavailableDeviceException;

public interface MMIODevice
	extends Device<MMIODevice>
{
	public abstract RawBlock getAsRawBlock()
		throws ClosedDeviceException, IOException, UnavailableDeviceException;
	
	public abstract RawBlock getBlock(String __n)
		throws ClosedDeviceException, IOException, UnavailableDeviceException;
	
	public abstract void setMMIOEventListener(int __evid, int __cdx,
		ByteBuffer __cbuf, MMIOEventListener __el)
		throws ClosedDeviceException, IOException;
	
	public abstract void setMMIOEventListener(int __evid,
		MMIOEventListener __el)
		throws ClosedDeviceException, IOException;
	
	public abstract void setMMIOEventListener(int __evid, String __cn,


		MMIOEventListener __el)
		throws ClosedDeviceException, IOException;
}








|


|


|
<
<
<
<



|
>
>
|



15
16
17
18
19
20
21
22
23
24
25
26
27
28




29
30
31
32
33
34
35
36
37
38
import jdk.dio.ClosedDeviceException;
import jdk.dio.Device;
import jdk.dio.UnavailableDeviceException;

public interface MMIODevice
	extends Device<MMIODevice>
{
	RawBlock getAsRawBlock()
		throws ClosedDeviceException, IOException, UnavailableDeviceException;
	
	RawBlock getBlock(String __n)
		throws ClosedDeviceException, IOException, UnavailableDeviceException;
	
	void setMMIOEventListener(int __evid, int __cdx, ByteBuffer __cbuf,




		MMIOEventListener __el)
		throws ClosedDeviceException, IOException;
	
	void setMMIOEventListener(int __evid, MMIOEventListener __el)
		throws ClosedDeviceException, IOException;
	
	void setMMIOEventListener(int __evid, String __cn, MMIOEventListener __el)
		throws ClosedDeviceException, IOException;
}

Name change from runt/apis/dio-mmio/jdk/dio/mmio/MMIODeviceConfig.java to modules/dio-mmio/src/main/java/jdk/dio/mmio/MMIODeviceConfig.java.

Name change from runt/apis/dio-mmio/jdk/dio/mmio/MMIOEvent.java to modules/dio-mmio/src/main/java/jdk/dio/mmio/MMIOEvent.java.

Name change from runt/apis/dio-mmio/jdk/dio/mmio/MMIOEventListener.java to modules/dio-mmio/src/main/java/jdk/dio/mmio/MMIOEventListener.java.

11
12
13
14
15
16
17
18
19
20
package jdk.dio.mmio;

import jdk.dio.DeviceEventListener;

public interface MMIOEventListener
	extends DeviceEventListener
{
	public abstract void eventDispatched(MMIOEvent __e);
}








|


11
12
13
14
15
16
17
18
19
20
package jdk.dio.mmio;

import jdk.dio.DeviceEventListener;

public interface MMIOEventListener
	extends DeviceEventListener
{
	void eventDispatched(MMIOEvent __e);
}

Name change from runt/apis/dio-mmio/jdk/dio/mmio/MMIOPermission.java to modules/dio-mmio/src/main/java/jdk/dio/mmio/MMIOPermission.java.

Name change from runt/apis/dio-mmio/jdk/dio/mmio/RawBlock.java to modules/dio-mmio/src/main/java/jdk/dio/mmio/RawBlock.java.

14
15
16
17
18
19
20
21
22
23
24
import java.nio.ByteBuffer;
import jdk.dio.ClosedDeviceException;
import jdk.dio.UnavailableDeviceException;

public interface RawBlock
	extends RawMemory
{
	public abstract ByteBuffer asDirectBuffer()
		throws ClosedDeviceException, IOException, UnavailableDeviceException;
}








|



14
15
16
17
18
19
20
21
22
23
24
import java.nio.ByteBuffer;
import jdk.dio.ClosedDeviceException;
import jdk.dio.UnavailableDeviceException;

public interface RawBlock
	extends RawMemory
{
	ByteBuffer asDirectBuffer()
		throws ClosedDeviceException, IOException, UnavailableDeviceException;
}

Name change from runt/apis/dio-mmio/jdk/dio/mmio/RawMemory.java to modules/dio-mmio/src/main/java/jdk/dio/mmio/RawMemory.java.

8
9
10
11
12
13
14
15
16
17
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package jdk.dio.mmio;

public interface RawMemory
{
	public abstract String getName();
}








|


8
9
10
11
12
13
14
15
16
17
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package jdk.dio.mmio;

public interface RawMemory
{
	String getName();
}

Name change from runt/apis/dio-mmio/jdk/dio/mmio/RawRegister.java to modules/dio-mmio/src/main/java/jdk/dio/mmio/RawRegister.java.

13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import java.io.IOException;
import jdk.dio.ClosedDeviceException;
import jdk.dio.UnavailableDeviceException;

public interface RawRegister<T extends Number>
	extends RawMemory
{
	public abstract void and(T __v)
		throws ClosedDeviceException, IOException, UnavailableDeviceException;
	
	public abstract void clearBit(int __dx)
		throws ClosedDeviceException, IOException, UnavailableDeviceException;
	
	public abstract void clearBits(T __mask)
		throws ClosedDeviceException, IOException, UnavailableDeviceException;
	
	public abstract T get()
		throws ClosedDeviceException, IOException, UnavailableDeviceException;
	
	public abstract Class<T> getType();
	
	public abstract boolean isBitSet(int __dx)
		throws ClosedDeviceException, IOException, UnavailableDeviceException;
	
	public abstract void or(T __v)
		throws ClosedDeviceException, IOException, UnavailableDeviceException;
	
	public abstract void set(T __v)
		throws ClosedDeviceException, IOException, UnavailableDeviceException;
	
	public abstract void setBit(int __dx)
		throws ClosedDeviceException, IOException, UnavailableDeviceException;
	
	public abstract void setBits(T __mask)
		throws ClosedDeviceException, IOException, UnavailableDeviceException;
	
	public abstract void xor(T __v)
		throws ClosedDeviceException, IOException, UnavailableDeviceException;
}








|


|


|


|


|

|


|


|


|


|


|



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import java.io.IOException;
import jdk.dio.ClosedDeviceException;
import jdk.dio.UnavailableDeviceException;

public interface RawRegister<T extends Number>
	extends RawMemory
{
	void and(T __v)
		throws ClosedDeviceException, IOException, UnavailableDeviceException;
	
	void clearBit(int __dx)
		throws ClosedDeviceException, IOException, UnavailableDeviceException;
	
	void clearBits(T __mask)
		throws ClosedDeviceException, IOException, UnavailableDeviceException;
	
	T get()
		throws ClosedDeviceException, IOException, UnavailableDeviceException;
	
	Class<T> getType();
	
	boolean isBitSet(int __dx)
		throws ClosedDeviceException, IOException, UnavailableDeviceException;
	
	void or(T __v)
		throws ClosedDeviceException, IOException, UnavailableDeviceException;
	
	void set(T __v)
		throws ClosedDeviceException, IOException, UnavailableDeviceException;
	
	void setBit(int __dx)
		throws ClosedDeviceException, IOException, UnavailableDeviceException;
	
	void setBits(T __mask)
		throws ClosedDeviceException, IOException, UnavailableDeviceException;
	
	void xor(T __v)
		throws ClosedDeviceException, IOException, UnavailableDeviceException;
}

Name change from runt/apis/dio-mmio/jdk/dio/mmio/package-info.java to modules/dio-mmio/src/main/java/jdk/dio/mmio/package-info.java.

Added modules/dio-modem/build.gradle.











































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import cc.squirreljme.plugin.swm.JavaMEMidletType
import cc.squirreljme.plugin.swm.JavaMEStandard

description = "This provides access to dial-up modems."
version = rootProject.version

squirreljme
{
	javaDocErrorCode = "CY"
	swmType = JavaMEMidletType.API
	swmName = "JavaME 8 Device I/O (Modems)"
	swmVendor = "Stephanie Gawroriski"
	definedStandards += new JavaMEStandard("dio.modem;;1.0.1")
}

dependencies
{
	implementation project(":modules:cldc")

	implementation project(":modules:dio")
}

Name change from runt/apis/dio-modem/jdk/dio/modem/ModemSignalEvent.java to modules/dio-modem/src/main/java/jdk/dio/modem/ModemSignalEvent.java.

18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
{
	protected int signalID;
	
	protected boolean signalState;
	
	public ModemSignalEvent(P __a, int __b, boolean __c)
	{
		super();
		throw new todo.TODO();
	}
	
	public ModemSignalEvent(P __a, int __b, boolean __c, long __d, int __e)
	{
		super();
		throw new todo.TODO();
	}
	
	public int getSignalID()
	{
		throw new todo.TODO();
	}







<





<







18
19
20
21
22
23
24

25
26
27
28
29

30
31
32
33
34
35
36
{
	protected int signalID;
	
	protected boolean signalState;
	
	public ModemSignalEvent(P __a, int __b, boolean __c)
	{

		throw new todo.TODO();
	}
	
	public ModemSignalEvent(P __a, int __b, boolean __c, long __d, int __e)
	{

		throw new todo.TODO();
	}
	
	public int getSignalID()
	{
		throw new todo.TODO();
	}

Name change from runt/apis/dio-modem/jdk/dio/modem/ModemSignalListener.java to modules/dio-modem/src/main/java/jdk/dio/modem/ModemSignalListener.java.

12
13
14
15
16
17
18
19
20
21
22

import jdk.dio.Device;
import jdk.dio.DeviceEventListener;

public interface ModemSignalListener<P extends Device<? super P>>
	extends DeviceEventListener
{
	public abstract void signalStateChanged(ModemSignalEvent<P> __a);
}









|



12
13
14
15
16
17
18
19
20
21
22

import jdk.dio.Device;
import jdk.dio.DeviceEventListener;

public interface ModemSignalListener<P extends Device<? super P>>
	extends DeviceEventListener
{
	void signalStateChanged(ModemSignalEvent<P> __a);
}


Name change from runt/apis/dio-modem/jdk/dio/modem/ModemSignalsControl.java to modules/dio-modem/src/main/java/jdk/dio/modem/ModemSignalsControl.java.

13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import java.io.IOException;
import jdk.dio.ClosedDeviceException;
import jdk.dio.Device;
import jdk.dio.UnavailableDeviceException;

public interface ModemSignalsControl<P extends Device<? super P>>
{
	public static final int CTS_SIGNAL =
		32;
	
	public static final int DCD_SIGNAL =
		2;
	
	public static final int DSR_SIGNAL =
		4;
	
	public static final int DTR_SIGNAL =
		1;
	
	public static final int RI_SIGNAL =
		8;
	
	public static final int RTS_SIGNAL =
		16;
	
	public abstract boolean getSignalState(int __a)
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	public abstract void setSignalChangeListener(ModemSignalListener<P> __a, 
		int __b)
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	public abstract void setSignalState(int __a, boolean __b)
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
}









|


|


|


|


|


|


|



|
<



|





13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42

43
44
45
46
47
48
49
50
51
import java.io.IOException;
import jdk.dio.ClosedDeviceException;
import jdk.dio.Device;
import jdk.dio.UnavailableDeviceException;

public interface ModemSignalsControl<P extends Device<? super P>>
{
	int CTS_SIGNAL =
		32;
	
	int DCD_SIGNAL =
		2;
	
	int DSR_SIGNAL =
		4;
	
	int DTR_SIGNAL =
		1;
	
	int RI_SIGNAL =
		8;
	
	int RTS_SIGNAL =
		16;
	
	boolean getSignalState(int __a)
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	void setSignalChangeListener(ModemSignalListener<P> __a, int __b)

		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	void setSignalState(int __a, boolean __b)
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
}


Name change from runt/apis/dio-modem/jdk/dio/modem/package-info.java to modules/dio-modem/src/main/java/jdk/dio/modem/package-info.java.

Added modules/dio-pwm/build.gradle.















































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import cc.squirreljme.plugin.swm.JavaMEMidletType
import cc.squirreljme.plugin.swm.JavaMEStandard

description = "This provides access to PWM devices."
version = rootProject.version

squirreljme
{
	javaDocErrorCode = "DR"
	swmType = JavaMEMidletType.API
	swmName = "JavaME 8 Device I/O (PWM)"
	swmVendor = "Stephanie Gawroriski"
	definedStandards += new JavaMEStandard("dio.pwm;;1.0.1")
}

dependencies
{
	implementation project(":modules:cldc-compact")
	implementation project(":modules:cldc")

	implementation project(":modules:dio")
	implementation project(":modules:dio-gpio")
}

Name change from runt/apis/dio-pwm/jdk/dio/pwm/GenerationEvent.java to modules/dio-pwm/src/main/java/jdk/dio/pwm/GenerationEvent.java.

13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import jdk.dio.DeviceEvent;

public class GenerationEvent
	extends DeviceEvent<PWMChannel>
{
	public GenerationEvent(PWMChannel __a, int __b)
	{
		super();
		throw new todo.TODO();
	}
	
	public GenerationEvent(PWMChannel __a, int __b, long __c, int __d)
	{
		super();
		throw new todo.TODO();
	}
	
	public int getPulseCount()
	{
		throw new todo.TODO();
	}







<





<







13
14
15
16
17
18
19

20
21
22
23
24

25
26
27
28
29
30
31
import jdk.dio.DeviceEvent;

public class GenerationEvent
	extends DeviceEvent<PWMChannel>
{
	public GenerationEvent(PWMChannel __a, int __b)
	{

		throw new todo.TODO();
	}
	
	public GenerationEvent(PWMChannel __a, int __b, long __c, int __d)
	{

		throw new todo.TODO();
	}
	
	public int getPulseCount()
	{
		throw new todo.TODO();
	}

Name change from runt/apis/dio-pwm/jdk/dio/pwm/GenerationListener.java to modules/dio-pwm/src/main/java/jdk/dio/pwm/GenerationListener.java.

12
13
14
15
16
17
18
19
20
21
22
23
24

import jdk.dio.AsyncErrorHandler;
import jdk.dio.DeviceEventListener;

public interface GenerationListener
	extends DeviceEventListener, AsyncErrorHandler<PWMChannel>
{
	public abstract void failed(Throwable __a, PWMChannel __b);
	
	public abstract void pulseGenerationCompleted(GenerationEvent __a);
}









|

|



12
13
14
15
16
17
18
19
20
21
22
23
24

import jdk.dio.AsyncErrorHandler;
import jdk.dio.DeviceEventListener;

public interface GenerationListener
	extends DeviceEventListener, AsyncErrorHandler<PWMChannel>
{
	void failed(Throwable __a, PWMChannel __b);
	
	void pulseGenerationCompleted(GenerationEvent __a);
}


Name change from runt/apis/dio-pwm/jdk/dio/pwm/GenerationRoundListener.java to modules/dio-pwm/src/main/java/jdk/dio/pwm/GenerationRoundListener.java.

13
14
15
16
17
18
19
20
21
22
23
24
25
26
import java.nio.IntBuffer;
import jdk.dio.OutputRoundListener;
import jdk.dio.RoundCompletionEvent;

public interface GenerationRoundListener
	extends OutputRoundListener<PWMChannel, IntBuffer>
{
	public abstract void failed(Throwable __a, PWMChannel __b);
	
	public abstract void outputRoundCompleted(RoundCompletionEvent<PWMChannel
		, IntBuffer> __a);
}









|

|
<



13
14
15
16
17
18
19
20
21
22

23
24
25
import java.nio.IntBuffer;
import jdk.dio.OutputRoundListener;
import jdk.dio.RoundCompletionEvent;

public interface GenerationRoundListener
	extends OutputRoundListener<PWMChannel, IntBuffer>
{
	void failed(Throwable __a, PWMChannel __b);
	
	void outputRoundCompleted(RoundCompletionEvent<PWMChannel, IntBuffer> __a);

}


Name change from runt/apis/dio-pwm/jdk/dio/pwm/InvalidPulseRateException.java to modules/dio-pwm/src/main/java/jdk/dio/pwm/InvalidPulseRateException.java.

12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30


public class InvalidPulseRateException
	extends RuntimeException
{
	public InvalidPulseRateException()
	{
		super();
		throw new todo.TODO();
	}
	
	public InvalidPulseRateException(String __a)
	{
		super();
		throw new todo.TODO();
	}
}









<





<





12
13
14
15
16
17
18

19
20
21
22
23

24
25
26
27
28


public class InvalidPulseRateException
	extends RuntimeException
{
	public InvalidPulseRateException()
	{

		throw new todo.TODO();
	}
	
	public InvalidPulseRateException(String __a)
	{

		throw new todo.TODO();
	}
}


Name change from runt/apis/dio-pwm/jdk/dio/pwm/PWMChannel.java to modules/dio-pwm/src/main/java/jdk/dio/pwm/PWMChannel.java.

11
12
13
14
15
16
17
18
19
20

21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
package jdk.dio.pwm;

import java.io.IOException;
import java.nio.IntBuffer;
import jdk.dio.BufferAccess;
import jdk.dio.ClosedDeviceException;
import jdk.dio.Device;
import jdk.dio.gpio.GPIOPin;
import jdk.dio.UnavailableDeviceException;
import jdk.dio.UnsupportedByteOrderException;


public interface PWMChannel
	extends Device<PWMChannel>, BufferAccess<IntBuffer>
{
	public abstract void generate(int __a, int __b)
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	public abstract void generate(IntBuffer __a)
		throws IOException, UnavailableDeviceException, 
			UnsupportedByteOrderException, ClosedDeviceException;
	
	public abstract int getMaxPulsePeriod()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	public abstract int getMinPulsePeriod()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	public abstract GPIOPin getOutput();
	
	public abstract int getPulsePeriod()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	public abstract double getScaleFactor()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	public abstract void setPulsePeriod(int __a)
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	public abstract void setScaleFactor(double __a)
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	public abstract void startGeneration(int __a)
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	public abstract void startGeneration(int __a, int __b, GenerationListener
		__c)
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	public abstract void startGeneration(IntBuffer __a, 
		GenerationRoundListener __b)
		throws IOException, UnavailableDeviceException, 
			UnsupportedByteOrderException, ClosedDeviceException;
	
	public abstract void startGeneration(IntBuffer __a, IntBuffer __b, 
		GenerationRoundListener __c)
		throws IOException, UnavailableDeviceException, 
			UnsupportedByteOrderException, ClosedDeviceException;
	
	public abstract void stopGeneration()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
}









<


>




|



|



|



|



|

|



|



|



|



|



|
<



|
<



|




|





11
12
13
14
15
16
17

18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63

64
65
66
67

68
69
70
71
72
73
74
75
76
77
78
79
80
81
package jdk.dio.pwm;

import java.io.IOException;
import java.nio.IntBuffer;
import jdk.dio.BufferAccess;
import jdk.dio.ClosedDeviceException;
import jdk.dio.Device;

import jdk.dio.UnavailableDeviceException;
import jdk.dio.UnsupportedByteOrderException;
import jdk.dio.gpio.GPIOPin;

public interface PWMChannel
	extends Device<PWMChannel>, BufferAccess<IntBuffer>
{
	void generate(int __a, int __b)
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	void generate(IntBuffer __a)
		throws IOException, UnavailableDeviceException, 
			UnsupportedByteOrderException, ClosedDeviceException;
	
	int getMaxPulsePeriod()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	int getMinPulsePeriod()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	GPIOPin getOutput();
	
	int getPulsePeriod()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	double getScaleFactor()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	void setPulsePeriod(int __a)
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	void setScaleFactor(double __a)
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	void startGeneration(int __a)
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	void startGeneration(int __a, int __b, GenerationListener __c)

		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	void startGeneration(IntBuffer __a, GenerationRoundListener __b)

		throws IOException, UnavailableDeviceException, 
			UnsupportedByteOrderException, ClosedDeviceException;
	
	void startGeneration(IntBuffer __a, IntBuffer __b,
		GenerationRoundListener __c)
		throws IOException, UnavailableDeviceException, 
			UnsupportedByteOrderException, ClosedDeviceException;
	
	void stopGeneration()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
}


Name change from runt/apis/dio-pwm/jdk/dio/pwm/PWMChannelConfig.java to modules/dio-pwm/src/main/java/jdk/dio/pwm/PWMChannelConfig.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package jdk.dio.pwm;

import java.io.InputStream;
import java.io.IOException;
import java.io.OutputStream;
import jdk.dio.DeviceConfig;
import jdk.dio.gpio.GPIOPin;
import jdk.dio.gpio.GPIOPinConfig;

public final class PWMChannelConfig
	implements DeviceConfig<PWMChannel>, DeviceConfig.HardwareAddressing












|
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package jdk.dio.pwm;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import jdk.dio.DeviceConfig;
import jdk.dio.gpio.GPIOPin;
import jdk.dio.gpio.GPIOPinConfig;

public final class PWMChannelConfig
	implements DeviceConfig<PWMChannel>, DeviceConfig.HardwareAddressing
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
	
	public static final int IDLE_STATE_LOW =
		1;
	
	@Deprecated
	public PWMChannelConfig(int __a, int __b, int __c, int __d, int __e)
	{
		super();
		throw new todo.TODO();
	}
	
	@Deprecated
	public PWMChannelConfig(int __a, int __b, int __c, int __d, int __e, 
		GPIOPinConfig __f)
	{
		super();
		throw new todo.TODO();
	}
	
	@Deprecated
	public PWMChannelConfig(String __a, int __b, int __c, int __d, int __e)
	{
		super();
		throw new todo.TODO();
	}
	
	@Deprecated
	public PWMChannelConfig(String __a, int __b, int __c, int __d, int __e, 
		GPIOPinConfig __f)
	{
		super();
		throw new todo.TODO();
	}
	
	public boolean equals(Object __a)
	{
		throw new todo.TODO();
	}







<







<






<







<







34
35
36
37
38
39
40

41
42
43
44
45
46
47

48
49
50
51
52
53

54
55
56
57
58
59
60

61
62
63
64
65
66
67
	
	public static final int IDLE_STATE_LOW =
		1;
	
	@Deprecated
	public PWMChannelConfig(int __a, int __b, int __c, int __d, int __e)
	{

		throw new todo.TODO();
	}
	
	@Deprecated
	public PWMChannelConfig(int __a, int __b, int __c, int __d, int __e, 
		GPIOPinConfig __f)
	{

		throw new todo.TODO();
	}
	
	@Deprecated
	public PWMChannelConfig(String __a, int __b, int __c, int __d, int __e)
	{

		throw new todo.TODO();
	}
	
	@Deprecated
	public PWMChannelConfig(String __a, int __b, int __c, int __d, int __e, 
		GPIOPinConfig __f)
	{

		throw new todo.TODO();
	}
	
	public boolean equals(Object __a)
	{
		throw new todo.TODO();
	}
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
		throw new todo.TODO();
	}
	
	public static final class Builder
	{
		public Builder()
		{
			super();
			throw new todo.TODO();
		}
		
		public PWMChannelConfig build()
		{
			throw new todo.TODO();
		}







<







138
139
140
141
142
143
144

145
146
147
148
149
150
151
		throw new todo.TODO();
	}
	
	public static final class Builder
	{
		public Builder()
		{

			throw new todo.TODO();
		}
		
		public PWMChannelConfig build()
		{
			throw new todo.TODO();
		}

Name change from runt/apis/dio-pwm/jdk/dio/pwm/PWMPermission.java to modules/dio-pwm/src/main/java/jdk/dio/pwm/PWMPermission.java.

Name change from runt/apis/dio-pwm/jdk/dio/pwm/package-info.java to modules/dio-pwm/src/main/java/jdk/dio/pwm/package-info.java.

Added modules/dio-spibus/build.gradle.











































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import cc.squirreljme.plugin.swm.JavaMEMidletType
import cc.squirreljme.plugin.swm.JavaMEStandard

description = "This provides access to the SPI bus."
version = rootProject.version

squirreljme
{
	javaDocErrorCode = "CU"
	swmType = JavaMEMidletType.API
	swmName = "JavaME 8 Device I/O (SPI)"
	swmVendor = "Stephanie Gawroriski"
	definedStandards += new JavaMEStandard("dio.spibus;;1.0.1")
}

dependencies
{
	implementation project(":modules:cldc")

	implementation project(":modules:dio")
}

Name change from runt/apis/dio-spibus/jdk/dio/spibus/InvalidWordLengthException.java to modules/dio-spibus/src/main/java/jdk/dio/spibus/InvalidWordLengthException.java.

12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30


public class InvalidWordLengthException
	extends RuntimeException
{
	public InvalidWordLengthException()
	{
		super();
		throw new todo.TODO();
	}
	
	public InvalidWordLengthException(String __a)
	{
		super();
		throw new todo.TODO();
	}
}









<





<





12
13
14
15
16
17
18

19
20
21
22
23

24
25
26
27
28


public class InvalidWordLengthException
	extends RuntimeException
{
	public InvalidWordLengthException()
	{

		throw new todo.TODO();
	}
	
	public InvalidWordLengthException(String __a)
	{

		throw new todo.TODO();
	}
}


Name change from runt/apis/dio-spibus/jdk/dio/spibus/SPICompositeMessage.java to modules/dio-spibus/src/main/java/jdk/dio/spibus/SPICompositeMessage.java.

13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import java.io.IOException;
import java.nio.ByteBuffer;
import jdk.dio.ClosedDeviceException;
import jdk.dio.UnavailableDeviceException;

public interface SPICompositeMessage
{
	public abstract SPICompositeMessage appendDelay(int __a)
		throws IOException, ClosedDeviceException;
	
	public abstract SPICompositeMessage appendRead(ByteBuffer __a)
		throws IOException, ClosedDeviceException;
	
	public abstract SPICompositeMessage appendRead(int __a, ByteBuffer __b)
		throws IOException, ClosedDeviceException;
	
	public abstract SPICompositeMessage appendWrite(ByteBuffer __a)
		throws IOException, ClosedDeviceException;
	
	public abstract SPICompositeMessage appendWriteAndRead(ByteBuffer __a, 
		ByteBuffer __b)
		throws IOException, ClosedDeviceException;
	
	public abstract SPICompositeMessage appendWriteAndRead(ByteBuffer __a, 
		int __b, ByteBuffer __c)
		throws IOException, ClosedDeviceException;
	
	public abstract SPIDevice getTargetedDevice();
	
	public abstract int[] transfer()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
}









|


|


|


|


|
<


|
|


|

|





13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32

33
34
35
36
37
38
39
40
41
42
43
44
45
46
import java.io.IOException;
import java.nio.ByteBuffer;
import jdk.dio.ClosedDeviceException;
import jdk.dio.UnavailableDeviceException;

public interface SPICompositeMessage
{
	SPICompositeMessage appendDelay(int __a)
		throws IOException, ClosedDeviceException;
	
	SPICompositeMessage appendRead(ByteBuffer __a)
		throws IOException, ClosedDeviceException;
	
	SPICompositeMessage appendRead(int __a, ByteBuffer __b)
		throws IOException, ClosedDeviceException;
	
	SPICompositeMessage appendWrite(ByteBuffer __a)
		throws IOException, ClosedDeviceException;
	
	SPICompositeMessage appendWriteAndRead(ByteBuffer __a, ByteBuffer __b)

		throws IOException, ClosedDeviceException;
	
	SPICompositeMessage appendWriteAndRead(ByteBuffer __a, int __b,
		ByteBuffer __c)
		throws IOException, ClosedDeviceException;
	
	SPIDevice getTargetedDevice();
	
	int[] transfer()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
}


Name change from runt/apis/dio-spibus/jdk/dio/spibus/SPIDevice.java to modules/dio-spibus/src/main/java/jdk/dio/spibus/SPIDevice.java.

18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import jdk.dio.Device;
import jdk.dio.UnavailableDeviceException;
import jdk.dio.UnsupportedByteOrderException;

public interface SPIDevice
	extends Device<SPIDevice>, ByteChannel, BufferAccess<ByteBuffer>
{
	public abstract SPICompositeMessage createCompositeMessage();
	
	public abstract int getWordLength()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	public abstract int read()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	public abstract int read(ByteBuffer __a)
		throws IOException, UnavailableDeviceException, 
			UnsupportedByteOrderException, ClosedDeviceException;
	
	public abstract int read(int __a, ByteBuffer __b)
		throws IOException, UnavailableDeviceException, 
			UnsupportedByteOrderException, ClosedDeviceException;
	
	public abstract int write(ByteBuffer __a)
		throws IOException, UnavailableDeviceException, 
			UnsupportedByteOrderException, ClosedDeviceException;
	
	public abstract void write(int __a)
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	public abstract int writeAndRead(ByteBuffer __a, ByteBuffer __b)
		throws IOException, UnavailableDeviceException, 
			UnsupportedByteOrderException, ClosedDeviceException;
	
	public abstract int writeAndRead(ByteBuffer __a, int __b, ByteBuffer __c)
		throws IOException, UnavailableDeviceException, 
			UnsupportedByteOrderException, ClosedDeviceException;
	
	public abstract int writeAndRead(int __a)
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
}









|

|



|



|



|



|



|



|



|



|





18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import jdk.dio.Device;
import jdk.dio.UnavailableDeviceException;
import jdk.dio.UnsupportedByteOrderException;

public interface SPIDevice
	extends Device<SPIDevice>, ByteChannel, BufferAccess<ByteBuffer>
{
	SPICompositeMessage createCompositeMessage();
	
	int getWordLength()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	int read()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	int read(ByteBuffer __a)
		throws IOException, UnavailableDeviceException, 
			UnsupportedByteOrderException, ClosedDeviceException;
	
	int read(int __a, ByteBuffer __b)
		throws IOException, UnavailableDeviceException, 
			UnsupportedByteOrderException, ClosedDeviceException;
	
	int write(ByteBuffer __a)
		throws IOException, UnavailableDeviceException, 
			UnsupportedByteOrderException, ClosedDeviceException;
	
	void write(int __a)
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	int writeAndRead(ByteBuffer __a, ByteBuffer __b)
		throws IOException, UnavailableDeviceException, 
			UnsupportedByteOrderException, ClosedDeviceException;
	
	int writeAndRead(ByteBuffer __a, int __b, ByteBuffer __c)
		throws IOException, UnavailableDeviceException, 
			UnsupportedByteOrderException, ClosedDeviceException;
	
	int writeAndRead(int __a)
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
}


Name change from runt/apis/dio-spibus/jdk/dio/spibus/SPIDeviceConfig.java to modules/dio-spibus/src/main/java/jdk/dio/spibus/SPIDeviceConfig.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package jdk.dio.spibus;

import java.io.InputStream;
import java.io.IOException;
import java.io.OutputStream;
import jdk.dio.DeviceConfig;

public final class SPIDeviceConfig
	implements DeviceConfig<SPIDevice>, DeviceConfig.HardwareAddressing
{
	public static final int CS_ACTIVE_HIGH =
		0;
	
	public static final int CS_ACTIVE_LOW =
		1;
	
	public static final int CS_NOT_CONTROLLED =
		2;
	
	@Deprecated
	public SPIDeviceConfig(int __a, int __b, int __c, int __d, int __e, int 
		__f)
	{
		super();
		throw new todo.TODO();
	}
	
	@Deprecated
	public SPIDeviceConfig(int __a, int __b, int __c, int __d, int __e, int 
		__f, int __g)
	{
		super();
		throw new todo.TODO();
	}
	
	@Deprecated
	public SPIDeviceConfig(String __a, int __b, int __c, int __d, int __e, 
		int __f)
	{
		super();
		throw new todo.TODO();
	}
	
	@Deprecated
	public SPIDeviceConfig(String __a, int __b, int __c, int __d, int __e, 
		int __f, int __g)
	{
		super();
		throw new todo.TODO();
	}
	
	public boolean equals(Object __a)
	{
		throw new todo.TODO();
	}












|
|



















<







<







<







<







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33

34
35
36
37
38
39
40

41
42
43
44
45
46
47

48
49
50
51
52
53
54

55
56
57
58
59
60
61
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package jdk.dio.spibus;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import jdk.dio.DeviceConfig;

public final class SPIDeviceConfig
	implements DeviceConfig<SPIDevice>, DeviceConfig.HardwareAddressing
{
	public static final int CS_ACTIVE_HIGH =
		0;
	
	public static final int CS_ACTIVE_LOW =
		1;
	
	public static final int CS_NOT_CONTROLLED =
		2;
	
	@Deprecated
	public SPIDeviceConfig(int __a, int __b, int __c, int __d, int __e, int 
		__f)
	{

		throw new todo.TODO();
	}
	
	@Deprecated
	public SPIDeviceConfig(int __a, int __b, int __c, int __d, int __e, int 
		__f, int __g)
	{

		throw new todo.TODO();
	}
	
	@Deprecated
	public SPIDeviceConfig(String __a, int __b, int __c, int __d, int __e, 
		int __f)
	{

		throw new todo.TODO();
	}
	
	@Deprecated
	public SPIDeviceConfig(String __a, int __b, int __c, int __d, int __e, 
		int __f, int __g)
	{

		throw new todo.TODO();
	}
	
	public boolean equals(Object __a)
	{
		throw new todo.TODO();
	}
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
		throw new todo.TODO();
	}
	
	public static final class Builder
	{
		public Builder()
		{
			super();
			throw new todo.TODO();
		}
		
		public SPIDeviceConfig build()
		{
			throw new todo.TODO();
		}







<







131
132
133
134
135
136
137

138
139
140
141
142
143
144
		throw new todo.TODO();
	}
	
	public static final class Builder
	{
		public Builder()
		{

			throw new todo.TODO();
		}
		
		public SPIDeviceConfig build()
		{
			throw new todo.TODO();
		}

Name change from runt/apis/dio-spibus/jdk/dio/spibus/SPIPermission.java to modules/dio-spibus/src/main/java/jdk/dio/spibus/SPIPermission.java.

Name change from runt/apis/dio-spibus/jdk/dio/spibus/package-info.java to modules/dio-spibus/src/main/java/jdk/dio/spibus/package-info.java.

Added modules/dio-uart/build.gradle.















































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import cc.squirreljme.plugin.swm.JavaMEMidletType
import cc.squirreljme.plugin.swm.JavaMEStandard

description = "This provides access to serial UARTs."
version = rootProject.version

squirreljme
{
	javaDocErrorCode = "CX"
	swmType = JavaMEMidletType.API
	swmName = "JavaME 8 Device I/O (UART)"
	swmVendor = "Stephanie Gawroriski"
	definedStandards += new JavaMEStandard("dio.uart;;1.0.1")
}

dependencies
{
	implementation project(":modules:cldc-compact")
	implementation project(":modules:cldc")

	implementation project(":modules:dio")
	implementation project(":modules:dio-modem")
}

Name change from runt/apis/dio-uart/jdk/dio/uart/ModemUART.java to modules/dio-uart/src/main/java/jdk/dio/uart/ModemUART.java.

Name change from runt/apis/dio-uart/jdk/dio/uart/UART.java to modules/dio-uart/src/main/java/jdk/dio/uart/UART.java.

19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
import jdk.dio.InputRoundListener;
import jdk.dio.OutputRoundListener;
import jdk.dio.UnavailableDeviceException;

public interface UART
	extends Device<UART>, ByteChannel, BufferAccess<ByteBuffer>
{
	public abstract void generateBreak(int __a)
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	public abstract int getBaudRate()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	public abstract int getDataBits()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	public abstract int getFlowControlMode()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	public abstract int getParity()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	public abstract int getReceiveTimeout()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	public abstract int getReceiveTriggerLevel()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	public abstract int getStopBits()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	public abstract int read(ByteBuffer __a)
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	public abstract void setBaudRate(int __a)
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	public abstract void setDataBits(int __a)
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	public abstract void setEventListener(int __a, UARTEventListener __b)
		throws IOException, ClosedDeviceException;
	
	public abstract void setFlowControlMode(int __a)
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	public abstract void setParity(int __a)
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	public abstract void setReceiveTimeout(int __a)
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	public abstract void setReceiveTriggerLevel(int __a)
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	public abstract void setStopBits(int __a)
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	public abstract void startReading(ByteBuffer __a, InputRoundListener<UART
		, ByteBuffer> __b)
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	public abstract void startReading(ByteBuffer __a, ByteBuffer __b, 
		InputRoundListener<UART, ByteBuffer> __c)
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	public abstract void startWriting(ByteBuffer __a, OutputRoundListener<
		UART, ByteBuffer> __b)
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	public abstract void startWriting(ByteBuffer __a, ByteBuffer __b, 
		OutputRoundListener<UART, ByteBuffer> __c)
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	public abstract void stopReading()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	public abstract void stopWriting()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	public abstract int write(ByteBuffer __a)
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
}









|



|



|



|



|



|



|



|



|



|



|



|


|



|



|



|



|



|
|



|




|
|



|




|



|



|





19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
import jdk.dio.InputRoundListener;
import jdk.dio.OutputRoundListener;
import jdk.dio.UnavailableDeviceException;

public interface UART
	extends Device<UART>, ByteChannel, BufferAccess<ByteBuffer>
{
	void generateBreak(int __a)
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	int getBaudRate()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	int getDataBits()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	int getFlowControlMode()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	int getParity()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	int getReceiveTimeout()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	int getReceiveTriggerLevel()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	int getStopBits()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	int read(ByteBuffer __a)
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	void setBaudRate(int __a)
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	void setDataBits(int __a)
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	void setEventListener(int __a, UARTEventListener __b)
		throws IOException, ClosedDeviceException;
	
	void setFlowControlMode(int __a)
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	void setParity(int __a)
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	void setReceiveTimeout(int __a)
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	void setReceiveTriggerLevel(int __a)
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	void setStopBits(int __a)
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	void startReading(ByteBuffer __a,
	 InputRoundListener<UART, ByteBuffer> __b)
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	void startReading(ByteBuffer __a, ByteBuffer __b,
		InputRoundListener<UART, ByteBuffer> __c)
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	void startWriting(ByteBuffer __a,
		OutputRoundListener<UART, ByteBuffer> __b)
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	void startWriting(ByteBuffer __a, ByteBuffer __b,
		OutputRoundListener<UART, ByteBuffer> __c)
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	void stopReading()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	void stopWriting()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	int write(ByteBuffer __a)
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
}


Name change from runt/apis/dio-uart/jdk/dio/uart/UARTConfig.java to modules/dio-uart/src/main/java/jdk/dio/uart/UARTConfig.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package jdk.dio.uart;

import java.io.InputStream;
import java.io.IOException;
import java.io.OutputStream;
import jdk.dio.DeviceConfig;

public final class UARTConfig
	implements DeviceConfig<UART>, DeviceConfig.HardwareAddressing
{
	public static final int DATABITS_5 =












|
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package jdk.dio.uart;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import jdk.dio.DeviceConfig;

public final class UARTConfig
	implements DeviceConfig<UART>, DeviceConfig.HardwareAddressing
{
	public static final int DATABITS_5 =
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
	public static final int STOPBITS_2 =
		3;
	
	@Deprecated
	public UARTConfig(int __a, int __b, int __c, int __d, int __e, int __f, 
		int __g)
	{
		super();
		throw new todo.TODO();
	}
	
	@Deprecated
	public UARTConfig(int __a, int __b, int __c, int __d, int __e, int __f, 
		int __g, int __h, int __i)
	{
		super();
		throw new todo.TODO();
	}
	
	@Deprecated
	public UARTConfig(String __a, int __b, int __c, int __d, int __e, int __f
		, int __g)
	{
		super();
		throw new todo.TODO();
	}
	
	@Deprecated
	public UARTConfig(String __a, int __b, int __c, int __d, int __e, int __f
		, int __g, int __h, int __i)
	{
		super();
		throw new todo.TODO();
	}
	
	public boolean equals(Object __a)
	{
		throw new todo.TODO();
	}







<







<







<







<







72
73
74
75
76
77
78

79
80
81
82
83
84
85

86
87
88
89
90
91
92

93
94
95
96
97
98
99

100
101
102
103
104
105
106
	public static final int STOPBITS_2 =
		3;
	
	@Deprecated
	public UARTConfig(int __a, int __b, int __c, int __d, int __e, int __f, 
		int __g)
	{

		throw new todo.TODO();
	}
	
	@Deprecated
	public UARTConfig(int __a, int __b, int __c, int __d, int __e, int __f, 
		int __g, int __h, int __i)
	{

		throw new todo.TODO();
	}
	
	@Deprecated
	public UARTConfig(String __a, int __b, int __c, int __d, int __e, int __f
		, int __g)
	{

		throw new todo.TODO();
	}
	
	@Deprecated
	public UARTConfig(String __a, int __b, int __c, int __d, int __e, int __f
		, int __g, int __h, int __i)
	{

		throw new todo.TODO();
	}
	
	public boolean equals(Object __a)
	{
		throw new todo.TODO();
	}
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
		throw new todo.TODO();
	}
	
	public static final class Builder
	{
		public Builder()
		{
			super();
			throw new todo.TODO();
		}
		
		public UARTConfig build()
		{
			throw new todo.TODO();
		}







<







176
177
178
179
180
181
182

183
184
185
186
187
188
189
		throw new todo.TODO();
	}
	
	public static final class Builder
	{
		public Builder()
		{

			throw new todo.TODO();
		}
		
		public UARTConfig build()
		{
			throw new todo.TODO();
		}

Name change from runt/apis/dio-uart/jdk/dio/uart/UARTEvent.java to modules/dio-uart/src/main/java/jdk/dio/uart/UARTEvent.java.

31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
		2;
	
	public static final int PARITY_ERROR =
		8;
	
	public UARTEvent(UART __a, int __b)
	{
		super();
		throw new todo.TODO();
	}
	
	public UARTEvent(UART __a, int __b, long __c, int __d)
	{
		super();
		throw new todo.TODO();
	}
	
	public int getID()
	{
		throw new todo.TODO();
	}







<





<







31
32
33
34
35
36
37

38
39
40
41
42

43
44
45
46
47
48
49
		2;
	
	public static final int PARITY_ERROR =
		8;
	
	public UARTEvent(UART __a, int __b)
	{

		throw new todo.TODO();
	}
	
	public UARTEvent(UART __a, int __b, long __c, int __d)
	{

		throw new todo.TODO();
	}
	
	public int getID()
	{
		throw new todo.TODO();
	}

Name change from runt/apis/dio-uart/jdk/dio/uart/UARTEventListener.java to modules/dio-uart/src/main/java/jdk/dio/uart/UARTEventListener.java.

11
12
13
14
15
16
17
18
19
20
21
package jdk.dio.uart;

import jdk.dio.DeviceEventListener;

public interface UARTEventListener
	extends DeviceEventListener
{
	public abstract void eventDispatched(UARTEvent __a);
}









|



11
12
13
14
15
16
17
18
19
20
21
package jdk.dio.uart;

import jdk.dio.DeviceEventListener;

public interface UARTEventListener
	extends DeviceEventListener
{
	void eventDispatched(UARTEvent __a);
}


Name change from runt/apis/dio-uart/jdk/dio/uart/UARTPermission.java to modules/dio-uart/src/main/java/jdk/dio/uart/UARTPermission.java.

Name change from runt/apis/dio-uart/jdk/dio/uart/package-info.java to modules/dio-uart/src/main/java/jdk/dio/uart/package-info.java.

Added modules/dio-watchdog/build.gradle.











































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import cc.squirreljme.plugin.swm.JavaMEMidletType
import cc.squirreljme.plugin.swm.JavaMEStandard

description = "This provides access to the watchdog."
version = rootProject.version

squirreljme
{
	javaDocErrorCode = "DP"
	swmType = JavaMEMidletType.API
	swmName = "JavaME 8 Device I/O (Watchdog)"
	swmVendor = "Stephanie Gawroriski"
	definedStandards += new JavaMEStandard("dio.watchdog;;1.0.1")
}

dependencies
{
	implementation project(":modules:cldc")

	implementation project(":modules:dio")
}

Name change from runt/apis/dio-watchdog/jdk/dio/watchdog/WatchdogTimer.java to modules/dio-watchdog/src/main/java/jdk/dio/watchdog/WatchdogTimer.java.

14
15
16
17
18
19
20
21








22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import jdk.dio.ClosedDeviceException;
import jdk.dio.Device;
import jdk.dio.UnavailableDeviceException;

public interface WatchdogTimer
	extends Device<WatchdogTimer>
{
	public abstract boolean causedLastReboot()








		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	public abstract long getMaxTimeout()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	public abstract long getTimeout()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	public abstract void refresh()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	public abstract void start(long __a)
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	public abstract void stop()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
}









|
>
>
>
>
>
>
>
>



|



|



<
<
<
<
<
<
<
<
|





14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40








41
42
43
44
45
46
import jdk.dio.ClosedDeviceException;
import jdk.dio.Device;
import jdk.dio.UnavailableDeviceException;

public interface WatchdogTimer
	extends Device<WatchdogTimer>
{
	boolean causedLastReboot()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	long getMaxTimeout()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	long getTimeout()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	void refresh()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	void start(long __a)
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	








	void stop()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
}


Name change from runt/apis/dio-watchdog/jdk/dio/watchdog/WatchdogTimerConfig.java to modules/dio-watchdog/src/main/java/jdk/dio/watchdog/WatchdogTimerConfig.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package jdk.dio.watchdog;

import java.io.InputStream;
import java.io.IOException;
import java.io.OutputStream;
import jdk.dio.DeviceConfig;

public final class WatchdogTimerConfig
	implements DeviceConfig<WatchdogTimer>, DeviceConfig.HardwareAddressing
{
	public WatchdogTimerConfig(String __a, int __b)
	{
		super();
		throw new todo.TODO();
	}
	
	public WatchdogTimerConfig(int __a, int __b)
	{
		super();
		throw new todo.TODO();
	}
	
	public boolean equals(Object __a)
	{
		throw new todo.TODO();
	}












|
|








<





<







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22

23
24
25
26
27

28
29
30
31
32
33
34
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package jdk.dio.watchdog;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import jdk.dio.DeviceConfig;

public final class WatchdogTimerConfig
	implements DeviceConfig<WatchdogTimer>, DeviceConfig.HardwareAddressing
{
	public WatchdogTimerConfig(String __a, int __b)
	{

		throw new todo.TODO();
	}
	
	public WatchdogTimerConfig(int __a, int __b)
	{

		throw new todo.TODO();
	}
	
	public boolean equals(Object __a)
	{
		throw new todo.TODO();
	}

Name change from runt/apis/dio-watchdog/jdk/dio/watchdog/WatchdogTimerPermission.java to modules/dio-watchdog/src/main/java/jdk/dio/watchdog/WatchdogTimerPermission.java.

Name change from runt/apis/dio-watchdog/jdk/dio/watchdog/WindowedWatchdogTimer.java to modules/dio-watchdog/src/main/java/jdk/dio/watchdog/WindowedWatchdogTimer.java.

12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29

import java.io.IOException;
import jdk.dio.ClosedDeviceException;

public interface WindowedWatchdogTimer
	extends WatchdogTimer
{
	public abstract long getClosedWindowTimeout()
		throws IOException, ClosedDeviceException;
	
	public abstract void start(long __a)
		throws IOException, ClosedDeviceException;
	
	public abstract void start(long __a, long __b)
		throws IOException, ClosedDeviceException;
}









|


|


|




12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29

import java.io.IOException;
import jdk.dio.ClosedDeviceException;

public interface WindowedWatchdogTimer
	extends WatchdogTimer
{
	long getClosedWindowTimeout()
		throws IOException, ClosedDeviceException;
	
	void start(long __a)
		throws IOException, ClosedDeviceException;
	
	void start(long __a, long __b)
		throws IOException, ClosedDeviceException;
}


Name change from runt/apis/dio-watchdog/jdk/dio/watchdog/package-info.java to modules/dio-watchdog/src/main/java/jdk/dio/watchdog/package-info.java.

Added modules/dio/build.gradle.









































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import cc.squirreljme.plugin.swm.JavaMEMidletType
import cc.squirreljme.plugin.swm.JavaMEStandard

description = "This provides the base support for devices " +
	"that may be provided by an implementation."
version = rootProject.version

squirreljme
{
	javaDocErrorCode = "CR"
	swmType = JavaMEMidletType.API
	swmName = "JavaME 8 Device I/O"
	swmVendor = "Stephanie Gawroriski"
	definedStandards += new JavaMEStandard("dio", null, "1.0.1")
}

dependencies
{
	implementation project(":modules:cldc")
}

Name change from runt/apis/dio/jdk/dio/AsyncErrorHandler.java to modules/dio/src/main/java/jdk/dio/AsyncErrorHandler.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package jdk.dio;


public interface AsyncErrorHandler<P extends Device<? super P>>
{
	public abstract void failed(Throwable __a, P __b);
}














<


|



1
2
3
4
5
6
7
8
9
10
11
12

13
14
15
16
17
18
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package jdk.dio;


public interface AsyncErrorHandler<P extends Device<? super P>>
{
	void failed(Throwable __a, P __b);
}


Name change from runt/apis/dio/jdk/dio/BufferAccess.java to modules/dio/src/main/java/jdk/dio/BufferAccess.java.

12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29

import java.io.IOException;
import java.nio.Buffer;
import java.nio.ByteBuffer;

public interface BufferAccess<B extends Buffer>
{
	public abstract B getInputBuffer()
		throws ClosedDeviceException, IOException;
	
	public abstract B getOutputBuffer()
		throws ClosedDeviceException, IOException;
	
	public abstract B prepareBuffer(ByteBuffer __a, int __b)
		throws IOException, ClosedDeviceException;
}









|


|


|




12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29

import java.io.IOException;
import java.nio.Buffer;
import java.nio.ByteBuffer;

public interface BufferAccess<B extends Buffer>
{
	B getInputBuffer()
		throws ClosedDeviceException, IOException;
	
	B getOutputBuffer()
		throws ClosedDeviceException, IOException;
	
	B prepareBuffer(ByteBuffer __a, int __b)
		throws IOException, ClosedDeviceException;
}


Name change from runt/apis/dio/jdk/dio/ClosedDeviceException.java to modules/dio/src/main/java/jdk/dio/ClosedDeviceException.java.

13
14
15
16
17
18
19
20
21
22
23
24
25
import java.nio.channels.ClosedChannelException;

public class ClosedDeviceException
	extends ClosedChannelException
{
	public ClosedDeviceException()
	{
		super();
		throw new todo.TODO();
	}
}









<





13
14
15
16
17
18
19

20
21
22
23
24
import java.nio.channels.ClosedChannelException;

public class ClosedDeviceException
	extends ClosedChannelException
{
	public ClosedDeviceException()
	{

		throw new todo.TODO();
	}
}


Name change from runt/apis/dio/jdk/dio/Device.java to modules/dio/src/main/java/jdk/dio/Device.java.

13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import java.io.IOException;
import java.nio.ByteOrder;
import java.nio.channels.Channel;

public interface Device<P extends Device<? super P>>
	extends Channel
{
	public static final int BIG_ENDIAN =
		1;
	
	public static final int LITTLE_ENDIAN =
		0;
	
	public static final int MIXED_ENDIAN =
		2;
	
	public abstract void close()
		throws IOException;
	
	public abstract ByteOrder getByteOrder()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	public abstract <U extends P> DeviceDescriptor<U> getDescriptor();
	
	public abstract boolean isOpen();
	
	public abstract void tryLock(int __a)
		throws UnavailableDeviceException, ClosedDeviceException, 
			IOException;
	
	public abstract void unlock()
		throws IOException;
}









|


|


|


|


|



|

|

|



|




13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import java.io.IOException;
import java.nio.ByteOrder;
import java.nio.channels.Channel;

public interface Device<P extends Device<? super P>>
	extends Channel
{
	int BIG_ENDIAN =
		1;
	
	int LITTLE_ENDIAN =
		0;
	
	int MIXED_ENDIAN =
		2;
	
	void close()
		throws IOException;
	
	ByteOrder getByteOrder()
		throws IOException, UnavailableDeviceException, 
			ClosedDeviceException;
	
	<U extends P> DeviceDescriptor<U> getDescriptor();
	
	boolean isOpen();
	
	void tryLock(int __a)
		throws UnavailableDeviceException, ClosedDeviceException, 
			IOException;
	
	void unlock()
		throws IOException;
}


Name change from runt/apis/dio/jdk/dio/DeviceAlreadyExistsException.java to modules/dio/src/main/java/jdk/dio/DeviceAlreadyExistsException.java.

12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30


public class DeviceAlreadyExistsException
	extends DeviceException
{
	public DeviceAlreadyExistsException()
	{
		super();
		throw new todo.TODO();
	}
	
	public DeviceAlreadyExistsException(String __a)
	{
		super();
		throw new todo.TODO();
	}
}









<





<





12
13
14
15
16
17
18

19
20
21
22
23

24
25
26
27
28


public class DeviceAlreadyExistsException
	extends DeviceException
{
	public DeviceAlreadyExistsException()
	{

		throw new todo.TODO();
	}
	
	public DeviceAlreadyExistsException(String __a)
	{

		throw new todo.TODO();
	}
}


Name change from runt/apis/dio/jdk/dio/DeviceConfig.java to modules/dio/src/main/java/jdk/dio/DeviceConfig.java.

12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36

import java.io.IOException;
import java.io.OutputStream;

public interface DeviceConfig<P extends Device<? super P>>
{
	@Deprecated
	public static final int DEFAULT =
		-1;
	
	public static final int UNASSIGNED =
		-1;
	
	public abstract int serialize(OutputStream __a)
		throws IOException;
	
	public static interface HardwareAddressing
	{
		public abstract String getControllerName();
		
		public abstract int getControllerNumber();
	}
}









|


|


|


|

|

|




12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36

import java.io.IOException;
import java.io.OutputStream;

public interface DeviceConfig<P extends Device<? super P>>
{
	@Deprecated
	int DEFAULT =
		-1;
	
	int UNASSIGNED =
		-1;
	
	int serialize(OutputStream __a)
		throws IOException;
	
	interface HardwareAddressing
	{
		String getControllerName();
		
		int getControllerNumber();
	}
}


Name change from runt/apis/dio/jdk/dio/DeviceDescriptor.java to modules/dio/src/main/java/jdk/dio/DeviceDescriptor.java.

9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// ---------------------------------------------------------------------------

package jdk.dio;


public interface DeviceDescriptor<P extends Device<? super P>>
{
	public static final int UNDEFINED_ID =
		-1;
	
	public abstract <C extends DeviceConfig<? super P>> C getConfiguration();
	
	public abstract int getID();
	
	public abstract Class<P> getInterface();
	
	public abstract String getName();
	
	public abstract String[] getProperties();
}









|


|

|

|

|

|



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// ---------------------------------------------------------------------------

package jdk.dio;


public interface DeviceDescriptor<P extends Device<? super P>>
{
	int UNDEFINED_ID =
		-1;
	
	<C extends DeviceConfig<? super P>> C getConfiguration();
	
	int getID();
	
	Class<P> getInterface();
	
	String getName();
	
	String[] getProperties();
}


Name change from runt/apis/dio/jdk/dio/DeviceEvent.java to modules/dio/src/main/java/jdk/dio/DeviceEvent.java.

23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
	
	protected long timeStamp;
	
	protected int timeStampMicros;
	
	public DeviceEvent()
	{
		super();
		throw new todo.TODO();
	}
	
	public final int getCount()
	{
		throw new todo.TODO();
	}







<







23
24
25
26
27
28
29

30
31
32
33
34
35
36
	
	protected long timeStamp;
	
	protected int timeStampMicros;
	
	public DeviceEvent()
	{

		throw new todo.TODO();
	}
	
	public final int getCount()
	{
		throw new todo.TODO();
	}

Name change from runt/apis/dio/jdk/dio/DeviceEventListener.java to modules/dio/src/main/java/jdk/dio/DeviceEventListener.java.

Name change from runt/apis/dio/jdk/dio/DeviceException.java to modules/dio/src/main/java/jdk/dio/DeviceException.java.

13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import java.io.IOException;

public class DeviceException
	extends IOException
{
	public DeviceException()
	{
		super();
		throw new todo.TODO();
	}
	
	public DeviceException(String __a)
	{
		super();
		throw new todo.TODO();
	}
}









<





<





13
14
15
16
17
18
19

20
21
22
23
24

25
26
27
28
29
import java.io.IOException;

public class DeviceException
	extends IOException
{
	public DeviceException()
	{

		throw new todo.TODO();
	}
	
	public DeviceException(String __a)
	{

		throw new todo.TODO();
	}
}


Name change from runt/apis/dio/jdk/dio/DeviceManager.java to modules/dio/src/main/java/jdk/dio/DeviceManager.java.

22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
		2;
	
	public static final int UNSPECIFIED_ID =
		-1;
	
	private DeviceManager()
	{
		super();
		throw new todo.TODO();
	}
	
	public static <P extends Device<? super P>> void addRegistrationListener(
		RegistrationListener<P> __a, Class<P> __b)
	{
		throw new todo.TODO();







<







22
23
24
25
26
27
28

29
30
31
32
33
34
35
		2;
	
	public static final int UNSPECIFIED_ID =
		-1;
	
	private DeviceManager()
	{

		throw new todo.TODO();
	}
	
	public static <P extends Device<? super P>> void addRegistrationListener(
		RegistrationListener<P> __a, Class<P> __b)
	{
		throw new todo.TODO();

Name change from runt/apis/dio/jdk/dio/DeviceMgmtPermission.java to modules/dio/src/main/java/jdk/dio/DeviceMgmtPermission.java.

Name change from runt/apis/dio/jdk/dio/DeviceNotFoundException.java to modules/dio/src/main/java/jdk/dio/DeviceNotFoundException.java.

12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30


public class DeviceNotFoundException
	extends DeviceException
{
	public DeviceNotFoundException()
	{
		super();
		throw new todo.TODO();
	}
	
	public DeviceNotFoundException(String __a)
	{
		super();
		throw new todo.TODO();
	}
}









<





<





12
13
14
15
16
17
18

19
20
21
22
23

24
25
26
27
28


public class DeviceNotFoundException
	extends DeviceException
{
	public DeviceNotFoundException()
	{

		throw new todo.TODO();
	}
	
	public DeviceNotFoundException(String __a)
	{

		throw new todo.TODO();
	}
}


Name change from runt/apis/dio/jdk/dio/DevicePermission.java to modules/dio/src/main/java/jdk/dio/DevicePermission.java.

Name change from runt/apis/dio/jdk/dio/InputRoundListener.java to modules/dio/src/main/java/jdk/dio/InputRoundListener.java.

12
13
14
15
16
17
18
19
20
21
22

import java.nio.Buffer;

public interface InputRoundListener<P extends Device<? super P>, B extends 
	Buffer>
	extends DeviceEventListener, AsyncErrorHandler<P>
{
	public abstract void inputRoundCompleted(RoundCompletionEvent<P, B> __a);
}









|



12
13
14
15
16
17
18
19
20
21
22

import java.nio.Buffer;

public interface InputRoundListener<P extends Device<? super P>, B extends 
	Buffer>
	extends DeviceEventListener, AsyncErrorHandler<P>
{
	void inputRoundCompleted(RoundCompletionEvent<P, B> __a);
}


Name change from runt/apis/dio/jdk/dio/InvalidDeviceConfigException.java to modules/dio/src/main/java/jdk/dio/InvalidDeviceConfigException.java.

12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30


public class InvalidDeviceConfigException
	extends DeviceException
{
	public InvalidDeviceConfigException()
	{
		super();
		throw new todo.TODO();
	}
	
	public InvalidDeviceConfigException(String __a)
	{
		super();
		throw new todo.TODO();
	}
}









<





<





12
13
14
15
16
17
18

19
20
21
22
23

24
25
26
27
28


public class InvalidDeviceConfigException
	extends DeviceException
{
	public InvalidDeviceConfigException()
	{

		throw new todo.TODO();
	}
	
	public InvalidDeviceConfigException(String __a)
	{

		throw new todo.TODO();
	}
}


Name change from runt/apis/dio/jdk/dio/OutputRoundListener.java to modules/dio/src/main/java/jdk/dio/OutputRoundListener.java.

12
13
14
15
16
17
18
19
20
21
22
23

import java.nio.Buffer;

public interface OutputRoundListener<P extends Device<? super P>, B extends 
	Buffer>
	extends DeviceEventListener, AsyncErrorHandler<P>
{
	public abstract void outputRoundCompleted(RoundCompletionEvent<P, B> __a
		);
}









|
<



12
13
14
15
16
17
18
19

20
21
22

import java.nio.Buffer;

public interface OutputRoundListener<P extends Device<? super P>, B extends 
	Buffer>
	extends DeviceEventListener, AsyncErrorHandler<P>
{
	void outputRoundCompleted(RoundCompletionEvent<P, B> __a);

}


Name change from runt/apis/dio/jdk/dio/RegistrationEvent.java to modules/dio/src/main/java/jdk/dio/RegistrationEvent.java.

Name change from runt/apis/dio/jdk/dio/RegistrationListener.java to modules/dio/src/main/java/jdk/dio/RegistrationListener.java.

11
12
13
14
15
16
17
18
19
20
21
22
23
package jdk.dio;

import java.util.EventListener;

public interface RegistrationListener<P extends Device<? super P>>
	extends EventListener
{
	public abstract void deviceRegistered(RegistrationEvent<P> __a);
	
	public abstract void deviceUnregistered(RegistrationEvent<P> __a);
}









|

|



11
12
13
14
15
16
17
18
19
20
21
22
23
package jdk.dio;

import java.util.EventListener;

public interface RegistrationListener<P extends Device<? super P>>
	extends EventListener
{
	void deviceRegistered(RegistrationEvent<P> __a);
	
	void deviceUnregistered(RegistrationEvent<P> __a);
}


Name change from runt/apis/dio/jdk/dio/RoundCompletionEvent.java to modules/dio/src/main/java/jdk/dio/RoundCompletionEvent.java.

14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47

public class RoundCompletionEvent<P extends Device<? super P>, B extends 
	Buffer>
	extends DeviceEvent<P>
{
	public RoundCompletionEvent(P __a, B __b, int __c)
	{
		super();
		throw new todo.TODO();
	}
	
	public RoundCompletionEvent(P __a, B __b, int __c, long __d, int __e)
	{
		super();
		throw new todo.TODO();
	}
	
	public RoundCompletionEvent(P __a, B __b, int __c, boolean __d)
	{
		super();
		throw new todo.TODO();
	}
	
	public RoundCompletionEvent(P __a, B __b, int __c, boolean __d, long __e,
		int __f)
	{
		super();
		throw new todo.TODO();
	}
	
	public B getBuffer()
	{
		throw new todo.TODO();
	}







<





<





<






<







14
15
16
17
18
19
20

21
22
23
24
25

26
27
28
29
30

31
32
33
34
35
36

37
38
39
40
41
42
43

public class RoundCompletionEvent<P extends Device<? super P>, B extends 
	Buffer>
	extends DeviceEvent<P>
{
	public RoundCompletionEvent(P __a, B __b, int __c)
	{

		throw new todo.TODO();
	}
	
	public RoundCompletionEvent(P __a, B __b, int __c, long __d, int __e)
	{

		throw new todo.TODO();
	}
	
	public RoundCompletionEvent(P __a, B __b, int __c, boolean __d)
	{

		throw new todo.TODO();
	}
	
	public RoundCompletionEvent(P __a, B __b, int __c, boolean __d, long __e,
		int __f)
	{

		throw new todo.TODO();
	}
	
	public B getBuffer()
	{
		throw new todo.TODO();
	}

Name change from runt/apis/dio/jdk/dio/Transactional.java to modules/dio/src/main/java/jdk/dio/Transactional.java.

10
11
12
13
14
15
16
17
18
19
20
21
22
23
24

package jdk.dio;

import java.io.IOException;

public interface Transactional
{
	public abstract void begin()
		throws ClosedDeviceException, IOException;
	
	public abstract void end()
		throws ClosedDeviceException, IOException;
}









|


|




10
11
12
13
14
15
16
17
18
19
20
21
22
23
24

package jdk.dio;

import java.io.IOException;

public interface Transactional
{
	void begin()
		throws ClosedDeviceException, IOException;
	
	void end()
		throws ClosedDeviceException, IOException;
}


Name change from runt/apis/dio/jdk/dio/UnavailableDeviceException.java to modules/dio/src/main/java/jdk/dio/UnavailableDeviceException.java.

12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30


public class UnavailableDeviceException
	extends DeviceException
{
	public UnavailableDeviceException()
	{
		super();
		throw new todo.TODO();
	}
	
	public UnavailableDeviceException(String __a)
	{
		super();
		throw new todo.TODO();
	}
}









<





<





12
13
14
15
16
17
18

19
20
21
22
23

24
25
26
27
28


public class UnavailableDeviceException
	extends DeviceException
{
	public UnavailableDeviceException()
	{

		throw new todo.TODO();
	}
	
	public UnavailableDeviceException(String __a)
	{

		throw new todo.TODO();
	}
}


Name change from runt/apis/dio/jdk/dio/UnsupportedAccessModeException.java to modules/dio/src/main/java/jdk/dio/UnsupportedAccessModeException.java.

12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30


public class UnsupportedAccessModeException
	extends DeviceException
{
	public UnsupportedAccessModeException()
	{
		super();
		throw new todo.TODO();
	}
	
	public UnsupportedAccessModeException(String __a)
	{
		super();
		throw new todo.TODO();
	}
}









<





<





12
13
14
15
16
17
18

19
20
21
22
23

24
25
26
27
28


public class UnsupportedAccessModeException
	extends DeviceException
{
	public UnsupportedAccessModeException()
	{

		throw new todo.TODO();
	}
	
	public UnsupportedAccessModeException(String __a)
	{

		throw new todo.TODO();
	}
}


Name change from runt/apis/dio/jdk/dio/UnsupportedByteOrderException.java to modules/dio/src/main/java/jdk/dio/UnsupportedByteOrderException.java.

12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30


public class UnsupportedByteOrderException
	extends DeviceException
{
	public UnsupportedByteOrderException()
	{
		super();
		throw new todo.TODO();
	}
	
	public UnsupportedByteOrderException(String __a)
	{
		super();
		throw new todo.TODO();
	}
}









<





<





12
13
14
15
16
17
18

19
20
21
22
23

24
25
26
27
28


public class UnsupportedByteOrderException
	extends DeviceException
{
	public UnsupportedByteOrderException()
	{

		throw new todo.TODO();
	}
	
	public UnsupportedByteOrderException(String __a)
	{

		throw new todo.TODO();
	}
}


Name change from runt/apis/dio/jdk/dio/UnsupportedDeviceTypeException.java to modules/dio/src/main/java/jdk/dio/UnsupportedDeviceTypeException.java.

12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30


public class UnsupportedDeviceTypeException
	extends DeviceException
{
	public UnsupportedDeviceTypeException()
	{
		super();
		throw new todo.TODO();
	}
	
	public UnsupportedDeviceTypeException(String __a)
	{
		super();
		throw new todo.TODO();
	}
}









<





<





12
13
14
15
16
17
18

19
20
21
22
23

24
25
26
27
28


public class UnsupportedDeviceTypeException
	extends DeviceException
{
	public UnsupportedDeviceTypeException()
	{

		throw new todo.TODO();
	}
	
	public UnsupportedDeviceTypeException(String __a)
	{

		throw new todo.TODO();
	}
}


Name change from runt/apis/dio/jdk/dio/package-info.java to modules/dio/src/main/java/jdk/dio/package-info.java.

Name change from runt/apis/dio/jdk/dio/power/PowerManaged.java to modules/dio/src/main/java/jdk/dio/power/PowerManaged.java.

11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
package jdk.dio.power;

import java.io.IOException;
import jdk.dio.ClosedDeviceException;

public interface PowerManaged
{
	public static final int LOWEST_POWER =
		4;
	
	public static final int LOW_POWER =
		2;
	
	public static final int POWER_OFF =
		8;
	
	public static final int POWER_ON =
		1;
	
	public static final long UNLIMITED_DURATION =
		-1L;
	
	public abstract void disablePowerSaving()
		throws IOException, ClosedDeviceException;
	
	public abstract void enablePowerSaving(int __a)
		throws IOException, ClosedDeviceException;
	
	public abstract void enablePowerSaving(int __a, PowerSavingHandler __b)
		throws IOException, ClosedDeviceException;
	
	public abstract PowerManaged.Group getGroup()
		throws IOException, ClosedDeviceException;
	
	public abstract int getPowerState()
		throws IOException, ClosedDeviceException;
	
	public abstract long requestPowerStateChange(int __a, long __b)
		throws IOException, ClosedDeviceException;
	
	public static interface Group
	{
		public abstract boolean contains(PowerManaged __a)
			throws IOException, ClosedDeviceException;
		
		public abstract void setPowerSavingHandler(PowerSavingHandler __a
			)
			throws IOException, ClosedDeviceException;
	}
}









|


|


|


|


|


|


|


|


|


|


|


|

|


|
<





11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56

57
58
59
60
61
package jdk.dio.power;

import java.io.IOException;
import jdk.dio.ClosedDeviceException;

public interface PowerManaged
{
	int LOWEST_POWER =
		4;
	
	int LOW_POWER =
		2;
	
	int POWER_OFF =
		8;
	
	int POWER_ON =
		1;
	
	long UNLIMITED_DURATION =
		-1L;
	
	void disablePowerSaving()
		throws IOException, ClosedDeviceException;
	
	void enablePowerSaving(int __a)
		throws IOException, ClosedDeviceException;
	
	void enablePowerSaving(int __a, PowerSavingHandler __b)
		throws IOException, ClosedDeviceException;
	
	PowerManaged.Group getGroup()
		throws IOException, ClosedDeviceException;
	
	int getPowerState()
		throws IOException, ClosedDeviceException;
	
	long requestPowerStateChange(int __a, long __b)
		throws IOException, ClosedDeviceException;
	
	interface Group
	{
		boolean contains(PowerManaged __a)
			throws IOException, ClosedDeviceException;
		
		void setPowerSavingHandler(PowerSavingHandler __a)

			throws IOException, ClosedDeviceException;
	}
}


Name change from runt/apis/dio/jdk/dio/power/PowerSavingHandler.java to modules/dio/src/main/java/jdk/dio/power/PowerSavingHandler.java.

10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25

package jdk.dio.power;

import jdk.dio.Device;

public interface PowerSavingHandler
{
	public abstract <P extends Device<? super P>> void handlePowerStateChange
		(P __a, PowerManaged.Group __b, int __c, int __d, long __e);
	
	public abstract <P extends Device<? super P>> long 
		handlePowerStateChangeRequest(P __a, PowerManaged.Group __b, int __c,
		int __d, long __e);
}









|
|

|





10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25

package jdk.dio.power;

import jdk.dio.Device;

public interface PowerSavingHandler
{
	<P extends Device<? super P>> void handlePowerStateChange(P __a,
		PowerManaged.Group __b, int __c, int __d, long __e);
	
	<P extends Device<? super P>> long
		handlePowerStateChangeRequest(P __a, PowerManaged.Group __b, int __c,
		int __d, long __e);
}


Name change from runt/apis/dio/jdk/dio/power/package-info.java to modules/dio/src/main/java/jdk/dio/power/package-info.java.

Name change from runt/apis/dio/jdk/dio/spi/AbstractDevice.java to modules/dio/src/main/java/jdk/dio/spi/AbstractDevice.java.

17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import jdk.dio.UnavailableDeviceException;

public abstract class AbstractDevice<P extends Device<? super P>>
	implements Device<P>
{
	public AbstractDevice()
	{
		super();
		throw new todo.TODO();
	}
	
	public final <U extends P> DeviceDescriptor<U> getDescriptor()
	{
		throw new todo.TODO();
	}







<







17
18
19
20
21
22
23

24
25
26
27
28
29
30
import jdk.dio.UnavailableDeviceException;

public abstract class AbstractDevice<P extends Device<? super P>>
	implements Device<P>
{
	public AbstractDevice()
	{

		throw new todo.TODO();
	}
	
	public final <U extends P> DeviceDescriptor<U> getDescriptor()
	{
		throw new todo.TODO();
	}

Name change from runt/apis/dio/jdk/dio/spi/DeviceProvider.java to modules/dio/src/main/java/jdk/dio/spi/DeviceProvider.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package jdk.dio.spi;

import java.io.InputStream;
import java.io.IOException;
import jdk.dio.Device;
import jdk.dio.DeviceConfig;
import jdk.dio.DeviceNotFoundException;
import jdk.dio.InvalidDeviceConfigException;
import jdk.dio.UnavailableDeviceException;
import jdk.dio.UnsupportedAccessModeException;

public interface DeviceProvider<P extends Device<? super P>>
{
	public abstract DeviceConfig<? super P> deserialize(InputStream __a)
		throws IOException;
	
	public abstract Class<? extends DeviceConfig<? super P>> getConfigType();
	
	public abstract Class<P> getType();
	
	public abstract boolean matches(String[] __a);
	
	public abstract AbstractDevice<? super P> open(DeviceConfig<? super P> 
		__a, String[] __b, int __c)
		throws DeviceNotFoundException, UnavailableDeviceException, 
			InvalidDeviceConfigException, UnsupportedAccessModeException, 
			IOException;
}














|
|









|


|

|

|

|
|






1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package jdk.dio.spi;

import java.io.IOException;
import java.io.InputStream;
import jdk.dio.Device;
import jdk.dio.DeviceConfig;
import jdk.dio.DeviceNotFoundException;
import jdk.dio.InvalidDeviceConfigException;
import jdk.dio.UnavailableDeviceException;
import jdk.dio.UnsupportedAccessModeException;

public interface DeviceProvider<P extends Device<? super P>>
{
	DeviceConfig<? super P> deserialize(InputStream __a)
		throws IOException;
	
	Class<? extends DeviceConfig<? super P>> getConfigType();
	
	Class<P> getType();
	
	boolean matches(String[] __a);
	
	AbstractDevice<? super P> open(DeviceConfig<? super P> __a, String[] __b,
		int __c)
		throws DeviceNotFoundException, UnavailableDeviceException, 
			InvalidDeviceConfigException, UnsupportedAccessModeException, 
			IOException;
}


Name change from runt/apis/dio/jdk/dio/spi/package-info.java to modules/dio/src/main/java/jdk/dio/spi/package-info.java.

Added modules/gcf/build.gradle.











































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import cc.squirreljme.plugin.swm.JavaMEMidletType

description = "This projects contains the Generic " +
	"connection framework which is used to create connections to other " +
	"resources."
version = rootProject.version

squirreljme
{
	javaDocErrorCode = "EC"
	swmType = JavaMEMidletType.API
	swmName = "Generic Connection Framework"
	swmVendor = "Stephanie Gawroriski"
}

dependencies
{
	implementation project(":modules:cldc-compact")

	implementation project(":modules:meep-midlet")
}

Name change from runt/apis/gcf/cc/squirreljme/runtime/gcf/ConnectionStateTracker.java to modules/gcf/src/main/java/cc/squirreljme/runtime/gcf/ConnectionStateTracker.java.

Name change from runt/apis/gcf/cc/squirreljme/runtime/gcf/FileAddress.java to modules/gcf/src/main/java/cc/squirreljme/runtime/gcf/FileAddress.java.

Name change from runt/apis/gcf/cc/squirreljme/runtime/gcf/HTTPAddress.java to modules/gcf/src/main/java/cc/squirreljme/runtime/gcf/HTTPAddress.java.

Name change from runt/apis/gcf/cc/squirreljme/runtime/gcf/HTTPAgent.java to modules/gcf/src/main/java/cc/squirreljme/runtime/gcf/HTTPAgent.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.gcf;

import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.io.IOException;
import java.io.OutputStream;
import javax.microedition.io.Connector;
import javax.microedition.io.SocketConnection;

/**
 * This class manages the HTTP connection data and is able to encode and
 * establish a connection.












|
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.gcf;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import javax.microedition.io.Connector;
import javax.microedition.io.SocketConnection;

/**
 * This class manages the HTTP connection data and is able to encode and
 * establish a connection.

Name change from runt/apis/gcf/cc/squirreljme/runtime/gcf/HTTPClientConnection.java to modules/gcf/src/main/java/cc/squirreljme/runtime/gcf/HTTPClientConnection.java.

10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package cc.squirreljme.runtime.gcf;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.LinkedHashMap;
import java.util.Map;
import javax.microedition.io.AccessPoint;
import javax.microedition.io.ConnectionNotFoundException;
import javax.microedition.io.HttpConnection;
import javax.microedition.io.SocketConnection;
import javax.microedition.io.StreamConnection;

/**
 * This is a connection to a remote HTTP server, this runs off an existing
 * socket since it may be SSL encrypted. SquirrelJME does all the HTTP
 * handling since it could just be based on any existing stream connection
 * and does not need any other library.
 *







<
<

<

<
<







10
11
12
13
14
15
16


17

18


19
20
21
22
23
24
25
package cc.squirreljme.runtime.gcf;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;


import javax.microedition.io.AccessPoint;

import javax.microedition.io.HttpConnection;



/**
 * This is a connection to a remote HTTP server, this runs off an existing
 * socket since it may be SSL encrypted. SquirrelJME does all the HTTP
 * handling since it could just be based on any existing stream connection
 * and does not need any other library.
 *
457
458
459
460
461
462
463

464
465
466
467
468
469
470
471
472
473
474
475
476
		}
	}
	
	/**
	 * Connects to the given address using the given stream.
	 *
	 * @param __addr The address.

	 * @throws NullPointerException On null arguments.
	 * @since 2019/05/06
	 */
	public static final HTTPClientConnection connect(HTTPAddress __addr)
		throws NullPointerException
	{
		if (__addr == null)
			throw new NullPointerException("NARG");
		
		return new HTTPClientConnection(__addr);
	}
}








>













452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
		}
	}
	
	/**
	 * Connects to the given address using the given stream.
	 *
	 * @param __addr The address.
	 * @return The open connection.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/05/06
	 */
	public static final HTTPClientConnection connect(HTTPAddress __addr)
		throws NullPointerException
	{
		if (__addr == null)
			throw new NullPointerException("NARG");
		
		return new HTTPClientConnection(__addr);
	}
}

Name change from runt/apis/gcf/cc/squirreljme/runtime/gcf/HTTPRequestBuilder.java to modules/gcf/src/main/java/cc/squirreljme/runtime/gcf/HTTPRequestBuilder.java.

135
136
137
138
139
140
141
142

143
144
145
146
147
148
149
150
				
				// Add some implicit properties
				Map<String, String> rqp = new LinkedHashMap<>(this._rqprops);
				rqp.put("host", address.ipaddr.hostname);
				
				// If the user agent was specified, add to it or set one
				String ua = rqp.get("user-agent");
				rqp.put("user-agent", (ua == null ? USER_AGENT :

					ua + USER_AGENT));
				
				// Is content being specified?
				if (bytes != null)
					rqp.put("content-length", Integer.toString(bytes.length));
				
				// Write headers
				for (Map.Entry<String, String> e : rqp.entrySet())







|
>
|







135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
				
				// Add some implicit properties
				Map<String, String> rqp = new LinkedHashMap<>(this._rqprops);
				rqp.put("host", address.ipaddr.hostname);
				
				// If the user agent was specified, add to it or set one
				String ua = rqp.get("user-agent");
				rqp.put("user-agent", (ua == null ?
					HTTPRequestBuilder.USER_AGENT :
					ua + HTTPRequestBuilder.USER_AGENT));
				
				// Is content being specified?
				if (bytes != null)
					rqp.put("content-length", Integer.toString(bytes.length));
				
				// Write headers
				for (Map.Entry<String, String> e : rqp.entrySet())

Name change from runt/apis/gcf/cc/squirreljme/runtime/gcf/HTTPResponse.java to modules/gcf/src/main/java/cc/squirreljme/runtime/gcf/HTTPResponse.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.gcf;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.io.IOException;

/**
 * This contains the response of the HTTP request.
 *
 * @since 2019/05/13
 */
public final class HTTPResponse













|
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.gcf;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;

/**
 * This contains the response of the HTTP request.
 *
 * @since 2019/05/13
 */
public final class HTTPResponse

Name change from runt/apis/gcf/cc/squirreljme/runtime/gcf/HTTPResponseHeader.java to modules/gcf/src/main/java/cc/squirreljme/runtime/gcf/HTTPResponseHeader.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.gcf;

import java.io.InputStream;
import java.io.IOException;
import java.util.LinkedHashMap;
import java.util.Map;

/**
 * This contains the HTTP response header.
 *
 * @since 2019/05/13











|
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.gcf;

import java.io.IOException;
import java.io.InputStream;
import java.util.LinkedHashMap;
import java.util.Map;

/**
 * This contains the HTTP response header.
 *
 * @since 2019/05/13

Name change from runt/apis/gcf/cc/squirreljme/runtime/gcf/HTTPSignalListener.java to modules/gcf/src/main/java/cc/squirreljme/runtime/gcf/HTTPSignalListener.java.

23
24
25
26
27
28
29
30
31
32
33
	 * Tells the other end that the HTTP request data is ready.
	 *
	 * @param __data The data of the request.
	 * @throws IOException If the request could not be sent.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/05/13
	 */
	public abstract void requestReady(byte[] __data)
		throws IOException, NullPointerException;
}








|



23
24
25
26
27
28
29
30
31
32
33
	 * Tells the other end that the HTTP request data is ready.
	 *
	 * @param __data The data of the request.
	 * @throws IOException If the request could not be sent.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/05/13
	 */
	void requestReady(byte[] __data)
		throws IOException, NullPointerException;
}

Name change from runt/apis/gcf/cc/squirreljme/runtime/gcf/HTTPState.java to modules/gcf/src/main/java/cc/squirreljme/runtime/gcf/HTTPState.java.

Name change from runt/apis/gcf/cc/squirreljme/runtime/gcf/HTTPStateTracker.java to modules/gcf/src/main/java/cc/squirreljme/runtime/gcf/HTTPStateTracker.java.

Name change from runt/apis/gcf/cc/squirreljme/runtime/gcf/IPAddress.java to modules/gcf/src/main/java/cc/squirreljme/runtime/gcf/IPAddress.java.

42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
	 * @throws IllegalArgumentException If the hostname or port is not valid.
	 * @since 2019/05/06
	 */
	public IPAddress(String __h, int __p)
		throws IllegalArgumentException
	{
		// {@squirreljme.error EC0c IP port out of range. (The port)}
		if (__p != ASSIGNED_PORT && __p < 0 || __p > 65535)
			throw new IllegalArgumentException("EC0c " + __p);
		
		// {@squirreljme.error EC0d No IP address was specified.}
		if (__h == null && __p == ASSIGNED_PORT)
			throw new IllegalArgumentException("EC0d");
		
		// Validate hostname
		if (__h != null)
		{
			// Make it lowercase
			__h = __h.toLowerCase();







|



|







42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
	 * @throws IllegalArgumentException If the hostname or port is not valid.
	 * @since 2019/05/06
	 */
	public IPAddress(String __h, int __p)
		throws IllegalArgumentException
	{
		// {@squirreljme.error EC0c IP port out of range. (The port)}
		if (__p != IPAddress.ASSIGNED_PORT && __p < 0 || __p > 65535)
			throw new IllegalArgumentException("EC0c " + __p);
		
		// {@squirreljme.error EC0d No IP address was specified.}
		if (__h == null && __p == IPAddress.ASSIGNED_PORT)
			throw new IllegalArgumentException("EC0d");
		
		// Validate hostname
		if (__h != null)
		{
			// Make it lowercase
			__h = __h.toLowerCase();
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
		{
			String hostname = this.hostname;
			int port = this.port;
			
			// Include the port or not?
			if (hostname == null)
				rv = ":" + port;
			else if (port == ASSIGNED_PORT)
				rv = hostname;
			else
				rv = hostname + ":" + port;
			
			this._string = new WeakReference<>(rv);
		}
		







|







140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
		{
			String hostname = this.hostname;
			int port = this.port;
			
			// Include the port or not?
			if (hostname == null)
				rv = ":" + port;
			else if (port == IPAddress.ASSIGNED_PORT)
				rv = hostname;
			else
				rv = hostname + ":" + port;
			
			this._string = new WeakReference<>(rv);
		}
		
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
			int col = __s.lastIndexOf(':'),
				eb = __s.lastIndexOf(']');
			if (eb >= 0 && eb > col)
				col = -1;
			
			// Just has a hostname?
			if (col < 0)
				return new IPAddress(__s, ASSIGNED_PORT);
			
			// Just has the port
			else if (col == 0)
				return new IPAddress(null,
					Integer.parseInt(__s.substring(1), 10));
			
			// Has both







|







201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
			int col = __s.lastIndexOf(':'),
				eb = __s.lastIndexOf(']');
			if (eb >= 0 && eb > col)
				col = -1;
			
			// Just has a hostname?
			if (col < 0)
				return new IPAddress(__s, IPAddress.ASSIGNED_PORT);
			
			// Just has the port
			else if (col == 0)
				return new IPAddress(null,
					Integer.parseInt(__s.substring(1), 10));
			
			// Has both

Name change from runt/apis/gcf/cc/squirreljme/runtime/gcf/IPConnectionFactory.java to modules/gcf/src/main/java/cc/squirreljme/runtime/gcf/IPConnectionFactory.java.

8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33

34
35
36
37
38
39
40
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.gcf;

import cc.squirreljme.runtime.cldc.asm.SystemProperties;
import java.io.IOException;
import java.util.ServiceLoader;
import javax.microedition.io.AccessPoint;
import javax.microedition.io.ConnectionNotFoundException;
import javax.microedition.io.SocketConnection;

/**
 * This factory is used in the creation of IP based connections thus allowing
 * SquirrelJME access to the internet.
 *
 * @since 2019/05/12
 */
public abstract class IPConnectionFactory
{
	/** The existing connection factory. */
	private static volatile IPConnectionFactory _FACTORY;
	
	/**
	 * Resolves the specified IP address.
	 *
	 * @param __addr The IP address.

	 * @throws ConnectionNotFoundException If the host was not found.
	 * @throws IOException If the address could not resolved.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/05/12
	 */
	public abstract IPAddress resolveAddress(IPAddress __addr)
		throws ConnectionNotFoundException, IOException, NullPointerException;







<

<
















>







8
9
10
11
12
13
14

15

16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.gcf;

import cc.squirreljme.runtime.cldc.asm.SystemProperties;
import java.io.IOException;
import java.util.ServiceLoader;

import javax.microedition.io.ConnectionNotFoundException;


/**
 * This factory is used in the creation of IP based connections thus allowing
 * SquirrelJME access to the internet.
 *
 * @since 2019/05/12
 */
public abstract class IPConnectionFactory
{
	/** The existing connection factory. */
	private static volatile IPConnectionFactory _FACTORY;
	
	/**
	 * Resolves the specified IP address.
	 *
	 * @param __addr The IP address.
	 * @return The resolved address.
	 * @throws ConnectionNotFoundException If the host was not found.
	 * @throws IOException If the address could not resolved.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/05/12
	 */
	public abstract IPAddress resolveAddress(IPAddress __addr)
		throws ConnectionNotFoundException, IOException, NullPointerException;

Name change from runt/apis/gcf/cc/squirreljme/runtime/gcf/NullIPConnectionFactory.java to modules/gcf/src/main/java/cc/squirreljme/runtime/gcf/NullIPConnectionFactory.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.gcf;

import java.io.IOException;
import javax.microedition.io.AccessPoint;
import javax.microedition.io.ConnectionNotFoundException;
import javax.microedition.io.SocketConnection;

/**
 * This is a connection factory which does not support any IP based
 * connections. Any attempt to open any kind of connection will result in
 * a connection not being made.
 *
 * @since 2019/05/12












<

<







1
2
3
4
5
6
7
8
9
10
11
12

13

14
15
16
17
18
19
20
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.gcf;

import java.io.IOException;

import javax.microedition.io.ConnectionNotFoundException;


/**
 * This is a connection factory which does not support any IP based
 * connections. Any attempt to open any kind of connection will result in
 * a connection not being made.
 *
 * @since 2019/05/12

Name change from runt/apis/gcf/cc/squirreljme/runtime/gcf/SocketAddress.java to modules/gcf/src/main/java/cc/squirreljme/runtime/gcf/SocketAddress.java.

17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
public interface SocketAddress
{
	/**
	 * {@inheritDoc}
	 * @since 2019/05/06
	 */
	@Override
	public abstract boolean equals(Object __o);
	
	/**
	 * {@inheritDoc}
	 * @since 2019/05/06
	 */
	@Override
	public abstract int hashCode();
	
	/**
	 * {@inheritDoc}
	 * @since 2019/05/06
	 */
	@Override
	public abstract String toString();
}








|






|






|


17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
public interface SocketAddress
{
	/**
	 * {@inheritDoc}
	 * @since 2019/05/06
	 */
	@Override
	boolean equals(Object __o);
	
	/**
	 * {@inheritDoc}
	 * @since 2019/05/06
	 */
	@Override
	int hashCode();
	
	/**
	 * {@inheritDoc}
	 * @since 2019/05/06
	 */
	@Override
	String toString();
}

Name change from runt/apis/gcf/cc/squirreljme/runtime/gcf/TCPClientConnection.java to modules/gcf/src/main/java/cc/squirreljme/runtime/gcf/TCPClientConnection.java.

11
12
13
14
15
16
17
18
19
20
21
22
23
24
25

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import javax.microedition.io.AccessPoint;
import javax.microedition.io.ConnectionNotFoundException;
import javax.microedition.io.SocketConnection;

/**
 * This is a connection to a remote TCP server as a client.
 *
 * @since 2019/05/06
 */







<







11
12
13
14
15
16
17

18
19
20
21
22
23
24

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import javax.microedition.io.AccessPoint;

import javax.microedition.io.SocketConnection;

/**
 * This is a connection to a remote TCP server as a client.
 *
 * @since 2019/05/06
 */
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
	 * @since 2019/05/06
	 */
	@Override
	public final void setSocketOption(byte __o, int __v)
		throws IllegalArgumentException, IOException
	{
		// {@squirreljme.error EC0n Invalid socket option. (The option)}
		if (__o != KEEPALIVE || __o != LINGER || __o != SNDBUF ||
			__o != RCVBUF || __o != DELAY || __o != TIMEOUT)
			throw new IllegalArgumentException("EC0n " + __o);
		
		// Check options
		switch (__o)
		{
			case LINGER:
				// {@squirreljme.error EC0o Linger cannot be negative.
				// (The requested linger)}
				if (__v < 0)
					throw new IllegalArgumentException("EC0o " + __v);
				break;
			
			case RCVBUF:
			case SNDBUF:
				// {@squirreljme.error EC0p Send/receive buffer size cannot
				// be negative. (The requested buffer size)}
				if (__v < 0)
					throw new IllegalArgumentException("EC0p " + __v);
				break;
			
			case TIMEOUT:
				// {@squirreljme.error EC0q Timeout cannot be negative.
				// (The requested timeout)}
				if (__v < 0)
					throw new IllegalArgumentException("EC0q " + __v);
				break;
		}
		
		// Forward
		this.doSetSocketOption(__o, __v);
	}
}








|
|





|






|
|






|












282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
	 * @since 2019/05/06
	 */
	@Override
	public final void setSocketOption(byte __o, int __v)
		throws IllegalArgumentException, IOException
	{
		// {@squirreljme.error EC0n Invalid socket option. (The option)}
		if (__o != SocketConnection.KEEPALIVE || __o != SocketConnection.LINGER || __o != SocketConnection.SNDBUF ||
			__o != SocketConnection.RCVBUF || __o != SocketConnection.DELAY || __o != SocketConnection.TIMEOUT)
			throw new IllegalArgumentException("EC0n " + __o);
		
		// Check options
		switch (__o)
		{
			case SocketConnection.LINGER:
				// {@squirreljme.error EC0o Linger cannot be negative.
				// (The requested linger)}
				if (__v < 0)
					throw new IllegalArgumentException("EC0o " + __v);
				break;
			
			case SocketConnection.RCVBUF:
			case SocketConnection.SNDBUF:
				// {@squirreljme.error EC0p Send/receive buffer size cannot
				// be negative. (The requested buffer size)}
				if (__v < 0)
					throw new IllegalArgumentException("EC0p " + __v);
				break;
			
			case SocketConnection.TIMEOUT:
				// {@squirreljme.error EC0q Timeout cannot be negative.
				// (The requested timeout)}
				if (__v < 0)
					throw new IllegalArgumentException("EC0q " + __v);
				break;
		}
		
		// Forward
		this.doSetSocketOption(__o, __v);
	}
}

Name change from runt/apis/gcf/cc/squirreljme/runtime/gcf/TrackedInputStream.java to modules/gcf/src/main/java/cc/squirreljme/runtime/gcf/TrackedInputStream.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.gcf;

import java.io.InputStream;
import java.io.IOException;

/**
 * This is an input which tracks if it has been closed, if EOF is read from
 * a stream then it will automatically be closed.
 *
 * @since 2019/05/13
 */











|
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.gcf;

import java.io.IOException;
import java.io.InputStream;

/**
 * This is an input which tracks if it has been closed, if EOF is read from
 * a stream then it will automatically be closed.
 *
 * @since 2019/05/13
 */

Name change from runt/apis/gcf/cc/squirreljme/runtime/gcf/TrackedOutputStream.java to modules/gcf/src/main/java/cc/squirreljme/runtime/gcf/TrackedOutputStream.java.

Name change from runt/apis/gcf/cc/squirreljme/runtime/gcf/package-info.java to modules/gcf/src/main/java/cc/squirreljme/runtime/gcf/package-info.java.

10
11
12
13
14
15
16
17
18

/**
 * This contains the default implementation of the GCF classes.
 *
 * @since 2016/10/12
 */

package cc.squirreljme.gcf;








|

10
11
12
13
14
15
16
17
18

/**
 * This contains the default implementation of the GCF classes.
 *
 * @since 2016/10/12
 */

package cc.squirreljme.runtime.gcf;

Name change from runt/apis/gcf/javax/microedition/io/AccessPoint.java to modules/gcf/src/main/java/javax/microedition/io/AccessPoint.java.

12
13
14
15
16
17
18
19
20
21
22
23
24
25
26

import java.io.IOException;

public class AccessPoint
{
	public AccessPoint()
	{
		super();
		throw new todo.TODO();
	}
	
	public void addListener(AccessPointListener __a)
	{
		throw new todo.TODO();
	}







<







12
13
14
15
16
17
18

19
20
21
22
23
24
25

import java.io.IOException;

public class AccessPoint
{
	public AccessPoint()
	{

		throw new todo.TODO();
	}
	
	public void addListener(AccessPointListener __a)
	{
		throw new todo.TODO();
	}

Name change from runt/apis/gcf/javax/microedition/io/AccessPointListener.java to modules/gcf/src/main/java/javax/microedition/io/AccessPointListener.java.

11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package javax.microedition.io;

import java.util.EventListener;

public interface AccessPointListener
	extends EventListener
{
	public static final int EVENT_TYPE_CONNECTED =
		0;
	
	public static final int EVENT_TYPE_DISCONNECTED =
		1;
	
	public static final int EVENT_TYPE_REMOVED =
		2;
	
	public abstract void notifyEvent(AccessPoint __a, int __b);
}









|


|


|


|



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package javax.microedition.io;

import java.util.EventListener;

public interface AccessPointListener
	extends EventListener
{
	int EVENT_TYPE_CONNECTED =
		0;
	
	int EVENT_TYPE_DISCONNECTED =
		1;
	
	int EVENT_TYPE_REMOVED =
		2;
	
	void notifyEvent(AccessPoint __a, int __b);
}


Name change from runt/apis/gcf/javax/microedition/io/AccessPointPermission.java to modules/gcf/src/main/java/javax/microedition/io/AccessPointPermission.java.

Name change from runt/apis/gcf/javax/microedition/io/CommConnection.java to modules/gcf/src/main/java/javax/microedition/io/CommConnection.java.

10
11
12
13
14
15
16
17
18
19
20
21
22

package javax.microedition.io;


public interface CommConnection
	extends StreamConnection
{
	public abstract int getBaudRate();
	
	public abstract int setBaudRate(int __a);
}









|

|



10
11
12
13
14
15
16
17
18
19
20
21
22

package javax.microedition.io;


public interface CommConnection
	extends StreamConnection
{
	int getBaudRate();
	
	int setBaudRate(int __a);
}


Name change from runt/apis/gcf/javax/microedition/io/CommProtocolPermission.java to modules/gcf/src/main/java/javax/microedition/io/CommProtocolPermission.java.

Name change from runt/apis/gcf/javax/microedition/io/Connection.java to modules/gcf/src/main/java/javax/microedition/io/Connection.java.

22
23
24
25
26
27
28
29
30
31
32
33
	extends Closeable
{
	/**
	 * {@inheritDoc}
	 * @since 2019/05/06
	 */
	@Override
	public abstract void close()
		throws IOException;
}









|




22
23
24
25
26
27
28
29
30
31
32
33
	extends Closeable
{
	/**
	 * {@inheritDoc}
	 * @since 2019/05/06
	 */
	@Override
	void close()
		throws IOException;
}


Name change from runt/apis/gcf/javax/microedition/io/ConnectionNotFoundException.java to modules/gcf/src/main/java/javax/microedition/io/ConnectionNotFoundException.java.

Name change from runt/apis/gcf/javax/microedition/io/ConnectionOption.java to modules/gcf/src/main/java/javax/microedition/io/ConnectionOption.java.

11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package javax.microedition.io;


public class ConnectionOption<T>
{
	public ConnectionOption(String __a, T __b)
	{
		super();
		throw new todo.TODO();
	}
	
	public String getName()
	{
		throw new todo.TODO();
	}







<







11
12
13
14
15
16
17

18
19
20
21
22
23
24
package javax.microedition.io;


public class ConnectionOption<T>
{
	public ConnectionOption(String __a, T __b)
	{

		throw new todo.TODO();
	}
	
	public String getName()
	{
		throw new todo.TODO();
	}

Name change from runt/apis/gcf/javax/microedition/io/Connector.java to modules/gcf/src/main/java/javax/microedition/io/Connector.java.

10
11
12
13
14
15
16
17
18
19

20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50

package javax.microedition.io;

import cc.squirreljme.runtime.gcf.HTTPAddress;
import cc.squirreljme.runtime.gcf.HTTPClientConnection;
import cc.squirreljme.runtime.gcf.IPAddress;
import cc.squirreljme.runtime.gcf.IPConnectionFactory;
import cc.squirreljme.runtime.gcf.TCPClientConnection;
import java.io.DataInputStream;
import java.io.DataOutputStream;

import java.io.InputStream;
import java.io.IOException;
import java.io.OutputStream;

/**
 * This class is used to create new connections via the generic connection
 * framework. All connection resources are URIs which describe the resource
 * to be accessed.
 *
 * @since 2016/10/12
 */
public class Connector
{
	/** Access mode to allow reading from the connection stream. */
	public static final int READ =
		1;
	
	/** Access mode to allow for writing to the connection stream. */
	public static final int WRITE =
		2;
	
	/** Access mode to allow for read and writing from/to the stream. */
	public static final int READ_WRITE =
		READ | WRITE;
	
	/**
	 * Not used.
	 *
	 * @since 2016/10/12
	 */
	private Connector()







<


>

|




















|
<







10
11
12
13
14
15
16

17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42

43
44
45
46
47
48
49

package javax.microedition.io;

import cc.squirreljme.runtime.gcf.HTTPAddress;
import cc.squirreljme.runtime.gcf.HTTPClientConnection;
import cc.squirreljme.runtime.gcf.IPAddress;
import cc.squirreljme.runtime.gcf.IPConnectionFactory;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InterruptedIOException;
import java.io.OutputStream;

/**
 * This class is used to create new connections via the generic connection
 * framework. All connection resources are URIs which describe the resource
 * to be accessed.
 *
 * @since 2016/10/12
 */
public class Connector
{
	/** Access mode to allow reading from the connection stream. */
	public static final int READ =
		1;
	
	/** Access mode to allow for writing to the connection stream. */
	public static final int WRITE =
		2;
	
	/** Access mode to allow for read and writing from/to the stream. */
	public static final int READ_WRITE = Connector.READ | Connector.WRITE;

	
	/**
	 * Not used.
	 *
	 * @since 2016/10/12
	 */
	private Connector()
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209

210
211
212
213
214
215
216
	 * @return As forwarded.
	 * @throws IOException As forwarded.
	 * @since 2016/10/12
	 */
	public static Connection open(String __uri)
		throws IOException
	{
		return open(__uri, READ_WRITE, false, (ConnectionOption<?>[])null);
	}
	
	/**
	 * Invokes:
	 * {@code open(__uri, READ_WRITE, false, __opts)}.
	 *
	 * @param __uri As forwarded.
	 * @param __opts As forwarded.
	 * @return As forwarded.
	 * @throws IOException As forwarded.
	 * @since 2016/10/12
	 */
	public static Connection open(String __uri, ConnectionOption<?>... __opts)
		throws IOException
	{
		return open(__uri, READ_WRITE, false, __opts);
	}
	
	/**
	 * Invokes:
	 * {@code open(__uri, __mode, false, (ConnectionOption<?>[])null)}.
	 *
	 * @param __uri As forwarded.
	 * @param __mode As forwarded.
	 * @return As forwarded.
	 * @throws IOException As forwarded.
	 * @since 2016/10/12
	 */
	public static Connection open(String __uri, int __mode)
		throws IOException
	{
		return open(__uri, __mode, false, (ConnectionOption<?>[])null);
	}
	
	/**
	 * Invokes:
	 * {@code open(__uri, __mode, false, __opts)}.
	 *
	 * @param __uri As forwarded.
	 * @param __mode As forwarded.
	 * @param __opts As forwarded.
	 * @return As forwarded.
	 * @throws IOException As forwarded.
	 * @since 2016/10/12
	 */
	public static Connection open(String __uri, int __mode,
		ConnectionOption<?>... __opts)
		throws IOException
	{
		return open(__uri, __mode, false, __opts);
	}
	
	/**
	 * Invokes:
	 * {@code open(__uri, __mode, __timeouts, (ConnectionOption<?>[])null)}.
	 *
	 * @param __uri As forwarded.
	 * @param __mode As forwarded.
	 * @param __timeouts As forwarded.
	 * @return As forwarded.
	 * @throws IOException As forwarded.
	 * @since 2016/10/12
	 */
	public static Connection open(String __uri, int __mode, boolean __timeouts)
		throws IOException
	{
		return open(__uri, __mode, __timeouts, (ConnectionOption<?>[])null);
	}
	
	/**
	 * This opens and creates a connection to the specified resource which is
	 * named by the URI.
	 *
	 * @param __uri The URI to open.
	 * @param __mode The open mode of the socket.
	 * @param __timeouts This is a hint to the connection system that it is
	 * acceptable for {@link InterruptedIOException}s to be generated. This
	 * is not required to be followed.
	 * @param __opts Options which modify the properties of a stream.

	 * @throws ConnectionNotFoundException Either the protocol is not supported
	 * or the target to connect to could not be located.
	 * @throws IllegalArgumentException If a parameter is not valid.
	 * @throws IOException On other unspecified exceptions.
	 * @throws NullPointerException If no URI was specified.
	 * @throws SecurityException If access to the protocol is not permitted.
	 * @since 2016/10/12







|















|















|

















|
















|












>







122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
	 * @return As forwarded.
	 * @throws IOException As forwarded.
	 * @since 2016/10/12
	 */
	public static Connection open(String __uri)
		throws IOException
	{
		return Connector.open(__uri, Connector.READ_WRITE, false, (ConnectionOption<?>[])null);
	}
	
	/**
	 * Invokes:
	 * {@code open(__uri, READ_WRITE, false, __opts)}.
	 *
	 * @param __uri As forwarded.
	 * @param __opts As forwarded.
	 * @return As forwarded.
	 * @throws IOException As forwarded.
	 * @since 2016/10/12
	 */
	public static Connection open(String __uri, ConnectionOption<?>... __opts)
		throws IOException
	{
		return Connector.open(__uri, Connector.READ_WRITE, false, __opts);
	}
	
	/**
	 * Invokes:
	 * {@code open(__uri, __mode, false, (ConnectionOption<?>[])null)}.
	 *
	 * @param __uri As forwarded.
	 * @param __mode As forwarded.
	 * @return As forwarded.
	 * @throws IOException As forwarded.
	 * @since 2016/10/12
	 */
	public static Connection open(String __uri, int __mode)
		throws IOException
	{
		return Connector.open(__uri, __mode, false, (ConnectionOption<?>[])null);
	}
	
	/**
	 * Invokes:
	 * {@code open(__uri, __mode, false, __opts)}.
	 *
	 * @param __uri As forwarded.
	 * @param __mode As forwarded.
	 * @param __opts As forwarded.
	 * @return As forwarded.
	 * @throws IOException As forwarded.
	 * @since 2016/10/12
	 */
	public static Connection open(String __uri, int __mode,
		ConnectionOption<?>... __opts)
		throws IOException
	{
		return Connector.open(__uri, __mode, false, __opts);
	}
	
	/**
	 * Invokes:
	 * {@code open(__uri, __mode, __timeouts, (ConnectionOption<?>[])null)}.
	 *
	 * @param __uri As forwarded.
	 * @param __mode As forwarded.
	 * @param __timeouts As forwarded.
	 * @return As forwarded.
	 * @throws IOException As forwarded.
	 * @since 2016/10/12
	 */
	public static Connection open(String __uri, int __mode, boolean __timeouts)
		throws IOException
	{
		return Connector.open(__uri, __mode, __timeouts, (ConnectionOption<?>[])null);
	}
	
	/**
	 * This opens and creates a connection to the specified resource which is
	 * named by the URI.
	 *
	 * @param __uri The URI to open.
	 * @param __mode The open mode of the socket.
	 * @param __timeouts This is a hint to the connection system that it is
	 * acceptable for {@link InterruptedIOException}s to be generated. This
	 * is not required to be followed.
	 * @param __opts Options which modify the properties of a stream.
	 * @return The opened connection.
	 * @throws ConnectionNotFoundException Either the protocol is not supported
	 * or the target to connect to could not be located.
	 * @throws IllegalArgumentException If a parameter is not valid.
	 * @throws IOException On other unspecified exceptions.
	 * @throws NullPointerException If no URI was specified.
	 * @throws SecurityException If access to the protocol is not permitted.
	 * @since 2016/10/12
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273

274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300

301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
	 * @return The data stream.
	 * @throws IOException As forwarded.
	 * @since 2016/10/12
	 */
	public static DataInputStream openDataInputStream(String __uri)
		throws IOException
	{
		return new DataInputStream(openInputStream(__uri));
	}
	
	/**
	 * Invokes {@code new DataOutputStream(openOutputStream(__uri))}.
	 *
	 * @param __uri The URI to open.
	 * @return The data stream.
	 * @throws IOException As forwarded.
	 * @since 2016/10/12
	 */
	public static DataOutputStream openDataOutputStream(String __uri)
		throws IOException
	{
		return new DataOutputStream(openOutputStream(__uri));
	}
	
	/**
	 * This opens a connection, obtains the input stream, then closes the
	 * connection.
	 *

	 * @return An input stream for the given connection.
	 * @throws IllegalArgumentException If the connection is not an
	 * {@link InputConnection}.
	 * @throws IOException On open errors.
	 * @since 2016/10/12
	 */
	public static InputStream openInputStream(String __uri)
		throws IllegalArgumentException, IOException
	{
		// Open it, then close it
		try (Connection c = open(__uri))
		{
			// {@squirreljme.error EC0z The specified URI is not an input
			// connection. (The URI)}
			if (!(c instanceof InputConnection))
				throw new IllegalArgumentException(String.format("EC0z %s",
					__uri));
			
			// Open it
			return ((InputConnection)c).openInputStream();
		}
	}
	
	/**
	 * This opens a connection, obtains the output stream, then closes the
	 * connection.
	 *

	 * @return An output stream for the given connection.
	 * @throws IllegalArgumentException If the connection is not an
	 * {@link OutputConnection}.
	 * @throws IOException On open errors.
	 * @since 2016/10/12
	 */
	public static OutputStream openOutputStream(String __uri)
		throws IllegalArgumentException, IOException
	{
		// Open it, then close it
		try (Connection c = open(__uri))
		{
			// {@squirreljme.error EC10 The specified URI is not an output
			// connection. (The URI)}
			if (!(c instanceof OutputConnection))
				throw new IllegalArgumentException(String.format("EC10 %s",
					__uri));
			







|













|






>










|
















>










|







246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
	 * @return The data stream.
	 * @throws IOException As forwarded.
	 * @since 2016/10/12
	 */
	public static DataInputStream openDataInputStream(String __uri)
		throws IOException
	{
		return new DataInputStream(Connector.openInputStream(__uri));
	}
	
	/**
	 * Invokes {@code new DataOutputStream(openOutputStream(__uri))}.
	 *
	 * @param __uri The URI to open.
	 * @return The data stream.
	 * @throws IOException As forwarded.
	 * @since 2016/10/12
	 */
	public static DataOutputStream openDataOutputStream(String __uri)
		throws IOException
	{
		return new DataOutputStream(Connector.openOutputStream(__uri));
	}
	
	/**
	 * This opens a connection, obtains the input stream, then closes the
	 * connection.
	 *
	 * @param __uri The URI to open.
	 * @return An input stream for the given connection.
	 * @throws IllegalArgumentException If the connection is not an
	 * {@link InputConnection}.
	 * @throws IOException On open errors.
	 * @since 2016/10/12
	 */
	public static InputStream openInputStream(String __uri)
		throws IllegalArgumentException, IOException
	{
		// Open it, then close it
		try (Connection c = Connector.open(__uri))
		{
			// {@squirreljme.error EC0z The specified URI is not an input
			// connection. (The URI)}
			if (!(c instanceof InputConnection))
				throw new IllegalArgumentException(String.format("EC0z %s",
					__uri));
			
			// Open it
			return ((InputConnection)c).openInputStream();
		}
	}
	
	/**
	 * This opens a connection, obtains the output stream, then closes the
	 * connection.
	 *
	 * @param __uri The URI to open.
	 * @return An output stream for the given connection.
	 * @throws IllegalArgumentException If the connection is not an
	 * {@link OutputConnection}.
	 * @throws IOException On open errors.
	 * @since 2016/10/12
	 */
	public static OutputStream openOutputStream(String __uri)
		throws IllegalArgumentException, IOException
	{
		// Open it, then close it
		try (Connection c = Connector.open(__uri))
		{
			// {@squirreljme.error EC10 The specified URI is not an output
			// connection. (The URI)}
			if (!(c instanceof OutputConnection))
				throw new IllegalArgumentException(String.format("EC10 %s",
					__uri));
			

Name change from runt/apis/gcf/javax/microedition/io/ContentConnection.java to modules/gcf/src/main/java/javax/microedition/io/ContentConnection.java.

10
11
12
13
14
15
16
17
18
19
20
21
22
23
24

package javax.microedition.io;


public interface ContentConnection
	extends StreamConnection
{
	public abstract String getEncoding();
	
	public abstract long getLength();
	
	public abstract String getType();
}









|

|

|



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24

package javax.microedition.io;


public interface ContentConnection
	extends StreamConnection
{
	String getEncoding();
	
	long getLength();
	
	String getType();
}


Name change from runt/apis/gcf/javax/microedition/io/DTLSProtocolPermission.java to modules/gcf/src/main/java/javax/microedition/io/DTLSProtocolPermission.java.

Name change from runt/apis/gcf/javax/microedition/io/Datagram.java to modules/gcf/src/main/java/javax/microedition/io/Datagram.java.

13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;

public interface Datagram
	extends DataInput, DataOutput
{
	public abstract String getAddress();
	
	public abstract byte[] getData();
	
	public abstract int getLength();
	
	public abstract int getOffset();
	
	public abstract void reset();
	
	public abstract void setAddress(String __a)
		throws IOException;
	
	public abstract void setAddress(Datagram __a);
	
	public abstract void setData(byte[] __a, int __b, int __c);
	
	public abstract void setLength(int __a);
}









|

|

|

|

|

|


|

|

|



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;

public interface Datagram
	extends DataInput, DataOutput
{
	String getAddress();
	
	byte[] getData();
	
	int getLength();
	
	int getOffset();
	
	void reset();
	
	void setAddress(String __a)
		throws IOException;
	
	void setAddress(Datagram __a);
	
	void setData(byte[] __a, int __b, int __c);
	
	void setLength(int __a);
}


Name change from runt/apis/gcf/javax/microedition/io/DatagramConnection.java to modules/gcf/src/main/java/javax/microedition/io/DatagramConnection.java.

11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package javax.microedition.io;

import java.io.IOException;

public interface DatagramConnection
	extends Connection
{
	public abstract AccessPoint[] getAccessPoints()
		throws IOException;
	
	public abstract int getMaximumLength()
		throws IOException;
	
	public abstract int getNominalLength()
		throws IOException;
	
	public abstract Datagram newDatagram(int __a)
		throws IOException;
	
	public abstract Datagram newDatagram(int __a, String __b)
		throws IOException;
	
	public abstract Datagram newDatagram(byte[] __a, int __b)
		throws IOException;
	
	public abstract Datagram newDatagram(byte[] __a, int __b, String __c)
		throws IOException;
	
	public abstract void receive(Datagram __a)
		throws IOException;
	
	public abstract void send(Datagram __a)
		throws IOException;
}









|


|


|


|


|


|


|


|


|




11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package javax.microedition.io;

import java.io.IOException;

public interface DatagramConnection
	extends Connection
{
	AccessPoint[] getAccessPoints()
		throws IOException;
	
	int getMaximumLength()
		throws IOException;
	
	int getNominalLength()
		throws IOException;
	
	Datagram newDatagram(int __a)
		throws IOException;
	
	Datagram newDatagram(int __a, String __b)
		throws IOException;
	
	Datagram newDatagram(byte[] __a, int __b)
		throws IOException;
	
	Datagram newDatagram(byte[] __a, int __b, String __c)
		throws IOException;
	
	void receive(Datagram __a)
		throws IOException;
	
	void send(Datagram __a)
		throws IOException;
}


Name change from runt/apis/gcf/javax/microedition/io/DatagramProtocolPermission.java to modules/gcf/src/main/java/javax/microedition/io/DatagramProtocolPermission.java.

Name change from runt/apis/gcf/javax/microedition/io/FileProtocolPermission.java to modules/gcf/src/main/java/javax/microedition/io/FileProtocolPermission.java.

Name change from runt/apis/gcf/javax/microedition/io/GCFPermission.java to modules/gcf/src/main/java/javax/microedition/io/GCFPermission.java.

Name change from runt/apis/gcf/javax/microedition/io/HttpConnection.java to modules/gcf/src/main/java/javax/microedition/io/HttpConnection.java.

16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
 * This is a connection which enables HTTP based API access.
 *
 * This connection is within three states:
 *  - SETUP where the connection is being setup.
 *  - CONNECTED where the connection has been made.
 *  - CLOSED where the connection has been completed and closed.
 *
 * The {@link openOutputStream} and {@link openDataOutputStream} may only be
 * called when in the SETUP state, when either of these streams are closed
 * the connection will transition to the connected state. Additionally if
 * the state transitions to the CONNECTED state for any reason then the stream
 * will be implicitly closed and its data will be used.
 *
 * @since 2019/05/12
 */
public interface HttpConnection
	extends ContentConnection
{
	public static final String CONNECT =
		"CONNECT";
	
	public static final String DELETE =
		"DELETE";
	
	public static final String GET =
		"GET";
	
	public static final String HEAD =
		"HEAD";
	
	public static final int HTTP_ACCEPTED =
		202;
	
	public static final int HTTP_BAD_GATEWAY =
		502;
	
	public static final int HTTP_BAD_METHOD =
		405;
	
	public static final int HTTP_BAD_REQUEST =
		400;
	
	public static final int HTTP_CLIENT_TIMEOUT =
		408;
	
	public static final int HTTP_CONFLICT =
		409;
	
	public static final int HTTP_CREATED =
		201;
	
	public static final int HTTP_ENTITY_TOO_LARGE =
		413;
	
	public static final int HTTP_EXPECT_FAILED =
		417;
	
	public static final int HTTP_FORBIDDEN =
		403;
	
	public static final int HTTP_GATEWAY_TIMEOUT =
		504;
	
	public static final int HTTP_GONE =
		410;
	
	public static final int HTTP_INTERNAL_ERROR =
		500;
	
	public static final int HTTP_LENGTH_REQUIRED =
		411;
	
	public static final int HTTP_MOVED_PERM =
		301;
	
	public static final int HTTP_MOVED_TEMP =
		302;
	
	public static final int HTTP_MULT_CHOICE =
		300;
	
	public static final int HTTP_NOT_ACCEPTABLE =
		406;
	
	public static final int HTTP_NOT_AUTHORITATIVE =
		203;
	
	public static final int HTTP_NOT_FOUND =
		404;
	
	public static final int HTTP_NOT_IMPLEMENTED =
		501;
	
	public static final int HTTP_NOT_MODIFIED =
		304;
	
	public static final int HTTP_NO_CONTENT =
		204;
	
	public static final int HTTP_OK =
		200;
	
	public static final int HTTP_PARTIAL =
		206;
	
	public static final int HTTP_PAYMENT_REQUIRED =
		402;
	
	public static final int HTTP_PRECON_FAILED =
		412;
	
	public static final int HTTP_PROXY_AUTH =
		407;
	
	public static final int HTTP_REQ_TOO_LONG =
		414;
	
	public static final int HTTP_RESET =
		205;
	
	public static final int HTTP_SEE_OTHER =
		303;
	
	public static final int HTTP_TEMP_REDIRECT =
		307;
	
	public static final int HTTP_UNAUTHORIZED =
		401;
	
	public static final int HTTP_UNAVAILABLE =
		503;
	
	public static final int HTTP_UNSUPPORTED_RANGE =
		416;
	
	public static final int HTTP_UNSUPPORTED_TYPE =
		415;
	
	public static final int HTTP_USE_PROXY =
		305;
	
	public static final int HTTP_VERSION =
		505;
	
	public static final String OPTIONS =
		"OPTIONS";
	
	public static final String POST =
		"POST";
	
	public static final String PUT =
		"PUT";
	
	public static final String TRACE =
		"TRACE";
	
	public abstract AccessPoint getAccessPoint()
		throws IOException;
	
	public abstract long getDate()
		throws IOException;
	
	public abstract long getExpiration()
		throws IOException;
	
	public abstract String getFile();
	
	public abstract String getHeaderField(String __a)
		throws IOException;
	
	public abstract String getHeaderField(int __a)
		throws IOException;
	
	public abstract long getHeaderFieldDate(String __a, long __b)
		throws IOException;
	
	public abstract int getHeaderFieldInt(String __a, int __b)
		throws IOException;
	
	public abstract String getHeaderFieldKey(int __a)
		throws IOException;
	
	public abstract String getHost();
	
	public abstract long getLastModified()
		throws IOException;
	
	public abstract int getPort();
	
	public abstract String getProtocol();
	
	public abstract String getQuery();
	
	public abstract String getRef();
	
	public abstract String getRequestMethod();
	
	public abstract String getRequestProperty(String __a);
	
	public abstract int getResponseCode()
		throws IOException;
	
	public abstract String getResponseMessage()
		throws IOException;
	
	public abstract String getURL();
	
	/**
	 * Sets the request method to use.
	 *
	 * @param __m The method to use.
	 * @throws IOException If this is not in the setup phase.
	 * @throws NullPointerException If no method was specified.
	 * @since 2019/05/12
	 */
	public abstract void setRequestMethod(String __m)
		throws IOException, NullPointerException;
	
	/**
	 * Adds or replaces an existing request property, note that for multiple
	 * request property specifications they need to manually be comma
	 * separated.
	 *
	 * @param __k The request header key.
	 * @param __v The value to use, {@code null} clears.
	 * @throws IOException If this is not in the setup phase.
	 * @throws NullPointerException If the key was null.
	 * @since 2019/05/12
	 */
	public abstract void setRequestProperty(String __k, String __v)
		throws IOException;
}









|
|









|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|

|


|


|


|


|


|

|


|

|

|

|

|

|

|


|


|









|













|




16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
 * This is a connection which enables HTTP based API access.
 *
 * This connection is within three states:
 *  - SETUP where the connection is being setup.
 *  - CONNECTED where the connection has been made.
 *  - CLOSED where the connection has been completed and closed.
 *
 * The {@link #openOutputStream()} and {@link #openDataOutputStream()} may only
 * be called when in the SETUP state, when either of these streams are closed
 * the connection will transition to the connected state. Additionally if
 * the state transitions to the CONNECTED state for any reason then the stream
 * will be implicitly closed and its data will be used.
 *
 * @since 2019/05/12
 */
public interface HttpConnection
	extends ContentConnection
{
	String CONNECT =
		"CONNECT";
	
	String DELETE =
		"DELETE";
	
	String GET =
		"GET";
	
	String HEAD =
		"HEAD";
	
	int HTTP_ACCEPTED =
		202;
	
	int HTTP_BAD_GATEWAY =
		502;
	
	int HTTP_BAD_METHOD =
		405;
	
	int HTTP_BAD_REQUEST =
		400;
	
	int HTTP_CLIENT_TIMEOUT =
		408;
	
	int HTTP_CONFLICT =
		409;
	
	int HTTP_CREATED =
		201;
	
	int HTTP_ENTITY_TOO_LARGE =
		413;
	
	int HTTP_EXPECT_FAILED =
		417;
	
	int HTTP_FORBIDDEN =
		403;
	
	int HTTP_GATEWAY_TIMEOUT =
		504;
	
	int HTTP_GONE =
		410;
	
	int HTTP_INTERNAL_ERROR =
		500;
	
	int HTTP_LENGTH_REQUIRED =
		411;
	
	int HTTP_MOVED_PERM =
		301;
	
	int HTTP_MOVED_TEMP =
		302;
	
	int HTTP_MULT_CHOICE =
		300;
	
	int HTTP_NOT_ACCEPTABLE =
		406;
	
	int HTTP_NOT_AUTHORITATIVE =
		203;
	
	int HTTP_NOT_FOUND =
		404;
	
	int HTTP_NOT_IMPLEMENTED =
		501;
	
	int HTTP_NOT_MODIFIED =
		304;
	
	int HTTP_NO_CONTENT =
		204;
	
	int HTTP_OK =
		200;
	
	int HTTP_PARTIAL =
		206;
	
	int HTTP_PAYMENT_REQUIRED =
		402;
	
	int HTTP_PRECON_FAILED =
		412;
	
	int HTTP_PROXY_AUTH =
		407;
	
	int HTTP_REQ_TOO_LONG =
		414;
	
	int HTTP_RESET =
		205;
	
	int HTTP_SEE_OTHER =
		303;
	
	int HTTP_TEMP_REDIRECT =
		307;
	
	int HTTP_UNAUTHORIZED =
		401;
	
	int HTTP_UNAVAILABLE =
		503;
	
	int HTTP_UNSUPPORTED_RANGE =
		416;
	
	int HTTP_UNSUPPORTED_TYPE =
		415;
	
	int HTTP_USE_PROXY =
		305;
	
	int HTTP_VERSION =
		505;
	
	String OPTIONS =
		"OPTIONS";
	
	String POST =
		"POST";
	
	String PUT =
		"PUT";
	
	String TRACE =
		"TRACE";
	
	AccessPoint getAccessPoint()
		throws IOException;
	
	long getDate()
		throws IOException;
	
	long getExpiration()
		throws IOException;
	
	String getFile();
	
	String getHeaderField(String __a)
		throws IOException;
	
	String getHeaderField(int __a)
		throws IOException;
	
	long getHeaderFieldDate(String __a, long __b)
		throws IOException;
	
	int getHeaderFieldInt(String __a, int __b)
		throws IOException;
	
	String getHeaderFieldKey(int __a)
		throws IOException;
	
	String getHost();
	
	long getLastModified()
		throws IOException;
	
	int getPort();
	
	String getProtocol();
	
	String getQuery();
	
	String getRef();
	
	String getRequestMethod();
	
	String getRequestProperty(String __a);
	
	int getResponseCode()
		throws IOException;
	
	String getResponseMessage()
		throws IOException;
	
	String getURL();
	
	/**
	 * Sets the request method to use.
	 *
	 * @param __m The method to use.
	 * @throws IOException If this is not in the setup phase.
	 * @throws NullPointerException If no method was specified.
	 * @since 2019/05/12
	 */
	void setRequestMethod(String __m)
		throws IOException, NullPointerException;
	
	/**
	 * Adds or replaces an existing request property, note that for multiple
	 * request property specifications they need to manually be comma
	 * separated.
	 *
	 * @param __k The request header key.
	 * @param __v The value to use, {@code null} clears.
	 * @throws IOException If this is not in the setup phase.
	 * @throws NullPointerException If the key was null.
	 * @since 2019/05/12
	 */
	void setRequestProperty(String __k, String __v)
		throws IOException;
}


Name change from runt/apis/gcf/javax/microedition/io/HttpProtocolPermission.java to modules/gcf/src/main/java/javax/microedition/io/HttpProtocolPermission.java.

Name change from runt/apis/gcf/javax/microedition/io/HttpsConnection.java to modules/gcf/src/main/java/javax/microedition/io/HttpsConnection.java.

11
12
13
14
15
16
17
18
19
20
21
22
23
24
package javax.microedition.io;

import java.io.IOException;

public interface HttpsConnection
	extends HttpConnection
{
	public abstract int getPort();
	
	public abstract SecurityInfo getSecurityInfo()
		throws IOException;
}









|

|




11
12
13
14
15
16
17
18
19
20
21
22
23
24
package javax.microedition.io;

import java.io.IOException;

public interface HttpsConnection
	extends HttpConnection
{
	int getPort();
	
	SecurityInfo getSecurityInfo()
		throws IOException;
}


Name change from runt/apis/gcf/javax/microedition/io/HttpsProtocolPermission.java to modules/gcf/src/main/java/javax/microedition/io/HttpsProtocolPermission.java.

Name change from runt/apis/gcf/javax/microedition/io/IMCConnection.java to modules/gcf/src/main/java/javax/microedition/io/IMCConnection.java.

11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package javax.microedition.io;

import javax.microedition.midlet.MIDletIdentity;

public interface IMCConnection
	extends StreamConnection
{
	public abstract MIDletIdentity getRemoteIdentity();
	
	public abstract String getRequestedServerVersion();
	
	public abstract String getServerName();
}









|

|

|



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package javax.microedition.io;

import javax.microedition.midlet.MIDletIdentity;

public interface IMCConnection
	extends StreamConnection
{
	MIDletIdentity getRemoteIdentity();
	
	String getRequestedServerVersion();
	
	String getServerName();
}


Name change from runt/apis/gcf/javax/microedition/io/IMCServerConnection.java to modules/gcf/src/main/java/javax/microedition/io/IMCServerConnection.java.

10
11
12
13
14
15
16
17
18
19
20
21
22

package javax.microedition.io;


public interface IMCServerConnection
	extends StreamConnectionNotifier
{
	public abstract String getName();
	
	public abstract String getVersion();
}









|

|



10
11
12
13
14
15
16
17
18
19
20
21
22

package javax.microedition.io;


public interface IMCServerConnection
	extends StreamConnectionNotifier
{
	String getName();
	
	String getVersion();
}


Name change from runt/apis/gcf/javax/microedition/io/InputConnection.java to modules/gcf/src/main/java/javax/microedition/io/InputConnection.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package javax.microedition.io;

import java.io.DataInputStream;
import java.io.InputStream;
import java.io.IOException;

public interface InputConnection
	extends Connection
{
	public abstract DataInputStream openDataInputStream()
		throws IOException;
	
	public abstract InputStream openInputStream()
		throws IOException;
}















|
|




|


|




1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package javax.microedition.io;

import java.io.DataInputStream;
import java.io.IOException;
import java.io.InputStream;

public interface InputConnection
	extends Connection
{
	DataInputStream openDataInputStream()
		throws IOException;
	
	InputStream openInputStream()
		throws IOException;
}


Name change from runt/apis/gcf/javax/microedition/io/ModemConnection.java to modules/gcf/src/main/java/javax/microedition/io/ModemConnection.java.

11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package javax.microedition.io;

import java.io.IOException;

public interface ModemConnection
	extends CommConnection
{
	public static final int DCD_SIGNAL =
		2;
	
	public static final int DSR_SIGNAL =
		4;
	
	public static final int DTR_SIGNAL =
		1;
	
	public static final int INPUT_MODE =
		0;
	
	public static final int OUTPUT_MODE =
		1;
	
	public static final int RI_SIGNAL =
		8;
	
	public static final int UNSUPPORTED =
		-1;
	
	public abstract void addListener(ModemListener __a, int __b);
	
	public abstract int getLineMode(int __a);
	
	public abstract boolean getLineState(int __a)
		throws IOException;
	
	public abstract void removeListener(ModemListener __a);
	
	public abstract void setLineState(int __a, boolean __b)
		throws IOException;
}









|


|


|


|


|


|


|


|

|

|


|

|




11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package javax.microedition.io;

import java.io.IOException;

public interface ModemConnection
	extends CommConnection
{
	int DCD_SIGNAL =
		2;
	
	int DSR_SIGNAL =
		4;
	
	int DTR_SIGNAL =
		1;
	
	int INPUT_MODE =
		0;
	
	int OUTPUT_MODE =
		1;
	
	int RI_SIGNAL =
		8;
	
	int UNSUPPORTED =
		-1;
	
	void addListener(ModemListener __a, int __b);
	
	int getLineMode(int __a);
	
	boolean getLineState(int __a)
		throws IOException;
	
	void removeListener(ModemListener __a);
	
	void setLineState(int __a, boolean __b)
		throws IOException;
}


Name change from runt/apis/gcf/javax/microedition/io/ModemListener.java to modules/gcf/src/main/java/javax/microedition/io/ModemListener.java.

11
12
13
14
15
16
17
18
19
20
21
22
package javax.microedition.io;

import java.util.EventListener;

public interface ModemListener
	extends EventListener
{
	public abstract void signalChanged(ModemConnection __a, int __b, boolean 
		__c);
}









|
<



11
12
13
14
15
16
17
18

19
20
21
package javax.microedition.io;

import java.util.EventListener;

public interface ModemListener
	extends EventListener
{
	void signalChanged(ModemConnection __a, int __b, boolean __c);

}


Name change from runt/apis/gcf/javax/microedition/io/MulticastProtocolPermission.java to modules/gcf/src/main/java/javax/microedition/io/MulticastProtocolPermission.java.

Name change from runt/apis/gcf/javax/microedition/io/NetworkInterface.java to modules/gcf/src/main/java/javax/microedition/io/NetworkInterface.java.

12
13
14
15
16
17
18
19
20
21
22
23
24
25
26

import java.io.IOException;

public class NetworkInterface
{
	public NetworkInterface()
	{
		super();
		throw new todo.TODO();
	}
	
	public void connect(AccessPoint __a)
		throws IOException
	{
		if (false)







<







12
13
14
15
16
17
18

19
20
21
22
23
24
25

import java.io.IOException;

public class NetworkInterface
{
	public NetworkInterface()
	{

		throw new todo.TODO();
	}
	
	public void connect(AccessPoint __a)
		throws IOException
	{
		if (false)

Name change from runt/apis/gcf/javax/microedition/io/NetworkUtilities.java to modules/gcf/src/main/java/javax/microedition/io/NetworkUtilities.java.

13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import java.io.IOException;
import java.net.UnknownHostException;

public class NetworkUtilities
{
	public NetworkUtilities()
	{
		super();
		throw new todo.TODO();
	}
	
	public static String getByName(String __a)
		throws UnknownHostException
	{
		if (false)







<







13
14
15
16
17
18
19

20
21
22
23
24
25
26
import java.io.IOException;
import java.net.UnknownHostException;

public class NetworkUtilities
{
	public NetworkUtilities()
	{

		throw new todo.TODO();
	}
	
	public static String getByName(String __a)
		throws UnknownHostException
	{
		if (false)

Name change from runt/apis/gcf/javax/microedition/io/OutputConnection.java to modules/gcf/src/main/java/javax/microedition/io/OutputConnection.java.

10
11
12
13
14
15
16

17
18
19
20
21
22
23
24
25
26
27

package javax.microedition.io;

import java.io.DataOutputStream;
import java.io.IOException;
import java.io.OutputStream;


public interface OutputConnection
	extends Connection
{
	public abstract DataOutputStream openDataOutputStream()
		throws IOException;
	
	public abstract OutputStream openOutputStream()
		throws IOException;
}









>



|


|




10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28

package javax.microedition.io;

import java.io.DataOutputStream;
import java.io.IOException;
import java.io.OutputStream;

@SuppressWarnings("InterfaceWithOnlyOneDirectInheritor")
public interface OutputConnection
	extends Connection
{
	DataOutputStream openDataOutputStream()
		throws IOException;
	
	OutputStream openOutputStream()
		throws IOException;
}


Name change from runt/apis/gcf/javax/microedition/io/PushRegistry.java to modules/gcf/src/main/java/javax/microedition/io/PushRegistry.java.

12
13
14
15
16
17
18
19
20
21
22
23
24
25
26

import java.io.IOException;

public class PushRegistry
{
	public PushRegistry()
	{
		super();
		throw new todo.TODO();
	}
	
	public static String getFilter(String __a)
	{
		throw new todo.TODO();
	}







<







12
13
14
15
16
17
18

19
20
21
22
23
24
25

import java.io.IOException;

public class PushRegistry
{
	public PushRegistry()
	{

		throw new todo.TODO();
	}
	
	public static String getFilter(String __a)
	{
		throw new todo.TODO();
	}

Name change from runt/apis/gcf/javax/microedition/io/PushRegistryPermission.java to modules/gcf/src/main/java/javax/microedition/io/PushRegistryPermission.java.

Name change from runt/apis/gcf/javax/microedition/io/SSLProtocolPermission.java to modules/gcf/src/main/java/javax/microedition/io/SSLProtocolPermission.java.

Name change from runt/apis/gcf/javax/microedition/io/SecureConnection.java to modules/gcf/src/main/java/javax/microedition/io/SecureConnection.java.

11
12
13
14
15
16
17
18
19
20
21
22
package javax.microedition.io;

import java.io.IOException;

public interface SecureConnection
	extends SocketConnection
{
	public abstract SecurityInfo getSecurityInfo()
		throws IOException;
}









|




11
12
13
14
15
16
17
18
19
20
21
22
package javax.microedition.io;

import java.io.IOException;

public interface SecureConnection
	extends SocketConnection
{
	SecurityInfo getSecurityInfo()
		throws IOException;
}


Name change from runt/apis/gcf/javax/microedition/io/SecureDatagramConnection.java to modules/gcf/src/main/java/javax/microedition/io/SecureDatagramConnection.java.

11
12
13
14
15
16
17
18
19
20
21
22
package javax.microedition.io;

import java.io.IOException;

public interface SecureDatagramConnection
	extends UDPDatagramConnection
{
	public abstract SecurityInfo getSecurityInfo()
		throws IOException;
}









|




11
12
13
14
15
16
17
18
19
20
21
22
package javax.microedition.io;

import java.io.IOException;

public interface SecureDatagramConnection
	extends UDPDatagramConnection
{
	SecurityInfo getSecurityInfo()
		throws IOException;
}


Name change from runt/apis/gcf/javax/microedition/io/SecureServerConnection.java to modules/gcf/src/main/java/javax/microedition/io/SecureServerConnection.java.

Name change from runt/apis/gcf/javax/microedition/io/SecurityInfo.java to modules/gcf/src/main/java/javax/microedition/io/SecurityInfo.java.

10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28

package javax.microedition.io;

import javax.microedition.pki.Certificate;

public interface SecurityInfo
{
	public abstract String getCipherSuite();
	
	public abstract Certificate getClientCertificate();
	
	public abstract String getProtocolName();
	
	public abstract String getProtocolVersion();
	
	public abstract Certificate getServerCertificate();
}









|

|

|

|

|



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28

package javax.microedition.io;

import javax.microedition.pki.Certificate;

public interface SecurityInfo
{
	String getCipherSuite();
	
	Certificate getClientCertificate();
	
	String getProtocolName();
	
	String getProtocolVersion();
	
	Certificate getServerCertificate();
}


Name change from runt/apis/gcf/javax/microedition/io/ServerSocketConnection.java to modules/gcf/src/main/java/javax/microedition/io/ServerSocketConnection.java.

11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package javax.microedition.io;

import java.io.IOException;

public interface ServerSocketConnection
	extends StreamConnectionNotifier
{
	public abstract AccessPoint[] getAccessPoints()
		throws IOException;
	
	public abstract String getLocalAddress()
		throws IOException;
	
	public abstract int getLocalPort()
		throws IOException;
}









|


|


|




11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package javax.microedition.io;

import java.io.IOException;

public interface ServerSocketConnection
	extends StreamConnectionNotifier
{
	AccessPoint[] getAccessPoints()
		throws IOException;
	
	String getLocalAddress()
		throws IOException;
	
	int getLocalPort()
		throws IOException;
}


Name change from runt/apis/gcf/javax/microedition/io/SocketConnection.java to modules/gcf/src/main/java/javax/microedition/io/SocketConnection.java.

12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79

import java.io.IOException;

public interface SocketConnection
	extends StreamConnection
{
	/** Use the nagle algorithm? Zero disables, non-zero enables. */
	public static final byte DELAY =
		0;
	
	/** Keep connections alive? Zero disables, non-zero enables. */
	public static final byte KEEPALIVE =
		2;
	
	/**
	 * Time to wait in seconds before closing connections. Zero disables and
	 * only positive values are used.
	 */
	public static final byte LINGER =
		1;
	
	/** Receive buffer size? Zero is default, only positive is permitted. */
	public static final byte RCVBUF =
		3;
	
	/** Send buffer size? Zero is default, only positive is permitted. */
	public static final byte SNDBUF =
		4;
	
	/**
	 * Sets the timeout on blocking read/write. Zero is default, otherwise a
	 * positive value in milliseconds.
	 */
	public static final byte TIMEOUT =
		5;
	
	public abstract AccessPoint getAccessPoint()
		throws IOException;
	
	public abstract String getAddress()
		throws IOException;
	
	public abstract String getLocalAddress()
		throws IOException;
	
	public abstract int getLocalPort()
		throws IOException;
	
	public abstract int getPort()
		throws IOException;
	
	public abstract int getSocketOption(byte __o)
		throws IllegalArgumentException, IOException;
	
	/**
	 * Sets an option for the socket.
	 *
	 * @param __o The option to use.
	 * @param __v The value to use.
	 * @throws IllegalArgumentException If the option is not valid.
	 * @throws IOException If it could not be set.
	 * @since 2019/05/12
	 */
	public abstract void setSocketOption(byte __o, int __v)
		throws IllegalArgumentException, IOException;
}









|



|






|



|



|






|


|


|


|


|


|


|











|




12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79

import java.io.IOException;

public interface SocketConnection
	extends StreamConnection
{
	/** Use the nagle algorithm? Zero disables, non-zero enables. */
	byte DELAY =
		0;
	
	/** Keep connections alive? Zero disables, non-zero enables. */
	byte KEEPALIVE =
		2;
	
	/**
	 * Time to wait in seconds before closing connections. Zero disables and
	 * only positive values are used.
	 */
	byte LINGER =
		1;
	
	/** Receive buffer size? Zero is default, only positive is permitted. */
	byte RCVBUF =
		3;
	
	/** Send buffer size? Zero is default, only positive is permitted. */
	byte SNDBUF =
		4;
	
	/**
	 * Sets the timeout on blocking read/write. Zero is default, otherwise a
	 * positive value in milliseconds.
	 */
	byte TIMEOUT =
		5;
	
	AccessPoint getAccessPoint()
		throws IOException;
	
	String getAddress()
		throws IOException;
	
	String getLocalAddress()
		throws IOException;
	
	int getLocalPort()
		throws IOException;
	
	int getPort()
		throws IOException;
	
	int getSocketOption(byte __o)
		throws IllegalArgumentException, IOException;
	
	/**
	 * Sets an option for the socket.
	 *
	 * @param __o The option to use.
	 * @param __v The value to use.
	 * @throws IllegalArgumentException If the option is not valid.
	 * @throws IOException If it could not be set.
	 * @since 2019/05/12
	 */
	void setSocketOption(byte __o, int __v)
		throws IllegalArgumentException, IOException;
}


Name change from runt/apis/gcf/javax/microedition/io/SocketProtocolPermission.java to modules/gcf/src/main/java/javax/microedition/io/SocketProtocolPermission.java.

Name change from runt/apis/gcf/javax/microedition/io/StreamConnection.java to modules/gcf/src/main/java/javax/microedition/io/StreamConnection.java.

Name change from runt/apis/gcf/javax/microedition/io/StreamConnectionNotifier.java to modules/gcf/src/main/java/javax/microedition/io/StreamConnectionNotifier.java.

11
12
13
14
15
16
17
18
19
20
21
22
package javax.microedition.io;

import java.io.IOException;

public interface StreamConnectionNotifier
	extends Connection
{
	public abstract StreamConnection acceptAndOpen()
		throws IOException;
}









|




11
12
13
14
15
16
17
18
19
20
21
22
package javax.microedition.io;

import java.io.IOException;

public interface StreamConnectionNotifier
	extends Connection
{
	StreamConnection acceptAndOpen()
		throws IOException;
}


Name change from runt/apis/gcf/javax/microedition/io/UDPDatagramConnection.java to modules/gcf/src/main/java/javax/microedition/io/UDPDatagramConnection.java.

11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package javax.microedition.io;

import java.io.IOException;

public interface UDPDatagramConnection
	extends DatagramConnection
{
	public abstract String getLocalAddress()
		throws IOException;
	
	public abstract int getLocalPort()
		throws IOException;
}









|


|




11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package javax.microedition.io;

import java.io.IOException;

public interface UDPDatagramConnection
	extends DatagramConnection
{
	String getLocalAddress()
		throws IOException;
	
	int getLocalPort()
		throws IOException;
}


Name change from runt/apis/gcf/javax/microedition/io/UDPMulticastConnection.java to modules/gcf/src/main/java/javax/microedition/io/UDPMulticastConnection.java.

11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package javax.microedition.io;

import java.io.IOException;

public interface UDPMulticastConnection
	extends UDPDatagramConnection
{
	public abstract int getTimeToLive()
		throws IOException;
	
	public abstract boolean isDisableLoopback()
		throws IOException;
	
	public abstract boolean isJoinSupported();
	
	public abstract void join(String __a)
		throws IOException;
	
	public abstract void leave(String __a)
		throws IOException;
	
	public abstract void receive(Datagram __a)
		throws IOException;
	
	public abstract void send(Datagram __a)
		throws IOException;
	
	public abstract void setDisableLoopback(boolean __a)
		throws IOException;
	
	public abstract void setTimeToLive(int __a)
		throws IOException;
}









|


|


|

|


|


|


|


|


|




11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package javax.microedition.io;

import java.io.IOException;

public interface UDPMulticastConnection
	extends UDPDatagramConnection
{
	int getTimeToLive()
		throws IOException;
	
	boolean isDisableLoopback()
		throws IOException;
	
	boolean isJoinSupported();
	
	void join(String __a)
		throws IOException;
	
	void leave(String __a)
		throws IOException;
	
	void receive(Datagram __a)
		throws IOException;
	
	void send(Datagram __a)
		throws IOException;
	
	void setDisableLoopback(boolean __a)
		throws IOException;
	
	void setTimeToLive(int __a)
		throws IOException;
}


Name change from runt/apis/gcf/javax/microedition/io/file/ConnectionClosedException.java to modules/gcf/src/main/java/javax/microedition/io/file/ConnectionClosedException.java.

12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30


public class ConnectionClosedException
	extends RuntimeException
{
	public ConnectionClosedException()
	{
		super();
		throw new todo.TODO();
	}
	
	public ConnectionClosedException(String __a)
	{
		super();
		throw new todo.TODO();
	}
}









<





<





12
13
14
15
16
17
18

19
20
21
22
23

24
25
26
27
28


public class ConnectionClosedException
	extends RuntimeException
{
	public ConnectionClosedException()
	{

		throw new todo.TODO();
	}
	
	public ConnectionClosedException(String __a)
	{

		throw new todo.TODO();
	}
}


Name change from runt/apis/gcf/javax/microedition/io/file/FileConnection.java to modules/gcf/src/main/java/javax/microedition/io/file/FileConnection.java.

8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package javax.microedition.io.file;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.InputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.Enumeration;
import javax.microedition.io.StreamConnection;

public interface FileConnection
	extends StreamConnection
{
	public abstract long availableSize();
	
	public abstract boolean canRead();
	
	public abstract boolean canWrite();
	
	public abstract void create()
		throws IOException;
	
	public abstract void delete()
		throws IOException;
	
	public abstract long directorySize(boolean __a)
		throws IOException;
	
	public abstract boolean exists();
	
	public abstract long fileSize()
		throws IOException;
	
	public abstract String getName();
	
	public abstract String getPath();
	
	public abstract String getURL();
	
	public abstract boolean isDirectory();
	
	public abstract boolean isHidden();
	
	public abstract boolean isOpen();
	
	public abstract long lastModified();
	
	public abstract Enumeration list()
		throws IOException;
	
	public abstract Enumeration list(String __a, boolean __b)
		throws IOException;
	
	public abstract void mkdir()
		throws IOException;
	
	public abstract DataInputStream openDataInputStream()
		throws IOException;
	
	public abstract DataOutputStream openDataOutputStream()
		throws IOException;
	
	public abstract InputStream openInputStream()
		throws IOException;
	
	public abstract OutputStream openOutputStream()
		throws IOException;
	
	public abstract OutputStream openOutputStream(long __a)
		throws IOException;
	
	public abstract void rename(String __a)
		throws IOException;
	
	public abstract void setFileConnection(String __a)
		throws IOException;
	
	public abstract void setHidden(boolean __a)
		throws IOException;
	
	public abstract void setReadable(boolean __a)
		throws IOException;
	
	public abstract void setWritable(boolean __a)
		throws IOException;
	
	public abstract long totalSize();
	
	public abstract void truncate(long __a)
		throws IOException;
	
	public abstract long usedSize();
}









|
|







|

|

|

|


|


|


|

|


|

|

|

|

|

|

|

|


|


|


|


|


|


|


|


|


|


|


|


|


|

|


|



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package javax.microedition.io.file;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Enumeration;
import javax.microedition.io.StreamConnection;

public interface FileConnection
	extends StreamConnection
{
	long availableSize();
	
	boolean canRead();
	
	boolean canWrite();
	
	void create()
		throws IOException;
	
	void delete()
		throws IOException;
	
	long directorySize(boolean __a)
		throws IOException;
	
	boolean exists();
	
	long fileSize()
		throws IOException;
	
	String getName();
	
	String getPath();
	
	String getURL();
	
	boolean isDirectory();
	
	boolean isHidden();
	
	boolean isOpen();
	
	long lastModified();
	
	Enumeration list()
		throws IOException;
	
	Enumeration list(String __a, boolean __b)
		throws IOException;
	
	void mkdir()
		throws IOException;
	
	DataInputStream openDataInputStream()
		throws IOException;
	
	DataOutputStream openDataOutputStream()
		throws IOException;
	
	InputStream openInputStream()
		throws IOException;
	
	OutputStream openOutputStream()
		throws IOException;
	
	OutputStream openOutputStream(long __a)
		throws IOException;
	
	void rename(String __a)
		throws IOException;
	
	void setFileConnection(String __a)
		throws IOException;
	
	void setHidden(boolean __a)
		throws IOException;
	
	void setReadable(boolean __a)
		throws IOException;
	
	void setWritable(boolean __a)
		throws IOException;
	
	long totalSize();
	
	void truncate(long __a)
		throws IOException;
	
	long usedSize();
}


Name change from runt/apis/gcf/javax/microedition/io/file/FileSystemListener.java to modules/gcf/src/main/java/javax/microedition/io/file/FileSystemListener.java.

9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// ---------------------------------------------------------------------------

package javax.microedition.io.file;


public interface FileSystemListener
{
	public static final int ROOT_ADDED =
		0;
	
	public static final int ROOT_REMOVED =
		1;
	
	public abstract void rootChanged(int __a, String __b);
}









|


|


|



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// ---------------------------------------------------------------------------

package javax.microedition.io.file;


public interface FileSystemListener
{
	int ROOT_ADDED =
		0;
	
	int ROOT_REMOVED =
		1;
	
	void rootChanged(int __a, String __b);
}


Name change from runt/apis/gcf/javax/microedition/io/file/IllegalModeException.java to modules/gcf/src/main/java/javax/microedition/io/file/IllegalModeException.java.

12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30


public class IllegalModeException
	extends RuntimeException
{
	public IllegalModeException()
	{
		super();
		throw new todo.TODO();
	}
	
	public IllegalModeException(String __a)
	{
		super();
		throw new todo.TODO();
	}
}









<





<





12
13
14
15
16
17
18

19
20
21
22
23

24
25
26
27
28


public class IllegalModeException
	extends RuntimeException
{
	public IllegalModeException()
	{

		throw new todo.TODO();
	}
	
	public IllegalModeException(String __a)
	{

		throw new todo.TODO();
	}
}


Name change from runt/apis/gcf/javax/microedition/pki/Certificate.java to modules/gcf/src/main/java/javax/microedition/pki/Certificate.java.

9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// ---------------------------------------------------------------------------

package javax.microedition.pki;


public interface Certificate
{
	public abstract String getIssuer();
	
	public abstract long getNotAfter();
	
	public abstract long getNotBefore();
	
	public abstract String getSerialNumber();
	
	public abstract String getSigAlgName();
	
	public abstract String getSubject();
	
	public abstract String getType();
	
	public abstract String getVersion();
}









|

|

|

|

|

|

|

|



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// ---------------------------------------------------------------------------

package javax.microedition.pki;


public interface Certificate
{
	String getIssuer();
	
	long getNotAfter();
	
	long getNotBefore();
	
	String getSerialNumber();
	
	String getSigAlgName();
	
	String getSubject();
	
	String getType();
	
	String getVersion();
}


Name change from runt/apis/gcf/javax/microedition/pki/CertificateException.java to modules/gcf/src/main/java/javax/microedition/pki/CertificateException.java.

55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
		9;
	
	public static final byte VERIFICATION_FAILED =
		14;
	
	public CertificateException(Certificate __a, byte __b)
	{
		super();
		throw new todo.TODO();
	}
	
	public CertificateException(String __a, Certificate __b, byte __c)
	{
		super();
		throw new todo.TODO();
	}
	
	public Certificate getCertificate()
	{
		throw new todo.TODO();
	}







<





<







55
56
57
58
59
60
61

62
63
64
65
66

67
68
69
70
71
72
73
		9;
	
	public static final byte VERIFICATION_FAILED =
		14;
	
	public CertificateException(Certificate __a, byte __b)
	{

		throw new todo.TODO();
	}
	
	public CertificateException(String __a, Certificate __b, byte __c)
	{

		throw new todo.TODO();
	}
	
	public Certificate getCertificate()
	{
		throw new todo.TODO();
	}

Added modules/io/build.gradle.





































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import cc.squirreljme.plugin.swm.JavaMEMidletType

description = "This provides slightly more powerful data " +
	"input and output streams which can be used to read and write data."
version = rootProject.version

squirreljme
{
	javaDocErrorCode = "BD"
	swmType = JavaMEMidletType.LIBRARY
	swmName = "Generic Input/Output"
	swmVendor = "Stephanie Gawroriski"
}

dependencies
{
	implementation project(":modules:cldc-compact")
}

Name change from runt/libs/io/net/multiphasicapps/io/Adler32Calculator.java to modules/io/src/main/java/net/multiphasicapps/io/Adler32Calculator.java.

50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
	 * @since 2017/03/05
	 */
	@Override
	public final void offer(byte __b)
	{
		byte[] solo = this._solo;
		solo[0] = __b;
		offer(solo, 0, 1);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/03/05
	 */
	@Override
	public final void offer(byte[] __b)
		throws NullPointerException
	{
		offer(__b, 0, __b.length);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/03/05
	 */
	@Override







|










|







50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
	 * @since 2017/03/05
	 */
	@Override
	public final void offer(byte __b)
	{
		byte[] solo = this._solo;
		solo[0] = __b;
		this.offer(solo, 0, 1);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/03/05
	 */
	@Override
	public final void offer(byte[] __b)
		throws NullPointerException
	{
		this.offer(__b, 0, __b.length);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/03/05
	 */
	@Override
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
		// Get parameters
		int a = this._a,
			b = this._b;
		
		// Calculate
		for (int p = __o, e = __o + __l; p < e; p++)
		{
			a = (a + (__b[p] & 0xFF)) % _ADLER_MODULO;
			b = (b + a) % _ADLER_MODULO;
		}
		
		// Set parameters
		this._a = a;
		this._b = b;
	}
	







|
|







85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
		// Get parameters
		int a = this._a,
			b = this._b;
		
		// Calculate
		for (int p = __o, e = __o + __l; p < e; p++)
		{
			a = (a + (__b[p] & 0xFF)) % Adler32Calculator._ADLER_MODULO;
			b = (b + a) % Adler32Calculator._ADLER_MODULO;
		}
		
		// Set parameters
		this._a = a;
		this._b = b;
	}
	

Name change from runt/libs/io/net/multiphasicapps/io/Base64Alphabet.java to modules/io/src/main/java/net/multiphasicapps/io/Base64Alphabet.java.

40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
	/**
	 * Initializes the alphabet.
	 *
	 * @param __alphabet The alphabet.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/03/05
	 */
	private Base64Alphabet(char... __alphabet)
		throws NullPointerException
	{
		if (__alphabet == null)
			throw new NullPointerException("NARG");
		
		this._alphabet = __alphabet;
	}







|







40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
	/**
	 * Initializes the alphabet.
	 *
	 * @param __alphabet The alphabet.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/03/05
	 */
	Base64Alphabet(char... __alphabet)
		throws NullPointerException
	{
		if (__alphabet == null)
			throw new NullPointerException("NARG");
		
		this._alphabet = __alphabet;
	}

Name change from runt/libs/io/net/multiphasicapps/io/Base64Decoder.java to modules/io/src/main/java/net/multiphasicapps/io/Base64Decoder.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.io;

import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.io.IOException;
import java.io.Reader;
import java.util.Arrays;

/**
 * This decodes the base64 character set, ignoring invalid characters, and
 * provides the binary data for the input. If the padding character is reached
 * or if the input stream runs out of characters then EOF is triggered.
 *
 * @since 2018/03/05













|
|

<







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16

17
18
19
20
21
22
23
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.io;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.Reader;


/**
 * This decodes the base64 character set, ignoring invalid characters, and
 * provides the binary data for the input. If the padding character is reached
 * or if the input stream runs out of characters then EOF is triggered.
 *
 * @since 2018/03/05

Name change from runt/libs/io/net/multiphasicapps/io/BitSource.java to modules/io/src/main/java/net/multiphasicapps/io/BitSource.java.

22
23
24
25
26
27
28
29
30
31
32
	/**
	 * Returns the next bit.
	 *
	 * @return The next bit.
	 * @throws IOException On read errors.
	 * @since 2016/08/16
	 */
	public abstract boolean nextBit()
		throws IOException;
}








|



22
23
24
25
26
27
28
29
30
31
32
	/**
	 * Returns the next bit.
	 *
	 * @return The next bit.
	 * @throws IOException On read errors.
	 * @since 2016/08/16
	 */
	boolean nextBit()
		throws IOException;
}

Name change from runt/libs/io/net/multiphasicapps/io/ByteArrayData.java to modules/io/src/main/java/net/multiphasicapps/io/ByteArrayData.java.

Name change from runt/libs/io/net/multiphasicapps/io/ByteDeque.java to modules/io/src/main/java/net/multiphasicapps/io/ByteDeque.java.

11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package net.multiphasicapps.io;

import java.io.IOException;
import java.io.OutputStream;
import java.util.Arrays;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.ListIterator;
import java.util.NoSuchElementException;

/**
 * This is a byte buffer which provides bytes for input and output as a
 * double ended queue.
 *







<







11
12
13
14
15
16
17

18
19
20
21
22
23
24
package net.multiphasicapps.io;

import java.io.IOException;
import java.io.OutputStream;
import java.util.Arrays;
import java.util.Iterator;
import java.util.LinkedList;

import java.util.ListIterator;
import java.util.NoSuchElementException;

/**
 * This is a byte buffer which provides bytes for input and output as a
 * double ended queue.
 *
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
	 * class. The value must be a power of two.}
	 */
	private static final int _BLOCK_SIZE =
		Math.max(8, Integer.getInteger(
			"net.multiphasicapps.util.datadeque.blocksize", 128));
	
	/** The block size mask. */
	private static final int _BLOCK_MASK =
		_BLOCK_SIZE - 1;
	
	/** The shift to convert block based values. */
	private static final int _BLOCK_SHIFT =
		Integer.numberOfTrailingZeros(_BLOCK_SIZE);
	
	/** The maximum permitted capacity. */
	protected final int capacity;
	
	/** Blocks which make up the queue. */
	private final LinkedList<byte[]> _blocks =
		new LinkedList<>();







|
<



|







36
37
38
39
40
41
42
43

44
45
46
47
48
49
50
51
52
53
54
	 * class. The value must be a power of two.}
	 */
	private static final int _BLOCK_SIZE =
		Math.max(8, Integer.getInteger(
			"net.multiphasicapps.util.datadeque.blocksize", 128));
	
	/** The block size mask. */
	private static final int _BLOCK_MASK = ByteDeque._BLOCK_SIZE - 1;

	
	/** The shift to convert block based values. */
	private static final int _BLOCK_SHIFT =
		Integer.numberOfTrailingZeros(ByteDeque._BLOCK_SIZE);
	
	/** The maximum permitted capacity. */
	protected final int capacity;
	
	/** Blocks which make up the queue. */
	private final LinkedList<byte[]> _blocks =
		new LinkedList<>();
73
74
75
76
77
78
79
80
81

82
83
84
85
86
87
88
	 *
	 * @since 2016/05/01
	 */
	static
	{
		// {@squirreljme.error BD21 The block size of the data deque is not
		// a power of two. (The specified block size)}
		if (Integer.bitCount(_BLOCK_SIZE) != 1)
			throw new RuntimeException(String.format("BD21 %d", _BLOCK_SIZE));

	}
	
	/**
	 * Initializes a byte deque with a 2GiB buffer size limit.
	 *
	 * @since 2016/03/11
	 */







|
|
>







71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
	 *
	 * @since 2016/05/01
	 */
	static
	{
		// {@squirreljme.error BD21 The block size of the data deque is not
		// a power of two. (The specified block size)}
		if (Integer.bitCount(ByteDeque._BLOCK_SIZE) != 1)
			throw new RuntimeException(String.format("BD21 %d",
				ByteDeque._BLOCK_SIZE));
	}
	
	/**
	 * Initializes a byte deque with a 2GiB buffer size limit.
	 *
	 * @since 2016/03/11
	 */
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
		throws IllegalArgumentException
	{
		// {@squirreljme.error BD22 Negative deque capacity specified.}
		if (__cap < 0)
			throw new IllegalArgumentException("BD22");
		
		// Set
		capacity = __cap;
	}
	
	/**
	 * Attempts to add a single byte to the start of the queue, if the capacity
	 * would be violated then an exception is thrown.
	 *
	 * @param __b The byte to add.
	 * @throws IllegalStateException If the capacity is violated.
	 * @since 2016/05/01
	 */
	public final void addFirst(byte __b)
		throws IllegalStateException
	{
		byte[] solo = _solo;
		solo[0] = __b;
		addFirst(solo, 0, 1);
	}
	
	/**
	 * Attempts to add multiple bytes to the start of the queue, if the
	 * capacity would be violated then an exception is thrown.
	 *
	 * @param __b The array to source bytes from.
	 * @throws IllegalStateException If the capacity is violated.
	 * @throws NullPointerException On null arguments.
	 * @since 2016/05/01
	 */
	public final void addFirst(byte[] __b)
		throws IllegalStateException, NullPointerException
	{
		addFirst(__b, 0, __b.length);
	}
	
	/**
	 * Attempts to add multiple bytes to the start of the queue, if the
	 * capacity would be violated then an exception is thrown.
	 *
	 * @param __b The array to source bytes from.







|













|

|














|







101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
		throws IllegalArgumentException
	{
		// {@squirreljme.error BD22 Negative deque capacity specified.}
		if (__cap < 0)
			throw new IllegalArgumentException("BD22");
		
		// Set
		this.capacity = __cap;
	}
	
	/**
	 * Attempts to add a single byte to the start of the queue, if the capacity
	 * would be violated then an exception is thrown.
	 *
	 * @param __b The byte to add.
	 * @throws IllegalStateException If the capacity is violated.
	 * @since 2016/05/01
	 */
	public final void addFirst(byte __b)
		throws IllegalStateException
	{
		byte[] solo = this._solo;
		solo[0] = __b;
		this.addFirst(solo, 0, 1);
	}
	
	/**
	 * Attempts to add multiple bytes to the start of the queue, if the
	 * capacity would be violated then an exception is thrown.
	 *
	 * @param __b The array to source bytes from.
	 * @throws IllegalStateException If the capacity is violated.
	 * @throws NullPointerException On null arguments.
	 * @since 2016/05/01
	 */
	public final void addFirst(byte[] __b)
		throws IllegalStateException, NullPointerException
	{
		this.addFirst(__b, 0, __b.length);
	}
	
	/**
	 * Attempts to add multiple bytes to the start of the queue, if the
	 * capacity would be violated then an exception is thrown.
	 *
	 * @param __b The array to source bytes from.
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
	 * @param __b The byte to add.
	 * @throws IllegalStateException If the capacity is violated.
	 * @since 2016/05/01
	 */
	public final void addLast(byte __b)
		throws IllegalStateException
	{
		byte[] solo = _solo;
		solo[0] = __b;
		addLast(solo, 0, 1);
	}
	
	/**
	 * Attempts to add multiple bytes to the end of the queue, if the capacity
	 * would be violated then an exception is thrown.
	 *
	 * @param __b The array to source bytes from.
	 * @throws IllegalStateException If the capacity is violated.
	 * @throws NullPointerException On null arguments.
	 * @since 2016/05/01
	 */
	public final void addLast(byte[] __b)
		throws IllegalStateException, NullPointerException
	{
		addLast(__b, 0, __b.length);
	}
	
	/**
	 * Attempts to add multiple bytes to the end of the queue, if the capacity
	 * would be violated then an exception is thrown.
	 *
	 * @param __b The array to source bytes from.







|

|














|







188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
	 * @param __b The byte to add.
	 * @throws IllegalStateException If the capacity is violated.
	 * @since 2016/05/01
	 */
	public final void addLast(byte __b)
		throws IllegalStateException
	{
		byte[] solo = this._solo;
		solo[0] = __b;
		this.addLast(solo, 0, 1);
	}
	
	/**
	 * Attempts to add multiple bytes to the end of the queue, if the capacity
	 * would be violated then an exception is thrown.
	 *
	 * @param __b The array to source bytes from.
	 * @throws IllegalStateException If the capacity is violated.
	 * @throws NullPointerException On null arguments.
	 * @since 2016/05/01
	 */
	public final void addLast(byte[] __b)
		throws IllegalStateException, NullPointerException
	{
		this.addLast(__b, 0, __b.length);
	}
	
	/**
	 * Attempts to add multiple bytes to the end of the queue, if the capacity
	 * would be violated then an exception is thrown.
	 *
	 * @param __b The array to source bytes from.
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
		
		// Get some things
		LinkedList<byte[]> blocks = this._blocks;
		int nb = blocks.size();
		int head = this._head, tail = this._tail;
		
		// Keep adding in data
		int bs = _BLOCK_SIZE;
		int bm = _BLOCK_MASK;
		int left = __l;
		int at = __o;
		while (left > 0)
		{
			// If the tail is at the start of the block then a new one
			// must be created
			byte[] bl;







|
|







248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
		
		// Get some things
		LinkedList<byte[]> blocks = this._blocks;
		int nb = blocks.size();
		int head = this._head, tail = this._tail;
		
		// Keep adding in data
		int bs = ByteDeque._BLOCK_SIZE;
		int bm = ByteDeque._BLOCK_MASK;
		int left = __l;
		int at = __o;
		while (left > 0)
		{
			// If the tail is at the start of the block then a new one
			// must be created
			byte[] bl;
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
		// Get some things
		LinkedList<byte[]> blocks = this._blocks;
		int nb = blocks.size();
		int head = this._head, tail = this._tail;
		
		// Write bytes into the target
		int left = limit;
		int bs = _BLOCK_SIZE;
		int bm = _BLOCK_MASK;
		while (left > 0)
		{
			// Get the first block
			byte[] bl = blocks.getFirst();
			boolean lastbl = (nb == 1);
			
			// Determine the max number of bytes to delete







|
|







354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
		// Get some things
		LinkedList<byte[]> blocks = this._blocks;
		int nb = blocks.size();
		int head = this._head, tail = this._tail;
		
		// Write bytes into the target
		int left = limit;
		int bs = ByteDeque._BLOCK_SIZE;
		int bm = ByteDeque._BLOCK_MASK;
		while (left > 0)
		{
			// Get the first block
			byte[] bl = blocks.getFirst();
			boolean lastbl = (nb == 1);
			
			// Determine the max number of bytes to delete
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
		throws IndexOutOfBoundsException
	{
		// {@squirreljme.error BD26 Request get at a negative index.}
		if (__a < 0)
			throw new IndexOutOfBoundsException("BD26");
		
		byte[] solo = this._solo;
		int rv = get(__a, solo, 0, 1);
		if (rv == 1)
			return solo[0];
		
		// {@squirreljme.error BD27 Could not get the byte at the
		// given position because it exceeds the deque bounds. (The index)}
		throw new IndexOutOfBoundsException(String.format("BD27 %d", __a));
	}







|







420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
		throws IndexOutOfBoundsException
	{
		// {@squirreljme.error BD26 Request get at a negative index.}
		if (__a < 0)
			throw new IndexOutOfBoundsException("BD26");
		
		byte[] solo = this._solo;
		int rv = this.get(__a, solo, 0, 1);
		if (rv == 1)
			return solo[0];
		
		// {@squirreljme.error BD27 Could not get the byte at the
		// given position because it exceeds the deque bounds. (The index)}
		throw new IndexOutOfBoundsException(String.format("BD27 %d", __a));
	}
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
		
		// If there are no bytes, all reads do nothing
		if (total <= 0)
			return 0;
		
		// If the address is within the starting half then seek from the
		// start, otherwise start from the trailing end
		return __getOrSetVia((__a < (total >> 1)), __a, __b, __o, __l, false);
	}
	
	/**
	 * Obtains but does not remove the first byte.
	 *
	 * @return The value of the first byte.
	 * @throws NoSuchElementException If the deque is empty.
	 * @since 2016/05/01
	 */
	public final byte getFirst()
		throws NoSuchElementException
	{
		byte[] solo = this._solo;
		int rv = getFirst(solo, 0, 1);
		if (rv == 1)
			return solo[0];
		
		// {@squirreljme.error BD2a Could not get the first byte
		// because the deque is empty.}
		throw new NoSuchElementException("BD2a");
	}
	
	/**
	 * Obtains but does not remove the first set of bytes.
	 *
	 * @param __b The destination array to obtain the first bytes for.
	 * @return The number of read bytes.
	 * @throws NullPointerException On null arguments.
	 * @since 2016/05/01
	 */
	public final int getFirst(byte[] __b)
		throws NullPointerException
	{
		return getFirst(__b, 0, __b.length);
	}
	
	/**
	 * Obtains but does not remove the first set of bytes.
	 *
	 * @param __b The destination array to obtain the first bytes for.
	 * @param __o The offset in the destination array to start reading bytes







|













|



















|







489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
		
		// If there are no bytes, all reads do nothing
		if (total <= 0)
			return 0;
		
		// If the address is within the starting half then seek from the
		// start, otherwise start from the trailing end
		return this.__getOrSetVia((__a < (total >> 1)), __a, __b, __o, __l, false);
	}
	
	/**
	 * Obtains but does not remove the first byte.
	 *
	 * @return The value of the first byte.
	 * @throws NoSuchElementException If the deque is empty.
	 * @since 2016/05/01
	 */
	public final byte getFirst()
		throws NoSuchElementException
	{
		byte[] solo = this._solo;
		int rv = this.getFirst(solo, 0, 1);
		if (rv == 1)
			return solo[0];
		
		// {@squirreljme.error BD2a Could not get the first byte
		// because the deque is empty.}
		throw new NoSuchElementException("BD2a");
	}
	
	/**
	 * Obtains but does not remove the first set of bytes.
	 *
	 * @param __b The destination array to obtain the first bytes for.
	 * @return The number of read bytes.
	 * @throws NullPointerException On null arguments.
	 * @since 2016/05/01
	 */
	public final int getFirst(byte[] __b)
		throws NullPointerException
	{
		return this.getFirst(__b, 0, __b.length);
	}
	
	/**
	 * Obtains but does not remove the first set of bytes.
	 *
	 * @param __b The destination array to obtain the first bytes for.
	 * @param __o The offset in the destination array to start reading bytes
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
	 * @throws NoSuchElementException If the deque is empty.
	 * @since 2016/05/01
	 */
	public final byte getLast()
		throws NoSuchElementException
	{
		byte[] solo = this._solo;
		int rv = getLast(solo, 0, 1);
		if (rv == 0)
			return solo[0];
		
		// {@squirreljme.error BD2b Could not remove the last byte because
		// the deque is empty.}
		throw new NoSuchElementException("BD2b");
	}
	
	/**
	 * Obtains but does not remove the last set of bytes.
	 *
	 * @param __b The destination array to obtain the last bytes for.
	 * @return The number of read bytes.
	 * @throws NullPointerException On null arguments.
	 * @since 2016/05/01
	 */
	public final int getLast(byte[] __b)
		throws NullPointerException
	{
		return getLast(__b, 0, __b.length);
	}
	
	/**
	 * Obtains but does not remove the last set of bytes.
	 *
	 * @param __b The destination array to obtain the last bytes for.
	 * @param __o The offset in the destination array to start reading bytes







|



















|







557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
	 * @throws NoSuchElementException If the deque is empty.
	 * @since 2016/05/01
	 */
	public final byte getLast()
		throws NoSuchElementException
	{
		byte[] solo = this._solo;
		int rv = this.getLast(solo, 0, 1);
		if (rv == 0)
			return solo[0];
		
		// {@squirreljme.error BD2b Could not remove the last byte because
		// the deque is empty.}
		throw new NoSuchElementException("BD2b");
	}
	
	/**
	 * Obtains but does not remove the last set of bytes.
	 *
	 * @param __b The destination array to obtain the last bytes for.
	 * @return The number of read bytes.
	 * @throws NullPointerException On null arguments.
	 * @since 2016/05/01
	 */
	public final int getLast(byte[] __b)
		throws NullPointerException
	{
		return this.getLast(__b, 0, __b.length);
	}
	
	/**
	 * Obtains but does not remove the last set of bytes.
	 *
	 * @param __b The destination array to obtain the last bytes for.
	 * @param __o The offset in the destination array to start reading bytes
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
	 * Returns whether or not this deque is empty.
	 *
	 * @return Whether it is empty or not.
	 * @since 2017/08/22
	 */
	public final boolean isEmpty()
	{
		return available() == 0;
	}
	
	/**
	 * Offers a single byte to the start of the deque and returns {@code true}
	 * if it was added to the deque.
	 *
	 * @param __b The byte to add to the start.
	 * @return {@code true} if the capacity was not violated and the bytes were
	 * added.
	 * @since 2016/05/01
	 */
	public final boolean offerFirst(byte __b)
	{
		// May violate the capacity
		try
		{
			addFirst(__b);
			return true;
		}
		
		// Violates capacity
		catch (IllegalStateException ise)
		{
			return false;







|
















|







613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
	 * Returns whether or not this deque is empty.
	 *
	 * @return Whether it is empty or not.
	 * @since 2017/08/22
	 */
	public final boolean isEmpty()
	{
		return this.available() == 0;
	}
	
	/**
	 * Offers a single byte to the start of the deque and returns {@code true}
	 * if it was added to the deque.
	 *
	 * @param __b The byte to add to the start.
	 * @return {@code true} if the capacity was not violated and the bytes were
	 * added.
	 * @since 2016/05/01
	 */
	public final boolean offerFirst(byte __b)
	{
		// May violate the capacity
		try
		{
			this.addFirst(__b);
			return true;
		}
		
		// Violates capacity
		catch (IllegalStateException ise)
		{
			return false;
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
	 * added.
	 * @throws NullPointerException On null arguments.
	 * @since 2016/05/01
	 */
	public final boolean offerFirst(byte[] __b)
		throws NullPointerException
	{
		return offerFirst(__b, 0, __b.length);
	}
	
	/**
	 * Offers multiple bytes to the start of the deque and returns {@code true}
	 * if they were added to the deque.
	 *
	 * @param __b The array to source bytes from.







|







654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
	 * added.
	 * @throws NullPointerException On null arguments.
	 * @since 2016/05/01
	 */
	public final boolean offerFirst(byte[] __b)
		throws NullPointerException
	{
		return this.offerFirst(__b, 0, __b.length);
	}
	
	/**
	 * Offers multiple bytes to the start of the deque and returns {@code true}
	 * if they were added to the deque.
	 *
	 * @param __b The array to source bytes from.
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
	 */
	public final boolean offerFirst(byte[] __b, int __o, int __l)
		throws IndexOutOfBoundsException
	{
		// May violate the capacity
		try
		{
			addFirst(__b, __o, __l);
			return true;
		}
		
		// Violates capacity
		catch (IllegalStateException ise)
		{
			return false;







|







676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
	 */
	public final boolean offerFirst(byte[] __b, int __o, int __l)
		throws IndexOutOfBoundsException
	{
		// May violate the capacity
		try
		{
			this.addFirst(__b, __o, __l);
			return true;
		}
		
		// Violates capacity
		catch (IllegalStateException ise)
		{
			return false;
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
	 * @since 2016/05/01
	 */
	public final boolean offerLast(byte __b)
	{
		// May violate the capacity
		try
		{
			addLast(__b);
			return true;
		}
		
		// Violates capacity
		catch (IllegalStateException ise)
		{
			return false;







|







701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
	 * @since 2016/05/01
	 */
	public final boolean offerLast(byte __b)
	{
		// May violate the capacity
		try
		{
			this.addLast(__b);
			return true;
		}
		
		// Violates capacity
		catch (IllegalStateException ise)
		{
			return false;
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
	 * added.
	 * @throws NullPointerException On null arguments.
	 * @since 2016/05/01
	 */
	public final boolean offerLast(byte[] __b)
		throws NullPointerException
	{
		return offerLast(__b, 0, __b.length);
	}
	
	/**
	 * Offers multiple bytes to the end of the deque and returns {@code true}
	 * if they were added to the deque.
	 *
	 * @param __b The array to source bytes from.







|







725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
	 * added.
	 * @throws NullPointerException On null arguments.
	 * @since 2016/05/01
	 */
	public final boolean offerLast(byte[] __b)
		throws NullPointerException
	{
		return this.offerLast(__b, 0, __b.length);
	}
	
	/**
	 * Offers multiple bytes to the end of the deque and returns {@code true}
	 * if they were added to the deque.
	 *
	 * @param __b The array to source bytes from.
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
	 */
	public final boolean offerLast(byte[] __b, int __o, int __l)
		throws IndexOutOfBoundsException
	{
		// May violate the capacity
		try
		{
			addLast(__b, __o, __l);
			return true;
		}
		
		// Violates capacity
		catch (IllegalStateException ise)
		{
			return false;







|







747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
	 */
	public final boolean offerLast(byte[] __b, int __o, int __l)
		throws IndexOutOfBoundsException
	{
		// May violate the capacity
		try
		{
			this.addLast(__b, __o, __l);
			return true;
		}
		
		// Violates capacity
		catch (IllegalStateException ise)
		{
			return false;
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
	 */
	public final int peekFirst()
		throws NoSuchElementException
	{
		// The deque could be empty
		try
		{
			return ((int)getFirst()) & 0xFF;
		}
		
		// Does not exist.
		catch (NoSuchElementException e)
		{
			return -1;
		}







|







772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
	 */
	public final int peekFirst()
		throws NoSuchElementException
	{
		// The deque could be empty
		try
		{
			return ((int)this.getFirst()) & 0xFF;
		}
		
		// Does not exist.
		catch (NoSuchElementException e)
		{
			return -1;
		}
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
	 */
	public final int peekLast()
		throws NoSuchElementException
	{
		// The deque could be empty
		try
		{
			return ((int)getLast()) & 0xFF;
		}
		
		// Does not exist.
		catch (NoSuchElementException e)
		{
			return -1;
		}
	}
	
	/**
	 * Removes a single byte from the from of the deque.
	 *
	 * @return The next input byte.
	 * @throws NoSuchElementException If not a single byte is available.
	 * @since 2016/05/01
	 */
	public final byte removeFirst()
		throws NoSuchElementException
	{
		byte[] solo = this._solo;
		int rv = removeFirst(solo, 0, 1);
		if (rv == 1)
			return solo[0];
		
		// {@squirreljme.error BD2c Could not remove the first byte
		// because the deque is empty.}
		throw new NoSuchElementException("BD2c");
	}
	
	/**
	 * Removes multiple bytes from the front of the deque.
	 *
	 * @param __b The array to read bytes into.
	 * @return The number of removed bytes, may be {@code 0}.
	 * @throws NullPointerException On null arguments.
	 * @since 2016/05/01
	 */
	public final int removeFirst(byte[] __b)
		throws NullPointerException
	{
		return removeFirst(__b, 0, __b.length);
	}
	
	/**
	 * Removes multiple bytes from the front of the deque.
	 *
	 * @param __b The array to read bytes into.
	 * @param __o The offset to start writing into.







|




















|



















|







796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
	 */
	public final int peekLast()
		throws NoSuchElementException
	{
		// The deque could be empty
		try
		{
			return ((int)this.getLast()) & 0xFF;
		}
		
		// Does not exist.
		catch (NoSuchElementException e)
		{
			return -1;
		}
	}
	
	/**
	 * Removes a single byte from the from of the deque.
	 *
	 * @return The next input byte.
	 * @throws NoSuchElementException If not a single byte is available.
	 * @since 2016/05/01
	 */
	public final byte removeFirst()
		throws NoSuchElementException
	{
		byte[] solo = this._solo;
		int rv = this.removeFirst(solo, 0, 1);
		if (rv == 1)
			return solo[0];
		
		// {@squirreljme.error BD2c Could not remove the first byte
		// because the deque is empty.}
		throw new NoSuchElementException("BD2c");
	}
	
	/**
	 * Removes multiple bytes from the front of the deque.
	 *
	 * @param __b The array to read bytes into.
	 * @return The number of removed bytes, may be {@code 0}.
	 * @throws NullPointerException On null arguments.
	 * @since 2016/05/01
	 */
	public final int removeFirst(byte[] __b)
		throws NullPointerException
	{
		return this.removeFirst(__b, 0, __b.length);
	}
	
	/**
	 * Removes multiple bytes from the front of the deque.
	 *
	 * @param __b The array to read bytes into.
	 * @param __o The offset to start writing into.
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
		
		// If the queue is empty do nothing
		int total = this._total;
		if (total == 0)
			return 0;
		
		// A remove is a get followed by a delete
		int rva = get(0, __b, __o, __l);
		int rvb = deleteFirst(__l);
		
		// If this occurs then the number of bytes deleted was not the
		// same as the number of bytes which were read.
		if (rva != rvb)
			throw new todo.OOPS();
		
		// Return the read count
		return rva;
	}
	
	/**
	 * Removes a single byte from the from of the deque.
	 *
	 * @return The next input byte.
	 * @throws NoSuchElementException If not a single byte is available.
	 * @since 2016/05/01
	 */
	public final byte removeLast()
		throws NoSuchElementException
	{
		byte[] solo = _solo;
		int rv = removeLast(solo, 0, 1);
		if (rv == 1)
			return solo[0];
		
		// {@squirreljme.error BD2d Could not remove the last byte because
		// the deque is empty.}
		throw new NoSuchElementException("BD2d");
	}
	
	/**
	 * Removes multiple bytes from the end of the deque.
	 *
	 * @param __b The array to read bytes into.
	 * @return The number of removed bytes, may be {@code 0}.
	 * @throws NullPointerException On null arguments.
	 * @since 2016/05/01
	 */
	public final int removeLast(byte[] __b)
		throws NullPointerException
	{
		return removeLast(__b, 0, __b.length);
	}
	
	/**
	 * Removes multiple bytes from the end of the deque.
	 *
	 * @param __b The array to read bytes into.
	 * @param __o The offset to start writing into.







|
|




















|
|



















|







871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
		
		// If the queue is empty do nothing
		int total = this._total;
		if (total == 0)
			return 0;
		
		// A remove is a get followed by a delete
		int rva = this.get(0, __b, __o, __l);
		int rvb = this.deleteFirst(__l);
		
		// If this occurs then the number of bytes deleted was not the
		// same as the number of bytes which were read.
		if (rva != rvb)
			throw new todo.OOPS();
		
		// Return the read count
		return rva;
	}
	
	/**
	 * Removes a single byte from the from of the deque.
	 *
	 * @return The next input byte.
	 * @throws NoSuchElementException If not a single byte is available.
	 * @since 2016/05/01
	 */
	public final byte removeLast()
		throws NoSuchElementException
	{
		byte[] solo = this._solo;
		int rv = this.removeLast(solo, 0, 1);
		if (rv == 1)
			return solo[0];
		
		// {@squirreljme.error BD2d Could not remove the last byte because
		// the deque is empty.}
		throw new NoSuchElementException("BD2d");
	}
	
	/**
	 * Removes multiple bytes from the end of the deque.
	 *
	 * @param __b The array to read bytes into.
	 * @return The number of removed bytes, may be {@code 0}.
	 * @throws NullPointerException On null arguments.
	 * @since 2016/05/01
	 */
	public final int removeLast(byte[] __b)
		throws NullPointerException
	{
		return this.removeLast(__b, 0, __b.length);
	}
	
	/**
	 * Removes multiple bytes from the end of the deque.
	 *
	 * @param __b The array to read bytes into.
	 * @param __o The offset to start writing into.
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
		throws IndexOutOfBoundsException
	{
		// {@squirreljme.error BD2e Request set at a negative index.}
		if (__a < 0)
			throw new IndexOutOfBoundsException("BD2e");
		
		byte[] solo = this._solo;
		int rv = set(__a, solo, 0, 1);
		if (rv == 1)
			return solo[0];
		
		// {@squirreljme.error BD2f Could not set the byte at the
		// given position because it exceeds the deque bounds. (The index)}
		throw new IndexOutOfBoundsException(String.format("BD2f %d", __a));
	}







|







958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
		throws IndexOutOfBoundsException
	{
		// {@squirreljme.error BD2e Request set at a negative index.}
		if (__a < 0)
			throw new IndexOutOfBoundsException("BD2e");
		
		byte[] solo = this._solo;
		int rv = this.set(__a, solo, 0, 1);
		if (rv == 1)
			return solo[0];
		
		// {@squirreljme.error BD2f Could not set the byte at the
		// given position because it exceeds the deque bounds. (The index)}
		throw new IndexOutOfBoundsException(String.format("BD2f %d", __a));
	}
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
		
		// If there are no bytes, all writes do nothing
		if (total <= 0)
			return 0;
		
		// If the address is within the starting half then seek to the
		// start, otherwise start to the trailing end
		return __getOrSetVia((__a < (total >> 1)), __a, __b, __o, __l, true);
	}
	
	/**
	 * Returns the number of bytes which are in this deque.
	 *
	 * @return The total number of bytes in this deque.
	 * @since 2017/08/14







|







1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
		
		// If there are no bytes, all writes do nothing
		if (total <= 0)
			return 0;
		
		// If the address is within the starting half then seek to the
		// start, otherwise start to the trailing end
		return this.__getOrSetVia((__a < (total >> 1)), __a, __b, __o, __l, true);
	}
	
	/**
	 * Returns the number of bytes which are in this deque.
	 *
	 * @return The total number of bytes in this deque.
	 * @since 2017/08/14
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
	 * Returns all of the data in this deque as a single byte array.
	 *
	 * @return The data contained within this deque.
	 * @since 2017/02/04
	 */
	public final byte[] toByteArray()
	{
		int sz = available();
		byte[] rv = new byte[sz];
		get(0, rv, 0, sz);
		return rv;
	}
	
	/**
	 * Writes the entire deque into the specified output stream.
	 *
	 * @param __os The stream to write to.







|

|







1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
	 * Returns all of the data in this deque as a single byte array.
	 *
	 * @return The data contained within this deque.
	 * @since 2017/02/04
	 */
	public final byte[] toByteArray()
	{
		int sz = this.available();
		byte[] rv = new byte[sz];
		this.get(0, rv, 0, sz);
		return rv;
	}
	
	/**
	 * Writes the entire deque into the specified output stream.
	 *
	 * @param __os The stream to write to.
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
		int __o, int __l, boolean __set)
	{
		// Get some things
		int total = this._total;
		LinkedList<byte[]> blocks = this._blocks;
		int nb = blocks.size();
		int head = this._head, tail = this._tail;
		int bs = _BLOCK_SIZE;
		int bm = _BLOCK_MASK;
		
		// The number of bytes to read
		int limit = total - __a;
		if (__l < limit)
			limit = __l;
		
		// Skip through the starting set of blocks since they are not
		// needed at all
		Iterator<byte[]> it;
		int blskip = (head + __a) >> _BLOCK_SHIFT;
		if (__last && nb > 1)
		{
			// Start from the back and then go to the index where we are
			// supposed to be at
			ListIterator<byte[]> lit = blocks.listIterator(nb);
			it = lit;
			int backskip = nb - blskip;







|
|









|







1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
		int __o, int __l, boolean __set)
	{
		// Get some things
		int total = this._total;
		LinkedList<byte[]> blocks = this._blocks;
		int nb = blocks.size();
		int head = this._head, tail = this._tail;
		int bs = ByteDeque._BLOCK_SIZE;
		int bm = ByteDeque._BLOCK_MASK;
		
		// The number of bytes to read
		int limit = total - __a;
		if (__l < limit)
			limit = __l;
		
		// Skip through the starting set of blocks since they are not
		// needed at all
		Iterator<byte[]> it;
		int blskip = (head + __a) >> ByteDeque._BLOCK_SHIFT;
		if (__last && nb > 1)
		{
			// Start from the back and then go to the index where we are
			// supposed to be at
			ListIterator<byte[]> lit = blocks.listIterator(nb);
			it = lit;
			int backskip = nb - blskip;

Name change from runt/libs/io/net/multiphasicapps/io/CRC32Calculator.java to modules/io/src/main/java/net/multiphasicapps/io/CRC32Calculator.java.

44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
	
	/** Solo buffer. */
	private final byte[] _solo =
		new byte[1];
	
	/** The work buffer. */
	private final byte[] _work =
		new byte[_WORK_BUFFER];
	
	/** The current CRC value (remainder). */
	private volatile int _remainder;
	
	/**
	 * Initializes the CRC-32 data sink.
	 *







|







44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
	
	/** Solo buffer. */
	private final byte[] _solo =
		new byte[1];
	
	/** The work buffer. */
	private final byte[] _work =
		new byte[CRC32Calculator._WORK_BUFFER];
	
	/** The current CRC value (remainder). */
	private volatile int _remainder;
	
	/**
	 * Initializes the CRC-32 data sink.
	 *
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
	 * @since 2016/12/20
	 */
	@Override
	public final void offer(byte __b)
	{
		byte[] solo = this._solo;
		solo[0] = __b;
		offer(solo, 0, 1);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/12/20
	 */
	@Override
	public final void offer(byte[] __b)
		throws NullPointerException
	{
		offer(__b, 0, __b.length);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/12/20
	 */
	@Override







|










|







96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
	 * @since 2016/12/20
	 */
	@Override
	public final void offer(byte __b)
	{
		byte[] solo = this._solo;
		solo[0] = __b;
		this.offer(solo, 0, 1);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/12/20
	 */
	@Override
	public final void offer(byte[] __b)
		throws NullPointerException
	{
		this.offer(__b, 0, __b.length);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/12/20
	 */
	@Override

Name change from runt/libs/io/net/multiphasicapps/io/Checksum.java to modules/io/src/main/java/net/multiphasicapps/io/Checksum.java.

20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
{
	/**
	 * Returns the currently calculated checksum value.
	 *
	 * @return The current checksum value.
	 * @since 2017/03/05
	 */
	public abstract int checksum();
	
	/**
	 * Offers a single byte for checksum calcualtion.
	 *
	 * @param __b The byte to offer.
	 * @since 2017/03/05
	 */
	public abstract void offer(byte __b);
	
	/**
	 * Offers multiple byte for checksum calculation.
	 *
	 * @param __b The bytes to offer.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/03/05
	 */
	public abstract void offer(byte[] __b)
		throws NullPointerException;
	
	/**
	 * Offers multiple byte for checksum calculation.
	 *
	 * @param __b The bytes to offer.
	 * @param __o The starting offset to read bytes from.
	 * @param __l The number of bytes to buffer.
	 * @throws ArrayIndexOutOfBoundsException If the offset or length are
	 * negative or they exceed the array bounds.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/03/05
	 */
	public abstract void offer(byte[] __b, int __o, int __l)
		throws ArrayIndexOutOfBoundsException, NullPointerException;
	
	/**
	 * Resets the checksum calculator to its initial state.
	 *
	 * @since 2017/03/05
	 */
	public abstract void reset();
}








|







|








|













|







|


20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
{
	/**
	 * Returns the currently calculated checksum value.
	 *
	 * @return The current checksum value.
	 * @since 2017/03/05
	 */
	int checksum();
	
	/**
	 * Offers a single byte for checksum calcualtion.
	 *
	 * @param __b The byte to offer.
	 * @since 2017/03/05
	 */
	void offer(byte __b);
	
	/**
	 * Offers multiple byte for checksum calculation.
	 *
	 * @param __b The bytes to offer.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/03/05
	 */
	void offer(byte[] __b)
		throws NullPointerException;
	
	/**
	 * Offers multiple byte for checksum calculation.
	 *
	 * @param __b The bytes to offer.
	 * @param __o The starting offset to read bytes from.
	 * @param __l The number of bytes to buffer.
	 * @throws ArrayIndexOutOfBoundsException If the offset or length are
	 * negative or they exceed the array bounds.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/03/05
	 */
	void offer(byte[] __b, int __o, int __l)
		throws ArrayIndexOutOfBoundsException, NullPointerException;
	
	/**
	 * Resets the checksum calculator to its initial state.
	 *
	 * @since 2017/03/05
	 */
	void reset();
}

Name change from runt/libs/io/net/multiphasicapps/io/ChecksumInputStream.java to modules/io/src/main/java/net/multiphasicapps/io/ChecksumInputStream.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.io;

import java.io.InputStream;
import java.io.IOException;

/**
 * The forwards data from an input stream and calculates the checksum for that
 * data stream.
 *
 * @since 2017/03/05
 */
public class ChecksumInputStream
	extends InputStream
{
	/** The checksum Calculator used. */
	protected final Checksum checksum;
	
	/** Input stream. */
	protected final InputStream in;
	
	/**
	 * Initializes the calculator.
	 *
	 * @param __checksum The checksum calculator to write to.
	 * @param __in The stream to read from.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/02/28
	 */
	public ChecksumInputStream(Checksum __calc, InputStream __in)
		throws NullPointerException
	{












|
|



















|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.io;

import java.io.IOException;
import java.io.InputStream;

/**
 * The forwards data from an input stream and calculates the checksum for that
 * data stream.
 *
 * @since 2017/03/05
 */
public class ChecksumInputStream
	extends InputStream
{
	/** The checksum Calculator used. */
	protected final Checksum checksum;
	
	/** Input stream. */
	protected final InputStream in;
	
	/**
	 * Initializes the calculator.
	 *
	 * @param __calc The checksum calculator to write to.
	 * @param __in The stream to read from.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/02/28
	 */
	public ChecksumInputStream(Checksum __calc, InputStream __in)
		throws NullPointerException
	{

Name change from runt/libs/io/net/multiphasicapps/io/CompressionLevel.java to modules/io/src/main/java/net/multiphasicapps/io/CompressionLevel.java.

36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
	/** Slowest compression. */
	SLOWEST,
	
	/** End. */
	;
	
	/** The default compression level. */
	public static final CompressionLevel DEFAULT =
		SLOW;
	
	/** The best compression level. */
	public static final CompressionLevel BEST =
		SLOWEST;
	
	/**
	 * The number of symbols to look at as a single unit with a given
	 * dictionary before attempting with another dictionary.
	 *
	 * @return The block size to use for compression.
	 * @since 2018/11/10







|
<


|
<







36
37
38
39
40
41
42
43

44
45
46

47
48
49
50
51
52
53
	/** Slowest compression. */
	SLOWEST,
	
	/** End. */
	;
	
	/** The default compression level. */
	public static final CompressionLevel DEFAULT = CompressionLevel.SLOW;

	
	/** The best compression level. */
	public static final CompressionLevel BEST = CompressionLevel.SLOWEST;

	
	/**
	 * The number of symbols to look at as a single unit with a given
	 * dictionary before attempting with another dictionary.
	 *
	 * @return The block size to use for compression.
	 * @since 2018/11/10
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105

106
107
108
109
	 * @return The compression level for the scale.
	 * @since 2018/11/10
	 */
	public static final CompressionLevel ofLevel(int __i)
	{
		switch (__i)
		{
			case 1:		return FASTEST;
			
			case 2:
			case 3:		return FASTER;
			
			case 4:
			case 5:		return FAST;
			
			case 6:
			case 7:		return SLOW;
			
			case 8:
			case 9:		return SLOWER;
			
			case 10:	return SLOWEST;
			
				// Out of range, so just treat as capped
			default:
				return (__i <= 0 ? FASTEST : SLOWEST);

		}
	}
}








|


|


|


|


|

|



|
>




78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
	 * @return The compression level for the scale.
	 * @since 2018/11/10
	 */
	public static final CompressionLevel ofLevel(int __i)
	{
		switch (__i)
		{
			case 1:		return CompressionLevel.FASTEST;
			
			case 2:
			case 3:		return CompressionLevel.FASTER;
			
			case 4:
			case 5:		return CompressionLevel.FAST;
			
			case 6:
			case 7:		return CompressionLevel.SLOW;
			
			case 8:
			case 9:		return CompressionLevel.SLOWER;
			
			case 10:	return CompressionLevel.SLOWEST;
			
				// Out of range, so just treat as capped
			default:
				return (__i <= 0 ? CompressionLevel.FASTEST :
					CompressionLevel.SLOWEST);
		}
	}
}

Name change from runt/libs/io/net/multiphasicapps/io/CompressionStream.java to modules/io/src/main/java/net/multiphasicapps/io/CompressionStream.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.io;

import java.io.Closeable;
import java.io.IOException;

/**
 * This interface is used for compressed streams.
 *
 * @since 2017/08/22
 */
public interface CompressionStream
	extends Closeable
{
	/**
	 * Returns the number of compressed bytes which were read.
	 *
	 * @return The number of compressed bytes which were read.
	 * @since 2017/08/22
	 */
	public abstract long compressedBytes();
	
	/**
	 * Returns the number of uncompressed bytes which have been read.
	 *
	 * @return The number of read uncompressed bytes.
	 * @since 2017/08/22
	 */
	public abstract long uncompressedBytes();
}














<















|







|


1
2
3
4
5
6
7
8
9
10
11
12
13

14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.io;

import java.io.Closeable;


/**
 * This interface is used for compressed streams.
 *
 * @since 2017/08/22
 */
public interface CompressionStream
	extends Closeable
{
	/**
	 * Returns the number of compressed bytes which were read.
	 *
	 * @return The number of compressed bytes which were read.
	 * @since 2017/08/22
	 */
	long compressedBytes();
	
	/**
	 * Returns the number of uncompressed bytes which have been read.
	 *
	 * @return The number of read uncompressed bytes.
	 * @since 2017/08/22
	 */
	long uncompressedBytes();
}

Name change from runt/libs/io/net/multiphasicapps/io/DataEndianess.java to modules/io/src/main/java/net/multiphasicapps/io/DataEndianess.java.

Name change from runt/libs/io/net/multiphasicapps/io/DecompressionInputStream.java to modules/io/src/main/java/net/multiphasicapps/io/DecompressionInputStream.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.io;

import java.io.InputStream;
import java.io.IOException;

/**
 * This interface is used to describe a compression stream which is used as
 * input.
 *
 * @since 2017/08/22
 */













<







1
2
3
4
5
6
7
8
9
10
11
12
13

14
15
16
17
18
19
20
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.io;

import java.io.InputStream;


/**
 * This interface is used to describe a compression stream which is used as
 * input.
 *
 * @since 2017/08/22
 */

Name change from runt/libs/io/net/multiphasicapps/io/DeflaterOutputStream.java to modules/io/src/main/java/net/multiphasicapps/io/DeflaterOutputStream.java.

12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27

import java.io.IOException;
import java.io.OutputStream;

/**
 * This is used to compress to standard deflate streams.
 *
 * Associated standards:
 * {@link https://www.ietf.org/rfc/rfc1951.txt}.
 *
 * This class is not thread safe.
 *
 * @since 2018/11/10
 */
public class DeflaterOutputStream
	extends OutputStream







|
<







12
13
14
15
16
17
18
19

20
21
22
23
24
25
26

import java.io.IOException;
import java.io.OutputStream;

/**
 * This is used to compress to standard deflate streams.
 *
 * Associated standards: https://www.ietf.org/rfc/rfc1951.txt.

 *
 * This class is not thread safe.
 *
 * @since 2018/11/10
 */
public class DeflaterOutputStream
	extends OutputStream

Name change from runt/libs/io/net/multiphasicapps/io/DynamicHistoryInputStream.java to modules/io/src/main/java/net/multiphasicapps/io/DynamicHistoryInputStream.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.io;

import java.io.InputStream;
import java.io.IOException;

/**
 * This is an input stream which allows any future data in the stream to be
 * cached for later actual reading. This class should be used in situations
 * where it is needed to read future bytes in the stream and react to those
 * bytes.
 *












|
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.io;

import java.io.IOException;
import java.io.InputStream;

/**
 * This is an input stream which allows any future data in the stream to be
 * cached for later actual reading. This class should be used in situations
 * where it is needed to read future bytes in the stream and react to those
 * bytes.
 *
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
		
		// {@squirreljme.error BD0p Cannot peek a single byte because the
		// stream is closed.}
		if (this._closed)
			throw new IOException("BD0p");
		
		// Grab bytes, stop if none are available
		int avail = grab(__a + 1);
		if (avail < __a)
			return -1;
		
		throw new todo.TODO();
	}
	
	/**







|







160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
		
		// {@squirreljme.error BD0p Cannot peek a single byte because the
		// stream is closed.}
		if (this._closed)
			throw new IOException("BD0p");
		
		// Grab bytes, stop if none are available
		int avail = this.grab(__a + 1);
		if (avail < __a)
			return -1;
		
		throw new todo.TODO();
	}
	
	/**
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
		
		// {@squirreljme.error BD0r Cannot peek multiple bytes because
		// the stream is closed.}
		if (this._closed)
			throw new IOException("BD0r");
		
		// Grab bytes, stop if none are available
		int avail = grab(__a + __l);
		if (avail < __a)
			return -1;
		
		// Not reading anything?
		int rc = Math.min(__l, avail);
		if (rc < 0)
			return 0;







|







227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
		
		// {@squirreljme.error BD0r Cannot peek multiple bytes because
		// the stream is closed.}
		if (this._closed)
			throw new IOException("BD0r");
		
		// Grab bytes, stop if none are available
		int avail = this.grab(__a + __l);
		if (avail < __a)
			return -1;
		
		// Not reading anything?
		int rc = Math.min(__l, avail);
		if (rc < 0)
			return 0;
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
	{
		// {@squirreljme.error BD0s Cannot read a single byte because the
		// stream has been closed.}
		if (this._closed)
			throw new IOException("BD0s");
		
		// Grab a single byte
		int gc = grab(1);
		
		// Nothing left
		if (gc <= 0)
			return -1;
		
		// Read single byte
		return (this.buffer.removeFirst() & 0xFF);







|







255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
	{
		// {@squirreljme.error BD0s Cannot read a single byte because the
		// stream has been closed.}
		if (this._closed)
			throw new IOException("BD0s");
		
		// Grab a single byte
		int gc = this.grab(1);
		
		// Nothing left
		if (gc <= 0)
			return -1;
		
		// Read single byte
		return (this.buffer.removeFirst() & 0xFF);
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
		
		// {@squirreljme BI08 Cannot read multiple bytes because the
		// stream is closed.}
		if (this._closed)
			throw new IOException("BI08");
		
		// Grab multiple bytes
		int gc = grab(__l);
		
		// Nothing left?
		if (gc <= 0)
			return -1;
		
		// No bytes to read?
		int dc = Math.min(gc, __l);







|







289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
		
		// {@squirreljme BI08 Cannot read multiple bytes because the
		// stream is closed.}
		if (this._closed)
			throw new IOException("BI08");
		
		// Grab multiple bytes
		int gc = this.grab(__l);
		
		// Nothing left?
		if (gc <= 0)
			return -1;
		
		// No bytes to read?
		int dc = Math.min(gc, __l);

Name change from runt/libs/io/net/multiphasicapps/io/ExtendedDataInputStream.java to modules/io/src/main/java/net/multiphasicapps/io/ExtendedDataInputStream.java.

9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// ---------------------------------------------------------------------------

package net.multiphasicapps.io;

import java.io.DataInput;
import java.io.DataInputStream;
import java.io.EOFException;
import java.io.InputStream;
import java.io.IOException;

/**
 * This is an extended input stream which is better suited for general binary
 * data file reading compared to the standard {@link DataInputStream}.
 *
 * Streams default to big endian.
 *







|
|







9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// ---------------------------------------------------------------------------

package net.multiphasicapps.io;

import java.io.DataInput;
import java.io.DataInputStream;
import java.io.EOFException;
import java.io.IOException;
import java.io.InputStream;

/**
 * This is an extended input stream which is better suited for general binary
 * data file reading compared to the standard {@link DataInputStream}.
 *
 * Streams default to big endian.
 *
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
	 * @since 2016/07/10
	 */
	@Override
	public byte readByte()
		throws IOException
	{
		// Read value
		int rv = read();
		
		// {@squirreljme.error BD0t End of file reached.}
		if (rv < 0)
			throw new EOFException("BD0t");
		
		// Cast
		return (byte)rv;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/07/10
	 */
	@Override
	public char readChar()
		throws IOException
	{
		return (char)readShort();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/07/10
	 */
	@Override
	public double readDouble()
		throws IOException
	{
		return Double.longBitsToDouble(readLong());
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/07/10
	 */
	@Override
	public float readFloat()
		throws IOException
	{
		return Float.intBitsToFloat(readInt());
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/07/10
	 */
	@Override
	public void readFully(byte[] __b)
		throws IOException
	{
		readFully(__b, 0, __b.length);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/07/10
	 */
	@Override







|

















|










|










|










|







189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
	 * @since 2016/07/10
	 */
	@Override
	public byte readByte()
		throws IOException
	{
		// Read value
		int rv = this.read();
		
		// {@squirreljme.error BD0t End of file reached.}
		if (rv < 0)
			throw new EOFException("BD0t");
		
		// Cast
		return (byte)rv;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/07/10
	 */
	@Override
	public char readChar()
		throws IOException
	{
		return (char)this.readShort();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/07/10
	 */
	@Override
	public double readDouble()
		throws IOException
	{
		return Double.longBitsToDouble(this.readLong());
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/07/10
	 */
	@Override
	public float readFloat()
		throws IOException
	{
		return Float.intBitsToFloat(this.readInt());
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/07/10
	 */
	@Override
	public void readFully(byte[] __b)
		throws IOException
	{
		this.readFully(__b, 0, __b.length);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/07/10
	 */
	@Override
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
	 * {@inheritDoc}
	 * @since 2016/07/10
	 */
	@Override
	public int readUnsignedByte()
		throws IOException
	{
		return readByte() & 0xFF;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/07/10
	 */
	@Override
	public int readUnsignedShort()
		throws IOException
	{
		return readShort() & 0xFFFF;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/07/10
	 */
	@Override







|










|







361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
	 * {@inheritDoc}
	 * @since 2016/07/10
	 */
	@Override
	public int readUnsignedByte()
		throws IOException
	{
		return this.readByte() & 0xFF;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/07/10
	 */
	@Override
	public int readUnsignedShort()
		throws IOException
	{
		return this.readShort() & 0xFFFF;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/07/10
	 */
	@Override

Name change from runt/libs/io/net/multiphasicapps/io/ExtendedDataOutputStream.java to modules/io/src/main/java/net/multiphasicapps/io/ExtendedDataOutputStream.java.

74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
	{
		// {@squirreljme.error BD0x Cannot align to zero or a negative
		// amount.}
		if (__n <= 0)
			throw new IndexOutOfBoundsException("BD0x");
		
		// Pad
		while ((size() % __n) != 0)
			write(0);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/07/10
	 */
	@Override







|
|







74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
	{
		// {@squirreljme.error BD0x Cannot align to zero or a negative
		// amount.}
		if (__n <= 0)
			throw new IndexOutOfBoundsException("BD0x");
		
		// Pad
		while ((this.size() % __n) != 0)
			this.write(0);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/07/10
	 */
	@Override
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
	 * {@inheritDoc}
	 * @since 2016/07/10
	 */
	@Override
	public final void writeBoolean(boolean __v)
		throws IOException
	{
		writeByte((__v ? 1 : 0));
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/07/10
	 */
	@Override







|







196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
	 * {@inheritDoc}
	 * @since 2016/07/10
	 */
	@Override
	public final void writeBoolean(boolean __v)
		throws IOException
	{
		this.writeByte((__v ? 1 : 0));
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/07/10
	 */
	@Override
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
	public final void writeByteExact(int __v)
		throws IOException
	{
		// {@squirreljme.error BD0y Byte value out of range.}
		if (__v < -128 || __v > 127)
			throw new IOException("BD0y");
		
		writeByte(__v);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/07/10
	 */
	@Override







|







226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
	public final void writeByteExact(int __v)
		throws IOException
	{
		// {@squirreljme.error BD0y Byte value out of range.}
		if (__v < -128 || __v > 127)
			throw new IOException("BD0y");
		
		this.writeByte(__v);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/07/10
	 */
	@Override
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
	 * {@inheritDoc}
	 * @since 2016/07/10
	 */
	@Override
	public final void writeChar(int __v)
		throws IOException
	{
		writeShort(__v);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/07/10
	 */
	@Override
	public final void writeChars(String __s)
		throws IOException, NullPointerException
	{
		// Check
		if (__s == null)
			throw new NullPointerException("NARG");
		
		// Write all characters
		int n = __s.length();
		for (int i = 0; i < n; i++)
			writeShort(__s.charAt(i));
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/07/10
	 */
	@Override
	public final void writeDouble(double __v)
		throws IOException
	{
		writeLong(Double.doubleToRawLongBits(__v));
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/07/10
	 */
	@Override
	public final void writeFloat(float __v)
		throws IOException
	{
		writeInt(Float.floatToRawIntBits(__v));
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/07/10
	 */
	@Override







|

















|










|










|







248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
	 * {@inheritDoc}
	 * @since 2016/07/10
	 */
	@Override
	public final void writeChar(int __v)
		throws IOException
	{
		this.writeShort(__v);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/07/10
	 */
	@Override
	public final void writeChars(String __s)
		throws IOException, NullPointerException
	{
		// Check
		if (__s == null)
			throw new NullPointerException("NARG");
		
		// Write all characters
		int n = __s.length();
		for (int i = 0; i < n; i++)
			this.writeShort(__s.charAt(i));
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/07/10
	 */
	@Override
	public final void writeDouble(double __v)
		throws IOException
	{
		this.writeLong(Double.doubleToRawLongBits(__v));
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/07/10
	 */
	@Override
	public final void writeFloat(float __v)
		throws IOException
	{
		this.writeInt(Float.floatToRawIntBits(__v));
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/07/10
	 */
	@Override
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
				// Little
			case LITTLE:
				output.writeInt(Integer.reverseBytes(__v));
				break;
			
				// Unknown
			default:
				throw new IOException(String.format("BD04", endian));
		}
		
		// Increase
		this._size += 4;
	}
	
	/**







|







316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
				// Little
			case LITTLE:
				output.writeInt(Integer.reverseBytes(__v));
				break;
			
				// Unknown
			default:
				throw new IOException(String.format("BD04 %s", endian));
		}
		
		// Increase
		this._size += 4;
	}
	
	/**
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
				// Little
			case LITTLE:
				output.writeLong(Long.reverseBytes(__v));
				break;
			
				// Unknown
			default:
				throw new IOException(String.format("BD04", endian));
		}
		
		// Increase
		this._size += 8;
	}
	
	/**







|







348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
				// Little
			case LITTLE:
				output.writeLong(Long.reverseBytes(__v));
				break;
			
				// Unknown
			default:
				throw new IOException(String.format("BD04 %s", endian));
		}
		
		// Increase
		this._size += 8;
	}
	
	/**
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
				// Little
			case LITTLE:
				output.writeShort(Short.reverseBytes((short)__v));
				break;
			
				// Unknown
			default:
				throw new IOException(String.format("BD04", endian));
		}
		
		// Increase
		this._size += 2;
	}
	
	/**







|







380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
				// Little
			case LITTLE:
				output.writeShort(Short.reverseBytes((short)__v));
				break;
			
				// Unknown
			default:
				throw new IOException(String.format("BD04 %s", endian));
		}
		
		// Increase
		this._size += 2;
	}
	
	/**
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
	public final void writeShortExact(int __v)
		throws IOException
	{
		// {@squirreljme.error BD0z Short value out of range.}
		if (__v < -32768 || __v > 32767)
			throw new IOException("BD0z");
		
		writeShort(__v);
	}
	
	/**
	 * Writes a single unsigned byte, if its value is out of range then a
	 * write error occurs.
	 *
	 * @param __v The unsigned byte to write.
	 * @throws IOException On out of range or other write errors.
	 * @since 2016/09/14
	 */
	public final void writeUnsignedByteExact(int __v)
		throws IOException
	{
		// {@squirreljme.error BD10 Unsigned byte value out of range.}
		if (__v < 0 || __v > 255)
			throw new IOException("BD10");
		
		writeByte(__v);
	}
	
	/**
	 * Writes a single unsigned byte, if its value is out of range then a
	 * write error occurs.
	 *
	 * @param __v The unsigned short to write.
	 * @throws IOException On out of range or other write errors.
	 * @since 2016/09/14
	 */
	public final void writeUnsignedShortExact(int __v)
		throws IOException
	{
		// {@squirreljme.error BD11 Unsigned short value out of range.}
		if (__v < 0 || __v > 65535)
			throw new IOException("BD11");
		
		writeShort(__v);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/07/10
	 */
	@Override







|

















|

















|







402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
	public final void writeShortExact(int __v)
		throws IOException
	{
		// {@squirreljme.error BD0z Short value out of range.}
		if (__v < -32768 || __v > 32767)
			throw new IOException("BD0z");
		
		this.writeShort(__v);
	}
	
	/**
	 * Writes a single unsigned byte, if its value is out of range then a
	 * write error occurs.
	 *
	 * @param __v The unsigned byte to write.
	 * @throws IOException On out of range or other write errors.
	 * @since 2016/09/14
	 */
	public final void writeUnsignedByteExact(int __v)
		throws IOException
	{
		// {@squirreljme.error BD10 Unsigned byte value out of range.}
		if (__v < 0 || __v > 255)
			throw new IOException("BD10");
		
		this.writeByte(__v);
	}
	
	/**
	 * Writes a single unsigned byte, if its value is out of range then a
	 * write error occurs.
	 *
	 * @param __v The unsigned short to write.
	 * @throws IOException On out of range or other write errors.
	 * @since 2016/09/14
	 */
	public final void writeUnsignedShortExact(int __v)
		throws IOException
	{
		// {@squirreljme.error BD11 Unsigned short value out of range.}
		if (__v < 0 || __v > 65535)
			throw new IOException("BD11");
		
		this.writeShort(__v);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/07/10
	 */
	@Override

Name change from runt/libs/io/net/multiphasicapps/io/GettableEndianess.java to modules/io/src/main/java/net/multiphasicapps/io/GettableEndianess.java.

19
20
21
22
23
24
25
26
27
28
{
	/**
	 * Obtains the current default endianess of the data.
	 *
	 * @return The current endianess.
	 * @since 2016/07/10
	 */
	public abstract DataEndianess getEndianess();
}








|


19
20
21
22
23
24
25
26
27
28
{
	/**
	 * Obtains the current default endianess of the data.
	 *
	 * @return The current endianess.
	 * @since 2016/07/10
	 */
	DataEndianess getEndianess();
}

Name change from runt/libs/io/net/multiphasicapps/io/HexDumpOutputStream.java to modules/io/src/main/java/net/multiphasicapps/io/HexDumpOutputStream.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.io;

import java.io.Closeable;
import java.io.InputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintStream;
import java.io.Writer;

/**
 * This contains a stream which when given bytes hexadecimal bytes will
 * output to the given stream.













|
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.io;

import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintStream;
import java.io.Writer;

/**
 * This contains a stream which when given bytes hexadecimal bytes will
 * output to the given stream.
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
	protected final OutputStream pipe;
	
	/** Where to write characters to. */
	protected final Writer dump;
	
	/** The write queue. */
	private final byte[] _queue =
		new byte[_COLUMNS];
	
	/** The current write position. */
	private volatile int _at;
	
	/**
	 * Initializes dumping to the given stream.
	 *







|







37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
	protected final OutputStream pipe;
	
	/** Where to write characters to. */
	protected final Writer dump;
	
	/** The write queue. */
	private final byte[] _queue =
		new byte[HexDumpOutputStream._COLUMNS];
	
	/** The current write position. */
	private volatile int _at;
	
	/**
	 * Initializes dumping to the given stream.
	 *
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
	 * @since 2016/08/12
	 */
	@Override
	public void close()
		throws IOException
	{
		// Force printing of bytes
		__printLine();
		
		// Only close the pipe and not the dump
		Closeable c = this.pipe;
		if (c != null)
			c.close();
	}
	







|







122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
	 * @since 2016/08/12
	 */
	@Override
	public void close()
		throws IOException
	{
		// Force printing of bytes
		this.__printLine();
		
		// Only close the pipe and not the dump
		Closeable c = this.pipe;
		if (c != null)
			c.close();
	}
	
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
	 * @since 2016/08/12
	 */
	@Override
	public void write(int __b)
		throws IOException
	{
		// Write a single byte
		int cols = _COLUMNS;
		byte b = (byte)__b;
		byte[] queue = this._queue;
		int at = this._at;
		try
		{
			// Write to the queue
			queue[at++] = b;
			this._at = at;
			
			// Send to the output
			OutputStream pipe = this.pipe;
			if (pipe != null)
				pipe.write(__b);
		}
		
		// Check if a row is to be printed
		finally
		{
			// Print entire row
			if (at == cols)
				__printLine();
		}
	}
	
	/**
	 * Prints a hexdumpped line.
	 *
	 * @throws IOException If it could not be written.
	 * @since 2016/08/12
	 */
	private void __printLine()
		throws IOException
	{
		// Might not always work
		int cols = _COLUMNS;
		byte[] queue = this._queue;
		int at = this._at;
		try
		{
			Writer w = this.dump;
			
			// Print starting hex data







|




















|













|







154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
	 * @since 2016/08/12
	 */
	@Override
	public void write(int __b)
		throws IOException
	{
		// Write a single byte
		int cols = HexDumpOutputStream._COLUMNS;
		byte b = (byte)__b;
		byte[] queue = this._queue;
		int at = this._at;
		try
		{
			// Write to the queue
			queue[at++] = b;
			this._at = at;
			
			// Send to the output
			OutputStream pipe = this.pipe;
			if (pipe != null)
				pipe.write(__b);
		}
		
		// Check if a row is to be printed
		finally
		{
			// Print entire row
			if (at == cols)
				this.__printLine();
		}
	}
	
	/**
	 * Prints a hexdumpped line.
	 *
	 * @throws IOException If it could not be written.
	 * @since 2016/08/12
	 */
	private void __printLine()
		throws IOException
	{
		// Might not always work
		int cols = HexDumpOutputStream._COLUMNS;
		byte[] queue = this._queue;
		int at = this._at;
		try
		{
			Writer w = this.dump;
			
			// Print starting hex data

Name change from runt/libs/io/net/multiphasicapps/io/HexInputStream.java to modules/io/src/main/java/net/multiphasicapps/io/HexInputStream.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) 2013-2016 Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) 2013-2016 Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// For more information see license.mkd.
// ---------------------------------------------------------------------------

package net.multiphasicapps.io;

import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.IOException;
import java.io.Reader;

/**
 * This reads a stream of hexadecimal characters and converts it to a binary
 * input.
 *
 * @since 2016/05/15












|
|
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) 2013-2016 Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) 2013-2016 Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// For more information see license.mkd.
// ---------------------------------------------------------------------------

package net.multiphasicapps.io;

import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;

/**
 * This reads a stream of hexadecimal characters and converts it to a binary
 * input.
 *
 * @since 2016/05/15
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
		throws NullPointerException
	{
		// Check
		if (__s == null)
			throw new NullPointerException("NARG");
		
		// Set
		source = __s;
	}
	
	/**
	 * Initializes the hex based input stream.
	 *
	 * @param __is The source hex bytes.
	 * @throws NullPointerException On null arguments.







|







41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
		throws NullPointerException
	{
		// Check
		if (__s == null)
			throw new NullPointerException("NARG");
		
		// Set
		this.source = __s;
	}
	
	/**
	 * Initializes the hex based input stream.
	 *
	 * @param __is The source hex bytes.
	 * @throws NullPointerException On null arguments.
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
	 * @since 2016/05/15
	 */
	@Override
	public void close()
		throws IOException
	{
		// Always set EOF
		_eof = true;
		
		// Close it
		source.close();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/05/15
	 */
	@Override
	public int read()
		throws IOException
	{
		// EOF?
		if (_eof)
			return -1;
		
		// Read the high value
		int hi = -1;
		while (hi < 0)
		{
			// Read 
			int c = source.read();
			
			// EOF?
			if (c < 0)
				return -1;
			
			// Try a digit
			hi = Character.digit((char)c, 16);
		}
		
		// Read the low value
		int lo = -1;
		while (lo < 0)
		{
			// Read 
			int c = source.read();
			
			// EOF?
			if (c < 0)
				return -1;
			
			// Try a digit
			lo = Character.digit((char)c, 16);







|


|











|







|














|







81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
	 * @since 2016/05/15
	 */
	@Override
	public void close()
		throws IOException
	{
		// Always set EOF
		this._eof = true;
		
		// Close it
		this.source.close();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/05/15
	 */
	@Override
	public int read()
		throws IOException
	{
		// EOF?
		if (this._eof)
			return -1;
		
		// Read the high value
		int hi = -1;
		while (hi < 0)
		{
			// Read 
			int c = this.source.read();
			
			// EOF?
			if (c < 0)
				return -1;
			
			// Try a digit
			hi = Character.digit((char)c, 16);
		}
		
		// Read the low value
		int lo = -1;
		while (lo < 0)
		{
			// Read 
			int c = this.source.read();
			
			// EOF?
			if (c < 0)
				return -1;
			
			// Try a digit
			lo = Character.digit((char)c, 16);

Name change from runt/libs/io/net/multiphasicapps/io/HuffmanTreeInt.java to modules/io/src/main/java/net/multiphasicapps/io/HuffmanTreeInt.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.io;

import java.io.IOException;
import java.util.ConcurrentModificationException;
import java.util.Iterator;
import java.util.NoSuchElementException;

/**
 * This represents a mutable huffman tree.
 * 
 * This class is not thread safe.
 *
 * Iteration of values goes through the internal value table in no particular
 * order. The iterator is fail-fast.
 *
 * {@squirreljme.error BD12 The huffman tree was modified in the middle of
 * iteration.}
 *
 * @param <int> The type of values to store in the tree.
 * @since 2016/03/10
 */
public class HuffmanTreeInt
{
	/** The huffman table. */
	private volatile int[] _table;
	













<
<













<







1
2
3
4
5
6
7
8
9
10
11
12
13


14
15
16
17
18
19
20
21
22
23
24
25
26

27
28
29
30
31
32
33
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.io;

import java.io.IOException;


import java.util.NoSuchElementException;

/**
 * This represents a mutable huffman tree.
 * 
 * This class is not thread safe.
 *
 * Iteration of values goes through the internal value table in no particular
 * order. The iterator is fail-fast.
 *
 * {@squirreljme.error BD12 The huffman tree was modified in the middle of
 * iteration.}
 *

 * @since 2016/03/10
 */
public class HuffmanTreeInt
{
	/** The huffman table. */
	private volatile int[] _table;
	
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
	 *
	 * @since 2016/03/10
	 */
	public HuffmanTreeInt()
	{
		// Initially add table space so that it is always initially valid but
		// points to nothing.
		__addTableSpace();
	}
	
	/**
	 * Adds the specified object which is associated with the given symbol
	 * and mask.
	 *
	 * @param __v The value to add.







|







45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
	 *
	 * @since 2016/03/10
	 */
	public HuffmanTreeInt()
	{
		// Initially add table space so that it is always initially valid but
		// points to nothing.
		this.__addTableSpace();
	}
	
	/**
	 * Adds the specified object which is associated with the given symbol
	 * and mask.
	 *
	 * @param __v The value to add.
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
		// at the least significant end. (The value; The mask)}
		if (ibm != (32 - Integer.numberOfLeadingZeros(__mask)) ||
			(__mask & 1) == 0)
			throw new IllegalArgumentException(String.format("BD14 %x %x",
				__sym, __mask));
		
		// Get the table
		int[] table = _table;
		int n = table.length;
		
		// Increase max bit count
		_maxbits = Math.max(_maxbits, ibm);
		
		// Find the spot to add it based on the bit depth
		int at = 0;
		for (int sh = (1 << (ibm - 1)); sh != 0; sh >>>= 1)
		{
			// Last bit set?
			boolean last = (sh == 1);







|



|







81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
		// at the least significant end. (The value; The mask)}
		if (ibm != (32 - Integer.numberOfLeadingZeros(__mask)) ||
			(__mask & 1) == 0)
			throw new IllegalArgumentException(String.format("BD14 %x %x",
				__sym, __mask));
		
		// Get the table
		int[] table = this._table;
		int n = table.length;
		
		// Increase max bit count
		this._maxbits = Math.max(this._maxbits, ibm);
		
		// Find the spot to add it based on the bit depth
		int at = 0;
		for (int sh = (1 << (ibm - 1)); sh != 0; sh >>>= 1)
		{
			// Last bit set?
			boolean last = (sh == 1);
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
			if (jump == Integer.MAX_VALUE)
			{
				// If this is the last entry then a value index needs to
				// be created to store the value
				if (last)
				{
					// Add space for a new variable
					int vat = __addValueSpace();
					
					// Place value there
					_values[vat] = __v;
					
					// Set table index to point there
					table[at + q] = -(vat + 1);
					
					// Modified
					_modcount++;
					
					// No old value exists
					return 0;
				}
				
				// Otherwise, add some table space and jump to that
				// instead on the next run.
				else
				{
					// Add new location info
					int jat = __addTableSpace();
				
					// Correct vars
					table = _table;
					n = table.length;
				
					// Set jump to that position
					// Use that position instead on the next read
					table[at + q] = at = jat;
				}
			}
			
			// Points to a constant area, return a value
			else if (jump < 0)
			{
				// Calculate actual placement
				int vat = (-jump) - 1;
				
				// Get old value
				int[] vals = _values;
				int old = vals[vat];
				
				// Set new value
				vals[vat] = __v;
				
				// Modified
				_modcount++;
				
				// Return the old value
				return old;
			}
			
			// Points to another location in the array
			else







|


|





|










|


|















|






|







118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
			if (jump == Integer.MAX_VALUE)
			{
				// If this is the last entry then a value index needs to
				// be created to store the value
				if (last)
				{
					// Add space for a new variable
					int vat = this.__addValueSpace();
					
					// Place value there
					this._values[vat] = __v;
					
					// Set table index to point there
					table[at + q] = -(vat + 1);
					
					// Modified
					this._modcount++;
					
					// No old value exists
					return 0;
				}
				
				// Otherwise, add some table space and jump to that
				// instead on the next run.
				else
				{
					// Add new location info
					int jat = this.__addTableSpace();
				
					// Correct vars
					table = this._table;
					n = table.length;
				
					// Set jump to that position
					// Use that position instead on the next read
					table[at + q] = at = jat;
				}
			}
			
			// Points to a constant area, return a value
			else if (jump < 0)
			{
				// Calculate actual placement
				int vat = (-jump) - 1;
				
				// Get old value
				int[] vals = this._values;
				int old = vals[vat];
				
				// Set new value
				vals[vat] = __v;
				
				// Modified
				this._modcount++;
				
				// Return the old value
				return old;
			}
			
			// Points to another location in the array
			else
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
		// Reset parameters
		this._table = null;
		this._values = null;
		this._modcount = 0;
		this._maxbits = 0;
		
		// Setup initial tree
		__addTableSpace();
	}
	
	/**
	 * Finds the bit sequence associated with the given value.
	 *
	 * @param __i The value to find the sequence for the given bit pattern.
	 * @return A {@code long} where the upper 32-bits is the bit mask while







|







193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
		// Reset parameters
		this._table = null;
		this._values = null;
		this._modcount = 0;
		this._maxbits = 0;
		
		// Setup initial tree
		this.__addTableSpace();
	}
	
	/**
	 * Finds the bit sequence associated with the given value.
	 *
	 * @param __i The value to find the sequence for the given bit pattern.
	 * @return A {@code long} where the upper 32-bits is the bit mask while
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
		if (vals == null)
			throw new NoSuchElementException("NSEE");
		
		// Look through all values
		int n = vals.length;
		for (int i = 0; i < n; i++)
			if (vals[i] == __i)
				return __recursiveMatch(0, 0, 0, -(i + 1));
		
		// Not found
		throw new NoSuchElementException("NSEE");
	}
	
	/**
	 * Returns the value obtained via the given bit source.
	 *
	 * @param __bs The source for bits.
	 * @return The value.
	 * @thorws IOException On read errors.
	 * @throws NoSuchElementException If no value was found.
	 * @throws NullPointerException On null arguments.
	 * @since 2016/08/16
	 */
	public final int getValue(BitSource __bs)
		throws IOException, NoSuchElementException, NullPointerException
	{







|










|







219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
		if (vals == null)
			throw new NoSuchElementException("NSEE");
		
		// Look through all values
		int n = vals.length;
		for (int i = 0; i < n; i++)
			if (vals[i] == __i)
				return this.__recursiveMatch(0, 0, 0, -(i + 1));
		
		// Not found
		throw new NoSuchElementException("NSEE");
	}
	
	/**
	 * Returns the value obtained via the given bit source.
	 *
	 * @param __bs The source for bits.
	 * @return The value.
	 * @throws IOException On read errors.
	 * @throws NoSuchElementException If no value was found.
	 * @throws NullPointerException On null arguments.
	 * @since 2016/08/16
	 */
	public final int getValue(BitSource __bs)
		throws IOException, NoSuchElementException, NullPointerException
	{
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
	 * Returns the maximum number of bits entries use.
	 *
	 * @return The maximum number of used bits.
	 * @since 2016/03/28
	 */
	public final int maximumBits()
	{
		return _maxbits;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/03/10
	 */
	@Override
	public final String toString()
	{
		// Setup
		StringBuilder sb = new StringBuilder("[");
		
		// Add elements in no particular order
		int[] vals = _values;
		if (vals != null)
		{
			int n = vals.length;
			for (int i = 0; i < n; i++)
			{
				// Comma?
				if (i > 0)







|













|







271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
	 * Returns the maximum number of bits entries use.
	 *
	 * @return The maximum number of used bits.
	 * @since 2016/03/28
	 */
	public final int maximumBits()
	{
		return this._maxbits;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/03/10
	 */
	@Override
	public final String toString()
	{
		// Setup
		StringBuilder sb = new StringBuilder("[");
		
		// Add elements in no particular order
		int[] vals = this._values;
		if (vals != null)
		{
			int n = vals.length;
			for (int i = 0; i < n; i++)
			{
				// Comma?
				if (i > 0)
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
	 *
	 * @return The base index of the newly added space.
	 * @since 2016/03/28
	 */
	private int __addTableSpace()
	{
		// The returned value is the end of the table
		int[] table = _table;
		int rv = (table == null ? 0 : table.length);
		
		// Allocate some extra space
		int[] becomes = new int[rv + 2];
		
		// Copy the old array over
		for (int i = 0; i < rv; i++)
			becomes[i] = table[i];
		
		// The end bits become invalidated
		becomes[rv] = Integer.MAX_VALUE;
		becomes[rv + 1] = Integer.MAX_VALUE;
		
		// Set new table
		_table = becomes;
		
		// Return it
		return rv;
	}
	
	/**
	 * Adds more value space to add a new value.
	 *
	 * @return The index where the value space was increased.
	 * @since 2016/03/28
	 */
	private int __addValueSpace()
	{
		// The returned value is the end of the table
		int[] values = _values;
		int rv = (values == null ? 0 : values.length);
		
		// Allocate some extra space
		int[] becomes = new int[rv + 1];
		
		// Copy the old array over
		for (int i = 0; i < rv; i++)
			becomes[i] = values[i];
		
		// Set new table
		_values = becomes;
		
		// Return it
		return rv;
	}
	
	/**
	 * Searches the huffman tree for the given raw match value.
	 *
	 * @param __at The index to look at.
	 * @param __huf The huffman index.
	 * @param __mask The mask of the input value.
	 * @param __match The value to match.
	 * @return The bit mask and the value for the given entry or {@code -1L} if
	 * not found.
	 * @since 2016/03/28
	 */
	private long __recursiveMatch(int __at, int __huf, int __mask, int __match)
	{
		// Get tree
		int[] table = _table;
		
		// Get the left and right side jump values
		int jl = table[__at];
		int jr = table[__at + 1];
		
		// Matches left or right side?
		boolean left = (jl == __match);
		if (left || jr == __match)
			return (((long)((__mask << 1) | 1)) << 32L) |
				((long)((__huf << 1) | (left ? 0 : 1)));
		
		// Traverse left side
		long rv;
		if (jl >= 0 && jl != Integer.MAX_VALUE)
		{
			rv = __recursiveMatch(jl, __huf << 1, (__mask << 1) | 1,
				__match);
			if (rv != -1L)
				return rv;
		}
		
		// Traverse right side
		if (jr >= 0 && jr != Integer.MAX_VALUE)
		{
			rv = __recursiveMatch(jr, (__huf << 1) | 1, (__mask << 1) | 1,
				__match);
			if (rv != 1L)
				return rv;
		}
		
		// Not found
		return -1L;
	}
}








|














|














|










|



















|















|








|










341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
	 *
	 * @return The base index of the newly added space.
	 * @since 2016/03/28
	 */
	private int __addTableSpace()
	{
		// The returned value is the end of the table
		int[] table = this._table;
		int rv = (table == null ? 0 : table.length);
		
		// Allocate some extra space
		int[] becomes = new int[rv + 2];
		
		// Copy the old array over
		for (int i = 0; i < rv; i++)
			becomes[i] = table[i];
		
		// The end bits become invalidated
		becomes[rv] = Integer.MAX_VALUE;
		becomes[rv + 1] = Integer.MAX_VALUE;
		
		// Set new table
		this._table = becomes;
		
		// Return it
		return rv;
	}
	
	/**
	 * Adds more value space to add a new value.
	 *
	 * @return The index where the value space was increased.
	 * @since 2016/03/28
	 */
	private int __addValueSpace()
	{
		// The returned value is the end of the table
		int[] values = this._values;
		int rv = (values == null ? 0 : values.length);
		
		// Allocate some extra space
		int[] becomes = new int[rv + 1];
		
		// Copy the old array over
		for (int i = 0; i < rv; i++)
			becomes[i] = values[i];
		
		// Set new table
		this._values = becomes;
		
		// Return it
		return rv;
	}
	
	/**
	 * Searches the huffman tree for the given raw match value.
	 *
	 * @param __at The index to look at.
	 * @param __huf The huffman index.
	 * @param __mask The mask of the input value.
	 * @param __match The value to match.
	 * @return The bit mask and the value for the given entry or {@code -1L} if
	 * not found.
	 * @since 2016/03/28
	 */
	private long __recursiveMatch(int __at, int __huf, int __mask, int __match)
	{
		// Get tree
		int[] table = this._table;
		
		// Get the left and right side jump values
		int jl = table[__at];
		int jr = table[__at + 1];
		
		// Matches left or right side?
		boolean left = (jl == __match);
		if (left || jr == __match)
			return (((long)((__mask << 1) | 1)) << 32L) |
				((long)((__huf << 1) | (left ? 0 : 1)));
		
		// Traverse left side
		long rv;
		if (jl >= 0 && jl != Integer.MAX_VALUE)
		{
			rv = this.__recursiveMatch(jl, __huf << 1, (__mask << 1) | 1,
				__match);
			if (rv != -1L)
				return rv;
		}
		
		// Traverse right side
		if (jr >= 0 && jr != Integer.MAX_VALUE)
		{
			rv = this.__recursiveMatch(jr, (__huf << 1) | 1, (__mask << 1) | 1,
				__match);
			if (rv != 1L)
				return rv;
		}
		
		// Not found
		return -1L;
	}
}

Name change from runt/libs/io/net/multiphasicapps/io/IndentedOutputStream.java to modules/io/src/main/java/net/multiphasicapps/io/IndentedOutputStream.java.

Name change from runt/libs/io/net/multiphasicapps/io/InflaterInputStream.java to modules/io/src/main/java/net/multiphasicapps/io/InflaterInputStream.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.io;

import java.io.InputStream;
import java.io.IOException;
import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import java.util.NoSuchElementException;

/**
 * This is used to decompress standard deflate compressed stream.
 *
 * Associated standards:
 * {@link https://www.ietf.org/rfc/rfc1951.txt}.
 *
 * This class is not thread safe.
 *
 * @since 2017/02/24
 */
public class InflaterInputStream
	extends DecompressionInputStream












|
|







|
<







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22

23
24
25
26
27
28
29
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.io;

import java.io.IOException;
import java.io.InputStream;
import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import java.util.NoSuchElementException;

/**
 * This is used to decompress standard deflate compressed stream.
 *
 * Associated standards: https://www.ietf.org/rfc/rfc1951.txt.

 *
 * This class is not thread safe.
 *
 * @since 2017/02/24
 */
public class InflaterInputStream
	extends DecompressionInputStream
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
	 * both the maximum length count and distance count.
	 */
	private final int[] _rawlitdistlens =
		new int[322];
	
	/** Used to store bit length counts. */
	private final int[] _blcount =
		new int[_MAX_BITS + 1];
	
	/** Used to store the next code. */
	private final int[] _nextcode =
		new int[_MAX_BITS + 1];
	
	/** The number of compressed bytes. */
	private long _compressedsize;
	
	/** The number of uncompressed bytes. */
	private long _uncompressedsize;
	







|



|







96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
	 * both the maximum length count and distance count.
	 */
	private final int[] _rawlitdistlens =
		new int[322];
	
	/** Used to store bit length counts. */
	private final int[] _blcount =
		new int[InflaterInputStream._MAX_BITS + 1];
	
	/** Used to store the next code. */
	private final int[] _nextcode =
		new int[InflaterInputStream._MAX_BITS + 1];
	
	/** The number of compressed bytes. */
	private long _compressedsize;
	
	/** The number of uncompressed bytes. */
	private long _uncompressedsize;
	
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
	 * @param __in The stream to inflate.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/02/24
	 */
	public InflaterInputStream(InputStream __in)
		throws NullPointerException
	{
		this(__in, _DEFAULT_SLIDING_WINDOW_SIZE);
	}
	
	/**
	 * Initializes the deflate compression stream inflater, an optional
	 * checksum calculator may be specified also.
	 *
	 * @param __in The stream to inflate.
	 * @param __cs
	 * @throws NullPointerException On null arguments, except for {@code __cs}.
	 * @since 2017/02/24
	 */
	public InflaterInputStream(InputStream __in, Checksum __cs)
		throws NullPointerException
	{
		this(__in, _DEFAULT_SLIDING_WINDOW_SIZE, __cs);
	}
	
	/**
	 * Initializes the deflate compression stream inflater with a custom
	 * size specified for the sliding window.
	 *
	 * @param __in The stream to inflate.







|







|






|







159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
	 * @param __in The stream to inflate.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/02/24
	 */
	public InflaterInputStream(InputStream __in)
		throws NullPointerException
	{
		this(__in, InflaterInputStream._DEFAULT_SLIDING_WINDOW_SIZE);
	}
	
	/**
	 * Initializes the deflate compression stream inflater, an optional
	 * checksum calculator may be specified also.
	 *
	 * @param __in The stream to inflate.
	 * @param __cs The checksum.
	 * @throws NullPointerException On null arguments, except for {@code __cs}.
	 * @since 2017/02/24
	 */
	public InflaterInputStream(InputStream __in, Checksum __cs)
		throws NullPointerException
	{
		this(__in, InflaterInputStream._DEFAULT_SLIDING_WINDOW_SIZE, __cs);
	}
	
	/**
	 * Initializes the deflate compression stream inflater with a custom
	 * size specified for the sliding window.
	 *
	 * @param __in The stream to inflate.
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
	public int read()
		throws IOException
	{
		// Try reading a single byte
		byte[] solo = this._solo;
		for (;;)
		{
			int rv = read(solo, 0, 1);
			
			// EOF?
			if (rv < 0)
				return rv;
			
			// Try again
			else if (rv == 0)







|







275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
	public int read()
		throws IOException
	{
		// Try reading a single byte
		byte[] solo = this._solo;
		for (;;)
		{
			int rv = this.read(solo, 0, 1);
			
			// EOF?
			if (rv < 0)
				return rv;
			
			// Try again
			else if (rv == 0)
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
			// Try to fit as many bytes as possible into the output
			while (c < __l)
			{
				// Decompress
				int base;
				this._targoff = (base = __o + c);
				this._targend = base + (__l - c);
				int rv = __decompress();
			
				// Ended?
				if (rv < 0)
				{
					this._eof = true;
					break;
				}







|







340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
			// Try to fit as many bytes as possible into the output
			while (c < __l)
			{
				// Decompress
				int base;
				this._targoff = (base = __o + c);
				this._targend = base + (__l - c);
				int rv = this.__decompress();
			
				// Ended?
				if (rv < 0)
				{
					this._eof = true;
					break;
				}
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
		if (this._eof)
			return -1;
		
		// The target offset on entry
		int enteroff = this._targoff;
		
		// Read the final bit which determines if this is the last block
		int finalhit = __readBits(1, false);
		
		// Read the window type
		int type = __readBits(2, false);
		switch (type)
		{
				// None
			case _TYPE_NO_COMPRESSION:
				__decompressNone();
				break;
				
				// Fixed huffman
			case _TYPE_FIXED_HUFFMAN:
				__decompressFixed();
				break;
				
				// Dynamic huffman
			case _TYPE_DYNAMIC_HUFFMAN:
				__decompressDynamic();
				break;
			
				// Error or unknown
			case _TYPE_ERROR:
			default:
				// {@squirreljme.error BD17 Unknown type or the error type
				// was reached. (The type code used in the stream)}
				throw new IOException(String.format("BD17 %d", type));
		}
		
		// If this was the last block to read, then return EOF if no data







|


|



|
|



|
|



|
|



|







398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
		if (this._eof)
			return -1;
		
		// The target offset on entry
		int enteroff = this._targoff;
		
		// Read the final bit which determines if this is the last block
		int finalhit = this.__readBits(1, false);
		
		// Read the window type
		int type = this.__readBits(2, false);
		switch (type)
		{
				// None
			case InflaterInputStream._TYPE_NO_COMPRESSION:
				this.__decompressNone();
				break;
				
				// Fixed huffman
			case InflaterInputStream._TYPE_FIXED_HUFFMAN:
				this.__decompressFixed();
				break;
				
				// Dynamic huffman
			case InflaterInputStream._TYPE_DYNAMIC_HUFFMAN:
				this.__decompressDynamic();
				break;
			
				// Error or unknown
			case InflaterInputStream._TYPE_ERROR:
			default:
				// {@squirreljme.error BD17 Unknown type or the error type
				// was reached. (The type code used in the stream)}
				throw new IOException(String.format("BD17 %d", type));
		}
		
		// If this was the last block to read, then return EOF if no data
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
		else
			return rv;
	}
	
	/**
	 * Decompress dynamic huffman code.
	 *
	 * @throws On read or decompression errors.
	 * @since 2017/02/25
	 */
	private void __decompressDynamic()
		throws IOException
	{
		// Read the code length parameters
		int dhlit = __readBits(5, false) + 257;
		int dhdist = __readBits(5, false) + 1;
		int dhclen = __readBits(4, false) + 4;
		
		// Read the code length tree
		HuffmanTreeInt codelentree = __decompressDynamicLoadLenTree(dhclen);
		
		// Read the literal and distance trees
		HuffmanTreeInt literaltree = __obtainLiteralTree(),
			distancetree = __obtainDistanceTree();
		__decompressDynamicLoadLitDistTree(codelentree, dhlit, dhdist,
			literaltree, distancetree);
		
		// Decode input
		for (;;)
		{
			// Read code
			int code = literaltree.getValue(this._bitsource);
			
			// Literal byte value
			if (code >= 0 && code <= 255)
				__write(code, 8, false);
		
			// Stop processing
			else if (code == 256)
				return;
		
			// Window based result
			else if (code >= 257 && code <= 285)
				__decompressWindow(__handleLength(code),
					distancetree.getValue(this._bitsource));
			
			// {@squirreljme.error BD18 Illegal dynamic huffman code. (The
			// code.)}
			else
				throw new IOException(String.format("BD18 %d", code));
		}







|






|
|
|


|


|
|
|










|







|







444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
		else
			return rv;
	}
	
	/**
	 * Decompress dynamic huffman code.
	 *
	 * @throws IOException On read or decompression errors.
	 * @since 2017/02/25
	 */
	private void __decompressDynamic()
		throws IOException
	{
		// Read the code length parameters
		int dhlit = this.__readBits(5, false) + 257;
		int dhdist = this.__readBits(5, false) + 1;
		int dhclen = this.__readBits(4, false) + 4;
		
		// Read the code length tree
		HuffmanTreeInt codelentree = this.__decompressDynamicLoadLenTree(dhclen);
		
		// Read the literal and distance trees
		HuffmanTreeInt literaltree = this.__obtainLiteralTree(),
			distancetree = this.__obtainDistanceTree();
		this.__decompressDynamicLoadLitDistTree(codelentree, dhlit, dhdist,
			literaltree, distancetree);
		
		// Decode input
		for (;;)
		{
			// Read code
			int code = literaltree.getValue(this._bitsource);
			
			// Literal byte value
			if (code >= 0 && code <= 255)
				this.__write(code, 8, false);
		
			// Stop processing
			else if (code == 256)
				return;
		
			// Window based result
			else if (code >= 257 && code <= 285)
				this.__decompressWindow(this.__handleLength(code),
					distancetree.getValue(this._bitsource));
			
			// {@squirreljme.error BD18 Illegal dynamic huffman code. (The
			// code.)}
			else
				throw new IOException(String.format("BD18 %d", code));
		}
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
		for (int i = 0, n = rawlitdistlens.length; i < n; i++)
			rawlitdistlens[i] = 0;
		
		// Read every code
		try
		{
			for (int next = 0; next < total;)
				next += __readCodeBits(__cltree, rawlitdistlens, next);
		}

		// {@squirreljme.error BD19 The compressed stream is
		// damaged by being too short or having an illegal tree
		// access.}				
		catch (NoSuchElementException e)
		{
			throw new IOException("BD19", e);
		}
		
		// Initialize both trees
		__thunkCodeLengthTree(__ltree, rawlitdistlens, 0, __dhlit);
		__thunkCodeLengthTree(__dtree, rawlitdistlens, __dhlit, __dhdist);
	}
	
	/**
	 * Reads the code length tree.
	 *
	 * @param __dhclen The code length size.
	 * @throws IOException On read errors.
	 * @since 2017/02/25
	 */
	private HuffmanTreeInt __decompressDynamicLoadLenTree(int __dhclen)
		throws IOException
	{
		// Target tree
		HuffmanTreeInt codelentree = __obtainCodeLenTree();
		
		// {@squirreljme.error BD1a There may only be at most 19 used
		// code lengths. (The number of code lengths)}
		if (__dhclen > 19)
			throw new IOException(String.format("BD1a %d", __dhclen));
		
		// The same array is used for reading code lengths but the next time
		// around it is possible that less code lengths are read, so if the
		// higher elements have previously been set they will be used
		int[] rawcodelens = this._rawcodelens;
		for (int i = 0, n = rawcodelens.length; i < n; i++)
			rawcodelens[i] = 0;
		
		// Read lengths, they are just 3 bits but their placement values are
		// shuffled since some sequences are more common than others
		int[] hsbits = _SHUFFLE_BITS;
		for (int next = 0; next < __dhclen; next++)
			rawcodelens[hsbits[next]] = __readBits(3, false);
		
		// Thunk the tree and return it
		return __thunkCodeLengthTree(codelentree, rawcodelens, 0,
			rawcodelens.length);
	}
	
	/**
	 * Decodes decompressed data stored with the fixed huffman table and
	 * decompresses it.
	 *
	 * @throws IOException On read or decompression errors.
	 * @since 2017/02/25
	 */
	private void __decompressFixed()
		throws IOException
	{
		// Read until the sequence has ended
		for (;;)
		{
			// Read code
			int code = __readFixedHuffman();
				
			// Literal byte value
			if (code >= 0 && code <= 255)
				__write(code, 8, false);
		
			// Stop processing
			else if (code == 256)
				return;
		
			// Window based result
			else if (code >= 257 && code <= 285)
				__decompressWindow(__handleLength(code), Integer.MIN_VALUE);
		
			// {@squirreljme.error BD1b Illegal fixed huffman code. (The
			// code.)}
			else
				throw new IOException(String.format("BD1b %d", code));
		}
	}







|











|
|













|















|

|


|

















|



|







|







518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
		for (int i = 0, n = rawlitdistlens.length; i < n; i++)
			rawlitdistlens[i] = 0;
		
		// Read every code
		try
		{
			for (int next = 0; next < total;)
				next += this.__readCodeBits(__cltree, rawlitdistlens, next);
		}

		// {@squirreljme.error BD19 The compressed stream is
		// damaged by being too short or having an illegal tree
		// access.}				
		catch (NoSuchElementException e)
		{
			throw new IOException("BD19", e);
		}
		
		// Initialize both trees
		this.__thunkCodeLengthTree(__ltree, rawlitdistlens, 0, __dhlit);
		this.__thunkCodeLengthTree(__dtree, rawlitdistlens, __dhlit, __dhdist);
	}
	
	/**
	 * Reads the code length tree.
	 *
	 * @param __dhclen The code length size.
	 * @throws IOException On read errors.
	 * @since 2017/02/25
	 */
	private HuffmanTreeInt __decompressDynamicLoadLenTree(int __dhclen)
		throws IOException
	{
		// Target tree
		HuffmanTreeInt codelentree = this.__obtainCodeLenTree();
		
		// {@squirreljme.error BD1a There may only be at most 19 used
		// code lengths. (The number of code lengths)}
		if (__dhclen > 19)
			throw new IOException(String.format("BD1a %d", __dhclen));
		
		// The same array is used for reading code lengths but the next time
		// around it is possible that less code lengths are read, so if the
		// higher elements have previously been set they will be used
		int[] rawcodelens = this._rawcodelens;
		for (int i = 0, n = rawcodelens.length; i < n; i++)
			rawcodelens[i] = 0;
		
		// Read lengths, they are just 3 bits but their placement values are
		// shuffled since some sequences are more common than others
		int[] hsbits = InflaterInputStream._SHUFFLE_BITS;
		for (int next = 0; next < __dhclen; next++)
			rawcodelens[hsbits[next]] = this.__readBits(3, false);
		
		// Thunk the tree and return it
		return this.__thunkCodeLengthTree(codelentree, rawcodelens, 0,
			rawcodelens.length);
	}
	
	/**
	 * Decodes decompressed data stored with the fixed huffman table and
	 * decompresses it.
	 *
	 * @throws IOException On read or decompression errors.
	 * @since 2017/02/25
	 */
	private void __decompressFixed()
		throws IOException
	{
		// Read until the sequence has ended
		for (;;)
		{
			// Read code
			int code = this.__readFixedHuffman();
				
			// Literal byte value
			if (code >= 0 && code <= 255)
				this.__write(code, 8, false);
		
			// Stop processing
			else if (code == 256)
				return;
		
			// Window based result
			else if (code >= 257 && code <= 285)
				this.__decompressWindow(this.__handleLength(code), Integer.MIN_VALUE);
		
			// {@squirreljme.error BD1b Illegal fixed huffman code. (The
			// code.)}
			else
				throw new IOException(String.format("BD1b %d", code));
		}
	}
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
	private void __decompressNone()
		throws IOException
	{
		// Throw out bits that have been read so that the following reads are
		// aligned to byte boundaries
		int minisub = this._minisize & 7;
		if (minisub > 0)
			__readBits(minisub, false);
		
		// Read length and the one's complement of it
		int len = __readBits(16, false);
		int com = __readBits(16, false);
		
		// The complemented length must be equal to the complement
		// {@squirreljme.error BD1c Value mismatch reading the number of
		// uncompressed symbols that exist. (The length; The complement;
		// The complemented input length; The complemented input complement)}
		if ((len ^ 0xFFFF) != com)
			throw new IOException(String.format("BD1c %04x %04x %04x %04x",
				len, com, len ^ 0xFFFF, com ^ 0xFFFF));
		
		// Read all bytes
		for (int i = 0; i < len; i++)
			__write(__readBits(8, false), 8, false);
	}
	
	/**
	 * Handles decompressing window data.
	 *
	 * @param __len The length to read, must be prehandled.
	 * @param __dist The distance to read.
	 * @throws IOException On read errors.
	 * @since 2017/02/25
	 */
	private void __decompressWindow(int __len, int __dist)
		throws IOException
	{
		// Handle distance
		__dist = __handleDistance(__dist);
	
		// Get the maximum valid length, so for example if the length
		// is 5 and the distance is two, then only read two bytes.
		int maxlen;
		if (__dist < __len)
			maxlen = __dist;
		else







|


|
|











|














|







618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
	private void __decompressNone()
		throws IOException
	{
		// Throw out bits that have been read so that the following reads are
		// aligned to byte boundaries
		int minisub = this._minisize & 7;
		if (minisub > 0)
			this.__readBits(minisub, false);
		
		// Read length and the one's complement of it
		int len = this.__readBits(16, false);
		int com = this.__readBits(16, false);
		
		// The complemented length must be equal to the complement
		// {@squirreljme.error BD1c Value mismatch reading the number of
		// uncompressed symbols that exist. (The length; The complement;
		// The complemented input length; The complemented input complement)}
		if ((len ^ 0xFFFF) != com)
			throw new IOException(String.format("BD1c %04x %04x %04x %04x",
				len, com, len ^ 0xFFFF, com ^ 0xFFFF));
		
		// Read all bytes
		for (int i = 0; i < len; i++)
			this.__write(this.__readBits(8, false), 8, false);
	}
	
	/**
	 * Handles decompressing window data.
	 *
	 * @param __len The length to read, must be prehandled.
	 * @param __dist The distance to read.
	 * @throws IOException On read errors.
	 * @since 2017/02/25
	 */
	private void __decompressWindow(int __len, int __dist)
		throws IOException
	{
		// Handle distance
		__dist = this.__handleDistance(__dist);
	
		// Get the maximum valid length, so for example if the length
		// is 5 and the distance is two, then only read two bytes.
		int maxlen;
		if (__dist < __len)
			maxlen = __dist;
		else
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
		}
	
		// Add those bytes to the output, handle wrapping around if the
		// length is greater than the current position
		for (int i = 0, v = 0; i < __len; i++)
		{
			// Write byte
			__write(winb[v], 8, false);
		
			// Wrap around
			if ((++v) >= maxlen)
				v = 0;
		}
	}
	
	/**
	 * Handles fixed huffman distance.
	 *
	 * @param __code The input code.
	 * @return The ditsance read.
	 * @throws IOException On read errors.
	 * @since 2017/02/25
	 */
	private int __handleDistance(int __code)
		throws IOException
	{
		// Read distance
		if (__code == Integer.MIN_VALUE)
			__code = __readBits(5, true);
		
		// {@squirreljme.error BD1e Illegal fixed distance code. (The distance
		// code)}
		if (__code > 29)
			throw new IOException(String.format("BD1e %d", __code));
		
		// Calculate the required distance to use







|




















|







680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
		}
	
		// Add those bytes to the output, handle wrapping around if the
		// length is greater than the current position
		for (int i = 0, v = 0; i < __len; i++)
		{
			// Write byte
			this.__write(winb[v], 8, false);
		
			// Wrap around
			if ((++v) >= maxlen)
				v = 0;
		}
	}
	
	/**
	 * Handles fixed huffman distance.
	 *
	 * @param __code The input code.
	 * @return The ditsance read.
	 * @throws IOException On read errors.
	 * @since 2017/02/25
	 */
	private int __handleDistance(int __code)
		throws IOException
	{
		// Read distance
		if (__code == Integer.MIN_VALUE)
			__code = this.__readBits(5, true);
		
		// {@squirreljme.error BD1e Illegal fixed distance code. (The distance
		// code)}
		if (__code > 29)
			throw new IOException(String.format("BD1e %d", __code));
		
		// Calculate the required distance to use
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
				rv++;
		}
		
		// Determine the number of extra bits that make up the distance which
		// is used as an additional distance value
		int extrabits = ((__code / 2) - 1);
		if (extrabits > 0)
			rv += __readBits(extrabits, false);
		
		// Return it
		return rv;
	}
	
	/**
	 * Reads length codes from the input.







|







725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
				rv++;
		}
		
		// Determine the number of extra bits that make up the distance which
		// is used as an additional distance value
		int extrabits = ((__code / 2) - 1);
		if (extrabits > 0)
			rv += this.__readBits(extrabits, false);
		
		// Return it
		return rv;
	}
	
	/**
	 * Reads length codes from the input.
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
			else
				rv++;
		}
		
		// Add extra bits which are used to modify the amount of data read
		int extrabits = (base / 4) - 1;
		if (extrabits > 0)
			rv += (extrabits = __readBits(extrabits, false));
		
		// Return the length
		return rv;
	}
	
	/**
	 * Obtains the code length tree.







|







769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
			else
				rv++;
		}
		
		// Add extra bits which are used to modify the amount of data read
		int extrabits = (base / 4) - 1;
		if (extrabits > 0)
			rv += (extrabits = this.__readBits(extrabits, false));
		
		// Return the length
		return rv;
	}
	
	/**
	 * Obtains the code length tree.
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
					throw new IOException(String.format("BD1h %d",
						lastlendx));
				
				// Read the last
				repval = __out[lastlendx];
				
				// Read the repeat count
				repfor = 3 + __readBits(2, false);
			}
			
			// Repeat zero for 3-10 times
			else if (code == 17)
			{
				// Use zero
				repval = 0;
				
				// Read 3 bits
				repfor = 3 + __readBits(3, false);
			}
			
			// Repeat zero for 11-138 times
			else if (code == 18)
			{
				// Use zero
				repval = 0;
				
				// Read 7 bits
				repfor = 11 + __readBits(7, false);
			}
			
			// {@squirreljme.error BD1i Illegal code. (The code)}
			else
				throw new IOException(String.format("BD1i %d", code));
			
			// Could fail







|









|









|







976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
					throw new IOException(String.format("BD1h %d",
						lastlendx));
				
				// Read the last
				repval = __out[lastlendx];
				
				// Read the repeat count
				repfor = 3 + this.__readBits(2, false);
			}
			
			// Repeat zero for 3-10 times
			else if (code == 17)
			{
				// Use zero
				repval = 0;
				
				// Read 3 bits
				repfor = 3 + this.__readBits(3, false);
			}
			
			// Repeat zero for 11-138 times
			else if (code == 18)
			{
				// Use zero
				repval = 0;
				
				// Read 7 bits
				repfor = 11 + this.__readBits(7, false);
			}
			
			// {@squirreljme.error BD1i Illegal code. (The code)}
			else
				throw new IOException(String.format("BD1i %d", code));
			
			// Could fail
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
	 * @throws IOException On read errors.
	 * @since 2016/03/10
	 */
	private int __readFixedHuffman()
		throws IOException
	{
		// The long if statement block
		if (__readBits(1, true) != 0)
			if (__readBits(1, true) != 0)
				if (__readBits(1, true) != 0)
					return 192 + __readBits(6, true);
				else
					if (__readBits(1, true) != 0)
						return 160 + __readBits(5, true);
					else
						if (__readBits(1, true) != 0)
							return 144 + __readBits(4, true);
						else
							return 280 + __readBits(3, true);
			else
				return 80 + __readBits(6, true);
		else
			if (__readBits(1, true) != 0)
				return 16 + __readBits(6, true);
			else
				if (__readBits(1, true) != 0)
					if (__readBits(1, true) != 0)
						return 0 + __readBits(4, true);
					else
						return 272 + __readBits(3, true);
				else
					return 256 + __readBits(4, true);
	}
	
	/**
	 * Creates a huffman tree from the given code lengths. These generate
	 * symbols which are used to determine how the dynamic huffman data is to
	 * be decoded.
	 *
	 * @param __rv The tree to output.
	 * @param __lens The input code lengths.
	 * @param __o The starting offset.
	 * @param __l The number of lengths to decode.
	 * @return A huffman tree from the code length input.
	 * @throws NullPointerException On null arguments.
	 * @since 2016/03/28
	 */







|
|
|
|

|
|

|
|

|

|

|
|

|
|
|

|

|







|







1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
	 * @throws IOException On read errors.
	 * @since 2016/03/10
	 */
	private int __readFixedHuffman()
		throws IOException
	{
		// The long if statement block
		if (this.__readBits(1, true) != 0)
			if (this.__readBits(1, true) != 0)
				if (this.__readBits(1, true) != 0)
					return 192 + this.__readBits(6, true);
				else
					if (this.__readBits(1, true) != 0)
						return 160 + this.__readBits(5, true);
					else
						if (this.__readBits(1, true) != 0)
							return 144 + this.__readBits(4, true);
						else
							return 280 + this.__readBits(3, true);
			else
				return 80 + this.__readBits(6, true);
		else
			if (this.__readBits(1, true) != 0)
				return 16 + this.__readBits(6, true);
			else
				if (this.__readBits(1, true) != 0)
					if (this.__readBits(1, true) != 0)
						return 0 + this.__readBits(4, true);
					else
						return 272 + this.__readBits(3, true);
				else
					return 256 + this.__readBits(4, true);
	}
	
	/**
	 * Creates a huffman tree from the given code lengths. These generate
	 * symbols which are used to determine how the dynamic huffman data is to
	 * be decoded.
	 *
	 * @param __tree The tree to output.
	 * @param __lens The input code lengths.
	 * @param __o The starting offset.
	 * @param __l The number of lengths to decode.
	 * @return A huffman tree from the code length input.
	 * @throws NullPointerException On null arguments.
	 * @since 2016/03/28
	 */
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
		for (int i = 0, p = __o; i < __l; i++, p++)
			bl_count[__lens[p]]++;
		bl_count[0] = 0;
		
		// Find the numerical value of the smallest code for each code
		// length.
		int code = 0;
		for (int bits = 1; bits <= _MAX_BITS; bits++)
		{
			code = (code + bl_count[bits - 1]) << 1;
			next_code[bits] = code;
		}
	
		// Assign values to all codes
		__tree.clear();







|







1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
		for (int i = 0, p = __o; i < __l; i++, p++)
			bl_count[__lens[p]]++;
		bl_count[0] = 0;
		
		// Find the numerical value of the smallest code for each code
		// length.
		int code = 0;
		for (int bits = 1; bits <= InflaterInputStream._MAX_BITS; bits++)
		{
			code = (code + bl_count[bits - 1]) << 1;
			next_code[bits] = code;
		}
	
		// Assign values to all codes
		__tree.clear();

Name change from runt/libs/io/net/multiphasicapps/io/MIMEFileDecoder.java to modules/io/src/main/java/net/multiphasicapps/io/MIMEFileDecoder.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.io;

import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.IOException;
import java.io.Reader;
import java.io.UnsupportedEncodingException;

/**
 * This class is used to decode input streams which have been encoded in the
 * MIME Base64 format. This file format is genearted by {@code uuencode -m}.
 * This format usually begins with {@code begin-base64 mode filename} and













|
|
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.io;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.io.UnsupportedEncodingException;

/**
 * This class is used to decode input streams which have been encoded in the
 * MIME Base64 format. This file format is genearted by {@code uuencode -m}.
 * This format usually begins with {@code begin-base64 mode filename} and

Name change from runt/libs/io/net/multiphasicapps/io/NullOutputStream.java to modules/io/src/main/java/net/multiphasicapps/io/NullOutputStream.java.

Name change from runt/libs/io/net/multiphasicapps/io/PrintStreamWriter.java to modules/io/src/main/java/net/multiphasicapps/io/PrintStreamWriter.java.

78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
		throws IOException
	{
		// Lock
		PrintStream output = this.output;
		synchronized (this.lock)
		{
			output.close();
			__checkError();
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/08/12
	 */
	@Override
	public void flush()
		throws IOException
	{
		// Lock
		PrintStream output = this.output;
		synchronized (this.lock)
		{
			output.flush();
			__checkError();
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/08/12
	 */
	@Override
	public void write(int __c)
		throws IOException
	{
		// Lock
		PrintStream output = this.output;
		synchronized (this.lock)
		{
			output.print((char)__c);
			__checkError();
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/08/12
	 */







|
















|
















|







78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
		throws IOException
	{
		// Lock
		PrintStream output = this.output;
		synchronized (this.lock)
		{
			output.close();
			this.__checkError();
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/08/12
	 */
	@Override
	public void flush()
		throws IOException
	{
		// Lock
		PrintStream output = this.output;
		synchronized (this.lock)
		{
			output.flush();
			this.__checkError();
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/08/12
	 */
	@Override
	public void write(int __c)
		throws IOException
	{
		// Lock
		PrintStream output = this.output;
		synchronized (this.lock)
		{
			output.print((char)__c);
			this.__checkError();
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/08/12
	 */
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
		synchronized (this.lock)
		{
			// Print characters
			for (int i = __o; i < end; i++)
				output.print((char)__c[i]);
			
			// Check
			__checkError();
		}
	}
	
	/**
	 * Checks if the given stream has reported an error.
	 *
	 * @throws IOException If the stream has entered the error state.







|







141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
		synchronized (this.lock)
		{
			// Print characters
			for (int i = __o; i < end; i++)
				output.print((char)__c[i]);
			
			// Check
			this.__checkError();
		}
	}
	
	/**
	 * Checks if the given stream has reported an error.
	 *
	 * @throws IOException If the stream has entered the error state.

Name change from runt/libs/io/net/multiphasicapps/io/RandomAccessData.java to modules/io/src/main/java/net/multiphasicapps/io/RandomAccessData.java.

27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
	 * @param __o The offset to read from.
	 * @param __l The number of bytes to read.
	 * @throws IndexOutOfBoundsException If the position is not within bounds;
	 * the offset and/or length are negative; or the offset and length exceed
	 * the array bounds.
	 * @since 2016/08/11
	 */
	public abstract void read(int __p, byte[] __b, int __o, int __l)
		throws IndexOutOfBoundsException;
	
	/**
	 * Reads a byte at the given position.
	 *
	 * @param __p The position to read from.
	 * @return The read value.
	 * @throws IndexOutOfBoundsException If the position is not within bounds.
	 * @since 2016/08/11
	 */
	public abstract int readByte(int __p)
		throws IndexOutOfBoundsException;
	
	/**
	 * Reads a double at the given position.
	 *
	 * @param __p The position to read from.
	 * @return The read value.
	 * @throws IndexOutOfBoundsException If the position is not within bounds.
	 * @since 2016/08/11
	 */
	public abstract double readDouble(int __p)
		throws IndexOutOfBoundsException;
	
	/**
	 * Reads a float at the given position.
	 *
	 * @param __p The position to read from.
	 * @return The read value.
	 * @throws IndexOutOfBoundsException If the position is not within bounds.
	 * @since 2016/08/11
	 */
	public abstract double readFloat(int __p)
		throws IndexOutOfBoundsException;
	
	/**
	 * Reads an integer at the given position.
	 *
	 * @param __p The position to read from.
	 * @return The read value.
	 * @throws IndexOutOfBoundsException If the position is not within bounds.
	 * @since 2016/08/11
	 */
	public abstract int readInt(int __p)
		throws IndexOutOfBoundsException;
	
	/**
	 * Reads a long at the given position.
	 *
	 * @param __p The position to read from.
	 * @return The read value.
	 * @throws IndexOutOfBoundsException If the position is not within bounds.
	 * @since 2016/08/11
	 */
	public abstract long readLong(int __p)
		throws IndexOutOfBoundsException;
	
	/**
	 * Reads a short at the given position.
	 *
	 * @param __p The position to read from.
	 * @return The read value.
	 * @throws IndexOutOfBoundsException If the position is not within bounds.
	 * @since 2016/08/11
	 */
	public abstract int readShort(int __p)
		throws IndexOutOfBoundsException;
	
	/**
	 * Reads an unsigned byte at the given position.
	 *
	 * @param __p The position to read from.
	 * @return The read value.
	 * @throws IndexOutOfBoundsException If the position is not within bounds.
	 * @since 2016/08/11
	 */
	public abstract int readUnsignedByte(int __p)
		throws IndexOutOfBoundsException;
	
	/**
	 * Reads an unsigned short at the given position.
	 *
	 * @param __p The position to read from.
	 * @return The read value.
	 * @throws IndexOutOfBoundsException If the position is not within bounds.
	 * @since 2016/08/11
	 */
	public abstract int readUnsignedShort(int __p)
		throws IndexOutOfBoundsException;
}








|










|










|










|










|










|










|










|










|



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
	 * @param __o The offset to read from.
	 * @param __l The number of bytes to read.
	 * @throws IndexOutOfBoundsException If the position is not within bounds;
	 * the offset and/or length are negative; or the offset and length exceed
	 * the array bounds.
	 * @since 2016/08/11
	 */
	void read(int __p, byte[] __b, int __o, int __l)
		throws IndexOutOfBoundsException;
	
	/**
	 * Reads a byte at the given position.
	 *
	 * @param __p The position to read from.
	 * @return The read value.
	 * @throws IndexOutOfBoundsException If the position is not within bounds.
	 * @since 2016/08/11
	 */
	int readByte(int __p)
		throws IndexOutOfBoundsException;
	
	/**
	 * Reads a double at the given position.
	 *
	 * @param __p The position to read from.
	 * @return The read value.
	 * @throws IndexOutOfBoundsException If the position is not within bounds.
	 * @since 2016/08/11
	 */
	double readDouble(int __p)
		throws IndexOutOfBoundsException;
	
	/**
	 * Reads a float at the given position.
	 *
	 * @param __p The position to read from.
	 * @return The read value.
	 * @throws IndexOutOfBoundsException If the position is not within bounds.
	 * @since 2016/08/11
	 */
	double readFloat(int __p)
		throws IndexOutOfBoundsException;
	
	/**
	 * Reads an integer at the given position.
	 *
	 * @param __p The position to read from.
	 * @return The read value.
	 * @throws IndexOutOfBoundsException If the position is not within bounds.
	 * @since 2016/08/11
	 */
	int readInt(int __p)
		throws IndexOutOfBoundsException;
	
	/**
	 * Reads a long at the given position.
	 *
	 * @param __p The position to read from.
	 * @return The read value.
	 * @throws IndexOutOfBoundsException If the position is not within bounds.
	 * @since 2016/08/11
	 */
	long readLong(int __p)
		throws IndexOutOfBoundsException;
	
	/**
	 * Reads a short at the given position.
	 *
	 * @param __p The position to read from.
	 * @return The read value.
	 * @throws IndexOutOfBoundsException If the position is not within bounds.
	 * @since 2016/08/11
	 */
	int readShort(int __p)
		throws IndexOutOfBoundsException;
	
	/**
	 * Reads an unsigned byte at the given position.
	 *
	 * @param __p The position to read from.
	 * @return The read value.
	 * @throws IndexOutOfBoundsException If the position is not within bounds.
	 * @since 2016/08/11
	 */
	int readUnsignedByte(int __p)
		throws IndexOutOfBoundsException;
	
	/**
	 * Reads an unsigned short at the given position.
	 *
	 * @param __p The position to read from.
	 * @return The read value.
	 * @throws IndexOutOfBoundsException If the position is not within bounds.
	 * @since 2016/08/11
	 */
	int readUnsignedShort(int __p)
		throws IndexOutOfBoundsException;
}

Name change from runt/libs/io/net/multiphasicapps/io/SettableEndianess.java to modules/io/src/main/java/net/multiphasicapps/io/SettableEndianess.java.

23
24
25
26
27
28
29
30
31
32
33
	 * Sets the endianess of the data.
	 *
	 * @param __end The new default endianess to use.
	 * @return The old endianess.
	 * @throws NullPointerException If no endianess was specified.
	 * @since 2016/07/10
	 */
	public abstract DataEndianess setEndianess(DataEndianess __end)
		throws NullPointerException;
}








|



23
24
25
26
27
28
29
30
31
32
33
	 * Sets the endianess of the data.
	 *
	 * @param __end The new default endianess to use.
	 * @return The old endianess.
	 * @throws NullPointerException If no endianess was specified.
	 * @since 2016/07/10
	 */
	DataEndianess setEndianess(DataEndianess __end)
		throws NullPointerException;
}

Name change from runt/libs/io/net/multiphasicapps/io/SizeLimitedInputStream.java to modules/io/src/main/java/net/multiphasicapps/io/SizeLimitedInputStream.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) 2013-2016 Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) 2013-2016 Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// For more information see license.mkd.
// ---------------------------------------------------------------------------

package net.multiphasicapps.io;

import java.io.InputStream;
import java.io.IOException;

/**
 * This is an input stream in which the size of the input stream is maximally
 * bound to a given size or fixed to a specific size.
 *
 * This class is not thread safe.
 *












|
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) 2013-2016 Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) 2013-2016 Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// For more information see license.mkd.
// ---------------------------------------------------------------------------

package net.multiphasicapps.io;

import java.io.IOException;
import java.io.InputStream;

/**
 * This is an input stream in which the size of the input stream is maximally
 * bound to a given size or fixed to a specific size.
 *
 * This class is not thread safe.
 *
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
	 * @since 2016/03/09
	 */
	@Override
	public int available()
		throws IOException
	{
		// Get the count for the wrapped stream
		long wav = wrapped.available();
	
		// Either limited to the max integer size, the number of available
		// bytes, or the remaining stream count.
		return (int)Math.min(Integer.MAX_VALUE,
			Math.min(wav, (limit - _current)));
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/03/09
	 */
	@Override







|




|







104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
	 * @since 2016/03/09
	 */
	@Override
	public int available()
		throws IOException
	{
		// Get the count for the wrapped stream
		long wav = this.wrapped.available();
	
		// Either limited to the max integer size, the number of available
		// bytes, or the remaining stream count.
		return (int)Math.min(Integer.MAX_VALUE,
			Math.min(wav, (this.limit - this._current)));
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/03/09
	 */
	@Override
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
			{
				// {@squirreljme.error BD1p Reached EOF on wrapped stream when
				// requesting an exact number of bytes. (The current read
				// count; The read limit)}
				long limit = this.limit;
				long at;
				while ((at = this._current) < limit)
					if (read() < 0)
						throw new IOException(String.format("BD1p %d %d",
							at, limit));
			}
		}
		
		// Close the underlying stream, but only if propogating
		if (this.propogate)
			wrapped.close();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/03/09
	 */
	@Override
	public int read()
		throws IOException
	{
		// Current position
		long limit = this.limit;
		long cur = this._current;
		
		// Reached the limit?
		if (cur >= limit)
			return -1;
		
		// Read next byte
		int next = wrapped.read();
		
		// EOF?
		if (next < 0)
		{
			// {@squirreljme.error BD1q Required an exact number of bytes
			// however the limit was not yet reached, the input stream is too
			// short. (The limit; The current position)}
			if (exact && cur != limit)
				throw new IOException(String.format("BD1q %d %d",
					limit, cur));
			
			// Return original negative
			return next;
		}
		







|







|



















|







|







135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
			{
				// {@squirreljme.error BD1p Reached EOF on wrapped stream when
				// requesting an exact number of bytes. (The current read
				// count; The read limit)}
				long limit = this.limit;
				long at;
				while ((at = this._current) < limit)
					if (this.read() < 0)
						throw new IOException(String.format("BD1p %d %d",
							at, limit));
			}
		}
		
		// Close the underlying stream, but only if propogating
		if (this.propogate)
			this.wrapped.close();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/03/09
	 */
	@Override
	public int read()
		throws IOException
	{
		// Current position
		long limit = this.limit;
		long cur = this._current;
		
		// Reached the limit?
		if (cur >= limit)
			return -1;
		
		// Read next byte
		int next = this.wrapped.read();
		
		// EOF?
		if (next < 0)
		{
			// {@squirreljme.error BD1q Required an exact number of bytes
			// however the limit was not yet reached, the input stream is too
			// short. (The limit; The current position)}
			if (this.exact && cur != limit)
				throw new IOException(String.format("BD1q %d %d",
					limit, cur));
			
			// Return original negative
			return next;
		}
		
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
		long current = this._current;
		long limit = this.limit;
		if (current >= limit)
		{
			// {@squirreljme.error BD1r Required an exact number of bytes
			// however the limit was not yet reached, the file is too short.
			// (The limit; The current position)}
			if (exact && current != limit)
				throw new IOException(String.format("BD1r %d %d",
					limit, current));
			
			return -1;
		}
		
		// Do not read more bytes after the limit
		int cc = (int)Math.min(limit - current, __l);
		
		// Read the next few bytes
		InputStream wrapped = this.wrapped;
		int rc = wrapped.read(__b, __o, cc);
		
		// EOF?
		if (rc < 0)
		{
			// {@squirreljme.error BD1s Required an exact number of bytes
			// however the limit was not yet reached. (The limit; The
			// current position)}
			if (exact && current != limit)
				throw new IOException(String.format("BD1s %d %d",
					limit, current));
			
			// Just EOF
			return -1;
		}
		







|



















|







208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
		long current = this._current;
		long limit = this.limit;
		if (current >= limit)
		{
			// {@squirreljme.error BD1r Required an exact number of bytes
			// however the limit was not yet reached, the file is too short.
			// (The limit; The current position)}
			if (this.exact && current != limit)
				throw new IOException(String.format("BD1r %d %d",
					limit, current));
			
			return -1;
		}
		
		// Do not read more bytes after the limit
		int cc = (int)Math.min(limit - current, __l);
		
		// Read the next few bytes
		InputStream wrapped = this.wrapped;
		int rc = wrapped.read(__b, __o, cc);
		
		// EOF?
		if (rc < 0)
		{
			// {@squirreljme.error BD1s Required an exact number of bytes
			// however the limit was not yet reached. (The limit; The
			// current position)}
			if (this.exact && current != limit)
				throw new IOException(String.format("BD1s %d %d",
					limit, current));
			
			// Just EOF
			return -1;
		}
		

Name change from runt/libs/io/net/multiphasicapps/io/SizedStream.java to modules/io/src/main/java/net/multiphasicapps/io/SizedStream.java.

20
21
22
23
24
25
26
27
28
29
{
	/**
	 * Returns the number of written or read bytes.
	 *
	 * @return The number of read or written bytes.
	 * @since 2016/07/10
	 */
	public abstract long size();
}








|


20
21
22
23
24
25
26
27
28
29
{
	/**
	 * Returns the number of written or read bytes.
	 *
	 * @return The number of read or written bytes.
	 * @since 2016/07/10
	 */
	long size();
}

Name change from runt/libs/io/net/multiphasicapps/io/SlidingByteWindow.java to modules/io/src/main/java/net/multiphasicapps/io/SlidingByteWindow.java.

50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
		// {@squirreljme.error BD1t Zero or negative window size specified.
		// (The window size)}
		if (__wsz <= 0)
			throw new IllegalArgumentException(String.format("BD1t %d",
				__wsz));
		
		// Set
		windowsize = __wsz;
		
		// Setup backing store
		deque = new ByteDeque(__wsz);
	}
	
	/**
	 * Appends a single byte to the sliding window.
	 *
	 * @param __b The byte to add to the window.
	 * @since 2016/03/10
	 */
	public void append(byte __b)
	{
		byte[] solo = this._solo;
		solo[0] = __b;
		append(solo, 0, 1);
	}
	
	/**
	 * Appends multiple bytes to the sliding window.
	 *
	 * @param __b Bytes to add to the sliding window.
	 * @throws NullPointerException On null arguments.







|


|












|







50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
		// {@squirreljme.error BD1t Zero or negative window size specified.
		// (The window size)}
		if (__wsz <= 0)
			throw new IllegalArgumentException(String.format("BD1t %d",
				__wsz));
		
		// Set
		this.windowsize = __wsz;
		
		// Setup backing store
		this.deque = new ByteDeque(__wsz);
	}
	
	/**
	 * Appends a single byte to the sliding window.
	 *
	 * @param __b The byte to add to the window.
	 * @since 2016/03/10
	 */
	public void append(byte __b)
	{
		byte[] solo = this._solo;
		solo[0] = __b;
		this.append(solo, 0, 1);
	}
	
	/**
	 * Appends multiple bytes to the sliding window.
	 *
	 * @param __b Bytes to add to the sliding window.
	 * @throws NullPointerException On null arguments.
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
	 * @param __o Offset into the byte array.
	 * @param __l The number of bytes to add.
	 * @throws IndexOutOfBoundsException If the offset or length are negative
	 * or the offset and the length exceeds the array bounds.
	 * @throws NullPointerException On null arguments.
	 * @since 2016/03/10
	 */
	public void append(byte __b[], int __o, int __l)
		throws IndexOutOfBoundsException, NullPointerException
	{
		// Check
		if (__b == null)
			throw new NullPointerException("NARG");
		if (__o < 0 || __l < 0 || (__o + __l > __b.length))
			throw new IndexOutOfBoundsException("BAOB");







|







99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
	 * @param __o Offset into the byte array.
	 * @param __l The number of bytes to add.
	 * @throws IndexOutOfBoundsException If the offset or length are negative
	 * or the offset and the length exceeds the array bounds.
	 * @throws NullPointerException On null arguments.
	 * @since 2016/03/10
	 */
	public void append(byte[] __b, int __o, int __l)
		throws IndexOutOfBoundsException, NullPointerException
	{
		// Check
		if (__b == null)
			throw new NullPointerException("NARG");
		if (__o < 0 || __l < 0 || (__o + __l > __b.length))
			throw new IndexOutOfBoundsException("BAOB");
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
	 * bounds of the sliding window.
	 * @since 2017/03/04
	 */
	public byte get(int __ago)
		throws IndexOutOfBoundsException
	{
		byte[] solo = this._solo;
		get(__ago, solo, 0, 1);
		return solo[0];
	}
	
	/**
	 * This reads bytes from the sliding window at a given historical index
	 * and writes them to the input array.
	 *







|







146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
	 * bounds of the sliding window.
	 * @since 2017/03/04
	 */
	public byte get(int __ago)
		throws IndexOutOfBoundsException
	{
		byte[] solo = this._solo;
		this.get(__ago, solo, 0, 1);
		return solo[0];
	}
	
	/**
	 * This reads bytes from the sliding window at a given historical index
	 * and writes them to the input array.
	 *

Name change from runt/libs/io/net/multiphasicapps/io/StringReader.java to modules/io/src/main/java/net/multiphasicapps/io/StringReader.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.io;

import java.io.IOException;
import java.io.Reader;

/**
 * This is a reader which can read from a string.
 *
 * This class is not thread safe.
 *












<







1
2
3
4
5
6
7
8
9
10
11
12

13
14
15
16
17
18
19
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.io;


import java.io.Reader;

/**
 * This is a reader which can read from a string.
 *
 * This class is not thread safe.
 *

Name change from runt/libs/io/net/multiphasicapps/io/TableSectionOutputStream.java to modules/io/src/main/java/net/multiphasicapps/io/TableSectionOutputStream.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

18
19
20
21
22
23
24
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.io;

import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.lang.ref.Reference;
import java.io.DataOutput;
import java.io.IOException;
import java.io.OutputStream;

import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;

/**
 * This is an output stream which writes to section tables, essentially a
 * number of various data chunks in the stream. All sections are ordered in












|
<
|


>







1
2
3
4
5
6
7
8
9
10
11
12
13

14
15
16
17
18
19
20
21
22
23
24
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.io;

import java.io.ByteArrayOutputStream;
import java.io.DataOutput;

import java.io.DataOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.lang.ref.Reference;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;

/**
 * This is an output stream which writes to section tables, essentially a
 * number of various data chunks in the stream. All sections are ordered in
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
	 * Adds a section which is of a variable size.
	 *
	 * @return The resulting section.
	 * @since 2019/08/11
	 */
	public final TableSectionOutputStream.Section addSection()
	{
		return this.addSection(VARIABLE_SIZE, 1);
	}
	
	/**
	 * Adds a section which consists of the given byte array.
	 *
	 * @param __bytes The byte array to initialize as.
	 * @return The resulting section.







|







49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
	 * Adds a section which is of a variable size.
	 *
	 * @return The resulting section.
	 * @since 2019/08/11
	 */
	public final TableSectionOutputStream.Section addSection()
	{
		return this.addSection(TableSectionOutputStream.VARIABLE_SIZE, 1);
	}
	
	/**
	 * Adds a section which consists of the given byte array.
	 *
	 * @param __bytes The byte array to initialize as.
	 * @return The resulting section.
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
	 * @since 2019/08/11
	 */
	public final TableSectionOutputStream.Section addSection(int __size,
		int __align)
		throws IllegalArgumentException
	{
		// {@squirreljme.error BD3h Zero or negative size section. (The size)}
		if (__size != VARIABLE_SIZE && __size <= 0)
			throw new IllegalArgumentException("BD3h " + __size);
		
		// {@squirreljme.error BD3q Zero or negative alignment.
		// (The alignment)}
		if (__align < 1)
			throw new IllegalArgumentException("BD3q " + __align);
		







|







131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
	 * @since 2019/08/11
	 */
	public final TableSectionOutputStream.Section addSection(int __size,
		int __align)
		throws IllegalArgumentException
	{
		// {@squirreljme.error BD3h Zero or negative size section. (The size)}
		if (__size != TableSectionOutputStream.VARIABLE_SIZE && __size <= 0)
			throw new IllegalArgumentException("BD3h " + __size);
		
		// {@squirreljme.error BD3q Zero or negative alignment.
		// (The alignment)}
		if (__align < 1)
			throw new IllegalArgumentException("BD3q " + __align);
		
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
		private Section(int __size, int __align, __Dirty__ __d)
			throws IllegalArgumentException, NullPointerException
		{
			if (__d == null)
				throw new NullPointerException("NARG");
			
			// {@squirreljme.error BD3l Zero or negative size. (The size)}
			if (__size != VARIABLE_SIZE && __size <= 0)
				throw new IllegalArgumentException("BD3l " + __size);
			
			// Set
			this.fixedsize = __size;
			this.alignment = (__align >= 1 ? __align : 1);
			this.isvariable = (__size == VARIABLE_SIZE);
			
			// Dirty flag storage
			this._dirty = __d;
			
			// If this is a fixed size section, we never have to expand it
			// so we can allocate all the needed data!
			if (__size != VARIABLE_SIZE)
				this._data = new byte[__size];
			else
				this._data = new byte[_BUFFER_SIZE];
		}
		
		/**
		 * {@inheritDoc}
		 * @since 2019/08/11
		 */
		@Override







|





|






|


|







435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
		private Section(int __size, int __align, __Dirty__ __d)
			throws IllegalArgumentException, NullPointerException
		{
			if (__d == null)
				throw new NullPointerException("NARG");
			
			// {@squirreljme.error BD3l Zero or negative size. (The size)}
			if (__size != TableSectionOutputStream.VARIABLE_SIZE && __size <= 0)
				throw new IllegalArgumentException("BD3l " + __size);
			
			// Set
			this.fixedsize = __size;
			this.alignment = (__align >= 1 ? __align : 1);
			this.isvariable = (__size == TableSectionOutputStream.VARIABLE_SIZE);
			
			// Dirty flag storage
			this._dirty = __d;
			
			// If this is a fixed size section, we never have to expand it
			// so we can allocate all the needed data!
			if (__size != TableSectionOutputStream.VARIABLE_SIZE)
				this._data = new byte[__size];
			else
				this._data = new byte[Section._BUFFER_SIZE];
		}
		
		/**
		 * {@inheritDoc}
		 * @since 2019/08/11
		 */
		@Override
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
			if (!this.isvariable && size + 1 > this.fixedsize)
				throw new IOException("BD3m " + size);
			
			// Possibly resize the data array, only when variable
			byte[] data = this._data;
			if (this.isvariable && size >= data.length)
			{
				data = Arrays.copyOf(data, size + _BUFFER_SIZE);
				this._data = data;
			}
			
			// Write into the data
			data[size] = (byte)__b;
			
			// Size up







|







503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
			if (!this.isvariable && size + 1 > this.fixedsize)
				throw new IOException("BD3m " + size);
			
			// Possibly resize the data array, only when variable
			byte[] data = this._data;
			if (this.isvariable && size >= data.length)
			{
				data = Arrays.copyOf(data, size + Section._BUFFER_SIZE);
				this._data = data;
			}
			
			// Write into the data
			data[size] = (byte)__b;
			
			// Size up
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
				throw new IOException("BD3p");
			
			// Possibly resize the data array (only when variable)
			byte[] data = this._data;
			if (this.isvariable && size + __l >= data.length)
			{
				data = Arrays.copyOf(data,
					size + (__l < _BUFFER_SIZE ? _BUFFER_SIZE : __l));
				this._data = data;
			}
			
			// Write into the data
			for (int i = 0; i < __l; i++)
				data[size++] = __b[__o++];
			







|







554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
				throw new IOException("BD3p");
			
			// Possibly resize the data array (only when variable)
			byte[] data = this._data;
			if (this.isvariable && size + __l >= data.length)
			{
				data = Arrays.copyOf(data,
					size + (__l < Section._BUFFER_SIZE ? Section._BUFFER_SIZE : __l));
				this._data = data;
			}
			
			// Write into the data
			for (int i = 0; i < __l; i++)
				data[size++] = __b[__o++];
			
756
757
758
759
760
761
762

763
764
765
766
767
768
769
		}
		
		/**
		 * Writes the specified number of bytes as padding, the padding
		 * value is zero.
		 *
		 * @param __n The number of bytes to pad with.

		 * @since 2019/08/11
		 */
		public final void writePadding(int __n)
			throws IOException
		{
			this.writePadding(__n, 0);
		}







>







756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
		}
		
		/**
		 * Writes the specified number of bytes as padding, the padding
		 * value is zero.
		 *
		 * @param __n The number of bytes to pad with.
		 * @throws IOException On write errors.
		 * @since 2019/08/11
		 */
		public final void writePadding(int __n)
			throws IOException
		{
			this.writePadding(__n, 0);
		}

Name change from runt/libs/io/net/multiphasicapps/io/ZLibCompressor.java to modules/io/src/main/java/net/multiphasicapps/io/ZLibCompressor.java.

12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27

import java.io.IOException;
import java.io.OutputStream;

/**
 * This class supports compressing data to ZLib streams.
 *
 * Associated standards:
 * {@link https://www.ietf.org/rfc/rfc1950.txt}.
 *
 * This class is not thread safe.
 *
 * @since 2018/11/11
 */
public final class ZLibCompressor
	extends OutputStream







|
<







12
13
14
15
16
17
18
19

20
21
22
23
24
25
26

import java.io.IOException;
import java.io.OutputStream;

/**
 * This class supports compressing data to ZLib streams.
 *
 * Associated standards: https://www.ietf.org/rfc/rfc1950.txt .

 *
 * This class is not thread safe.
 *
 * @since 2018/11/11
 */
public final class ZLibCompressor
	extends OutputStream

Name change from runt/libs/io/net/multiphasicapps/io/ZLibDecompressor.java to modules/io/src/main/java/net/multiphasicapps/io/ZLibDecompressor.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.io;

import java.io.DataInputStream;
import java.io.InputStream;
import java.io.IOException;

/**
 * This class supports decompressing ZLib streams.
 *
 * Associated standards:
 * {@link https://www.ietf.org/rfc/rfc1950.txt}.
 *
 * This class is not thread safe.
 *
 * @since 2017/03/04
 */
public class ZLibDecompressor
	extends DecompressionInputStream













|
|




|
<







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

21
22
23
24
25
26
27
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.io;

import java.io.DataInputStream;
import java.io.IOException;
import java.io.InputStream;

/**
 * This class supports decompressing ZLib streams.
 *
 * Associated standards: https://www.ietf.org/rfc/rfc1950.txt .

 *
 * This class is not thread safe.
 *
 * @since 2017/03/04
 */
public class ZLibDecompressor
	extends DecompressionInputStream
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
	public int read()
		throws IOException
	{
		// Try reading a single byte
		byte[] solo = this._solo;
		for (;;)
		{
			int rv = read(solo, 0, 1);
			
			// EOF?
			if (rv < 0)
				return rv;
			
			// Try again
			else if (rv == 0)







|







157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
	public int read()
		throws IOException
	{
		// Try reading a single byte
		byte[] solo = this._solo;
		for (;;)
		{
			int rv = this.read(solo, 0, 1);
			
			// EOF?
			if (rv < 0)
				return rv;
			
			// Try again
			else if (rv == 0)
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
				}
				
				// Count single compressed byte
				this._basecomp++;
				
				// {@squirreljme.error BD1x Only deflate compressed ZLib
				// streams are supported. (The compression method used)}
				int method = (cmf & _CMF_COMPRESSION_METHOD_MASK);
				if (_CMF_METHOD_DEFLATE != method)
					throw new IOException(String.format("BD1x %d", method));
				
				// {@squirreljme.error BD1y The specified binary logarithm
				// specified for the sliding window is not valid. (The binary
				// logarithm of the sliding window)}
				// The specification says that higher sliding windows are not
				// allowed, but skirt that requirement
				int slwin = ((cmf & _CMF_COMPRESSION_INFO_MASK) >>>
					_CMF_COMPRESSION_INFO_SHIFT) + 8;
				if (slwin < 0 || slwin > 30)
					throw new IOException(String.format("BD1y %d", slwin));
				
				// Shift up
				slwin = 1 << slwin;
				
				// Read more flags







|
|







|
<







274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290

291
292
293
294
295
296
297
				}
				
				// Count single compressed byte
				this._basecomp++;
				
				// {@squirreljme.error BD1x Only deflate compressed ZLib
				// streams are supported. (The compression method used)}
				int method = (cmf & ZLibDecompressor._CMF_COMPRESSION_METHOD_MASK);
				if (ZLibDecompressor._CMF_METHOD_DEFLATE != method)
					throw new IOException(String.format("BD1x %d", method));
				
				// {@squirreljme.error BD1y The specified binary logarithm
				// specified for the sliding window is not valid. (The binary
				// logarithm of the sliding window)}
				// The specification says that higher sliding windows are not
				// allowed, but skirt that requirement
				int slwin = ((cmf & ZLibDecompressor._CMF_COMPRESSION_INFO_MASK) >>> ZLibDecompressor._CMF_COMPRESSION_INFO_SHIFT) + 8;

				if (slwin < 0 || slwin > 30)
					throw new IOException(String.format("BD1y %d", slwin));
				
				// Shift up
				slwin = 1 << slwin;
				
				// Read more flags
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
				// header of the ZLib chunk is not corrupt.
				int was = ((cmf * 256) + mf) % 31;
				if (was != 0)
					throw new IOException(String.format("BD1z %d", was));
				
				// {@squirreljme.error BD20 Preset dictionaries in ZLib
				// streams are not supported.}
				if ((mf & _FLAG_PRESET_DICTIONARY) != 0)
					throw new IOException("BD20");
				
				// Setup inflate stream
				checksum.reset();
				current = new InflaterInputStream(in, slwin, checksum);
				this._current = current;
			}







|







307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
				// header of the ZLib chunk is not corrupt.
				int was = ((cmf * 256) + mf) % 31;
				if (was != 0)
					throw new IOException(String.format("BD1z %d", was));
				
				// {@squirreljme.error BD20 Preset dictionaries in ZLib
				// streams are not supported.}
				if ((mf & ZLibDecompressor._FLAG_PRESET_DICTIONARY) != 0)
					throw new IOException("BD20");
				
				// Setup inflate stream
				checksum.reset();
				current = new InflaterInputStream(in, slwin, checksum);
				this._current = current;
			}

Name change from runt/libs/io/net/multiphasicapps/io/__CRC32Table__.java to modules/io/src/main/java/net/multiphasicapps/io/__CRC32Table__.java.

61
62
63
64
65
66
67
68
69
70
71
72
73
74
75

76
77
78
79
80
81
82
		// Store
		this._table = table;
	}
	
	/**
	 * Obtains the CRC table.
	 *
	 * @parma __poly The polynomial.
	 * @return The CRC table.
	 * @since 2016/07/16
	 */
	static final __CRC32Table__ __table(int __poly)
	{
		// Lock
		Map<Integer, Reference<__CRC32Table__>> tables = _TABLES;

		synchronized (tables)
		{
			// Get
			Integer i = Integer.valueOf(__poly);
			Reference<__CRC32Table__> ref = tables.get(i);
			__CRC32Table__ rv;
		







|






|
>







61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
		// Store
		this._table = table;
	}
	
	/**
	 * Obtains the CRC table.
	 *
	 * @param __poly The polynomial.
	 * @return The CRC table.
	 * @since 2016/07/16
	 */
	static final __CRC32Table__ __table(int __poly)
	{
		// Lock
		Map<Integer, Reference<__CRC32Table__>> tables =
			__CRC32Table__._TABLES;
		synchronized (tables)
		{
			// Get
			Integer i = Integer.valueOf(__poly);
			Reference<__CRC32Table__> ref = tables.get(i);
			__CRC32Table__ rv;
		

Name change from runt/libs/io/net/multiphasicapps/io/__RewriteType__.java to modules/io/src/main/java/net/multiphasicapps/io/__RewriteType__.java.

Name change from runt/libs/io/net/multiphasicapps/io/__RewriteValue__.java to modules/io/src/main/java/net/multiphasicapps/io/__RewriteValue__.java.

Name change from runt/libs/io/net/multiphasicapps/io/__Rewrite__.java to modules/io/src/main/java/net/multiphasicapps/io/__Rewrite__.java.

Name change from runt/libs/io/net/multiphasicapps/io/package-info.java to modules/io/src/main/java/net/multiphasicapps/io/package-info.java.

Name change from runt/libs/io.test/TestBase64Decoder.java to modules/io/src/test/java/TestBase64Decoder.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

import net.multiphasicapps.tac.TestBiConsumer;
import net.multiphasicapps.io.Base64Alphabet;
import net.multiphasicapps.io.Base64Decoder;

/**
 * This tests the base 64 decoder.
 *
 * @since 2018/03/06
 */
public class TestBase64Decoder










|
|
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

import net.multiphasicapps.io.Base64Alphabet;
import net.multiphasicapps.io.Base64Decoder;
import net.multiphasicapps.tac.TestBiConsumer;

/**
 * This tests the base 64 decoder.
 *
 * @since 2018/03/06
 */
public class TestBase64Decoder

Name change from runt/libs/io.test/TestDeflaterInflater.java to modules/io/src/test/java/TestDeflaterInflater.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

16
17
18
19
20
21
22
23
24
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

import net.multiphasicapps.tac.TestSupplier;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import net.multiphasicapps.io.CompressionLevel;

import net.multiphasicapps.io.InflaterInputStream;
import net.multiphasicapps.io.DeflaterOutputStream;

/**
 * Tests the deflater and then the inflater, making sure that compressed
 * data ends up the same when decompressed.
 *
 * @since 2018/11/10
 */










<




>

|







1
2
3
4
5
6
7
8
9
10

11
12
13
14
15
16
17
18
19
20
21
22
23
24
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------


import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import net.multiphasicapps.io.CompressionLevel;
import net.multiphasicapps.io.DeflaterOutputStream;
import net.multiphasicapps.io.InflaterInputStream;
import net.multiphasicapps.tac.TestSupplier;

/**
 * Tests the deflater and then the inflater, making sure that compressed
 * data ends up the same when decompressed.
 *
 * @since 2018/11/10
 */

Name change from runt/libs/io.test/TestMIMEFileDecoder.java to modules/io/src/test/java/TestMIMEFileDecoder.java.

1
2
3
4
5
6
7
8
9
10


11
12
13
14
15
16
17
18
19
20
21
22
23
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------



import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Arrays;
import net.multiphasicapps.tac.TestSupplier;
import net.multiphasicapps.io.MIMEFileDecoder;

/**
 * Tests decoding of MIME files.
 *
 * @since 2018/11/25
 */
public class TestMIMEFileDecoder










>
>



|
|
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Objects;
import net.multiphasicapps.io.MIMEFileDecoder;
import net.multiphasicapps.tac.TestSupplier;

/**
 * Tests decoding of MIME files.
 *
 * @since 2018/11/25
 */
public class TestMIMEFileDecoder
68
69
70
71
72
73
74


75




















76
77
78


79










				baos.write(buf, 0, rc);
			}
			
			// Read it
			decoded = baos.toByteArray();
		}
		


		// They must be the same




















		return Arrays.equals(expected, decoded);
	}
}




















>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
|
|
>
>
|
>
>
>
>
>
>
>
>
>
>
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
				baos.write(buf, 0, rc);
			}
			
			// Read it
			decoded = baos.toByteArray();
		}
		
		// The decoded is a fixed length, even with the raw data
		this.secondary("dlen", decoded.length);
		
		// Compare all lines
		int linecount = 0;
		try (BufferedReader dec = new BufferedReader(new InputStreamReader(
				new ByteArrayInputStream(decoded), "utf-8"));
			BufferedReader exp = new BufferedReader(new InputStreamReader(
				new ByteArrayInputStream(expected), "utf-8")))
		{
			for (;; linecount++)
			{
				String dl = dec.readLine();
				String xl = exp.readLine();
				
				// Compare equality first
				if (!Objects.equals(dl, xl))
				{
					// Add these in case
					this.secondary("decoded", dl);
					this.secondary("expected", xl);
					
					// Fail
					return false;
				}
				
				if (dl == null || xl == null)
					break;
			}
		}
		
		// Line count
		this.secondary("linecount", linecount);
		
		// Would be a mis-match if not reached
		return true;
	}
}

Name change from runt/libs/io.test/TestZlibCompressorDecompressor.java to modules/io/src/test/java/TestZlibCompressorDecompressor.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

19
20
21
22
23
24
25
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

import net.multiphasicapps.tac.TestSupplier;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import net.multiphasicapps.io.CompressionLevel;
import net.multiphasicapps.io.ZLibCompressor;
import net.multiphasicapps.io.ZLibDecompressor;


/**
 * Tests the deflater and then the inflater, making sure that compressed
 * data ends up the same when decompressed.
 *
 * @since 2018/11/11
 */










<
<






>







1
2
3
4
5
6
7
8
9
10


11
12
13
14
15
16
17
18
19
20
21
22
23
24
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------



import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import net.multiphasicapps.io.CompressionLevel;
import net.multiphasicapps.io.ZLibCompressor;
import net.multiphasicapps.io.ZLibDecompressor;
import net.multiphasicapps.tac.TestSupplier;

/**
 * Tests the deflater and then the inflater, making sure that compressed
 * data ends up the same when decompressed.
 *
 * @since 2018/11/11
 */

Name change from runt/libs/io.test/TestBase64Decoder.in to modules/io/src/test/resources/TestBase64Decoder.in.

Name change from runt/libs/io.test/TestDeflaterInflater.in to modules/io/src/test/resources/TestDeflaterInflater.in.

Name change from runt/libs/io.test/TestMIMEFileDecoder.in to modules/io/src/test/resources/TestMIMEFileDecoder.in.

1
2
3

result: true
thrown: NoExceptionThrown




|
>
1
2
3
4
result: true
thrown: NoExceptionThrown
secondary-dlen: int:4988
secondary-linecount: int:71

Name change from runt/libs/io.test/TestZlibCompressorDecompressor.in to modules/io/src/test/resources/TestZlibCompressorDecompressor.in.

Name change from runt/libs/io.test/message to modules/io/src/test/resources/message.

Name change from runt/libs/io.test/mimemessage to modules/io/src/test/resources/mimemessage.

Added modules/jblend-api/build.gradle.









































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import cc.squirreljme.plugin.swm.JavaMEMidletType

description = "Proprietary Aplix JBlend API"
version = rootProject.version

squirreljme
{
	javaDocErrorCode = "LB"
	swmType = JavaMEMidletType.API
	swmName = "Aplix JBlend API"
	swmVendor = "Stephanie Gawroriski"
}

dependencies
{
	implementation project(":modules:cldc-compact")

	implementation project(":modules:meep-midlet")
	implementation project(":modules:midp-lcdui")
}

Added modules/jblend-api/src/main/java/com/jblend/graphics/WindowSystem.java.



































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package com.jblend.graphics;

public class WindowSystem
{
    public final int real_width;
    public final int real_height;
    public final int virtual_width;
    public final int virtual_height;
    public final boolean isColor;
    public final int numColors;
    public final boolean hasPointerEvents;
    public final boolean hasPointerMotionEvents;
    public final int numSoftkeys;
    
    public WindowSystem()
	{
		throw new todo.TODO();
	}

    public static WindowSystem getDefaultWindowSystem()
	{
		throw new todo.TODO();
	}
}

Added modules/jblend-api/src/main/java/com/jblend/io/ConnectorImpl.java.















































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package com.jblend.io;

public class ConnectorImpl
{
    public static synchronized Class getProtocol(String var0)
	{
		throw new todo.TODO();
	}

    public static synchronized void setProtocol(String var0, String var1)
	{
		throw new todo.TODO();
	}
}

Added modules/jblend-api/src/main/java/com/jblend/io/NotSimpleSerializableException.java.







































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package com.jblend.io;

public class NotSimpleSerializableException
	extends SimpleSerializeException
{
	public NotSimpleSerializableException()
	{
		super(null);
	}
}

Added modules/jblend-api/src/main/java/com/jblend/io/SimpleObjectInputStream.java.

















































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package com.jblend.io;

import java.io.DataInputStream;
import java.io.IOException;
import java.io.InputStream;

public class SimpleObjectInputStream
	extends DataInputStream
{
    public SimpleObjectInputStream(InputStream var1) {
        super((InputStream)null);
        
        throw new todo.TODO();
    }

    public String readString() throws IOException
	{
		throw new todo.TODO();
	}

    public SimpleSerializable read(SimpleSerializable var1) throws IOException
	{
		throw new todo.TODO();
	}

    public Object dispatchReadCommand(Class var1) throws IOException
	{
		throw new todo.TODO();
	}
}

Added modules/jblend-api/src/main/java/com/jblend/io/SimpleObjectOutputStream.java.















































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package com.jblend.io;

import java.io.DataOutputStream;
import java.io.IOException;
import java.io.OutputStream;

public class SimpleObjectOutputStream
	extends DataOutputStream
{
    public SimpleObjectOutputStream(OutputStream var1) {
        super((OutputStream)null);
        
        throw new todo.TODO();
    }

    public void write(String var1) throws IOException
	{
		throw new todo.TODO();
	}

    public void write(SimpleSerializable var1) throws IOException
	{
		throw new todo.TODO();
	}

    public void dispatchWriteCommand(Object var1) throws IOException
	{
		throw new todo.TODO();
	}
}

Added modules/jblend-api/src/main/java/com/jblend/io/SimpleSerializable.java.









































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package com.jblend.io;

import java.io.IOException;

public interface SimpleSerializable
{
    void writeObject(SimpleObjectOutputStream var1) throws IOException;

    void readObject(SimpleObjectInputStream var1) throws IOException;
}

Added modules/jblend-api/src/main/java/com/jblend/io/SimpleSerializeException.java.













































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package com.jblend.io;

import java.io.IOException;

public class SimpleSerializeException
	extends IOException
{
    public SimpleSerializeException(String var1)
	{
		throw new todo.TODO();
	}
}

Added modules/jblend-api/src/main/java/com/jblend/io/j2me/events/EventDispatcher.java.













































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package com.jblend.io.j2me.events;

import javax.microedition.midlet.MIDlet;

public class EventDispatcher
{
    public EventDispatcher()
    {
    	throw new todo.TODO();
    }

    public static Thread getEventThread()
	{
		throw new todo.TODO();
	}

    public static void start()
	{
		throw new todo.TODO();
	}

    public static void setCurrentMIDlet(MIDlet var0)
	{
		throw new todo.TODO();
	}

    public static void setJoclEventDispatcherInterface(EventDispatcherInterface var0)
	{
		throw new todo.TODO();
	}

    public static UiEventDispatcherInterface setUiEventDispatcherInterface(UiEventDispatcherInterface var0)
	{
		throw new todo.TODO();
	}

    public static void setMIDletEventDispatcherInterface(EventDispatcherInterface var0)
	{
		throw new todo.TODO();
	}

    public static void setMediaEventDispatcherInterface(EventDispatcherInterface var0)
	{
		throw new todo.TODO();
	}

    public static void setSmafEventDispatcherInterface(EventDispatcherInterface var0)
	{
		throw new todo.TODO();
	}

    public static void setPhraseEventDispatcherInterface(EventDispatcherInterface var0)
	{
		throw new todo.TODO();
	}

    public static void setDialEventDispatcherInterface(EventDispatcherInterface var0)
	{
		throw new todo.TODO();
	}

    public static synchronized int setOptionalEventDispatcher(EventDispatcherInterface var0, int var1)
	{
		throw new todo.TODO();
	}

    public static int setOptionalEventDispatcher(EventDispatcherInterface var0, int var1, String var2)
	{
		throw new todo.TODO();
	}

    public static synchronized void dispatchEvent()
	{
		throw new todo.TODO();
	}
}

Added modules/jblend-api/src/main/java/com/jblend/io/j2me/events/EventDispatcherInterface.java.

































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package com.jblend.io.j2me.events;

public interface EventDispatcherInterface
{
    void dispatch(int var1, int var2, int var3, int var4);
}

Added modules/jblend-api/src/main/java/com/jblend/io/j2me/events/EventType.java.























































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package com.jblend.io.j2me.events;

public interface EventType
{
    int PRESSED = 1;
    int RELEASED = 2;
    int CLICKED = 3;
    int EXPIRED = 4;
    int STARTED = 5;
    int STOPPED = 6;
    int PAUSED = 7;
    int REQUEST_PAUSE = 8;
    int REQUEST_STOP = 9;
    int REQUEST_RESUME = 10;
    int CALLING = 11;
    int RECEIVED = 12;
    int SCHEDULED_ALARM = 13;
}

Added modules/jblend-api/src/main/java/com/jblend/io/j2me/events/InternalEvent.java.









































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package com.jblend.io.j2me.events;

public interface InternalEvent
{
    int BEAM_RECEIVE_KVM_EVENT = 0;
    int PEN_DOWN_KVM_EVENT = 1;
    int PEN_UP_KVM_EVENT = 2;
    int PEN_MOVE_KVM_EVENT = 3;
    int KEY_DOWN_KVM_EVENT = 4;
    int KEY_UP_KVM_EVENT = 5;
    int LAST_KVM_EVENT = 6;
    int APP_STOP_KVM_EVENT = 7;
    int UI_KVM_EVENT = 8;
    int TIMER_KVM_EVENT = 9;
    int PLATFORM_KVM_EVENT = 10;
    int SOUND_KVM_EVENT = 11;
    int MEDIA_KVM_EVENT = 12;
    int DIAL_KVM_EVENT = 14;
    int APP_RESUME_KVM_EVENT = 100;
    int APP_SUSPEND_KVM_EVENT = 101;
    int GENERAL_NOTIFY_EVENT = 200;
    int ANI_CHAR_EVENT = 221;
    int USER_KVM_EVENT = 255;
    int VENDOR_KVM_EVENT = 1000;
    int OPTIONAL_EVENT_ORIGIN = 10000;
    int MAX_OPTIONAL_EVENT = 5;
}

Added modules/jblend-api/src/main/java/com/jblend/io/j2me/events/JoclEventDispatcher.java.































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package com.jblend.io.j2me.events;

@SuppressWarnings("NewMethodNamingConvention")
public class JoclEventDispatcher
	implements EventDispatcherInterface
{
	
	public void dispatch(int var1, int var2, int var3, int var4)
	{
		throw new todo.TODO();
	}

    public static void setPhraseEventDispatcherInterface(JoclEventDispatcherInterface var0)
	{
		throw new todo.TODO();
	}

    public static void setMediaEventDispatcherInterface(JoclEventDispatcherInterface var0)
	{
		throw new todo.TODO();
	}

    public static void setPlatformEventDispatcherInterface(JoclEventDispatcherInterface var0)
	{
		throw new todo.TODO();
	}

    public static void setVendorEventDispatcherInterface(JoclEventDispatcherInterface var0)
	{
		throw new todo.TODO();
	}

    public static void init()
	{
		throw new todo.TODO();
	}
}

Added modules/jblend-api/src/main/java/com/jblend/io/j2me/events/JoclEventDispatcherInterface.java.



































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package com.jblend.io.j2me.events;

public interface JoclEventDispatcherInterface
{
    void dispatch(int var1, int var2, int var3);
}


Added modules/jblend-api/src/main/java/com/jblend/io/j2me/events/NativeMediaEventDispatcher.java.









































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package com.jblend.io.j2me.events;

public interface NativeMediaEventDispatcher
{
    void stateChanged(int var1);

    void repeated(int var1);

    int getMediaType();
}

Added modules/jblend-api/src/main/java/com/jblend/io/j2me/events/UiEventDispatcherInterface.java.































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package com.jblend.io.j2me.events;

public interface UiEventDispatcherInterface
{
    void dispatchUi(int var1, int var2, int var3, int var4, int var5);
}

Added modules/jblend-api/src/main/java/com/jblend/io/j2me/events/UiEventType.java.















































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package com.jblend.io.j2me.events;

public interface UiEventType
{
    int CLICKED = 1;
    int SELECTED = 2;
    int DESELECTED = 3;
    int CHANGED = 4;
    int REPAINT = 5;
    int GOTDISPLAY = 6;
    int LOSTFOCUS = 7;
    int REPAINTCOMPONENT = 8;
    int RELEASEDISPLAY = 9;
}

Added modules/jblend-api/src/main/java/com/jblend/io/j2me/events/package-info.java.





















>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package com.jblend.io.j2me.events;

Added modules/jblend-api/src/main/java/com/jblend/media/MediaData.java.







































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package com.jblend.media;

import java.io.IOException;

public abstract class MediaData
{
    public MediaData()
	{
		throw new todo.TODO();
	}

    public MediaData(String var1)
    	throws IOException
	{
		throw new todo.TODO();
	}

    public MediaData(byte[] var1)
	{
		throw new todo.TODO();
	}

    public abstract String getMediaType();

    public abstract void setData(byte[] var1);
}

Added modules/jblend-api/src/main/java/com/jblend/media/MediaImageOperator.java.



































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package com.jblend.media;

public interface MediaImageOperator
{
    int getX();

    int getY();

    int getWidth();

    int getHeight();

    void setBounds(int var1, int var2, int var3, int var4);

    int getOriginX();

    int getOriginY();

    void setOrigin(int var1, int var2);

    int getMediaWidth();

    int getMediaHeight();
}

Added modules/jblend-api/src/main/java/com/jblend/media/MediaPlayer.java.



















































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package com.jblend.media;

import com.jblend.io.j2me.events.NativeMediaEventDispatcher;

public abstract class MediaPlayer
{
    public static final int NO_DATA = 0;
    public static final int READY = 1;
    public static final int PLAYING = 2;
    public static final int PAUSED = 3;
    public static final int ERROR = 65536;
    
    protected static final int REAL_WIDTH =
    	todo.TODO.missingInteger();
    	
    protected static final int REAL_HEIGHT =
    	todo.TODO.missingInteger();

    public MediaPlayer()
	{
		throw new todo.TODO();
	}

    public abstract void setData(MediaData var1);

    public abstract void play();

    public abstract void play(boolean var1);

    public abstract void play(int var1);

    public abstract void stop();

    public abstract void pause();

    public abstract void resume();

    public abstract int getState();

    public abstract void addMediaPlayerListener(MediaPlayerListener var1);

    public abstract void removeMediaPlayerListener(MediaPlayerListener var1);

    protected static void addNativeMediaEventDispatcher(NativeMediaEventDispatcher var0)
	{
		throw new todo.TODO();
	}
}

Added modules/jblend-api/src/main/java/com/jblend/media/MediaPlayerListener.java.





































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package com.jblend.media;

public interface MediaPlayerListener
{
    void playerStateChanged(MediaPlayer var1);

    void playerRepeated(MediaPlayer var1);
}

Added modules/jblend-api/src/main/java/com/jblend/media/audio/AudioData.java.



























































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package com.jblend.media.audio;

import com.jblend.media.MediaData;
import java.io.IOException;

public class AudioData
	extends MediaData
{
    public static final String type = "AUDIO";

    public AudioData()
	{
		throw new todo.TODO();
	}

    public AudioData(String var1)
    	throws IOException
	{
		throw new todo.TODO();
	}

    public AudioData(byte[] var1)
	{
		throw new todo.TODO();
	}

    public String getMediaType()
	{
		throw new todo.TODO();
	}

    public void setData(byte[] var1)
	{
		throw new todo.TODO();
	}
}

Added modules/jblend-api/src/main/java/com/jblend/media/audio/AudioPlayer.java.

























































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package com.jblend.media.audio;

import com.jblend.media.MediaData;
import com.jblend.media.MediaPlayer;
import com.jblend.media.MediaPlayerListener;

public class AudioPlayer
	extends MediaPlayer
{
    public AudioPlayer()
	{
		throw new todo.TODO();
	}

    public AudioPlayer(AudioData var1)
	{
		throw new todo.TODO();
	}

    public AudioPlayer(byte[] var1)
	{
		throw new todo.TODO();
	}

    public static int checkData(byte[] var0)
	{
		throw new todo.TODO();
	}

    public void setData(AudioData var1)
	{
		throw new todo.TODO();
	}

    public void setData(MediaData var1)
	{
		throw new todo.TODO();
	}

    public int getCurrent()
	{
		throw new todo.TODO();
	}

    public int getVolume()
	{
		throw new todo.TODO();
	}

    public void setVolume(int var1)
	{
		throw new todo.TODO();
	}

    public void play()
	{
		throw new todo.TODO();
	}

    public void play(boolean var1)
	{
		throw new todo.TODO();
	}

    public void play(int var1)
	{
		throw new todo.TODO();
	}

    public void stop()
	{
		throw new todo.TODO();
	}

    public void pause()
	{
		throw new todo.TODO();
	}

    public void resume()
	{
		throw new todo.TODO();
	}

    public int getState()
	{
		throw new todo.TODO();
	}

    public void addMediaPlayerListener(MediaPlayerListener var1)
	{
		throw new todo.TODO();
	}

    public void removeMediaPlayerListener(MediaPlayerListener var1)
	{
		throw new todo.TODO();
	}
}

Added modules/jblend-api/src/main/java/com/jblend/media/audio/package-info.java.





















>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package com.jblend.media.audio;

Added modules/jblend-api/src/main/java/com/jblend/media/video/VideoData.java.





























































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package com.jblend.media.video;

import com.jblend.media.MediaData;
import java.io.IOException;

public class VideoData extends MediaData {
    public static final String type = "VIDEO";

    public VideoData() {
    }

    public VideoData(String var1) throws IOException {
    }

    public VideoData(byte[] var1) {
    }

    public int getWidth()
	{
		throw new todo.TODO();
	}

    public int getHeight()
	{
		throw new todo.TODO();
	}

    public String getMediaType()
	{
		throw new todo.TODO();
	}

    public void setData(byte[] var1)
	{
		throw new todo.TODO();
	}
}

Added modules/jblend-api/src/main/java/com/jblend/media/video/VideoPlayer.java.













































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package com.jblend.media.video;

import com.jblend.media.MediaData;
import com.jblend.media.MediaImageOperator;
import com.jblend.media.MediaPlayer;
import com.jblend.media.MediaPlayerListener;

public class VideoPlayer
	extends MediaPlayer
	implements MediaImageOperator {
    public VideoPlayer()
	{
		throw new todo.TODO();
	}

    public VideoPlayer(VideoData var1)
	{
		throw new todo.TODO();
	}

    public VideoPlayer(byte[] var1)
	{
		throw new todo.TODO();
	}

    public static int checkData(byte[] var0)
	{
		throw new todo.TODO();
	}

    public void setData(VideoData var1)
	{
		throw new todo.TODO();
	}

    public void setData(MediaData var1)
	{
		throw new todo.TODO();
	}

    public int getX()
	{
		throw new todo.TODO();
	}

    public int getY()
	{
		throw new todo.TODO();
	}

    public int getWidth()
	{
		throw new todo.TODO();
	}

    public int getHeight()
	{
		throw new todo.TODO();
	}

    public void setBounds(int var1, int var2, int var3, int var4)
	{
		throw new todo.TODO();
	}

    public int getOriginX()
	{
		throw new todo.TODO();
	}

    public int getOriginY()
	{
		throw new todo.TODO();
	}

    public void setOrigin(int var1, int var2)
	{
		throw new todo.TODO();
	}

    public int getMediaWidth()
	{
		throw new todo.TODO();
	}

    public int getMediaHeight()
	{
		throw new todo.TODO();
	}

    public void repaintCurrent()
	{
		throw new todo.TODO();
	}

    public void play()
	{
		throw new todo.TODO();
	}

    public void play(boolean var1)
	{
		throw new todo.TODO();
	}

    public void play(int var1)
	{
		throw new todo.TODO();
	}

    public void stop()
	{
		throw new todo.TODO();
	}

    public void pause()
	{
		throw new todo.TODO();
	}

    public void resume()
	{
		throw new todo.TODO();
	}

    public int getState()
	{
		throw new todo.TODO();
	}

    public void addMediaPlayerListener(MediaPlayerListener var1)
	{
		throw new todo.TODO();
	}

    public void removeMediaPlayerListener(MediaPlayerListener var1)
	{
		throw new todo.TODO();
	}
}

Added modules/jblend-api/src/main/java/com/jblend/micro/lcdui/CalendarImpl.java.







































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package com.jblend.micro.lcdui;

import javax.microedition.lcdui.Graphics;

public class CalendarImpl implements CalendarInterface {
	
	public void initCalendarValues(int var1, int var2)
	{
		throw new todo.TODO();
	}

    public void paint(Graphics var1, int var2, int var3, int var4, int var5, int var6, int var7)
	{
		throw new todo.TODO();
	}

    public String getBackCommand()
	{
		throw new todo.TODO();
	}

    public String getSaveCommand()
	{
		throw new todo.TODO();
	}
}

Added modules/jblend-api/src/main/java/com/jblend/micro/lcdui/CalendarInterface.java.

























































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package com.jblend.micro.lcdui;

import javax.microedition.lcdui.Graphics;

@SuppressWarnings({"FieldNamingConvention",
"InterfaceWithOnlyOneDirectInheritor"})
public interface CalendarInterface {
    int kYearSelectionMode = 1;
    int kMonthSelectionMode = 2;
    int kDaySelectionMode = 3;

    void initCalendarValues(int var1, int var2);

    void paint(Graphics var1, int var2, int var3, int var4, int var5, int var6, int var7);

    String getBackCommand();

    String getSaveCommand();
}

Added modules/jblend-api/src/main/java/com/jblend/micro/lcdui/GaugeImpl.java.

























































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package com.jblend.micro.lcdui;

import javax.microedition.lcdui.Graphics;

public class GaugeImpl implements GaugeInterface {
	
	public void init(boolean var1, int var2, int var3, int var4)
	{
		throw new todo.TODO();
	}

    public void setValue(int var1)
	{
		throw new todo.TODO();
	}

    public int getValue()
	{
		throw new todo.TODO();
	}

    public void setMaxValue(int var1)
	{
		throw new todo.TODO();
	}

    public int getMaxValue()
	{
		throw new todo.TODO();
	}

    public void paint(boolean var1, Graphics var2, int var3, int var4)
	{
		throw new todo.TODO();
	}

    public int processEvent(int var1, int var2, int var3, int var4)
	{
		throw new todo.TODO();
	}

    public synchronized int getWidth()
	{
		throw new todo.TODO();
	}

    public synchronized int getHeight()
	{
		throw new todo.TODO();
	}
}

Added modules/jblend-api/src/main/java/com/jblend/micro/lcdui/GaugeInterface.java.







































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package com.jblend.micro.lcdui;

import javax.microedition.lcdui.Graphics;

public interface GaugeInterface {
    int LOST_FOCUS = 1;
    int VALUE_CHANGED = 2;

    void init(boolean var1, int var2, int var3, int var4);

    void setValue(int var1);

    int getValue();

    void setMaxValue(int var1);

    int getMaxValue();

    void paint(boolean var1, Graphics var2, int var3, int var4);

    int processEvent(int var1, int var2, int var3, int var4);

    int getWidth();

    int getHeight();
}

Added modules/jblend-api/src/main/java/com/jblend/micro/lcdui/WatchImpl.java.





















































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package com.jblend.micro.lcdui;

import javax.microedition.lcdui.Graphics;

public class WatchImpl
	implements WatchInterface
{
    public WatchImpl()
	{
		throw new todo.TODO();
	}

    public void initWatchValues(int var1, int var2)
	{
		throw new todo.TODO();
	}

    public void paint(Graphics var1, int var2, int var3, int var4)
	{
		throw new todo.TODO();
	}

    public String getBackCommand()
	{
		throw new todo.TODO();
	}

    public String getSaveCommand()
	{
		throw new todo.TODO();
	}
}

Added modules/jblend-api/src/main/java/com/jblend/micro/lcdui/WatchInterface.java.























































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package com.jblend.micro.lcdui;

import javax.microedition.lcdui.Graphics;

public interface WatchInterface
{
    int kHourSelection = 1;
    int kMinuteSelection = 2;

    void initWatchValues(int var1, int var2);

    void paint(Graphics var1, int var2, int var3, int var4);

    String getBackCommand();

    String getSaveCommand();
}

Added modules/jblend-api/src/main/java/com/jblend/micro/lcdui/package-info.java.





















>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package com.jblend.micro.lcdui;

Added modules/jblend-api/src/main/java/com/jblend/net/HttpUrlParser.java.



































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package com.jblend.net;

public class HttpUrlParser
{
    public HttpUrlParser(String var1)
    	throws IllegalArgumentException
	{
		throw new todo.TODO();
	}

    public String getFile()
	{
		throw new todo.TODO();
	}

    public String getHost()
	{
		throw new todo.TODO();
	}

    public int getPort()
	{
		throw new todo.TODO();
	}

    public String getQuery()
	{
		throw new todo.TODO();
	}

    public String getRef()
	{
		throw new todo.TODO();
	}

    public String getRequestUri()
	{
		throw new todo.TODO();
	}
}

Added modules/jblend-api/src/main/java/com/jblend/ui/SequenceInterface.java.



































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package com.jblend.ui;

public interface SequenceInterface
{
    void sequenceStart();

    void sequenceStop();
}

Added modules/jblend-api/src/main/java/com/jblend/util/BASE64Decoder.java.

































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package com.jblend.util;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

public class BASE64Decoder
{
    public BASE64Decoder()
	{
		throw new todo.TODO();
	}

    public static synchronized String decode(String var0)
	{
		throw new todo.TODO();
	}

    protected static int bytesPerAtom()
	{
		throw new todo.TODO();
	}

    protected static int bytesPerLine()
	{
		throw new todo.TODO();
	}

    protected static void decodeAtom(InputStream var0, OutputStream var1, int var2) throws IOException
	{
		throw new todo.TODO();
	}

    protected static int readFully(InputStream var0, byte[] var1, int var2, int var3) throws IOException
	{
		throw new todo.TODO();
	}
}

Added modules/jblend-api/src/main/java/com/jblend/util/BASE64Encoder.java.

































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package com.jblend.util;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

public class BASE64Encoder
{
    public BASE64Encoder()
	{
		throw new todo.TODO();
	}

    public static synchronized String encode(String var0)
	{
		throw new todo.TODO();
	}

    protected static int bytesPerAtom()
	{
		throw new todo.TODO();
	}

    protected static int bytesPerLine()
	{
		throw new todo.TODO();
	}

    protected static void encodeAtom(OutputStream var0, byte[] var1, int var2, int var3) throws IOException
	{
		throw new todo.TODO();
	}

    protected static int readFully(InputStream var0, byte[] var1) throws IOException
	{
		throw new todo.TODO();
	}
}

Added modules/jblend-api/src/main/java/com/jblend/util/ByteRingBuffer.java.













































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package com.jblend.util;

import java.io.IOException;

public final class ByteRingBuffer
{
    public ByteRingBuffer()
	{
		throw new todo.TODO();
	}

    public ByteRingBuffer(int var1)
	{
		throw new todo.TODO();
	}

    public ByteRingBuffer(int var1, int var2)
	{
		throw new todo.TODO();
	}

    public void write(byte var1) throws IOException
	{
		throw new todo.TODO();
	}

    public void write(byte[] var1) throws IOException
	{
		throw new todo.TODO();
	}

    public byte read() throws IOException
	{
		throw new todo.TODO();
	}

    public void read(byte[] var1) throws IOException
	{
		throw new todo.TODO();
	}

    public byte peek() throws IOException
	{
		throw new todo.TODO();
	}

    public void peek(byte[] var1) throws IOException
	{
		throw new todo.TODO();
	}

    public int available()
	{
		throw new todo.TODO();
	}

    public int getFreeArea()
	{
		throw new todo.TODO();
	}
}

Added modules/jblend-api/src/main/java/com/jblend/util/Case.java.















































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package com.jblend.util;

public final class Case
{
    public static final String toLower(String var0)
	{
		throw new todo.TODO();
	}

    public static final String toUpper(String var0)
	{
		throw new todo.TODO();
	}
}

Added modules/jblend-api/src/main/java/com/jblend/util/Debug.java.



















































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package com.jblend.util;

public final class Debug
{
    public static final boolean WATCH_TIME = false;

    public Debug()
	{
		throw new todo.TODO();
	}

    public static void trace(Object var0, String var1)
	{
		throw new todo.TODO();
	}
}

Added modules/jblend-api/src/main/java/com/jblend/util/Hack.java.































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package com.jblend.util;

public final class Hack
{
    public Hack()
	{
		throw new todo.TODO();
	}

    public static final void disableDispatch()
	{
		throw new todo.TODO();
	}

    public static final void enableDispatch()
	{
		throw new todo.TODO();
	}

    public static final void initializeDispatch()
	{
		throw new todo.TODO();
	}

    public static final void expandTimeslice(int var0)
	{
		throw new todo.TODO();
	}

    public static final void setTimeslice(int var0)
	{
		throw new todo.TODO();
	}
	
    public static final void dumpTheHeap()
	{
		throw new todo.TODO();
	}

    public static final void traceMethod(boolean var0)
	{
		throw new todo.TODO();
	}

    public static final void printAllThreadStatus()
	{
		throw new todo.TODO();
	}

    public static final boolean isSomeoneWaiting(Object var0)
	{
		throw new todo.TODO();
	}
}

Added modules/jblend-api/src/main/java/com/jblend/util/Hashtable.java.





















































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package com.jblend.util;

import com.jblend.io.SimpleObjectInputStream;
import com.jblend.io.SimpleObjectOutputStream;
import com.jblend.io.SimpleSerializable;
import java.io.IOException;

public class Hashtable
	extends java.util.Hashtable
	implements SimpleSerializable
{
    public Hashtable() {
        super(0, 0.0F);
        
        throw new todo.TODO();
    }

    public Hashtable(int var1) {
        super(0, 0.0F);
        
        throw new todo.TODO();
    }

    public void writeObject(SimpleObjectOutputStream var1) throws IOException
	{
		throw new todo.TODO();
	}

    public void readObject(SimpleObjectInputStream var1) throws IOException
	{
		throw new todo.TODO();
	}
}

Added modules/jblend-api/src/main/java/com/jblend/util/IntRingBuffer.java.























































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package com.jblend.util;

import java.io.IOException;

public class IntRingBuffer
{
    public IntRingBuffer()
	{
		throw new todo.TODO();
	}

    public IntRingBuffer(int var1)
	{
		throw new todo.TODO();
	}

    public IntRingBuffer(int var1, int var2)
	{
		throw new todo.TODO();
	}

    public void write(int var1) throws IOException
	{
		throw new todo.TODO();
	}

    public void write(int var1, int var2, int var3, int var4, int var5) throws IOException
	{
		throw new todo.TODO();
	}

    public void write(int[] var1) throws IOException
	{
		throw new todo.TODO();
	}

    public int read() throws IOException
	{
		throw new todo.TODO();
	}

    public void read(int[] var1) throws IOException
	{
		throw new todo.TODO();
	}

    public int peek() throws IOException
	{
		throw new todo.TODO();
	}

    public void peek(int[] var1) throws IOException
	{
		throw new todo.TODO();
	}

    public int available()
	{
		throw new todo.TODO();
	}

    public int getFreeArea()
	{
		throw new todo.TODO();
	}
}

Added modules/jblend-api/src/main/java/com/jblend/util/Log.java.





























































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package com.jblend.util;

import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintStream;

public final class Log
{
    public static final PrintStream out =
    	todo.TODO.<PrintStream>missingObject();
    	
    public static final PrintStream err =
    	todo.TODO.<PrintStream>missingObject();

    public Log()
	{
		throw new todo.TODO();
	}

    public static final void out(String var0)
	{
		throw new todo.TODO();
	}

    public static final void err(String var0)
	{
		throw new todo.TODO();
	}

    private static final class PrivateOutputStream extends OutputStream {
        public void write(int var1) throws IOException
		{
			throw new todo.TODO();
		}
    }
}

Added modules/jblend-api/src/main/java/com/jblend/util/NativeSyncObject.java.































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package com.jblend.util;

public class NativeSyncObject
{
}

Added modules/jblend-api/src/main/java/com/jblend/util/NativeThreadJoinner.java.































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package com.jblend.util;

public final class NativeThreadJoinner
	{
    public static NativeThreadJoinner createInstance()
	{
		throw new todo.TODO();
	}

    public static void destroyInstance(NativeThreadJoinner var0)
	{
		throw new todo.TODO();
	}

    public void reset()
	{
		throw new todo.TODO();
	}

    public int getId()
	{
		throw new todo.TODO();
	}

    public synchronized int getCause()
	{
		throw new todo.TODO();
	}

    public synchronized int getOption()
	{
		throw new todo.TODO();
	}

    public synchronized void join() throws InterruptedException
	{
		throw new todo.TODO();
	}

    public synchronized void join(long var1) throws InterruptedException
	{
		throw new todo.TODO();
	}

    public boolean causeContains(int var1)
	{
		throw new todo.TODO();
	}

    public synchronized void joinNotify(int var1, int var2, int var3)
	{
		throw new todo.TODO();
	}
}

Added modules/jblend-api/src/main/java/com/jblend/util/NativeThreadMonitor.java.



















































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package com.jblend.util;

public class NativeThreadMonitor
	extends Thread
{
    public static void reset()
	{
		throw new todo.TODO();
	}

    public void run()
	{
		throw new todo.TODO();
	}
}

Added modules/jblend-api/src/main/java/com/jblend/util/Properties.java.









































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package com.jblend.util;

import java.util.Enumeration;

public class Properties
	extends StringKeyHashtable
{
    protected Properties defaults;

    public Properties()
	{
		throw new todo.TODO();
	}

    public Properties(int var1)
	{
		throw new todo.TODO();
	}

    public Properties(Properties var1)
	{
		throw new todo.TODO();
	}

    public synchronized String getProperty(String var1)
	{
		throw new todo.TODO();
	}

    public synchronized Integer getIntegerProperty(String var1)
	{
		throw new todo.TODO();
	}

    public synchronized String getProperty(String var1, String var2)
	{
		throw new todo.TODO();
	}

    public synchronized Integer getIntegerProperty(String var1, Integer var2)
	{
		throw new todo.TODO();
	}

    public synchronized String setProperty(String var1, String var2)
	{
		throw new todo.TODO();
	}

    public synchronized Integer setProperty(String var1, Integer var2)
	{
		throw new todo.TODO();
	}

    public synchronized Enumeration propertyNames()
	{
		throw new todo.TODO();
	}
}

Added modules/jblend-api/src/main/java/com/jblend/util/RingBuffer.java.













































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package com.jblend.util;

import java.io.IOException;

public final class RingBuffer
{
    public RingBuffer()
	{
		throw new todo.TODO();
	}

    public RingBuffer(int var1)
	{
		throw new todo.TODO();
	}

    public RingBuffer(int var1, int var2)
	{
		throw new todo.TODO();
	}

    public void write(Object var1) throws IOException
	{
		throw new todo.TODO();
	}

    public void write(Object[] var1) throws IOException
	{
		throw new todo.TODO();
	}

    public Object read() throws IOException
	{
		throw new todo.TODO();
	}

    public void read(Object[] var1) throws IOException
	{
		throw new todo.TODO();
	}

    public Object peek() throws IOException
	{
		throw new todo.TODO();
	}

    public void peek(Object[] var1) throws IOException
	{
		throw new todo.TODO();
	}

    public int available()
	{
		throw new todo.TODO();
	}

    public int getFreeArea()
	{
		throw new todo.TODO();
	}
}

Added modules/jblend-api/src/main/java/com/jblend/util/Secure.java.





















































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package com.jblend.util;

public final class Secure
{
    public static final String javaPackageName = "java.";
    public static final String javaxPackageName = "javax.";

    public static void checkPackage()
	{
		throw new todo.TODO();
	}

    public static void checkPackage(String var0)
	{
		throw new todo.TODO();
	}
}

Added modules/jblend-api/src/main/java/com/jblend/util/SimpleStack.java.













































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package com.jblend.util;

import java.util.Enumeration;

public final class SimpleStack
{
    public Object[] elementData;
    public int size;

    public SimpleStack()
	{
		throw new todo.TODO();
	}

    public SimpleStack(int var1)
	{
		throw new todo.TODO();
	}

    public Object push(Object var1)
	{
		throw new todo.TODO();
	}

    public Object pop()
	{
		throw new todo.TODO();
	}

    public Object peek()
	{
		throw new todo.TODO();
	}

    public int size()
	{
		throw new todo.TODO();
	}

    public boolean empty()
	{
		throw new todo.TODO();
	}

    public Enumeration elements()
	{
		throw new todo.TODO();
	}

    final class SimpleStackEnumerator implements Enumeration {
        public boolean hasMoreElements()
		{
			throw new todo.TODO();
		}

        public Object nextElement()
		{
			throw new todo.TODO();
		}
    }
}

Added modules/jblend-api/src/main/java/com/jblend/util/SimpleVector.java.

































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package com.jblend.util;

import java.util.Enumeration;

public final class SimpleVector
{
    public Object[] elementData;
    public int elementCount;

    public SimpleVector()
	{
		throw new todo.TODO();
	}

    public SimpleVector(int var1)
	{
		throw new todo.TODO();
	}

    public void addElement(Object var1)
	{
		throw new todo.TODO();
	}

    public boolean removeElement(Object var1)
	{
		throw new todo.TODO();
	}

    public int size()
	{
		throw new todo.TODO();
	}

    public Object elementAt(int var1)
	{
		throw new todo.TODO();
	}

    public Object lastElement()
	{
		throw new todo.TODO();
	}

    public boolean contains(Object var1)
	{
		throw new todo.TODO();
	}

    public int indexOf(Object var1, int var2)
	{
		throw new todo.TODO();
	}

    public void removeElementAt(int var1)
	{
		throw new todo.TODO();
	}

    public void insertElementAt(Object var1, int var2)
	{
		throw new todo.TODO();
	}

    public void removeAllElements()
	{
		throw new todo.TODO();
	}

    public Enumeration elements()
	{
		throw new todo.TODO();
	}

    final class SimpleVectorEnumerator implements Enumeration {
        public boolean hasMoreElements()
		{
			throw new todo.TODO();
		}

        public Object nextElement()
		{
			throw new todo.TODO();
		}
    }
}

Added modules/jblend-api/src/main/java/com/jblend/util/StringKeyHashtable.java.

































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package com.jblend.util;

import java.util.Hashtable;

public class StringKeyHashtable
	extends Hashtable
{
    public StringKeyHashtable() {
        super(0, 0.0F);
        
        throw new todo.TODO();
    }

    public StringKeyHashtable(int var1) {
        super(0, 0.0F);
        
        throw new todo.TODO();
    }

    public final Object get(String var1)
	{
		throw new todo.TODO();
	}

    public final boolean containsKey(String var1)
	{
		throw new todo.TODO();
	}

    public final Object put(Object var1, Object var2)
	{
		throw new todo.TODO();
	}

    protected final void rehash()
	{
		throw new todo.TODO();
	}
}

Added modules/jblend-api/src/main/java/com/jblend/util/SystemProperties.java.















































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package com.jblend.util;

public class SystemProperties
{
    public SystemProperties()
	{
		throw new todo.TODO();
	}

    public static Properties getSystemProperties()
	{
		throw new todo.TODO();
	}
}

Added modules/jblend-api/src/main/java/com/jblend/util/Vector.java.























































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package com.jblend.util;

import com.jblend.io.SimpleObjectInputStream;
import com.jblend.io.SimpleObjectOutputStream;
import com.jblend.io.SimpleSerializable;
import java.io.IOException;

public class Vector
	extends java.util.Vector
	implements SimpleSerializable
{
    public Vector() {
        super(0, 0);
        
        throw new todo.TODO();
    }

    public Vector(int var1) {
        super(0, 0);
        
        throw new todo.TODO();
    }

    public void writeObject(SimpleObjectOutputStream var1) throws IOException
	{
		throw new todo.TODO();
	}

    public void readObject(SimpleObjectInputStream var1) throws IOException
	{
		throw new todo.TODO();
	}
}

Added modules/jblend-api/src/main/java/com/jblend/util/locale/Calendar.java.



























































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package com.jblend.util.locale;

public final class Calendar
{
    public Calendar()
	{
		throw new todo.TODO();
	}

    public static String getMonthString(int var0)
	{
		throw new todo.TODO();
	}

    public static String getWeekString(int var0)
	{
		throw new todo.TODO();
	}
}

Added modules/launcher/build.gradle.























































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import cc.squirreljme.plugin.swm.JavaMEMidlet
import cc.squirreljme.plugin.swm.JavaMEMidletType

description = "This project contains the graphical launcher " +
	"that SquirrelJME uses to act as a front end interface to running user" +
	"programs."
version = rootProject.version

squirreljme
{
	javaDocErrorCode = "EP"
	swmType = JavaMEMidletType.APPLICATION
	swmName = "SquirrelJME Launcher (Graphical)"
	swmVendor = "Stephanie Gawroriski"
	ignoreInLauncher = true
	midlets += new JavaMEMidlet("SquirrelJME Launcher (Graphical)", null,
		"cc.squirreljme.runtime.launcher.ui.MidletMain")
}

dependencies
{
	implementation project(":modules:cldc-compact")

	implementation project(":modules:midp-lcdui")
	implementation project(":modules:meep-midlet")
	implementation project(":modules:meep-swm")
}

Name change from runt/kmid/launcher/cc/squirreljme/runtime/launcher/ui/MidletMain.java to modules/launcher/src/main/java/cc/squirreljme/runtime/launcher/ui/MidletMain.java.

8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.launcher.ui;

import java.util.ArrayList;
import java.util.Timer;
import javax.microedition.lcdui.Alert;
import javax.microedition.lcdui.AlertType;
import javax.microedition.lcdui.Choice;
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.Image;
import javax.microedition.lcdui.List;
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;
import javax.microedition.swm.ManagerFactory;
import javax.microedition.swm.Suite;
import javax.microedition.swm.SuiteManager;
import javax.microedition.swm.SuiteType;
import javax.microedition.swm.Task;
import javax.microedition.swm.TaskManager;
import javax.microedition.swm.TaskStatus;

/**
 * This is the main midlet for the LCDUI based launcher interface.
 *
 * @since 2016/10/11
 */
public class MidletMain







<
<





<





<

<
<
<







8
9
10
11
12
13
14


15
16
17
18
19

20
21
22
23
24

25



26
27
28
29
30
31
32
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.launcher.ui;

import java.util.ArrayList;
import java.util.Timer;


import javax.microedition.lcdui.Choice;
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Displayable;

import javax.microedition.lcdui.List;
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;
import javax.microedition.swm.ManagerFactory;
import javax.microedition.swm.Suite;

import javax.microedition.swm.SuiteType;




/**
 * This is the main midlet for the LCDUI based launcher interface.
 *
 * @since 2016/10/11
 */
public class MidletMain
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
	 * @since 2019/04/14
	 */
	{
		// Do not crash if we cannot read properties
		String al = null;
		try
		{
			al = System.getProperty(AUTOLAUNCH_PROPERTY);
		}
		catch (SecurityException e)
		{
		}
		
		this._autolaunch = al;
	}







|







75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
	 * @since 2019/04/14
	 */
	{
		// Do not crash if we cannot read properties
		String al = null;
		try
		{
			al = System.getProperty(MidletMain.AUTOLAUNCH_PROPERTY);
		}
		catch (SecurityException e)
		{
		}
		
		this._autolaunch = al;
	}
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
			programlist.append("Loading available programs...", null);
			programlist.append("This might take awhile!", null);
			programlist.append("UP/DOWN -- Adjust focused item", null);
			programlist.append("FIRE    -- Select item", null);
			programlist.append("The SPACEBAR key is the FIRE key", null);
			
			// Re-flip on this display
			if (_MAIN_DISPLAY.getCurrent() == programlist)
				_MAIN_DISPLAY.setCurrent(programlist);
		}
		
		// Go through all of the available application suites and build the
		// program list
		boolean queried = false;
		int foundcount = 0;
		ArrayList<__Program__> programs = new ArrayList<>();







|
|







121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
			programlist.append("Loading available programs...", null);
			programlist.append("This might take awhile!", null);
			programlist.append("UP/DOWN -- Adjust focused item", null);
			programlist.append("FIRE    -- Select item", null);
			programlist.append("The SPACEBAR key is the FIRE key", null);
			
			// Re-flip on this display
			if (MidletMain._MAIN_DISPLAY.getCurrent() == programlist)
				MidletMain._MAIN_DISPLAY.setCurrent(programlist);
		}
		
		// Go through all of the available application suites and build the
		// program list
		boolean queried = false;
		int foundcount = 0;
		ArrayList<__Program__> programs = new ArrayList<>();
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
		// Use this list
		this._programs = arrprogs;
		
		// All done so, return the title back
		programlist.setTitle("SquirrelJME Launcher");
		
		// Make sure the program list is showing
		Displayable current = _MAIN_DISPLAY.getCurrent();
		if (current == null || (current instanceof SplashScreen))
			_MAIN_DISPLAY.setCurrent(programlist);
		
		// Automatically launch a program?
		String autolaunch = this._autolaunch;
		if (autolaunch != null)
		{
			this._autolaunch = null;
			







|

|







198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
		// Use this list
		this._programs = arrprogs;
		
		// All done so, return the title back
		programlist.setTitle("SquirrelJME Launcher");
		
		// Make sure the program list is showing
		Displayable current = MidletMain._MAIN_DISPLAY.getCurrent();
		if (current == null || (current instanceof SplashScreen))
			MidletMain._MAIN_DISPLAY.setCurrent(programlist);
		
		// Automatically launch a program?
		String autolaunch = this._autolaunch;
		if (autolaunch != null)
		{
			this._autolaunch = null;
			
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
	@Override
	protected void startApp()
		throws MIDletStateChangeException
	{
		// We will need to access our own display to build the list of
		// MIDlets that could actually be ran
		Display disp = Display.getDisplay(this);
		_MAIN_DISPLAY = disp;
		
		// Add commands to the list so things can be done with them
		List programlist = this.programlist;
		programlist.addCommand(EXIT_COMMAND);
		programlist.addCommand(ABOUT_COMMAND);
		
		// Need to handle commands and such
		__CommandHandler__ ch = new __CommandHandler__();
		programlist.setCommandListener(ch);
		
		// Used to ensure the splash screen is visible for at least a second
		long endtime = System.nanoTime() + 1_000_000_000L;







|



|
|







225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
	@Override
	protected void startApp()
		throws MIDletStateChangeException
	{
		// We will need to access our own display to build the list of
		// MIDlets that could actually be ran
		Display disp = Display.getDisplay(this);
		MidletMain._MAIN_DISPLAY = disp;
		
		// Add commands to the list so things can be done with them
		List programlist = this.programlist;
		programlist.addCommand(MidletMain.EXIT_COMMAND);
		programlist.addCommand(MidletMain.ABOUT_COMMAND);
		
		// Need to handle commands and such
		__CommandHandler__ ch = new __CommandHandler__();
		programlist.setCommandListener(ch);
		
		// Used to ensure the splash screen is visible for at least a second
		long endtime = System.nanoTime() + 1_000_000_000L;
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
					return;
				
				// Call other launcher
				MidletMain.this.__launch(seldx);
			}
			
			// Exiting the VM?
			else if (__c == EXIT_COMMAND)
			{
				// Indication that something is happening
				MidletMain.this.programlist.setTitle("Exiting...");
				
				System.exit(0);
			}
			
			// About SquirrelJME
			else if (__c == ABOUT_COMMAND)
			{
			}
		}
	}
}








|








|






383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
					return;
				
				// Call other launcher
				MidletMain.this.__launch(seldx);
			}
			
			// Exiting the VM?
			else if (__c == MidletMain.EXIT_COMMAND)
			{
				// Indication that something is happening
				MidletMain.this.programlist.setTitle("Exiting...");
				
				System.exit(0);
			}
			
			// About SquirrelJME
			else if (__c == MidletMain.ABOUT_COMMAND)
			{
			}
		}
	}
}

Name change from runt/kmid/launcher/cc/squirreljme/runtime/launcher/ui/SplashScreen.java to modules/launcher/src/main/java/cc/squirreljme/runtime/launcher/ui/SplashScreen.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.launcher.ui;

import cc.squirreljme.runtime.cldc.SquirrelJME;
import cc.squirreljme.runtime.lcdui.gfx.AdvancedGraphics;
import java.io.DataInputStream;
import java.io.InputStream;
import java.io.IOException;
import javax.microedition.lcdui.Canvas;
import javax.microedition.lcdui.Font;
import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;

/**
 * This is the splash screen for the launcher which always shows.
 *
 * @since 2019/05/19
 */
public final class SplashScreen













|

<



<







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

16
17
18

19
20
21
22
23
24
25
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.launcher.ui;

import cc.squirreljme.runtime.cldc.SquirrelJME;
import cc.squirreljme.runtime.lcdui.gfx.AdvancedGraphics;
import java.io.IOException;
import java.io.InputStream;

import javax.microedition.lcdui.Canvas;
import javax.microedition.lcdui.Font;
import javax.microedition.lcdui.Graphics;


/**
 * This is the splash screen for the launcher which always shows.
 *
 * @since 2019/05/19
 */
public final class SplashScreen
69
70
71
72
73
74
75
76

77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
	 */
	@Override
	public final void paint(Graphics __g)
	{
		// Draw the raw image data, is the fastest
		int[] image = this._image;
		if (image != null)
			__g.drawRGB(image, 0, WIDTH, 0, 0, WIDTH, HEIGHT, false);

		
		// The image is not fully loaded yet, so draw the copyright at least
		else
			SplashScreen.__copyright(__g, true);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2019/06/29
	 */
	@Override
	public final void run()
	{
		// Image is completely operated with using raw data
		int np = WIDTH * HEIGHT;
		int[] image = new int[np];
		
		// Load splash image onto the data
		try (InputStream in = SplashScreen.class.
			getResourceAsStream("splash.raw"))
		{
			// If it exists, use it
			if (in != null)
			{
				// Input raw pixels
				int nr = WIDTH * HEIGHT * 3;
				byte[] raw = new byte[nr];
				
				// Read in raw data
				for (int read = 0; read < nr;)
				{
					int rc = in.read(raw, read, nr - read);
					







|
>














|










|







67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
	 */
	@Override
	public final void paint(Graphics __g)
	{
		// Draw the raw image data, is the fastest
		int[] image = this._image;
		if (image != null)
			__g.drawRGB(image, 0, SplashScreen.WIDTH, 0, 0, SplashScreen.WIDTH,
				SplashScreen.HEIGHT, false);
		
		// The image is not fully loaded yet, so draw the copyright at least
		else
			SplashScreen.__copyright(__g, true);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2019/06/29
	 */
	@Override
	public final void run()
	{
		// Image is completely operated with using raw data
		int np = SplashScreen.WIDTH * SplashScreen.HEIGHT;
		int[] image = new int[np];
		
		// Load splash image onto the data
		try (InputStream in = SplashScreen.class.
			getResourceAsStream("splash.raw"))
		{
			// If it exists, use it
			if (in != null)
			{
				// Input raw pixels
				int nr = SplashScreen.WIDTH * SplashScreen.HEIGHT * 3;
				byte[] raw = new byte[nr];
				
				// Read in raw data
				for (int read = 0; read < nr;)
				{
					int rc = in.read(raw, read, nr - read);
					
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
		}
		catch (IOException e)
		{
		}
		
		// Text will be drawn using the advanced graphics since it can
		// operate on integer buffers directly
		Graphics g = new AdvancedGraphics(image, false, null, WIDTH, HEIGHT,
			WIDTH, 0, 0, 0);
		
		// Draw copyright at the bottom
		SplashScreen.__copyright(g, false);
		
		// Use this image
		this._image = image;
		







|
|







121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
		}
		catch (IOException e)
		{
		}
		
		// Text will be drawn using the advanced graphics since it can
		// operate on integer buffers directly
		Graphics g = new AdvancedGraphics(image, false, null,
			SplashScreen.WIDTH, SplashScreen.HEIGHT, SplashScreen.WIDTH, 0, 0, 0);
		
		// Draw copyright at the bottom
		SplashScreen.__copyright(g, false);
		
		// Use this image
		this._image = image;
		
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
		
		// Set properties
		__g.setFont(Font.getFont("sansserif", 0, 12));
		
		// Draw a black drop-shadow, this makes the lighter front easier to
		// see regardless of what is on the background
		__g.setColor(0x000000);
		__g.drawString(COPYRIGHT, 1, 318,
			Graphics.BOTTOM | Graphics.LEFT);
		__g.drawString(COPYRIGHT, 3, 318,
			Graphics.BOTTOM | Graphics.LEFT);
		__g.drawString(COPYRIGHT, 2, 317,
			Graphics.BOTTOM | Graphics.LEFT);
		__g.drawString(COPYRIGHT, 2, 319,
			Graphics.BOTTOM | Graphics.LEFT);
		
		// Then draw the frontal white text
		__g.setColor(0xFFFFFF);
		__g.drawString(COPYRIGHT, 2, 318,
			Graphics.BOTTOM | Graphics.LEFT);
	}
}








|

|

|

|




|




171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
		
		// Set properties
		__g.setFont(Font.getFont("sansserif", 0, 12));
		
		// Draw a black drop-shadow, this makes the lighter front easier to
		// see regardless of what is on the background
		__g.setColor(0x000000);
		__g.drawString(SplashScreen.COPYRIGHT, 1, 318,
			Graphics.BOTTOM | Graphics.LEFT);
		__g.drawString(SplashScreen.COPYRIGHT, 3, 318,
			Graphics.BOTTOM | Graphics.LEFT);
		__g.drawString(SplashScreen.COPYRIGHT, 2, 317,
			Graphics.BOTTOM | Graphics.LEFT);
		__g.drawString(SplashScreen.COPYRIGHT, 2, 319,
			Graphics.BOTTOM | Graphics.LEFT);
		
		// Then draw the frontal white text
		__g.setColor(0xFFFFFF);
		__g.drawString(SplashScreen.COPYRIGHT, 2, 318,
			Graphics.BOTTOM | Graphics.LEFT);
	}
}

Name change from runt/kmid/launcher/cc/squirreljme/runtime/launcher/ui/__ActiveTask__.java to modules/launcher/src/main/java/cc/squirreljme/runtime/launcher/ui/__ActiveTask__.java.

Name change from runt/kmid/launcher/cc/squirreljme/runtime/launcher/ui/__Program__.java to modules/launcher/src/main/java/cc/squirreljme/runtime/launcher/ui/__Program__.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.launcher.ui;

import cc.squirreljme.runtime.cldc.io.ResourceInputStream;
import java.io.InputStream;
import java.io.IOException;
import javax.microedition.lcdui.Alert;
import javax.microedition.lcdui.AlertType;
import javax.microedition.lcdui.Image;
import javax.microedition.swm.ManagerFactory;
import javax.microedition.swm.Suite;
import javax.microedition.swm.Task;
import javax.microedition.swm.TaskStatus;













|
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.launcher.ui;

import cc.squirreljme.runtime.cldc.io.ResourceInputStream;
import java.io.IOException;
import java.io.InputStream;
import javax.microedition.lcdui.Alert;
import javax.microedition.lcdui.AlertType;
import javax.microedition.lcdui.Image;
import javax.microedition.swm.ManagerFactory;
import javax.microedition.swm.Suite;
import javax.microedition.swm.Task;
import javax.microedition.swm.TaskStatus;

Name change from runt/kmid/launcher/cc/squirreljme/runtime/launcher/ui/__ReControlTask__.java to modules/launcher/src/main/java/cc/squirreljme/runtime/launcher/ui/__ReControlTask__.java.

8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.launcher.ui;

import java.util.TimerTask;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Displayable;
import javax.microedition.swm.Task;
import javax.microedition.swm.TaskStatus;

/**
 * This is used to regain control of tasks and make it so the launcher is
 * brought back up after it has lost hardware control.
 *







<







8
9
10
11
12
13
14

15
16
17
18
19
20
21
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.launcher.ui;

import java.util.TimerTask;
import javax.microedition.lcdui.Display;

import javax.microedition.swm.Task;
import javax.microedition.swm.TaskStatus;

/**
 * This is used to regain control of tasks and make it so the launcher is
 * brought back up after it has lost hardware control.
 *

Name change from runt/kmid/launcher/cc/squirreljme/runtime/launcher/ui/package-info.java to modules/launcher/src/main/java/cc/squirreljme/runtime/launcher/ui/package-info.java.

Name change from runt/kmid/launcher/cc/squirreljme/runtime/launcher/ui/splash.raw.__mime to modules/launcher/src/main/resources/cc/squirreljme/runtime/launcher/ui/splash.raw.__mime.

Name change from runt/kmid/launcher/cc/squirreljme/runtime/launcher/ui/splash.xpm to modules/launcher/src/main/resources/cc/squirreljme/runtime/launcher/ui/splash.xpm.

Added modules/lcdui-demo/build.gradle.









































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import cc.squirreljme.plugin.swm.JavaMEMidlet
import cc.squirreljme.plugin.swm.JavaMEMidletType

description = "This is a demo which is used to demonstrate " +
	"how the graphic operations operate."
version = rootProject.version

squirreljme
{
	javaDocErrorCode = "AW"
	swmType = JavaMEMidletType.APPLICATION
	swmName = "LCDUI Graphics Demo"
	swmVendor = "Stephanie Gawroriski"
	midlets += new JavaMEMidlet("Font Demo", "fonts.xpm",
		"net.multiphasicapps.lcduidemo.Fonts")
	midlets += new JavaMEMidlet("Mystify Your Squirrels!", "mystify.xpm",
		"net.multiphasicapps.lcduidemo.Mystify")
	midlets += new JavaMEMidlet("Events Demo", "event.xpm",
		"net.multiphasicapps.lcduidemo.Events")
	midlets += new JavaMEMidlet("List Demo", "list.xpm",
		"net.multiphasicapps.lcduidemo.Lists")
	midlets += new JavaMEMidlet("Image Demo (XPM)", "image.xpm",
		"net.multiphasicapps.lcduidemo.XPMDemo")
	midlets += new JavaMEMidlet("Image Demo (PNG)", "image.xpm",
		"net.multiphasicapps.lcduidemo.PNGDemo")
	midlets += new JavaMEMidlet("Image Demo (JPEG)", "image.xpm",
		"net.multiphasicapps.lcduidemo.JPEGDemo")
}

dependencies
{
	implementation project(":modules:cldc-compact")

	implementation project(":modules:meep-midlet")
	implementation project(":modules:midp-lcdui")
}

Name change from runt/mids/lcdui-demo/net/multiphasicapps/lcduidemo/AbstractImageDemo.java to modules/lcdui-demo/src/main/java/net/multiphasicapps/lcduidemo/AbstractImageDemo.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.lcduidemo;

import java.io.InputStream;
import java.io.IOException;
import javax.microedition.lcdui.Canvas;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.game.Sprite;
import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;

/**
 * This is the base for image demos.
 *
 * @since 2019/04/15











|
|


|
|
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.lcduidemo;

import java.io.IOException;
import java.io.InputStream;
import javax.microedition.lcdui.Canvas;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;
import javax.microedition.lcdui.game.Sprite;
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;

/**
 * This is the base for image demos.
 *
 * @since 2019/04/15
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
	}
	
	/**
	 * The demo canvas which does the drawing.
	 *
	 * @since 2019/04/15
	 */
	static public final class DemoCanvas
		extends Canvas
	{
		/** The image to draw. */
		protected final Image image;
		
		/**
		 * Initializes the demo canvas.







|







94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
	}
	
	/**
	 * The demo canvas which does the drawing.
	 *
	 * @since 2019/04/15
	 */
	public static final class DemoCanvas
		extends Canvas
	{
		/** The image to draw. */
		protected final Image image;
		
		/**
		 * Initializes the demo canvas.
145
146
147
148
149
150
151
152
153

154
155
156
157
158
159

160
161
162
163
164
165
166
				// Source X and Y dimensions
				int sx = xoff,
					sy = yoff,
					sw = w - xoff,
					sh = h - yoff;
				
				// Non-mirrored rotations
				for (int j = 0; j < _NO_MIRROR.length; j++)
					__g.drawRegion(image, sx, sy, sw, sh, _NO_MIRROR[j],

						(w * j), basey, 0);
				basey += h;
					
				// Mirrored rotations
				for (int j = 0; j < _MIRROR.length; j++)
					__g.drawRegion(image, sx, sy, sw, sh, _MIRROR[j],

						(w * j), basey, 0);
				basey += h;
			}
		}
	}
}








|
|
>




|
|
>







145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
				// Source X and Y dimensions
				int sx = xoff,
					sy = yoff,
					sw = w - xoff,
					sh = h - yoff;
				
				// Non-mirrored rotations
				for (int j = 0; j < AbstractImageDemo._NO_MIRROR.length; j++)
					__g.drawRegion(image, sx, sy, sw, sh,
						AbstractImageDemo._NO_MIRROR[j],
						(w * j), basey, 0);
				basey += h;
					
				// Mirrored rotations
				for (int j = 0; j < AbstractImageDemo._MIRROR.length; j++)
					__g.drawRegion(image, sx, sy, sw, sh,
						AbstractImageDemo._MIRROR[j],
						(w * j), basey, 0);
				basey += h;
			}
		}
	}
}

Name change from runt/mids/lcdui-demo/net/multiphasicapps/lcduidemo/Events.java to modules/lcdui-demo/src/main/java/net/multiphasicapps/lcduidemo/Events.java.

85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
	}
	
	/**
	 * The demo canvas which does the event handling and other things.
	 *
	 * @since 2018/12/01
	 */
	static public final class DemoCanvas
		extends Canvas
	{
		/** The number of times this was shown. */
		volatile int _numshown;
		
		/** The number of times this was hidden. */
		volatile int _numhides;







|







85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
	}
	
	/**
	 * The demo canvas which does the event handling and other things.
	 *
	 * @since 2018/12/01
	 */
	public static final class DemoCanvas
		extends Canvas
	{
		/** The number of times this was shown. */
		volatile int _numshown;
		
		/** The number of times this was hidden. */
		volatile int _numhides;
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
	}
	
	/**
	 * The type of keyboard event which happened.
	 *
	 * @since 2018/12/01
	 */
	static public enum KeyboardType
	{
		/** Pressed. */
		PRESSED,
		
		/** Released. */
		RELEASED,
		
		/** Repeated. */
		REPEATED,
		
		/** End. */
		;
	}
	
	/**
	 * The type of pointer event which happened.
	 *
	 * @since 2018/12/01
	 */
	static public enum PointerType
	{
		/** Pressed. */
		PRESSED,
		
		/** Released. */
		RELEASED,
		







|



















|







294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
	}
	
	/**
	 * The type of keyboard event which happened.
	 *
	 * @since 2018/12/01
	 */
	public static enum KeyboardType
	{
		/** Pressed. */
		PRESSED,
		
		/** Released. */
		RELEASED,
		
		/** Repeated. */
		REPEATED,
		
		/** End. */
		;
	}
	
	/**
	 * The type of pointer event which happened.
	 *
	 * @since 2018/12/01
	 */
	public static enum PointerType
	{
		/** Pressed. */
		PRESSED,
		
		/** Released. */
		RELEASED,
		

Name change from runt/mids/lcdui-demo/net/multiphasicapps/lcduidemo/Exit.java to modules/lcdui-demo/src/main/java/net/multiphasicapps/lcduidemo/Exit.java.

Name change from runt/mids/lcdui-demo/net/multiphasicapps/lcduidemo/Fonts.java to modules/lcdui-demo/src/main/java/net/multiphasicapps/lcduidemo/Fonts.java.

57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
	}
	
	/**
	 * The demo canvas which does the animation.
	 *
	 * @since 2018/11/23
	 */
	static public final class DemoCanvas
		extends Canvas
	{
		/** Fonts to use. */
		private final Font[] _fonts;
		
		/**
		 * Initializes the canvas.







|







57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
	}
	
	/**
	 * The demo canvas which does the animation.
	 *
	 * @since 2018/11/23
	 */
	public static final class DemoCanvas
		extends Canvas
	{
		/** Fonts to use. */
		private final Font[] _fonts;
		
		/**
		 * Initializes the canvas.

Name change from runt/mids/lcdui-demo/net/multiphasicapps/lcduidemo/JPEGDemo.java to modules/lcdui-demo/src/main/java/net/multiphasicapps/lcduidemo/JPEGDemo.java.

Name change from runt/mids/lcdui-demo/net/multiphasicapps/lcduidemo/Lists.java to modules/lcdui-demo/src/main/java/net/multiphasicapps/lcduidemo/Lists.java.

Name change from runt/mids/lcdui-demo/net/multiphasicapps/lcduidemo/Mystify.java to modules/lcdui-demo/src/main/java/net/multiphasicapps/lcduidemo/Mystify.java.

47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
		2;
	
	/** The delay time. */
	public static final int DELAY_TIME =
		250;
	
	/** Delay time in nanoseconds. */
	public static final long DELAY_TIME_NS =
		DELAY_TIME * 1_000_000L;
	
	/**
	 * {@inheritDoc}
	 * @since 2018/11/22
	 */
	@Override
	protected void destroyApp(boolean __uc)







|
<







47
48
49
50
51
52
53
54

55
56
57
58
59
60
61
		2;
	
	/** The delay time. */
	public static final int DELAY_TIME =
		250;
	
	/** Delay time in nanoseconds. */
	public static final long DELAY_TIME_NS = Mystify.DELAY_TIME * 1_000_000L;

	
	/**
	 * {@inheritDoc}
	 * @since 2018/11/22
	 */
	@Override
	protected void destroyApp(boolean __uc)
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
		cv.addCommand(Exit.command);
		cv.setCommandListener(new Exit());
		
		// Set display to the canvas
		Display.getDisplay(this).setCurrent(cv);
		
		// Setup thread to force repaints on canvas
		new RepaintTimer(cv, DELAY_TIME).start();
	}
	
	/**
	 * The demo canvas which does the animation.
	 *
	 * @since 2018/11/22
	 */
	static public final class DemoCanvas
		extends Canvas
	{
		/** Random number generator for bounces and such. */
		protected final Random random =
			new Random();
		
		/** Points and their shadows. */
		protected final Point[][] points =
			new Point[NUM_SHADOWS][NUM_POINTS];
		
		/** Colors. */
		protected final int[] colors =
			new int[NUM_SHADOWS];
		
		/** The direction of the points. */
		protected final Point[] direction =
			new Point[NUM_POINTS];
		
		/** Update lock to prevent multiple threads updating at once. */
		private volatile boolean _lockflag;
		
		/** The last time an update happened. */
		private volatile long _nextnano =
			Long.MIN_VALUE;







|







|








|



|



|







78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
		cv.addCommand(Exit.command);
		cv.setCommandListener(new Exit());
		
		// Set display to the canvas
		Display.getDisplay(this).setCurrent(cv);
		
		// Setup thread to force repaints on canvas
		new RepaintTimer(cv, Mystify.DELAY_TIME).start();
	}
	
	/**
	 * The demo canvas which does the animation.
	 *
	 * @since 2018/11/22
	 */
	public static final class DemoCanvas
		extends Canvas
	{
		/** Random number generator for bounces and such. */
		protected final Random random =
			new Random();
		
		/** Points and their shadows. */
		protected final Point[][] points =
			new Point[Mystify.NUM_SHADOWS][Mystify.NUM_POINTS];
		
		/** Colors. */
		protected final int[] colors =
			new int[Mystify.NUM_SHADOWS];
		
		/** The direction of the points. */
		protected final Point[] direction =
			new Point[Mystify.NUM_POINTS];
		
		/** Update lock to prevent multiple threads updating at once. */
		private volatile boolean _lockflag;
		
		/** The last time an update happened. */
		private volatile long _nextnano =
			Long.MIN_VALUE;
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
			
			// Setup points
			Point[][] points = this.points;
			
			// Generate random start points
			Random random = this.random;
			Point[] start = points[0];
			for (int i = 0; i < NUM_POINTS; i++)
				start[i] = new Point(random.nextInt(), random.nextInt());
			
			// Copy all the points to the shadow
			for (int i = 1; i < NUM_SHADOWS; i++)
				for (int j = 0; j < NUM_POINTS; j++)
					points[i][j] = new Point(start[j]);
			
			// Initialize the color cycle
			int[] colors = this.colors;
			for (int i = 0; i < NUM_SHADOWS; i++)
				colors[i] = random.nextInt();
			
			// Determine new directions for all the points
			Point[] direction = this.direction;
			for (int i = 0; i < NUM_POINTS; i++)
				direction[i] = this.__newDirection(new Point(),
					random.nextBoolean(), random.nextBoolean());
		}
		
		/**
		 * {@inheritDoc}
		 * @since 2018/11/22







|



|
|




|




|







130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
			
			// Setup points
			Point[][] points = this.points;
			
			// Generate random start points
			Random random = this.random;
			Point[] start = points[0];
			for (int i = 0; i < Mystify.NUM_POINTS; i++)
				start[i] = new Point(random.nextInt(), random.nextInt());
			
			// Copy all the points to the shadow
			for (int i = 1; i < Mystify.NUM_SHADOWS; i++)
				for (int j = 0; j < Mystify.NUM_POINTS; j++)
					points[i][j] = new Point(start[j]);
			
			// Initialize the color cycle
			int[] colors = this.colors;
			for (int i = 0; i < Mystify.NUM_SHADOWS; i++)
				colors[i] = random.nextInt();
			
			// Determine new directions for all the points
			Point[] direction = this.direction;
			for (int i = 0; i < Mystify.NUM_POINTS; i++)
				direction[i] = this.__newDirection(new Point(),
					random.nextBoolean(), random.nextBoolean());
		}
		
		/**
		 * {@inheritDoc}
		 * @since 2018/11/22
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
			int[] colors = this.colors;
			
			// Used to limit update rate
			long now = System.nanoTime(),
				nextnano = this._nextnano;
			
			// Draw every point, from older shadows to the newer shape
			for (int i = NUM_SHADOWS - 1; i >= 0; i--)
			{
				Point[] draw = points[i];
				
				// Update the state of the demo, but keep it consistent so
				// that it is not always updating
				if (i == 0 && now >= nextnano)
				{







|







174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
			int[] colors = this.colors;
			
			// Used to limit update rate
			long now = System.nanoTime(),
				nextnano = this._nextnano;
			
			// Draw every point, from older shadows to the newer shape
			for (int i = Mystify.NUM_SHADOWS - 1; i >= 0; i--)
			{
				Point[] draw = points[i];
				
				// Update the state of the demo, but keep it consistent so
				// that it is not always updating
				if (i == 0 && now >= nextnano)
				{
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
						finally
						{
							// Always clear the flag so another run can
							// have a go
							this._lockflag = false;
							
							// Update some other time in the future
							this._nextnano = System.nanoTime() + DELAY_TIME_NS;
						}
				}
				
				// Set the color for this shadow
				__g.setColor(colors[i]);
				
				// Draw all the points
				for (int j = 0; j < NUM_POINTS; j++)
				{
					// Get A and B points
					Point a = draw[j],
						b = draw[(j + 1) % NUM_POINTS];
					
					// Draw line
					__g.drawLine(a.x, a.y, b.x, b.y);
				}
			}
		}
		







|







|



|







206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
						finally
						{
							// Always clear the flag so another run can
							// have a go
							this._lockflag = false;
							
							// Update some other time in the future
							this._nextnano = System.nanoTime() + Mystify.DELAY_TIME_NS;
						}
				}
				
				// Set the color for this shadow
				__g.setColor(colors[i]);
				
				// Draw all the points
				for (int j = 0; j < Mystify.NUM_POINTS; j++)
				{
					// Get A and B points
					Point a = draw[j],
						b = draw[(j + 1) % Mystify.NUM_POINTS];
					
					// Draw line
					__g.drawLine(a.x, a.y, b.x, b.y);
				}
			}
		}
		
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
			throws NullPointerException
		{
			if (__p == null)
				throw new NullPointerException("NARG");
			
			// Generate new speeds
			Random random = this.random;
			int x = random.nextInt(MAX_SPEED) + 1,
				y = random.nextInt(MAX_SPEED) + 1;
			
			// Flip signs?
			if (!__px)
				x = -x;
			if (!__py)
				y = -y;
			







|
|







244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
			throws NullPointerException
		{
			if (__p == null)
				throw new NullPointerException("NARG");
			
			// Generate new speeds
			Random random = this.random;
			int x = random.nextInt(Mystify.MAX_SPEED) + 1,
				y = random.nextInt(Mystify.MAX_SPEED) + 1;
			
			// Flip signs?
			if (!__px)
				x = -x;
			if (!__py)
				y = -y;
			
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
		 */
		private void __updateState(int __w, int __h)
		{
			// Needed for cycling	
			Random random = this.random;
			
			// Base points to modify
			Point[] draw = points[0];
			
			// Needed for drawing
			Point[][] points = this.points;
			Point[] direction = this.direction;
			int[] colors = this.colors;
			
			// Move all the old points and colors down
			for (int j = NUM_SHADOWS - 2; j >= 0; j--)
			{
				points[j + 1] = points[j];
				colors[j + 1] = colors[j];
			}
			
			// Allocate a new set of points offset in the directions
			Point[] place = new Point[NUM_POINTS];
			for (int j = 0; j < NUM_POINTS; j++)
			{
				// Get base coordinates
				int newx = draw[j].x,
					newy = draw[j].y;
				
				// Limit to the bounds of the screen. If a point is
				// way off, just choose a random point on the
				// screen instead
				if (newx < 0 || newx >= __w)
				{
					if (newx < -WAY_OFF || newy > __w + WAY_OFF)
						newx = random.nextInt((__w > 0 ? __w : 1));
					else
					{
						if (newx < 0)
							newx = 0;
						else if (newx >= __w)
							newx = __w;
					}
				}
				
				if (newy < 0 || newy >= __h)
				{
					if (newy < -WAY_OFF || newy > __h + WAY_OFF)
						newy = random.nextInt((__h > 0 ? __h : 1));
					else
					{
						if (newy < 0)
							newy = 0;
						else if (newy >= __h)
							newy = __h;







|







|






|
|










|












|







274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
		 */
		private void __updateState(int __w, int __h)
		{
			// Needed for cycling	
			Random random = this.random;
			
			// Base points to modify
			Point[] draw = this.points[0];
			
			// Needed for drawing
			Point[][] points = this.points;
			Point[] direction = this.direction;
			int[] colors = this.colors;
			
			// Move all the old points and colors down
			for (int j = Mystify.NUM_SHADOWS - 2; j >= 0; j--)
			{
				points[j + 1] = points[j];
				colors[j + 1] = colors[j];
			}
			
			// Allocate a new set of points offset in the directions
			Point[] place = new Point[Mystify.NUM_POINTS];
			for (int j = 0; j < Mystify.NUM_POINTS; j++)
			{
				// Get base coordinates
				int newx = draw[j].x,
					newy = draw[j].y;
				
				// Limit to the bounds of the screen. If a point is
				// way off, just choose a random point on the
				// screen instead
				if (newx < 0 || newx >= __w)
				{
					if (newx < -Mystify.WAY_OFF || newy > __w + Mystify.WAY_OFF)
						newx = random.nextInt((__w > 0 ? __w : 1));
					else
					{
						if (newx < 0)
							newx = 0;
						else if (newx >= __w)
							newx = __w;
					}
				}
				
				if (newy < 0 || newy >= __h)
				{
					if (newy < -Mystify.WAY_OFF || newy > __h + Mystify.WAY_OFF)
						newy = random.nextInt((__h > 0 ? __h : 1));
					else
					{
						if (newy < 0)
							newy = 0;
						else if (newy >= __h)
							newy = __h;
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
				// Extract the color
				int color = colors[j];
				byte r = (byte)((color & 0xFF0000) >>> 16),
					g = (byte)((color & 0x00FF00) >>> 8),
					b = (byte)((color & 0x0000FF));
				
				// Cycle the colors depending on the direction of travel
				r += (ppx ^ ppy ? +COLOR_SHIFT : -COLOR_SHIFT);
				g += (ppy | ppy ? -COLOR_SHIFT : +COLOR_SHIFT);
				b += (ppx ^ ppy ? -COLOR_SHIFT : +COLOR_SHIFT);
				
				// Recombine the color
				colors[j] = ((r & 0xFF) << 16) |
					((g & 0xFF) << 8) |
					(b & 0xFF);
				
				// Store the point
				place[j] = new Point(newx, newy);
			}
			
			// Use all these points
			points[0] = place;
		}
	}
	
	/**
	 * Volatile point information.
	 *
	 * @since 2018/11/22
	 */
	static public final class Point
	{
		/** X position. */
		public int x;
		
		/** Y position. */
		public int y;
		







|
|
|




















|







360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
				// Extract the color
				int color = colors[j];
				byte r = (byte)((color & 0xFF0000) >>> 16),
					g = (byte)((color & 0x00FF00) >>> 8),
					b = (byte)((color & 0x0000FF));
				
				// Cycle the colors depending on the direction of travel
				r += (ppx ^ ppy ? +Mystify.COLOR_SHIFT : -Mystify.COLOR_SHIFT);
				g += (ppy | ppy ? -Mystify.COLOR_SHIFT : +Mystify.COLOR_SHIFT);
				b += (ppx ^ ppy ? -Mystify.COLOR_SHIFT : +Mystify.COLOR_SHIFT);
				
				// Recombine the color
				colors[j] = ((r & 0xFF) << 16) |
					((g & 0xFF) << 8) |
					(b & 0xFF);
				
				// Store the point
				place[j] = new Point(newx, newy);
			}
			
			// Use all these points
			points[0] = place;
		}
	}
	
	/**
	 * Volatile point information.
	 *
	 * @since 2018/11/22
	 */
	public static final class Point
	{
		/** X position. */
		public int x;
		
		/** Y position. */
		public int y;
		

Name change from runt/mids/lcdui-demo/net/multiphasicapps/lcduidemo/PNGDemo.java to modules/lcdui-demo/src/main/java/net/multiphasicapps/lcduidemo/PNGDemo.java.

Name change from runt/mids/lcdui-demo/net/multiphasicapps/lcduidemo/RepaintTimer.java to modules/lcdui-demo/src/main/java/net/multiphasicapps/lcduidemo/RepaintTimer.java.

Name change from runt/mids/lcdui-demo/net/multiphasicapps/lcduidemo/XPMDemo.java to modules/lcdui-demo/src/main/java/net/multiphasicapps/lcduidemo/XPMDemo.java.

Name change from runt/mids/lcdui-demo/net/multiphasicapps/lcduidemo/package-info.java to modules/lcdui-demo/src/main/java/net/multiphasicapps/lcduidemo/package-info.java.

Name change from runt/mids/lcdui-demo/event.xpm to modules/lcdui-demo/src/main/resources/event.xpm.

Name change from runt/mids/lcdui-demo/fonts.xpm to modules/lcdui-demo/src/main/resources/fonts.xpm.

Name change from runt/mids/lcdui-demo/image.xpm to modules/lcdui-demo/src/main/resources/image.xpm.

Name change from runt/mids/lcdui-demo/list.xpm to modules/lcdui-demo/src/main/resources/list.xpm.

Name change from runt/mids/lcdui-demo/mystify.xpm to modules/lcdui-demo/src/main/resources/mystify.xpm.

Name change from runt/mids/lcdui-demo/net/multiphasicapps/lcduidemo/image.jpg.__mime to modules/lcdui-demo/src/main/resources/net/multiphasicapps/lcduidemo/image.jpg.__mime.

Name change from runt/mids/lcdui-demo/net/multiphasicapps/lcduidemo/image.png.__mime to modules/lcdui-demo/src/main/resources/net/multiphasicapps/lcduidemo/image.png.__mime.

Name change from runt/mids/lcdui-demo/net/multiphasicapps/lcduidemo/image.xpm to modules/lcdui-demo/src/main/resources/net/multiphasicapps/lcduidemo/image.xpm.

Added modules/m3g/build.gradle.











































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import cc.squirreljme.plugin.swm.JavaMEMidletType

description = "This contains an implementation of the J2ME "
	"Mobile 3D Graphics API. In SquirrelJME it utilizes OpenGL ES to " +
	"perform the rendering as required."
version = rootProject.version

squirreljme
{
	javaDocErrorCode = "EK"
	swmType = JavaMEMidletType.API
	swmName = "Mobile 3D Graphics API"
	swmVendor = "Stephanie Gawroriski"
}

dependencies
{
	implementation project(":modules:cldc-compact")

	implementation project(":modules:opengles")
}

Name change from runt/apis/m3g/javax/microedition/m3g/AnimationController.java to modules/m3g/src/main/java/javax/microedition/m3g/AnimationController.java.

12
13
14
15
16
17
18
19
20
21
22
23
24
25
26


public class AnimationController
	extends Object3D
{
	public AnimationController()
	{
		super();
		throw new todo.TODO();
	}
	
	public int getActiveIntervalEnd()
	{
		throw new todo.TODO();
	}







<







12
13
14
15
16
17
18

19
20
21
22
23
24
25


public class AnimationController
	extends Object3D
{
	public AnimationController()
	{

		throw new todo.TODO();
	}
	
	public int getActiveIntervalEnd()
	{
		throw new todo.TODO();
	}

Name change from runt/apis/m3g/javax/microedition/m3g/AnimationTrack.java to modules/m3g/src/main/java/javax/microedition/m3g/AnimationTrack.java.

75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
		275;
	
	public static final int VISIBILITY =
		276;
	
	public AnimationTrack(KeyframeSequence __a, int __b)
	{
		super();
		throw new todo.TODO();
	}
	
	public AnimationController getController()
	{
		throw new todo.TODO();
	}







<







75
76
77
78
79
80
81

82
83
84
85
86
87
88
		275;
	
	public static final int VISIBILITY =
		276;
	
	public AnimationTrack(KeyframeSequence __a, int __b)
	{

		throw new todo.TODO();
	}
	
	public AnimationController getController()
	{
		throw new todo.TODO();
	}

Name change from runt/apis/m3g/javax/microedition/m3g/Appearance.java to modules/m3g/src/main/java/javax/microedition/m3g/Appearance.java.

12
13
14
15
16
17
18
19
20
21
22
23
24
25
26


public class Appearance
	extends Object3D
{
	public Appearance()
	{
		super();
		throw new todo.TODO();
	}
	
	public CompositingMode getCompositingMode()
	{
		throw new todo.TODO();
	}







<







12
13
14
15
16
17
18

19
20
21
22
23
24
25


public class Appearance
	extends Object3D
{
	public Appearance()
	{

		throw new todo.TODO();
	}
	
	public CompositingMode getCompositingMode()
	{
		throw new todo.TODO();
	}

Name change from runt/apis/m3g/javax/microedition/m3g/Background.java to modules/m3g/src/main/java/javax/microedition/m3g/Background.java.

18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
		32;
	
	public static final int REPEAT =
		33;
	
	public Background()
	{
		super();
		throw new todo.TODO();
	}
	
	public int getColor()
	{
		throw new todo.TODO();
	}







<







18
19
20
21
22
23
24

25
26
27
28
29
30
31
		32;
	
	public static final int REPEAT =
		33;
	
	public Background()
	{

		throw new todo.TODO();
	}
	
	public int getColor()
	{
		throw new todo.TODO();
	}

Name change from runt/apis/m3g/javax/microedition/m3g/Camera.java to modules/m3g/src/main/java/javax/microedition/m3g/Camera.java.

21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
		49;
	
	public static final int PERSPECTIVE =
		50;
	
	public Camera()
	{
		super();
		throw new todo.TODO();
	}
	
	public int getProjection(float[] __a)
	{
		throw new todo.TODO();
	}







<







21
22
23
24
25
26
27

28
29
30
31
32
33
34
		49;
	
	public static final int PERSPECTIVE =
		50;
	
	public Camera()
	{

		throw new todo.TODO();
	}
	
	public int getProjection(float[] __a)
	{
		throw new todo.TODO();
	}

Name change from runt/apis/m3g/javax/microedition/m3g/CompositingMode.java to modules/m3g/src/main/java/javax/microedition/m3g/CompositingMode.java.

27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
		67;
	
	public static final int REPLACE =
		68;
	
	public CompositingMode()
	{
		super();
		throw new todo.TODO();
	}
	
	public float getAlphaThreshold()
	{
		throw new todo.TODO();
	}







<







27
28
29
30
31
32
33

34
35
36
37
38
39
40
		67;
	
	public static final int REPLACE =
		68;
	
	public CompositingMode()
	{

		throw new todo.TODO();
	}
	
	public float getAlphaThreshold()
	{
		throw new todo.TODO();
	}

Name change from runt/apis/m3g/javax/microedition/m3g/Fog.java to modules/m3g/src/main/java/javax/microedition/m3g/Fog.java.

18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
		80;
	
	public static final int LINEAR =
		81;
	
	public Fog()
	{
		super();
		throw new todo.TODO();
	}
	
	public int getColor()
	{
		throw new todo.TODO();
	}







<







18
19
20
21
22
23
24

25
26
27
28
29
30
31
		80;
	
	public static final int LINEAR =
		81;
	
	public Fog()
	{

		throw new todo.TODO();
	}
	
	public int getColor()
	{
		throw new todo.TODO();
	}

Name change from runt/apis/m3g/javax/microedition/m3g/Graphics3D.java to modules/m3g/src/main/java/javax/microedition/m3g/Graphics3D.java.

24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
		16;
	
	public static final int TRUE_COLOR =
		8;
	
	private Graphics3D()
	{
		super();
		throw new todo.TODO();
	}
	
	public int addLight(Light __a, Transform __b)
	{
		throw new todo.TODO();
	}







<







24
25
26
27
28
29
30

31
32
33
34
35
36
37
		16;
	
	public static final int TRUE_COLOR =
		8;
	
	private Graphics3D()
	{

		throw new todo.TODO();
	}
	
	public int addLight(Light __a, Transform __b)
	{
		throw new todo.TODO();
	}

Name change from runt/apis/m3g/javax/microedition/m3g/Group.java to modules/m3g/src/main/java/javax/microedition/m3g/Group.java.

12
13
14
15
16
17
18
19
20
21
22
23
24
25
26


public class Group
	extends Node
{
	public Group()
	{
		super();
		throw new todo.TODO();
	}
	
	public void addChild(Node __a)
	{
		throw new todo.TODO();
	}







<







12
13
14
15
16
17
18

19
20
21
22
23
24
25


public class Group
	extends Node
{
	public Group()
	{

		throw new todo.TODO();
	}
	
	public void addChild(Node __a)
	{
		throw new todo.TODO();
	}

Name change from runt/apis/m3g/javax/microedition/m3g/Image2D.java to modules/m3g/src/main/java/javax/microedition/m3g/Image2D.java.

27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
		99;
	
	public static final int RGBA =
		100;
	
	public Image2D(int __a, int __b, int __c)
	{
		super();
		throw new todo.TODO();
	}
	
	public Image2D(int __a, int __b, int __c, byte[] __d)
	{
		super();
		throw new todo.TODO();
	}
	
	public Image2D(int __a, int __b, int __c, byte[] __d, byte[] __e)
	{
		super();
		throw new todo.TODO();
	}
	
	public Image2D(int __a, Object __b)
	{
		super();
		throw new todo.TODO();
	}
	
	public int getFormat()
	{
		throw new todo.TODO();
	}







<





<





<





<







27
28
29
30
31
32
33

34
35
36
37
38

39
40
41
42
43

44
45
46
47
48

49
50
51
52
53
54
55
		99;
	
	public static final int RGBA =
		100;
	
	public Image2D(int __a, int __b, int __c)
	{

		throw new todo.TODO();
	}
	
	public Image2D(int __a, int __b, int __c, byte[] __d)
	{

		throw new todo.TODO();
	}
	
	public Image2D(int __a, int __b, int __c, byte[] __d, byte[] __e)
	{

		throw new todo.TODO();
	}
	
	public Image2D(int __a, Object __b)
	{

		throw new todo.TODO();
	}
	
	public int getFormat()
	{
		throw new todo.TODO();
	}

Name change from runt/apis/m3g/javax/microedition/m3g/IndexBuffer.java to modules/m3g/src/main/java/javax/microedition/m3g/IndexBuffer.java.

12
13
14
15
16
17
18
19
20
21
22
23
24
25
26


public abstract class IndexBuffer
	extends Object3D
{
	IndexBuffer()
	{
		super();
		throw new todo.TODO();
	}
	
	public abstract int getIndexCount();
	
	public abstract void getIndices(int[] __a);
}







<







12
13
14
15
16
17
18

19
20
21
22
23
24
25


public abstract class IndexBuffer
	extends Object3D
{
	IndexBuffer()
	{

		throw new todo.TODO();
	}
	
	public abstract int getIndexCount();
	
	public abstract void getIndices(int[] __a);
}

Name change from runt/apis/m3g/javax/microedition/m3g/KeyframeSequence.java to modules/m3g/src/main/java/javax/microedition/m3g/KeyframeSequence.java.

33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
		179;
	
	public static final int STEP =
		180;
	
	public KeyframeSequence(int __a, int __b, int __c)
	{
		super();
		throw new todo.TODO();
	}
	
	public int getComponentCount()
	{
		throw new todo.TODO();
	}







<







33
34
35
36
37
38
39

40
41
42
43
44
45
46
		179;
	
	public static final int STEP =
		180;
	
	public KeyframeSequence(int __a, int __b, int __c)
	{

		throw new todo.TODO();
	}
	
	public int getComponentCount()
	{
		throw new todo.TODO();
	}

Name change from runt/apis/m3g/javax/microedition/m3g/Light.java to modules/m3g/src/main/java/javax/microedition/m3g/Light.java.

24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
		130;
	
	public static final int SPOT =
		131;
	
	public Light()
	{
		super();
		throw new todo.TODO();
	}
	
	public int getColor()
	{
		throw new todo.TODO();
	}







<







24
25
26
27
28
29
30

31
32
33
34
35
36
37
		130;
	
	public static final int SPOT =
		131;
	
	public Light()
	{

		throw new todo.TODO();
	}
	
	public int getColor()
	{
		throw new todo.TODO();
	}

Name change from runt/apis/m3g/javax/microedition/m3g/Loader.java to modules/m3g/src/main/java/javax/microedition/m3g/Loader.java.

12
13
14
15
16
17
18
19
20
21
22
23
24
25
26

import java.io.IOException;

public class Loader
{
	private Loader()
	{
		super();
		throw new todo.TODO();
	}
	
	public static Object3D[] load(byte[] __a, int __b)
		throws IOException
	{
		if (false)







<







12
13
14
15
16
17
18

19
20
21
22
23
24
25

import java.io.IOException;

public class Loader
{
	private Loader()
	{

		throw new todo.TODO();
	}
	
	public static Object3D[] load(byte[] __a, int __b)
		throws IOException
	{
		if (false)

Name change from runt/apis/m3g/javax/microedition/m3g/Material.java to modules/m3g/src/main/java/javax/microedition/m3g/Material.java.

24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
		4096;
	
	public static final int SPECULAR =
		8192;
	
	public Material()
	{
		super();
		throw new todo.TODO();
	}
	
	public int getColor(int __a)
	{
		throw new todo.TODO();
	}







<







24
25
26
27
28
29
30

31
32
33
34
35
36
37
		4096;
	
	public static final int SPECULAR =
		8192;
	
	public Material()
	{

		throw new todo.TODO();
	}
	
	public int getColor(int __a)
	{
		throw new todo.TODO();
	}

Name change from runt/apis/m3g/javax/microedition/m3g/Mesh.java to modules/m3g/src/main/java/javax/microedition/m3g/Mesh.java.

12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32


public class Mesh
	extends Node
{
	public Mesh(VertexBuffer __a, IndexBuffer[] __b, Appearance[] __c)
	{
		super();
		throw new todo.TODO();
	}
	
	public Mesh(VertexBuffer __a, IndexBuffer __b, Appearance __c)
	{
		super();
		throw new todo.TODO();
	}
	
	public Appearance getAppearance(int __a)
	{
		throw new todo.TODO();
	}







<





<







12
13
14
15
16
17
18

19
20
21
22
23

24
25
26
27
28
29
30


public class Mesh
	extends Node
{
	public Mesh(VertexBuffer __a, IndexBuffer[] __b, Appearance[] __c)
	{

		throw new todo.TODO();
	}
	
	public Mesh(VertexBuffer __a, IndexBuffer __b, Appearance __c)
	{

		throw new todo.TODO();
	}
	
	public Appearance getAppearance(int __a)
	{
		throw new todo.TODO();
	}

Name change from runt/apis/m3g/javax/microedition/m3g/MorphingMesh.java to modules/m3g/src/main/java/javax/microedition/m3g/MorphingMesh.java.

Name change from runt/apis/m3g/javax/microedition/m3g/Node.java to modules/m3g/src/main/java/javax/microedition/m3g/Node.java.

27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
		147;
	
	public static final int Z_AXIS =
		148;
	
	Node()
	{
		super();
		throw new todo.TODO();
	}
	
	public final void align(Node __a)
	{
		throw new todo.TODO();
	}







<







27
28
29
30
31
32
33

34
35
36
37
38
39
40
		147;
	
	public static final int Z_AXIS =
		148;
	
	Node()
	{

		throw new todo.TODO();
	}
	
	public final void align(Node __a)
	{
		throw new todo.TODO();
	}

Name change from runt/apis/m3g/javax/microedition/m3g/Object3D.java to modules/m3g/src/main/java/javax/microedition/m3g/Object3D.java.

11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package javax.microedition.m3g;


public abstract class Object3D
{
	Object3D()
	{
		super();
		throw new todo.TODO();
	}
	
	public void addAnimationTrack(AnimationTrack __a)
	{
		throw new todo.TODO();
	}







<







11
12
13
14
15
16
17

18
19
20
21
22
23
24
package javax.microedition.m3g;


public abstract class Object3D
{
	Object3D()
	{

		throw new todo.TODO();
	}
	
	public void addAnimationTrack(AnimationTrack __a)
	{
		throw new todo.TODO();
	}

Name change from runt/apis/m3g/javax/microedition/m3g/PolygonMode.java to modules/m3g/src/main/java/javax/microedition/m3g/PolygonMode.java.

33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
		168;
	
	public static final int WINDING_CW =
		169;
	
	public PolygonMode()
	{
		super();
		throw new todo.TODO();
	}
	
	public int getCulling()
	{
		throw new todo.TODO();
	}







<







33
34
35
36
37
38
39

40
41
42
43
44
45
46
		168;
	
	public static final int WINDING_CW =
		169;
	
	public PolygonMode()
	{

		throw new todo.TODO();
	}
	
	public int getCulling()
	{
		throw new todo.TODO();
	}

Name change from runt/apis/m3g/javax/microedition/m3g/RayIntersection.java to modules/m3g/src/main/java/javax/microedition/m3g/RayIntersection.java.

11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package javax.microedition.m3g;


public class RayIntersection
{
	public RayIntersection()
	{
		super();
		throw new todo.TODO();
	}
	
	public float getDistance()
	{
		throw new todo.TODO();
	}







<







11
12
13
14
15
16
17

18
19
20
21
22
23
24
package javax.microedition.m3g;


public class RayIntersection
{
	public RayIntersection()
	{

		throw new todo.TODO();
	}
	
	public float getDistance()
	{
		throw new todo.TODO();
	}

Name change from runt/apis/m3g/javax/microedition/m3g/SkinnedMesh.java to modules/m3g/src/main/java/javax/microedition/m3g/SkinnedMesh.java.

Name change from runt/apis/m3g/javax/microedition/m3g/Sprite3D.java to modules/m3g/src/main/java/javax/microedition/m3g/Sprite3D.java.

12
13
14
15
16
17
18
19
20
21
22
23
24
25
26


public class Sprite3D
	extends Node
{
	public Sprite3D(boolean __a, Image2D __b, Appearance __c)
	{
		super();
		throw new todo.TODO();
	}
	
	public Appearance getAppearance()
	{
		throw new todo.TODO();
	}







<







12
13
14
15
16
17
18

19
20
21
22
23
24
25


public class Sprite3D
	extends Node
{
	public Sprite3D(boolean __a, Image2D __b, Appearance __c)
	{

		throw new todo.TODO();
	}
	
	public Appearance getAppearance()
	{
		throw new todo.TODO();
	}

Name change from runt/apis/m3g/javax/microedition/m3g/Texture2D.java to modules/m3g/src/main/java/javax/microedition/m3g/Texture2D.java.

42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
		240;
	
	public static final int WRAP_REPEAT =
		241;
	
	public Texture2D(Image2D __a)
	{
		super();
		throw new todo.TODO();
	}
	
	public int getBlendColor()
	{
		throw new todo.TODO();
	}







<







42
43
44
45
46
47
48

49
50
51
52
53
54
55
		240;
	
	public static final int WRAP_REPEAT =
		241;
	
	public Texture2D(Image2D __a)
	{

		throw new todo.TODO();
	}
	
	public int getBlendColor()
	{
		throw new todo.TODO();
	}

Name change from runt/apis/m3g/javax/microedition/m3g/Transform.java to modules/m3g/src/main/java/javax/microedition/m3g/Transform.java.

11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package javax.microedition.m3g;


public class Transform
{
	public Transform()
	{
		super();
		throw new todo.TODO();
	}
	
	public Transform(Transform __a)
	{
		super();
		throw new todo.TODO();
	}
	
	public void get(float[] __a)
	{
		throw new todo.TODO();
	}







<





<







11
12
13
14
15
16
17

18
19
20
21
22

23
24
25
26
27
28
29
package javax.microedition.m3g;


public class Transform
{
	public Transform()
	{

		throw new todo.TODO();
	}
	
	public Transform(Transform __a)
	{

		throw new todo.TODO();
	}
	
	public void get(float[] __a)
	{
		throw new todo.TODO();
	}

Name change from runt/apis/m3g/javax/microedition/m3g/Transformable.java to modules/m3g/src/main/java/javax/microedition/m3g/Transformable.java.

12
13
14
15
16
17
18
19
20
21
22
23
24
25
26


public abstract class Transformable
	extends Object3D
{
	Transformable()
	{
		super();
		throw new todo.TODO();
	}
	
	public void getCompositeTransform(Transform __a)
	{
		throw new todo.TODO();
	}







<







12
13
14
15
16
17
18

19
20
21
22
23
24
25


public abstract class Transformable
	extends Object3D
{
	Transformable()
	{

		throw new todo.TODO();
	}
	
	public void getCompositeTransform(Transform __a)
	{
		throw new todo.TODO();
	}

Name change from runt/apis/m3g/javax/microedition/m3g/TriangleStripArray.java to modules/m3g/src/main/java/javax/microedition/m3g/TriangleStripArray.java.

12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32


public class TriangleStripArray
	extends IndexBuffer
{
	public TriangleStripArray(int[] __a, int[] __b)
	{
		super();
		throw new todo.TODO();
	}
	
	public TriangleStripArray(int __a, int[] __b)
	{
		super();
		throw new todo.TODO();
	}
	
	@Override
	public int getIndexCount()
	{
		throw new todo.TODO();







<





<







12
13
14
15
16
17
18

19
20
21
22
23

24
25
26
27
28
29
30


public class TriangleStripArray
	extends IndexBuffer
{
	public TriangleStripArray(int[] __a, int[] __b)
	{

		throw new todo.TODO();
	}
	
	public TriangleStripArray(int __a, int[] __b)
	{

		throw new todo.TODO();
	}
	
	@Override
	public int getIndexCount()
	{
		throw new todo.TODO();

Name change from runt/apis/m3g/javax/microedition/m3g/VertexArray.java to modules/m3g/src/main/java/javax/microedition/m3g/VertexArray.java.

12
13
14
15
16
17
18
19
20
21
22
23
24
25
26


public class VertexArray
	extends Object3D
{
	public VertexArray(int __a, int __b, int __c)
	{
		super();
		throw new todo.TODO();
	}
	
	public void get(int __a, int __b, byte[] __c)
	{
		throw new todo.TODO();
	}







<







12
13
14
15
16
17
18

19
20
21
22
23
24
25


public class VertexArray
	extends Object3D
{
	public VertexArray(int __a, int __b, int __c)
	{

		throw new todo.TODO();
	}
	
	public void get(int __a, int __b, byte[] __c)
	{
		throw new todo.TODO();
	}

Name change from runt/apis/m3g/javax/microedition/m3g/VertexBuffer.java to modules/m3g/src/main/java/javax/microedition/m3g/VertexBuffer.java.

12
13
14
15
16
17
18
19
20
21
22
23
24
25
26


public class VertexBuffer
	extends Object3D
{
	public VertexBuffer()
	{
		super();
		throw new todo.TODO();
	}
	
	public VertexArray getColors()
	{
		throw new todo.TODO();
	}







<







12
13
14
15
16
17
18

19
20
21
22
23
24
25


public class VertexBuffer
	extends Object3D
{
	public VertexBuffer()
	{

		throw new todo.TODO();
	}
	
	public VertexArray getColors()
	{
		throw new todo.TODO();
	}

Name change from runt/apis/m3g/javax/microedition/m3g/World.java to modules/m3g/src/main/java/javax/microedition/m3g/World.java.

12
13
14
15
16
17
18
19
20
21
22
23
24
25
26


public class World
	extends Group
{
	public World()
	{
		super();
		throw new todo.TODO();
	}
	
	public Camera getActiveCamera()
	{
		throw new todo.TODO();
	}







<







12
13
14
15
16
17
18

19
20
21
22
23
24
25


public class World
	extends Group
{
	public World()
	{

		throw new todo.TODO();
	}
	
	public Camera getActiveCamera()
	{
		throw new todo.TODO();
	}

Added modules/markdown-writer/build.gradle.







































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import cc.squirreljme.plugin.swm.JavaMEMidletType

description = "This project contains a formatted markdown " +
	"writer which allows documents to be written to a standard stream yet " +
	"have state on which properties to apply to the output."
version = rootProject.version

squirreljme
{
	javaDocErrorCode = "CG"
	swmType = JavaMEMidletType.LIBRARY
	swmName = "Markdown Writer"
	swmVendor = "Stephanie Gawroriski"
}

dependencies
{
	implementation project(":modules:cldc-compact")
}

Name change from runt/libs/markdown-writer/net/multiphasicapps/markdownwriter/MarkdownTextStyle.java to modules/markdown-writer/src/main/java/net/multiphasicapps/markdownwriter/MarkdownTextStyle.java.

40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
	
	/**
	 * Initializes the style information.
	 *
	 * @param __n Is this style considered for non-code text.
	 * @since 2016/09/13
	 */
	private MarkdownTextStyle(boolean __n)
	{
		this.normal = __n;
	}
	
	/**
	 * Is this style for normal text?
	 *







|







40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
	
	/**
	 * Initializes the style information.
	 *
	 * @param __n Is this style considered for non-code text.
	 * @since 2016/09/13
	 */
	MarkdownTextStyle(boolean __n)
	{
		this.normal = __n;
	}
	
	/**
	 * Is this style for normal text?
	 *

Name change from runt/libs/markdown-writer/net/multiphasicapps/markdownwriter/MarkdownWriter.java to modules/markdown-writer/src/main/java/net/multiphasicapps/markdownwriter/MarkdownWriter.java.

9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// ---------------------------------------------------------------------------

package net.multiphasicapps.markdownwriter;

import java.io.Closeable;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintStream;
import java.io.Writer;
import java.util.ArrayDeque;
import java.util.Deque;
import java.util.Formatter;
import java.util.Objects;

/**
 * This is a class which writes markdown formatted text to the specified
 * {@link Appendable} which may be any implentation of one. This handle all
 * of the standard formatting details that markdown supports.







<

<
<







9
10
11
12
13
14
15

16


17
18
19
20
21
22
23
// ---------------------------------------------------------------------------

package net.multiphasicapps.markdownwriter;

import java.io.Closeable;
import java.io.IOException;
import java.io.OutputStream;

import java.io.Writer;


import java.util.Formatter;
import java.util.Objects;

/**
 * This is a class which writes markdown formatted text to the specified
 * {@link Appendable} which may be any implentation of one. This handle all
 * of the standard formatting details that markdown supports.
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
		
		// Setup formatter
		this.formatter = new Formatter(this);
	}
	
	/**
	 * {@inheritDoc}
	 * @sicne 2016/09/13
	 */
	@Override
	public MarkdownWriter append(char __c)
		throws IOException
	{
		__put(__c, false);
		return this;
	}
	
	/**
	 * {@inheritDoc}
	 * @sicne 2016/09/13
	 */
	@Override
	public MarkdownWriter append(CharSequence __cs)
		throws IOException
	{
		return this.append(__cs, 0, __cs.length());
	}
	
	/**
	 * {@inheritDoc}
	 * @sicne 2016/09/13
	 */
	@Override
	public MarkdownWriter append(CharSequence __cs, int __s, int __e)
		throws IOException
	{
		for (int i = __s; i < __e; i++)
			__put(__cs.charAt(i), false);
		return this;
	}
	
	/**
	 * {@inheritDoc}
	 * @sicne 2016/09/13
	 */
	@Override
	public void close()
		throws IOException
	{
		// Flush before close
		try
		{
			flush();
		}
		
		// Ignore
		catch (IOException e)
		{
		}
		







|





|





|










|






|





|








|







68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
		
		// Setup formatter
		this.formatter = new Formatter(this);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/09/13
	 */
	@Override
	public MarkdownWriter append(char __c)
		throws IOException
	{
		this.__put(__c, false);
		return this;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/09/13
	 */
	@Override
	public MarkdownWriter append(CharSequence __cs)
		throws IOException
	{
		return this.append(__cs, 0, __cs.length());
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/09/13
	 */
	@Override
	public MarkdownWriter append(CharSequence __cs, int __s, int __e)
		throws IOException
	{
		for (int i = __s; i < __e; i++)
			this.__put(__cs.charAt(i), false);
		return this;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/09/13
	 */
	@Override
	public void close()
		throws IOException
	{
		// Flush before close
		try
		{
			this.flush();
		}
		
		// Ignore
		catch (IOException e)
		{
		}
		
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
		if (__s == null)
			throw new NullPointerException("NARG");
		
		// Setup section
		__SectionHeader__ header = new __SectionHeader__(this, __abs, __level);
		
		// Print header text
		append(__s);
		
		// Enter paragraph mode
		paragraph();
	}
	
	/**
	 * End a list.
	 *
	 * @throws IOException On write errors.
	 * @since 2016/10/01







|


|







169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
		if (__s == null)
			throw new NullPointerException("NARG");
		
		// Setup section
		__SectionHeader__ header = new __SectionHeader__(this, __abs, __level);
		
		// Print header text
		this.append(__s);
		
		// Enter paragraph mode
		this.paragraph();
	}
	
	/**
	 * End a list.
	 *
	 * @throws IOException On write errors.
	 * @since 2016/10/01
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
	 * @param __c The character to print.
	 * @throws IOException On write errors.
	 * @since 2016/10/02
	 */
	public void print(char __c)
		throws IOException
	{
		append(__c);
	}
	
	/**
	 * Prints the specified object.
	 *
	 * @param __o The object to print.
	 * @throws IOException On write errors.
	 * @since 2016/10/01
	 */
	public void print(Object __o)
		throws IOException
	{
		append(Objects.toString(__o));
	}
	
	/**
	 * Prints formatted text to the output.
	 *
	 * @param __f The format specifier.
	 * @param __args The format arguments.







|












|







246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
	 * @param __c The character to print.
	 * @throws IOException On write errors.
	 * @since 2016/10/02
	 */
	public void print(char __c)
		throws IOException
	{
		this.append(__c);
	}
	
	/**
	 * Prints the specified object.
	 *
	 * @param __o The object to print.
	 * @throws IOException On write errors.
	 * @since 2016/10/01
	 */
	public void print(Object __o)
		throws IOException
	{
		this.append(Objects.toString(__o));
	}
	
	/**
	 * Prints formatted text to the output.
	 *
	 * @param __f The format specifier.
	 * @param __args The format arguments.
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
	 *
	 * @throws IOException On write errors.
	 * @since 2016/10/01
	 */
	public void println()
		throws IOException
	{
		append('\n');
	}
	
	/**
	 * Prints the specified object followed by a new line.
	 *
	 * @param __o The object to print.
	 * @throws IOException On write errors.
	 * @since 2016/10/01
	 */
	public void println(Object __o)
		throws IOException
	{
		print(__o);
		println();
	}
	
	/**
	 * Prints a URI to the output document.
	 *
	 * @param __uri The URI to print.
	 * @throws IOException On write errors.
	 * @throws NullPointerException On null arguments.
	 * @since 2016/10/01
	 */
	public void uri(String __uri)
		throws IOException, NullPointerException
	{
		// Check
		if (__uri == null)
			throw new NullPointerException("NARG");
		
		// Prime
		__put('\0', false);
		
		// Print it out
		__put('<', true);
		append(__uri);
		__put('>', true);
	}
	
	/**
	 * Prints a URI to the output document with the given display text.
	 *
	 * @param __uri The URI to point to.
	 * @param __text The display text for the URI.
	 * @throws IOException On write errors.
	 * @throws NullPointerException On null arguments.
	 * @since 2016/10/01
	 */
	public void uri(String __uri, String __text)
		throws IOException, NullPointerException
	{
		// Check
		if (__uri == null || __text == null)
			throw new NullPointerException("NARG");
		
		// Prime
		__put('\0', false);
		
		// Print it out
		__put('[', true);
		append(__text);
		__put(']', true);
		__put('(', true);
		__unescapedURI(__uri);
		__put(')', true);
	}
	
	/**
	 * Prints a URI to the output document with the given display text.
	 *
	 * @param __uri The URI to point to.
	 * @param __text The display text for the URI.
	 * @param __title The text text for the URI.
	 * @throws IOException On write errors.
	 * @throws NullPointerException On null arguments.
	 * @since 2016/10/01
	 */
	public void uri(String __uri, String __text, String __title)
		throws IOException, NullPointerException
	{
		// Check
		if (__uri == null || __text == null || __title == null)
			throw new NullPointerException("NARG");
		
		// Prime
		__put('\0', false);
		
		// Print it out
		__put('[', true);
		append(__text);
		__put(']', true);
		__put('(', true);
		__unescapedURI(__uri);
		__put(' ', true);
		__put('"', true);
		append(__title);
		__put('"', true);
		__put(')', true);
	}
	
	/**
	 * Returns {@code true} if the specified character is to be escaped.
	 *
	 * @return {@code true} if the character must be escaped.
	 * @since 2016/10/02







|












|
|


















|


|
|
|



















|


|
|
|
|
|
|




















|


|
|
|
|
|
|
|
|
|
|







291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
	 *
	 * @throws IOException On write errors.
	 * @since 2016/10/01
	 */
	public void println()
		throws IOException
	{
		this.append('\n');
	}
	
	/**
	 * Prints the specified object followed by a new line.
	 *
	 * @param __o The object to print.
	 * @throws IOException On write errors.
	 * @since 2016/10/01
	 */
	public void println(Object __o)
		throws IOException
	{
		this.print(__o);
		this.println();
	}
	
	/**
	 * Prints a URI to the output document.
	 *
	 * @param __uri The URI to print.
	 * @throws IOException On write errors.
	 * @throws NullPointerException On null arguments.
	 * @since 2016/10/01
	 */
	public void uri(String __uri)
		throws IOException, NullPointerException
	{
		// Check
		if (__uri == null)
			throw new NullPointerException("NARG");
		
		// Prime
		this.__put('\0', false);
		
		// Print it out
		this.__put('<', true);
		this.append(__uri);
		this.__put('>', true);
	}
	
	/**
	 * Prints a URI to the output document with the given display text.
	 *
	 * @param __uri The URI to point to.
	 * @param __text The display text for the URI.
	 * @throws IOException On write errors.
	 * @throws NullPointerException On null arguments.
	 * @since 2016/10/01
	 */
	public void uri(String __uri, String __text)
		throws IOException, NullPointerException
	{
		// Check
		if (__uri == null || __text == null)
			throw new NullPointerException("NARG");
		
		// Prime
		this.__put('\0', false);
		
		// Print it out
		this.__put('[', true);
		this.append(__text);
		this.__put(']', true);
		this.__put('(', true);
		this.__unescapedURI(__uri);
		this.__put(')', true);
	}
	
	/**
	 * Prints a URI to the output document with the given display text.
	 *
	 * @param __uri The URI to point to.
	 * @param __text The display text for the URI.
	 * @param __title The text text for the URI.
	 * @throws IOException On write errors.
	 * @throws NullPointerException On null arguments.
	 * @since 2016/10/01
	 */
	public void uri(String __uri, String __text, String __title)
		throws IOException, NullPointerException
	{
		// Check
		if (__uri == null || __text == null || __title == null)
			throw new NullPointerException("NARG");
		
		// Prime
		this.__put('\0', false);
		
		// Print it out
		this.__put('[', true);
		this.append(__text);
		this.__put(']', true);
		this.__put('(', true);
		this.__unescapedURI(__uri);
		this.__put(' ', true);
		this.__put('"', true);
		this.append(__title);
		this.__put('"', true);
		this.__put(')', true);
	}
	
	/**
	 * Returns {@code true} if the specified character is to be escaped.
	 *
	 * @return {@code true} if the character must be escaped.
	 * @since 2016/10/02
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
				this._column = (column = 0);
			
			// Otherwise it goes up
			else
				this._column = (++column);
			
			// If at the end, go to the next line
			if (column >= RIGHT_COLUMN)
				__put('\n', true);
			
			// Done
			return;
		}
		
		// Need section to always exist
		__Section__ section = this._section;
		if (section == null)
			section = new __SectionParagraph__(this);
		
		// Character needs escaping?
		if (__escaped(__c))
			section.__process('\\');
		
		// Place character
		section.__process(__c);
	}
	
	/**







|
|











|







442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
				this._column = (column = 0);
			
			// Otherwise it goes up
			else
				this._column = (++column);
			
			// If at the end, go to the next line
			if (column >= MarkdownWriter.RIGHT_COLUMN)
				this.__put('\n', true);
			
			// Done
			return;
		}
		
		// Need section to always exist
		__Section__ section = this._section;
		if (section == null)
			section = new __SectionParagraph__(this);
		
		// Character needs escaping?
		if (this.__escaped(__c))
			section.__process('\\');
		
		// Place character
		section.__process(__c);
	}
	
	/**
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
		// Go through all
		int n = __s.length();
		for (int i = 0; i < n; i++)
		{
			char c = __s.charAt(i);
			
			// Never escape underscore
			if (__escaped(c) || c == '"' || MarkdownWriter.__isWhitespace(c))
				if (c == '_')
					__put(c, true);
				
				// Percent encode anything else
				else
				{
					byte[] b = Character.toString(c).getBytes("utf-8");
					int q = b.length;
					__put('%', false);
					for (int l = 0; l < q; l++)
					{
						byte d = b[l];
						__put(Character.forDigit((d >>> 4) & 0xF, 16), false);
						__put(Character.forDigit(d & 0xF, 16), false);
					}
				}
			
			// Otherwise normal print
			else
				__put(c, false);
		}
	}
	
	/**
	 * Is this a whitespace character?
	 *
	 * @param __c The character to check.







|

|






|



|
|





|







484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
		// Go through all
		int n = __s.length();
		for (int i = 0; i < n; i++)
		{
			char c = __s.charAt(i);
			
			// Never escape underscore
			if (this.__escaped(c) || c == '"' || MarkdownWriter.__isWhitespace(c))
				if (c == '_')
					this.__put(c, true);
				
				// Percent encode anything else
				else
				{
					byte[] b = Character.toString(c).getBytes("utf-8");
					int q = b.length;
					this.__put('%', false);
					for (int l = 0; l < q; l++)
					{
						byte d = b[l];
						this.__put(Character.forDigit((d >>> 4) & 0xF, 16), false);
						this.__put(Character.forDigit(d & 0xF, 16), false);
					}
				}
			
			// Otherwise normal print
			else
				this.__put(c, false);
		}
	}
	
	/**
	 * Is this a whitespace character?
	 *
	 * @param __c The character to check.

Name change from runt/libs/markdown-writer/net/multiphasicapps/markdownwriter/__SectionHeader__.java to modules/markdown-writer/src/main/java/net/multiphasicapps/markdownwriter/__SectionHeader__.java.

Name change from runt/libs/markdown-writer/net/multiphasicapps/markdownwriter/__SectionList__.java to modules/markdown-writer/src/main/java/net/multiphasicapps/markdownwriter/__SectionList__.java.

81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
			
			// Indent with spaces first
			int indent = this._indent;
			for (int i = 0; i < indent; i++)
				writer.__put(' ', true);
			
			// Add list characters
			__listCharacters();
			
			// Add sapce
			writer.__put(' ', true);
			
			// Do not write any more new items
			this._newitem = false;
		}







|







81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
			
			// Indent with spaces first
			int indent = this._indent;
			for (int i = 0; i < indent; i++)
				writer.__put(' ', true);
			
			// Add list characters
			this.__listCharacters();
			
			// Add sapce
			writer.__put(' ', true);
			
			// Do not write any more new items
			this._newitem = false;
		}

Name change from runt/libs/markdown-writer/net/multiphasicapps/markdownwriter/__SectionParagraph__.java to modules/markdown-writer/src/main/java/net/multiphasicapps/markdownwriter/__SectionParagraph__.java.

Name change from runt/libs/markdown-writer/net/multiphasicapps/markdownwriter/__SectionUnorderedList__.java to modules/markdown-writer/src/main/java/net/multiphasicapps/markdownwriter/__SectionUnorderedList__.java.

Name change from runt/libs/markdown-writer/net/multiphasicapps/markdownwriter/__Section__.java to modules/markdown-writer/src/main/java/net/multiphasicapps/markdownwriter/__Section__.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.markdownwriter;

import java.io.IOException;
import java.util.Deque;

/**
 * This is the base class for all sections within the markdown writer, this is
 * used to modify how data is written to the output file when it is written.
 *
 * The constructor for a section will automatically set itself as the newest
 * section and initialize it from a previous one.













<







1
2
3
4
5
6
7
8
9
10
11
12
13

14
15
16
17
18
19
20
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.markdownwriter;

import java.io.IOException;


/**
 * This is the base class for all sections within the markdown writer, this is
 * used to modify how data is written to the output file when it is written.
 *
 * The constructor for a section will automatically set itself as the newest
 * section and initialize it from a previous one.

Name change from runt/libs/markdown-writer/net/multiphasicapps/markdownwriter/package-info.java to modules/markdown-writer/src/main/java/net/multiphasicapps/markdownwriter/package-info.java.

Added modules/media-api/build.gradle.





































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import cc.squirreljme.plugin.swm.JavaMEMidletType

description = "This project contains the implementation of " +
	"the MIDP 3.0 Media API which is also specified in JSR 135."
version = rootProject.version

squirreljme
{
	javaDocErrorCode = "EA"
	swmType = JavaMEMidletType.API
	swmName = "Media API"
	swmVendor = "Stephanie Gawroriski"
}

dependencies
{
	implementation project(":modules:cldc-compact")
}

Name change from runt/apis/media-api/cc/squirreljme/runtime/media/NullPlayer.java to modules/media-api/src/main/java/cc/squirreljme/runtime/media/NullPlayer.java.

34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
		new LinkedList<>();
	
	/** The timebase. */
	private TimeBase _timebase =
		Manager.getSystemTimeBase();
	
	/** The state of the player. */
	private volatile int _state =
		UNREALIZED;
	
	/**
	 * Initializes the player.
	 *
	 * @param __mime The mime type.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/04/15







|
<







34
35
36
37
38
39
40
41

42
43
44
45
46
47
48
		new LinkedList<>();
	
	/** The timebase. */
	private TimeBase _timebase =
		Manager.getSystemTimeBase();
	
	/** The state of the player. */
	private volatile int _state = Player.UNREALIZED;

	
	/**
	 * Initializes the player.
	 *
	 * @param __mime The mime type.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/04/15
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
	public final void addPlayerListener(PlayerListener __l)
	{
		// Ignore?
		if (__l == null)
			return;
		
		// {@squirreljme.error EA01 Null Player has been closed.}
		if (this._state == CLOSED)
			throw new IllegalStateException("EA01");
		
		// Add unique listener
		List<PlayerListener> listeners = this._listeners;
		synchronized (listeners)
		{
			if (!listeners.contains(__l))
				listeners.add(__l);
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2019/04/15
	 */
	@Override
	public final void close()
	{
		if (this._state != CLOSED)
		{
			this._state = CLOSED;
			
			// Send event
			this.__event(PlayerListener.CLOSED, null);
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2019/04/15
	 */
	@Override
	public final void deallocate()
	{
		// {@squirreljme.error EA03 Null Player has been closed.}
		if (this._state == CLOSED)
			throw new IllegalStateException("EA03");
		
		if (this._state == STARTED)
		{
			// Implicit stop state
			try
			{
				this.stop();
			}
			catch (MediaException e)
			{
				e.printStackTrace();
			}
			
			// Become realized
			this._state = REALIZED;
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2019/04/15
	 */







|


















|

|














|


|












|







64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
	public final void addPlayerListener(PlayerListener __l)
	{
		// Ignore?
		if (__l == null)
			return;
		
		// {@squirreljme.error EA01 Null Player has been closed.}
		if (this._state == Player.CLOSED)
			throw new IllegalStateException("EA01");
		
		// Add unique listener
		List<PlayerListener> listeners = this._listeners;
		synchronized (listeners)
		{
			if (!listeners.contains(__l))
				listeners.add(__l);
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2019/04/15
	 */
	@Override
	public final void close()
	{
		if (this._state != Player.CLOSED)
		{
			this._state = Player.CLOSED;
			
			// Send event
			this.__event(PlayerListener.CLOSED, null);
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2019/04/15
	 */
	@Override
	public final void deallocate()
	{
		// {@squirreljme.error EA03 Null Player has been closed.}
		if (this._state == Player.CLOSED)
			throw new IllegalStateException("EA03");
		
		if (this._state == Player.STARTED)
		{
			// Implicit stop state
			try
			{
				this.stop();
			}
			catch (MediaException e)
			{
				e.printStackTrace();
			}
			
			// Become realized
			this._state = Player.REALIZED;
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2019/04/15
	 */
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
	 * @since 2019/04/15
	 */
	@Override
	public final void realize()
		throws MediaException
	{
		// {@squirreljme.error EA04 Null Player has been closed.}
		if (this._state == CLOSED)
			throw new IllegalStateException("EA04");
		
		if (this._state != UNREALIZED)
			this._state = REALIZED;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2019/04/15
	 */
	@Override
	public final void removePlayerListener(PlayerListener __l)
	{
		// Ignore?
		if (__l == null)
			return;
		
		// {@squirreljme.error EA02 Null Player has been closed.}
		if (this._state == CLOSED)
			throw new IllegalStateException("EA02");
		
		// Remove it
		List<PlayerListener> listeners = this._listeners;
		synchronized (listeners)
		{
			listeners.remove(__l);







|


|
|














|







216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
	 * @since 2019/04/15
	 */
	@Override
	public final void realize()
		throws MediaException
	{
		// {@squirreljme.error EA04 Null Player has been closed.}
		if (this._state == Player.CLOSED)
			throw new IllegalStateException("EA04");
		
		if (this._state != Player.UNREALIZED)
			this._state = Player.REALIZED;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2019/04/15
	 */
	@Override
	public final void removePlayerListener(PlayerListener __l)
	{
		// Ignore?
		if (__l == null)
			return;
		
		// {@squirreljme.error EA02 Null Player has been closed.}
		if (this._state == Player.CLOSED)
			throw new IllegalStateException("EA02");
		
		// Remove it
		List<PlayerListener> listeners = this._listeners;
		synchronized (listeners)
		{
			listeners.remove(__l);
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
	 * @since 2019/04/15
	 */
	@Override
	public final void start()
		throws MediaException
	{
		// {@squirreljme.error EA05 Null Player has been closed.}
		if (this._state == CLOSED)
			throw new IllegalStateException("EA05");
		
		if (this._state != STARTED || this._state == PREFETCHED)
		{
			this._state = STARTED;
			
			// Send event
			this.__event(PlayerListener.STARTED,
				Long.valueOf(this._timebase.getTime()));
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2019/04/15
	 */
	@Override
	public final void stop()
		throws MediaException
	{
		// {@squirreljme.error EA06 Null Player has been closed.}
		if (this._state == CLOSED)
			throw new IllegalStateException("EA06");
		
		if (this._state != STARTED)
		{
			this._state = PREFETCHED;
			
			// Send event
			this.__event(PlayerListener.STOPPED,
				Long.valueOf(this._timebase.getTime()));
		}
	}
	







|


|

|
















|


|

|







286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
	 * @since 2019/04/15
	 */
	@Override
	public final void start()
		throws MediaException
	{
		// {@squirreljme.error EA05 Null Player has been closed.}
		if (this._state == Player.CLOSED)
			throw new IllegalStateException("EA05");
		
		if (this._state != Player.STARTED || this._state == Player.PREFETCHED)
		{
			this._state = Player.STARTED;
			
			// Send event
			this.__event(PlayerListener.STARTED,
				Long.valueOf(this._timebase.getTime()));
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2019/04/15
	 */
	@Override
	public final void stop()
		throws MediaException
	{
		// {@squirreljme.error EA06 Null Player has been closed.}
		if (this._state == Player.CLOSED)
			throw new IllegalStateException("EA06");
		
		if (this._state != Player.STARTED)
		{
			this._state = Player.PREFETCHED;
			
			// Send event
			this.__event(PlayerListener.STOPPED,
				Long.valueOf(this._timebase.getTime()));
		}
	}
	

Name change from runt/apis/media-api/cc/squirreljme/runtime/media/NullVolumeControl.java to modules/media-api/src/main/java/cc/squirreljme/runtime/media/NullVolumeControl.java.

Name change from runt/apis/media-api/cc/squirreljme/runtime/media/SystemNanoTimeBase.java to modules/media-api/src/main/java/cc/squirreljme/runtime/media/SystemNanoTimeBase.java.

Name change from runt/apis/media-api/cc/squirreljme/runtime/media/package-info.java to modules/media-api/src/main/java/cc/squirreljme/runtime/media/package-info.java.

Name change from runt/apis/media-api/javax/microedition/media/Control.java to modules/media-api/src/main/java/javax/microedition/media/Control.java.

Name change from runt/apis/media-api/javax/microedition/media/Controllable.java to modules/media-api/src/main/java/javax/microedition/media/Controllable.java.

9
10
11
12
13
14
15
16
17
18
19
20
21
// ---------------------------------------------------------------------------

package javax.microedition.media;


public interface Controllable
{
	public abstract Control getControl(String __a);
	
	public abstract Control[] getControls();
}









|

|



9
10
11
12
13
14
15
16
17
18
19
20
21
// ---------------------------------------------------------------------------

package javax.microedition.media;


public interface Controllable
{
	Control getControl(String __a);
	
	Control[] getControls();
}


Name change from runt/apis/media-api/javax/microedition/media/Manager.java to modules/media-api/src/main/java/javax/microedition/media/Manager.java.

8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package javax.microedition.media;

import cc.squirreljme.runtime.media.NullPlayer;
import cc.squirreljme.runtime.media.SystemNanoTimeBase;
import java.io.InputStream;
import java.io.IOException;
import javax.microedition.media.protocol.DataSource;

public final class Manager
{
	public static final String MIDI_DEVICE_LOCATOR =
		"device://midi";
	







|
|







8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package javax.microedition.media;

import cc.squirreljme.runtime.media.NullPlayer;
import cc.squirreljme.runtime.media.SystemNanoTimeBase;
import java.io.IOException;
import java.io.InputStream;
import javax.microedition.media.protocol.DataSource;

public final class Manager
{
	public static final String MIDI_DEVICE_LOCATOR =
		"device://midi";
	

Name change from runt/apis/media-api/javax/microedition/media/MediaException.java to modules/media-api/src/main/java/javax/microedition/media/MediaException.java.

Name change from runt/apis/media-api/javax/microedition/media/Player.java to modules/media-api/src/main/java/javax/microedition/media/Player.java.

9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
// ---------------------------------------------------------------------------

package javax.microedition.media;

public interface Player
	extends Controllable
{
	public static final int CLOSED =
		0;
	
	public static final int PREFETCHED =
		300;
	
	public static final int REALIZED =
		200;
	
	public static final int STARTED =
		400;
	
	public static final long TIME_UNKNOWN =
		-1L;
	
	public static final int UNREALIZED =
		100;
	
	public abstract void addPlayerListener(PlayerListener __a);
	
	public abstract void close();
	
	public abstract void deallocate();
	
	public abstract String getContentType();
	
	public abstract long getDuration();
	
	public abstract long getMediaTime();
	
	public abstract int getState();
	
	public abstract TimeBase getTimeBase();
	
	public abstract void prefetch()
		throws MediaException;
	
	public abstract void realize()
		throws MediaException;
	
	public abstract void removePlayerListener(PlayerListener __a);
	
	public abstract void setLoopCount(int __a);
	
	public abstract long setMediaTime(long __a)
		throws MediaException;
	
	public abstract void setTimeBase(TimeBase __a)
		throws MediaException;
	
	public abstract void start()
		throws MediaException;
	
	public abstract void stop()
		throws MediaException;
}









|


|


|


|


|


|


|

|

|

|

|

|

|

|

|


|


|

|

|


|


|


|




9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
// ---------------------------------------------------------------------------

package javax.microedition.media;

public interface Player
	extends Controllable
{
	int CLOSED =
		0;
	
	int PREFETCHED =
		300;
	
	int REALIZED =
		200;
	
	int STARTED =
		400;
	
	long TIME_UNKNOWN =
		-1L;
	
	int UNREALIZED =
		100;
	
	void addPlayerListener(PlayerListener __a);
	
	void close();
	
	void deallocate();
	
	String getContentType();
	
	long getDuration();
	
	long getMediaTime();
	
	int getState();
	
	TimeBase getTimeBase();
	
	void prefetch()
		throws MediaException;
	
	void realize()
		throws MediaException;
	
	void removePlayerListener(PlayerListener __a);
	
	void setLoopCount(int __a);
	
	long setMediaTime(long __a)
		throws MediaException;
	
	void setTimeBase(TimeBase __a)
		throws MediaException;
	
	void start()
		throws MediaException;
	
	void stop()
		throws MediaException;
}


Name change from runt/apis/media-api/javax/microedition/media/PlayerListener.java to modules/media-api/src/main/java/javax/microedition/media/PlayerListener.java.

9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
// ---------------------------------------------------------------------------

package javax.microedition.media;


public interface PlayerListener
{
	public static final String BUFFERING_STARTED =
		"bufferingStarted";
	
	public static final String BUFFERING_STOPPED =
		"bufferingStopped";
	
	public static final String CLOSED =
		"closed";
	
	public static final String DEVICE_AVAILABLE =
		"deviceAvailable";
	
	public static final String DEVICE_UNAVAILABLE =
		"deviceUnavailable";
	
	public static final String DURATION_UPDATED =
		"durationUpdated";
	
	public static final String END_OF_MEDIA =
		"endOfMedia";
	
	public static final String ERROR =
		"error";
	
	public static final String RECORD_ERROR =
		"recordError";
	
	public static final String RECORD_STARTED =
		"recordStarted";
	
	public static final String RECORD_STOPPED =
		"recordStopped";
	
	public static final String SIZE_CHANGED =
		"sizeChanged";
	
	public static final String STARTED =
		"started";
	
	public static final String STOPPED =
		"stopped";
	
	public static final String STOPPED_AT_TIME =
		"stoppedAtTime";
	
	public static final String VOLUME_CHANGED =
		"volumeChanged";
	
	public abstract void playerUpdate(Player __a, String __b, Object __c);
}









|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
// ---------------------------------------------------------------------------

package javax.microedition.media;


public interface PlayerListener
{
	String BUFFERING_STARTED =
		"bufferingStarted";
	
	String BUFFERING_STOPPED =
		"bufferingStopped";
	
	String CLOSED =
		"closed";
	
	String DEVICE_AVAILABLE =
		"deviceAvailable";
	
	String DEVICE_UNAVAILABLE =
		"deviceUnavailable";
	
	String DURATION_UPDATED =
		"durationUpdated";
	
	String END_OF_MEDIA =
		"endOfMedia";
	
	String ERROR =
		"error";
	
	String RECORD_ERROR =
		"recordError";
	
	String RECORD_STARTED =
		"recordStarted";
	
	String RECORD_STOPPED =
		"recordStopped";
	
	String SIZE_CHANGED =
		"sizeChanged";
	
	String STARTED =
		"started";
	
	String STOPPED =
		"stopped";
	
	String STOPPED_AT_TIME =
		"stoppedAtTime";
	
	String VOLUME_CHANGED =
		"volumeChanged";
	
	void playerUpdate(Player __a, String __b, Object __c);
}


Name change from runt/apis/media-api/javax/microedition/media/TimeBase.java to modules/media-api/src/main/java/javax/microedition/media/TimeBase.java.

9
10
11
12
13
14
15
16
17
18
19
// ---------------------------------------------------------------------------

package javax.microedition.media;


public interface TimeBase
{
	public abstract long getTime();
}









|



9
10
11
12
13
14
15
16
17
18
19
// ---------------------------------------------------------------------------

package javax.microedition.media;


public interface TimeBase
{
	long getTime();
}


Name change from runt/apis/media-api/javax/microedition/media/control/FramePositioningControl.java to modules/media-api/src/main/java/javax/microedition/media/control/FramePositioningControl.java.

11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package javax.microedition.media.control;

import javax.microedition.media.Control;

public interface FramePositioningControl
	extends Control
{
	public abstract long mapFrameToTime(int __a);
	
	public abstract int mapTimeToFrame(long __a);
	
	public abstract int seek(int __a);
	
	public abstract int skip(int __a);
}









|

|

|

|



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package javax.microedition.media.control;

import javax.microedition.media.Control;

public interface FramePositioningControl
	extends Control
{
	long mapFrameToTime(int __a);
	
	int mapTimeToFrame(long __a);
	
	int seek(int __a);
	
	int skip(int __a);
}


Name change from runt/apis/media-api/javax/microedition/media/control/GUIControl.java to modules/media-api/src/main/java/javax/microedition/media/control/GUIControl.java.

11
12
13
14
15
16
17
18
19
20
21
22
23
24
package javax.microedition.media.control;

import javax.microedition.media.Control;

public interface GUIControl
	extends Control
{
	public static final int USE_GUI_PRIMITIVE =
		0;
	
	public abstract Object initDisplayMode(int __a, Object __b);
}









|


|



11
12
13
14
15
16
17
18
19
20
21
22
23
24
package javax.microedition.media.control;

import javax.microedition.media.Control;

public interface GUIControl
	extends Control
{
	int USE_GUI_PRIMITIVE =
		0;
	
	Object initDisplayMode(int __a, Object __b);
}


Name change from runt/apis/media-api/javax/microedition/media/control/MIDIControl.java to modules/media-api/src/main/java/javax/microedition/media/control/MIDIControl.java.

12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53

import javax.microedition.media.Control;
import javax.microedition.media.MediaException;

public interface MIDIControl
	extends Control
{
	public static final int CONTROL_CHANGE =
		176;
	
	public static final int NOTE_ON =
		144;
	
	public abstract int[] getBankList(boolean __a)
		throws MediaException;
	
	public abstract int getChannelVolume(int __a);
	
	public abstract String getKeyName(int __a, int __b, int __c)
		throws MediaException;
	
	public abstract int[] getProgram(int __a)
		throws MediaException;
	
	public abstract int[] getProgramList(int __a)
		throws MediaException;
	
	public abstract String getProgramName(int __a, int __b)
		throws MediaException;
	
	public abstract boolean isBankQuerySupported();
	
	public abstract int longMidiEvent(byte[] __a, int __b, int __c);
	
	public abstract void setChannelVolume(int __a, int __b);
	
	public abstract void setProgram(int __a, int __b, int __c);
	
	public abstract void shortMidiEvent(int __a, int __b, int __c);
}









|


|


|


|

|


|


|


|


|

|

|

|

|



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53

import javax.microedition.media.Control;
import javax.microedition.media.MediaException;

public interface MIDIControl
	extends Control
{
	int CONTROL_CHANGE =
		176;
	
	int NOTE_ON =
		144;
	
	int[] getBankList(boolean __a)
		throws MediaException;
	
	int getChannelVolume(int __a);
	
	String getKeyName(int __a, int __b, int __c)
		throws MediaException;
	
	int[] getProgram(int __a)
		throws MediaException;
	
	int[] getProgramList(int __a)
		throws MediaException;
	
	String getProgramName(int __a, int __b)
		throws MediaException;
	
	boolean isBankQuerySupported();
	
	int longMidiEvent(byte[] __a, int __b, int __c);
	
	void setChannelVolume(int __a, int __b);
	
	void setProgram(int __a, int __b, int __c);
	
	void shortMidiEvent(int __a, int __b, int __c);
}


Name change from runt/apis/media-api/javax/microedition/media/control/MetaDataControl.java to modules/media-api/src/main/java/javax/microedition/media/control/MetaDataControl.java.

11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package javax.microedition.media.control;

import javax.microedition.media.Control;

public interface MetaDataControl
	extends Control
{
	public static final String AUTHOR_KEY =
		"author";
	
	public static final String COPYRIGHT_KEY =
		"copyright";
	
	public static final String DATE_KEY =
		"date";
	
	public static final String TITLE_KEY =
		"title";
	
	public abstract String getKeyValue(String __a);
	
	public abstract String[] getKeys();
}









|


|


|


|


|

|



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package javax.microedition.media.control;

import javax.microedition.media.Control;

public interface MetaDataControl
	extends Control
{
	String AUTHOR_KEY =
		"author";
	
	String COPYRIGHT_KEY =
		"copyright";
	
	String DATE_KEY =
		"date";
	
	String TITLE_KEY =
		"title";
	
	String getKeyValue(String __a);
	
	String[] getKeys();
}


Name change from runt/apis/media-api/javax/microedition/media/control/PitchControl.java to modules/media-api/src/main/java/javax/microedition/media/control/PitchControl.java.

11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package javax.microedition.media.control;

import javax.microedition.media.Control;

public interface PitchControl
	extends Control
{
	public abstract int getMaxPitch();
	
	public abstract int getMinPitch();
	
	public abstract int getPitch();
	
	public abstract int setPitch(int __a);
}









|

|

|

|



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package javax.microedition.media.control;

import javax.microedition.media.Control;

public interface PitchControl
	extends Control
{
	int getMaxPitch();
	
	int getMinPitch();
	
	int getPitch();
	
	int setPitch(int __a);
}


Name change from runt/apis/media-api/javax/microedition/media/control/RateControl.java to modules/media-api/src/main/java/javax/microedition/media/control/RateControl.java.

11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package javax.microedition.media.control;

import javax.microedition.media.Control;

public interface RateControl
	extends Control
{
	public abstract int getMaxRate();
	
	public abstract int getMinRate();
	
	public abstract int getRate();
	
	public abstract int setRate(int __a);
}









|

|

|

|



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package javax.microedition.media.control;

import javax.microedition.media.Control;

public interface RateControl
	extends Control
{
	int getMaxRate();
	
	int getMinRate();
	
	int getRate();
	
	int setRate(int __a);
}


Name change from runt/apis/media-api/javax/microedition/media/control/RecordControl.java to modules/media-api/src/main/java/javax/microedition/media/control/RecordControl.java.

14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import java.io.OutputStream;
import javax.microedition.media.Control;
import javax.microedition.media.MediaException;

public interface RecordControl
	extends Control
{
	public abstract void commit()
		throws IOException;
	
	public abstract String getContentType();
	
	public abstract void reset()
		throws IOException;
	
	public abstract void setRecordLocation(String __a)
		throws IOException, MediaException;
	
	public abstract int setRecordSizeLimit(int __a)
		throws MediaException;
	
	public abstract void setRecordStream(OutputStream __a);
	
	public abstract void startRecord();
	
	public abstract void stopRecord();
}









|


|

|


|


|


|

|

|



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import java.io.OutputStream;
import javax.microedition.media.Control;
import javax.microedition.media.MediaException;

public interface RecordControl
	extends Control
{
	void commit()
		throws IOException;
	
	String getContentType();
	
	void reset()
		throws IOException;
	
	void setRecordLocation(String __a)
		throws IOException, MediaException;
	
	int setRecordSizeLimit(int __a)
		throws MediaException;
	
	void setRecordStream(OutputStream __a);
	
	void startRecord();
	
	void stopRecord();
}


Name change from runt/apis/media-api/javax/microedition/media/control/StopTimeControl.java to modules/media-api/src/main/java/javax/microedition/media/control/StopTimeControl.java.

11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package javax.microedition.media.control;

import javax.microedition.media.Control;

public interface StopTimeControl
	extends Control
{
	public static final long RESET =
		9223372036854775807L;
	
	public abstract long getStopTime();
	
	public abstract void setStopTime(long __a);
}









|


|

|



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package javax.microedition.media.control;

import javax.microedition.media.Control;

public interface StopTimeControl
	extends Control
{
	long RESET =
		9223372036854775807L;
	
	long getStopTime();
	
	void setStopTime(long __a);
}


Name change from runt/apis/media-api/javax/microedition/media/control/TempoControl.java to modules/media-api/src/main/java/javax/microedition/media/control/TempoControl.java.

10
11
12
13
14
15
16
17
18
19
20
21
22

package javax.microedition.media.control;


public interface TempoControl
	extends RateControl
{
	public abstract int getTempo();
	
	public abstract int setTempo(int __a);
}









|

|



10
11
12
13
14
15
16
17
18
19
20
21
22

package javax.microedition.media.control;


public interface TempoControl
	extends RateControl
{
	int getTempo();
	
	int setTempo(int __a);
}


Name change from runt/apis/media-api/javax/microedition/media/control/ToneControl.java to modules/media-api/src/main/java/javax/microedition/media/control/ToneControl.java.

11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package javax.microedition.media.control;

import javax.microedition.media.Control;

public interface ToneControl
	extends Control
{
	public static final byte BLOCK_END =
		-6;
	
	public static final byte BLOCK_START =
		-5;
	
	public static final byte C4 =
		60;
	
	public static final byte PLAY_BLOCK =
		-7;
	
	public static final byte REPEAT =
		-9;
	
	public static final byte RESOLUTION =
		-4;
	
	public static final byte SET_VOLUME =
		-8;
	
	public static final byte SILENCE =
		-1;
	
	public static final byte TEMPO =
		-3;
	
	public static final byte VERSION =
		-2;
	
	public abstract void setSequence(byte[] __a);
}









|


|


|


|


|


|


|


|


|


|


|



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package javax.microedition.media.control;

import javax.microedition.media.Control;

public interface ToneControl
	extends Control
{
	byte BLOCK_END =
		-6;
	
	byte BLOCK_START =
		-5;
	
	byte C4 =
		60;
	
	byte PLAY_BLOCK =
		-7;
	
	byte REPEAT =
		-9;
	
	byte RESOLUTION =
		-4;
	
	byte SET_VOLUME =
		-8;
	
	byte SILENCE =
		-1;
	
	byte TEMPO =
		-3;
	
	byte VERSION =
		-2;
	
	void setSequence(byte[] __a);
}


Name change from runt/apis/media-api/javax/microedition/media/control/VideoControl.java to modules/media-api/src/main/java/javax/microedition/media/control/VideoControl.java.

11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package javax.microedition.media.control;

import javax.microedition.media.MediaException;

public interface VideoControl
	extends GUIControl
{
	public static final int USE_DIRECT_VIDEO =
		1;
	
	public abstract int getDisplayHeight();
	
	public abstract int getDisplayWidth();
	
	public abstract int getDisplayX();
	
	public abstract int getDisplayY();
	
	public abstract byte[] getSnapshot(String __a)
		throws MediaException;
	
	public abstract int getSourceHeight();
	
	public abstract int getSourceWidth();
	
	public abstract Object initDisplayMode(int __a, Object __b);
	
	public abstract void setDisplayFullScreen(boolean __a)
		throws MediaException;
	
	public abstract void setDisplayLocation(int __a, int __b);
	
	public abstract void setDisplaySize(int __a, int __b)
		throws MediaException;
	
	public abstract void setVisible(boolean __a);
}









|


|

|

|

|

|


|

|

|

|


|

|


|



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package javax.microedition.media.control;

import javax.microedition.media.MediaException;

public interface VideoControl
	extends GUIControl
{
	int USE_DIRECT_VIDEO =
		1;
	
	int getDisplayHeight();
	
	int getDisplayWidth();
	
	int getDisplayX();
	
	int getDisplayY();
	
	byte[] getSnapshot(String __a)
		throws MediaException;
	
	int getSourceHeight();
	
	int getSourceWidth();
	
	Object initDisplayMode(int __a, Object __b);
	
	void setDisplayFullScreen(boolean __a)
		throws MediaException;
	
	void setDisplayLocation(int __a, int __b);
	
	void setDisplaySize(int __a, int __b)
		throws MediaException;
	
	void setVisible(boolean __a);
}


Name change from runt/apis/media-api/javax/microedition/media/control/VolumeControl.java to modules/media-api/src/main/java/javax/microedition/media/control/VolumeControl.java.

11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package javax.microedition.media.control;

import javax.microedition.media.Control;

public interface VolumeControl
	extends Control
{
	public abstract int getLevel();
	
	public abstract boolean isMuted();
	
	public abstract int setLevel(int __a);
	
	public abstract void setMute(boolean __a);
}









|

|

|

|



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package javax.microedition.media.control;

import javax.microedition.media.Control;

public interface VolumeControl
	extends Control
{
	int getLevel();
	
	boolean isMuted();
	
	int setLevel(int __a);
	
	void setMute(boolean __a);
}


Name change from runt/apis/media-api/javax/microedition/media/protocol/ContentDescriptor.java to modules/media-api/src/main/java/javax/microedition/media/protocol/ContentDescriptor.java.

11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package javax.microedition.media.protocol;


public class ContentDescriptor
{
	public ContentDescriptor(String __a)
	{
		super();
		throw new todo.TODO();
	}
	
	public String getContentType()
	{
		throw new todo.TODO();
	}







<







11
12
13
14
15
16
17

18
19
20
21
22
23
24
package javax.microedition.media.protocol;


public class ContentDescriptor
{
	public ContentDescriptor(String __a)
	{

		throw new todo.TODO();
	}
	
	public String getContentType()
	{
		throw new todo.TODO();
	}

Name change from runt/apis/media-api/javax/microedition/media/protocol/DataSource.java to modules/media-api/src/main/java/javax/microedition/media/protocol/DataSource.java.

15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import javax.microedition.media.Controllable;

public abstract class DataSource
	implements Controllable
{
	public DataSource(String __a)
	{
		super();
		throw new todo.TODO();
	}
	
	public abstract void connect()
		throws IOException;
	
	public abstract void disconnect();







<







15
16
17
18
19
20
21

22
23
24
25
26
27
28
import javax.microedition.media.Controllable;

public abstract class DataSource
	implements Controllable
{
	public DataSource(String __a)
	{

		throw new todo.TODO();
	}
	
	public abstract void connect()
		throws IOException;
	
	public abstract void disconnect();

Name change from runt/apis/media-api/javax/microedition/media/protocol/SourceStream.java to modules/media-api/src/main/java/javax/microedition/media/protocol/SourceStream.java.

12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45

import java.io.IOException;
import javax.microedition.media.Controllable;

public interface SourceStream
	extends Controllable
{
	public static final int NOT_SEEKABLE =
		0;
	
	public static final int RANDOM_ACCESSIBLE =
		2;
	
	public static final int SEEKABLE_TO_START =
		1;
	
	public abstract ContentDescriptor getContentDescriptor();
	
	public abstract long getContentLength();
	
	public abstract int getSeekType();
	
	public abstract int getTransferSize();
	
	public abstract int read(byte[] __a, int __b, int __c)
		throws IOException;
	
	public abstract long seek(long __a)
		throws IOException;
	
	public abstract long tell();
}









|


|


|


|

|

|

|

|


|


|



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45

import java.io.IOException;
import javax.microedition.media.Controllable;

public interface SourceStream
	extends Controllable
{
	int NOT_SEEKABLE =
		0;
	
	int RANDOM_ACCESSIBLE =
		2;
	
	int SEEKABLE_TO_START =
		1;
	
	ContentDescriptor getContentDescriptor();
	
	long getContentLength();
	
	int getSeekType();
	
	int getTransferSize();
	
	int read(byte[] __a, int __b, int __c)
		throws IOException;
	
	long seek(long __a)
		throws IOException;
	
	long tell();
}


Added modules/meep-cellular/build.gradle.









































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import cc.squirreljme.plugin.swm.JavaMEMidletType
import cc.squirreljme.plugin.swm.JavaMEStandard

description = "This provides an implementation which is used " +
	"to access cellular networks."
version = rootProject.version

squirreljme
{
	javaDocErrorCode = "DH"
	swmType = JavaMEMidletType.API
	swmName = "MEEP Cellular Networking"
	swmVendor = "Stephanie Gawroriski"
	definedStandards += new JavaMEStandard("microedition.cellular;;")
}

dependencies
{
	implementation project(":modules:cldc-compact")
}

Added modules/meep-concurrency/build.gradle.









































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import cc.squirreljme.plugin.swm.JavaMEMidletType
import cc.squirreljme.plugin.swm.JavaMEStandard

description = "The concurrency APIs allows multiple applications to run " +
	"at the same time."
version = rootProject.version

squirreljme
{
	javaDocErrorCode = "DK"
	swmType = JavaMEMidletType.API
	swmName = "MEEP Concurrency"
	swmVendor = "Stephanie Gawroriski"
	definedStandards += new JavaMEStandard("microedition.concurrency;;")
}

dependencies
{
	implementation project(":modules:cldc-compact")
}

Added modules/meep-event/build.gradle.











































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import cc.squirreljme.plugin.swm.JavaMEMidletType
import cc.squirreljme.plugin.swm.JavaMEStandard

description = "This provides an interface which allows an " +
	"application to receive events from the system along withsending events " +
	"to other running applications."
version = rootProject.version

squirreljme
{
	javaDocErrorCode = "DI"
	swmType = JavaMEMidletType.API
	swmName = "MEEP Event Management"
	swmVendor = "Stephanie Gawroriski"
	definedStandards += new JavaMEStandard("microedition.event;;")
}

dependencies
{
	implementation project(":modules:cldc-compact")
}

Added modules/meep-key/build.gradle.









































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import cc.squirreljme.plugin.swm.JavaMEMidletType
import cc.squirreljme.plugin.swm.JavaMEStandard

description = "This contains classes for handling key and other " +
	"user input events."
version = rootProject.version

squirreljme
{
	javaDocErrorCode = "DB"
	swmType = JavaMEMidletType.API
	swmName = "MEEP Key Events"
	swmVendor = "Stephanie Gawroriski"
	definedStandards += new JavaMEStandard("microedition.key;;")
}

dependencies
{
	implementation project(":modules:cldc-compact")
}

Name change from runt/apis/meep-key/javax/microedition/key/InputDevice.java to modules/meep-key/src/main/java/javax/microedition/key/InputDevice.java.

8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package javax.microedition.key;

public interface InputDevice
{
	public abstract void setKeyListener(KeyListener __l);

	public abstract String getId();

	public abstract boolean isHardwareAssigned();

	public abstract void setHardwareAssigned(boolean __h);
}








|

|

|

|


8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package javax.microedition.key;

public interface InputDevice
{
	void setKeyListener(KeyListener __l);

	String getId();

	boolean isHardwareAssigned();

	void setHardwareAssigned(boolean __h);
}

Name change from runt/apis/meep-key/javax/microedition/key/InputDeviceListener.java to modules/meep-key/src/main/java/javax/microedition/key/InputDeviceListener.java.

13
14
15
16
17
18
19
20
21
22
23
24
25
26
/**
 * DESCRIBE THIS.
 *
 * @since 2016/08/30
 */
public interface InputDeviceListener
{
	public abstract void hardwareStateChanged(InputDevice __dev, boolean __hw);

	public abstract void inputDeviceAdded(InputDevice __dev);

	public abstract void inputDeviceRemoved(InputDevice __dev);
}








|

|

|


13
14
15
16
17
18
19
20
21
22
23
24
25
26
/**
 * DESCRIBE THIS.
 *
 * @since 2016/08/30
 */
public interface InputDeviceListener
{
	void hardwareStateChanged(InputDevice __dev, boolean __hw);

	void inputDeviceAdded(InputDevice __dev);

	void inputDeviceRemoved(InputDevice __dev);
}

Name change from runt/apis/meep-key/javax/microedition/key/KeyListener.java to modules/meep-key/src/main/java/javax/microedition/key/KeyListener.java.

8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package javax.microedition.key;

public interface KeyListener
{
	public static final int DOWN =
		6;
		
	public static final int KEY_BACKSPACE =
		8;
		
	public static final int KEY_DELETE =
		127;
		
	public static final int KEY_DOWN =
		-2;
		
	public static final int KEY_ENTER =
		10;
		
	public static final int KEY_ESCAPE =
		27;
		
	public static final int KEY_LEFT =
		-3;
		
	public static final int KEY_NUM0 =
		48;
		
	public static final int KEY_NUM1 =
		49;
		
	public static final int KEY_NUM2 =
		50;
		
	public static final int KEY_NUM3 =
		51;
		
	public static final int KEY_NUM4 =
		52;
		
	public static final int KEY_NUM5 =
		53;
		
	public static final int KEY_NUM6 =
		54;
		
	public static final int KEY_NUM7 =
		55;
		
	public static final int KEY_NUM8 =
		56;
		
	public static final int KEY_NUM9 =
		57;
		
	public static final int KEY_POUND =
		35;
		
	public static final int KEY_RIGHT =
		-4;
		
	public static final int KEY_SELECT =
		-5;
		
	public static final int KEY_SPACE =
		32;
		
	public static final int KEY_STAR =
		42;
		
	public static final int KEY_TAB =
		9;
		
	public static final int KEY_UP =
		-1;
		
	public static final int LEFT =
		2;
		
	public static final int MODIFIER_ALT =
		65536;
		
	public static final int MODIFIER_CHR =
		8388608;
		
	public static final int MODIFIER_COMMAND =
		4194304;
		
	public static final int MODIFIER_CTRL =
		262144;
		
	public static final int MODIFIER_MASK =
		13041664;
		
	public static final int MODIFIER_SHIFT =
		131072;
		
	public static final int RIGHT =
		5;
		
	public static final int UP =
		1;

	public abstract void keyPressed(InputDevice __dev, int __code, int __mod);

	public abstract void keyReleased(InputDevice __dev, int __code, int __mod);

	public abstract void keyRepeated(InputDevice __dev, int __code, int __mod);
}








|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|

|

|


8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package javax.microedition.key;

public interface KeyListener
{
	int DOWN =
		6;
		
	int KEY_BACKSPACE =
		8;
		
	int KEY_DELETE =
		127;
		
	int KEY_DOWN =
		-2;
		
	int KEY_ENTER =
		10;
		
	int KEY_ESCAPE =
		27;
		
	int KEY_LEFT =
		-3;
		
	int KEY_NUM0 =
		48;
		
	int KEY_NUM1 =
		49;
		
	int KEY_NUM2 =
		50;
		
	int KEY_NUM3 =
		51;
		
	int KEY_NUM4 =
		52;
		
	int KEY_NUM5 =
		53;
		
	int KEY_NUM6 =
		54;
		
	int KEY_NUM7 =
		55;
		
	int KEY_NUM8 =
		56;
		
	int KEY_NUM9 =
		57;
		
	int KEY_POUND =
		35;
		
	int KEY_RIGHT =
		-4;
		
	int KEY_SELECT =
		-5;
		
	int KEY_SPACE =
		32;
		
	int KEY_STAR =
		42;
		
	int KEY_TAB =
		9;
		
	int KEY_UP =
		-1;
		
	int LEFT =
		2;
		
	int MODIFIER_ALT =
		65536;
		
	int MODIFIER_CHR =
		8388608;
		
	int MODIFIER_COMMAND =
		4194304;
		
	int MODIFIER_CTRL =
		262144;
		
	int MODIFIER_MASK =
		13041664;
		
	int MODIFIER_SHIFT =
		131072;
		
	int RIGHT =
		5;
		
	int UP =
		1;

	void keyPressed(InputDevice __dev, int __code, int __mod);

	void keyReleased(InputDevice __dev, int __code, int __mod);

	void keyRepeated(InputDevice __dev, int __code, int __mod);
}

Name change from runt/apis/meep-key/javax/microedition/key/KeyManager.java to modules/meep-key/src/main/java/javax/microedition/key/KeyManager.java.

Name change from runt/apis/meep-key/javax/microedition/key/package-info.java to modules/meep-key/src/main/java/javax/microedition/key/package-info.java.

Added modules/meep-liblets/build.gradle.







































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import cc.squirreljme.plugin.swm.JavaMEMidletType
import cc.squirreljme.plugin.swm.JavaMEStandard

description = "This provides support for application suites and LIBlets."
version = rootProject.version

squirreljme
{
	javaDocErrorCode = "DL"
	swmType = JavaMEMidletType.API
	swmName = "MEEP Application Suites and LIBlets"
	swmVendor = "Stephanie Gawroriski"
	definedStandards += new JavaMEStandard("microedition.liblets;;")
}

dependencies
{
	implementation project(":modules:cldc-compact")
}

Added modules/meep-lui/build.gradle.

















































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import cc.squirreljme.plugin.swm.JavaMEMidletType
import cc.squirreljme.plugin.swm.JavaMEStandard

description = "This contains the base support for the line " +
	"based interface."
version = rootProject.version

squirreljme
{
	javaDocErrorCode = "DA"
	swmType = JavaMEMidletType.API
	swmName = "MEEP Line Based Interface"
	swmVendor = "Stephanie Gawroriski"
	definedStandards += new JavaMEStandard("microedition.lui;;")
}

dependencies
{
	implementation project(":modules:cldc-compact")

	implementation project(":modules:meep-key")
	implementation project(":modules:collections")
	implementation project(":modules:gcf")
}

Name change from runt/apis/meep-lui/cc/squirreljme/runtime/lui/package-info.java to modules/meep-lui/src/main/java/cc/squirreljme/runtime/lui/package-info.java.

Name change from runt/apis/meep-lui/javax/microedition/lui/Display.java to modules/meep-lui/src/main/java/javax/microedition/lui/Display.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package javax.microedition.lui;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.ServiceLoader;
import net.multiphasicapps.collections.EmptyIterator;

/**
 * This provides an interface to basic text based displays.
 *
 * There may be multiple displays associated with a device and the displays
 * that are available may change at any rate. It is possible for a display to
 * support user input, which in this case it will generate key events.












<
<

<
<
<
<
<







1
2
3
4
5
6
7
8
9
10
11
12


13





14
15
16
17
18
19
20
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package javax.microedition.lui;



import java.util.Iterator;






/**
 * This provides an interface to basic text based displays.
 *
 * There may be multiple displays associated with a device and the displays
 * that are available may change at any rate. It is possible for a display to
 * support user input, which in this case it will generate key events.
238
239
240
241
242
243
244

245
246
247
248
249
250
251
	 * Returns the number of milliseconds between character shifts for the
	 * given line.
	 *
	 * If the display does not support horizontal scrolling then the value
	 * returned here is meaningless.
	 *
	 * @param __l The line to get the scrolling interval of.

	 * @throws ArrayIndexOutOfBoundsException If the specified line is not
	 * within the bounds of the display.
	 * @since 2016/08/30
	 */
	public int getHorizontalScrollingInterval(int __l)
		throws ArrayIndexOutOfBoundsException
	{







>







231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
	 * Returns the number of milliseconds between character shifts for the
	 * given line.
	 *
	 * If the display does not support horizontal scrolling then the value
	 * returned here is meaningless.
	 *
	 * @param __l The line to get the scrolling interval of.
	 * @return The scrolling interval.
	 * @throws ArrayIndexOutOfBoundsException If the specified line is not
	 * within the bounds of the display.
	 * @since 2016/08/30
	 */
	public int getHorizontalScrollingInterval(int __l)
		throws ArrayIndexOutOfBoundsException
	{
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
	 * @throws ArrayIndexOutOfBoundsException If the offset and/or length
	 * are negative or exceed the array bounds.
	 * @since 2016/08/30
	 */
	public void setChars(char[] __c, int __o, int __l)
		throws ArrayIndexOutOfBoundsException
	{
		setChars(__c, __o, __l, false, false);
	}
	
	/**
	 * Sets the characters used on the display. The entire display is used.
	 *
	 * @param __c The charactes to use.
	 * @param __o The offset in the charater array.







|







470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
	 * @throws ArrayIndexOutOfBoundsException If the offset and/or length
	 * are negative or exceed the array bounds.
	 * @since 2016/08/30
	 */
	public void setChars(char[] __c, int __o, int __l)
		throws ArrayIndexOutOfBoundsException
	{
		this.setChars(__c, __o, __l, false, false);
	}
	
	/**
	 * Sets the characters used on the display. The entire display is used.
	 *
	 * @param __c The charactes to use.
	 * @param __o The offset in the charater array.
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
	 * are negative or exceed the array bounds; or the line is not within
	 * bounds of the display.
	 * @since 2016/08/30
	 */
	public void setChars(int __ln, char[] __c, int __o, int __l)
		throws ArrayIndexOutOfBoundsException
	{
		setChars(__ln, __c, __o, __l, false, false);
	}
	
	/**
	 * Sets the characters used on the display, on the given line.
	 *
	 * @param __ln The line to set text for.
	 * @param __c The charactes to use.







|







507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
	 * are negative or exceed the array bounds; or the line is not within
	 * bounds of the display.
	 * @since 2016/08/30
	 */
	public void setChars(int __ln, char[] __c, int __o, int __l)
		throws ArrayIndexOutOfBoundsException
	{
		this.setChars(__ln, __c, __o, __l, false, false);
	}
	
	/**
	 * Sets the characters used on the display, on the given line.
	 *
	 * @param __ln The line to set text for.
	 * @param __c The charactes to use.
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
	
	/**
	 * Sets the color of the light to use for the given display.
	 *
	 * If {@code null} is specified then the light is turned off, otherwise
	 * it is switched on.
	 *
	 * @param __c The color to use for the light.
	 * @return The actually used color.
	 * @since 2016/08/30
	 */
	public DisplayColor setLightingColor(DisplayColor __l)
	{
		throw new todo.TODO();
	}
	
	/**
	 * Sets the characters used on the display. The entire display is used.
	 *
	 * @param __t The text to display.
	 * @since 2016/08/30
	 */
	public void setText(String __t)
	{
		setText(__t, false, false);
	}
	
	/**
	 * Sets the characters used on the display. The entire display is used.
	 *
	 * @param __t The text to display.
	 * @param __blink Should characters blink, if supported?







|
















|







615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
	
	/**
	 * Sets the color of the light to use for the given display.
	 *
	 * If {@code null} is specified then the light is turned off, otherwise
	 * it is switched on.
	 *
	 * @param __l The color to use for the light.
	 * @return The actually used color.
	 * @since 2016/08/30
	 */
	public DisplayColor setLightingColor(DisplayColor __l)
	{
		throw new todo.TODO();
	}
	
	/**
	 * Sets the characters used on the display. The entire display is used.
	 *
	 * @param __t The text to display.
	 * @since 2016/08/30
	 */
	public void setText(String __t)
	{
		this.setText(__t, false, false);
	}
	
	/**
	 * Sets the characters used on the display. The entire display is used.
	 *
	 * @param __t The text to display.
	 * @param __blink Should characters blink, if supported?
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
	 * @throws ArrayIndexOutOfBoundsException If the line is not within
	 * bounds of the display.
	 * @since 2016/08/30
	 */
	public void setText(int __ln, String __t)
		throws ArrayIndexOutOfBoundsException
	{
		setText(__ln, __t, false, false);
	}
	
	/**
	 * Sets the characters used on the display, on the given line.
	 *
	 * @param __ln The line to set text for.
	 * @param __t The text to display.







|







660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
	 * @throws ArrayIndexOutOfBoundsException If the line is not within
	 * bounds of the display.
	 * @since 2016/08/30
	 */
	public void setText(int __ln, String __t)
		throws ArrayIndexOutOfBoundsException
	{
		this.setText(__ln, __t, false, false);
	}
	
	/**
	 * Sets the characters used on the display, on the given line.
	 *
	 * @param __ln The line to set text for.
	 * @param __t The text to display.

Name change from runt/apis/meep-lui/javax/microedition/lui/DisplayCapability.java to modules/meep-lui/src/main/java/javax/microedition/lui/DisplayCapability.java.

Name change from runt/apis/meep-lui/javax/microedition/lui/DisplayColor.java to modules/meep-lui/src/main/java/javax/microedition/lui/DisplayColor.java.

55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
	{
		// Check
		if (!(__o instanceof DisplayColor))
			return false;
		
		// Cast and check
		DisplayColor o = (DisplayColor)__o;
		return getRedComponent() == o.getRedComponent() &&
			getGreenComponent() == o.getGreenComponent() &&
			getBlueComponent() == o.getBlueComponent();
	}
	
	/**
	 * Returns the blue component.
	 *
	 * @return The blue component.
	 * @since 2016/08/30







|
|
|







55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
	{
		// Check
		if (!(__o instanceof DisplayColor))
			return false;
		
		// Cast and check
		DisplayColor o = (DisplayColor)__o;
		return this.getRedComponent() == o.getRedComponent() && this
			.getGreenComponent() == o.getGreenComponent() && this
			.getBlueComponent() == o.getBlueComponent();
	}
	
	/**
	 * Returns the blue component.
	 *
	 * @return The blue component.
	 * @since 2016/08/30

Name change from runt/apis/meep-lui/javax/microedition/lui/DisplayListener.java to modules/meep-lui/src/main/java/javax/microedition/lui/DisplayListener.java.

21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41

42
43
44
45
46
47
48
{
	/**
	 * This is called when a new display has been added to the device.
	 *
	 * @param __d The display which was added.
	 * @since 2016/08/30
	 */
	public abstract void displayAdded(Display __d);
	
	/**
	 * This is called when a display has been removed from the device, any
	 * actions on the display following this might not have any effect.
	 *
	 * @param __d The display which was removed.
	 * @since 2016/08/30
	 */
	public abstract void displayRemoved(Display __d);
	
	/**
	 * This is called when the state of a display changes in hardware.
	 *

	 * @param __ns If {@code true} then the display was reassigned on the
	 * underlying hardware, if {@code false} then the display was unassigned.
	 * @since 2016/08/30
	 */
	public abstract void hardwareStateChanged(Display __d, boolean __ns);
}








|








|




>




|


21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
{
	/**
	 * This is called when a new display has been added to the device.
	 *
	 * @param __d The display which was added.
	 * @since 2016/08/30
	 */
	void displayAdded(Display __d);
	
	/**
	 * This is called when a display has been removed from the device, any
	 * actions on the display following this might not have any effect.
	 *
	 * @param __d The display which was removed.
	 * @since 2016/08/30
	 */
	void displayRemoved(Display __d);
	
	/**
	 * This is called when the state of a display changes in hardware.
	 *
	 * @param __d The display that changed state.
	 * @param __ns If {@code true} then the display was reassigned on the
	 * underlying hardware, if {@code false} then the display was unassigned.
	 * @since 2016/08/30
	 */
	void hardwareStateChanged(Display __d, boolean __ns);
}

Name change from runt/apis/meep-lui/javax/microedition/lui/package-info.java to modules/meep-lui/src/main/java/javax/microedition/lui/package-info.java.

Added modules/meep-midlet/build.gradle.

















































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import cc.squirreljme.plugin.swm.JavaMEMidletType
import cc.squirreljme.plugin.swm.JavaMEStandard

description = "This contains the MIDlet interface which " +
	"acts as the main entry point for all MIDlets."
version = rootProject.version

squirreljme
{
	javaDocErrorCode = "AD"
	swmType = JavaMEMidletType.API
	swmName = "MEEP MIDlet Interface"
	swmVendor = "Stephanie Gawroriski"
	definedStandards += new JavaMEStandard("microedition.midlet;;")
}

dependencies
{
	implementation project(":modules:cldc-compact")

	implementation project(":modules:tool-manifest-reader")
	implementation project(":modules:strings")
	implementation project(":modules:collections")
}

Name change from runt/apis/meep-midlet/cc/squirreljme/runtime/midlet/ActiveMidlet.java to modules/meep-midlet/src/main/java/cc/squirreljme/runtime/midlet/ActiveMidlet.java.

61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95

96
97
98
99
100
101
102
103
	 * @return The active midlet or {@code null} if none is active.
	 * @since 2019/04/14
	 */
	public static MIDlet optional()
		throws IllegalStateException
	{
		// Lock
		synchronized (_ACTIVE_LOCK)
		{
			return _ACTIVE_MIDLET;
		}
	}
	
	/**
	 * Sets the currently active midlet.
	 *
	 * @param __m The midlet to set.
	 * @throws IllegalStateException If a midlet is already set.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/02/26
	 */
	public static void set(MIDlet __m)
		throws IllegalStateException, NullPointerException
	{
		// Check
		if (__m == null)
			throw new NullPointerException("NARG");
		
		// Prevent multiple MIDlet launches
		synchronized (_ACTIVE_LOCK)
		{
			// {@squirreljme.error AD02 Only a single MIDlet may be active at
			// a time.}
			MIDlet active = _ACTIVE_MIDLET;
			if (active != null)

				throw new IllegalStateException("AD02");
			
			// Set active midlet
			_ACTIVE_MIDLET = __m;
		}
	}
}








|

|


















|
|



|
|
>



|




61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
	 * @return The active midlet or {@code null} if none is active.
	 * @since 2019/04/14
	 */
	public static MIDlet optional()
		throws IllegalStateException
	{
		// Lock
		synchronized (ActiveMidlet._ACTIVE_LOCK)
		{
			return ActiveMidlet._ACTIVE_MIDLET;
		}
	}
	
	/**
	 * Sets the currently active midlet.
	 *
	 * @param __m The midlet to set.
	 * @throws IllegalStateException If a midlet is already set.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/02/26
	 */
	public static void set(MIDlet __m)
		throws IllegalStateException, NullPointerException
	{
		// Check
		if (__m == null)
			throw new NullPointerException("NARG");
		
		// Prevent multiple MIDlet instantiations
		synchronized (ActiveMidlet._ACTIVE_LOCK)
		{
			// {@squirreljme.error AD02 Only a single MIDlet may be active at
			// a time.}
			MIDlet active = ActiveMidlet._ACTIVE_MIDLET;
			if (active != null &&
				!(__m instanceof OverrideActiveMidletRestriction))
				throw new IllegalStateException("AD02");
			
			// Set active midlet
			ActiveMidlet._ACTIVE_MIDLET = __m;
		}
	}
}

Added modules/meep-midlet/src/main/java/cc/squirreljme/runtime/midlet/OverrideActiveMidletRestriction.java.























>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
package cc.squirreljme.runtime.midlet;

/**
 * This overrides the active MIDlet restriction allowing it to replace
 * other active MIDlets, this should only be used for tests.
 *
 * @since 2020/02/23
 */
public interface OverrideActiveMidletRestriction
{
}

Name change from runt/apis/meep-midlet/cc/squirreljme/runtime/midlet/package-info.java to modules/meep-midlet/src/main/java/cc/squirreljme/runtime/midlet/package-info.java.

Name change from runt/apis/meep-midlet/javax/microedition/midlet/AutoStartPermission.java to modules/meep-midlet/src/main/java/javax/microedition/midlet/AutoStartPermission.java.

Name change from runt/apis/meep-midlet/javax/microedition/midlet/MIDlet.java to modules/meep-midlet/src/main/java/javax/microedition/midlet/MIDlet.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package javax.microedition.midlet;

import cc.squirreljme.runtime.midlet.ActiveMidlet;
import java.io.InputStream;
import java.io.IOException;
import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import net.multiphasicapps.tool.manifest.JavaManifest;
import net.multiphasicapps.tool.manifest.JavaManifestKey;

public abstract class MIDlet
{













|
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package javax.microedition.midlet;

import cc.squirreljme.runtime.midlet.ActiveMidlet;
import java.io.IOException;
import java.io.InputStream;
import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import net.multiphasicapps.tool.manifest.JavaManifest;
import net.multiphasicapps.tool.manifest.JavaManifestKey;

public abstract class MIDlet
{
37
38
39
40
41
42
43







44
45
46
47
48
49
50
	 */
	protected MIDlet()
	{
		// Set the active midlet to this one
		ActiveMidlet.set(this);
	}
	







	protected abstract void destroyApp(boolean __uc)
		throws MIDletStateChangeException;
	
	protected abstract void startApp()
		throws MIDletStateChangeException;
	
	/**







>
>
>
>
>
>
>







37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
	 */
	protected MIDlet()
	{
		// Set the active midlet to this one
		ActiveMidlet.set(this);
	}
	
	/**
	 * Signals that the MIDlet is in the destruction state.
	 *
	 * @param __uc Is is unconditional?
	 * @throws MIDletStateChangeException If the destruction might stop.
	 * @since 2020/02/29
	 */
	protected abstract void destroyApp(boolean __uc)
		throws MIDletStateChangeException;
	
	protected abstract void startApp()
		throws MIDletStateChangeException;
	
	/**
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
	{
		// Check
		if (__p == null)
			throw new NullPointerException("NARG");
		
		// Overridden property?
		JavaManifestKey key = new JavaManifestKey(__p);
		String val = System.getProperty(_APP_PROPERTY_OVERRIDE + key);
		if (val != null)
			return val.trim();
		
		// If there is not manifest, ignore this step
		if (!this._nomanifest)
		{
			// Lookup JAR manifest







|







121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
	{
		// Check
		if (__p == null)
			throw new NullPointerException("NARG");
		
		// Overridden property?
		JavaManifestKey key = new JavaManifestKey(__p);
		String val = System.getProperty(MIDlet._APP_PROPERTY_OVERRIDE + key);
		if (val != null)
			return val.trim();
		
		// If there is not manifest, ignore this step
		if (!this._nomanifest)
		{
			// Lookup JAR manifest
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
		}
		
		// Key not found or no manifest
		return null;
	}
	
	/**
	 * Used by the application to notify the MIDlet that it is being destroyed
	 * and resources should be cleaned up and such. When this is called the
	 * program will be terminated.
	 *
	 * @since 2019/04/15
	 */
	public final void notifyDestroyed()
	{
		todo.DEBUG.note("Notification of destruction");
		







|
|
|







175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
		}
		
		// Key not found or no manifest
		return null;
	}
	
	/**
	 * Used by the application to notify the MIDlet that it has entered the
	 * destroyed state and resources should be cleaned up and such. When this
	 * is called the program will be terminated.
	 *
	 * @since 2019/04/15
	 */
	public final void notifyDestroyed()
	{
		todo.DEBUG.note("Notification of destruction");
		

Name change from runt/apis/meep-midlet/javax/microedition/midlet/MIDletIdentity.java to modules/meep-midlet/src/main/java/javax/microedition/midlet/MIDletIdentity.java.

Name change from runt/apis/meep-midlet/javax/microedition/midlet/MIDletStateChangeException.java to modules/meep-midlet/src/main/java/javax/microedition/midlet/MIDletStateChangeException.java.

24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
	 * Initializes the exception with no message,
	 *
	 * @since 2019/09/25
	 */
	@Deprecated
	public MIDletStateChangeException()
	{
		super();
	}

	/**
	 * Initializes the exception with the given message,
	 *
	 * @param __s The message to use.
	 * @since 2019/09/25







<







24
25
26
27
28
29
30

31
32
33
34
35
36
37
	 * Initializes the exception with no message,
	 *
	 * @since 2019/09/25
	 */
	@Deprecated
	public MIDletStateChangeException()
	{

	}

	/**
	 * Initializes the exception with the given message,
	 *
	 * @param __s The message to use.
	 * @since 2019/09/25

Added modules/meep-midlet/src/main/java/javax/microedition/midlet/__MainHandler__.java.





































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package javax.microedition.midlet;

import cc.squirreljme.runtime.cldc.Poking;

/**
 * This class
 *
 * @since 2020/02/29
 */
final class __MainHandler__
{
	/**
	 * Main entry point.
	 *
	 * @param __args Program arguments.
	 * @throws Throwable On any exception.
	 * @since 2020/02/29
	 */
	public static void main(String... __args)
		throws Throwable
	{
		// {@squirreljme.error AD02 No main MIDlet class specified.}
		if (__args == null || __args.length < 1 || __args[0] == null)
			throw new IllegalArgumentException("AD02");
		
		// We might be on the emulator
		Poking.poke();
		
		// Locate the main class before we initialize it
		Class<?> classType;
		try
		{
			classType = Class.forName(__args[0]);
		}
		catch (ClassNotFoundException e)
		{
			// {@squirreljme.error AD03 Could not find main MIDlet. (Class)}
			throw new RuntimeException(String.format(
				"AD03 %s", __args[0]), e);
		}
		
		// Create instance of the MIDlet
		MIDlet instance;
		try
		{
			// Create it
			Object rawInstance = classType.newInstance();
			
			// Catch class casts here because if there is one while the
			// instance is being created it will not be erroneously caught
			try
			{
				instance = (MIDlet)rawInstance;
			}
			catch (ClassCastException e)
			{
				// {@squirreljme.error AD05 Class not a MIDlet.}
				throw new RuntimeException("AD05", e);
			}
		}
		catch (IllegalAccessException|InstantiationException e)
		{
			// {@squirreljme.error AD04 Could not instantiate class.}
			throw new RuntimeException("AD04", e);
		}
		
		// Start the MIDlet and perform any potential handling of it
		try
		{
			instance.startApp();
		}
		finally
		{
			// Always try to destroy the MIDlet
			try
			{
				instance.destroyApp(true);
			}
			catch (MIDletStateChangeException e)
			{
				// Ignore, but still print a trace
				e.printStackTrace(System.err);
			}
			
			// Application is gone now, exit
			instance.notifyDestroyed();
		}
	}
}

Name change from runt/apis/meep-midlet/javax/microedition/midlet/package-info.java to modules/meep-midlet/src/main/java/javax/microedition/midlet/package-info.java.

Added modules/meep-power/build.gradle.











































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import cc.squirreljme.plugin.swm.JavaMEMidletType
import cc.squirreljme.plugin.swm.JavaMEStandard

description = "This provides support for quering the current " +
	"electrical state of the device along with the setting of potential new " +
	"power modes."
version = rootProject.version

squirreljme
{
	javaDocErrorCode = "DJ"
	swmType = JavaMEMidletType.API
	swmName = "MEEP Power Management"
	swmVendor = "Stephanie Gawroriski"
	definedStandards += new JavaMEStandard("microedition.power;;")
}

dependencies
{
	implementation project(":modules:cldc-compact")
}

Added modules/meep-provisioning/build.gradle.















































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import cc.squirreljme.plugin.swm.JavaMEMidletType
import cc.squirreljme.plugin.swm.JavaMEStandard

description = "This provides support for provisioning new " +
	"MIDlets and LIBlets which may exist on the network and can beseen in a " +
	"way as a remote application downloader and installerexcept by a more " +
	"concrete means. It is possible for applicationsto automatically be " +
	"updated."
version = rootProject.version

squirreljme
{
	javaDocErrorCode = "DM"
	swmType = JavaMEMidletType.API
	swmName = "MEEP Provisioning"
	swmVendor = "Stephanie Gawroriski"
	definedStandards += new JavaMEStandard("microedition.provisioning;;")
}

dependencies
{
	implementation project(":modules:cldc-compact")
}

Added modules/meep-rms/build.gradle.





















































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import cc.squirreljme.plugin.swm.JavaMEMidletType
import cc.squirreljme.plugin.swm.JavaMEStandard

description = "This contains the implementation of the " +
	"record management system which is used to manage records whichmay be " +
	"used instead of the filesystem (if a filesystem is notsupported)."
version = rootProject.version

squirreljme
{
	javaDocErrorCode = "DC"
	swmType = JavaMEMidletType.API
	swmName = "MEEP Record Management System"
	swmVendor = "Stephanie Gawroriski"
	definedStandards += new JavaMEStandard("microedition.rms;;")
}

dependencies
{
	implementation project(":modules:cldc")

	implementation project(":modules:meep-midlet")
	implementation project(":modules:tool-manifest-writer")
	implementation project(":modules:meep-swm")
	implementation project(":modules:collections")
}

Name change from runt/apis/meep-rms/cc/squirreljme/runtime/rms/BasicVinylLock.java to modules/meep-rms/src/main/java/cc/squirreljme/runtime/rms/BasicVinylLock.java.

Name change from runt/apis/meep-rms/cc/squirreljme/runtime/rms/SuiteIdentifier.java to modules/meep-rms/src/main/java/cc/squirreljme/runtime/rms/SuiteIdentifier.java.

47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
	 *
	 * @return The current identifier.
	 * @since 2019/04/14
	 */
	public static long currentIdentifier()
	{
		// Already been cached?
		long rv = _CURRENT_ID;
		if (rv != 0)
			return rv;
		
		// Set, cache, and store
		_CURRENT_ID = (rv = SuiteIdentifier.identifier(
			SuiteIdentifier.currentVendor(), SuiteIdentifier.currentName()));
		return rv;
	}
	
	/**
	 * Returns the current name.
	 *
	 * @return The current name.
	 * @since 2019/04/14
	 */
	public static String currentName()
	{
		String rv = _CURRENT_NAME;
		if (rv != null)
			return rv;
		
		// Use task manager
		if (ApiLevel.minimumLevel(ApiLevel.UNDEFINED))
		{
			// Need to obtain the current suite







|




|












|







47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
	 *
	 * @return The current identifier.
	 * @since 2019/04/14
	 */
	public static long currentIdentifier()
	{
		// Already been cached?
		long rv = SuiteIdentifier._CURRENT_ID;
		if (rv != 0)
			return rv;
		
		// Set, cache, and store
		SuiteIdentifier._CURRENT_ID = (rv = SuiteIdentifier.identifier(
			SuiteIdentifier.currentVendor(), SuiteIdentifier.currentName()));
		return rv;
	}
	
	/**
	 * Returns the current name.
	 *
	 * @return The current name.
	 * @since 2019/04/14
	 */
	public static String currentName()
	{
		String rv = SuiteIdentifier._CURRENT_NAME;
		if (rv != null)
			return rv;
		
		// Use task manager
		if (ApiLevel.minimumLevel(ApiLevel.UNDEFINED))
		{
			// Need to obtain the current suite
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
		}
		
		// Fallback
		if (rv == null)
			rv = "UndefinedName";
		
		// Cache and return
		_CURRENT_NAME = rv;
		return rv;
	}
	
	/**
	 * Returns the current vendor.
	 *
	 * @return The current vendor.
	 * @since 2019/04/14
	 */
	public static String currentVendor()
	{
		String rv = _CURRENT_VENDOR;
		if (rv != null)
			return rv;
		
		// Use task manager
		if (ApiLevel.minimumLevel(ApiLevel.UNDEFINED))
		{
			// Need to obtain the current suite







|











|







94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
		}
		
		// Fallback
		if (rv == null)
			rv = "UndefinedName";
		
		// Cache and return
		SuiteIdentifier._CURRENT_NAME = rv;
		return rv;
	}
	
	/**
	 * Returns the current vendor.
	 *
	 * @return The current vendor.
	 * @since 2019/04/14
	 */
	public static String currentVendor()
	{
		String rv = SuiteIdentifier._CURRENT_VENDOR;
		if (rv != null)
			return rv;
		
		// Use task manager
		if (ApiLevel.minimumLevel(ApiLevel.UNDEFINED))
		{
			// Need to obtain the current suite
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
		}
		
		// Fallback
		if (rv == null)
			rv = "UndefinedVendor";
		
		// Cache and return
		_CURRENT_VENDOR = rv;
		return rv;
	}
	
	/**
	 * Returns the suite identifier.
	 *
	 * @param __vend The vendor.







|







135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
		}
		
		// Fallback
		if (rv == null)
			rv = "UndefinedVendor";
		
		// Cache and return
		SuiteIdentifier._CURRENT_VENDOR = rv;
		return rv;
	}
	
	/**
	 * Returns the suite identifier.
	 *
	 * @param __vend The vendor.

Name change from runt/apis/meep-rms/cc/squirreljme/runtime/rms/TemporaryVinylRecord.java to modules/meep-rms/src/main/java/cc/squirreljme/runtime/rms/TemporaryVinylRecord.java.

58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
			throw new NullPointerException("NARG");
		if (__o < 0 || __l < 0 || (__o + __l) > __b.length)
			throw new IndexOutOfBoundsException("IOOB");
		
		// Locate the volume
		Volume vol = this._volumes.get(__vid);
		if (vol == null)
			return ERROR_NO_VOLUME;
		
		// Create new page
		int pid = vol._nextpid++;
		Page page;
		vol._pages.put(pid, (page = new Page(pid)));
		
		// Volume modified







|







58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
			throw new NullPointerException("NARG");
		if (__o < 0 || __l < 0 || (__o + __l) > __b.length)
			throw new IndexOutOfBoundsException("IOOB");
		
		// Locate the volume
		Volume vol = this._volumes.get(__vid);
		if (vol == null)
			return VinylRecord.ERROR_NO_VOLUME;
		
		// Create new page
		int pid = vol._nextpid++;
		Page page;
		vol._pages.put(pid, (page = new Page(pid)));
		
		// Volume modified
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
	 */
	@Override
	public final int pageDelete(int __vid, int __pid)
	{
		// Locate the volume
		Volume vol = this._volumes.get(__vid);
		if (vol == null)
			return ERROR_NO_VOLUME;
		
		// Locate the page
		Page page = vol._pages.get(__pid);
		if (page == null)
			return ERROR_NO_PAGE;
		
		// Just remove it
		vol._pages.remove(__pid);
		
		// Return ID of the deleted page
		return __pid;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2019/04/15
	 */
	@Override
	public final int[] pageList(int __vid)
	{
		// Locate the volume
		Volume vol = this._volumes.get(__vid);
		if (vol == null)
			return new int[]{ERROR_NO_VOLUME};
		
		// Get page IDs
		Set<Integer> keys = vol._pages.keySet();
		int n = keys.size(),
			i = 0;
		int[] rv = new int[n];
		for (Integer v : keys)







|




|


















|







83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
	 */
	@Override
	public final int pageDelete(int __vid, int __pid)
	{
		// Locate the volume
		Volume vol = this._volumes.get(__vid);
		if (vol == null)
			return VinylRecord.ERROR_NO_VOLUME;
		
		// Locate the page
		Page page = vol._pages.get(__pid);
		if (page == null)
			return VinylRecord.ERROR_NO_PAGE;
		
		// Just remove it
		vol._pages.remove(__pid);
		
		// Return ID of the deleted page
		return __pid;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2019/04/15
	 */
	@Override
	public final int[] pageList(int __vid)
	{
		// Locate the volume
		Volume vol = this._volumes.get(__vid);
		if (vol == null)
			return new int[]{VinylRecord.ERROR_NO_VOLUME};
		
		// Get page IDs
		Set<Integer> keys = vol._pages.keySet();
		int n = keys.size(),
			i = 0;
		int[] rv = new int[n];
		for (Integer v : keys)
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
	 */
	@Override
	public final int pageNextId(int __vid)
	{
		// Locate the volume
		Volume vol = this._volumes.get(__vid);
		if (vol == null)
			return ERROR_NO_VOLUME;
		
		// Return guessed next ID
		return vol._nextpid;
	}
	
	/**
	 * {@inheritDoc}







|







130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
	 */
	@Override
	public final int pageNextId(int __vid)
	{
		// Locate the volume
		Volume vol = this._volumes.get(__vid);
		if (vol == null)
			return VinylRecord.ERROR_NO_VOLUME;
		
		// Return guessed next ID
		return vol._nextpid;
	}
	
	/**
	 * {@inheritDoc}
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
			throw new NullPointerException("NARG");
		if (__o < 0 || __l < 0 || (__o + __l) > __b.length)
			throw new IndexOutOfBoundsException("IOOB");
		
		// Locate the volume
		Volume vol = this._volumes.get(__vid);
		if (vol == null)
			return ERROR_NO_VOLUME;
		
		// Locate the page
		Page page = vol._pages.get(__pid);
		if (page == null)
			return ERROR_NO_PAGE;
		
		// Determine read limit
		byte[] data = page._data;
		int pagelen = data.length;
		if (__l > pagelen)
			__l = pagelen;
		







|




|







153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
			throw new NullPointerException("NARG");
		if (__o < 0 || __l < 0 || (__o + __l) > __b.length)
			throw new IndexOutOfBoundsException("IOOB");
		
		// Locate the volume
		Volume vol = this._volumes.get(__vid);
		if (vol == null)
			return VinylRecord.ERROR_NO_VOLUME;
		
		// Locate the page
		Page page = vol._pages.get(__pid);
		if (page == null)
			return VinylRecord.ERROR_NO_PAGE;
		
		// Determine read limit
		byte[] data = page._data;
		int pagelen = data.length;
		if (__l > pagelen)
			__l = pagelen;
		
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
			throw new NullPointerException("NARG");
		if (__o < 0 || __l < 0 || (__o + __l) > __b.length)
			throw new IndexOutOfBoundsException("IOOB");
		
		// Locate the volume
		Volume vol = this._volumes.get(__vid);
		if (vol == null)
			return ERROR_NO_VOLUME;
		
		// Locate the page
		Page page = vol._pages.get(__pid);
		if (page == null)
			return ERROR_NO_PAGE;
			
		// Volume modified
		vol._modcount++;
		vol._modtime = System.currentTimeMillis();
		
		// Store page data, will return the PID or error
		return page.setData(__b, __o, __l, __tag);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2019/05/01
	 */
	@Override
	public final int pageSize(int __vid, int __pid)
	{
		// Locate the volume
		Volume vol = this._volumes.get(__vid);
		if (vol == null)
			return ERROR_NO_VOLUME;
		
		// Locate the page
		Page page = vol._pages.get(__pid);
		if (page == null)
			return ERROR_NO_PAGE;
		
		// Return data length
		return page._data.length;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2019/05/13
	 */
	@Override
	public final int pageTag(int __vid, int __pid)
	{
		// Locate the volume
		Volume vol = this._volumes.get(__vid);
		if (vol == null)
			return ERROR_NO_VOLUME;
		
		// Locate the page
		Page page = vol._pages.get(__pid);
		if (page == null)
			return ERROR_NO_PAGE;
		
		// Return page tag
		return page._tag;
	}
	
	/**
	 * {@inheritDoc}







|




|



















|




|















|




|







191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
			throw new NullPointerException("NARG");
		if (__o < 0 || __l < 0 || (__o + __l) > __b.length)
			throw new IndexOutOfBoundsException("IOOB");
		
		// Locate the volume
		Volume vol = this._volumes.get(__vid);
		if (vol == null)
			return VinylRecord.ERROR_NO_VOLUME;
		
		// Locate the page
		Page page = vol._pages.get(__pid);
		if (page == null)
			return VinylRecord.ERROR_NO_PAGE;
			
		// Volume modified
		vol._modcount++;
		vol._modtime = System.currentTimeMillis();
		
		// Store page data, will return the PID or error
		return page.setData(__b, __o, __l, __tag);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2019/05/01
	 */
	@Override
	public final int pageSize(int __vid, int __pid)
	{
		// Locate the volume
		Volume vol = this._volumes.get(__vid);
		if (vol == null)
			return VinylRecord.ERROR_NO_VOLUME;
		
		// Locate the page
		Page page = vol._pages.get(__pid);
		if (page == null)
			return VinylRecord.ERROR_NO_PAGE;
		
		// Return data length
		return page._data.length;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2019/05/13
	 */
	@Override
	public final int pageTag(int __vid, int __pid)
	{
		// Locate the volume
		Volume vol = this._volumes.get(__vid);
		if (vol == null)
			return VinylRecord.ERROR_NO_VOLUME;
		
		// Locate the page
		Page page = vol._pages.get(__pid);
		if (page == null)
			return VinylRecord.ERROR_NO_PAGE;
		
		// Return page tag
		return page._tag;
	}
	
	/**
	 * {@inheritDoc}
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
	 */
	@Override
	public final int volumeModCount(int __vid)
	{
		// Locate the volume
		Volume vol = this._volumes.get(__vid);
		if (vol == null)
			return ERROR_NO_VOLUME;
		
		return vol._modcount;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2019/06/09
	 */
	@Override
	public final int volumeModTime(int __vid, long[] __time)
		throws NullPointerException
	{
		if (__time == null)
			throw new NullPointerException("NARG");
		
		// Locate the volume
		Volume vol = this._volumes.get(__vid);
		if (vol == null)
			return ERROR_NO_VOLUME;
		
		if (__time.length > 0)
			__time[0] = vol._modtime;
		return 0;
	}
	
	/**







|


















|







311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
	 */
	@Override
	public final int volumeModCount(int __vid)
	{
		// Locate the volume
		Volume vol = this._volumes.get(__vid);
		if (vol == null)
			return VinylRecord.ERROR_NO_VOLUME;
		
		return vol._modcount;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2019/06/09
	 */
	@Override
	public final int volumeModTime(int __vid, long[] __time)
		throws NullPointerException
	{
		if (__time == null)
			throw new NullPointerException("NARG");
		
		// Locate the volume
		Volume vol = this._volumes.get(__vid);
		if (vol == null)
			return VinylRecord.ERROR_NO_VOLUME;
		
		if (__time.length > 0)
			__time[0] = vol._modtime;
		return 0;
	}
	
	/**
407
408
409
410
411
412
413
414
415
416
417

418
419
420
421
422
423
424
			// Setup PID
			this.pid = __pid;
		}
		
		/**
		 * Sets the page data.
		 *
		 * @param __pid The page ID.
		 * @param __b The data.
		 * @param __o Offset into data.
		 * @param __l The length of data.

		 * @return The page ID or a negative value if an error.
		 * @throws IndexOutOfBoundsException If the offset and/or length
		 * exceed the array bounds.
		 * @throws NullPointerException On null arguments.
		 * @since 2019/04/15
		 */
		public final int setData(byte[] __b, int __o, int __l, int __tag)







<
|


>







407
408
409
410
411
412
413

414
415
416
417
418
419
420
421
422
423
424
			// Setup PID
			this.pid = __pid;
		}
		
		/**
		 * Sets the page data.
		 *

		 * @param __b The byte data.
		 * @param __o Offset into data.
		 * @param __l The length of data.
		 * @param __tag The tag for the page.
		 * @return The page ID or a negative value if an error.
		 * @throws IndexOutOfBoundsException If the offset and/or length
		 * exceed the array bounds.
		 * @throws NullPointerException On null arguments.
		 * @since 2019/04/15
		 */
		public final int setData(byte[] __b, int __o, int __l, int __tag)
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
				// Store this data
				this._data = place;
			}
			
			// No memory to store this data?
			catch (OutOfMemoryError e)
			{
				return ERROR_NO_MEMORY;
			}
			
			// Set tag
			this._tag = __tag;
			
			// Return PID
			return this.pid;







|







440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
				// Store this data
				this._data = place;
			}
			
			// No memory to store this data?
			catch (OutOfMemoryError e)
			{
				return VinylRecord.ERROR_NO_MEMORY;
			}
			
			// Set tag
			this._tag = __tag;
			
			// Return PID
			return this.pid;
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
		/** Modification time. */
		volatile long _modtime =
			System.currentTimeMillis();
		
		/**
		 * Initializes the volume.
		 *
		 * @param __rid The volume ID.
		 * @param __sid The suite identifier.
		 * @param __name The name of the record.
		 * @param __wo Allow write by others?
		 * @throws NullPointerException On null arguments.
		 * @since 2019/04/14
		 */
		public Volume(int __vid, long __sid, String __name, boolean __wo)







|







489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
		/** Modification time. */
		volatile long _modtime =
			System.currentTimeMillis();
		
		/**
		 * Initializes the volume.
		 *
		 * @param __vid The volume ID.
		 * @param __sid The suite identifier.
		 * @param __name The name of the record.
		 * @param __wo Allow write by others?
		 * @throws NullPointerException On null arguments.
		 * @since 2019/04/14
		 */
		public Volume(int __vid, long __sid, String __name, boolean __wo)

Name change from runt/apis/meep-rms/cc/squirreljme/runtime/rms/VinylLock.java to modules/meep-rms/src/main/java/cc/squirreljme/runtime/rms/VinylLock.java.

19
20
21
22
23
24
25
26
27
28
	extends AutoCloseable
{
	/**
	 * {@inheritDoc}
	 * @since 2018/12/14
	 */
	@Override
	public abstract void close();
}








|


19
20
21
22
23
24
25
26
27
28
	extends AutoCloseable
{
	/**
	 * {@inheritDoc}
	 * @since 2018/12/14
	 */
	@Override
	void close();
}

Name change from runt/apis/meep-rms/cc/squirreljme/runtime/rms/VinylRecord.java to modules/meep-rms/src/main/java/cc/squirreljme/runtime/rms/VinylRecord.java.

16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
 * Vinyls have a single lock on them.
 *
 * @since 2018/12/13
 */
public interface VinylRecord
{
	/** No memory is available. */
	public static final int ERROR_NO_MEMORY =
		-1;
	
	/** No such volume. */
	public static final int ERROR_NO_VOLUME =
		-2;
	
	/** No such page. */
	public static final int ERROR_NO_PAGE =
		-3;
	
	/**
	 * Locks this record so only a single set of actions can be performed on
	 * them, even for the same thread.
	 *
	 * @return The lock used to eventually unlock, to be used with
	 * try-with-resources.
	 * @since 2018/12/14
	 */
	public abstract VinylLock lock();
	
	/**
	 * Adds a page to the given volume.
	 *
	 * @param __vid The volume ID.
	 * @param __b The data to store.
	 * @param __o The offset into the array.
	 * @param __l The length of the array.
	 * @param __tag The tag to identify the given record with.
	 * @return The ID of the newly created page.
	 * @throws IndexOutOfBoundsException If the offset and/or length
	 * are negative or exceed the array bounds.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/04/15
	 */
	public abstract int pageAdd(int __vid, byte[] __b, int __o, int __l,
		int __tag)
		throws IndexOutOfBoundsException, NullPointerException;
	
	/**
	 * Deletes the given page.
	 *
	 * @param __vid The volume ID.
	 * @param __pid The page ID.
	 * @return The page that was deleted or an error.
	 * @since 2019/06/09
	 */
	public abstract int pageDelete(int __vid, int __pid);
	
	/**
	 * Returns the list of pages in the volume.
	 *
	 * @param __vid The volume ID.
	 * @return The list of records, if the volume is not valid then
	 * the first entry will be the error code.
	 * @since 2019/04/15
	 */
	public abstract int[] pageList(int __vid);
	
	/**
	 * Returns the ID of the next page ID that might be used.
	 *
	 * @param __vid The volume ID.
	 * @return The next page ID or an error.
	 * @since 2019/06/09
	 */
	public abstract int pageNextId(int __vid);
	
	/**
	 * Returns the data of the given page.
	 *
	 * @param __vid The volume ID.
	 * @param __pid The page ID.
	 * @param __b The output buffer.
	 * @param __o The offset.
	 * @param __l The length.
	 * @return The number of bytes read or an error otherwise.
	 * @throws IndexOutOfBoundsException If the offset and/or length are
	 * negative or exceed the array bounds.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/05/13
	 */
	public abstract int pageRead(int __vid, int __pid, byte[] __b, int __o,
		int __l)
		throws IndexOutOfBoundsException, NullPointerException;
	
	/**
	 * Sets a page to the given value.
	 *
	 * @param __vid The volume ID.
	 * @param __pid The page ID.
	 * @param __b The data to store.
	 * @param __o The offset into the array.
	 * @param __l The length of the array.
	 * @param __tag The tag to identify the given record with.
	 * @return Should be the ID of the same page, otherwise an error.
	 * @throws IndexOutOfBoundsException If the offset and/or length
	 * are negative or exceed the array bounds.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/06/09
	 */
	public abstract int pageSet(int __vid, int __pid, byte[] __b, int __o,
		int __l, int __tag)
		throws IndexOutOfBoundsException, NullPointerException;
	
	/**
	 * Returns the size of the given page.
	 *
	 * @param __vid The volume ID.
	 * @param __pid The page ID.
	 * @return The size of the page or an error otherwise.
	 * @since 2019/05/01
	 */
	public abstract int pageSize(int __vid, int __pid);
	
	/**
	 * Returns the tag of the page.
	 *
	 * @param __vid The volume ID.
	 * @param __pid The page ID.
	 * @return The tag identifier.
	 * @since 2019/05/13
	 */
	public abstract int pageTag(int __vid, int __pid);
	
	/**
	 * Returns the amount of space available for this record.
	 *
	 * @return The available space count.
	 * @since 2019/05/13
	 */
	public abstract int vinylSizeAvailable();
	
	/**
	 * Creates a new record.
	 *
	 * @param __sid The suite identifier.
	 * @param __n The name of the suite.
	 * @param __wo Allow write other?
	 * @return The identifier of the suite.
	 * @since 2019/04/14
	 */
	public abstract int volumeCreate(long __sid, String __n, boolean __wo);
	
	/**
	 * Returns the list of all available stores.
	 *
	 * @return The list of available stores.
	 * @since 2019/04/14
	 */
	public abstract int[] volumeList();
	
	/**
	 * Returns the modification count of the volume.
	 *
	 * @param __vid The volume ID.
	 * @return The modification count or an error.
	 * @since 2019/05/13
	 */
	public abstract int volumeModCount(int __vid);
	
	/**
	 * Returns the modification time of the volume.
	 *
	 * @param __vid The volume ID.
	 * @param __time The output time.
	 * @return Zero or an error.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/05/13
	 */
	public abstract int volumeModTime(int __vid, long[] __time)
		throws NullPointerException;
	
	/**
	 * Returns the name of the given record.
	 *
	 * @param __vid Volume ID.
	 * @return The name of the record or {@code null} if there is no name.
	 * @since 2019/04/14
	 */
	public abstract String volumeName(int __vid);
	
	/**
	 * Returns the suite identifier for the given record.
	 *
	 * @param __vid Volume ID.
	 * @return The suite identifier or {@code 0} if it is not valid.
	 * @since 2019/04/14
	 */
	public abstract long volumeSuiteIdentifier(int __vid);
	
	/**
	 * Returns if this volume is other writable.
	 *
	 * @param __vid The volume ID.
	 * @return If it is writable by others.
	 * @since 2019/04/15
	 */
	public abstract boolean volumeOtherWritable(int __vid);
}








|



|



|










|















|
<










|









|








|















|
<

















|
<










|









|







|










|







|








|










|









|








|








|


16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58

59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104

105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122

123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
 * Vinyls have a single lock on them.
 *
 * @since 2018/12/13
 */
public interface VinylRecord
{
	/** No memory is available. */
	int ERROR_NO_MEMORY =
		-1;
	
	/** No such volume. */
	int ERROR_NO_VOLUME =
		-2;
	
	/** No such page. */
	int ERROR_NO_PAGE =
		-3;
	
	/**
	 * Locks this record so only a single set of actions can be performed on
	 * them, even for the same thread.
	 *
	 * @return The lock used to eventually unlock, to be used with
	 * try-with-resources.
	 * @since 2018/12/14
	 */
	VinylLock lock();
	
	/**
	 * Adds a page to the given volume.
	 *
	 * @param __vid The volume ID.
	 * @param __b The data to store.
	 * @param __o The offset into the array.
	 * @param __l The length of the array.
	 * @param __tag The tag to identify the given record with.
	 * @return The ID of the newly created page.
	 * @throws IndexOutOfBoundsException If the offset and/or length
	 * are negative or exceed the array bounds.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/04/15
	 */
	int pageAdd(int __vid, byte[] __b, int __o, int __l, int __tag)

		throws IndexOutOfBoundsException, NullPointerException;
	
	/**
	 * Deletes the given page.
	 *
	 * @param __vid The volume ID.
	 * @param __pid The page ID.
	 * @return The page that was deleted or an error.
	 * @since 2019/06/09
	 */
	int pageDelete(int __vid, int __pid);
	
	/**
	 * Returns the list of pages in the volume.
	 *
	 * @param __vid The volume ID.
	 * @return The list of records, if the volume is not valid then
	 * the first entry will be the error code.
	 * @since 2019/04/15
	 */
	int[] pageList(int __vid);
	
	/**
	 * Returns the ID of the next page ID that might be used.
	 *
	 * @param __vid The volume ID.
	 * @return The next page ID or an error.
	 * @since 2019/06/09
	 */
	int pageNextId(int __vid);
	
	/**
	 * Returns the data of the given page.
	 *
	 * @param __vid The volume ID.
	 * @param __pid The page ID.
	 * @param __b The output buffer.
	 * @param __o The offset.
	 * @param __l The length.
	 * @return The number of bytes read or an error otherwise.
	 * @throws IndexOutOfBoundsException If the offset and/or length are
	 * negative or exceed the array bounds.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/05/13
	 */
	int pageRead(int __vid, int __pid, byte[] __b, int __o, int __l)

		throws IndexOutOfBoundsException, NullPointerException;
	
	/**
	 * Sets a page to the given value.
	 *
	 * @param __vid The volume ID.
	 * @param __pid The page ID.
	 * @param __b The data to store.
	 * @param __o The offset into the array.
	 * @param __l The length of the array.
	 * @param __tag The tag to identify the given record with.
	 * @return Should be the ID of the same page, otherwise an error.
	 * @throws IndexOutOfBoundsException If the offset and/or length
	 * are negative or exceed the array bounds.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/06/09
	 */
	int pageSet(int __vid, int __pid, byte[] __b, int __o, int __l, int __tag)

		throws IndexOutOfBoundsException, NullPointerException;
	
	/**
	 * Returns the size of the given page.
	 *
	 * @param __vid The volume ID.
	 * @param __pid The page ID.
	 * @return The size of the page or an error otherwise.
	 * @since 2019/05/01
	 */
	int pageSize(int __vid, int __pid);
	
	/**
	 * Returns the tag of the page.
	 *
	 * @param __vid The volume ID.
	 * @param __pid The page ID.
	 * @return The tag identifier.
	 * @since 2019/05/13
	 */
	int pageTag(int __vid, int __pid);
	
	/**
	 * Returns the amount of space available for this record.
	 *
	 * @return The available space count.
	 * @since 2019/05/13
	 */
	int vinylSizeAvailable();
	
	/**
	 * Creates a new record.
	 *
	 * @param __sid The suite identifier.
	 * @param __n The name of the suite.
	 * @param __wo Allow write other?
	 * @return The identifier of the suite.
	 * @since 2019/04/14
	 */
	int volumeCreate(long __sid, String __n, boolean __wo);
	
	/**
	 * Returns the list of all available stores.
	 *
	 * @return The list of available stores.
	 * @since 2019/04/14
	 */
	int[] volumeList();
	
	/**
	 * Returns the modification count of the volume.
	 *
	 * @param __vid The volume ID.
	 * @return The modification count or an error.
	 * @since 2019/05/13
	 */
	int volumeModCount(int __vid);
	
	/**
	 * Returns the modification time of the volume.
	 *
	 * @param __vid The volume ID.
	 * @param __time The output time.
	 * @return Zero or an error.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/05/13
	 */
	int volumeModTime(int __vid, long[] __time)
		throws NullPointerException;
	
	/**
	 * Returns the name of the given record.
	 *
	 * @param __vid Volume ID.
	 * @return The name of the record or {@code null} if there is no name.
	 * @since 2019/04/14
	 */
	String volumeName(int __vid);
	
	/**
	 * Returns the suite identifier for the given record.
	 *
	 * @param __vid Volume ID.
	 * @return The suite identifier or {@code 0} if it is not valid.
	 * @since 2019/04/14
	 */
	long volumeSuiteIdentifier(int __vid);
	
	/**
	 * Returns if this volume is other writable.
	 *
	 * @param __vid The volume ID.
	 * @return If it is writable by others.
	 * @since 2019/04/15
	 */
	boolean volumeOtherWritable(int __vid);
}

Name change from runt/apis/meep-rms/cc/squirreljme/runtime/rms/package-info.java to modules/meep-rms/src/main/java/cc/squirreljme/runtime/rms/package-info.java.

Name change from runt/apis/meep-rms/javax/microedition/rms/InvalidRecordIDException.java to modules/meep-rms/src/main/java/javax/microedition/rms/InvalidRecordIDException.java.

Name change from runt/apis/meep-rms/javax/microedition/rms/RecordComparator.java to modules/meep-rms/src/main/java/javax/microedition/rms/RecordComparator.java.

26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
 * @see RecordEnumeration
 * @see RecordFilter
 * @since 2017/02/26
 */
public interface RecordComparator
{
	/** This represents two equal records. */
	public static final int EQUIVALENT =
		0;
	
	/** This represents a record that follows another. */
	public static final int FOLLOWS =
		1;
	
	/** This represents a record that precedes another. */
	public static final int PRECEDES =
		-1;
	
	/**
	 * Compares the data in one record with the data in another record.
	 *
	 * @param __a The first record, the array must not be modified by the
	 * comparator.
	 * @param __b The second record, the array must not be modified by the
	 * comparator.
	 * @return The record comparison, one of {@link #EQUIVALENT},
	 * {@link #FOLLOWS}, or {@link #PRECEDES}.
	 * @since 2017/02/26
	 */
	public abstract int compare(byte[] __a, byte[] __b);
}








|



|



|













|


26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
 * @see RecordEnumeration
 * @see RecordFilter
 * @since 2017/02/26
 */
public interface RecordComparator
{
	/** This represents two equal records. */
	int EQUIVALENT =
		0;
	
	/** This represents a record that follows another. */
	int FOLLOWS =
		1;
	
	/** This represents a record that precedes another. */
	int PRECEDES =
		-1;
	
	/**
	 * Compares the data in one record with the data in another record.
	 *
	 * @param __a The first record, the array must not be modified by the
	 * comparator.
	 * @param __b The second record, the array must not be modified by the
	 * comparator.
	 * @return The record comparison, one of {@link #EQUIVALENT},
	 * {@link #FOLLOWS}, or {@link #PRECEDES}.
	 * @since 2017/02/26
	 */
	int compare(byte[] __a, byte[] __b);
}

Name change from runt/apis/meep-rms/javax/microedition/rms/RecordEnumeration.java to modules/meep-rms/src/main/java/javax/microedition/rms/RecordEnumeration.java.

34
35
36
37
38
39
40
41
42
43
44
45
46
47
48

49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118








119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
{
	/**
	 * This should be called when the enumeration is no longer needed and as
	 * such it can free resources.
	 *
	 * @since 2017/02/26
	 */
	public abstract void destroy();
	
	/**
	 * This is used to quickly obtain the record at the specified index within
	 * this enumeration. When using this behavior it is recommended to not
	 * keep the enumeraton up to date, otherwise it is implementation defined.
	 *
	 * @param __i The index to get.

	 * @throws IllegalArgumentException If the index is negative or is at
	 * least {@link #numRecords()}.
	 * @since 2017/02/26
	 */
	public abstract int getRecordId(int __i)
		throws IllegalArgumentException;
	
	/**
	 * Returns {@code true} if there is a next element.
	 *
	 * @return {@code true} if there is a next element.
	 * @since 2017/02/26
	 */
	public abstract boolean hasNextElement();
	
	/**
	 * Returns {@code true} if there is a previous element.
	 *
	 * @return {@code true} if there is a previous element.
	 * @since 2017/02/26
	 */
	public abstract boolean hasPreviousElement();
	
	/**
	 * Returns {@code true} if the enumeration is kept up to date with changes.
	 *
	 * @return {@code true} if the enumeration is kept up to date with changes.
	 * @since 2017/02/26
	 */
	public abstract boolean isKeptUpdated();
	
	/**
	 * This is used by the enumeration to specify that it should be kept up
	 * to date with any record changes.
	 *
	 * If set to {@code true} this also performs the equivalent call to
	 * {@link #rebuild()}.
	 *
	 * Note that keeping enumerations up to date may cause performance issues.
	 *
	 * @param __u If {@code true} then the enumeration is kept updated.
	 * @since 2017/02/26
	 */
	public abstract void keepUpdated(boolean __u);
	
	/**
	 * Returns a copy of the data contained in the next record. Changes to the
	 * returned array will not modify the data in the record.
	 *
	 * @return The data for the next record.
	 * @throws InvalidRecordIDException If the record is not valid.
	 * @throws RecordStoreException If another unspecified exception occurs.
	 * @throws RecordStoreNotOpenException This is called when the record store
	 * is no longer open.
	 * @since 2017/02/26
	 */
	public abstract byte[] nextRecord()
		throws InvalidRecordIDException, RecordStoreException,
			RecordStoreNotOpenException;
	
	/**
	 * Returns the identifier of the next record.
	 *
	 * @return The next record.
	 * @throws InvalidRecordIDException If there is no next record.
	 * @since 2017/02/26
	 */
	public abstract int nextRecordId()
		throws InvalidRecordIDException;
	








	/**
	 * Returns a copy of the data contained in the previous record. Changes to
	 * the returned array will not modify the data in the record.
	 *
	 * @return The data for the previous record.
	 * @throws InvalidRecordIDException If the record is not valid.
	 * @throws RecordStoreException If another unspecified exception occurs.
	 * @throws RecordStoreNotOpenException This is called when the record store
	 * is no longer open.
	 * @since 2017/02/26
	 */
	public abstract byte[] previousRecord()
		throws InvalidRecordIDException, RecordStoreException,
			RecordStoreNotOpenException;
	
	/**
	 * Returns the identifier of the previous record.
	 *
	 * @return The previous record.
	 * @throws InvalidRecordIDException If there is no next record.
	 * @since 2017/02/26
	 */
	public abstract int previousRecordId()
		throws InvalidRecordIDException;
	
	/**
	 * Rebuilds the enumeration to reflect the most up to date state.
	 *
	 * @throws IllegalStateException If this enumeration was destroyed.
	 * @see #isKeptUpdated()
	 * @see #keepUpdated(boolean)
	 * @since 2017/02/26
	 */
	public abstract void rebuild()
		throws IllegalStateException;
	
	/**
	 * Repositions the enumeration so that the next element to be returned
	 * is the first element (and there is no previous element if that is
	 * called). The index will be reset back to zero.
	 *
	 * @since 2017/02/26
	 */
	public abstract void reset();
}








|







>




|








|







|







|













|












|










|


>
>
>
>
>
>
>
>











|










|










|









|


34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
{
	/**
	 * This should be called when the enumeration is no longer needed and as
	 * such it can free resources.
	 *
	 * @since 2017/02/26
	 */
	void destroy();
	
	/**
	 * This is used to quickly obtain the record at the specified index within
	 * this enumeration. When using this behavior it is recommended to not
	 * keep the enumeraton up to date, otherwise it is implementation defined.
	 *
	 * @param __i The index to get.
	 * @return The record ID.
	 * @throws IllegalArgumentException If the index is negative or is at
	 * least {@link #numRecords()}.
	 * @since 2017/02/26
	 */
	int getRecordId(int __i)
		throws IllegalArgumentException;
	
	/**
	 * Returns {@code true} if there is a next element.
	 *
	 * @return {@code true} if there is a next element.
	 * @since 2017/02/26
	 */
	boolean hasNextElement();
	
	/**
	 * Returns {@code true} if there is a previous element.
	 *
	 * @return {@code true} if there is a previous element.
	 * @since 2017/02/26
	 */
	boolean hasPreviousElement();
	
	/**
	 * Returns {@code true} if the enumeration is kept up to date with changes.
	 *
	 * @return {@code true} if the enumeration is kept up to date with changes.
	 * @since 2017/02/26
	 */
	boolean isKeptUpdated();
	
	/**
	 * This is used by the enumeration to specify that it should be kept up
	 * to date with any record changes.
	 *
	 * If set to {@code true} this also performs the equivalent call to
	 * {@link #rebuild()}.
	 *
	 * Note that keeping enumerations up to date may cause performance issues.
	 *
	 * @param __u If {@code true} then the enumeration is kept updated.
	 * @since 2017/02/26
	 */
	void keepUpdated(boolean __u);
	
	/**
	 * Returns a copy of the data contained in the next record. Changes to the
	 * returned array will not modify the data in the record.
	 *
	 * @return The data for the next record.
	 * @throws InvalidRecordIDException If the record is not valid.
	 * @throws RecordStoreException If another unspecified exception occurs.
	 * @throws RecordStoreNotOpenException This is called when the record store
	 * is no longer open.
	 * @since 2017/02/26
	 */
	byte[] nextRecord()
		throws InvalidRecordIDException, RecordStoreException,
			RecordStoreNotOpenException;
	
	/**
	 * Returns the identifier of the next record.
	 *
	 * @return The next record.
	 * @throws InvalidRecordIDException If there is no next record.
	 * @since 2017/02/26
	 */
	int nextRecordId()
		throws InvalidRecordIDException;
	
	/**
	 * Returns the number of records.
	 *
	 * @return The record count.
	 * @since 2020/02/16
	 */
	int numRecords();
	
	/**
	 * Returns a copy of the data contained in the previous record. Changes to
	 * the returned array will not modify the data in the record.
	 *
	 * @return The data for the previous record.
	 * @throws InvalidRecordIDException If the record is not valid.
	 * @throws RecordStoreException If another unspecified exception occurs.
	 * @throws RecordStoreNotOpenException This is called when the record store
	 * is no longer open.
	 * @since 2017/02/26
	 */
	byte[] previousRecord()
		throws InvalidRecordIDException, RecordStoreException,
			RecordStoreNotOpenException;
	
	/**
	 * Returns the identifier of the previous record.
	 *
	 * @return The previous record.
	 * @throws InvalidRecordIDException If there is no next record.
	 * @since 2017/02/26
	 */
	int previousRecordId()
		throws InvalidRecordIDException;
	
	/**
	 * Rebuilds the enumeration to reflect the most up to date state.
	 *
	 * @throws IllegalStateException If this enumeration was destroyed.
	 * @see #isKeptUpdated()
	 * @see #keepUpdated(boolean)
	 * @since 2017/02/26
	 */
	void rebuild()
		throws IllegalStateException;
	
	/**
	 * Repositions the enumeration so that the next element to be returned
	 * is the first element (and there is no previous element if that is
	 * called). The index will be reset back to zero.
	 *
	 * @since 2017/02/26
	 */
	void reset();
}

Name change from runt/apis/meep-rms/javax/microedition/rms/RecordFilter.java to modules/meep-rms/src/main/java/javax/microedition/rms/RecordFilter.java.

25
26
27
28
29
30
31
32
33
34
	 * filter.
	 *
	 * @param __b The record data to check, the array data must not be
	 * modified.
	 * @return {@code true} if the specified record is a match.
	 * @since 2017/02/26
	 */
	public abstract boolean matches(byte[] __b);
}








|


25
26
27
28
29
30
31
32
33
34
	 * filter.
	 *
	 * @param __b The record data to check, the array data must not be
	 * modified.
	 * @return {@code true} if the specified record is a match.
	 * @since 2017/02/26
	 */
	boolean matches(byte[] __b);
}

Name change from runt/apis/meep-rms/javax/microedition/rms/RecordListener.java to modules/meep-rms/src/main/java/javax/microedition/rms/RecordListener.java.

20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
	/**
	 * This is called when a record was added to the store.
	 *
	 * @param __rs The record store the change was made in.
	 * @param __id The ID of the added record.
	 * @since 2017/02/26
	 */
	public abstract void recordAdded(RecordStore __rs, int __id);
	
	/**
	 * This is called when a record was changed in a store.
	 *
	 * @param __rs The record store the change was made in.
	 * @param __id The ID of the changed record.
	 * @since 2017/02/26
	 */
	public abstract void recordChanged(RecordStore __rs, int __id);
	
	/**
	 * This is called when a record was deleted from a store.
	 *
	 * @param __rs The record store the change was made in.
	 * @param __id The ID of the deleted record, an attempt to use the record
	 * after it has been used is illegal will throw an
	 * {@link InvalidRecordIDException}.
	 * @since 2017/02/26
	 */
	public abstract void recordDeleted(RecordStore __rs, int __id);
}








|








|










|


20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
	/**
	 * This is called when a record was added to the store.
	 *
	 * @param __rs The record store the change was made in.
	 * @param __id The ID of the added record.
	 * @since 2017/02/26
	 */
	void recordAdded(RecordStore __rs, int __id);
	
	/**
	 * This is called when a record was changed in a store.
	 *
	 * @param __rs The record store the change was made in.
	 * @param __id The ID of the changed record.
	 * @since 2017/02/26
	 */
	void recordChanged(RecordStore __rs, int __id);
	
	/**
	 * This is called when a record was deleted from a store.
	 *
	 * @param __rs The record store the change was made in.
	 * @param __id The ID of the deleted record, an attempt to use the record
	 * after it has been used is illegal will throw an
	 * {@link InvalidRecordIDException}.
	 * @since 2017/02/26
	 */
	void recordDeleted(RecordStore __rs, int __id);
}

Name change from runt/apis/meep-rms/javax/microedition/rms/RecordStore.java to modules/meep-rms/src/main/java/javax/microedition/rms/RecordStore.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package javax.microedition.rms;

import cc.squirreljme.runtime.cldc.lang.ImplementationClass;
import cc.squirreljme.runtime.cldc.asm.SuiteAccess;
import cc.squirreljme.runtime.midlet.ActiveMidlet;
import cc.squirreljme.runtime.rms.VinylLock;
import cc.squirreljme.runtime.rms.VinylRecord;
import cc.squirreljme.runtime.rms.SuiteIdentifier;
import cc.squirreljme.runtime.rms.TemporaryVinylRecord;
import cc.squirreljme.runtime.swm.SuiteName;
import cc.squirreljme.runtime.swm.SuiteVendor;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.microedition.midlet.MIDlet;
import net.multiphasicapps.collections.IdentityLinkedHashSet;

/**
 * This is a record store which may be used by an application to store
 * information about it in an implementation defined manner.
 *
 * Opened record stores have an open count, as such for every open operation













<
<
<
<


|
|





<







1
2
3
4
5
6
7
8
9
10
11
12
13




14
15
16
17
18
19
20
21
22

23
24
25
26
27
28
29
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package javax.microedition.rms;

import cc.squirreljme.runtime.cldc.lang.ImplementationClass;




import cc.squirreljme.runtime.rms.SuiteIdentifier;
import cc.squirreljme.runtime.rms.TemporaryVinylRecord;
import cc.squirreljme.runtime.rms.VinylLock;
import cc.squirreljme.runtime.rms.VinylRecord;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;

import net.multiphasicapps.collections.IdentityLinkedHashSet;

/**
 * This is a record store which may be used by an application to store
 * information about it in an implementation defined manner.
 *
 * Opened record stores have an open count, as such for every open operation
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
			throw new RecordStoreException("DC01");
		
		// Used for later
		int rv;
		RecordListener[] listeners = this.__listeners();
		
		// Lock
		VinylRecord vinyl = _VINYL;
		try (VinylLock lock = vinyl.lock())
		{
			// Check open
			this.__checkOpen();
			
			// Add the page
			rv = vinyl.pageAdd(this._vid, __b, __o, __l, __tag);







|







156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
			throw new RecordStoreException("DC01");
		
		// Used for later
		int rv;
		RecordListener[] listeners = this.__listeners();
		
		// Lock
		VinylRecord vinyl = RecordStore._VINYL;
		try (VinylLock lock = vinyl.lock())
		{
			// Check open
			this.__checkOpen();
			
			// Add the page
			rv = vinyl.pageAdd(this._vid, __b, __o, __l, __tag);
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
	public void addRecordListener(RecordListener __l)
	{
		// Ignore
		if (__l == null)
			return;
		
		// Lock
		VinylRecord vinyl = _VINYL;
		try (VinylLock lock = vinyl.lock())
		{
			// No effect if closed
			if (this._opens <= 0)
				return;
			
			// Add listener







|







212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
	public void addRecordListener(RecordListener __l)
	{
		// Ignore
		if (__l == null)
			return;
		
		// Lock
		VinylRecord vinyl = RecordStore._VINYL;
		try (VinylLock lock = vinyl.lock())
		{
			// No effect if closed
			if (this._opens <= 0)
				return;
			
			// Add listener
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
	 * @since 2017/02/26
	 */
	public void closeRecordStore()
		throws RecordStoreNotOpenException, RecordStoreException
	{
		// Lock the record, so that only a single thread is messing with the
		// open counts and such
		VinylRecord vinyl = _VINYL;
		try (VinylLock lock = vinyl.lock())
		{
			// Check open
			this.__checkOpen();
			
			// If closed then remove all the listeners
			if ((--this._opens) <= 0)







|







256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
	 * @since 2017/02/26
	 */
	public void closeRecordStore()
		throws RecordStoreNotOpenException, RecordStoreException
	{
		// Lock the record, so that only a single thread is messing with the
		// open counts and such
		VinylRecord vinyl = RecordStore._VINYL;
		try (VinylLock lock = vinyl.lock())
		{
			// Check open
			this.__checkOpen();
			
			// If closed then remove all the listeners
			if ((--this._opens) <= 0)
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
		throws InvalidRecordIDException, RecordStoreNotOpenException,
			RecordStoreException, SecurityException
	{
		// Used later
		RecordListener[] listeners = this.__listeners();
		
		// Lock
		VinylRecord vinyl = _VINYL;
		try (VinylLock lock = vinyl.lock())
		{
			// Check open
			this.__checkOpen();
			
			// Delete it
			int rv = vinyl.pageDelete(this._vid, __id);







|







286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
		throws InvalidRecordIDException, RecordStoreNotOpenException,
			RecordStoreException, SecurityException
	{
		// Used later
		RecordListener[] listeners = this.__listeners();
		
		// Lock
		VinylRecord vinyl = RecordStore._VINYL;
		try (VinylLock lock = vinyl.lock())
		{
			// Check open
			this.__checkOpen();
			
			// Delete it
			int rv = vinyl.pageDelete(this._vid, __id);
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
	public long getLastModified()
		throws RecordStoreNotOpenException
	{
		// Check open
		this.__checkOpen();
		
		// Lock
		VinylRecord vinyl = _VINYL;
		try (VinylLock lock = vinyl.lock())
		{
			// Check open
			this.__checkOpen();
			
			long[] time = new long[1];
			int rv = vinyl.volumeModTime(this._vid, time);







|







367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
	public long getLastModified()
		throws RecordStoreNotOpenException
	{
		// Check open
		this.__checkOpen();
		
		// Lock
		VinylRecord vinyl = RecordStore._VINYL;
		try (VinylLock lock = vinyl.lock())
		{
			// Check open
			this.__checkOpen();
			
			long[] time = new long[1];
			int rv = vinyl.volumeModTime(this._vid, time);
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
	 * @throws RecordStoreNotOpenException If this record store is not open.
	 * @since 2017/02/26
	 */
	public int getNextRecordID()
		throws RecordStoreException, RecordStoreNotOpenException
	{
		// Lock
		VinylRecord vinyl = _VINYL;
		try (VinylLock lock = vinyl.lock())
		{
			// Check open
			this.__checkOpen();
			
			// Get next ID as a guess
			int rv = vinyl.pageNextId(this._vid);







|







427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
	 * @throws RecordStoreNotOpenException If this record store is not open.
	 * @since 2017/02/26
	 */
	public int getNextRecordID()
		throws RecordStoreException, RecordStoreNotOpenException
	{
		// Lock
		VinylRecord vinyl = RecordStore._VINYL;
		try (VinylLock lock = vinyl.lock())
		{
			// Check open
			this.__checkOpen();
			
			// Get next ID as a guess
			int rv = vinyl.pageNextId(this._vid);
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
	public int getNumRecords()
		throws RecordStoreNotOpenException
	{
		// Check open
		this.__checkOpen();
		
		// Lock
		VinylRecord vinyl = _VINYL;
		try (VinylLock lock = vinyl.lock())
		{
			// Get record list
			int[] pages = vinyl.pageList(this._vid);
			
			// Check for error
			if (pages.length > 0)







|







455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
	public int getNumRecords()
		throws RecordStoreNotOpenException
	{
		// Check open
		this.__checkOpen();
		
		// Lock
		VinylRecord vinyl = RecordStore._VINYL;
		try (VinylLock lock = vinyl.lock())
		{
			// Get record list
			int[] pages = vinyl.pageList(this._vid);
			
			// Check for error
			if (pages.length > 0)
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
		// Check open
		this.__checkOpen();
		
		// This volume
		int vid = this._vid;
		
		// Lock
		VinylRecord vinyl = _VINYL;
		try (VinylLock lock = vinyl.lock())
		{
			// Need to know the size of the record
			int size = vinyl.pageSize(vid, __id);
			RecordStore.__checkError(size);
			
			// Allocate data to read from it







|







509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
		// Check open
		this.__checkOpen();
		
		// This volume
		int vid = this._vid;
		
		// Lock
		VinylRecord vinyl = RecordStore._VINYL;
		try (VinylLock lock = vinyl.lock())
		{
			// Need to know the size of the record
			int size = vinyl.pageSize(vid, __id);
			RecordStore.__checkError(size);
			
			// Allocate data to read from it
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
		if (__o < 0)
			throw new ArrayIndexOutOfBoundsException("IOOB");
		
		// This volume
		int vid = this._vid;
		
		// Lock
		VinylRecord vinyl = _VINYL;
		try (VinylLock lock = vinyl.lock())
		{
			// Check open
			this.__checkOpen();
			
			// Need to know the size of the record
			int size = vinyl.pageSize(vid, __id);







|







558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
		if (__o < 0)
			throw new ArrayIndexOutOfBoundsException("IOOB");
		
		// This volume
		int vid = this._vid;
		
		// Lock
		VinylRecord vinyl = RecordStore._VINYL;
		try (VinylLock lock = vinyl.lock())
		{
			// Check open
			this.__checkOpen();
			
			// Need to know the size of the record
			int size = vinyl.pageSize(vid, __id);
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
	 * @since 2016/02/26
	 */
	public int getRecordSize(int __id)
		throws InvalidRecordIDException, RecordStoreException,
			RecordStoreNotOpenException
	{
		// Lock
		VinylRecord vinyl = _VINYL;
		try (VinylLock lock = vinyl.lock())
		{
			// Check open
			this.__checkOpen();
			
			// Need to know the size of the record
			int size = vinyl.pageSize(this._vid, __id);







|







598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
	 * @since 2016/02/26
	 */
	public int getRecordSize(int __id)
		throws InvalidRecordIDException, RecordStoreException,
			RecordStoreNotOpenException
	{
		// Lock
		VinylRecord vinyl = RecordStore._VINYL;
		try (VinylLock lock = vinyl.lock())
		{
			// Check open
			this.__checkOpen();
			
			// Need to know the size of the record
			int size = vinyl.pageSize(this._vid, __id);
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
	 * @since 2016/02/26
	 */
	@Deprecated
	public int getSize()
		throws RecordStoreNotOpenException
	{
		return (int)Math.min(Integer.MAX_VALUE,
			getRecordStoreInfo().getSize());
	}
	
	/**
	 * Returns the available size of the record store.
	 *
	 * @return The available record store size, not to exceed
	 * {@link Integer#MAX_VALUE}.
	 * @throws RecordStoreNotOpenException If the record store is not open.
	 * @since 2016/02/26
	 */
	@Deprecated
	public int getSizeAvailable()
		throws RecordStoreNotOpenException
	{
		return (int)Math.min(Integer.MAX_VALUE,
			getRecordStoreInfo().getSizeAvailable());
	}
	
	/**
	 * Returns the tag of the given record.
	 *
	 * @param __id The record ID to get the tag for.
	 * @return The tag of the given record.
	 * @throws InvalidRecordIDException If the record ID is not valid.
	 * @throws RecordStoreException If another problem occurs with the record
	 * store.
	 * @throws RecordStoreNotOpenException If the record store is not open.
	 * @since 2016/02/26
	 */
	public int getTag(int __id)
		throws InvalidRecordIDException, RecordStoreException,
			RecordStoreNotOpenException
	{
		// Lock
		VinylRecord vinyl = _VINYL;
		try (VinylLock lock = vinyl.lock())
		{
			// Check open
			this.__checkOpen();
			
			// Get and check tag
			int rv = vinyl.pageTag(this._vid, __id);







|















|


















|







642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
	 * @since 2016/02/26
	 */
	@Deprecated
	public int getSize()
		throws RecordStoreNotOpenException
	{
		return (int)Math.min(Integer.MAX_VALUE,
			this.getRecordStoreInfo().getSize());
	}
	
	/**
	 * Returns the available size of the record store.
	 *
	 * @return The available record store size, not to exceed
	 * {@link Integer#MAX_VALUE}.
	 * @throws RecordStoreNotOpenException If the record store is not open.
	 * @since 2016/02/26
	 */
	@Deprecated
	public int getSizeAvailable()
		throws RecordStoreNotOpenException
	{
		return (int)Math.min(Integer.MAX_VALUE,
			this.getRecordStoreInfo().getSizeAvailable());
	}
	
	/**
	 * Returns the tag of the given record.
	 *
	 * @param __id The record ID to get the tag for.
	 * @return The tag of the given record.
	 * @throws InvalidRecordIDException If the record ID is not valid.
	 * @throws RecordStoreException If another problem occurs with the record
	 * store.
	 * @throws RecordStoreNotOpenException If the record store is not open.
	 * @since 2016/02/26
	 */
	public int getTag(int __id)
		throws InvalidRecordIDException, RecordStoreException,
			RecordStoreNotOpenException
	{
		// Lock
		VinylRecord vinyl = RecordStore._VINYL;
		try (VinylLock lock = vinyl.lock())
		{
			// Check open
			this.__checkOpen();
			
			// Get and check tag
			int rv = vinyl.pageTag(this._vid, __id);
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
	 * @throws RecordStoreNotOpenException If the record store is not open.
	 * @since 2016/02/26
	 */
	public int getVersion()
		throws RecordStoreNotOpenException
	{
		// Lock
		VinylRecord vinyl = _VINYL;
		try (VinylLock lock = vinyl.lock())
		{
			// Check open
			this.__checkOpen();
			
			int rv = vinyl.volumeModCount(this._vid);
			







|







703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
	 * @throws RecordStoreNotOpenException If the record store is not open.
	 * @since 2016/02/26
	 */
	public int getVersion()
		throws RecordStoreNotOpenException
	{
		// Lock
		VinylRecord vinyl = RecordStore._VINYL;
		try (VinylLock lock = vinyl.lock())
		{
			// Check open
			this.__checkOpen();
			
			int rv = vinyl.volumeModCount(this._vid);
			
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
	public void removeRecordListener(RecordListener __l)
	{
		// Ignore
		if (__l == null)
			return;
		
		// Lock
		VinylRecord vinyl = _VINYL;
		try (VinylLock lock = vinyl.lock())
		{
			// No effect if closed
			if (this._opens <= 0)
				return;
			
			// Remove listener







|







743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
	public void removeRecordListener(RecordListener __l)
	{
		// Ignore
		if (__l == null)
			return;
		
		// Lock
		VinylRecord vinyl = RecordStore._VINYL;
		try (VinylLock lock = vinyl.lock())
		{
			// No effect if closed
			if (this._opens <= 0)
				return;
			
			// Remove listener
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
	 * @since 2017/02/26
	 */
	public void setMode(int __auth, boolean __write)
		throws IllegalArgumentException, IllegalStateException,
			RecordStoreException, SecurityException
	{
		// Lock
		VinylRecord vinyl = _VINYL;
		try (VinylLock lock = vinyl.lock())
		{
			throw new todo.TODO();
		}
	}
	
	/**







|







782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
	 * @since 2017/02/26
	 */
	public void setMode(int __auth, boolean __write)
		throws IllegalArgumentException, IllegalStateException,
			RecordStoreException, SecurityException
	{
		// Lock
		VinylRecord vinyl = RecordStore._VINYL;
		try (VinylLock lock = vinyl.lock())
		{
			throw new todo.TODO();
		}
	}
	
	/**
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
		if (!this._write)
			throw new RecordStoreException("DC06");
		
		// Used for later
		RecordListener[] listeners = this.__listeners();
		
		// Lock
		VinylRecord vinyl = _VINYL;
		try (VinylLock lock = vinyl.lock())
		{
			// Check open
			this.__checkOpen();
			
			// Set the page
			__id = vinyl.pageSet(this._vid, __id, __b, __o, __l, __tag);







|







826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
		if (!this._write)
			throw new RecordStoreException("DC06");
		
		// Used for later
		RecordListener[] listeners = this.__listeners();
		
		// Lock
		VinylRecord vinyl = RecordStore._VINYL;
		try (VinylLock lock = vinyl.lock())
		{
			// Check open
			this.__checkOpen();
			
			// Set the page
			__id = vinyl.pageSet(this._vid, __id, __b, __o, __l, __tag);
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
	 * @return The page IDs.
	 * @since 2019/05/13
	 */
	final int[] __listPages()
		throws RecordStoreNotOpenException
	{
		// Lock
		VinylRecord vinyl = _VINYL;
		try (VinylLock lock = vinyl.lock())
		{
			// Check open
			this.__checkOpen();
			
			return vinyl.pageList(this._vid);
		}







|







889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
	 * @return The page IDs.
	 * @since 2019/05/13
	 */
	final int[] __listPages()
		throws RecordStoreNotOpenException
	{
		// Lock
		VinylRecord vinyl = RecordStore._VINYL;
		try (VinylLock lock = vinyl.lock())
		{
			// Check open
			this.__checkOpen();
			
			return vinyl.pageList(this._vid);
		}
922
923
924
925
926
927
928
929

930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
	}
	
	/**
	 * Deletes the specified record store.
	 *
	 * Suites may only delete their own record store.
	 *
	 * This will not call {@link RecordListener#recordDelete(RecordStore, int)}

	 * listeners associated with the given record store.
	 *
	 * @param __n The name of the record store to delete.
	 * @throws RecordStoreException If the record store cannot be deleted due
	 * to being owned by another suite or deletion is not possible.
	 * @throws RecordStoreNotFoundException If the given record store was not
	 * found.
	 * @since 2017/02/26
	 */
	public static void deleteRecordStore(String __n)
		throws NullPointerException, RecordStoreException,
			RecordStoreNotFoundException
	{
		if (__n == null)
			throw new NullPointerException("NARG");
		
		// Our suite identifier to find our own records
		long mysid = SuiteIdentifier.currentIdentifier();
		
		// Lock
		VinylRecord vinyl = _VINYL;
		try (VinylLock lock = vinyl.lock())
		{
			// Try to locate our record
			int got = -1;
			for (int rid : vinyl.volumeList())
			{
				// Another suite's volume







|
>




















|







917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
	}
	
	/**
	 * Deletes the specified record store.
	 *
	 * Suites may only delete their own record store.
	 *
	 * This will not call
	 * {@link RecordListener#recordDeleted(RecordStore, int)}
	 * listeners associated with the given record store.
	 *
	 * @param __n The name of the record store to delete.
	 * @throws RecordStoreException If the record store cannot be deleted due
	 * to being owned by another suite or deletion is not possible.
	 * @throws RecordStoreNotFoundException If the given record store was not
	 * found.
	 * @since 2017/02/26
	 */
	public static void deleteRecordStore(String __n)
		throws NullPointerException, RecordStoreException,
			RecordStoreNotFoundException
	{
		if (__n == null)
			throw new NullPointerException("NARG");
		
		// Our suite identifier to find our own records
		long mysid = SuiteIdentifier.currentIdentifier();
		
		// Lock
		VinylRecord vinyl = RecordStore._VINYL;
		try (VinylLock lock = vinyl.lock())
		{
			// Try to locate our record
			int got = -1;
			for (int rid : vinyl.volumeList())
			{
				// Another suite's volume
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
	 */
	public static String[] listRecordStores()
	{
		// Our suite identifier to find our own records
		long mysid = SuiteIdentifier.currentIdentifier();
		
		// Lock
		VinylRecord vinyl = _VINYL;
		try (VinylLock lock = vinyl.lock())
		{
			List<String> rv = new ArrayList<>();
			
			// Go through all IDs and locate record store info
			for (int rid : vinyl.volumeList())
			{







|







982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
	 */
	public static String[] listRecordStores()
	{
		// Our suite identifier to find our own records
		long mysid = SuiteIdentifier.currentIdentifier();
		
		// Lock
		VinylRecord vinyl = RecordStore._VINYL;
		try (VinylLock lock = vinyl.lock())
		{
			List<String> rv = new ArrayList<>();
			
			// Go through all IDs and locate record store info
			for (int rid : vinyl.volumeList())
			{
1025
1026
1027
1028
1029
1030
1031

1032
1033
1034
1035
1036
1037
1038
	 * exist it will be created.
	 * @param __auth The authorization mode of the record which may permit
	 * other applications to access this record. If the record already exists
	 * then this argument will be ignored.
	 * @param __write If {@code true} then the record store may be written to
	 * by other suites. If the record already exists then this argument will be
	 * ignored.

	 * @return The newly opened or created record store, if the record store
	 * is already open then it will return the already open one.
	 * @throws IllegalArgumentException If the name is not valid or the
	 * authorization mode is not valid.
	 * @throws RecordStoreException If it could not be opened for another
	 * reason.
	 * @throws RecordStoreFullException If there is no space remaining.







>







1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
	 * exist it will be created.
	 * @param __auth The authorization mode of the record which may permit
	 * other applications to access this record. If the record already exists
	 * then this argument will be ignored.
	 * @param __write If {@code true} then the record store may be written to
	 * by other suites. If the record already exists then this argument will be
	 * ignored.
	 * @param __pass The password.
	 * @return The newly opened or created record store, if the record store
	 * is already open then it will return the already open one.
	 * @throws IllegalArgumentException If the name is not valid or the
	 * authorization mode is not valid.
	 * @throws RecordStoreException If it could not be opened for another
	 * reason.
	 * @throws RecordStoreFullException If there is no space remaining.
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105

1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123

1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
	
	/**
	 * Forwards to {@code openRecordStore(__n, __create, AUTHMODE_PRIVATE,
	 * true, "")}.
	 *
	 * @param __n As forwarded.
	 * @param __create As forwarded.
	 * @param __auth As forwarded.
	 * @param __write As forwarded.
	 * @return As forwarded.
	 * @throws IllegalArgumentException As forwarded.
	 * @throws RecordStoreException As forwarded.
	 * @throws RecordStoreFullException As forwarded.
	 * @throws RecordStoreNotFoundException As forwarded.
	 * @throws SecureRecordStoreException As forwarded.
	 * @throws SecurityException As forwarded.
	 * @since 2017/02/26
	 */
	public static RecordStore openRecordStore(String __n, boolean __create)
		throws IllegalArgumentException, RecordStoreException,
			RecordStoreFullException, RecordStoreNotFoundException,
			SecureRecordStoreException, SecurityException
	{
		return RecordStore.openRecordStore(__n, __create, AUTHMODE_PRIVATE,

			true, "");
	}
	
	/**
	 * Attempts to open the record store created by another application.
	 *
	 * The record store must have been created with the {@link #AUTHMODE_ANY}
	 * authorization. If it is encrypted then the same password must be
	 * specified.
	 *
	 * If the vendor and suite is our own then this will be the same as
	 * calling: {@code openRecordStore(__n, false, AUTHMODE_PRIVATE, true,
	 * __pass)}.
	 *
	 * @param __n The name of the record store, must consist of 1 to 32
	 * Unicode characters.
	 * @param __vend The vendor of the other suite.
	 * @param __name The name of the other suite.

	 * @return The opened record store.
	 * @throws IllegalArgumentException If the name, vendor, or suite names
	 * are not valid.
	 * @throws RecordStoreException If it could not be opened for another
	 * reason.
	 * @throws RecordStoreNotFoundException If the record store could not be
	 * located.
	 * @throws SecureRecordStoreException The secured record could not be
	 * initialized.
	 * @throws SecurityException If the encryption password does not
	 * match an existing password.
	 * @since 2017/02/26
	 */
	public static RecordStore openRecordStore(String __n, String __vend,
		String __suite, String __pass)
		throws IllegalArgumentException, RecordStoreException,
			RecordStoreNotFoundException, SecureRecordStoreException,
			SecurityException
	{
		return RecordStore.__openRecordStore(__n, __vend, __suite, false,
			AUTHMODE_ANY, false, __pass);
	}
	
	/**
	 * Calls {@code openRecordStore(__n, __vend, __suite, "")}.
	 *
	 * @param __n As forwarded.
	 * @param __vend As forwarded.
	 * @param __name As forwarded.
	 * @return As forwarded.
	 * @throws IllegalArgumentException As forwarded.
	 * @throws RecordStoreException As forwarded.
	 * @throws RecordStoreNotFoundException As forwarded.
	 * @throws SecureRecordStoreException As forwarded.
	 * @throws SecurityException As forwarded.
	 * @since 2017/02/26







<
<














|
>

















|
>




















|







|







1079
1080
1081
1082
1083
1084
1085


1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
	
	/**
	 * Forwards to {@code openRecordStore(__n, __create, AUTHMODE_PRIVATE,
	 * true, "")}.
	 *
	 * @param __n As forwarded.
	 * @param __create As forwarded.


	 * @return As forwarded.
	 * @throws IllegalArgumentException As forwarded.
	 * @throws RecordStoreException As forwarded.
	 * @throws RecordStoreFullException As forwarded.
	 * @throws RecordStoreNotFoundException As forwarded.
	 * @throws SecureRecordStoreException As forwarded.
	 * @throws SecurityException As forwarded.
	 * @since 2017/02/26
	 */
	public static RecordStore openRecordStore(String __n, boolean __create)
		throws IllegalArgumentException, RecordStoreException,
			RecordStoreFullException, RecordStoreNotFoundException,
			SecureRecordStoreException, SecurityException
	{
		return RecordStore.openRecordStore(__n, __create,
			RecordStore.AUTHMODE_PRIVATE,
			true, "");
	}
	
	/**
	 * Attempts to open the record store created by another application.
	 *
	 * The record store must have been created with the {@link #AUTHMODE_ANY}
	 * authorization. If it is encrypted then the same password must be
	 * specified.
	 *
	 * If the vendor and suite is our own then this will be the same as
	 * calling: {@code openRecordStore(__n, false, AUTHMODE_PRIVATE, true,
	 * __pass)}.
	 *
	 * @param __n The name of the record store, must consist of 1 to 32
	 * Unicode characters.
	 * @param __vend The vendor of the other suite.
	 * @param __suite The suite.
	 * @param __pass The password to the record store.
	 * @return The opened record store.
	 * @throws IllegalArgumentException If the name, vendor, or suite names
	 * are not valid.
	 * @throws RecordStoreException If it could not be opened for another
	 * reason.
	 * @throws RecordStoreNotFoundException If the record store could not be
	 * located.
	 * @throws SecureRecordStoreException The secured record could not be
	 * initialized.
	 * @throws SecurityException If the encryption password does not
	 * match an existing password.
	 * @since 2017/02/26
	 */
	public static RecordStore openRecordStore(String __n, String __vend,
		String __suite, String __pass)
		throws IllegalArgumentException, RecordStoreException,
			RecordStoreNotFoundException, SecureRecordStoreException,
			SecurityException
	{
		return RecordStore.__openRecordStore(__n, __vend, __suite, false,
			RecordStore.AUTHMODE_ANY, false, __pass);
	}
	
	/**
	 * Calls {@code openRecordStore(__n, __vend, __suite, "")}.
	 *
	 * @param __n As forwarded.
	 * @param __vend As forwarded.
	 * @param __suite As forwarded.
	 * @return As forwarded.
	 * @throws IllegalArgumentException As forwarded.
	 * @throws RecordStoreException As forwarded.
	 * @throws RecordStoreNotFoundException As forwarded.
	 * @throws SecureRecordStoreException As forwarded.
	 * @throws SecurityException As forwarded.
	 * @since 2017/02/26
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
			throw new IllegalArgumentException("DC0d " + __name);
		
		// Get identifier, used to find the record
		long sid = SuiteIdentifier.identifier(__vend, __suite),
			mysid = SuiteIdentifier.currentIdentifier();
		
		// Lock
		VinylRecord vinyl = _VINYL;
		try (VinylLock lock = vinyl.lock())
		{
			// Go through all records and try to find a pre-existing one
			int rv = -1;
			for (int rid : vinyl.volumeList())
			{
				// Belongs to another suite?







|







1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
			throw new IllegalArgumentException("DC0d " + __name);
		
		// Get identifier, used to find the record
		long sid = SuiteIdentifier.identifier(__vend, __suite),
			mysid = SuiteIdentifier.currentIdentifier();
		
		// Lock
		VinylRecord vinyl = RecordStore._VINYL;
		try (VinylLock lock = vinyl.lock())
		{
			// Go through all records and try to find a pre-existing one
			int rv = -1;
			for (int rid : vinyl.volumeList())
			{
				// Belongs to another suite?
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
				}
			}
			
			// Open a record which already exists
			if (rv >= 0)
			{
				// Use a pre-cached store
				Map<Integer, RecordStore> cache = _STORE_CACHE;
				RecordStore rs = cache.get(rv);
				if (rs == null)
					cache.put(rv, (rs = new RecordStore(rv, __name,
						sid == mysid || vinyl.volumeOtherWritable(rv))));
				
				// Increment the open count
				rs._opens++;







|







1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
				}
			}
			
			// Open a record which already exists
			if (rv >= 0)
			{
				// Use a pre-cached store
				Map<Integer, RecordStore> cache = RecordStore._STORE_CACHE;
				RecordStore rs = cache.get(rv);
				if (rs == null)
					cache.put(rv, (rs = new RecordStore(rv, __name,
						sid == mysid || vinyl.volumeOtherWritable(rv))));
				
				// Increment the open count
				rs._opens++;

Name change from runt/apis/meep-rms/javax/microedition/rms/RecordStoreException.java to modules/meep-rms/src/main/java/javax/microedition/rms/RecordStoreException.java.

Name change from runt/apis/meep-rms/javax/microedition/rms/RecordStoreFullException.java to modules/meep-rms/src/main/java/javax/microedition/rms/RecordStoreFullException.java.

Name change from runt/apis/meep-rms/javax/microedition/rms/RecordStoreInfo.java to modules/meep-rms/src/main/java/javax/microedition/rms/RecordStoreInfo.java.

Name change from runt/apis/meep-rms/javax/microedition/rms/RecordStoreNotFoundException.java to modules/meep-rms/src/main/java/javax/microedition/rms/RecordStoreNotFoundException.java.

Name change from runt/apis/meep-rms/javax/microedition/rms/RecordStoreNotOpenException.java to modules/meep-rms/src/main/java/javax/microedition/rms/RecordStoreNotOpenException.java.

Name change from runt/apis/meep-rms/javax/microedition/rms/SecureRecordStoreException.java to modules/meep-rms/src/main/java/javax/microedition/rms/SecureRecordStoreException.java.

Name change from runt/apis/meep-rms/javax/microedition/rms/__VolumeEnumeration__.java to modules/meep-rms/src/main/java/javax/microedition/rms/__VolumeEnumeration__.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package javax.microedition.rms;

import cc.squirreljme.runtime.rms.VinylLock;
import cc.squirreljme.runtime.rms.VinylRecord;
import java.util.ArrayList;
import java.util.List;

/**
 * This is the internal enumeration over records.
 *
 * @since 2019/05/13











<
<







1
2
3
4
5
6
7
8
9
10
11


12
13
14
15
16
17
18
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package javax.microedition.rms;



import java.util.ArrayList;
import java.util.List;

/**
 * This is the internal enumeration over records.
 *
 * @since 2019/05/13
191
192
193
194
195
196
197










198
199
200
201
202
203
204
	{
		// Check for destruction
		this.__checkDestroy();
		
		// Check for rebuild
		this.__checkRebuild();
		










		throw new todo.TODO();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2019/05/13
	 */







>
>
>
>
>
>
>
>
>
>







189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
	{
		// Check for destruction
		this.__checkDestroy();
		
		// Check for rebuild
		this.__checkRebuild();
		
		throw new todo.TODO();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2020/02/16
	 */
	@Override
	public final int numRecords()
	{
		throw new todo.TODO();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2019/05/13
	 */

Name change from runt/apis/meep-rms/javax/microedition/rms/package-info.java to modules/meep-rms/src/main/java/javax/microedition/rms/package-info.java.

Name change from runt/apis/meep-rms.test/TestNothing.java to modules/meep-rms/src/test/java/TestNothing.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32

33
34
35
36
37
38
39
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

import javax.microedition.rms.RecordStore;

import javax.microedition.rms.RecordStore;
import javax.microedition.rms.RecordStoreException;

/**
 * Tests that nothing is done on the record.
 *
 * @since 2018/12/13
 */
public class TestNothing
	extends __RecordTest__<Object>
{
	/**
	 * {@inheritDoc}
	 * @since 2018/12/13
	 */
	@Override
	public Object test(RecordStore __rs)
		throws RecordStoreException
	{
		try (RecordStore rs = RecordStore.openRecordStore("rmstest", true))

		{
		}
		
		return null;
	}
}












<
<


















|
>







1
2
3
4
5
6
7
8
9
10
11


12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

import javax.microedition.rms.RecordStore;


import javax.microedition.rms.RecordStoreException;

/**
 * Tests that nothing is done on the record.
 *
 * @since 2018/12/13
 */
public class TestNothing
	extends __RecordTest__<Object>
{
	/**
	 * {@inheritDoc}
	 * @since 2018/12/13
	 */
	@Override
	public Object test(RecordStore __rs)
		throws RecordStoreException
	{
		try (RecordStore rs = RecordStore.openRecordStore("rmstest",
			true))
		{
		}
		
		return null;
	}
}

Name change from runt/apis/meep-rms.test/__RecordTest__.java to modules/meep-rms/src/test/java/__RecordTest__.java.

Name change from runt/apis/meep-rms.test/TestNothing.in to modules/meep-rms/src/test/resources/TestNothing.in.

Added modules/meep-securityframework/build.gradle.









































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import cc.squirreljme.plugin.swm.JavaMEMidletType
import cc.squirreljme.plugin.swm.JavaMEStandard

description = "This is used to control and potentially grant " +
	"or deny access to specific features that applicationsmay use."
version = rootProject.version

squirreljme
{
	javaDocErrorCode = "DO"
	swmType = JavaMEMidletType.API
	swmName = "MEEP Security Framework"
	swmVendor = "Stephanie Gawroriski"
	definedStandards += new JavaMEStandard("microedition.securityframework;;")
}

dependencies
{
	implementation project(":modules:cldc-compact")
}

Added modules/meep-swm/build.gradle.























































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import cc.squirreljme.plugin.swm.JavaMEMidletType
import cc.squirreljme.plugin.swm.JavaMEStandard

description = "This contains the application management " +
	"system, this allows programs (provided they have the correct " +
	"permissions) to launch other programs and install new applications " +
	"which may have been sourced from other locations."
version = rootProject.version

squirreljme
{
	javaDocErrorCode = "DG"
	swmType = JavaMEMidletType.API
	swmName = "MEEP Application Management System"
	swmVendor = "Stephanie Gawroriski"
	definedStandards += new JavaMEStandard("microedition.swm;;")
}

dependencies
{
	implementation project(":modules:cldc-compact")

	implementation project(":modules:collections")
	implementation project(":modules:meep-midlet")
	implementation project(":modules:strings")
	implementation project(":modules:tool-manifest-reader")
}

Name change from runt/apis/meep-swm/cc/squirreljme/runtime/swm/APIName.java to modules/meep-swm/src/main/java/cc/squirreljme/runtime/swm/APIName.java.

36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
	{
		if (__n == null)
			throw new NullPointerException("NARG");
		
		// Force all APIs to be uppercase
		__n = StringUtils.toUpperCaseNoLocale(__n);
		
		// {@squirreljme.error AR01 An illegal character was
		// specified in the API name. (The API name)
		if (StringUtils.firstIndex("\0\r\n:;", __n) >= 0)
			throw new InvalidSuiteException(String.format("AR01 %s", __n));
		
		// {@squirreljme.error DG02 API name cannot be blank.}
		if (__n.length() <= 0)
			throw new InvalidSuiteException("DG02");
		
		this.string = __n;
	}







|
|

|







36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
	{
		if (__n == null)
			throw new NullPointerException("NARG");
		
		// Force all APIs to be uppercase
		__n = StringUtils.toUpperCaseNoLocale(__n);
		
		// {@squirreljme.error DG01 An illegal character was
		// specified in the API name. (The API name)}
		if (StringUtils.firstIndex("\0\r\n:;", __n) >= 0)
			throw new InvalidSuiteException(String.format("DG01 %s", __n));
		
		// {@squirreljme.error DG02 API name cannot be blank.}
		if (__n.length() <= 0)
			throw new InvalidSuiteException("DG02");
		
		this.string = __n;
	}

Name change from runt/apis/meep-swm/cc/squirreljme/runtime/swm/ByteArrayJarStreamSupplier.java to modules/meep-swm/src/main/java/cc/squirreljme/runtime/swm/ByteArrayJarStreamSupplier.java.

Name change from runt/apis/meep-swm/cc/squirreljme/runtime/swm/Configuration.java to modules/meep-swm/src/main/java/cc/squirreljme/runtime/swm/Configuration.java.

8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.swm;

import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import java.util.Arrays;
import java.util.Objects;
import net.multiphasicapps.strings.StringUtils;

/**
 * This represents a configuration such as CLDC which specifies which base
 * classes are available. Configurations may optionally be "compact" in which
 * they are a lighter version.







<







8
9
10
11
12
13
14

15
16
17
18
19
20
21
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.swm;

import java.lang.ref.Reference;
import java.lang.ref.WeakReference;

import java.util.Objects;
import net.multiphasicapps.strings.StringUtils;

/**
 * This represents a configuration such as CLDC which specifies which base
 * classes are available. Configurations may optionally be "compact" in which
 * they are a lighter version.
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
		this.version = __v;
		this.compact = __c;
	}
	
	/**
	 * Initializes the configuration by parsing the given string.
	 *
	 * @param __s The string to parse.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/11/30
	 */
	public Configuration(String __n)
		throws NullPointerException
	{
		if (__n == null)
			throw new NullPointerException("NARG");
		
		// {@squirreljme.error AR02 Expected two or three fields for the
		// configuration. (The input string)}
		String[] fields = StringUtils.fieldSplit('-', __n);
		int fn = fields.length;
		if (fn != 2 && fn != 3)
			throw new InvalidSuiteException(String.format("AR02 %s", __n));
		
		// Potentially compact?







|









|







57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
		this.version = __v;
		this.compact = __c;
	}
	
	/**
	 * Initializes the configuration by parsing the given string.
	 *
	 * @param __n The string to parse.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/11/30
	 */
	public Configuration(String __n)
		throws NullPointerException
	{
		if (__n == null)
			throw new NullPointerException("NARG");
		
		// {@squirreljme.error DG02 Expected two or three fields for the
		// configuration. (The input string)}
		String[] fields = StringUtils.fieldSplit('-', __n);
		int fn = fields.length;
		if (fn != 2 && fn != 3)
			throw new InvalidSuiteException(String.format("AR02 %s", __n));
		
		// Potentially compact?

Name change from runt/apis/meep-swm/cc/squirreljme/runtime/swm/DependencyInfo.java to modules/meep-swm/src/main/java/cc/squirreljme/runtime/swm/DependencyInfo.java.

13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import java.util.Arrays;
import java.util.Collection;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.Set;
import net.multiphasicapps.collections.ArrayUtils;
import net.multiphasicapps.collections.EmptySet;
import net.multiphasicapps.collections.SortedTreeSet;
import net.multiphasicapps.collections.UnmodifiableSet;
import net.multiphasicapps.strings.StringUtils;
import net.multiphasicapps.tool.manifest.JavaManifest;
import net.multiphasicapps.tool.manifest.JavaManifestAttributes;
import net.multiphasicapps.tool.manifest.JavaManifestKey;

/**
 * This contains the information which specifies all of the dependencies which
 * and application depends on.
 *
 * @since 2017/11/30
 */







<

<


<

<







13
14
15
16
17
18
19

20

21
22

23

24
25
26
27
28
29
30
import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import java.util.Arrays;
import java.util.Collection;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.Set;

import net.multiphasicapps.collections.EmptySet;

import net.multiphasicapps.collections.UnmodifiableSet;
import net.multiphasicapps.strings.StringUtils;

import net.multiphasicapps.tool.manifest.JavaManifestAttributes;


/**
 * This contains the information which specifies all of the dependencies which
 * and application depends on.
 *
 * @since 2017/11/30
 */

Name change from runt/apis/meep-swm/cc/squirreljme/runtime/swm/EntryPoint.java to modules/meep-swm/src/main/java/cc/squirreljme/runtime/swm/EntryPoint.java.

Name change from runt/apis/meep-swm/cc/squirreljme/runtime/swm/EntryPoints.java to modules/meep-swm/src/main/java/cc/squirreljme/runtime/swm/EntryPoints.java.

8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.swm;

import java.util.AbstractList;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import net.multiphasicapps.tool.manifest.JavaManifest;
import net.multiphasicapps.tool.manifest.JavaManifestAttributes;
import net.multiphasicapps.tool.manifest.JavaManifestKey;

/**
 * This parses the entry points which are available for usage.







<
<







8
9
10
11
12
13
14


15
16
17
18
19
20
21
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.swm;

import java.util.AbstractList;
import java.util.ArrayList;


import java.util.List;
import net.multiphasicapps.tool.manifest.JavaManifest;
import net.multiphasicapps.tool.manifest.JavaManifestAttributes;
import net.multiphasicapps.tool.manifest.JavaManifestKey;

/**
 * This parses the entry points which are available for usage.
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
			// These are always in sequence
			String midletval = __attr.get(new JavaManifestKey(
				String.format("MIDlet-%d", i)));
			if (midletval == null)
				break;
			
			// The MIDlet field is in 3 fields: name, icon, class
			// {@squirreljme.error AR03 Expected two commas in the MIDlet
			// field.}
			int pc = midletval.indexOf(','),
				sc = midletval.indexOf(',', Math.max(pc + 1, 0));
			if (pc < 0 || sc < 0)
				throw new RuntimeException("AR03");
		
			// Split fields
			target.add(new EntryPoint(midletval.substring(0, pc).trim(),
				midletval.substring(sc + 1).trim(), true));
		}
		
		// Finalize







|




|







69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
			// These are always in sequence
			String midletval = __attr.get(new JavaManifestKey(
				String.format("MIDlet-%d", i)));
			if (midletval == null)
				break;
			
			// The MIDlet field is in 3 fields: name, icon, class
			// {@squirreljme.error DG03 Expected two commas in the MIDlet
			// field.}
			int pc = midletval.indexOf(','),
				sc = midletval.indexOf(',', Math.max(pc + 1, 0));
			if (pc < 0 || sc < 0)
				throw new RuntimeException("DG03");
		
			// Split fields
			target.add(new EntryPoint(midletval.substring(0, pc).trim(),
				midletval.substring(sc + 1).trim(), true));
		}
		
		// Finalize

Name change from runt/apis/meep-swm/cc/squirreljme/runtime/swm/ExtendedTaskManager.java to modules/meep-swm/src/main/java/cc/squirreljme/runtime/swm/ExtendedTaskManager.java.

10
11
12
13
14
15
16

17
18
19
20
21
22
23

package cc.squirreljme.runtime.swm;

import java.io.OutputStream;
import java.util.Map;
import javax.microedition.swm.Suite;
import javax.microedition.swm.Task;


/**
 * This interface is used for providing the ability to launch tasks.
 *
 * @since 2019/02/02
 */
public interface ExtendedTaskManager







>







10
11
12
13
14
15
16
17
18
19
20
21
22
23
24

package cc.squirreljme.runtime.swm;

import java.io.OutputStream;
import java.util.Map;
import javax.microedition.swm.Suite;
import javax.microedition.swm.Task;
import javax.microedition.swm.TaskStatus;

/**
 * This interface is used for providing the ability to launch tasks.
 *
 * @since 2019/02/02
 */
public interface ExtendedTaskManager
49
50
51
52
53
54
55
56
57
58
59
60
61
	 * @throws IllegalArgumentException If the suite is a library, the given
	 * class does not exist, or the given class does not extend
	 * {@link javax.microedition.midlet.MIDlet}.
	 * @throws IllegalStateException If the suite has been removed.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/02/02
	 */
	public abstract Task startTask(Suite __s, String __cn,
		Map<String, String> __sprops, String[] __args, OutputStream __stdout,
		OutputStream __stderr)
		throws IllegalArgumentException, IllegalStateException,
			NullPointerException;
}







|
|
<



50
51
52
53
54
55
56
57
58

59
60
61
	 * @throws IllegalArgumentException If the suite is a library, the given
	 * class does not exist, or the given class does not extend
	 * {@link javax.microedition.midlet.MIDlet}.
	 * @throws IllegalStateException If the suite has been removed.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/02/02
	 */
	Task startTask(Suite __s, String __cn, Map<String, String> __sprops,
		String[] __args, OutputStream __stdout, OutputStream __stderr)

		throws IllegalArgumentException, IllegalStateException,
			NullPointerException;
}

Name change from runt/apis/meep-swm/cc/squirreljme/runtime/swm/InternalName.java to modules/meep-swm/src/main/java/cc/squirreljme/runtime/swm/InternalName.java.

Name change from runt/apis/meep-swm/cc/squirreljme/runtime/swm/InvalidSuiteException.java to modules/meep-swm/src/main/java/cc/squirreljme/runtime/swm/InvalidSuiteException.java.

Name change from runt/apis/meep-swm/cc/squirreljme/runtime/swm/JarStreamSupplier.java to modules/meep-swm/src/main/java/cc/squirreljme/runtime/swm/JarStreamSupplier.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.swm;

import java.io.InputStream;
import java.io.IOException;

/**
 * This is used to obtain an input stream which contains JAR file data which
 * would then be passed through the JIT for recompilation.
 *
 * @since 2017/12/28
 */
public interface JarStreamSupplier
{
	/**
	 * Returns an input stream over the JAR data.
	 *
	 * @return The input stream over the JAR data.
	 * @throws IOException If it could not be obtained.
	 * @since 2017/12/28
	 */
	public abstract InputStream get()
		throws IOException;
}













|
|
















|



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.swm;

import java.io.IOException;
import java.io.InputStream;

/**
 * This is used to obtain an input stream which contains JAR file data which
 * would then be passed through the JIT for recompilation.
 *
 * @since 2017/12/28
 */
public interface JarStreamSupplier
{
	/**
	 * Returns an input stream over the JAR data.
	 *
	 * @return The input stream over the JAR data.
	 * @throws IOException If it could not be obtained.
	 * @since 2017/12/28
	 */
	InputStream get()
		throws IOException;
}

Name change from runt/apis/meep-swm/cc/squirreljme/runtime/swm/MarkedDependency.java to modules/meep-swm/src/main/java/cc/squirreljme/runtime/swm/MarkedDependency.java.

20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
{
	/**
	 * Is this dependency optional?
	 *
	 * @return {@code true} if this dependency is optional.
	 * @since 2017/12/31
	 */
	public abstract boolean isOptional();
	
	/**
	 * Checks if this dependency matches the specified provision in that the
	 * provided entry is acceptable to be used for this dependency.
	 *
	 * @param __mp The provided to check.
	 * @return {@code true} if the provided is valid for this dependency.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/12/31
	 */
	public abstract boolean matchesProvided(MarkedProvided __mp)
		throws NullPointerException;
}








|










|



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
{
	/**
	 * Is this dependency optional?
	 *
	 * @return {@code true} if this dependency is optional.
	 * @since 2017/12/31
	 */
	boolean isOptional();
	
	/**
	 * Checks if this dependency matches the specified provision in that the
	 * provided entry is acceptable to be used for this dependency.
	 *
	 * @param __mp The provided to check.
	 * @return {@code true} if the provided is valid for this dependency.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/12/31
	 */
	boolean matchesProvided(MarkedProvided __mp)
		throws NullPointerException;
}

Name change from runt/apis/meep-swm/cc/squirreljme/runtime/swm/MarkedProvided.java to modules/meep-swm/src/main/java/cc/squirreljme/runtime/swm/MarkedProvided.java.

Name change from runt/apis/meep-swm/cc/squirreljme/runtime/swm/MatchResult.java to modules/meep-swm/src/main/java/cc/squirreljme/runtime/swm/MatchResult.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.swm;

import java.util.Arrays;
import java.util.Collections;
import java.util.Set;
import net.multiphasicapps.collections.EmptySet;

/**
 * This class contains the results of a dependency match.
 *
 * @since 2017/11/30
 */
public final class MatchResult
{












<
<
<
<
<







1
2
3
4
5
6
7
8
9
10
11
12





13
14
15
16
17
18
19
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.swm;






/**
 * This class contains the results of a dependency match.
 *
 * @since 2017/11/30
 */
public final class MatchResult
{

Name change from runt/apis/meep-swm/cc/squirreljme/runtime/swm/Profile.java to modules/meep-swm/src/main/java/cc/squirreljme/runtime/swm/Profile.java.

9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.swm;

import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import java.util.Objects;
import net.multiphasicapps.strings.StringUtils;

/**
 * This represents a profile that may be implemented, such as MIDP.
 *
 * @since 2016/12/14
 */
public final class Profile







<







9
10
11
12
13
14
15

16
17
18
19
20
21
22
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.swm;

import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import java.util.Objects;


/**
 * This represents a profile that may be implemented, such as MIDP.
 *
 * @since 2016/12/14
 */
public final class Profile
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
		this.name = __n;
		this.version = __v;
	}
	
	/**
	 * Initializes the profile by parsing the given string.
	 *
	 * @param __s The string to parse.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/11/30
	 */
	public Profile(String __n)
		throws NullPointerException
	{
		if (__n == null)







|







48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
		this.name = __n;
		this.version = __v;
	}
	
	/**
	 * Initializes the profile by parsing the given string.
	 *
	 * @param __n The string to parse.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/11/30
	 */
	public Profile(String __n)
		throws NullPointerException
	{
		if (__n == null)

Name change from runt/apis/meep-swm/cc/squirreljme/runtime/swm/ProvidedInfo.java to modules/meep-swm/src/main/java/cc/squirreljme/runtime/swm/ProvidedInfo.java.

12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33

import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import java.util.Arrays;
import java.util.Collection;
import java.util.LinkedHashSet;
import java.util.Set;
import net.multiphasicapps.collections.ArrayUtils;
import net.multiphasicapps.collections.EmptySet;
import net.multiphasicapps.collections.SortedTreeSet;
import net.multiphasicapps.collections.UnmodifiableSet;
import net.multiphasicapps.strings.StringUtils;
import net.multiphasicapps.tool.manifest.JavaManifest;
import net.multiphasicapps.tool.manifest.JavaManifestAttributes;
import net.multiphasicapps.tool.manifest.JavaManifestKey;

/**
 * This contains all of the information for dependencies which are provided
 * by an application or library.
 *
 * @since 2017/11/30
 */







<

<


<

<







12
13
14
15
16
17
18

19

20
21

22

23
24
25
26
27
28
29

import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import java.util.Arrays;
import java.util.Collection;
import java.util.LinkedHashSet;
import java.util.Set;

import net.multiphasicapps.collections.EmptySet;

import net.multiphasicapps.collections.UnmodifiableSet;
import net.multiphasicapps.strings.StringUtils;

import net.multiphasicapps.tool.manifest.JavaManifestAttributes;


/**
 * This contains all of the information for dependencies which are provided
 * by an application or library.
 *
 * @since 2017/11/30
 */

Name change from runt/apis/meep-swm/cc/squirreljme/runtime/swm/Standard.java to modules/meep-swm/src/main/java/cc/squirreljme/runtime/swm/Standard.java.

65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
	 */
	public Standard(String __s)
		throws InvalidSuiteException, NullPointerException
	{
		if (__s == null)
			throw new NullPointerException("NARG");
		
		// {@squirreljme.error AR04 Expected input standard string to
		// contain three fields separated by semi-colon. (The input string)}
		String[] splice = StringUtils.fieldSplitAndTrim(';', __s);
		if (splice.length != 3)
			throw new InvalidSuiteException(String.format("AR04 %s", __s));
		
		// {@squirreljme.error AR05 Name in standard string is empty. (The
		// input string)}
		String name = splice[0];
		if (name.isEmpty())
			throw new InvalidSuiteException(String.format("AR05 %s", __s));
		this.name = new SuiteName(name);
		
		String vendor = splice[1];
		this.vendor = (vendor.isEmpty() ? null : new SuiteVendor(vendor));
		
		String version = splice[2];
		this.version = (version.isEmpty() ? null : new SuiteVersion(version));







|



|

|



|







65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
	 */
	public Standard(String __s)
		throws InvalidSuiteException, NullPointerException
	{
		if (__s == null)
			throw new NullPointerException("NARG");
		
		// {@squirreljme.error DG04 Expected input standard string to
		// contain three fields separated by semi-colon. (The input string)}
		String[] splice = StringUtils.fieldSplitAndTrim(';', __s);
		if (splice.length != 3)
			throw new InvalidSuiteException(String.format("DG04 %s", __s));
		
		// {@squirreljme.error DG05 Name in standard string is empty. (The
		// input string)}
		String name = splice[0];
		if (name.isEmpty())
			throw new InvalidSuiteException(String.format("DG05 %s", __s));
		this.name = new SuiteName(name);
		
		String vendor = splice[1];
		this.vendor = (vendor.isEmpty() ? null : new SuiteVendor(vendor));
		
		String version = splice[2];
		this.version = (version.isEmpty() ? null : new SuiteVersion(version));

Name change from runt/apis/meep-swm/cc/squirreljme/runtime/swm/StandardName.java to modules/meep-swm/src/main/java/cc/squirreljme/runtime/swm/StandardName.java.

Name change from runt/apis/meep-swm/cc/squirreljme/runtime/swm/SuiteDependency.java to modules/meep-swm/src/main/java/cc/squirreljme/runtime/swm/SuiteDependency.java.

59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
		
		// Trim whitespace
		__s = __s.trim();
		
		// Extract all semicolon positions
		int[] sc = StringUtils.multipleIndexOf(';', __s);
		
		// {@squirreljme.error AR06 Expected four semi-colons in the
		// dependency field. (The input dependency)}
		if (sc.length != 4)
			throw new InvalidSuiteException(String.format(
				"AR06 %s", __s));
		
		// Split fields
		String intype = __s.substring(0, sc[0]).trim(),







|







59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
		
		// Trim whitespace
		__s = __s.trim();
		
		// Extract all semicolon positions
		int[] sc = StringUtils.multipleIndexOf(';', __s);
		
		// {@squirreljme.error DG06 Expected four semi-colons in the
		// dependency field. (The input dependency)}
		if (sc.length != 4)
			throw new InvalidSuiteException(String.format(
				"AR06 %s", __s));
		
		// Split fields
		String intype = __s.substring(0, sc[0]).trim(),
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
			new SuiteName(inname)));
		this.vendor = (vendor = (invendor.isEmpty() ? null :
			new SuiteVendor(invendor)));
		this.version = (version = (inversion.isEmpty() ? null :
			new SuiteVersionRange(inversion)));
		
		// Check
		__check(type, level, name, vendor, version);
	}
	
	/**
	 * Initializes the depedency with the given type, level, and where the
	 * remainder of the dependencies are parsed from the specified string.
	 *
	 * @param __type The type of dependency this is.







|







89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
			new SuiteName(inname)));
		this.vendor = (vendor = (invendor.isEmpty() ? null :
			new SuiteVendor(invendor)));
		this.version = (version = (inversion.isEmpty() ? null :
			new SuiteVersionRange(inversion)));
		
		// Check
		SuiteDependency.__check(type, this.level, name, vendor, version);
	}
	
	/**
	 * Initializes the depedency with the given type, level, and where the
	 * remainder of the dependencies are parsed from the specified string.
	 *
	 * @param __type The type of dependency this is.
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
		
		// Trim whitespace
		__s = __s.trim();
		
		// Extract all semicolon positions
		int[] sc = StringUtils.multipleIndexOf(';', __s);
		
		// {@squirreljme.error AR07 Expected two semi-colons in the
		// dependency field. (The input dependency)}
		if (sc.length != 2)
			throw new InvalidSuiteException(String.format(
				"AR07 %s", __s));
		
		// Split fields
		String inname = __s.substring(0, sc[0]).trim(),







|







116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
		
		// Trim whitespace
		__s = __s.trim();
		
		// Extract all semicolon positions
		int[] sc = StringUtils.multipleIndexOf(';', __s);
		
		// {@squirreljme.error DG07 Expected two semi-colons in the
		// dependency field. (The input dependency)}
		if (sc.length != 2)
			throw new InvalidSuiteException(String.format(
				"AR07 %s", __s));
		
		// Split fields
		String inname = __s.substring(0, sc[0]).trim(),
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
		this.name = (name = (inname.isEmpty() ? null :
			new SuiteName(inname)));
		this.vendor = (vendor = (invendor.isEmpty() ? null :
			new SuiteVendor(invendor)));
		this.version = (version = (inversion.isEmpty() ? null :
			new SuiteVersionRange(inversion)));
		
		__check(__type, __level, name, vendor, version);
		
		// Set
		this.type = __type;
		this.level = __level;
	}
	
	/**







|







138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
		this.name = (name = (inname.isEmpty() ? null :
			new SuiteName(inname)));
		this.vendor = (vendor = (invendor.isEmpty() ? null :
			new SuiteVendor(invendor)));
		this.version = (version = (inversion.isEmpty() ? null :
			new SuiteVersionRange(inversion)));
		
		SuiteDependency.__check(__type, __level, name, vendor, version);
		
		// Set
		this.type = __type;
		this.level = __level;
	}
	
	/**
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
		SuiteDependencyLevel __level, SuiteName __name,
		SuiteVendor __vendor, SuiteVersionRange __version)
		throws InvalidSuiteException, NullPointerException
	{
		if (__type == null || __level == null)
			throw new NullPointerException("NARG");
		
		__check(__type, __level, __name, __vendor, __version);
		
		// Set
		this.type = __type;
		this.level = __level;
		this.name = __name;
		this.vendor = __vendor;
		this.version = __version;







|







165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
		SuiteDependencyLevel __level, SuiteName __name,
		SuiteVendor __vendor, SuiteVersionRange __version)
		throws InvalidSuiteException, NullPointerException
	{
		if (__type == null || __level == null)
			throw new NullPointerException("NARG");
		
		SuiteDependency.__check(__type, __level, __name, __vendor, __version);
		
		// Set
		this.type = __type;
		this.level = __level;
		this.name = __name;
		this.vendor = __vendor;
		this.version = __version;
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
					return true;
				}
				
				// Not a standard
				else
					return false;
				
				// {@squirreljme.error AR08 Illegal dependency check.
				// (The dependency type; The target class)}
			default:
				throw new RuntimeException(String.format("AR08 %s %s",
					type, mpclass));
		}
	}
	
	/**
	 * Returns a dependency which is the same as this one except that it is
	 * required.
	 *
	 * @return This dependency but required.
	 * @since 2017/11/26
	 */
	public SuiteDependency toRequired()
	{
		if (isRequired())
			return this;
		return new SuiteDependency(this.type, SuiteDependencyLevel.REQUIRED,
			this.name, this.vendor, this.version);
	}
	
	/**
	 * Returns a dependency which is the same as this one except that it is
	 * optional.
	 *
	 * @return This dependency but optional.
	 * @since 2017/11/26
	 */
	public SuiteDependency toOptional()
	{
		if (isOptional())
			return this;
		return new SuiteDependency(this.type, SuiteDependencyLevel.OPTIONAL,
			this.name, this.vendor, this.version);
	}
	
	/**
	 * {@inheritDoc}







|
















|














|







400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
					return true;
				}
				
				// Not a standard
				else
					return false;
				
				// {@squirreljme.error DG08 Illegal dependency check.
				// (The dependency type; The target class)}
			default:
				throw new RuntimeException(String.format("AR08 %s %s",
					type, mpclass));
		}
	}
	
	/**
	 * Returns a dependency which is the same as this one except that it is
	 * required.
	 *
	 * @return This dependency but required.
	 * @since 2017/11/26
	 */
	public SuiteDependency toRequired()
	{
		if (this.isRequired())
			return this;
		return new SuiteDependency(this.type, SuiteDependencyLevel.REQUIRED,
			this.name, this.vendor, this.version);
	}
	
	/**
	 * Returns a dependency which is the same as this one except that it is
	 * optional.
	 *
	 * @return This dependency but optional.
	 * @since 2017/11/26
	 */
	public SuiteDependency toOptional()
	{
		if (this.isOptional())
			return this;
		return new SuiteDependency(this.type, SuiteDependencyLevel.OPTIONAL,
			this.name, this.vendor, this.version);
	}
	
	/**
	 * {@inheritDoc}
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
	 * @since 2017/11/26
	 */
	private static final void __check(SuiteDependencyType __type,
		SuiteDependencyLevel __level, SuiteName __name,
		SuiteVendor __vendor, SuiteVersionRange __version)
		throws InvalidSuiteException
	{
		// {@squirreljme.error AR09 Dependencies on LIBlets must have the
		// name, vendor, and version set. (The type; The level; The name;
		// The vendor; The version)}
		if (__type == SuiteDependencyType.LIBLET && (__name == null ||
			__vendor == null || __version == null))
			throw new InvalidSuiteException(
				String.format("AR09 %s %s %s %s %s", __type, __level, __name,
					__vendor, __version));
	}
}








|










518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
	 * @since 2017/11/26
	 */
	private static final void __check(SuiteDependencyType __type,
		SuiteDependencyLevel __level, SuiteName __name,
		SuiteVendor __vendor, SuiteVersionRange __version)
		throws InvalidSuiteException
	{
		// {@squirreljme.error DG09 Dependencies on LIBlets must have the
		// name, vendor, and version set. (The type; The level; The name;
		// The vendor; The version)}
		if (__type == SuiteDependencyType.LIBLET && (__name == null ||
			__vendor == null || __version == null))
			throw new InvalidSuiteException(
				String.format("AR09 %s %s %s %s %s", __type, __level, __name,
					__vendor, __version));
	}
}

Name change from runt/apis/meep-swm/cc/squirreljme/runtime/swm/SuiteDependencyLevel.java to modules/meep-swm/src/main/java/cc/squirreljme/runtime/swm/SuiteDependencyLevel.java.

30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
	 * Is this an optional dependency level?
	 *
	 * @return {@code true} if this is an optional dependency level.
	 * @since 2017/11/22
	 */
	public boolean isOptional()
	{
		return this == OPTIONAL;
	}
	
	/**
	 * Is this an required dependency level?
	 *
	 * @return {@code true} if this is an required dependency level.
	 * @since 2017/11/22
	 */
	public boolean isRequired()
	{
		return this == REQUIRED;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/02/22
	 */
	@Override







|










|







30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
	 * Is this an optional dependency level?
	 *
	 * @return {@code true} if this is an optional dependency level.
	 * @since 2017/11/22
	 */
	public boolean isOptional()
	{
		return this == SuiteDependencyLevel.OPTIONAL;
	}
	
	/**
	 * Is this an required dependency level?
	 *
	 * @return {@code true} if this is an required dependency level.
	 * @since 2017/11/22
	 */
	public boolean isRequired()
	{
		return this == SuiteDependencyLevel.REQUIRED;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/02/22
	 */
	@Override
66
67
68
69
70
71
72

73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91

92
93
94
95
	}
	
	/**
	 * Returns the dependency level based on the input string.
	 *
	 * @param __s The input string to parse.
	 * @return The dependency level for the given string.

	 * @throws NullPointerException On null arguments.
	 * @since 2017/02/22
	 */
	public static SuiteDependencyLevel of(String __s)
		throws NullPointerException
	{
		// Check
		if (__s == null)
			throw new NullPointerException("NARG");
		
		// Depends
		switch (__s.trim())
		{
			case "required":	return REQUIRED;
			case "optional":	return OPTIONAL;
			
				// Should not happen
			default:
				throw new todo.OOPS();

		}
	}
}








>




|








|
|

|

|
>




66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
	}
	
	/**
	 * Returns the dependency level based on the input string.
	 *
	 * @param __s The input string to parse.
	 * @return The dependency level for the given string.
	 * @throws IllegalArgumentException If the level is not valid.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/02/22
	 */
	public static SuiteDependencyLevel of(String __s)
		throws IllegalArgumentException, NullPointerException
	{
		// Check
		if (__s == null)
			throw new NullPointerException("NARG");
		
		// Depends
		switch (__s.trim())
		{
			case "required":	return SuiteDependencyLevel.REQUIRED;
			case "optional":	return SuiteDependencyLevel.OPTIONAL;
			
				// {@squirreljme.error DG82 Invalid dependency level. (Level)}
			default:
				throw new IllegalArgumentException(String.format(
					"DG82 %s", __s));
		}
	}
}

Name change from runt/apis/meep-swm/cc/squirreljme/runtime/swm/SuiteDependencyType.java to modules/meep-swm/src/main/java/cc/squirreljme/runtime/swm/SuiteDependencyType.java.

68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
		// Check
		if (__s == null)
			throw new NullPointerException("NARG");
		
		// Depends
		switch (__s.trim())
		{
			case "liblet":		return LIBLET;
			case "standard":	return STANDARD;
			case "service":		return SERVICE;
			case "proprietary":	return PROPRIETARY;
			
				// {@squirreljme.error AR0a The specified string is not a valid
				// dependency type. (The input string)}
			default:
				throw new InvalidSuiteException(
					String.format("AR0a %s", __s));
		}
	}
}







|
|
|
|

|







68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
		// Check
		if (__s == null)
			throw new NullPointerException("NARG");
		
		// Depends
		switch (__s.trim())
		{
			case "liblet":		return SuiteDependencyType.LIBLET;
			case "standard":	return SuiteDependencyType.STANDARD;
			case "service":		return SuiteDependencyType.SERVICE;
			case "proprietary":	return SuiteDependencyType.PROPRIETARY;
			
				// {@squirreljme.error DG0a The specified string is not a valid
				// dependency type. (The input string)}
			default:
				throw new InvalidSuiteException(
					String.format("AR0a %s", __s));
		}
	}
}

Name change from runt/apis/meep-swm/cc/squirreljme/runtime/swm/SuiteIdentifier.java to modules/meep-swm/src/main/java/cc/squirreljme/runtime/swm/SuiteIdentifier.java.

34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
	/** String representation. */
	private Reference<String> _string;
	
	/**
	 * Initializes the suite identifier.
	 *
	 * @param __name The name of the suite.
	 * @param __vendor The vendor of the suite.
	 * @param __ver The version of the suite.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/02/22
	 */
	public SuiteIdentifier(SuiteName __name, SuiteVendor __ven,
		SuiteVersion __ver)
		throws NullPointerException
	{
		this(__ven, __name, __ver);
	}
	
	/**
	 * Initializes the suite identifier.
	 *
	 * @param __vendor The vendor of the suite.
	 * @param __name The name of the suite.
	 * @param __ver The version of the suite.
	 * @throws NullPointerException On null arguments.
	 * @since 2016/10/12
	 */
	public SuiteIdentifier(SuiteVendor __ven, SuiteName __name,
		SuiteVersion __ver)







|














|







34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
	/** String representation. */
	private Reference<String> _string;
	
	/**
	 * Initializes the suite identifier.
	 *
	 * @param __name The name of the suite.
	 * @param __ven The vendor of the suite.
	 * @param __ver The version of the suite.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/02/22
	 */
	public SuiteIdentifier(SuiteName __name, SuiteVendor __ven,
		SuiteVersion __ver)
		throws NullPointerException
	{
		this(__ven, __name, __ver);
	}
	
	/**
	 * Initializes the suite identifier.
	 *
	 * @param __ven The vendor of the suite.
	 * @param __name The name of the suite.
	 * @param __ver The version of the suite.
	 * @throws NullPointerException On null arguments.
	 * @since 2016/10/12
	 */
	public SuiteIdentifier(SuiteVendor __ven, SuiteName __name,
		SuiteVersion __ver)
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
		if (this == __o)
			return true;
		
		// Check
		if (!(__o instanceof SuiteIdentifier))
			return false;
		
		return 0 == (compareTo((SuiteIdentifier)__o));
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/10/12
	 */
	@Override







|







107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
		if (this == __o)
			return true;
		
		// Check
		if (!(__o instanceof SuiteIdentifier))
			return false;
		
		return 0 == (this.compareTo((SuiteIdentifier)__o));
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/10/12
	 */
	@Override

Name change from runt/apis/meep-swm/cc/squirreljme/runtime/swm/SuiteInfo.java to modules/meep-swm/src/main/java/cc/squirreljme/runtime/swm/SuiteInfo.java.

11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package cc.squirreljme.runtime.swm;

import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import java.util.Objects;
import net.multiphasicapps.tool.manifest.JavaManifest;
import net.multiphasicapps.tool.manifest.JavaManifestAttributes;
import net.multiphasicapps.tool.manifest.JavaManifestKey;

/**
 * This contains all of the information which is provided by a suite.
 *
 * @since 2017/11/30
 */
public final class SuiteInfo







<







11
12
13
14
15
16
17

18
19
20
21
22
23
24
package cc.squirreljme.runtime.swm;

import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import java.util.Objects;
import net.multiphasicapps.tool.manifest.JavaManifest;
import net.multiphasicapps.tool.manifest.JavaManifestAttributes;


/**
 * This contains all of the information which is provided by a suite.
 *
 * @since 2017/11/30
 */
public final class SuiteInfo
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
		this.manifest = __man;
		JavaManifestAttributes attr = __man.getMainAttributes();
		
		// First determine the type
		SuiteType type = SuiteType.ofManifest(__man);
		this.type = type;
		
		// {@squirreljme.error AR0b No suite name was specified.}
		SuiteName name = new SuiteName(
			Objects.<String>requireNonNull(attr.getValue(type.nameKey()),
			"AR0b"));
		this.name = name;
		
		// {@squirreljme.error AR0c No suite vendor was specified.}
		SuiteVendor vendor = new SuiteVendor(
			Objects.<String>requireNonNull(attr.getValue(type.vendorKey()),
			"AR0c"));
		this.vendor = vendor;
		
		// {@squirreljme.error AR0d No suite version was specified.}
		SuiteVersion version = new SuiteVersion(
			Objects.<String>requireNonNull(attr.getValue(type.versionKey()),
			"AR0d"));
		this.version = version;
	}
	
	/**







|





|





|







64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
		this.manifest = __man;
		JavaManifestAttributes attr = __man.getMainAttributes();
		
		// First determine the type
		SuiteType type = SuiteType.ofManifest(__man);
		this.type = type;
		
		// {@squirreljme.error DG0b No suite name was specified.}
		SuiteName name = new SuiteName(
			Objects.<String>requireNonNull(attr.getValue(type.nameKey()),
			"AR0b"));
		this.name = name;
		
		// {@squirreljme.error DG0c No suite vendor was specified.}
		SuiteVendor vendor = new SuiteVendor(
			Objects.<String>requireNonNull(attr.getValue(type.vendorKey()),
			"AR0c"));
		this.vendor = vendor;
		
		// {@squirreljme.error DG0d No suite version was specified.}
		SuiteVersion version = new SuiteVersion(
			Objects.<String>requireNonNull(attr.getValue(type.versionKey()),
			"AR0d"));
		this.version = version;
	}
	
	/**

Name change from runt/apis/meep-swm/cc/squirreljme/runtime/swm/SuiteName.java to modules/meep-swm/src/main/java/cc/squirreljme/runtime/swm/SuiteName.java.

34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
	public SuiteName(String __v)
		throws InvalidSuiteException, NullPointerException
	{
		// Check
		if (__v == null)
			throw new NullPointerException("NARG");
		
		// {@squirreljme.error AR0e An illegal character was
		// specified in the midlet suite name. (The midlet suite
		// name)}
		if (StringUtils.firstIndex("\0\r\n:;", __v) >= 0)
			throw new InvalidSuiteException(String.format("AR0e %s", __v));
		
		this.string = __v;
	}







|







34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
	public SuiteName(String __v)
		throws InvalidSuiteException, NullPointerException
	{
		// Check
		if (__v == null)
			throw new NullPointerException("NARG");
		
		// {@squirreljme.error DG0e An illegal character was
		// specified in the midlet suite name. (The midlet suite
		// name)}
		if (StringUtils.firstIndex("\0\r\n:;", __v) >= 0)
			throw new InvalidSuiteException(String.format("AR0e %s", __v));
		
		this.string = __v;
	}

Name change from runt/apis/meep-swm/cc/squirreljme/runtime/swm/SuiteType.java to modules/meep-swm/src/main/java/cc/squirreljme/runtime/swm/SuiteType.java.

53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
	/**
	 * Initializes the type.
	 *
	 * @param __p The prefix which is used.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/12/04
	 */
	private SuiteType(String __p)
		throws NullPointerException
	{
		if (__p == null)
			throw new NullPointerException("NARG");
		
		this.prefix = __p;
	}
	
	/**
	 * Returns the key which is used to refer to dependencies.
	 *
	 * @param __i The index of the dependency to get.
	 * @return The key for the given dependency index.
	 * @since 2017/12/05
	 */
	public JavaManifestKey dependencyKey(int __i)
	{
		// {@squirreljme.error AR0f Cannot have a zero or negative dependency
		// index.}
		if (__i <= 0)
			throw new IllegalArgumentException("AR0f");
		
		return new JavaManifestKey(this.prefix + "-Dependency-" + __i);
	}
	







|

















|







53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
	/**
	 * Initializes the type.
	 *
	 * @param __p The prefix which is used.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/12/04
	 */
	SuiteType(String __p)
		throws NullPointerException
	{
		if (__p == null)
			throw new NullPointerException("NARG");
		
		this.prefix = __p;
	}
	
	/**
	 * Returns the key which is used to refer to dependencies.
	 *
	 * @param __i The index of the dependency to get.
	 * @return The key for the given dependency index.
	 * @since 2017/12/05
	 */
	public JavaManifestKey dependencyKey(int __i)
	{
		// {@squirreljme.error DG0f Cannot have a zero or negative dependency
		// index.}
		if (__i <= 0)
			throw new IllegalArgumentException("AR0f");
		
		return new JavaManifestKey(this.prefix + "-Dependency-" + __i);
	}
	
171
172
173
174
175
176
177
178
179
180
181
182
183
			throw new NullPointerException("NARG");
		
		JavaManifestAttributes attr = __man.getMainAttributes();
		for (SuiteType t : SuiteType.values())
			if (attr.definesValue(t.nameKey()))
				return t;
		
		// {@squirreljme.error AR0g Could not obtain the type of suite from
		// the input manifest.}
		throw new InvalidSuiteException("AR0g");
	}
}








|





171
172
173
174
175
176
177
178
179
180
181
182
183
			throw new NullPointerException("NARG");
		
		JavaManifestAttributes attr = __man.getMainAttributes();
		for (SuiteType t : SuiteType.values())
			if (attr.definesValue(t.nameKey()))
				return t;
		
		// {@squirreljme.error DG0g Could not obtain the type of suite from
		// the input manifest.}
		throw new InvalidSuiteException("AR0g");
	}
}

Name change from runt/apis/meep-swm/cc/squirreljme/runtime/swm/SuiteVendor.java to modules/meep-swm/src/main/java/cc/squirreljme/runtime/swm/SuiteVendor.java.

34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
	public SuiteVendor(String __v)
		throws InvalidSuiteException, NullPointerException
	{
		// Check
		if (__v == null)
			throw new NullPointerException("NARG");
		
		// {@squirreljme.error AR0h An illegal character was
		// specified in the midlet suite vendor. (The midlet suite
		// vendor)}
		if (StringUtils.firstIndex("\0\r\n:;", __v) >= 0)
			throw new InvalidSuiteException(String.format("AD0d %s", __v));
		
		this.string = __v;
	}







|







34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
	public SuiteVendor(String __v)
		throws InvalidSuiteException, NullPointerException
	{
		// Check
		if (__v == null)
			throw new NullPointerException("NARG");
		
		// {@squirreljme.error DG0h An illegal character was
		// specified in the midlet suite vendor. (The midlet suite
		// vendor)}
		if (StringUtils.firstIndex("\0\r\n:;", __v) >= 0)
			throw new InvalidSuiteException(String.format("AD0d %s", __v));
		
		this.string = __v;
	}

Name change from runt/apis/meep-swm/cc/squirreljme/runtime/swm/SuiteVersion.java to modules/meep-swm/src/main/java/cc/squirreljme/runtime/swm/SuiteVersion.java.

10
11
12
13
14
15
16
17
18
19
20
21
22
23
24

package cc.squirreljme.runtime.swm;

import java.lang.ref.Reference;
import java.lang.ref.WeakReference;

/**
 * This represents a midlet version.
 *
 * @since 2016/10/12
 */
public final class SuiteVersion
	implements Comparable<SuiteVersion>
{
	/** The minimum version number. */







|







10
11
12
13
14
15
16
17
18
19
20
21
22
23
24

package cc.squirreljme.runtime.swm;

import java.lang.ref.Reference;
import java.lang.ref.WeakReference;

/**
 * This represents a suite version.
 *
 * @since 2016/10/12
 */
public final class SuiteVersion
	implements Comparable<SuiteVersion>
{
	/** The minimum version number. */
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
	 * value.
	 * @throws NullPointerException On null arguments.
	 * @since 2016/10/12
	 */
	public SuiteVersion(String __v)
		throws InvalidSuiteException, NullPointerException
	{
		this(__decodeVersion(__v));
	}
	
	/**
	 * Initializes a Midlet version number from the specified array of
	 * integer values.
	 *
	 * @param __v The version triplet, up to the first three elements are







|







50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
	 * value.
	 * @throws NullPointerException On null arguments.
	 * @since 2016/10/12
	 */
	public SuiteVersion(String __v)
		throws InvalidSuiteException, NullPointerException
	{
		this(SuiteVersion.__decodeVersion(__v));
	}
	
	/**
	 * Initializes a Midlet version number from the specified array of
	 * integer values.
	 *
	 * @param __v The version triplet, up to the first three elements are
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
	 * @param __rel The release version.
	 * @throws InvalidSuiteException If any value is out of range.
	 * @since 2016/10/12
	 */
	public SuiteVersion(int __maj, int __min, int __rel)
		throws InvalidSuiteException
	{
		// {@squirreljme.error AR0i Input version number is out of range, only
		// 0 through 99 are valid. (The major version; The minor version; The
		// release version)}
		if (__maj < 0 || __maj > 99 || __min < 0 || __min > 99 ||
			__rel < 0 || __rel > 99)
			throw new InvalidSuiteException(String.format("AR0i %d %d %d",
				__maj, __min, __rel));
		







|







129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
	 * @param __rel The release version.
	 * @throws InvalidSuiteException If any value is out of range.
	 * @since 2016/10/12
	 */
	public SuiteVersion(int __maj, int __min, int __rel)
		throws InvalidSuiteException
	{
		// {@squirreljme.error DG0i Input version number is out of range, only
		// 0 through 99 are valid. (The major version; The minor version; The
		// release version)}
		if (__maj < 0 || __maj > 99 || __min < 0 || __min > 99 ||
			__rel < 0 || __rel > 99)
			throw new InvalidSuiteException(String.format("AR0i %d %d %d",
				__maj, __min, __rel));
		
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
		throws NullPointerException
	{
		// Check
		if (__v == null)
			throw new NullPointerException("NARG");
		
		// Can compare the hashcodes
		return hashCode() >= __v.hashCode();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/10/12
	 */
	@Override







|







158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
		throws NullPointerException
	{
		// Check
		if (__v == null)
			throw new NullPointerException("NARG");
		
		// Can compare the hashcodes
		return this.hashCode() >= __v.hashCode();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/10/12
	 */
	@Override
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
			int c = (i == n ? -1 : __v.charAt(i));
			
			// Decimal point? or end
			if (c == '.' || c == -1)
			{
				rv[at++] = Integer.parseInt(sb.toString(), 10);
				
				// {@squirreljme.error AR0j Too many version fields in the
				// specified string. (The input string)}
				if (c != -1 && at >= 4)
					throw new InvalidSuiteException(String.format("AR0j %s",
						__v));
				
				// Clear
				sb.setLength(0);
			}
			
			// Add to string
			else if (c >= '0' && c <= '9')
				sb.append((char)c);
			
			// {@squirreljme.error AR0k An illegal character is in the
			// version string. (The input string; The illegal character)}
			else
				throw new InvalidSuiteException(String.format("AR0k %s %04x",
					__v, c));
		}
		
		// Return it
		return rv;
	}
}








|













|











307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
			int c = (i == n ? -1 : __v.charAt(i));
			
			// Decimal point? or end
			if (c == '.' || c == -1)
			{
				rv[at++] = Integer.parseInt(sb.toString(), 10);
				
				// {@squirreljme.error DG0j Too many version fields in the
				// specified string. (The input string)}
				if (c != -1 && at >= 4)
					throw new InvalidSuiteException(String.format("AR0j %s",
						__v));
				
				// Clear
				sb.setLength(0);
			}
			
			// Add to string
			else if (c >= '0' && c <= '9')
				sb.append((char)c);
			
			// {@squirreljme.error DG0k An illegal character is in the
			// version string. (The input string; The illegal character)}
			else
				throw new InvalidSuiteException(String.format("AR0k %s %04x",
					__v, c));
		}
		
		// Return it
		return rv;
	}
}

Name change from runt/apis/meep-swm/cc/squirreljme/runtime/swm/SuiteVersionRange.java to modules/meep-swm/src/main/java/cc/squirreljme/runtime/swm/SuiteVersionRange.java.

82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
		// Check
		if (__s == null)
			throw new NullPointerException("NARG");
		
		// Trim
		__s = __s.trim();
		
		// {@squirreljme.error AR0l The version range cannot be blank.}
		int sl = __s.length();
		if (sl <= 0)
			throw new IllegalArgumentException("AR0l");
		
		// Get the last character
		char lc = __s.charAt(__s.length() - 1);
		







|







82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
		// Check
		if (__s == null)
			throw new NullPointerException("NARG");
		
		// Trim
		__s = __s.trim();
		
		// {@squirreljme.error DG0l The version range cannot be blank.}
		int sl = __s.length();
		if (sl <= 0)
			throw new IllegalArgumentException("AR0l");
		
		// Get the last character
		char lc = __s.charAt(__s.length() - 1);
		
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
				// Any version, does not matter
				if (sl == 1)
				{
					this.from = new SuiteVersion(0);
					this.to = new SuiteVersion(99, 99, 99);
				}
				
				// {@squirreljme.error AR0m Major only wildcard versions must
				// be a single asterisk. (The input string)}
				else
					throw new InvalidSuiteException(String.format("AR0m %s",
						__s));
			}
			
			// Parse otherwise, just count the number of dots to determine
			// how deep it goes
			else
			{
				// {@squirreljme.error AR0n The last dot in a wildcard must be
				// before the asterisk. (The input string)}
				if (ld != sl - 1)
					throw new InvalidSuiteException(String.format("AR0n %s",
						__s));
				
				// Source range is simple
				SuiteVersion ver = new SuiteVersion(







|










|







111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
				// Any version, does not matter
				if (sl == 1)
				{
					this.from = new SuiteVersion(0);
					this.to = new SuiteVersion(99, 99, 99);
				}
				
				// {@squirreljme.error DG0m Major only wildcard versions must
				// be a single asterisk. (The input string)}
				else
					throw new InvalidSuiteException(String.format("AR0m %s",
						__s));
			}
			
			// Parse otherwise, just count the number of dots to determine
			// how deep it goes
			else
			{
				// {@squirreljme.error DG0n The last dot in a wildcard must be
				// before the asterisk. (The input string)}
				if (ld != sl - 1)
					throw new InvalidSuiteException(String.format("AR0n %s",
						__s));
				
				// Source range is simple
				SuiteVersion ver = new SuiteVersion(
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
				if (numdots == 1)
					this.to = new SuiteVersion(ver.major(), 99, 99);
				
				// release ranged wildcard
				else if (numdots == 2)
					this.to = new SuiteVersion(ver.major(), ver.minor(), 99);
				
				// {@squirreljme.error AR0o There are too many decimal points
				// in the wildcard version string. (The input string)}
				else
					throw new InvalidSuiteException(String.format("AR0o %s",
						__s));
			}
		}
		







|







147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
				if (numdots == 1)
					this.to = new SuiteVersion(ver.major(), 99, 99);
				
				// release ranged wildcard
				else if (numdots == 2)
					this.to = new SuiteVersion(ver.major(), ver.minor(), 99);
				
				// {@squirreljme.error DG0o There are too many decimal points
				// in the wildcard version string. (The input string)}
				else
					throw new InvalidSuiteException(String.format("AR0o %s",
						__s));
			}
		}
		

Name change from runt/apis/meep-swm/cc/squirreljme/runtime/swm/TypedSuite.java to modules/meep-swm/src/main/java/cc/squirreljme/runtime/swm/TypedSuite.java.

Name change from runt/apis/meep-swm/cc/squirreljme/runtime/swm/package-info.java to modules/meep-swm/src/main/java/cc/squirreljme/runtime/swm/package-info.java.

Name change from runt/apis/meep-swm/javax/microedition/swm/InstallErrorCodes.java to modules/meep-swm/src/main/java/javax/microedition/swm/InstallErrorCodes.java.

12
13
14
15
16
17
18

19
20
21
22
23
24
25

/**
 * This enumeration contains the many ways which applications can be failed
 * to be installed.
 *
 * @since 2016/06/24
 */

public enum InstallErrorCodes
{
	/** The applicaton is already installed. */
	ALREADY_INSTALLED,

	/** The dependency of an application is in conflict. */
	APP_INTEGRITY_FAILURE_DEPENDENCY_CONFLICT,







>







12
13
14
15
16
17
18
19
20
21
22
23
24
25
26

/**
 * This enumeration contains the many ways which applications can be failed
 * to be installed.
 *
 * @since 2016/06/24
 */
@SuppressWarnings("FieldNamingConvention")
public enum InstallErrorCodes
{
	/** The applicaton is already installed. */
	ALREADY_INSTALLED,

	/** The dependency of an application is in conflict. */
	APP_INTEGRITY_FAILURE_DEPENDENCY_CONFLICT,

Name change from runt/apis/meep-swm/javax/microedition/swm/ManagerFactory.java to modules/meep-swm/src/main/java/javax/microedition/swm/ManagerFactory.java.

Name change from runt/apis/meep-swm/javax/microedition/swm/SWMPermission.java to modules/meep-swm/src/main/java/javax/microedition/swm/SWMPermission.java.

Name change from runt/apis/meep-swm/javax/microedition/swm/Suite.java to modules/meep-swm/src/main/java/javax/microedition/swm/Suite.java.

8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package javax.microedition.swm;

import cc.squirreljme.runtime.cldc.io.ResourceInputStream;
import cc.squirreljme.runtime.swm.DependencyInfo;
import cc.squirreljme.runtime.swm.EntryPoint;
import cc.squirreljme.runtime.swm.EntryPoints;
import cc.squirreljme.runtime.swm.MatchResult;
import cc.squirreljme.runtime.swm.ProvidedInfo;
import cc.squirreljme.runtime.swm.SuiteInfo;
import java.io.InputStream;
import java.io.IOException;
import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import net.multiphasicapps.collections.EmptyIterator;
import net.multiphasicapps.strings.StringUtils;
import net.multiphasicapps.tool.manifest.JavaManifest;
import net.multiphasicapps.tool.manifest.JavaManifestAttributes;
import net.multiphasicapps.tool.manifest.JavaManifestKey;

/**
 * This represents an application suite.
 *
 * Created suites by default have their {@link SuiteStateFlag#AVAILABLE} and
 * {@link SuiteStateFlag#ENABLED} flags set.
 *







<
<

<

|
|


<
<
<

<


<

<

<


<







8
9
10
11
12
13
14


15

16
17
18
19
20



21

22
23

24

25

26
27

28
29
30
31
32
33
34
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package javax.microedition.swm;

import cc.squirreljme.runtime.cldc.io.ResourceInputStream;
import cc.squirreljme.runtime.swm.DependencyInfo;


import cc.squirreljme.runtime.swm.MatchResult;

import cc.squirreljme.runtime.swm.SuiteInfo;
import java.io.IOException;
import java.io.InputStream;
import java.lang.ref.Reference;
import java.lang.ref.WeakReference;



import java.util.Iterator;

import java.util.LinkedList;
import java.util.List;

import java.util.Objects;

import net.multiphasicapps.collections.EmptyIterator;

import net.multiphasicapps.tool.manifest.JavaManifest;
import net.multiphasicapps.tool.manifest.JavaManifestAttributes;


/**
 * This represents an application suite.
 *
 * Created suites by default have their {@link SuiteStateFlag#AVAILABLE} and
 * {@link SuiteStateFlag#ENABLED} flags set.
 *
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
	{
		// Not another suite?
		if (!(__o instanceof Suite))
			return false;
		
		// Check
		Suite o = (Suite)__o;
		return Objects.equals(getName(), o.getName()) &&
			Objects.equals(getVendor(), o.getVendor());
	}
	
	/**
	 * Returns the list of attributes which are defined in the JAD or the
	 * manifest.
	 *
	 * @return The iterator of attributes. The system suite always returns







|
|







102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
	{
		// Not another suite?
		if (!(__o instanceof Suite))
			return false;
		
		// Check
		Suite o = (Suite)__o;
		return Objects.equals(this.getName(), o.getName()) &&
			Objects.equals(this.getVendor(), o.getVendor());
	}
	
	/**
	 * Returns the list of attributes which are defined in the JAD or the
	 * manifest.
	 *
	 * @return The iterator of attributes. The system suite always returns
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
	 * dependencies for this suite.
	 *
	 * This is taken from the SquirrelJME build system.
	 *
	 * @param __d The input dependencies to check.
	 * @return The result of the match.
	 * @throws NullPointerException On null arguments.
	 * @sine 2018/11/02
	 */
	final MatchResult __matchedDependencies(DependencyInfo __d)
		throws NullPointerException
	{
		if (__d == null)
			throw new NullPointerException("NARG");
		







|







553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
	 * dependencies for this suite.
	 *
	 * This is taken from the SquirrelJME build system.
	 *
	 * @param __d The input dependencies to check.
	 * @return The result of the match.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/11/02
	 */
	final MatchResult __matchedDependencies(DependencyInfo __d)
		throws NullPointerException
	{
		if (__d == null)
			throw new NullPointerException("NARG");
		

Name change from runt/apis/meep-swm/javax/microedition/swm/SuiteInstallListener.java to modules/meep-swm/src/main/java/javax/microedition/swm/SuiteInstallListener.java.

27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
	 * {@link SuiteInstallStage#DONE}.
	 *
	 * @param __ec The result of the installation attempt.
	 * @param __track The tracker which was created when an installation
	 * was started to be performed.
	 * @since 2016/06/24
	 */
	public abstract void installationDone(InstallErrorCodes __ec,
		SuiteManagementTracker __track);
	
	/**
	 * This is called when the current status of the installation of a suite
	 * has been updated. This may be used by a listener to provide a progress
	 * bar for example.
	 *
	 * @param __track The tracker which was created when an installation
	 * was started to be performed.
	 * @param __stage The current stage of the installation.
	 * @param __pct The amount of progress which has passed in this stage, this
	 * should be a value between zero and one hundred.
	 * @since 2016/06/24
	 */
	public abstract void updateStatus(SuiteManagementTracker __track,
		SuiteInstallStage __stage, int __pct);
}








|














|



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
	 * {@link SuiteInstallStage#DONE}.
	 *
	 * @param __ec The result of the installation attempt.
	 * @param __track The tracker which was created when an installation
	 * was started to be performed.
	 * @since 2016/06/24
	 */
	void installationDone(InstallErrorCodes __ec,
		SuiteManagementTracker __track);
	
	/**
	 * This is called when the current status of the installation of a suite
	 * has been updated. This may be used by a listener to provide a progress
	 * bar for example.
	 *
	 * @param __track The tracker which was created when an installation
	 * was started to be performed.
	 * @param __stage The current stage of the installation.
	 * @param __pct The amount of progress which has passed in this stage, this
	 * should be a value between zero and one hundred.
	 * @since 2016/06/24
	 */
	void updateStatus(SuiteManagementTracker __track,
		SuiteInstallStage __stage, int __pct);
}

Name change from runt/apis/meep-swm/javax/microedition/swm/SuiteInstallStage.java to modules/meep-swm/src/main/java/javax/microedition/swm/SuiteInstallStage.java.

Name change from runt/apis/meep-swm/javax/microedition/swm/SuiteInstaller.java to modules/meep-swm/src/main/java/javax/microedition/swm/SuiteInstaller.java.

90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
	 * Starts installation of the given suite.
	 *
	 * If this is called twice then the next installation attempt is
	 * enqueued regardless if the previous installation has succeeded or
	 * failed.
	 *
	 * If there is not enough permission to install the given suite then
	 * {@link InstallErrorCodes.UNAUTHORIZED_INSTALL} is set.
	 *
	 * @return The tracker for the given suite.
	 * @since 2016/06/24
	 */
	public final SuiteManagementTracker start()
	{
		return new __SuiteTracker__(this);







|







90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
	 * Starts installation of the given suite.
	 *
	 * If this is called twice then the next installation attempt is
	 * enqueued regardless if the previous installation has succeeded or
	 * failed.
	 *
	 * If there is not enough permission to install the given suite then
	 * {@link InstallErrorCodes#UNAUTHORIZED_INSTALL} is set.
	 *
	 * @return The tracker for the given suite.
	 * @since 2016/06/24
	 */
	public final SuiteManagementTracker start()
	{
		return new __SuiteTracker__(this);

Name change from runt/apis/meep-swm/javax/microedition/swm/SuiteListener.java to modules/meep-swm/src/main/java/javax/microedition/swm/SuiteListener.java.

28
29
30
31
32
33
34
35
36
37
38
	 * application was set for installation or an unspecified tracker in the
	 * event of a removal. In the event of removal it is likely that the
	 * tracker would not be the same one returned by an installation due to
	 * restarts of the virtual machine.
	 * @param __state The new state of the suite.
	 * @since 2016/06/24
	 */
	public abstract void notifySuiteStateChanged(
		SuiteManagementTracker __track, SuiteState __state);
}








|
|


28
29
30
31
32
33
34
35
36
37
38
	 * application was set for installation or an unspecified tracker in the
	 * event of a removal. In the event of removal it is likely that the
	 * tracker would not be the same one returned by an installation due to
	 * restarts of the virtual machine.
	 * @param __state The new state of the suite.
	 * @since 2016/06/24
	 */
	void notifySuiteStateChanged(SuiteManagementTracker __track,
		SuiteState __state);
}

Name change from runt/apis/meep-swm/javax/microedition/swm/SuiteLockedException.java to modules/meep-swm/src/main/java/javax/microedition/swm/SuiteLockedException.java.

Name change from runt/apis/meep-swm/javax/microedition/swm/SuiteManagementTracker.java to modules/meep-swm/src/main/java/javax/microedition/swm/SuiteManagementTracker.java.

Name change from runt/apis/meep-swm/javax/microedition/swm/SuiteManager.java to modules/meep-swm/src/main/java/javax/microedition/swm/SuiteManager.java.

24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
	/**
	 * Adds a listener which is used when the state of a suite has been changed
	 * such as when it has been installed or removed.
	 *
	 * @param __sl The listener to be added.
	 * @since 2016/06/24
	 */
	public abstract void addSuiteListener(SuiteListener __sl);
	
	/**
	 * Attempts to return an installed suite created by a specific vendor and
	 * which uses the given name.
	 *
	 * @param __vendor The vendor which created the given suite.
	 * @param __name The name of the suite.
	 * @return An instance of the given suite or {@code null} if it was not
	 * found.
	 * @since 2016/06/24
	 */
	public abstract Suite getSuite(String __vendor, String __name);
	
	/**
	 * Obtains an installer that would be used to install the given JAR file
	 * which is represented as raw byte data.
	 *
	 * The {@code {@link SWMPermission}("client", "installation")} or
	 * {@code {@link SWMPermission}("crossClient", "installation")} is checked







|











|







24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
	/**
	 * Adds a listener which is used when the state of a suite has been changed
	 * such as when it has been installed or removed.
	 *
	 * @param __sl The listener to be added.
	 * @since 2016/06/24
	 */
	void addSuiteListener(SuiteListener __sl);
	
	/**
	 * Attempts to return an installed suite created by a specific vendor and
	 * which uses the given name.
	 *
	 * @param __vendor The vendor which created the given suite.
	 * @param __name The name of the suite.
	 * @return An instance of the given suite or {@code null} if it was not
	 * found.
	 * @since 2016/06/24
	 */
	Suite getSuite(String __vendor, String __name);
	
	/**
	 * Obtains an installer that would be used to install the given JAR file
	 * which is represented as raw byte data.
	 *
	 * The {@code {@link SWMPermission}("client", "installation")} or
	 * {@code {@link SWMPermission}("crossClient", "installation")} is checked
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82

83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
	 * @return An installer which represents this given installation.
	 * @throws IllegalArgumentException If the input buffer is null, empty, or
	 * the offset and length are negative or exceed the array bounds.
	 * @throws SecurityException If the current application is not permitted
	 * to install new suites.
	 * @since 2016/06/24
	 */
	public abstract SuiteInstaller getSuiteInstaller(byte[] __b, int __o,
		int __l, boolean __ignuplock)
		throws IllegalArgumentException, SecurityException;
	
	/**
	 * This attempts to install a suite which is specified at the given URL. It
	 * is implementation dependent on how the URL is handled, it may be a
	 * platform specific resource or a network resource.
	 *
	 * The {@code {@link SWMPermission}("client", "installation")} or
	 * {@code {@link SWMPermission}("crossClient", "installation")} is checked
	 * before an installation is attempted.
	 *
	 * @param __url The URL which refers to a suite to be installed.
	 * @param __ignuplock If {@code true} then the components of the suite
	 * will be updated without regards to synchronization, this is not
	 * recommended and {@code false} should always be used.

	 * @throws IllegalArgumentException If the URL is not valid or it could
	 * not be obtained.
	 * @throws SecurityException If the current application is not permitted
	 * to install new suites.
	 * @since 2016/06/24
	 */
	public abstract SuiteInstaller getSuiteInstaller(String __url,
		boolean __ignuplock)
		throws IllegalArgumentException, SecurityException;
	
	/**
	 * Returns a list of the suites tha are currently installed on the system.
	 *
	 * @param __t The type of suites to obtain, only
	 * {@link SuiteType#APPLICATION} and {@link SuiteType#LIBRARY} are valid.
	 * @return A list containing the suites which are currently installed,
	 * if there are no suites then this may be empty.
	 * @throws IllegalArgumentException If the requested type is neither
	 * an application or a library.
	 * @throws NullPointerException On null arguments.
	 * @since 2016/06/24
	 */
	public abstract List<Suite> getSuites(SuiteType __t)
		throws IllegalArgumentException, NullPointerException;
	
	/**
	 * Synchronously removes the given installed suite.
	 *
	 * Suites must be stopped before they can be used, a removal of a suite
	 * that is currently active cannot be performed.







|
|















>






|
<














|







59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90

91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
	 * @return An installer which represents this given installation.
	 * @throws IllegalArgumentException If the input buffer is null, empty, or
	 * the offset and length are negative or exceed the array bounds.
	 * @throws SecurityException If the current application is not permitted
	 * to install new suites.
	 * @since 2016/06/24
	 */
	SuiteInstaller getSuiteInstaller(byte[] __b, int __o, int __l,
		boolean __ignuplock)
		throws IllegalArgumentException, SecurityException;
	
	/**
	 * This attempts to install a suite which is specified at the given URL. It
	 * is implementation dependent on how the URL is handled, it may be a
	 * platform specific resource or a network resource.
	 *
	 * The {@code {@link SWMPermission}("client", "installation")} or
	 * {@code {@link SWMPermission}("crossClient", "installation")} is checked
	 * before an installation is attempted.
	 *
	 * @param __url The URL which refers to a suite to be installed.
	 * @param __ignuplock If {@code true} then the components of the suite
	 * will be updated without regards to synchronization, this is not
	 * recommended and {@code false} should always be used.
	 * @return The suite installer.
	 * @throws IllegalArgumentException If the URL is not valid or it could
	 * not be obtained.
	 * @throws SecurityException If the current application is not permitted
	 * to install new suites.
	 * @since 2016/06/24
	 */
	SuiteInstaller getSuiteInstaller(String __url, boolean __ignuplock)

		throws IllegalArgumentException, SecurityException;
	
	/**
	 * Returns a list of the suites tha are currently installed on the system.
	 *
	 * @param __t The type of suites to obtain, only
	 * {@link SuiteType#APPLICATION} and {@link SuiteType#LIBRARY} are valid.
	 * @return A list containing the suites which are currently installed,
	 * if there are no suites then this may be empty.
	 * @throws IllegalArgumentException If the requested type is neither
	 * an application or a library.
	 * @throws NullPointerException On null arguments.
	 * @since 2016/06/24
	 */
	List<Suite> getSuites(SuiteType __t)
		throws IllegalArgumentException, NullPointerException;
	
	/**
	 * Synchronously removes the given installed suite.
	 *
	 * Suites must be stopped before they can be used, a removal of a suite
	 * that is currently active cannot be performed.
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
	 * or if the application is currently running and the application.
	 * @throws SuiteLockedException If the suite is locked and
	 * {@code __ignuplock} has been set to {@code false}. It should also be
	 * noted that it is possible for this to be thrown regardless of the
	 * parameter.
	 * @since 2016/06/24
	 */
	public abstract void removeSuite(Suite __s, boolean __ignuplock)
		throws IllegalArgumentException, SuiteLockedException;
	
	/**
	 * Removes a previously added suite listener so that it no longer is
	 * given any status updated when the state of a suite has changed.
	 *
	 * @param __sl The listener to remove.
	 * @since 2016/06/24
	 */
	public abstract void removeSuiteListener(SuiteListener __sl);
}








|









|


125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
	 * or if the application is currently running and the application.
	 * @throws SuiteLockedException If the suite is locked and
	 * {@code __ignuplock} has been set to {@code false}. It should also be
	 * noted that it is possible for this to be thrown regardless of the
	 * parameter.
	 * @since 2016/06/24
	 */
	void removeSuite(Suite __s, boolean __ignuplock)
		throws IllegalArgumentException, SuiteLockedException;
	
	/**
	 * Removes a previously added suite listener so that it no longer is
	 * given any status updated when the state of a suite has changed.
	 *
	 * @param __sl The listener to remove.
	 * @since 2016/06/24
	 */
	void removeSuiteListener(SuiteListener __sl);
}

Name change from runt/apis/meep-swm/javax/microedition/swm/SuiteState.java to modules/meep-swm/src/main/java/javax/microedition/swm/SuiteState.java.

Name change from runt/apis/meep-swm/javax/microedition/swm/SuiteStateFlag.java to modules/meep-swm/src/main/java/javax/microedition/swm/SuiteStateFlag.java.

Name change from runt/apis/meep-swm/javax/microedition/swm/SuiteType.java to modules/meep-swm/src/main/java/javax/microedition/swm/SuiteType.java.

Name change from runt/apis/meep-swm/javax/microedition/swm/Task.java to modules/meep-swm/src/main/java/javax/microedition/swm/Task.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package javax.microedition.swm;

import cc.squirreljme.runtime.cldc.asm.TaskAccess;
import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import java.util.Objects;

/**
 * This describes a task which is currently running on the system. Each task
 * has a starting point which is a {@link javax.microedition.midlet.MIDlet}.
 *
 * System tasks cannot be started or stopped.













<
<







1
2
3
4
5
6
7
8
9
10
11
12
13


14
15
16
17
18
19
20
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package javax.microedition.swm;

import cc.squirreljme.runtime.cldc.asm.TaskAccess;


import java.util.Objects;

/**
 * This describes a task which is currently running on the system. Each task
 * has a starting point which is a {@link javax.microedition.midlet.MIDlet}.
 *
 * System tasks cannot be started or stopped.
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
	
	/**
	 * Checks if this task is the same as another task, tasks are equal if
	 * they share the same name.
	 *
	 * @param __o The other object.
	 * @return {@code true} if this is the same task.
	 * @sicne 2016/06/24
	 */
	@Override
	public boolean equals(Object __o)
	{
		if (this == __o)
			return true;
		







|







54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
	
	/**
	 * Checks if this task is the same as another task, tasks are equal if
	 * they share the same name.
	 *
	 * @param __o The other object.
	 * @return {@code true} if this is the same task.
	 * @since 2016/06/24
	 */
	@Override
	public boolean equals(Object __o)
	{
		if (this == __o)
			return true;
		

Name change from runt/apis/meep-swm/javax/microedition/swm/TaskListener.java to modules/meep-swm/src/main/java/javax/microedition/swm/TaskListener.java.

20
21
22
23
24
25
26
27
28
29
	/**
	 * This is called when a task has changed status.
	 *
	 * @param __t The task which has had its status changed.
	 * @param __status The new status of the task.
	 * @since 2016/06/24
	 */
	public abstract void notifyStatusUpdate(Task __t, TaskStatus __status);
}








|


20
21
22
23
24
25
26
27
28
29
	/**
	 * This is called when a task has changed status.
	 *
	 * @param __t The task which has had its status changed.
	 * @param __status The new status of the task.
	 * @since 2016/06/24
	 */
	void notifyStatusUpdate(Task __t, TaskStatus __status);
}

Name change from runt/apis/meep-swm/javax/microedition/swm/TaskManager.java to modules/meep-swm/src/main/java/javax/microedition/swm/TaskManager.java.

24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
	/**
	 * Adds the given task listener so that if the state of any task changes
	 * then the provided methods are called.
	 *
	 * @param __tl The listener for events.
	 * @since 2016/06/24
	 */
	public abstract void addTaskListener(TaskListener __tl);
	
	/**
	 * Returns the task which belongs to the caller of this method.
	 *
	 * @return The task of the current caller.
	 * @since 2016/06/24
	 */
	public abstract Task getCurrentTask();
	
	/**
	 * This returns the list of all running tasks on the system.
	 *
	 * @param __incsys If {@code true} then any tasks which are owned by the
	 * system are also returned.
	 * @return The list of tasks which currently exist within the virtual
	 * machine.
	 * @since 2016/06/24
	 */
	public abstract List<Task> getTaskList(boolean __incsys);
	
	/**
	 * Removes the given task listener so that it is no longer notified when
	 * the state of a task has changed.
	 *
	 * @param __tl The task listener to remove.
	 * @since 2016/06/24
	 */
	public abstract void removeTaskListener(TaskListener __tl);
	
	/**
	 * Sets the given task so that it appears at the foreground task which
	 * is running, this operation may fail.
	 *
	 * A task that is in the foreground is one which is visible and has
	 * input focus. It is possible that a call of this method will have no
	 * effect.
	 *
	 * @param __t The task to bring to the foreground.
	 * @return If {@code true} then the task was brought to the foreground.
	 * @throws IllegalArgumentException If the task is a system task.
	 * @since 2016/06/24
	 */
	public abstract boolean setForeground(Task __t)
		throws IllegalArgumentException;
	
	/**
	 * Attempts to set the priority of a given task. A call of this method
	 * may affect the amount of time slices which are available to a process
	 * or its resume priority in the event of cooperative multi-tasking.
	 *
	 * @param __t The task to change the priority of.
	 * @param __p The new priority of the given task.
	 * @return {@code true} if the priority of the given task has been
	 * changed.
	 * @throws IllegalArgumentException if the task is a system task.
	 * @since 2016/06/24
	 */
	public abstract boolean setPriority(Task __t, TaskPriority __p)
		throws IllegalArgumentException;
	
	/**
	 * Attempts to create a task which runs the given suite.
	 *
	 * The task is created and is initially in the {@link TaskStatus#STARTING}
	 * state. If starting fails then it enters the







|







|










|








|














|














|







24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
	/**
	 * Adds the given task listener so that if the state of any task changes
	 * then the provided methods are called.
	 *
	 * @param __tl The listener for events.
	 * @since 2016/06/24
	 */
	void addTaskListener(TaskListener __tl);
	
	/**
	 * Returns the task which belongs to the caller of this method.
	 *
	 * @return The task of the current caller.
	 * @since 2016/06/24
	 */
	Task getCurrentTask();
	
	/**
	 * This returns the list of all running tasks on the system.
	 *
	 * @param __incsys If {@code true} then any tasks which are owned by the
	 * system are also returned.
	 * @return The list of tasks which currently exist within the virtual
	 * machine.
	 * @since 2016/06/24
	 */
	List<Task> getTaskList(boolean __incsys);
	
	/**
	 * Removes the given task listener so that it is no longer notified when
	 * the state of a task has changed.
	 *
	 * @param __tl The task listener to remove.
	 * @since 2016/06/24
	 */
	void removeTaskListener(TaskListener __tl);
	
	/**
	 * Sets the given task so that it appears at the foreground task which
	 * is running, this operation may fail.
	 *
	 * A task that is in the foreground is one which is visible and has
	 * input focus. It is possible that a call of this method will have no
	 * effect.
	 *
	 * @param __t The task to bring to the foreground.
	 * @return If {@code true} then the task was brought to the foreground.
	 * @throws IllegalArgumentException If the task is a system task.
	 * @since 2016/06/24
	 */
	boolean setForeground(Task __t)
		throws IllegalArgumentException;
	
	/**
	 * Attempts to set the priority of a given task. A call of this method
	 * may affect the amount of time slices which are available to a process
	 * or its resume priority in the event of cooperative multi-tasking.
	 *
	 * @param __t The task to change the priority of.
	 * @param __p The new priority of the given task.
	 * @return {@code true} if the priority of the given task has been
	 * changed.
	 * @throws IllegalArgumentException if the task is a system task.
	 * @since 2016/06/24
	 */
	boolean setPriority(Task __t, TaskPriority __p)
		throws IllegalArgumentException;
	
	/**
	 * Attempts to create a task which runs the given suite.
	 *
	 * The task is created and is initially in the {@link TaskStatus#STARTING}
	 * state. If starting fails then it enters the
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
	 * @throws IllegalArgumentException If the suite is a library, the given
	 * class does not exist, or the given class does not extend
	 * {@link javax.microedition.midlet.MIDlet}.
	 * @throws IllegalStateException If the suite has been removed.
	 * @throws NullPointerException On null arguments.
	 * @since 2016/06/24
	 */
	public abstract Task startTask(Suite __s, String __cn)
		throws IllegalArgumentException, IllegalStateException,
			NullPointerException;
	
	/**
	 * Attempts to stop the given task and destroy it so that it does not
	 * consume memory or execution cycles.
	 *
	 * @param __t The task to be stopped.
	 * @return {@code true} if the task has been stopped and destroyed.
	 * @throws IllegalArgumentException If the task has already stopped, has
	 * not yet been started, or has finished execution.
	 * @throws IllegalStateException If the task is a system task.
	 * @since 2016/06/24
	 */
	public abstract boolean stopTask(Task __t)
		throws IllegalArgumentException, IllegalStateException;
}








|














|



108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
	 * @throws IllegalArgumentException If the suite is a library, the given
	 * class does not exist, or the given class does not extend
	 * {@link javax.microedition.midlet.MIDlet}.
	 * @throws IllegalStateException If the suite has been removed.
	 * @throws NullPointerException On null arguments.
	 * @since 2016/06/24
	 */
	Task startTask(Suite __s, String __cn)
		throws IllegalArgumentException, IllegalStateException,
			NullPointerException;
	
	/**
	 * Attempts to stop the given task and destroy it so that it does not
	 * consume memory or execution cycles.
	 *
	 * @param __t The task to be stopped.
	 * @return {@code true} if the task has been stopped and destroyed.
	 * @throws IllegalArgumentException If the task has already stopped, has
	 * not yet been started, or has finished execution.
	 * @throws IllegalStateException If the task is a system task.
	 * @since 2016/06/24
	 */
	boolean stopTask(Task __t)
		throws IllegalArgumentException, IllegalStateException;
}

Name change from runt/apis/meep-swm/javax/microedition/swm/TaskPriority.java to modules/meep-swm/src/main/java/javax/microedition/swm/TaskPriority.java.

Name change from runt/apis/meep-swm/javax/microedition/swm/TaskStatus.java to modules/meep-swm/src/main/java/javax/microedition/swm/TaskStatus.java.

45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
	 * @return The task status.
	 * @since 2018/11/04
	 */
	static final TaskStatus __of(int __i)
	{
		switch (__i)
		{
			case 0: return EXITED_FATAL;
			case 1: return EXITED_REGULAR;
			case 2: return EXITED_TERMINATED;
			case 3: return RUNNING;
			case 4: return START_FAILED;
			case 5: return STARTING;
			
			default:
				return EXITED_FATAL;
		}
	}
}








|
|
|
|
|
|


|




45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
	 * @return The task status.
	 * @since 2018/11/04
	 */
	static final TaskStatus __of(int __i)
	{
		switch (__i)
		{
			case 0: return TaskStatus.EXITED_FATAL;
			case 1: return TaskStatus.EXITED_REGULAR;
			case 2: return TaskStatus.EXITED_TERMINATED;
			case 3: return TaskStatus.RUNNING;
			case 4: return TaskStatus.START_FAILED;
			case 5: return TaskStatus.STARTING;
			
			default:
				return TaskStatus.EXITED_FATAL;
		}
	}
}

Name change from runt/apis/meep-swm/javax/microedition/swm/__CCWrapper__.java to modules/meep-swm/src/main/java/javax/microedition/swm/__CCWrapper__.java.

Name change from runt/apis/meep-swm/javax/microedition/swm/__SuiteTracker__.java to modules/meep-swm/src/main/java/javax/microedition/swm/__SuiteTracker__.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package javax.microedition.swm;

import cc.squirreljme.runtime.swm.JarStreamSupplier;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.io.IOException;
import java.util.Set;

/**
 * This performs the installation and tracks progress.
 *
 * @since 2017/12/28
 */













<
<
<







1
2
3
4
5
6
7
8
9
10
11
12
13



14
15
16
17
18
19
20
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package javax.microedition.swm;

import cc.squirreljme.runtime.swm.JarStreamSupplier;



import java.util.Set;

/**
 * This performs the installation and tracks progress.
 *
 * @since 2017/12/28
 */
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
			// Oops
			catch (Throwable t)
			{
				// Just print the trace
				t.printStackTrace();
				
				// And use some other error code to indicate failure 
				__done(InstallErrorCodes.OTHER_ERROR);
			}
		}
		
		/**
		 * Called when installation has finished, potentially with an error.
		 *
		 * @param __code The error code.







|







195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
			// Oops
			catch (Throwable t)
			{
				// Just print the trace
				t.printStackTrace();
				
				// And use some other error code to indicate failure 
				this.__done(InstallErrorCodes.OTHER_ERROR);
			}
		}
		
		/**
		 * Called when installation has finished, potentially with an error.
		 *
		 * @param __code The error code.

Name change from runt/apis/meep-swm/javax/microedition/swm/__SystemSuiteManager__.java to modules/meep-swm/src/main/java/javax/microedition/swm/__SystemSuiteManager__.java.

1
2
3
4
5
6
7
8
9
10
11
12

13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package javax.microedition.swm;


import cc.squirreljme.runtime.swm.ByteArrayJarStreamSupplier;
import cc.squirreljme.runtime.swm.DependencyInfo;
import cc.squirreljme.runtime.swm.InvalidSuiteException;
import cc.squirreljme.runtime.swm.MatchResult;
import cc.squirreljme.runtime.swm.ProvidedInfo;
import cc.squirreljme.runtime.cldc.asm.SuiteAccess;
import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.WeakHashMap;

/**
 * This class manages the bridge for the suite manager to the native program
 * manager.
 *
 * @since 2017/12/08
 */












>




<
<
<
<

<





<







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17




18

19
20
21
22
23

24
25
26
27
28
29
30
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package javax.microedition.swm;

import cc.squirreljme.runtime.cldc.asm.SuiteAccess;
import cc.squirreljme.runtime.swm.ByteArrayJarStreamSupplier;
import cc.squirreljme.runtime.swm.DependencyInfo;
import cc.squirreljme.runtime.swm.InvalidSuiteException;
import cc.squirreljme.runtime.swm.MatchResult;




import java.util.ArrayList;

import java.util.HashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;


/**
 * This class manages the bridge for the suite manager to the native program
 * manager.
 *
 * @since 2017/12/08
 */

Name change from runt/apis/meep-swm/javax/microedition/swm/__SystemTaskManager__.java to modules/meep-swm/src/main/java/javax/microedition/swm/__SystemTaskManager__.java.

8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package javax.microedition.swm;

import cc.squirreljme.runtime.cldc.asm.TaskAccess;
import cc.squirreljme.runtime.cldc.lang.ApiLevel;
import cc.squirreljme.runtime.swm.DependencyInfo;
import cc.squirreljme.runtime.swm.ExtendedTaskManager;
import cc.squirreljme.runtime.swm.MatchResult;
import cc.squirreljme.runtime.swm.ProvidedInfo;
import java.io.OutputStream;
import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * This is the task manager which interfaces with the CLDC system support
 * methods to provide access to tasks and such.
 *
 * @since 2017/12/07
 */







<

<
<

<
<
<

<
<


<


<







8
9
10
11
12
13
14

15


16



17


18
19

20
21

22
23
24
25
26
27
28
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package javax.microedition.swm;

import cc.squirreljme.runtime.cldc.asm.TaskAccess;
import cc.squirreljme.runtime.cldc.lang.ApiLevel;

import cc.squirreljme.runtime.swm.ExtendedTaskManager;


import java.io.OutputStream;



import java.util.Arrays;


import java.util.HashMap;
import java.util.Iterator;

import java.util.List;
import java.util.Map;


/**
 * This is the task manager which interfaces with the CLDC system support
 * methods to provide access to tasks and such.
 *
 * @since 2017/12/07
 */
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
	static final Task __getTask(int __tid, Suite __s, String __n)
		throws NullPointerException
	{
		if (__s == null || __n == null)
			throw new NullPointerException("NARG");
		
		// Lock on the tasks
		Map<Integer, Task> tasks = _TASKS;
		synchronized (tasks)
		{
			// There should not be duplicates
			Integer k = __tid;
			Task rv = tasks.get(k);
			if (rv != null)
				throw new todo.OOPS();







|







258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
	static final Task __getTask(int __tid, Suite __s, String __n)
		throws NullPointerException
	{
		if (__s == null || __n == null)
			throw new NullPointerException("NARG");
		
		// Lock on the tasks
		Map<Integer, Task> tasks = __SystemTaskManager__._TASKS;
		synchronized (tasks)
		{
			// There should not be duplicates
			Integer k = __tid;
			Task rv = tasks.get(k);
			if (rv != null)
				throw new todo.OOPS();

Name change from runt/apis/meep-swm/javax/microedition/swm/package-info.java to modules/meep-swm/src/main/java/javax/microedition/swm/package-info.java.

Added modules/midp-lcdui/build.gradle.























































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import cc.squirreljme.plugin.swm.JavaMEMidletType
import cc.squirreljme.plugin.swm.JavaMEStandard

description = "This contains the standard MIDP LCD User " +
 "Interface which uses graphical text, widgets, and images to interact " +
 "with the user. Unlike the MEEP Line User Interface, this requires a " +
 "much more capable graphical system."
version = rootProject.version

squirreljme
{
	javaDocErrorCode = "EB"
	swmType = JavaMEMidletType.API
	swmName = "LCD UI"
	swmVendor = "Stephanie Gawroriski"
	definedStandards += new JavaMEStandard("microedition.lcdui;;")
}

dependencies
{
	implementation project(":modules:cldc-compact")

	implementation project(":modules:meep-midlet")
	implementation project(":modules:gcf")
	implementation project(":modules:io")
	implementation project(":modules:collections")
}

Name change from runt/apis/midp-lcdui/cc/squirreljme/runtime/lcdui/DisplayHardwareState.java to modules/midp-lcdui/src/main/java/cc/squirreljme/runtime/lcdui/DisplayHardwareState.java.

33
34
35
36
37
38
39
40
41
42
43
	 * Is this forced to be disabled?
	 *
	 * @return If this is forced to be disabled.
	 * @since 2017/10/01
	 */
	public final boolean forceDisabled()
	{
		return this == DISABLED || this == ABSENT;
	}
}








|



33
34
35
36
37
38
39
40
41
42
43
	 * Is this forced to be disabled?
	 *
	 * @return If this is forced to be disabled.
	 * @since 2017/10/01
	 */
	public final boolean forceDisabled()
	{
		return this == DisplayHardwareState.DISABLED || this == DisplayHardwareState.ABSENT;
	}
}

Name change from runt/apis/midp-lcdui/cc/squirreljme/runtime/lcdui/DisplayOrientation.java to modules/midp-lcdui/src/main/java/cc/squirreljme/runtime/lcdui/DisplayOrientation.java.

Name change from runt/apis/midp-lcdui/cc/squirreljme/runtime/lcdui/DisplayState.java to modules/midp-lcdui/src/main/java/cc/squirreljme/runtime/lcdui/DisplayState.java.

Name change from runt/apis/midp-lcdui/cc/squirreljme/runtime/lcdui/ExtendedCapabilities.java to modules/midp-lcdui/src/main/java/cc/squirreljme/runtime/lcdui/ExtendedCapabilities.java.

13
14
15
16
17
18
19
20
21
22
23
 * Represents extended capabilities of the display.
 *
 * @since 2019/05/05
 */
public interface ExtendedCapabilities
{
	/** Does this support pointer events? */
	public static final int SUPPORTS_POINTER_EVENTS =
		0x4000_0000;
}








|



13
14
15
16
17
18
19
20
21
22
23
 * Represents extended capabilities of the display.
 *
 * @since 2019/05/05
 */
public interface ExtendedCapabilities
{
	/** Does this support pointer events? */
	int SUPPORTS_POINTER_EVENTS =
		0x4000_0000;
}

Name change from runt/apis/midp-lcdui/cc/squirreljme/runtime/lcdui/SerializedEvent.java to modules/midp-lcdui/src/main/java/cc/squirreljme/runtime/lcdui/SerializedEvent.java.

Name change from runt/apis/midp-lcdui/cc/squirreljme/runtime/lcdui/common/CharSequenceDecoder.java to modules/midp-lcdui/src/main/java/cc/squirreljme/runtime/lcdui/common/CharSequenceDecoder.java.

66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
	 * @return The next codepoint or {@code -1} if there are no more code
	 * points remaining.
	 * @since 2017/10/21
	 */
	public DecodedCharacter next()
	{
		// Peek first always
		peek();
		
		// Has been read already?
		DecodedCharacter rv = this._next;
		if (rv != null)
		{
			this._next = null;
			return rv;







|







66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
	 * @return The next codepoint or {@code -1} if there are no more code
	 * points remaining.
	 * @since 2017/10/21
	 */
	public DecodedCharacter next()
	{
		// Peek first always
		this.peek();
		
		// Has been read already?
		DecodedCharacter rv = this._next;
		if (rv != null)
		{
			this._next = null;
			return rv;

Name change from runt/apis/midp-lcdui/cc/squirreljme/runtime/lcdui/common/CommonColors.java to modules/midp-lcdui/src/main/java/cc/squirreljme/runtime/lcdui/common/CommonColors.java.

14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
 * Common widget colors.
 *
 * @since 2018/12/02
 */
public interface CommonColors
{
	/** Default text color. */
	public static final int DEFAULT_TEXT_COLOR =
		0xFF_000000;
	
	/** Default text background color. */
	public static final int DEFAULT_TEXT_BACKGROUND_COLOR =
		0x00_FFFFFF;
	
	/** Border color. */
	public static final int BORDER =
		0xFF_000000;
	
	/** Background color. */
	public static final int BACKGROUND =
		0xFF_FFFFFF;
	
	/** Foreground color. */
	public static final int FOREGROUND =
		0xFF_000000;
	
	/** Disabled background. */
	public static final int DISABLED_BACKGROUND =
		0xFF_FFFFFF;
	
	/** Disabled foreground. */
	public static final int DISABLED_FOREGROUND =
		0xFF_3C3C3C;
	
	/** Highlighted border. */
	public static final int HIGHLIGHTED_BORDER =
		0xFF_0000FF;
	
	/** Highlighted background. */
	public static final int HIGHLIGHTED_BACKGROUND =
		0xFF_000080;
	
	/** Highlighted foreground. */
	public static final int HIGHLIGHTED_FOREGROUND =
		0xFF_FFFFFF;
	
	/** Disabled Highlighted background. */
	public static final int DISABLED_HIGHLIGHTED_BORDER =
		0xFF_000000;
	
	/** Disabled Highlighted background. */
	public static final int DISABLED_HIGHLIGHTED_BACKGROUND =
		0xFF_3C3C3C;
	
	/** Disabled Highlighted foreground. */
	public static final int DISABLED_HIGHLIGHTED_FOREGROUND =
		0xFF_9C9C9C;
	
	/** Canvas background. */
	public static final int CANVAS_BACKGROUND =
		0xFF_FFFFFF;
	
	/** Command bar background. */
	public static final int COMMANDBAR_BACKGROUND =
		0xFF_000000;
	
	/** Command bar foreground. */
	public static final int COMMANDBAR_FOREGROUND =
		0xFF_FFFFFF;
	
	/** Focused item color. */
	public static final int FOCUSED_COLOR =
		0xFF_FFFF00;
	
	/** Secondary focused item color. */
	public static final int FOCUSED_COLOR_TWO =
		0xFF_FF00FF;
}








|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
 * Common widget colors.
 *
 * @since 2018/12/02
 */
public interface CommonColors
{
	/** Default text color. */
	int DEFAULT_TEXT_COLOR =
		0xFF_000000;
	
	/** Default text background color. */
	int DEFAULT_TEXT_BACKGROUND_COLOR =
		0x00_FFFFFF;
	
	/** Border color. */
	int BORDER =
		0xFF_000000;
	
	/** Background color. */
	int BACKGROUND =
		0xFF_FFFFFF;
	
	/** Foreground color. */
	int FOREGROUND =
		0xFF_000000;
	
	/** Disabled background. */
	int DISABLED_BACKGROUND =
		0xFF_FFFFFF;
	
	/** Disabled foreground. */
	int DISABLED_FOREGROUND =
		0xFF_3C3C3C;
	
	/** Highlighted border. */
	int HIGHLIGHTED_BORDER =
		0xFF_0000FF;
	
	/** Highlighted background. */
	int HIGHLIGHTED_BACKGROUND =
		0xFF_000080;
	
	/** Highlighted foreground. */
	int HIGHLIGHTED_FOREGROUND =
		0xFF_FFFFFF;
	
	/** Disabled Highlighted background. */
	int DISABLED_HIGHLIGHTED_BORDER =
		0xFF_000000;
	
	/** Disabled Highlighted background. */
	int DISABLED_HIGHLIGHTED_BACKGROUND =
		0xFF_3C3C3C;
	
	/** Disabled Highlighted foreground. */
	int DISABLED_HIGHLIGHTED_FOREGROUND =
		0xFF_9C9C9C;
	
	/** Canvas background. */
	int CANVAS_BACKGROUND =
		0xFF_FFFFFF;
	
	/** Command bar background. */
	int COMMANDBAR_BACKGROUND =
		0xFF_000000;
	
	/** Command bar foreground. */
	int COMMANDBAR_FOREGROUND =
		0xFF_FFFFFF;
	
	/** Focused item color. */
	int FOCUSED_COLOR =
		0xFF_FFFF00;
	
	/** Secondary focused item color. */
	int FOCUSED_COLOR_TWO =
		0xFF_FF00FF;
}

Name change from runt/apis/midp-lcdui/cc/squirreljme/runtime/lcdui/common/CommonMetrics.java to modules/midp-lcdui/src/main/java/cc/squirreljme/runtime/lcdui/common/CommonMetrics.java.

16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
 * @since 2018/12/02
 */
@Deprecated
public interface CommonMetrics
{
	/** Width of the scroll bar. */
	@Deprecated
	public static final int SCROLLBAR_WIDTH =
		8;
	
	/** Command bar height. */
	@Deprecated
	public static final int COMMANDBAR_HEIGHT =
		18;
	
	/** Command bar font size. */
	@Deprecated
	public static final int COMMANDBAR_FONT_SIZE =
		16;
}








|




|




|



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
 * @since 2018/12/02
 */
@Deprecated
public interface CommonMetrics
{
	/** Width of the scroll bar. */
	@Deprecated
	int SCROLLBAR_WIDTH =
		8;
	
	/** Command bar height. */
	@Deprecated
	int COMMANDBAR_HEIGHT =
		18;
	
	/** Command bar font size. */
	@Deprecated
	int COMMANDBAR_FONT_SIZE =
		16;
}

Name change from runt/apis/midp-lcdui/cc/squirreljme/runtime/lcdui/common/DecodedCharacter.java to modules/midp-lcdui/src/main/java/cc/squirreljme/runtime/lcdui/common/DecodedCharacter.java.

Name change from runt/apis/midp-lcdui/cc/squirreljme/runtime/lcdui/common/EditableText.java to modules/midp-lcdui/src/main/java/cc/squirreljme/runtime/lcdui/common/EditableText.java.

73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
		throws IllegalArgumentException
	{
		// Lock
		synchronized (this.lock)
		{
			// Size and constraints are set first to make sure the string is
			// valid
			int n = setMaxSize(__ms);
			setConstraints(__c);
		
			// Set the string which validates the input
			// However if the constraints are smaller for the implementation
			// then no exception is thrown (just give the truncated string)
			if (__t != null)
				setString((n < __c ? __t.substring(0, n) : __t));
		}
	}
	
	/**
	 * Sets the constraints for this field according to the constraints which
	 * are available. If the current value is not valid under the constraints
	 * to be set then it is cleared.
	 *
	 * @param __c The constraints to set.
	 * @throws IllegalArgumentException If the input constraints are not
	 * valid.
	 * @since 2017/08/20
	 */
	public void setConstraints(int __c)
		throws IllegalArgumentException
	{
		// {@squirreljme.error EB01 The specified constraint type is not
		// valid. (The type)}
		int type = (__c & TextField.CONSTRAINT_MASK);
		if (type < 0 || type > _MAX_CONSTRAINT)
			throw new IllegalArgumentException(String.format("EB01 %d", type));
		
		// {@squirreljme.error EB02 The specified constraint flags are not
		// valid. (The constraint flags)}
		if (((__c ^ type) & ~_VALID_CONSTRAINT_FLAG_BITS) != 0)
			throw new IllegalArgumentException(String.format("EB02 %04x",
				__c >>> 16));
		
		// Lock
		synchronized (this.lock)
		{
			// If the new constraints are not valid then any previous text
			// is cleared
			StringBuilder value = this._value;
			if (!__check(value, this._maxlength, __c))
			{
				value.setLength(0);
				return;
			}
			
			// Set
			this._constraints = __c;







|
|





|



















|




|









|







73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
		throws IllegalArgumentException
	{
		// Lock
		synchronized (this.lock)
		{
			// Size and constraints are set first to make sure the string is
			// valid
			int n = this.setMaxSize(__ms);
			this.setConstraints(__c);
		
			// Set the string which validates the input
			// However if the constraints are smaller for the implementation
			// then no exception is thrown (just give the truncated string)
			if (__t != null)
				this.setString((n < __c ? __t.substring(0, n) : __t));
		}
	}
	
	/**
	 * Sets the constraints for this field according to the constraints which
	 * are available. If the current value is not valid under the constraints
	 * to be set then it is cleared.
	 *
	 * @param __c The constraints to set.
	 * @throws IllegalArgumentException If the input constraints are not
	 * valid.
	 * @since 2017/08/20
	 */
	public void setConstraints(int __c)
		throws IllegalArgumentException
	{
		// {@squirreljme.error EB01 The specified constraint type is not
		// valid. (The type)}
		int type = (__c & TextField.CONSTRAINT_MASK);
		if (type < 0 || type > EditableText._MAX_CONSTRAINT)
			throw new IllegalArgumentException(String.format("EB01 %d", type));
		
		// {@squirreljme.error EB02 The specified constraint flags are not
		// valid. (The constraint flags)}
		if (((__c ^ type) & ~EditableText._VALID_CONSTRAINT_FLAG_BITS) != 0)
			throw new IllegalArgumentException(String.format("EB02 %04x",
				__c >>> 16));
		
		// Lock
		synchronized (this.lock)
		{
			// If the new constraints are not valid then any previous text
			// is cleared
			StringBuilder value = this._value;
			if (!EditableText.__check(value, this._maxlength, __c))
			{
				value.setLength(0);
				return;
			}
			
			// Set
			this._constraints = __c;
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
			throw new IllegalArgumentException(String.format("EB03 %d", __ms));
		
		// Lock
		synchronized (this.lock)
		{
			// {@squirreljme.error EB04 Cannot set the maximum size because the
			// input text field would have an invalid value.}
			if (!__check(this._value, __ms, this._constraints))
				throw new IllegalArgumentException("EB04");
		
			// Set, SquirrelJME does not have a fixed limit on the size of text
			// fields
			this._maxlength = __ms;
			return __ms;
		}







|







151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
			throw new IllegalArgumentException(String.format("EB03 %d", __ms));
		
		// Lock
		synchronized (this.lock)
		{
			// {@squirreljme.error EB04 Cannot set the maximum size because the
			// input text field would have an invalid value.}
			if (!EditableText.__check(this._value, __ms, this._constraints))
				throw new IllegalArgumentException("EB04");
		
			// Set, SquirrelJME does not have a fixed limit on the size of text
			// fields
			this._maxlength = __ms;
			return __ms;
		}
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
			__s = "";
		
		// Lock
		synchronized (this.lock)
		{
			// {@squirreljme.error EB05 Cannot set the specified string
			// because it is not valid within the constraints.}
			if (!__check(__s, this._maxlength, this._constraints))
				throw new IllegalArgumentException("EB05");
			
			// Set value
			StringBuilder value = this._value;
			value.setLength(0);
			value.append(__s);
		}







|







182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
			__s = "";
		
		// Lock
		synchronized (this.lock)
		{
			// {@squirreljme.error EB05 Cannot set the specified string
			// because it is not valid within the constraints.}
			if (!EditableText.__check(__s, this._maxlength, this._constraints))
				throw new IllegalArgumentException("EB05");
			
			// Set value
			StringBuilder value = this._value;
			value.setLength(0);
			value.append(__s);
		}

Name change from runt/apis/midp-lcdui/cc/squirreljme/runtime/lcdui/common/TextStorage.java to modules/midp-lcdui/src/main/java/cc/squirreljme/runtime/lcdui/common/TextStorage.java.

1
2
3
4
5
6
7
8
9
10
11
12
13

14
15
16
17
18
19
20
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.lcdui.common;

import javax.microedition.lcdui.Font;
import java.util.Arrays;


/**
 * Manages the storage for the text in multiple different arrays at once
 * for simplicity.
 *
 * @since 2018/11/30
 */











<

>







1
2
3
4
5
6
7
8
9
10
11

12
13
14
15
16
17
18
19
20
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.lcdui.common;


import java.util.Arrays;
import javax.microedition.lcdui.Font;

/**
 * Manages the storage for the text in multiple different arrays at once
 * for simplicity.
 *
 * @since 2018/11/30
 */
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
		
		// Need to grow the buffer?
		int newsize = size + __l,
			limit = this.limit;
		if (newsize > limit)
		{
			// Calculate a new limit with some extra room
			int newlimit = newsize + GROWTH;
			
			// Resize all the arrays
			this.chars = (chars = Arrays.copyOf(chars, newlimit));
			this.font = (font = Arrays.<Font>copyOf(font, newlimit));
			this.color = (color = Arrays.copyOf(color, newlimit));
			this.x = (x = Arrays.copyOf(x, newlimit));
			this.y = (y = Arrays.copyOf(y, newlimit));







|







113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
		
		// Need to grow the buffer?
		int newsize = size + __l,
			limit = this.limit;
		if (newsize > limit)
		{
			// Calculate a new limit with some extra room
			int newlimit = newsize + TextStorage.GROWTH;
			
			// Resize all the arrays
			this.chars = (chars = Arrays.copyOf(chars, newlimit));
			this.font = (font = Arrays.<Font>copyOf(font, newlimit));
			this.color = (color = Arrays.copyOf(color, newlimit));
			this.x = (x = Arrays.copyOf(x, newlimit));
			this.y = (y = Arrays.copyOf(y, newlimit));

Name change from runt/apis/midp-lcdui/cc/squirreljme/runtime/lcdui/common/package-info.java to modules/midp-lcdui/src/main/java/cc/squirreljme/runtime/lcdui/common/package-info.java.

Name change from runt/apis/midp-lcdui/cc/squirreljme/runtime/lcdui/event/EventTranslate.java to modules/midp-lcdui/src/main/java/cc/squirreljme/runtime/lcdui/event/EventTranslate.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.lcdui.event;

import cc.squirreljme.runtime.lcdui.event.NonStandardKey;
import javax.microedition.lcdui.Canvas;

/**
 * Used to translate key events and such.
 *
 * @since 2018/12/09
 */












<







1
2
3
4
5
6
7
8
9
10
11
12

13
14
15
16
17
18
19
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.lcdui.event;


import javax.microedition.lcdui.Canvas;

/**
 * Used to translate key events and such.
 *
 * @since 2018/12/09
 */

Name change from runt/apis/midp-lcdui/cc/squirreljme/runtime/lcdui/event/KeyNames.java to modules/midp-lcdui/src/main/java/cc/squirreljme/runtime/lcdui/event/KeyNames.java.

Name change from runt/apis/midp-lcdui/cc/squirreljme/runtime/lcdui/event/NonStandardKey.java to modules/midp-lcdui/src/main/java/cc/squirreljme/runtime/lcdui/event/NonStandardKey.java.

14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
 * This byteerface contains identifiers for non-standard keys.
 *
 * @since 2017/02/12
 */
public interface NonStandardKey
{
	/** Unknown, zero is the invalid index so always make it known. */
	public static final byte UNKNOWN =
		0;
	
	/** Game Up. */
	public static final byte VGAME_UP =
		-9;
	
	/** Game Down. */
	public static final byte VGAME_DOWN =
		-10;
	
	/** Game Left. */
	public static final byte VGAME_LEFT =
		-11;
	
	/** Game Right. */
	public static final byte VGAME_RIGHT =
		-12;
	
	/** Game fire. */
	public static final byte VGAME_FIRE =
		-13;
	
	/** Game A. */
	public static final byte VGAME_A =
		-14;
	
	/** Game B. */
	public static final byte VGAME_B =
		-15;
	
	/** Game C. */
	public static final byte VGAME_C =
		-16;
	
	/** Game D. */
	public static final byte VGAME_D =
		-17;
	
	/** Shift. */
	public static final byte SHIFT =
		-18;
	
	/** Control. */
	public static final byte CONTROL =
		-19;
	
	/** Alt. */
	public static final byte ALT =
		-20;
	
	/** Logo. */
	public static final byte LOGO =
		-21;
	
	/** Caps lock. */
	public static final byte CAPSLOCK =
		-22;
	
	/** Context menu. */
	public static final byte CONTEXT_MENU =
		-23;
	
	/** Home. */
	public static final byte HOME =
		-24;
	
	/** End. */
	public static final byte END =
		-25;
	
	/** Page Up. */
	public static final byte PAGE_UP =
		-26;
	
	/** Page Down. */
	public static final byte PAGE_DOWN =
		-27;
	
	/** Meta. */
	public static final byte META =
		-28;
	
	/** Numlock. */
	public static final byte NUMLOCK =
		-29;
	
	/** Pause. */
	public static final byte PAUSE =
		-30;
	
	/** Print Screen. */
	public static final byte PRINTSCREEN =
		-31;
	
	/** Scroll lock. */
	public static final byte SCROLLLOCK =
		-32;
	
	/** Insert. */
	public static final byte INSERT =
		-33;
	
	/** F24. */
	public static final byte F24 =
		-34;
	
	/** F1. */
	public static final byte F1 =
		F24 - 24;
}








|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



<
|


14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128

129
130
131
 * This byteerface contains identifiers for non-standard keys.
 *
 * @since 2017/02/12
 */
public interface NonStandardKey
{
	/** Unknown, zero is the invalid index so always make it known. */
	byte UNKNOWN =
		0;
	
	/** Game Up. */
	byte VGAME_UP =
		-9;
	
	/** Game Down. */
	byte VGAME_DOWN =
		-10;
	
	/** Game Left. */
	byte VGAME_LEFT =
		-11;
	
	/** Game Right. */
	byte VGAME_RIGHT =
		-12;
	
	/** Game fire. */
	byte VGAME_FIRE =
		-13;
	
	/** Game A. */
	byte VGAME_A =
		-14;
	
	/** Game B. */
	byte VGAME_B =
		-15;
	
	/** Game C. */
	byte VGAME_C =
		-16;
	
	/** Game D. */
	byte VGAME_D =
		-17;
	
	/** Shift. */
	byte SHIFT =
		-18;
	
	/** Control. */
	byte CONTROL =
		-19;
	
	/** Alt. */
	byte ALT =
		-20;
	
	/** Logo. */
	byte LOGO =
		-21;
	
	/** Caps lock. */
	byte CAPSLOCK =
		-22;
	
	/** Context menu. */
	byte CONTEXT_MENU =
		-23;
	
	/** Home. */
	byte HOME =
		-24;
	
	/** End. */
	byte END =
		-25;
	
	/** Page Up. */
	byte PAGE_UP =
		-26;
	
	/** Page Down. */
	byte PAGE_DOWN =
		-27;
	
	/** Meta. */
	byte META =
		-28;
	
	/** Numlock. */
	byte NUMLOCK =
		-29;
	
	/** Pause. */
	byte PAUSE =
		-30;
	
	/** Print Screen. */
	byte PRINTSCREEN =
		-31;
	
	/** Scroll lock. */
	byte SCROLLLOCK =
		-32;
	
	/** Insert. */
	byte INSERT =
		-33;
	
	/** F24. */
	byte F24 =
		-34;
	
	/** F1. */

	byte F1 = NonStandardKey.F24 - 24;
}

Name change from runt/apis/midp-lcdui/cc/squirreljme/runtime/lcdui/event/package-info.java to modules/midp-lcdui/src/main/java/cc/squirreljme/runtime/lcdui/event/package-info.java.

Name change from runt/apis/midp-lcdui/cc/squirreljme/runtime/lcdui/fbui/DrawingCanvas.java to modules/midp-lcdui/src/main/java/cc/squirreljme/runtime/lcdui/fbui/DrawingCanvas.java.

Name change from runt/apis/midp-lcdui/cc/squirreljme/runtime/lcdui/fbui/DrawingList.java to modules/midp-lcdui/src/main/java/cc/squirreljme/runtime/lcdui/fbui/DrawingList.java.

Name change from runt/apis/midp-lcdui/cc/squirreljme/runtime/lcdui/fbui/UIDrawerState.java to modules/midp-lcdui/src/main/java/cc/squirreljme/runtime/lcdui/fbui/UIDrawerState.java.

Name change from runt/apis/midp-lcdui/cc/squirreljme/runtime/lcdui/fbui/UIState.java to modules/midp-lcdui/src/main/java/cc/squirreljme/runtime/lcdui/fbui/UIState.java.

273
274
275
276
277
278
279

280
281

282
283
284
285
286
287
288
	 * @since 2020/01/15
	 */
	public final void setTitle(String __s)
	{
		char[] chars = (__s == null ? "SquirrelJME" : __s).toCharArray();
		
		// Tell the framebuffer to set the title as needed

		Assembly.sysCall(SystemCallIndex.FRAMEBUFFER,
			Framebuffer.CONTROL_SET_TITLE, Assembly.objectToPointer(chars));

		
		// Touch
		if (chars.length > 0)
			chars[0] = chars[0];
	}
	
	/**







>

|
>







273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
	 * @since 2020/01/15
	 */
	public final void setTitle(String __s)
	{
		char[] chars = (__s == null ? "SquirrelJME" : __s).toCharArray();
		
		// Tell the framebuffer to set the title as needed
		long pointer = Assembly.objectToPointer(chars);
		Assembly.sysCall(SystemCallIndex.FRAMEBUFFER,
			Framebuffer.CONTROL_SET_TITLE,
			Assembly.longUnpackHigh(pointer), Assembly.longUnpackLow(pointer));
		
		// Touch
		if (chars.length > 0)
			chars[0] = chars[0];
	}
	
	/**

Name change from runt/apis/midp-lcdui/cc/squirreljme/runtime/lcdui/fbui/package-info.java to modules/midp-lcdui/src/main/java/cc/squirreljme/runtime/lcdui/fbui/package-info.java.

Name change from runt/apis/midp-lcdui/cc/squirreljme/runtime/lcdui/font/FontSizeConversion.java to modules/midp-lcdui/src/main/java/cc/squirreljme/runtime/lcdui/font/FontSizeConversion.java.

Name change from runt/apis/midp-lcdui/cc/squirreljme/runtime/lcdui/font/SQFFont.java to modules/midp-lcdui/src/main/java/cc/squirreljme/runtime/lcdui/font/SQFFont.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.lcdui.font;

import java.io.DataInputStream;
import java.io.InputStream;
import java.io.IOException;
import java.io.PrintStream;
import java.util.HashMap;
import java.util.Map;
import javax.microedition.lcdui.Font;

/**
 * This represents a SQF Font (SquirrelJME Font) which is a compacted and













|
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.lcdui.font;

import java.io.DataInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintStream;
import java.util.HashMap;
import java.util.Map;
import javax.microedition.lcdui.Font;

/**
 * This represents a SQF Font (SquirrelJME Font) which is a compacted and
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
	{
		if (__n == null)
			throw new NullPointerException("NARG");	
		
		// Build specifier
		SQFFontSpecifier spec = new SQFFontSpecifier(__n, __pxs);
		
		Map<SQFFontSpecifier, SQFFont> cache = _FONT_CACHE;
		synchronized (cache)
		{
			// Already cached?
			SQFFont rv = cache.get(spec);
			if (rv != null)
				return rv;
			







|







288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
	{
		if (__n == null)
			throw new NullPointerException("NARG");	
		
		// Build specifier
		SQFFontSpecifier spec = new SQFFontSpecifier(__n, __pxs);
		
		Map<SQFFontSpecifier, SQFFont> cache = SQFFont._FONT_CACHE;
		synchronized (cache)
		{
			// Already cached?
			SQFFont rv = cache.get(spec);
			if (rv != null)
				return rv;
			

Name change from runt/apis/midp-lcdui/cc/squirreljme/runtime/lcdui/font/SQFFontSpecifier.java to modules/midp-lcdui/src/main/java/cc/squirreljme/runtime/lcdui/font/SQFFontSpecifier.java.

Name change from runt/apis/midp-lcdui/cc/squirreljme/runtime/lcdui/font/package-info.java to modules/midp-lcdui/src/main/java/cc/squirreljme/runtime/lcdui/font/package-info.java.

Name change from runt/apis/midp-lcdui/cc/squirreljme/runtime/lcdui/gfx/AcceleratedGraphics.java to modules/midp-lcdui/src/main/java/cc/squirreljme/runtime/lcdui/gfx/AcceleratedGraphics.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.lcdui.gfx;

import cc.squirreljme.runtime.cldc.asm.NativeDisplayAccess;
import javax.microedition.lcdui.Font;
import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;
import javax.microedition.lcdui.Text;

/**
 * This class forwards graphics operations to the host native display API
 * which provides a single instance of accelerated graphics.
 *
 * @since 2018/11/19
 */
public final class AcceleratedGraphics
	extends SerializedGraphics
{
	/**
	 * Initializes for the given display.
	 *
	 * @since 2018/11/19
	 */
	public AcceleratedGraphics()
	{
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/11/19
	 */
	@Override
	public final Object serialize(GraphicsFunction __func, Object... __args)
	{
		// Forward serialized arguments to the destination host
		return NativeDisplayAccess.accelGfxFunc(0,
			__func.ordinal(), __args);
	}
	
	/**
	 * Returns the instance for the given display ID.
	 *
	 * @param __did The display ID.
	 * @return The accelerated graphics instance.
	 * @throws UnsupportedOperationException If accelerated graphics are not
	 * supported.
	 * @since 2018/11/19
	 */
	public static final AcceleratedGraphics instance()
		throws UnsupportedOperationException













<
<
<
<










<
<
<
<
<
<
<
<
















<







1
2
3
4
5
6
7
8
9
10
11
12
13




14
15
16
17
18
19
20
21
22
23








24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39

40
41
42
43
44
45
46
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.lcdui.gfx;

import cc.squirreljme.runtime.cldc.asm.NativeDisplayAccess;





/**
 * This class forwards graphics operations to the host native display API
 * which provides a single instance of accelerated graphics.
 *
 * @since 2018/11/19
 */
public final class AcceleratedGraphics
	extends SerializedGraphics
{








	
	/**
	 * {@inheritDoc}
	 * @since 2018/11/19
	 */
	@Override
	public final Object serialize(GraphicsFunction __func, Object... __args)
	{
		// Forward serialized arguments to the destination host
		return NativeDisplayAccess.accelGfxFunc(0,
			__func.ordinal(), __args);
	}
	
	/**
	 * Returns the instance for the given display ID.
	 *

	 * @return The accelerated graphics instance.
	 * @throws UnsupportedOperationException If accelerated graphics are not
	 * supported.
	 * @since 2018/11/19
	 */
	public static final AcceleratedGraphics instance()
		throws UnsupportedOperationException

Name change from runt/apis/midp-lcdui/cc/squirreljme/runtime/lcdui/gfx/AdvancedBufferAdapter.java to modules/midp-lcdui/src/main/java/cc/squirreljme/runtime/lcdui/gfx/AdvancedBufferAdapter.java.

Name change from runt/apis/midp-lcdui/cc/squirreljme/runtime/lcdui/gfx/AdvancedFunction.java to modules/midp-lcdui/src/main/java/cc/squirreljme/runtime/lcdui/gfx/AdvancedFunction.java.

Name change from runt/apis/midp-lcdui/cc/squirreljme/runtime/lcdui/gfx/AdvancedGraphics.java to modules/midp-lcdui/src/main/java/cc/squirreljme/runtime/lcdui/gfx/AdvancedGraphics.java.

8
9
10
11
12
13
14
15
16
17
18

19
20
21
22
23
24
25
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.lcdui.gfx;

import cc.squirreljme.runtime.lcdui.font.SQFFont;
import javax.microedition.lcdui.Font;
import javax.microedition.lcdui.game.Sprite;
import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;
import javax.microedition.lcdui.Text;


/**
 * This class contains the advanced graphics functions which uses
 * pre-determined functions to determine how to draw something.
 *
 * @since 2019/03/24
 */







<



>







8
9
10
11
12
13
14

15
16
17
18
19
20
21
22
23
24
25
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.lcdui.gfx;

import cc.squirreljme.runtime.lcdui.font.SQFFont;
import javax.microedition.lcdui.Font;

import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;
import javax.microedition.lcdui.Text;
import javax.microedition.lcdui.game.Sprite;

/**
 * This class contains the advanced graphics functions which uses
 * pre-determined functions to determine how to draw something.
 *
 * @since 2019/03/24
 */
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
			this.clipsy = (oldclipsy = __y);
		if (ex < oldclipex)
			this.clipex = (oldclipex = ex);
		if (ey < oldclipey)
			this.clipey = (oldclipey = ey);
		
		// Set width/height
		this.clipw = clipex - oldclipsx;
		this.cliph = clipey - oldclipsy;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2019/03/24
	 */
	@Override







|
|







282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
			this.clipsy = (oldclipsy = __y);
		if (ex < oldclipex)
			this.clipex = (oldclipex = ex);
		if (ey < oldclipey)
			this.clipey = (oldclipey = ey);
		
		// Set width/height
		this.clipw = this.clipex - oldclipsx;
		this.cliph = this.clipey - oldclipsy;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2019/03/24
	 */
	@Override
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
			if (outa != 0)
			{
				// Differences of points
				int dx = __x2 - __x1,
					dy = __y2 - __y1;
				
				// Clips above the box
				if ((outa & _CLIP_ABOVE) != 0)
				{
					__x1 += dx * (clipey - __y1) / dy;
					__y1 = clipey - 1;
				}
			
				// Clips below
				else if ((outa & _CLIP_BELOW) != 0)
				{
					__x1 += dx * (clipsy - __y1) / dy;
					__y1 = clipsy;
				}
			
				// Clips the right side
				else if ((outa & _CLIP_RIGHT) != 0)
				{
					__y1 += dy * (clipex - __x1) / dx;
					__x1 = clipex - 1;
				}
			
				// Clips the left side
				else if ((outa & _CLIP_LEFT) != 0)
				{
					__y1 += dy * (clipsx - __x1) / dx;
					__x1 = clipsx;
				}
			}
		}
		







|






|






|






|







466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
			if (outa != 0)
			{
				// Differences of points
				int dx = __x2 - __x1,
					dy = __y2 - __y1;
				
				// Clips above the box
				if ((outa & AdvancedGraphics._CLIP_ABOVE) != 0)
				{
					__x1 += dx * (clipey - __y1) / dy;
					__y1 = clipey - 1;
				}
			
				// Clips below
				else if ((outa & AdvancedGraphics._CLIP_BELOW) != 0)
				{
					__x1 += dx * (clipsy - __y1) / dy;
					__y1 = clipsy;
				}
			
				// Clips the right side
				else if ((outa & AdvancedGraphics._CLIP_RIGHT) != 0)
				{
					__y1 += dy * (clipex - __x1) / dx;
					__x1 = clipex - 1;
				}
			
				// Clips the left side
				else if ((outa & AdvancedGraphics._CLIP_LEFT) != 0)
				{
					__y1 += dy * (clipsx - __x1) / dx;
					__x1 = clipsx;
				}
			}
		}
		
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
	/**
	 * {@inheritDoc}
	 * @since 2019/03/24
	 */
	@Override
	public int getGrayScale()
	{
		return (getRedComponent() + getGreenComponent() +
			getBlueComponent()) / 3;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2019/03/24
	 */
	@Override







|
|







952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
	/**
	 * {@inheritDoc}
	 * @since 2019/03/24
	 */
	@Override
	public int getGrayScale()
	{
		return (this.getRedComponent() + this.getGreenComponent() + this
			.getBlueComponent()) / 3;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2019/03/24
	 */
	@Override
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
			this.clipey = height;
			this.clipw = width;
			this.cliph = height;
		}
		
		// Always reset these
		this.setAlphaColor(0xFF000000);
		this.setBlendingMode(SRC_OVER);
		this.setStrokeStyle(SOLID);
		this.setFont(null);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2019/03/24
	 */
	@Override
	public void setAlpha(int __a)
		throws IllegalArgumentException
	{
		this.setAlphaColor(__a, getRedComponent(), getGreenComponent(),
			getBlueComponent());
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2019/03/24
	 */
	@Override







|
|











|
|







1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
			this.clipey = height;
			this.clipw = width;
			this.cliph = height;
		}
		
		// Always reset these
		this.setAlphaColor(0xFF000000);
		this.setBlendingMode(Graphics.SRC_OVER);
		this.setStrokeStyle(Graphics.SOLID);
		this.setFont(null);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2019/03/24
	 */
	@Override
	public void setAlpha(int __a)
		throws IllegalArgumentException
	{
		this.setAlphaColor(__a, this.getRedComponent(), this.getGreenComponent(),
			this.getBlueComponent());
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2019/03/24
	 */
	@Override
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
	public void setBlendingMode(int __m)
		throws IllegalArgumentException
	{
		boolean candoblending,
			oldcandoblending = this.candoblending;
		
		// Just use source pixels
		if (__m == SRC)
		{
			// {@squirreljme.error EB0g Cannot set the overlay blending mode
			// because this graphics context does not have the alpha channel.}
			if (!this.hasalphachannel)
				throw new IllegalArgumentException("EB0g");
			
			candoblending = false;
		}
		
		// Perform blending since this is the default mode
		else if (__m == SRC_OVER)
		{
			candoblending = true;
		}
		
		// {@squirreljme.error EB0h Unknown blending mode.}
		else
			throw new IllegalArgumentException("EB0h");







|










|







1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
	public void setBlendingMode(int __m)
		throws IllegalArgumentException
	{
		boolean candoblending,
			oldcandoblending = this.candoblending;
		
		// Just use source pixels
		if (__m == Graphics.SRC)
		{
			// {@squirreljme.error EB0g Cannot set the overlay blending mode
			// because this graphics context does not have the alpha channel.}
			if (!this.hasalphachannel)
				throw new IllegalArgumentException("EB0g");
			
			candoblending = false;
		}
		
		// Perform blending since this is the default mode
		else if (__m == Graphics.SRC_OVER)
		{
			candoblending = true;
		}
		
		// {@squirreljme.error EB0h Unknown blending mode.}
		else
			throw new IllegalArgumentException("EB0h");
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
	 * {@inheritDoc}
	 * @since 2019/03/24
	 */
	@Override
	public void setColor(int __r, int __g, int __b)
		throws IllegalArgumentException
	{
		this.setAlphaColor(getAlpha(), __r, __g, __b);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2019/03/24
	 */
	@Override
	public void setFont(Font __a)
	{
		// Just set it
		this.font = __a;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2019/03/24
	 */
	@Override
	public void setGrayScale(int __v)
	{
		this.setAlphaColor(getAlpha(), __v, __v, __v);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2019/03/24
	 */
	@Override
	public void setStrokeStyle(int __a)
		throws IllegalArgumentException
	{
		// {@squirreljme.error EB0i Illegal stroke style.}
		if (__a != SOLID && __a != DOTTED)
			throw new IllegalArgumentException("EB0i");
		
		// Set
		this.strokestyle = __a;
		this.dotstroke = (__a == DOTTED);
		
		// Update functions
		this.__updateFunctions();
	}
	
	/**
	 * {@inheritDoc}







|




















|











|




|







1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
	 * {@inheritDoc}
	 * @since 2019/03/24
	 */
	@Override
	public void setColor(int __r, int __g, int __b)
		throws IllegalArgumentException
	{
		this.setAlphaColor(this.getAlpha(), __r, __g, __b);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2019/03/24
	 */
	@Override
	public void setFont(Font __a)
	{
		// Just set it
		this.font = __a;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2019/03/24
	 */
	@Override
	public void setGrayScale(int __v)
	{
		this.setAlphaColor(this.getAlpha(), __v, __v, __v);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2019/03/24
	 */
	@Override
	public void setStrokeStyle(int __a)
		throws IllegalArgumentException
	{
		// {@squirreljme.error EB0i Illegal stroke style.}
		if (__a != Graphics.SOLID && __a != Graphics.DOTTED)
			throw new IllegalArgumentException("EB0i");
		
		// Set
		this.strokestyle = __a;
		this.dotstroke = (__a == Graphics.DOTTED);
		
		// Update functions
		this.__updateFunctions();
	}
	
	/**
	 * {@inheritDoc}
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
		// Re-read the new image sizes!
		__wsrc = transdim[0];
		__hsrc = transdim[1];
		__wdest = transdim[2];
		__hdest = transdim[3];
		
		// Anchor horizontally?
		if ((__anch & HCENTER) == HCENTER)
			__xdest -= __wdest >> 1;
		
		// Anchor right?
		else if ((__anch & RIGHT) == RIGHT)
			__xdest -= __wdest;
		
		// Anchor middle?
		if ((__anch & VCENTER) == VCENTER)
			__ydest -= __hdest >> 1;
		
		// Anchor bottom?
		else if ((__anch & BOTTOM) == BOTTOM)
			__ydest -= __hdest;
		
		// If this is non-stretched we can just use the standard RGB
		// drawing function!
		if (__wsrc == __wdest && __hsrc == __hdest)
			this.drawRGB(data, 0, __wsrc, __xdest, __ydest, __wsrc, __hsrc,
				alpha);







|



|



|



|







1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
		// Re-read the new image sizes!
		__wsrc = transdim[0];
		__hsrc = transdim[1];
		__wdest = transdim[2];
		__hdest = transdim[3];
		
		// Anchor horizontally?
		if ((__anch & Graphics.HCENTER) == Graphics.HCENTER)
			__xdest -= __wdest >> 1;
		
		// Anchor right?
		else if ((__anch & Graphics.RIGHT) == Graphics.RIGHT)
			__xdest -= __wdest;
		
		// Anchor middle?
		if ((__anch & Graphics.VCENTER) == Graphics.VCENTER)
			__ydest -= __hdest >> 1;
		
		// Anchor bottom?
		else if ((__anch & Graphics.BOTTOM) == Graphics.BOTTOM)
			__ydest -= __hdest;
		
		// If this is non-stretched we can just use the standard RGB
		// drawing function!
		if (__wsrc == __wdest && __hsrc == __hdest)
			this.drawRGB(data, 0, __wsrc, __xdest, __ydest, __wsrc, __hsrc,
				alpha);
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
						scanlen - scanoff, linelen - lineoff), ts.chobj);
				}
				
				// Set color to the foreground color of this character
				this.setAlphaColor(__t.getForegroundColor(i));
				
				// Setup the draw and do it
				this.funccharbmp.function(this, ts.loadIntArgs(color, dsx, dsy,
					bps, scanoff, scanlen, lineoff, linelen),
					ts.loadObject(bmp));
			}
		}
		
		// Just in case revert properties
		finally







|







1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
						scanlen - scanoff, linelen - lineoff), ts.chobj);
				}
				
				// Set color to the foreground color of this character
				this.setAlphaColor(__t.getForegroundColor(i));
				
				// Setup the draw and do it
				this.funccharbmp.function(this, ts.loadIntArgs(this.color, dsx, dsy,
					bps, scanoff, scanlen, lineoff, linelen),
					ts.loadObject(bmp));
			}
		}
		
		// Just in case revert properties
		finally
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
	private static final int __csOut(int __x, int __y, int __csx, int __csy,
		int __cex, int __cey)
	{
		int rv = 0;
		
		// Clips above or below?
		if (__y > __cey)
			rv |= _CLIP_ABOVE;
		else if (__y < __csy)
			rv |= _CLIP_BELOW;
		
		// Clips right or left?
		if (__x > __cex)
			rv |= _CLIP_RIGHT;
		else if (__x < __csx)
			rv |= _CLIP_LEFT;
		
		return rv;
	}
	
	/**
	 * Transforms the data in the buffer.
	 *







|

|



|

|







1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
	private static final int __csOut(int __x, int __y, int __csx, int __csy,
		int __cex, int __cey)
	{
		int rv = 0;
		
		// Clips above or below?
		if (__y > __cey)
			rv |= AdvancedGraphics._CLIP_ABOVE;
		else if (__y < __csy)
			rv |= AdvancedGraphics._CLIP_BELOW;
		
		// Clips right or left?
		if (__x > __cex)
			rv |= AdvancedGraphics._CLIP_RIGHT;
		else if (__x < __csx)
			rv |= AdvancedGraphics._CLIP_LEFT;
		
		return rv;
	}
	
	/**
	 * Transforms the data in the buffer.
	 *

Name change from runt/apis/midp-lcdui/cc/squirreljme/runtime/lcdui/gfx/BasicForwardingGraphics.java to modules/midp-lcdui/src/main/java/cc/squirreljme/runtime/lcdui/gfx/BasicForwardingGraphics.java.

Name change from runt/apis/midp-lcdui/cc/squirreljme/runtime/lcdui/gfx/EnforcedDrawingAreaGraphics.java to modules/midp-lcdui/src/main/java/cc/squirreljme/runtime/lcdui/gfx/EnforcedDrawingAreaGraphics.java.

Name change from runt/apis/midp-lcdui/cc/squirreljme/runtime/lcdui/gfx/ForwardingGraphics.java to modules/midp-lcdui/src/main/java/cc/squirreljme/runtime/lcdui/gfx/ForwardingGraphics.java.

63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
	/**
	 * {@inheritDoc}
	 * @since 2016/10/10
	 */
	@Override
	public void clipRect(int __x, int __y, int __w, int __h)
	{
		setClip(Math.max(__x, getClipX()),
			Math.max(__y, getClipY()),
			Math.min(__w, getClipWidth()),
			Math.min(__h, getClipHeight()));
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/10/10
	 */
	@Override







|
|
|
|







63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
	/**
	 * {@inheritDoc}
	 * @since 2016/10/10
	 */
	@Override
	public void clipRect(int __x, int __y, int __w, int __h)
	{
		this.setClip(Math.max(__x, this.getClipX()),
			Math.max(__y, this.getClipY()),
			Math.min(__w, this.getClipWidth()),
			Math.min(__h, this.getClipHeight()));
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/10/10
	 */
	@Override
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
	 * {@inheritDoc}
	 * @since 2016/10/10
	 */
	@Override
	public int getGrayScale()
	{
		// Average all channels
		return ((getRedComponent() & 0xFF) +
			(getGreenComponent() & 0xFF) +
			(getBlueComponent() & 0xFF)) / 3;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/10/10
	 */
	@Override







|
|
|







547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
	 * {@inheritDoc}
	 * @since 2016/10/10
	 */
	@Override
	public int getGrayScale()
	{
		// Average all channels
		return ((this.getRedComponent() & 0xFF) +
			(this.getGreenComponent() & 0xFF) +
			(this.getBlueComponent() & 0xFF)) / 3;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/10/10
	 */
	@Override
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
	/**
	 * {@inheritDoc}
	 * @since 2016/10/10
	 */
	@Override
	public void setAlpha(int __a)
	{
		setAlphaColor(__a, getRedComponent(), getGreenComponent(),
			getBlueComponent());
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/10/10
	 */
	@Override







|
|







634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
	/**
	 * {@inheritDoc}
	 * @since 2016/10/10
	 */
	@Override
	public void setAlpha(int __a)
	{
		this.setAlphaColor(__a, this.getRedComponent(), this.getGreenComponent(),
			this.getBlueComponent());
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/10/10
	 */
	@Override
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
	/**
	 * {@inheritDoc}
	 * @since 2016/10/10
	 */
	@Override
	public void setAlphaColor(int __a, int __r, int __g, int __b)
	{
		setAlphaColor(((__a & 0xFF) << 24) |
			((__r & 0xFF) << 16) |
			((__g & 0xFF) << 8) |
			(__b & 0xFF));
	}
	
	/**
	 * {@inheritDoc}







|







660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
	/**
	 * {@inheritDoc}
	 * @since 2016/10/10
	 */
	@Override
	public void setAlphaColor(int __a, int __r, int __g, int __b)
	{
		this.setAlphaColor(((__a & 0xFF) << 24) |
			((__r & 0xFF) << 16) |
			((__g & 0xFF) << 8) |
			(__b & 0xFF));
	}
	
	/**
	 * {@inheritDoc}
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
	/**
	 * {@inheritDoc}
	 * @since 2016/10/10
	 */
	@Override
	public void setColor(int __a)
	{
		setAlphaColor((__a & 0xFFFFFF) | ((getAlpha() & 0xFF) << 24));
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/10/10
	 */
	@Override
	public void setColor(int __a, int __b, int __c)
	{
		setAlphaColor(getAlpha(), __a, __b, __c);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/10/10
	 */
	@Override







|









|







706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
	/**
	 * {@inheritDoc}
	 * @since 2016/10/10
	 */
	@Override
	public void setColor(int __a)
	{
		this.setAlphaColor((__a & 0xFFFFFF) | ((this.getAlpha() & 0xFF) << 24));
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/10/10
	 */
	@Override
	public void setColor(int __a, int __b, int __c)
	{
		this.setAlphaColor(this.getAlpha(), __a, __b, __c);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/10/10
	 */
	@Override
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
	/**
	 * {@inheritDoc}
	 * @since 2016/10/10
	 */
	@Override
	public void setGrayScale(int __a)
	{
		setColor(__a, __a, __a);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/10/10
	 */
	@Override







|







741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
	/**
	 * {@inheritDoc}
	 * @since 2016/10/10
	 */
	@Override
	public void setGrayScale(int __a)
	{
		this.setColor(__a, __a, __a);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/10/10
	 */
	@Override
771
772
773
774
775
776
777
778
779
780
781
782
	public void translate(int __a, int __b)
	{
		Graphics graphics = this._graphics;
		if (graphics != null)
			graphics.translate(__a, __b);
		
		// Store
		this._translatex = getTranslateX();
		this._translatey = getTranslateY();
	}
}








|
|



771
772
773
774
775
776
777
778
779
780
781
782
	public void translate(int __a, int __b)
	{
		Graphics graphics = this._graphics;
		if (graphics != null)
			graphics.translate(__a, __b);
		
		// Store
		this._translatex = this.getTranslateX();
		this._translatey = this.getTranslateY();
	}
}

Name change from runt/apis/midp-lcdui/cc/squirreljme/runtime/lcdui/gfx/GraphicsFunction.java to modules/midp-lcdui/src/main/java/cc/squirreljme/runtime/lcdui/gfx/GraphicsFunction.java.

126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
	 */
	public static GraphicsFunction of(int __id)
		throws IllegalArgumentException
	{
		// Depends
		switch (__id)
		{
			case 0:		return SET_COLOR;
			case 1:		return DRAW_LINE;
			case 2:		return GET_CLIP_X;
			case 3:		return GET_CLIP_Y;
			case 4:		return GET_CLIP_WIDTH;
			case 5:		return GET_CLIP_HEIGHT;
			case 6:		return SET_CLIP;
			case 7:		return DRAW_RECT;
			case 8:		return GET_ALPHA_COLOR;
			case 9:		return SET_ALPHA_COLOR;
			case 10:	return FILL_RECT;
			case 11:	return SET_FONT;
			case 12:	return GET_FONT;
			case 13:	return DRAW_SUB_CHARS;
			case 14:	return DRAW_TEXT;
			case 15:	return GET_STROKE_STYLE;
			case 16:	return SET_STROKE_STYLE;
			case 17:	return COPY_AREA;
			case 18:	return DRAW_ARC;
			case 19:	return DRAW_ARGB16;
			case 20:	return DRAW_CHAR;
			case 21:	return DRAW_CHARS;
			case 22:	return DRAW_RGB;
			case 23:	return DRAW_RGB16;
			case 24:	return DRAW_ROUND_RECT;
			case 25:	return FILL_ARC;
			case 26:	return FILL_ROUND_RECT;
			case 27:	return FILL_TRIANGLE;
			case 28:	return GET_BLENDING_MODE;
			case 29:	return GET_DISPLAY_COLOR;
			case 30:	return SET_BLENDING_MODE;
			case 31:	return DRAW_REGION;
				
				// {@squirreljme.error EB0j Invalid graphics function.
				// (The function ID)}
			default:
				throw new IllegalArgumentException("EB0j " + __id);
		}
	}







|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|







126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
	 */
	public static GraphicsFunction of(int __id)
		throws IllegalArgumentException
	{
		// Depends
		switch (__id)
		{
			case 0:		return GraphicsFunction.SET_COLOR;
			case 1:		return GraphicsFunction.DRAW_LINE;
			case 2:		return GraphicsFunction.GET_CLIP_X;
			case 3:		return GraphicsFunction.GET_CLIP_Y;
			case 4:		return GraphicsFunction.GET_CLIP_WIDTH;
			case 5:		return GraphicsFunction.GET_CLIP_HEIGHT;
			case 6:		return GraphicsFunction.SET_CLIP;
			case 7:		return GraphicsFunction.DRAW_RECT;
			case 8:		return GraphicsFunction.GET_ALPHA_COLOR;
			case 9:		return GraphicsFunction.SET_ALPHA_COLOR;
			case 10:	return GraphicsFunction.FILL_RECT;
			case 11:	return GraphicsFunction.SET_FONT;
			case 12:	return GraphicsFunction.GET_FONT;
			case 13:	return GraphicsFunction.DRAW_SUB_CHARS;
			case 14:	return GraphicsFunction.DRAW_TEXT;
			case 15:	return GraphicsFunction.GET_STROKE_STYLE;
			case 16:	return GraphicsFunction.SET_STROKE_STYLE;
			case 17:	return GraphicsFunction.COPY_AREA;
			case 18:	return GraphicsFunction.DRAW_ARC;
			case 19:	return GraphicsFunction.DRAW_ARGB16;
			case 20:	return GraphicsFunction.DRAW_CHAR;
			case 21:	return GraphicsFunction.DRAW_CHARS;
			case 22:	return GraphicsFunction.DRAW_RGB;
			case 23:	return GraphicsFunction.DRAW_RGB16;
			case 24:	return GraphicsFunction.DRAW_ROUND_RECT;
			case 25:	return GraphicsFunction.FILL_ARC;
			case 26:	return GraphicsFunction.FILL_ROUND_RECT;
			case 27:	return GraphicsFunction.FILL_TRIANGLE;
			case 28:	return GraphicsFunction.GET_BLENDING_MODE;
			case 29:	return GraphicsFunction.GET_DISPLAY_COLOR;
			case 30:	return GraphicsFunction.SET_BLENDING_MODE;
			case 31:	return GraphicsFunction.DRAW_REGION;
				
				// {@squirreljme.error EB0j Invalid graphics function.
				// (The function ID)}
			default:
				throw new IllegalArgumentException("EB0j " + __id);
		}
	}

Name change from runt/apis/midp-lcdui/cc/squirreljme/runtime/lcdui/gfx/PixelFormat.java to modules/midp-lcdui/src/main/java/cc/squirreljme/runtime/lcdui/gfx/PixelFormat.java.

55
56
57
58
59
60
61

62
63
64
65
66
67
68
	
	/**
	 * Creates an array buffer which is capable of containing an image of
	 * the specified size.
	 *
	 * @param __p The buffer pitch.
	 * @param __h The buffer height.

	 * @since 2018/03/28
	 */
	public final Object createBuffer(int __p, int __h)
	{
		// Depends on the format
		int dim = __p * __h;
		switch (this)







>







55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
	
	/**
	 * Creates an array buffer which is capable of containing an image of
	 * the specified size.
	 *
	 * @param __p The buffer pitch.
	 * @param __h The buffer height.
	 * @return The created buffer.
	 * @since 2018/03/28
	 */
	public final Object createBuffer(int __p, int __h)
	{
		// Depends on the format
		int dim = __p * __h;
		switch (this)
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
	 * @since 2018/11/18
	 */
	public static final PixelFormat of(int __id)
		throws IllegalArgumentException
	{
		switch (__id)
		{
			case 0:		return BYTE_INDEXED1;
			case 1:		return BYTE_INDEXED2;
			case 2:		return BYTE_INDEXED4;
			case 3:		return BYTE_INDEXED8;
			case 4:		return BYTE_RGB332;
			case 5:		return SHORT_INDEXED16;
			case 6:		return SHORT_ARGB4444;
			case 7:		return SHORT_RGB565;
			case 8:		return INTEGER_ARGB8888;
			case 9:		return INTEGER_RGB888;
			
				// {@squirreljme.error EB0k Unknown pixel buffer format. (ID)}
			default:
				throw new IllegalArgumentException("EB0k " + __id);
		}
	}
	







|
|
|
|
|
|
|
|
|
|







250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
	 * @since 2018/11/18
	 */
	public static final PixelFormat of(int __id)
		throws IllegalArgumentException
	{
		switch (__id)
		{
			case 0:		return PixelFormat.BYTE_INDEXED1;
			case 1:		return PixelFormat.BYTE_INDEXED2;
			case 2:		return PixelFormat.BYTE_INDEXED4;
			case 3:		return PixelFormat.BYTE_INDEXED8;
			case 4:		return PixelFormat.BYTE_RGB332;
			case 5:		return PixelFormat.SHORT_INDEXED16;
			case 6:		return PixelFormat.SHORT_ARGB4444;
			case 7:		return PixelFormat.SHORT_RGB565;
			case 8:		return PixelFormat.INTEGER_ARGB8888;
			case 9:		return PixelFormat.INTEGER_RGB888;
			
				// {@squirreljme.error EB0k Unknown pixel buffer format. (ID)}
			default:
				throw new IllegalArgumentException("EB0k " + __id);
		}
	}
	
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
	 */
	public static final PixelFormat ofFramebuffer(int __id)
		throws IllegalArgumentException
	{
		switch (__id)
		{
			case Framebuffer.FORMAT_INTEGER_RGB888:
				return INTEGER_RGB888;
			
			case Framebuffer.FORMAT_BYTE_INDEXED:
				return BYTE_INDEXED8;
			
			case Framebuffer.FORMAT_SHORT_RGB565:
				return SHORT_RGB565;
			
			case Framebuffer.FORMAT_PACKED_ONE:
				return BYTE_INDEXED1;
				
			case Framebuffer.FORMAT_PACKED_TWO:
				return BYTE_INDEXED2;
				
			case Framebuffer.FORMAT_PACKED_FOUR:
				return BYTE_INDEXED4;
			
				// {@squirreljme.error EB3a Unknown frame buffer pixel buffer
				// format. (ID}}
			default:
				throw new IllegalArgumentException("EB3a " + __id);
		}
	}
}








|


|


|


|


|


|









281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
	 */
	public static final PixelFormat ofFramebuffer(int __id)
		throws IllegalArgumentException
	{
		switch (__id)
		{
			case Framebuffer.FORMAT_INTEGER_RGB888:
				return PixelFormat.INTEGER_RGB888;
			
			case Framebuffer.FORMAT_BYTE_INDEXED:
				return PixelFormat.BYTE_INDEXED8;
			
			case Framebuffer.FORMAT_SHORT_RGB565:
				return PixelFormat.SHORT_RGB565;
			
			case Framebuffer.FORMAT_PACKED_ONE:
				return PixelFormat.BYTE_INDEXED1;
				
			case Framebuffer.FORMAT_PACKED_TWO:
				return PixelFormat.BYTE_INDEXED2;
				
			case Framebuffer.FORMAT_PACKED_FOUR:
				return PixelFormat.BYTE_INDEXED4;
			
				// {@squirreljme.error EB3a Unknown frame buffer pixel buffer
				// format. (ID}}
			default:
				throw new IllegalArgumentException("EB3a " + __id);
		}
	}
}

Name change from runt/apis/midp-lcdui/cc/squirreljme/runtime/lcdui/gfx/SerializedGraphics.java to modules/midp-lcdui/src/main/java/cc/squirreljme/runtime/lcdui/gfx/SerializedGraphics.java.

Name change from runt/apis/midp-lcdui/cc/squirreljme/runtime/lcdui/gfx/__TextState__.java to modules/midp-lcdui/src/main/java/cc/squirreljme/runtime/lcdui/gfx/__TextState__.java.

Name change from runt/apis/midp-lcdui/cc/squirreljme/runtime/lcdui/gfx/package-info.java to modules/midp-lcdui/src/main/java/cc/squirreljme/runtime/lcdui/gfx/package-info.java.

Name change from runt/apis/midp-lcdui/cc/squirreljme/runtime/lcdui/image/ImageReaderDispatcher.java to modules/midp-lcdui/src/main/java/cc/squirreljme/runtime/lcdui/image/ImageReaderDispatcher.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.lcdui.image;

import java.io.DataInputStream;
import java.io.InputStream;
import java.io.IOException;
import javax.microedition.lcdui.Image;

/**
 * This is used to dispatch to the correct parser when loading images.
 *
 * @since 2017/02/28
 */












|

<







1
2
3
4
5
6
7
8
9
10
11
12
13
14

15
16
17
18
19
20
21
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.lcdui.image;

import java.io.IOException;
import java.io.InputStream;

import javax.microedition.lcdui.Image;

/**
 * This is used to dispatch to the correct parser when loading images.
 *
 * @since 2017/02/28
 */

Name change from runt/apis/midp-lcdui/cc/squirreljme/runtime/lcdui/image/JPEGReader.java to modules/midp-lcdui/src/main/java/cc/squirreljme/runtime/lcdui/image/JPEGReader.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.lcdui.image;

import java.io.DataInputStream;
import java.io.InputStream;
import java.io.IOException;
import javax.microedition.lcdui.Image;

/**
 * This class is used to process JPEG image files.
 *
 * @since 2019/05/06
 */













<







1
2
3
4
5
6
7
8
9
10
11
12
13

14
15
16
17
18
19
20
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.lcdui.image;

import java.io.DataInputStream;
import java.io.InputStream;

import javax.microedition.lcdui.Image;

/**
 * This class is used to process JPEG image files.
 *
 * @since 2019/05/06
 */
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
		this.in = new DataInputStream(__in);
	}
	
	/**
	 * Parses the JPEG.
	 *
	 * @return The resulting image.
	 * @throws IOException On read errors.
	 * @since 2019/05/06
	 */
	public Image parse()
	{
		DataInputStream in = this.in;
		
		todo.TODO.note("Implement JPEG decoding");
		return Image.createRGBImage(new int[16], 4, 4, false);
	}
}








<











39
40
41
42
43
44
45

46
47
48
49
50
51
52
53
54
55
56
		this.in = new DataInputStream(__in);
	}
	
	/**
	 * Parses the JPEG.
	 *
	 * @return The resulting image.

	 * @since 2019/05/06
	 */
	public Image parse()
	{
		DataInputStream in = this.in;
		
		todo.TODO.note("Implement JPEG decoding");
		return Image.createRGBImage(new int[16], 4, 4, false);
	}
}

Name change from runt/apis/midp-lcdui/cc/squirreljme/runtime/lcdui/image/PNGReader.java to modules/midp-lcdui/src/main/java/cc/squirreljme/runtime/lcdui/image/PNGReader.java.

9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.lcdui.image;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
import java.io.InputStream;
import java.io.IOException;
import java.util.Arrays;
import javax.microedition.lcdui.Image;
import net.multiphasicapps.io.ChecksumInputStream;
import net.multiphasicapps.io.CRC32Calculator;
import net.multiphasicapps.io.InflaterInputStream;
import net.multiphasicapps.io.SizeLimitedInputStream;
import net.multiphasicapps.io.ZLibDecompressor;

/**
 * This class parses PNG images.
 *
 * PNG specifications:
 * {@link http://www.libpng.org/pub/png/pngdocs.html}
 * {@link http://www.libpng.org/pub/png/spec/iso/index-object.html}
 * {@link https://www.w3.org/TR/PNG/}
 * {@link https://tools.ietf.org/html/rfc2083}
 *
 * @since 2017/02/28
 */
public class PNGReader
{
	/** The input source. */
	protected final DataInputStream in;







|
|


<

|







|
|
|
|







9
10
11
12
13
14
15
16
17
18
19

20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.lcdui.image;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
import javax.microedition.lcdui.Image;

import net.multiphasicapps.io.CRC32Calculator;
import net.multiphasicapps.io.ChecksumInputStream;
import net.multiphasicapps.io.SizeLimitedInputStream;
import net.multiphasicapps.io.ZLibDecompressor;

/**
 * This class parses PNG images.
 *
 * PNG specifications:
 *  * http://www.libpng.org/pub/png/pngdocs.html
 *  * http://www.libpng.org/pub/png/spec/iso/index-object.html
 *  * https://www.w3.org/TR/PNG/
 *  * https://tools.ietf.org/html/rfc2083
 *
 * @since 2017/02/28
 */
public class PNGReader
{
	/** The input source. */
	protected final DataInputStream in;
96
97
98
99
100
101
102

103
104
105
106
107
108
109
		this.in = new DataInputStream(__in);
	}
	
	/**
	 * Parses the PNG image data.
	 *
	 * @return The read image.

	 * @since 2017/02/28
	 */
	public Image parse()
		throws IOException
	{
		DataInputStream in = this.in;
		







>







95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
		this.in = new DataInputStream(__in);
	}
	
	/**
	 * Parses the PNG image data.
	 *
	 * @return The read image.
	 * @throws IOException On read errors.
	 * @since 2017/02/28
	 */
	public Image parse()
		throws IOException
	{
		DataInputStream in = this.in;
		
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
					break;
				
				// Depends on the type
				switch (type)
				{
						// Header
					case 0x49484452:
						__parseHeader(data);
						break;
						
						// Palette
					case 0x504c5445:
						__parsePalette(data, len);
						break;
						
						// Image data
					case 0x49444154:
						// There may be multiple consecutive IDAT chunks which
						// just continue where the previous one left off, so
						// just smash them together







|




|







150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
					break;
				
				// Depends on the type
				switch (type)
				{
						// Header
					case 0x49484452:
						this.__parseHeader(data);
						break;
						
						// Palette
					case 0x504c5445:
						this.__parsePalette(data, len);
						break;
						
						// Image data
					case 0x49444154:
						// There may be multiple consecutive IDAT chunks which
						// just continue where the previous one left off, so
						// just smash them together

Name change from runt/apis/midp-lcdui/cc/squirreljme/runtime/lcdui/image/XPMReader.java to modules/midp-lcdui/src/main/java/cc/squirreljme/runtime/lcdui/image/XPMReader.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.lcdui.image;

import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.IOException;
import java.io.Reader;
import java.util.Arrays;
import javax.microedition.lcdui.Image;

/**
 * This class is able to read XPM images.
 *












|
|
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.lcdui.image;

import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.util.Arrays;
import javax.microedition.lcdui.Image;

/**
 * This class is able to read XPM images.
 *
33
34
35
36
37
38
39

40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
{
	/** Source stream. */
	protected final InputStream in;
	
	/**
	 * Initializes the XPM image reader.
	 *

	 * @since 2016/05/08
	 */
	public XPMReader(InputStream __is)
		throws NullPointerException
	{
		if (__is == null)
			throw new NullPointerException("NARG");
		
		this.in = __is;
	}
	
	/**
	 * Reads the XPM image data from the specified input stream.
	 *
	 * @param __is The stream to read XPM data from.
	 * @return The read image data.
	 * @throws IOException If the XPM is not valid.
	 * @since 2017/02/10
	 */
	public Image parse()
		throws IOException
	{
		InputStream in = this.in;
		
		// Create character stripper
		__CharStripper__ cs = new __CharStripper__(new InputStreamReader(in,
			"utf-8"));
		
		// Read the XPM header
		int[] header = __readHeader(cs);
		
		// Get dimensional data
		int width = Math.max(header[0], 1);
		int height = Math.max(header[1], 1);
		int numcolors = Math.max(header[2], 1);
		int pxchars = Math.max(header[3], 1);
		int hotx = header[4];
		int hoty = header[5];
		
		// Read the color table
		int[] codes = new int[numcolors];
		int[] palette = new int[numcolors];
		boolean alpha = this.__readColorTable(
			cs, codes, palette, numcolors, pxchars);
		
		// Target array
		int area = width * height;
		int[] data = new int[area];
		
		// Read pixels
		__readPixels(cs, width, height, data, pxchars, codes, palette);
		
		// Create image
		return Image.createRGBImage(data, width, height, alpha);
	}
	
	/**
	 * Decodes a color key value.







>














<














|




















|







33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54

55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
{
	/** Source stream. */
	protected final InputStream in;
	
	/**
	 * Initializes the XPM image reader.
	 *
	 * @param __is The input stream.
	 * @since 2016/05/08
	 */
	public XPMReader(InputStream __is)
		throws NullPointerException
	{
		if (__is == null)
			throw new NullPointerException("NARG");
		
		this.in = __is;
	}
	
	/**
	 * Reads the XPM image data from the specified input stream.
	 *

	 * @return The read image data.
	 * @throws IOException If the XPM is not valid.
	 * @since 2017/02/10
	 */
	public Image parse()
		throws IOException
	{
		InputStream in = this.in;
		
		// Create character stripper
		__CharStripper__ cs = new __CharStripper__(new InputStreamReader(in,
			"utf-8"));
		
		// Read the XPM header
		int[] header = this.__readHeader(cs);
		
		// Get dimensional data
		int width = Math.max(header[0], 1);
		int height = Math.max(header[1], 1);
		int numcolors = Math.max(header[2], 1);
		int pxchars = Math.max(header[3], 1);
		int hotx = header[4];
		int hoty = header[5];
		
		// Read the color table
		int[] codes = new int[numcolors];
		int[] palette = new int[numcolors];
		boolean alpha = this.__readColorTable(
			cs, codes, palette, numcolors, pxchars);
		
		// Target array
		int area = width * height;
		int[] data = new int[area];
		
		// Read pixels
		this.__readPixels(cs, width, height, data, pxchars, codes, palette);
		
		// Create image
		return Image.createRGBImage(data, width, height, alpha);
	}
	
	/**
	 * Decodes a color key value.
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
		
		// Decode the color palette
		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < __numcolors; i++)
		{
			// Read new input string
			sb.setLength(0);
			__readLine(__cs, sb);
			
			// Ignore really short lines
			int n = sb.length();
			if (n < __pxchars)
				continue;
			
			// Set code to the given sequence







|







201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
		
		// Decode the color palette
		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < __numcolors; i++)
		{
			// Read new input string
			sb.setLength(0);
			this.__readLine(__cs, sb);
			
			// Ignore really short lines
			int n = sb.length();
			if (n < __pxchars)
				continue;
			
			// Set code to the given sequence
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
			while (s >= __pxchars && sb.charAt(s) > ' ')
			{
				s--;
				continue;
			}
			
			// Decode color, detect if there is a transparent pixel
			int col = __decodeColor(sb.subSequence(s + 1, e + 1));
			if ((col & 0xFF_000000) != 0xFF_000000)
				hasalpha = true;
			
			// Find the position to place the code at
			int at = Arrays.binarySearch(__codes, 0, i, cx);
			if (at < 0)
				at = -(at + 1);







|







232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
			while (s >= __pxchars && sb.charAt(s) > ' ')
			{
				s--;
				continue;
			}
			
			// Decode color, detect if there is a transparent pixel
			int col = this.__decodeColor(sb.subSequence(s + 1, e + 1));
			if ((col & 0xFF_000000) != 0xFF_000000)
				hasalpha = true;
			
			// Find the position to place the code at
			int at = Arrays.binarySearch(__codes, 0, i, cx);
			if (at < 0)
				at = -(at + 1);
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
	 */
	private int[] __readHeader(Reader __r)
		throws IOException
	{
		// Read XPM header
		int[] header = new int[7];
		for (int i = 0;; i++)
			if (__readInt(__r, header, Math.min(6, i)))
				break;
		
		// Return it
		return header;
	}
	
	/**







|







271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
	 */
	private int[] __readHeader(Reader __r)
		throws IOException
	{
		// Read XPM header
		int[] header = new int[7];
		for (int i = 0;; i++)
			if (this.__readInt(__r, header, Math.min(6, i)))
				break;
		
		// Return it
		return header;
	}
	
	/**
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
				// the parsing speed slightly.
				if (code == lastcode)
					__data[z++] = lastpall;
				
				// Find the code used
				else
				{
					lastpall = __locateCode((lastcode = code), __codes,
						__palette);
					__data[z++] = lastpall;
				}
			}
	}
}








|







422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
				// the parsing speed slightly.
				if (code == lastcode)
					__data[z++] = lastpall;
				
				// Find the code used
				else
				{
					lastpall = this.__locateCode((lastcode = code), __codes,
						__palette);
					__data[z++] = lastpall;
				}
			}
	}
}

Name change from runt/apis/midp-lcdui/cc/squirreljme/runtime/lcdui/image/__CharStripper__.java to modules/midp-lcdui/src/main/java/cc/squirreljme/runtime/lcdui/image/__CharStripper__.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.lcdui.image;

import java.io.InputStream;
import java.io.IOException;
import java.io.Reader;

/**
 * This is a character stripper which is used to remove C/C++ comments and
 * return the series of strings between curly braces. This does not perform
 * tokenization to remain as simple and as fast as possible, so XPM images












<







1
2
3
4
5
6
7
8
9
10
11
12

13
14
15
16
17
18
19
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.lcdui.image;


import java.io.IOException;
import java.io.Reader;

/**
 * This is a character stripper which is used to remove C/C++ comments and
 * return the series of strings between curly braces. This does not perform
 * tokenization to remain as simple and as fast as possible, so XPM images
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
					}
					
					// String separator
					else if (c == ',')
					{
						// If in a bracket, return a special code
						if (this._inbracket)
							return END_OF_LINE;
						
						// Otherwise, ignore it
						continue;
					}
					
					// Unknown, ignore
					else







|







271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
					}
					
					// String separator
					else if (c == ',')
					{
						// If in a bracket, return a special code
						if (this._inbracket)
							return __CharStripper__.END_OF_LINE;
						
						// Otherwise, ignore it
						continue;
					}
					
					// Unknown, ignore
					else
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
		synchronized (this.lock)
		{
			// Read loop
			for (int i = 0; i < __l; i++)
				try
				{
					// Read single character
					int c = read();
				
					// EOF?
					if (c < 0)
						return (i > 0 ? i : -1);
				
					// Set
					__b[__o + i] = (char)c;







|







307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
		synchronized (this.lock)
		{
			// Read loop
			for (int i = 0; i < __l; i++)
				try
				{
					// Read single character
					int c = this.read();
				
					// EOF?
					if (c < 0)
						return (i > 0 ? i : -1);
				
					// Set
					__b[__o + i] = (char)c;

Name change from runt/apis/midp-lcdui/cc/squirreljme/runtime/lcdui/image/package-info.java to modules/midp-lcdui/src/main/java/cc/squirreljme/runtime/lcdui/image/package-info.java.

Name change from runt/apis/midp-lcdui/cc/squirreljme/runtime/lcdui/package-info.java to modules/midp-lcdui/src/main/java/cc/squirreljme/runtime/lcdui/package-info.java.

Name change from runt/apis/midp-lcdui/cc/squirreljme/runtime/lcdui/phoneui/ActionMethod.java to modules/midp-lcdui/src/main/java/cc/squirreljme/runtime/lcdui/phoneui/ActionMethod.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.lcdui.phoneui;

import cc.squirreljme.runtime.cldc.asm.NativeDisplayEventCallback;
import cc.squirreljme.runtime.lcdui.event.EventTranslate;
import cc.squirreljme.runtime.lcdui.event.KeyNames;
import cc.squirreljme.runtime.lcdui.event.NonStandardKey;
import javax.microedition.lcdui.Alert;
import javax.microedition.lcdui.Canvas;
import javax.microedition.lcdui.Choice;
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.FileSelector;
import javax.microedition.lcdui.Font;
import javax.microedition.lcdui.Form;
import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;
import javax.microedition.lcdui.List;
import javax.microedition.lcdui.TabbedPane;
import javax.microedition.lcdui.TextBox;

/**
 * This represents an action method which when a key is pressed or similar
 * then something is done.













<






<


<

<
<







1
2
3
4
5
6
7
8
9
10
11
12
13

14
15
16
17
18
19

20
21

22


23
24
25
26
27
28
29
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.lcdui.phoneui;

import cc.squirreljme.runtime.cldc.asm.NativeDisplayEventCallback;
import cc.squirreljme.runtime.lcdui.event.EventTranslate;

import cc.squirreljme.runtime.lcdui.event.NonStandardKey;
import javax.microedition.lcdui.Alert;
import javax.microedition.lcdui.Canvas;
import javax.microedition.lcdui.Choice;
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;

import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.FileSelector;

import javax.microedition.lcdui.Form;


import javax.microedition.lcdui.List;
import javax.microedition.lcdui.TabbedPane;
import javax.microedition.lcdui.TextBox;

/**
 * This represents an action method which when a key is pressed or similar
 * then something is done.
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
	 * @throws NullPointerException On null arguments.
	 * @since 2019/05/18
	 */
	public static final ActionMethod of(Class<?> __cl)
		throws NullPointerException
	{
		if (Alert.class.isAssignableFrom(__cl))
			return ALERT;
		else if (Canvas.class.isAssignableFrom(__cl))
			return CANVAS;
		else if (FileSelector.class.isAssignableFrom(__cl))
			return FILE_SELECTOR;
		else if (Form.class.isAssignableFrom(__cl))
			return FORM;
		else if (List.class.isAssignableFrom(__cl))
			return LIST;
		else if (TabbedPane.class.isAssignableFrom(__cl))
			return TABBED_PANE;
		else if (TextBox.class.isAssignableFrom(__cl))
			return TEXT_BOX;
		
		// {@squirreljme.error EB17 Could not get the action method of the
		// given class. (The class)}
		throw new IllegalArgumentException("EB17 " + __cl);
	}
}








|

|

|

|

|

|

|







305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
	 * @throws NullPointerException On null arguments.
	 * @since 2019/05/18
	 */
	public static final ActionMethod of(Class<?> __cl)
		throws NullPointerException
	{
		if (Alert.class.isAssignableFrom(__cl))
			return ActionMethod.ALERT;
		else if (Canvas.class.isAssignableFrom(__cl))
			return ActionMethod.CANVAS;
		else if (FileSelector.class.isAssignableFrom(__cl))
			return ActionMethod.FILE_SELECTOR;
		else if (Form.class.isAssignableFrom(__cl))
			return ActionMethod.FORM;
		else if (List.class.isAssignableFrom(__cl))
			return ActionMethod.LIST;
		else if (TabbedPane.class.isAssignableFrom(__cl))
			return ActionMethod.TABBED_PANE;
		else if (TextBox.class.isAssignableFrom(__cl))
			return ActionMethod.TEXT_BOX;
		
		// {@squirreljme.error EB17 Could not get the action method of the
		// given class. (The class)}
		throw new IllegalArgumentException("EB17 " + __cl);
	}
}

Name change from runt/apis/midp-lcdui/cc/squirreljme/runtime/lcdui/phoneui/ActiveDisplay.java to modules/midp-lcdui/src/main/java/cc/squirreljme/runtime/lcdui/phoneui/ActiveDisplay.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.lcdui.phoneui;

import cc.squirreljme.runtime.cldc.asm.NativeDisplayEventCallback;
import cc.squirreljme.runtime.cldc.SquirrelJME;
import cc.squirreljme.runtime.lcdui.event.NonStandardKey;
import cc.squirreljme.runtime.lcdui.gfx.EnforcedDrawingAreaGraphics;
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.Font;
import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;
import javax.microedition.lcdui.Text;
import javax.microedition.lcdui.Ticker;
import java.util.Arrays;

/**
 * This contains the display display along with the internal image buffer.
 *
 * @since 2019/05/16
 */
public final class ActiveDisplay











|
|







<


<







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

21
22

23
24
25
26
27
28
29
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.lcdui.phoneui;

import cc.squirreljme.runtime.cldc.SquirrelJME;
import cc.squirreljme.runtime.cldc.asm.NativeDisplayEventCallback;
import cc.squirreljme.runtime.lcdui.event.NonStandardKey;
import cc.squirreljme.runtime.lcdui.gfx.EnforcedDrawingAreaGraphics;
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.Font;
import javax.microedition.lcdui.Graphics;

import javax.microedition.lcdui.Text;
import javax.microedition.lcdui.Ticker;


/**
 * This contains the display display along with the internal image buffer.
 *
 * @since 2019/05/16
 */
public final class ActiveDisplay
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
		// Otherwise just terminate the application
		System.exit(0);
	}
	
	/**
	 * Key action has been performed.
	 *
	 * @param __d The display ID.
	 * @param __ty The type of key event.
	 * @param __kc The key code.
	 * @param __ch The key character, {@code -1} is not valid.
	 * @param __time Timecode.
	 * @return If the display should be repainted.
	 * @since 2019/05/18
	 */







<







175
176
177
178
179
180
181

182
183
184
185
186
187
188
		// Otherwise just terminate the application
		System.exit(0);
	}
	
	/**
	 * Key action has been performed.
	 *

	 * @param __ty The type of key event.
	 * @param __kc The key code.
	 * @param __ch The key character, {@code -1} is not valid.
	 * @param __time Timecode.
	 * @return If the display should be repainted.
	 * @since 2019/05/18
	 */

Name change from runt/apis/midp-lcdui/cc/squirreljme/runtime/lcdui/phoneui/DrawingItemMethod.java to modules/midp-lcdui/src/main/java/cc/squirreljme/runtime/lcdui/phoneui/DrawingItemMethod.java.

166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
	 * Paints the method.
	 *
	 * @param __d The displayable to be drawn.
	 * @param __i The item to draw.
	 * @param __s The draw state.
	 * @param __g The graphics to draw to.
	 * @param __x The X position.
	 * @param __h The Y position.
	 * @param __w The item width.
	 * @param __h The item height.
	 * @param __enb Is this enabled?
	 * @param __sel Is this selected?
	 * @since 2019/12/09
	 */
	public abstract void paint(Displayable __d, Item __i, State __s,







|







166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
	 * Paints the method.
	 *
	 * @param __d The displayable to be drawn.
	 * @param __i The item to draw.
	 * @param __s The draw state.
	 * @param __g The graphics to draw to.
	 * @param __x The X position.
	 * @param __y The Y position.
	 * @param __w The item width.
	 * @param __h The item height.
	 * @param __enb Is this enabled?
	 * @param __sel Is this selected?
	 * @since 2019/12/09
	 */
	public abstract void paint(Displayable __d, Item __i, State __s,
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
	 * @throws NullPointerException On null arguments.
	 * @since 2019/12/09
	 */
	public static final DrawingItemMethod of(Class<?> __cl)
		throws NullPointerException
	{
		if (ChoiceGroup.class.isAssignableFrom(__cl))
			return CHOICE_GROUP;
		else if (CustomItem.class.isAssignableFrom(__cl))
			return CUSTOM_ITEM;
		else if (DateField.class.isAssignableFrom(__cl))
			return DATE_FIELD;
		else if (Gauge.class.isAssignableFrom(__cl))
			return GAUGE;
		else if (ImageItem.class.isAssignableFrom(__cl))
			return IMAGE_ITEM;
		else if (Spacer.class.isAssignableFrom(__cl))
			return SPACER;
		else if (StringItem.class.isAssignableFrom(__cl))
			return STRING_ITEM;
		else if (TextField.class.isAssignableFrom(__cl))
			return TEXT_FIELD;
		
		// {@squirreljme.error EB39 Could not get the item drawing method of
		// the given class. (The class)}
		throw new IllegalArgumentException("EB39 " + __cl);
	}
}








|

|

|

|

|

|

|

|







189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
	 * @throws NullPointerException On null arguments.
	 * @since 2019/12/09
	 */
	public static final DrawingItemMethod of(Class<?> __cl)
		throws NullPointerException
	{
		if (ChoiceGroup.class.isAssignableFrom(__cl))
			return DrawingItemMethod.CHOICE_GROUP;
		else if (CustomItem.class.isAssignableFrom(__cl))
			return DrawingItemMethod.CUSTOM_ITEM;
		else if (DateField.class.isAssignableFrom(__cl))
			return DrawingItemMethod.DATE_FIELD;
		else if (Gauge.class.isAssignableFrom(__cl))
			return DrawingItemMethod.GAUGE;
		else if (ImageItem.class.isAssignableFrom(__cl))
			return DrawingItemMethod.IMAGE_ITEM;
		else if (Spacer.class.isAssignableFrom(__cl))
			return DrawingItemMethod.SPACER;
		else if (StringItem.class.isAssignableFrom(__cl))
			return DrawingItemMethod.STRING_ITEM;
		else if (TextField.class.isAssignableFrom(__cl))
			return DrawingItemMethod.TEXT_FIELD;
		
		// {@squirreljme.error EB39 Could not get the item drawing method of
		// the given class. (The class)}
		throw new IllegalArgumentException("EB39 " + __cl);
	}
}

Name change from runt/apis/midp-lcdui/cc/squirreljme/runtime/lcdui/phoneui/DrawingMethod.java to modules/midp-lcdui/src/main/java/cc/squirreljme/runtime/lcdui/phoneui/DrawingMethod.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.lcdui.phoneui;

import javax.microedition.lcdui.Alert;
import javax.microedition.lcdui.Canvas;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.FileSelector;
import javax.microedition.lcdui.Font;
import javax.microedition.lcdui.Form;
import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;
import javax.microedition.lcdui.Item;













<







1
2
3
4
5
6
7
8
9
10
11
12
13

14
15
16
17
18
19
20
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.lcdui.phoneui;

import javax.microedition.lcdui.Alert;
import javax.microedition.lcdui.Canvas;

import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.FileSelector;
import javax.microedition.lcdui.Font;
import javax.microedition.lcdui.Form;
import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;
import javax.microedition.lcdui.Item;
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
	 * @throws NullPointerException On null arguments.
	 * @since 2019/05/18
	 */
	public static final DrawingMethod of(Class<?> __cl)
		throws NullPointerException
	{
		if (Alert.class.isAssignableFrom(__cl))
			return ALERT;
		else if (Canvas.class.isAssignableFrom(__cl))
			return CANVAS;
		else if (FileSelector.class.isAssignableFrom(__cl))
			return FILE_SELECTOR;
		else if (Form.class.isAssignableFrom(__cl))
			return FORM;
		else if (List.class.isAssignableFrom(__cl))
			return LIST;
		else if (TabbedPane.class.isAssignableFrom(__cl))
			return TABBED_PANE;
		else if (TextBox.class.isAssignableFrom(__cl))
			return TEXT_BOX;
		
		// {@squirreljme.error EB18 Could not get the drawing method of the
		// given class. (The class)}
		throw new IllegalArgumentException("EB18 " + __cl);
	}
}








|

|

|

|

|

|

|







288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
	 * @throws NullPointerException On null arguments.
	 * @since 2019/05/18
	 */
	public static final DrawingMethod of(Class<?> __cl)
		throws NullPointerException
	{
		if (Alert.class.isAssignableFrom(__cl))
			return DrawingMethod.ALERT;
		else if (Canvas.class.isAssignableFrom(__cl))
			return DrawingMethod.CANVAS;
		else if (FileSelector.class.isAssignableFrom(__cl))
			return DrawingMethod.FILE_SELECTOR;
		else if (Form.class.isAssignableFrom(__cl))
			return DrawingMethod.FORM;
		else if (List.class.isAssignableFrom(__cl))
			return DrawingMethod.LIST;
		else if (TabbedPane.class.isAssignableFrom(__cl))
			return DrawingMethod.TABBED_PANE;
		else if (TextBox.class.isAssignableFrom(__cl))
			return DrawingMethod.TEXT_BOX;
		
		// {@squirreljme.error EB18 Could not get the drawing method of the
		// given class. (The class)}
		throw new IllegalArgumentException("EB18 " + __cl);
	}
}

Name change from runt/apis/midp-lcdui/cc/squirreljme/runtime/lcdui/phoneui/ExposedDisplayable.java to modules/midp-lcdui/src/main/java/cc/squirreljme/runtime/lcdui/phoneui/ExposedDisplayable.java.

1
2
3
4
5
6
7
8
9
10
11
12

13
14
15
16
17
18
19
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.lcdui.phoneui;

import cc.squirreljme.runtime.lcdui.SerializedEvent;

import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Ticker;

/**
 * This is a base class for items which need to be exposed action wise and












>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.lcdui.phoneui;

import cc.squirreljme.runtime.lcdui.SerializedEvent;
import javax.microedition.lcdui.Canvas;
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Ticker;

/**
 * This is a base class for items which need to be exposed action wise and
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
	}
	
	/**
	 * This is called when the pointer is being dragged across the canvas, a
	 * drag is when there is movement 
	 *
	 * This requires that motion events are supported which can be known by
	 * calling {@link #hasPointerMotionEvents()}.
	 *
	 * @param __x The X coordinate of the pointer, on the canvas origin.
	 * @param __y The Y coordinate of the pointer, on the canvas origin.
	 * @since 2017/02/12
	 */
	@SerializedEvent
	protected void pointerDragged(int __x, int __y)
	{
		// Does nothing by default
	}
	
	/**
	 * This is called when the pointer has been pressed on the canvas.
	 *
	 * This requires that pointer events are supported which can be known by
	 * calling {@link #hasPointerEvents()}.
	 *
	 * @param __x The X coordinate of the pointer, on the canvas origin.
	 * @param __y The Y coordinate of the pointer, on the canvas origin.
	 * @since 2019/05/18
	 */
	@SerializedEvent
	protected void pointerPressed(int __x, int __y)
	{
		// Does nothing by default
	}
	
	/**
	 * This is called when the pointer has been released on the canvas.
	 *
	 * This requires that pointer events are supported which can be known by
	 * calling {@link #hasPointerEvents()}.
	 *
	 * @param __x The X coordinate of the pointer, on the canvas origin.
	 * @param __y The Y coordinate of the pointer, on the canvas origin.
	 * @since 2019/05/18
	 */
	@SerializedEvent
	protected void pointerReleased(int __x, int __y)







|















|















|







129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
	}
	
	/**
	 * This is called when the pointer is being dragged across the canvas, a
	 * drag is when there is movement 
	 *
	 * This requires that motion events are supported which can be known by
	 * calling {@link Canvas#hasPointerMotionEvents()}.
	 *
	 * @param __x The X coordinate of the pointer, on the canvas origin.
	 * @param __y The Y coordinate of the pointer, on the canvas origin.
	 * @since 2017/02/12
	 */
	@SerializedEvent
	protected void pointerDragged(int __x, int __y)
	{
		// Does nothing by default
	}
	
	/**
	 * This is called when the pointer has been pressed on the canvas.
	 *
	 * This requires that pointer events are supported which can be known by
	 * calling {@link Canvas#hasPointerEvents()}.
	 *
	 * @param __x The X coordinate of the pointer, on the canvas origin.
	 * @param __y The Y coordinate of the pointer, on the canvas origin.
	 * @since 2019/05/18
	 */
	@SerializedEvent
	protected void pointerPressed(int __x, int __y)
	{
		// Does nothing by default
	}
	
	/**
	 * This is called when the pointer has been released on the canvas.
	 *
	 * This requires that pointer events are supported which can be known by
	 * calling {@link Canvas#hasPointerEvents()}.
	 *
	 * @param __x The X coordinate of the pointer, on the canvas origin.
	 * @param __y The Y coordinate of the pointer, on the canvas origin.
	 * @since 2019/05/18
	 */
	@SerializedEvent
	protected void pointerReleased(int __x, int __y)

Name change from runt/apis/midp-lcdui/cc/squirreljme/runtime/lcdui/phoneui/NativeUIBackend.java to modules/midp-lcdui/src/main/java/cc/squirreljme/runtime/lcdui/phoneui/NativeUIBackend.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.lcdui.phoneui;

import cc.squirreljme.jvm.Assembly;
import cc.squirreljme.jvm.Framebuffer;
import cc.squirreljme.jvm.SystemCallIndex;
import cc.squirreljme.jvm.SystemCallError;
import cc.squirreljme.runtime.cldc.asm.NativeDisplayAccess;
import cc.squirreljme.runtime.cldc.asm.NativeDisplayEventCallback;
import cc.squirreljme.runtime.lcdui.event.NonStandardKey;
import cc.squirreljme.runtime.lcdui.ExtendedCapabilities;
import cc.squirreljme.runtime.lcdui.gfx.AcceleratedGraphics;
import cc.squirreljme.runtime.lcdui.gfx.EnforcedDrawingAreaGraphics;
import cc.squirreljme.runtime.lcdui.gfx.PixelFormat;
import javax.microedition.lcdui.Canvas;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;

/**
 * This is a backend which utilizes the SquirrelJME UI interface for all of
 * the related drawing applications.
 *
 * @since 2019/05/16
 */













|
|


<


<

<

<

<







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

18
19

20

21

22

23
24
25
26
27
28
29
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.lcdui.phoneui;

import cc.squirreljme.jvm.Assembly;
import cc.squirreljme.jvm.Framebuffer;
import cc.squirreljme.jvm.SystemCallError;
import cc.squirreljme.jvm.SystemCallIndex;
import cc.squirreljme.runtime.cldc.asm.NativeDisplayAccess;
import cc.squirreljme.runtime.cldc.asm.NativeDisplayEventCallback;

import cc.squirreljme.runtime.lcdui.ExtendedCapabilities;
import cc.squirreljme.runtime.lcdui.gfx.AcceleratedGraphics;

import cc.squirreljme.runtime.lcdui.gfx.PixelFormat;

import javax.microedition.lcdui.Display;

import javax.microedition.lcdui.Graphics;


/**
 * This is a backend which utilizes the SquirrelJME UI interface for all of
 * the related drawing applications.
 *
 * @since 2019/05/16
 */
165
166
167
168
169
170
171

172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
	}
	
	/**
	 * Returns the native display graphics.
	 *
	 * @param __a Output boolean if this is accelerated.
	 * @param __dims Screen dimensions.

	 * @since 2019/05/16
	 */
	public final Graphics graphics(boolean[] __a, int[] __dims)
		throws NullPointerException
	{
		if (__dims == null)
			throw new NullPointerException("NARG");
		
		if (true)
			throw new todo.TODO();
		
		// Read width and height
		int[] params = NativeDisplayAccess.framebufferParameters(nid);
		int width = params[NativeDisplayAccess.PARAMETER_BUFFERWIDTH];
		int height = params[NativeDisplayAccess.PARAMETER_BUFFERHEIGHT];
		
		// Set
		__dims[0] = width;
		__dims[1] = height;
		
		// Remember size
		this._width = width;
		this._height = height;
		
		// If acceleration is enabled, try to get accelerated graphics
		int nid = this.nid;
		if (USE_ACCELERATION)
			try
			{
				// Try to get it
				Graphics rv = AcceleratedGraphics.instance();
				
				// Set acceleration flag
				if (__a != null && __a.length > 1)







>












|













|







160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
	}
	
	/**
	 * Returns the native display graphics.
	 *
	 * @param __a Output boolean if this is accelerated.
	 * @param __dims Screen dimensions.
	 * @return The graphics for this backend.
	 * @since 2019/05/16
	 */
	public final Graphics graphics(boolean[] __a, int[] __dims)
		throws NullPointerException
	{
		if (__dims == null)
			throw new NullPointerException("NARG");
		
		if (true)
			throw new todo.TODO();
		
		// Read width and height
		int[] params = NativeDisplayAccess.framebufferParameters(this.nid);
		int width = params[NativeDisplayAccess.PARAMETER_BUFFERWIDTH];
		int height = params[NativeDisplayAccess.PARAMETER_BUFFERHEIGHT];
		
		// Set
		__dims[0] = width;
		__dims[1] = height;
		
		// Remember size
		this._width = width;
		this._height = height;
		
		// If acceleration is enabled, try to get accelerated graphics
		int nid = this.nid;
		if (NativeUIBackend.USE_ACCELERATION)
			try
			{
				// Try to get it
				Graphics rv = AcceleratedGraphics.instance();
				
				// Set acceleration flag
				if (__a != null && __a.length > 1)

Name change from runt/apis/midp-lcdui/cc/squirreljme/runtime/lcdui/phoneui/PhoneDisplayBackend.java to modules/midp-lcdui/src/main/java/cc/squirreljme/runtime/lcdui/phoneui/PhoneDisplayBackend.java.

22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
	/**
	 * Activates the display.
	 *
	 * @param __ad The active display to draw into.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/05/16
	 */
	public abstract void activate(ActiveDisplay __ad)
		throws NullPointerException;
	
	/**
	 * Returns the capabilities of the display.
	 *
	 * @return The display capabilities.
	 * @since 2019/05/17
	 */
	public abstract int capabilities();
	
	/**
	 * Returns if the display is upside-down, this is used for orientation
	 * purposes.
	 *
	 * @return If the display is upside-down.
	 * @since 2019/05/16
	 */
	public abstract boolean isUpsidedown();
	
	/**
	 * Returns the pixel format of the display.
	 *
	 * @return The display pixel format.
	 * @since 2019/05/16
	 */
	public abstract PixelFormat pixelFormat();
	
	/**
	 * Specifies that the display should be repainted now.
	 *
	 * @param __x The X coordinate.
	 * @param __y The Y coordinate.
	 * @param __w The width.
	 * @param __h The height.
	 * @since 2019/05/16
	 */
	public abstract void repaint(int __x, int __y, int __w, int __h);
}








|








|








|







|










|


22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
	/**
	 * Activates the display.
	 *
	 * @param __ad The active display to draw into.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/05/16
	 */
	void activate(ActiveDisplay __ad)
		throws NullPointerException;
	
	/**
	 * Returns the capabilities of the display.
	 *
	 * @return The display capabilities.
	 * @since 2019/05/17
	 */
	int capabilities();
	
	/**
	 * Returns if the display is upside-down, this is used for orientation
	 * purposes.
	 *
	 * @return If the display is upside-down.
	 * @since 2019/05/16
	 */
	boolean isUpsidedown();
	
	/**
	 * Returns the pixel format of the display.
	 *
	 * @return The display pixel format.
	 * @since 2019/05/16
	 */
	PixelFormat pixelFormat();
	
	/**
	 * Specifies that the display should be repainted now.
	 *
	 * @param __x The X coordinate.
	 * @param __y The Y coordinate.
	 * @param __w The width.
	 * @param __h The height.
	 * @since 2019/05/16
	 */
	void repaint(int __x, int __y, int __w, int __h);
}

Name change from runt/apis/midp-lcdui/cc/squirreljme/runtime/lcdui/phoneui/PhoneUI.java to modules/midp-lcdui/src/main/java/cc/squirreljme/runtime/lcdui/phoneui/PhoneUI.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.lcdui.phoneui;

import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;

/**
 * This class contains the definition and holders for the phone based user
 * interface.
 *
 * @since 2019/05/16
 */












<
<







1
2
3
4
5
6
7
8
9
10
11
12


13
14
15
16
17
18
19
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.lcdui.phoneui;

import javax.microedition.lcdui.Displayable;



/**
 * This class contains the definition and holders for the phone based user
 * interface.
 *
 * @since 2019/05/16
 */
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
	 * @param __b The display backend to use.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/05/16
	 */
	public PhoneUI(PhoneDisplayBackend __b)
		throws NullPointerException
	{
		this(__b, DEFAULT_SCREEN_WIDTH, DEFAULT_SCREEN_HEIGHT);
	}
	
	/**
	 * Initializes the UI with the given screen width and height.
	 *
	 * @param __b The display backend to use.
	 * @param __sw The screen width.
	 * @param __sh The screen height.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/05/15
	 */
	public PhoneUI(PhoneDisplayBackend __b, int __sw, int __sh)
		throws NullPointerException
	{
		if (__b == null)
			throw new NullPointerException("NARG");
		
		this.backend = __b;
		this.width = (__sw = (__sw <= 0 ? DEFAULT_SCREEN_WIDTH : __sw));
		this.height = (__sh = (__sh <= 0 ? DEFAULT_SCREEN_HEIGHT : __sh));
		
		// Set active display
		ActiveDisplay activedisplay = new ActiveDisplay(__sw, __sh);
		this.activedisplay = activedisplay;
	}
	
	/**







|


















|
|







56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
	 * @param __b The display backend to use.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/05/16
	 */
	public PhoneUI(PhoneDisplayBackend __b)
		throws NullPointerException
	{
		this(__b, PhoneUI.DEFAULT_SCREEN_WIDTH, PhoneUI.DEFAULT_SCREEN_HEIGHT);
	}
	
	/**
	 * Initializes the UI with the given screen width and height.
	 *
	 * @param __b The display backend to use.
	 * @param __sw The screen width.
	 * @param __sh The screen height.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/05/15
	 */
	public PhoneUI(PhoneDisplayBackend __b, int __sw, int __sh)
		throws NullPointerException
	{
		if (__b == null)
			throw new NullPointerException("NARG");
		
		this.backend = __b;
		this.width = (__sw = (__sw <= 0 ? PhoneUI.DEFAULT_SCREEN_WIDTH : __sw));
		this.height = (__sh = (__sh <= 0 ? PhoneUI.DEFAULT_SCREEN_HEIGHT : __sh));
		
		// Set active display
		ActiveDisplay activedisplay = new ActiveDisplay(__sw, __sh);
		this.activedisplay = activedisplay;
	}
	
	/**

Name change from runt/apis/midp-lcdui/cc/squirreljme/runtime/lcdui/phoneui/StandardMetrics.java to modules/midp-lcdui/src/main/java/cc/squirreljme/runtime/lcdui/phoneui/StandardMetrics.java.

19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
public final class StandardMetrics
{
	/** UI Font size. */
	public static final byte UI_FONT_SIZE =
		16;
	
	/** Height of the title bar. */
	public static final int TITLE_BAR_HEIGHT =
		UI_FONT_SIZE;
	
	/** Height of the command bar. */
	public static final int COMMAND_BAR_HEIGHT =
		UI_FONT_SIZE;
	
	/** The background bar color. */
	public static final int BACKGROUND_BAR_COLOR =
		0xFF_000000;
	
	/** The foreground bar color. */
	public static final int FOREGROUND_BAR_COLOR =
		0xFF_FFFFFF;
	
	/** Transparent background color. */
	public static final int TRANSPARENT_COLOR =
		0xFF_FFFFFF;
	
	/** Vibration symbol color. */
	public static final int VIBRATE_COLOR =
		0xFF_FF00FF;
	
	/** Height of the ticker bar. */
	public static final int TICKER_BAR_HEIGHT =
		UI_FONT_SIZE;
	
	/** Background color of the ticker bar. */
	public static final int BACKGROUND_TICKER_COLOR =
		0xFF_A6F6FF;
	
	/** Foreground color of the ticker bar. */
	public static final int FOREGROUND_TICKER_COLOR =
		0xFF_000000;
	
	/** The font used for list items. */
	public static final String LIST_ITEM_FONT =
		"sansserif";
	
	/** The height of list items. */
	public static final int LIST_ITEM_HEIGHT =
		UI_FONT_SIZE;
	
	/** Enabled normal foreground. */
	public static final int ENABLED_NORMAL_FOREGROUND =
		0xFF_000000;
	
	/** Enabled normal background. */
	public static final int ENABLED_NORMAL_BACKGROUND =







|
<


|
<


















|
<














|
<







19
20
21
22
23
24
25
26

27
28
29

30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48

49
50
51
52
53
54
55
56
57
58
59
60
61
62
63

64
65
66
67
68
69
70
public final class StandardMetrics
{
	/** UI Font size. */
	public static final byte UI_FONT_SIZE =
		16;
	
	/** Height of the title bar. */
	public static final int TITLE_BAR_HEIGHT = StandardMetrics.UI_FONT_SIZE;

	
	/** Height of the command bar. */
	public static final int COMMAND_BAR_HEIGHT = StandardMetrics.UI_FONT_SIZE;

	
	/** The background bar color. */
	public static final int BACKGROUND_BAR_COLOR =
		0xFF_000000;
	
	/** The foreground bar color. */
	public static final int FOREGROUND_BAR_COLOR =
		0xFF_FFFFFF;
	
	/** Transparent background color. */
	public static final int TRANSPARENT_COLOR =
		0xFF_FFFFFF;
	
	/** Vibration symbol color. */
	public static final int VIBRATE_COLOR =
		0xFF_FF00FF;
	
	/** Height of the ticker bar. */
	public static final int TICKER_BAR_HEIGHT = StandardMetrics.UI_FONT_SIZE;

	
	/** Background color of the ticker bar. */
	public static final int BACKGROUND_TICKER_COLOR =
		0xFF_A6F6FF;
	
	/** Foreground color of the ticker bar. */
	public static final int FOREGROUND_TICKER_COLOR =
		0xFF_000000;
	
	/** The font used for list items. */
	public static final String LIST_ITEM_FONT =
		"sansserif";
	
	/** The height of list items. */
	public static final int LIST_ITEM_HEIGHT = StandardMetrics.UI_FONT_SIZE;

	
	/** Enabled normal foreground. */
	public static final int ENABLED_NORMAL_FOREGROUND =
		0xFF_000000;
	
	/** Enabled normal background. */
	public static final int ENABLED_NORMAL_BACKGROUND =
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169

170
171
172
173
	 * @return The color to use.
	 * @since 2019/05/18
	 */
	public static final int itemBackgroundColor(boolean __en, boolean __sl)
	{
		if (__en)
			if (__sl)
				return ENABLED_SELECTED_BACKGROUND;
			else
				return ENABLED_NORMAL_BACKGROUND;
		else
			if (__sl)
				return DISABLED_SELECTED_BACKGROUND;
			else
				return DISABLED_NORMAL_BACKGROUND;
	}
	
	/**
	 * Returns the foreground color.
	 *
	 * @param __en Is this enabled?
	 * @param __sl Is this selected?
	 * @return The color to use.
	 * @since 2019/05/18
	 */
	public static final int itemForegroundColor(boolean __en, boolean __sl)
	{
		if (__en)
			if (__sl)
				return ENABLED_SELECTED_FOREGROUND;
			else
				return ENABLED_NORMAL_FOREGROUND;
		else
			if (__sl)
				return DISABLED_SELECTED_FOREGROUND;
			else
				return DISABLED_NORMAL_FOREGROUND;
	}
	
	/**
	 * Returns the item label font.
	 *
	 * @return The item label font.
	 * @since 2019/12/09
	 */
	public static final Font itemLabelFont()
	{

		return Font.getFont(LIST_ITEM_FONT, 0, LIST_ITEM_HEIGHT);
	}
}








|

|


|

|














|

|


|

|










>
|



119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
	 * @return The color to use.
	 * @since 2019/05/18
	 */
	public static final int itemBackgroundColor(boolean __en, boolean __sl)
	{
		if (__en)
			if (__sl)
				return StandardMetrics.ENABLED_SELECTED_BACKGROUND;
			else
				return StandardMetrics.ENABLED_NORMAL_BACKGROUND;
		else
			if (__sl)
				return StandardMetrics.DISABLED_SELECTED_BACKGROUND;
			else
				return StandardMetrics.DISABLED_NORMAL_BACKGROUND;
	}
	
	/**
	 * Returns the foreground color.
	 *
	 * @param __en Is this enabled?
	 * @param __sl Is this selected?
	 * @return The color to use.
	 * @since 2019/05/18
	 */
	public static final int itemForegroundColor(boolean __en, boolean __sl)
	{
		if (__en)
			if (__sl)
				return StandardMetrics.ENABLED_SELECTED_FOREGROUND;
			else
				return StandardMetrics.ENABLED_NORMAL_FOREGROUND;
		else
			if (__sl)
				return StandardMetrics.DISABLED_SELECTED_FOREGROUND;
			else
				return StandardMetrics.DISABLED_NORMAL_FOREGROUND;
	}
	
	/**
	 * Returns the item label font.
	 *
	 * @return The item label font.
	 * @since 2019/12/09
	 */
	public static final Font itemLabelFont()
	{
		return Font.getFont(StandardMetrics.LIST_ITEM_FONT, 0,
			StandardMetrics.LIST_ITEM_HEIGHT);
	}
}

Name change from runt/apis/midp-lcdui/cc/squirreljme/runtime/lcdui/phoneui/State.java to modules/midp-lcdui/src/main/java/cc/squirreljme/runtime/lcdui/phoneui/State.java.

Name change from runt/apis/midp-lcdui/cc/squirreljme/runtime/lcdui/phoneui/package-info.java to modules/midp-lcdui/src/main/java/cc/squirreljme/runtime/lcdui/phoneui/package-info.java.

Name change from runt/apis/midp-lcdui/cc/squirreljme/runtime/lcdui/vfb/FramebufferTitleListener.java to modules/midp-lcdui/src/main/java/cc/squirreljme/runtime/lcdui/vfb/FramebufferTitleListener.java.

19
20
21
22
23
24
25
26
27
28
{
	/**
	 * This is called when the title is updated.
	 *
	 * @param __s The title to set.
	 * @since 2020/01/17
	 */
	public abstract void titleUpdated(String __s);
}








|


19
20
21
22
23
24
25
26
27
28
{
	/**
	 * This is called when the title is updated.
	 *
	 * @param __s The title to set.
	 * @since 2020/01/17
	 */
	void titleUpdated(String __s);
}

Name change from runt/apis/midp-lcdui/cc/squirreljme/runtime/lcdui/vfb/VirtualFramebuffer.java to modules/midp-lcdui/src/main/java/cc/squirreljme/runtime/lcdui/vfb/VirtualFramebuffer.java.

52
53
54
55
56
57
58

59
60
61
62
63
64
65
66
	 * @param __ipc The callback to forward events to.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/12/28
	 */
	public VirtualFramebuffer(IPCCallback __ipc)
		throws NullPointerException
	{

		this(__ipc, DEFAULT_WIDTH, DEFAULT_HEIGHT);
	}
	
	/**
	 * Initializes the virtual framebuffer.
	 *
	 * @param __ipc The callback to forward events to.
	 * @param __w The width.







>
|







52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
	 * @param __ipc The callback to forward events to.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/12/28
	 */
	public VirtualFramebuffer(IPCCallback __ipc)
		throws NullPointerException
	{
		this(__ipc, VirtualFramebuffer.DEFAULT_WIDTH,
			VirtualFramebuffer.DEFAULT_HEIGHT);
	}
	
	/**
	 * Initializes the virtual framebuffer.
	 *
	 * @param __ipc The callback to forward events to.
	 * @param __w The width.
177
178
179
180
181
182
183
184






185
186
187
188
189
190
191
192
193
194
195
196
197
		}
	}
	
	/**
	 * Executes the framebuffer control system call.
	 *
	 * @param __pid The property ID.
	 * @param __args The call arguments.






	 * @return The result of the property.
	 * @throws IllegalArgumentException If the property was not known.
	 * @since 2019/12/28
	 */
	public final long framebufferControl(int __pid, int __a, int __b, int __c,
		int __d, int __e, int __g, int __h)
		throws IllegalArgumentException
	{
		// Depends on the property
		switch (__pid)
		{
				// Raw address (since it is simulated, this is not set)
			case Framebuffer.CONTROL_ADDRESS:







|
>
>
>
>
>
>





|







178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
		}
	}
	
	/**
	 * Executes the framebuffer control system call.
	 *
	 * @param __pid The property ID.
	 * @param __a The call arguments.
	 * @param __b The call arguments.
	 * @param __c The call arguments.
	 * @param __d The call arguments.
	 * @param __e The call arguments.
	 * @param __f The call arguments.
	 * @param __g The call arguments.
	 * @return The result of the property.
	 * @throws IllegalArgumentException If the property was not known.
	 * @since 2019/12/28
	 */
	public final long framebufferControl(int __pid, int __a, int __b, int __c,
		int __d, int __e, int __f, int __g)
		throws IllegalArgumentException
	{
		// Depends on the property
		switch (__pid)
		{
				// Raw address (since it is simulated, this is not set)
			case Framebuffer.CONTROL_ADDRESS:

Name change from runt/apis/midp-lcdui/cc/squirreljme/runtime/lcdui/vfb/VirtualFramebufferCanvas.java to modules/midp-lcdui/src/main/java/cc/squirreljme/runtime/lcdui/vfb/VirtualFramebufferCanvas.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.lcdui.vfb;

import javax.microedition.lcdui.Canvas;
import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;

/**
 * This is a virtualized framebuffer that provides a LCDUI canvas.
 *
 * @see VirtualFramebuffer
 * @since 2019/12/28
 */













<







1
2
3
4
5
6
7
8
9
10
11
12
13

14
15
16
17
18
19
20
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.lcdui.vfb;

import javax.microedition.lcdui.Canvas;
import javax.microedition.lcdui.Graphics;


/**
 * This is a virtualized framebuffer that provides a LCDUI canvas.
 *
 * @see VirtualFramebuffer
 * @since 2019/12/28
 */

Name change from runt/apis/midp-lcdui/cc/squirreljme/runtime/lcdui/vfb/package-info.java to modules/midp-lcdui/src/main/java/cc/squirreljme/runtime/lcdui/vfb/package-info.java.

Name change from runt/apis/midp-lcdui/com/nokia/mid/ui/DeviceControl.java to modules/midp-lcdui/src/main/java/com/nokia/mid/ui/DeviceControl.java.

8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// ---------------------------------------------------------------------------

package com.nokia.mid.ui;

import cc.squirreljme.jvm.Assembly;
import cc.squirreljme.jvm.DeviceFeedbackType;
import cc.squirreljme.jvm.Framebuffer;
import cc.squirreljme.jvm.SystemCallError;
import cc.squirreljme.jvm.SystemCallIndex;

/**
 * This is used to utilize special hardware that exists on the device for
 * user feedback.
 *
 * @since 2019/10/05







<







8
9
10
11
12
13
14

15
16
17
18
19
20
21
// ---------------------------------------------------------------------------

package com.nokia.mid.ui;

import cc.squirreljme.jvm.Assembly;
import cc.squirreljme.jvm.DeviceFeedbackType;
import cc.squirreljme.jvm.Framebuffer;

import cc.squirreljme.jvm.SystemCallIndex;

/**
 * This is used to utilize special hardware that exists on the device for
 * user feedback.
 *
 * @since 2019/10/05

Name change from runt/apis/midp-lcdui/com/nokia/mid/ui/DirectGraphics.java to modules/midp-lcdui/src/main/java/com/nokia/mid/ui/DirectGraphics.java.

Name change from runt/apis/midp-lcdui/com/nokia/mid/ui/DirectUtils.java to modules/midp-lcdui/src/main/java/com/nokia/mid/ui/DirectUtils.java.

73
74
75
76
77
78
79

80
81
82
83
84
85
86
	}
	
	/**
	 * Returns an interface which wraps the given graphics and provides raw
	 * pixel data access to it.
	 *
	 * @param __g The graphics object to wrap.

	 * @throws NullPointerException On null arguments.
	 * @since 2019/10/07
	 */
	public static DirectGraphics getDirectGraphics(Graphics __g)
		throws NullPointerException
	{
		if (__g == null)







>







73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
	}
	
	/**
	 * Returns an interface which wraps the given graphics and provides raw
	 * pixel data access to it.
	 *
	 * @param __g The graphics object to wrap.
	 * @return The direct graphics.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/10/07
	 */
	public static DirectGraphics getDirectGraphics(Graphics __g)
		throws NullPointerException
	{
		if (__g == null)

Name change from runt/apis/midp-lcdui/com/nokia/mid/ui/FullCanvas.java to modules/midp-lcdui/src/main/java/com/nokia/mid/ui/FullCanvas.java.

Name change from runt/apis/midp-lcdui/com/nokia/mid/ui/package-info.java to modules/midp-lcdui/src/main/java/com/nokia/mid/ui/package-info.java.

Name change from runt/apis/midp-lcdui/javax/microedition/lcdui/Alert.java to modules/midp-lcdui/src/main/java/javax/microedition/lcdui/Alert.java.

30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
	/** The image to use. */
	volatile Image _image;
	
	/** The type of alert this is. */
	volatile AlertType _type;
	
	/** The duration the alert should last in milliseconds. */
	volatile int _timeout =
		FOREVER;
	
	/**
	 * Initializes the alert with just a title.
	 *
	 * @param __title The title of the alert, may be {@code null}.
	 * @since 2017/02/28
	 */







|
<







30
31
32
33
34
35
36
37

38
39
40
41
42
43
44
	/** The image to use. */
	volatile Image _image;
	
	/** The type of alert this is. */
	volatile AlertType _type;
	
	/** The duration the alert should last in milliseconds. */
	volatile int _timeout = Alert.FOREVER;

	
	/**
	 * Initializes the alert with just a title.
	 *
	 * @param __title The title of the alert, may be {@code null}.
	 * @since 2017/02/28
	 */
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
	 * @since 2017/02/28
	 */
	public void setTimeout(int __ms)
		throws IllegalArgumentException
	{
		// {@squirreljme.error EB19 The specified number of milliseconds is
		// negative. (The number of milliseconds specified)}
		if (__ms < 0 && __ms != FOREVER)
			throw new IllegalArgumentException(String.format("EB19 %d", __ms));
		
		// Set
		this._timeout = __ms;
	}
	
	/**







|







198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
	 * @since 2017/02/28
	 */
	public void setTimeout(int __ms)
		throws IllegalArgumentException
	{
		// {@squirreljme.error EB19 The specified number of milliseconds is
		// negative. (The number of milliseconds specified)}
		if (__ms < 0 && __ms != Alert.FOREVER)
			throw new IllegalArgumentException(String.format("EB19 %d", __ms));
		
		// Set
		this._timeout = __ms;
	}
	
	/**

Name change from runt/apis/midp-lcdui/javax/microedition/lcdui/AlertType.java to modules/midp-lcdui/src/main/java/javax/microedition/lcdui/AlertType.java.

Name change from runt/apis/midp-lcdui/javax/microedition/lcdui/AnimatedImage.java to modules/midp-lcdui/src/main/java/javax/microedition/lcdui/AnimatedImage.java.

Name change from runt/apis/midp-lcdui/javax/microedition/lcdui/Canvas.java to modules/midp-lcdui/src/main/java/javax/microedition/lcdui/Canvas.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package javax.microedition.lcdui;

import cc.squirreljme.runtime.cldc.annotation.ImplementationNote;
import cc.squirreljme.runtime.lcdui.common.CommonColors;
import cc.squirreljme.runtime.lcdui.event.EventTranslate;
import cc.squirreljme.runtime.lcdui.event.KeyNames;
import cc.squirreljme.runtime.lcdui.event.NonStandardKey;
import cc.squirreljme.runtime.lcdui.fbui.UIState;
import cc.squirreljme.runtime.lcdui.gfx.EnforcedDrawingAreaGraphics;
import cc.squirreljme.runtime.lcdui.SerializedEvent;

/**
 * The canvas acts as the base class for primary display interfaces that
 * require more customized draw handling.
 *
 * It is not recommended to use a lookup table between keycodes and actions at
 * initialization time. The reason for this is that it is possible for the













|


<

<
<







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16

17


18
19
20
21
22
23
24
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package javax.microedition.lcdui;

import cc.squirreljme.runtime.cldc.annotation.ImplementationNote;
import cc.squirreljme.runtime.lcdui.SerializedEvent;
import cc.squirreljme.runtime.lcdui.event.EventTranslate;
import cc.squirreljme.runtime.lcdui.event.KeyNames;

import cc.squirreljme.runtime.lcdui.fbui.UIState;



/**
 * The canvas acts as the base class for primary display interfaces that
 * require more customized draw handling.
 *
 * It is not recommended to use a lookup table between keycodes and actions at
 * initialization time. The reason for this is that it is possible for the
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
		// will clip the rectangle to be in bounds.
		this.repaint(0, 0, this.getWidth(), this.getHeight());
	}
	
	/**
	 * Requests that the specified region of the canvas be repainted.
	 *
	 * The clipping region when {@link #paint()} is called will have its clip
	 * set to the region to be redrawn.
	 *
	 * It is unspecified whether the drawing operation will happen immedietely,
	 * be enqueued, or not happen at all (for example if the canvas is
	 * currently being painted).
	 *
	 * A width or height with a negative value or zero does nothing.
	 *







|
|







444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
		// will clip the rectangle to be in bounds.
		this.repaint(0, 0, this.getWidth(), this.getHeight());
	}
	
	/**
	 * Requests that the specified region of the canvas be repainted.
	 *
	 * The clipping region when {@link #paint(Graphics)} is called will have
	 * its clip set to the region to be redrawn.
	 *
	 * It is unspecified whether the drawing operation will happen immedietely,
	 * be enqueued, or not happen at all (for example if the canvas is
	 * currently being painted).
	 *
	 * A width or height with a negative value or zero does nothing.
	 *
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
	 * Sets the painting mode of the canvas.
	 *
	 * If transparent mode is enabled, then the implementation (not the end
	 * developer) will fill the background with a suitable color or image
	 * (which is unspecified).
	 *
	 * If opaque mode (which is the default) is enabled then it will be
	 * assumed that {@link #repaint(Graphics)} will cover every pixel and as
	 * such it will not be required for the background to be cleared or
	 * initialized.
	 *
	 * @param __opaque If {@code true} then opaque mode is enabled.
	 * @since 2017/02/12
	 */
	public void setPaintMode(boolean __opaque)
	{







|
|







545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
	 * Sets the painting mode of the canvas.
	 *
	 * If transparent mode is enabled, then the implementation (not the end
	 * developer) will fill the background with a suitable color or image
	 * (which is unspecified).
	 *
	 * If opaque mode (which is the default) is enabled then it will be
	 * assumed that {@link #repaint()} will cover every pixel and
	 * as such it will not be required for the background to be cleared or
	 * initialized.
	 *
	 * @param __opaque If {@code true} then opaque mode is enabled.
	 * @since 2017/02/12
	 */
	public void setPaintMode(boolean __opaque)
	{

Name change from runt/apis/midp-lcdui/javax/microedition/lcdui/CanvasItem.java to modules/midp-lcdui/src/main/java/javax/microedition/lcdui/CanvasItem.java.

Name change from runt/apis/midp-lcdui/javax/microedition/lcdui/Choice.java to modules/midp-lcdui/src/main/java/javax/microedition/lcdui/Choice.java.

9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
// ---------------------------------------------------------------------------

package javax.microedition.lcdui;


public interface Choice
{
	public static final int EXCLUSIVE =
		1;
	
	public static final int IMPLICIT =
		3;
	
	public static final int MULTIPLE =
		2;
	
	public static final int POPUP =
		4;
	
	public static final int TEXT_WRAP_DEFAULT =
		0;
	
	public static final int TEXT_WRAP_OFF =
		2;
	
	public static final int TEXT_WRAP_ON =
		1;
	
	public abstract int append(String __a, Image __b);
	
	public abstract void delete(int __a);
	
	public abstract void deleteAll();
	
	public abstract int getFitPolicy();
	
	public abstract Font getFont(int __a);
	
	public abstract Image getImage(int __a);
	
	public abstract int getSelectedFlags(boolean[] __a);
	
	public abstract int getSelectedIndex();
	
	public abstract String getString(int __a);
	
	public abstract void insert(int __a, String __b, Image __c);
	
	public abstract boolean isEnabled(int __i);
	
	public abstract boolean isSelected(int __a);
	
	public abstract void set(int __a, String __b, Image __c);
	
	public abstract void setEnabled(int __i, boolean __e);
	
	public abstract void setFitPolicy(int __a);
	
	public abstract void setFont(int __a, Font __b);
	
	public abstract void setSelectedFlags(boolean[] __a);
	
	public abstract void setSelectedIndex(int __a, boolean __b);
	
	public abstract int size();
}









|


|


|


|


|


|


|


|

|

|

|

|

|

|

|

|

|

|

|

|

|

|

|

|

|

|



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
// ---------------------------------------------------------------------------

package javax.microedition.lcdui;


public interface Choice
{
	int EXCLUSIVE =
		1;
	
	int IMPLICIT =
		3;
	
	int MULTIPLE =
		2;
	
	int POPUP =
		4;
	
	int TEXT_WRAP_DEFAULT =
		0;
	
	int TEXT_WRAP_OFF =
		2;
	
	int TEXT_WRAP_ON =
		1;
	
	int append(String __a, Image __b);
	
	void delete(int __a);
	
	void deleteAll();
	
	int getFitPolicy();
	
	Font getFont(int __a);
	
	Image getImage(int __a);
	
	int getSelectedFlags(boolean[] __a);
	
	int getSelectedIndex();
	
	String getString(int __a);
	
	void insert(int __a, String __b, Image __c);
	
	boolean isEnabled(int __i);
	
	boolean isSelected(int __a);
	
	void set(int __a, String __b, Image __c);
	
	void setEnabled(int __i, boolean __e);
	
	void setFitPolicy(int __a);
	
	void setFont(int __a, Font __b);
	
	void setSelectedFlags(boolean[] __a);
	
	void setSelectedIndex(int __a, boolean __b);
	
	int size();
}


Name change from runt/apis/midp-lcdui/javax/microedition/lcdui/ChoiceGroup.java to modules/midp-lcdui/src/main/java/javax/microedition/lcdui/ChoiceGroup.java.

81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
		// length as the string array.}
		int n = __se.length;
		if (__ie != null && __ie.length != n)
			throw new IllegalArgumentException("EB1b");
		
		// {@squirreljme.error EB1c Invalid choice type specified for a
		// choice group. (The choice type)}
		if (__ct < _MIN_TYPE || __ct > _MAX_TYPE || __ct == IMPLICIT)
			throw new IllegalArgumentException(String.format("EB1c %d", __ct));
		
		// Set
		setLabel(__l);
		this._type = __ct;
		
		// Append all elements
		for (int i = 0; i < n; i++)
		{
			// {@squirreljme.error EB1d A string element contains a null
			// entry.}
			String s = __se[i];
			if (s == null)
				throw new NullPointerException("EB1d");
			
			// Add it
			append(s, (__ie != null ? __ie[i] : null));
		}
	}
	
	/**
	 * This appends a single choice.
	 *
	 * @param __s The string to display.
	 * @param __i The image to display, may be {@code null}.
	 * @return The index the element was added at.
	 * @throws NullPointerException If no string was specified.
	 * @since 2017/08/20
	 */
	public int append(String __s, Image __i)
	{
		// Check
		if (__s == null)
			throw new NullPointerException("NARG");
		
		// Just insert at the end
		int rv;
		this.insert((rv = size()), __s, __i);
		return rv;
	}
	
	public void delete(int __a)
	{
		throw new todo.TODO();
	}







|



|












|




















|







81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
		// length as the string array.}
		int n = __se.length;
		if (__ie != null && __ie.length != n)
			throw new IllegalArgumentException("EB1b");
		
		// {@squirreljme.error EB1c Invalid choice type specified for a
		// choice group. (The choice type)}
		if (__ct < ChoiceGroup._MIN_TYPE || __ct > ChoiceGroup._MAX_TYPE || __ct == Choice.IMPLICIT)
			throw new IllegalArgumentException(String.format("EB1c %d", __ct));
		
		// Set
		this.setLabel(__l);
		this._type = __ct;
		
		// Append all elements
		for (int i = 0; i < n; i++)
		{
			// {@squirreljme.error EB1d A string element contains a null
			// entry.}
			String s = __se[i];
			if (s == null)
				throw new NullPointerException("EB1d");
			
			// Add it
			this.append(s, (__ie != null ? __ie[i] : null));
		}
	}
	
	/**
	 * This appends a single choice.
	 *
	 * @param __s The string to display.
	 * @param __i The image to display, may be {@code null}.
	 * @return The index the element was added at.
	 * @throws NullPointerException If no string was specified.
	 * @since 2017/08/20
	 */
	public int append(String __s, Image __i)
	{
		// Check
		if (__s == null)
			throw new NullPointerException("NARG");
		
		// Just insert at the end
		int rv;
		this.insert((rv = this.size()), __s, __i);
		return rv;
	}
	
	public void delete(int __a)
	{
		throw new todo.TODO();
	}

Name change from runt/apis/midp-lcdui/javax/microedition/lcdui/Command.java to modules/midp-lcdui/src/main/java/javax/microedition/lcdui/Command.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package javax.microedition.lcdui;

import cc.squirreljme.runtime.cldc.annotation.ImplementationNote;
import cc.squirreljme.runtime.lcdui.common.CommonColors;
import cc.squirreljme.runtime.lcdui.common.CommonMetrics;

public class Command
	extends __Action__
{ 
	/** Returns the user to the previous screen.. */
	public static final int BACK =
		2;













<
<







1
2
3
4
5
6
7
8
9
10
11
12
13


14
15
16
17
18
19
20
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package javax.microedition.lcdui;

import cc.squirreljme.runtime.cldc.annotation.ImplementationNote;



public class Command
	extends __Action__
{ 
	/** Returns the user to the previous screen.. */
	public static final int BACK =
		2;
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
		1;
	
	/** A command which will stop an in-progress operation. */
	public static final int STOP =
		6;
	
	/** The first command type. */
	private static final int _FIRST_TYPE =
		SCREEN;
	
	/** The last command type. */
	private static final int _LAST_TYPE =
		ITEM;
	
	/** The command type. */
	final int _type;
	
	/** The priority. */
	@ImplementationNote("In SquirrelJME if the priority is " +
		"Integer.MAX_VALUE then it will not be displayed.")







|
<


|
<







44
45
46
47
48
49
50
51

52
53
54

55
56
57
58
59
60
61
		1;
	
	/** A command which will stop an in-progress operation. */
	public static final int STOP =
		6;
	
	/** The first command type. */
	private static final int _FIRST_TYPE = Command.SCREEN;

	
	/** The last command type. */
	private static final int _LAST_TYPE = Command.ITEM;

	
	/** The command type. */
	final int _type;
	
	/** The priority. */
	@ImplementationNote("In SquirrelJME if the priority is " +
		"Integer.MAX_VALUE then it will not be displayed.")

Name change from runt/apis/midp-lcdui/javax/microedition/lcdui/CommandLayoutPolicy.java to modules/midp-lcdui/src/main/java/javax/microedition/lcdui/CommandLayoutPolicy.java.

8
9
10
11
12
13
14
15
16
17
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package javax.microedition.lcdui;

public interface CommandLayoutPolicy
{
	public abstract void onCommandLayout(Displayable __disp);
}








|


8
9
10
11
12
13
14
15
16
17
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package javax.microedition.lcdui;

public interface CommandLayoutPolicy
{
	void onCommandLayout(Displayable __disp);
}

Name change from runt/apis/midp-lcdui/javax/microedition/lcdui/CommandListener.java to modules/midp-lcdui/src/main/java/javax/microedition/lcdui/CommandListener.java.

11
12
13
14
15
16
17
18
19
20
21
package javax.microedition.lcdui;

import cc.squirreljme.runtime.lcdui.SerializedEvent;

public interface CommandListener
{
	@SerializedEvent
	public abstract void commandAction(Command __a, Displayable __b);
}









|



11
12
13
14
15
16
17
18
19
20
21
package javax.microedition.lcdui;

import cc.squirreljme.runtime.lcdui.SerializedEvent;

public interface CommandListener
{
	@SerializedEvent
	void commandAction(Command __a, Displayable __b);
}


Name change from runt/apis/midp-lcdui/javax/microedition/lcdui/CustomItem.java to modules/midp-lcdui/src/main/java/javax/microedition/lcdui/CustomItem.java.

168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
	 * Sets the painting mode of the canvas.
	 *
	 * If transparent mode is enabled, then the implementation (not the end
	 * developer) will fill the background with a suitable color or image
	 * (which is unspecified).
	 *
	 * If opaque mode (which is the default) is enabled then it will be
	 * assumed that {@link #repaint(Graphics)} will cover every pixel and as
	 * such it will not be required for the background to be cleared or
	 * initialized.
	 *
	 * @param __opaque If {@code true} then opaque mode is enabled.
	 * @since 2018/03/28
	 */
	public void setPaintMode(boolean __opaque)







|







168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
	 * Sets the painting mode of the canvas.
	 *
	 * If transparent mode is enabled, then the implementation (not the end
	 * developer) will fill the background with a suitable color or image
	 * (which is unspecified).
	 *
	 * If opaque mode (which is the default) is enabled then it will be
	 * assumed that {@link CustomItem#repaint()} will cover every pixel and as
	 * such it will not be required for the background to be cleared or
	 * initialized.
	 *
	 * @param __opaque If {@code true} then opaque mode is enabled.
	 * @since 2018/03/28
	 */
	public void setPaintMode(boolean __opaque)

Name change from runt/apis/midp-lcdui/javax/microedition/lcdui/DateField.java to modules/midp-lcdui/src/main/java/javax/microedition/lcdui/DateField.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package javax.microedition.lcdui;

import cc.squirreljme.runtime.lcdui.SerializedEvent;
import java.util.Date;
import java.util.TimeZone;

public class DateField
	extends Item
{
	public static final int DATE =












<







1
2
3
4
5
6
7
8
9
10
11
12

13
14
15
16
17
18
19
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package javax.microedition.lcdui;


import java.util.Date;
import java.util.TimeZone;

public class DateField
	extends Item
{
	public static final int DATE =
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
	 */
	public DateField(String __l, int __m, TimeZone __z)
		throws IllegalArgumentException
	{
		super(__l);
		
		// {@squirreljme.error EB1g Invalid date field mode. (The mode)}
		if (__m != DATE && __m != DATE_TIME && __m != TIME)
			throw new IllegalArgumentException("EB1g " + __m);
		
		this._zone = __z;
	}
	
	public Date getDate()
	{







|







53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
	 */
	public DateField(String __l, int __m, TimeZone __z)
		throws IllegalArgumentException
	{
		super(__l);
		
		// {@squirreljme.error EB1g Invalid date field mode. (The mode)}
		if (__m != DateField.DATE && __m != DateField.DATE_TIME && __m != DateField.TIME)
			throw new IllegalArgumentException("EB1g " + __m);
		
		this._zone = __z;
	}
	
	public Date getDate()
	{

Name change from runt/apis/midp-lcdui/javax/microedition/lcdui/Display.java to modules/midp-lcdui/src/main/java/javax/microedition/lcdui/Display.java.

9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// ---------------------------------------------------------------------------

package javax.microedition.lcdui;

import cc.squirreljme.jvm.Assembly;
import cc.squirreljme.jvm.DeviceFeedbackType;
import cc.squirreljme.jvm.Framebuffer;
import cc.squirreljme.jvm.IPCManager;
import cc.squirreljme.jvm.SystemCallError;
import cc.squirreljme.jvm.SystemCallIndex;
import cc.squirreljme.runtime.lcdui.common.CommonColors;
import cc.squirreljme.runtime.lcdui.common.CommonMetrics;
import cc.squirreljme.runtime.lcdui.DisplayOrientation;
import cc.squirreljme.runtime.lcdui.DisplayState;
import cc.squirreljme.runtime.lcdui.event.NonStandardKey;
import cc.squirreljme.runtime.lcdui.ExtendedCapabilities;
import cc.squirreljme.runtime.lcdui.fbui.UIState;
import cc.squirreljme.runtime.lcdui.phoneui.NativeUIBackend;
import cc.squirreljme.runtime.lcdui.phoneui.PhoneDisplayBackend;
import cc.squirreljme.runtime.lcdui.phoneui.PhoneUI;
import cc.squirreljme.runtime.lcdui.phoneui.StandardMetrics;
import cc.squirreljme.runtime.lcdui.SerializedEvent;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.lang.ref.Reference;
import java.lang.ref.ReferenceQueue;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.microedition.midlet.MIDlet;

public class Display
{
	public static final int ALERT =
		3;








<


|
|
<
<
<
<

<
<
<

|
<
<
<
<
<
<

<
<
<

<
<







9
10
11
12
13
14
15

16
17
18
19




20



21
22






23



24


25
26
27
28
29
30
31
// ---------------------------------------------------------------------------

package javax.microedition.lcdui;

import cc.squirreljme.jvm.Assembly;
import cc.squirreljme.jvm.DeviceFeedbackType;
import cc.squirreljme.jvm.Framebuffer;

import cc.squirreljme.jvm.SystemCallError;
import cc.squirreljme.jvm.SystemCallIndex;
import cc.squirreljme.runtime.lcdui.ExtendedCapabilities;
import cc.squirreljme.runtime.lcdui.common.CommonColors;




import cc.squirreljme.runtime.lcdui.fbui.UIState;



import cc.squirreljme.runtime.lcdui.phoneui.StandardMetrics;
import cc.squirreljme.runtime.cldc.Poking;






import java.util.ArrayList;



import java.util.List;


import javax.microedition.midlet.MIDlet;

public class Display
{
	public static final int ALERT =
		3;

292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
	 * @return The height of the image for that element.
	 * @throws IllegalArgumentException On null arguments.
	 * @since 2016/10/14
	 */
	public int getBestImageHeight(int __a)
		throws IllegalArgumentException
	{
		return __bestImageSize(__a, true);
	}
	
	/**
	 * Returns the width of the image that should be used for the given
	 * display element.
	 *
	 * Valid elements are:







|







273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
	 * @return The height of the image for that element.
	 * @throws IllegalArgumentException On null arguments.
	 * @since 2016/10/14
	 */
	public int getBestImageHeight(int __a)
		throws IllegalArgumentException
	{
		return this.__bestImageSize(__a, true);
	}
	
	/**
	 * Returns the width of the image that should be used for the given
	 * display element.
	 *
	 * Valid elements are:
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
	 * @return The width of the image for that element.
	 * @throws IllegalArgumentException On null arguments.
	 * @since 2016/10/14
	 */
	public int getBestImageWidth(int __a)
		throws IllegalArgumentException
	{
		return __bestImageSize(__a, false);
	}
	
	public int getBorderStyle(boolean __a)
	{
		throw new todo.TODO();
	}
	







|







297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
	 * @return The width of the image for that element.
	 * @throws IllegalArgumentException On null arguments.
	 * @since 2016/10/14
	 */
	public int getBestImageWidth(int __a)
		throws IllegalArgumentException
	{
		return this.__bestImageSize(__a, false);
	}
	
	public int getBorderStyle(boolean __a)
	{
		throw new todo.TODO();
	}
	
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
		boolean hastouch = ((caps & Framebuffer.CAPABILITY_TOUCH) != 0);
		boolean hasinput = hastouch |
			((caps & Framebuffer.CAPABILITY_KEYBOARD) != 0);
		
		// Use the capabilities of the native display, but since SquirrelJME
		// manages pretty much everything in a framebuffer every display will
		// always have certain capabilities
		return (hasinput ? SUPPORTS_INPUT_EVENTS : 0) |
			(hastouch ? ExtendedCapabilities.SUPPORTS_POINTER_EVENTS : 0) |
			SUPPORTS_COMMANDS | SUPPORTS_FORMS | SUPPORTS_TICKER |
			SUPPORTS_ALERTS | SUPPORTS_LISTS | SUPPORTS_TEXTBOXES |
			SUPPORTS_FILESELECTORS | SUPPORTS_TABBEDPANES |
			SUPPORTS_MENUS;
	}
	
	/**
	 * Returns the color used for the specified interface item.
	 *
	 * The value values are:
	 * {@link #COLOR_BACKGROUND},







|
|
<
<
<
<







326
327
328
329
330
331
332
333
334




335
336
337
338
339
340
341
		boolean hastouch = ((caps & Framebuffer.CAPABILITY_TOUCH) != 0);
		boolean hasinput = hastouch |
			((caps & Framebuffer.CAPABILITY_KEYBOARD) != 0);
		
		// Use the capabilities of the native display, but since SquirrelJME
		// manages pretty much everything in a framebuffer every display will
		// always have certain capabilities
		return (hasinput ? Display.SUPPORTS_INPUT_EVENTS : 0) |
			(hastouch ? ExtendedCapabilities.SUPPORTS_POINTER_EVENTS : 0) | Display.SUPPORTS_COMMANDS | Display.SUPPORTS_FORMS | Display.SUPPORTS_TICKER | Display.SUPPORTS_ALERTS | Display.SUPPORTS_LISTS | Display.SUPPORTS_TEXTBOXES | Display.SUPPORTS_FILESELECTORS | Display.SUPPORTS_TABBEDPANES | Display.SUPPORTS_MENUS;




	}
	
	/**
	 * Returns the color used for the specified interface item.
	 *
	 * The value values are:
	 * {@link #COLOR_BACKGROUND},
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
	 */
	public int getColor(int __c)
		throws IllegalArgumentException
	{
		int rv;
		switch (__c)
		{
			case COLOR_BORDER:
				rv = CommonColors.BORDER;
				break;
			
			case COLOR_BACKGROUND:
			case COLOR_IDLE_BACKGROUND:
				rv = CommonColors.BACKGROUND;
				break;
			
			case COLOR_FOREGROUND:
			case COLOR_IDLE_FOREGROUND:
				rv = CommonColors.FOREGROUND;
				break;
			
			case COLOR_HIGHLIGHTED_BORDER:
				rv = CommonColors.HIGHLIGHTED_BORDER;
				break;
				
			case COLOR_HIGHLIGHTED_BACKGROUND:
			case COLOR_IDLE_HIGHLIGHTED_BACKGROUND:
				rv = CommonColors.HIGHLIGHTED_BACKGROUND;
				break;
			
			case COLOR_HIGHLIGHTED_FOREGROUND:
			case COLOR_IDLE_HIGHLIGHTED_FOREGROUND:
				rv = CommonColors.HIGHLIGHTED_FOREGROUND;
				break;
		
				// {@squirreljme.error EB1h Unknown color specifier. (The
				// color specifier)}
			default:
				throw new IllegalArgumentException("EB1h " + __c);







|



|
|



|
|



|



|
|



|
|







357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
	 */
	public int getColor(int __c)
		throws IllegalArgumentException
	{
		int rv;
		switch (__c)
		{
			case Display.COLOR_BORDER:
				rv = CommonColors.BORDER;
				break;
			
			case Display.COLOR_BACKGROUND:
			case Display.COLOR_IDLE_BACKGROUND:
				rv = CommonColors.BACKGROUND;
				break;
			
			case Display.COLOR_FOREGROUND:
			case Display.COLOR_IDLE_FOREGROUND:
				rv = CommonColors.FOREGROUND;
				break;
			
			case Display.COLOR_HIGHLIGHTED_BORDER:
				rv = CommonColors.HIGHLIGHTED_BORDER;
				break;
				
			case Display.COLOR_HIGHLIGHTED_BACKGROUND:
			case Display.COLOR_IDLE_HIGHLIGHTED_BACKGROUND:
				rv = CommonColors.HIGHLIGHTED_BACKGROUND;
				break;
			
			case Display.COLOR_HIGHLIGHTED_FOREGROUND:
			case Display.COLOR_IDLE_HIGHLIGHTED_FOREGROUND:
				rv = CommonColors.HIGHLIGHTED_FOREGROUND;
				break;
		
				// {@squirreljme.error EB1h Unknown color specifier. (The
				// color specifier)}
			default:
				throw new IllegalArgumentException("EB1h " + __c);
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
		// Landscape just means a longer width
		boolean landscape = this.getWidth() > this.getHeight();
		
		// If it is detected that the display is upsidedown, just say that
		// it was rotated 180 degrees
		if (UIState.getInstance().displayFlipped())
			if (landscape)
				return ORIENTATION_LANDSCAPE_180;
			else
				return ORIENTATION_PORTRAIT_180;
		else
			if (landscape)
				return ORIENTATION_LANDSCAPE;
			else
				return ORIENTATION_PORTRAIT;
	}
	
	/**
	 * Returns the maximum width of the display.
	 *
	 * @retrn The maximum display width.
	 * @since 2016/10/14
	 */
	public int getWidth()
	{
		return UIState.getInstance().displayWidth();
	}
	







|

|


|

|





|







498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
		// Landscape just means a longer width
		boolean landscape = this.getWidth() > this.getHeight();
		
		// If it is detected that the display is upsidedown, just say that
		// it was rotated 180 degrees
		if (UIState.getInstance().displayFlipped())
			if (landscape)
				return Display.ORIENTATION_LANDSCAPE_180;
			else
				return Display.ORIENTATION_PORTRAIT_180;
		else
			if (landscape)
				return Display.ORIENTATION_LANDSCAPE;
			else
				return Display.ORIENTATION_PORTRAIT;
	}
	
	/**
	 * Returns the maximum width of the display.
	 *
	 * @return The maximum display width.
	 * @since 2016/10/14
	 */
	public int getWidth()
	{
		return UIState.getInstance().displayWidth();
	}
	
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
	 * @throws IllegalArgumentException If the specified mode is not valid.
	 * @since 2016/10/08
	 */
	public void setActivityMode(int __m)
		throws IllegalArgumentException
	{
		// Active?
		if (__m == MODE_ACTIVE)
			throw new todo.TODO();
	
		// Normal
		else if (__m == MODE_NORMAL)
			throw new todo.TODO();
	
		// {@squirreljme.error EB1i Unknown activity mode specified.}
		else
			throw new IllegalArgumentException("EB1i");
	}
	







|



|







615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
	 * @throws IllegalArgumentException If the specified mode is not valid.
	 * @since 2016/10/08
	 */
	public void setActivityMode(int __m)
		throws IllegalArgumentException
	{
		// Active?
		if (__m == Display.MODE_ACTIVE)
			throw new todo.TODO();
	
		// Normal
		else if (__m == Display.MODE_NORMAL)
			throw new todo.TODO();
	
		// {@squirreljme.error EB1i Unknown activity mode specified.}
		else
			throw new IllegalArgumentException("EB1i");
	}
	
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
	 */
	private int __bestImageSize(int __e, boolean __h)
		throws IllegalArgumentException
	{
		// Depends
		switch (__e)
		{
			case LIST_ELEMENT:
				return StandardMetrics.LIST_ITEM_HEIGHT;
				
			case CHOICE_GROUP_ELEMENT:
				throw new todo.TODO();
				
			case ALERT:
				throw new todo.TODO();
				
			case TAB:
				throw new todo.TODO();
				
			case COMMAND:
				return StandardMetrics.COMMAND_BAR_HEIGHT;
				
			case NOTIFICATION:
				throw new todo.TODO();
				
			case MENU:
				return StandardMetrics.COMMAND_BAR_HEIGHT;
				
				// {@squirreljme.error EB1o Cannot get the best image size of
				// the specified element. (The element specifier)}
			default:
				throw new IllegalArgumentException(String.format("EB1o %d",
					__e));







|


|


|


|


|


|


|







838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
	 */
	private int __bestImageSize(int __e, boolean __h)
		throws IllegalArgumentException
	{
		// Depends
		switch (__e)
		{
			case Display.LIST_ELEMENT:
				return StandardMetrics.LIST_ITEM_HEIGHT;
				
			case Display.CHOICE_GROUP_ELEMENT:
				throw new todo.TODO();
				
			case Display.ALERT:
				throw new todo.TODO();
				
			case Display.TAB:
				throw new todo.TODO();
				
			case Display.COMMAND:
				return StandardMetrics.COMMAND_BAR_HEIGHT;
				
			case Display.NOTIFICATION:
				throw new todo.TODO();
				
			case Display.MENU:
				return StandardMetrics.COMMAND_BAR_HEIGHT;
				
				// {@squirreljme.error EB1o Cannot get the best image size of
				// the specified element. (The element specifier)}
			default:
				throw new IllegalArgumentException(String.format("EB1o %d",
					__e));
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995



996
997
998
999
1000
1001
1002
		if (d != null)
			return d;
		
		// Use the first display that is available.
		// In the runtime, each program only ever gets a single MIDlet and
		// creating new MIDlets is illegal. Thus since getDisplays() has zero
		// be the return value for this method, that is used here.
		Display[] disp = getDisplays(0);
		if (disp.length > 0)
			return disp[0];
		
		// {@squirreljme.error EB1p Could not get the display for the specified
		// MIDlet because no displays are available.}
		throw new IllegalStateException("EB1p");
	}
	
	/**
	 * Obtains the displays which have the given capability from all internal
	 * display providers.
	 *
	 * @param __caps The capabities to use, this is a bitfield and the values
	 * include all of the {@code SUPPORT_} prefixed constans. If {@code 0} is
	 * specified then capabilities are not checked.
	 * @return An array containing the displays with these capabilities.
	 * @since 2016/10/08
	 */
	public static Display[] getDisplays(int __caps)
	{



		// Create initial display?
		Display d = Display._DISPLAY;
		if (d == null)
			synchronized (Display.class)
			{
				d = Display._DISPLAY;
				if (d == null)







|




















>
>
>







945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
		if (d != null)
			return d;
		
		// Use the first display that is available.
		// In the runtime, each program only ever gets a single MIDlet and
		// creating new MIDlets is illegal. Thus since getDisplays() has zero
		// be the return value for this method, that is used here.
		Display[] disp = Display.getDisplays(0);
		if (disp.length > 0)
			return disp[0];
		
		// {@squirreljme.error EB1p Could not get the display for the specified
		// MIDlet because no displays are available.}
		throw new IllegalStateException("EB1p");
	}
	
	/**
	 * Obtains the displays which have the given capability from all internal
	 * display providers.
	 *
	 * @param __caps The capabities to use, this is a bitfield and the values
	 * include all of the {@code SUPPORT_} prefixed constans. If {@code 0} is
	 * specified then capabilities are not checked.
	 * @return An array containing the displays with these capabilities.
	 * @since 2016/10/08
	 */
	public static Display[] getDisplays(int __caps)
	{
		// Poke the VM to initialize things potentially
		Poking.poke();
		
		// Create initial display?
		Display d = Display._DISPLAY;
		if (d == null)
			synchronized (Display.class)
			{
				d = Display._DISPLAY;
				if (d == null)

Name change from runt/apis/midp-lcdui/javax/microedition/lcdui/DisplayCapabilityException.java to modules/midp-lcdui/src/main/java/javax/microedition/lcdui/DisplayCapabilityException.java.

22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
	/**
	 * Initializes the exception with no message or cause.
	 *
	 * @since 2018/11/17
	 */
	public DisplayCapabilityException()
	{
		super();
	}
	
	/**
	 * Initializes the exception with the given message and no cause.
	 *
	 * @param __m The message.
	 * @since 2018/11/17







<







22
23
24
25
26
27
28

29
30
31
32
33
34
35
	/**
	 * Initializes the exception with no message or cause.
	 *
	 * @since 2018/11/17
	 */
	public DisplayCapabilityException()
	{

	}
	
	/**
	 * Initializes the exception with the given message and no cause.
	 *
	 * @param __m The message.
	 * @since 2018/11/17

Name change from runt/apis/midp-lcdui/javax/microedition/lcdui/DisplayListener.java to modules/midp-lcdui/src/main/java/javax/microedition/lcdui/DisplayListener.java.

11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package javax.microedition.lcdui;

import cc.squirreljme.runtime.lcdui.SerializedEvent;

public interface DisplayListener
{
	@SerializedEvent
	public abstract void displayAdded(Display __d);
	
	@SerializedEvent
	public abstract void displayStateChanged(Display __d, int __ns);
	
	@SerializedEvent
	public abstract void hardwareStateChanged(Display __d, int __ns);
	
	@SerializedEvent
	public abstract void orientationChanged(Display __d, int __no);
	
	@SerializedEvent
	public abstract void sizeChanged(Display __d, int __w, int __h);
}








|


|


|


|


|


11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package javax.microedition.lcdui;

import cc.squirreljme.runtime.lcdui.SerializedEvent;

public interface DisplayListener
{
	@SerializedEvent
	void displayAdded(Display __d);
	
	@SerializedEvent
	void displayStateChanged(Display __d, int __ns);
	
	@SerializedEvent
	void hardwareStateChanged(Display __d, int __ns);
	
	@SerializedEvent
	void orientationChanged(Display __d, int __no);
	
	@SerializedEvent
	void sizeChanged(Display __d, int __w, int __h);
}

Name change from runt/apis/midp-lcdui/javax/microedition/lcdui/Displayable.java to modules/midp-lcdui/src/main/java/javax/microedition/lcdui/Displayable.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package javax.microedition.lcdui;

import cc.squirreljme.runtime.lcdui.fbui.UIState;
import cc.squirreljme.runtime.lcdui.phoneui.ExposedDisplayable;
import cc.squirreljme.runtime.lcdui.SerializedEvent;
import cc.squirreljme.runtime.midlet.ActiveMidlet;
import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.List;
import javax.microedition.midlet.MIDlet;

/**
 * A displayable is a primary container such as a form or a canvas that can be
 * set on a display. A display may only have a single displayable associated












|
|
|

<
<







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16


17
18
19
20
21
22
23
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package javax.microedition.lcdui;

import cc.squirreljme.runtime.lcdui.SerializedEvent;
import cc.squirreljme.runtime.lcdui.fbui.UIState;
import cc.squirreljme.runtime.lcdui.phoneui.ExposedDisplayable;
import cc.squirreljme.runtime.midlet.ActiveMidlet;


import java.util.ArrayList;
import java.util.List;
import javax.microedition.midlet.MIDlet;

/**
 * A displayable is a primary container such as a form or a canvas that can be
 * set on a display. A display may only have a single displayable associated

Name change from runt/apis/midp-lcdui/javax/microedition/lcdui/FileSelector.java to modules/midp-lcdui/src/main/java/javax/microedition/lcdui/FileSelector.java.

Name change from runt/apis/midp-lcdui/javax/microedition/lcdui/Font.java to modules/midp-lcdui/src/main/java/javax/microedition/lcdui/Font.java.

8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package javax.microedition.lcdui;

import cc.squirreljme.runtime.lcdui.font.FontSizeConversion;
import cc.squirreljme.runtime.lcdui.font.SQFFont;
import java.io.InputStream;
import java.io.IOException;
import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.List;

/**
 * This class represents a font which is a representation of the glyphs which
 * are used to display text and pictographs.
 *







|
|
<
<







8
9
10
11
12
13
14
15
16


17
18
19
20
21
22
23
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package javax.microedition.lcdui;

import cc.squirreljme.runtime.lcdui.font.FontSizeConversion;
import cc.squirreljme.runtime.lcdui.font.SQFFont;
import java.io.IOException;
import java.io.InputStream;


import java.util.ArrayList;
import java.util.List;

/**
 * This class represents a font which is a representation of the glyphs which
 * are used to display text and pictographs.
 *
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
		this._sqf = (sqf = SQFFont.cacheFont(__n, __px));
		
		// Determine if the font is monospaced or proportional
		int totalwidth = 0;
		for (char c = 0; c < 128; c++)
			totalwidth += sqf.charWidth(c);
		this._face = ((totalwidth / 128) == sqf.charWidth('\0') ?
			FACE_MONOSPACE : FACE_PROPORTIONAL);
	}
	
	/**
	 * Returns the width of the specified character.
	 *
	 * @param __c The character to get the width of.
	 * @return The width of the given character.







|







133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
		this._sqf = (sqf = SQFFont.cacheFont(__n, __px));
		
		// Determine if the font is monospaced or proportional
		int totalwidth = 0;
		for (char c = 0; c < 128; c++)
			totalwidth += sqf.charWidth(c);
		this._face = ((totalwidth / 128) == sqf.charWidth('\0') ?
			Font.FACE_MONOSPACE : Font.FACE_PROPORTIONAL);
	}
	
	/**
	 * Returns the width of the specified character.
	 *
	 * @param __c The character to get the width of.
	 * @return The width of the given character.
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
	 * no font is available using that size, or the style is not valid.
	 * @since 2018/11/24
	 */
	public Font deriveFont(int __style, int __pxs)
		throws IllegalArgumentException
	{
		// {@squirreljme.error EB1t Invalid font style specified. (The style)}
		if ((__style & ~(STYLE_PLAIN | STYLE_UNDERLINED | STYLE_BOLD)) != 0)
			throw new IllegalArgumentException(String.format("EB1t %d",
				__style));
		
		// Use default font size?
		if (__pxs == 0)
			__pxs = FontSizeConversion.logicalSizeToPixelSize(SIZE_MEDIUM);
		
		// {@squirreljme.error EB1u The pixel size of a font cannot be
		// negative.}
		else if (__pxs < 0)
			throw new IllegalArgumentException("EB1u");
		
		// Same exact font?







|





|







228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
	 * no font is available using that size, or the style is not valid.
	 * @since 2018/11/24
	 */
	public Font deriveFont(int __style, int __pxs)
		throws IllegalArgumentException
	{
		// {@squirreljme.error EB1t Invalid font style specified. (The style)}
		if ((__style & ~(Font.STYLE_PLAIN | Font.STYLE_UNDERLINED | Font.STYLE_BOLD)) != 0)
			throw new IllegalArgumentException(String.format("EB1t %d",
				__style));
		
		// Use default font size?
		if (__pxs == 0)
			__pxs = FontSizeConversion.logicalSizeToPixelSize(Font.SIZE_MEDIUM);
		
		// {@squirreljme.error EB1u The pixel size of a font cannot be
		// negative.}
		else if (__pxs < 0)
			throw new IllegalArgumentException("EB1u");
		
		// Same exact font?
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
	 *
	 * @return All of the available fonts.
	 * @since 2018/11/24
	 */
	public static Font[] getAvailableFonts()
	{
		// Already read these fonts?
		Font[] rv = _BUILTIN_FONTS;
		if (rv != null)
			return rv.clone();
		
		// There are currently just three built-in fonts
		_BUILTIN_FONTS = (rv = new Font[]
			{
				new Font("sansserif", 0, _DEFAULT_FONT_SIZE),
				new Font("serif", 0, _DEFAULT_FONT_SIZE),
				new Font("monospace", 0, _DEFAULT_FONT_SIZE),
				new Font("symbol", 0, _DEFAULT_FONT_SIZE),
			});
		return rv.clone();
	}
	
	/**
	 * Returns all of the fonts which are available on the system using the
	 * standard font size.
	 *
	 * @param __style The style of the font, may be a combination of styles.
	 * @return An array of matching font and styles.
	 * @throws IllegalArgumentException If the parameters are not correct.
	 * @since 2017/05/25
	 */
	public static Font[] getAvailableFonts(int __style)
		throws IllegalArgumentException
	{
		// {@squirreljme.error EB1v Invalid font style specified. (The style)}
		if ((__style & ~(STYLE_PLAIN | STYLE_UNDERLINED | STYLE_BOLD)) != 0)
			throw new IllegalArgumentException(String.format("EB1v %d",
				__style));
		
		List<Font> rv = new ArrayList<>();
		for (Font f : Font.getAvailableFonts())
			try
			{







|




|

|
|
|
|

















|







529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
	 *
	 * @return All of the available fonts.
	 * @since 2018/11/24
	 */
	public static Font[] getAvailableFonts()
	{
		// Already read these fonts?
		Font[] rv = Font._BUILTIN_FONTS;
		if (rv != null)
			return rv.clone();
		
		// There are currently just three built-in fonts
		Font._BUILTIN_FONTS = (rv = new Font[]
			{
				new Font("sansserif", 0, Font._DEFAULT_FONT_SIZE),
				new Font("serif", 0, Font._DEFAULT_FONT_SIZE),
				new Font("monospace", 0, Font._DEFAULT_FONT_SIZE),
				new Font("symbol", 0, Font._DEFAULT_FONT_SIZE),
			});
		return rv.clone();
	}
	
	/**
	 * Returns all of the fonts which are available on the system using the
	 * standard font size.
	 *
	 * @param __style The style of the font, may be a combination of styles.
	 * @return An array of matching font and styles.
	 * @throws IllegalArgumentException If the parameters are not correct.
	 * @since 2017/05/25
	 */
	public static Font[] getAvailableFonts(int __style)
		throws IllegalArgumentException
	{
		// {@squirreljme.error EB1v Invalid font style specified. (The style)}
		if ((__style & ~(Font.STYLE_PLAIN | Font.STYLE_UNDERLINED | Font.STYLE_BOLD)) != 0)
			throw new IllegalArgumentException(String.format("EB1v %d",
				__style));
		
		List<Font> rv = new ArrayList<>();
		for (Font f : Font.getAvailableFonts())
			try
			{
582
583
584
585
586
587
588

589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
	
	/**
	 * Returns all of the fonts which are available in the given format.
	 *
	 * @param __face The face type of the font.
	 * @param __style The style of the font.
	 * @param __pxs The pixel size of the font.

	 * @throws IllegalArgumentException If the parameters are not correct.
	 * @since 2018/11/24
	 */
	public static Font[] getAvailableFonts(int __face, int __style, int __pxs)
		throws IllegalArgumentException
	{
		// {@squirreljme.error EB1w Invalid font style specified. (The style)}
		if ((__style & ~(STYLE_PLAIN | STYLE_UNDERLINED | STYLE_BOLD)) != 0)
			throw new IllegalArgumentException(String.format("EB1w %d",
				__style));
		
		// Need to filter by face, then derive
		List<Font> rv = new ArrayList<>();
		for (Font f : Font.getAvailableFonts())
		{







>







|







580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
	
	/**
	 * Returns all of the fonts which are available in the given format.
	 *
	 * @param __face The face type of the font.
	 * @param __style The style of the font.
	 * @param __pxs The pixel size of the font.
	 * @return The available fonts.
	 * @throws IllegalArgumentException If the parameters are not correct.
	 * @since 2018/11/24
	 */
	public static Font[] getAvailableFonts(int __face, int __style, int __pxs)
		throws IllegalArgumentException
	{
		// {@squirreljme.error EB1w Invalid font style specified. (The style)}
		if ((__style & ~(Font.STYLE_PLAIN | Font.STYLE_UNDERLINED | Font.STYLE_BOLD)) != 0)
			throw new IllegalArgumentException(String.format("EB1w %d",
				__style));
		
		// Need to filter by face, then derive
		List<Font> rv = new ArrayList<>();
		for (Font f : Font.getAvailableFonts())
		{
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
	 *
	 * @return The default system font.
	 * @since 2017/05/24
	 */
	public static Font getDefaultFont()
	{
		// 
		Font rv = _DEFAULT_FONT;
		if (rv != null)
			return rv;
		
		// Use the first found font as the default
		_DEFAULT_FONT = (rv = Font.getAvailableFonts()[0]);
		return rv;
	}
	
	/**
	 * Returns the font by the given specifier.
	 *
	 * @param __spec The specifier of the font to get.
	 * @return The font for the given specifier.
	 * @throws IllegalArgumentException If the specifier is not valid.
	 * @since 2018/11/24
	 */
	public static Font getFont(int __spec)
		throws IllegalArgumentException
	{
		// {@squirreljme.error EB1x Invalid font specifiers. (The specifiers)}
		if (__spec != FONT_INPUT_TEXT && __spec != FONT_STATIC_TEXT &&
			__spec != FONT_IDLE_TEXT && __spec != FONT_IDLE_HIGHLIGHTED_TEXT)
			throw new IllegalArgumentException("EB1x " + __spec);
		
		// This is always the default font
		return Font.getDefaultFont();
	}
	
	/**







|




|















|
|







622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
	 *
	 * @return The default system font.
	 * @since 2017/05/24
	 */
	public static Font getDefaultFont()
	{
		// 
		Font rv = Font._DEFAULT_FONT;
		if (rv != null)
			return rv;
		
		// Use the first found font as the default
		Font._DEFAULT_FONT = (rv = Font.getAvailableFonts()[0]);
		return rv;
	}
	
	/**
	 * Returns the font by the given specifier.
	 *
	 * @param __spec The specifier of the font to get.
	 * @return The font for the given specifier.
	 * @throws IllegalArgumentException If the specifier is not valid.
	 * @since 2018/11/24
	 */
	public static Font getFont(int __spec)
		throws IllegalArgumentException
	{
		// {@squirreljme.error EB1x Invalid font specifiers. (The specifiers)}
		if (__spec != Font.FONT_INPUT_TEXT && __spec != Font.FONT_STATIC_TEXT &&
			__spec != Font.FONT_IDLE_TEXT && __spec != Font.FONT_IDLE_HIGHLIGHTED_TEXT)
			throw new IllegalArgumentException("EB1x " + __spec);
		
		// This is always the default font
		return Font.getDefaultFont();
	}
	
	/**
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
	 * @throws IllegalArgumentException If the input parameters are not valid.
	 * @since 2017/05/25
	 */
	public static Font getFont(int __face, int __style, int __size)
		throws IllegalArgumentException
	{
		// {@squirreljme.error EB1y Invalid font face specified. (The face)}
		if ((__face & ~(FACE_SYSTEM | FACE_MONOSPACE | FACE_PROPORTIONAL)) != 0
			|| Integer.bitCount(__face) > 1)
			throw new IllegalArgumentException(String.format("EB1y %d",
				__face));
		
		// {@squirreljme.error EB1z Invalid font size specified. (The size)}
		if ((__size & ~(SIZE_SMALL | SIZE_MEDIUM | SIZE_LARGE)) != 0
			|| Integer.bitCount(__size) > 1)
			throw new IllegalArgumentException(String.format("EB1z %d",
				__size));
		
		// Get fonts that might exist
		Font[] scan = Font.getAvailableFonts(__face, __style,
			FontSizeConversion.logicalSizeToPixelSize(__size));







|





|







667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
	 * @throws IllegalArgumentException If the input parameters are not valid.
	 * @since 2017/05/25
	 */
	public static Font getFont(int __face, int __style, int __size)
		throws IllegalArgumentException
	{
		// {@squirreljme.error EB1y Invalid font face specified. (The face)}
		if ((__face & ~(Font.FACE_SYSTEM | Font.FACE_MONOSPACE | Font.FACE_PROPORTIONAL)) != 0
			|| Integer.bitCount(__face) > 1)
			throw new IllegalArgumentException(String.format("EB1y %d",
				__face));
		
		// {@squirreljme.error EB1z Invalid font size specified. (The size)}
		if ((__size & ~(Font.SIZE_SMALL | Font.SIZE_MEDIUM | Font.SIZE_LARGE)) != 0
			|| Integer.bitCount(__size) > 1)
			throw new IllegalArgumentException(String.format("EB1z %d",
				__size));
		
		// Get fonts that might exist
		Font[] scan = Font.getAvailableFonts(__face, __style,
			FontSizeConversion.logicalSizeToPixelSize(__size));

Name change from runt/apis/midp-lcdui/javax/microedition/lcdui/FontFormatException.java to modules/midp-lcdui/src/main/java/javax/microedition/lcdui/FontFormatException.java.

Name change from runt/apis/midp-lcdui/javax/microedition/lcdui/Form.java to modules/midp-lcdui/src/main/java/javax/microedition/lcdui/Form.java.

Name change from runt/apis/midp-lcdui/javax/microedition/lcdui/FormLayoutPolicy.java to modules/midp-lcdui/src/main/java/javax/microedition/lcdui/FormLayoutPolicy.java.

Name change from runt/apis/midp-lcdui/javax/microedition/lcdui/Gauge.java to modules/midp-lcdui/src/main/java/javax/microedition/lcdui/Gauge.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package javax.microedition.lcdui;

import cc.squirreljme.runtime.lcdui.SerializedEvent;

public class Gauge
	extends Item
{
	public static final int CONTINUOUS_IDLE =
		0;
	
	public static final int CONTINUOUS_RUNNING =












<
<







1
2
3
4
5
6
7
8
9
10
11
12


13
14
15
16
17
18
19
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package javax.microedition.lcdui;



public class Gauge
	extends Item
{
	public static final int CONTINUOUS_IDLE =
		0;
	
	public static final int CONTINUOUS_RUNNING =
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
		// {@squirreljme.error EB24 An interactive gauge cannot have a negative
		// maximum value.}
		if (__int && __max < 0)
			throw new IllegalArgumentException("EB24");
		
		// {@squirreljme.error EB25 A non-interactive gauge cannot have a
		// negative value that is not indefinite.}
		if (!__int && !(__max >= 0 || __max == INDEFINITE))
			throw new IllegalArgumentException("EB25");
		
		// {@squirreljme.error EB26 Invalid symbolism for indefinite range.}
		if (__max == INDEFINITE && __iv != CONTINUOUS_IDLE &&
			__iv != CONTINUOUS_RUNNING && __iv != INCREMENTAL_IDLE &&
			__iv != INCREMENTAL_UPDATING)
			throw new IllegalArgumentException("EB26");
		
		this._interactive = __int;
		this._value = __iv;
		this._maxvalue = __max;
	}
	







|



|
|
|







58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
		// {@squirreljme.error EB24 An interactive gauge cannot have a negative
		// maximum value.}
		if (__int && __max < 0)
			throw new IllegalArgumentException("EB24");
		
		// {@squirreljme.error EB25 A non-interactive gauge cannot have a
		// negative value that is not indefinite.}
		if (!__int && !(__max >= 0 || __max == Gauge.INDEFINITE))
			throw new IllegalArgumentException("EB25");
		
		// {@squirreljme.error EB26 Invalid symbolism for indefinite range.}
		if (__max == Gauge.INDEFINITE && __iv != Gauge.CONTINUOUS_IDLE &&
			__iv != Gauge.CONTINUOUS_RUNNING && __iv != Gauge.INCREMENTAL_IDLE &&
			__iv != Gauge.INCREMENTAL_UPDATING)
			throw new IllegalArgumentException("EB26");
		
		this._interactive = __int;
		this._value = __iv;
		this._maxvalue = __max;
	}
	

Name change from runt/apis/midp-lcdui/javax/microedition/lcdui/Graphics.java to modules/midp-lcdui/src/main/java/javax/microedition/lcdui/Graphics.java.

1
2
3
4
5
6
7
8
9
10
11
12


13
14
15
16
17
18
19
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package javax.microedition.lcdui;



/**
 * The class describes the interface that is used for drawing operations.
 *
 * When the clipping area is used, no pixels outside of it are drawn. This may
 * be used to draw special effects or have similar maskings.
 *
 * The anchor points {@link #BASELINE}, {@link #BOTTOM}, {@link #HCENTER},












>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package javax.microedition.lcdui;

import javax.microedition.lcdui.game.Sprite;

/**
 * The class describes the interface that is used for drawing operations.
 *
 * When the clipping area is used, no pixels outside of it are drawn. This may
 * be used to draw special effects or have similar maskings.
 *
 * The anchor points {@link #BASELINE}, {@link #BOTTOM}, {@link #HCENTER},
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
	{
	}
	
	/**
	 * This reduces the clipping area of the drawing so that 
	 *
	 * This is only used to reduce the clipping area, to make it larger use
	 * {@link #setClip(int, int, int int)}.
	 *
	 * @param __x The X coordinate of the clipping rectangle,
	 * will be translated.
	 * @param __y The Y coordinate of the clipping rectangle,
	 * will be translated.
	 * @param __w The width of the rectangle.
	 * @param __h The height of the rectangle.







|







100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
	{
	}
	
	/**
	 * This reduces the clipping area of the drawing so that 
	 *
	 * This is only used to reduce the clipping area, to make it larger use
	 * {@link Graphics#setClip(int, int, int, int)}.
	 *
	 * @param __x The X coordinate of the clipping rectangle,
	 * will be translated.
	 * @param __y The Y coordinate of the clipping rectangle,
	 * will be translated.
	 * @param __w The width of the rectangle.
	 * @param __h The height of the rectangle.
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
		int __y, int __anchor)
		throws NullPointerException;
	
	/**
	 * Draws the specified image.
	 *
	 * If this graphics object draws onto the source image then the result is
	 * undefined, {@link copyArea(int, int, int, int, int, int, int)} should
	 * be used instead.
	 *
	 * @param __i The source image.
	 * @param __x The X position to draw at, is translated.
	 * @param __y The Y position to draw at, is translated.
	 * @param __anchor The anchor point of the image.
	 * @throws IllegalArgumentException If the anchor point is not valid.







|







186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
		int __y, int __anchor)
		throws NullPointerException;
	
	/**
	 * Draws the specified image.
	 *
	 * If this graphics object draws onto the source image then the result is
	 * undefined, {@link #copyArea(int, int, int, int, int, int, int)} should
	 * be used instead.
	 *
	 * @param __i The source image.
	 * @param __x The X position to draw at, is translated.
	 * @param __y The Y position to draw at, is translated.
	 * @param __anchor The anchor point of the image.
	 * @throws IllegalArgumentException If the anchor point is not valid.
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
	 * @param __x The X position of the upper left corner, will be translated.
	 * @param __y The Y position of the upper left corner, will be translated.
	 * @param __w The width of the arc.
	 * @param __h The height of the arc.
	 * @param __sa The starting angle in degrees, 
	 * @param __aa The offset from the starting angle, negative values indicate
	 * clockwise direction while positive values are counter clockwise.
	 * @see drawArc(int, int, int, int, int, int)
	 * @since 2017/02/10
	 */
	public abstract void fillArc(int __x, int __y, int __w, int __h, int __sa,
		int __aa);
	
	public abstract void fillRect(int __x, int __y, int __w, int __h);
	







|







311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
	 * @param __x The X position of the upper left corner, will be translated.
	 * @param __y The Y position of the upper left corner, will be translated.
	 * @param __w The width of the arc.
	 * @param __h The height of the arc.
	 * @param __sa The starting angle in degrees, 
	 * @param __aa The offset from the starting angle, negative values indicate
	 * clockwise direction while positive values are counter clockwise.
	 * @see #drawArc(int, int, int, int, int, int)
	 * @since 2017/02/10
	 */
	public abstract void fillArc(int __x, int __y, int __w, int __h, int __sa,
		int __aa);
	
	public abstract void fillRect(int __x, int __y, int __w, int __h);
	
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
	 * @since 2017/02/10
	 */
	public abstract int getAlpha();
	
	/**
	 * Returns the color along with the alpha color. 
	 *
	 * @return The color in the form of {@link @0xAARRGGBB}.
	 * @since 2017/02/10
	 */
	public abstract int getAlphaColor();
	
	/**
	 * Returns the blending mode.
	 *







|







336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
	 * @since 2017/02/10
	 */
	public abstract int getAlpha();
	
	/**
	 * Returns the color along with the alpha color. 
	 *
	 * @return The color in the form of {@code @0xAARRGGBB}.
	 * @since 2017/02/10
	 */
	public abstract int getAlphaColor();
	
	/**
	 * Returns the blending mode.
	 *
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
	 */
	public abstract void setAlpha(int __a)
		throws IllegalArgumentException;
	
	/**
	 * Sets the alpha color to draw with along with the color to use.
	 *
	 * @param __argb The color in the form of {@link 0xAARRGGBB}.
	 * @since 2017/02/10
	 */
	public abstract void setAlphaColor(int __argb);
	
	/**
	 * Sets the color and alpha value to use for drawing.
	 *







|







481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
	 */
	public abstract void setAlpha(int __a)
		throws IllegalArgumentException;
	
	/**
	 * Sets the alpha color to draw with along with the color to use.
	 *
	 * @param __argb The color in the form of {@code 0xAARRGGBB}.
	 * @since 2017/02/10
	 */
	public abstract void setAlphaColor(int __argb);
	
	/**
	 * Sets the color and alpha value to use for drawing.
	 *

Name change from runt/apis/midp-lcdui/javax/microedition/lcdui/IdleItem.java to modules/midp-lcdui/src/main/java/javax/microedition/lcdui/IdleItem.java.

Name change from runt/apis/midp-lcdui/javax/microedition/lcdui/Image.java to modules/midp-lcdui/src/main/java/javax/microedition/lcdui/Image.java.

11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package javax.microedition.lcdui;

import cc.squirreljme.runtime.lcdui.gfx.AdvancedGraphics;
import cc.squirreljme.runtime.lcdui.image.ImageReaderDispatcher;
import cc.squirreljme.runtime.midlet.ActiveMidlet;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
import java.io.InputStream;
import java.io.IOException;

public class Image
{
	/** The RGB image data. */
	private final int[] _data;
	
	/** Image width. */







|

<







11
12
13
14
15
16
17
18
19

20
21
22
23
24
25
26
package javax.microedition.lcdui;

import cc.squirreljme.runtime.lcdui.gfx.AdvancedGraphics;
import cc.squirreljme.runtime.lcdui.image.ImageReaderDispatcher;
import cc.squirreljme.runtime.midlet.ActiveMidlet;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;


public class Image
{
	/** The RGB image data. */
	private final int[] _data;
	
	/** Image width. */
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
	{
		throw new todo.TODO();
	}
	
	/**
	 * Initializes the image with the given settings.
	 *
	 * @parma __data The image data, this is used directly.
	 * @param __w The image width.
	 * @param __h The image height.
	 * @param __mut If this image is mutable
	 * @param __alpha If this image has an alpha channel.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/02/10
	 */
	Image(int[] __data, int __w, int __h, boolean __mut, boolean __alpha)
	{
		// Check
		if (__data == null)
			throw new NullPointerException("NARG");
		
		// Set
		this._data = __data;
		this._width = __w;
		this._height = __h;
		this._mutable = __mut && !isAnimated() && !isScalable();
		this._alpha = __alpha;
		
		// If no alpha, set upper channel to full opaqueness
		if (!__alpha)
			for (int i = 0, n = __data.length; i < n; i++)
				__data[i] |= 0xFF000000;
	}







|

















|







39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
	{
		throw new todo.TODO();
	}
	
	/**
	 * Initializes the image with the given settings.
	 *
	 * @param __data The image data, this is used directly.
	 * @param __w The image width.
	 * @param __h The image height.
	 * @param __mut If this image is mutable
	 * @param __alpha If this image has an alpha channel.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/02/10
	 */
	Image(int[] __data, int __w, int __h, boolean __mut, boolean __alpha)
	{
		// Check
		if (__data == null)
			throw new NullPointerException("NARG");
		
		// Set
		this._data = __data;
		this._width = __w;
		this._height = __h;
		this._mutable = __mut && !this.isAnimated() && !this.isScalable();
		this._alpha = __alpha;
		
		// If no alpha, set upper channel to full opaqueness
		if (!__alpha)
			for (int i = 0, n = __data.length; i < n; i++)
				__data[i] |= 0xFF000000;
	}
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
	 * @since 2017/02/10
	 */
	public final Graphics getGraphics()
		throws IllegalStateException
	{
		// {@squirreljme.error EB28 Cannot get mutable graphic operations for
		// an immutable image.}
		if (!isMutable())
			throw new IllegalStateException("EB28");
		
		// Create
		return new AdvancedGraphics(this._data, this._alpha, null, this._width,
			this._height, this._width, 0, 0, 0);
	}
	







|







96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
	 * @since 2017/02/10
	 */
	public final Graphics getGraphics()
		throws IllegalStateException
	{
		// {@squirreljme.error EB28 Cannot get mutable graphic operations for
		// an immutable image.}
		if (!this.isMutable())
			throw new IllegalStateException("EB28");
		
		// Create
		return new AdvancedGraphics(this._data, this._alpha, null, this._width,
			this._height, this._width, 0, 0, 0);
	}
	
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
			NullPointerException
	{
		// Do nothing
		if (__w <= 0 || __h <= 0)
			return;
		
		// Scalable images must be rasterized
		if (isScalable())
			throw new todo.TODO();
			
		// Check
		if (__b == null)
			throw new NullPointerException("NARG");
		
		// {@squirreljme.error EB29 The source coordinates are negative.}







|







151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
			NullPointerException
	{
		// Do nothing
		if (__w <= 0 || __h <= 0)
			return;
		
		// Scalable images must be rasterized
		if (this.isScalable())
			throw new todo.TODO();
			
		// Check
		if (__b == null)
			throw new NullPointerException("NARG");
		
		// {@squirreljme.error EB29 The source coordinates are negative.}
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
	 * Returns {@code true} if this image is mutable.
	 *
	 * @return {@code true} if this image is mutable.
	 * @since 2017/02/10
	 */
	public final boolean isMutable()
	{
		return this._mutable && !isAnimated() && !isScalable();
	}
	
	/**
	 * Returns {@code true} if this image is scalable.
	 *
	 * @return {@code true} if this image is scalable.
	 * @since 2017/02/10







|







249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
	 * Returns {@code true} if this image is mutable.
	 *
	 * @return {@code true} if this image is mutable.
	 * @since 2017/02/10
	 */
	public final boolean isMutable()
	{
		return this._mutable && !this.isAnimated() && !this.isScalable();
	}
	
	/**
	 * Returns {@code true} if this image is scalable.
	 *
	 * @return {@code true} if this image is scalable.
	 * @since 2017/02/10
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
		// Check
		if (__b == null)
			throw new NullPointerException("NARG");
		
		// Could fail
		try
		{
			return createImage(new ByteArrayInputStream(__b, __o, __l));
		}
		
		// {@squirreljme.error EB2d Could not load the image data.}
		catch (IOException e)
		{
			throw new IllegalArgumentException("EB2d", e);
		}







|







287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
		// Check
		if (__b == null)
			throw new NullPointerException("NARG");
		
		// Could fail
		try
		{
			return Image.createImage(new ByteArrayInputStream(__b, __o, __l));
		}
		
		// {@squirreljme.error EB2d Could not load the image data.}
		catch (IOException e)
		{
			throw new IllegalArgumentException("EB2d", e);
		}
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
	 * @throws IllegalArgumentException If the requested image size has a zero
	 * or negative dimension.
	 * @since 2017/02/11
	 */
	public static Image createImage(int __w, int __h)
		throws IllegalArgumentException
	{
		return createImage(__w, __h, false, 0x00FFFFFF);
	}
	
	/**
	 * Creates a mutable image that may or may not have an alpha channel.
	 *
	 * @param __w The width of the image.
	 * @param __h The height of the image.







|







310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
	 * @throws IllegalArgumentException If the requested image size has a zero
	 * or negative dimension.
	 * @since 2017/02/11
	 */
	public static Image createImage(int __w, int __h)
		throws IllegalArgumentException
	{
		return Image.createImage(__w, __h, false, 0x00FFFFFF);
	}
	
	/**
	 * Creates a mutable image that may or may not have an alpha channel.
	 *
	 * @param __w The width of the image.
	 * @param __h The height of the image.
349
350
351
352
353
354
355

356
357
358
359
360
361
362
		return new Image(data, __w, __h, true, __alpha);
	}
	
	/**
	 * Loads the image from the specified input stream.
	 *
	 * @param __is The stream to read image data from.

	 * @throws IOException If the image could not be read.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/02/28
	 */
	public static Image createImage(InputStream __is)
		throws IOException, NullPointerException
	{







>







348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
		return new Image(data, __w, __h, true, __alpha);
	}
	
	/**
	 * Loads the image from the specified input stream.
	 *
	 * @param __is The stream to read image data from.
	 * @return The parsed image.
	 * @throws IOException If the image could not be read.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/02/28
	 */
	public static Image createImage(InputStream __is)
		throws IOException, NullPointerException
	{
393
394
395
396
397
398
399

400
401
402
403
404
405
406
		return ImageReaderDispatcher.parse(new ByteArrayInputStream(copy));
	}
	
	/**
	 * This loads the specified resource as an image.
	 *
	 * @param __s The string to load the resource for.

	 * @throws IOException If the resource does not exist or the image data
	 * could not be decoded.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/02/28
	 */
	public static Image createImage(String __s)
		throws IOException, NullPointerException







>







393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
		return ImageReaderDispatcher.parse(new ByteArrayInputStream(copy));
	}
	
	/**
	 * This loads the specified resource as an image.
	 *
	 * @param __s The string to load the resource for.
	 * @return The created image.
	 * @throws IOException If the resource does not exist or the image data
	 * could not be decoded.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/02/28
	 */
	public static Image createImage(String __s)
		throws IOException, NullPointerException
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
			getResourceAsStream(__s))
		{
			// {@squirreljme.error EB2f The specified resource does not
			// exist. (The resource name)}
			if (is == null)
				throw new IOException(String.format("EB2f %s", __s));
			
			return createImage(is);
		}
	}
	
	/**
	 * Creates an immutable image which is an exact copy of the other image. If
	 * the other image is scalable it will be rasterized with whatever
	 * dimensions the other image has. If the specified image is immutable then







|







415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
			getResourceAsStream(__s))
		{
			// {@squirreljme.error EB2f The specified resource does not
			// exist. (The resource name)}
			if (is == null)
				throw new IOException(String.format("EB2f %s", __s));
			
			return Image.createImage(is);
		}
	}
	
	/**
	 * Creates an immutable image which is an exact copy of the other image. If
	 * the other image is scalable it will be rasterized with whatever
	 * dimensions the other image has. If the specified image is immutable then
451
452
453
454
455
456
457
458

459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474




475
476
477
478
479
480
481
		return new Image(__i._data.clone(), __i._width, __i._height,
			false, __i._alpha);
	}
	
	public static Image createImage(Image __i, int __x, int __y,
		int __w, int __h, int __trans)
	{
		return Image.createImage(__i, __x, __y, __w, __h, __trans);

	}
	
	public static Image createImage(Image __i, int __x, int __y, int __w,
		int __h, int __trans, int __iw, int __ih)
	{
		throw new todo.TODO();
	}
	
	/**
	 * Creates an image from the specified ARGB pixel array.
	 *
	 * @param __rgb The ARGB or RGB image data to use as the image data.
	 * @param __w The width of the image.
	 * @param __h The height of the image.
	 * @param __alpha If {@code true} then the alpha is processed, otherwise
	 * all pixels are treated as fully opaque.




	 * @since 2017/02/10
	 */
	public static Image createRGBImage(int[] __rgb, int __w, int __h, boolean 
		__alpha)
		throws IllegalArgumentException, IndexOutOfBoundsException,
			NullPointerException
	{







|
>
















>
>
>
>







452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
		return new Image(__i._data.clone(), __i._width, __i._height,
			false, __i._alpha);
	}
	
	public static Image createImage(Image __i, int __x, int __y,
		int __w, int __h, int __trans)
	{
		return Image.createImage(__i, __x, __y, __w, __h, __trans,
			__i.getWidth(), __i.getHeight());
	}
	
	public static Image createImage(Image __i, int __x, int __y, int __w,
		int __h, int __trans, int __iw, int __ih)
	{
		throw new todo.TODO();
	}
	
	/**
	 * Creates an image from the specified ARGB pixel array.
	 *
	 * @param __rgb The ARGB or RGB image data to use as the image data.
	 * @param __w The width of the image.
	 * @param __h The height of the image.
	 * @param __alpha If {@code true} then the alpha is processed, otherwise
	 * all pixels are treated as fully opaque.
	 * @return The created image.
	 * @throws IllegalArgumentException If the width or height is negative.
	 * @throws IndexOutOfBoundsException If the input array is too small.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/02/10
	 */
	public static Image createRGBImage(int[] __rgb, int __w, int __h, boolean 
		__alpha)
		throws IllegalArgumentException, IndexOutOfBoundsException,
			NullPointerException
	{

Name change from runt/apis/midp-lcdui/javax/microedition/lcdui/ImageItem.java to modules/midp-lcdui/src/main/java/javax/microedition/lcdui/ImageItem.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package javax.microedition.lcdui;

import cc.squirreljme.runtime.lcdui.SerializedEvent;

public class ImageItem
	extends Item
{
	public static final int LAYOUT_CENTER =
		3;
	
	public static final int LAYOUT_DEFAULT =












<
<







1
2
3
4
5
6
7
8
9
10
11
12


13
14
15
16
17
18
19
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package javax.microedition.lcdui;



public class ImageItem
	extends Item
{
	public static final int LAYOUT_CENTER =
		3;
	
	public static final int LAYOUT_DEFAULT =
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
	 * @param __alt The alternative text.
	 * @throws IllegalArgumentException If the layout is not valid.
	 * @since 2019/05/17
	 */
	public ImageItem(String __l, Image __i, int __lay, String __alt)
		throws IllegalArgumentException
	{
		this(__l, __i, __lay, __alt, PLAIN);
	}
	
	/**
	 * Initializes the image item.
	 *
	 * @param __l The label.
	 * @param __i The image.
	 * @param __lay The layout.
	 * @param __alt The alternative text.
	 * @param __am The appearance mode.
	 * @throws IllegalArgumentException If the layout is not valid.
	 * @since 2019/05/17
	 */
	public ImageItem(String __l, Image __i, int __lay, String __alt, int __am)
		throws IllegalArgumentException
	{
		super(__l);
		
		// {@squirreljme.error EB2i The appearance mode is not valid.
		// (The appearance mode)}
		if (__am != PLAIN && __am != BUTTON && __am != HYPERLINK)
			throw new IllegalArgumentException("EB2i " + __am);
		
		this._image = __i;
		this._alt = __alt;
		this._amode = __am;
		
		// Set the layout







|




















|







49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
	 * @param __alt The alternative text.
	 * @throws IllegalArgumentException If the layout is not valid.
	 * @since 2019/05/17
	 */
	public ImageItem(String __l, Image __i, int __lay, String __alt)
		throws IllegalArgumentException
	{
		this(__l, __i, __lay, __alt, Item.PLAIN);
	}
	
	/**
	 * Initializes the image item.
	 *
	 * @param __l The label.
	 * @param __i The image.
	 * @param __lay The layout.
	 * @param __alt The alternative text.
	 * @param __am The appearance mode.
	 * @throws IllegalArgumentException If the layout is not valid.
	 * @since 2019/05/17
	 */
	public ImageItem(String __l, Image __i, int __lay, String __alt, int __am)
		throws IllegalArgumentException
	{
		super(__l);
		
		// {@squirreljme.error EB2i The appearance mode is not valid.
		// (The appearance mode)}
		if (__am != Item.PLAIN && __am != Item.BUTTON && __am != Item.HYPERLINK)
			throw new IllegalArgumentException("EB2i " + __am);
		
		this._image = __i;
		this._alt = __alt;
		this._amode = __am;
		
		// Set the layout

Name change from runt/apis/midp-lcdui/javax/microedition/lcdui/Item.java to modules/midp-lcdui/src/main/java/javax/microedition/lcdui/Item.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package javax.microedition.lcdui;

import cc.squirreljme.runtime.lcdui.fbui.UIState;
import cc.squirreljme.runtime.lcdui.SerializedEvent;

public abstract class Item
{
	public static final int BUTTON =
		2;
	
	public static final int HYPERLINK =













<







1
2
3
4
5
6
7
8
9
10
11
12
13

14
15
16
17
18
19
20
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package javax.microedition.lcdui;

import cc.squirreljme.runtime.lcdui.fbui.UIState;


public abstract class Item
{
	public static final int BUTTON =
		2;
	
	public static final int HYPERLINK =
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
	public static final int PLAIN =
		0;
	
	/** The owning displayable. */
	volatile Displayable _displayable;
	
	/** The current layout of the item. */
	volatile int _layout =
		LAYOUT_DEFAULT;
	
	/** The label of this item. */
	volatile String _label;
	
	/** The preferred width. */
	volatile int _preferredw =
		-1;







|
<







65
66
67
68
69
70
71
72

73
74
75
76
77
78
79
	public static final int PLAIN =
		0;
	
	/** The owning displayable. */
	volatile Displayable _displayable;
	
	/** The current layout of the item. */
	volatile int _layout = Item.LAYOUT_DEFAULT;

	
	/** The label of this item. */
	volatile String _label;
	
	/** The preferred width. */
	volatile int _preferredw =
		-1;

Name change from runt/apis/midp-lcdui/javax/microedition/lcdui/ItemCommandListener.java to modules/midp-lcdui/src/main/java/javax/microedition/lcdui/ItemCommandListener.java.

11
12
13
14
15
16
17
18
19
20
21
package javax.microedition.lcdui;

import cc.squirreljme.runtime.lcdui.SerializedEvent;

public interface ItemCommandListener
{
	@SerializedEvent
	public abstract void commandAction(Command __a, Item __b);
}









|



11
12
13
14
15
16
17
18
19
20
21
package javax.microedition.lcdui;

import cc.squirreljme.runtime.lcdui.SerializedEvent;

public interface ItemCommandListener
{
	@SerializedEvent
	void commandAction(Command __a, Item __b);
}


Name change from runt/apis/midp-lcdui/javax/microedition/lcdui/ItemLayoutHint.java to modules/midp-lcdui/src/main/java/javax/microedition/lcdui/ItemLayoutHint.java.

Name change from runt/apis/midp-lcdui/javax/microedition/lcdui/ItemStateListener.java to modules/midp-lcdui/src/main/java/javax/microedition/lcdui/ItemStateListener.java.

11
12
13
14
15
16
17
18
19
20
21
package javax.microedition.lcdui;

import cc.squirreljme.runtime.lcdui.SerializedEvent;

public interface ItemStateListener
{
	@SerializedEvent
	public abstract void itemStateChanged(Item __a);
}









|



11
12
13
14
15
16
17
18
19
20
21
package javax.microedition.lcdui;

import cc.squirreljme.runtime.lcdui.SerializedEvent;

public interface ItemStateListener
{
	@SerializedEvent
	void itemStateChanged(Item __a);
}


Name change from runt/apis/midp-lcdui/javax/microedition/lcdui/ItemTraversalListener.java to modules/midp-lcdui/src/main/java/javax/microedition/lcdui/ItemTraversalListener.java.

11
12
13
14
15
16
17
18
19
20
21
22
23
package javax.microedition.lcdui;

import cc.squirreljme.runtime.lcdui.SerializedEvent;

public interface ItemTraversalListener
{
	@SerializedEvent
	public abstract void itemTraversedIn(Item __i);
	
	@SerializedEvent
	public abstract void itemTraversedOut(Item __i);
}








|


|


11
12
13
14
15
16
17
18
19
20
21
22
23
package javax.microedition.lcdui;

import cc.squirreljme.runtime.lcdui.SerializedEvent;

public interface ItemTraversalListener
{
	@SerializedEvent
	void itemTraversedIn(Item __i);
	
	@SerializedEvent
	void itemTraversedOut(Item __i);
}

Name change from runt/apis/midp-lcdui/javax/microedition/lcdui/KeyListener.java to modules/midp-lcdui/src/main/java/javax/microedition/lcdui/KeyListener.java.

19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
 * if shift is held down then letters will be uppercase).
 *
 * @since 2017/02/12
 */
public interface KeyListener
{
	/** The chr alt modifier. */
	public static final int MODIFIER_ALT =
		65536;

	/** The chr key modifier. */
	public static final int MODIFIER_CHR =
		8388608;

	/** The command key modifier. */
	public static final int MODIFIER_COMMAND =
		4194304;

	/** The ctrl key modifier. */
	public static final int MODIFIER_CTRL =
		262144;

	/** The mask for modifiers. */
	public static final int MODIFIER_MASK =
		13041664;

	/** The shift key modifier. */
	public static final int MODIFIER_SHIFT =
		131072;
	
	/**
	 * Called when a key is pressed.
	 *
	 * @param __kc The key code.
	 * @param __km The modifiers to the key.
	 * @sicne 2017/02/12
	 */
	public abstract void keyPressed(int __kc, int __km);
	
	/**
	 * Called when a key is released.
	 *
	 * @param __kc The key code.
	 * @param __km The modifiers to the key.
	 * @sicne 2017/02/12
	 */
	public abstract void keyReleased(int __kc, int __km);
	
	/**
	 * Called when a key is repeated.
	 *
	 * @param __kc The key code.
	 * @param __km The modifiers to the key.
	 * @sicne 2017/02/12
	 */
	public abstract void keyRepeated(int __kc, int __km);
}








|



|



|



|



|



|







|

|






|

|






|

|


19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
 * if shift is held down then letters will be uppercase).
 *
 * @since 2017/02/12
 */
public interface KeyListener
{
	/** The chr alt modifier. */
	int MODIFIER_ALT =
		65536;

	/** The chr key modifier. */
	int MODIFIER_CHR =
		8388608;

	/** The command key modifier. */
	int MODIFIER_COMMAND =
		4194304;

	/** The ctrl key modifier. */
	int MODIFIER_CTRL =
		262144;

	/** The mask for modifiers. */
	int MODIFIER_MASK =
		13041664;

	/** The shift key modifier. */
	int MODIFIER_SHIFT =
		131072;
	
	/**
	 * Called when a key is pressed.
	 *
	 * @param __kc The key code.
	 * @param __km The modifiers to the key.
	 * @since 2017/02/12
	 */
	void keyPressed(int __kc, int __km);
	
	/**
	 * Called when a key is released.
	 *
	 * @param __kc The key code.
	 * @param __km The modifiers to the key.
	 * @since 2017/02/12
	 */
	void keyReleased(int __kc, int __km);
	
	/**
	 * Called when a key is repeated.
	 *
	 * @param __kc The key code.
	 * @param __km The modifiers to the key.
	 * @since 2017/02/12
	 */
	void keyRepeated(int __kc, int __km);
}

Name change from runt/apis/midp-lcdui/javax/microedition/lcdui/List.java to modules/midp-lcdui/src/main/java/javax/microedition/lcdui/List.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package javax.microedition.lcdui;

import cc.squirreljme.runtime.cldc.annotation.ImplementationNote;
import cc.squirreljme.runtime.cldc.asm.NativeDisplayEventCallback;
import cc.squirreljme.runtime.lcdui.common.CommonColors;
import cc.squirreljme.runtime.lcdui.common.CommonMetrics;
import cc.squirreljme.runtime.lcdui.fbui.UIState;
import cc.squirreljme.runtime.lcdui.SerializedEvent;

public class List
	extends Screen
	implements Choice
{
	/** The default select command used for lists. */
	public static final Command SELECT_COMMAND =













<
<
<

<







1
2
3
4
5
6
7
8
9
10
11
12
13



14

15
16
17
18
19
20
21
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package javax.microedition.lcdui;

import cc.squirreljme.runtime.cldc.annotation.ImplementationNote;



import cc.squirreljme.runtime.lcdui.fbui.UIState;


public class List
	extends Screen
	implements Choice
{
	/** The default select command used for lists. */
	public static final Command SELECT_COMMAND =
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
		// Check bounds
		__VolatileList__<__ChoiceEntry__> items = this._items;
		int n = items.size();
		if (__i < 0 || __i >= n)
			throw new IndexOutOfBoundsException("IOOB");
		
		// If deselecting or using this on multiple lists, just direct set
		if (!__e || this._type == MULTIPLE)
			items.get(__i)._selected = __e;
		
		// Otherwise only select the item that matches the index
		else
		{
			for (int i = 0; i < n; i++)
				this._items.get(i)._selected = (__i == i);







|







350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
		// Check bounds
		__VolatileList__<__ChoiceEntry__> items = this._items;
		int n = items.size();
		if (__i < 0 || __i >= n)
			throw new IndexOutOfBoundsException("IOOB");
		
		// If deselecting or using this on multiple lists, just direct set
		if (!__e || this._type == Choice.MULTIPLE)
			items.get(__i)._selected = __e;
		
		// Otherwise only select the item that matches the index
		else
		{
			for (int i = 0; i < n; i++)
				this._items.get(i)._selected = (__i == i);

Name change from runt/apis/midp-lcdui/javax/microedition/lcdui/Menu.java to modules/midp-lcdui/src/main/java/javax/microedition/lcdui/Menu.java.

Name change from runt/apis/midp-lcdui/javax/microedition/lcdui/Notification.java to modules/midp-lcdui/src/main/java/javax/microedition/lcdui/Notification.java.

Name change from runt/apis/midp-lcdui/javax/microedition/lcdui/NotificationException.java to modules/midp-lcdui/src/main/java/javax/microedition/lcdui/NotificationException.java.

11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package javax.microedition.lcdui;

public class NotificationException
	extends RuntimeException
{
	public NotificationException()
	{
		super();
	}
	
	public NotificationException(String __s)
	{
		super(__s);
	}
}







<







11
12
13
14
15
16
17

18
19
20
21
22
23
24
package javax.microedition.lcdui;

public class NotificationException
	extends RuntimeException
{
	public NotificationException()
	{

	}
	
	public NotificationException(String __s)
	{
		super(__s);
	}
}

Name change from runt/apis/midp-lcdui/javax/microedition/lcdui/NotificationListener.java to modules/midp-lcdui/src/main/java/javax/microedition/lcdui/NotificationListener.java.

8
9
10
11
12
13
14
15
16
17
18
19
20
21
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package javax.microedition.lcdui;

public interface NotificationListener
{
	public abstract void notificationDismissed(Notification __n);
	
	public abstract void notificationSelected(Notification __n);
	
	public abstract void notificationTimeout(Notification __n);
}








|

|

|


8
9
10
11
12
13
14
15
16
17
18
19
20
21
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package javax.microedition.lcdui;

public interface NotificationListener
{
	void notificationDismissed(Notification __n);
	
	void notificationSelected(Notification __n);
	
	void notificationTimeout(Notification __n);
}

Name change from runt/apis/midp-lcdui/javax/microedition/lcdui/NotificationType.java to modules/midp-lcdui/src/main/java/javax/microedition/lcdui/NotificationType.java.

Name change from runt/apis/midp-lcdui/javax/microedition/lcdui/ScalableImage.java to modules/midp-lcdui/src/main/java/javax/microedition/lcdui/ScalableImage.java.

Name change from runt/apis/midp-lcdui/javax/microedition/lcdui/Screen.java to modules/midp-lcdui/src/main/java/javax/microedition/lcdui/Screen.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package javax.microedition.lcdui;

import cc.squirreljme.runtime.lcdui.SerializedEvent;

/**
 * This is the base class for all user interactable displays.
 *
 * It is only recommended to change the screen contents when it is not being
 * displayed.
 *
 * @since 2017/02/28












<
<







1
2
3
4
5
6
7
8
9
10
11
12


13
14
15
16
17
18
19
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package javax.microedition.lcdui;



/**
 * This is the base class for all user interactable displays.
 *
 * It is only recommended to change the screen contents when it is not being
 * displayed.
 *
 * @since 2017/02/28

Name change from runt/apis/midp-lcdui/javax/microedition/lcdui/Spacer.java to modules/midp-lcdui/src/main/java/javax/microedition/lcdui/Spacer.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package javax.microedition.lcdui;

import cc.squirreljme.runtime.lcdui.SerializedEvent;

public class Spacer
	extends Item
{
	public Spacer(int __a, int __b)
	{
		super();
		throw new todo.TODO();
	}
	
	/**
	 * Commands are not supported for this item.
	 *
	 * @param __a Ignored.












<
<





<







1
2
3
4
5
6
7
8
9
10
11
12


13
14
15
16
17

18
19
20
21
22
23
24
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package javax.microedition.lcdui;



public class Spacer
	extends Item
{
	public Spacer(int __a, int __b)
	{

		throw new todo.TODO();
	}
	
	/**
	 * Commands are not supported for this item.
	 *
	 * @param __a Ignored.

Name change from runt/apis/midp-lcdui/javax/microedition/lcdui/StringItem.java to modules/midp-lcdui/src/main/java/javax/microedition/lcdui/StringItem.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package javax.microedition.lcdui;

import cc.squirreljme.runtime.lcdui.phoneui.StandardMetrics;
import cc.squirreljme.runtime.lcdui.SerializedEvent;

public class StringItem
	extends Item
{
	/** Apperance mode. */
	final int _amode;
	













<







1
2
3
4
5
6
7
8
9
10
11
12
13

14
15
16
17
18
19
20
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package javax.microedition.lcdui;

import cc.squirreljme.runtime.lcdui.phoneui.StandardMetrics;


public class StringItem
	extends Item
{
	/** Apperance mode. */
	final int _amode;
	
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44

45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
	 *
	 * @param __l The label.
	 * @param __t The text.
	 * @since 2019/05/17
	 */
	public StringItem(String __l, String __t)
	{
		this(__l, __t, PLAIN);
	}
	
	/**
	 * Initializes the string item with the plain style.
	 *
	 * @param __l The label.
	 * @param __t The text.

	 * @throws IllegalArgumentException If the appearance mode is not valid.
	 * @since 2019/05/17
	 */
	public StringItem(String __l, String __t, int __am)
		throws IllegalArgumentException
	{
		super(__l);
		
		// {@squirreljme.error EB2o The appearance mode is not valid.
		// (The appearance mode)}
		if (__am != PLAIN && __am != BUTTON && __am != HYPERLINK)
			throw new IllegalArgumentException("EB2o " + __am);
		
		this._text = __t;
		this._amode = __am;
	}
	
	public int getAppearanceMode()







|







>










|







29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
	 *
	 * @param __l The label.
	 * @param __t The text.
	 * @since 2019/05/17
	 */
	public StringItem(String __l, String __t)
	{
		this(__l, __t, Item.PLAIN);
	}
	
	/**
	 * Initializes the string item with the plain style.
	 *
	 * @param __l The label.
	 * @param __t The text.
	 * @param __am The appearance mode.
	 * @throws IllegalArgumentException If the appearance mode is not valid.
	 * @since 2019/05/17
	 */
	public StringItem(String __l, String __t, int __am)
		throws IllegalArgumentException
	{
		super(__l);
		
		// {@squirreljme.error EB2o The appearance mode is not valid.
		// (The appearance mode)}
		if (__am != Item.PLAIN && __am != Item.BUTTON && __am != Item.HYPERLINK)
			throw new IllegalArgumentException("EB2o " + __am);
		
		this._text = __t;
		this._amode = __am;
	}
	
	public int getAppearanceMode()

Name change from runt/apis/midp-lcdui/javax/microedition/lcdui/TabListener.java to modules/midp-lcdui/src/main/java/javax/microedition/lcdui/TabListener.java.

26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
	 * has been added to the tabbed pane.
	 *
	 * @param __i The index where insertion is to occur.
	 * @param __tab The screen that was added to the tabbed pane.
	 * @since 2018/03/29
	 */
	@SerializedEvent
	public abstract void tabAddedEvent(int __i, Screen __tab);
	
	/**
	 * This indicates when a new tab has been focused and will indicate the
	 * screen which now has focus.
	 *
	 * @param __tab The tab which now has focus.
	 * @since 2018/03/29
	 */
	@SerializedEvent
	public abstract void tabChangeEvent(Screen __tab);
	
	/**
	 * This is called after a tab has been removed and only specifies the
	 * index of that tab.
	 *
	 * @param __i The tab that has been removed.
	 * @since 2018/03/29
	 */
	@SerializedEvent
	public abstract void tabRemoveEvent(int __i);
}








|









|









|


26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
	 * has been added to the tabbed pane.
	 *
	 * @param __i The index where insertion is to occur.
	 * @param __tab The screen that was added to the tabbed pane.
	 * @since 2018/03/29
	 */
	@SerializedEvent
	void tabAddedEvent(int __i, Screen __tab);
	
	/**
	 * This indicates when a new tab has been focused and will indicate the
	 * screen which now has focus.
	 *
	 * @param __tab The tab which now has focus.
	 * @since 2018/03/29
	 */
	@SerializedEvent
	void tabChangeEvent(Screen __tab);
	
	/**
	 * This is called after a tab has been removed and only specifies the
	 * index of that tab.
	 *
	 * @param __i The tab that has been removed.
	 * @since 2018/03/29
	 */
	@SerializedEvent
	void tabRemoveEvent(int __i);
}

Name change from runt/apis/midp-lcdui/javax/microedition/lcdui/TabbedPane.java to modules/midp-lcdui/src/main/java/javax/microedition/lcdui/TabbedPane.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package javax.microedition.lcdui;

import java.util.ArrayList;
import java.util.List;

public class TabbedPane
	extends Screen
{
	public TabbedPane(String __title, boolean __stringtab, boolean __suptitle)
	{
		throw new todo.TODO();
	}












<
<
<







1
2
3
4
5
6
7
8
9
10
11
12



13
14
15
16
17
18
19
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package javax.microedition.lcdui;




public class TabbedPane
	extends Screen
{
	public TabbedPane(String __title, boolean __stringtab, boolean __suptitle)
	{
		throw new todo.TODO();
	}

Name change from runt/apis/midp-lcdui/javax/microedition/lcdui/TableLayoutPolicy.java to modules/midp-lcdui/src/main/java/javax/microedition/lcdui/TableLayoutPolicy.java.

Name change from runt/apis/midp-lcdui/javax/microedition/lcdui/Text.java to modules/midp-lcdui/src/main/java/javax/microedition/lcdui/Text.java.

8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package javax.microedition.lcdui;

import cc.squirreljme.runtime.lcdui.common.CommonColors;
import cc.squirreljme.runtime.lcdui.common.TextStorage;
import cc.squirreljme.runtime.cldc.annotation.ImplementationNote;
import java.util.Arrays;

/**
 * This text class is one which handles all of the text metrics and drawing and
 * such. It handles different fonts, colors, and styles on a per character
 * basis and performs all the needed operations to support text drawing.
 *
 * The color defaults to {@code Display.getColor(Display.COLOR_FOREGROUND)}.







<
<







8
9
10
11
12
13
14


15
16
17
18
19
20
21
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package javax.microedition.lcdui;

import cc.squirreljme.runtime.lcdui.common.CommonColors;
import cc.squirreljme.runtime.lcdui.common.TextStorage;



/**
 * This text class is one which handles all of the text metrics and drawing and
 * such. It handles different fonts, colors, and styles on a per character
 * basis and performs all the needed operations to support text drawing.
 *
 * The color defaults to {@code Display.getColor(Display.COLOR_FOREGROUND)}.
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
	/** The alignment of each line. */
	private int _align;
	
	/** Indentation. */
	private int _indentation;
	
	/** The direction of the text. */
	private int _direction =
		DIRECTION_NEUTRAL;
	
	/** Scrolling offset (scrolled up by n pixels). */
	private int _scrolloffset;
	
	/** The highlight index. */
	private int _highlightdx =
		-1;







|
<







92
93
94
95
96
97
98
99

100
101
102
103
104
105
106
	/** The alignment of each line. */
	private int _align;
	
	/** Indentation. */
	private int _indentation;
	
	/** The direction of the text. */
	private int _direction = Text.DIRECTION_NEUTRAL;

	
	/** Scrolling offset (scrolled up by n pixels). */
	private int _scrolloffset;
	
	/** The highlight index. */
	private int _highlightdx =
		-1;
141
142
143
144
145
146
147


148
149
150
151
152
153
154
		this(__c, 0, __c.length(), __w, __h);
	}
	
	/**
	 * Initializes the text with the given width and height.
	 *
	 * @param __c The text to use.


	 * @param __w The width.
	 * @param __h The height.
	 * @throws IllegalArgumentException If the width or height are negative.
	 * @throws IndexOutOfBoundsException If the offset and/or length are
	 * negative or exceed the array bounds.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/11/29







>
>







138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
		this(__c, 0, __c.length(), __w, __h);
	}
	
	/**
	 * Initializes the text with the given width and height.
	 *
	 * @param __c The text to use.
	 * @param __o The offset.
	 * @param __l The length.
	 * @param __w The width.
	 * @param __h The height.
	 * @throws IllegalArgumentException If the width or height are negative.
	 * @throws IndexOutOfBoundsException If the offset and/or length are
	 * negative or exceed the array bounds.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/11/29
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
	 * @throws IllegalArgumentException If the alignment is not valid.
	 * @since 2018/12/02
	 */
	public void setAlignment(int __a)
		throws IllegalArgumentException
	{
		// {@squirreljme.error EB2s Invalid alignment. (The alignment)}
		if (__a != ALIGN_LEFT && __a != ALIGN_CENTER && __a != ALIGN_RIGHT &&
			__a != ALIGN_JUSTIFY && __a != ALIGN_DEFAULT)
			throw new IllegalArgumentException("EB2s " + __a);
		
		this._alignment = __a;
	}
	
	/**
	 * Sets the background color.







|
|







591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
	 * @throws IllegalArgumentException If the alignment is not valid.
	 * @since 2018/12/02
	 */
	public void setAlignment(int __a)
		throws IllegalArgumentException
	{
		// {@squirreljme.error EB2s Invalid alignment. (The alignment)}
		if (__a != Text.ALIGN_LEFT && __a != Text.ALIGN_CENTER && __a != Text.ALIGN_RIGHT &&
			__a != Text.ALIGN_JUSTIFY && __a != Text.ALIGN_DEFAULT)
			throw new IllegalArgumentException("EB2s " + __a);
		
		this._alignment = __a;
	}
	
	/**
	 * Sets the background color.
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
	 * @throws IllegalArgumentException If the direction is not valid.
	 * @since 2018/12/02
	 */
	public void setInitialDirection(int __dir)
		throws IllegalArgumentException
	{
		// {@squirreljme.error EB2u The direction to use. (The direction)}
		if (__dir != DIRECTION_LTR && __dir != DIRECTION_RTL &&
			__dir != DIRECTION_NEUTRAL)
			throw new IllegalArgumentException("EB2u " + __dir);
		
		this._direction = __dir;
	}
	
	/**
	 * Sets the scroll offset.







|
|







786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
	 * @throws IllegalArgumentException If the direction is not valid.
	 * @since 2018/12/02
	 */
	public void setInitialDirection(int __dir)
		throws IllegalArgumentException
	{
		// {@squirreljme.error EB2u The direction to use. (The direction)}
		if (__dir != Text.DIRECTION_LTR && __dir != Text.DIRECTION_RTL &&
			__dir != Text.DIRECTION_NEUTRAL)
			throw new IllegalArgumentException("EB2u " + __dir);
		
		this._direction = __dir;
	}
	
	/**
	 * Sets the scroll offset.
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
		int align = this._align;
		int indentation = this._indentation;
		int direction = this._direction;
		int scrolloffset = this._scrolloffset;
		
		// If the direction is neutral, this just becomes the locale default
		// For now just treat it as LTR
		if (direction == DIRECTION_NEUTRAL)
			direction = DIRECTION_LTR;
		
		// Are we going right to left?
		boolean dortl = (direction == DIRECTION_RTL);
		
		// Will use this storage stuff
		TextStorage storage = this._storage;
		char[] chars = storage.chars;
		Font[] font = storage.font;
		short[] cx = storage.x;
		short[] cy = storage.y;







|
|


|







892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
		int align = this._align;
		int indentation = this._indentation;
		int direction = this._direction;
		int scrolloffset = this._scrolloffset;
		
		// If the direction is neutral, this just becomes the locale default
		// For now just treat it as LTR
		if (direction == Text.DIRECTION_NEUTRAL)
			direction = Text.DIRECTION_LTR;
		
		// Are we going right to left?
		boolean dortl = (direction == Text.DIRECTION_RTL);
		
		// Will use this storage stuff
		TextStorage storage = this._storage;
		char[] chars = storage.chars;
		Font[] font = storage.font;
		short[] cx = storage.x;
		short[] cy = storage.y;
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
					
					// The Y position is just the difference in space between
					// the line's max ascent and the character's actual ascent
					cy[q] = (short)(y + (linemaxascent - origascent));
				}
				
				// Handle non-default alignments
				if ((dortl && align != ALIGN_RIGHT) ||
					(!dortl && align != ALIGN_LEFT))
				{
					throw new todo.TODO();
				}
				
				// A line was here so the line count goes up
				linecount++;
				







|
|







1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
					
					// The Y position is just the difference in space between
					// the line's max ascent and the character's actual ascent
					cy[q] = (short)(y + (linemaxascent - origascent));
				}
				
				// Handle non-default alignments
				if ((dortl && align != Text.ALIGN_RIGHT) ||
					(!dortl && align != Text.ALIGN_LEFT))
				{
					throw new todo.TODO();
				}
				
				// A line was here so the line count goes up
				linecount++;
				

Name change from runt/apis/midp-lcdui/javax/microedition/lcdui/TextBox.java to modules/midp-lcdui/src/main/java/javax/microedition/lcdui/TextBox.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package javax.microedition.lcdui;

import cc.squirreljme.runtime.lcdui.common.EditableText;
import cc.squirreljme.runtime.lcdui.SerializedEvent;

public class TextBox
	extends Screen
{
	/** The common text editor this is associated with. */
	private final EditableText _editabletext =
		new EditableText();













<







1
2
3
4
5
6
7
8
9
10
11
12
13

14
15
16
17
18
19
20
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package javax.microedition.lcdui;

import cc.squirreljme.runtime.lcdui.common.EditableText;


public class TextBox
	extends Screen
{
	/** The common text editor this is associated with. */
	private final EditableText _editabletext =
		new EditableText();
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
	 * @since 2017/10/20
	 */
	public TextBox(String __title, String __text, int __max, int __con)
		throws IllegalArgumentException
	{
		// Set title if there is one
		if (__title != null)
			setTitle(__title);
		
		// Initialize editor with the given set of values
		this._editabletext.initialize(__text, __max, __con);
	}
	
	public void delete(int __a, int __b)
	{







|







32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
	 * @since 2017/10/20
	 */
	public TextBox(String __title, String __text, int __max, int __con)
		throws IllegalArgumentException
	{
		// Set title if there is one
		if (__title != null)
			this.setTitle(__title);
		
		// Initialize editor with the given set of values
		this._editabletext.initialize(__text, __max, __con);
	}
	
	public void delete(int __a, int __b)
	{

Name change from runt/apis/midp-lcdui/javax/microedition/lcdui/TextEditor.java to modules/midp-lcdui/src/main/java/javax/microedition/lcdui/TextEditor.java.

Name change from runt/apis/midp-lcdui/javax/microedition/lcdui/TextEditorChangeListener.java to modules/midp-lcdui/src/main/java/javax/microedition/lcdui/TextEditorChangeListener.java.

8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package javax.microedition.lcdui;

public interface TextEditorChangeListener
{
	public static final int ACTION_CARET_MOVE =
		4;
	
	public static final int ACTION_CONTENT_CHANGE =
		1;
	
	public static final int ACTION_DIRECTION_CHANGE =
		64;
	
	public static final int ACTION_INPUT_MODE_CHANGE =
		128;
	
	public static final int ACTION_LANGUAGE_CHANGE =
		256;
	
	public static final int ACTION_TRAVERSE_NEXT =
		16;
	
	public static final int ACTION_TRAVERSE_PREVIOUS =
		8;
	
	public abstract void inputAction(TextEditor __e, int __act);
}








|


|


|


|


|


|


|


|


8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package javax.microedition.lcdui;

public interface TextEditorChangeListener
{
	int ACTION_CARET_MOVE =
		4;
	
	int ACTION_CONTENT_CHANGE =
		1;
	
	int ACTION_DIRECTION_CHANGE =
		64;
	
	int ACTION_INPUT_MODE_CHANGE =
		128;
	
	int ACTION_LANGUAGE_CHANGE =
		256;
	
	int ACTION_TRAVERSE_NEXT =
		16;
	
	int ACTION_TRAVERSE_PREVIOUS =
		8;
	
	void inputAction(TextEditor __e, int __act);
}

Name change from runt/apis/midp-lcdui/javax/microedition/lcdui/TextField.java to modules/midp-lcdui/src/main/java/javax/microedition/lcdui/TextField.java.

170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
	 * exceeds the maximum specified characters.
	 * @since 2017/08/19
	 */
	public TextField(String __l, String __t, int __ms, int __c)
		throws IllegalArgumentException
	{
		// Standard item properties
		setLabel(__l);
		
		// Initialize text area
		this._editabletext.initialize(__t, __ms, __c);
	}
	
	public void delete(int __a, int __b)
	{







|







170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
	 * exceeds the maximum specified characters.
	 * @since 2017/08/19
	 */
	public TextField(String __l, String __t, int __ms, int __c)
		throws IllegalArgumentException
	{
		// Standard item properties
		this.setLabel(__l);
		
		// Initialize text area
		this._editabletext.initialize(__t, __ms, __c);
	}
	
	public void delete(int __a, int __b)
	{

Name change from runt/apis/midp-lcdui/javax/microedition/lcdui/Ticker.java to modules/midp-lcdui/src/main/java/javax/microedition/lcdui/Ticker.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package javax.microedition.lcdui;

import cc.squirreljme.runtime.lcdui.fbui.UIState;
import cc.squirreljme.runtime.lcdui.SerializedEvent;

/**
 * A ticker contains an infinitely scrolling message.
 *
 * Any {@link Displayable} may have tickers associated with them in which
 * they will be shown at the top of the screen accordingly. As such these can
 * be used to convey information as needed.













<







1
2
3
4
5
6
7
8
9
10
11
12
13

14
15
16
17
18
19
20
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package javax.microedition.lcdui;

import cc.squirreljme.runtime.lcdui.fbui.UIState;


/**
 * A ticker contains an infinitely scrolling message.
 *
 * Any {@link Displayable} may have tickers associated with them in which
 * they will be shown at the top of the screen accordingly. As such these can
 * be used to convey information as needed.

Name change from runt/apis/midp-lcdui/javax/microedition/lcdui/__Action__.java to modules/midp-lcdui/src/main/java/javax/microedition/lcdui/__Action__.java.

Name change from runt/apis/midp-lcdui/javax/microedition/lcdui/__ChoiceEntry__.java to modules/midp-lcdui/src/main/java/javax/microedition/lcdui/__ChoiceEntry__.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package javax.microedition.lcdui;

import cc.squirreljme.runtime.lcdui.common.CommonColors;

/**
 * This is a package public mutable class which represents single choices
 * within anything which uses choices.
 *
 * @since 2017/08/20
 */
final class __ChoiceEntry__












<
<







1
2
3
4
5
6
7
8
9
10
11
12


13
14
15
16
17
18
19
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package javax.microedition.lcdui;



/**
 * This is a package public mutable class which represents single choices
 * within anything which uses choices.
 *
 * @since 2017/08/20
 */
final class __ChoiceEntry__

Name change from runt/apis/midp-lcdui/javax/microedition/lcdui/__GfxIPCDispatch__.java to modules/midp-lcdui/src/main/java/javax/microedition/lcdui/__GfxIPCDispatch__.java.

39
40
41
42
43
44
45
46
47
48
49
50
51
52
	 * Creates an instance of this class.
	 *
	 * @return The class instance.
	 * @since 2019/12/28
	 */
	static final __GfxIPCDispatch__ __instance()
	{
		__GfxIPCDispatch__ rv = _INSTANCE;
		if (rv == null)
			_INSTANCE = (rv = new __GfxIPCDispatch__());
		return rv;
	}
}








|

|




39
40
41
42
43
44
45
46
47
48
49
50
51
52
	 * Creates an instance of this class.
	 *
	 * @return The class instance.
	 * @since 2019/12/28
	 */
	static final __GfxIPCDispatch__ __instance()
	{
		__GfxIPCDispatch__ rv = __GfxIPCDispatch__._INSTANCE;
		if (rv == null)
			__GfxIPCDispatch__._INSTANCE = (rv = new __GfxIPCDispatch__());
		return rv;
	}
}

Name change from runt/apis/midp-lcdui/javax/microedition/lcdui/__VolatileList__.java to modules/midp-lcdui/src/main/java/javax/microedition/lcdui/__VolatileList__.java.

Name change from runt/apis/midp-lcdui/javax/microedition/lcdui/game/GameCanvas.java to modules/midp-lcdui/src/main/java/javax/microedition/lcdui/game/GameCanvas.java.

10
11
12
13
14
15
16
17
18
19
20
21
22
23
24

package javax.microedition.lcdui.game;

import cc.squirreljme.runtime.lcdui.gfx.AdvancedGraphics;
import cc.squirreljme.runtime.lcdui.gfx.ForwardingGraphics;
import javax.microedition.lcdui.Canvas;
import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;

public abstract class GameCanvas
	extends Canvas
{
	public static final int DOWN_PRESSED =
		64;
	







<







10
11
12
13
14
15
16

17
18
19
20
21
22
23

package javax.microedition.lcdui.game;

import cc.squirreljme.runtime.lcdui.gfx.AdvancedGraphics;
import cc.squirreljme.runtime.lcdui.gfx.ForwardingGraphics;
import javax.microedition.lcdui.Canvas;
import javax.microedition.lcdui.Graphics;


public abstract class GameCanvas
	extends Canvas
{
	public static final int DOWN_PRESSED =
		64;
	

Name change from runt/apis/midp-lcdui/javax/microedition/lcdui/game/Layer.java to modules/midp-lcdui/src/main/java/javax/microedition/lcdui/game/Layer.java.

12
13
14
15
16
17
18
19
20
21
22
23
24
25
26

import javax.microedition.lcdui.Graphics;

public abstract class Layer
{
	Layer()
	{
		super();
		throw new todo.TODO();
	}
	
	public abstract void paint(Graphics __a);
	
	public final int getHeight()
	{







<







12
13
14
15
16
17
18

19
20
21
22
23
24
25

import javax.microedition.lcdui.Graphics;

public abstract class Layer
{
	Layer()
	{

		throw new todo.TODO();
	}
	
	public abstract void paint(Graphics __a);
	
	public final int getHeight()
	{

Name change from runt/apis/midp-lcdui/javax/microedition/lcdui/game/LayerManager.java to modules/midp-lcdui/src/main/java/javax/microedition/lcdui/game/LayerManager.java.

12
13
14
15
16
17
18
19
20
21
22
23
24
25
26

import javax.microedition.lcdui.Graphics;

public class LayerManager
{
	public LayerManager()
	{
		super();
		throw new todo.TODO();
	}
	
	public void append(Layer __a)
	{
		throw new todo.TODO();
	}







<







12
13
14
15
16
17
18

19
20
21
22
23
24
25

import javax.microedition.lcdui.Graphics;

public class LayerManager
{
	public LayerManager()
	{

		throw new todo.TODO();
	}
	
	public void append(Layer __a)
	{
		throw new todo.TODO();
	}

Name change from runt/apis/midp-lcdui/javax/microedition/lcdui/game/Sprite.java to modules/midp-lcdui/src/main/java/javax/microedition/lcdui/game/Sprite.java.

38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
		6;
	
	public static final int TRANS_ROT90 =
		5;
	
	public Sprite(Image __a)
	{
		super();
		throw new todo.TODO();
	}
	
	public Sprite(Image __a, int __b, int __c)
	{
		super();
		throw new todo.TODO();
	}
	
	public Sprite(Sprite __a)
	{
		super();
		throw new todo.TODO();
	}
	
	public final boolean collidesWith(Image __a, int __b, int __c, boolean 
		__d)
	{
		throw new todo.TODO();







<





<





<







38
39
40
41
42
43
44

45
46
47
48
49

50
51
52
53
54

55
56
57
58
59
60
61
		6;
	
	public static final int TRANS_ROT90 =
		5;
	
	public Sprite(Image __a)
	{

		throw new todo.TODO();
	}
	
	public Sprite(Image __a, int __b, int __c)
	{

		throw new todo.TODO();
	}
	
	public Sprite(Sprite __a)
	{

		throw new todo.TODO();
	}
	
	public final boolean collidesWith(Image __a, int __b, int __c, boolean 
		__d)
	{
		throw new todo.TODO();

Name change from runt/apis/midp-lcdui/javax/microedition/lcdui/game/TiledLayer.java to modules/midp-lcdui/src/main/java/javax/microedition/lcdui/game/TiledLayer.java.

14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import javax.microedition.lcdui.Image;

public class TiledLayer
	extends Layer
{
	public TiledLayer(int __a, int __b, Image __c, int __d, int __e)
	{
		super();
		throw new todo.TODO();
	}
	
	public int createAnimatedTile(int __a)
	{
		throw new todo.TODO();
	}







<







14
15
16
17
18
19
20

21
22
23
24
25
26
27
import javax.microedition.lcdui.Image;

public class TiledLayer
	extends Layer
{
	public TiledLayer(int __a, int __b, Image __c, int __d, int __e)
	{

		throw new todo.TODO();
	}
	
	public int createAnimatedTile(int __a)
	{
		throw new todo.TODO();
	}

Name change from runt/apis/midp-lcdui/cc/squirreljme/runtime/lcdui/font/monospace-12.sqf.__mime to modules/midp-lcdui/src/main/resources/cc/squirreljme/runtime/lcdui/font/monospace-12.sqf.__mime.

Name change from runt/apis/midp-lcdui/cc/squirreljme/runtime/lcdui/font/monospace-16.sqf.__mime to modules/midp-lcdui/src/main/resources/cc/squirreljme/runtime/lcdui/font/monospace-16.sqf.__mime.

Name change from runt/apis/midp-lcdui/cc/squirreljme/runtime/lcdui/font/monospace-8.sqf.__mime to modules/midp-lcdui/src/main/resources/cc/squirreljme/runtime/lcdui/font/monospace-8.sqf.__mime.

Name change from runt/apis/midp-lcdui/cc/squirreljme/runtime/lcdui/font/sansserif-12.sqf.__mime to modules/midp-lcdui/src/main/resources/cc/squirreljme/runtime/lcdui/font/sansserif-12.sqf.__mime.

Name change from runt/apis/midp-lcdui/cc/squirreljme/runtime/lcdui/font/sansserif-16.sqf.__mime to modules/midp-lcdui/src/main/resources/cc/squirreljme/runtime/lcdui/font/sansserif-16.sqf.__mime.

Name change from runt/apis/midp-lcdui/cc/squirreljme/runtime/lcdui/font/sansserif-8.sqf.__mime to modules/midp-lcdui/src/main/resources/cc/squirreljme/runtime/lcdui/font/sansserif-8.sqf.__mime.

Name change from runt/apis/midp-lcdui/cc/squirreljme/runtime/lcdui/font/serif-12.sqf.__mime to modules/midp-lcdui/src/main/resources/cc/squirreljme/runtime/lcdui/font/serif-12.sqf.__mime.

Name change from runt/apis/midp-lcdui/cc/squirreljme/runtime/lcdui/font/serif-16.sqf.__mime to modules/midp-lcdui/src/main/resources/cc/squirreljme/runtime/lcdui/font/serif-16.sqf.__mime.

Name change from runt/apis/midp-lcdui/cc/squirreljme/runtime/lcdui/font/serif-8.sqf.__mime to modules/midp-lcdui/src/main/resources/cc/squirreljme/runtime/lcdui/font/serif-8.sqf.__mime.

Name change from runt/apis/midp-lcdui/cc/squirreljme/runtime/lcdui/font/symbol-12.sqf.__mime to modules/midp-lcdui/src/main/resources/cc/squirreljme/runtime/lcdui/font/symbol-12.sqf.__mime.

Name change from runt/apis/midp-lcdui/cc/squirreljme/runtime/lcdui/font/symbol-16.sqf.__mime to modules/midp-lcdui/src/main/resources/cc/squirreljme/runtime/lcdui/font/symbol-16.sqf.__mime.

Name change from runt/apis/midp-lcdui/cc/squirreljme/runtime/lcdui/font/symbol-8.sqf.__mime to modules/midp-lcdui/src/main/resources/cc/squirreljme/runtime/lcdui/font/symbol-8.sqf.__mime.

Name change from runt/apis/midp-lcdui.test/TestDisplay.java to modules/midp-lcdui/src/test/java/TestDisplay.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

import net.multiphasicapps.tac.TestRunnable;

import javax.microedition.lcdui.Display;

/**
 * Tests that the display works.
 *
 * @since 2018/11/12
 */
public class TestDisplay
	extends TestRunnable












<
<







1
2
3
4
5
6
7
8
9
10
11
12


13
14
15
16
17
18
19
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

import net.multiphasicapps.tac.TestRunnable;



/**
 * Tests that the display works.
 *
 * @since 2018/11/12
 */
public class TestDisplay
	extends TestRunnable

Name change from runt/apis/midp-lcdui.test/TestFont.java to modules/midp-lcdui/src/test/java/TestFont.java.

Name change from runt/apis/midp-lcdui.test/__Utils__.java to modules/midp-lcdui/src/test/java/__Utils__.java.

Added modules/midp-lcdui/src/test/java/display/TestDisplayInitialize.java.



































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package display;

import javax.microedition.lcdui.Canvas;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Graphics;
import net.multiphasicapps.tac.TestRunnable;

/**
 * Not Described
 *
 * @since 2020/02/29
 */
public class TestDisplayInitialize
	extends TestRunnable
{
	/**
	 * {@inheritDoc}
	 * @since 2020/02/29
	 */
	@Override
	public void test()
	{
		Display display = Display.getDisplay(this);
		
		display.setCurrent(new __BlankCanvas__());
	}
	
	/**
	 * Blank canvas, needed because the display appears when a displayable is
	 * added.
	 *
	 * @since 2020/02/29
	 */
	private static final class __BlankCanvas__
		extends Canvas
	{
		/**
		 * Initialization.
		 *
		 * @since 2020/02/29
		 */
		__BlankCanvas__()
		{
		}
		
		/**
		 * {@inheritDoc}
		 * @since 2020/02/29
		 */
		@Override
		protected void paint(Graphics __g)
		{
			// Does nothing
		}
	}
}

Name change from runt/apis/midp-lcdui.test/TestDisplay.in to modules/midp-lcdui/src/test/resources/TestDisplay.in.

Name change from runt/apis/midp-lcdui.test/TestFont.in to modules/midp-lcdui/src/test/resources/TestFont.in.

Added modules/midp-lcdui/src/test/resources/display/TestDisplayInitialize.in.





>
>
1
2
result: NoResult
thrown: NoExceptionThrown

Added modules/opengles/build.gradle.









































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import cc.squirreljme.plugin.swm.JavaMEMidletType

description = "This project contains the base support needed " +
	"for OpenGL ES 1.1 functionality defined by JSR 239."
version = rootProject.version

squirreljme
{
	javaDocErrorCode = "EJ"
	swmType = JavaMEMidletType.API
	swmName = "OpenGL ES"
	swmVendor = "Stephanie Gawroriski"
}

dependencies
{
	implementation project(":modules:cldc")

	implementation project(":modules:midp-lcdui")
}

Name change from runt/apis/opengles/cc/squirreljme/runtime/opengles/DefaultDisplay.java to modules/opengles/src/main/java/cc/squirreljme/runtime/opengles/DefaultDisplay.java.

Name change from runt/apis/opengles/cc/squirreljme/runtime/opengles/DefaultEGL.java to modules/opengles/src/main/java/cc/squirreljme/runtime/opengles/DefaultEGL.java.

32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
	
	/** The end of temporary enumerants. */
	public static final int TEMPORARY_ENUMERANT_END =
		32767;
	
	/** The start of the SquirrelJME enumerant. */
	public static final int SQUIRRELJME_ENUMERANT_START =
		TEMPORARY_ENUMERANT_START;
	
	/** The end of the SquirrelJME enumerant. */
	public static final int SQUIRRELJME_ENUMERANT_END =
		SQUIRRELJME_ENUMERANT_START + 16;
	
	/** The OpenGL ES error code. */
	private volatile int _error =
		EGL11.EGL_SUCCESS;
	
	/**
	 * {@inheritDoc}







|



|







32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
	
	/** The end of temporary enumerants. */
	public static final int TEMPORARY_ENUMERANT_END =
		32767;
	
	/** The start of the SquirrelJME enumerant. */
	public static final int SQUIRRELJME_ENUMERANT_START =
		DefaultEGL.TEMPORARY_ENUMERANT_START;
	
	/** The end of the SquirrelJME enumerant. */
	public static final int SQUIRRELJME_ENUMERANT_END =
		DefaultEGL.SQUIRRELJME_ENUMERANT_START + 16;
	
	/** The OpenGL ES error code. */
	private volatile int _error =
		EGL11.EGL_SUCCESS;
	
	/**
	 * {@inheritDoc}

Name change from runt/apis/opengles/cc/squirreljme/runtime/opengles/package-info.java to modules/opengles/src/main/java/cc/squirreljme/runtime/opengles/package-info.java.

Name change from runt/apis/opengles/javax/microedition/khronos/egl/EGL.java to modules/opengles/src/main/java/javax/microedition/khronos/egl/EGL.java.

Name change from runt/apis/opengles/javax/microedition/khronos/egl/EGL10.java to modules/opengles/src/main/java/javax/microedition/khronos/egl/EGL10.java.

16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
 * This interface defines the standard OpenGL ES definitions and methods.
 *
 * To initialize a display, {@link #eglGetDisplay(Object)} must be called
 * where the {@link Object} is an instance of
 * {@link javax.microedition.lcdui.Display}.
 *
 * OpenGL ES is utilized by calling
 * {@link #eglCreateWindowSurface(EGLDisplay, EGLConfig, Object, int[]). The
 * {@link Object} parameter in this call represents a native surface to draw
 * onto. In this case, it is an instance of
 * {@link javax.microedition.lcdui.Graphics}.
 */
public interface EGL10
	extends EGL
{
	/**
	 * The minimum size in bits that the alpha buffer/channel must be.
	 *
	 * A value of zero means to prefer the smallest buffer, while a positive
	 * value selects the highest available buffer size.
	 *
	 * Default 0.
	 */
	public static final int EGL_ALPHA_SIZE =
		12321;
	
	public static final int EGL_BAD_ACCESS =
		12290;
	
	public static final int EGL_BAD_ALLOC =
		12291;
	
	public static final int EGL_BAD_ATTRIBUTE =
		12292;
	
	public static final int EGL_BAD_CONFIG =
		12293;
	
	public static final int EGL_BAD_CONTEXT =
		12294;
	
	public static final int EGL_BAD_CURRENT_SURFACE =
		12295;
	
	/** This is an error specifying that the given display is not valid. */
	public static final int EGL_BAD_DISPLAY =
		12296;
	
	public static final int EGL_BAD_MATCH =
		12297;
	
	public static final int EGL_BAD_NATIVE_PIXMAP =
		12298;
	
	public static final int EGL_BAD_NATIVE_WINDOW =
		12299;
	
	public static final int EGL_BAD_PARAMETER =
		12300;
	
	public static final int EGL_BAD_SURFACE =
		12301;
	
	/**
	 * The minimum size in bits that the blue buffer/channel must be.
	 *
	 * A value of zero means to prefer the smallest buffer, while a positive
	 * value selects the highest available buffer size.
	 *
	 * Default 0.
	 */
	public static final int EGL_BLUE_SIZE =
		12322;
	
	/**
	 * Attribute for the minimum desired size of the color buffer.
	 *
	 * Default 0.
	 */
	public static final int EGL_BUFFER_SIZE =
		12320;
	
	/**
	 * Configurations may have caveats, as such this allows conifgurations
	 * with caveats to be selected.
	 *
	 * May be either {@link #EGL_SLOW_CONFIG}, {@link #EGL_NONE} to use one
	 * with no caveats, {@link #EGL_NON_CONFORMANT_CONFIG}, or
	 * {@link #EGL_DONT_CARE} if it does not matter.
	 *
	 * Default {@link #EGL_DONT_CARE}.
	 */
	public static final int EGL_CONFIG_CAVEAT =
		12327;
	
	/**
	 * A precomposed OpenGL ES configuration to choose, if this is specified
	 * then all other attributes are ignored. The value is implementation
	 * dependent.
	 *
	 * Default {@link #EGL_DONT_CARE}.
	 */
	public static final int EGL_CONFIG_ID =
		12328;
	
	public static final int EGL_CORE_NATIVE_ENGINE =
		12379;
	
	/** This is used to signify that the default display should be used. */
	public static final Object EGL_DEFAULT_DISPLAY =
		new Object();
	
	/**
	 * The minimum size in bits that the depth buffer must be.
	 *
	 * A value of zero means to not use this buffer.
	 *
	 * Default 0.
	 */
	public static final int EGL_DEPTH_SIZE =
		12325;
	
	public static final int EGL_DONT_CARE =
		-1;
	
	public static final int EGL_DRAW =
		12377;
	
	/**
	 * A value for {@link #eglQueryString(EGLDisplay, int)} that requests the
	 * extensions that are available to this OpenGL ES implementation.
	 */
	public static final int EGL_EXTENSIONS =
		12373;
	
	public static final int EGL_FALSE =
		0;
	
	/**
	 * The minimum size in bits that the green buffer/channel must be.
	 *
	 * A value of zero means to prefer the smallest buffer, while a positive
	 * value selects the highest available buffer size.
	 *
	 * Default 0.
	 */
	public static final int EGL_GREEN_SIZE =
		12323;
	
	public static final int EGL_HEIGHT =
		12374;
	
	public static final int EGL_LARGEST_PBUFFER =
		12376;
	
	/**
	 * The exact number of buffer-levels to use, positive values mean the given
	 * number of overlay buffers and negative values are mapped to underlay
	 * buffers. Level zero is the default framebuffer of the display.
	 *
	 * Default 0.
	 */
	public static final int EGL_LEVEL =
		12329;
	
	public static final int EGL_MAX_PBUFFER_HEIGHT =
		12330;
	
	public static final int EGL_MAX_PBUFFER_PIXELS =
		12331;
	
	public static final int EGL_MAX_PBUFFER_WIDTH =
		12332;
	
	/**
	 * Specifies configurations that allow native rendering onto the surface
	 * or not. {@link #EGL_DONT_CARE} can choose any, {@link #EGL_TRUE}
	 * chooses configurations that allow native rendering, and
	 * {@link #EGL_FALSE} choose configurations that disallow native
	 * rendering.
	 *
	 * Default {@link #EGL_DONT_CARE}.
	 */
	public static final int EGL_NATIVE_RENDERABLE =
		12333;
	
	public static final int EGL_NATIVE_VISUAL_ID =
		12334;
	
	/**
	 * A platform specified value or {@link #EGL_DONT_CARE}.
	 *
	 * Default {@link #EGL_DONT_CARE}.
	 */
	public static final int EGL_NATIVE_VISUAL_TYPE =
		12335;
	
	public static final int EGL_NONE =
		12344;
	
	public static final int EGL_NON_CONFORMANT_CONFIG =
		12369;
	
	/** An error specifying that the display has not been initialized. */
	public static final int EGL_NOT_INITIALIZED =
		12289;
	
	/** This represents a null context. */
	public static final EGLContext EGL_NO_CONTEXT =
		new EGLContext()
		{
			/**
			 * {@inheritDoc}
			 * @since 2016/10/10
			 */
			@Override
			public GL getGL()
			{
				// {@squirreljme.error EJ0a Cannot get the GL instance of
				// a null context.}
				throw new RuntimeException("EJ0a");
			}
		};
	
	/** This represents a null display. */
	public static final EGLDisplay EGL_NO_DISPLAY =
		new EGLDisplay()
		{
		};
	
	/** This represents a null surface. */
	public static final EGLSurface EGL_NO_SURFACE =
		new EGLSurface()
		{
		};
	
	/**
	 * Specifies that the surface is capable of creating pixel buffer
	 * surfaces.
	 */
	public static final int EGL_PBUFFER_BIT =
		1;
	
	/** Specifies that the surface is capable of creating pixmap surfaces. */
	public static final int EGL_PIXMAP_BIT =
		2;
	
	public static final int EGL_PRESERVED_RESOURCES =
		12336;
	
	public static final int EGL_READ =
		12378;
	
	/**
	 * The minimum size in bits that the red buffer/channel must be.
	 *
	 * A value of zero means to prefer the smallest buffer, while a positive
	 * value selects the highest available buffer size.
	 *
	 * Default 0.
	 */
	public static final int EGL_RED_SIZE =
		12324;
	
	/**
	 * The minimum number of samples needed in the sample buffers.
	 *
	 * Default unspecified.
	 */
	public static final int EGL_SAMPLES =
		12337;
	
	/**
	 * The minimum number of acceptable multi-sample buffers. Configurations
	 * that are closer to this value are preferred.
	 *
	 * Default 0.
	 */
	public static final int EGL_SAMPLE_BUFFERS =
		12338;
	
	public static final int EGL_SLOW_CONFIG =
		12368;
	
	/**
	 * The minimum size in bits that the stencil buffer must be.
	 *
	 * A value of zero means to not use this buffer.
	 *
	 * Default 0.
	 */
	public static final int EGL_STENCIL_SIZE =
		12326;
	
	public static final int EGL_SUCCESS =
		12288;
	
	/**
	 * Represents the type of surface to use, this is a bitmask. The valid
	 * bits are {@link #EGL_WINDOW_BIT}, {@link #EGL_PBUFFER_BIT}, and
	 * {@link #EGL_PIXMAP_BIT}.
	 *
	 * Default {@link #EGL_WINDOW_BIT}.
	 */
	public static final int EGL_SURFACE_TYPE =
		12339;
	
	/**
	 * The transparent blue channel value to use. The value must be between
	 * {@code 0} and the maximum range for the given channel. Only
	 * configurations that use this specific color for transparent values will
	 * be considered.
	 *
	 * Default {@link #EGL_DONT_CARE}.
	 */
	public static final int EGL_TRANSPARENT_BLUE_VALUE =
		12341;
	
	/**
	 * The transparent green channel value to use. The value must be between
	 * {@code 0} and the maximum range for the given channel. Only
	 * configurations that use this specific color for transparent values will
	 * be considered.
	 *
	 * Default {@link #EGL_DONT_CARE}.
	 */
	public static final int EGL_TRANSPARENT_GREEN_VALUE =
		12342;
	
	/**
	 * The transparent red channel value to use. The value must be between
	 * {@code 0} and the maximum range for the given channel. Only
	 * configurations that use this specific color for transparent values will
	 * be considered.
	 *
	 * Default {@link #EGL_DONT_CARE}.
	 */
	public static final int EGL_TRANSPARENT_RED_VALUE =
		12343;
	
	public static final int EGL_TRANSPARENT_RGB =
		12370;
	
	/**
	 * The type of transparent framebuffer to use.
	 *
	 * May be {@link #EGL_NONE} then opaque framebuffers are used, otherwise
	 * {@link #EGL_TRANSPARENT_RGB} specifies that transparent framebuffers
	 * are used.
	 *
	 * Transparent framebuffers might not be supported.
	 *
	 * Default {@link #EGL_NONE}.
	 */
	public static final int EGL_TRANSPARENT_TYPE =
		12340;
	
	public static final int EGL_TRUE =
		1;
	
	/**
	 * A value for {@link #eglQueryString(EGLDisplay, int)} that requests the
	 * OpenGL ES vendor.
	 */
	public static final int EGL_VENDOR =
		12371;
	
	/**
	 * A value for {@link #eglQueryString(EGLDisplay, int)} that requests the
	 * OpenGL ES version in the form of {@code major.minor vendor-specific}.
	 */
	public static final int EGL_VERSION =
		12372;
	
	public static final int EGL_WIDTH =
		12375;
	
	/** Supports creation of window surfaces. */
	public static final int EGL_WINDOW_BIT =
		4;
	
	/**
	 * This returns an array of framebuffer configurations that match the
	 * given input attributes.
	 *
	 * This method attempts to match all of the attributes that were specified.







|
|
|













|


|


|


|


|


|


|



|


|


|


|


|


|










|







|












|









|


|



|









|


|


|






|


|










|


|


|









|


|


|


|











|


|







|


|


|



|



|
















|





|








|



|


|


|










|







|








|


|









|


|









|










|










|










|


|













|


|






|






|


|



|







16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
 * This interface defines the standard OpenGL ES definitions and methods.
 *
 * To initialize a display, {@link #eglGetDisplay(Object)} must be called
 * where the {@link Object} is an instance of
 * {@link javax.microedition.lcdui.Display}.
 *
 * OpenGL ES is utilized by calling
 * {@link EGL10#eglCreateWindowSurface(EGLDisplay, EGLConfig, Object, int[])}.
 * The {@link Object} parameter in this call represents a native surface to
 * draw onto. In this case, it is an instance of
 * {@link javax.microedition.lcdui.Graphics}.
 */
public interface EGL10
	extends EGL
{
	/**
	 * The minimum size in bits that the alpha buffer/channel must be.
	 *
	 * A value of zero means to prefer the smallest buffer, while a positive
	 * value selects the highest available buffer size.
	 *
	 * Default 0.
	 */
	int EGL_ALPHA_SIZE =
		12321;
	
	int EGL_BAD_ACCESS =
		12290;
	
	int EGL_BAD_ALLOC =
		12291;
	
	int EGL_BAD_ATTRIBUTE =
		12292;
	
	int EGL_BAD_CONFIG =
		12293;
	
	int EGL_BAD_CONTEXT =
		12294;
	
	int EGL_BAD_CURRENT_SURFACE =
		12295;
	
	/** This is an error specifying that the given display is not valid. */
	int EGL_BAD_DISPLAY =
		12296;
	
	int EGL_BAD_MATCH =
		12297;
	
	int EGL_BAD_NATIVE_PIXMAP =
		12298;
	
	int EGL_BAD_NATIVE_WINDOW =
		12299;
	
	int EGL_BAD_PARAMETER =
		12300;
	
	int EGL_BAD_SURFACE =
		12301;
	
	/**
	 * The minimum size in bits that the blue buffer/channel must be.
	 *
	 * A value of zero means to prefer the smallest buffer, while a positive
	 * value selects the highest available buffer size.
	 *
	 * Default 0.
	 */
	int EGL_BLUE_SIZE =
		12322;
	
	/**
	 * Attribute for the minimum desired size of the color buffer.
	 *
	 * Default 0.
	 */
	int EGL_BUFFER_SIZE =
		12320;
	
	/**
	 * Configurations may have caveats, as such this allows conifgurations
	 * with caveats to be selected.
	 *
	 * May be either {@link #EGL_SLOW_CONFIG}, {@link #EGL_NONE} to use one
	 * with no caveats, {@link #EGL_NON_CONFORMANT_CONFIG}, or
	 * {@link #EGL_DONT_CARE} if it does not matter.
	 *
	 * Default {@link #EGL_DONT_CARE}.
	 */
	int EGL_CONFIG_CAVEAT =
		12327;
	
	/**
	 * A precomposed OpenGL ES configuration to choose, if this is specified
	 * then all other attributes are ignored. The value is implementation
	 * dependent.
	 *
	 * Default {@link #EGL_DONT_CARE}.
	 */
	int EGL_CONFIG_ID =
		12328;
	
	int EGL_CORE_NATIVE_ENGINE =
		12379;
	
	/** This is used to signify that the default display should be used. */
	Object EGL_DEFAULT_DISPLAY =
		new Object();
	
	/**
	 * The minimum size in bits that the depth buffer must be.
	 *
	 * A value of zero means to not use this buffer.
	 *
	 * Default 0.
	 */
	int EGL_DEPTH_SIZE =
		12325;
	
	int EGL_DONT_CARE =
		-1;
	
	int EGL_DRAW =
		12377;
	
	/**
	 * A value for {@link #eglQueryString(EGLDisplay, int)} that requests the
	 * extensions that are available to this OpenGL ES implementation.
	 */
	int EGL_EXTENSIONS =
		12373;
	
	int EGL_FALSE =
		0;
	
	/**
	 * The minimum size in bits that the green buffer/channel must be.
	 *
	 * A value of zero means to prefer the smallest buffer, while a positive
	 * value selects the highest available buffer size.
	 *
	 * Default 0.
	 */
	int EGL_GREEN_SIZE =
		12323;
	
	int EGL_HEIGHT =
		12374;
	
	int EGL_LARGEST_PBUFFER =
		12376;
	
	/**
	 * The exact number of buffer-levels to use, positive values mean the given
	 * number of overlay buffers and negative values are mapped to underlay
	 * buffers. Level zero is the default framebuffer of the display.
	 *
	 * Default 0.
	 */
	int EGL_LEVEL =
		12329;
	
	int EGL_MAX_PBUFFER_HEIGHT =
		12330;
	
	int EGL_MAX_PBUFFER_PIXELS =
		12331;
	
	int EGL_MAX_PBUFFER_WIDTH =
		12332;
	
	/**
	 * Specifies configurations that allow native rendering onto the surface
	 * or not. {@link #EGL_DONT_CARE} can choose any, {@link #EGL_TRUE}
	 * chooses configurations that allow native rendering, and
	 * {@link #EGL_FALSE} choose configurations that disallow native
	 * rendering.
	 *
	 * Default {@link #EGL_DONT_CARE}.
	 */
	int EGL_NATIVE_RENDERABLE =
		12333;
	
	int EGL_NATIVE_VISUAL_ID =
		12334;
	
	/**
	 * A platform specified value or {@link #EGL_DONT_CARE}.
	 *
	 * Default {@link #EGL_DONT_CARE}.
	 */
	int EGL_NATIVE_VISUAL_TYPE =
		12335;
	
	int EGL_NONE =
		12344;
	
	int EGL_NON_CONFORMANT_CONFIG =
		12369;
	
	/** An error specifying that the display has not been initialized. */
	int EGL_NOT_INITIALIZED =
		12289;
	
	/** This represents a null context. */
	EGLContext EGL_NO_CONTEXT =
		new EGLContext()
		{
			/**
			 * {@inheritDoc}
			 * @since 2016/10/10
			 */
			@Override
			public GL getGL()
			{
				// {@squirreljme.error EJ0a Cannot get the GL instance of
				// a null context.}
				throw new RuntimeException("EJ0a");
			}
		};
	
	/** This represents a null display. */
	EGLDisplay EGL_NO_DISPLAY =
		new EGLDisplay()
		{
		};
	
	/** This represents a null surface. */
	EGLSurface EGL_NO_SURFACE =
		new EGLSurface()
		{
		};
	
	/**
	 * Specifies that the surface is capable of creating pixel buffer
	 * surfaces.
	 */
	int EGL_PBUFFER_BIT =
		1;
	
	/** Specifies that the surface is capable of creating pixmap surfaces. */
	int EGL_PIXMAP_BIT =
		2;
	
	int EGL_PRESERVED_RESOURCES =
		12336;
	
	int EGL_READ =
		12378;
	
	/**
	 * The minimum size in bits that the red buffer/channel must be.
	 *
	 * A value of zero means to prefer the smallest buffer, while a positive
	 * value selects the highest available buffer size.
	 *
	 * Default 0.
	 */
	int EGL_RED_SIZE =
		12324;
	
	/**
	 * The minimum number of samples needed in the sample buffers.
	 *
	 * Default unspecified.
	 */
	int EGL_SAMPLES =
		12337;
	
	/**
	 * The minimum number of acceptable multi-sample buffers. Configurations
	 * that are closer to this value are preferred.
	 *
	 * Default 0.
	 */
	int EGL_SAMPLE_BUFFERS =
		12338;
	
	int EGL_SLOW_CONFIG =
		12368;
	
	/**
	 * The minimum size in bits that the stencil buffer must be.
	 *
	 * A value of zero means to not use this buffer.
	 *
	 * Default 0.
	 */
	int EGL_STENCIL_SIZE =
		12326;
	
	int EGL_SUCCESS =
		12288;
	
	/**
	 * Represents the type of surface to use, this is a bitmask. The valid
	 * bits are {@link #EGL_WINDOW_BIT}, {@link #EGL_PBUFFER_BIT}, and
	 * {@link #EGL_PIXMAP_BIT}.
	 *
	 * Default {@link #EGL_WINDOW_BIT}.
	 */
	int EGL_SURFACE_TYPE =
		12339;
	
	/**
	 * The transparent blue channel value to use. The value must be between
	 * {@code 0} and the maximum range for the given channel. Only
	 * configurations that use this specific color for transparent values will
	 * be considered.
	 *
	 * Default {@link #EGL_DONT_CARE}.
	 */
	int EGL_TRANSPARENT_BLUE_VALUE =
		12341;
	
	/**
	 * The transparent green channel value to use. The value must be between
	 * {@code 0} and the maximum range for the given channel. Only
	 * configurations that use this specific color for transparent values will
	 * be considered.
	 *
	 * Default {@link #EGL_DONT_CARE}.
	 */
	int EGL_TRANSPARENT_GREEN_VALUE =
		12342;
	
	/**
	 * The transparent red channel value to use. The value must be between
	 * {@code 0} and the maximum range for the given channel. Only
	 * configurations that use this specific color for transparent values will
	 * be considered.
	 *
	 * Default {@link #EGL_DONT_CARE}.
	 */
	int EGL_TRANSPARENT_RED_VALUE =
		12343;
	
	int EGL_TRANSPARENT_RGB =
		12370;
	
	/**
	 * The type of transparent framebuffer to use.
	 *
	 * May be {@link #EGL_NONE} then opaque framebuffers are used, otherwise
	 * {@link #EGL_TRANSPARENT_RGB} specifies that transparent framebuffers
	 * are used.
	 *
	 * Transparent framebuffers might not be supported.
	 *
	 * Default {@link #EGL_NONE}.
	 */
	int EGL_TRANSPARENT_TYPE =
		12340;
	
	int EGL_TRUE =
		1;
	
	/**
	 * A value for {@link #eglQueryString(EGLDisplay, int)} that requests the
	 * OpenGL ES vendor.
	 */
	int EGL_VENDOR =
		12371;
	
	/**
	 * A value for {@link #eglQueryString(EGLDisplay, int)} that requests the
	 * OpenGL ES version in the form of {@code major.minor vendor-specific}.
	 */
	int EGL_VERSION =
		12372;
	
	int EGL_WIDTH =
		12375;
	
	/** Supports creation of window surfaces. */
	int EGL_WINDOW_BIT =
		4;
	
	/**
	 * This returns an array of framebuffer configurations that match the
	 * given input attributes.
	 *
	 * This method attempts to match all of the attributes that were specified.
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
	 * {@link #EGL_STENCIL_SIZE},
	 * {@link #EGL_SURFACE_TYPE},
	 * {@link #EGL_TRANSPARENT_TYPE},
	 * {@link #EGL_TRANSPARENT_RED_VALUE},
	 * {@link #EGL_TRANSPARENT_GREEN_VALUE},
	 * {@link #EGL_TRANSPARENT_BLUE_VALUE},
	 * {@link EGL11#EGL_BIND_TO_TEXTURE_RGB},
	 * {@link EGL11#EGL_BING_TO_TEXTURE_RGBA},
	 * {@link EGL11#EGL_MAX_SWAP_INTERVAL},
	 * {@link EGL11#EGL_MIN_SWAP_INTERVAL}
	 *
	 * Conifgurations are sorted in the following order:
	 *
	 * 1. {@link #EGL_CONFIG_CAVEAT} with the order: {@link #EGL_NONE},
	 *    {@link #EGL_SLOW_CONFIG}, then {@link #EGL_NON_CONFORMANT_CONFIG}.
	 * 2. The number of bits for the red, green, blue, and alpha channels,
	 *    higher is better. If the value is zero or {@link #EGL_DONT_CARE} then
	 *    it is not considered.
	 * 3. Smaller {@link #EGL_BUFFER_SIZE}.
	 * 4. Smaller {@link #EGL_SAMPLE_BUFFERS}.
	 * 5. Smaller {@link #EGL_DEPTH_SIZE}.
	 * 6. Smaller {@link #EGL_STENCIL_SIZE}.
	 * 7. Platform dependent {@link #EGL_NATIVE_VISUAL_TYPE}.
	 * 8. Smaller {@link EGL_CONFIG_ID}.
	 * 9. Other attributes are not considered.
	 *
	 * The following errors are set:
	 *
	 * {@link #EGL_BAD_DISPLAY} if the display is not valid.
	 * {@link #EGL_BAD_ATTRIBUTE} if an attribute is not valid.
	 * {@link #EGL_NOT_INITIALIZED} if the display is not initialized.







|















|







423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
	 * {@link #EGL_STENCIL_SIZE},
	 * {@link #EGL_SURFACE_TYPE},
	 * {@link #EGL_TRANSPARENT_TYPE},
	 * {@link #EGL_TRANSPARENT_RED_VALUE},
	 * {@link #EGL_TRANSPARENT_GREEN_VALUE},
	 * {@link #EGL_TRANSPARENT_BLUE_VALUE},
	 * {@link EGL11#EGL_BIND_TO_TEXTURE_RGB},
	 * {@link EGL11#EGL_BIND_TO_TEXTURE_RGBA},
	 * {@link EGL11#EGL_MAX_SWAP_INTERVAL},
	 * {@link EGL11#EGL_MIN_SWAP_INTERVAL}
	 *
	 * Conifgurations are sorted in the following order:
	 *
	 * 1. {@link #EGL_CONFIG_CAVEAT} with the order: {@link #EGL_NONE},
	 *    {@link #EGL_SLOW_CONFIG}, then {@link #EGL_NON_CONFORMANT_CONFIG}.
	 * 2. The number of bits for the red, green, blue, and alpha channels,
	 *    higher is better. If the value is zero or {@link #EGL_DONT_CARE} then
	 *    it is not considered.
	 * 3. Smaller {@link #EGL_BUFFER_SIZE}.
	 * 4. Smaller {@link #EGL_SAMPLE_BUFFERS}.
	 * 5. Smaller {@link #EGL_DEPTH_SIZE}.
	 * 6. Smaller {@link #EGL_STENCIL_SIZE}.
	 * 7. Platform dependent {@link #EGL_NATIVE_VISUAL_TYPE}.
	 * 8. Smaller {@link #EGL_CONFIG_ID}.
	 * 9. Other attributes are not considered.
	 *
	 * The following errors are set:
	 *
	 * {@link #EGL_BAD_DISPLAY} if the display is not valid.
	 * {@link #EGL_BAD_ATTRIBUTE} if an attribute is not valid.
	 * {@link #EGL_NOT_INITIALIZED} if the display is not initialized.
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
	 * @throws IllegalArgumentException If no display was specified; If the
	 * attribute list is not terminated with {@link #EGL_NONE}; If the
	 * configurations were not null and the array length is shorter than the
	 * specified size; The number of configurations is not null and the length
	 * is zero.
	 * @since 2016/10/11
	 */
	public abstract boolean eglChooseConfig(EGLDisplay __disp, int[] __attrl,
		EGLConfig[] __confs, int __confssize, int[] __numconf)
		throws IllegalArgumentException;
	
	public abstract boolean eglCopyBuffers(EGLDisplay __a, EGLSurface __b, 
		Object __c);
	
	public abstract EGLContext eglCreateContext(EGLDisplay __a, EGLConfig __b
		, EGLContext __c, int[] __d);
	
	public abstract EGLSurface eglCreatePbufferSurface(EGLDisplay __a, 
		EGLConfig __b, int[] __c);
	
	public abstract EGLSurface eglCreatePixmapSurface(EGLDisplay __a, 
		EGLConfig __b, Object __c, int[] __d);
	
	public abstract EGLSurface eglCreateWindowSurface(EGLDisplay __a, 
		EGLConfig __b, Object __c, int[] __d);
	
	public abstract boolean eglDestroyContext(EGLDisplay __a, EGLContext __b
		);
	
	public abstract boolean eglDestroySurface(EGLDisplay __a, EGLSurface __b
		);
	
	public abstract boolean eglGetConfigAttrib(EGLDisplay __a, EGLConfig __b,
		int __c, int[] __d);
	
	public abstract boolean eglGetConfigs(EGLDisplay __a, EGLConfig[] __b, 
		int __c, int[] __d);
	
	public abstract EGLContext eglGetCurrentContext();
	
	public abstract EGLDisplay eglGetCurrentDisplay();
	
	public abstract EGLSurface eglGetCurrentSurface(int __a);
	
	/**
	 * This creates a connection to the given native display.
	 *
	 * If the return of this method succeeds, then the display must be
	 * initialized by calling {@link #eglInitialize(EGLDisplay, int[])}.
	 *
	 * No error code is set.
	 *
	 * @param __nd The native display object to use, in SquirrelJME this will
	 * be an instance of {@link javax.microedition.lcdui.Display}. This may
	 * be {@link #EGL_DEFAULT_DISPLAY} to use the default display.
	 * @return The OpenGL ES Display for the given native display, or
	 * {@code EGL_NO_DISPLAY} is returned on error.
	 * @throws IllegalArgumentException If {@code __nd} is {@code null} or is
	 * not compatible with the OpenGL ES backend.
	 * @since 2016/10/10
	 */
	public abstract EGLDisplay eglGetDisplay(Object __nd)
		throws IllegalArgumentException;
	
	/**
	 * Returns the last error code that was emitted from the last operation
	 * that was called.
	 *
	 * After the call, it is reset to {@link #EGL_SUCCESS}.
	 *
	 * @return The error code.
	 * @since 2016/10/11
	 */
	public abstract int eglGetError();
	
	/**
	 * Initializes the OpenGL ES display and optionally returns the version
	 * number of OpenGL ES.
	 *
	 * If a display is already initialized then the version numbers are
	 * returned.







|



|
<

|
|

|
|

|
|

|
|

|
<

|
<

|
|

|
|

|

|

|


















|











|







466
467
468
469
470
471
472
473
474
475
476
477

478
479
480
481
482
483
484
485
486
487
488
489
490
491

492
493

494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
	 * @throws IllegalArgumentException If no display was specified; If the
	 * attribute list is not terminated with {@link #EGL_NONE}; If the
	 * configurations were not null and the array length is shorter than the
	 * specified size; The number of configurations is not null and the length
	 * is zero.
	 * @since 2016/10/11
	 */
	boolean eglChooseConfig(EGLDisplay __disp, int[] __attrl,
		EGLConfig[] __confs, int __confssize, int[] __numconf)
		throws IllegalArgumentException;
	
	boolean eglCopyBuffers(EGLDisplay __a, EGLSurface __b, Object __c);

	
	EGLContext eglCreateContext(EGLDisplay __a, EGLConfig __b, EGLContext __c,
		int[] __d);
	
	EGLSurface eglCreatePbufferSurface(EGLDisplay __a, EGLConfig __b,
		int[] __c);
	
	EGLSurface eglCreatePixmapSurface(EGLDisplay __a, EGLConfig __b,
		Object __c, int[] __d);
	
	EGLSurface eglCreateWindowSurface(EGLDisplay __a, EGLConfig __b,
		Object __c, int[] __d);
	
	boolean eglDestroyContext(EGLDisplay __a, EGLContext __b);

	
	boolean eglDestroySurface(EGLDisplay __a, EGLSurface __b);

	
	boolean eglGetConfigAttrib(EGLDisplay __a, EGLConfig __b, int __c,
		int[] __d);
	
	boolean eglGetConfigs(EGLDisplay __a, EGLConfig[] __b, int __c,
	 int[] __d);
	
	EGLContext eglGetCurrentContext();
	
	EGLDisplay eglGetCurrentDisplay();
	
	EGLSurface eglGetCurrentSurface(int __a);
	
	/**
	 * This creates a connection to the given native display.
	 *
	 * If the return of this method succeeds, then the display must be
	 * initialized by calling {@link #eglInitialize(EGLDisplay, int[])}.
	 *
	 * No error code is set.
	 *
	 * @param __nd The native display object to use, in SquirrelJME this will
	 * be an instance of {@link javax.microedition.lcdui.Display}. This may
	 * be {@link #EGL_DEFAULT_DISPLAY} to use the default display.
	 * @return The OpenGL ES Display for the given native display, or
	 * {@code EGL_NO_DISPLAY} is returned on error.
	 * @throws IllegalArgumentException If {@code __nd} is {@code null} or is
	 * not compatible with the OpenGL ES backend.
	 * @since 2016/10/10
	 */
	EGLDisplay eglGetDisplay(Object __nd)
		throws IllegalArgumentException;
	
	/**
	 * Returns the last error code that was emitted from the last operation
	 * that was called.
	 *
	 * After the call, it is reset to {@link #EGL_SUCCESS}.
	 *
	 * @return The error code.
	 * @since 2016/10/11
	 */
	int eglGetError();
	
	/**
	 * Initializes the OpenGL ES display and optionally returns the version
	 * number of OpenGL ES.
	 *
	 * If a display is already initialized then the version numbers are
	 * returned.
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
	 * element is set to the major version number and the second element is set
	 * to the minor version number.
	 * @return {@code true} on success.
	 * @throws IllegalArgumentException If {@code __disp} is {@code null} or
	 * {@code __ver} is non-null and has a length lower than two.
	 * @since 2016/10/11
	 */
	public abstract boolean eglInitialize(EGLDisplay __disp, int[] __ver)
		throws IllegalArgumentException;
	
	public abstract boolean eglMakeCurrent(EGLDisplay __a, EGLSurface __b, 
		EGLSurface __c, EGLContext __d);
	
	public abstract boolean eglQueryContext(EGLDisplay __a, EGLContext __b, 
		int __c, int[] __d);
	
	/**
	 * Queries an implementation specific string from the specified display.
	 *
	 * Valid keys are: {@link #EGL_VENDOR}, {@link #EGL_VERSION}, and
	 * {@link #EGL_EXTENSIONS}.
	 *
	 * The following errors may be set:
	 *
	 * {@link #EGL_BAD_DISPLAY} if the display is not valid.
	 * {@link #EGL_NOT_INITIALIZED} if the display is not initialized.
	 * {@link #EGL_BAD_PARAMETER} if the name is not a valid value.
	 *
	 * @param __disp The display to query.
	 * @param __key The key value to obtain.
	 * @return The string value for the given display and variable or 
	 * {@code null} on failure.
	 * @throws IllegalArgumentException If {@code __disp} is {@code null}.
	 * @since 2016/10/11
	 */
	public abstract String eglQueryString(EGLDisplay __disp, int __key)
		throws IllegalArgumentException;
	
	public abstract boolean eglQuerySurface(EGLDisplay __a, EGLSurface __b, 
		int __c, int[] __d);
	
	public abstract boolean eglSwapBuffers(EGLDisplay __a, EGLSurface __b);
	
	public abstract boolean eglTerminate(EGLDisplay __a);
	
	public abstract boolean eglWaitGL();
	
	public abstract boolean eglWaitNative(int __a, Object __b);
}









|


|
|

|
|




















|


|
|

|

|

|

|



557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
	 * element is set to the major version number and the second element is set
	 * to the minor version number.
	 * @return {@code true} on success.
	 * @throws IllegalArgumentException If {@code __disp} is {@code null} or
	 * {@code __ver} is non-null and has a length lower than two.
	 * @since 2016/10/11
	 */
	boolean eglInitialize(EGLDisplay __disp, int[] __ver)
		throws IllegalArgumentException;
	
	boolean eglMakeCurrent(EGLDisplay __a, EGLSurface __b, EGLSurface __c,
		EGLContext __d);
	
	boolean eglQueryContext(EGLDisplay __a, EGLContext __b, int __c,
	 int[] __d);
	
	/**
	 * Queries an implementation specific string from the specified display.
	 *
	 * Valid keys are: {@link #EGL_VENDOR}, {@link #EGL_VERSION}, and
	 * {@link #EGL_EXTENSIONS}.
	 *
	 * The following errors may be set:
	 *
	 * {@link #EGL_BAD_DISPLAY} if the display is not valid.
	 * {@link #EGL_NOT_INITIALIZED} if the display is not initialized.
	 * {@link #EGL_BAD_PARAMETER} if the name is not a valid value.
	 *
	 * @param __disp The display to query.
	 * @param __key The key value to obtain.
	 * @return The string value for the given display and variable or 
	 * {@code null} on failure.
	 * @throws IllegalArgumentException If {@code __disp} is {@code null}.
	 * @since 2016/10/11
	 */
	String eglQueryString(EGLDisplay __disp, int __key)
		throws IllegalArgumentException;
	
	boolean eglQuerySurface(EGLDisplay __a, EGLSurface __b, int __c,
	 int[] __d);
	
	boolean eglSwapBuffers(EGLDisplay __a, EGLSurface __b);
	
	boolean eglTerminate(EGLDisplay __a);
	
	boolean eglWaitGL();
	
	boolean eglWaitNative(int __a, Object __b);
}


Name change from runt/apis/opengles/javax/microedition/khronos/egl/EGL11.java to modules/opengles/src/main/java/javax/microedition/khronos/egl/EGL11.java.

10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97

package javax.microedition.khronos.egl;


public interface EGL11
	extends EGL10
{
	public static final int EGL_BACK_BUFFER =
		12420;
	
	/**
	 * Specifies whether or not binding color buffers to RGB textures is
	 * supported. The value may be {@link EGL10#EGL_DONT_CARE},
	 * {@link EGL10#EGL_FALSE}, or {@link EGL10#EGL_TRUE}.
	 *
	 * Default {@link EGL10#EGL_DONT_CARE}.
	 */
	public static final int EGL_BIND_TO_TEXTURE_RGB =
		12345;
	
	/**
	 * Specifies whether or not binding color buffers to RGBA textures is
	 * supported. The value may be {@link EGL10#EGL_DONT_CARE},
	 * {@link EGL10#EGL_FALSE}, or {@link EGL10#EGL_TRUE}.
	 *
	 * Default {@link EGL10#EGL_DONT_CARE}.
	 */
	public static final int EGL_BIND_TO_TEXTURE_RGBA =
		12346;
	
	public static final int EGL_CONTEXT_LOST =
		12302;
	
	/**
	 * The maximum value that may be passed to
	 * {@link #eglSwapInterval(EGLDisplay, int)}.
	 *
	 * Default {@link EGL10#EGL_DONT_CARE}.
	 */
	public static final int EGL_MAX_SWAP_INTERVAL =
		12348;
	
	/**
	 * The minimum value that may be passed to
	 * {@link #eglSwapInterval(EGLDisplay, int)}.
	 *
	 * Default {@link EGL10#EGL_DONT_CARE}.
	 */
	public static final int EGL_MIN_SWAP_INTERVAL =
		12347;
	
	public static final int EGL_MIPMAP_LEVEL =
		12419;
	
	public static final int EGL_MIPMAP_TEXTURE =
		12418;
	
	public static final int EGL_NO_TEXTURE =
		12380;
	
	public static final int EGL_TEXTURE_2D =
		12383;
	
	public static final int EGL_TEXTURE_FORMAT =
		12416;
	
	public static final int EGL_TEXTURE_RGB =
		12381;
	
	public static final int EGL_TEXTURE_RGBA =
		12382;
	
	public static final int EGL_TEXTURE_TARGET =
		12417;
	
	public abstract boolean eglBindTexImage(EGLDisplay __a, EGLSurface __b, 
		int __c);
	
	public abstract boolean eglReleaseTexImage(EGLDisplay __a, EGLSurface __b
		, int __c);
	
	public abstract boolean eglSurfaceAttrib(EGLDisplay __a, EGLSurface __b, 
		int __c, int __d);
	
	public abstract boolean eglSwapInterval(EGLDisplay __a, int __b);
}









|









|









|


|








|








|


|


|


|


|


|


|


|


|


|
<

|
<

|
|

|



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85

86
87

88
89
90
91
92
93
94
95

package javax.microedition.khronos.egl;


public interface EGL11
	extends EGL10
{
	int EGL_BACK_BUFFER =
		12420;
	
	/**
	 * Specifies whether or not binding color buffers to RGB textures is
	 * supported. The value may be {@link EGL10#EGL_DONT_CARE},
	 * {@link EGL10#EGL_FALSE}, or {@link EGL10#EGL_TRUE}.
	 *
	 * Default {@link EGL10#EGL_DONT_CARE}.
	 */
	int EGL_BIND_TO_TEXTURE_RGB =
		12345;
	
	/**
	 * Specifies whether or not binding color buffers to RGBA textures is
	 * supported. The value may be {@link EGL10#EGL_DONT_CARE},
	 * {@link EGL10#EGL_FALSE}, or {@link EGL10#EGL_TRUE}.
	 *
	 * Default {@link EGL10#EGL_DONT_CARE}.
	 */
	int EGL_BIND_TO_TEXTURE_RGBA =
		12346;
	
	int EGL_CONTEXT_LOST =
		12302;
	
	/**
	 * The maximum value that may be passed to
	 * {@link #eglSwapInterval(EGLDisplay, int)}.
	 *
	 * Default {@link EGL10#EGL_DONT_CARE}.
	 */
	int EGL_MAX_SWAP_INTERVAL =
		12348;
	
	/**
	 * The minimum value that may be passed to
	 * {@link #eglSwapInterval(EGLDisplay, int)}.
	 *
	 * Default {@link EGL10#EGL_DONT_CARE}.
	 */
	int EGL_MIN_SWAP_INTERVAL =
		12347;
	
	int EGL_MIPMAP_LEVEL =
		12419;
	
	int EGL_MIPMAP_TEXTURE =
		12418;
	
	int EGL_NO_TEXTURE =
		12380;
	
	int EGL_TEXTURE_2D =
		12383;
	
	int EGL_TEXTURE_FORMAT =
		12416;
	
	int EGL_TEXTURE_RGB =
		12381;
	
	int EGL_TEXTURE_RGBA =
		12382;
	
	int EGL_TEXTURE_TARGET =
		12417;
	
	boolean eglBindTexImage(EGLDisplay __a, EGLSurface __b, int __c);

	
	boolean eglReleaseTexImage(EGLDisplay __a, EGLSurface __b, int __c);

	
	boolean eglSurfaceAttrib(EGLDisplay __a, EGLSurface __b, int __c,
	 int __d);
	
	boolean eglSwapInterval(EGLDisplay __a, int __b);
}


Name change from runt/apis/opengles/javax/microedition/khronos/egl/EGLConfig.java to modules/opengles/src/main/java/javax/microedition/khronos/egl/EGLConfig.java.

Name change from runt/apis/opengles/javax/microedition/khronos/egl/EGLContext.java to modules/opengles/src/main/java/javax/microedition/khronos/egl/EGLContext.java.

19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
 * This class encapsulates the OpenGL context which is used to obtain instances
 * of OpenGL ES and OpenGL rasterizers.
 *
 * To create a context use {@link EGL10#eglCreateContext(EGLDisplay, EGLConfig,
 * EGLContext, int[])} method.
 *
 * To destroy a context use {@link EGL10#eglDestroyContext(EGLDisplay,
 * EGLContext}.
 *
 * For compatibility with the standard API this class should not be extended,
 * unless the class extending is internal to SquirrelJME.
 *
 * @since 2016/10/10
 */
public abstract class EGLContext







|







19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
 * This class encapsulates the OpenGL context which is used to obtain instances
 * of OpenGL ES and OpenGL rasterizers.
 *
 * To create a context use {@link EGL10#eglCreateContext(EGLDisplay, EGLConfig,
 * EGLContext, int[])} method.
 *
 * To destroy a context use {@link EGL10#eglDestroyContext(EGLDisplay,
 * EGLContext)}.
 *
 * For compatibility with the standard API this class should not be extended,
 * unless the class extending is internal to SquirrelJME.
 *
 * @since 2016/10/10
 */
public abstract class EGLContext

Name change from runt/apis/opengles/javax/microedition/khronos/egl/EGLDisplay.java to modules/opengles/src/main/java/javax/microedition/khronos/egl/EGLDisplay.java.

Name change from runt/apis/opengles/javax/microedition/khronos/egl/EGLSurface.java to modules/opengles/src/main/java/javax/microedition/khronos/egl/EGLSurface.java.

Name change from runt/apis/opengles/javax/microedition/khronos/opengles/GL.java to modules/opengles/src/main/java/javax/microedition/khronos/opengles/GL.java.

Name change from runt/apis/opengles/javax/microedition/khronos/opengles/GL10.java to modules/opengles/src/main/java/javax/microedition/khronos/opengles/GL10.java.

10
11
12
13
14
15
16

17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764

765
766
767

768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994

package javax.microedition.khronos.opengles;

import java.nio.Buffer;
import java.nio.FloatBuffer;
import java.nio.IntBuffer;


public interface GL10
	extends GL
{
	public static final int GL_ADD =
		260;
	
	public static final int GL_ALIASED_LINE_WIDTH_RANGE =
		33902;
	
	public static final int GL_ALIASED_POINT_SIZE_RANGE =
		33901;
	
	public static final int GL_ALPHA =
		6406;
	
	public static final int GL_ALPHA_BITS =
		3413;
	
	public static final int GL_ALPHA_TEST =
		3008;
	
	public static final int GL_ALWAYS =
		519;
	
	public static final int GL_AMBIENT =
		4608;
	
	public static final int GL_AMBIENT_AND_DIFFUSE =
		5634;
	
	public static final int GL_AND =
		5377;
	
	public static final int GL_AND_INVERTED =
		5380;
	
	public static final int GL_AND_REVERSE =
		5378;
	
	public static final int GL_BACK =
		1029;
	
	public static final int GL_BLEND =
		3042;
	
	public static final int GL_BLUE_BITS =
		3412;
	
	public static final int GL_BYTE =
		5120;
	
	public static final int GL_CCW =
		2305;
	
	public static final int GL_CLAMP_TO_EDGE =
		33071;
	
	public static final int GL_CLEAR =
		5376;
	
	public static final int GL_COLOR_ARRAY =
		32886;
	
	public static final int GL_COLOR_BUFFER_BIT =
		16384;
	
	public static final int GL_COLOR_LOGIC_OP =
		3058;
	
	public static final int GL_COLOR_MATERIAL =
		2903;
	
	public static final int GL_COMPRESSED_TEXTURE_FORMATS =
		34467;
	
	public static final int GL_CONSTANT_ATTENUATION =
		4615;
	
	public static final int GL_COPY =
		5379;
	
	public static final int GL_COPY_INVERTED =
		5388;
	
	public static final int GL_CULL_FACE =
		2884;
	
	public static final int GL_CW =
		2304;
	
	public static final int GL_DECAL =
		8449;
	
	public static final int GL_DECR =
		7683;
	
	public static final int GL_DEPTH_BITS =
		3414;
	
	public static final int GL_DEPTH_BUFFER_BIT =
		256;
	
	public static final int GL_DEPTH_TEST =
		2929;
	
	public static final int GL_DIFFUSE =
		4609;
	
	public static final int GL_DITHER =
		3024;
	
	public static final int GL_DONT_CARE =
		4352;
	
	public static final int GL_DST_ALPHA =
		772;
	
	public static final int GL_DST_COLOR =
		774;
	
	public static final int GL_EMISSION =
		5632;
	
	public static final int GL_EQUAL =
		514;
	
	public static final int GL_EQUIV =
		5385;
	
	public static final int GL_EXP =
		2048;
	
	public static final int GL_EXP2 =
		2049;
	
	public static final int GL_EXTENSIONS =
		7939;
	
	public static final int GL_FALSE =
		0;
	
	public static final int GL_FASTEST =
		4353;
	
	public static final int GL_FIXED =
		5132;
	
	public static final int GL_FLAT =
		7424;
	
	public static final int GL_FLOAT =
		5126;
	
	public static final int GL_FOG =
		2912;
	
	public static final int GL_FOG_COLOR =
		2918;
	
	public static final int GL_FOG_DENSITY =
		2914;
	
	public static final int GL_FOG_END =
		2916;
	
	public static final int GL_FOG_HINT =
		3156;
	
	public static final int GL_FOG_MODE =
		2917;
	
	public static final int GL_FOG_START =
		2915;
	
	public static final int GL_FRONT =
		1028;
	
	public static final int GL_FRONT_AND_BACK =
		1032;
	
	public static final int GL_GEQUAL =
		518;
	
	public static final int GL_GREATER =
		516;
	
	public static final int GL_GREEN_BITS =
		3411;
	
	public static final int GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES =
		35739;
	
	public static final int GL_IMPLEMENTATION_COLOR_READ_TYPE_OES =
		35738;
	
	public static final int GL_INCR =
		7682;
	
	public static final int GL_INVALID_ENUM =
		1280;
	
	public static final int GL_INVALID_OPERATION =
		1282;
	
	public static final int GL_INVALID_VALUE =
		1281;
	
	public static final int GL_INVERT =
		5386;
	
	public static final int GL_KEEP =
		7680;
	
	public static final int GL_LEQUAL =
		515;
	
	public static final int GL_LESS =
		513;
	
	public static final int GL_LIGHT0 =
		16384;
	
	public static final int GL_LIGHT1 =
		16385;
	
	public static final int GL_LIGHT2 =
		16386;
	
	public static final int GL_LIGHT3 =
		16387;
	
	public static final int GL_LIGHT4 =
		16388;
	
	public static final int GL_LIGHT5 =
		16389;
	
	public static final int GL_LIGHT6 =
		16390;
	
	public static final int GL_LIGHT7 =
		16391;
	
	public static final int GL_LIGHTING =
		2896;
	
	public static final int GL_LIGHT_MODEL_AMBIENT =
		2899;
	
	public static final int GL_LIGHT_MODEL_TWO_SIDE =
		2898;
	
	public static final int GL_LINEAR =
		9729;
	
	public static final int GL_LINEAR_ATTENUATION =
		4616;
	
	public static final int GL_LINEAR_MIPMAP_LINEAR =
		9987;
	
	public static final int GL_LINEAR_MIPMAP_NEAREST =
		9985;
	
	public static final int GL_LINES =
		1;
	
	public static final int GL_LINE_LOOP =
		2;
	
	public static final int GL_LINE_SMOOTH =
		2848;
	
	public static final int GL_LINE_SMOOTH_HINT =
		3154;
	
	public static final int GL_LINE_STRIP =
		3;
	
	public static final int GL_LUMINANCE =
		6409;
	
	public static final int GL_LUMINANCE_ALPHA =
		6410;
	
	public static final int GL_MAX_ELEMENTS_INDICES =
		33001;
	
	public static final int GL_MAX_ELEMENTS_VERTICES =
		33000;
	
	public static final int GL_MAX_LIGHTS =
		3377;
	
	public static final int GL_MAX_MODELVIEW_STACK_DEPTH =
		3382;
	
	public static final int GL_MAX_PROJECTION_STACK_DEPTH =
		3384;
	
	public static final int GL_MAX_TEXTURE_SIZE =
		3379;
	
	public static final int GL_MAX_TEXTURE_STACK_DEPTH =
		3385;
	
	public static final int GL_MAX_TEXTURE_UNITS =
		34018;
	
	public static final int GL_MAX_VIEWPORT_DIMS =
		3386;
	
	public static final int GL_MODELVIEW =
		5888;
	
	public static final int GL_MODULATE =
		8448;
	
	public static final int GL_MULTISAMPLE =
		32925;
	
	public static final int GL_NAND =
		5390;
	
	public static final int GL_NEAREST =
		9728;
	
	public static final int GL_NEAREST_MIPMAP_LINEAR =
		9986;
	
	public static final int GL_NEAREST_MIPMAP_NEAREST =
		9984;
	
	public static final int GL_NEVER =
		512;
	
	public static final int GL_NICEST =
		4354;
	
	public static final int GL_NOOP =
		5381;
	
	public static final int GL_NOR =
		5384;
	
	public static final int GL_NORMALIZE =
		2977;
	
	public static final int GL_NORMAL_ARRAY =
		32885;
	
	public static final int GL_NOTEQUAL =
		517;
	
	public static final int GL_NO_ERROR =
		0;
	
	public static final int GL_NUM_COMPRESSED_TEXTURE_FORMATS =
		34466;
	
	public static final int GL_ONE =
		1;
	
	public static final int GL_ONE_MINUS_DST_ALPHA =
		773;
	
	public static final int GL_ONE_MINUS_DST_COLOR =
		775;
	
	public static final int GL_ONE_MINUS_SRC_ALPHA =
		771;
	
	public static final int GL_ONE_MINUS_SRC_COLOR =
		769;
	
	public static final int GL_OR =
		5383;
	
	public static final int GL_OR_INVERTED =
		5389;
	
	public static final int GL_OR_REVERSE =
		5387;
	
	public static final int GL_OUT_OF_MEMORY =
		1285;
	
	public static final int GL_PACK_ALIGNMENT =
		3333;
	
	public static final int GL_PALETTE4_R5_G6_B5_OES =
		35730;
	
	public static final int GL_PALETTE4_RGB5_A1_OES =
		35732;
	
	public static final int GL_PALETTE4_RGB8_OES =
		35728;
	
	public static final int GL_PALETTE4_RGBA4_OES =
		35731;
	
	public static final int GL_PALETTE4_RGBA8_OES =
		35729;
	
	public static final int GL_PALETTE8_R5_G6_B5_OES =
		35735;
	
	public static final int GL_PALETTE8_RGB5_A1_OES =
		35737;
	
	public static final int GL_PALETTE8_RGB8_OES =
		35733;
	
	public static final int GL_PALETTE8_RGBA4_OES =
		35736;
	
	public static final int GL_PALETTE8_RGBA8_OES =
		35734;
	
	public static final int GL_PERSPECTIVE_CORRECTION_HINT =
		3152;
	
	public static final int GL_POINTS =
		0;
	
	public static final int GL_POINT_SMOOTH =
		2832;
	
	public static final int GL_POINT_SMOOTH_HINT =
		3153;
	
	public static final int GL_POLYGON_OFFSET_FILL =
		32823;
	
	public static final int GL_POLYGON_SMOOTH_HINT =
		3155;
	
	public static final int GL_POSITION =
		4611;
	
	public static final int GL_PROJECTION =
		5889;
	
	public static final int GL_QUADRATIC_ATTENUATION =
		4617;
	
	public static final int GL_RED_BITS =
		3410;
	
	public static final int GL_RENDERER =
		7937;
	
	public static final int GL_REPEAT =
		10497;
	
	public static final int GL_REPLACE =
		7681;
	
	public static final int GL_RESCALE_NORMAL =
		32826;
	
	public static final int GL_RGB =
		6407;
	
	public static final int GL_RGBA =
		6408;
	
	public static final int GL_SAMPLE_ALPHA_TO_COVERAGE =
		32926;
	
	public static final int GL_SAMPLE_ALPHA_TO_ONE =
		32927;
	
	public static final int GL_SAMPLE_COVERAGE =
		32928;
	
	public static final int GL_SCISSOR_TEST =
		3089;
	
	public static final int GL_SET =
		5391;
	
	public static final int GL_SHININESS =
		5633;
	
	public static final int GL_SHORT =
		5122;
	
	public static final int GL_SMOOTH =
		7425;
	
	public static final int GL_SMOOTH_LINE_WIDTH_RANGE =
		2850;
	
	public static final int GL_SMOOTH_POINT_SIZE_RANGE =
		2834;
	
	public static final int GL_SPECULAR =
		4610;
	
	public static final int GL_SPOT_CUTOFF =
		4614;
	
	public static final int GL_SPOT_DIRECTION =
		4612;
	
	public static final int GL_SPOT_EXPONENT =
		4613;
	
	public static final int GL_SRC_ALPHA =
		770;
	
	public static final int GL_SRC_ALPHA_SATURATE =
		776;
	
	public static final int GL_SRC_COLOR =
		768;
	
	public static final int GL_STACK_OVERFLOW =
		1283;
	
	public static final int GL_STACK_UNDERFLOW =
		1284;
	
	public static final int GL_STENCIL_BITS =
		3415;
	
	public static final int GL_STENCIL_BUFFER_BIT =
		1024;
	
	public static final int GL_STENCIL_TEST =
		2960;
	
	public static final int GL_SUBPIXEL_BITS =
		3408;
	
	public static final int GL_TEXTURE =
		5890;
	
	public static final int GL_TEXTURE0 =
		33984;
	
	public static final int GL_TEXTURE1 =
		33985;
	
	public static final int GL_TEXTURE10 =
		33994;
	
	public static final int GL_TEXTURE11 =
		33995;
	
	public static final int GL_TEXTURE12 =
		33996;
	
	public static final int GL_TEXTURE13 =
		33997;
	
	public static final int GL_TEXTURE14 =
		33998;
	
	public static final int GL_TEXTURE15 =
		33999;
	
	public static final int GL_TEXTURE16 =
		34000;
	
	public static final int GL_TEXTURE17 =
		34001;
	
	public static final int GL_TEXTURE18 =
		34002;
	
	public static final int GL_TEXTURE19 =
		34003;
	
	public static final int GL_TEXTURE2 =
		33986;
	
	public static final int GL_TEXTURE20 =
		34004;
	
	public static final int GL_TEXTURE21 =
		34005;
	
	public static final int GL_TEXTURE22 =
		34006;
	
	public static final int GL_TEXTURE23 =
		34007;
	
	public static final int GL_TEXTURE24 =
		34008;
	
	public static final int GL_TEXTURE25 =
		34009;
	
	public static final int GL_TEXTURE26 =
		34010;
	
	public static final int GL_TEXTURE27 =
		34011;
	
	public static final int GL_TEXTURE28 =
		34012;
	
	public static final int GL_TEXTURE29 =
		34013;
	
	public static final int GL_TEXTURE3 =
		33987;
	
	public static final int GL_TEXTURE30 =
		34014;
	
	public static final int GL_TEXTURE31 =
		34015;
	
	public static final int GL_TEXTURE4 =
		33988;
	
	public static final int GL_TEXTURE5 =
		33989;
	
	public static final int GL_TEXTURE6 =
		33990;
	
	public static final int GL_TEXTURE7 =
		33991;
	
	public static final int GL_TEXTURE8 =
		33992;
	
	public static final int GL_TEXTURE9 =
		33993;
	
	public static final int GL_TEXTURE_2D =
		3553;
	
	public static final int GL_TEXTURE_COORD_ARRAY =
		32888;
	
	public static final int GL_TEXTURE_ENV =
		8960;
	
	public static final int GL_TEXTURE_ENV_COLOR =
		8705;
	
	public static final int GL_TEXTURE_ENV_MODE =
		8704;
	
	public static final int GL_TEXTURE_MAG_FILTER =
		10240;
	
	public static final int GL_TEXTURE_MIN_FILTER =
		10241;
	
	public static final int GL_TEXTURE_WRAP_S =
		10242;
	
	public static final int GL_TEXTURE_WRAP_T =
		10243;
	
	public static final int GL_TRIANGLES =
		4;
	
	public static final int GL_TRIANGLE_FAN =
		6;
	
	public static final int GL_TRIANGLE_STRIP =
		5;
	
	public static final int GL_TRUE =
		1;
	
	public static final int GL_UNPACK_ALIGNMENT =
		3317;
	
	public static final int GL_UNSIGNED_BYTE =
		5121;
	
	public static final int GL_UNSIGNED_SHORT =
		5123;
	
	public static final int GL_UNSIGNED_SHORT_4_4_4_4 =
		32819;
	
	public static final int GL_UNSIGNED_SHORT_5_5_5_1 =
		32820;
	
	public static final int GL_UNSIGNED_SHORT_5_6_5 =
		33635;
	
	public static final int GL_VENDOR =
		7936;
	
	public static final int GL_VERSION =
		7938;
	
	public static final int GL_VERTEX_ARRAY =
		32884;
	
	public static final int GL_XOR =
		5382;
	
	public static final int GL_ZERO =
		0;
	
	public abstract void glActiveTexture(int __a);
	
	public abstract void glAlphaFunc(int __a, float __b);
	
	public abstract void glAlphaFuncx(int __a, int __b);
	
	public abstract void glBindTexture(int __a, int __b);
	
	public abstract void glBlendFunc(int __a, int __b);
	
	public abstract void glClear(int __a);
	
	public abstract void glClearColor(float __a, float __b, float __c, float 
		__d);
	
	public abstract void glClearColorx(int __a, int __b, int __c, int __d);
	
	public abstract void glClearDepthf(float __a);
	
	public abstract void glClearDepthx(int __a);
	
	public abstract void glClearStencil(int __a);
	
	public abstract void glClientActiveTexture(int __a);
	
	public abstract void glColor4f(float __a, float __b, float __c, float __d
		);
	
	public abstract void glColor4x(int __a, int __b, int __c, int __d);
	
	public abstract void glColorMask(boolean __a, boolean __b, boolean __c, 
		boolean __d);
	
	public abstract void glColorPointer(int __a, int __b, int __c, Buffer __d
		);
	
	public abstract void glCompressedTexImage2D(int __a, int __b, int __c, 
		int __d, int __e, int __f, int __g, Buffer __h);
	
	public abstract void glCompressedTexSubImage2D(int __a, int __b, int __c,

		int __d, int __e, int __f, int __g, int __h, Buffer __i);
	
	public abstract void glCopyTexImage2D(int __a, int __b, int __c, int __d,

		int __e, int __f, int __g, int __h);
	
	public abstract void glCopyTexSubImage2D(int __a, int __b, int __c, int 
		__d, int __e, int __f, int __g, int __h);
	
	public abstract void glCullFace(int __a);
	
	public abstract void glDeleteTextures(int __a, int[] __b, int __c);
	
	public abstract void glDeleteTextures(int __a, IntBuffer __b);
	
	public abstract void glDepthFunc(int __a);
	
	public abstract void glDepthMask(boolean __a);
	
	public abstract void glDepthRangef(float __a, float __b);
	
	public abstract void glDepthRangex(int __a, int __b);
	
	public abstract void glDisable(int __a);
	
	public abstract void glDisableClientState(int __a);
	
	public abstract void glDrawArrays(int __a, int __b, int __c);
	
	public abstract void glDrawElements(int __a, int __b, int __c, Buffer __d
		);
	
	public abstract void glEnable(int __a);
	
	public abstract void glEnableClientState(int __a);
	
	public abstract void glFinish();
	
	public abstract void glFlush();
	
	public abstract void glFogf(int __a, float __b);
	
	public abstract void glFogfv(int __a, float[] __b, int __c);
	
	public abstract void glFogfv(int __a, FloatBuffer __b);
	
	public abstract void glFogx(int __a, int __b);
	
	public abstract void glFogxv(int __a, int[] __b, int __c);
	
	public abstract void glFogxv(int __a, IntBuffer __b);
	
	public abstract void glFrontFace(int __a);
	
	public abstract void glFrustumf(float __a, float __b, float __c, float 
		__d, float __e, float __f);
	
	public abstract void glFrustumx(int __a, int __b, int __c, int __d, int 
		__e, int __f);
	
	public abstract void glGenTextures(int __a, int[] __b, int __c);
	
	public abstract void glGenTextures(int __a, IntBuffer __b);
	
	public abstract int glGetError();
	
	public abstract void glGetIntegerv(int __a, int[] __b, int __c);
	
	public abstract void glGetIntegerv(int __a, IntBuffer __b);
	
	public abstract String glGetString(int __a);
	
	public abstract void glHint(int __a, int __b);
	
	public abstract void glLightModelf(int __a, float __b);
	
	public abstract void glLightModelfv(int __a, float[] __b, int __c);
	
	public abstract void glLightModelfv(int __a, FloatBuffer __b);
	
	public abstract void glLightModelx(int __a, int __b);
	
	public abstract void glLightModelxv(int __a, int[] __b, int __c);
	
	public abstract void glLightModelxv(int __a, IntBuffer __b);
	
	public abstract void glLightf(int __a, int __b, float __c);
	
	public abstract void glLightfv(int __a, int __b, float[] __c, int __d);
	
	public abstract void glLightfv(int __a, int __b, FloatBuffer __c);
	
	public abstract void glLightx(int __a, int __b, int __c);
	
	public abstract void glLightxv(int __a, int __b, int[] __c, int __d);
	
	public abstract void glLightxv(int __a, int __b, IntBuffer __c);
	
	public abstract void glLineWidth(float __a);
	
	public abstract void glLineWidthx(int __a);
	
	public abstract void glLoadIdentity();
	
	public abstract void glLoadMatrixf(float[] __a, int __b);
	
	public abstract void glLoadMatrixf(FloatBuffer __a);
	
	public abstract void glLoadMatrixx(int[] __a, int __b);
	
	public abstract void glLoadMatrixx(IntBuffer __a);
	
	public abstract void glLogicOp(int __a);
	
	public abstract void glMaterialf(int __a, int __b, float __c);
	
	public abstract void glMaterialfv(int __a, int __b, float[] __c, int __d
		);
	
	public abstract void glMaterialfv(int __a, int __b, FloatBuffer __c);
	
	public abstract void glMaterialx(int __a, int __b, int __c);
	
	public abstract void glMaterialxv(int __a, int __b, int[] __c, int __d);
	
	public abstract void glMaterialxv(int __a, int __b, IntBuffer __c);
	
	public abstract void glMatrixMode(int __a);
	
	public abstract void glMultMatrixf(float[] __a, int __b);
	
	public abstract void glMultMatrixf(FloatBuffer __a);
	
	public abstract void glMultMatrixx(int[] __a, int __b);
	
	public abstract void glMultMatrixx(IntBuffer __a);
	
	public abstract void glMultiTexCoord4f(int __a, float __b, float __c, 
		float __d, float __e);
	
	public abstract void glMultiTexCoord4x(int __a, int __b, int __c, int __d
		, int __e);
	
	public abstract void glNormal3f(float __a, float __b, float __c);
	
	public abstract void glNormal3x(int __a, int __b, int __c);
	
	public abstract void glNormalPointer(int __a, int __b, Buffer __c);
	
	public abstract void glOrthof(float __a, float __b, float __c, float __d,
		float __e, float __f);
	
	public abstract void glOrthox(int __a, int __b, int __c, int __d, int __e
		, int __f);
	
	public abstract void glPixelStorei(int __a, int __b);
	
	public abstract void glPointSize(float __a);
	
	public abstract void glPointSizex(int __a);
	
	public abstract void glPolygonOffset(float __a, float __b);
	
	public abstract void glPolygonOffsetx(int __a, int __b);
	
	public abstract void glPopMatrix();
	
	public abstract void glPushMatrix();
	
	public abstract void glReadPixels(int __a, int __b, int __c, int __d, int
		__e, int __f, Buffer __g);
	
	public abstract void glRotatef(float __a, float __b, float __c, float __d
		);
	
	public abstract void glRotatex(int __a, int __b, int __c, int __d);
	
	public abstract void glSampleCoverage(float __a, boolean __b);
	
	public abstract void glSampleCoveragex(int __a, boolean __b);
	
	public abstract void glScalef(float __a, float __b, float __c);
	
	public abstract void glScalex(int __a, int __b, int __c);
	
	public abstract void glScissor(int __a, int __b, int __c, int __d);
	
	public abstract void glShadeModel(int __a);
	
	public abstract void glStencilFunc(int __a, int __b, int __c);
	
	public abstract void glStencilMask(int __a);
	
	public abstract void glStencilOp(int __a, int __b, int __c);
	
	public abstract void glTexCoordPointer(int __a, int __b, int __c, Buffer 
		__d);
	
	public abstract void glTexEnvf(int __a, int __b, float __c);
	
	public abstract void glTexEnvfv(int __a, int __b, float[] __c, int __d);
	
	public abstract void glTexEnvfv(int __a, int __b, FloatBuffer __c);
	
	public abstract void glTexEnvx(int __a, int __b, int __c);
	
	public abstract void glTexEnvxv(int __a, int __b, int[] __c, int __d);
	
	public abstract void glTexEnvxv(int __a, int __b, IntBuffer __c);
	
	public abstract void glTexImage2D(int __a, int __b, int __c, int __d, int
		__e, int __f, int __g, int __h, Buffer __i);
	
	public abstract void glTexParameterf(int __a, int __b, float __c);
	
	public abstract void glTexParameterx(int __a, int __b, int __c);
	
	public abstract void glTexSubImage2D(int __a, int __b, int __c, int __d, 
		int __e, int __f, int __g, int __h, Buffer __i);
	
	public abstract void glTranslatef(float __a, float __b, float __c);
	
	public abstract void glTranslatex(int __a, int __b, int __c);
	
	public abstract void glVertexPointer(int __a, int __b, int __c, Buffer 
		__d);
	
	public abstract void glViewport(int __a, int __b, int __c, int __d);
}









>



|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|

|

|

|

|

|

|
<

|

|

|

|

|

|
<

|

|
<

|
<

|
|

|
>
|

|
>
|

|
|

|

|

|

|

|

|

|

|

|

|

|
<

|

|

|

|

|

|

|

|

|

|

|

|
|

|
<

|

|

|

|

|

|

|

|

|

|

|

|

|

|

|

|

|

|

|

|

|

|

|

|

|

|

|

|

|
<

|

|

|

|

|

|

|

|

|

|
|

|
<

|

|

|

|
|

|
<

|

|

|

|

|

|

|

|
|

|
<

|

|

|

|

|

|

|

|

|

|

|
<

|

|

|

|

|

|

|
|

|

|

|
|

|

|

|
<

|



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738

739
740
741
742
743
744
745
746
747
748
749
750

751
752
753
754

755
756

757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792

793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819

820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877

878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900

901
902
903
904
905
906
907
908
909
910
911

912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930

931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952

953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980

981
982
983
984
985

package javax.microedition.khronos.opengles;

import java.nio.Buffer;
import java.nio.FloatBuffer;
import java.nio.IntBuffer;

@SuppressWarnings("FieldNamingConvention")
public interface GL10
	extends GL
{
	int GL_ADD =
		260;
	
	int GL_ALIASED_LINE_WIDTH_RANGE =
		33902;
	
	int GL_ALIASED_POINT_SIZE_RANGE =
		33901;
	
	int GL_ALPHA =
		6406;
	
	int GL_ALPHA_BITS =
		3413;
	
	int GL_ALPHA_TEST =
		3008;
	
	int GL_ALWAYS =
		519;
	
	int GL_AMBIENT =
		4608;
	
	int GL_AMBIENT_AND_DIFFUSE =
		5634;
	
	int GL_AND =
		5377;
	
	int GL_AND_INVERTED =
		5380;
	
	int GL_AND_REVERSE =
		5378;
	
	int GL_BACK =
		1029;
	
	int GL_BLEND =
		3042;
	
	int GL_BLUE_BITS =
		3412;
	
	int GL_BYTE =
		5120;
	
	int GL_CCW =
		2305;
	
	int GL_CLAMP_TO_EDGE =
		33071;
	
	int GL_CLEAR =
		5376;
	
	int GL_COLOR_ARRAY =
		32886;
	
	int GL_COLOR_BUFFER_BIT =
		16384;
	
	int GL_COLOR_LOGIC_OP =
		3058;
	
	int GL_COLOR_MATERIAL =
		2903;
	
	int GL_COMPRESSED_TEXTURE_FORMATS =
		34467;
	
	int GL_CONSTANT_ATTENUATION =
		4615;
	
	int GL_COPY =
		5379;
	
	int GL_COPY_INVERTED =
		5388;
	
	int GL_CULL_FACE =
		2884;
	
	int GL_CW =
		2304;
	
	int GL_DECAL =
		8449;
	
	int GL_DECR =
		7683;
	
	int GL_DEPTH_BITS =
		3414;
	
	int GL_DEPTH_BUFFER_BIT =
		256;
	
	int GL_DEPTH_TEST =
		2929;
	
	int GL_DIFFUSE =
		4609;
	
	int GL_DITHER =
		3024;
	
	int GL_DONT_CARE =
		4352;
	
	int GL_DST_ALPHA =
		772;
	
	int GL_DST_COLOR =
		774;
	
	int GL_EMISSION =
		5632;
	
	int GL_EQUAL =
		514;
	
	int GL_EQUIV =
		5385;
	
	int GL_EXP =
		2048;
	
	int GL_EXP2 =
		2049;
	
	int GL_EXTENSIONS =
		7939;
	
	int GL_FALSE =
		0;
	
	int GL_FASTEST =
		4353;
	
	int GL_FIXED =
		5132;
	
	int GL_FLAT =
		7424;
	
	int GL_FLOAT =
		5126;
	
	int GL_FOG =
		2912;
	
	int GL_FOG_COLOR =
		2918;
	
	int GL_FOG_DENSITY =
		2914;
	
	int GL_FOG_END =
		2916;
	
	int GL_FOG_HINT =
		3156;
	
	int GL_FOG_MODE =
		2917;
	
	int GL_FOG_START =
		2915;
	
	int GL_FRONT =
		1028;
	
	int GL_FRONT_AND_BACK =
		1032;
	
	int GL_GEQUAL =
		518;
	
	int GL_GREATER =
		516;
	
	int GL_GREEN_BITS =
		3411;
	
	int GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES =
		35739;
	
	int GL_IMPLEMENTATION_COLOR_READ_TYPE_OES =
		35738;
	
	int GL_INCR =
		7682;
	
	int GL_INVALID_ENUM =
		1280;
	
	int GL_INVALID_OPERATION =
		1282;
	
	int GL_INVALID_VALUE =
		1281;
	
	int GL_INVERT =
		5386;
	
	int GL_KEEP =
		7680;
	
	int GL_LEQUAL =
		515;
	
	int GL_LESS =
		513;
	
	int GL_LIGHT0 =
		16384;
	
	int GL_LIGHT1 =
		16385;
	
	int GL_LIGHT2 =
		16386;
	
	int GL_LIGHT3 =
		16387;
	
	int GL_LIGHT4 =
		16388;
	
	int GL_LIGHT5 =
		16389;
	
	int GL_LIGHT6 =
		16390;
	
	int GL_LIGHT7 =
		16391;
	
	int GL_LIGHTING =
		2896;
	
	int GL_LIGHT_MODEL_AMBIENT =
		2899;
	
	int GL_LIGHT_MODEL_TWO_SIDE =
		2898;
	
	int GL_LINEAR =
		9729;
	
	int GL_LINEAR_ATTENUATION =
		4616;
	
	int GL_LINEAR_MIPMAP_LINEAR =
		9987;
	
	int GL_LINEAR_MIPMAP_NEAREST =
		9985;
	
	int GL_LINES =
		1;
	
	int GL_LINE_LOOP =
		2;
	
	int GL_LINE_SMOOTH =
		2848;
	
	int GL_LINE_SMOOTH_HINT =
		3154;
	
	int GL_LINE_STRIP =
		3;
	
	int GL_LUMINANCE =
		6409;
	
	int GL_LUMINANCE_ALPHA =
		6410;
	
	int GL_MAX_ELEMENTS_INDICES =
		33001;
	
	int GL_MAX_ELEMENTS_VERTICES =
		33000;
	
	int GL_MAX_LIGHTS =
		3377;
	
	int GL_MAX_MODELVIEW_STACK_DEPTH =
		3382;
	
	int GL_MAX_PROJECTION_STACK_DEPTH =
		3384;
	
	int GL_MAX_TEXTURE_SIZE =
		3379;
	
	int GL_MAX_TEXTURE_STACK_DEPTH =
		3385;
	
	int GL_MAX_TEXTURE_UNITS =
		34018;
	
	int GL_MAX_VIEWPORT_DIMS =
		3386;
	
	int GL_MODELVIEW =
		5888;
	
	int GL_MODULATE =
		8448;
	
	int GL_MULTISAMPLE =
		32925;
	
	int GL_NAND =
		5390;
	
	int GL_NEAREST =
		9728;
	
	int GL_NEAREST_MIPMAP_LINEAR =
		9986;
	
	int GL_NEAREST_MIPMAP_NEAREST =
		9984;
	
	int GL_NEVER =
		512;
	
	int GL_NICEST =
		4354;
	
	int GL_NOOP =
		5381;
	
	int GL_NOR =
		5384;
	
	int GL_NORMALIZE =
		2977;
	
	int GL_NORMAL_ARRAY =
		32885;
	
	int GL_NOTEQUAL =
		517;
	
	int GL_NO_ERROR =
		0;
	
	int GL_NUM_COMPRESSED_TEXTURE_FORMATS =
		34466;
	
	int GL_ONE =
		1;
	
	int GL_ONE_MINUS_DST_ALPHA =
		773;
	
	int GL_ONE_MINUS_DST_COLOR =
		775;
	
	int GL_ONE_MINUS_SRC_ALPHA =
		771;
	
	int GL_ONE_MINUS_SRC_COLOR =
		769;
	
	int GL_OR =
		5383;
	
	int GL_OR_INVERTED =
		5389;
	
	int GL_OR_REVERSE =
		5387;
	
	int GL_OUT_OF_MEMORY =
		1285;
	
	int GL_PACK_ALIGNMENT =
		3333;
	
	int GL_PALETTE4_R5_G6_B5_OES =
		35730;
	
	int GL_PALETTE4_RGB5_A1_OES =
		35732;
	
	int GL_PALETTE4_RGB8_OES =
		35728;
	
	int GL_PALETTE4_RGBA4_OES =
		35731;
	
	int GL_PALETTE4_RGBA8_OES =
		35729;
	
	int GL_PALETTE8_R5_G6_B5_OES =
		35735;
	
	int GL_PALETTE8_RGB5_A1_OES =
		35737;
	
	int GL_PALETTE8_RGB8_OES =
		35733;
	
	int GL_PALETTE8_RGBA4_OES =
		35736;
	
	int GL_PALETTE8_RGBA8_OES =
		35734;
	
	int GL_PERSPECTIVE_CORRECTION_HINT =
		3152;
	
	int GL_POINTS =
		0;
	
	int GL_POINT_SMOOTH =
		2832;
	
	int GL_POINT_SMOOTH_HINT =
		3153;
	
	int GL_POLYGON_OFFSET_FILL =
		32823;
	
	int GL_POLYGON_SMOOTH_HINT =
		3155;
	
	int GL_POSITION =
		4611;
	
	int GL_PROJECTION =
		5889;
	
	int GL_QUADRATIC_ATTENUATION =
		4617;
	
	int GL_RED_BITS =
		3410;
	
	int GL_RENDERER =
		7937;
	
	int GL_REPEAT =
		10497;
	
	int GL_REPLACE =
		7681;
	
	int GL_RESCALE_NORMAL =
		32826;
	
	int GL_RGB =
		6407;
	
	int GL_RGBA =
		6408;
	
	int GL_SAMPLE_ALPHA_TO_COVERAGE =
		32926;
	
	int GL_SAMPLE_ALPHA_TO_ONE =
		32927;
	
	int GL_SAMPLE_COVERAGE =
		32928;
	
	int GL_SCISSOR_TEST =
		3089;
	
	int GL_SET =
		5391;
	
	int GL_SHININESS =
		5633;
	
	int GL_SHORT =
		5122;
	
	int GL_SMOOTH =
		7425;
	
	int GL_SMOOTH_LINE_WIDTH_RANGE =
		2850;
	
	int GL_SMOOTH_POINT_SIZE_RANGE =
		2834;
	
	int GL_SPECULAR =
		4610;
	
	int GL_SPOT_CUTOFF =
		4614;
	
	int GL_SPOT_DIRECTION =
		4612;
	
	int GL_SPOT_EXPONENT =
		4613;
	
	int GL_SRC_ALPHA =
		770;
	
	int GL_SRC_ALPHA_SATURATE =
		776;
	
	int GL_SRC_COLOR =
		768;
	
	int GL_STACK_OVERFLOW =
		1283;
	
	int GL_STACK_UNDERFLOW =
		1284;
	
	int GL_STENCIL_BITS =
		3415;
	
	int GL_STENCIL_BUFFER_BIT =
		1024;
	
	int GL_STENCIL_TEST =
		2960;
	
	int GL_SUBPIXEL_BITS =
		3408;
	
	int GL_TEXTURE =
		5890;
	
	int GL_TEXTURE0 =
		33984;
	
	int GL_TEXTURE1 =
		33985;
	
	int GL_TEXTURE10 =
		33994;
	
	int GL_TEXTURE11 =
		33995;
	
	int GL_TEXTURE12 =
		33996;
	
	int GL_TEXTURE13 =
		33997;
	
	int GL_TEXTURE14 =
		33998;
	
	int GL_TEXTURE15 =
		33999;
	
	int GL_TEXTURE16 =
		34000;
	
	int GL_TEXTURE17 =
		34001;
	
	int GL_TEXTURE18 =
		34002;
	
	int GL_TEXTURE19 =
		34003;
	
	int GL_TEXTURE2 =
		33986;
	
	int GL_TEXTURE20 =
		34004;
	
	int GL_TEXTURE21 =
		34005;
	
	int GL_TEXTURE22 =
		34006;
	
	int GL_TEXTURE23 =
		34007;
	
	int GL_TEXTURE24 =
		34008;
	
	int GL_TEXTURE25 =
		34009;
	
	int GL_TEXTURE26 =
		34010;
	
	int GL_TEXTURE27 =
		34011;
	
	int GL_TEXTURE28 =
		34012;
	
	int GL_TEXTURE29 =
		34013;
	
	int GL_TEXTURE3 =
		33987;
	
	int GL_TEXTURE30 =
		34014;
	
	int GL_TEXTURE31 =
		34015;
	
	int GL_TEXTURE4 =
		33988;
	
	int GL_TEXTURE5 =
		33989;
	
	int GL_TEXTURE6 =
		33990;
	
	int GL_TEXTURE7 =
		33991;
	
	int GL_TEXTURE8 =
		33992;
	
	int GL_TEXTURE9 =
		33993;
	
	int GL_TEXTURE_2D =
		3553;
	
	int GL_TEXTURE_COORD_ARRAY =
		32888;
	
	int GL_TEXTURE_ENV =
		8960;
	
	int GL_TEXTURE_ENV_COLOR =
		8705;
	
	int GL_TEXTURE_ENV_MODE =
		8704;
	
	int GL_TEXTURE_MAG_FILTER =
		10240;
	
	int GL_TEXTURE_MIN_FILTER =
		10241;
	
	int GL_TEXTURE_WRAP_S =
		10242;
	
	int GL_TEXTURE_WRAP_T =
		10243;
	
	int GL_TRIANGLES =
		4;
	
	int GL_TRIANGLE_FAN =
		6;
	
	int GL_TRIANGLE_STRIP =
		5;
	
	int GL_TRUE =
		1;
	
	int GL_UNPACK_ALIGNMENT =
		3317;
	
	int GL_UNSIGNED_BYTE =
		5121;
	
	int GL_UNSIGNED_SHORT =
		5123;
	
	int GL_UNSIGNED_SHORT_4_4_4_4 =
		32819;
	
	int GL_UNSIGNED_SHORT_5_5_5_1 =
		32820;
	
	int GL_UNSIGNED_SHORT_5_6_5 =
		33635;
	
	int GL_VENDOR =
		7936;
	
	int GL_VERSION =
		7938;
	
	int GL_VERTEX_ARRAY =
		32884;
	
	int GL_XOR =
		5382;
	
	int GL_ZERO =
		0;
	
	void glActiveTexture(int __a);
	
	void glAlphaFunc(int __a, float __b);
	
	void glAlphaFuncx(int __a, int __b);
	
	void glBindTexture(int __a, int __b);
	
	void glBlendFunc(int __a, int __b);
	
	void glClear(int __a);
	
	void glClearColor(float __a, float __b, float __c, float __d);

	
	void glClearColorx(int __a, int __b, int __c, int __d);
	
	void glClearDepthf(float __a);
	
	void glClearDepthx(int __a);
	
	void glClearStencil(int __a);
	
	void glClientActiveTexture(int __a);
	
	void glColor4f(float __a, float __b, float __c, float __d);

	
	void glColor4x(int __a, int __b, int __c, int __d);
	
	void glColorMask(boolean __a, boolean __b, boolean __c, boolean __d);

	
	void glColorPointer(int __a, int __b, int __c, Buffer __d);

	
	void glCompressedTexImage2D(int __a, int __b, int __c, int __d, int __e,
		int __f, int __g, Buffer __h);
	
	void glCompressedTexSubImage2D(int __a, int __b, int __c, int __d,
	 int __e,
		int __f, int __g, int __h, Buffer __i);
	
	void glCopyTexImage2D(int __a, int __b, int __c, int __d, int __e,
	 int __f,
		int __g, int __h);
	
	void glCopyTexSubImage2D(int __a, int __b, int __c, int __d, int __e,
		int __f, int __g, int __h);
	
	void glCullFace(int __a);
	
	void glDeleteTextures(int __a, int[] __b, int __c);
	
	void glDeleteTextures(int __a, IntBuffer __b);
	
	void glDepthFunc(int __a);
	
	void glDepthMask(boolean __a);
	
	void glDepthRangef(float __a, float __b);
	
	void glDepthRangex(int __a, int __b);
	
	void glDisable(int __a);
	
	void glDisableClientState(int __a);
	
	void glDrawArrays(int __a, int __b, int __c);
	
	void glDrawElements(int __a, int __b, int __c, Buffer __d);

	
	void glEnable(int __a);
	
	void glEnableClientState(int __a);
	
	void glFinish();
	
	void glFlush();
	
	void glFogf(int __a, float __b);
	
	void glFogfv(int __a, float[] __b, int __c);
	
	void glFogfv(int __a, FloatBuffer __b);
	
	void glFogx(int __a, int __b);
	
	void glFogxv(int __a, int[] __b, int __c);
	
	void glFogxv(int __a, IntBuffer __b);
	
	void glFrontFace(int __a);
	
	void glFrustumf(float __a, float __b, float __c, float __d, float __e,
		float __f);
	
	void glFrustumx(int __a, int __b, int __c, int __d, int __e, int __f);

	
	void glGenTextures(int __a, int[] __b, int __c);
	
	void glGenTextures(int __a, IntBuffer __b);
	
	int glGetError();
	
	void glGetIntegerv(int __a, int[] __b, int __c);
	
	void glGetIntegerv(int __a, IntBuffer __b);
	
	String glGetString(int __a);
	
	void glHint(int __a, int __b);
	
	void glLightModelf(int __a, float __b);
	
	void glLightModelfv(int __a, float[] __b, int __c);
	
	void glLightModelfv(int __a, FloatBuffer __b);
	
	void glLightModelx(int __a, int __b);
	
	void glLightModelxv(int __a, int[] __b, int __c);
	
	void glLightModelxv(int __a, IntBuffer __b);
	
	void glLightf(int __a, int __b, float __c);
	
	void glLightfv(int __a, int __b, float[] __c, int __d);
	
	void glLightfv(int __a, int __b, FloatBuffer __c);
	
	void glLightx(int __a, int __b, int __c);
	
	void glLightxv(int __a, int __b, int[] __c, int __d);
	
	void glLightxv(int __a, int __b, IntBuffer __c);
	
	void glLineWidth(float __a);
	
	void glLineWidthx(int __a);
	
	void glLoadIdentity();
	
	void glLoadMatrixf(float[] __a, int __b);
	
	void glLoadMatrixf(FloatBuffer __a);
	
	void glLoadMatrixx(int[] __a, int __b);
	
	void glLoadMatrixx(IntBuffer __a);
	
	void glLogicOp(int __a);
	
	void glMaterialf(int __a, int __b, float __c);
	
	void glMaterialfv(int __a, int __b, float[] __c, int __d);

	
	void glMaterialfv(int __a, int __b, FloatBuffer __c);
	
	void glMaterialx(int __a, int __b, int __c);
	
	void glMaterialxv(int __a, int __b, int[] __c, int __d);
	
	void glMaterialxv(int __a, int __b, IntBuffer __c);
	
	void glMatrixMode(int __a);
	
	void glMultMatrixf(float[] __a, int __b);
	
	void glMultMatrixf(FloatBuffer __a);
	
	void glMultMatrixx(int[] __a, int __b);
	
	void glMultMatrixx(IntBuffer __a);
	
	void glMultiTexCoord4f(int __a, float __b, float __c, float __d,
	 float __e);
	
	void glMultiTexCoord4x(int __a, int __b, int __c, int __d, int __e);

	
	void glNormal3f(float __a, float __b, float __c);
	
	void glNormal3x(int __a, int __b, int __c);
	
	void glNormalPointer(int __a, int __b, Buffer __c);
	
	void glOrthof(float __a, float __b, float __c, float __d, float __e,
		float __f);
	
	void glOrthox(int __a, int __b, int __c, int __d, int __e, int __f);

	
	void glPixelStorei(int __a, int __b);
	
	void glPointSize(float __a);
	
	void glPointSizex(int __a);
	
	void glPolygonOffset(float __a, float __b);
	
	void glPolygonOffsetx(int __a, int __b);
	
	void glPopMatrix();
	
	void glPushMatrix();
	
	void glReadPixels(int __a, int __b, int __c, int __d, int __e, int __f,
		Buffer __g);
	
	void glRotatef(float __a, float __b, float __c, float __d);

	
	void glRotatex(int __a, int __b, int __c, int __d);
	
	void glSampleCoverage(float __a, boolean __b);
	
	void glSampleCoveragex(int __a, boolean __b);
	
	void glScalef(float __a, float __b, float __c);
	
	void glScalex(int __a, int __b, int __c);
	
	void glScissor(int __a, int __b, int __c, int __d);
	
	void glShadeModel(int __a);
	
	void glStencilFunc(int __a, int __b, int __c);
	
	void glStencilMask(int __a);
	
	void glStencilOp(int __a, int __b, int __c);
	
	void glTexCoordPointer(int __a, int __b, int __c, Buffer __d);

	
	void glTexEnvf(int __a, int __b, float __c);
	
	void glTexEnvfv(int __a, int __b, float[] __c, int __d);
	
	void glTexEnvfv(int __a, int __b, FloatBuffer __c);
	
	void glTexEnvx(int __a, int __b, int __c);
	
	void glTexEnvxv(int __a, int __b, int[] __c, int __d);
	
	void glTexEnvxv(int __a, int __b, IntBuffer __c);
	
	void glTexImage2D(int __a, int __b, int __c, int __d, int __e, int __f,
		int __g, int __h, Buffer __i);
	
	void glTexParameterf(int __a, int __b, float __c);
	
	void glTexParameterx(int __a, int __b, int __c);
	
	void glTexSubImage2D(int __a, int __b, int __c, int __d, int __e, int __f,
		int __g, int __h, Buffer __i);
	
	void glTranslatef(float __a, float __b, float __c);
	
	void glTranslatex(int __a, int __b, int __c);
	
	void glVertexPointer(int __a, int __b, int __c, Buffer __d);

	
	void glViewport(int __a, int __b, int __c, int __d);
}


Name change from runt/apis/opengles/javax/microedition/khronos/opengles/GL10Ext.java to modules/opengles/src/main/java/javax/microedition/khronos/opengles/GL10Ext.java.

10
11
12
13
14
15
16
17
18
19
20
21

package javax.microedition.khronos.opengles;


public interface GL10Ext
	extends GL
{
	public abstract int glQueryMatrixxOES(int[] __a, int __b, int[] __c, int 
		__d);
}









|
<



10
11
12
13
14
15
16
17

18
19
20

package javax.microedition.khronos.opengles;


public interface GL10Ext
	extends GL
{
	int glQueryMatrixxOES(int[] __a, int __b, int[] __c, int __d);

}


Name change from runt/apis/opengles/javax/microedition/khronos/opengles/GL11.java to modules/opengles/src/main/java/javax/microedition/khronos/opengles/GL11.java.

10
11
12
13
14
15
16

17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445


446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546

package javax.microedition.khronos.opengles;

import java.nio.Buffer;
import java.nio.FloatBuffer;
import java.nio.IntBuffer;


public interface GL11
	extends GL10
{
	public static final int GL_ACTIVE_TEXTURE =
		34016;
	
	public static final int GL_ADD_SIGNED =
		34164;
	
	public static final int GL_ALPHA_SCALE =
		3356;
	
	public static final int GL_ALPHA_TEST_FUNC =
		3009;
	
	public static final int GL_ALPHA_TEST_REF =
		3010;
	
	public static final int GL_ARRAY_BUFFER =
		34962;
	
	public static final int GL_ARRAY_BUFFER_BINDING =
		34964;
	
	public static final int GL_BLEND_DST =
		3040;
	
	public static final int GL_BLEND_SRC =
		3041;
	
	public static final int GL_BUFFER_ACCESS =
		35003;
	
	public static final int GL_BUFFER_SIZE =
		34660;
	
	public static final int GL_BUFFER_USAGE =
		34661;
	
	public static final int GL_CLIENT_ACTIVE_TEXTURE =
		34017;
	
	public static final int GL_CLIP_PLANE0 =
		12288;
	
	public static final int GL_CLIP_PLANE1 =
		12289;
	
	public static final int GL_CLIP_PLANE2 =
		12290;
	
	public static final int GL_CLIP_PLANE3 =
		12291;
	
	public static final int GL_CLIP_PLANE4 =
		12292;
	
	public static final int GL_CLIP_PLANE5 =
		12293;
	
	public static final int GL_COLOR_ARRAY_BUFFER_BINDING =
		34968;
	
	public static final int GL_COLOR_ARRAY_POINTER =
		32912;
	
	public static final int GL_COLOR_ARRAY_SIZE =
		32897;
	
	public static final int GL_COLOR_ARRAY_STRIDE =
		32899;
	
	public static final int GL_COLOR_ARRAY_TYPE =
		32898;
	
	public static final int GL_COLOR_CLEAR_VALUE =
		3106;
	
	public static final int GL_COLOR_WRITEMASK =
		3107;
	
	public static final int GL_COMBINE =
		34160;
	
	public static final int GL_COMBINE_ALPHA =
		34162;
	
	public static final int GL_COMBINE_RGB =
		34161;
	
	public static final int GL_CONSTANT =
		34166;
	
	public static final int GL_COORD_REPLACE_OES =
		34914;
	
	public static final int GL_CULL_FACE_MODE =
		2885;
	
	public static final int GL_CURRENT_COLOR =
		2816;
	
	public static final int GL_CURRENT_NORMAL =
		2818;
	
	public static final int GL_CURRENT_TEXTURE_COORDS =
		2819;
	
	public static final int GL_DEPTH_CLEAR_VALUE =
		2931;
	
	public static final int GL_DEPTH_FUNC =
		2932;
	
	public static final int GL_DEPTH_RANGE =
		2928;
	
	public static final int GL_DEPTH_WRITEMASK =
		2930;
	
	public static final int GL_DOT3_RGB =
		34478;
	
	public static final int GL_DOT3_RGBA =
		34479;
	
	public static final int GL_DYNAMIC_DRAW =
		35048;
	
	public static final int GL_ELEMENT_ARRAY_BUFFER =
		34963;
	
	public static final int GL_ELEMENT_ARRAY_BUFFER_BINDING =
		34965;
	
	public static final int GL_FRONT_FACE =
		2886;
	
	public static final int GL_GENERATE_MIPMAP =
		33169;
	
	public static final int GL_GENERATE_MIPMAP_HINT =
		33170;
	
	public static final int GL_INTERPOLATE =
		34165;
	
	public static final int GL_LINE_WIDTH =
		2849;
	
	public static final int GL_LOGIC_OP_MODE =
		3056;
	
	public static final int GL_MATRIX_MODE =
		2976;
	
	public static final int GL_MAX_CLIP_PLANES =
		3378;
	
	public static final int GL_MODELVIEW_MATRIX =
		2982;
	
	public static final int GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES =
		35213;
	
	public static final int GL_MODELVIEW_STACK_DEPTH =
		2979;
	
	public static final int GL_NORMAL_ARRAY_BUFFER_BINDING =
		34967;
	
	public static final int GL_NORMAL_ARRAY_POINTER =
		32911;
	
	public static final int GL_NORMAL_ARRAY_STRIDE =
		32895;
	
	public static final int GL_NORMAL_ARRAY_TYPE =
		32894;
	
	public static final int GL_OPERAND0_ALPHA =
		34200;
	
	public static final int GL_OPERAND0_RGB =
		34192;
	
	public static final int GL_OPERAND1_ALPHA =
		34201;
	
	public static final int GL_OPERAND1_RGB =
		34193;
	
	public static final int GL_OPERAND2_ALPHA =
		34202;
	
	public static final int GL_OPERAND2_RGB =
		34194;
	
	public static final int GL_POINT_DISTANCE_ATTENUATION =
		33065;
	
	public static final int GL_POINT_FADE_THRESHOLD_SIZE =
		33064;
	
	public static final int GL_POINT_SIZE =
		2833;
	
	public static final int GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES =
		35743;
	
	public static final int GL_POINT_SIZE_ARRAY_OES =
		35740;
	
	public static final int GL_POINT_SIZE_ARRAY_POINTER_OES =
		35212;
	
	public static final int GL_POINT_SIZE_ARRAY_STRIDE_OES =
		35211;
	
	public static final int GL_POINT_SIZE_ARRAY_TYPE_OES =
		35210;
	
	public static final int GL_POINT_SIZE_MAX =
		33063;
	
	public static final int GL_POINT_SIZE_MIN =
		33062;
	
	public static final int GL_POINT_SPRITE_OES =
		34913;
	
	public static final int GL_POLYGON_OFFSET_FACTOR =
		32824;
	
	public static final int GL_POLYGON_OFFSET_UNITS =
		10752;
	
	public static final int GL_PREVIOUS =
		34168;
	
	public static final int GL_PRIMARY_COLOR =
		34167;
	
	public static final int GL_PROJECTION_MATRIX =
		2983;
	
	public static final int GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES =
		35214;
	
	public static final int GL_PROJECTION_STACK_DEPTH =
		2980;
	
	public static final int GL_RGB_SCALE =
		34163;
	
	public static final int GL_SAMPLES =
		32937;
	
	public static final int GL_SAMPLE_BUFFERS =
		32936;
	
	public static final int GL_SAMPLE_COVERAGE_INVERT =
		32939;
	
	public static final int GL_SAMPLE_COVERAGE_VALUE =
		32938;
	
	public static final int GL_SCISSOR_BOX =
		3088;
	
	public static final int GL_SHADE_MODEL =
		2900;
	
	public static final int GL_SRC0_ALPHA =
		34184;
	
	public static final int GL_SRC0_RGB =
		34176;
	
	public static final int GL_SRC1_ALPHA =
		34185;
	
	public static final int GL_SRC1_RGB =
		34177;
	
	public static final int GL_SRC2_ALPHA =
		34186;
	
	public static final int GL_SRC2_RGB =
		34178;
	
	public static final int GL_STATIC_DRAW =
		35044;
	
	public static final int GL_STENCIL_CLEAR_VALUE =
		2961;
	
	public static final int GL_STENCIL_FAIL =
		2964;
	
	public static final int GL_STENCIL_FUNC =
		2962;
	
	public static final int GL_STENCIL_PASS_DEPTH_FAIL =
		2965;
	
	public static final int GL_STENCIL_PASS_DEPTH_PASS =
		2966;
	
	public static final int GL_STENCIL_REF =
		2967;
	
	public static final int GL_STENCIL_VALUE_MASK =
		2963;
	
	public static final int GL_STENCIL_WRITEMASK =
		2968;
	
	public static final int GL_SUBTRACT =
		34023;
	
	public static final int GL_TEXTURE_BINDING_2D =
		32873;
	
	public static final int GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING =
		34970;
	
	public static final int GL_TEXTURE_COORD_ARRAY_POINTER =
		32914;
	
	public static final int GL_TEXTURE_COORD_ARRAY_SIZE =
		32904;
	
	public static final int GL_TEXTURE_COORD_ARRAY_STRIDE =
		32906;
	
	public static final int GL_TEXTURE_COORD_ARRAY_TYPE =
		32905;
	
	public static final int GL_TEXTURE_MATRIX =
		2984;
	
	public static final int GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES =
		35215;
	
	public static final int GL_TEXTURE_STACK_DEPTH =
		2981;
	
	public static final int GL_VERTEX_ARRAY_BUFFER_BINDING =
		34966;
	
	public static final int GL_VERTEX_ARRAY_POINTER =
		32910;
	
	public static final int GL_VERTEX_ARRAY_SIZE =
		32890;
	
	public static final int GL_VERTEX_ARRAY_STRIDE =
		32892;
	
	public static final int GL_VERTEX_ARRAY_TYPE =
		32891;
	
	public static final int GL_VIEWPORT =
		2978;
	
	public static final int GL_WRITE_ONLY =
		35001;
	
	public abstract void glBindBuffer(int __a, int __b);
	
	public abstract void glBufferData(int __a, int __b, Buffer __c, int __d);
	
	public abstract void glBufferSubData(int __a, int __b, int __c, Buffer 
		__d);
	
	public abstract void glClipPlanef(int __a, float[] __b, int __c);
	
	public abstract void glClipPlanef(int __a, FloatBuffer __b);
	
	public abstract void glClipPlanex(int __a, int[] __b, int __c);
	
	public abstract void glClipPlanex(int __a, IntBuffer __b);
	
	public abstract void glColor4ub(byte __a, byte __b, byte __c, byte __d);
	
	public abstract void glColorPointer(int __a, int __b, int __c, int __d);
	
	public abstract void glDeleteBuffers(int __a, int[] __b, int __c);
	
	public abstract void glDeleteBuffers(int __a, IntBuffer __b);
	
	public abstract void glDrawElements(int __a, int __b, int __c, int __d);
	
	public abstract void glGenBuffers(int __a, int[] __b, int __c);
	
	public abstract void glGenBuffers(int __a, IntBuffer __b);
	
	public abstract void glGetBooleanv(int __a, boolean[] __b, int __c);
	
	public abstract void glGetBooleanv(int __a, IntBuffer __b);
	
	public abstract void glGetBufferParameteriv(int __a, int __b, int[] __c, 
		int __d);
	
	public abstract void glGetBufferParameteriv(int __a, int __b, IntBuffer 
		__c);
	
	public abstract void glGetClipPlanef(int __a, float[] __b, int __c);
	
	public abstract void glGetClipPlanef(int __a, FloatBuffer __b);
	
	public abstract void glGetClipPlanex(int __a, int[] __b, int __c);
	
	public abstract void glGetClipPlanex(int __a, IntBuffer __b);
	
	public abstract void glGetFixedv(int __a, int[] __b, int __c);
	
	public abstract void glGetFixedv(int __a, IntBuffer __b);
	
	public abstract void glGetFloatv(int __a, float[] __b, int __c);
	
	public abstract void glGetFloatv(int __a, FloatBuffer __b);
	
	public abstract void glGetLightfv(int __a, int __b, float[] __c, int __d
		);
	
	public abstract void glGetLightfv(int __a, int __b, FloatBuffer __c);
	


	public abstract void glGetLightxv(int __a, int __b, int[] __c, int __d);
	
	public abstract void glGetLightxv(int __a, int __b, IntBuffer __c);
	
	public abstract void glGetMaterialfv(int __a, int __b, float[] __c, int 
		__d);
	
	public abstract void glGetMaterialfv(int __a, int __b, FloatBuffer __c);
	
	public abstract void glGetMaterialxv(int __a, int __b, int[] __c, int __d
		);
	
	public abstract void glGetMaterialxv(int __a, int __b, IntBuffer __c);
	
	public abstract void glGetPointerv(int __a, Buffer[] __b);
	
	public abstract void glGetTexEnvfv(int __a, int __b, float[] __c, int __d
		);
	
	public abstract void glGetTexEnvfv(int __a, int __b, FloatBuffer __c);
	
	public abstract void glGetTexEnviv(int __a, int __b, int[] __c, int __d);
	
	public abstract void glGetTexEnviv(int __a, int __b, IntBuffer __c);
	
	public abstract void glGetTexEnvxv(int __a, int __b, int[] __c, int __d);
	
	public abstract void glGetTexEnvxv(int __a, int __b, IntBuffer __c);
	
	public abstract void glGetTexParameterfv(int __a, int __b, float[] __c, 
		int __d);
	
	public abstract void glGetTexParameterfv(int __a, int __b, FloatBuffer 
		__c);
	
	public abstract void glGetTexParameteriv(int __a, int __b, int[] __c, int
		__d);
	
	public abstract void glGetTexParameteriv(int __a, int __b, IntBuffer __c
		);
	
	public abstract void glGetTexParameterxv(int __a, int __b, int[] __c, int
		__d);
	
	public abstract void glGetTexParameterxv(int __a, int __b, IntBuffer __c
		);
	
	public abstract boolean glIsBuffer(int __a);
	
	public abstract boolean glIsEnabled(int __a);
	
	public abstract boolean glIsTexture(int __a);
	
	public abstract void glNormalPointer(int __a, int __b, int __c);
	
	public abstract void glPointParameterf(int __a, float __b);
	
	public abstract void glPointParameterfv(int __a, float[] __b, int __c);
	
	public abstract void glPointParameterfv(int __a, FloatBuffer __b);
	
	public abstract void glPointParameterx(int __a, int __b);
	
	public abstract void glPointParameterxv(int __a, int[] __b, int __c);
	
	public abstract void glPointParameterxv(int __a, IntBuffer __b);
	
	public abstract void glPointSizePointerOES(int __a, int __b, int __c);
	
	public abstract void glPointSizePointerOES(int __a, int __b, Buffer __c);
	
	public abstract void glTexCoordPointer(int __a, int __b, int __c, int __d
		);
	
	public abstract void glTexEnvi(int __a, int __b, int __c);
	
	public abstract void glTexEnviv(int __a, int __b, int[] __c, int __d);
	
	public abstract void glTexEnviv(int __a, int __b, IntBuffer __c);
	
	public abstract void glTexParameterfv(int __a, int __b, float[] __c, int 
		__d);
	
	public abstract void glTexParameterfv(int __a, int __b, FloatBuffer __c);
	
	public abstract void glTexParameteri(int __a, int __b, int __c);
	
	public abstract void glTexParameteriv(int __a, int __b, int[] __c, int 
		__d);
	
	public abstract void glTexParameteriv(int __a, int __b, IntBuffer __c);
	
	public abstract void glTexParameterxv(int __a, int __b, int[] __c, int 
		__d);
	
	public abstract void glTexParameterxv(int __a, int __b, IntBuffer __c);
	
	public abstract void glVertexPointer(int __a, int __b, int __c, int __d);
}









>



|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|

|

|
<

|

|

|

|

|

|

|

|

|

|

|

|

|

|
<

|
<

|

|

|

|

|

|

|

|

|
<
<
<

>
>
|

|

|
<

|

|
<

|

|

|
<

|

|

|

|

|

|
<

|
<

|
<

|
<

|
<

|
<

|

|

|

|

|

|

|

|

|

|

|

|

|
<

|

|

|

|
<

|

|

|
<

|

|
<

|

|



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391

392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419

420
421

422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439



440
441
442
443
444
445
446
447

448
449
450
451

452
453
454
455
456
457

458
459
460
461
462
463
464
465
466
467
468
469

470
471

472
473

474
475

476
477

478
479

480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505

506
507
508
509
510
511
512
513

514
515
516
517
518
519

520
521
522
523

524
525
526
527
528
529
530

package javax.microedition.khronos.opengles;

import java.nio.Buffer;
import java.nio.FloatBuffer;
import java.nio.IntBuffer;

@SuppressWarnings("FieldNamingConvention")
public interface GL11
	extends GL10
{
	int GL_ACTIVE_TEXTURE =
		34016;
	
	int GL_ADD_SIGNED =
		34164;
	
	int GL_ALPHA_SCALE =
		3356;
	
	int GL_ALPHA_TEST_FUNC =
		3009;
	
	int GL_ALPHA_TEST_REF =
		3010;
	
	int GL_ARRAY_BUFFER =
		34962;
	
	int GL_ARRAY_BUFFER_BINDING =
		34964;
	
	int GL_BLEND_DST =
		3040;
	
	int GL_BLEND_SRC =
		3041;
	
	int GL_BUFFER_ACCESS =
		35003;
	
	int GL_BUFFER_SIZE =
		34660;
	
	int GL_BUFFER_USAGE =
		34661;
	
	int GL_CLIENT_ACTIVE_TEXTURE =
		34017;
	
	int GL_CLIP_PLANE0 =
		12288;
	
	int GL_CLIP_PLANE1 =
		12289;
	
	int GL_CLIP_PLANE2 =
		12290;
	
	int GL_CLIP_PLANE3 =
		12291;
	
	int GL_CLIP_PLANE4 =
		12292;
	
	int GL_CLIP_PLANE5 =
		12293;
	
	int GL_COLOR_ARRAY_BUFFER_BINDING =
		34968;
	
	int GL_COLOR_ARRAY_POINTER =
		32912;
	
	int GL_COLOR_ARRAY_SIZE =
		32897;
	
	int GL_COLOR_ARRAY_STRIDE =
		32899;
	
	int GL_COLOR_ARRAY_TYPE =
		32898;
	
	int GL_COLOR_CLEAR_VALUE =
		3106;
	
	int GL_COLOR_WRITEMASK =
		3107;
	
	int GL_COMBINE =
		34160;
	
	int GL_COMBINE_ALPHA =
		34162;
	
	int GL_COMBINE_RGB =
		34161;
	
	int GL_CONSTANT =
		34166;
	
	int GL_COORD_REPLACE_OES =
		34914;
	
	int GL_CULL_FACE_MODE =
		2885;
	
	int GL_CURRENT_COLOR =
		2816;
	
	int GL_CURRENT_NORMAL =
		2818;
	
	int GL_CURRENT_TEXTURE_COORDS =
		2819;
	
	int GL_DEPTH_CLEAR_VALUE =
		2931;
	
	int GL_DEPTH_FUNC =
		2932;
	
	int GL_DEPTH_RANGE =
		2928;
	
	int GL_DEPTH_WRITEMASK =
		2930;
	
	int GL_DOT3_RGB =
		34478;
	
	int GL_DOT3_RGBA =
		34479;
	
	int GL_DYNAMIC_DRAW =
		35048;
	
	int GL_ELEMENT_ARRAY_BUFFER =
		34963;
	
	int GL_ELEMENT_ARRAY_BUFFER_BINDING =
		34965;
	
	int GL_FRONT_FACE =
		2886;
	
	int GL_GENERATE_MIPMAP =
		33169;
	
	int GL_GENERATE_MIPMAP_HINT =
		33170;
	
	int GL_INTERPOLATE =
		34165;
	
	int GL_LINE_WIDTH =
		2849;
	
	int GL_LOGIC_OP_MODE =
		3056;
	
	int GL_MATRIX_MODE =
		2976;
	
	int GL_MAX_CLIP_PLANES =
		3378;
	
	int GL_MODELVIEW_MATRIX =
		2982;
	
	int GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES =
		35213;
	
	int GL_MODELVIEW_STACK_DEPTH =
		2979;
	
	int GL_NORMAL_ARRAY_BUFFER_BINDING =
		34967;
	
	int GL_NORMAL_ARRAY_POINTER =
		32911;
	
	int GL_NORMAL_ARRAY_STRIDE =
		32895;
	
	int GL_NORMAL_ARRAY_TYPE =
		32894;
	
	int GL_OPERAND0_ALPHA =
		34200;
	
	int GL_OPERAND0_RGB =
		34192;
	
	int GL_OPERAND1_ALPHA =
		34201;
	
	int GL_OPERAND1_RGB =
		34193;
	
	int GL_OPERAND2_ALPHA =
		34202;
	
	int GL_OPERAND2_RGB =
		34194;
	
	int GL_POINT_DISTANCE_ATTENUATION =
		33065;
	
	int GL_POINT_FADE_THRESHOLD_SIZE =
		33064;
	
	int GL_POINT_SIZE =
		2833;
	
	int GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES =
		35743;
	
	int GL_POINT_SIZE_ARRAY_OES =
		35740;
	
	int GL_POINT_SIZE_ARRAY_POINTER_OES =
		35212;
	
	int GL_POINT_SIZE_ARRAY_STRIDE_OES =
		35211;
	
	int GL_POINT_SIZE_ARRAY_TYPE_OES =
		35210;
	
	int GL_POINT_SIZE_MAX =
		33063;
	
	int GL_POINT_SIZE_MIN =
		33062;
	
	int GL_POINT_SPRITE_OES =
		34913;
	
	int GL_POLYGON_OFFSET_FACTOR =
		32824;
	
	int GL_POLYGON_OFFSET_UNITS =
		10752;
	
	int GL_PREVIOUS =
		34168;
	
	int GL_PRIMARY_COLOR =
		34167;
	
	int GL_PROJECTION_MATRIX =
		2983;
	
	int GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES =
		35214;
	
	int GL_PROJECTION_STACK_DEPTH =
		2980;
	
	int GL_RGB_SCALE =
		34163;
	
	int GL_SAMPLES =
		32937;
	
	int GL_SAMPLE_BUFFERS =
		32936;
	
	int GL_SAMPLE_COVERAGE_INVERT =
		32939;
	
	int GL_SAMPLE_COVERAGE_VALUE =
		32938;
	
	int GL_SCISSOR_BOX =
		3088;
	
	int GL_SHADE_MODEL =
		2900;
	
	int GL_SRC0_ALPHA =
		34184;
	
	int GL_SRC0_RGB =
		34176;
	
	int GL_SRC1_ALPHA =
		34185;
	
	int GL_SRC1_RGB =
		34177;
	
	int GL_SRC2_ALPHA =
		34186;
	
	int GL_SRC2_RGB =
		34178;
	
	int GL_STATIC_DRAW =
		35044;
	
	int GL_STENCIL_CLEAR_VALUE =
		2961;
	
	int GL_STENCIL_FAIL =
		2964;
	
	int GL_STENCIL_FUNC =
		2962;
	
	int GL_STENCIL_PASS_DEPTH_FAIL =
		2965;
	
	int GL_STENCIL_PASS_DEPTH_PASS =
		2966;
	
	int GL_STENCIL_REF =
		2967;
	
	int GL_STENCIL_VALUE_MASK =
		2963;
	
	int GL_STENCIL_WRITEMASK =
		2968;
	
	int GL_SUBTRACT =
		34023;
	
	int GL_TEXTURE_BINDING_2D =
		32873;
	
	int GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING =
		34970;
	
	int GL_TEXTURE_COORD_ARRAY_POINTER =
		32914;
	
	int GL_TEXTURE_COORD_ARRAY_SIZE =
		32904;
	
	int GL_TEXTURE_COORD_ARRAY_STRIDE =
		32906;
	
	int GL_TEXTURE_COORD_ARRAY_TYPE =
		32905;
	
	int GL_TEXTURE_MATRIX =
		2984;
	
	int GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES =
		35215;
	
	int GL_TEXTURE_STACK_DEPTH =
		2981;
	
	int GL_VERTEX_ARRAY_BUFFER_BINDING =
		34966;
	
	int GL_VERTEX_ARRAY_POINTER =
		32910;
	
	int GL_VERTEX_ARRAY_SIZE =
		32890;
	
	int GL_VERTEX_ARRAY_STRIDE =
		32892;
	
	int GL_VERTEX_ARRAY_TYPE =
		32891;
	
	int GL_VIEWPORT =
		2978;
	
	int GL_WRITE_ONLY =
		35001;
	
	void glBindBuffer(int __a, int __b);
	
	void glBufferData(int __a, int __b, Buffer __c, int __d);
	
	void glBufferSubData(int __a, int __b, int __c, Buffer __d);

	
	void glClipPlanef(int __a, float[] __b, int __c);
	
	void glClipPlanef(int __a, FloatBuffer __b);
	
	void glClipPlanex(int __a, int[] __b, int __c);
	
	void glClipPlanex(int __a, IntBuffer __b);
	
	void glColor4ub(byte __a, byte __b, byte __c, byte __d);
	
	void glColorPointer(int __a, int __b, int __c, int __d);
	
	void glDeleteBuffers(int __a, int[] __b, int __c);
	
	void glDeleteBuffers(int __a, IntBuffer __b);
	
	void glDrawElements(int __a, int __b, int __c, int __d);
	
	void glGenBuffers(int __a, int[] __b, int __c);
	
	void glGenBuffers(int __a, IntBuffer __b);
	
	void glGetBooleanv(int __a, boolean[] __b, int __c);
	
	void glGetBooleanv(int __a, IntBuffer __b);
	
	void glGetBufferParameteriv(int __a, int __b, int[] __c, int __d);

	
	void glGetBufferParameteriv(int __a, int __b, IntBuffer __c);

	
	void glGetClipPlanef(int __a, float[] __b, int __c);
	
	void glGetClipPlanef(int __a, FloatBuffer __b);
	
	void glGetClipPlanex(int __a, int[] __b, int __c);
	
	void glGetClipPlanex(int __a, IntBuffer __b);
	
	void glGetFixedv(int __a, int[] __b, int __c);
	
	void glGetFixedv(int __a, IntBuffer __b);
	
	void glGetFloatv(int __a, float[] __b, int __c);
	
	void glGetFloatv(int __a, FloatBuffer __b);
	
	void glGetLightfv(int __a, int __b, float[] __c, int __d);



	
	void glGetLightfv(int __a, int __b, FloatBuffer __c);
	
	void glGetLightxv(int __a, int __b, int[] __c, int __d);
	
	void glGetLightxv(int __a, int __b, IntBuffer __c);
	
	void glGetMaterialfv(int __a, int __b, float[] __c, int __d);

	
	void glGetMaterialfv(int __a, int __b, FloatBuffer __c);
	
	void glGetMaterialxv(int __a, int __b, int[] __c, int __d);

	
	void glGetMaterialxv(int __a, int __b, IntBuffer __c);
	
	void glGetPointerv(int __a, Buffer[] __b);
	
	void glGetTexEnvfv(int __a, int __b, float[] __c, int __d);

	
	void glGetTexEnvfv(int __a, int __b, FloatBuffer __c);
	
	void glGetTexEnviv(int __a, int __b, int[] __c, int __d);
	
	void glGetTexEnviv(int __a, int __b, IntBuffer __c);
	
	void glGetTexEnvxv(int __a, int __b, int[] __c, int __d);
	
	void glGetTexEnvxv(int __a, int __b, IntBuffer __c);
	
	void glGetTexParameterfv(int __a, int __b, float[] __c, int __d);

	
	void glGetTexParameterfv(int __a, int __b, FloatBuffer __c);

	
	void glGetTexParameteriv(int __a, int __b, int[] __c, int __d);

	
	void glGetTexParameteriv(int __a, int __b, IntBuffer __c);

	
	void glGetTexParameterxv(int __a, int __b, int[] __c, int __d);

	
	void glGetTexParameterxv(int __a, int __b, IntBuffer __c);

	
	boolean glIsBuffer(int __a);
	
	boolean glIsEnabled(int __a);
	
	boolean glIsTexture(int __a);
	
	void glNormalPointer(int __a, int __b, int __c);
	
	void glPointParameterf(int __a, float __b);
	
	void glPointParameterfv(int __a, float[] __b, int __c);
	
	void glPointParameterfv(int __a, FloatBuffer __b);
	
	void glPointParameterx(int __a, int __b);
	
	void glPointParameterxv(int __a, int[] __b, int __c);
	
	void glPointParameterxv(int __a, IntBuffer __b);
	
	void glPointSizePointerOES(int __a, int __b, int __c);
	
	void glPointSizePointerOES(int __a, int __b, Buffer __c);
	
	void glTexCoordPointer(int __a, int __b, int __c, int __d);

	
	void glTexEnvi(int __a, int __b, int __c);
	
	void glTexEnviv(int __a, int __b, int[] __c, int __d);
	
	void glTexEnviv(int __a, int __b, IntBuffer __c);
	
	void glTexParameterfv(int __a, int __b, float[] __c, int __d);

	
	void glTexParameterfv(int __a, int __b, FloatBuffer __c);
	
	void glTexParameteri(int __a, int __b, int __c);
	
	void glTexParameteriv(int __a, int __b, int[] __c, int __d);

	
	void glTexParameteriv(int __a, int __b, IntBuffer __c);
	
	void glTexParameterxv(int __a, int __b, int[] __c, int __d);

	
	void glTexParameterxv(int __a, int __b, IntBuffer __c);
	
	void glVertexPointer(int __a, int __b, int __c, int __d);
}


Name change from runt/apis/opengles/javax/microedition/khronos/opengles/GL11Ext.java to modules/opengles/src/main/java/javax/microedition/khronos/opengles/GL11Ext.java.

11
12
13
14
15
16
17

18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94


95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
package javax.microedition.khronos.opengles;

import java.nio.Buffer;
import java.nio.FloatBuffer;
import java.nio.IntBuffer;
import java.nio.ShortBuffer;


public interface GL11Ext
	extends GL
{
	public static final int GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES =
		35742;
	
	public static final int GL_MATRIX_INDEX_ARRAY_OES =
		34884;
	
	public static final int GL_MATRIX_INDEX_ARRAY_POINTER_OES =
		34889;
	
	public static final int GL_MATRIX_INDEX_ARRAY_SIZE_OES =
		34886;
	
	public static final int GL_MATRIX_INDEX_ARRAY_STRIDE_OES =
		34888;
	
	public static final int GL_MATRIX_INDEX_ARRAY_TYPE_OES =
		34887;
	
	public static final int GL_MATRIX_PALETTE_OES =
		34880;
	
	public static final int GL_MAX_PALETTE_MATRICES_OES =
		34882;
	
	public static final int GL_MAX_VERTEX_UNITS_OES =
		34468;
	
	public static final int GL_TEXTURE_CROP_RECT_OES =
		35741;
	
	public static final int GL_WEIGHT_ARRAY_BUFFER_BINDING_OES =
		34974;
	
	public static final int GL_WEIGHT_ARRAY_OES =
		34477;
	
	public static final int GL_WEIGHT_ARRAY_POINTER_OES =
		34476;
	
	public static final int GL_WEIGHT_ARRAY_SIZE_OES =
		34475;
	
	public static final int GL_WEIGHT_ARRAY_STRIDE_OES =
		34474;
	
	public static final int GL_WEIGHT_ARRAY_TYPE_OES =
		34473;
	
	public abstract void glCurrentPaletteMatrixOES(int __a);
	
	public abstract void glDrawTexfOES(float __a, float __b, float __c, float
		__d, float __e);
	
	public abstract void glDrawTexfvOES(float[] __a, int __b);
	
	public abstract void glDrawTexfvOES(FloatBuffer __a);
	
	public abstract void glDrawTexiOES(int __a, int __b, int __c, int __d, 
		int __e);
	
	public abstract void glDrawTexivOES(int[] __a, int __b);
	
	public abstract void glDrawTexivOES(IntBuffer __a);
	
	public abstract void glDrawTexsOES(short __a, short __b, short __c, short
		__d, short __e);
	
	public abstract void glDrawTexsvOES(short[] __a, int __b);
	
	public abstract void glDrawTexsvOES(ShortBuffer __a);
	
	public abstract void glDrawTexxOES(int __a, int __b, int __c, int __d, 
		int __e);
	


	public abstract void glDrawTexxvOES(int[] __a, int __b);
	
	public abstract void glDrawTexxvOES(IntBuffer __a);
	
	public abstract void glEnable(int __a);
	
	public abstract void glEnableClientState(int __a);
	
	public abstract void glLoadPaletteFromModelViewMatrixOES();
	
	public abstract void glMatrixIndexPointerOES(int __a, int __b, int __c, 
		int __d);
	
	public abstract void glMatrixIndexPointerOES(int __a, int __b, int __c, 
		Buffer __d);
	
	public abstract void glTexParameterfv(int __a, int __b, float[] __c, int 
		__d);
	
	public abstract void glWeightPointerOES(int __a, int __b, int __c, int 
		__d);
	
	public abstract void glWeightPointerOES(int __a, int __b, int __c, Buffer
		__d);
}









>



|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|

|
<

|

|

|
<

|

|

|
<

|

|
<
<
<

>
>
|

|

|

|

|

|
<

|
<

|
<

|
<

|
<



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72

73
74
75
76
77
78

79
80
81
82
83
84

85
86
87
88



89
90
91
92
93
94
95
96
97
98
99
100
101
102

103
104

105
106

107
108

109
110

111
112
113
package javax.microedition.khronos.opengles;

import java.nio.Buffer;
import java.nio.FloatBuffer;
import java.nio.IntBuffer;
import java.nio.ShortBuffer;

@SuppressWarnings({"FieldNamingConvention", "NewMethodNamingConvention"})
public interface GL11Ext
	extends GL
{
	int GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES =
		35742;
	
	int GL_MATRIX_INDEX_ARRAY_OES =
		34884;
	
	int GL_MATRIX_INDEX_ARRAY_POINTER_OES =
		34889;
	
	int GL_MATRIX_INDEX_ARRAY_SIZE_OES =
		34886;
	
	int GL_MATRIX_INDEX_ARRAY_STRIDE_OES =
		34888;
	
	int GL_MATRIX_INDEX_ARRAY_TYPE_OES =
		34887;
	
	int GL_MATRIX_PALETTE_OES =
		34880;
	
	int GL_MAX_PALETTE_MATRICES_OES =
		34882;
	
	int GL_MAX_VERTEX_UNITS_OES =
		34468;
	
	int GL_TEXTURE_CROP_RECT_OES =
		35741;
	
	int GL_WEIGHT_ARRAY_BUFFER_BINDING_OES =
		34974;
	
	int GL_WEIGHT_ARRAY_OES =
		34477;
	
	int GL_WEIGHT_ARRAY_POINTER_OES =
		34476;
	
	int GL_WEIGHT_ARRAY_SIZE_OES =
		34475;
	
	int GL_WEIGHT_ARRAY_STRIDE_OES =
		34474;
	
	int GL_WEIGHT_ARRAY_TYPE_OES =
		34473;
	
	void glCurrentPaletteMatrixOES(int __a);
	
	void glDrawTexfOES(float __a, float __b, float __c, float __d, float __e);

	
	void glDrawTexfvOES(float[] __a, int __b);
	
	void glDrawTexfvOES(FloatBuffer __a);
	
	void glDrawTexiOES(int __a, int __b, int __c, int __d, int __e);

	
	void glDrawTexivOES(int[] __a, int __b);
	
	void glDrawTexivOES(IntBuffer __a);
	
	void glDrawTexsOES(short __a, short __b, short __c, short __d, short __e);

	
	void glDrawTexsvOES(short[] __a, int __b);
	
	void glDrawTexsvOES(ShortBuffer __a);



	
	void glDrawTexxOES(int __a, int __b, int __c, int __d, int __e);
	
	void glDrawTexxvOES(int[] __a, int __b);
	
	void glDrawTexxvOES(IntBuffer __a);
	
	void glEnable(int __a);
	
	void glEnableClientState(int __a);
	
	void glLoadPaletteFromModelViewMatrixOES();
	
	void glMatrixIndexPointerOES(int __a, int __b, int __c, int __d);

	
	void glMatrixIndexPointerOES(int __a, int __b, int __c, Buffer __d);

	
	void glTexParameterfv(int __a, int __b, float[] __c, int __d);

	
	void glWeightPointerOES(int __a, int __b, int __c, int __d);

	
	void glWeightPointerOES(int __a, int __b, int __c, Buffer __d);

}


Name change from runt/apis/opengles/javax/microedition/khronos/opengles/GL11ExtensionPack.java to modules/opengles/src/main/java/javax/microedition/khronos/opengles/GL11ExtensionPack.java.

10
11
12
13
14
15
16

17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298

299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367


368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400

package javax.microedition.khronos.opengles;

import java.nio.Buffer;
import java.nio.FloatBuffer;
import java.nio.IntBuffer;


public interface GL11ExtensionPack
	extends GL
{
	public static final int GL_BLEND_DST_ALPHA =
		32970;
	
	public static final int GL_BLEND_DST_RGB =
		32968;
	
	public static final int GL_BLEND_EQUATION =
		32777;
	
	public static final int GL_BLEND_EQUATION_ALPHA =
		34877;
	
	public static final int GL_BLEND_EQUATION_RGB =
		32777;
	
	public static final int GL_BLEND_SRC_ALPHA =
		32971;
	
	public static final int GL_BLEND_SRC_RGB =
		32969;
	
	public static final int GL_COLOR_ATTACHMENT0_OES =
		36064;
	
	public static final int GL_COLOR_ATTACHMENT10_OES =
		36074;
	
	public static final int GL_COLOR_ATTACHMENT11_OES =
		36075;
	
	public static final int GL_COLOR_ATTACHMENT12_OES =
		36076;
	
	public static final int GL_COLOR_ATTACHMENT13_OES =
		36077;
	
	public static final int GL_COLOR_ATTACHMENT14_OES =
		36078;
	
	public static final int GL_COLOR_ATTACHMENT15_OES =
		36079;
	
	public static final int GL_COLOR_ATTACHMENT1_OES =
		36065;
	
	public static final int GL_COLOR_ATTACHMENT2_OES =
		36066;
	
	public static final int GL_COLOR_ATTACHMENT3_OES =
		36067;
	
	public static final int GL_COLOR_ATTACHMENT4_OES =
		36068;
	
	public static final int GL_COLOR_ATTACHMENT5_OES =
		36069;
	
	public static final int GL_COLOR_ATTACHMENT6_OES =
		36070;
	
	public static final int GL_COLOR_ATTACHMENT7_OES =
		36071;
	
	public static final int GL_COLOR_ATTACHMENT8_OES =
		36072;
	
	public static final int GL_COLOR_ATTACHMENT9_OES =
		36073;
	
	public static final int GL_DECR_WRAP =
		34056;
	
	public static final int GL_DEPTH_ATTACHMENT_OES =
		36096;
	
	public static final int GL_DEPTH_COMPONENT =
		6402;
	
	public static final int GL_DEPTH_COMPONENT16 =
		33189;
	
	public static final int GL_DEPTH_COMPONENT24 =
		33190;
	
	public static final int GL_DEPTH_COMPONENT32 =
		33191;
	
	public static final int GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_OES =
		36049;
	
	public static final int GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_OES =
		36048;
	
	public static final int 
		GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_OES =
		36051;
	
	public static final int GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_OES =
		36050;
	
	public static final int GL_FRAMEBUFFER_BINDING_OES =
		36006;
	
	public static final int GL_FRAMEBUFFER_COMPLETE_OES =
		36053;
	
	public static final int GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_OES =
		36054;
	
	public static final int GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_OES =
		36057;
	
	public static final int GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_OES =
		36059;
	
	public static final int GL_FRAMEBUFFER_INCOMPLETE_FORMATS_OES =
		36058;
	
	public static final int GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_OES 
		=
		36055;
	
	public static final int GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_OES =
		36060;
	
	public static final int GL_FRAMEBUFFER_OES =
		36160;
	
	public static final int GL_FRAMEBUFFER_UNSUPPORTED_OES =
		36061;
	
	public static final int GL_FUNC_ADD =
		32774;
	
	public static final int GL_FUNC_REVERSE_SUBTRACT =
		32779;
	
	public static final int GL_FUNC_SUBTRACT =
		32778;
	
	public static final int GL_INCR_WRAP =
		34055;
	
	public static final int GL_INVALID_FRAMEBUFFER_OPERATION_OES =
		1286;
	
	public static final int GL_MAX_COLOR_ATTACHMENTS_OES =
		36063;
	
	public static final int GL_MAX_CUBE_MAP_TEXTURE_SIZE =
		34076;
	
	public static final int GL_MAX_RENDERBUFFER_SIZE_OES =
		34024;
	
	public static final int GL_MIRRORED_REPEAT =
		33648;
	
	public static final int GL_NORMAL_MAP =
		34065;
	
	public static final int GL_REFLECTION_MAP =
		34066;
	
	public static final int GL_RENDERBUFFER_ALPHA_SIZE_OES =
		36179;
	
	public static final int GL_RENDERBUFFER_BINDING_OES =
		36007;
	
	public static final int GL_RENDERBUFFER_BLUE_SIZE_OES =
		36178;
	
	public static final int GL_RENDERBUFFER_DEPTH_SIZE_OES =
		36180;
	
	public static final int GL_RENDERBUFFER_GREEN_SIZE_OES =
		36177;
	
	public static final int GL_RENDERBUFFER_HEIGHT_OES =
		36163;
	
	public static final int GL_RENDERBUFFER_INTERNAL_FORMAT_OES =
		36164;
	
	public static final int GL_RENDERBUFFER_OES =
		36161;
	
	public static final int GL_RENDERBUFFER_RED_SIZE_OES =
		36176;
	
	public static final int GL_RENDERBUFFER_STENCIL_SIZE_OES =
		36181;
	
	public static final int GL_RENDERBUFFER_WIDTH_OES =
		36162;
	
	public static final int GL_RGB565_OES =
		36194;
	
	public static final int GL_RGB5_A1 =
		32855;
	
	public static final int GL_RGB8 =
		32849;
	
	public static final int GL_RGBA4 =
		32854;
	
	public static final int GL_RGBA8 =
		32856;
	
	public static final int GL_STENCIL_ATTACHMENT_OES =
		36128;
	
	public static final int GL_STENCIL_INDEX =
		6401;
	
	public static final int GL_STENCIL_INDEX1_OES =
		36166;
	
	public static final int GL_STENCIL_INDEX4_OES =
		36167;
	
	public static final int GL_STENCIL_INDEX8_OES =
		36168;
	
	public static final int GL_STR =
		-1;
	
	public static final int GL_TEXTURE_BINDING_CUBE_MAP =
		34068;
	
	public static final int GL_TEXTURE_CUBE_MAP =
		34067;
	
	public static final int GL_TEXTURE_CUBE_MAP_NEGATIVE_X =
		8318;
	
	public static final int GL_TEXTURE_CUBE_MAP_NEGATIVE_Y =
		8320;
	
	public static final int GL_TEXTURE_CUBE_MAP_NEGATIVE_Z =
		8322;
	
	public static final int GL_TEXTURE_CUBE_MAP_POSITIVE_X =
		8317;
	
	public static final int GL_TEXTURE_CUBE_MAP_POSITIVE_Y =
		8319;
	
	public static final int GL_TEXTURE_CUBE_MAP_POSITIVE_Z =
		8321;
	
	public static final int GL_TEXTURE_GEN_MODE =
		9472;
	
	public static final int GL_TEXTURE_GEN_STR =
		36192;
	
	public abstract void glBindFramebufferOES(int __a, int __b);
	
	public abstract void glBindRenderbufferOES(int __a, int __b);
	
	public abstract void glBindTexture(int __a, int __b);
	
	public abstract void glBlendEquation(int __a);
	
	public abstract void glBlendEquationSeparate(int __a, int __b);
	
	public abstract void glBlendFuncSeparate(int __a, int __b, int __c, int 
		__d);
	
	public abstract int glCheckFramebufferStatusOES(int __a);
	
	public abstract void glCompressedTexImage2D(int __a, int __b, int __c, 
		int __d, int __e, int __f, int __g, Buffer __h);
	
	public abstract void glCopyTexImage2D(int __a, int __b, int __c, int __d,

		int __e, int __f, int __g, int __h);
	
	public abstract void glDeleteFramebuffersOES(int __a, int[] __b, int __c
		);
	
	public abstract void glDeleteFramebuffersOES(int __a, IntBuffer __b);
	
	public abstract void glDeleteRenderbuffersOES(int __a, int[] __b, int __c
		);
	
	public abstract void glDeleteRenderbuffersOES(int __a, IntBuffer __b);
	
	public abstract void glEnable(int __a);
	
	public abstract void glFramebufferRenderbufferOES(int __a, int __b, int 
		__c, int __d);
	
	public abstract void glFramebufferTexture2DOES(int __a, int __b, int __c,
		int __d, int __e);
	
	public abstract void glGenFramebuffersOES(int __a, int[] __b, int __c);
	
	public abstract void glGenFramebuffersOES(int __a, IntBuffer __b);
	
	public abstract void glGenRenderbuffersOES(int __a, int[] __b, int __c);
	
	public abstract void glGenRenderbuffersOES(int __a, IntBuffer __b);
	
	public abstract void glGenerateMipmapOES(int __a);
	
	public abstract void glGetFramebufferAttachmentParameterivOES(int __a, 
		int __b, int __c, int[] __d, int __e);
	
	public abstract void glGetFramebufferAttachmentParameterivOES(int __a, 
		int __b, int __c, IntBuffer __d);
	
	public abstract void glGetIntegerv(int __a, int[] __b, int __c);
	
	public abstract void glGetIntegerv(int __a, IntBuffer __b);
	
	public abstract void glGetRenderbufferParameterivOES(int __a, int __b, 
		int[] __c, int __d);
	
	public abstract void glGetRenderbufferParameterivOES(int __a, int __b, 
		IntBuffer __c);
	
	public abstract void glGetTexGenfv(int __a, int __b, float[] __c, int __d
		);
	
	public abstract void glGetTexGenfv(int __a, int __b, FloatBuffer __c);
	
	public abstract void glGetTexGeniv(int __a, int __b, int[] __c, int __d);
	
	public abstract void glGetTexGeniv(int __a, int __b, IntBuffer __c);
	
	public abstract void glGetTexGenxv(int __a, int __b, int[] __c, int __d);
	
	public abstract void glGetTexGenxv(int __a, int __b, IntBuffer __c);
	
	public abstract boolean glIsFramebufferOES(int __a);
	
	public abstract boolean glIsRenderbufferOES(int __a);
	
	public abstract void glRenderbufferStorageOES(int __a, int __b, int __c, 
		int __d);
	
	public abstract void glStencilOp(int __a, int __b, int __c);
	
	public abstract void glTexEnvf(int __a, int __b, float __c);


	
	public abstract void glTexEnvfv(int __a, int __b, float[] __c, int __d);
	
	public abstract void glTexEnvfv(int __a, int __b, FloatBuffer __c);
	
	public abstract void glTexEnvx(int __a, int __b, int __c);
	
	public abstract void glTexEnvxv(int __a, int __b, int[] __c, int __d);
	
	public abstract void glTexEnvxv(int __a, int __b, IntBuffer __c);
	
	public abstract void glTexGenf(int __a, int __b, float __c);
	
	public abstract void glTexGenfv(int __a, int __b, float[] __c, int __d);
	
	public abstract void glTexGenfv(int __a, int __b, FloatBuffer __c);
	
	public abstract void glTexGeni(int __a, int __b, int __c);
	
	public abstract void glTexGeniv(int __a, int __b, int[] __c, int __d);
	
	public abstract void glTexGeniv(int __a, int __b, IntBuffer __c);
	
	public abstract void glTexGenx(int __a, int __b, int __c);
	
	public abstract void glTexGenxv(int __a, int __b, int[] __c, int __d);
	
	public abstract void glTexGenxv(int __a, int __b, IntBuffer __c);
	
	public abstract void glTexParameterf(int __a, int __b, float __c);
}









>



|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|



|


|


|


|


|


|


|


|



|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|

|

|

|

|

|
<

|

|
|

|
>
|

|
<

|

|
<

|

|

|
<

|
|

|

|

|

|

|

|
|

|
|

|

|

|
|

|
<

|
<

|

|

|

|

|

|

|

|
<

|

|
>
>

<
<
|

|

|

|

|

|

|

|

|

|

|

|

|

|



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291

292
293
294
295
296
297
298
299
300
301
302

303
304
305
306

307
308
309
310
311
312

313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340

341
342

343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358

359
360
361
362
363
364
365


366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395

package javax.microedition.khronos.opengles;

import java.nio.Buffer;
import java.nio.FloatBuffer;
import java.nio.IntBuffer;

@SuppressWarnings({"FieldNamingConvention", "NewMethodNamingConvention"})
public interface GL11ExtensionPack
	extends GL
{
	int GL_BLEND_DST_ALPHA =
		32970;
	
	int GL_BLEND_DST_RGB =
		32968;
	
	int GL_BLEND_EQUATION =
		32777;
	
	int GL_BLEND_EQUATION_ALPHA =
		34877;
	
	int GL_BLEND_EQUATION_RGB =
		32777;
	
	int GL_BLEND_SRC_ALPHA =
		32971;
	
	int GL_BLEND_SRC_RGB =
		32969;
	
	int GL_COLOR_ATTACHMENT0_OES =
		36064;
	
	int GL_COLOR_ATTACHMENT10_OES =
		36074;
	
	int GL_COLOR_ATTACHMENT11_OES =
		36075;
	
	int GL_COLOR_ATTACHMENT12_OES =
		36076;
	
	int GL_COLOR_ATTACHMENT13_OES =
		36077;
	
	int GL_COLOR_ATTACHMENT14_OES =
		36078;
	
	int GL_COLOR_ATTACHMENT15_OES =
		36079;
	
	int GL_COLOR_ATTACHMENT1_OES =
		36065;
	
	int GL_COLOR_ATTACHMENT2_OES =
		36066;
	
	int GL_COLOR_ATTACHMENT3_OES =
		36067;
	
	int GL_COLOR_ATTACHMENT4_OES =
		36068;
	
	int GL_COLOR_ATTACHMENT5_OES =
		36069;
	
	int GL_COLOR_ATTACHMENT6_OES =
		36070;
	
	int GL_COLOR_ATTACHMENT7_OES =
		36071;
	
	int GL_COLOR_ATTACHMENT8_OES =
		36072;
	
	int GL_COLOR_ATTACHMENT9_OES =
		36073;
	
	int GL_DECR_WRAP =
		34056;
	
	int GL_DEPTH_ATTACHMENT_OES =
		36096;
	
	int GL_DEPTH_COMPONENT =
		6402;
	
	int GL_DEPTH_COMPONENT16 =
		33189;
	
	int GL_DEPTH_COMPONENT24 =
		33190;
	
	int GL_DEPTH_COMPONENT32 =
		33191;
	
	int GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_OES =
		36049;
	
	int GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_OES =
		36048;
	
	int
		GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_OES =
		36051;
	
	int GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_OES =
		36050;
	
	int GL_FRAMEBUFFER_BINDING_OES =
		36006;
	
	int GL_FRAMEBUFFER_COMPLETE_OES =
		36053;
	
	int GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_OES =
		36054;
	
	int GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_OES =
		36057;
	
	int GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_OES =
		36059;
	
	int GL_FRAMEBUFFER_INCOMPLETE_FORMATS_OES =
		36058;
	
	int GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_OES
		=
		36055;
	
	int GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_OES =
		36060;
	
	int GL_FRAMEBUFFER_OES =
		36160;
	
	int GL_FRAMEBUFFER_UNSUPPORTED_OES =
		36061;
	
	int GL_FUNC_ADD =
		32774;
	
	int GL_FUNC_REVERSE_SUBTRACT =
		32779;
	
	int GL_FUNC_SUBTRACT =
		32778;
	
	int GL_INCR_WRAP =
		34055;
	
	int GL_INVALID_FRAMEBUFFER_OPERATION_OES =
		1286;
	
	int GL_MAX_COLOR_ATTACHMENTS_OES =
		36063;
	
	int GL_MAX_CUBE_MAP_TEXTURE_SIZE =
		34076;
	
	int GL_MAX_RENDERBUFFER_SIZE_OES =
		34024;
	
	int GL_MIRRORED_REPEAT =
		33648;
	
	int GL_NORMAL_MAP =
		34065;
	
	int GL_REFLECTION_MAP =
		34066;
	
	int GL_RENDERBUFFER_ALPHA_SIZE_OES =
		36179;
	
	int GL_RENDERBUFFER_BINDING_OES =
		36007;
	
	int GL_RENDERBUFFER_BLUE_SIZE_OES =
		36178;
	
	int GL_RENDERBUFFER_DEPTH_SIZE_OES =
		36180;
	
	int GL_RENDERBUFFER_GREEN_SIZE_OES =
		36177;
	
	int GL_RENDERBUFFER_HEIGHT_OES =
		36163;
	
	int GL_RENDERBUFFER_INTERNAL_FORMAT_OES =
		36164;
	
	int GL_RENDERBUFFER_OES =
		36161;
	
	int GL_RENDERBUFFER_RED_SIZE_OES =
		36176;
	
	int GL_RENDERBUFFER_STENCIL_SIZE_OES =
		36181;
	
	int GL_RENDERBUFFER_WIDTH_OES =
		36162;
	
	int GL_RGB565_OES =
		36194;
	
	int GL_RGB5_A1 =
		32855;
	
	int GL_RGB8 =
		32849;
	
	int GL_RGBA4 =
		32854;
	
	int GL_RGBA8 =
		32856;
	
	int GL_STENCIL_ATTACHMENT_OES =
		36128;
	
	int GL_STENCIL_INDEX =
		6401;
	
	int GL_STENCIL_INDEX1_OES =
		36166;
	
	int GL_STENCIL_INDEX4_OES =
		36167;
	
	int GL_STENCIL_INDEX8_OES =
		36168;
	
	int GL_STR =
		-1;
	
	int GL_TEXTURE_BINDING_CUBE_MAP =
		34068;
	
	int GL_TEXTURE_CUBE_MAP =
		34067;
	
	int GL_TEXTURE_CUBE_MAP_NEGATIVE_X =
		8318;
	
	int GL_TEXTURE_CUBE_MAP_NEGATIVE_Y =
		8320;
	
	int GL_TEXTURE_CUBE_MAP_NEGATIVE_Z =
		8322;
	
	int GL_TEXTURE_CUBE_MAP_POSITIVE_X =
		8317;
	
	int GL_TEXTURE_CUBE_MAP_POSITIVE_Y =
		8319;
	
	int GL_TEXTURE_CUBE_MAP_POSITIVE_Z =
		8321;
	
	int GL_TEXTURE_GEN_MODE =
		9472;
	
	int GL_TEXTURE_GEN_STR =
		36192;
	
	void glBindFramebufferOES(int __a, int __b);
	
	void glBindRenderbufferOES(int __a, int __b);
	
	void glBindTexture(int __a, int __b);
	
	void glBlendEquation(int __a);
	
	void glBlendEquationSeparate(int __a, int __b);
	
	void glBlendFuncSeparate(int __a, int __b, int __c, int __d);

	
	int glCheckFramebufferStatusOES(int __a);
	
	void glCompressedTexImage2D(int __a, int __b, int __c, int __d, int __e,
		int __f, int __g, Buffer __h);
	
	void glCopyTexImage2D(int __a, int __b, int __c, int __d, int __e,
	 int __f,
		int __g, int __h);
	
	void glDeleteFramebuffersOES(int __a, int[] __b, int __c);

	
	void glDeleteFramebuffersOES(int __a, IntBuffer __b);
	
	void glDeleteRenderbuffersOES(int __a, int[] __b, int __c);

	
	void glDeleteRenderbuffersOES(int __a, IntBuffer __b);
	
	void glEnable(int __a);
	
	void glFramebufferRenderbufferOES(int __a, int __b, int __c, int __d);

	
	void glFramebufferTexture2DOES(int __a, int __b, int __c, int __d,
	 int __e);
	
	void glGenFramebuffersOES(int __a, int[] __b, int __c);
	
	void glGenFramebuffersOES(int __a, IntBuffer __b);
	
	void glGenRenderbuffersOES(int __a, int[] __b, int __c);
	
	void glGenRenderbuffersOES(int __a, IntBuffer __b);
	
	void glGenerateMipmapOES(int __a);
	
	void glGetFramebufferAttachmentParameterivOES(int __a, int __b, int __c,
		int[] __d, int __e);
	
	void glGetFramebufferAttachmentParameterivOES(int __a, int __b, int __c,
		IntBuffer __d);
	
	void glGetIntegerv(int __a, int[] __b, int __c);
	
	void glGetIntegerv(int __a, IntBuffer __b);
	
	void glGetRenderbufferParameterivOES(int __a, int __b, int[] __c,
	 int __d);
	
	void glGetRenderbufferParameterivOES(int __a, int __b, IntBuffer __c);

	
	void glGetTexGenfv(int __a, int __b, float[] __c, int __d);

	
	void glGetTexGenfv(int __a, int __b, FloatBuffer __c);
	
	void glGetTexGeniv(int __a, int __b, int[] __c, int __d);
	
	void glGetTexGeniv(int __a, int __b, IntBuffer __c);
	
	void glGetTexGenxv(int __a, int __b, int[] __c, int __d);
	
	void glGetTexGenxv(int __a, int __b, IntBuffer __c);
	
	boolean glIsFramebufferOES(int __a);
	
	boolean glIsRenderbufferOES(int __a);
	
	void glRenderbufferStorageOES(int __a, int __b, int __c, int __d);

	
	void glStencilOp(int __a, int __b, int __c);
	
	void glTexEnvf(int __a, int __b, float __c);
	
	void glTexEnvfv(int __a, int __b, float[] __c, int __d);
	


	void glTexEnvfv(int __a, int __b, FloatBuffer __c);
	
	void glTexEnvx(int __a, int __b, int __c);
	
	void glTexEnvxv(int __a, int __b, int[] __c, int __d);
	
	void glTexEnvxv(int __a, int __b, IntBuffer __c);
	
	void glTexGenf(int __a, int __b, float __c);
	
	void glTexGenfv(int __a, int __b, float[] __c, int __d);
	
	void glTexGenfv(int __a, int __b, FloatBuffer __c);
	
	void glTexGeni(int __a, int __b, int __c);
	
	void glTexGeniv(int __a, int __b, int[] __c, int __d);
	
	void glTexGeniv(int __a, int __b, IntBuffer __c);
	
	void glTexGenx(int __a, int __b, int __c);
	
	void glTexGenxv(int __a, int __b, int[] __c, int __d);
	
	void glTexGenxv(int __a, int __b, IntBuffer __c);
	
	void glTexParameterf(int __a, int __b, float __c);
}


Added modules/profile-meep/build.gradle.

















































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import cc.squirreljme.plugin.swm.JavaMEMidletType
import cc.squirreljme.plugin.swm.JavaMEProfile

description = "This defines the MEEP profile and is a virtual project."
version = rootProject.version

squirreljme
{
	javaDocErrorCode = "AR"
	swmType = JavaMEMidletType.API
	swmName = "MEEP 8.0 Profile"
	swmVendor = "Stephanie Gawroriski"
	definedProfiles += new JavaMEProfile("MIDP-1.0")
	definedProfiles += new JavaMEProfile("MIDP-2.0")
	definedProfiles += new JavaMEProfile("MIDP-2.1")
	definedProfiles += new JavaMEProfile("MIDP-3.0")
	definedProfiles += new JavaMEProfile("MIDP-3.1")
	definedProfiles += new JavaMEProfile("MEEP-8")
}

dependencies
{
	implementation project(":modules:cldc-compact")

	implementation project(":modules:gcf")
	implementation project(":modules:media-api")
	implementation project(":modules:meep-cellular")
	implementation project(":modules:meep-concurrency")
	implementation project(":modules:meep-event")
	implementation project(":modules:meep-key")
	implementation project(":modules:meep-liblets")
	implementation project(":modules:meep-lui")
	implementation project(":modules:meep-midlet")
	implementation project(":modules:meep-power")
	implementation project(":modules:meep-provisioning")
	implementation project(":modules:meep-rms")
	implementation project(":modules:meep-securityframework")
	implementation project(":modules:meep-swm")
	implementation project(":modules:midp-lcdui")
}

Added modules/squirrel-quarrel/build.gradle.



















































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import cc.squirreljme.plugin.swm.JavaMEMidlet
import cc.squirreljme.plugin.swm.JavaMEMidletType

description = "A turn based strategy involving squirrels and " +
 "lots of acorns! Keep on your claws and horde them all!"
version = rootProject.version

squirreljme
{
	javaDocErrorCode = "BE"
	swmType = JavaMEMidletType.APPLICATION
	swmName = "Squirrel Quarrel"
	swmVendor = "Stephanie Gawroriski"
	midlets += new JavaMEMidlet("Squirrel Quarrel", "icon.xpm",
		"dev.shadowtail.squirrelquarrel.MainMidlet")
}

dependencies
{
	implementation project(":modules:cldc-compact")

	implementation project(":modules:tool-manifest-reader")
	implementation project(":modules:midp-lcdui")
	implementation project(":modules:meep-midlet")
}

Name change from runt/mids/squirrel-quarrel/dev/shadowtail/squirrelquarrel/AIThinker.java to modules/squirrel-quarrel/src/main/java/dev/shadowtail/squirrelquarrel/AIThinker.java.

Name change from runt/mids/squirrel-quarrel/dev/shadowtail/squirrelquarrel/CommandHandler.java to modules/squirrel-quarrel/src/main/java/dev/shadowtail/squirrelquarrel/CommandHandler.java.

51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
	 *
	 * @param __c The command to execute.
	 * @since 2019/12/25
	 */
	public void commandAction(Command __c, Displayable __d)
	{
		// Exit the game?
		if (__c == EXIT_COMMAND)
			System.exit(0);
		
		// The in-game menu was requested
		else if (__c == GameInterface.STATUS_COMMAND)
			__d.getCurrentDisplay().setCurrent(
				this.__makeStatusMenu((GameInterface)__d));
		







|







51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
	 *
	 * @param __c The command to execute.
	 * @since 2019/12/25
	 */
	public void commandAction(Command __c, Displayable __d)
	{
		// Exit the game?
		if (__c == CommandHandler.EXIT_COMMAND)
			System.exit(0);
		
		// The in-game menu was requested
		else if (__c == GameInterface.STATUS_COMMAND)
			__d.getCurrentDisplay().setCurrent(
				this.__makeStatusMenu((GameInterface)__d));
		
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
		items.append("P2: 9999 Acorns", PlayerIndex.of(1).colorBox());
		items.append("P3: 9999 Acorns", PlayerIndex.of(2).colorBox());
		items.append("P4: 9999 Acorns", PlayerIndex.of(3).colorBox());
		items.append("Season: Spring Day 1", null);
		
		// Set commands for this list
		items.addCommand(new ReturnToGameCommand(__gi));
		items.addCommand(EXIT_COMMAND);
		
		// Use self as the command listener
		items.setCommandListener(this);
		
		// Return the list
		return items;
	}
}








|









90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
		items.append("P2: 9999 Acorns", PlayerIndex.of(1).colorBox());
		items.append("P3: 9999 Acorns", PlayerIndex.of(2).colorBox());
		items.append("P4: 9999 Acorns", PlayerIndex.of(3).colorBox());
		items.append("Season: Spring Day 1", null);
		
		// Set commands for this list
		items.addCommand(new ReturnToGameCommand(__gi));
		items.addCommand(CommandHandler.EXIT_COMMAND);
		
		// Use self as the command listener
		items.setCommandListener(this);
		
		// Return the list
		return items;
	}
}

Name change from runt/mids/squirrel-quarrel/dev/shadowtail/squirrelquarrel/Game.java to modules/squirrel-quarrel/src/main/java/dev/shadowtail/squirrelquarrel/Game.java.

Name change from runt/mids/squirrel-quarrel/dev/shadowtail/squirrelquarrel/GameBuilder.java to modules/squirrel-quarrel/src/main/java/dev/shadowtail/squirrelquarrel/GameBuilder.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package dev.shadowtail.squirrelquarrel;

import java.io.InputStream;
import java.io.IOException;
import java.util.Random;

/**
 * This is used to build games which can then be run and such.
 *
 * @since 2019/07/01
 */











|
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package dev.shadowtail.squirrelquarrel;

import java.io.IOException;
import java.io.InputStream;
import java.util.Random;

/**
 * This is used to build games which can then be run and such.
 *
 * @since 2019/07/01
 */

Name change from runt/mids/squirrel-quarrel/dev/shadowtail/squirrelquarrel/GameInterface.java to modules/squirrel-quarrel/src/main/java/dev/shadowtail/squirrelquarrel/GameInterface.java.

50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
		// Initialize variables
		this.game = __g;
		
		// Setup canvas view and such
		this.setTitle("Squirrel Quarrel");
		
		// Add menu command to access the in-game menu
		this.addCommand(STATUS_COMMAND);
		this.setCommandListener(new CommandHandler(__g));
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2019/07/02
	 */







|







50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
		// Initialize variables
		this.game = __g;
		
		// Setup canvas view and such
		this.setTitle("Squirrel Quarrel");
		
		// Add menu command to access the in-game menu
		this.addCommand(GameInterface.STATUS_COMMAND);
		this.setCommandListener(new CommandHandler(__g));
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2019/07/02
	 */

Name change from runt/mids/squirrel-quarrel/dev/shadowtail/squirrelquarrel/MainMidlet.java to modules/squirrel-quarrel/src/main/java/dev/shadowtail/squirrelquarrel/MainMidlet.java.

Name change from runt/mids/squirrel-quarrel/dev/shadowtail/squirrelquarrel/MapSize.java to modules/squirrel-quarrel/src/main/java/dev/shadowtail/squirrelquarrel/MapSize.java.

34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
	/** Ridiculous. */
	RIDICULOUSLY_LARGE(80, 80),
	
	/** End. */
	;
	
	/** The default map size to use. */
	public static final MapSize DEFAULT =
		TINY;
	
	/** The map width. */
	public final int width;
	
	/** The map height. */
	public final int height;
	
	/**
	 * Initializes the map size.
	 *
	 * @param __w The width.
	 * @param __h The height.
	 * @since 2019/07/01
	 */
	private MapSize(int __w, int __h)
	{
		this.width = __w;
		this.height = __h;
	}
}








|
<














|






34
35
36
37
38
39
40
41

42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
	/** Ridiculous. */
	RIDICULOUSLY_LARGE(80, 80),
	
	/** End. */
	;
	
	/** The default map size to use. */
	public static final MapSize DEFAULT = MapSize.TINY;

	
	/** The map width. */
	public final int width;
	
	/** The map height. */
	public final int height;
	
	/**
	 * Initializes the map size.
	 *
	 * @param __w The width.
	 * @param __h The height.
	 * @since 2019/07/01
	 */
	MapSize(int __w, int __h)
	{
		this.width = __w;
		this.height = __h;
	}
}

Name change from runt/mids/squirrel-quarrel/dev/shadowtail/squirrelquarrel/MutablePoint.java to modules/squirrel-quarrel/src/main/java/dev/shadowtail/squirrelquarrel/MutablePoint.java.

Name change from runt/mids/squirrel-quarrel/dev/shadowtail/squirrelquarrel/Player.java to modules/squirrel-quarrel/src/main/java/dev/shadowtail/squirrelquarrel/Player.java.

Name change from runt/mids/squirrel-quarrel/dev/shadowtail/squirrelquarrel/PlayerIndex.java to modules/squirrel-quarrel/src/main/java/dev/shadowtail/squirrelquarrel/PlayerIndex.java.

96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
	 * Initializes the color code.
	 *
	 * @param __name The name of the color.
	 * @param __rgb The RGB used for the player color.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/02/10
	 */
	private PlayerIndex(String __name, int __rgb)
		throws NullPointerException
	{
		// Check
		if (__name == null)
			throw new NullPointerException("NARG");
		
		// Set







|







96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
	 * Initializes the color code.
	 *
	 * @param __name The name of the color.
	 * @param __rgb The RGB used for the player color.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/02/10
	 */
	PlayerIndex(String __name, int __rgb)
		throws NullPointerException
	{
		// Check
		if (__name == null)
			throw new NullPointerException("NARG");
		
		// Set
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
	 * @since 2019/12/26
	 */
	public static final PlayerIndex of(int __i)
		throws NoSuchElementException
	{
		switch (__i)
		{
			case 0:	return RED;
			case 1:	return PURPLE;
			case 2:	return GREEN;
			case 3:	return BLUE;
			case 4:	return YELLOW;
			case 5:	return GRAY;
			
				// {@squirreljme.error BE0u Invalid player index.}
			default:
				throw new NoSuchElementException("BE0u");
		}
	}
}








|
|
|
|
|
|








142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
	 * @since 2019/12/26
	 */
	public static final PlayerIndex of(int __i)
		throws NoSuchElementException
	{
		switch (__i)
		{
			case 0:	return PlayerIndex.RED;
			case 1:	return PlayerIndex.PURPLE;
			case 2:	return PlayerIndex.GREEN;
			case 3:	return PlayerIndex.BLUE;
			case 4:	return PlayerIndex.YELLOW;
			case 5:	return PlayerIndex.GRAY;
			
				// {@squirreljme.error BE0u Invalid player index.}
			default:
				throw new NoSuchElementException("BE0u");
		}
	}
}

Name change from runt/mids/squirrel-quarrel/dev/shadowtail/squirrelquarrel/PlayerThinker.java to modules/squirrel-quarrel/src/main/java/dev/shadowtail/squirrelquarrel/PlayerThinker.java.

Name change from runt/mids/squirrel-quarrel/dev/shadowtail/squirrelquarrel/Players.java to modules/squirrel-quarrel/src/main/java/dev/shadowtail/squirrelquarrel/Players.java.

Name change from runt/mids/squirrel-quarrel/dev/shadowtail/squirrelquarrel/RemoteThinker.java to modules/squirrel-quarrel/src/main/java/dev/shadowtail/squirrelquarrel/RemoteThinker.java.

Name change from runt/mids/squirrel-quarrel/dev/shadowtail/squirrelquarrel/ReplayThinker.java to modules/squirrel-quarrel/src/main/java/dev/shadowtail/squirrelquarrel/ReplayThinker.java.

Name change from runt/mids/squirrel-quarrel/dev/shadowtail/squirrelquarrel/ReturnToGameCommand.java to modules/squirrel-quarrel/src/main/java/dev/shadowtail/squirrelquarrel/ReturnToGameCommand.java.

Name change from runt/mids/squirrel-quarrel/dev/shadowtail/squirrelquarrel/Thinker.java to modules/squirrel-quarrel/src/main/java/dev/shadowtail/squirrelquarrel/Thinker.java.

Name change from runt/mids/squirrel-quarrel/dev/shadowtail/squirrelquarrel/TileMap.java to modules/squirrel-quarrel/src/main/java/dev/shadowtail/squirrelquarrel/TileMap.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package dev.shadowtail.squirrelquarrel;

import java.io.InputStream;
import java.io.IOException;
import java.util.Random;
import javax.microedition.lcdui.Image;

/**
 * This manages the world map which consists of tiles.
 *
 * @since 2019/07/01











|
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package dev.shadowtail.squirrelquarrel;

import java.io.IOException;
import java.io.InputStream;
import java.util.Random;
import javax.microedition.lcdui.Image;

/**
 * This manages the world map which consists of tiles.
 *
 * @since 2019/07/01
133
134
135
136
137
138
139
140

141
142
143
144
	 * @param __b The tile data.
	 * @return The image to use.
	 * @since 2019/07/02
	 */
	public static Image imageBackground(byte __b)
	{
		// Read cached image
		return TileMap.cacheImage(_CACHE_BACKGROUND, __b & TILE_BACKGOUND_MASK,

			"tile");
	}
}








|
>




133
134
135
136
137
138
139
140
141
142
143
144
145
	 * @param __b The tile data.
	 * @return The image to use.
	 * @since 2019/07/02
	 */
	public static Image imageBackground(byte __b)
	{
		// Read cached image
		return TileMap.cacheImage(
			TileMap._CACHE_BACKGROUND, __b & TileMap.TILE_BACKGOUND_MASK,
			"tile");
	}
}

Name change from runt/mids/squirrel-quarrel/dev/shadowtail/squirrelquarrel/Unit.java to modules/squirrel-quarrel/src/main/java/dev/shadowtail/squirrelquarrel/Unit.java.

Name change from runt/mids/squirrel-quarrel/dev/shadowtail/squirrelquarrel/Units.java to modules/squirrel-quarrel/src/main/java/dev/shadowtail/squirrelquarrel/Units.java.

Name change from runt/mids/squirrel-quarrel/dev/shadowtail/squirrelquarrel/package-info.java to modules/squirrel-quarrel/src/main/java/dev/shadowtail/squirrelquarrel/package-info.java.

Name change from runt/mids/squirrel-quarrel/net/multiphasicapps/squirrelquarrel/game/EventSource.java to modules/squirrel-quarrel/src/main/java/net/multiphasicapps/squirrelquarrel/game/EventSource.java.

Name change from runt/mids/squirrel-quarrel/net/multiphasicapps/squirrelquarrel/game/Game.java to modules/squirrel-quarrel/src/main/java/net/multiphasicapps/squirrelquarrel/game/Game.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.squirrelquarrel.game;

import java.io.DataInputStream;
import java.io.InputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import net.multiphasicapps.squirrelquarrel.player.Player;
import net.multiphasicapps.squirrelquarrel.player.Players;
import net.multiphasicapps.squirrelquarrel.player.PlayerColor;
import net.multiphasicapps.squirrelquarrel.units.SpawnPlacementType;
import net.multiphasicapps.squirrelquarrel.units.Unit;
import net.multiphasicapps.squirrelquarrel.units.Units;
import net.multiphasicapps.squirrelquarrel.units.UnitType;
import net.multiphasicapps.squirrelquarrel.util.GameRandom;
import net.multiphasicapps.squirrelquarrel.world.World;

/**
 * This class contains the state for a single game.
 *
 * @since 2017/02/08












<
<
<
<
<

|
|


|
|







1
2
3
4
5
6
7
8
9
10
11
12





13
14
15
16
17
18
19
20
21
22
23
24
25
26
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.squirrelquarrel.game;






import net.multiphasicapps.squirrelquarrel.player.Player;
import net.multiphasicapps.squirrelquarrel.player.PlayerColor;
import net.multiphasicapps.squirrelquarrel.player.Players;
import net.multiphasicapps.squirrelquarrel.units.SpawnPlacementType;
import net.multiphasicapps.squirrelquarrel.units.Unit;
import net.multiphasicapps.squirrelquarrel.units.UnitType;
import net.multiphasicapps.squirrelquarrel.units.Units;
import net.multiphasicapps.squirrelquarrel.util.GameRandom;
import net.multiphasicapps.squirrelquarrel.world.World;

/**
 * This class contains the state for a single game.
 *
 * @since 2017/02/08
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141

142
143
144
145
146
147
148
		if (!this._booted)
		{
			this.__boot();
			this._booted = true;
		}
		
		// Run all the sub-logic
		world.run(framenum);
		units.run(framenum);
		players.run(framenum);
		
		// Increase the game frame
		this._framenum = framenum + 1;
	}
	
	/**
	 * Returns the world.
	 *

	 * @since 2017/02/10
	 */
	public World world()
	{
		return this.world;
	}
	







|
|
|








>







119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
		if (!this._booted)
		{
			this.__boot();
			this._booted = true;
		}
		
		// Run all the sub-logic
		this.world.run(framenum);
		this.units.run(framenum);
		this.players.run(framenum);
		
		// Increase the game frame
		this._framenum = framenum + 1;
	}
	
	/**
	 * Returns the world.
	 *
	 * @return The world.
	 * @since 2017/02/10
	 */
	public World world()
	{
		return this.world;
	}
	

Name change from runt/mids/squirrel-quarrel/net/multiphasicapps/squirrelquarrel/game/GameLooper.java to modules/squirrel-quarrel/src/main/java/net/multiphasicapps/squirrelquarrel/game/GameLooper.java.

175
176
177
178
179
180
181

182
183
184
185
186
187
188
	/**
	 * Initialize a game loop which either resumes the game from the given
	 * point or plays it back in a replay.
	 *
	 * @param __out The output for replay data.
	 * @param __rm How will the game be resumed?
	 * @param __in The input stream for replay/save data.

	 * @throws NullPointerException On null arguments.
	 * @since 2018/03/19
	 */
	public static final GameLooper resume(OutputStream __out,
		ResumeMode __rm, InputStream __in)
		throws NullPointerException
	{







>







175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
	/**
	 * Initialize a game loop which either resumes the game from the given
	 * point or plays it back in a replay.
	 *
	 * @param __out The output for replay data.
	 * @param __rm How will the game be resumed?
	 * @param __in The input stream for replay/save data.
	 * @return The loop.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/03/19
	 */
	public static final GameLooper resume(OutputStream __out,
		ResumeMode __rm, InputStream __in)
		throws NullPointerException
	{

Name change from runt/mids/squirrel-quarrel/net/multiphasicapps/squirrelquarrel/game/GameSpeed.java to modules/squirrel-quarrel/src/main/java/net/multiphasicapps/squirrelquarrel/game/GameSpeed.java.

54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
	
	/**
	 * Initializes the game speed.
	 *
	 * @param __msbf Milliseconds between frames.
	 * @since 2017/02/10
	 */
	private GameSpeed(int __msbf)
	{
		this.msbetweenframes = __msbf;
		this.nsbetweenframes = __msbf * 1_000_000;
	}
	
	/**
	 * Returns the game speed which is faster than this one.
	 *
	 * @return The faster game speed.
	 * @since 2017/02/12
	 */
	public GameSpeed faster()
	{
		// Depends
		switch (this)
		{
			case SLOWEST:	return SLOWER;
			case SLOWER:	return SLOW;
			case SLOW:		return NORMAL;
			case NORMAL:	return FAST;
			case FAST:		return FASTER;
			case FASTER:	return FASTEST;
			default:
				return this;
		}
	}
	
	/**
	 * Returns the duration of a single frame in nanoseconds.







|
















|
|
|
|
|
|







54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
	
	/**
	 * Initializes the game speed.
	 *
	 * @param __msbf Milliseconds between frames.
	 * @since 2017/02/10
	 */
	GameSpeed(int __msbf)
	{
		this.msbetweenframes = __msbf;
		this.nsbetweenframes = __msbf * 1_000_000;
	}
	
	/**
	 * Returns the game speed which is faster than this one.
	 *
	 * @return The faster game speed.
	 * @since 2017/02/12
	 */
	public GameSpeed faster()
	{
		// Depends
		switch (this)
		{
			case SLOWEST:	return GameSpeed.SLOWER;
			case SLOWER:	return GameSpeed.SLOW;
			case SLOW:		return GameSpeed.NORMAL;
			case NORMAL:	return GameSpeed.FAST;
			case FAST:		return GameSpeed.FASTER;
			case FASTER:	return GameSpeed.FASTEST;
			default:
				return this;
		}
	}
	
	/**
	 * Returns the duration of a single frame in nanoseconds.
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
	 * Returns the ratio this game speed and the normal game speed.
	 *
	 * @return The ratio between speeds.
	 * @since 2017/02/12
	 */
	public double ratio()
	{
		return (double)this.msbetweenframes / _NORMAL_SPEED;
	}
	
	/**
	 * Returns the game speed which is slower than this one.
	 *
	 * @return The slower game speed.
	 * @since 2017/02/12
	 */
	public GameSpeed slower()
	{
		// Depends
		switch (this)
		{
			case SLOWER:	return SLOWEST;
			case SLOW:		return SLOWER;
			case NORMAL:	return SLOW;
			case FAST:		return NORMAL;
			case FASTER:	return FAST;
			case FASTEST:	return FASTER;
			default:
				return this;
		}
	}
}








|













|
|
|
|
|
|






101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
	 * Returns the ratio this game speed and the normal game speed.
	 *
	 * @return The ratio between speeds.
	 * @since 2017/02/12
	 */
	public double ratio()
	{
		return (double)this.msbetweenframes / GameSpeed._NORMAL_SPEED;
	}
	
	/**
	 * Returns the game speed which is slower than this one.
	 *
	 * @return The slower game speed.
	 * @since 2017/02/12
	 */
	public GameSpeed slower()
	{
		// Depends
		switch (this)
		{
			case SLOWER:	return GameSpeed.SLOWEST;
			case SLOW:		return GameSpeed.SLOWER;
			case NORMAL:	return GameSpeed.SLOW;
			case FAST:		return GameSpeed.NORMAL;
			case FASTER:	return GameSpeed.FAST;
			case FASTEST:	return GameSpeed.FASTER;
			default:
				return this;
		}
	}
}

Name change from runt/mids/squirrel-quarrel/net/multiphasicapps/squirrelquarrel/game/InitialSettings.java to modules/squirrel-quarrel/src/main/java/net/multiphasicapps/squirrelquarrel/game/InitialSettings.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.squirrelquarrel.game;

import net.multiphasicapps.squirrelquarrel.player.PlayerColor;
import net.multiphasicapps.squirrelquarrel.util.ReplayInputStream;
import net.multiphasicapps.squirrelquarrel.util.ReplayFormatException;
import net.multiphasicapps.squirrelquarrel.util.ReplayOutputStream;

/**
 * This contains the initial settings which is used to determine how to
 * generate and initialize the initial game.
 *
 * @since 2017/02/09













|
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.squirrelquarrel.game;

import net.multiphasicapps.squirrelquarrel.player.PlayerColor;
import net.multiphasicapps.squirrelquarrel.util.ReplayFormatException;
import net.multiphasicapps.squirrelquarrel.util.ReplayInputStream;
import net.multiphasicapps.squirrelquarrel.util.ReplayOutputStream;

/**
 * This contains the initial settings which is used to determine how to
 * generate and initialize the initial game.
 *
 * @since 2017/02/09

Name change from runt/mids/squirrel-quarrel/net/multiphasicapps/squirrelquarrel/game/InitialSettingsBuilder.java to modules/squirrel-quarrel/src/main/java/net/multiphasicapps/squirrelquarrel/game/InitialSettingsBuilder.java.

Name change from runt/mids/squirrel-quarrel/net/multiphasicapps/squirrelquarrel/game/ResumeMode.java to modules/squirrel-quarrel/src/main/java/net/multiphasicapps/squirrelquarrel/game/ResumeMode.java.

Name change from runt/mids/squirrel-quarrel/net/multiphasicapps/squirrelquarrel/game/package-info.java to modules/squirrel-quarrel/src/main/java/net/multiphasicapps/squirrelquarrel/game/package-info.java.

Name change from runt/mids/squirrel-quarrel/net/multiphasicapps/squirrelquarrel/lcdui/Automap.java to modules/squirrel-quarrel/src/main/java/net/multiphasicapps/squirrelquarrel/lcdui/Automap.java.

8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.squirrelquarrel.lcdui;

import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;
import net.multiphasicapps.squirrelquarrel.world.World;
import net.multiphasicapps.squirrelquarrel.player.Player;
import net.multiphasicapps.squirrelquarrel.ui.Viewport;

/**
 * This class is used to draw and update the automap which is used to give the
 * position of terrain and objects around the map. This class handles the
 * drawing aspects of it.
 *
 * @since 2017/02/12







|
|
<







8
9
10
11
12
13
14
15
16

17
18
19
20
21
22
23
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.squirrelquarrel.lcdui;

import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;
import net.multiphasicapps.squirrelquarrel.ui.Viewport;
import net.multiphasicapps.squirrelquarrel.world.World;


/**
 * This class is used to draw and update the automap which is used to give the
 * position of terrain and objects around the map. This class handles the
 * drawing aspects of it.
 *
 * @since 2017/02/12

Name change from runt/mids/squirrel-quarrel/net/multiphasicapps/squirrelquarrel/lcdui/ControllerEventSource.java to modules/squirrel-quarrel/src/main/java/net/multiphasicapps/squirrelquarrel/lcdui/ControllerEventSource.java.

Name change from runt/mids/squirrel-quarrel/net/multiphasicapps/squirrelquarrel/lcdui/GameInputHandler.java to modules/squirrel-quarrel/src/main/java/net/multiphasicapps/squirrelquarrel/lcdui/GameInputHandler.java.

28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
	
	/** Level panning speed. */
	private static final int _PANNING_SPEED =
		Tile.PIXEL_SIZE / 2;
	
	/** The game keys which are held down. */
	protected final boolean[] gamekeys =
		new boolean[GAME_ACTION_COUNT];
	
	/** Is on the automap dragging? */
	private volatile boolean _ondragmap;
	
	/** Disable automap drag. */
	private volatile boolean _nomapdrag;
	
	/**
	 * Initializes the input handler for the game.
	 *
	 * @since 2017/02/12
	 */
	public GameInputHandler()
	{
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/02/12
	 */
	@Override
	public void keyPressed(int __code, int __mods)
	{







|







<
<
<
<
<
<
<
<
<







28
29
30
31
32
33
34
35
36
37
38
39
40
41
42









43
44
45
46
47
48
49
	
	/** Level panning speed. */
	private static final int _PANNING_SPEED =
		Tile.PIXEL_SIZE / 2;
	
	/** The game keys which are held down. */
	protected final boolean[] gamekeys =
		new boolean[GameInputHandler.GAME_ACTION_COUNT];
	
	/** Is on the automap dragging? */
	private volatile boolean _ondragmap;
	
	/** Disable automap drag. */
	private volatile boolean _nomapdrag;
	









	/**
	 * {@inheritDoc}
	 * @since 2017/02/12
	 */
	@Override
	public void keyPressed(int __code, int __mods)
	{

Name change from runt/mids/squirrel-quarrel/net/multiphasicapps/squirrelquarrel/lcdui/GameInterface.java to modules/squirrel-quarrel/src/main/java/net/multiphasicapps/squirrelquarrel/lcdui/GameInterface.java.

8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.squirrelquarrel.lcdui;

import javax.microedition.lcdui.Canvas;
import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.KeyListener;
import net.multiphasicapps.squirrelquarrel.game.EventSource;
import net.multiphasicapps.squirrelquarrel.game.Game;
import net.multiphasicapps.squirrelquarrel.game.GameLooper;
import net.multiphasicapps.squirrelquarrel.ui.FrameSync;
import net.multiphasicapps.squirrelquarrel.ui.SplitScreen;

/**
 * This class provides an interface to the game, allowing for input to be
 * handled along with the game itself.







<

<







8
9
10
11
12
13
14

15

16
17
18
19
20
21
22
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.squirrelquarrel.lcdui;

import javax.microedition.lcdui.Canvas;
import javax.microedition.lcdui.Graphics;

import net.multiphasicapps.squirrelquarrel.game.EventSource;

import net.multiphasicapps.squirrelquarrel.game.GameLooper;
import net.multiphasicapps.squirrelquarrel.ui.FrameSync;
import net.multiphasicapps.squirrelquarrel.ui.SplitScreen;

/**
 * This class provides an interface to the game, allowing for input to be
 * handled along with the game itself.
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
	public GameInterface(GameLooper __g)
		throws NullPointerException
	{
		if (__g == null)
			throw new NullPointerException("NARG");
		
		// Setup details
		setTitle("Squirrel Quarrel");
		
		this.looper = __g;
		SplitScreen splitscreen;
		this.splitscreen = (splitscreen = new SplitScreen(__g));
		this.renderer = new Renderer(__g, splitscreen);
		
		// Setup basic controller events







|







49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
	public GameInterface(GameLooper __g)
		throws NullPointerException
	{
		if (__g == null)
			throw new NullPointerException("NARG");
		
		// Setup details
		this.setTitle("Squirrel Quarrel");
		
		this.looper = __g;
		SplitScreen splitscreen;
		this.splitscreen = (splitscreen = new SplitScreen(__g));
		this.renderer = new Renderer(__g, splitscreen);
		
		// Setup basic controller events

Name change from runt/mids/squirrel-quarrel/net/multiphasicapps/squirrelquarrel/lcdui/MainMidlet.java to modules/squirrel-quarrel/src/main/java/net/multiphasicapps/squirrelquarrel/lcdui/MainMidlet.java.

12
13
14
15
16
17
18
19
20
21
22
23
24
25
26

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import javax.microedition.lcdui.Display;
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;
import net.multiphasicapps.squirrelquarrel.game.Game;
import net.multiphasicapps.squirrelquarrel.game.GameLooper;
import net.multiphasicapps.squirrelquarrel.game.ResumeMode;

/**
 * This is the main midlet entry point for Squirrel Quarrel.
 *
 * @since 2017/02/08







<







12
13
14
15
16
17
18

19
20
21
22
23
24
25

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import javax.microedition.lcdui.Display;
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;

import net.multiphasicapps.squirrelquarrel.game.GameLooper;
import net.multiphasicapps.squirrelquarrel.game.ResumeMode;

/**
 * This is the main midlet entry point for Squirrel Quarrel.
 *
 * @since 2017/02/08

Name change from runt/mids/squirrel-quarrel/net/multiphasicapps/squirrelquarrel/lcdui/MegaTileCacher.java to modules/squirrel-quarrel/src/main/java/net/multiphasicapps/squirrelquarrel/lcdui/MegaTileCacher.java.

14
15
16
17
18
19
20
21
22
23
24

25
26
27
28
29
30
31
import java.io.IOException;
import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import java.util.HashMap;
import java.util.Map;
import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;
import net.multiphasicapps.squirrelquarrel.world.World;
import net.multiphasicapps.squirrelquarrel.world.MegaTile;
import net.multiphasicapps.squirrelquarrel.world.TerrainType;
import net.multiphasicapps.squirrelquarrel.world.Tile;


/**
 * This is used to cache mega tiles as single large images since drawing a
 * large image is faster than drawing many smaller images.
 *
 * @since 2017/02/11
 */







<



>







14
15
16
17
18
19
20

21
22
23
24
25
26
27
28
29
30
31
import java.io.IOException;
import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import java.util.HashMap;
import java.util.Map;
import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;

import net.multiphasicapps.squirrelquarrel.world.MegaTile;
import net.multiphasicapps.squirrelquarrel.world.TerrainType;
import net.multiphasicapps.squirrelquarrel.world.Tile;
import net.multiphasicapps.squirrelquarrel.world.World;

/**
 * This is used to cache mega tiles as single large images since drawing a
 * large image is faster than drawing many smaller images.
 *
 * @since 2017/02/11
 */
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
	 * @param __x The X coordinate in megatiles.
	 * @param __y The Y coordinate in megatiles.
	 * @return The cached image for the given mega tile.
	 * @since 2017/02/11
	 */
	public Image cacheMegaTile(int __x, int __y)
	{
		return cacheMegaTile(this.world.megaTile(__x, __y));
	}
	
	/**
	 * Caches the image for the given megatile.
	 *
	 * @param __mt The mega tile to cache.
	 * @return The cached image for the given mega tile.







|







66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
	 * @param __x The X coordinate in megatiles.
	 * @param __y The Y coordinate in megatiles.
	 * @return The cached image for the given mega tile.
	 * @since 2017/02/11
	 */
	public Image cacheMegaTile(int __x, int __y)
	{
		return this.cacheMegaTile(this.world.megaTile(__x, __y));
	}
	
	/**
	 * Caches the image for the given megatile.
	 *
	 * @param __mt The mega tile to cache.
	 * @return The cached image for the given mega tile.
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
					// If the terrain type is the same then use the existing
					// image of it rather than checking the cache every
					// single time
					TerrainType type = __mt.subTileTerrain(tx, ty);
					if (type != oldtype)
					{
						oldtype = type;
						tilepic = __cacheTile(type);
					}
					
					// Draw it
					g.drawImage(tilepic, dx, dy, 0);
				}
			
			// Cache







|







115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
					// If the terrain type is the same then use the existing
					// image of it rather than checking the cache every
					// single time
					TerrainType type = __mt.subTileTerrain(tx, ty);
					if (type != oldtype)
					{
						oldtype = type;
						tilepic = MegaTileCacher.__cacheTile(type);
					}
					
					// Draw it
					g.drawImage(tilepic, dx, dy, 0);
				}
			
			// Cache
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
		throws NullPointerException
	{
		// Check
		if (__t == null)
			throw new NullPointerException("NARG");
		
		// Get ref
		Reference<Image> ref = _TILE_CACHE.get(__t);
		Image rv;
		
		// Cache?
		if (ref == null || null == (rv = ref.get()))
			try
			{
				_TILE_CACHE.put(__t, new WeakReference<>(
					(rv = new XPMReader(__t.imageStream()).parse())));
			}
			
			// {@squirreljme.error BE03 Failed to read the image data for the
			// specified file. (The terrain type)}
			catch (IOException e)
			{







|






|







145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
		throws NullPointerException
	{
		// Check
		if (__t == null)
			throw new NullPointerException("NARG");
		
		// Get ref
		Reference<Image> ref = MegaTileCacher._TILE_CACHE.get(__t);
		Image rv;
		
		// Cache?
		if (ref == null || null == (rv = ref.get()))
			try
			{
				MegaTileCacher._TILE_CACHE.put(__t, new WeakReference<>(
					(rv = new XPMReader(__t.imageStream()).parse())));
			}
			
			// {@squirreljme.error BE03 Failed to read the image data for the
			// specified file. (The terrain type)}
			catch (IOException e)
			{

Name change from runt/mids/squirrel-quarrel/net/multiphasicapps/squirrelquarrel/lcdui/Renderer.java to modules/squirrel-quarrel/src/main/java/net/multiphasicapps/squirrelquarrel/lcdui/Renderer.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.squirrelquarrel.lcdui;

import java.util.ArrayList;
import java.util.List;
import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;
import net.multiphasicapps.squirrelquarrel.game.Game;
import net.multiphasicapps.squirrelquarrel.game.GameLooper;
import net.multiphasicapps.squirrelquarrel.player.Player;
import net.multiphasicapps.squirrelquarrel.player.PlayerColor;
import net.multiphasicapps.squirrelquarrel.ui.FrameSync;
import net.multiphasicapps.squirrelquarrel.ui.GameScreen;
import net.multiphasicapps.squirrelquarrel.ui.SplitScreen;
import net.multiphasicapps.squirrelquarrel.units.UnitReference;
import net.multiphasicapps.squirrelquarrel.world.MegaTile;

/**
 * This contains the renderer for the level and performs the actual drawing
 * of the game to the canvas.
 *
 * @since 2018/03/18












<
<

<
<



<


<







1
2
3
4
5
6
7
8
9
10
11
12


13


14
15
16

17
18

19
20
21
22
23
24
25
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.squirrelquarrel.lcdui;



import javax.microedition.lcdui.Graphics;


import net.multiphasicapps.squirrelquarrel.game.GameLooper;
import net.multiphasicapps.squirrelquarrel.player.Player;
import net.multiphasicapps.squirrelquarrel.player.PlayerColor;

import net.multiphasicapps.squirrelquarrel.ui.GameScreen;
import net.multiphasicapps.squirrelquarrel.ui.SplitScreen;

import net.multiphasicapps.squirrelquarrel.world.MegaTile;

/**
 * This contains the renderer for the level and performs the actual drawing
 * of the game to the canvas.
 *
 * @since 2018/03/18
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
		this.looper = __g;
		this.splitscreen = __ss;
	}
	
	/**
	 * Paints the game to the given graphics.
	 *
	 * @param __src The screen to draw for.
	 * @param __g The graphics to draw on.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/02/08
	 */
	public void paint(GameScreen __scr, Graphics __g)
		throws NullPointerException
	{







|







49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
		this.looper = __g;
		this.splitscreen = __ss;
	}
	
	/**
	 * Paints the game to the given graphics.
	 *
	 * @param __scr The screen to draw for.
	 * @param __g The graphics to draw on.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/02/08
	 */
	public void paint(GameScreen __scr, Graphics __g)
		throws NullPointerException
	{

Name change from runt/mids/squirrel-quarrel/net/multiphasicapps/squirrelquarrel/lcdui/package-info.java to modules/squirrel-quarrel/src/main/java/net/multiphasicapps/squirrelquarrel/lcdui/package-info.java.

Name change from runt/mids/squirrel-quarrel/net/multiphasicapps/squirrelquarrel/package-info.java to modules/squirrel-quarrel/src/main/java/net/multiphasicapps/squirrelquarrel/package-info.java.

Name change from runt/mids/squirrel-quarrel/net/multiphasicapps/squirrelquarrel/player/Player.java to modules/squirrel-quarrel/src/main/java/net/multiphasicapps/squirrelquarrel/player/Player.java.

Name change from runt/mids/squirrel-quarrel/net/multiphasicapps/squirrelquarrel/player/PlayerColor.java to modules/squirrel-quarrel/src/main/java/net/multiphasicapps/squirrelquarrel/player/PlayerColor.java.

74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
	 * Initializes the color code.
	 *
	 * @param __name The name of the color.
	 * @param __rgb The RGB used for the player color.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/02/10
	 */
	private PlayerColor(String __name, int __rgb)
		throws NullPointerException
	{
		// Check
		if (__name == null)
			throw new NullPointerException("NARG");
		
		// Set







|







74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
	 * Initializes the color code.
	 *
	 * @param __name The name of the color.
	 * @param __rgb The RGB used for the player color.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/02/10
	 */
	PlayerColor(String __name, int __rgb)
		throws NullPointerException
	{
		// Check
		if (__name == null)
			throw new NullPointerException("NARG");
		
		// Set
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
	 */
	public static final PlayerColor of(int __i)
	{
		// Depends
		switch (__i)
		{
				// Normal colors;
			case 0: return RED;
			case 1: return YELLOW;
			case 2: return GREEN;
			case 3: return BLUE;
			case 4: return PURPLE;
			case 5: return GRAY;
			
				// {@squirreljme.error BE04 Player index out of range. (The
				// player index)}
			default:
				throw new IllegalArgumentException(String.format("BE04 %d",
					__i));
		}
	}
}








|
|
|
|
|
|










151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
	 */
	public static final PlayerColor of(int __i)
	{
		// Depends
		switch (__i)
		{
				// Normal colors;
			case 0: return PlayerColor.RED;
			case 1: return PlayerColor.YELLOW;
			case 2: return PlayerColor.GREEN;
			case 3: return PlayerColor.BLUE;
			case 4: return PlayerColor.PURPLE;
			case 5: return PlayerColor.GRAY;
			
				// {@squirreljme.error BE04 Player index out of range. (The
				// player index)}
			default:
				throw new IllegalArgumentException(String.format("BE04 %d",
					__i));
		}
	}
}

Name change from runt/mids/squirrel-quarrel/net/multiphasicapps/squirrelquarrel/player/Players.java to modules/squirrel-quarrel/src/main/java/net/multiphasicapps/squirrelquarrel/player/Players.java.

Name change from runt/mids/squirrel-quarrel/net/multiphasicapps/squirrelquarrel/player/Species.java to modules/squirrel-quarrel/src/main/java/net/multiphasicapps/squirrelquarrel/player/Species.java.

Name change from runt/mids/squirrel-quarrel/net/multiphasicapps/squirrelquarrel/player/package-info.java to modules/squirrel-quarrel/src/main/java/net/multiphasicapps/squirrelquarrel/player/package-info.java.

Name change from runt/mids/squirrel-quarrel/net/multiphasicapps/squirrelquarrel/ui/FrameSync.java to modules/squirrel-quarrel/src/main/java/net/multiphasicapps/squirrelquarrel/ui/FrameSync.java.

21
22
23
24
25
26
27
28
29
30
	/**
	 * This is called when the game has finished running the game logic
	 * and is requesting that the game be repainted accordingly.
	 *
	 * @param __framenum The frame which has just finished.
	 * @since 2018/03/19
	 */
	public abstract void frameRepaintRequest(int __framenum);
}








|


21
22
23
24
25
26
27
28
29
30
	/**
	 * This is called when the game has finished running the game logic
	 * and is requesting that the game be repainted accordingly.
	 *
	 * @param __framenum The frame which has just finished.
	 * @since 2018/03/19
	 */
	void frameRepaintRequest(int __framenum);
}

Name change from runt/mids/squirrel-quarrel/net/multiphasicapps/squirrelquarrel/ui/GameScreen.java to modules/squirrel-quarrel/src/main/java/net/multiphasicapps/squirrelquarrel/ui/GameScreen.java.

Name change from runt/mids/squirrel-quarrel/net/multiphasicapps/squirrelquarrel/ui/SplitScreen.java to modules/squirrel-quarrel/src/main/java/net/multiphasicapps/squirrelquarrel/ui/SplitScreen.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.squirrelquarrel.ui;

import net.multiphasicapps.squirrelquarrel.game.Game;
import net.multiphasicapps.squirrelquarrel.game.GameLooper;
import net.multiphasicapps.squirrelquarrel.player.Player;
import net.multiphasicapps.squirrelquarrel.player.PlayerColor;
import net.multiphasicapps.squirrelquarrel.player.Players;

/**
 * This class is used to manage multiple screen spaces so that multiple players












<







1
2
3
4
5
6
7
8
9
10
11
12

13
14
15
16
17
18
19
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.squirrelquarrel.ui;


import net.multiphasicapps.squirrelquarrel.game.GameLooper;
import net.multiphasicapps.squirrelquarrel.player.Player;
import net.multiphasicapps.squirrelquarrel.player.PlayerColor;
import net.multiphasicapps.squirrelquarrel.player.Players;

/**
 * This class is used to manage multiple screen spaces so that multiple players

Name change from runt/mids/squirrel-quarrel/net/multiphasicapps/squirrelquarrel/ui/Viewport.java to modules/squirrel-quarrel/src/main/java/net/multiphasicapps/squirrelquarrel/ui/Viewport.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.squirrelquarrel.ui;

import net.multiphasicapps.squirrelquarrel.world.MegaTile;
import net.multiphasicapps.squirrelquarrel.world.Tile;

/**
 * This represents a viewport into the level, it does not contain any
 * rendering information.
 *
 * @since 2018/03/18
 */













<







1
2
3
4
5
6
7
8
9
10
11
12
13

14
15
16
17
18
19
20
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.squirrelquarrel.ui;

import net.multiphasicapps.squirrelquarrel.world.MegaTile;


/**
 * This represents a viewport into the level, it does not contain any
 * rendering information.
 *
 * @since 2018/03/18
 */
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
	{
		return __x - this._viewx;
	}
	
	/**
	 * Converts a map Y coordinate to a screen Y coordinate.
	 *
	 * @param __x The input Y coordinate.
	 * @return The output y coordinate.
	 * @since 2017/02/12
	 */
	public int mapToScreenY(int __y)
	{
		return __y - this._viewy;
	}







|







84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
	{
		return __x - this._viewx;
	}
	
	/**
	 * Converts a map Y coordinate to a screen Y coordinate.
	 *
	 * @param __y The input Y coordinate.
	 * @return The output y coordinate.
	 * @since 2017/02/12
	 */
	public int mapToScreenY(int __y)
	{
		return __y - this._viewy;
	}
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
	{
		return this._viewx + __x;
	}
	
	/**
	 * Converts a screen Y coordinate to a map Y coordinate.
	 *
	 * @param __x The input Y coordinate.
	 * @return The output y coordinate.
	 * @since 2017/02/12
	 */
	public int screenToMapY(int __y)
	{
		return this._viewy + __y;
	}







|







162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
	{
		return this._viewx + __x;
	}
	
	/**
	 * Converts a screen Y coordinate to a map Y coordinate.
	 *
	 * @param __y The input Y coordinate.
	 * @return The output y coordinate.
	 * @since 2017/02/12
	 */
	public int screenToMapY(int __y)
	{
		return this._viewy + __y;
	}

Name change from runt/mids/squirrel-quarrel/net/multiphasicapps/squirrelquarrel/ui/package-info.java to modules/squirrel-quarrel/src/main/java/net/multiphasicapps/squirrelquarrel/ui/package-info.java.

Name change from runt/mids/squirrel-quarrel/net/multiphasicapps/squirrelquarrel/units/AbilityType.java to modules/squirrel-quarrel/src/main/java/net/multiphasicapps/squirrelquarrel/units/AbilityType.java.

Name change from runt/mids/squirrel-quarrel/net/multiphasicapps/squirrelquarrel/units/BaseUnitInfo.java to modules/squirrel-quarrel/src/main/java/net/multiphasicapps/squirrelquarrel/units/BaseUnitInfo.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.squirrelquarrel.units;

import java.io.InputStream;
import java.io.IOException;
import java.util.Objects;
import net.multiphasicapps.squirrelquarrel.util.ConstantFixedPoint;
import net.multiphasicapps.squirrelquarrel.util.Dimension;
import net.multiphasicapps.squirrelquarrel.util.FixedPoint;
import net.multiphasicapps.squirrelquarrel.util.Point;
import net.multiphasicapps.squirrelquarrel.util.Rectangle;
import net.multiphasicapps.squirrelquarrel.world.MegaTile;
import net.multiphasicapps.squirrelquarrel.world.Tile;
import net.multiphasicapps.tool.manifest.JavaManifest;
import net.multiphasicapps.tool.manifest.JavaManifestAttributes;

/**
 * This contains the base information about a unit which is fixed and never
 * changes.












<
<
<


<

<
<







1
2
3
4
5
6
7
8
9
10
11
12



13
14

15


16
17
18
19
20
21
22
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.squirrelquarrel.units;




import net.multiphasicapps.squirrelquarrel.util.ConstantFixedPoint;
import net.multiphasicapps.squirrelquarrel.util.Dimension;

import net.multiphasicapps.squirrelquarrel.util.Point;


import net.multiphasicapps.squirrelquarrel.world.Tile;
import net.multiphasicapps.tool.manifest.JavaManifest;
import net.multiphasicapps.tool.manifest.JavaManifestAttributes;

/**
 * This contains the base information about a unit which is fixed and never
 * changes.

Name change from runt/mids/squirrel-quarrel/net/multiphasicapps/squirrelquarrel/units/ModifiedUnitInfo.java to modules/squirrel-quarrel/src/main/java/net/multiphasicapps/squirrelquarrel/units/ModifiedUnitInfo.java.

Name change from runt/mids/squirrel-quarrel/net/multiphasicapps/squirrelquarrel/units/SpawnPlacementType.java to modules/squirrel-quarrel/src/main/java/net/multiphasicapps/squirrelquarrel/units/SpawnPlacementType.java.

Name change from runt/mids/squirrel-quarrel/net/multiphasicapps/squirrelquarrel/units/Unit.java to modules/squirrel-quarrel/src/main/java/net/multiphasicapps/squirrelquarrel/units/Unit.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.squirrelquarrel.units;

import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.List;

/**
 * This represents and holds information for a single unit in the game.
 *
 * @since 2017/02/14
 */
public final class Unit













<
<
<







1
2
3
4
5
6
7
8
9
10
11
12
13



14
15
16
17
18
19
20
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.squirrelquarrel.units;

import java.lang.ref.Reference;




/**
 * This represents and holds information for a single unit in the game.
 *
 * @since 2017/02/14
 */
public final class Unit

Name change from runt/mids/squirrel-quarrel/net/multiphasicapps/squirrelquarrel/units/UnitDeletedException.java to modules/squirrel-quarrel/src/main/java/net/multiphasicapps/squirrelquarrel/units/UnitDeletedException.java.

Name change from runt/mids/squirrel-quarrel/net/multiphasicapps/squirrelquarrel/units/UnitLinker.java to modules/squirrel-quarrel/src/main/java/net/multiphasicapps/squirrelquarrel/units/UnitLinker.java.

Name change from runt/mids/squirrel-quarrel/net/multiphasicapps/squirrelquarrel/units/UnitReference.java to modules/squirrel-quarrel/src/main/java/net/multiphasicapps/squirrelquarrel/units/UnitReference.java.

Name change from runt/mids/squirrel-quarrel/net/multiphasicapps/squirrelquarrel/units/UnitSize.java to modules/squirrel-quarrel/src/main/java/net/multiphasicapps/squirrelquarrel/units/UnitSize.java.

Name change from runt/mids/squirrel-quarrel/net/multiphasicapps/squirrelquarrel/units/UnitType.java to modules/squirrel-quarrel/src/main/java/net/multiphasicapps/squirrelquarrel/units/UnitType.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.squirrelquarrel.units;

import java.io.InputStream;
import java.io.IOException;
import net.multiphasicapps.tool.manifest.JavaManifest;

/**
 * These are the units which are available in the game and what are actively
 * used within the game.
 *
 * @since 2017/02/14












|
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.squirrelquarrel.units;

import java.io.IOException;
import java.io.InputStream;
import net.multiphasicapps.tool.manifest.JavaManifest;

/**
 * These are the units which are available in the game and what are actively
 * used within the game.
 *
 * @since 2017/02/14

Name change from runt/mids/squirrel-quarrel/net/multiphasicapps/squirrelquarrel/units/Units.java to modules/squirrel-quarrel/src/main/java/net/multiphasicapps/squirrelquarrel/units/Units.java.

Name change from runt/mids/squirrel-quarrel/net/multiphasicapps/squirrelquarrel/units/package-info.java to modules/squirrel-quarrel/src/main/java/net/multiphasicapps/squirrelquarrel/units/package-info.java.

Name change from runt/mids/squirrel-quarrel/net/multiphasicapps/squirrelquarrel/util/ConstantFixedPoint.java to modules/squirrel-quarrel/src/main/java/net/multiphasicapps/squirrelquarrel/util/ConstantFixedPoint.java.

33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
	 * Initializes the fixed point value with the given whole number.
	 *
	 * @param __whole The whole number, only the lowest 16-bits are used.
	 * @since 2018/03/18
	 */
	public ConstantFixedPoint(int __whole)
	{
		this._value = __whole << SHIFT;
	}
	
	/**
	 * Initializes the fixed point value with the given whole number and
	 * fraction.
	 *
	 * @param __whole The whole number, only the lowest 16-bits are used.
	 * @param __frac The fraction, only the lowest 16-bits are used.
	 * @since 2018/03/18
	 */
	public ConstantFixedPoint(int __whole, int __frac)
	{
		this._value = (__whole << SHIFT) | (__frac & MASK);
	}
	
	/**
	 * Initializes the fixed point value with the given fixed point value.
	 *
	 * @param __fp The fixed point number to copy.
	 * @throws NullPointerException On null arguments.







|












|







33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
	 * Initializes the fixed point value with the given whole number.
	 *
	 * @param __whole The whole number, only the lowest 16-bits are used.
	 * @since 2018/03/18
	 */
	public ConstantFixedPoint(int __whole)
	{
		this._value = __whole << ConstantFixedPoint.SHIFT;
	}
	
	/**
	 * Initializes the fixed point value with the given whole number and
	 * fraction.
	 *
	 * @param __whole The whole number, only the lowest 16-bits are used.
	 * @param __frac The fraction, only the lowest 16-bits are used.
	 * @since 2018/03/18
	 */
	public ConstantFixedPoint(int __whole, int __frac)
	{
		this._value = (__whole << ConstantFixedPoint.SHIFT) | (__frac & ConstantFixedPoint.MASK);
	}
	
	/**
	 * Initializes the fixed point value with the given fixed point value.
	 *
	 * @param __fp The fixed point number to copy.
	 * @throws NullPointerException On null arguments.
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
			throw new NullPointerException("NARG");
		
		int value;
		
		// Is a whole number
		int dot = __s.indexOf('.');
		if (dot < 0)
			value = Integer.parseInt(__s, 10) << SHIFT;
		
		// Is fractional value
		else
			throw new todo.TODO();
		
		this._value = value;
	}







|







84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
			throw new NullPointerException("NARG");
		
		int value;
		
		// Is a whole number
		int dot = __s.indexOf('.');
		if (dot < 0)
			value = Integer.parseInt(__s, 10) << ConstantFixedPoint.SHIFT;
		
		// Is fractional value
		else
			throw new todo.TODO();
		
		this._value = value;
	}

Name change from runt/mids/squirrel-quarrel/net/multiphasicapps/squirrelquarrel/util/Dimension.java to modules/squirrel-quarrel/src/main/java/net/multiphasicapps/squirrelquarrel/util/Dimension.java.

Name change from runt/mids/squirrel-quarrel/net/multiphasicapps/squirrelquarrel/util/FixedPoint.java to modules/squirrel-quarrel/src/main/java/net/multiphasicapps/squirrelquarrel/util/FixedPoint.java.

20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
{
	/**
	 * Returns the fraction part.
	 *
	 * @return The fraction part.
	 * @since 2018/03/18
	 */
	public abstract int fraction();
	
	/**
	 * Returns the whole number part.
	 *
	 * @return The whole number part.
	 * @since 2018/03/18
	 */
	public abstract int whole();
}








|







|


20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
{
	/**
	 * Returns the fraction part.
	 *
	 * @return The fraction part.
	 * @since 2018/03/18
	 */
	int fraction();
	
	/**
	 * Returns the whole number part.
	 *
	 * @return The whole number part.
	 * @since 2018/03/18
	 */
	int whole();
}

Name change from runt/mids/squirrel-quarrel/net/multiphasicapps/squirrelquarrel/util/GameRandom.java to modules/squirrel-quarrel/src/main/java/net/multiphasicapps/squirrelquarrel/util/GameRandom.java.

30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
	 * Initializes the random number generator with the given seed.
	 *
	 * @param __s The seed to use.
	 * @since 2017/02/10
	 */
	public GameRandom(long __s)
	{
		setSeed(__s);
	}
	
	/**
	 * Returns the current raw seed value.
	 *
	 * @return The current raw seed value.
	 * @since 2017/02/10







|







30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
	 * Initializes the random number generator with the given seed.
	 *
	 * @param __s The seed to use.
	 * @since 2017/02/10
	 */
	public GameRandom(long __s)
	{
		this.setSeed(__s);
	}
	
	/**
	 * Returns the current raw seed value.
	 *
	 * @return The current raw seed value.
	 * @since 2017/02/10

Name change from runt/mids/squirrel-quarrel/net/multiphasicapps/squirrelquarrel/util/MutableFixedPoint.java to modules/squirrel-quarrel/src/main/java/net/multiphasicapps/squirrelquarrel/util/MutableFixedPoint.java.

Name change from runt/mids/squirrel-quarrel/net/multiphasicapps/squirrelquarrel/util/Point.java to modules/squirrel-quarrel/src/main/java/net/multiphasicapps/squirrelquarrel/util/Point.java.

Name change from runt/mids/squirrel-quarrel/net/multiphasicapps/squirrelquarrel/util/Rectangle.java to modules/squirrel-quarrel/src/main/java/net/multiphasicapps/squirrelquarrel/util/Rectangle.java.

Name change from runt/mids/squirrel-quarrel/net/multiphasicapps/squirrelquarrel/util/ReplayEventSource.java to modules/squirrel-quarrel/src/main/java/net/multiphasicapps/squirrelquarrel/util/ReplayEventSource.java.

Name change from runt/mids/squirrel-quarrel/net/multiphasicapps/squirrelquarrel/util/ReplayFormatException.java to modules/squirrel-quarrel/src/main/java/net/multiphasicapps/squirrelquarrel/util/ReplayFormatException.java.

Name change from runt/mids/squirrel-quarrel/net/multiphasicapps/squirrelquarrel/util/ReplayIOException.java to modules/squirrel-quarrel/src/main/java/net/multiphasicapps/squirrelquarrel/util/ReplayIOException.java.

Name change from runt/mids/squirrel-quarrel/net/multiphasicapps/squirrelquarrel/util/ReplayInputStream.java to modules/squirrel-quarrel/src/main/java/net/multiphasicapps/squirrelquarrel/util/ReplayInputStream.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.squirrelquarrel.util;

import java.io.DataInputStream;
import java.io.InputStream;
import java.io.IOException;

/**
 * This allows for easier reading from the replay input without requiring that
 * {@link IOException} be caught each time.
 *
 * @since 2018/03/19
 */













|
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.squirrelquarrel.util;

import java.io.DataInputStream;
import java.io.IOException;
import java.io.InputStream;

/**
 * This allows for easier reading from the replay input without requiring that
 * {@link IOException} be caught each time.
 *
 * @since 2018/03/19
 */

Name change from runt/mids/squirrel-quarrel/net/multiphasicapps/squirrelquarrel/util/ReplayOutputStream.java to modules/squirrel-quarrel/src/main/java/net/multiphasicapps/squirrelquarrel/util/ReplayOutputStream.java.

Name change from runt/mids/squirrel-quarrel/net/multiphasicapps/squirrelquarrel/util/package-info.java to modules/squirrel-quarrel/src/main/java/net/multiphasicapps/squirrelquarrel/util/package-info.java.

Name change from runt/mids/squirrel-quarrel/net/multiphasicapps/squirrelquarrel/world/MegaTile.java to modules/squirrel-quarrel/src/main/java/net/multiphasicapps/squirrelquarrel/world/MegaTile.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.squirrelquarrel.world;

import java.io.DataInputStream;
import java.io.InputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.ConcurrentModificationException;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;

/**
 * This represents a single mega tile which represents a small region in the
 * level.
 *
 * @since 2017/02/09
 */
public class MegaTile












<
<
<
<
<
<
<
<
<
<







1
2
3
4
5
6
7
8
9
10
11
12










13
14
15
16
17
18
19
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.squirrelquarrel.world;











/**
 * This represents a single mega tile which represents a small region in the
 * level.
 *
 * @since 2017/02/09
 */
public class MegaTile
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83

84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
	public final int megay;
	
	/** Mega tile ordinal. */
	public final int megaordinal;
	
	/** Terrain information. */
	private final byte[] _terrain =
		new byte[TILES_IN_MEGA_TILE];
	
	/**
	 * This contains the first cycle for the fog of war. The fog of war acts
	 * in two cycles, so that previously revealed areas go away and new ones
	 * are set. This means that the fog of war does not need to be cleared
	 * every frame by units, only set. The fog is in two cycles because on a
	 * new cycle this array is cleared, and it would be possible for a unit to
	 * be blind while its logic is handled. Also fog of war updates do not need
	 * to be that instant.
	 */
	private final byte[] _fogcyclea =
		new byte[TILES_IN_MEGA_TILE];
	
	/** Fog of war second cycle. */
	private final byte[] _fogcycleb =
		new byte[TILES_IN_MEGA_TILE];
	
	/**
	 * Initializes a basic megatile.
	 *
	 * @param __x Megatile X position.
	 * @param __y Megatile Y position.

	 * @since 2017/02/10
	 */
	public MegaTile(int __mx, int __my, int __mi)
	{
		// Set
		this.megax = __mx;
		this.megay = __my;
		this.megaordinal = __mi;
		this.index = new MegaTileIndex(__mx, __my, __mi);
		
		// Initialize it with some pattern
		byte[] terrain = this._terrain;
		for (int y = 0; y < TILES_PER_MEGA_TILE; y++)
			for (int x = 0; x < TILES_PER_MEGA_TILE; x++)
				terrain[(y * TILES_PER_MEGA_TILE) + x] =
					(byte)(((x + y) / 2) & 1);
	}
	
	/**
	 * Gets the terrain for the given sub-tile.
	 *
	 * @param __x The tile X position.
	 * @param __y The tile Y position.
	 * @return The terrain type for the given tile.
	 * @throws IndexOutOfBoundsException If the position is not in the megatile
	 * bounds.
	 * @since 2017/02/11
	 */
	public TerrainType subTileTerrain(int __x, int __y)
		throws IndexOutOfBoundsException
	{
		// {@squirreljme.error BE0o Cannot get terrain because the tile is
		// out of range.}
		if (__x < 0 || __y < 0 || __x >= TILES_PER_MEGA_TILE ||
			__y >= TILES_PER_MEGA_TILE)
			throw new IndexOutOfBoundsException("BE0o");
		
		// Depends
		return TerrainType.of(
			this._terrain[(__y * TILES_PER_MEGA_TILE) + __x]);
	}
	
	/**
	 * Return the megatile X position.
	 *
	 * @return The X position of the megatile.
	 * @since 2017/02/17







|











|



|




|
|
>












|
|
|


















|
|




|







44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
	public final int megay;
	
	/** Mega tile ordinal. */
	public final int megaordinal;
	
	/** Terrain information. */
	private final byte[] _terrain =
		new byte[MegaTile.TILES_IN_MEGA_TILE];
	
	/**
	 * This contains the first cycle for the fog of war. The fog of war acts
	 * in two cycles, so that previously revealed areas go away and new ones
	 * are set. This means that the fog of war does not need to be cleared
	 * every frame by units, only set. The fog is in two cycles because on a
	 * new cycle this array is cleared, and it would be possible for a unit to
	 * be blind while its logic is handled. Also fog of war updates do not need
	 * to be that instant.
	 */
	private final byte[] _fogcyclea =
		new byte[MegaTile.TILES_IN_MEGA_TILE];
	
	/** Fog of war second cycle. */
	private final byte[] _fogcycleb =
		new byte[MegaTile.TILES_IN_MEGA_TILE];
	
	/**
	 * Initializes a basic megatile.
	 *
	 * @param __mx Megatile X position.
	 * @param __my Megatile Y position.
	 * @param __mi The index.
	 * @since 2017/02/10
	 */
	public MegaTile(int __mx, int __my, int __mi)
	{
		// Set
		this.megax = __mx;
		this.megay = __my;
		this.megaordinal = __mi;
		this.index = new MegaTileIndex(__mx, __my, __mi);
		
		// Initialize it with some pattern
		byte[] terrain = this._terrain;
		for (int y = 0; y < MegaTile.TILES_PER_MEGA_TILE; y++)
			for (int x = 0; x < MegaTile.TILES_PER_MEGA_TILE; x++)
				terrain[(y * MegaTile.TILES_PER_MEGA_TILE) + x] =
					(byte)(((x + y) / 2) & 1);
	}
	
	/**
	 * Gets the terrain for the given sub-tile.
	 *
	 * @param __x The tile X position.
	 * @param __y The tile Y position.
	 * @return The terrain type for the given tile.
	 * @throws IndexOutOfBoundsException If the position is not in the megatile
	 * bounds.
	 * @since 2017/02/11
	 */
	public TerrainType subTileTerrain(int __x, int __y)
		throws IndexOutOfBoundsException
	{
		// {@squirreljme.error BE0o Cannot get terrain because the tile is
		// out of range.}
		if (__x < 0 || __y < 0 || __x >= MegaTile.TILES_PER_MEGA_TILE ||
			__y >= MegaTile.TILES_PER_MEGA_TILE)
			throw new IndexOutOfBoundsException("BE0o");
		
		// Depends
		return TerrainType.of(
			this._terrain[(__y * MegaTile.TILES_PER_MEGA_TILE) + __x]);
	}
	
	/**
	 * Return the megatile X position.
	 *
	 * @return The X position of the megatile.
	 * @since 2017/02/17
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
	 *
	 * @param __frame The current frame.
	 * @since 2017/02/14
	 */
	public void run(int __frame)
	{
		// Cycle the fog of war?
		if ((__frame & _FOG_OF_WAR_CYCLE_MASK) == 0)
			__cycleFog();
	}
	
	/**
	 * This cycles the fog of war.
	 *
	 * @since 2017/02/14
	 */
	void __cycleFog()
	{
		// Transfer all fog state from the first cycle to the second
		byte[] fogcyclea = this._fogcyclea;
		byte[] fogcycleb = this._fogcyclea;
		for (int i = 0, n = TILES_IN_MEGA_TILE; i < n; i++)
		{
			// Set the second cycle to the first
			fogcycleb[i] = fogcyclea[i];
			
			// Clear the first
			fogcyclea[i] = 0;
		}
	}
}








|
|












|










141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
	 *
	 * @param __frame The current frame.
	 * @since 2017/02/14
	 */
	public void run(int __frame)
	{
		// Cycle the fog of war?
		if ((__frame & MegaTile._FOG_OF_WAR_CYCLE_MASK) == 0)
			this.__cycleFog();
	}
	
	/**
	 * This cycles the fog of war.
	 *
	 * @since 2017/02/14
	 */
	void __cycleFog()
	{
		// Transfer all fog state from the first cycle to the second
		byte[] fogcyclea = this._fogcyclea;
		byte[] fogcycleb = this._fogcyclea;
		for (int i = 0, n = MegaTile.TILES_IN_MEGA_TILE; i < n; i++)
		{
			// Set the second cycle to the first
			fogcycleb[i] = fogcyclea[i];
			
			// Clear the first
			fogcyclea[i] = 0;
		}
	}
}

Name change from runt/mids/squirrel-quarrel/net/multiphasicapps/squirrelquarrel/world/MegaTileIndex.java to modules/squirrel-quarrel/src/main/java/net/multiphasicapps/squirrelquarrel/world/MegaTileIndex.java.

Name change from runt/mids/squirrel-quarrel/net/multiphasicapps/squirrelquarrel/world/TerrainType.java to modules/squirrel-quarrel/src/main/java/net/multiphasicapps/squirrelquarrel/world/TerrainType.java.

25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
	/** Dirt. */
	DIRT(0x6E370B),
	
	/** End. */
	;
	
	/** Cache of terrain types. */
	private static final TerrainType[] _VALUES =
		values();
	
	/** The terrain color. */
	protected final int color;
	
	/**
	 * Initializes the terrain type.
	 *
	 * @param __color The color used for this terrain.
	 * @since 2017/09/13
	 */
	private TerrainType(int __color)
	{
		// Set
		this.color = __color;
	}
	
	/**
	 * Returns the color used for the terrain.







|
<










|







25
26
27
28
29
30
31
32

33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
	/** Dirt. */
	DIRT(0x6E370B),
	
	/** End. */
	;
	
	/** Cache of terrain types. */
	private static final TerrainType[] _VALUES = TerrainType.values();

	
	/** The terrain color. */
	protected final int color;
	
	/**
	 * Initializes the terrain type.
	 *
	 * @param __color The color used for this terrain.
	 * @since 2017/09/13
	 */
	TerrainType(int __color)
	{
		// Set
		this.color = __color;
	}
	
	/**
	 * Returns the color used for the terrain.
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
	 */
	public InputStream imageStream()
		throws RuntimeException
	{
		// {@squirreljme.error BE0p Could not get the tile image for the
		// given terrain. (The terrain type)}
		InputStream rv = TerrainType.class.getResourceAsStream(
			"images/terrain/" + __lower(name()) + ".xpm");
		if (rv == null)
			throw new RuntimeException(String.format("BE0p %s", this));
		return rv;
	}
	
	/**
	 * Returns the terrain type of the given ID.
	 *
	 * @param __i The ID of the terrain to return.
	 * @return The terrain type at this position.
	 * @since 2017/02/13
	 */
	public static TerrainType of(int __i)
	{
		return _VALUES[__i];
	}
	
	/**
	 * Lowercases the specified string.
	 *
	 * @param __s The string to lowercase.
	 * @return The lowercased string.







|














|







66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
	 */
	public InputStream imageStream()
		throws RuntimeException
	{
		// {@squirreljme.error BE0p Could not get the tile image for the
		// given terrain. (The terrain type)}
		InputStream rv = TerrainType.class.getResourceAsStream(
			"images/terrain/" + TerrainType.__lower(this.name()) + ".xpm");
		if (rv == null)
			throw new RuntimeException(String.format("BE0p %s", this));
		return rv;
	}
	
	/**
	 * Returns the terrain type of the given ID.
	 *
	 * @param __i The ID of the terrain to return.
	 * @return The terrain type at this position.
	 * @since 2017/02/13
	 */
	public static TerrainType of(int __i)
	{
		return TerrainType._VALUES[__i];
	}
	
	/**
	 * Lowercases the specified string.
	 *
	 * @param __s The string to lowercase.
	 * @return The lowercased string.

Name change from runt/mids/squirrel-quarrel/net/multiphasicapps/squirrelquarrel/world/Tile.java to modules/squirrel-quarrel/src/main/java/net/multiphasicapps/squirrelquarrel/world/Tile.java.

Name change from runt/mids/squirrel-quarrel/net/multiphasicapps/squirrelquarrel/world/World.java to modules/squirrel-quarrel/src/main/java/net/multiphasicapps/squirrelquarrel/world/World.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.squirrelquarrel.world;

import java.io.DataInputStream;
import java.io.InputStream;
import java.io.IOException;
import net.multiphasicapps.squirrelquarrel.game.InitialSettings;

/**
 * This stores the mega tiles within the level along with storing level related
 * data structures.
 *
 * @since 2017/02/09












<
<
<







1
2
3
4
5
6
7
8
9
10
11
12



13
14
15
16
17
18
19
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.squirrelquarrel.world;




import net.multiphasicapps.squirrelquarrel.game.InitialSettings;

/**
 * This stores the mega tiles within the level along with storing level related
 * data structures.
 *
 * @since 2017/02/09
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
		// Check
		if (__is == null)
			throw new NullPointerException("NARG");
		
		// Initialize the tile map
		int mw = __is.mapWidth(),
			mh = __is.mapHeight();
		this._tiles = __initTiles(mw, mh);
		
		// Store sizes
		this.tilew = mw;
		this.tileh = mh;
		this.megaw = mw / MegaTile.TILES_PER_MEGA_TILE;
		this.megah = mh / MegaTile.TILES_PER_MEGA_TILE;
		this.pixelw = mw * Tile.PIXEL_SIZE;







|







54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
		// Check
		if (__is == null)
			throw new NullPointerException("NARG");
		
		// Initialize the tile map
		int mw = __is.mapWidth(),
			mh = __is.mapHeight();
		this._tiles = this.__initTiles(mw, mh);
		
		// Store sizes
		this.tilew = mw;
		this.tileh = mh;
		this.megaw = mw / MegaTile.TILES_PER_MEGA_TILE;
		this.megah = mh / MegaTile.TILES_PER_MEGA_TILE;
		this.pixelw = mw * Tile.PIXEL_SIZE;
145
146
147
148
149
150
151

152
153

154
155
156
157
158
159
160
	 * @param __x The pixel X position.
	 * @param __y The pixel Y position.
	 * @return The terrain type for the given tile.
	 * @since 2017/02/13
	 */
	public TerrainType pixelTerrain(int __x, int __y)
	{

		return megaTile(pixelCoordToMegaTile(__x), pixelCoordToMegaTile(__y)).
			subTileTerrain(pixelCoordToSubTile(__x), pixelCoordToSubTile(__y));

	}
	
	/**
	 * Initializes the map tiles.
	 *
	 * @param __tw The tile width of the map.
	 * @param __th The tile height of the map.







>
|
|
>







142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
	 * @param __x The pixel X position.
	 * @param __y The pixel Y position.
	 * @return The terrain type for the given tile.
	 * @since 2017/02/13
	 */
	public TerrainType pixelTerrain(int __x, int __y)
	{
		return this.megaTile(
			World.pixelCoordToMegaTile(__x), World.pixelCoordToMegaTile(__y)).
			subTileTerrain(
				World.pixelCoordToSubTile(__x), World.pixelCoordToSubTile(__y));
	}
	
	/**
	 * Initializes the map tiles.
	 *
	 * @param __tw The tile width of the map.
	 * @param __th The tile height of the map.

Name change from runt/mids/squirrel-quarrel/net/multiphasicapps/squirrelquarrel/world/package-info.java to modules/squirrel-quarrel/src/main/java/net/multiphasicapps/squirrelquarrel/world/package-info.java.

Name change from runt/mids/squirrel-quarrel/dev/shadowtail/squirrelquarrel/tile0.xpm to modules/squirrel-quarrel/src/main/resources/dev/shadowtail/squirrelquarrel/tile0.xpm.

Name change from runt/mids/squirrel-quarrel/dev/shadowtail/squirrelquarrel/tile1.xpm to modules/squirrel-quarrel/src/main/resources/dev/shadowtail/squirrelquarrel/tile1.xpm.

Name change from runt/mids/squirrel-quarrel/dev/shadowtail/squirrelquarrel/tile2.xpm to modules/squirrel-quarrel/src/main/resources/dev/shadowtail/squirrelquarrel/tile2.xpm.

Name change from runt/mids/squirrel-quarrel/dev/shadowtail/squirrelquarrel/tile3.xpm to modules/squirrel-quarrel/src/main/resources/dev/shadowtail/squirrelquarrel/tile3.xpm.

Name change from runt/mids/squirrel-quarrel/icon.xpm to modules/squirrel-quarrel/src/main/resources/icon.xpm.

Name change from runt/mids/squirrel-quarrel/net/multiphasicapps/squirrelquarrel/data/graphics/clock.xpm to modules/squirrel-quarrel/src/main/resources/net/multiphasicapps/squirrelquarrel/data/graphics/clock.xpm.

Name change from runt/mids/squirrel-quarrel/net/multiphasicapps/squirrelquarrel/data/graphics/globe.xpm to modules/squirrel-quarrel/src/main/resources/net/multiphasicapps/squirrelquarrel/data/graphics/globe.xpm.

Name change from runt/mids/squirrel-quarrel/net/multiphasicapps/squirrelquarrel/data/graphics/pepper.xpm to modules/squirrel-quarrel/src/main/resources/net/multiphasicapps/squirrelquarrel/data/graphics/pepper.xpm.

Name change from runt/mids/squirrel-quarrel/net/multiphasicapps/squirrelquarrel/data/graphics/salt.xpm to modules/squirrel-quarrel/src/main/resources/net/multiphasicapps/squirrelquarrel/data/graphics/salt.xpm.

Name change from runt/mids/squirrel-quarrel/net/multiphasicapps/squirrelquarrel/data/terrain/dirt.xpm to modules/squirrel-quarrel/src/main/resources/net/multiphasicapps/squirrelquarrel/data/terrain/dirt.xpm.

Name change from runt/mids/squirrel-quarrel/net/multiphasicapps/squirrelquarrel/data/terrain/grass.xpm to modules/squirrel-quarrel/src/main/resources/net/multiphasicapps/squirrelquarrel/data/terrain/grass.xpm.

Name change from runt/mids/squirrel-quarrel/net/multiphasicapps/squirrelquarrel/data/units/chlorophid_garden/info to modules/squirrel-quarrel/src/main/resources/net/multiphasicapps/squirrelquarrel/data/units/chlorophid_garden/info.

Name change from runt/mids/squirrel-quarrel/net/multiphasicapps/squirrelquarrel/data/units/start_location/idle0v.xpm to modules/squirrel-quarrel/src/main/resources/net/multiphasicapps/squirrelquarrel/data/units/start_location/idle0v.xpm.

Name change from runt/mids/squirrel-quarrel/net/multiphasicapps/squirrelquarrel/data/units/start_location/info to modules/squirrel-quarrel/src/main/resources/net/multiphasicapps/squirrelquarrel/data/units/start_location/info.

Added modules/strings/build.gradle.









































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import cc.squirreljme.plugin.swm.JavaMEMidletType

description = "This project contains basic string utilities " +
	"which are useful when parsing strings."
version = rootProject.version

squirreljme
{
	javaDocErrorCode = "AM"
	swmType = JavaMEMidletType.LIBRARY
	swmName = "Basic String Utilities"
	swmVendor = "Stephanie Gawroriski"
}

dependencies
{
	implementation project(":modules:cldc-compact")

	implementation project(":modules:collections")
}

Name change from runt/libs/strings/net/multiphasicapps/strings/CharSequenceUtils.java to modules/strings/src/main/java/net/multiphasicapps/strings/CharSequenceUtils.java.

156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
		return -1;
	}
	
	/**
	 * Returns an array containing all of the indexes that the specified
	 * character appears in the given sequence.
	 *
	 * @parma __c The character to get the indexes for.
	 * @param __s The sequence to check in.
	 * @return An array containing the array indexes for the given character,
	 * if there are none then the array will be empty.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/11/26
	 */
	public static final int[] multipleIndexOf(char __c, CharSequence __s)







|







156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
		return -1;
	}
	
	/**
	 * Returns an array containing all of the indexes that the specified
	 * character appears in the given sequence.
	 *
	 * @param __c The character to get the indexes for.
	 * @param __s The sequence to check in.
	 * @return An array containing the array indexes for the given character,
	 * if there are none then the array will be empty.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/11/26
	 */
	public static final int[] multipleIndexOf(char __c, CharSequence __s)

Name change from runt/libs/strings/net/multiphasicapps/strings/StringUtils.java to modules/strings/src/main/java/net/multiphasicapps/strings/StringUtils.java.

9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// ---------------------------------------------------------------------------

package net.multiphasicapps.strings;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;

/**
 * This class contains static methods which can be used for manipulating
 * strings.
 *
 * @since 2017/11/23
 */







<







9
10
11
12
13
14
15

16
17
18
19
20
21
22
// ---------------------------------------------------------------------------

package net.multiphasicapps.strings;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;


/**
 * This class contains static methods which can be used for manipulating
 * strings.
 *
 * @since 2017/11/23
 */
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
		{
			// -1 is a special delimeter for the end of string because
			// otherwise if the string does not end in a delimeter it will not
			// be found
			int c = (i == n ? -1 : __s.charAt(i));
			
			// Is this a delimeter
			if (c == lastdelim || c == -1 || __indexOf(__delim, (char)c) >= 0)
			{
				// Remember last delimeter for potential speed
				lastdelim = c;
				
				// If reading delimeters, clear flag and mark
				// to remember the current index
				if (dows)







|







56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
		{
			// -1 is a special delimeter for the end of string because
			// otherwise if the string does not end in a delimeter it will not
			// be found
			int c = (i == n ? -1 : __s.charAt(i));
			
			// Is this a delimeter
			if (c == lastdelim || c == -1 || StringUtils.__indexOf(__delim, (char)c) >= 0)
			{
				// Remember last delimeter for potential speed
				lastdelim = c;
				
				// If reading delimeters, clear flag and mark
				// to remember the current index
				if (dows)
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
	public static final Collection<String> basicSplit(String __delim,
		String __s, Collection<String> __out)
		throws NullPointerException
	{
		if (__delim == null || __s == null || __out == null)
			throw new NullPointerException("NARG");
		
		return basicSplit(__delim.toCharArray(), __s, __out);
	}
	
	/**
	 * Splits the given string using the specified delimeter.
	 *
	 * @param __delim The delimeter to use.
	 * @param __s The string to split.







|







112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
	public static final Collection<String> basicSplit(String __delim,
		String __s, Collection<String> __out)
		throws NullPointerException
	{
		if (__delim == null || __s == null || __out == null)
			throw new NullPointerException("NARG");
		
		return StringUtils.basicSplit(__delim.toCharArray(), __s, __out);
	}
	
	/**
	 * Splits the given string using the specified delimeter.
	 *
	 * @param __delim The delimeter to use.
	 * @param __s The string to split.
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
	 */
	public static final String[] basicSplit(char[] __delim, String __s)
		throws NullPointerException
	{
		if (__delim == null || __s == null)
			throw new NullPointerException("NARG");
		
		Collection<String> rv = basicSplit(__delim, __s,
			new ArrayList<String>());
		return rv.<String>toArray(new String[rv.size()]);
	}
	
	/**
	 * Splits the given string using the specified delimeters.
	 *
	 * @param __delim The delimeters to use.
	 * @param __s The string to split.
	 * @return The split sequence of strings.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/11/23
	 */
	public static final String[] basicSplit(String __delim, String __s)
		throws NullPointerException
	{
		if (__delim == null || __s == null)
			throw new NullPointerException("NARG");
		
		return basicSplit(__delim.toCharArray(), __s);
	}
	
	/**
	 * Splits the specified string using the given delimeter and returns all
	 * of the fields which are contained within, any leading and trailing
	 * whitespace is trimmed.
	 *







|



















|







144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
	 */
	public static final String[] basicSplit(char[] __delim, String __s)
		throws NullPointerException
	{
		if (__delim == null || __s == null)
			throw new NullPointerException("NARG");
		
		Collection<String> rv = StringUtils.basicSplit(__delim, __s,
			new ArrayList<String>());
		return rv.<String>toArray(new String[rv.size()]);
	}
	
	/**
	 * Splits the given string using the specified delimeters.
	 *
	 * @param __delim The delimeters to use.
	 * @param __s The string to split.
	 * @return The split sequence of strings.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/11/23
	 */
	public static final String[] basicSplit(String __delim, String __s)
		throws NullPointerException
	{
		if (__delim == null || __s == null)
			throw new NullPointerException("NARG");
		
		return StringUtils.basicSplit(__delim.toCharArray(), __s);
	}
	
	/**
	 * Splits the specified string using the given delimeter and returns all
	 * of the fields which are contained within, any leading and trailing
	 * whitespace is trimmed.
	 *
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
		return CharSequenceUtils.firstIndexSorted(__c, __s);
	}
	
	/**
	 * Returns an array containing all of the indexes that the specified
	 * character appears in the given string.
	 *
	 * @parma __c The character to get the indexes for.
	 * @param __s The string to check in.
	 * @return An array containing the array indexes for the given character,
	 * if there are none then the array will be empty.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/11/26
	 */
	public static final int[] multipleIndexOf(char __c, String __s)







|







282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
		return CharSequenceUtils.firstIndexSorted(__c, __s);
	}
	
	/**
	 * Returns an array containing all of the indexes that the specified
	 * character appears in the given string.
	 *
	 * @param __c The character to get the indexes for.
	 * @param __s The string to check in.
	 * @return An array containing the array indexes for the given character,
	 * if there are none then the array will be empty.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/11/26
	 */
	public static final int[] multipleIndexOf(char __c, String __s)

Name change from runt/libs/strings/net/multiphasicapps/strings/package-info.java to modules/strings/src/main/java/net/multiphasicapps/strings/package-info.java.

Added modules/tac-runner/build.gradle.













































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import cc.squirreljme.plugin.swm.JavaMEMidletType

description = "This is a system which interacts with " +
	"SquirrelJME and is able to launch and execute various tests within " +
	"the environment automatically."
version = rootProject.version

squirreljme
{
	javaDocErrorCode = "AI"
	swmType = JavaMEMidletType.API
	swmName = "TAC Runner"
	swmVendor = "Stephanie Gawroriski"
	mainClass = "net.multiphasicapps.tac.runner.Main"
}

dependencies
{
	implementation project(":modules:cldc-compact")
	implementation project(":modules:collections")
	implementation project(":modules:meep-swm")
}

Name change from test/mids/tac-runner/net/multiphasicapps/tac/runner/Database.java to modules/tac-runner/src/main/java/net/multiphasicapps/tac/runner/Database.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.tac.runner;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import javax.microedition.swm.ManagerFactory;
import javax.microedition.swm.Suite;
import javax.microedition.swm.SuiteManager;












<
<







1
2
3
4
5
6
7
8
9
10
11
12


13
14
15
16
17
18
19
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.tac.runner;



import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import javax.microedition.swm.ManagerFactory;
import javax.microedition.swm.Suite;
import javax.microedition.swm.SuiteManager;

Name change from test/mids/tac-runner/net/multiphasicapps/tac/runner/Main.java to modules/tac-runner/src/main/java/net/multiphasicapps/tac/runner/Main.java.

Name change from test/mids/tac-runner/net/multiphasicapps/tac/runner/Report.java to modules/tac-runner/src/main/java/net/multiphasicapps/tac/runner/Report.java.

159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
			// XML header
			__out.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
			
			// Testsuites
			__out.printf("<testsuites failures=\"%d\" " +
				"tests=\"%d\" time=\"%s\">%n",
				numfail, numpass,
				Report.doubleToString(totalns / NANOS_PER_SECOND));
			
			// There is just a single test suite
			__out.printf("<testsuite name=\"SquirrelJME\" " +
				"tests=\"%d\" failures=\"%d\" id=\"0\" time=\"%s\">%n",
				numtests, numfail,
				Report.doubleToString(totalns / NANOS_PER_SECOND));
			
			// Dump environment showing the details of the VM, this is taken
			// from the hello demo. Just used to identify the VM and such.
			__out.println("<properties>");
			for (String p : _PROPERTIES)
				try
				{
					String v = System.getProperty(p);
					if (v != null)
						__out.printf("<property name=\"%s\" value=\"%s\" />%n",
							p, v.replace('"', '\''));
				}
				catch (SecurityException e)
				{
				}
			__out.println("</properties>");
			
			// Print every item
			for (ReportItem i : items.values())
			{
				__out.printf("<testcase name=\"%s\" " +
					"classname=\"%s\" status=\"%s\" time=\"%s\">%n",
					i.name, i.name, (i.passed ? "pass" : "fail"),
					Report.doubleToString(i.duration / NANOS_PER_SECOND));
				
				// Failure gets a note attached
				if (!i.passed)
					__out.println("<failure message=\"Failed.\" />");

				// End
				__out.println("</testcase>");







|





|




|


















|







159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
			// XML header
			__out.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
			
			// Testsuites
			__out.printf("<testsuites failures=\"%d\" " +
				"tests=\"%d\" time=\"%s\">%n",
				numfail, numpass,
				Report.doubleToString(totalns / Report.NANOS_PER_SECOND));
			
			// There is just a single test suite
			__out.printf("<testsuite name=\"SquirrelJME\" " +
				"tests=\"%d\" failures=\"%d\" id=\"0\" time=\"%s\">%n",
				numtests, numfail,
				Report.doubleToString(totalns / Report.NANOS_PER_SECOND));
			
			// Dump environment showing the details of the VM, this is taken
			// from the hello demo. Just used to identify the VM and such.
			__out.println("<properties>");
			for (String p : Report._PROPERTIES)
				try
				{
					String v = System.getProperty(p);
					if (v != null)
						__out.printf("<property name=\"%s\" value=\"%s\" />%n",
							p, v.replace('"', '\''));
				}
				catch (SecurityException e)
				{
				}
			__out.println("</properties>");
			
			// Print every item
			for (ReportItem i : items.values())
			{
				__out.printf("<testcase name=\"%s\" " +
					"classname=\"%s\" status=\"%s\" time=\"%s\">%n",
					i.name, i.name, (i.passed ? "pass" : "fail"),
					Report.doubleToString(i.duration / Report.NANOS_PER_SECOND));
				
				// Failure gets a note attached
				if (!i.passed)
					__out.println("<failure message=\"Failed.\" />");

				// End
				__out.println("</testcase>");

Name change from test/mids/tac-runner/net/multiphasicapps/tac/runner/ReportItem.java to modules/tac-runner/src/main/java/net/multiphasicapps/tac/runner/ReportItem.java.

Name change from test/mids/tac-runner/net/multiphasicapps/tac/runner/ReportType.java to modules/tac-runner/src/main/java/net/multiphasicapps/tac/runner/ReportType.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.tac.runner;

import java.io.PrintStream;

/**
 * Represents the type of report to make.
 *
 * @since 2019/01/23
 */
public enum ReportType
{












<
<







1
2
3
4
5
6
7
8
9
10
11
12


13
14
15
16
17
18
19
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.tac.runner;



/**
 * Represents the type of report to make.
 *
 * @since 2019/01/23
 */
public enum ReportType
{

Name change from test/mids/tac-runner/net/multiphasicapps/tac/runner/SingleUnit.java to modules/tac-runner/src/main/java/net/multiphasicapps/tac/runner/SingleUnit.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.tac.runner;

import javax.microedition.swm.Suite;
import javax.microedition.swm.ManagerFactory;
import javax.microedition.swm.Task;
import javax.microedition.swm.TaskManager;
import javax.microedition.swm.TaskStatus;

/**
 * This contains a single test unit which may be run accordingly.
 *
 * @since 2018/10/17
 */












|
|

<







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

16
17
18
19
20
21
22
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.tac.runner;

import javax.microedition.swm.ManagerFactory;
import javax.microedition.swm.Suite;
import javax.microedition.swm.Task;

import javax.microedition.swm.TaskStatus;

/**
 * This contains a single test unit which may be run accordingly.
 *
 * @since 2018/10/17
 */

Name change from test/mids/tac-runner/net/multiphasicapps/tac/runner/package-info.java to modules/tac-runner/src/main/java/net/multiphasicapps/tac/runner/package-info.java.

Added modules/tac/build.gradle.









































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import cc.squirreljme.plugin.swm.JavaMEMidletType

description = "This project contains the testing, acceptance, "+
	"and comparison framework which is used to test and compare differring " +
	"executions of the virtual machine."
version = rootProject.version

squirreljme
{
	javaDocErrorCode = "BU"
	swmType = JavaMEMidletType.LIBRARY
	swmName = "Testing Framework"
	swmVendor = "Stephanie Gawroriski"
}

// We need to compile a class but not write it to:
// /squirreljme/modules/tac/build/classes/java/main
sourceSets
{
	main
	{
		java
		{
			exclude "org/testng/internal/annotations/DisabledRetryAnalyzer.java"
			exclude "org/testng/annotations/CustomAttribute.java"
			exclude "org/testng/annotations/Test.java"
		}
	}
}

dependencies
{
	// We have some annotations we need the source for, but we do not want
	// these to stay at run-time
	compileOnly "org.testng:testng:7.1.0"

	implementation project(":modules:cldc-compact")
	implementation project(":modules:io")
	implementation project(":modules:meep-midlet")
	implementation project(":modules:tool-manifest-reader")
	implementation project(":modules:tool-manifest-writer")
	implementation project(":modules:collections")
}

jar
{
	// These are excluded because they are not needed by the source and are
	// part of TestNG
	exclude("org/testng/internal/annotations/DisabledRetryAnalyzer.class")
	exclude("org/testng/annotations/CustomAttribute.class")
	exclude("org/testng/annotations/Test.class")
}

Name change from test/libs/tac/net/multiphasicapps/tac/DataConversion.java to modules/tac/src/main/java/net/multiphasicapps/tac/DataConversion.java.

Name change from test/libs/tac/net/multiphasicapps/tac/DataDeserialization.java to modules/tac/src/main/java/net/multiphasicapps/tac/DataDeserialization.java.

Name change from test/libs/tac/net/multiphasicapps/tac/DataSerialization.java to modules/tac/src/main/java/net/multiphasicapps/tac/DataSerialization.java.

Name change from test/libs/tac/net/multiphasicapps/tac/DeadlockTimeout.java to modules/tac/src/main/java/net/multiphasicapps/tac/DeadlockTimeout.java.

30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
	/**
	 * Initializes a timeout thread.
	 *
	 * @since 2019/05/09
	 */
	public DeadlockTimeout()
	{
		this(DEFAULT_TIMEOUT);
	}
	
	/**
	 * Initializes a timeout thread for the given duration.
	 *
	 * @param __ms The timeout in milliseconds.
	 * @since 2019/05/09
	 */
	public DeadlockTimeout(int __ms)
	{
		super("TestDeadlockTimeout");
		
		__ms = (__ms <= 0 ? DEFAULT_TIMEOUT : __ms);
		
		this.timeoutnano = System.nanoTime() + (__ms * 1000000L);
	}
	
	/**
	 * Expires this timeout watch.
	 *







|












|







30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
	/**
	 * Initializes a timeout thread.
	 *
	 * @since 2019/05/09
	 */
	public DeadlockTimeout()
	{
		this(DeadlockTimeout.DEFAULT_TIMEOUT);
	}
	
	/**
	 * Initializes a timeout thread for the given duration.
	 *
	 * @param __ms The timeout in milliseconds.
	 * @since 2019/05/09
	 */
	public DeadlockTimeout(int __ms)
	{
		super("TestDeadlockTimeout");
		
		__ms = (__ms <= 0 ? DeadlockTimeout.DEFAULT_TIMEOUT : __ms);
		
		this.timeoutnano = System.nanoTime() + (__ms * 1000000L);
	}
	
	/**
	 * Expires this timeout watch.
	 *

Name change from test/libs/tac/net/multiphasicapps/tac/InvalidTestException.java to modules/tac/src/main/java/net/multiphasicapps/tac/InvalidTestException.java.

Name change from test/libs/tac/net/multiphasicapps/tac/InvalidTestParameterException.java to modules/tac/src/main/java/net/multiphasicapps/tac/InvalidTestParameterException.java.

Name change from test/libs/tac/net/multiphasicapps/tac/InvalidTestResultException.java to modules/tac/src/main/java/net/multiphasicapps/tac/InvalidTestResultException.java.

Name change from test/libs/tac/net/multiphasicapps/tac/TestBiConsumer.java to modules/tac/src/main/java/net/multiphasicapps/tac/TestBiConsumer.java.

Name change from test/libs/tac/net/multiphasicapps/tac/TestBiFunction.java to modules/tac/src/main/java/net/multiphasicapps/tac/TestBiFunction.java.

Name change from test/libs/tac/net/multiphasicapps/tac/TestBoolean.java to modules/tac/src/main/java/net/multiphasicapps/tac/TestBoolean.java.

Name change from test/libs/tac/net/multiphasicapps/tac/TestConsumer.java to modules/tac/src/main/java/net/multiphasicapps/tac/TestConsumer.java.

Added modules/tac/src/main/java/net/multiphasicapps/tac/TestExecution.java.









































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
package net.multiphasicapps.tac;

import java.io.PrintStream;

/**
 * This represents the expected and resultant results of a test.
 *
 * @since 2020/02/23
 */
public final class TestExecution
{
	/** The status of the test. */
	public final TestStatus status;
	
	/** The class being tested. */
	public final Class<?> testClass;
	
	/** The result of the test. */
	public final TestResult result;
	
	/** The expected results of the test. */
	public final TestResult expected;
	
	/** The exception tossed, if there is one. */
	public final Object tossed;
	
	/**
	 * Initializes the test execution.
	 *
	 * @param __ts The test status.
	 * @param __tc The test class.
	 * @param __res The results of the test.
	 * @param __exp The expected results.
	 * @param __tossed Any exception that was tossed.
	 * @since 2020/02/23
	 */
	public TestExecution(TestStatus __ts, Class<?> __tc,
		TestResult __res, TestResult __exp, Object __tossed)
	{
		this.status = __ts;
		this.testClass = __tc;
		this.result = __res;
		this.expected = __exp;
		this.tossed = __tossed;
	}
	
	/**
	 * Prints the execution results.
	 *
	 * @param __ps The stream to print to.
	 * @throws NullPointerException On null arguments.
	 * @since 2020/02/26
	 */
	public final void print(PrintStream __ps)
		throws NullPointerException
	{
		if (__ps == null)
			throw new NullPointerException("NARG");
			
		switch (this.status)
		{
				// Test passed
			case SUCCESS:
				__ps.printf("%s: PASS %s%n",
					this.testClass, this.result);
				break;
			
				// Failed test, print results
			case FAILED:
				// Failure notice
				__ps.printf("%s: FAIL %s%n",
					this.testClass, this.result);
				
				// Print comparison to show what failed
				this.expected.printComparison(System.err,
					this.result);
				break;
			
			case TEST_EXCEPTION:
				// {@squirreljme.error BU0d The test failed to run properly.
				// (The given test)}
				__ps.printf("BU0d %s%n", this.testClass);
				break;
			
			case UNTESTABLE:
				// {@squirreljme.error BU0c Test could not be ran
				// potentially because a condition was not met. (Test class)}
				__ps.printf("BU0c %s%n", this.testClass);
				break;
		}
		
		// Print traces of unexpected exceptions
		if (this.status != TestStatus.FAILED &&
			this.tossed instanceof Throwable)
			((Throwable)this.tossed).printStackTrace(__ps);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2020/02/26
	 */
	@Override
	public final String toString()
	{
		StringBuilder sb = new StringBuilder();
		
		sb.append("{");
		
		sb.append("status=");
		sb.append(this.status);
		
		sb.append(", testClass=");
		sb.append(this.testClass.getName());
		
		sb.append(", result=");
		sb.append(this.result.toString());
		
		sb.append(", expected=");
		sb.append(this.expected.toString());
		
		Object tossed = this.tossed;
		if (tossed != null)
		{
			sb.append(", tossed=");
			sb.append(tossed.toString());
		}
		
		sb.append("}");
		
		return sb.toString();
	}
}

Name change from test/libs/tac/net/multiphasicapps/tac/TestFunction.java to modules/tac/src/main/java/net/multiphasicapps/tac/TestFunction.java.

Name change from test/libs/tac/net/multiphasicapps/tac/TestInteger.java to modules/tac/src/main/java/net/multiphasicapps/tac/TestInteger.java.

Added modules/tac/src/main/java/net/multiphasicapps/tac/TestInterface.java.





























































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package net.multiphasicapps.tac;

import org.testng.annotations.Test;

/**
 * This is an interface for anything which is something that can be tested
 * within the SquirrelJME test framework.
 *
 * @since 2020/02/23
 */
public interface TestInterface
	extends Runnable
{
	/**
	 * {@inheritDoc}
	 * @since 2020/02/26
	 */
	@Override
	@Test
	void run();
	
	/**
	 * Runs the test.
	 *
	 * @param __mainargs Arguments to the test.
	 * @return The execution result of the test.
	 * @since 2020/02/23
	 */
	TestExecution runExecution(String... __mainargs);
}

Name change from test/libs/tac/net/multiphasicapps/tac/TestLong.java to modules/tac/src/main/java/net/multiphasicapps/tac/TestLong.java.

31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
	 * {@inheritDoc}
	 * @since 2019/12/24
	 */
	@Override
	final Object __runTest(Object... __args)
		throws Throwable
	{
		// {@squirreljme.error BU0e Test does not take any parameters.}
		if (__args.length != 0)
			throw new InvalidTestParameterException("BU0e");
		
		// Run the test
		return Long.valueOf(this.test());
	}
}








|

|






31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
	 * {@inheritDoc}
	 * @since 2019/12/24
	 */
	@Override
	final Object __runTest(Object... __args)
		throws Throwable
	{
		// {@squirreljme.error BU0A Test does not take any parameters.}
		if (__args.length != 0)
			throw new InvalidTestParameterException("BU0A");
		
		// Run the test
		return Long.valueOf(this.test());
	}
}

Name change from test/libs/tac/net/multiphasicapps/tac/TestResult.java to modules/tac/src/main/java/net/multiphasicapps/tac/TestResult.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.tac;

import java.io.InputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintStream;
import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import net.multiphasicapps.collections.SortedTreeMap;
import net.multiphasicapps.collections.SortedTreeSet;
import net.multiphasicapps.tool.manifest.JavaManifest;
import net.multiphasicapps.tool.manifest.JavaManifestKey;
import net.multiphasicapps.tool.manifest.JavaManifestAttributes;
import net.multiphasicapps.tool.manifest.writer.MutableJavaManifest;
import net.multiphasicapps.tool.manifest.writer.MutableJavaManifestAttributes;

/**
 * This class contains an immutable result of the test.
 *
 * @since 2019/05/08











|
|





<








|
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.tac;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintStream;
import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import java.util.ArrayList;

import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import net.multiphasicapps.collections.SortedTreeMap;
import net.multiphasicapps.collections.SortedTreeSet;
import net.multiphasicapps.tool.manifest.JavaManifest;
import net.multiphasicapps.tool.manifest.JavaManifestAttributes;
import net.multiphasicapps.tool.manifest.JavaManifestKey;
import net.multiphasicapps.tool.manifest.writer.MutableJavaManifest;
import net.multiphasicapps.tool.manifest.writer.MutableJavaManifestAttributes;

/**
 * This class contains an immutable result of the test.
 *
 * @since 2019/05/08
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123





















124
125
126
127
128
129
130
		if (__o == this)
			return true;
		
		if (!(__o instanceof TestResult))
			return false;
		
		TestResult o = (TestResult)__o;
		return TestResult.valueEquals(this.rvalue, o.rvalue) &&
			TestResult.valueEquals(this.tvalue, o.tvalue) &&
			TestResult.__equals(this._secondary, o._secondary);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2019/05/08
	 */
	@Override
	public final int hashCode()
	{
		int rv = this._hash;
		if (rv == 0)
			this._hash = (rv = this.rvalue.hashCode() ^
				this.tvalue.hashCode() ^ this._secondary.hashCode());
		return rv;
	}





















	
	/**
	 * Prints the comparison of this result and the other result.
	 *
	 * @param __ps The stream to write to.
	 * @param __o The result to compare against.
	 * @throws NullPointerException On null arguments.







|
|
|















>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
		if (__o == this)
			return true;
		
		if (!(__o instanceof TestResult))
			return false;
		
		TestResult o = (TestResult)__o;
		return this.rvalue.equals(o.rvalue) &&
			this.tvalue.equals(o.tvalue) &&
			this._secondary.equals(o._secondary);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2019/05/08
	 */
	@Override
	public final int hashCode()
	{
		int rv = this._hash;
		if (rv == 0)
			this._hash = (rv = this.rvalue.hashCode() ^
				this.tvalue.hashCode() ^ this._secondary.hashCode());
		return rv;
	}
	
	/**
	 * Checks if this result is satisfied by the other result, note that this
	 * is not the same as equality just a result for a test.
	 *
	 * @param __o The other result.
	 * @return If it is satisfied by it.
	 * @throws NullPointerException On null arguments.
	 * @since 2020/03/01
	 */
	public final boolean isSatisfiedBy(TestResult __o)
		throws NullPointerException
	{
		if (__o == null)
			throw new NullPointerException("NARG");
		
		// Use test comparison (note is expected and actual)
		return TestResult.valueEquals(__o.rvalue, this.rvalue) &&
			TestResult.valueEquals(__o.tvalue, this.tvalue) &&
			TestResult.__equals(__o._secondary, this._secondary);
	}
	
	/**
	 * Prints the comparison of this result and the other result.
	 *
	 * @param __ps The stream to write to.
	 * @param __o The result to compare against.
	 * @throws NullPointerException On null arguments.
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401






















402
403
404
405
406
407
408
	 * @param __exp The expected value.
	 * @return If the strings are a match.
	 * @throws InvalidTestParameterException If a throwable is not formatted
	 * correctly.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/10/06
	 */
	public static final boolean valueEquals(String __act, String __exp)
		throws InvalidTestParameterException, NullPointerException
	{
		if (__act == null || __exp == null)
			throw new NullPointerException("NARG");
		
		// Throwables are special cases since they represent multiple classes
		if (__act.startsWith("throwable:") && __exp.startsWith("throwable:"))
		{
			// Get all elements for both
			List<String> la = TestResult.throwableList(__act),
				lb = TestResult.throwableList(__exp);
			
			todo.DEBUG.note("%s ~~= %s", la, lb);
			
			// These are considered equal if they have anything in common
			la.retainAll(lb);
			return !la.isEmpty();
		}






















		
		// Use normal string comparison
		return __exp.equals(__act);
	}
	
	/**
	 * Compares the map of strings to see that they are equal.







|


















>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
	 * @param __exp The expected value.
	 * @return If the strings are a match.
	 * @throws InvalidTestParameterException If a throwable is not formatted
	 * correctly.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/10/06
	 */
	public static boolean valueEquals(String __act, String __exp)
		throws InvalidTestParameterException, NullPointerException
	{
		if (__act == null || __exp == null)
			throw new NullPointerException("NARG");
		
		// Throwables are special cases since they represent multiple classes
		if (__act.startsWith("throwable:") && __exp.startsWith("throwable:"))
		{
			// Get all elements for both
			List<String> la = TestResult.throwableList(__act),
				lb = TestResult.throwableList(__exp);
			
			todo.DEBUG.note("%s ~~= %s", la, lb);
			
			// These are considered equal if they have anything in common
			la.retainAll(lb);
			return !la.isEmpty();
		}
		
		// Comparing against fudged long value (which is a plus or minus value)
		else if (__act.startsWith("long:") && __exp.startsWith("long-fudge:"))
		{
			// Parse actual value
			long act = Long.parseLong(__act.substring("long:".length()));
			
			// The expected value has a fudge
			int xfc = __exp.indexOf(':');
			int xlc = __exp.lastIndexOf(':');
			if (xlc == xfc)
				xlc = -1;
			
			// Parse values
			long exp = Long.parseLong(__exp.substring(xfc + 1,
				(xlc > 0 ? xlc : __exp.length())));
			long fudge = Math.abs((xlc > 0 ?
				Long.parseLong(__exp.substring(xlc + 1)) : 0));
			
			// Matches as long as we are within the fudge range
			return act == exp || (act >= (exp - fudge) && act <= (exp + fudge));
		}
		
		// Use normal string comparison
		return __exp.equals(__act);
	}
	
	/**
	 * Compares the map of strings to see that they are equal.
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
		throws NullPointerException
	{
		if (__ps == null || __key == null)
			throw new NullPointerException("NARG");
		
		// Not the same?
		boolean equals;
		if (__a == null || (__a == null) != (__b == null))
			equals = Objects.equals(__a, __b);
		
		// Compare values otherwise
		else
			equals = TestResult.valueEquals(__a, __b);
		
		// Do not print null as is because it can be confused for actual null







|







503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
		throws NullPointerException
	{
		if (__ps == null || __key == null)
			throw new NullPointerException("NARG");
		
		// Not the same?
		boolean equals;
		if (__a == null || __b == null)
			equals = Objects.equals(__a, __b);
		
		// Compare values otherwise
		else
			equals = TestResult.valueEquals(__a, __b);
		
		// Do not print null as is because it can be confused for actual null

Name change from test/libs/tac/net/multiphasicapps/tac/TestResultBuilder.java to modules/tac/src/main/java/net/multiphasicapps/tac/TestResultBuilder.java.

Name change from test/libs/tac/net/multiphasicapps/tac/TestRunnable.java to modules/tac/src/main/java/net/multiphasicapps/tac/TestRunnable.java.

Name change from test/libs/tac/net/multiphasicapps/tac/TestStatus.java to modules/tac/src/main/java/net/multiphasicapps/tac/TestStatus.java.

Name change from test/libs/tac/net/multiphasicapps/tac/TestSupplier.java to modules/tac/src/main/java/net/multiphasicapps/tac/TestSupplier.java.

Added modules/tac/src/main/java/net/multiphasicapps/tac/ThrownTestExecution.java.























































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package net.multiphasicapps.tac;

/**
 * This is used to throw the test execution.
 *
 * @since 2020/02/26
 */
public class ThrownTestExecution
	extends RuntimeException
{
	/** The tossed execution. */
	public final TestExecution execution;
	
	/**
	 * Initializes the exception.
	 *
	 * @param __exec The execution to trace.
	 * @param __cause The cause of it.
	 * @since 2020/02/26
	 */
	public ThrownTestExecution(TestExecution __exec, Throwable __cause)
	{
		super((__exec == null ? "NULL" : __exec.toString()), __cause);
		
		this.execution = __exec;
	}
}

Name change from test/libs/tac/net/multiphasicapps/tac/UntestableException.java to modules/tac/src/main/java/net/multiphasicapps/tac/UntestableException.java.

Name change from test/libs/tac/net/multiphasicapps/tac/__CoreTest__.java to modules/tac/src/main/java/net/multiphasicapps/tac/__CoreTest__.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38

39
40
41
42
43
44
45
46
47
48
49
50
51
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.tac;

import cc.squirreljme.runtime.cldc.lang.ApiLevel;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.IOException;
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.microedition.midlet.MIDlet;
import net.multiphasicapps.collections.SortedTreeMap;
import net.multiphasicapps.collections.SortedTreeSet;
import net.multiphasicapps.tool.manifest.JavaManifest;
import net.multiphasicapps.tool.manifest.JavaManifestKey;
import net.multiphasicapps.tool.manifest.JavaManifestAttributes;

/**
 * This is the core test framework which handles reading test information and
 * parameters, it forwards internally to other classes which handle
 * parameters and such.
 *
 * @since 2018/10/06
 */
abstract class __CoreTest__
	extends MIDlet

{
	/** {@squirreljme.error test.dump=bool Dump test result manifests?} */
	public static final String DUMP_ACTUAL =
		"test.dump";
	
	/** Final result of the test. */
	final TestResultBuilder _runresult =
		new TestResultBuilder();
	
	/** The status of the test. */
	volatile TestStatus _status =
		TestStatus.NOT_RUN;
	













|
|
|
<



<
<

<
<

|
|










>

|



|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16

17
18
19


20


21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.tac;

import cc.squirreljme.runtime.cldc.lang.ApiLevel;
import cc.squirreljme.runtime.midlet.OverrideActiveMidletRestriction;
import java.io.IOException;
import java.io.InputStream;

import java.io.PrintStream;
import java.util.ArrayList;
import java.util.List;


import javax.microedition.midlet.MIDlet;


import net.multiphasicapps.tool.manifest.JavaManifest;
import net.multiphasicapps.tool.manifest.JavaManifestAttributes;
import org.testng.annotations.Test;

/**
 * This is the core test framework which handles reading test information and
 * parameters, it forwards internally to other classes which handle
 * parameters and such.
 *
 * @since 2018/10/06
 */
abstract class __CoreTest__
	extends MIDlet
	implements OverrideActiveMidletRestriction, TestInterface
{
	/** {@squirreljme.property test.dump=bool Dump test result manifests?} */
	public static final String DUMP_ACTUAL =
		"test.dump";
	
	/** Final result of the test, used during the test. */
	final TestResultBuilder _runresult =
		new TestResultBuilder();
	
	/** The status of the test. */
	volatile TestStatus _status =
		TestStatus.NOT_RUN;
	
64
65
66
67
68
69
70

71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90

































































































































91



92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225

226



227
228
229
230
231
232
233
	/**
	 * Tests the minimum API level.
	 *
	 * @param __lv The level to test.
	 * @throws InvalidTestException If the API level is not met.
	 * @since 2019/03/14
	 */

	public final void checkApiLevel(int __lv)
		throws InvalidTestException
	{
		// {@squirreljme.error BU0b Minimum API level has not been met.
		// (The required API level)}
		if (!ApiLevel.minimumLevel(__lv))
			throw new InvalidTestException(String.format("BU0b %x", __lv));
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/10/06
	 */
	@Override
	protected final void destroyApp(boolean __u)
	{
		// Not used
	}
	
	/**

































































































































	 * Runs the specified test using the given main arguments, if any.



	 *
	 * @param __mainargs The main arguments to the test which allow parameters
	 * to be used accordingly.
	 * @since 2018/10/06
	 */
	public final void runTest(String... __mainargs)
	{
		if (__mainargs == null)
			__mainargs = new String[0];
		
		// Set a watchdog in case our test takes a very long time to execute
		DeadlockTimeout dtimeout = new DeadlockTimeout();
		dtimeout.start();
		
		// Use to name this test
		Class<?> self = this.getClass();
		String classname = self.getName();
		
		// Decode the expected result
		TestResult expected = TestResult.loadForClass(self);
		
		// Read the inputs for the test
		Object[] args = this.__parseInput(self, __mainargs);
		
		// Remember the old output stream because it will be replaced with
		// stderr, this way when tests run they do not inadvertently output
		// to standard output. Standard output being printed to will mess up
		// the test results generated at the end of tac-runner
		PrintStream oldout = System.out;
		
		// This is the result of the test
		TestResultBuilder runresult = this._runresult;
		
		// Run the test, catch any exception to report it
		Object thrown;
		try
		{
			// Set the output stream to standard error as noted above
			try
			{
				System.setOut(System.err);
			}
			catch (SecurityException e)
			{
				// Ignore, oh well
			}
			
			// Run the test
			runresult.setReturnValue(this.__runTest(args));
			runresult.setThrownValue((thrown = new __NoExceptionThrown__()));
		}
		
		// Cannot be tested
		catch (UntestableException e)
		{
			// {@squirreljme.error BU0c Test could not be ran.
			// (The given test)}
			System.err.printf("BU0c %s%n", classname);
			e.printStackTrace(System.err);
			
			// Cannot be tested so it shall fail
			this._status = TestStatus.UNTESTABLE;
			return;
		}
		
		// Test failure
		catch (Throwable t)
		{
			// The test parameter is not valid, so whoops!
			if (t instanceof InvalidTestException)
			{
				// Exception was thrown
				this._status = TestStatus.TEST_EXCEPTION;
				
				// {@squirreljme.error BU0d The test failed to run properly.
				// (The given test)}
				System.err.printf("BU0d %s%n", classname);
				t.printStackTrace(System.err);
				return;
			}
			
			// Indicate an exception was thrown
			runresult.setReturnValue(new __ExceptionThrown__());
			runresult.setThrownValue((thrown = t));
		}
		finally
		{
			// Restore the old output stream
			try
			{
				System.setOut(oldout);
			}
			catch (SecurityException e)
			{
				// Ignore, things happen
			}
		}
		
		// Return actual result
		TestResult actual = runresult.build();
		
		// The test result is exactly the same!
		boolean passed = expected.equals(actual);
		if (passed)
			oldout.printf("%s: PASS %s%n",
				classname, actual);
		
		// Otherwise print information on what has differed within the test
		// so that bugs may potentially be found
		else
		{
			// Failure notice
			oldout.printf("%s: FAIL %s%n",
				classname, actual);
			
			// Print comparison on another stream so it is not used in output
			expected.printComparison(System.err, actual);
		
			// Print the throwable stack since this was not expected
			if (thrown instanceof Throwable)
				((Throwable)thrown).printStackTrace();
		}
		
		// Set test status
		this._status = (passed ? TestStatus.SUCCESS : TestStatus.FAILED);
		
		// Dump test result
		try
		{
			if (Boolean.getBoolean(DUMP_ACTUAL))
				actual.writeAsManifest(System.err);
		}
		catch (IOException|SecurityException e)
		{

		}



		
		// Stop the watchdog so we do not exit
		dtimeout.expire();
	}
	
	/**
	 * Stores a secondary value which can be additionally used as test







>




















>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
>
>
>














<
<
<
<
<
<
<
<
<
<






|
<
|
<
<












|
<
<
<
|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<














<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<



|
|



>

>
>
>







60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234










235
236
237
238
239
240
241

242


243
244
245
246
247
248
249
250
251
252
253
254
255



256
































257
258
259
260
261
262
263
264
265
266
267
268
269
270




























271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
	/**
	 * Tests the minimum API level.
	 *
	 * @param __lv The level to test.
	 * @throws InvalidTestException If the API level is not met.
	 * @since 2019/03/14
	 */
	@Deprecated
	public final void checkApiLevel(int __lv)
		throws InvalidTestException
	{
		// {@squirreljme.error BU0b Minimum API level has not been met.
		// (The required API level)}
		if (!ApiLevel.minimumLevel(__lv))
			throw new InvalidTestException(String.format("BU0b %x", __lv));
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/10/06
	 */
	@Override
	protected final void destroyApp(boolean __u)
	{
		// Not used
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2020/02/23
	 */
	@Override
	@Test
	public final void run()
	{
		// Run our execution with the default arguments!
		TestExecution execution = this.runExecution();
		
		// Always print the result
		execution.print(System.err);
		
		// If the test did not pass, throw an exception
		if (execution.status != TestStatus.SUCCESS)
		{
			// If skippable, try throwing a TestNG skip exception if it exists
			if (execution.status == TestStatus.UNTESTABLE)
				try
				{
					Class<?> skippy = Class.forName(
						"org.testng.SkipException");
					
					// Create instance
					Object instance = skippy.newInstance();
					
					// If it is throwable, we throw it!
					if (instance instanceof RuntimeException)
					{
						RuntimeException re = (RuntimeException)instance;
						
						// So this way our information is not completely gone
						re.initCause(new ThrownTestExecution(
							execution, null));
						
						throw re;
					}
				}
				catch (ClassNotFoundException|InstantiationException|
					IllegalAccessException e)
				{
					// Ignore, treat as failure
				}
			
			Object tossed = execution.tossed;
			throw new ThrownTestExecution(execution,
				((tossed instanceof Throwable) ? (Throwable)tossed : null));
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2020/02/23
	 */
	@SuppressWarnings("FeatureEnvy")
	@Override
	public final TestExecution runExecution(String... __mainargs)
	{
		// Use to name this test
		Class<?> self = this.getClass();
		String classname = self.getName();
		
		// Decode the expected result
		TestResult expected = TestResult.loadForClass(self);
		
		// Read the inputs for the test
		Object[] args = this.__parseInput(self, __mainargs);
		
		// This is the result of the test
		TestResultBuilder runresult = this._runresult;
		
		// Our test result
		TestStatus status = null;
		
		// Run the test, catch any exception to report it
		Object thrown = null;
		try
		{
			// Run the test
			runresult.setReturnValue(this.__runTest(args));
			runresult.setThrownValue((thrown = new __NoExceptionThrown__()));
		}
		
		// Cannot be tested
		catch (UntestableException e)
		{
			// Cannot be tested so it shall fail
			status = TestStatus.UNTESTABLE;
			thrown = e;
		}
		
		// Test failure
		catch (Throwable t)
		{
			// Errors are bad, stop testing and just fail here
			if (t instanceof Error)
				throw (Error)t;
			
			// The test parameter is not valid, so whoops!
			if (t instanceof InvalidTestException)
			{
				// Exception was thrown
				status = TestStatus.TEST_EXCEPTION;
				thrown = t;
			}
			
			// Normal test which threw a possibly valid exception
			else
			{
				runresult.setReturnValue(new __ExceptionThrown__());
				runresult.setThrownValue((thrown = t));
			}
		}
		
		// If the status is not yet known, do a comparison with the results to
		// see if there is a match
		TestResult result = runresult.build();
		if (status == null)
			status = (expected.isSatisfiedBy(result) ? TestStatus.SUCCESS :
				TestStatus.FAILED);
		
		// Store the status of the test that just ran
		this._status = status;
		
		// Return the result
		return new TestExecution(status, self, expected, result, thrown);
	}
	
	/**
	 * Runs the specified test using the given main arguments as if it
	 * were a program to be run, if any.
	 *
	 * This method will handle dead-locks and otherwise.
	 *
	 * @param __mainargs The main arguments to the test which allow parameters
	 * to be used accordingly.
	 * @since 2018/10/06
	 */
	public final void runTest(String... __mainargs)
	{
		if (__mainargs == null)
			__mainargs = new String[0];
		
		// Set a watchdog in case our test takes a very long time to execute
		DeadlockTimeout dtimeout = new DeadlockTimeout();
		dtimeout.start();
		










		// Remember the old output stream because it will be replaced with
		// stderr, this way when tests run they do not inadvertently output
		// to standard output. Standard output being printed to will mess up
		// the test results generated at the end of tac-runner
		PrintStream oldout = System.out;
		
		// Replace standard output from the test!

		TestExecution execution;


		try
		{
			// Set the output stream to standard error as noted above
			try
			{
				System.setOut(System.err);
			}
			catch (SecurityException e)
			{
				// Ignore, oh well
			}
			
			// Execute the test



			execution = this.runExecution(__mainargs);
































		}
		finally
		{
			// Restore the old output stream
			try
			{
				System.setOut(oldout);
			}
			catch (SecurityException e)
			{
				// Ignore, things happen
			}
		}
		




























		// Dump test result
		try
		{
			if (Boolean.getBoolean(__CoreTest__.DUMP_ACTUAL))
				execution.result.writeAsManifest(System.err);
		}
		catch (IOException|SecurityException e)
		{
			// Ignore, could not dump it?
		}
		
		// Set output according to the status
		execution.print(System.err);
		
		// Stop the watchdog so we do not exit
		dtimeout.expire();
	}
	
	/**
	 * Stores a secondary value which can be additionally used as test
246
247
248
249
250
251
252

253
254
255
256
257
258
259
	
	/**
	 * Runs the MIDlet, parses input test data then runs the test performing
	 * any test work that is needed.
	 *
	 * @since 2018/10/06
	 */

	protected final void startApp()
	{
		// Just forward to run, no main arguments are used at all
		this.runTest((String[])null);
		
		// There is just a single program, so exit with the test status
		System.exit(this._status.ordinal());







>







303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
	
	/**
	 * Runs the MIDlet, parses input test data then runs the test performing
	 * any test work that is needed.
	 *
	 * @since 2018/10/06
	 */
	@Override
	protected final void startApp()
	{
		// Just forward to run, no main arguments are used at all
		this.runTest((String[])null);
		
		// There is just a single program, so exit with the test status
		System.exit(this._status.ordinal());

Name change from test/libs/tac/net/multiphasicapps/tac/__ExceptionThrown__.java to modules/tac/src/main/java/net/multiphasicapps/tac/__ExceptionThrown__.java.

Name change from test/libs/tac/net/multiphasicapps/tac/__NoExceptionThrown__.java to modules/tac/src/main/java/net/multiphasicapps/tac/__NoExceptionThrown__.java.

Name change from test/libs/tac/net/multiphasicapps/tac/__NoResult__.java to modules/tac/src/main/java/net/multiphasicapps/tac/__NoResult__.java.

Name change from test/libs/tac/net/multiphasicapps/tac/__UndefinedResult__.java to modules/tac/src/main/java/net/multiphasicapps/tac/__UndefinedResult__.java.

Name change from test/libs/tac/net/multiphasicapps/tac/package-info.java to modules/tac/src/main/java/net/multiphasicapps/tac/package-info.java.

Added modules/tac/src/main/java/org/testng/annotations/CustomAttribute.java.











































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
package org.testng.annotations;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * Custom attributes for a test.
 *
 * @since 2020/02/26
 */
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD, ElementType.TYPE})
public @interface CustomAttribute {
	/** @retrun The name of the attribute. */
	String name();
	
	/** @return The values of the attributes. */
	String[] values() default {};
}

Added modules/tac/src/main/java/org/testng/annotations/Test.java.













































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
package org.testng.annotations;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import org.testng.internal.annotations.DisabledRetryAnalyzer;

/**
 * Used to trick TestNG that this is a test to run.
 *
 * @since 2020/02/26
 */
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD, ElementType.TYPE})
public @interface Test
{
	/** @return Always run the class? */
	boolean alwaysRun() default false;
	
	/** @return Custom attributes. */
	CustomAttribute[] attributes() default {};
	
	/** @return Data provider. */
	String dataProvider() default "";
	
	/** @return The class for the data provider. */
	Class<?> dataProviderClass() default Object.class;
	
	/** @return The groups this depends on. */
	String[] dependsOnGroups() default {};
	
	/** @return The methods this depends on. */
	String[] dependsOnMethods() default {};
	
	/** @return The test description. */
	String description() default "";
	
	/** @return Enabled by default. */
	boolean enabled() default true;
	
	/** @return The expected excpetions. */
	Class[] expectedExceptions() default {};
	
	/** @return Regular expression for the expected exception message. */
	String expectedExceptionsMessageRegExp() default ".*";
	
	/** @return Groups the test is under. */
	String[] groups() default {};
	
	/** @return Are missing dependencies ignored? */
	boolean ignoreMissingDependencies() default false;
	
	/** @return The number of times to invoke the method. */
	int invocationCount() default 1;
	
	/** @return How long before the invocation will time out. */
	long invocationTimeOut() default 0;
	
	/** @return The test priority. */
	int priority() default 0;
	
	/** @return Are the tests single threaded? */
	boolean singleThreaded() default false;
	
	/** @return Skip methods that fail to be invoked? */
	boolean skipFailedInvocations() default false;
	
	/** @return The expected percentage of passing tests. */
	int successPercentage() default 100;
	
	/** @return The name of the suite. */
	String suiteName() default "";
	
	/** @return THe test name. */
	String testName() default "";
	
	/** @return The size of the thread pool. */
	int threadPoolSize() default 0;
	
	/** @return Maximum amount of time the test should take. */
	long timeOut() default 0;
	
	/** @return How tests should be ran. */
	Class<?> retryAnalyzer() default DisabledRetryAnalyzer.class;
}

Name change from test/libs/tac.test/DoBiConsumer.java to modules/tac/src/test/java/DoBiConsumer.java.

Name change from test/libs/tac.test/DoBiFunction.java to modules/tac/src/test/java/DoBiFunction.java.

Name change from test/libs/tac.test/DoConsumer.java to modules/tac/src/test/java/DoConsumer.java.

Name change from test/libs/tac.test/DoException.java to modules/tac/src/test/java/DoException.java.

Name change from test/libs/tac.test/DoFunction.java to modules/tac/src/test/java/DoFunction.java.

Name change from test/libs/tac.test/DoRunnable.java to modules/tac/src/test/java/DoRunnable.java.

Name change from test/libs/tac.test/DoSupplier.java to modules/tac/src/test/java/DoSupplier.java.

Name change from test/libs/tac.test/DoBiConsumer.in to modules/tac/src/test/resources/DoBiConsumer.in.

Name change from test/libs/tac.test/DoBiFunction.in to modules/tac/src/test/resources/DoBiFunction.in.

Name change from test/libs/tac.test/DoConsumer.in to modules/tac/src/test/resources/DoConsumer.in.

Name change from test/libs/tac.test/DoException.in to modules/tac/src/test/resources/DoException.in.

Name change from test/libs/tac.test/DoFunction.in to modules/tac/src/test/resources/DoFunction.in.

Name change from test/libs/tac.test/DoRunnable.in to modules/tac/src/test/resources/DoRunnable.in.

Name change from test/libs/tac.test/DoSupplier.in to modules/tac/src/test/resources/DoSupplier.in.

Added modules/tool-classfile/build.gradle.









































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import cc.squirreljme.plugin.swm.JavaMEMidletType

description = "This contains support for reading class files."
version = rootProject.version

squirreljme
{
	javaDocErrorCode = "JC"
	swmType = JavaMEMidletType.LIBRARY
	swmName = "Class File Reader"
	swmVendor = "Stephanie Gawroriski"
}

dependencies
{
	implementation project(":modules:cldc-compact")

	implementation project(":modules:collections")
	implementation project(":modules:io")
}

Name change from runt/libs/tool-classfile/dev/shadowtail/classfile/mini/DualPoolEncodeResult.java to modules/tool-classfile/src/main/java/dev/shadowtail/classfile/mini/DualPoolEncodeResult.java.

Name change from runt/libs/tool-classfile/dev/shadowtail/classfile/mini/DualPoolEncoder.java to modules/tool-classfile/src/main/java/dev/shadowtail/classfile/mini/DualPoolEncoder.java.

21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import dev.shadowtail.classfile.pool.FieldAccessType;
import dev.shadowtail.classfile.pool.InvokeType;
import dev.shadowtail.classfile.pool.InvokedMethod;
import dev.shadowtail.classfile.pool.MethodIndex;
import dev.shadowtail.classfile.pool.NotedString;
import dev.shadowtail.classfile.pool.UsedString;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;
import net.multiphasicapps.classfile.ClassName;
import net.multiphasicapps.classfile.ClassNames;
import net.multiphasicapps.classfile.InvalidClassFormatException;
import net.multiphasicapps.classfile.MethodDescriptor;
import net.multiphasicapps.classfile.MethodHandle;
import net.multiphasicapps.classfile.MethodName;
import net.multiphasicapps.io.TableSectionOutputStream;

/**
 * This contains the encoder and decoder for dual pools.
 *
 * @since 2019/07/17
 */







<

<

<







<
<







21
22
23
24
25
26
27

28

29

30
31
32
33
34
35
36


37
38
39
40
41
42
43
import dev.shadowtail.classfile.pool.FieldAccessType;
import dev.shadowtail.classfile.pool.InvokeType;
import dev.shadowtail.classfile.pool.InvokedMethod;
import dev.shadowtail.classfile.pool.MethodIndex;
import dev.shadowtail.classfile.pool.NotedString;
import dev.shadowtail.classfile.pool.UsedString;
import java.io.ByteArrayInputStream;

import java.io.DataInputStream;

import java.io.IOException;

import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;
import net.multiphasicapps.classfile.ClassName;
import net.multiphasicapps.classfile.ClassNames;
import net.multiphasicapps.classfile.InvalidClassFormatException;
import net.multiphasicapps.classfile.MethodDescriptor;


import net.multiphasicapps.io.TableSectionOutputStream;

/**
 * This contains the encoder and decoder for dual pools.
 *
 * @since 2019/07/17
 */

Name change from runt/libs/tool-classfile/dev/shadowtail/classfile/mini/MinimizedClassFile.java to modules/tool-classfile/src/main/java/dev/shadowtail/classfile/mini/MinimizedClassFile.java.

9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// ---------------------------------------------------------------------------

package dev.shadowtail.classfile.mini;

import dev.shadowtail.classfile.pool.DualClassRuntimePool;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
import java.io.EOFException;
import java.io.IOException;
import java.io.InputStream;
import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import net.multiphasicapps.classfile.ClassFlags;
import net.multiphasicapps.classfile.ClassName;







<







9
10
11
12
13
14
15

16
17
18
19
20
21
22
// ---------------------------------------------------------------------------

package dev.shadowtail.classfile.mini;

import dev.shadowtail.classfile.pool.DualClassRuntimePool;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;

import java.io.EOFException;
import java.io.IOException;
import java.io.InputStream;
import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import net.multiphasicapps.classfile.ClassFlags;
import net.multiphasicapps.classfile.ClassName;

Name change from runt/libs/tool-classfile/dev/shadowtail/classfile/mini/MinimizedClassHeader.java to modules/tool-classfile/src/main/java/dev/shadowtail/classfile/mini/MinimizedClassHeader.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package dev.shadowtail.classfile.mini;

import dev.shadowtail.classfile.xlate.DataType;
import java.io.ByteArrayInputStream;
import java.io.DataInputStream;
import java.io.IOException;
import java.io.InputStream;
import net.multiphasicapps.classfile.InvalidClassFormatException;

/**
 * This represents the raw minimized header of a class.












<







1
2
3
4
5
6
7
8
9
10
11
12

13
14
15
16
17
18
19
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package dev.shadowtail.classfile.mini;

import dev.shadowtail.classfile.xlate.DataType;

import java.io.DataInputStream;
import java.io.IOException;
import java.io.InputStream;
import net.multiphasicapps.classfile.InvalidClassFormatException;

/**
 * This represents the raw minimized header of a class.
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
	
	/** The size of the header without the magic number. */
	public static final int HEADER_SIZE_WITHOUT_MAGIC =
		108;
	
	/** The size of the header with the magic number. */
	public static final int HEADER_SIZE_WITH_MAGIC =
		HEADER_SIZE_WITHOUT_MAGIC + 4;
	
	/** Unused A. */
	public final int unuseda;
	
	/** The index of the method which is __start. */
	public final int startmethodindex;
	







|







32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
	
	/** The size of the header without the magic number. */
	public static final int HEADER_SIZE_WITHOUT_MAGIC =
		108;
	
	/** The size of the header with the magic number. */
	public static final int HEADER_SIZE_WITH_MAGIC =
		MinimizedClassHeader.HEADER_SIZE_WITHOUT_MAGIC + 4;
	
	/** Unused A. */
	public final int unuseda;
	
	/** The index of the method which is __start. */
	public final int startmethodindex;
	
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
			throw new NullPointerException("NARG");
		
		DataInputStream dis = new DataInputStream(__is);
		
		// {@squirreljme.error JC04 Invalid minimized class magic number.
		// (The magic number)}
		int readmagic;
		if (MAGIC_NUMBER != (readmagic = dis.readInt()))
			throw new InvalidClassFormatException(String.format("JC04 %08x",
				readmagic));
		
		// Read in all the data
		return new MinimizedClassHeader(
			// Unused
			/* unuseda */ dis.readUnsignedShort(),







|







243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
			throw new NullPointerException("NARG");
		
		DataInputStream dis = new DataInputStream(__is);
		
		// {@squirreljme.error JC04 Invalid minimized class magic number.
		// (The magic number)}
		int readmagic;
		if (MinimizedClassHeader.MAGIC_NUMBER != (readmagic = dis.readInt()))
			throw new InvalidClassFormatException(String.format("JC04 %08x",
				readmagic));
		
		// Read in all the data
		return new MinimizedClassHeader(
			// Unused
			/* unuseda */ dis.readUnsignedShort(),

Name change from runt/libs/tool-classfile/dev/shadowtail/classfile/mini/MinimizedField.java to modules/tool-classfile/src/main/java/dev/shadowtail/classfile/mini/MinimizedField.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package dev.shadowtail.classfile.mini;

import dev.shadowtail.classfile.xlate.DataType;
import dev.shadowtail.classfile.pool.DualClassRuntimePool;
import java.io.ByteArrayInputStream;
import java.io.DataInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import net.multiphasicapps.classfile.ClassName;
import net.multiphasicapps.classfile.FieldDescriptor;
import net.multiphasicapps.classfile.FieldFlags;
import net.multiphasicapps.classfile.FieldName;
import net.multiphasicapps.classfile.FieldNameAndType;












|
|



<







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

18
19
20
21
22
23
24
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package dev.shadowtail.classfile.mini;

import dev.shadowtail.classfile.pool.DualClassRuntimePool;
import dev.shadowtail.classfile.xlate.DataType;
import java.io.ByteArrayInputStream;
import java.io.DataInputStream;
import java.io.IOException;

import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import net.multiphasicapps.classfile.ClassName;
import net.multiphasicapps.classfile.FieldDescriptor;
import net.multiphasicapps.classfile.FieldFlags;
import net.multiphasicapps.classfile.FieldName;
import net.multiphasicapps.classfile.FieldNameAndType;

Name change from runt/libs/tool-classfile/dev/shadowtail/classfile/mini/MinimizedMethod.java to modules/tool-classfile/src/main/java/dev/shadowtail/classfile/mini/MinimizedMethod.java.

10
11
12
13
14
15
16
17
18
19
20
21
22
23
24

package dev.shadowtail.classfile.mini;

import dev.shadowtail.classfile.pool.DualClassRuntimePool;
import java.io.ByteArrayInputStream;
import java.io.DataInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import net.multiphasicapps.classfile.InvalidClassFormatException;
import net.multiphasicapps.classfile.MethodDescriptor;
import net.multiphasicapps.classfile.MethodFlags;
import net.multiphasicapps.classfile.MethodName;
import net.multiphasicapps.classfile.MethodNameAndType;







<







10
11
12
13
14
15
16

17
18
19
20
21
22
23

package dev.shadowtail.classfile.mini;

import dev.shadowtail.classfile.pool.DualClassRuntimePool;
import java.io.ByteArrayInputStream;
import java.io.DataInputStream;
import java.io.IOException;

import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import net.multiphasicapps.classfile.InvalidClassFormatException;
import net.multiphasicapps.classfile.MethodDescriptor;
import net.multiphasicapps.classfile.MethodFlags;
import net.multiphasicapps.classfile.MethodName;
import net.multiphasicapps.classfile.MethodNameAndType;

Name change from runt/libs/tool-classfile/dev/shadowtail/classfile/mini/MinimizedPool.java to modules/tool-classfile/src/main/java/dev/shadowtail/classfile/mini/MinimizedPool.java.

16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import dev.shadowtail.classfile.pool.InvokeType;
import dev.shadowtail.classfile.pool.InvokedMethod;
import dev.shadowtail.classfile.pool.MethodIndex;
import dev.shadowtail.classfile.pool.UsedString;
import java.io.ByteArrayInputStream;
import java.io.DataInputStream;
import java.io.IOException;
import java.io.InputStream;
import net.multiphasicapps.classfile.InvalidClassFormatException;
import net.multiphasicapps.classfile.ClassName;
import net.multiphasicapps.classfile.ClassNames;
import net.multiphasicapps.classfile.FieldDescriptor;
import net.multiphasicapps.classfile.FieldName;
import net.multiphasicapps.classfile.FieldReference;
import net.multiphasicapps.classfile.MethodDescriptor;
import net.multiphasicapps.classfile.MethodHandle;
import net.multiphasicapps.classfile.MethodName;

/**
 * This represents the minimized constant pool.
 *







<
<


|
|
|







16
17
18
19
20
21
22


23
24
25
26
27
28
29
30
31
32
33
34
import dev.shadowtail.classfile.pool.InvokeType;
import dev.shadowtail.classfile.pool.InvokedMethod;
import dev.shadowtail.classfile.pool.MethodIndex;
import dev.shadowtail.classfile.pool.UsedString;
import java.io.ByteArrayInputStream;
import java.io.DataInputStream;
import java.io.IOException;


import net.multiphasicapps.classfile.ClassName;
import net.multiphasicapps.classfile.ClassNames;
import net.multiphasicapps.classfile.FieldName;
import net.multiphasicapps.classfile.FieldReference;
import net.multiphasicapps.classfile.InvalidClassFormatException;
import net.multiphasicapps.classfile.MethodDescriptor;
import net.multiphasicapps.classfile.MethodHandle;
import net.multiphasicapps.classfile.MethodName;

/**
 * This represents the minimized constant pool.
 *

Name change from runt/libs/tool-classfile/dev/shadowtail/classfile/mini/MinimizedPoolBuilder.java to modules/tool-classfile/src/main/java/dev/shadowtail/classfile/mini/MinimizedPoolBuilder.java.

8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package dev.shadowtail.classfile.mini;

import dev.shadowtail.classfile.pool.AccessedField;
import dev.shadowtail.classfile.pool.ClassPool;
import dev.shadowtail.classfile.pool.FieldAccessTime;
import dev.shadowtail.classfile.pool.FieldAccessType;
import dev.shadowtail.classfile.pool.InvokeType;
import dev.shadowtail.classfile.pool.InvokedMethod;
import dev.shadowtail.classfile.pool.MethodIndex;
import dev.shadowtail.classfile.pool.UsedString;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import net.multiphasicapps.classfile.ClassName;
import net.multiphasicapps.classfile.ClassNames;
import net.multiphasicapps.classfile.FieldDescriptor;
import net.multiphasicapps.classfile.FieldName;
import net.multiphasicapps.classfile.FieldReference;
import net.multiphasicapps.classfile.MethodDescriptor;
import net.multiphasicapps.classfile.MethodHandle;
import net.multiphasicapps.classfile.MethodName;
import net.multiphasicapps.collections.IntegerList;
import net.multiphasicapps.collections.UnmodifiableList;

/**
 * This class is used to build the constant pool for a minimized class.
 *
 * @since 2019/03/11
 */
@Deprecated







<
<
<






<

<






<



<
<
<







8
9
10
11
12
13
14



15
16
17
18
19
20

21

22
23
24
25
26
27

28
29
30



31
32
33
34
35
36
37
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package dev.shadowtail.classfile.mini;

import dev.shadowtail.classfile.pool.AccessedField;
import dev.shadowtail.classfile.pool.ClassPool;



import dev.shadowtail.classfile.pool.InvokedMethod;
import dev.shadowtail.classfile.pool.MethodIndex;
import dev.shadowtail.classfile.pool.UsedString;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.io.IOException;

import java.util.ArrayList;

import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import net.multiphasicapps.classfile.ClassName;
import net.multiphasicapps.classfile.ClassNames;
import net.multiphasicapps.classfile.FieldDescriptor;

import net.multiphasicapps.classfile.FieldReference;
import net.multiphasicapps.classfile.MethodDescriptor;
import net.multiphasicapps.classfile.MethodHandle;




/**
 * This class is used to build the constant pool for a minimized class.
 *
 * @since 2019/03/11
 */
@Deprecated

Name change from runt/libs/tool-classfile/dev/shadowtail/classfile/mini/MinimizedPoolEntryType.java to modules/tool-classfile/src/main/java/dev/shadowtail/classfile/mini/MinimizedPoolEntryType.java.

125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
	 * @since 2019/04/17
	 */
	public static final MinimizedPoolEntryType of(int __i)
		throws IllegalArgumentException
	{
		switch (__i)
		{
			case 0:		return NULL;
			case 1:		return STRING;
			case 2:		return CLASS_NAME;
			case 3:		return CLASS_NAMES;
			case 4:		return CLASS_POOL;
			case 5:		return ACCESSED_FIELD;
			case 6:		return INVOKED_METHOD;
			case 7:		return METHOD_DESCRIPTOR;
			case 8:		return INTEGER;
			case 9:		return FLOAT;
			case 10:	return LONG;
			case 11:	return DOUBLE;
			case 12:	return USED_STRING;
			case 13:	return METHOD_INDEX;
			case 14:	return CLASS_INFO_POINTER;
			case 15:	return NOTED_STRING;
		}
		
		// {@squirreljme.error JC0e Unknown pool type. (The type)}
		throw new IllegalArgumentException("JC0e " + __i);
	}
	
	/**







|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|







125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
	 * @since 2019/04/17
	 */
	public static final MinimizedPoolEntryType of(int __i)
		throws IllegalArgumentException
	{
		switch (__i)
		{
			case 0:		return MinimizedPoolEntryType.NULL;
			case 1:		return MinimizedPoolEntryType.STRING;
			case 2:		return MinimizedPoolEntryType.CLASS_NAME;
			case 3:		return MinimizedPoolEntryType.CLASS_NAMES;
			case 4:		return MinimizedPoolEntryType.CLASS_POOL;
			case 5:		return MinimizedPoolEntryType.ACCESSED_FIELD;
			case 6:		return MinimizedPoolEntryType.INVOKED_METHOD;
			case 7:		return MinimizedPoolEntryType.METHOD_DESCRIPTOR;
			case 8:		return MinimizedPoolEntryType.INTEGER;
			case 9:		return MinimizedPoolEntryType.FLOAT;
			case 10:	return MinimizedPoolEntryType.LONG;
			case 11:	return MinimizedPoolEntryType.DOUBLE;
			case 12:	return MinimizedPoolEntryType.USED_STRING;
			case 13:	return MinimizedPoolEntryType.METHOD_INDEX;
			case 14:	return MinimizedPoolEntryType.CLASS_INFO_POINTER;
			case 15:	return MinimizedPoolEntryType.NOTED_STRING;
		}
		
		// {@squirreljme.error JC0e Unknown pool type. (The type)}
		throw new IllegalArgumentException("JC0e " + __i);
	}
	
	/**
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
		if (__cl == null)
			throw new NullPointerException("NARG");
		
		// Easier to do it just by name
		switch (__cl.getName())
		{
			case "java.lang.String":
				return STRING;
			case "java.lang.Integer":
				return INTEGER;
			case "java.lang.Float":
				return FLOAT;
			case "java.lang.Long":
				return LONG;
			case "java.lang.Double":
				return DOUBLE;
			case "dev.shadowtail.classfile.pool.AccessedField":
				return ACCESSED_FIELD;
			case "dev.shadowtail.classfile.pool.ClassPool":
				return CLASS_POOL;
			case "dev.shadowtail.classfile.pool.InvokedMethod":
				return INVOKED_METHOD;
			case "net.multiphasicapps.classfile.ClassName":
				return CLASS_NAME;
			case "net.multiphasicapps.classfile.ClassNames":
				return CLASS_NAMES;
			case "List net.multiphasicapps.classfile.ClassName":
				return CLASS_NAMES;
			case "net.multiphasicapps.classfile.MethodDescriptor":
				return METHOD_DESCRIPTOR;
			case "dev.shadowtail.classfile.pool.UsedString":
				return USED_STRING;
			case "dev.shadowtail.classfile.pool.MethodIndex":
				return METHOD_INDEX;
			case "dev.shadowtail.classfile.pool.ClassInfoPointer":
				return CLASS_INFO_POINTER;
			case "dev.shadowtail.classfile.pool.NotedString":
				return NOTED_STRING;
			case "dev.shadowtail.classfile.pool.NullPoolEntry":
				return NULL;
		}
		
		// {@squirreljme.error JC0f Class does not map to a pool entry
		// type. (The class)}
		throw new IllegalArgumentException("JC0f " + __cl);
	}
}








|

|

|

|

|

|

|

|

|

|

|

|

|

|

|

|

|








166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
		if (__cl == null)
			throw new NullPointerException("NARG");
		
		// Easier to do it just by name
		switch (__cl.getName())
		{
			case "java.lang.String":
				return MinimizedPoolEntryType.STRING;
			case "java.lang.Integer":
				return MinimizedPoolEntryType.INTEGER;
			case "java.lang.Float":
				return MinimizedPoolEntryType.FLOAT;
			case "java.lang.Long":
				return MinimizedPoolEntryType.LONG;
			case "java.lang.Double":
				return MinimizedPoolEntryType.DOUBLE;
			case "dev.shadowtail.classfile.pool.AccessedField":
				return MinimizedPoolEntryType.ACCESSED_FIELD;
			case "dev.shadowtail.classfile.pool.ClassPool":
				return MinimizedPoolEntryType.CLASS_POOL;
			case "dev.shadowtail.classfile.pool.InvokedMethod":
				return MinimizedPoolEntryType.INVOKED_METHOD;
			case "net.multiphasicapps.classfile.ClassName":
				return MinimizedPoolEntryType.CLASS_NAME;
			case "net.multiphasicapps.classfile.ClassNames":
				return MinimizedPoolEntryType.CLASS_NAMES;
			case "List net.multiphasicapps.classfile.ClassName":
				return MinimizedPoolEntryType.CLASS_NAMES;
			case "net.multiphasicapps.classfile.MethodDescriptor":
				return MinimizedPoolEntryType.METHOD_DESCRIPTOR;
			case "dev.shadowtail.classfile.pool.UsedString":
				return MinimizedPoolEntryType.USED_STRING;
			case "dev.shadowtail.classfile.pool.MethodIndex":
				return MinimizedPoolEntryType.METHOD_INDEX;
			case "dev.shadowtail.classfile.pool.ClassInfoPointer":
				return MinimizedPoolEntryType.CLASS_INFO_POINTER;
			case "dev.shadowtail.classfile.pool.NotedString":
				return MinimizedPoolEntryType.NOTED_STRING;
			case "dev.shadowtail.classfile.pool.NullPoolEntry":
				return MinimizedPoolEntryType.NULL;
		}
		
		// {@squirreljme.error JC0f Class does not map to a pool entry
		// type. (The class)}
		throw new IllegalArgumentException("JC0f " + __cl);
	}
}

Name change from runt/libs/tool-classfile/dev/shadowtail/classfile/mini/Minimizer.java to modules/tool-classfile/src/main/java/dev/shadowtail/classfile/mini/Minimizer.java.

9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// ---------------------------------------------------------------------------

package dev.shadowtail.classfile.mini;

import dev.shadowtail.classfile.nncc.ArgumentFormat;
import dev.shadowtail.classfile.nncc.NativeCode;
import dev.shadowtail.classfile.nncc.NativeInstruction;
import dev.shadowtail.classfile.nncc.NativeInstructionType;
import dev.shadowtail.classfile.nncc.RegisterList;
import dev.shadowtail.classfile.pool.ClassPool;
import dev.shadowtail.classfile.pool.DualClassRuntimePoolBuilder;
import dev.shadowtail.classfile.xlate.CompareType;
import dev.shadowtail.classfile.xlate.DataType;
import dev.shadowtail.classfile.xlate.MathType;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.io.InputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Random;
import net.multiphasicapps.classfile.ClassFile;
import net.multiphasicapps.classfile.ClassName;
import net.multiphasicapps.classfile.ConstantValue;
import net.multiphasicapps.classfile.Field;
import net.multiphasicapps.classfile.FieldDescriptor;
import net.multiphasicapps.classfile.FieldFlags;
import net.multiphasicapps.classfile.FieldName;
import net.multiphasicapps.classfile.InstructionJumpTarget;
import net.multiphasicapps.classfile.InvalidClassFormatException;
import net.multiphasicapps.classfile.Method;
import net.multiphasicapps.classfile.MethodDescriptor;
import net.multiphasicapps.classfile.MethodFlags;
import net.multiphasicapps.classfile.MethodName;
import net.multiphasicapps.classfile.PrimitiveType;
import net.multiphasicapps.io.TableSectionOutputStream;

/**
 * This takes an input class file and translates it to the minimized format
 * which is easier to use.
 *







<

<

<

<
<


<




<


<











<

<







9
10
11
12
13
14
15

16

17

18


19
20

21
22
23
24

25
26

27
28
29
30
31
32
33
34
35
36
37

38

39
40
41
42
43
44
45
// ---------------------------------------------------------------------------

package dev.shadowtail.classfile.mini;

import dev.shadowtail.classfile.nncc.ArgumentFormat;
import dev.shadowtail.classfile.nncc.NativeCode;
import dev.shadowtail.classfile.nncc.NativeInstruction;

import dev.shadowtail.classfile.nncc.RegisterList;

import dev.shadowtail.classfile.pool.DualClassRuntimePoolBuilder;

import dev.shadowtail.classfile.xlate.DataType;


import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;

import java.io.IOException;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.Collections;

import java.util.LinkedList;
import java.util.List;

import java.util.Random;
import net.multiphasicapps.classfile.ClassFile;
import net.multiphasicapps.classfile.ClassName;
import net.multiphasicapps.classfile.ConstantValue;
import net.multiphasicapps.classfile.Field;
import net.multiphasicapps.classfile.FieldDescriptor;
import net.multiphasicapps.classfile.FieldFlags;
import net.multiphasicapps.classfile.FieldName;
import net.multiphasicapps.classfile.InstructionJumpTarget;
import net.multiphasicapps.classfile.InvalidClassFormatException;
import net.multiphasicapps.classfile.Method;

import net.multiphasicapps.classfile.MethodFlags;

import net.multiphasicapps.classfile.PrimitiveType;
import net.multiphasicapps.io.TableSectionOutputStream;

/**
 * This takes an input class file and translates it to the minimized format
 * which is easier to use.
 *
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
	 * @return The generated UUID.
	 * @since 2019/04/27
	 */
	public static final long generateUUID()
	{
		// Hopefully this seed is good enough?
		Random rand = new Random(System.nanoTime() +
			(System.currentTimeMillis() << 24) + (++_UUID_COUNTER));
		
		// Skip a random amount of values to run it for a bit
		for (int i = 0, n = rand.nextInt(32 + rand.nextInt(32)); i < n; i++)
			rand.nextInt();
		
		// Just use the next long value
		return rand.nextLong();







|







647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
	 * @return The generated UUID.
	 * @since 2019/04/27
	 */
	public static final long generateUUID()
	{
		// Hopefully this seed is good enough?
		Random rand = new Random(System.nanoTime() +
			(System.currentTimeMillis() << 24) + (++Minimizer._UUID_COUNTER));
		
		// Skip a random amount of values to run it for a bit
		for (int i = 0, n = rand.nextInt(32 + rand.nextInt(32)); i < n; i++)
			rand.nextInt();
		
		// Just use the next long value
		return rand.nextLong();

Name change from runt/libs/tool-classfile/dev/shadowtail/classfile/mini/__Jump__.java to modules/tool-classfile/src/main/java/dev/shadowtail/classfile/mini/__Jump__.java.

Name change from runt/libs/tool-classfile/dev/shadowtail/classfile/mini/__MinimizerFieldSort__.java to modules/tool-classfile/src/main/java/dev/shadowtail/classfile/mini/__MinimizerFieldSort__.java.

Name change from runt/libs/tool-classfile/dev/shadowtail/classfile/mini/__TempFields__.java to modules/tool-classfile/src/main/java/dev/shadowtail/classfile/mini/__TempFields__.java.

10
11
12
13
14
15
16
17
18
19
20
21
22
23
24

package dev.shadowtail.classfile.mini;

import dev.shadowtail.classfile.pool.DualClassRuntimePoolBuilder;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;
import net.multiphasicapps.io.TableSectionOutputStream;

/**
 * Stores temporary field data as it is processed.
 *







<







10
11
12
13
14
15
16

17
18
19
20
21
22
23

package dev.shadowtail.classfile.mini;

import dev.shadowtail.classfile.pool.DualClassRuntimePoolBuilder;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.io.IOException;

import java.util.ArrayList;
import java.util.List;
import net.multiphasicapps.io.TableSectionOutputStream;

/**
 * Stores temporary field data as it is processed.
 *

Name change from runt/libs/tool-classfile/dev/shadowtail/classfile/mini/__TempMethods__.java to modules/tool-classfile/src/main/java/dev/shadowtail/classfile/mini/__TempMethods__.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package dev.shadowtail.classfile.mini;

import dev.shadowtail.classfile.pool.DualClassRuntimePoolBuilder;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;
import net.multiphasicapps.classfile.ClassName;
import net.multiphasicapps.classfile.InvalidClassFormatException;
import net.multiphasicapps.io.TableSectionOutputStream;

/**













<
<

<







1
2
3
4
5
6
7
8
9
10
11
12
13


14

15
16
17
18
19
20
21
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package dev.shadowtail.classfile.mini;

import dev.shadowtail.classfile.pool.DualClassRuntimePoolBuilder;


import java.io.IOException;

import java.util.ArrayList;
import java.util.List;
import net.multiphasicapps.classfile.ClassName;
import net.multiphasicapps.classfile.InvalidClassFormatException;
import net.multiphasicapps.io.TableSectionOutputStream;

/**

Name change from runt/libs/tool-classfile/dev/shadowtail/classfile/mini/package-info.java to modules/tool-classfile/src/main/java/dev/shadowtail/classfile/mini/package-info.java.

Name change from runt/libs/tool-classfile/dev/shadowtail/classfile/nncc/ArgumentFormat.java to modules/tool-classfile/src/main/java/dev/shadowtail/classfile/nncc/ArgumentFormat.java.

Name change from runt/libs/tool-classfile/dev/shadowtail/classfile/nncc/ClassAndLabel.java to modules/tool-classfile/src/main/java/dev/shadowtail/classfile/nncc/ClassAndLabel.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package dev.shadowtail.classfile.nncc;

import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import net.multiphasicapps.classfile.ClassName;

/**
 * This stores a class and a label.
 *
 * @since 2019/04/13
 */












<







1
2
3
4
5
6
7
8
9
10
11
12

13
14
15
16
17
18
19
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package dev.shadowtail.classfile.nncc;

import java.lang.ref.Reference;

import net.multiphasicapps.classfile.ClassName;

/**
 * This stores a class and a label.
 *
 * @since 2019/04/13
 */

Name change from runt/libs/tool-classfile/dev/shadowtail/classfile/nncc/ClassStackAndLabel.java to modules/tool-classfile/src/main/java/dev/shadowtail/classfile/nncc/ClassStackAndLabel.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package dev.shadowtail.classfile.nncc;

import dev.shadowtail.classfile.xlate.JavaStackState;
import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import net.multiphasicapps.classfile.ClassName;

/**
 * This stores a class, a stack state, and a label.
 *
 * @since 2019/04/11
 */













<







1
2
3
4
5
6
7
8
9
10
11
12
13

14
15
16
17
18
19
20
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package dev.shadowtail.classfile.nncc;

import dev.shadowtail.classfile.xlate.JavaStackState;
import java.lang.ref.Reference;

import net.multiphasicapps.classfile.ClassName;

/**
 * This stores a class, a stack state, and a label.
 *
 * @since 2019/04/11
 */

Name change from runt/libs/tool-classfile/dev/shadowtail/classfile/nncc/EnqueueAndLabel.java to modules/tool-classfile/src/main/java/dev/shadowtail/classfile/nncc/EnqueueAndLabel.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package dev.shadowtail.classfile.nncc;

import dev.shadowtail.classfile.xlate.JavaStackEnqueueList;
import java.lang.ref.Reference;
import java.lang.ref.WeakReference;

/**
 * This contains an enqueue and a label.
 *
 * @since 2019/04/24
 */
public final class EnqueueAndLabel













<







1
2
3
4
5
6
7
8
9
10
11
12
13

14
15
16
17
18
19
20
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package dev.shadowtail.classfile.nncc;

import dev.shadowtail.classfile.xlate.JavaStackEnqueueList;
import java.lang.ref.Reference;


/**
 * This contains an enqueue and a label.
 *
 * @since 2019/04/24
 */
public final class EnqueueAndLabel

Name change from runt/libs/tool-classfile/dev/shadowtail/classfile/nncc/InvalidInstructionException.java to modules/tool-classfile/src/main/java/dev/shadowtail/classfile/nncc/InvalidInstructionException.java.

Name change from runt/libs/tool-classfile/dev/shadowtail/classfile/nncc/NativeCode.java to modules/tool-classfile/src/main/java/dev/shadowtail/classfile/nncc/NativeCode.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package dev.shadowtail.classfile.nncc;

import dev.shadowtail.classfile.nncc.NearNativeByteCodeHandler;
import dev.shadowtail.classfile.xlate.ByteCodeProcessor;
import java.util.Collection;
import java.util.Iterator;
import net.multiphasicapps.classfile.ByteCode;
import net.multiphasicapps.collections.UnmodifiableIterator;

/**
 * This is similar to {@link ByteCode} except that it instead of using a
 * stack for intermediate Java operations, this instead uses registers. This












<
<
<







1
2
3
4
5
6
7
8
9
10
11
12



13
14
15
16
17
18
19
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package dev.shadowtail.classfile.nncc;




import java.util.Iterator;
import net.multiphasicapps.classfile.ByteCode;
import net.multiphasicapps.collections.UnmodifiableIterator;

/**
 * This is similar to {@link ByteCode} except that it instead of using a
 * stack for intermediate Java operations, this instead uses registers. This

Name change from runt/libs/tool-classfile/dev/shadowtail/classfile/nncc/NativeCodeBuilder.java to modules/tool-classfile/src/main/java/dev/shadowtail/classfile/nncc/NativeCodeBuilder.java.

8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package dev.shadowtail.classfile.nncc;

import dev.shadowtail.classfile.xlate.CompareType;
import dev.shadowtail.classfile.xlate.DataType;
import dev.shadowtail.classfile.xlate.JavaStackResult;
import dev.shadowtail.classfile.xlate.MathType;
import dev.shadowtail.classfile.xlate.StackJavaType;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import net.multiphasicapps.classfile.ClassName;
import net.multiphasicapps.classfile.InstructionJumpTarget;

/**
 * This is used to build {@link NativeCode} and add instructions to it.
 *
 * @since 2019/03/16
 */







<







<







8
9
10
11
12
13
14

15
16
17
18
19
20
21

22
23
24
25
26
27
28
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package dev.shadowtail.classfile.nncc;

import dev.shadowtail.classfile.xlate.CompareType;
import dev.shadowtail.classfile.xlate.DataType;

import dev.shadowtail.classfile.xlate.MathType;
import dev.shadowtail.classfile.xlate.StackJavaType;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

import net.multiphasicapps.classfile.InstructionJumpTarget;

/**
 * This is used to build {@link NativeCode} and add instructions to it.
 *
 * @since 2019/03/16
 */
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
		return this.label(new NativeCodeLabel(__lo, __dx), __pc);
	}
	
	/**
	 * Adds a label at the current position.
	 *
	 * @param __l The label to add.
	 * @param __pc The address to target.
	 * @return The added label.
	 * @since 2019/03/22
	 */
	public final NativeCodeLabel label(NativeCodeLabel __l)
	{
		return this.label(__l, this._nextaddr);
	}







<







562
563
564
565
566
567
568

569
570
571
572
573
574
575
		return this.label(new NativeCodeLabel(__lo, __dx), __pc);
	}
	
	/**
	 * Adds a label at the current position.
	 *
	 * @param __l The label to add.

	 * @return The added label.
	 * @since 2019/03/22
	 */
	public final NativeCodeLabel label(NativeCodeLabel __l)
	{
		return this.label(__l, this._nextaddr);
	}

Name change from runt/libs/tool-classfile/dev/shadowtail/classfile/nncc/NativeCodeLabel.java to modules/tool-classfile/src/main/java/dev/shadowtail/classfile/nncc/NativeCodeLabel.java.

Name change from runt/libs/tool-classfile/dev/shadowtail/classfile/nncc/NativeInstruction.java to modules/tool-classfile/src/main/java/dev/shadowtail/classfile/nncc/NativeInstruction.java.

10
11
12
13
14
15
16
17
18
19
20


21
22
23
24
25
26
27

package dev.shadowtail.classfile.nncc;

import dev.shadowtail.classfile.xlate.CompareType;
import dev.shadowtail.classfile.xlate.DataType;
import dev.shadowtail.classfile.xlate.MathType;
import dev.shadowtail.classfile.xlate.StackJavaType;
import java.util.Arrays;
import java.util.Collection;
import java.lang.ref.Reference;
import java.lang.ref.WeakReference;



/**
 * This represents a single instruction.
 *
 * @since 2019/03/22
 */
public final class NativeInstruction







<
<


>
>







10
11
12
13
14
15
16


17
18
19
20
21
22
23
24
25
26
27

package dev.shadowtail.classfile.nncc;

import dev.shadowtail.classfile.xlate.CompareType;
import dev.shadowtail.classfile.xlate.DataType;
import dev.shadowtail.classfile.xlate.MathType;
import dev.shadowtail.classfile.xlate.StackJavaType;


import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import java.util.Arrays;
import java.util.Collection;

/**
 * This represents a single instruction.
 *
 * @since 2019/03/22
 */
public final class NativeInstruction

Name change from runt/libs/tool-classfile/dev/shadowtail/classfile/nncc/NativeInstructionType.java to modules/tool-classfile/src/main/java/dev/shadowtail/classfile/nncc/NativeInstructionType.java.

17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
 */
public interface NativeInstructionType
{
	/**
	 * Math, R=RR, Integer.
	 * {@code iiiiMMMM, r3 = r1 ? r2}.
	 */
	public static final short MATH_REG_INT =
		0x00;
	
	/**
	 * Int comparison, then maybe jump.
	 * {@code iiiiRccc, if (r1 ? r2) jump->j3}.
	 */
	public static final short IF_ICMP =
		0x10;
	
	/**
	 * Memory access, offset is in register.
	 * {@code iiiiLddd, L=T load r1 = *(r2 + r3), L=F set *(r2 + r3) = r1}.
	 */
	public static final short MEMORY_OFF_REG =
		0x20;
	
	/**
	 * Memory access to big endian Java format, offset is in register.
	 * {@code iiiiLddd, L=T load r1 = *(r2 + r3), L=F set *(r2 + r3) = r1}.
	 */
	public static final short MEMORY_OFF_REG_JAVA =
		0x30;
	
	/**
	 * Math, R=RC, Integer.
	 * {@code iiiiMMMM, r3 = r1 ? c2}.
	 */
	public static final short MATH_CONST_INT =
		0x80;
	
	/**
	 * Memory access, offset is a constant.
	 * {@code iiiiLddd, L=T load r1 = *(r2 + r3), L=F set *(r2 + r3) = r1}.
	 */
	public static final short MEMORY_OFF_ICONST =
		0xA0;
	
	/**
	 * Memory access to big endian Java format, offset is a constant.
	 * {@code iiiiLddd, L=T load r1 = *(r2 + r3), L=F set *(r2 + r3) = r1}.
	 */
	public static final short MEMORY_OFF_ICONST_JAVA =
		0xB0;
	
	/**
	 * Special.
	 * {@code iiiixxxx}.
	 */
	public static final short SPECIAL_A =
		0xE0;
	
	/**
	 * Special.
	 * {@code iiiixxxx}.
	 */
	public static final short SPECIAL_B =
		0xF0;
	
	/** If equal to constant. */
	public static final short IFEQ_CONST =
		0xE6;
	
	/** Debug entry to method. */
	public static final short DEBUG_ENTRY =
		0xE8;
	
	/** Debug exit from method. */
	public static final short DEBUG_EXIT =
		0xE9;
	
	/** Debug single point in method. */
	public static final short DEBUG_POINT =
		0xEA;
	
	/**
	 * Return. 
	 * {@code iiiixxxx, return}.
	 */
	public static final short RETURN =
		0xF3;
	
	/**
	 * Store to pool, note that at code gen time this is aliased.
	 * {@code iiiixxxx}.
	 */
	public static final short STORE_POOL =
		0xF4;
	
	/** Store to integer array. */
	public static final short STORE_TO_INTARRAY =
		0xF5;
	
	/**
	 * Invoke. 
	 * {@code iiiixxxx}.
	 */
	public static final short INVOKE =
		0xF7;
	
	/** Copy value in register. */
	public static final short COPY =
		0xF8;
	
	/** Atomically decrements a memory addres and gets the value. */
	public static final short ATOMIC_INT_DECREMENT_AND_GET =
		0xF9;
	
	/** Atomically increments a memory address. */
	public static final short ATOMIC_INT_INCREMENT =
		0xFA;
	
	/** System call. */
	public static final short SYSTEM_CALL =
		0xFB;
	
	/** Atomic compare and set. */
	public static final short ATOMIC_COMPARE_GET_AND_SET =
		0xFC;
	
	/**
	 * Load from pool, note that at code gen time this is aliased.
	 * {@code iiiixxxx}.
	 */
	public static final short LOAD_POOL =
		0xFD;
	
	/** Load from integer array. */
	public static final short LOAD_FROM_INTARRAY =
		0xFE;
	
	/**
	 * Compare and exchange. 
	 * {@code iiiixxxx}.
	 */
	public static final short BREAKPOINT =
		0xFF;
}








|






|






|






|






|






|






|






|






|



|



|



|



|






|






|



|






|



|



|



|



|



|






|



|






|



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
 */
public interface NativeInstructionType
{
	/**
	 * Math, R=RR, Integer.
	 * {@code iiiiMMMM, r3 = r1 ? r2}.
	 */
	short MATH_REG_INT =
		0x00;
	
	/**
	 * Int comparison, then maybe jump.
	 * {@code iiiiRccc, if (r1 ? r2) jump->j3}.
	 */
	short IF_ICMP =
		0x10;
	
	/**
	 * Memory access, offset is in register.
	 * {@code iiiiLddd, L=T load r1 = *(r2 + r3), L=F set *(r2 + r3) = r1}.
	 */
	short MEMORY_OFF_REG =
		0x20;
	
	/**
	 * Memory access to big endian Java format, offset is in register.
	 * {@code iiiiLddd, L=T load r1 = *(r2 + r3), L=F set *(r2 + r3) = r1}.
	 */
	short MEMORY_OFF_REG_JAVA =
		0x30;
	
	/**
	 * Math, R=RC, Integer.
	 * {@code iiiiMMMM, r3 = r1 ? c2}.
	 */
	short MATH_CONST_INT =
		0x80;
	
	/**
	 * Memory access, offset is a constant.
	 * {@code iiiiLddd, L=T load r1 = *(r2 + r3), L=F set *(r2 + r3) = r1}.
	 */
	short MEMORY_OFF_ICONST =
		0xA0;
	
	/**
	 * Memory access to big endian Java format, offset is a constant.
	 * {@code iiiiLddd, L=T load r1 = *(r2 + r3), L=F set *(r2 + r3) = r1}.
	 */
	short MEMORY_OFF_ICONST_JAVA =
		0xB0;
	
	/**
	 * Special.
	 * {@code iiiixxxx}.
	 */
	short SPECIAL_A =
		0xE0;
	
	/**
	 * Special.
	 * {@code iiiixxxx}.
	 */
	short SPECIAL_B =
		0xF0;
	
	/** If equal to constant. */
	short IFEQ_CONST =
		0xE6;
	
	/** Debug entry to method. */
	short DEBUG_ENTRY =
		0xE8;
	
	/** Debug exit from method. */
	short DEBUG_EXIT =
		0xE9;
	
	/** Debug single point in method. */
	short DEBUG_POINT =
		0xEA;
	
	/**
	 * Return. 
	 * {@code iiiixxxx, return}.
	 */
	short RETURN =
		0xF3;
	
	/**
	 * Store to pool, note that at code gen time this is aliased.
	 * {@code iiiixxxx}.
	 */
	short STORE_POOL =
		0xF4;
	
	/** Store to integer array. */
	short STORE_TO_INTARRAY =
		0xF5;
	
	/**
	 * Invoke. 
	 * {@code iiiixxxx}.
	 */
	short INVOKE =
		0xF7;
	
	/** Copy value in register. */
	short COPY =
		0xF8;
	
	/** Atomically decrements a memory addres and gets the value. */
	short ATOMIC_INT_DECREMENT_AND_GET =
		0xF9;
	
	/** Atomically increments a memory address. */
	short ATOMIC_INT_INCREMENT =
		0xFA;
	
	/** System call. */
	short SYSTEM_CALL =
		0xFB;
	
	/** Atomic compare and set. */
	short ATOMIC_COMPARE_GET_AND_SET =
		0xFC;
	
	/**
	 * Load from pool, note that at code gen time this is aliased.
	 * {@code iiiixxxx}.
	 */
	short LOAD_POOL =
		0xFD;
	
	/** Load from integer array. */
	short LOAD_FROM_INTARRAY =
		0xFE;
	
	/**
	 * Compare and exchange. 
	 * {@code iiiixxxx}.
	 */
	short BREAKPOINT =
		0xFF;
}

Name change from runt/libs/tool-classfile/dev/shadowtail/classfile/nncc/NearNativeByteCodeHandler.java to modules/tool-classfile/src/main/java/dev/shadowtail/classfile/nncc/NearNativeByteCodeHandler.java.

13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import cc.squirreljme.jvm.Constants;
import cc.squirreljme.jvm.SystemCallIndex;
import dev.shadowtail.classfile.pool.AccessedField;
import dev.shadowtail.classfile.pool.ClassInfoPointer;
import dev.shadowtail.classfile.pool.ClassPool;
import dev.shadowtail.classfile.pool.FieldAccessTime;
import dev.shadowtail.classfile.pool.FieldAccessType;
import dev.shadowtail.classfile.pool.InvokedMethod;
import dev.shadowtail.classfile.pool.InvokeType;
import dev.shadowtail.classfile.pool.MethodIndex;
import dev.shadowtail.classfile.pool.NotedString;
import dev.shadowtail.classfile.pool.NullPoolEntry;
import dev.shadowtail.classfile.pool.UsedString;
import dev.shadowtail.classfile.xlate.ByteCodeHandler;
import dev.shadowtail.classfile.xlate.ByteCodeState;
import dev.shadowtail.classfile.xlate.CompareType;
import dev.shadowtail.classfile.xlate.DataType;
import dev.shadowtail.classfile.xlate.ExceptionClassEnqueueAndTable;
import dev.shadowtail.classfile.xlate.ExceptionHandlerRanges;
import dev.shadowtail.classfile.xlate.ExceptionHandlerTransition;
import dev.shadowtail.classfile.xlate.ExceptionStackAndTable;
import dev.shadowtail.classfile.xlate.JavaStackEnqueueList;
import dev.shadowtail.classfile.xlate.JavaStackResult;
import dev.shadowtail.classfile.xlate.JavaStackState;
import dev.shadowtail.classfile.xlate.MathType;
import dev.shadowtail.classfile.xlate.StackJavaType;
import dev.shadowtail.classfile.xlate.StateOperation;
import dev.shadowtail.classfile.xlate.StateOperations;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import net.multiphasicapps.classfile.ByteCode;
import net.multiphasicapps.classfile.ClassName;
import net.multiphasicapps.classfile.ExceptionHandler;
import net.multiphasicapps.classfile.ExceptionHandlerTable;
import net.multiphasicapps.classfile.FieldDescriptor;
import net.multiphasicapps.classfile.FieldName;
import net.multiphasicapps.classfile.FieldReference;
import net.multiphasicapps.classfile.JavaType;
import net.multiphasicapps.classfile.InstructionJumpTarget;
import net.multiphasicapps.classfile.LookupSwitch;
import net.multiphasicapps.classfile.MethodDescriptor;
import net.multiphasicapps.classfile.MethodHandle;
import net.multiphasicapps.classfile.MethodName;
import net.multiphasicapps.classfile.MethodReference;

/**







|
|








<
<

<


















|
|







13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29


30

31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import cc.squirreljme.jvm.Constants;
import cc.squirreljme.jvm.SystemCallIndex;
import dev.shadowtail.classfile.pool.AccessedField;
import dev.shadowtail.classfile.pool.ClassInfoPointer;
import dev.shadowtail.classfile.pool.ClassPool;
import dev.shadowtail.classfile.pool.FieldAccessTime;
import dev.shadowtail.classfile.pool.FieldAccessType;
import dev.shadowtail.classfile.pool.InvokeType;
import dev.shadowtail.classfile.pool.InvokedMethod;
import dev.shadowtail.classfile.pool.MethodIndex;
import dev.shadowtail.classfile.pool.NotedString;
import dev.shadowtail.classfile.pool.NullPoolEntry;
import dev.shadowtail.classfile.pool.UsedString;
import dev.shadowtail.classfile.xlate.ByteCodeHandler;
import dev.shadowtail.classfile.xlate.ByteCodeState;
import dev.shadowtail.classfile.xlate.CompareType;
import dev.shadowtail.classfile.xlate.DataType;


import dev.shadowtail.classfile.xlate.ExceptionHandlerTransition;

import dev.shadowtail.classfile.xlate.JavaStackEnqueueList;
import dev.shadowtail.classfile.xlate.JavaStackResult;
import dev.shadowtail.classfile.xlate.JavaStackState;
import dev.shadowtail.classfile.xlate.MathType;
import dev.shadowtail.classfile.xlate.StackJavaType;
import dev.shadowtail.classfile.xlate.StateOperation;
import dev.shadowtail.classfile.xlate.StateOperations;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import net.multiphasicapps.classfile.ByteCode;
import net.multiphasicapps.classfile.ClassName;
import net.multiphasicapps.classfile.ExceptionHandler;
import net.multiphasicapps.classfile.ExceptionHandlerTable;
import net.multiphasicapps.classfile.FieldDescriptor;
import net.multiphasicapps.classfile.FieldName;
import net.multiphasicapps.classfile.FieldReference;
import net.multiphasicapps.classfile.InstructionJumpTarget;
import net.multiphasicapps.classfile.JavaType;
import net.multiphasicapps.classfile.LookupSwitch;
import net.multiphasicapps.classfile.MethodDescriptor;
import net.multiphasicapps.classfile.MethodHandle;
import net.multiphasicapps.classfile.MethodName;
import net.multiphasicapps.classfile.MethodReference;

/**
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
		int volbase = NativeCode.ARGUMENT_REGISTER_BASE + 2 +
			__bc.maxLocals() + __bc.maxStack();
		this.monitortarget = volbase;
		this.volatiles = new VolatileRegisterStack(volbase + 1);
		
		// Returning values?
		this.isreturn = (__bc.type().returnValue() != null);
		this.isreturnwide = (isreturn && __bc.type().returnValue().isWide());
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2019/04/12
	 */
	@Override







|







144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
		int volbase = NativeCode.ARGUMENT_REGISTER_BASE + 2 +
			__bc.maxLocals() + __bc.maxStack();
		this.monitortarget = volbase;
		this.volatiles = new VolatileRegisterStack(volbase + 1);
		
		// Returning values?
		this.isreturn = (__bc.type().returnValue() != null);
		this.isreturnwide = (this.isreturn && __bc.type().returnValue().isWide());
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2019/04/12
	 */
	@Override
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
		
		// Must be an array
		if (!__in.isArray())
			this.__basicCheckIsArray(__in.register);
		
		// We already checked the only valid exceptions, so do not perform
		// later handling!
		state.canexception = false;
		
		// Read length
		codebuilder.addMemoryOffConst(DataType.INTEGER, true,
			__len.register,
			__in.register, Constants.ARRAY_LENGTH_OFFSET);
		
		// Clear references







|







169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
		
		// Must be an array
		if (!__in.isArray())
			this.__basicCheckIsArray(__in.register);
		
		// We already checked the only valid exceptions, so do not perform
		// later handling!
		this.state.canexception = false;
		
		// Read length
		codebuilder.addMemoryOffConst(DataType.INTEGER, true,
			__len.register,
			__in.register, Constants.ARRAY_LENGTH_OFFSET);
		
		// Clear references
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232

233
234
235
236
237
238
239
			this.__basicCheckIsArray(__in.register);
		
		// Check array bounds
		this.__basicCheckArrayBound(__in.register, __dx.register);
		
		// We already checked the only valid exceptions, so do not perform
		// later handling!
		state.canexception = false;
		
		// Grab some volatiles
		VolatileRegisterStack volatiles = this.volatiles;
		int volaip = volatiles.get();
		
		// Determine array index position
		codebuilder.addMathConst(StackJavaType.INTEGER, MathType.MUL,
			__dx.register, __dt.size(), volaip);
		codebuilder.addMathConst(StackJavaType.INTEGER, MathType.ADD,
			volaip, Constants.ARRAY_BASE_SIZE, volaip);
		
		// Use helper function
		if (__dt.isWide())
		{
			// Read memory
			this.__invokeStatic(InvokeType.SYSTEM, JVMFUNC_CLASS,

				"jvmMemReadLong", "(II)J",
				__in.register, volaip);
			
			// Copy return value
			codebuilder.addCopy(NativeCode.RETURN_REGISTER,
				__v.register);
			codebuilder.addCopy(NativeCode.RETURN_REGISTER + 1,







|















|
>







206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
			this.__basicCheckIsArray(__in.register);
		
		// Check array bounds
		this.__basicCheckArrayBound(__in.register, __dx.register);
		
		// We already checked the only valid exceptions, so do not perform
		// later handling!
		this.state.canexception = false;
		
		// Grab some volatiles
		VolatileRegisterStack volatiles = this.volatiles;
		int volaip = volatiles.get();
		
		// Determine array index position
		codebuilder.addMathConst(StackJavaType.INTEGER, MathType.MUL,
			__dx.register, __dt.size(), volaip);
		codebuilder.addMathConst(StackJavaType.INTEGER, MathType.ADD,
			volaip, Constants.ARRAY_BASE_SIZE, volaip);
		
		// Use helper function
		if (__dt.isWide())
		{
			// Read memory
			this.__invokeStatic(InvokeType.SYSTEM,
				NearNativeByteCodeHandler.JVMFUNC_CLASS,
				"jvmMemReadLong", "(II)J",
				__in.register, volaip);
			
			// Copy return value
			codebuilder.addCopy(NativeCode.RETURN_REGISTER,
				__v.register);
			codebuilder.addCopy(NativeCode.RETURN_REGISTER + 1,
305
306
307
308
309
310
311
312
313
314
315
316
317
318

319
320
321
322
323
324
325
			voltemp = volatiles.get();
			codebuilder.addMemoryOffReg(DataType.INTEGER, true,
				voltemp, __in.register, volaip);
		}
		
		// We already checked the only valid exceptions, so do not perform
		// later handling!
		state.canexception = false;
		
		// Use helper function
		if (__dt.isWide())
		{
			// Write memory
			this.__invokeStatic(InvokeType.STATIC, JVMFUNC_CLASS,

				"jvmMemWriteLong", "(IIII)V",
				__in.register, volaip, __v.register, __v.register + 1);
		}
		
		// Store value
		else
			codebuilder.addMemoryOffReg(__dt, false,







|





|
>







303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
			voltemp = volatiles.get();
			codebuilder.addMemoryOffReg(DataType.INTEGER, true,
				voltemp, __in.register, volaip);
		}
		
		// We already checked the only valid exceptions, so do not perform
		// later handling!
		this.state.canexception = false;
		
		// Use helper function
		if (__dt.isWide())
		{
			// Write memory
			this.__invokeStatic(InvokeType.STATIC,
				NearNativeByteCodeHandler.JVMFUNC_CLASS,
				"jvmMemWriteLong", "(IIII)V",
				__in.register, volaip, __v.register, __v.register + 1);
		}
		
		// Store value
		else
			codebuilder.addMemoryOffReg(__dt, false,
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
		this.__basicCheckCCE(__v.register, __cl);
		
		// Null jump goes here
		codebuilder.label(nullskip);
		
		// We already checked the only valid exceptions, so do not perform
		// later handling!
		state.canexception = false;
		
		// We do not need to uncount whatever was pushed in because it would
		// be immediately pushed back onto the stack. The counts should only
		// be lowered if ClassCastException is to be thrown. Because otherwise
		// we will just end up collecting things on a normal refclear
		this.__refReset();
	}







|







363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
		this.__basicCheckCCE(__v.register, __cl);
		
		// Null jump goes here
		codebuilder.label(nullskip);
		
		// We already checked the only valid exceptions, so do not perform
		// later handling!
		this.state.canexception = false;
		
		// We do not need to uncount whatever was pushed in because it would
		// be immediately pushed back onto the stack. The counts should only
		// be lowered if ClassCastException is to be thrown. Because otherwise
		// we will just end up collecting things on a normal refclear
		this.__refReset();
	}
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516

517
518
519
520
521
522
523
		
		// Must be the given class
		if (!__i.isCompatible(__fr.className()))
			this.__basicCheckCCE(ireg, __fr.className());
		
		// We already checked the only valid exceptions, so do not perform
		// later handling!
		state.canexception = false;
		
		// Determine volatile registers
		VolatileRegisterStack volatiles = this.volatiles;
		int tempreg = volatiles.get();
		
		// Read field offset
		codebuilder.add(NativeInstructionType.LOAD_POOL,
			this.__fieldAccess(FieldAccessType.INSTANCE, __fr, true), tempreg);
		
		// Data type used
		DataType dt = DataType.of(__fr.memberType().primitiveType());
		
		// Use helper function?
		if (dt.isWide())
		{
			// Read memory
			this.__invokeStatic(InvokeType.SYSTEM, JVMFUNC_CLASS,

				"jvmMemReadLong", "(II)J",
				ireg, tempreg);
			
			// Copy return value
			codebuilder.addCopy(NativeCode.RETURN_REGISTER + 1,
				__v.register + 1);
			codebuilder.addCopy(NativeCode.RETURN_REGISTER,







|
















|
>







491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
		
		// Must be the given class
		if (!__i.isCompatible(__fr.className()))
			this.__basicCheckCCE(ireg, __fr.className());
		
		// We already checked the only valid exceptions, so do not perform
		// later handling!
		this.state.canexception = false;
		
		// Determine volatile registers
		VolatileRegisterStack volatiles = this.volatiles;
		int tempreg = volatiles.get();
		
		// Read field offset
		codebuilder.add(NativeInstructionType.LOAD_POOL,
			this.__fieldAccess(FieldAccessType.INSTANCE, __fr, true), tempreg);
		
		// Data type used
		DataType dt = DataType.of(__fr.memberType().primitiveType());
		
		// Use helper function?
		if (dt.isWide())
		{
			// Read memory
			this.__invokeStatic(InvokeType.SYSTEM,
				NearNativeByteCodeHandler.JVMFUNC_CLASS,
				"jvmMemReadLong", "(II)J",
				ireg, tempreg);
			
			// Copy return value
			codebuilder.addCopy(NativeCode.RETURN_REGISTER + 1,
				__v.register + 1);
			codebuilder.addCopy(NativeCode.RETURN_REGISTER,
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
		
		// Must be the given class
		if (!__i.isCompatible(__fr.className()))
			this.__basicCheckCCE(ireg, __fr.className());
			
		// We already checked the only valid exceptions, so do not perform
		// later handling!
		state.canexception = false;
		
		// Get volatiles
		VolatileRegisterStack volatiles = this.volatiles;
		int volfioff = volatiles.get();
		
		// Read field offset
		codebuilder.add(NativeInstructionType.LOAD_POOL,







|







562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
		
		// Must be the given class
		if (!__i.isCompatible(__fr.className()))
			this.__basicCheckCCE(ireg, __fr.className());
			
		// We already checked the only valid exceptions, so do not perform
		// later handling!
		this.state.canexception = false;
		
		// Get volatiles
		VolatileRegisterStack volatiles = this.volatiles;
		int volfioff = volatiles.get();
		
		// Read field offset
		codebuilder.add(NativeInstructionType.LOAD_POOL,
596
597
598
599
600
601
602
603

604
605
606
607
608
609
610
				voltemp, ireg, volfioff);
		}
		
		// Use helper function?
		if (dt.isWide())
		{
			// Write memory
			this.__invokeStatic(InvokeType.SYSTEM, JVMFUNC_CLASS,

				"jvmMemWriteLong", "(IIII)V",
				ireg, volfioff, __v.register, __v.register + 1);
		}
		
		// Write to memory
		else
			codebuilder.addMemoryOffReg(







|
>







596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
				voltemp, ireg, volfioff);
		}
		
		// Use helper function?
		if (dt.isWide())
		{
			// Write memory
			this.__invokeStatic(InvokeType.SYSTEM,
				NearNativeByteCodeHandler.JVMFUNC_CLASS,
				"jvmMemWriteLong", "(IIII)V",
				ireg, volfioff, __v.register, __v.register + 1);
		}
		
		// Write to memory
		else
			codebuilder.addMemoryOffReg(
663
664
665
666
667
668
669
670

671
672
673
674
675
676
677
678
679
680
681
		VolatileRegisterStack volatiles = this.volatiles;
		int volwantcldx = volatiles.get();
		
		// Load desired class index type
		this.__loadClassInfo(__cl, volwantcldx);
		
		// Invoke helper method
		this.__invokeStatic(InvokeType.SYSTEM, JVMFUNC_CLASS,

			"jvmIsInstance", "(II)I", __v.register, volwantcldx);
		
		// Use result
		codebuilder.addCopy(NativeCode.RETURN_REGISTER, __o.register);
		
		// No longer needed
		volatiles.remove(volwantcldx);
		
		// Clear references in the event it was overwritten
		this.__refClear();
	}







|
>



|







664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
		VolatileRegisterStack volatiles = this.volatiles;
		int volwantcldx = volatiles.get();
		
		// Load desired class index type
		this.__loadClassInfo(__cl, volwantcldx);
		
		// Invoke helper method
		this.__invokeStatic(InvokeType.SYSTEM,
			NearNativeByteCodeHandler.JVMFUNC_CLASS,
			"jvmIsInstance", "(II)I", __v.register, volwantcldx);
		
		// Use result
		this.codebuilder.addCopy(NativeCode.RETURN_REGISTER, __o.register);
		
		// No longer needed
		volatiles.remove(volwantcldx);
		
		// Clear references in the event it was overwritten
		this.__refClear();
	}
758
759
760
761
762
763
764
765

766
767
768
769
770
771
772
				codebuilder.add(NativeInstructionType.LOAD_POOL,
					new MethodIndex(__r.handle().outerClass(),
						__r.handle().name(), __r.handle().descriptor()),
					volimethdx);
				
				// Use helper method to find the method pointer to invoke
				// for this interface (hi=pool, lo=pointer)
				this.__invokeStatic(InvokeType.SYSTEM, JVMFUNC_CLASS,

					"jvmInterfacePointer", "(III)J",
					ireg, voliclass, volimethdx);
				
				// We need to extract the pool pointer of the class we
				// are calling in so that nothing is horribly incorrect
				codebuilder.addCopy(NativeCode.RETURN_REGISTER + 1,
					NativeCode.NEXT_POOL_REGISTER);







|
>







760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
				codebuilder.add(NativeInstructionType.LOAD_POOL,
					new MethodIndex(__r.handle().outerClass(),
						__r.handle().name(), __r.handle().descriptor()),
					volimethdx);
				
				// Use helper method to find the method pointer to invoke
				// for this interface (hi=pool, lo=pointer)
				this.__invokeStatic(InvokeType.SYSTEM,
					NearNativeByteCodeHandler.JVMFUNC_CLASS,
					"jvmInterfacePointer", "(III)J",
					ireg, voliclass, volimethdx);
				
				// We need to extract the pool pointer of the class we
				// are calling in so that nothing is horribly incorrect
				codebuilder.addCopy(NativeCode.RETURN_REGISTER + 1,
					NativeCode.NEXT_POOL_REGISTER);
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
				// Invoke instance method
				this.__invokeInstance(__t, mh.outerClass(), mh.name(),
					mh.descriptor(), reglist);
			}
		}
		
		// Check if exception occurred, before copying the return value!
		if (state.canexception)
		{
			// Exception check
			codebuilder.addIfNonZero(NativeCode.EXCEPTION_REGISTER,
				this.__labelException());
			
			// We did the exception handling, so do not handle later
			state.canexception = false;
		}
		
		// Read in return value, it is just a copy
		if (__out != null)
		{
			int a = NativeCode.RETURN_REGISTER,
				b = __out.register;







|






|







789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
				// Invoke instance method
				this.__invokeInstance(__t, mh.outerClass(), mh.name(),
					mh.descriptor(), reglist);
			}
		}
		
		// Check if exception occurred, before copying the return value!
		if (this.state.canexception)
		{
			// Exception check
			codebuilder.addIfNonZero(NativeCode.EXCEPTION_REGISTER,
				this.__labelException());
			
			// We did the exception handling, so do not handle later
			this.state.canexception = false;
		}
		
		// Read in return value, it is just a copy
		if (__out != null)
		{
			int a = NativeCode.RETURN_REGISTER,
				b = __out.register;
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
			if (__mt == MathType.DIV || __mt == MathType.REM)
			{
				// Perform divide by zero check
				this.__basicCheckDBZ(__b.register);
				
				// We already checked the only valid exceptions, so do not
				// perform later handling!
				state.canexception = false;
			}
			
			// Add math operation
			codebuilder.addMathReg(__dt, __mt, __a.register, __b.register,
				__c.register);
		}
		







|







863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
			if (__mt == MathType.DIV || __mt == MathType.REM)
			{
				// Perform divide by zero check
				this.__basicCheckDBZ(__b.register);
				
				// We already checked the only valid exceptions, so do not
				// perform later handling!
				this.state.canexception = false;
			}
			
			// Add math operation
			codebuilder.addMathReg(__dt, __mt, __a.register, __b.register,
				__c.register);
		}
		
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
			if (__b.longValue() == 0)
			{
				// Directly jump to the make exception handler
				codebuilder.addGoto(this.__labelMakeException(
					"java/lang/ArithmeticException"));
				
				// Already handled this
				state.canexception = false;
				
				// Since we are dividing by zero, never actually generate the
				// division code
				return;
			}
		
		// Integer math on constants is natively supported







|







963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
			if (__b.longValue() == 0)
			{
				// Directly jump to the make exception handler
				codebuilder.addGoto(this.__labelMakeException(
					"java/lang/ArithmeticException"));
				
				// Already handled this
				this.state.canexception = false;
				
				// Since we are dividing by zero, never actually generate the
				// division code
				return;
			}
		
		// Integer math on constants is natively supported
1131
1132
1133
1134
1135
1136
1137
1138

1139
1140
1141
1142
1143
1144
1145
			volresult = volatiles.get();
		
		// Load the class data for the array type
		// If not a fixed class index, then rely on the value in the pool
		this.__loadClassInfo(__at, volclassdx);
		
		// Call internal handler, place into temporary for OOM check
		this.__invokeStatic(InvokeType.SYSTEM, JVMFUNC_CLASS, "jvmNewArray",

			"(II)I", volclassdx, __len.register);
		codebuilder.addCopy(NativeCode.RETURN_REGISTER, volresult);
		
		// No longer needed
		volatiles.remove(volclassdx);
		
		// Check for out of memory







|
>







1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
			volresult = volatiles.get();
		
		// Load the class data for the array type
		// If not a fixed class index, then rely on the value in the pool
		this.__loadClassInfo(__at, volclassdx);
		
		// Call internal handler, place into temporary for OOM check
		this.__invokeStatic(InvokeType.SYSTEM,
			NearNativeByteCodeHandler.JVMFUNC_CLASS, "jvmNewArray",
			"(II)I", volclassdx, __len.register);
		codebuilder.addCopy(NativeCode.RETURN_REGISTER, volresult);
		
		// No longer needed
		volatiles.remove(volclassdx);
		
		// Check for out of memory
1181
1182
1183
1184
1185
1186
1187
1188

1189
1190
1191
1192
1193
1194
1195
			
			// Load the noted string
			int volstrptr = volatiles.get();
			codebuilder.add(NativeInstructionType.LOAD_POOL,
				new NotedString((String)__v), volstrptr);
				
			// Call internal string loader
			this.__invokeStatic(InvokeType.SYSTEM, JVMFUNC_CLASS,

				"jvmLoadString", "(I)Ljava/lang/String;", volstrptr);
			
			// Cleanup
			volatiles.remove(volstrptr);
			
			// Store into the pull and copy the result as well
			codebuilder.add(NativeInstructionType.STORE_POOL,







|
>







1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
			
			// Load the noted string
			int volstrptr = volatiles.get();
			codebuilder.add(NativeInstructionType.LOAD_POOL,
				new NotedString((String)__v), volstrptr);
				
			// Call internal string loader
			this.__invokeStatic(InvokeType.SYSTEM,
				NearNativeByteCodeHandler.JVMFUNC_CLASS,
				"jvmLoadString", "(I)Ljava/lang/String;", volstrptr);
			
			// Cleanup
			volatiles.remove(volstrptr);
			
			// Store into the pull and copy the result as well
			codebuilder.add(NativeInstructionType.STORE_POOL,
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320

1321
1322
1323
1324
1325
1326
1327
	public final void doStaticGet(FieldReference __fr,
		JavaStackResult.Output __v)
	{
		NativeCodeBuilder codebuilder = this.codebuilder;
		
		// Ignore thrown exceptions because field access is checked at link
		// time
		state.canexception = false;
		
		// Push references
		this.__refPush();
		
		// Need volatiles
		VolatileRegisterStack volatiles = this.volatiles;
		int volsfo = volatiles.get();
		
		// Read static offset
		codebuilder.add(NativeInstructionType.LOAD_POOL,
			this.__fieldAccess(FieldAccessType.STATIC, __fr, true),
			volsfo);
		
		// The datatype used
		DataType dt = DataType.of(__fr.memberType().primitiveType());
		
		// Use helper function?
		if (dt.isWide())
		{
			// Read memory
			this.__invokeStatic(InvokeType.SYSTEM, JVMFUNC_CLASS,

				"jvmMemReadLong", "(II)J",
				NativeCode.STATIC_FIELD_REGISTER, volsfo);
			
			// Copy return value
			codebuilder.addCopy(NativeCode.RETURN_REGISTER,
				__v.register);
			codebuilder.addCopy(NativeCode.RETURN_REGISTER + 1,







|




















|
>







1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
	public final void doStaticGet(FieldReference __fr,
		JavaStackResult.Output __v)
	{
		NativeCodeBuilder codebuilder = this.codebuilder;
		
		// Ignore thrown exceptions because field access is checked at link
		// time
		this.state.canexception = false;
		
		// Push references
		this.__refPush();
		
		// Need volatiles
		VolatileRegisterStack volatiles = this.volatiles;
		int volsfo = volatiles.get();
		
		// Read static offset
		codebuilder.add(NativeInstructionType.LOAD_POOL,
			this.__fieldAccess(FieldAccessType.STATIC, __fr, true),
			volsfo);
		
		// The datatype used
		DataType dt = DataType.of(__fr.memberType().primitiveType());
		
		// Use helper function?
		if (dt.isWide())
		{
			// Read memory
			this.__invokeStatic(InvokeType.SYSTEM,
				NearNativeByteCodeHandler.JVMFUNC_CLASS,
				"jvmMemReadLong", "(II)J",
				NativeCode.STATIC_FIELD_REGISTER, volsfo);
			
			// Copy return value
			codebuilder.addCopy(NativeCode.RETURN_REGISTER,
				__v.register);
			codebuilder.addCopy(NativeCode.RETURN_REGISTER + 1,
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
	public final void doStaticPut(FieldReference __fr,
		JavaStackResult.Input __v)
	{
		NativeCodeBuilder codebuilder = this.codebuilder;
		
		// Ignore thrown exceptions because field access is checked at link
		// time
		state.canexception = false;

		// Push references
		this.__refPush();
		
		// Need volatiles
		VolatileRegisterStack volatiles = this.volatiles;
		int volsfo = volatiles.get();







|







1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
	public final void doStaticPut(FieldReference __fr,
		JavaStackResult.Input __v)
	{
		NativeCodeBuilder codebuilder = this.codebuilder;
		
		// Ignore thrown exceptions because field access is checked at link
		// time
		this.state.canexception = false;

		// Push references
		this.__refPush();
		
		// Need volatiles
		VolatileRegisterStack volatiles = this.volatiles;
		int volsfo = volatiles.get();
1390
1391
1392
1393
1394
1395
1396
1397

1398
1399
1400
1401
1402
1403
1404
				voltemp, NativeCode.STATIC_FIELD_REGISTER, volsfo);
		}
		
		// Use helper function?
		if (dt.isWide())
		{
			// Write memory
			this.__invokeStatic(InvokeType.SYSTEM, JVMFUNC_CLASS,

				"jvmMemWriteLong", "(IIII)V",
				NativeCode.STATIC_FIELD_REGISTER, volsfo,
				__v.register, __v.register + 1);
		}
		
		// Write to memory
		else







|
>







1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
				voltemp, NativeCode.STATIC_FIELD_REGISTER, volsfo);
		}
		
		// Use helper function?
		if (dt.isWide())
		{
			// Write memory
			this.__invokeStatic(InvokeType.SYSTEM,
				NearNativeByteCodeHandler.JVMFUNC_CLASS,
				"jvmMemWriteLong", "(IIII)V",
				NativeCode.STATIC_FIELD_REGISTER, volsfo,
				__v.register, __v.register + 1);
		}
		
		// Write to memory
		else
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
		// internal compiler error.}
		if (this._lastenqueue != null)
			throw new IllegalStateException("JC12");
		
		// An exception check was requested, do a check on the exception
		// register and jump if there is something there
		if (state.canexception)
			codebuilder.addIfNonZero(NativeCode.EXCEPTION_REGISTER,
				this.__labelException());
		
		// If this instruction naturally flows into another, determine we
		// need to transition to that stack state in order to work properly
		// with any cached values
		if (state.instruction.hasNaturalFlow())
		{







|







1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
		// internal compiler error.}
		if (this._lastenqueue != null)
			throw new IllegalStateException("JC12");
		
		// An exception check was requested, do a check on the exception
		// register and jump if there is something there
		if (state.canexception)
			this.codebuilder.addIfNonZero(NativeCode.EXCEPTION_REGISTER,
				this.__labelException());
		
		// If this instruction naturally flows into another, determine we
		// need to transition to that stack state in order to work properly
		// with any cached values
		if (state.instruction.hasNaturalFlow())
		{
1666
1667
1668
1669
1670
1671
1672
1673

1674
1675
1676
1677
1678
1679
1680
			for (ExceptionHandler eh : ehtable)
			{
				// Load the class type for the exception to check against
				int volehclassdx = volatiles.get();
				this.__loadClassInfo(eh.type(), volehclassdx);
				
				// Call instance handler check
				this.__invokeStatic(InvokeType.SYSTEM, JVMFUNC_CLASS,

					"jvmIsInstance", "(II)I",
					NativeCode.EXCEPTION_REGISTER, volehclassdx);
				
				// Cleanup
				volatiles.remove(volehclassdx);
				
				// If the return value is non-zero then it is an instance, in







|
>







1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
			for (ExceptionHandler eh : ehtable)
			{
				// Load the class type for the exception to check against
				int volehclassdx = volatiles.get();
				this.__loadClassInfo(eh.type(), volehclassdx);
				
				// Call instance handler check
				this.__invokeStatic(InvokeType.SYSTEM,
					NearNativeByteCodeHandler.JVMFUNC_CLASS,
					"jvmIsInstance", "(II)I",
					NativeCode.EXCEPTION_REGISTER, volehclassdx);
				
				// Cleanup
				volatiles.remove(volehclassdx);
				
				// If the return value is non-zero then it is an instance, in
1768
1769
1770
1771
1772
1773
1774
1775

1776
1777
1778
1779
1780
1781
1782
	 * @since 2019/04/27
	 */
	private final void __basicCheckArrayStore(int __ir, int __vr)
	{
		NativeCodeBuilder codebuilder = this.codebuilder;
		
		// Call helper class
		this.__invokeStatic(InvokeType.SYSTEM, JVMFUNC_CLASS,

			"jvmCanArrayStore", "(II)I", __ir, __vr);
		
		// Was it invalid?
		codebuilder.addIfZero(NativeCode.RETURN_REGISTER,
			this.__labelMakeException("java/lang/ArrayStoreException"));
	}
	







|
>







1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
	 * @since 2019/04/27
	 */
	private final void __basicCheckArrayStore(int __ir, int __vr)
	{
		NativeCodeBuilder codebuilder = this.codebuilder;
		
		// Call helper class
		this.__invokeStatic(InvokeType.SYSTEM,
			NearNativeByteCodeHandler.JVMFUNC_CLASS,
			"jvmCanArrayStore", "(II)I", __ir, __vr);
		
		// Was it invalid?
		codebuilder.addIfZero(NativeCode.RETURN_REGISTER,
			this.__labelMakeException("java/lang/ArrayStoreException"));
	}
	
1799
1800
1801
1802
1803
1804
1805
1806

1807
1808
1809
1810
1811
1812
1813
		VolatileRegisterStack volatiles = this.volatiles;
		int volwantcldx = volatiles.get();
		
		// Load desired target class type
		this.__loadClassInfo(__cl, volwantcldx);
		
		// Call helper class
		this.__invokeStatic(InvokeType.SYSTEM, JVMFUNC_CLASS,

			"jvmIsInstance", "(II)I", __ir, volwantcldx);
		
		// If the resulting method call returns zero then it is not an instance
		// of the given class. The return register is checked because the
		// value of that method will be placed there.
		codebuilder.addIfZero(NativeCode.RETURN_REGISTER,
			this.__labelRefClearJump(this.__labelMakeException(







|
>







1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
		VolatileRegisterStack volatiles = this.volatiles;
		int volwantcldx = volatiles.get();
		
		// Load desired target class type
		this.__loadClassInfo(__cl, volwantcldx);
		
		// Call helper class
		this.__invokeStatic(InvokeType.SYSTEM,
			NearNativeByteCodeHandler.JVMFUNC_CLASS,
			"jvmIsInstance", "(II)I", __ir, volwantcldx);
		
		// If the resulting method call returns zero then it is not an instance
		// of the given class. The return register is checked because the
		// value of that method will be placed there.
		codebuilder.addIfZero(NativeCode.RETURN_REGISTER,
			this.__labelRefClearJump(this.__labelMakeException(
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842

1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
	 *
	 * @param __br The B register.
	 * @since 2019/06/24
	 */
	private final void __basicCheckDBZ(int __br)
	{
		// If the B register is zero, then we throw the exception
		codebuilder.addIfZero(__br, this.__labelMakeException(
			"java/lang/ArithmeticException"));
	}
	
	/**
	 * Checks that the given object is an array.
	 *
	 * @param __ir The type to check.
	 * @since 2019/04/27
	 */
	private final void __basicCheckIsArray(int __ir)
	{
		// Call internal helper
		this.__invokeStatic(InvokeType.SYSTEM, JVMFUNC_CLASS, "jvmIsArray",

			"(I)I", __ir);
		
		// If this is not an array, throw a class cast exception
		codebuilder.addIfZero(NativeCode.RETURN_REGISTER,
			this.__labelRefClearJump(this.__labelMakeException(
			"java/lang/ClassCastException")));
	}
	
	/**
	 * Checks if the requested array allocation is negative.
	 *







|












|
>



|







1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
	 *
	 * @param __br The B register.
	 * @since 2019/06/24
	 */
	private final void __basicCheckDBZ(int __br)
	{
		// If the B register is zero, then we throw the exception
		this.codebuilder.addIfZero(__br, this.__labelMakeException(
			"java/lang/ArithmeticException"));
	}
	
	/**
	 * Checks that the given object is an array.
	 *
	 * @param __ir The type to check.
	 * @since 2019/04/27
	 */
	private final void __basicCheckIsArray(int __ir)
	{
		// Call internal helper
		this.__invokeStatic(InvokeType.SYSTEM,
			NearNativeByteCodeHandler.JVMFUNC_CLASS, "jvmIsArray",
			"(I)I", __ir);
		
		// If this is not an array, throw a class cast exception
		this.codebuilder.addIfZero(NativeCode.RETURN_REGISTER,
			this.__labelRefClearJump(this.__labelMakeException(
			"java/lang/ClassCastException")));
	}
	
	/**
	 * Checks if the requested array allocation is negative.
	 *
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
		throws NullPointerException
	{
		if (__at == null || __fr == null)
			throw new NullPointerException("NARG");
		
		// Accessing final fields of another class will always be treated as
		// normal despite being in the constructor of a class
		if (!state.classname.equals(__fr.className()))
			return new AccessedField((__read ? FieldAccessTime.READ :
				FieldAccessTime.NORMAL), __at, __fr);
		return new AccessedField((__read ? FieldAccessTime.READ :
			this.defaultfieldaccesstime), __at, __fr);
	}
	
	/**







|







1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
		throws NullPointerException
	{
		if (__at == null || __fr == null)
			throw new NullPointerException("NARG");
		
		// Accessing final fields of another class will always be treated as
		// normal despite being in the constructor of a class
		if (!this.state.classname.equals(__fr.className()))
			return new AccessedField((__read ? FieldAccessTime.READ :
				FieldAccessTime.NORMAL), __at, __fr);
		return new AccessedField((__read ? FieldAccessTime.READ :
			this.defaultfieldaccesstime), __at, __fr);
	}
	
	/**
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
			returns.add((dx = returns.size()), __eq);
		
		// Label used for return
		NativeCodeLabel lb = new NativeCodeLabel("return", dx);
		
		// If this was never added here, make sure a label exists
		if (freshdx)
			codebuilder.label(lb);
		
		// If the enqueue list is empty then the only thing we need to do
		// is generate a return instruction
		NativeCodeBuilder codebuilder = this.codebuilder;
		if (__eq.isEmpty())
		{
			// If this is synchronized, we need to exit the monitor
			if (this.issynchronized)
			{
				// Protect return value, if there is one
				if (isreturn)
				{
					ssh = volatiles.get();
					codebuilder.addCopy(NativeCode.RETURN_REGISTER, ssh);
				}
				
				// And wide value, if any
				if (isreturnwide)
				{
					ssl = volatiles.get();
					codebuilder.addCopy(NativeCode.RETURN_REGISTER + 1, ssl);
				}
				
				// Uncount and clear out
				this.__monitor(false, this.monitortarget);
				this.__refUncount(this.monitortarget);
				
				// Recover value, if any
				if (isreturn)
				{
					codebuilder.addCopy(ssh, NativeCode.RETURN_REGISTER);
					volatiles.remove(ssh);
				}
				
				// Recover wide, if any
				if (isreturnwide)
				{
					codebuilder.addCopy(ssl, NativeCode.RETURN_REGISTER + 1);
					volatiles.remove(ssl);
				}
			}
			
			// Debug exit







|










|






|










|






|







1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
			returns.add((dx = returns.size()), __eq);
		
		// Label used for return
		NativeCodeLabel lb = new NativeCodeLabel("return", dx);
		
		// If this was never added here, make sure a label exists
		if (freshdx)
			this.codebuilder.label(lb);
		
		// If the enqueue list is empty then the only thing we need to do
		// is generate a return instruction
		NativeCodeBuilder codebuilder = this.codebuilder;
		if (__eq.isEmpty())
		{
			// If this is synchronized, we need to exit the monitor
			if (this.issynchronized)
			{
				// Protect return value, if there is one
				if (this.isreturn)
				{
					ssh = volatiles.get();
					codebuilder.addCopy(NativeCode.RETURN_REGISTER, ssh);
				}
				
				// And wide value, if any
				if (this.isreturnwide)
				{
					ssl = volatiles.get();
					codebuilder.addCopy(NativeCode.RETURN_REGISTER + 1, ssl);
				}
				
				// Uncount and clear out
				this.__monitor(false, this.monitortarget);
				this.__refUncount(this.monitortarget);
				
				// Recover value, if any
				if (this.isreturn)
				{
					codebuilder.addCopy(ssh, NativeCode.RETURN_REGISTER);
					volatiles.remove(ssh);
				}
				
				// Recover wide, if any
				if (this.isreturnwide)
				{
					codebuilder.addCopy(ssl, NativeCode.RETURN_REGISTER + 1);
					volatiles.remove(ssl);
				}
			}
			
			// Debug exit
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
			// Jump to label
			codebuilder.addGoto(lb);
			
			return lb;
		}
		
		// Protect return value, if there is one
		if (isreturn)
		{
			ssh = volatiles.get();
			codebuilder.addCopy(NativeCode.RETURN_REGISTER, ssh);
		}
		
		// And wide value, if any
		if (isreturnwide)
		{
			ssl = volatiles.get();
			codebuilder.addCopy(NativeCode.RETURN_REGISTER + 1, ssl);
		}
		
		// Since the enqueue list is not empty, we can just trim a register
		// from the top and recursively go down
		// So uncount the top
		this.__refUncount(__eq.top());
		
		// Recover value, if any
		if (isreturn)
		{
			codebuilder.addCopy(ssh, NativeCode.RETURN_REGISTER);
			volatiles.remove(ssh);
		}
		
		// Recover wide, if any
		if (isreturnwide)
		{
			codebuilder.addCopy(ssl, NativeCode.RETURN_REGISTER + 1);
			volatiles.remove(ssl);
		}
		
		// Recursively go down since the enqueues may possibly be shared, if
		// any of these enqueues were previously made then the recursive







|






|











|






|







2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
			// Jump to label
			codebuilder.addGoto(lb);
			
			return lb;
		}
		
		// Protect return value, if there is one
		if (this.isreturn)
		{
			ssh = volatiles.get();
			codebuilder.addCopy(NativeCode.RETURN_REGISTER, ssh);
		}
		
		// And wide value, if any
		if (this.isreturnwide)
		{
			ssl = volatiles.get();
			codebuilder.addCopy(NativeCode.RETURN_REGISTER + 1, ssl);
		}
		
		// Since the enqueue list is not empty, we can just trim a register
		// from the top and recursively go down
		// So uncount the top
		this.__refUncount(__eq.top());
		
		// Recover value, if any
		if (this.isreturn)
		{
			codebuilder.addCopy(ssh, NativeCode.RETURN_REGISTER);
			volatiles.remove(ssh);
		}
		
		// Recover wide, if any
		if (this.isreturnwide)
		{
			codebuilder.addCopy(ssl, NativeCode.RETURN_REGISTER + 1);
			volatiles.remove(ssl);
		}
		
		// Recursively go down since the enqueues may possibly be shared, if
		// any of these enqueues were previously made then the recursive
2669
2670
2671
2672
2673
2674
2675
2676

2677
2678
2679
2680
2681
2682
2683
		VolatileRegisterStack volatiles = this.volatiles;
		int volwantcl = volatiles.get();
		
		// Load class data
		this.__loadClassInfo(__cl, volwantcl);
		
		// Call allocator, copy to result
		this.__invokeStatic(InvokeType.SYSTEM, JVMFUNC_CLASS, "jvmNew",

			"(I)I", volwantcl);
		codebuilder.addCopy(NativeCode.RETURN_REGISTER, __out);
		
		// Not needed
		volatiles.remove(volwantcl);
	}
	







|
>







2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
		VolatileRegisterStack volatiles = this.volatiles;
		int volwantcl = volatiles.get();
		
		// Load class data
		this.__loadClassInfo(__cl, volwantcl);
		
		// Call allocator, copy to result
		this.__invokeStatic(InvokeType.SYSTEM,
			NearNativeByteCodeHandler.JVMFUNC_CLASS, "jvmNew",
			"(I)I", volwantcl);
		codebuilder.addCopy(NativeCode.RETURN_REGISTER, __out);
		
		// Not needed
		volatiles.remove(volwantcl);
	}
	
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906

2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
			// Build the register List
			List<Integer> args = new ArrayList<>();
			int n = __in.length;
			for (int i = 1; i < n; i++)
				args.add(__in[i].register);
			
			// Perform the pure call
			codebuilder.add(NativeInstructionType.SYSTEM_CALL,
				__in[0].register, new RegisterList(args));
			
			// Need to store the return value of this call
			VolatileRegisterStack volatiles = this.volatiles;
			int rvlo = volatiles.get(),
				rvhi = volatiles.get();
			
			// Defensive copy of return value
			if (__out != null)
			{
				// Low
				codebuilder.addCopy(NativeCode.RETURN_REGISTER, rvlo);
				
				// High
				if (__long)
					codebuilder.addCopy(NativeCode.RETURN_REGISTER + 1, rvhi);
			}
			
			// Load the system call index for IPC exception store
			int ipcesid = volatiles.get();
			codebuilder.addMathConst(StackJavaType.INTEGER, MathType.ADD,
				NativeCode.ZERO_REGISTER, SystemCallIndex.EXCEPTION_STORE,
				ipcesid);
			
			// Perform system call to clear and read exception
			codebuilder.add(NativeInstructionType.SYSTEM_CALL,
				ipcesid, new RegisterList(NativeCode.ZERO_REGISTER));
			
			// Quickly copy out exception value
			int eval = volatiles.get();
			codebuilder.addCopy(NativeCode.RETURN_REGISTER, eval);
			
			// If this value is set, then we fail
			codebuilder.addIfNonZero(eval,
				this.__labelMakeException("cc/squirreljme/jvm/IPCException"));
			
			// Copy out the moved out return values
			if (__out != null)
			{
				// Low value
				codebuilder.addCopy(rvlo, __out.register);
				
				// Possible high value
				if (__long)
					codebuilder.addCopy(rvhi, __out.register + 1);
			}
			
			// No longer needed
			volatiles.remove(eval);
			volatiles.remove(ipcesid);
			volatiles.remove(rvhi);
			volatiles.remove(rvlo);
		}
		
		// Unpure system call (possibly adapted by our own handler)
		else
		{
			// Since this is a standard invocation, we just pass all the
			// input arguments as is
			int n = __in.length;
			int[] args = new int[n];
			for (int i = 0; i < n; i++)
				args[i] = __in[i].register;
			
			// Perform the unpure call into the JVM helper
			this.__invokeStatic(InvokeType.SYSTEM, JVMFUNC_CLASS,

				"jvmSystemCall", "(SIIIIIIII)J", args);
				
			// Copy return value
			if (__out != null)
			{
				// Low value
				codebuilder.addCopy(NativeCode.RETURN_REGISTER,
					__out.register);
				
				// Possible high value
				if (__long)
					codebuilder.addCopy(NativeCode.RETURN_REGISTER + 1,
						__out.register + 1);
			}
		}
	}
	
	/**
	 * Creates and stores an exception.







|











|



|




|




|




|


|






|



|




















|
>






|




|







2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
			// Build the register List
			List<Integer> args = new ArrayList<>();
			int n = __in.length;
			for (int i = 1; i < n; i++)
				args.add(__in[i].register);
			
			// Perform the pure call
			this.codebuilder.add(NativeInstructionType.SYSTEM_CALL,
				__in[0].register, new RegisterList(args));
			
			// Need to store the return value of this call
			VolatileRegisterStack volatiles = this.volatiles;
			int rvlo = volatiles.get(),
				rvhi = volatiles.get();
			
			// Defensive copy of return value
			if (__out != null)
			{
				// Low
				this.codebuilder.addCopy(NativeCode.RETURN_REGISTER, rvlo);
				
				// High
				if (__long)
					this.codebuilder.addCopy(NativeCode.RETURN_REGISTER + 1, rvhi);
			}
			
			// Load the system call index for IPC exception store
			int ipcesid = volatiles.get();
			this.codebuilder.addMathConst(StackJavaType.INTEGER, MathType.ADD,
				NativeCode.ZERO_REGISTER, SystemCallIndex.EXCEPTION_STORE,
				ipcesid);
			
			// Perform system call to clear and read exception
			this.codebuilder.add(NativeInstructionType.SYSTEM_CALL,
				ipcesid, new RegisterList(NativeCode.ZERO_REGISTER));
			
			// Quickly copy out exception value
			int eval = volatiles.get();
			this.codebuilder.addCopy(NativeCode.RETURN_REGISTER, eval);
			
			// If this value is set, then we fail
			this.codebuilder.addIfNonZero(eval,
				this.__labelMakeException("cc/squirreljme/jvm/IPCException"));
			
			// Copy out the moved out return values
			if (__out != null)
			{
				// Low value
				this.codebuilder.addCopy(rvlo, __out.register);
				
				// Possible high value
				if (__long)
					this.codebuilder.addCopy(rvhi, __out.register + 1);
			}
			
			// No longer needed
			volatiles.remove(eval);
			volatiles.remove(ipcesid);
			volatiles.remove(rvhi);
			volatiles.remove(rvlo);
		}
		
		// Unpure system call (possibly adapted by our own handler)
		else
		{
			// Since this is a standard invocation, we just pass all the
			// input arguments as is
			int n = __in.length;
			int[] args = new int[n];
			for (int i = 0; i < n; i++)
				args[i] = __in[i].register;
			
			// Perform the unpure call into the JVM helper
			this.__invokeStatic(InvokeType.SYSTEM,
				NearNativeByteCodeHandler.JVMFUNC_CLASS,
				"jvmSystemCall", "(SIIIIIIII)J", args);
				
			// Copy return value
			if (__out != null)
			{
				// Low value
				this.codebuilder.addCopy(NativeCode.RETURN_REGISTER,
					__out.register);
				
				// Possible high value
				if (__long)
					this.codebuilder.addCopy(NativeCode.RETURN_REGISTER + 1,
						__out.register + 1);
			}
		}
	}
	
	/**
	 * Creates and stores an exception.
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193

3194
3195
3196
3197
3198
3199
3200
		NativeCodeBuilder codebuilder = this.codebuilder;
		
		// Attempt load to the target register
		codebuilder.add(NativeInstructionType.LOAD_POOL,
			new ClassInfoPointer(__cl), __r);
		
		// Detect classes which are dynamically initialized or self
		if (!ClassLoadingAdjustments.isDeferredLoad(state.classname.toString(),
			__cl.toString()))
			return;
		
		// If the class is already loaded do not try loading
		NativeCodeLabel isloaded = new NativeCodeLabel("ciisloaded",
			this._refclunk++);
		codebuilder.addIfNonZero(__r, isloaded);
		
		// Need register to load the class info
		VolatileRegisterStack volatiles = this.volatiles;
		int volnoted = volatiles.get();
		
		// Load the noted class name
		codebuilder.add(NativeInstructionType.LOAD_POOL,
			new NotedString(__cl.toString()), volnoted);
		
		// Initialize the class
		this.__invokeStatic(InvokeType.SYSTEM, JVMFUNC_CLASS,

			"jvmInitClass", "(I)Lcc/squirreljme/jvm/ClassInfo;", volnoted);
		
		// Store the result of the init into the pool
		codebuilder.add(NativeInstructionType.STORE_POOL,
			new ClassInfoPointer(__cl), NativeCode.RETURN_REGISTER);
		
		// Use the value of it







|

















|
>







3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
		NativeCodeBuilder codebuilder = this.codebuilder;
		
		// Attempt load to the target register
		codebuilder.add(NativeInstructionType.LOAD_POOL,
			new ClassInfoPointer(__cl), __r);
		
		// Detect classes which are dynamically initialized or self
		if (!ClassLoadingAdjustments.isDeferredLoad(this.state.classname.toString(),
			__cl.toString()))
			return;
		
		// If the class is already loaded do not try loading
		NativeCodeLabel isloaded = new NativeCodeLabel("ciisloaded",
			this._refclunk++);
		codebuilder.addIfNonZero(__r, isloaded);
		
		// Need register to load the class info
		VolatileRegisterStack volatiles = this.volatiles;
		int volnoted = volatiles.get();
		
		// Load the noted class name
		codebuilder.add(NativeInstructionType.LOAD_POOL,
			new NotedString(__cl.toString()), volnoted);
		
		// Initialize the class
		this.__invokeStatic(InvokeType.SYSTEM,
			NearNativeByteCodeHandler.JVMFUNC_CLASS,
			"jvmInitClass", "(I)Lcc/squirreljme/jvm/ClassInfo;", volnoted);
		
		// Store the result of the init into the pool
		codebuilder.add(NativeInstructionType.STORE_POOL,
			new ClassInfoPointer(__cl), NativeCode.RETURN_REGISTER);
		
		// Use the value of it
3219
3220
3221
3222
3223
3224
3225
3226

3227
3228
3229
3230
3231
3232
3233
		VolatileRegisterStack volatiles = this.volatiles;
		
		// Load the class info for the class
		int volcdvt = volatiles.get();
		this.__loadClassInfo(__cl, volcdvt);
		
		// Call internal class object loader
		this.__invokeStatic(InvokeType.SYSTEM, JVMFUNC_CLASS,

			"jvmLoadClass", "(I)Ljava/lang/Class;", volcdvt);
		
		// Cleanup
		volatiles.remove(volcdvt);
		
		// Copy return value to the output register
		this.codebuilder.addCopy(NativeCode.RETURN_REGISTER, __r);







|
>







3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
		VolatileRegisterStack volatiles = this.volatiles;
		
		// Load the class info for the class
		int volcdvt = volatiles.get();
		this.__loadClassInfo(__cl, volcdvt);
		
		// Call internal class object loader
		this.__invokeStatic(InvokeType.SYSTEM,
			NearNativeByteCodeHandler.JVMFUNC_CLASS,
			"jvmLoadClass", "(I)Ljava/lang/Class;", volcdvt);
		
		// Cleanup
		volatiles.remove(volcdvt);
		
		// Copy return value to the output register
		this.codebuilder.addCopy(NativeCode.RETURN_REGISTER, __r);
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
		NativeCodeBuilder codebuilder = this.codebuilder;
		
		// Load class pool which may already be loaded
		codebuilder.add(NativeInstructionType.LOAD_POOL,
			new ClassPool(__cl), __r);
		
		// Detect classes which are dynamically initialized
		if (!ClassLoadingAdjustments.isDeferredLoad(state.classname.toString(),
			__cl.toString()))
			return;
		
		// Jump if the pool is already loaded
		NativeCodeLabel isloaded = new NativeCodeLabel("piisloaded",
			this._refclunk++);
		codebuilder.addIfNonZero(__r, isloaded);







|







3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
		NativeCodeBuilder codebuilder = this.codebuilder;
		
		// Load class pool which may already be loaded
		codebuilder.add(NativeInstructionType.LOAD_POOL,
			new ClassPool(__cl), __r);
		
		// Detect classes which are dynamically initialized
		if (!ClassLoadingAdjustments.isDeferredLoad(this.state.classname.toString(),
			__cl.toString()))
			return;
		
		// Jump if the pool is already loaded
		NativeCodeLabel isloaded = new NativeCodeLabel("piisloaded",
			this._refclunk++);
		codebuilder.addIfNonZero(__r, isloaded);
3303
3304
3305
3306
3307
3308
3309
3310

3311
3312
3313
3314
3315
3316
3317
	 * @param __enter Is the monitor being entered? 
	 * @param __r The register to enter a monitor for.
	 * @since 2019/04/26
	 */
	private final void __monitor(boolean __enter, int __r)
	{
		// Call helper method
		this.__invokeStatic(InvokeType.SYSTEM, JVMFUNC_CLASS,

			(__enter ? "jvmMonitorEnter" : "jvmMonitorExit"), "(I)V", __r);
	}
	
	/**
	 * If anything has been previously pushed then generate code to clear it.
	 *
	 * @since 2019/03/30







|
>







3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
	 * @param __enter Is the monitor being entered? 
	 * @param __r The register to enter a monitor for.
	 * @since 2019/04/26
	 */
	private final void __monitor(boolean __enter, int __r)
	{
		// Call helper method
		this.__invokeStatic(InvokeType.SYSTEM,
			NearNativeByteCodeHandler.JVMFUNC_CLASS,
			(__enter ? "jvmMonitorEnter" : "jvmMonitorExit"), "(I)V", __r);
	}
	
	/**
	 * If anything has been previously pushed then generate code to clear it.
	 *
	 * @since 2019/03/30
3464
3465
3466
3467
3468
3469
3470
3471

3472
3473
3474
3475
3476
3477
3478
		codebuilder.add(NativeInstructionType.ATOMIC_INT_DECREMENT_AND_GET,
			volnowcount, __r, Constants.OBJECT_COUNT_OFFSET);
		
		// If the count is still positive, we do not GC
		codebuilder.addIfPositive(volnowcount, ncj);
		
		// Call garbage collect on object via helper
		this.__invokeStatic(InvokeType.SYSTEM, JVMFUNC_CLASS,

			"jvmGarbageCollectObject", "(I)V", __r);
		
		// Reset the variable to zero to prevent it from being used again
		codebuilder.addCopy(NativeCode.ZERO_REGISTER, __r);
		
		// No uncount or not GCed are jumped here
		codebuilder.label(ncj);







|
>







3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
		codebuilder.add(NativeInstructionType.ATOMIC_INT_DECREMENT_AND_GET,
			volnowcount, __r, Constants.OBJECT_COUNT_OFFSET);
		
		// If the count is still positive, we do not GC
		codebuilder.addIfPositive(volnowcount, ncj);
		
		// Call garbage collect on object via helper
		this.__invokeStatic(InvokeType.SYSTEM,
			NearNativeByteCodeHandler.JVMFUNC_CLASS,
			"jvmGarbageCollectObject", "(I)V", __r);
		
		// Reset the variable to zero to prevent it from being used again
		codebuilder.addCopy(NativeCode.ZERO_REGISTER, __r);
		
		// No uncount or not GCed are jumped here
		codebuilder.label(ncj);
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
	private final void __useEDataDebugPoint(__EData__ __ed, int __jop)
		throws NullPointerException
	{
		if (__ed == null)
			throw new NullPointerException("NARG");
		
		// Add debug point (operation becomes debug point 1)
		codebuilder.add(NativeInstructionType.DEBUG_POINT,
			__ed.line & 0x7FFF, __jop,
			__ed.jpc & 0x7FFF);
	}
}








|





3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
	private final void __useEDataDebugPoint(__EData__ __ed, int __jop)
		throws NullPointerException
	{
		if (__ed == null)
			throw new NullPointerException("NARG");
		
		// Add debug point (operation becomes debug point 1)
		this.codebuilder.add(NativeInstructionType.DEBUG_POINT,
			__ed.line & 0x7FFF, __jop,
			__ed.jpc & 0x7FFF);
	}
}

Name change from runt/libs/tool-classfile/dev/shadowtail/classfile/nncc/RegisterList.java to modules/tool-classfile/src/main/java/dev/shadowtail/classfile/nncc/RegisterList.java.

Name change from runt/libs/tool-classfile/dev/shadowtail/classfile/nncc/StateOperationsAndTarget.java to modules/tool-classfile/src/main/java/dev/shadowtail/classfile/nncc/StateOperationsAndTarget.java.

Name change from runt/libs/tool-classfile/dev/shadowtail/classfile/nncc/VolatileRegisterStack.java to modules/tool-classfile/src/main/java/dev/shadowtail/classfile/nncc/VolatileRegisterStack.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package dev.shadowtail.classfile.nncc;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

/**
 * This is a stack which is used to manage which volatile registers are used.
 *
 * @since 2019/05/24
 */
public final class VolatileRegisterStack













<







1
2
3
4
5
6
7
8
9
10
11
12
13

14
15
16
17
18
19
20
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package dev.shadowtail.classfile.nncc;

import java.util.ArrayList;
import java.util.Collection;


/**
 * This is a stack which is used to manage which volatile registers are used.
 *
 * @since 2019/05/24
 */
public final class VolatileRegisterStack

Name change from runt/libs/tool-classfile/dev/shadowtail/classfile/nncc/__Debug__.java to modules/tool-classfile/src/main/java/dev/shadowtail/classfile/nncc/__Debug__.java.

Name change from runt/libs/tool-classfile/dev/shadowtail/classfile/nncc/__EData__.java to modules/tool-classfile/src/main/java/dev/shadowtail/classfile/nncc/__EData__.java.

Name change from runt/libs/tool-classfile/dev/shadowtail/classfile/nncc/package-info.java to modules/tool-classfile/src/main/java/dev/shadowtail/classfile/nncc/package-info.java.

Name change from runt/libs/tool-classfile/dev/shadowtail/classfile/pool/AccessedField.java to modules/tool-classfile/src/main/java/dev/shadowtail/classfile/pool/AccessedField.java.

Name change from runt/libs/tool-classfile/dev/shadowtail/classfile/pool/BasicPool.java to modules/tool-classfile/src/main/java/dev/shadowtail/classfile/pool/BasicPool.java.

Name change from runt/libs/tool-classfile/dev/shadowtail/classfile/pool/BasicPoolBuilder.java to modules/tool-classfile/src/main/java/dev/shadowtail/classfile/pool/BasicPoolBuilder.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package dev.shadowtail.classfile.pool;

import java.util.Collection;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Map;
import net.multiphasicapps.collections.UnmodifiableIterator;

/**
 * This class is used to store and contain the basic constant pool which











<







1
2
3
4
5
6
7
8
9
10
11

12
13
14
15
16
17
18
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package dev.shadowtail.classfile.pool;


import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Map;
import net.multiphasicapps.collections.UnmodifiableIterator;

/**
 * This class is used to store and contain the basic constant pool which

Name change from runt/libs/tool-classfile/dev/shadowtail/classfile/pool/BasicPoolEntry.java to modules/tool-classfile/src/main/java/dev/shadowtail/classfile/pool/BasicPoolEntry.java.

Name change from runt/libs/tool-classfile/dev/shadowtail/classfile/pool/ClassInfoPointer.java to modules/tool-classfile/src/main/java/dev/shadowtail/classfile/pool/ClassInfoPointer.java.

Name change from runt/libs/tool-classfile/dev/shadowtail/classfile/pool/ClassPool.java to modules/tool-classfile/src/main/java/dev/shadowtail/classfile/pool/ClassPool.java.

Name change from runt/libs/tool-classfile/dev/shadowtail/classfile/pool/DualClassRuntimePool.java to modules/tool-classfile/src/main/java/dev/shadowtail/classfile/pool/DualClassRuntimePool.java.

Name change from runt/libs/tool-classfile/dev/shadowtail/classfile/pool/DualClassRuntimePoolBuilder.java to modules/tool-classfile/src/main/java/dev/shadowtail/classfile/pool/DualClassRuntimePoolBuilder.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package dev.shadowtail.classfile.pool;

import dev.shadowtail.classfile.mini.MinimizedPoolEntryType;
import java.util.List;
import java.util.ArrayList;
import net.multiphasicapps.classfile.ClassName;
import net.multiphasicapps.classfile.ClassNames;
import net.multiphasicapps.classfile.FieldDescriptor;
import net.multiphasicapps.classfile.FieldReference;
import net.multiphasicapps.classfile.MethodDescriptor;
import net.multiphasicapps.classfile.MethodHandle;













<
<







1
2
3
4
5
6
7
8
9
10
11
12


13
14
15
16
17
18
19
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package dev.shadowtail.classfile.pool;

import dev.shadowtail.classfile.mini.MinimizedPoolEntryType;


import net.multiphasicapps.classfile.ClassName;
import net.multiphasicapps.classfile.ClassNames;
import net.multiphasicapps.classfile.FieldDescriptor;
import net.multiphasicapps.classfile.FieldReference;
import net.multiphasicapps.classfile.MethodDescriptor;
import net.multiphasicapps.classfile.MethodHandle;

Name change from runt/libs/tool-classfile/dev/shadowtail/classfile/pool/FieldAccessTime.java to modules/tool-classfile/src/main/java/dev/shadowtail/classfile/pool/FieldAccessTime.java.

38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
	 * @since 2019/04/17
	 */
	public static final FieldAccessTime of(int __i)
		throws IllegalArgumentException
	{
		switch (__i)
		{
			case 0:	return INITIALIZER;
			case 1: return NORMAL;
			case 2: return READ;
		}
		
		// {@squirreljme.error JC14 Unknown access time. (The index)}
		throw new IllegalArgumentException("JC14 " + __i);
	}
}








|
|
|







38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
	 * @since 2019/04/17
	 */
	public static final FieldAccessTime of(int __i)
		throws IllegalArgumentException
	{
		switch (__i)
		{
			case 0:	return FieldAccessTime.INITIALIZER;
			case 1: return FieldAccessTime.NORMAL;
			case 2: return FieldAccessTime.READ;
		}
		
		// {@squirreljme.error JC14 Unknown access time. (The index)}
		throw new IllegalArgumentException("JC14 " + __i);
	}
}

Name change from runt/libs/tool-classfile/dev/shadowtail/classfile/pool/FieldAccessType.java to modules/tool-classfile/src/main/java/dev/shadowtail/classfile/pool/FieldAccessType.java.

30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
	 * Is this field access static?
	 *
	 * @return If this is a static field access.
	 * @since 2019/04/22
	 */
	public final boolean isStatic()
	{
		return this == STATIC;
	}
	
	/**
	 * Returns the access type for the given ordinal.
	 *
	 * @param __i The ordinal.
	 * @return The access type.
	 * @throws IllegalArgumentException If it is not valid.
	 * @since 2019/04/17
	 */
	public static final FieldAccessType of(int __i)
		throws IllegalArgumentException
	{
		switch (__i)
		{
			case 0:	return STATIC;
			case 1: return INSTANCE;
		}
		
		// {@squirreljme.error JC15 Unknown access type. (The index)}
		throw new IllegalArgumentException("JC15 " + __i);
	}
}








|















|
|







30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
	 * Is this field access static?
	 *
	 * @return If this is a static field access.
	 * @since 2019/04/22
	 */
	public final boolean isStatic()
	{
		return this == FieldAccessType.STATIC;
	}
	
	/**
	 * Returns the access type for the given ordinal.
	 *
	 * @param __i The ordinal.
	 * @return The access type.
	 * @throws IllegalArgumentException If it is not valid.
	 * @since 2019/04/17
	 */
	public static final FieldAccessType of(int __i)
		throws IllegalArgumentException
	{
		switch (__i)
		{
			case 0:	return FieldAccessType.STATIC;
			case 1: return FieldAccessType.INSTANCE;
		}
		
		// {@squirreljme.error JC15 Unknown access type. (The index)}
		throw new IllegalArgumentException("JC15 " + __i);
	}
}

Name change from runt/libs/tool-classfile/dev/shadowtail/classfile/pool/InvokeType.java to modules/tool-classfile/src/main/java/dev/shadowtail/classfile/pool/InvokeType.java.

50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
	 * Is this a static invocation?
	 *
	 * @return If this is a static invocation.
	 * @since 2019/04/22
	 */
	public final boolean isStatic()
	{
		return this == STATIC || this == SYSTEM;
	}
	
	/**
	 * Returns the invocation type for the given ordinal.
	 *
	 * @param __i The ordinal.
	 * @return The invocation type.
	 * @throws IllegalArgumentException If it is not valid.
	 * @since 2019/04/17
	 */
	public static final InvokeType of(int __i)
		throws IllegalArgumentException
	{
		switch (__i)
		{
			case 0:	return STATIC;
			case 1: return SPECIAL;
			case 2: return VIRTUAL;
			case 3: return INTERFACE;
			case 4: return SYSTEM;
		}
		
		// {@squirreljme.error JC16 Unknown invocation type. (The index)}
		throw new IllegalArgumentException("JC16 " + __i);
	}
}








|















|
|
|
|
|







50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
	 * Is this a static invocation?
	 *
	 * @return If this is a static invocation.
	 * @since 2019/04/22
	 */
	public final boolean isStatic()
	{
		return this == InvokeType.STATIC || this == InvokeType.SYSTEM;
	}
	
	/**
	 * Returns the invocation type for the given ordinal.
	 *
	 * @param __i The ordinal.
	 * @return The invocation type.
	 * @throws IllegalArgumentException If it is not valid.
	 * @since 2019/04/17
	 */
	public static final InvokeType of(int __i)
		throws IllegalArgumentException
	{
		switch (__i)
		{
			case 0:	return InvokeType.STATIC;
			case 1: return InvokeType.SPECIAL;
			case 2: return InvokeType.VIRTUAL;
			case 3: return InvokeType.INTERFACE;
			case 4: return InvokeType.SYSTEM;
		}
		
		// {@squirreljme.error JC16 Unknown invocation type. (The index)}
		throw new IllegalArgumentException("JC16 " + __i);
	}
}

Name change from runt/libs/tool-classfile/dev/shadowtail/classfile/pool/InvokedMethod.java to modules/tool-classfile/src/main/java/dev/shadowtail/classfile/pool/InvokedMethod.java.

Name change from runt/libs/tool-classfile/dev/shadowtail/classfile/pool/MethodIndex.java to modules/tool-classfile/src/main/java/dev/shadowtail/classfile/pool/MethodIndex.java.

Name change from runt/libs/tool-classfile/dev/shadowtail/classfile/pool/NotedString.java to modules/tool-classfile/src/main/java/dev/shadowtail/classfile/pool/NotedString.java.

Name change from runt/libs/tool-classfile/dev/shadowtail/classfile/pool/NullPoolEntry.java to modules/tool-classfile/src/main/java/dev/shadowtail/classfile/pool/NullPoolEntry.java.

Name change from runt/libs/tool-classfile/dev/shadowtail/classfile/pool/UsedString.java to modules/tool-classfile/src/main/java/dev/shadowtail/classfile/pool/UsedString.java.

Name change from runt/libs/tool-classfile/dev/shadowtail/classfile/pool/package-info.java to modules/tool-classfile/src/main/java/dev/shadowtail/classfile/pool/package-info.java.

Name change from runt/libs/tool-classfile/dev/shadowtail/classfile/xlate/ByteCodeHandler.java to modules/tool-classfile/src/main/java/dev/shadowtail/classfile/xlate/ByteCodeHandler.java.

27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
	/**
	 * Read length of array.
	 *
	 * @param __in The instance.
	 * @param __len The output length.
	 * @since 2019/04/12
	 */
	public abstract void doArrayLength(JavaStackResult.Input __in,
		JavaStackResult.Output __len);
	
	/**
	 * Load from array.
	 *
	 * @param __dt The type of data to load.
	 * @param __in The instance.
	 * @param __dx The index.
	 * @param __v The value.
	 * @since 2019/04/12
	 */
	public abstract void doArrayLoad(DataType __dt,
		JavaStackResult.Input __in, JavaStackResult.Input __dx,
		JavaStackResult.Output __v);
	
	/**
	 * Store into array.
	 *
	 * @param __dt The type of data to store.
	 * @param __in The instance.
	 * @param __dx The index.
	 * @param __v The value.
	 * @since 2019/04/12
	 */
	public abstract void doArrayStore(DataType __dt,
		JavaStackResult.Input __in, JavaStackResult.Input __dx,
		JavaStackResult.Input __v);
	
	/**
	 * Check that an object is of a given type or thrown exception.
	 *
	 * @param __cl The class to check.
	 * @param __v The object to check.
	 * @since 2019/04/12
	 */
	public abstract void doCheckCast(ClassName __cl,
		JavaStackResult.Input __v);
	
	/**
	 * Loads the class object of a class.
	 *
	 * @param __cl The class object to load.
	 * @param __out The output register.
	 * @since 2019/04/26
	 */
	public abstract void doClassObjectLoad(ClassName __cl,
		JavaStackResult.Output __out);
	
	/**
	 * Performs convert of value.
	 *
	 * @param __as The source type.
	 * @param __a The input.
	 * @param __bs The output type.
	 * @param __b The output.
	 * @since 2019/04/16
	 */
	public abstract void doConvert(StackJavaType __as,
		JavaStackResult.Input __a, StackJavaType __bs,
		JavaStackResult.Output __b);
	
	/**
	 * Performs a copy operation.
	 *
	 * @param __in The input.
	 * @param __out The output.
	 * @since 2019/04/07
	 */
	public abstract void doCopy(JavaStackResult.Input __in,
		JavaStackResult.Output __out);
	
	/**
	 * Reads a field.
	 *
	 * @param __fr The field reference.
	 * @param __i The instance.
	 * @param __v The output value.
	 * @since 2019/04/12
	 */
	public abstract void doFieldGet(FieldReference __fr,
		JavaStackResult.Input __i, JavaStackResult.Output __v);
	
	/**
	 * Puts a field.
	 *
	 * @param __fr The field reference.
	 * @param __i The instance.
	 * @param __v The value.
	 * @since 2019/04/12
	 */
	public abstract void doFieldPut(FieldReference __fr,
		JavaStackResult.Input __i, JavaStackResult.Input __v);
	
	/**
	 * Compares two values and then possibly jumps.
	 *
	 * @param __a The first value.
	 * @param __b The second value.
	 * @param __ijt The jump target.
	 * @since 2019/04/12
	 */
	public abstract void doIfICmp(CompareType __ct, JavaStackResult.Input __a,
		JavaStackResult.Input __b, InstructionJumpTarget __ijt);
	
	/**
	 * Invocation of a method.
	 *
	 * @param __t The type of invoke to be performed.
	 * @param __r The reference to the method.
	 * @param __out The output.
	 * @param __in The arguments to the method.
	 * @since 2019/04/10
	 */
	public abstract void doInvoke(InvokeType __t, MethodReference __r,
		JavaStackResult.Output __out, JavaStackResult.Input... __in);
	
	/**
	 * Check that an object is of a given type and sets the stack if it is.
	 *
	 * @param __cl The class to check.
	 * @param __v The object to check.
	 * @param __o The output.
	 * @since 2019/04/16
	 */
	public abstract void doInstanceOf(ClassName __cl,
		JavaStackResult.Input __v, JavaStackResult.Output __o);
	
	/**
	 * Generates a lookup on a lookup table then jumps to a target.
	 *
	 * @param __key The key to check against.
	 * @param __ls The lookup switch.
	 * @since 2019/04/16
	 */
	public abstract void doLookupSwitch(JavaStackResult.Input __key,
		LookupSwitch __ls);
	
	/**
	 * Performs math operation.
	 *
	 * @param __dt The type to operate on.
	 * @param __mt The math operation to perform.
	 * @param __a Argument A.
	 * @param __b Argument B.
	 * @param __c Output.
	 * @since 2019/04/07
	 */
	public abstract void doMath(StackJavaType __dt, MathType __mt,
		JavaStackResult.Input __a, JavaStackResult.Input __b,
		JavaStackResult.Output __c);
	
	/**
	 * Performs math operation.
	 *
	 * @param __dt The type to operate on.
	 * @param __mt The math operation to perform.
	 * @param __a Argument A.
	 * @param __b Constant B.
	 * @param __c Output.
	 * @since 2019/04/07
	 */
	public abstract void doMath(StackJavaType __dt, MathType __mt,
		JavaStackResult.Input __a, Number __b, JavaStackResult.Output __c);
	
	/**
	 * Enter or exit the monitor.
	 *
	 * @param __enter Being entered?
	 * @param __o The object to enter or exit.
	 * @since 2019/04/16
	 */
	public abstract void doMonitor(boolean __enter, JavaStackResult.Input __o);
	
	/**
	 * Allocates multi-dimensional array.
	 *
	 * @param __cl The class name.
	 * @param __numdim The number of dimensions.
	 * @param __o The output value.
	 * @param __dims The input dimensions.
	 * @since 2019/05/04
	 */
	public abstract void doMultiANewArray(ClassName __cl, int __numdims,
		JavaStackResult.Output __o, JavaStackResult.Input... __dims);
	
	/**
	 * Allocates new class.
	 *
	 * @param __cn The class to allocate.
	 * @param __out The output.
	 * @since 2019/04/11
	 */
	public abstract void doNew(ClassName __cn, JavaStackResult.Output __out);
	
	/**
	 * Allocates a new array.
	 *
	 * @param __at The array type with all the needed dimensions.
	 * @param __len The length of the array.
	 * @param __out Where the array is to be stored.
	 * @since 2019/04/12
	 */
	public abstract void doNewArray(ClassName __at,
		JavaStackResult.Input __len, JavaStackResult.Output __out);
	
	/**
	 * Loads pool value.
	 *
	 * @param __v The value to load.
	 * @param __out The output.
	 * @since 2019/04/12
	 */
	public abstract void doPoolLoad(Object __v, JavaStackResult.Output __out);
	
	/**
	 * Return of value.
	 *
	 * @param __rv The return value, {@code null} means no value was returned.
	 * @since 2019/04/11
	 */
	public abstract void doReturn(JavaStackResult.Input __in);
	
	/**
	 * Generates code for state operations.
	 *
	 * @param __ops The operations to perform.
	 * @since 2019/04/11
	 */
	public abstract void doStateOperations(StateOperations __ops);
	
	/**
	 * Reads a static field.
	 *
	 * @param __fr The field to read from.
	 * @param __v The output register.
	 * @since 2019/04/12
	 */
	public abstract void doStaticGet(FieldReference __fr,
		JavaStackResult.Output __v);
	
	/**
	 * Writes a static field.
	 *
	 * @param __fr The field to write to.
	 * @param __v The input register.
	 * @since 2019/04/13
	 */
	public abstract void doStaticPut(FieldReference __fr,
		JavaStackResult.Input __v);
	
	/**
	 * Throws the given object.
	 *
	 * @param __in The object to throw.
	 * @since 2019/04/12
	 */
	public abstract void doThrow(JavaStackResult.Input __in);
	
	/**
	 * Finishes handling the instruction operation.
	 *
	 * @since 2019/04/07
	 */
	public abstract void instructionFinish();
	
	/**
	 * Sets up before processing the instruction.
	 *
	 * @since 2019/04/07
	 */
	public abstract void instructionSetup();
	
	/**
	 * Returns the state of the byte code, this must always return the
	 * same object.
	 *
	 * @return The byte code state.
	 * @since 2019/04/06
	 */
	public abstract ByteCodeState state();
}








|











|
<
|










|
<
|








<
|








|
<










|
<
|








|
<









|
|









|
|









|











|










|
|








|
<











|
<
|











|
|








|





|




|









|









|
|








|




|


|







|








|
<








|
<







|






|






|








|


27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46

47
48
49
50
51
52
53
54
55
56
57
58

59
60
61
62
63
64
65
66
67

68
69
70
71
72
73
74
75
76
77

78
79
80
81
82
83
84
85
86
87
88

89
90
91
92
93
94
95
96
97
98

99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163

164
165
166
167
168
169
170
171
172
173
174
175

176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264

265
266
267
268
269
270
271
272
273

274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
	/**
	 * Read length of array.
	 *
	 * @param __in The instance.
	 * @param __len The output length.
	 * @since 2019/04/12
	 */
	void doArrayLength(JavaStackResult.Input __in,
		JavaStackResult.Output __len);
	
	/**
	 * Load from array.
	 *
	 * @param __dt The type of data to load.
	 * @param __in The instance.
	 * @param __dx The index.
	 * @param __v The value.
	 * @since 2019/04/12
	 */
	void doArrayLoad(DataType __dt, JavaStackResult.Input __in,

		JavaStackResult.Input __dx, JavaStackResult.Output __v);
	
	/**
	 * Store into array.
	 *
	 * @param __dt The type of data to store.
	 * @param __in The instance.
	 * @param __dx The index.
	 * @param __v The value.
	 * @since 2019/04/12
	 */
	void doArrayStore(DataType __dt, JavaStackResult.Input __in,

		JavaStackResult.Input __dx, JavaStackResult.Input __v);
	
	/**
	 * Check that an object is of a given type or thrown exception.
	 *
	 * @param __cl The class to check.
	 * @param __v The object to check.
	 * @since 2019/04/12
	 */

	void doCheckCast(ClassName __cl, JavaStackResult.Input __v);
	
	/**
	 * Loads the class object of a class.
	 *
	 * @param __cl The class object to load.
	 * @param __out The output register.
	 * @since 2019/04/26
	 */
	void doClassObjectLoad(ClassName __cl, JavaStackResult.Output __out);

	
	/**
	 * Performs convert of value.
	 *
	 * @param __as The source type.
	 * @param __a The input.
	 * @param __bs The output type.
	 * @param __b The output.
	 * @since 2019/04/16
	 */
	void doConvert(StackJavaType __as, JavaStackResult.Input __a,

		StackJavaType __bs, JavaStackResult.Output __b);
	
	/**
	 * Performs a copy operation.
	 *
	 * @param __in The input.
	 * @param __out The output.
	 * @since 2019/04/07
	 */
	void doCopy(JavaStackResult.Input __in, JavaStackResult.Output __out);

	
	/**
	 * Reads a field.
	 *
	 * @param __fr The field reference.
	 * @param __i The instance.
	 * @param __v The output value.
	 * @since 2019/04/12
	 */
	void doFieldGet(FieldReference __fr, JavaStackResult.Input __i,
		JavaStackResult.Output __v);
	
	/**
	 * Puts a field.
	 *
	 * @param __fr The field reference.
	 * @param __i The instance.
	 * @param __v The value.
	 * @since 2019/04/12
	 */
	void doFieldPut(FieldReference __fr, JavaStackResult.Input __i,
		JavaStackResult.Input __v);
	
	/**
	 * Compares two values and then possibly jumps.
	 *
	 * @param __a The first value.
	 * @param __b The second value.
	 * @param __ijt The jump target.
	 * @since 2019/04/12
	 */
	void doIfICmp(CompareType __ct, JavaStackResult.Input __a,
		JavaStackResult.Input __b, InstructionJumpTarget __ijt);
	
	/**
	 * Invocation of a method.
	 *
	 * @param __t The type of invoke to be performed.
	 * @param __r The reference to the method.
	 * @param __out The output.
	 * @param __in The arguments to the method.
	 * @since 2019/04/10
	 */
	void doInvoke(InvokeType __t, MethodReference __r,
		JavaStackResult.Output __out, JavaStackResult.Input... __in);
	
	/**
	 * Check that an object is of a given type and sets the stack if it is.
	 *
	 * @param __cl The class to check.
	 * @param __v The object to check.
	 * @param __o The output.
	 * @since 2019/04/16
	 */
	void doInstanceOf(ClassName __cl, JavaStackResult.Input __v,
		JavaStackResult.Output __o);
	
	/**
	 * Generates a lookup on a lookup table then jumps to a target.
	 *
	 * @param __key The key to check against.
	 * @param __ls The lookup switch.
	 * @since 2019/04/16
	 */
	void doLookupSwitch(JavaStackResult.Input __key, LookupSwitch __ls);

	
	/**
	 * Performs math operation.
	 *
	 * @param __dt The type to operate on.
	 * @param __mt The math operation to perform.
	 * @param __a Argument A.
	 * @param __b Argument B.
	 * @param __c Output.
	 * @since 2019/04/07
	 */
	void doMath(StackJavaType __dt, MathType __mt, JavaStackResult.Input __a,

		JavaStackResult.Input __b, JavaStackResult.Output __c);
	
	/**
	 * Performs math operation.
	 *
	 * @param __dt The type to operate on.
	 * @param __mt The math operation to perform.
	 * @param __a Argument A.
	 * @param __b Constant B.
	 * @param __c Output.
	 * @since 2019/04/07
	 */
	void doMath(StackJavaType __dt, MathType __mt, JavaStackResult.Input __a,
		Number __b, JavaStackResult.Output __c);
	
	/**
	 * Enter or exit the monitor.
	 *
	 * @param __enter Being entered?
	 * @param __o The object to enter or exit.
	 * @since 2019/04/16
	 */
	void doMonitor(boolean __enter, JavaStackResult.Input __o);
	
	/**
	 * Allocates multi-dimensional array.
	 *
	 * @param __cl The class name.
	 * @param __numdims The number of dimensions.
	 * @param __o The output value.
	 * @param __dims The input dimensions.
	 * @since 2019/05/04
	 */
	void doMultiANewArray(ClassName __cl, int __numdims,
		JavaStackResult.Output __o, JavaStackResult.Input... __dims);
	
	/**
	 * Allocates new class.
	 *
	 * @param __cn The class to allocate.
	 * @param __out The output.
	 * @since 2019/04/11
	 */
	void doNew(ClassName __cn, JavaStackResult.Output __out);
	
	/**
	 * Allocates a new array.
	 *
	 * @param __at The array type with all the needed dimensions.
	 * @param __len The length of the array.
	 * @param __out Where the array is to be stored.
	 * @since 2019/04/12
	 */
	void doNewArray(ClassName __at, JavaStackResult.Input __len,
		JavaStackResult.Output __out);
	
	/**
	 * Loads pool value.
	 *
	 * @param __v The value to load.
	 * @param __out The output.
	 * @since 2019/04/12
	 */
	void doPoolLoad(Object __v, JavaStackResult.Output __out);
	
	/**
	 * Return of value.
	 *
	 * @param __in The return value, {@code null} means no value was returned.
	 * @since 2019/04/11
	 */
	void doReturn(JavaStackResult.Input __in);
	
	/**
	 * Generates code for state operations.
	 *
	 * @param __ops The operations to perform.
	 * @since 2019/04/11
	 */
	void doStateOperations(StateOperations __ops);
	
	/**
	 * Reads a static field.
	 *
	 * @param __fr The field to read from.
	 * @param __v The output register.
	 * @since 2019/04/12
	 */
	void doStaticGet(FieldReference __fr, JavaStackResult.Output __v);

	
	/**
	 * Writes a static field.
	 *
	 * @param __fr The field to write to.
	 * @param __v The input register.
	 * @since 2019/04/13
	 */
	void doStaticPut(FieldReference __fr, JavaStackResult.Input __v);

	
	/**
	 * Throws the given object.
	 *
	 * @param __in The object to throw.
	 * @since 2019/04/12
	 */
	void doThrow(JavaStackResult.Input __in);
	
	/**
	 * Finishes handling the instruction operation.
	 *
	 * @since 2019/04/07
	 */
	void instructionFinish();
	
	/**
	 * Sets up before processing the instruction.
	 *
	 * @since 2019/04/07
	 */
	void instructionSetup();
	
	/**
	 * Returns the state of the byte code, this must always return the
	 * same object.
	 *
	 * @return The byte code state.
	 * @since 2019/04/06
	 */
	ByteCodeState state();
}

Name change from runt/libs/tool-classfile/dev/shadowtail/classfile/xlate/ByteCodeProcessor.java to modules/tool-classfile/src/main/java/dev/shadowtail/classfile/xlate/ByteCodeProcessor.java.

11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39

import dev.shadowtail.classfile.pool.InvokeType;
import java.util.Map;
import net.multiphasicapps.classfile.ByteCode;
import net.multiphasicapps.classfile.ClassName;
import net.multiphasicapps.classfile.ConstantValue;
import net.multiphasicapps.classfile.ConstantValueClass;
import net.multiphasicapps.classfile.ConstantValueNumber;
import net.multiphasicapps.classfile.ExceptionHandler;
import net.multiphasicapps.classfile.ExceptionHandlerTable;
import net.multiphasicapps.classfile.FieldDescriptor;
import net.multiphasicapps.classfile.FieldReference;
import net.multiphasicapps.classfile.Instruction;
import net.multiphasicapps.classfile.InstructionIndex;
import net.multiphasicapps.classfile.InstructionJumpTarget;
import net.multiphasicapps.classfile.InstructionJumpTargets;
import net.multiphasicapps.classfile.InvalidClassFormatException;
import net.multiphasicapps.classfile.JavaType;
import net.multiphasicapps.classfile.LookupSwitch;
import net.multiphasicapps.classfile.MethodDescriptor;
import net.multiphasicapps.classfile.MethodHandle;
import net.multiphasicapps.classfile.MethodName;
import net.multiphasicapps.classfile.MethodReference;
import net.multiphasicapps.classfile.PrimitiveType;
import net.multiphasicapps.classfile.StackMapTable;
import net.multiphasicapps.classfile.StackMapTableState;

/**
 * This class goes through the byte code for a method and then performs stack







<
<
<









<

<







11
12
13
14
15
16
17



18
19
20
21
22
23
24
25
26

27

28
29
30
31
32
33
34

import dev.shadowtail.classfile.pool.InvokeType;
import java.util.Map;
import net.multiphasicapps.classfile.ByteCode;
import net.multiphasicapps.classfile.ClassName;
import net.multiphasicapps.classfile.ConstantValue;
import net.multiphasicapps.classfile.ConstantValueClass;



import net.multiphasicapps.classfile.FieldDescriptor;
import net.multiphasicapps.classfile.FieldReference;
import net.multiphasicapps.classfile.Instruction;
import net.multiphasicapps.classfile.InstructionIndex;
import net.multiphasicapps.classfile.InstructionJumpTarget;
import net.multiphasicapps.classfile.InstructionJumpTargets;
import net.multiphasicapps.classfile.InvalidClassFormatException;
import net.multiphasicapps.classfile.JavaType;
import net.multiphasicapps.classfile.LookupSwitch;

import net.multiphasicapps.classfile.MethodHandle;

import net.multiphasicapps.classfile.MethodReference;
import net.multiphasicapps.classfile.PrimitiveType;
import net.multiphasicapps.classfile.StackMapTable;
import net.multiphasicapps.classfile.StackMapTableState;

/**
 * This class goes through the byte code for a method and then performs stack
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
	 * Pushes a null constant to the stack.
	 *
	 * @since 2019/04/16
	 */
	private final void __doAConstNull()
	{
		// -> [ref]
		JavaStackResult result = state.stack.doStack(0, JavaType.OBJECT);
		this.__update(result);
		
		// Stop pre-processing here
		if (!this._dohandling)
			return;
		
		// Handle







|







542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
	 * Pushes a null constant to the stack.
	 *
	 * @since 2019/04/16
	 */
	private final void __doAConstNull()
	{
		// -> [ref]
		JavaStackResult result = this.state.stack.doStack(0, JavaType.OBJECT);
		this.__update(result);
		
		// Stop pre-processing here
		if (!this._dohandling)
			return;
		
		// Handle
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
	 */
	private final void __doArrayLength()
	{
		// An exception may be thrown
		this._canexception = true;
		
		// [array] -> [len]
		JavaStackResult result = state.stack.doStack(1, JavaType.INTEGER);
		this.__update(result);
		
		// Stop pre-processing here
		if (!this._dohandling)
			return;
		
		// Handle







|







564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
	 */
	private final void __doArrayLength()
	{
		// An exception may be thrown
		this._canexception = true;
		
		// [array] -> [len]
		JavaStackResult result = this.state.stack.doStack(1, JavaType.INTEGER);
		this.__update(result);
		
		// Stop pre-processing here
		if (!this._dohandling)
			return;
		
		// Handle
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
			faketype = __pt.stackJavaType();
		
		// Otherwise, pop twice and see what the array is and work from
		// that
		else
		{
			// Pop two
			JavaStackResult wouldbe = state.stack.doStack(2);
			
			// Get the base type
			ClassName maybecl = wouldbe.in(0).type.type().className();
			
			// If this is an array then get the component type and work
			// from it, otherwise just assume it is Object since we could
			// not derive that info at all
			faketype = (maybecl.isArray() ?
				new JavaType(maybecl.componentType()) : JavaType.OBJECT);
		}
		
		// [array, index] -> [value]
		JavaStackResult result = state.stack.doStack(2, faketype);
		this.__update(result);
		
		// Stop pre-processing here
		if (!this._dohandling)
			return;
		
		// Handle







|












|







597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
			faketype = __pt.stackJavaType();
		
		// Otherwise, pop twice and see what the array is and work from
		// that
		else
		{
			// Pop two
			JavaStackResult wouldbe = this.state.stack.doStack(2);
			
			// Get the base type
			ClassName maybecl = wouldbe.in(0).type.type().className();
			
			// If this is an array then get the component type and work
			// from it, otherwise just assume it is Object since we could
			// not derive that info at all
			faketype = (maybecl.isArray() ?
				new JavaType(maybecl.componentType()) : JavaType.OBJECT);
		}
		
		// [array, index] -> [value]
		JavaStackResult result = this.state.stack.doStack(2, faketype);
		this.__update(result);
		
		// Stop pre-processing here
		if (!this._dohandling)
			return;
		
		// Handle
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
	 */
	private final void __doArrayStore(PrimitiveType __pt)
	{
		// An exception may be thrown
		this._canexception = true;
		
		// [array, index, value]
		JavaStackResult result = state.stack.doStack(3);
		this.__update(result);
		
		// Stop pre-processing here
		if (!this._dohandling)
			return;
		
		// Handle







|







635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
	 */
	private final void __doArrayStore(PrimitiveType __pt)
	{
		// An exception may be thrown
		this._canexception = true;
		
		// [array, index, value]
		JavaStackResult result = this.state.stack.doStack(3);
		this.__update(result);
		
		// Stop pre-processing here
		if (!this._dohandling)
			return;
		
		// Handle
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
	private final void __doConvert(StackJavaType __from, StackJavaType __to)
		throws NullPointerException
	{
		if (__from == null || __to == null)
			throw new NullPointerException("NARG");
		
		// [from] -> [to]
		JavaStackResult result = state.stack.doStack(1, __to.toJavaType());
		this.__update(result);
		
		// Stop pre-processing here
		if (!this._dohandling)
			return;
		
		// Forward







|







688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
	private final void __doConvert(StackJavaType __from, StackJavaType __to)
		throws NullPointerException
	{
		if (__from == null || __to == null)
			throw new NullPointerException("NARG");
		
		// [from] -> [to]
		JavaStackResult result = this.state.stack.doStack(1, __to.toJavaType());
		this.__update(result);
		
		// Stop pre-processing here
		if (!this._dohandling)
			return;
		
		// Forward
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
		// Stop pre-processing here
		if (!this._dohandling)
			return;
		
		// Only perform the copy if the value is different, because otherwise
		// it would have just been cached
		if (result.in(0).register != result.out(0).register)
			handler.doCopy(result.in(0), result.out(0));
	}
	
	/**
	 * Handles lookup switch.
	 *
	 * @param __ls The switch.
	 * @throws NullPointerException On null arguments.







|







1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
		// Stop pre-processing here
		if (!this._dohandling)
			return;
		
		// Only perform the copy if the value is different, because otherwise
		// it would have just been cached
		if (result.in(0).register != result.out(0).register)
			this.handler.doCopy(result.in(0), result.out(0));
	}
	
	/**
	 * Handles lookup switch.
	 *
	 * @param __ls The switch.
	 * @throws NullPointerException On null arguments.

Name change from runt/libs/tool-classfile/dev/shadowtail/classfile/xlate/ByteCodeState.java to modules/tool-classfile/src/main/java/dev/shadowtail/classfile/xlate/ByteCodeState.java.

1
2
3
4
5
6
7
8
9
10
11


12
13
14
15
16
17
18
19
20
21
22
23
24
25
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package dev.shadowtail.classfile.xlate;



import net.multiphasicapps.classfile.ClassName;
import net.multiphasicapps.classfile.Instruction;
import net.multiphasicapps.classfile.InstructionJumpTargets;
import net.multiphasicapps.classfile.MethodDescriptor;
import net.multiphasicapps.classfile.MethodName;
import java.util.LinkedHashMap;
import java.util.Map;

/**
 * This represents the state of the byte code.
 *
 * @since 2019/04/06
 */
public class ByteCodeState











>
>





<
<







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18


19
20
21
22
23
24
25
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package dev.shadowtail.classfile.xlate;

import java.util.LinkedHashMap;
import java.util.Map;
import net.multiphasicapps.classfile.ClassName;
import net.multiphasicapps.classfile.Instruction;
import net.multiphasicapps.classfile.InstructionJumpTargets;
import net.multiphasicapps.classfile.MethodDescriptor;
import net.multiphasicapps.classfile.MethodName;



/**
 * This represents the state of the byte code.
 *
 * @since 2019/04/06
 */
public class ByteCodeState

Name change from runt/libs/tool-classfile/dev/shadowtail/classfile/xlate/CompareType.java to modules/tool-classfile/src/main/java/dev/shadowtail/classfile/xlate/CompareType.java.

51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
	 * @return The resulting compare type.
	 * @since 2019/04/08
	 */
	public static final CompareType of(int __i)
	{
		switch (__i)
		{
			case 0:		return EQUALS;
			case 1:		return NOT_EQUALS;
			case 2:		return LESS_THAN;
			case 3:		return LESS_THAN_OR_EQUALS;
			case 4:		return GREATER_THAN;
			case 5:		return GREATER_THAN_OR_EQUALS;
			case 6:		return TRUE;
			case 7:		return FALSE;
		}
		
		// {@squirreljme.error JC1b Invalid compare operation.}
		throw new IllegalArgumentException("JC1b");
	}
}








|
|
|
|
|
|
|
|







51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
	 * @return The resulting compare type.
	 * @since 2019/04/08
	 */
	public static final CompareType of(int __i)
	{
		switch (__i)
		{
			case 0:		return CompareType.EQUALS;
			case 1:		return CompareType.NOT_EQUALS;
			case 2:		return CompareType.LESS_THAN;
			case 3:		return CompareType.LESS_THAN_OR_EQUALS;
			case 4:		return CompareType.GREATER_THAN;
			case 5:		return CompareType.GREATER_THAN_OR_EQUALS;
			case 6:		return CompareType.TRUE;
			case 7:		return CompareType.FALSE;
		}
		
		// {@squirreljme.error JC1b Invalid compare operation.}
		throw new IllegalArgumentException("JC1b");
	}
}

Name change from runt/libs/tool-classfile/dev/shadowtail/classfile/xlate/DataType.java to modules/tool-classfile/src/main/java/dev/shadowtail/classfile/xlate/DataType.java.

52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
	 * Is this a wide data type?
	 *
	 * @return If this is wide.
	 * @since 2019/04/20
	 */
	public final boolean isWide()
	{
		return (this == LONG || this == DOUBLE);
	}
	
	/**
	 * Returns the size of the data type.
	 *
	 * @return The data size type.
	 * @since 2019/04/20







|







52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
	 * Is this a wide data type?
	 *
	 * @return If this is wide.
	 * @since 2019/04/20
	 */
	public final boolean isWide()
	{
		return (this == DataType.LONG || this == DataType.DOUBLE);
	}
	
	/**
	 * Returns the size of the data type.
	 *
	 * @return The data size type.
	 * @since 2019/04/20
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
	 * @return The resulting compare type.
	 * @since 2019/04/08
	 */
	public static final DataType of(int __i)
	{
		switch (__i)
		{
			case 0:		return OBJECT;
			case 1:		return BYTE;
			case 2:		return SHORT;
			case 3:		return CHARACTER;
			case 4:		return INTEGER;
			case 5:		return FLOAT;
			case 6:		return LONG;
			case 7:		return DOUBLE;
		}
		
		// {@squirreljme.error JC1c Invalid data type.}
		throw new IllegalArgumentException("JC1c");
	}
	
	/**
	 * Returns the data type used for the primitive type.
	 *
	 * @param __t The type to use, {@code null} is treated as a pointer.
	 * @return The data type used.
	 * @since 2019/03/24
	 */
	public static final DataType of(PrimitiveType __t)
	{
		if (__t == null)
			return OBJECT;
		
		switch (__t)
		{
			case BOOLEAN:
			case BYTE:		return BYTE;
			case CHARACTER:	return CHARACTER;
			case SHORT:		return SHORT;
			case INTEGER:	return INTEGER;
			case LONG:		return LONG;
			case FLOAT:		return FLOAT;
			case DOUBLE:	return DOUBLE;
			
			default:
				throw new todo.OOPS(__t.name());
		}
	}
	
	/**







|
|
|
|
|
|
|
|
















|




|
|
|
|
|
|
|







135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
	 * @return The resulting compare type.
	 * @since 2019/04/08
	 */
	public static final DataType of(int __i)
	{
		switch (__i)
		{
			case 0:		return DataType.OBJECT;
			case 1:		return DataType.BYTE;
			case 2:		return DataType.SHORT;
			case 3:		return DataType.CHARACTER;
			case 4:		return DataType.INTEGER;
			case 5:		return DataType.FLOAT;
			case 6:		return DataType.LONG;
			case 7:		return DataType.DOUBLE;
		}
		
		// {@squirreljme.error JC1c Invalid data type.}
		throw new IllegalArgumentException("JC1c");
	}
	
	/**
	 * Returns the data type used for the primitive type.
	 *
	 * @param __t The type to use, {@code null} is treated as a pointer.
	 * @return The data type used.
	 * @since 2019/03/24
	 */
	public static final DataType of(PrimitiveType __t)
	{
		if (__t == null)
			return DataType.OBJECT;
		
		switch (__t)
		{
			case BOOLEAN:
			case BYTE:		return DataType.BYTE;
			case CHARACTER:	return DataType.CHARACTER;
			case SHORT:		return DataType.SHORT;
			case INTEGER:	return DataType.INTEGER;
			case LONG:		return DataType.LONG;
			case FLOAT:		return DataType.FLOAT;
			case DOUBLE:	return DataType.DOUBLE;
			
			default:
				throw new todo.OOPS(__t.name());
		}
	}
	
	/**
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
		throws NullPointerException
	{
		if (__t == null)
			throw new NullPointerException("NARG");
		
		switch (__t)
		{
			case INTEGER:	return INTEGER;
			case FLOAT:		return FLOAT;
			case LONG:		return LONG;
			case DOUBLE:	return DOUBLE;
		}
		
		throw new todo.OOPS();
	}
}








|
|
|
|






227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
		throws NullPointerException
	{
		if (__t == null)
			throw new NullPointerException("NARG");
		
		switch (__t)
		{
			case INTEGER:	return DataType.INTEGER;
			case FLOAT:		return DataType.FLOAT;
			case LONG:		return DataType.LONG;
			case DOUBLE:	return DataType.DOUBLE;
		}
		
		throw new todo.OOPS();
	}
}

Name change from runt/libs/tool-classfile/dev/shadowtail/classfile/xlate/ExceptionClassEnqueueAndTable.java to modules/tool-classfile/src/main/java/dev/shadowtail/classfile/xlate/ExceptionClassEnqueueAndTable.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package dev.shadowtail.classfile.xlate;

import dev.shadowtail.classfile.xlate.JavaStackEnqueueList;
import dev.shadowtail.classfile.xlate.JavaStackState;
import net.multiphasicapps.classfile.ClassName;
import net.multiphasicapps.classfile.ExceptionHandlerTable;

/**
 * Represents a class, enqueue, and exception table.
 *
 * @since 2019/04/03











<
<







1
2
3
4
5
6
7
8
9
10
11


12
13
14
15
16
17
18
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package dev.shadowtail.classfile.xlate;



import net.multiphasicapps.classfile.ClassName;
import net.multiphasicapps.classfile.ExceptionHandlerTable;

/**
 * Represents a class, enqueue, and exception table.
 *
 * @since 2019/04/03

Name change from runt/libs/tool-classfile/dev/shadowtail/classfile/xlate/ExceptionClassStackAndTable.java to modules/tool-classfile/src/main/java/dev/shadowtail/classfile/xlate/ExceptionClassStackAndTable.java.

Name change from runt/libs/tool-classfile/dev/shadowtail/classfile/xlate/ExceptionEnqueueAndTable.java to modules/tool-classfile/src/main/java/dev/shadowtail/classfile/xlate/ExceptionEnqueueAndTable.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package dev.shadowtail.classfile.xlate;

import dev.shadowtail.classfile.xlate.JavaStackEnqueueList;
import dev.shadowtail.classfile.xlate.JavaStackState;
import net.multiphasicapps.classfile.ExceptionHandlerTable;

/**
 * This is a combination of an enqueue and exception handler table.
 *
 * @since 2019/04/03
 */











<
<







1
2
3
4
5
6
7
8
9
10
11


12
13
14
15
16
17
18
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package dev.shadowtail.classfile.xlate;



import net.multiphasicapps.classfile.ExceptionHandlerTable;

/**
 * This is a combination of an enqueue and exception handler table.
 *
 * @since 2019/04/03
 */

Name change from runt/libs/tool-classfile/dev/shadowtail/classfile/xlate/ExceptionHandlerRanges.java to modules/tool-classfile/src/main/java/dev/shadowtail/classfile/xlate/ExceptionHandlerRanges.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package dev.shadowtail.classfile.xlate;

import java.util.Collection;
import java.util.LinkedHashMap;
import java.util.Map;
import net.multiphasicapps.classfile.ByteCode;
import net.multiphasicapps.classfile.ClassName;
import net.multiphasicapps.classfile.ExceptionHandlerTable;
import net.multiphasicapps.classfile.InstructionAddressRange;
import net.multiphasicapps.classfile.StackMapTable;

/**
 * This class is used to keep track of the exceptions in the methods.
 *
 * @since 2019/03/21
 */
public final class ExceptionHandlerRanges












<
<





<







1
2
3
4
5
6
7
8
9
10
11
12


13
14
15
16
17

18
19
20
21
22
23
24
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package dev.shadowtail.classfile.xlate;



import java.util.Map;
import net.multiphasicapps.classfile.ByteCode;
import net.multiphasicapps.classfile.ClassName;
import net.multiphasicapps.classfile.ExceptionHandlerTable;
import net.multiphasicapps.classfile.InstructionAddressRange;


/**
 * This class is used to keep track of the exceptions in the methods.
 *
 * @since 2019/03/21
 */
public final class ExceptionHandlerRanges

Name change from runt/libs/tool-classfile/dev/shadowtail/classfile/xlate/ExceptionHandlerTransition.java to modules/tool-classfile/src/main/java/dev/shadowtail/classfile/xlate/ExceptionHandlerTransition.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package dev.shadowtail.classfile.xlate;

import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import net.multiphasicapps.classfile.ExceptionHandlerTable;

/**
 * This contains the information needed to transition into exception handlers.
 *
 * @since 2019/04/13
 */












<







1
2
3
4
5
6
7
8
9
10
11
12

13
14
15
16
17
18
19
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package dev.shadowtail.classfile.xlate;

import java.lang.ref.Reference;

import net.multiphasicapps.classfile.ExceptionHandlerTable;

/**
 * This contains the information needed to transition into exception handlers.
 *
 * @since 2019/04/13
 */

Name change from runt/libs/tool-classfile/dev/shadowtail/classfile/xlate/ExceptionStackAndTable.java to modules/tool-classfile/src/main/java/dev/shadowtail/classfile/xlate/ExceptionStackAndTable.java.

Name change from runt/libs/tool-classfile/dev/shadowtail/classfile/xlate/JavaStackEnqueueList.java to modules/tool-classfile/src/main/java/dev/shadowtail/classfile/xlate/JavaStackEnqueueList.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package dev.shadowtail.classfile.xlate;

import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.NoSuchElementException;
import java.util.Set;
import net.multiphasicapps.collections.SortedTreeSet;












<







1
2
3
4
5
6
7
8
9
10
11
12

13
14
15
16
17
18
19
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package dev.shadowtail.classfile.xlate;

import java.lang.ref.Reference;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.NoSuchElementException;
import java.util.Set;
import net.multiphasicapps.collections.SortedTreeSet;

Name change from runt/libs/tool-classfile/dev/shadowtail/classfile/xlate/JavaStackEnqueueType.java to modules/tool-classfile/src/main/java/dev/shadowtail/classfile/xlate/JavaStackEnqueueType.java.

Name change from runt/libs/tool-classfile/dev/shadowtail/classfile/xlate/JavaStackResult.java to modules/tool-classfile/src/main/java/dev/shadowtail/classfile/xlate/JavaStackResult.java.

447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
	}
	
	/**
	 * Used to flag input and output.
	 *
	 * @since 2019/03/31
	 */
	public static interface InputOutput
	{
	}
	
	/**
	 * Output information.
	 *
	 * @since 2019/03/30







|







447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
	}
	
	/**
	 * Used to flag input and output.
	 *
	 * @since 2019/03/31
	 */
	public interface InputOutput
	{
	}
	
	/**
	 * Output information.
	 *
	 * @since 2019/03/30

Name change from runt/libs/tool-classfile/dev/shadowtail/classfile/xlate/JavaStackShuffleType.java to modules/tool-classfile/src/main/java/dev/shadowtail/classfile/xlate/JavaStackShuffleType.java.

69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
	 * represents a wide type. Input and output is separated by a colon. The
	 * operation is just that whatever is pushed to the stack has the same
	 * value as the items removed from the stack.
	 *
	 * @param __fs The forms.
	 * @since 2019/04/01
	 */
	private JavaStackShuffleType(String... __fs)
	{
		int n = __fs.length;
		Function[] functions = new Function[n];
		for (int i = 0; i < n; i++)
			functions[i] = Function.of(__fs[i]);
		this._functions = functions;
	}







|







69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
	 * represents a wide type. Input and output is separated by a colon. The
	 * operation is just that whatever is pushed to the stack has the same
	 * value as the items removed from the stack.
	 *
	 * @param __fs The forms.
	 * @since 2019/04/01
	 */
	JavaStackShuffleType(String... __fs)
	{
		int n = __fs.length;
		Function[] functions = new Function[n];
		for (int i = 0; i < n; i++)
			functions[i] = Function.of(__fs[i]);
		this._functions = functions;
	}

Name change from runt/libs/tool-classfile/dev/shadowtail/classfile/xlate/JavaStackState.java to modules/tool-classfile/src/main/java/dev/shadowtail/classfile/xlate/JavaStackState.java.

10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package dev.shadowtail.classfile.xlate;

import dev.shadowtail.classfile.nncc.NativeCode;
import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import net.multiphasicapps.classfile.InvalidClassFormatException;
import net.multiphasicapps.classfile.JavaType;
import net.multiphasicapps.classfile.StackMapTableEntry;
import net.multiphasicapps.classfile.StackMapTableState;







<







10
11
12
13
14
15
16

17
18
19
20
21
22
23
package dev.shadowtail.classfile.xlate;

import dev.shadowtail.classfile.nncc.NativeCode;
import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.Arrays;

import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import net.multiphasicapps.classfile.InvalidClassFormatException;
import net.multiphasicapps.classfile.JavaType;
import net.multiphasicapps.classfile.StackMapTableEntry;
import net.multiphasicapps.classfile.StackMapTableState;
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
	 * for exception handling.
	 *
	 * The input is filled with the entire stack. The output is a single
	 * entry and contains the stack entry to place the value at. The single
	 * stack entry for the exception will never be cached to the exception
	 * register.
	 *
	 * @param __t The type to push.
	 * @since 2019/04/13
	 */
	public final JavaStackResult doExceptionHandler()
	{
		return this.doExceptionHandler(JavaType.THROWABLE);
	}
	







<







393
394
395
396
397
398
399

400
401
402
403
404
405
406
	 * for exception handling.
	 *
	 * The input is filled with the entire stack. The output is a single
	 * entry and contains the stack entry to place the value at. The single
	 * stack entry for the exception will never be cached to the exception
	 * register.
	 *

	 * @since 2019/04/13
	 */
	public final JavaStackResult doExceptionHandler()
	{
		return this.doExceptionHandler(JavaType.THROWABLE);
	}
	
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
			maxstack++;
		
		// Setup output infos
		Info[] locals = new Info[maxlocals],
			stack = new Info[maxstack];
		
		// Register position for the slot
		int rpos = BASE_REGISTER;
		
		// Initialize locals
		for (int i = 0; i < maxlocals; i++)
		{
			StackMapTableEntry from = __s.getLocal(i);
			
			// This local is considered read-only if it is not written to







|







1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
			maxstack++;
		
		// Setup output infos
		Info[] locals = new Info[maxlocals],
			stack = new Info[maxstack];
		
		// Register position for the slot
		int rpos = JavaStackState.BASE_REGISTER;
		
		// Initialize locals
		for (int i = 0; i < maxlocals; i++)
		{
			StackMapTableEntry from = __s.getLocal(i);
			
			// This local is considered read-only if it is not written to

Name change from runt/libs/tool-classfile/dev/shadowtail/classfile/xlate/MathType.java to modules/tool-classfile/src/main/java/dev/shadowtail/classfile/xlate/MathType.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package dev.shadowtail.classfile.xlate;

import net.multiphasicapps.classfile.PrimitiveType;

/**
 * This represents a math operation to be performed.
 *
 * @since 2019/04/03
 */
public enum MathType
{











<
<







1
2
3
4
5
6
7
8
9
10
11


12
13
14
15
16
17
18
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package dev.shadowtail.classfile.xlate;



/**
 * This represents a math operation to be performed.
 *
 * @since 2019/04/03
 */
public enum MathType
{
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
	 * @return The resulting math type.
	 * @since 2019/04/08
	 */
	public static final MathType of(int __i)
	{
		switch (__i)
		{
			case 0:		return ADD;
			case 1:		return SUB;
			case 2:		return MUL;
			case 3:		return DIV;
			case 4:		return REM;
			case 5:		return NEG;
			case 6:		return SHL;
			case 7:		return SHR;
			case 8:		return USHR;
			case 9:		return AND;
			case 10:	return OR;
			case 11:	return XOR;
			case 12:	return CMPL;
			case 13:	return CMPG;
			case 14:	return SIGNX8;
			case 15:	return SIGNX16;
		}
		
		// {@squirreljme.error JC1r Invalid math operation.}
		throw new IllegalArgumentException("JC1r");
	}
}








|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|







136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
	 * @return The resulting math type.
	 * @since 2019/04/08
	 */
	public static final MathType of(int __i)
	{
		switch (__i)
		{
			case 0:		return MathType.ADD;
			case 1:		return MathType.SUB;
			case 2:		return MathType.MUL;
			case 3:		return MathType.DIV;
			case 4:		return MathType.REM;
			case 5:		return MathType.NEG;
			case 6:		return MathType.SHL;
			case 7:		return MathType.SHR;
			case 8:		return MathType.USHR;
			case 9:		return MathType.AND;
			case 10:	return MathType.OR;
			case 11:	return MathType.XOR;
			case 12:	return MathType.CMPL;
			case 13:	return MathType.CMPG;
			case 14:	return MathType.SIGNX8;
			case 15:	return MathType.SIGNX16;
		}
		
		// {@squirreljme.error JC1r Invalid math operation.}
		throw new IllegalArgumentException("JC1r");
	}
}

Name change from runt/libs/tool-classfile/dev/shadowtail/classfile/xlate/SimplifiedJavaInstruction.java to modules/tool-classfile/src/main/java/dev/shadowtail/classfile/xlate/SimplifiedJavaInstruction.java.

17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import net.multiphasicapps.classfile.ConstantValueFloat;
import net.multiphasicapps.classfile.ConstantValueInteger;
import net.multiphasicapps.classfile.ConstantValueLong;
import net.multiphasicapps.classfile.Instruction;
import net.multiphasicapps.classfile.InstructionIndex;
import net.multiphasicapps.classfile.InstructionJumpTarget;
import net.multiphasicapps.classfile.InstructionMnemonics;
import net.multiphasicapps.classfile.LookupSwitch;
import net.multiphasicapps.classfile.JavaType;
import net.multiphasicapps.classfile.PrimitiveType;
import net.multiphasicapps.classfile.TableSwitch;

/**
 * This represents a simplified Java instruction which modifies the operation
 * that was performed to combine and make it more aliased. The primary goal
 * of this class is to simplify the translator code so it does not have to know







<
<







17
18
19
20
21
22
23


24
25
26
27
28
29
30
import net.multiphasicapps.classfile.ConstantValueFloat;
import net.multiphasicapps.classfile.ConstantValueInteger;
import net.multiphasicapps.classfile.ConstantValueLong;
import net.multiphasicapps.classfile.Instruction;
import net.multiphasicapps.classfile.InstructionIndex;
import net.multiphasicapps.classfile.InstructionJumpTarget;
import net.multiphasicapps.classfile.InstructionMnemonics;


import net.multiphasicapps.classfile.PrimitiveType;
import net.multiphasicapps.classfile.TableSwitch;

/**
 * This represents a simplified Java instruction which modifies the operation
 * that was performed to combine and make it more aliased. The primary goal
 * of this class is to simplify the translator code so it does not have to know
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
	 * @return The mnemonic for the string.
	 * @since 2019/04/03
	 */
	public static final String mnemonic(int __op)
	{
		switch (__op)
		{
			case STORE:			return "STORE";
			case LOAD:			return "LOAD";
			case VRETURN:		return "VRETURN";
			case MATH:			return "MATH";
			case IF:			return "IF";
			case IF_CMP:		return "IF_CMP";
			case PASTORE:		return "PASTORE";
			case PALOAD:		return "PALOAD";
			case STACKSHUFFLE:	return "STACKSHUFFLE";
			case CONVERT:		return "CONVERT";
			case MATH_CONST:	return "MATH_CONST";
			
				// Fallback to standard stuff
			default:
				return InstructionMnemonics.toString(__op);
		}
	}
}








|
|
|
|
|
|
|
|
|
|
|








1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
	 * @return The mnemonic for the string.
	 * @since 2019/04/03
	 */
	public static final String mnemonic(int __op)
	{
		switch (__op)
		{
			case SimplifiedJavaInstruction.STORE:			return "STORE";
			case SimplifiedJavaInstruction.LOAD:			return "LOAD";
			case SimplifiedJavaInstruction.VRETURN:		return "VRETURN";
			case SimplifiedJavaInstruction.MATH:			return "MATH";
			case SimplifiedJavaInstruction.IF:			return "IF";
			case SimplifiedJavaInstruction.IF_CMP:		return "IF_CMP";
			case SimplifiedJavaInstruction.PASTORE:		return "PASTORE";
			case SimplifiedJavaInstruction.PALOAD:		return "PALOAD";
			case SimplifiedJavaInstruction.STACKSHUFFLE:	return "STACKSHUFFLE";
			case SimplifiedJavaInstruction.CONVERT:		return "CONVERT";
			case SimplifiedJavaInstruction.MATH_CONST:	return "MATH_CONST";
			
				// Fallback to standard stuff
			default:
				return InstructionMnemonics.toString(__op);
		}
	}
}

Name change from runt/libs/tool-classfile/dev/shadowtail/classfile/xlate/StackJavaType.java to modules/tool-classfile/src/main/java/dev/shadowtail/classfile/xlate/StackJavaType.java.

76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
	 * Is this a wide type?
	 *
	 * @return If this is wide.
	 * @since 2019/04/20
	 */
	public final boolean isWide()
	{
		return (this == LONG || this == DOUBLE);
	}
	
	/**
	 * Returns the software math class.
	 *
	 * @return The software math class.
	 * @since 2019/05/27







|







76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
	 * Is this a wide type?
	 *
	 * @return If this is wide.
	 * @since 2019/04/20
	 */
	public final boolean isWide()
	{
		return (this == StackJavaType.LONG || this == StackJavaType.DOUBLE);
	}
	
	/**
	 * Returns the software math class.
	 *
	 * @return The software math class.
	 * @since 2019/05/27
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
	 * @return The resulting stack type.
	 * @since 2019/04/08
	 */
	public static final StackJavaType of(int __i)
	{
		switch (__i)
		{
			case 0:		return INTEGER;
			case 1:		return LONG;
			case 2:		return FLOAT;
			case 3:		return DOUBLE;
		}
		
		// {@squirreljme.error JC1s Invalid stack Java type.}
		throw new IllegalArgumentException("JC1s");
	}
}








|
|
|
|







132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
	 * @return The resulting stack type.
	 * @since 2019/04/08
	 */
	public static final StackJavaType of(int __i)
	{
		switch (__i)
		{
			case 0:		return StackJavaType.INTEGER;
			case 1:		return StackJavaType.LONG;
			case 2:		return StackJavaType.FLOAT;
			case 3:		return StackJavaType.DOUBLE;
		}
		
		// {@squirreljme.error JC1s Invalid stack Java type.}
		throw new IllegalArgumentException("JC1s");
	}
}

Name change from runt/libs/tool-classfile/dev/shadowtail/classfile/xlate/StateOperation.java to modules/tool-classfile/src/main/java/dev/shadowtail/classfile/xlate/StateOperation.java.

121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
		return rv;
	}
	
	/**
	 * Creates a copy operation.
	 *
	 * @param __w Is this wide?
	 * @param __s The source.
	 * @param __d The destination.
	 * @return The operation.
	 * @since 2019/04/13
	 */
	public static final StateOperation copy(boolean __w, int __a, int __b)
	{
		return new StateOperation((__w ? Type.WIDE_COPY : Type.COPY),
			__a, __b);







|
|







121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
		return rv;
	}
	
	/**
	 * Creates a copy operation.
	 *
	 * @param __w Is this wide?
	 * @param __a The source.
	 * @param __b The destination.
	 * @return The operation.
	 * @since 2019/04/13
	 */
	public static final StateOperation copy(boolean __w, int __a, int __b)
	{
		return new StateOperation((__w ? Type.WIDE_COPY : Type.COPY),
			__a, __b);
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
	}
	
	/**
	 * Represents the type of operation to perform.
	 *
	 * @since 2019/04/11
	 */
	public static enum Type
	{
		/** Count. */
		COUNT,
		
		/** Un-count. */
		UNCOUNT,
		







|







161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
	}
	
	/**
	 * Represents the type of operation to perform.
	 *
	 * @since 2019/04/11
	 */
	public enum Type
	{
		/** Count. */
		COUNT,
		
		/** Un-count. */
		UNCOUNT,
		

Name change from runt/libs/tool-classfile/dev/shadowtail/classfile/xlate/StateOperations.java to modules/tool-classfile/src/main/java/dev/shadowtail/classfile/xlate/StateOperations.java.

Name change from runt/libs/tool-classfile/dev/shadowtail/classfile/xlate/__Debug__.java to modules/tool-classfile/src/main/java/dev/shadowtail/classfile/xlate/__Debug__.java.

Name change from runt/libs/tool-classfile/dev/shadowtail/classfile/xlate/package-info.java to modules/tool-classfile/src/main/java/dev/shadowtail/classfile/xlate/package-info.java.

Name change from runt/libs/tool-classfile/net/multiphasicapps/classfile/AccessibleFlags.java to modules/tool-classfile/src/main/java/net/multiphasicapps/classfile/AccessibleFlags.java.

20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
{
	/**
	 * Is the current accessible object package private?
	 *
	 * @return {@code true} if package private.
	 * @since 2016/05/12
	 */
	public abstract boolean isPackagePrivate();
	
	/**
	 * Is the current accessible object private?
	 *
	 * @return {@code true} if private.
	 * @since 2016/05/12
	 */
	public abstract boolean isPrivate();
	
	/**
	 * Is the current accessible object protected?
	 *
	 * @return {@code true} if protected.
	 * @since 2016/05/12
	 */
	public abstract boolean isProtected();
	
	/**
	 * Is the current accessible object public?
	 *
	 * @return {@code true} if public.
	 * @since 2016/05/12
	 */
	public abstract boolean isPublic();
}








|







|







|







|


20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
{
	/**
	 * Is the current accessible object package private?
	 *
	 * @return {@code true} if package private.
	 * @since 2016/05/12
	 */
	boolean isPackagePrivate();
	
	/**
	 * Is the current accessible object private?
	 *
	 * @return {@code true} if private.
	 * @since 2016/05/12
	 */
	boolean isPrivate();
	
	/**
	 * Is the current accessible object protected?
	 *
	 * @return {@code true} if protected.
	 * @since 2016/05/12
	 */
	boolean isProtected();
	
	/**
	 * Is the current accessible object public?
	 *
	 * @return {@code true} if public.
	 * @since 2016/05/12
	 */
	boolean isPublic();
}

Name change from runt/libs/tool-classfile/net/multiphasicapps/classfile/Annotated.java to modules/tool-classfile/src/main/java/net/multiphasicapps/classfile/Annotated.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.classfile;

import java.util.List;

/**
 * This represents any element which has been annotated.
 *
 * @since 2018/03/06
 */
public interface Annotated
{
	/**
	 * Returns all of the annotations which have been specified for this.
	 *
	 * @return The annotated elements.
	 * @since 2018/03/06
	 */
	public abstract AnnotationTable annotationTable();
}













<
<













|


1
2
3
4
5
6
7
8
9
10
11
12


13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.classfile;



/**
 * This represents any element which has been annotated.
 *
 * @since 2018/03/06
 */
public interface Annotated
{
	/**
	 * Returns all of the annotations which have been specified for this.
	 *
	 * @return The annotated elements.
	 * @since 2018/03/06
	 */
	AnnotationTable annotationTable();
}

Name change from runt/libs/tool-classfile/net/multiphasicapps/classfile/Annotation.java to modules/tool-classfile/src/main/java/net/multiphasicapps/classfile/Annotation.java.

8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.classfile;

import java.io.DataInputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import net.multiphasicapps.collections.UnmodifiableMap;

/**
 * This represents an annotation which has values assigned to keys.
 *
 * @since 2018/06/16
 */







<

<

<







8
9
10
11
12
13
14

15

16

17
18
19
20
21
22
23
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.classfile;

import java.io.DataInputStream;
import java.io.IOException;

import java.util.LinkedHashMap;

import java.util.Map;

import net.multiphasicapps.collections.UnmodifiableMap;

/**
 * This represents an annotation which has values assigned to keys.
 *
 * @since 2018/06/16
 */

Name change from runt/libs/tool-classfile/net/multiphasicapps/classfile/AnnotationTable.java to modules/tool-classfile/src/main/java/net/multiphasicapps/classfile/AnnotationTable.java.

12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29

import java.io.DataInputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import net.multiphasicapps.collections.UnmodifiableIterator;

/**
 * This contains the annotation table which stores all of the annotation
 * information. No visibility information is stored because that is not needed
 * in SquirrelJME either by the run-time or the compiler.
 *







<


<







12
13
14
15
16
17
18

19
20

21
22
23
24
25
26
27

import java.io.DataInputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.LinkedHashMap;

import java.util.List;
import java.util.Map;

import net.multiphasicapps.collections.UnmodifiableIterator;

/**
 * This contains the annotation table which stores all of the annotation
 * information. No visibility information is stored because that is not needed
 * in SquirrelJME either by the run-time or the compiler.
 *

Name change from runt/libs/tool-classfile/net/multiphasicapps/classfile/AnnotationValue.java to modules/tool-classfile/src/main/java/net/multiphasicapps/classfile/AnnotationValue.java.

Name change from runt/libs/tool-classfile/net/multiphasicapps/classfile/AnnotationValueArray.java to modules/tool-classfile/src/main/java/net/multiphasicapps/classfile/AnnotationValueArray.java.

Name change from runt/libs/tool-classfile/net/multiphasicapps/classfile/AnnotationValueClass.java to modules/tool-classfile/src/main/java/net/multiphasicapps/classfile/AnnotationValueClass.java.

Name change from runt/libs/tool-classfile/net/multiphasicapps/classfile/AnnotationValueEnum.java to modules/tool-classfile/src/main/java/net/multiphasicapps/classfile/AnnotationValueEnum.java.

Name change from runt/libs/tool-classfile/net/multiphasicapps/classfile/AnnotationValuePrimitive.java to modules/tool-classfile/src/main/java/net/multiphasicapps/classfile/AnnotationValuePrimitive.java.

Name change from runt/libs/tool-classfile/net/multiphasicapps/classfile/AnnotationValueString.java to modules/tool-classfile/src/main/java/net/multiphasicapps/classfile/AnnotationValueString.java.

Name change from runt/libs/tool-classfile/net/multiphasicapps/classfile/Attribute.java to modules/tool-classfile/src/main/java/net/multiphasicapps/classfile/Attribute.java.

8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.classfile;

import java.io.ByteArrayInputStream;
import java.io.DataInputStream;
import java.io.IOException;
import java.io.InputStream;

/**
 * This represents a single attribute which exists within a class.
 *
 * @since 2018/05/14
 */
public final class Attribute







<
<







8
9
10
11
12
13
14


15
16
17
18
19
20
21
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.classfile;

import java.io.ByteArrayInputStream;
import java.io.DataInputStream;



/**
 * This represents a single attribute which exists within a class.
 *
 * @since 2018/05/14
 */
public final class Attribute

Name change from runt/libs/tool-classfile/net/multiphasicapps/classfile/AttributeTable.java to modules/tool-classfile/src/main/java/net/multiphasicapps/classfile/AttributeTable.java.

Name change from runt/libs/tool-classfile/net/multiphasicapps/classfile/BinaryName.java to modules/tool-classfile/src/main/java/net/multiphasicapps/classfile/BinaryName.java.

Name change from runt/libs/tool-classfile/net/multiphasicapps/classfile/ByteCode.java to modules/tool-classfile/src/main/java/net/multiphasicapps/classfile/ByteCode.java.

138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
			// The number of variables allocated to the method
			int maxstack = in.readUnsignedShort(),
				maxlocals = in.readUnsignedShort();
				
			// {@squirreljme.error JC1y The specified code length is not valid.
			// (The code length)}
			int codelen = in.readInt();
			if (codelen <= 0 || codelen > _MAX_CODE_LENGTH)
				throw new InvalidClassFormatException(
					String.format("JC1y %d", codelen));
		
			// Ignore that many bytes
			for (int i = 0; i < codelen; i++)
				in.readByte();
			







|







138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
			// The number of variables allocated to the method
			int maxstack = in.readUnsignedShort(),
				maxlocals = in.readUnsignedShort();
				
			// {@squirreljme.error JC1y The specified code length is not valid.
			// (The code length)}
			int codelen = in.readInt();
			if (codelen <= 0 || codelen > ByteCode._MAX_CODE_LENGTH)
				throw new InvalidClassFormatException(
					String.format("JC1y %d", codelen));
		
			// Ignore that many bytes
			for (int i = 0; i < codelen; i++)
				in.readByte();
			
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185

186
187
188
189
190
191
192
			for (int i = 0, li = -1; i < codelen; li = i)
			{
				// Store address of instruction for an index based lookup
				index[indexat++] = i;
			
				// Store length
				int oplen;
				lengths[i] = (oplen = __opLength(__ca, i, ollastop));
			
				// {@squirreljme.error JC1z The operation exceeds the bounds of
				// the method byte code. (The operation pointer; The operation
				// length; The code length; The last operation pointer)}
				if ((i += oplen) > codelen)
					throw new InvalidClassFormatException(
						String.format("JC1z %d %d %d", i, oplen, codelen, li));

			}
			
			// The stack map table is used for verification
			byte[] smt = null;
			boolean smtnew = false;
			
			// Parse the attribute table







|






|
>







171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
			for (int i = 0, li = -1; i < codelen; li = i)
			{
				// Store address of instruction for an index based lookup
				index[indexat++] = i;
			
				// Store length
				int oplen;
				lengths[i] = (oplen = ByteCode.__opLength(__ca, i, ollastop));
			
				// {@squirreljme.error JC1z The operation exceeds the bounds of
				// the method byte code. (The operation pointer; The operation
				// length; The code length; The last operation pointer)}
				if ((i += oplen) > codelen)
					throw new InvalidClassFormatException(
						String.format("JC1z %d %d %d %d",
							i, oplen, codelen, li));
			}
			
			// The stack map table is used for verification
			byte[] smt = null;
			boolean smtnew = false;
			
			// Parse the attribute table
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
			this.codelen = codelen;
			this.exceptions = eht;
			this.pool = pool;
			this.thistype = __tt;
			this._smtdata = smt;
			this._newsmtdata = smtnew;
			this._lengths = lengths;
			this._icache = __newCache(codelen);
			this._linenumbertable = lnt;
			
			// Store addresses for all the indexes
			if (indexat == codelen)
				this._index = index;
			else
				this._index = Arrays.copyOf(index, indexat);







|







257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
			this.codelen = codelen;
			this.exceptions = eht;
			this.pool = pool;
			this.thistype = __tt;
			this._smtdata = smt;
			this._newsmtdata = smtnew;
			this._lengths = lengths;
			this._icache = ByteCode.__newCache(codelen);
			this._linenumbertable = lnt;
			
			// Store addresses for all the indexes
			if (indexat == codelen)
				this._index = index;
			else
				this._index = Arrays.copyOf(index, indexat);
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
	
	/**
	 * Returns the address of the instruction following the specified one.
	 *
	 * @param __a The following address.
	 * @return The instruction address following the instruction at the
	 * specified address.
	 * @throws JITExcepInvalidClassFormatExceptiontion If the specified address
	 * is not valid.
	 * @since 2017/05/20
	 */
	public int addressFollowing(int __a)
		throws InvalidClassFormatException
	{
		// {@squirreljme.error JC21 The instruction at the specified address is
		// not valid. (The address)}
		if (!isValidAddress(__a))
			throw new InvalidClassFormatException(
				String.format("JC21 %d", __a));
		
		return __a + this._lengths[__a];
	}
	
	/**







|








|







280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
	
	/**
	 * Returns the address of the instruction following the specified one.
	 *
	 * @param __a The following address.
	 * @return The instruction address following the instruction at the
	 * specified address.
	 * @throws InvalidClassFormatException If the specified address
	 * is not valid.
	 * @since 2017/05/20
	 */
	public int addressFollowing(int __a)
		throws InvalidClassFormatException
	{
		// {@squirreljme.error JC21 The instruction at the specified address is
		// not valid. (The address)}
		if (!this.isValidAddress(__a))
			throw new InvalidClassFormatException(
				String.format("JC21 %d", __a));
		
		return __a + this._lengths[__a];
	}
	
	/**
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
	 * @since 2017/05/18
	 */
	public Instruction getByAddress(int __a)
		throws InvalidClassFormatException
	{
		// {@squirreljme.error JC22 The instruction at the specified address is
		// not valid. (The address)}
		if (!isValidAddress(__a))
			throw new InvalidClassFormatException(
				String.format("JC22 %d", __a));
		
		Reference<Instruction>[] icache = this._icache;
		Reference<Instruction> ref = icache[__a];
		Instruction rv;
		
		if (ref == null || null == (rv = ref.get()))
			icache[__a] = new WeakReference<>((rv = new Instruction(
				this._rawattributedata, this.pool, __a, this.exceptions,
				stackMapTable(), this.addressFollowing(__a))));
		
		return rv;
	}
	
	/**
	 * Returns the instruction based on an index in the order it appears within
	 * the byte code rather than by address.







|










|







343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
	 * @since 2017/05/18
	 */
	public Instruction getByAddress(int __a)
		throws InvalidClassFormatException
	{
		// {@squirreljme.error JC22 The instruction at the specified address is
		// not valid. (The address)}
		if (!this.isValidAddress(__a))
			throw new InvalidClassFormatException(
				String.format("JC22 %d", __a));
		
		Reference<Instruction>[] icache = this._icache;
		Reference<Instruction> ref = icache[__a];
		Instruction rv;
		
		if (ref == null || null == (rv = ref.get()))
			icache[__a] = new WeakReference<>((rv = new Instruction(
				this._rawattributedata, this.pool, __a, this.exceptions,
				this.stackMapTable(), this.addressFollowing(__a))));
		
		return rv;
	}
	
	/**
	 * Returns the instruction based on an index in the order it appears within
	 * the byte code rather than by address.
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
		throws IndexOutOfBoundsException
	{
		// Check
		int[] index = this._index;
		if (__i < 0 || __i >= index.length)
			throw new IndexOutOfBoundsException("IOOB");
		
		return getByAddress(index[__i]);
	}
	
	/**
	 * Translates an index to an address.
	 *
	 * @param __i The index to translate.
	 * @return The address of the index or {@code -1} if it is not valid, if







|







377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
		throws IndexOutOfBoundsException
	{
		// Check
		int[] index = this._index;
		if (__i < 0 || __i >= index.length)
			throw new IndexOutOfBoundsException("IOOB");
		
		return this.getByAddress(index[__i]);
	}
	
	/**
	 * Translates an index to an address.
	 *
	 * @param __i The index to translate.
	 * @return The address of the index or {@code -1} if it is not valid, if
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
	public StackMapTable stackMapTable()
	{
		Reference<StackMapTable> ref = this._smt;
		StackMapTable rv;
		
		if (ref == null || null == (rv = ref.get()))
			this._smt = new WeakReference<>(rv = new __StackMapParser__(
				this.pool, __method(), this._newsmtdata, this._smtdata,
				this, new JavaType(this.thistype)).get());
		
		return rv;
	}
	
	/**
	 * Returns the name of the current class.







|







714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
	public StackMapTable stackMapTable()
	{
		Reference<StackMapTable> ref = this._smt;
		StackMapTable rv;
		
		if (ref == null || null == (rv = ref.get()))
			this._smt = new WeakReference<>(rv = new __StackMapParser__(
				this.pool, this.__method(), this._newsmtdata, this._smtdata,
				this, new JavaType(this.thistype)).get());
		
		return rv;
	}
	
	/**
	 * Returns the name of the current class.
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
		
		if (ref == null || null == (rv = ref.get()))
		{
			StringBuilder sb = new StringBuilder("[");
			
			// Fill in instructions
			boolean comma = false;
			for (Iterator<Instruction> it = instructionIterator();
				it.hasNext();)
			{
				if (comma)
					sb.append(", ");
				else
					comma = true;
				
				sb.append(it.next());







|
|







747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
		
		if (ref == null || null == (rv = ref.get()))
		{
			StringBuilder sb = new StringBuilder("[");
			
			// Fill in instructions
			boolean comma = false;
			for (Iterator<Instruction> it = this.instructionIterator();
				 it.hasNext();)
			{
				if (comma)
					sb.append(", ");
				else
					comma = true;
				
				sb.append(it.next());
797
798
799
800
801
802
803






804
805
806
807
808
809
810
811
812
813
814
815


816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
			
			// Only specific instructions will do so
			int hit, op;
			switch ((op = inst.operation()))
			{
				case InstructionIndex.ASTORE:
				case InstructionIndex.WIDE_ASTORE:






					hit = inst.intArgument(0);
					break;
				
				case InstructionIndex.ASTORE_0:
				case InstructionIndex.ASTORE_1:
				case InstructionIndex.ASTORE_2:
				case InstructionIndex.ASTORE_3:
					hit = op - InstructionIndex.ASTORE_0;
					break;
				
				case InstructionIndex.DSTORE:
				case InstructionIndex.WIDE_DSTORE:


					hit = inst.intArgument(0);
					wide = true;
					break;
				
				case InstructionIndex.DSTORE_0:
				case InstructionIndex.DSTORE_1:
				case InstructionIndex.DSTORE_2:
				case InstructionIndex.DSTORE_3:
					hit = op - InstructionIndex.DSTORE_0;
					wide = true;
					break;
				
				case InstructionIndex.FSTORE:
				case InstructionIndex.WIDE_FSTORE:
					hit = inst.intArgument(0);
					break;
				
				case InstructionIndex.FSTORE_0:
				case InstructionIndex.FSTORE_1:
				case InstructionIndex.FSTORE_2:
				case InstructionIndex.FSTORE_3:
					hit = op - InstructionIndex.FSTORE_0;
					break;
				
				case InstructionIndex.IINC:
				case InstructionIndex.WIDE_IINC:
					hit = inst.intArgument(0);
					break;
				
				case InstructionIndex.ISTORE:
				case InstructionIndex.WIDE_ISTORE:
					hit = inst.intArgument(0);
					break;
				
				case InstructionIndex.ISTORE_0:
				case InstructionIndex.ISTORE_1:
				case InstructionIndex.ISTORE_2:
				case InstructionIndex.ISTORE_3:
					hit = op - InstructionIndex.ISTORE_0;
					break;
				
				case InstructionIndex.LSTORE:
				case InstructionIndex.WIDE_LSTORE:
					hit = inst.intArgument(0);
					wide = true;
					break;
				
				case InstructionIndex.LSTORE_0:
				case InstructionIndex.LSTORE_1:
				case InstructionIndex.LSTORE_2:
				case InstructionIndex.LSTORE_3:
					hit = op - InstructionIndex.LSTORE_0;
					wide = true;
					break;







>
>
>
>
>
>












>
>












<
<
<
<
<







<
<
<
<
<
<
<
<
<
<







<
<
<
<
<
<







798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836





837
838
839
840
841
842
843










844
845
846
847
848
849
850






851
852
853
854
855
856
857
			
			// Only specific instructions will do so
			int hit, op;
			switch ((op = inst.operation()))
			{
				case InstructionIndex.ASTORE:
				case InstructionIndex.WIDE_ASTORE:
				case InstructionIndex.FSTORE:
				case InstructionIndex.WIDE_FSTORE:
				case InstructionIndex.IINC:
				case InstructionIndex.WIDE_IINC:
				case InstructionIndex.ISTORE:
				case InstructionIndex.WIDE_ISTORE:
					hit = inst.intArgument(0);
					break;
				
				case InstructionIndex.ASTORE_0:
				case InstructionIndex.ASTORE_1:
				case InstructionIndex.ASTORE_2:
				case InstructionIndex.ASTORE_3:
					hit = op - InstructionIndex.ASTORE_0;
					break;
				
				case InstructionIndex.DSTORE:
				case InstructionIndex.WIDE_DSTORE:
				case InstructionIndex.LSTORE:
				case InstructionIndex.WIDE_LSTORE:
					hit = inst.intArgument(0);
					wide = true;
					break;
				
				case InstructionIndex.DSTORE_0:
				case InstructionIndex.DSTORE_1:
				case InstructionIndex.DSTORE_2:
				case InstructionIndex.DSTORE_3:
					hit = op - InstructionIndex.DSTORE_0;
					wide = true;
					break;
				





				case InstructionIndex.FSTORE_0:
				case InstructionIndex.FSTORE_1:
				case InstructionIndex.FSTORE_2:
				case InstructionIndex.FSTORE_3:
					hit = op - InstructionIndex.FSTORE_0;
					break;
				










				case InstructionIndex.ISTORE_0:
				case InstructionIndex.ISTORE_1:
				case InstructionIndex.ISTORE_2:
				case InstructionIndex.ISTORE_3:
					hit = op - InstructionIndex.ISTORE_0;
					break;
				






				case InstructionIndex.LSTORE_0:
				case InstructionIndex.LSTORE_1:
				case InstructionIndex.LSTORE_2:
				case InstructionIndex.LSTORE_3:
					hit = op - InstructionIndex.LSTORE_0;
					wide = true;
					break;
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
		if (__code == null)
			throw new NullPointerException("NARG");
		
		// Base instruction length is always 1
		int rv = 1;
		
		// Real offset, since the code attribute is offset
		int aa = __a + _CODE_OFFSET;
		
		// Read operation
		int op = (__code[aa] & 0xFF);
		if (op == InstructionIndex.WIDE)
		{
			// {@squirreljme.error JC25 The wide instruction cannot be the
			// last instruction in a method. (The address)}







|







920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
		if (__code == null)
			throw new NullPointerException("NARG");
		
		// Base instruction length is always 1
		int rv = 1;
		
		// Real offset, since the code attribute is offset
		int aa = __a + ByteCode._CODE_OFFSET;
		
		// Read operation
		int op = (__code[aa] & 0xFF);
		if (op == InstructionIndex.WIDE)
		{
			// {@squirreljme.error JC25 The wide instruction cannot be the
			// last instruction in a method. (The address)}
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
		 * @since 2017/05/20
		 */
		@Override
		public Instruction next()
			throws NoSuchElementException
		{
			// No more?
			if (!hasNext())
				throw new NoSuchElementException("NSEE");
			
			// Instruction at current pointer
			int at = this._at;
			Instruction rv = ByteCode.this.getByAddress(at);
			
			// Skip length of instruction







|







1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
		 * @since 2017/05/20
		 */
		@Override
		public Instruction next()
			throws NoSuchElementException
		{
			// No more?
			if (!this.hasNext())
				throw new NoSuchElementException("NSEE");
			
			// Instruction at current pointer
			int at = this._at;
			Instruction rv = ByteCode.this.getByAddress(at);
			
			// Skip length of instruction

Name change from runt/libs/tool-classfile/net/multiphasicapps/classfile/ClassFile.java to modules/tool-classfile/src/main/java/net/multiphasicapps/classfile/ClassFile.java.

9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// ---------------------------------------------------------------------------

package net.multiphasicapps.classfile;

import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.InputStream;
import java.io.IOException;
import java.util.Collection;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
import net.multiphasicapps.collections.UnmodifiableArrayList;
import net.multiphasicapps.io.SizeLimitedInputStream;

/**
 * This represents a class file which was most likely derived from the binary
 * class file format of a class.
 *







|
|
<
<

<







9
10
11
12
13
14
15
16
17


18

19
20
21
22
23
24
25
// ---------------------------------------------------------------------------

package net.multiphasicapps.classfile;

import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStream;


import java.util.List;

import net.multiphasicapps.collections.UnmodifiableArrayList;
import net.multiphasicapps.io.SizeLimitedInputStream;

/**
 * This represents a class file which was most likely derived from the binary
 * class file format of a class.
 *
103
104
105
106
107
108
109
110

111
112
113
114
115
116
117
		// cannot extend any class or any other class does not have a super
		// class. Additionally primitive types cannot have a super class.
		// (The current class name; The super class name; Object class name;
		// Is this primitive?)}
		ClassName objectcn = new ClassName("java/lang/Object");
		if ((__tn.isPrimitive() ||
			__tn.equals(objectcn)) != (__sn == null))
			throw new InvalidClassFormatException(String.format("JC29 %s %s",

				__tn, __sn, objectcn, __tn.isPrimitive()));
		
		// Set
		this.version = __ver;
		this.classflags = __cf;
		this.thisname = __tn;
		this.supername = __sn;







|
>







100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
		// cannot extend any class or any other class does not have a super
		// class. Additionally primitive types cannot have a super class.
		// (The current class name; The super class name; Object class name;
		// Is this primitive?)}
		ClassName objectcn = new ClassName("java/lang/Object");
		if ((__tn.isPrimitive() ||
			__tn.equals(objectcn)) != (__sn == null))
			throw new InvalidClassFormatException(String.format(
				"JC29 %s %s %s %s",
				__tn, __sn, objectcn, __tn.isPrimitive()));
		
		// Set
		this.version = __ver;
		this.classflags = __cf;
		this.thisname = __tn;
		this.supername = __sn;
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
		if (__is == null)
			throw new NullPointerException("NARG");
		
		// {@squirreljme.error JC2b The magic number for the class is not
		// valid. (The read magic number; The expected magic number)}
		DataInputStream in = new DataInputStream(__is);
		int magic = in.readInt();
		if (magic != _MAGIC_NUMBER)
			throw new InvalidClassFormatException(String.format(
				"JC2b %08x %08x", magic, _MAGIC_NUMBER));
		
		// {@squirreljme.error JC2c The version number of the input class
		// file is not valid. (The version number)}
		int cver = in.readShort() | (in.readShort() << 16);
		ClassVersion version = ClassVersion.findVersion(cver);
		if (version == null)
			throw new InvalidClassFormatException(String.format("JC2c %d.%d",







|

|







370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
		if (__is == null)
			throw new NullPointerException("NARG");
		
		// {@squirreljme.error JC2b The magic number for the class is not
		// valid. (The read magic number; The expected magic number)}
		DataInputStream in = new DataInputStream(__is);
		int magic = in.readInt();
		if (magic != ClassFile._MAGIC_NUMBER)
			throw new InvalidClassFormatException(String.format(
				"JC2b %08x %08x", magic, ClassFile._MAGIC_NUMBER));
		
		// {@squirreljme.error JC2c The version number of the input class
		// file is not valid. (The version number)}
		int cver = in.readShort() | (in.readShort() << 16);
		ClassVersion version = ClassVersion.findVersion(cver);
		if (version == null)
			throw new InvalidClassFormatException(String.format("JC2c %d.%d",

Name change from runt/libs/tool-classfile/net/multiphasicapps/classfile/ClassFlag.java to modules/tool-classfile/src/main/java/net/multiphasicapps/classfile/ClassFlag.java.

Name change from runt/libs/tool-classfile/net/multiphasicapps/classfile/ClassFlags.java to modules/tool-classfile/src/main/java/net/multiphasicapps/classfile/ClassFlags.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.classfile;

import java.util.ArrayList;
import java.util.List;

/**
 * This represents the flags which a class may be.
 *
 * @since 2016/04/23
 */
public class ClassFlags
	extends Flags<ClassFlag>












<
<
<







1
2
3
4
5
6
7
8
9
10
11
12



13
14
15
16
17
18
19
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.classfile;




/**
 * This represents the flags which a class may be.
 *
 * @since 2016/04/23
 */
public class ClassFlags
	extends Flags<ClassFlag>
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
	 * @param __fl The class flags.
	 * @since 2016/04/23
	 */
	public ClassFlags(ClassFlag... __fl)
	{
		super(ClassFlag.class, __fl);
		
		__checkFlags();
	}
	
	/**
	 * Initializes the class flags.
	 *
	 * @param __fl The class flags.
	 * @since 2016/04/23
	 */
	public ClassFlags(Iterable<ClassFlag> __fl)
	{
		super(ClassFlag.class, __fl);
		
		__checkFlags();
	}
	
	/**
	 * Is this class abstract?
	 *
	 * @return {@code true} if it is abstract.
	 * @since 2016/03/15
	 */
	public final boolean isAbstract()
	{
		return contains(ClassFlag.ABSTRACT);
	}
	
	/**
	 * Is this an annotation?
	 *
	 * @return {@code true} if it is an annotation.
	 * @since 2016/03/15
	 */
	public final boolean isAnnotation()
	{
		return contains(ClassFlag.ANNOTATION);
	}
	
	/**
	 * Is this an enumeration?
	 *
	 * @return {@code true} if it is an enumeration.
	 * @since 2016/03/15
	 */
	public final boolean isEnum()
	{
		return contains(ClassFlag.ENUM);
	}
	
	/**
	 * Is this class final?
	 *
	 * @return {@code true} if it is final.
	 * @since 2016/03/15
	 */
	public final boolean isFinal()
	{
		return contains(ClassFlag.FINAL);
	}
	
	/**
	 * Is this an interface?
	 *
	 * @return {@code true} if an interface.
	 * @since 2016/03/15
	 */
	public final boolean isInterface()
	{
		return contains(ClassFlag.INTERFACE);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/03/15
	 */
	@Override
	public final boolean isPackagePrivate()
	{
		return !isPublic();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/05/12
	 */
	@Override







|












|










|










|










|










|










|









|







36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
	 * @param __fl The class flags.
	 * @since 2016/04/23
	 */
	public ClassFlags(ClassFlag... __fl)
	{
		super(ClassFlag.class, __fl);
		
		this.__checkFlags();
	}
	
	/**
	 * Initializes the class flags.
	 *
	 * @param __fl The class flags.
	 * @since 2016/04/23
	 */
	public ClassFlags(Iterable<ClassFlag> __fl)
	{
		super(ClassFlag.class, __fl);
		
		this.__checkFlags();
	}
	
	/**
	 * Is this class abstract?
	 *
	 * @return {@code true} if it is abstract.
	 * @since 2016/03/15
	 */
	public final boolean isAbstract()
	{
		return this.contains(ClassFlag.ABSTRACT);
	}
	
	/**
	 * Is this an annotation?
	 *
	 * @return {@code true} if it is an annotation.
	 * @since 2016/03/15
	 */
	public final boolean isAnnotation()
	{
		return this.contains(ClassFlag.ANNOTATION);
	}
	
	/**
	 * Is this an enumeration?
	 *
	 * @return {@code true} if it is an enumeration.
	 * @since 2016/03/15
	 */
	public final boolean isEnum()
	{
		return this.contains(ClassFlag.ENUM);
	}
	
	/**
	 * Is this class final?
	 *
	 * @return {@code true} if it is final.
	 * @since 2016/03/15
	 */
	public final boolean isFinal()
	{
		return this.contains(ClassFlag.FINAL);
	}
	
	/**
	 * Is this an interface?
	 *
	 * @return {@code true} if an interface.
	 * @since 2016/03/15
	 */
	public final boolean isInterface()
	{
		return this.contains(ClassFlag.INTERFACE);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/03/15
	 */
	@Override
	public final boolean isPackagePrivate()
	{
		return !this.isPublic();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/05/12
	 */
	@Override
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
	/**
	 * {@inheritDoc}
	 * @since 2016/03/15
	 */
	@Override
	public final boolean isPublic()
	{
		return contains(ClassFlag.PUBLIC);
	}
	
	/**
	 * Is there special handling for super-class method calls?
	 *
	 * @return {@code true} if the super-class invocation special flag is set.
	 * @since 2016/03/15
	 */
	public final boolean isSpecialInvokeSpecial()
	{
		return contains(ClassFlag.SUPER);
	}
	
	/**
	 * Checks that the given flags are valid.
	 *
	 * @throws InvalidClassFormatException If they are not valid.
	 * @since 2016/04/23
	 */
	private final void __checkFlags()
		throws InvalidClassFormatException
	{
		// Interface?
		if (isInterface())
		{
			// {@squirreljme.error JC2f An interface must also be abstract.
			// (The class flags)}
			if (!isAbstract())
				throw new InvalidClassFormatException(
					String.format("JC2f %s", this));
			
			// {@squirreljme.error JC2g An interface cannot be {@code final} or
			// {@code enum} and it must not have the special flag set. (The
			// class flags)}
			if (isFinal() || isSpecialInvokeSpecial() || isEnum())
				throw new InvalidClassFormatException(
					String.format("JC2g %s", this));
		}
		
		// Normal class
		else
		{
			// {@squirreljme.error JC2h Annotations must be interfaces. (The
			// class flags)}
			if (isAnnotation())
				throw new InvalidClassFormatException(
					String.format("JC2h %s", this));
				
			// {@squirreljme.error JC2i A class cannot be both {@code abstract}
			// and {@code final}. (The class flags)}
			if (isAbstract() && isFinal())
				throw new InvalidClassFormatException(
					String.format("JC2i %s", this));
		}
	}
}








|










|












|



|






|









|





|






146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
	/**
	 * {@inheritDoc}
	 * @since 2016/03/15
	 */
	@Override
	public final boolean isPublic()
	{
		return this.contains(ClassFlag.PUBLIC);
	}
	
	/**
	 * Is there special handling for super-class method calls?
	 *
	 * @return {@code true} if the super-class invocation special flag is set.
	 * @since 2016/03/15
	 */
	public final boolean isSpecialInvokeSpecial()
	{
		return this.contains(ClassFlag.SUPER);
	}
	
	/**
	 * Checks that the given flags are valid.
	 *
	 * @throws InvalidClassFormatException If they are not valid.
	 * @since 2016/04/23
	 */
	private final void __checkFlags()
		throws InvalidClassFormatException
	{
		// Interface?
		if (this.isInterface())
		{
			// {@squirreljme.error JC2f An interface must also be abstract.
			// (The class flags)}
			if (!this.isAbstract())
				throw new InvalidClassFormatException(
					String.format("JC2f %s", this));
			
			// {@squirreljme.error JC2g An interface cannot be {@code final} or
			// {@code enum} and it must not have the special flag set. (The
			// class flags)}
			if (this.isFinal() || this.isSpecialInvokeSpecial() || this.isEnum())
				throw new InvalidClassFormatException(
					String.format("JC2g %s", this));
		}
		
		// Normal class
		else
		{
			// {@squirreljme.error JC2h Annotations must be interfaces. (The
			// class flags)}
			if (this.isAnnotation())
				throw new InvalidClassFormatException(
					String.format("JC2h %s", this));
				
			// {@squirreljme.error JC2i A class cannot be both {@code abstract}
			// and {@code final}. (The class flags)}
			if (this.isAbstract() && this.isFinal())
				throw new InvalidClassFormatException(
					String.format("JC2i %s", this));
		}
	}
}

Name change from runt/libs/tool-classfile/net/multiphasicapps/classfile/ClassIdentifier.java to modules/tool-classfile/src/main/java/net/multiphasicapps/classfile/ClassIdentifier.java.

33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
	/**
	 * {@inheritDoc}
	 * @since 2017/10/02
	 */
	@Override
	public int compareTo(ClassIdentifier __o)
	{
		return toString().compareTo(__o.toString());
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/09/27
	 */
	@Override







|







33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
	/**
	 * {@inheritDoc}
	 * @since 2017/10/02
	 */
	@Override
	public int compareTo(ClassIdentifier __o)
	{
		return this.toString().compareTo(__o.toString());
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/09/27
	 */
	@Override

Name change from runt/libs/tool-classfile/net/multiphasicapps/classfile/ClassName.java to modules/tool-classfile/src/main/java/net/multiphasicapps/classfile/ClassName.java.

260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
	 */
	public boolean isInSamePackage(ClassName __b)
		throws NullPointerException
	{
		if (__b == null)
			throw new NullPointerException("NARG");
		
		return Objects.equals(inPackage(), __b.inPackage());
	}
	
	/**
	 * Does this class refer to a primitive type?
	 *
	 * @return If this is a primitive type.
	 * @since 2017/10/08







|







260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
	 */
	public boolean isInSamePackage(ClassName __b)
		throws NullPointerException
	{
		if (__b == null)
			throw new NullPointerException("NARG");
		
		return Objects.equals(this.inPackage(), __b.inPackage());
	}
	
	/**
	 * Does this class refer to a primitive type?
	 *
	 * @return If this is a primitive type.
	 * @since 2017/10/08
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
	 */
	@Override
	public String toString()
	{
		BinaryName binary = this.binary;
		if (binary != null)
			return binary.toString();
		return field.toString();
	}
	
	/**
	 * Translates the primitive type to the given class type.
	 *
	 * @param __t The type to convert.
	 * @return The name of the class for this primitive.







|







311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
	 */
	@Override
	public String toString()
	{
		BinaryName binary = this.binary;
		if (binary != null)
			return binary.toString();
		return this.field.toString();
	}
	
	/**
	 * Translates the primitive type to the given class type.
	 *
	 * @param __t The type to convert.
	 * @return The name of the class for this primitive.

Name change from runt/libs/tool-classfile/net/multiphasicapps/classfile/ClassNames.java to modules/tool-classfile/src/main/java/net/multiphasicapps/classfile/ClassNames.java.

9
10
11
12
13
14
15
16
17
18
19
20
21
22
23

package net.multiphasicapps.classfile;

import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import java.util.AbstractList;
import java.util.RandomAccess;
import net.multiphasicapps.collections.UnmodifiableIterator;

/**
 * Represents multiple class names.
 *
 * @since 2019/04/14
 */
public final class ClassNames







<







9
10
11
12
13
14
15

16
17
18
19
20
21
22

package net.multiphasicapps.classfile;

import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import java.util.AbstractList;
import java.util.RandomAccess;


/**
 * Represents multiple class names.
 *
 * @since 2019/04/14
 */
public final class ClassNames

Name change from runt/libs/tool-classfile/net/multiphasicapps/classfile/ClassType.java to modules/tool-classfile/src/main/java/net/multiphasicapps/classfile/ClassType.java.

Name change from runt/libs/tool-classfile/net/multiphasicapps/classfile/ClassVersion.java to modules/tool-classfile/src/main/java/net/multiphasicapps/classfile/ClassVersion.java.

26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
	/** CLDC 8 (aka Java 7). */
	CLDC_8((51 << 16), (52 << 16), true, false, true),
	
	/** End. */
	;
	
	/** The minimum supported version. */
	public static final ClassVersion MIN_VERSION =
		CLDC_1;
	
	/** The maximum supported version. */
	public static final ClassVersion MAX_VERSION =
		CLDC_8;
	
	/** The version ID. */
	protected final int version;
	
	/** The maximum range of the version. */
	protected final int maxversion;
	







|
<


|
<







26
27
28
29
30
31
32
33

34
35
36

37
38
39
40
41
42
43
	/** CLDC 8 (aka Java 7). */
	CLDC_8((51 << 16), (52 << 16), true, false, true),
	
	/** End. */
	;
	
	/** The minimum supported version. */
	public static final ClassVersion MIN_VERSION = ClassVersion.CLDC_1;

	
	/** The maximum supported version. */
	public static final ClassVersion MAX_VERSION = ClassVersion.CLDC_8;

	
	/** The version ID. */
	protected final int version;
	
	/** The maximum range of the version. */
	protected final int maxversion;
	
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
	 * @param __vmx The max version identifier.
	 * @param __undef Is this version information undefined?
	 * @param __float Is floating point supported?
	 * @param __hasid Has invoke dynamic support?
	 * @param __usesmt Should the StackMapTable attribute be used?
	 * @since 2016/03/13
	 */
	private ClassVersion(int __vid, int __vmx,
		boolean __float, boolean __hasid, boolean __usesmt)
	{
		// Set
		version = __vid;
		maxversion = __vmx;
		hasfloat = __float;
		hasinvokedynamic = __hasid;
		usestackmaptable = __usesmt;
	}
	
	/**
	 * Returns {@code true} if floating point is supported by the virtual
	 * machine.
	 *
	 * @return {@code true} if it is.
	 * @since 2016/03/13
	 */
	public boolean hasFloatingPoint()
	{
		return hasfloat;
	}
	
	/**
	 * Returns {@code true} if invokedynamic is supported by the virtual
	 * machine.
	 *
	 * @return {@code true} if it is.
	 * @since 2016/03/15
	 */
	public boolean hasInvokeDynamic()
	{
		return hasinvokedynamic;
	}
	
	/**
	 * Should the new StackMapTable attribute be used when veryifying the byte
	 * code of a class?
	 *
	 * @return {@code true} if the "StackMapTable" attribute should be parsed
	 * instead of "StackMap".
	 * @since 2016/03/20
	 */
	public boolean useStackMapTable()
	{
		return usestackmaptable;
	}
	
	/**
	 * Finds the best matching version with the given ID.
	 *
	 * @param __vid The version ID to get a match for.
	 * @return The matching class version or {@code null} if not found.
	 * @since 2016/03/13
	 */
	public static ClassVersion findVersion(int __vid)
	{
		// Go through all versions, find the best
		ClassVersion best = null;
		for (ClassVersion v : values())
			if (__vid >= v.version && __vid <= v.maxversion)
				if (best == null || v.version > best.version)
					best = v;
		
		// Use the best (if any)
		return best;
	}
}








|
|


|
|
|
|
|











|











|












|













|









57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
	 * @param __vmx The max version identifier.
	 * @param __undef Is this version information undefined?
	 * @param __float Is floating point supported?
	 * @param __hasid Has invoke dynamic support?
	 * @param __usesmt Should the StackMapTable attribute be used?
	 * @since 2016/03/13
	 */
	ClassVersion(int __vid, int __vmx, boolean __float, boolean __hasid,
		boolean __usesmt)
	{
		// Set
		this.version = __vid;
		this.maxversion = __vmx;
		this.hasfloat = __float;
		this.hasinvokedynamic = __hasid;
		this.usestackmaptable = __usesmt;
	}
	
	/**
	 * Returns {@code true} if floating point is supported by the virtual
	 * machine.
	 *
	 * @return {@code true} if it is.
	 * @since 2016/03/13
	 */
	public boolean hasFloatingPoint()
	{
		return this.hasfloat;
	}
	
	/**
	 * Returns {@code true} if invokedynamic is supported by the virtual
	 * machine.
	 *
	 * @return {@code true} if it is.
	 * @since 2016/03/15
	 */
	public boolean hasInvokeDynamic()
	{
		return this.hasinvokedynamic;
	}
	
	/**
	 * Should the new StackMapTable attribute be used when veryifying the byte
	 * code of a class?
	 *
	 * @return {@code true} if the "StackMapTable" attribute should be parsed
	 * instead of "StackMap".
	 * @since 2016/03/20
	 */
	public boolean useStackMapTable()
	{
		return this.usestackmaptable;
	}
	
	/**
	 * Finds the best matching version with the given ID.
	 *
	 * @param __vid The version ID to get a match for.
	 * @return The matching class version or {@code null} if not found.
	 * @since 2016/03/13
	 */
	public static ClassVersion findVersion(int __vid)
	{
		// Go through all versions, find the best
		ClassVersion best = null;
		for (ClassVersion v : ClassVersion.values())
			if (__vid >= v.version && __vid <= v.maxversion)
				if (best == null || v.version > best.version)
					best = v;
		
		// Use the best (if any)
		return best;
	}
}

Name change from runt/libs/tool-classfile/net/multiphasicapps/classfile/ConstantValue.java to modules/tool-classfile/src/main/java/net/multiphasicapps/classfile/ConstantValue.java.

Name change from runt/libs/tool-classfile/net/multiphasicapps/classfile/ConstantValueClass.java to modules/tool-classfile/src/main/java/net/multiphasicapps/classfile/ConstantValueClass.java.

Name change from runt/libs/tool-classfile/net/multiphasicapps/classfile/ConstantValueDouble.java to modules/tool-classfile/src/main/java/net/multiphasicapps/classfile/ConstantValueDouble.java.

Name change from runt/libs/tool-classfile/net/multiphasicapps/classfile/ConstantValueFloat.java to modules/tool-classfile/src/main/java/net/multiphasicapps/classfile/ConstantValueFloat.java.

Name change from runt/libs/tool-classfile/net/multiphasicapps/classfile/ConstantValueInteger.java to modules/tool-classfile/src/main/java/net/multiphasicapps/classfile/ConstantValueInteger.java.

Name change from runt/libs/tool-classfile/net/multiphasicapps/classfile/ConstantValueLong.java to modules/tool-classfile/src/main/java/net/multiphasicapps/classfile/ConstantValueLong.java.

Name change from runt/libs/tool-classfile/net/multiphasicapps/classfile/ConstantValueNumber.java to modules/tool-classfile/src/main/java/net/multiphasicapps/classfile/ConstantValueNumber.java.

Name change from runt/libs/tool-classfile/net/multiphasicapps/classfile/ConstantValueString.java to modules/tool-classfile/src/main/java/net/multiphasicapps/classfile/ConstantValueString.java.

Name change from runt/libs/tool-classfile/net/multiphasicapps/classfile/ConstantValueType.java to modules/tool-classfile/src/main/java/net/multiphasicapps/classfile/ConstantValueType.java.

Name change from runt/libs/tool-classfile/net/multiphasicapps/classfile/ExceptionHandler.java to modules/tool-classfile/src/main/java/net/multiphasicapps/classfile/ExceptionHandler.java.

Name change from runt/libs/tool-classfile/net/multiphasicapps/classfile/ExceptionHandlerTable.java to modules/tool-classfile/src/main/java/net/multiphasicapps/classfile/ExceptionHandlerTable.java.

10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32

package net.multiphasicapps.classfile;

import java.io.DataInputStream;
import java.io.IOException;
import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import java.util.AbstractList;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.RandomAccess;
import net.multiphasicapps.collections.UnmodifiableIterator;

/**
 * This represents a every exception that exists within a method.
 *
 * @since 2017/02/09
 */







<







<







10
11
12
13
14
15
16

17
18
19
20
21
22
23

24
25
26
27
28
29
30

package net.multiphasicapps.classfile;

import java.io.DataInputStream;
import java.io.IOException;
import java.lang.ref.Reference;
import java.lang.ref.WeakReference;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

import net.multiphasicapps.collections.UnmodifiableIterator;

/**
 * This represents a every exception that exists within a method.
 *
 * @since 2017/02/09
 */
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
		
		return rv;
	}
	
	/**
	 * Parses the exception handler table.
	 *
	 * @param __in The input stream to read exceptions from.
	 * @param __pool The constant pool for class names.
	 * @param __len The length of the method in byte codes.
	 * @throws InvalidClassFormatException If the exception table is not valid.
	 * @throws IOException On read errors.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/02/09
	 */







|







297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
		
		return rv;
	}
	
	/**
	 * Parses the exception handler table.
	 *
	 * @param __is The input stream to read exceptions from.
	 * @param __pool The constant pool for class names.
	 * @param __len The length of the method in byte codes.
	 * @throws InvalidClassFormatException If the exception table is not valid.
	 * @throws IOException On read errors.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/02/09
	 */

Name change from runt/libs/tool-classfile/net/multiphasicapps/classfile/Field.java to modules/tool-classfile/src/main/java/net/multiphasicapps/classfile/Field.java.

11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package net.multiphasicapps.classfile;

import java.io.DataInputStream;
import java.io.IOException;
import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
import net.multiphasicapps.collections.UnmodifiableArrayList;

/**
 * This represents a field in a class which is used to store values either as
 * static instances or as instance variables outside of methods.
 *
 * @since 2017/09/30
 */







<
<

<







11
12
13
14
15
16
17


18

19
20
21
22
23
24
25
package net.multiphasicapps.classfile;

import java.io.DataInputStream;
import java.io.IOException;
import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import java.util.HashSet;


import java.util.Set;


/**
 * This represents a field in a class which is used to store values either as
 * static instances or as instance variables outside of methods.
 *
 * @since 2017/09/30
 */

Name change from runt/libs/tool-classfile/net/multiphasicapps/classfile/FieldDescriptor.java to modules/tool-classfile/src/main/java/net/multiphasicapps/classfile/FieldDescriptor.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.classfile;

import java.lang.ref.Reference;
import java.lang.ref.WeakReference;

/**
 * This represents the type descriptor of a field.
 *
 * @since 2017/06/12
 */
public final class FieldDescriptor
	implements Comparable<FieldDescriptor>, MemberDescriptor












<
<
<







1
2
3
4
5
6
7
8
9
10
11
12



13
14
15
16
17
18
19
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.classfile;




/**
 * This represents the type descriptor of a field.
 *
 * @since 2017/06/12
 */
public final class FieldDescriptor
	implements Comparable<FieldDescriptor>, MemberDescriptor
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
	 * Is this an object type?
	 *
	 * @return If this is an object type.
	 * @since 2017/09/16
	 */
	public boolean isObject()
	{
		return !isPrimitive();
	}
	
	/**
	 * Returns if this is a wide field or not.
	 *
	 * @return If this is a wide field.
	 * @since 2019/02/05







|







256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
	 * Is this an object type?
	 *
	 * @return If this is an object type.
	 * @since 2017/09/16
	 */
	public boolean isObject()
	{
		return !this.isPrimitive();
	}
	
	/**
	 * Returns if this is a wide field or not.
	 *
	 * @return If this is a wide field.
	 * @since 2019/02/05
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
	public PrimitiveType primitiveType()
	{
		// Quick detect
		if (!this.primitive)
			return null;
		
		// Depends on the string
		switch (toString())
		{
			case "B": return PrimitiveType.BYTE;
			case "C": return PrimitiveType.CHARACTER;
			case "D": return PrimitiveType.DOUBLE;
			case "F": return PrimitiveType.FLOAT;
			case "I": return PrimitiveType.INTEGER;
			case "J": return PrimitiveType.LONG;







|







293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
	public PrimitiveType primitiveType()
	{
		// Quick detect
		if (!this.primitive)
			return null;
		
		// Depends on the string
		switch (this.toString())
		{
			case "B": return PrimitiveType.BYTE;
			case "C": return PrimitiveType.CHARACTER;
			case "D": return PrimitiveType.DOUBLE;
			case "F": return PrimitiveType.FLOAT;
			case "I": return PrimitiveType.INTEGER;
			case "J": return PrimitiveType.LONG;

Name change from runt/libs/tool-classfile/net/multiphasicapps/classfile/FieldFlag.java to modules/tool-classfile/src/main/java/net/multiphasicapps/classfile/FieldFlag.java.

Name change from runt/libs/tool-classfile/net/multiphasicapps/classfile/FieldFlags.java to modules/tool-classfile/src/main/java/net/multiphasicapps/classfile/FieldFlags.java.

38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
	 * @param __fl The field flags.
	 * @since 2016/04/23
	 */
	public FieldFlags(ClassFlags __oc, FieldFlag... __fl)
	{
		super(FieldFlag.class, __fl);
		
		__checkFlags(__oc);
	}
	
	/**
	 * Initializes the field flags.
	 *
	 * @param __oc The outer class.
	 * @param __fl The field flags.
	 * @since 2016/04/23
	 */
	public FieldFlags(ClassFlags __oc, Iterable<FieldFlag> __fl)
	{
		super(FieldFlag.class, __fl);
		
		__checkFlags(__oc);
	}
	
	/**
	 * Decodes field flags from the bit field.
	 *
	 * @param __oc The outer class flags.
	 * @param __i The bitfield to decode.







|













|







38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
	 * @param __fl The field flags.
	 * @since 2016/04/23
	 */
	public FieldFlags(ClassFlags __oc, FieldFlag... __fl)
	{
		super(FieldFlag.class, __fl);
		
		this.__checkFlags(__oc);
	}
	
	/**
	 * Initializes the field flags.
	 *
	 * @param __oc The outer class.
	 * @param __fl The field flags.
	 * @since 2016/04/23
	 */
	public FieldFlags(ClassFlags __oc, Iterable<FieldFlag> __fl)
	{
		super(FieldFlag.class, __fl);
		
		this.__checkFlags(__oc);
	}
	
	/**
	 * Decodes field flags from the bit field.
	 *
	 * @param __oc The outer class flags.
	 * @param __i The bitfield to decode.
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
	 * Returns {@code true} if this is an enumeration.
	 *
	 * @return {@code true} if an enumeration.
	 * @since 2016/03/20
	 */
	public boolean isEnum()
	{
		return contains(FieldFlag.ENUM);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/03/20
	 */
	@Override
	public boolean isFinal()
	{
		return contains(FieldFlag.FINAL);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/03/20
	 */
	@Override
	public boolean isPrivate()
	{
		return contains(FieldFlag.PRIVATE);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/03/20
	 */
	@Override
	public boolean isProtected()
	{
		return contains(FieldFlag.PROTECTED);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/03/20
	 */
	@Override
	public boolean isPublic()
	{
		return contains(FieldFlag.PUBLIC);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/03/20
	 */
	@Override
	public boolean isStatic()
	{
		return contains(FieldFlag.STATIC);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/03/20
	 */
	@Override
	public boolean isSynthetic()
	{
		return contains(FieldFlag.SYNTHETIC);
	}
	
	/**
	 * Returns {@code true} if this is transient.
	 *
	 * @return {@code true} if transient.
	 * @since 2016/03/20
	 */
	public boolean isTransient()
	{
		return contains(FieldFlag.TRANSIENT);
	}
	
	/**
	 * Returns {@code true} if this is volatile.
	 *
	 * @return {@code true} if volatile.
	 * @since 2016/03/20
	 */
	public boolean isVolatile()
	{
		return contains(FieldFlag.VOLATILE);
	}
	
	/**
	 * Checks that the given flags are valid.
	 *
	 * @param __oc The outer class.
	 * @throws InvalidClassFormatException If they are not valid.
	 * @throws NullPointerException On null arguments.
	 * @since 2016/04/23
	 */
	private final void __checkFlags(ClassFlags __oc)
		throws InvalidClassFormatException, NullPointerException
	{
		// Check
		if (__oc == null)
			throw new NullPointerException("NARG");
		
		// {@squirreljme.error JC2u A field cannot be both {@code final} and
		// {@code volatile}. (The field flags)}
		if (isFinal() && isVolatile())
			throw new InvalidClassFormatException(
				String.format("JC2u %s", this));
		
		// If the class is an interface, some flags cannot be set
		if (__oc.isInterface())
			for (FieldFlag f : FieldFlag.values())
			{
				// Must have these
				boolean must = (f == FieldFlag.PUBLIC ||
					f == FieldFlag.STATIC || f == FieldFlag.FINAL);
				
				// Could have these
				boolean maybe = (f == FieldFlag.SYNTHETIC);
				
				// Is it set?
				boolean has = contains(f);
				
				// {@squirreljme.error JC2v Flags for interface field has an
				// incorrect set of flags. (The field flags)}
				if (must != has && !maybe)
					throw new InvalidClassFormatException(
						String.format("JC2v %s", this));
			}
	}
}








|









|









|









|









|









|









|










|










|



















|















|










75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
	 * Returns {@code true} if this is an enumeration.
	 *
	 * @return {@code true} if an enumeration.
	 * @since 2016/03/20
	 */
	public boolean isEnum()
	{
		return this.contains(FieldFlag.ENUM);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/03/20
	 */
	@Override
	public boolean isFinal()
	{
		return this.contains(FieldFlag.FINAL);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/03/20
	 */
	@Override
	public boolean isPrivate()
	{
		return this.contains(FieldFlag.PRIVATE);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/03/20
	 */
	@Override
	public boolean isProtected()
	{
		return this.contains(FieldFlag.PROTECTED);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/03/20
	 */
	@Override
	public boolean isPublic()
	{
		return this.contains(FieldFlag.PUBLIC);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/03/20
	 */
	@Override
	public boolean isStatic()
	{
		return this.contains(FieldFlag.STATIC);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/03/20
	 */
	@Override
	public boolean isSynthetic()
	{
		return this.contains(FieldFlag.SYNTHETIC);
	}
	
	/**
	 * Returns {@code true} if this is transient.
	 *
	 * @return {@code true} if transient.
	 * @since 2016/03/20
	 */
	public boolean isTransient()
	{
		return this.contains(FieldFlag.TRANSIENT);
	}
	
	/**
	 * Returns {@code true} if this is volatile.
	 *
	 * @return {@code true} if volatile.
	 * @since 2016/03/20
	 */
	public boolean isVolatile()
	{
		return this.contains(FieldFlag.VOLATILE);
	}
	
	/**
	 * Checks that the given flags are valid.
	 *
	 * @param __oc The outer class.
	 * @throws InvalidClassFormatException If they are not valid.
	 * @throws NullPointerException On null arguments.
	 * @since 2016/04/23
	 */
	private final void __checkFlags(ClassFlags __oc)
		throws InvalidClassFormatException, NullPointerException
	{
		// Check
		if (__oc == null)
			throw new NullPointerException("NARG");
		
		// {@squirreljme.error JC2u A field cannot be both {@code final} and
		// {@code volatile}. (The field flags)}
		if (this.isFinal() && this.isVolatile())
			throw new InvalidClassFormatException(
				String.format("JC2u %s", this));
		
		// If the class is an interface, some flags cannot be set
		if (__oc.isInterface())
			for (FieldFlag f : FieldFlag.values())
			{
				// Must have these
				boolean must = (f == FieldFlag.PUBLIC ||
					f == FieldFlag.STATIC || f == FieldFlag.FINAL);
				
				// Could have these
				boolean maybe = (f == FieldFlag.SYNTHETIC);
				
				// Is it set?
				boolean has = this.contains(f);
				
				// {@squirreljme.error JC2v Flags for interface field has an
				// incorrect set of flags. (The field flags)}
				if (must != has && !maybe)
					throw new InvalidClassFormatException(
						String.format("JC2v %s", this));
			}
	}
}

Name change from runt/libs/tool-classfile/net/multiphasicapps/classfile/FieldName.java to modules/tool-classfile/src/main/java/net/multiphasicapps/classfile/FieldName.java.

Name change from runt/libs/tool-classfile/net/multiphasicapps/classfile/FieldNameAndType.java to modules/tool-classfile/src/main/java/net/multiphasicapps/classfile/FieldNameAndType.java.

Name change from runt/libs/tool-classfile/net/multiphasicapps/classfile/FieldReference.java to modules/tool-classfile/src/main/java/net/multiphasicapps/classfile/FieldReference.java.

Name change from runt/libs/tool-classfile/net/multiphasicapps/classfile/Flag.java to modules/tool-classfile/src/main/java/net/multiphasicapps/classfile/Flag.java.

19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
{
	/**
	 * Returns the bit mask of the given flag.
	 *
	 * @return The bit mask of the given flag.
	 * @since 2017/07/07
	 */
	public abstract int javaBitMask();
	
	/**
	 * Returns the flag ordinal.
	 *
	 * @return The ordinal of the flag.
	 * @since 2016/04/23
	 */
	public abstract int ordinal();
}








|







|


19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
{
	/**
	 * Returns the bit mask of the given flag.
	 *
	 * @return The bit mask of the given flag.
	 * @since 2017/07/07
	 */
	int javaBitMask();
	
	/**
	 * Returns the flag ordinal.
	 *
	 * @return The ordinal of the flag.
	 * @since 2016/04/23
	 */
	int ordinal();
}

Name change from runt/libs/tool-classfile/net/multiphasicapps/classfile/Flags.java to modules/tool-classfile/src/main/java/net/multiphasicapps/classfile/Flags.java.

61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
	Flags(Class<F> __cl, Iterable<F> __fl)
	{
		// Check
		if (__cl == null || __fl == null)
			throw new NullPointerException("NARG");
		
		// Set
		cast = __cl;
		
		// Go through all input flags
		Set<F> to = new HashSet<>();
		int bits = 0;
		for (F f : __fl)
		{
			// Get ordinal







|







61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
	Flags(Class<F> __cl, Iterable<F> __fl)
	{
		// Check
		if (__cl == null || __fl == null)
			throw new NullPointerException("NARG");
		
		// Set
		this.cast = __cl;
		
		// Go through all input flags
		Set<F> to = new HashSet<>();
		int bits = 0;
		for (F f : __fl)
		{
			// Get ordinal
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
	@Override
	public final boolean contains(Object __o)
	{
		if (!(__o instanceof Flag))
			return false;
		
		// Quick bit check?
		if (cast.isInstance(__o))
			return 0 != (this.setbits & (1 << (((Flag)__o).ordinal())));
		
		// Fallback
		return this._flags.contains(__o);
	}
	
	/**







|







94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
	@Override
	public final boolean contains(Object __o)
	{
		if (!(__o instanceof Flag))
			return false;
		
		// Quick bit check?
		if (this.cast.isInstance(__o))
			return 0 != (this.setbits & (1 << (((Flag)__o).ordinal())));
		
		// Fallback
		return this._flags.contains(__o);
	}
	
	/**

Name change from runt/libs/tool-classfile/net/multiphasicapps/classfile/FormalParameter.java to modules/tool-classfile/src/main/java/net/multiphasicapps/classfile/FormalParameter.java.

Name change from runt/libs/tool-classfile/net/multiphasicapps/classfile/FormalParameters.java to modules/tool-classfile/src/main/java/net/multiphasicapps/classfile/FormalParameters.java.

Name change from runt/libs/tool-classfile/net/multiphasicapps/classfile/HasAccessibleFlags.java to modules/tool-classfile/src/main/java/net/multiphasicapps/classfile/HasAccessibleFlags.java.

19
20
21
22
23
24
25
26
27
28
{
	/**
	 * Returns accessible flags.
	 *
	 * @return The accessible flags.
	 * @since 2018/09/09
	 */
	public abstract AccessibleFlags flags();
}








|


19
20
21
22
23
24
25
26
27
28
{
	/**
	 * Returns accessible flags.
	 *
	 * @return The accessible flags.
	 * @since 2018/09/09
	 */
	AccessibleFlags flags();
}

Name change from runt/libs/tool-classfile/net/multiphasicapps/classfile/HasMemberFlags.java to modules/tool-classfile/src/main/java/net/multiphasicapps/classfile/HasMemberFlags.java.

21
22
23
24
25
26
27
28
29
30
	/**
	 * Returns member flags.
	 *
	 * @return The member flags.
	 * @since 2018/09/09
	 */
	@Override
	public abstract MemberFlags flags();
}








|


21
22
23
24
25
26
27
28
29
30
	/**
	 * Returns member flags.
	 *
	 * @return The member flags.
	 * @since 2018/09/09
	 */
	@Override
	MemberFlags flags();
}

Name change from runt/libs/tool-classfile/net/multiphasicapps/classfile/Identifier.java to modules/tool-classfile/src/main/java/net/multiphasicapps/classfile/Identifier.java.

Name change from runt/libs/tool-classfile/net/multiphasicapps/classfile/InnerClass.java to modules/tool-classfile/src/main/java/net/multiphasicapps/classfile/InnerClass.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.classfile;

import java.io.DataInputStream;
import java.io.IOException;

/**
 * This represents an inner class that is contained within an outer class, it
 * is used by the compiler to determine how classes are contained within each
 * other.
 *
 * @since 2018/05/15
 */












<
<
<







1
2
3
4
5
6
7
8
9
10
11
12



13
14
15
16
17
18
19
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.classfile;




/**
 * This represents an inner class that is contained within an outer class, it
 * is used by the compiler to determine how classes are contained within each
 * other.
 *
 * @since 2018/05/15
 */

Name change from runt/libs/tool-classfile/net/multiphasicapps/classfile/InnerClassFlag.java to modules/tool-classfile/src/main/java/net/multiphasicapps/classfile/InnerClassFlag.java.

Name change from runt/libs/tool-classfile/net/multiphasicapps/classfile/InnerClassFlags.java to modules/tool-classfile/src/main/java/net/multiphasicapps/classfile/InnerClassFlags.java.

8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.classfile;

import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import java.util.LinkedHashSet;
import java.util.Set;

/**
 * This represents a set of flags which are used as modifiers to inner classes.
 *
 * @since 2018/05/15
 */
public final class InnerClassFlags







<
<







8
9
10
11
12
13
14


15
16
17
18
19
20
21
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.classfile;

import java.lang.ref.Reference;
import java.lang.ref.WeakReference;



/**
 * This represents a set of flags which are used as modifiers to inner classes.
 *
 * @since 2018/05/15
 */
public final class InnerClassFlags

Name change from runt/libs/tool-classfile/net/multiphasicapps/classfile/InnerClasses.java to modules/tool-classfile/src/main/java/net/multiphasicapps/classfile/InnerClasses.java.

Name change from runt/libs/tool-classfile/net/multiphasicapps/classfile/Instruction.java to modules/tool-classfile/src/main/java/net/multiphasicapps/classfile/Instruction.java.

696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
	 * Returns the operation that this performs.
	 *
	 * @return The operation.
	 * @since 2017/05/20
	 */
	public int operation()
	{
		return op;
	}
	
	/**
	 * Obtains the given argument as a short.
	 *
	 * @param __i The argument to get.
	 * @return The value of the argument.







|







696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
	 * Returns the operation that this performs.
	 *
	 * @return The operation.
	 * @since 2017/05/20
	 */
	public int operation()
	{
		return this.op;
	}
	
	/**
	 * Obtains the given argument as a short.
	 *
	 * @param __i The argument to get.
	 * @return The value of the argument.

Name change from runt/libs/tool-classfile/net/multiphasicapps/classfile/InstructionAddressRange.java to modules/tool-classfile/src/main/java/net/multiphasicapps/classfile/InstructionAddressRange.java.

Name change from runt/libs/tool-classfile/net/multiphasicapps/classfile/InstructionIndex.java to modules/tool-classfile/src/main/java/net/multiphasicapps/classfile/InstructionIndex.java.

15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
 * opcodes based on their opcode ID.
 *
 * @since 2016/08/24
 */
public interface InstructionIndex
{
	/** NOP. */
	public static final int NOP =
		0;

	/** ACONST_NULL. */
	public static final int ACONST_NULL =
		1;

	/** ICONST_M1. */
	public static final int ICONST_M1 =
		2;

	/** ICONST_0. */
	public static final int ICONST_0 =
		3;

	/** ICONST_1. */
	public static final int ICONST_1 =
		4;

	/** ICONST_2. */
	public static final int ICONST_2 =
		5;

	/** ICONST_3. */
	public static final int ICONST_3 =
		6;

	/** ICONST_4. */
	public static final int ICONST_4 =
		7;

	/** ICONST_5. */
	public static final int ICONST_5 =
		8;

	/** LCONST_0. */
	public static final int LCONST_0 =
		9;

	/** LCONST_1. */
	public static final int LCONST_1 =
		10;

	/** FCONST_0. */
	public static final int FCONST_0 =
		11;

	/** FCONST_1. */
	public static final int FCONST_1 =
		12;

	/** FCONST_2. */
	public static final int FCONST_2 =
		13;

	/** DCONST_0. */
	public static final int DCONST_0 =
		14;

	/** DCONST_1. */
	public static final int DCONST_1 =
		15;

	/** BIPUSH. */
	public static final int BIPUSH =
		16;

	/** SIPUSH. */
	public static final int SIPUSH =
		17;

	/** LDC. */
	public static final int LDC =
		18;

	/** LDC_W. */
	public static final int LDC_W =
		19;

	/** LDC2_W. */
	public static final int LDC2_W =
		20;

	/** ILOAD. */
	public static final int ILOAD =
		21;

	/** LLOAD. */
	public static final int LLOAD =
		22;

	/** FLOAD. */
	public static final int FLOAD =
		23;

	/** DLOAD. */
	public static final int DLOAD =
		24;

	/** ALOAD. */
	public static final int ALOAD =
		25;

	/** ILOAD_0. */
	public static final int ILOAD_0 =
		26;

	/** ILOAD_1. */
	public static final int ILOAD_1 =
		27;

	/** ILOAD_2. */
	public static final int ILOAD_2 =
		28;

	/** ILOAD_3. */
	public static final int ILOAD_3 =
		29;

	/** LLOAD_0. */
	public static final int LLOAD_0 =
		30;

	/** LLOAD_1. */
	public static final int LLOAD_1 =
		31;

	/** LLOAD_2. */
	public static final int LLOAD_2 =
		32;

	/** LLOAD_3. */
	public static final int LLOAD_3 =
		33;

	/** FLOAD_0. */
	public static final int FLOAD_0 =
		34;

	/** FLOAD_1. */
	public static final int FLOAD_1 =
		35;

	/** FLOAD_2. */
	public static final int FLOAD_2 =
		36;

	/** FLOAD_3. */
	public static final int FLOAD_3 =
		37;

	/** DLOAD_0. */
	public static final int DLOAD_0 =
		38;

	/** DLOAD_1. */
	public static final int DLOAD_1 =
		39;

	/** DLOAD_2. */
	public static final int DLOAD_2 =
		40;

	/** DLOAD_3. */
	public static final int DLOAD_3 =
		41;

	/** ALOAD_0. */
	public static final int ALOAD_0 =
		42;

	/** ALOAD_1. */
	public static final int ALOAD_1 =
		43;

	/** ALOAD_2. */
	public static final int ALOAD_2 =
		44;

	/** ALOAD_3. */
	public static final int ALOAD_3 =
		45;

	/** IALOAD. */
	public static final int IALOAD =
		46;

	/** LALOAD. */
	public static final int LALOAD =
		47;

	/** FALOAD. */
	public static final int FALOAD =
		48;

	/** DALOAD. */
	public static final int DALOAD =
		49;

	/** AALOAD. */
	public static final int AALOAD =
		50;

	/** BALOAD. */
	public static final int BALOAD =
		51;

	/** CALOAD. */
	public static final int CALOAD =
		52;

	/** SALOAD. */
	public static final int SALOAD =
		53;

	/** ISTORE. */
	public static final int ISTORE =
		54;

	/** LSTORE. */
	public static final int LSTORE =
		55;

	/** FSTORE. */
	public static final int FSTORE =
		56;

	/** DSTORE. */
	public static final int DSTORE =
		57;

	/** ASTORE. */
	public static final int ASTORE =
		58;

	/** ISTORE_0. */
	public static final int ISTORE_0 =
		59;

	/** ISTORE_1. */
	public static final int ISTORE_1 =
		60;

	/** ISTORE_2. */
	public static final int ISTORE_2 =
		61;

	/** ISTORE_3. */
	public static final int ISTORE_3 =
		62;

	/** LSTORE_0. */
	public static final int LSTORE_0 =
		63;

	/** LSTORE_1. */
	public static final int LSTORE_1 =
		64;

	/** LSTORE_2. */
	public static final int LSTORE_2 =
		65;

	/** LSTORE_3. */
	public static final int LSTORE_3 =
		66;

	/** FSTORE_0. */
	public static final int FSTORE_0 =
		67;

	/** FSTORE_1. */
	public static final int FSTORE_1 =
		68;

	/** FSTORE_2. */
	public static final int FSTORE_2 =
		69;

	/** FSTORE_3. */
	public static final int FSTORE_3 =
		70;

	/** DSTORE_0. */
	public static final int DSTORE_0 =
		71;

	/** DSTORE_1. */
	public static final int DSTORE_1 =
		72;

	/** DSTORE_2. */
	public static final int DSTORE_2 =
		73;

	/** DSTORE_3. */
	public static final int DSTORE_3 =
		74;

	/** ASTORE_0. */
	public static final int ASTORE_0 =
		75;

	/** ASTORE_1. */
	public static final int ASTORE_1 =
		76;

	/** ASTORE_2. */
	public static final int ASTORE_2 =
		77;

	/** ASTORE_3. */
	public static final int ASTORE_3 =
		78;

	/** IASTORE. */
	public static final int IASTORE =
		79;

	/** LASTORE. */
	public static final int LASTORE =
		80;

	/** FASTORE. */
	public static final int FASTORE =
		81;

	/** DASTORE. */
	public static final int DASTORE =
		82;

	/** AASTORE. */
	public static final int AASTORE =
		83;

	/** BASTORE. */
	public static final int BASTORE =
		84;

	/** CASTORE. */
	public static final int CASTORE =
		85;

	/** SASTORE. */
	public static final int SASTORE =
		86;

	/** POP. */
	public static final int POP =
		87;

	/** POP2. */
	public static final int POP2 =
		88;

	/** DUP. */
	public static final int DUP =
		89;

	/** DUP_X1. */
	public static final int DUP_X1 =
		90;

	/** DUP_X2. */
	public static final int DUP_X2 =
		91;

	/** DUP2. */
	public static final int DUP2 =
		92;

	/** DUP2_X1. */
	public static final int DUP2_X1 =
		93;

	/** DUP2_X2. */
	public static final int DUP2_X2 =
		94;

	/** SWAP. */
	public static final int SWAP =
		95;

	/** IADD. */
	public static final int IADD =
		96;

	/** LADD. */
	public static final int LADD =
		97;

	/** FADD. */
	public static final int FADD =
		98;

	/** DADD. */
	public static final int DADD =
		99;

	/** ISUB. */
	public static final int ISUB =
		100;

	/** LSUB. */
	public static final int LSUB =
		101;

	/** FSUB. */
	public static final int FSUB =
		102;

	/** DSUB. */
	public static final int DSUB =
		103;

	/** IMUL. */
	public static final int IMUL =
		104;

	/** LMUL. */
	public static final int LMUL =
		105;

	/** FMUL. */
	public static final int FMUL =
		106;

	/** DMUL. */
	public static final int DMUL =
		107;

	/** IDIV. */
	public static final int IDIV =
		108;

	/** LDIV. */
	public static final int LDIV =
		109;

	/** FDIV. */
	public static final int FDIV =
		110;

	/** DDIV. */
	public static final int DDIV =
		111;

	/** IREM. */
	public static final int IREM =
		112;

	/** LREM. */
	public static final int LREM =
		113;

	/** FREM. */
	public static final int FREM =
		114;

	/** DREM. */
	public static final int DREM =
		115;

	/** INEG. */
	public static final int INEG =
		116;

	/** LNEG. */
	public static final int LNEG =
		117;

	/** FNEG. */
	public static final int FNEG =
		118;

	/** DNEG. */
	public static final int DNEG =
		119;

	/** ISHL. */
	public static final int ISHL =
		120;

	/** LSHL. */
	public static final int LSHL =
		121;

	/** ISHR. */
	public static final int ISHR =
		122;

	/** LSHR. */
	public static final int LSHR =
		123;

	/** IUSHR. */
	public static final int IUSHR =
		124;

	/** LUSHR. */
	public static final int LUSHR =
		125;

	/** IAND. */
	public static final int IAND =
		126;

	/** LAND. */
	public static final int LAND =
		127;

	/** IOR. */
	public static final int IOR =
		128;

	/** LOR. */
	public static final int LOR =
		129;

	/** IXOR. */
	public static final int IXOR =
		130;

	/** LXOR. */
	public static final int LXOR =
		131;

	/** IINC. */
	public static final int IINC =
		132;

	/** I2L. */
	public static final int I2L =
		133;

	/** I2F. */
	public static final int I2F =
		134;

	/** I2D. */
	public static final int I2D =
		135;

	/** L2I. */
	public static final int L2I =
		136;

	/** L2F. */
	public static final int L2F =
		137;

	/** L2D. */
	public static final int L2D =
		138;

	/** F2I. */
	public static final int F2I =
		139;

	/** F2L. */
	public static final int F2L =
		140;

	/** F2D. */
	public static final int F2D =
		141;

	/** D2I. */
	public static final int D2I =
		142;

	/** D2L. */
	public static final int D2L =
		143;

	/** D2F. */
	public static final int D2F =
		144;

	/** I2B. */
	public static final int I2B =
		145;

	/** I2C. */
	public static final int I2C =
		146;

	/** I2S. */
	public static final int I2S =
		147;

	/** LCMP. */
	public static final int LCMP =
		148;

	/** FCMPL. */
	public static final int FCMPL =
		149;

	/** FCMPG. */
	public static final int FCMPG =
		150;

	/** DCMPL. */
	public static final int DCMPL =
		151;

	/** DCMPG. */
	public static final int DCMPG =
		152;

	/** IFEQ. */
	public static final int IFEQ =
		153;

	/** IFNE. */
	public static final int IFNE =
		154;

	/** IFLT. */
	public static final int IFLT =
		155;

	/** IFGE. */
	public static final int IFGE =
		156;

	/** IFGT. */
	public static final int IFGT =
		157;

	/** IFLE. */
	public static final int IFLE =
		158;

	/** IF_ICMPEQ. */
	public static final int IF_ICMPEQ =
		159;

	/** IF_ICMPNE. */
	public static final int IF_ICMPNE =
		160;

	/** IF_ICMPLT. */
	public static final int IF_ICMPLT =
		161;

	/** IF_ICMPGE. */
	public static final int IF_ICMPGE =
		162;

	/** IF_ICMPGT. */
	public static final int IF_ICMPGT =
		163;

	/** IF_ICMPLE. */
	public static final int IF_ICMPLE =
		164;

	/** IF_ACMPEQ. */
	public static final int IF_ACMPEQ =
		165;

	/** IF_ACMPNE. */
	public static final int IF_ACMPNE =
		166;

	/** GOTO. */
	public static final int GOTO =
		167;

	/** JSR. */
	public static final int JSR =
		168;

	/** RET. */
	public static final int RET =
		169;

	/** TABLESWITCH. */
	public static final int TABLESWITCH =
		170;

	/** LOOKUPSWITCH. */
	public static final int LOOKUPSWITCH =
		171;

	/** IRETURN. */
	public static final int IRETURN =
		172;

	/** LRETURN. */
	public static final int LRETURN =
		173;

	/** FRETURN. */
	public static final int FRETURN =
		174;

	/** DRETURN. */
	public static final int DRETURN =
		175;

	/** ARETURN. */
	public static final int ARETURN =
		176;

	/** RETURN. */
	public static final int RETURN =
		177;

	/** GETSTATIC. */
	public static final int GETSTATIC =
		178;

	/** PUTSTATIC. */
	public static final int PUTSTATIC =
		179;

	/** GETFIELD. */
	public static final int GETFIELD =
		180;

	/** PUTFIELD. */
	public static final int PUTFIELD =
		181;

	/** INVOKEVIRTUAL. */
	public static final int INVOKEVIRTUAL =
		182;

	/** INVOKESPECIAL. */
	public static final int INVOKESPECIAL =
		183;

	/** INVOKESTATIC. */
	public static final int INVOKESTATIC =
		184;

	/** INVOKEINTERFACE. */
	public static final int INVOKEINTERFACE =
		185;

	/** INVOKEDYNAMIC. */
	public static final int INVOKEDYNAMIC =
		186;

	/** NEW. */
	public static final int NEW =
		187;

	/** NEWARRAY. */
	public static final int NEWARRAY =
		188;

	/** ANEWARRAY. */
	public static final int ANEWARRAY =
		189;

	/** ARRAYLENGTH. */
	public static final int ARRAYLENGTH =
		190;

	/** ATHROW. */
	public static final int ATHROW =
		191;

	/** CHECKCAST. */
	public static final int CHECKCAST =
		192;

	/** INSTANCEOF. */
	public static final int INSTANCEOF =
		193;

	/** MONITORENTER. */
	public static final int MONITORENTER =
		194;

	/** MONITOREXIT. */
	public static final int MONITOREXIT =
		195;

	/** WIDE. */
	public static final int WIDE =
		196;

	/** MULTIANEWARRAY. */
	public static final int MULTIANEWARRAY =
		197;

	/** IFNULL. */
	public static final int IFNULL =
		198;

	/** IFNONNULL. */
	public static final int IFNONNULL =
		199;

	/** GOTO_W. */
	public static final int GOTO_W =
		200;

	/** JSR_W. */
	public static final int JSR_W =
		201;

	/** BREAKPOINT. */
	public static final int BREAKPOINT =
		202;

	/** IMPDEP1. */
	public static final int IMPDEP1 =
		254;

	/** IMPDEP2. */
	public static final int IMPDEP2 =
		255;

	/** Wide ALOAD. */
	public static final int WIDE_ALOAD =
		(WIDE << 8) | ALOAD;

	/** Wide ILOAD. */
	public static final int WIDE_ILOAD =
		(WIDE << 8) | ILOAD;

	/** Wide LLOAD. */
	public static final int WIDE_LLOAD =
		(WIDE << 8) | LLOAD;

	/** Wide FLOAD. */
	public static final int WIDE_FLOAD =
		(WIDE << 8) | FLOAD;

	/** Wide DLOAD. */
	public static final int WIDE_DLOAD =
		(WIDE << 8) | DLOAD;

	/** Wide ASTORE. */
	public static final int WIDE_ASTORE =
		(WIDE << 8) | ASTORE;

	/** Wide ISTORE. */
	public static final int WIDE_ISTORE =
		(WIDE << 8) | ISTORE;

	/** Wide LSTORE. */
	public static final int WIDE_LSTORE =
		(WIDE << 8) | LSTORE;

	/** Wide FSTORE. */
	public static final int WIDE_FSTORE =
		(WIDE << 8) | FSTORE;

	/** Wide DSTORE. */
	public static final int WIDE_DSTORE =
		(WIDE << 8) | DSTORE;
	
	/** Wide IINC. */
	public static final int WIDE_IINC =
		(WIDE << 8) | IINC;
}








|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|



|
|


|
|


|
|


|
|


|
|


|
|


|
|


|
|


|
|


|
|


|
|


15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
 * opcodes based on their opcode ID.
 *
 * @since 2016/08/24
 */
public interface InstructionIndex
{
	/** NOP. */
	int NOP =
		0;

	/** ACONST_NULL. */
	int ACONST_NULL =
		1;

	/** ICONST_M1. */
	int ICONST_M1 =
		2;

	/** ICONST_0. */
	int ICONST_0 =
		3;

	/** ICONST_1. */
	int ICONST_1 =
		4;

	/** ICONST_2. */
	int ICONST_2 =
		5;

	/** ICONST_3. */
	int ICONST_3 =
		6;

	/** ICONST_4. */
	int ICONST_4 =
		7;

	/** ICONST_5. */
	int ICONST_5 =
		8;

	/** LCONST_0. */
	int LCONST_0 =
		9;

	/** LCONST_1. */
	int LCONST_1 =
		10;

	/** FCONST_0. */
	int FCONST_0 =
		11;

	/** FCONST_1. */
	int FCONST_1 =
		12;

	/** FCONST_2. */
	int FCONST_2 =
		13;

	/** DCONST_0. */
	int DCONST_0 =
		14;

	/** DCONST_1. */
	int DCONST_1 =
		15;

	/** BIPUSH. */
	int BIPUSH =
		16;

	/** SIPUSH. */
	int SIPUSH =
		17;

	/** LDC. */
	int LDC =
		18;

	/** LDC_W. */
	int LDC_W =
		19;

	/** LDC2_W. */
	int LDC2_W =
		20;

	/** ILOAD. */
	int ILOAD =
		21;

	/** LLOAD. */
	int LLOAD =
		22;

	/** FLOAD. */
	int FLOAD =
		23;

	/** DLOAD. */
	int DLOAD =
		24;

	/** ALOAD. */
	int ALOAD =
		25;

	/** ILOAD_0. */
	int ILOAD_0 =
		26;

	/** ILOAD_1. */
	int ILOAD_1 =
		27;

	/** ILOAD_2. */
	int ILOAD_2 =
		28;

	/** ILOAD_3. */
	int ILOAD_3 =
		29;

	/** LLOAD_0. */
	int LLOAD_0 =
		30;

	/** LLOAD_1. */
	int LLOAD_1 =
		31;

	/** LLOAD_2. */
	int LLOAD_2 =
		32;

	/** LLOAD_3. */
	int LLOAD_3 =
		33;

	/** FLOAD_0. */
	int FLOAD_0 =
		34;

	/** FLOAD_1. */
	int FLOAD_1 =
		35;

	/** FLOAD_2. */
	int FLOAD_2 =
		36;

	/** FLOAD_3. */
	int FLOAD_3 =
		37;

	/** DLOAD_0. */
	int DLOAD_0 =
		38;

	/** DLOAD_1. */
	int DLOAD_1 =
		39;

	/** DLOAD_2. */
	int DLOAD_2 =
		40;

	/** DLOAD_3. */
	int DLOAD_3 =
		41;

	/** ALOAD_0. */
	int ALOAD_0 =
		42;

	/** ALOAD_1. */
	int ALOAD_1 =
		43;

	/** ALOAD_2. */
	int ALOAD_2 =
		44;

	/** ALOAD_3. */
	int ALOAD_3 =
		45;

	/** IALOAD. */
	int IALOAD =
		46;

	/** LALOAD. */
	int LALOAD =
		47;

	/** FALOAD. */
	int FALOAD =
		48;

	/** DALOAD. */
	int DALOAD =
		49;

	/** AALOAD. */
	int AALOAD =
		50;

	/** BALOAD. */
	int BALOAD =
		51;

	/** CALOAD. */
	int CALOAD =
		52;

	/** SALOAD. */
	int SALOAD =
		53;

	/** ISTORE. */
	int ISTORE =
		54;

	/** LSTORE. */
	int LSTORE =
		55;

	/** FSTORE. */
	int FSTORE =
		56;

	/** DSTORE. */
	int DSTORE =
		57;

	/** ASTORE. */
	int ASTORE =
		58;

	/** ISTORE_0. */
	int ISTORE_0 =
		59;

	/** ISTORE_1. */
	int ISTORE_1 =
		60;

	/** ISTORE_2. */
	int ISTORE_2 =
		61;

	/** ISTORE_3. */
	int ISTORE_3 =
		62;

	/** LSTORE_0. */
	int LSTORE_0 =
		63;

	/** LSTORE_1. */
	int LSTORE_1 =
		64;

	/** LSTORE_2. */
	int LSTORE_2 =
		65;

	/** LSTORE_3. */
	int LSTORE_3 =
		66;

	/** FSTORE_0. */
	int FSTORE_0 =
		67;

	/** FSTORE_1. */
	int FSTORE_1 =
		68;

	/** FSTORE_2. */
	int FSTORE_2 =
		69;

	/** FSTORE_3. */
	int FSTORE_3 =
		70;

	/** DSTORE_0. */
	int DSTORE_0 =
		71;

	/** DSTORE_1. */
	int DSTORE_1 =
		72;

	/** DSTORE_2. */
	int DSTORE_2 =
		73;

	/** DSTORE_3. */
	int DSTORE_3 =
		74;

	/** ASTORE_0. */
	int ASTORE_0 =
		75;

	/** ASTORE_1. */
	int ASTORE_1 =
		76;

	/** ASTORE_2. */
	int ASTORE_2 =
		77;

	/** ASTORE_3. */
	int ASTORE_3 =
		78;

	/** IASTORE. */
	int IASTORE =
		79;

	/** LASTORE. */
	int LASTORE =
		80;

	/** FASTORE. */
	int FASTORE =
		81;

	/** DASTORE. */
	int DASTORE =
		82;

	/** AASTORE. */
	int AASTORE =
		83;

	/** BASTORE. */
	int BASTORE =
		84;

	/** CASTORE. */
	int CASTORE =
		85;

	/** SASTORE. */
	int SASTORE =
		86;

	/** POP. */
	int POP =
		87;

	/** POP2. */
	int POP2 =
		88;

	/** DUP. */
	int DUP =
		89;

	/** DUP_X1. */
	int DUP_X1 =
		90;

	/** DUP_X2. */
	int DUP_X2 =
		91;

	/** DUP2. */
	int DUP2 =
		92;

	/** DUP2_X1. */
	int DUP2_X1 =
		93;

	/** DUP2_X2. */
	int DUP2_X2 =
		94;

	/** SWAP. */
	int SWAP =
		95;

	/** IADD. */
	int IADD =
		96;

	/** LADD. */
	int LADD =
		97;

	/** FADD. */
	int FADD =
		98;

	/** DADD. */
	int DADD =
		99;

	/** ISUB. */
	int ISUB =
		100;

	/** LSUB. */
	int LSUB =
		101;

	/** FSUB. */
	int FSUB =
		102;

	/** DSUB. */
	int DSUB =
		103;

	/** IMUL. */
	int IMUL =
		104;

	/** LMUL. */
	int LMUL =
		105;

	/** FMUL. */
	int FMUL =
		106;

	/** DMUL. */
	int DMUL =
		107;

	/** IDIV. */
	int IDIV =
		108;

	/** LDIV. */
	int LDIV =
		109;

	/** FDIV. */
	int FDIV =
		110;

	/** DDIV. */
	int DDIV =
		111;

	/** IREM. */
	int IREM =
		112;

	/** LREM. */
	int LREM =
		113;

	/** FREM. */
	int FREM =
		114;

	/** DREM. */
	int DREM =
		115;

	/** INEG. */
	int INEG =
		116;

	/** LNEG. */
	int LNEG =
		117;

	/** FNEG. */
	int FNEG =
		118;

	/** DNEG. */
	int DNEG =
		119;

	/** ISHL. */
	int ISHL =
		120;

	/** LSHL. */
	int LSHL =
		121;

	/** ISHR. */
	int ISHR =
		122;

	/** LSHR. */
	int LSHR =
		123;

	/** IUSHR. */
	int IUSHR =
		124;

	/** LUSHR. */
	int LUSHR =
		125;

	/** IAND. */
	int IAND =
		126;

	/** LAND. */
	int LAND =
		127;

	/** IOR. */
	int IOR =
		128;

	/** LOR. */
	int LOR =
		129;

	/** IXOR. */
	int IXOR =
		130;

	/** LXOR. */
	int LXOR =
		131;

	/** IINC. */
	int IINC =
		132;

	/** I2L. */
	int I2L =
		133;

	/** I2F. */
	int I2F =
		134;

	/** I2D. */
	int I2D =
		135;

	/** L2I. */
	int L2I =
		136;

	/** L2F. */
	int L2F =
		137;

	/** L2D. */
	int L2D =
		138;

	/** F2I. */
	int F2I =
		139;

	/** F2L. */
	int F2L =
		140;

	/** F2D. */
	int F2D =
		141;

	/** D2I. */
	int D2I =
		142;

	/** D2L. */
	int D2L =
		143;

	/** D2F. */
	int D2F =
		144;

	/** I2B. */
	int I2B =
		145;

	/** I2C. */
	int I2C =
		146;

	/** I2S. */
	int I2S =
		147;

	/** LCMP. */
	int LCMP =
		148;

	/** FCMPL. */
	int FCMPL =
		149;

	/** FCMPG. */
	int FCMPG =
		150;

	/** DCMPL. */
	int DCMPL =
		151;

	/** DCMPG. */
	int DCMPG =
		152;

	/** IFEQ. */
	int IFEQ =
		153;

	/** IFNE. */
	int IFNE =
		154;

	/** IFLT. */
	int IFLT =
		155;

	/** IFGE. */
	int IFGE =
		156;

	/** IFGT. */
	int IFGT =
		157;

	/** IFLE. */
	int IFLE =
		158;

	/** IF_ICMPEQ. */
	int IF_ICMPEQ =
		159;

	/** IF_ICMPNE. */
	int IF_ICMPNE =
		160;

	/** IF_ICMPLT. */
	int IF_ICMPLT =
		161;

	/** IF_ICMPGE. */
	int IF_ICMPGE =
		162;

	/** IF_ICMPGT. */
	int IF_ICMPGT =
		163;

	/** IF_ICMPLE. */
	int IF_ICMPLE =
		164;

	/** IF_ACMPEQ. */
	int IF_ACMPEQ =
		165;

	/** IF_ACMPNE. */
	int IF_ACMPNE =
		166;

	/** GOTO. */
	int GOTO =
		167;

	/** JSR. */
	int JSR =
		168;

	/** RET. */
	int RET =
		169;

	/** TABLESWITCH. */
	int TABLESWITCH =
		170;

	/** LOOKUPSWITCH. */
	int LOOKUPSWITCH =
		171;

	/** IRETURN. */
	int IRETURN =
		172;

	/** LRETURN. */
	int LRETURN =
		173;

	/** FRETURN. */
	int FRETURN =
		174;

	/** DRETURN. */
	int DRETURN =
		175;

	/** ARETURN. */
	int ARETURN =
		176;

	/** RETURN. */
	int RETURN =
		177;

	/** GETSTATIC. */
	int GETSTATIC =
		178;

	/** PUTSTATIC. */
	int PUTSTATIC =
		179;

	/** GETFIELD. */
	int GETFIELD =
		180;

	/** PUTFIELD. */
	int PUTFIELD =
		181;

	/** INVOKEVIRTUAL. */
	int INVOKEVIRTUAL =
		182;

	/** INVOKESPECIAL. */
	int INVOKESPECIAL =
		183;

	/** INVOKESTATIC. */
	int INVOKESTATIC =
		184;

	/** INVOKEINTERFACE. */
	int INVOKEINTERFACE =
		185;

	/** INVOKEDYNAMIC. */
	int INVOKEDYNAMIC =
		186;

	/** NEW. */
	int NEW =
		187;

	/** NEWARRAY. */
	int NEWARRAY =
		188;

	/** ANEWARRAY. */
	int ANEWARRAY =
		189;

	/** ARRAYLENGTH. */
	int ARRAYLENGTH =
		190;

	/** ATHROW. */
	int ATHROW =
		191;

	/** CHECKCAST. */
	int CHECKCAST =
		192;

	/** INSTANCEOF. */
	int INSTANCEOF =
		193;

	/** MONITORENTER. */
	int MONITORENTER =
		194;

	/** MONITOREXIT. */
	int MONITOREXIT =
		195;

	/** WIDE. */
	int WIDE =
		196;

	/** MULTIANEWARRAY. */
	int MULTIANEWARRAY =
		197;

	/** IFNULL. */
	int IFNULL =
		198;

	/** IFNONNULL. */
	int IFNONNULL =
		199;

	/** GOTO_W. */
	int GOTO_W =
		200;

	/** JSR_W. */
	int JSR_W =
		201;

	/** BREAKPOINT. */
	int BREAKPOINT =
		202;

	/** IMPDEP1. */
	int IMPDEP1 =
		254;

	/** IMPDEP2. */
	int IMPDEP2 =
		255;

	/** Wide ALOAD. */
	int WIDE_ALOAD =
		(InstructionIndex.WIDE << 8) | InstructionIndex.ALOAD;

	/** Wide ILOAD. */
	int WIDE_ILOAD =
		(InstructionIndex.WIDE << 8) | InstructionIndex.ILOAD;

	/** Wide LLOAD. */
	int WIDE_LLOAD =
		(InstructionIndex.WIDE << 8) | InstructionIndex.LLOAD;

	/** Wide FLOAD. */
	int WIDE_FLOAD =
		(InstructionIndex.WIDE << 8) | InstructionIndex.FLOAD;

	/** Wide DLOAD. */
	int WIDE_DLOAD =
		(InstructionIndex.WIDE << 8) | InstructionIndex.DLOAD;

	/** Wide ASTORE. */
	int WIDE_ASTORE =
		(InstructionIndex.WIDE << 8) | InstructionIndex.ASTORE;

	/** Wide ISTORE. */
	int WIDE_ISTORE =
		(InstructionIndex.WIDE << 8) | InstructionIndex.ISTORE;

	/** Wide LSTORE. */
	int WIDE_LSTORE =
		(InstructionIndex.WIDE << 8) | InstructionIndex.LSTORE;

	/** Wide FSTORE. */
	int WIDE_FSTORE =
		(InstructionIndex.WIDE << 8) | InstructionIndex.FSTORE;

	/** Wide DSTORE. */
	int WIDE_DSTORE =
		(InstructionIndex.WIDE << 8) | InstructionIndex.DSTORE;
	
	/** Wide IINC. */
	int WIDE_IINC =
		(InstructionIndex.WIDE << 8) | InstructionIndex.IINC;
}

Name change from runt/libs/tool-classfile/net/multiphasicapps/classfile/InstructionJumpTarget.java to modules/tool-classfile/src/main/java/net/multiphasicapps/classfile/InstructionJumpTarget.java.

Name change from runt/libs/tool-classfile/net/multiphasicapps/classfile/InstructionJumpTargets.java to modules/tool-classfile/src/main/java/net/multiphasicapps/classfile/InstructionJumpTargets.java.

Name change from runt/libs/tool-classfile/net/multiphasicapps/classfile/InstructionMnemonics.java to modules/tool-classfile/src/main/java/net/multiphasicapps/classfile/InstructionMnemonics.java.

Name change from runt/libs/tool-classfile/net/multiphasicapps/classfile/IntMatchingJumpTable.java to modules/tool-classfile/src/main/java/net/multiphasicapps/classfile/IntMatchingJumpTable.java.

22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
	 * Matches the input key with the given jump target or returns the default.
	 *
	 * @param __k The key to match.
	 * @return The jump target for the match or the default if it was not
	 * found.
	 * @since 2018/09/20
	 */
	public abstract InstructionJumpTarget match(int __k);
	
	/**
	 * Returns all of the used jump targets.
	 *
	 * @return The used jump targets.
	 * @since 2019/03/31
	 */
	public abstract InstructionJumpTarget[] targets();
}








|







|


22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
	 * Matches the input key with the given jump target or returns the default.
	 *
	 * @param __k The key to match.
	 * @return The jump target for the match or the default if it was not
	 * found.
	 * @since 2018/09/20
	 */
	InstructionJumpTarget match(int __k);
	
	/**
	 * Returns all of the used jump targets.
	 *
	 * @return The used jump targets.
	 * @since 2019/03/31
	 */
	InstructionJumpTarget[] targets();
}

Name change from runt/libs/tool-classfile/net/multiphasicapps/classfile/InvalidClassFormatException.java to modules/tool-classfile/src/main/java/net/multiphasicapps/classfile/InvalidClassFormatException.java.

Name change from runt/libs/tool-classfile/net/multiphasicapps/classfile/JavaType.java to modules/tool-classfile/src/main/java/net/multiphasicapps/classfile/JavaType.java.

208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225


226
227
228
229
230
231
232
233
	 * Is this the nothing type?
	 *
	 * @return If this is the nothing type.
	 * @since 2017/10/20
	 */
	public boolean isNothing()
	{
		return equals(NOTHING);
	}
	
	/**
	 * Is this a top type?
	 *
	 * @return If this is a top type or not.
	 * @since 2017/09/16
	 */
	public boolean isTop()
	{


		return equals(TOP_LONG) || equals(TOP_DOUBLE) || equals(TOP_UNDEFINED);
	}
	
	/**
	 * Is this a wide type?
	 *
	 * @return {@code true} if the type is a wide type.
	 * @since 2017/07/28







|










>
>
|







208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
	 * Is this the nothing type?
	 *
	 * @return If this is the nothing type.
	 * @since 2017/10/20
	 */
	public boolean isNothing()
	{
		return this.equals(JavaType.NOTHING);
	}
	
	/**
	 * Is this a top type?
	 *
	 * @return If this is a top type or not.
	 * @since 2017/09/16
	 */
	public boolean isTop()
	{
		return this.equals(JavaType.TOP_LONG) || this.equals(JavaType.TOP_DOUBLE) || this
			.equals(
			JavaType.TOP_UNDEFINED);
	}
	
	/**
	 * Is this a wide type?
	 *
	 * @return {@code true} if the type is a wide type.
	 * @since 2017/07/28
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
	{
		PrimitiveType pt = this.type.primitiveType();
		if (pt == null)
			return null;
		
		switch (pt)
		{
			case LONG:		return TOP_LONG;
			case DOUBLE:	return TOP_DOUBLE;
			default:
				return null;
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/07/28
	 */
	@Override
	public String toString()
	{
		// Unknown
		Reference<String> ref = this._string;
		String rv;
		
		// Cache?
		if (ref == null || null == (rv = ref.get()))
		{
			// Fixed type
			if (this.equals(TOP_LONG))
				rv = "top-long";
			else if (this.equals(TOP_DOUBLE))
				rv = "top-double";
			else if (this.equals(TOP_UNDEFINED))
				rv = "top-undefined";
			else if (this.equals(NOTHING))
				rv = "nothing";
			
			// Other
			else
				rv = this.type.toString();
			
			// Cache







|
|




















|

|

|

|







254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
	{
		PrimitiveType pt = this.type.primitiveType();
		if (pt == null)
			return null;
		
		switch (pt)
		{
			case LONG:		return JavaType.TOP_LONG;
			case DOUBLE:	return JavaType.TOP_DOUBLE;
			default:
				return null;
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/07/28
	 */
	@Override
	public String toString()
	{
		// Unknown
		Reference<String> ref = this._string;
		String rv;
		
		// Cache?
		if (ref == null || null == (rv = ref.get()))
		{
			// Fixed type
			if (this.equals(JavaType.TOP_LONG))
				rv = "top-long";
			else if (this.equals(JavaType.TOP_DOUBLE))
				rv = "top-double";
			else if (this.equals(JavaType.TOP_UNDEFINED))
				rv = "top-undefined";
			else if (this.equals(JavaType.NOTHING))
				rv = "nothing";
			
			// Other
			else
				rv = this.type.toString();
			
			// Cache
313
314
315
316
317
318
319
320
321
322
	 * Returns the width of the type.
	 *
	 * @return The width of the type.
	 * @since 2017/09/03
	 */
	public int width()
	{
		return (isWide() ? 2 : 1);
	}
}







|


315
316
317
318
319
320
321
322
323
324
	 * Returns the width of the type.
	 *
	 * @return The width of the type.
	 * @since 2017/09/03
	 */
	public int width()
	{
		return (this.isWide() ? 2 : 1);
	}
}

Name change from runt/libs/tool-classfile/net/multiphasicapps/classfile/LookupSwitch.java to modules/tool-classfile/src/main/java/net/multiphasicapps/classfile/LookupSwitch.java.

Name change from runt/libs/tool-classfile/net/multiphasicapps/classfile/Member.java to modules/tool-classfile/src/main/java/net/multiphasicapps/classfile/Member.java.

Name change from runt/libs/tool-classfile/net/multiphasicapps/classfile/MemberDescriptor.java to modules/tool-classfile/src/main/java/net/multiphasicapps/classfile/MemberDescriptor.java.

Name change from runt/libs/tool-classfile/net/multiphasicapps/classfile/MemberFlag.java to modules/tool-classfile/src/main/java/net/multiphasicapps/classfile/MemberFlag.java.

Name change from runt/libs/tool-classfile/net/multiphasicapps/classfile/MemberFlags.java to modules/tool-classfile/src/main/java/net/multiphasicapps/classfile/MemberFlags.java.

103
104
105
106
107
108
109
110
111
112
113
	/**
	 * {@inheritDoc}
	 * @since 2016/03/20
	 */
	@Override
	public final boolean isPackagePrivate()
	{
		return !isPublic() && !isProtected() && !isPrivate();
	}
}








|



103
104
105
106
107
108
109
110
111
112
113
	/**
	 * {@inheritDoc}
	 * @since 2016/03/20
	 */
	@Override
	public final boolean isPackagePrivate()
	{
		return !this.isPublic() && !this.isProtected() && !this.isPrivate();
	}
}

Name change from runt/libs/tool-classfile/net/multiphasicapps/classfile/MemberName.java to modules/tool-classfile/src/main/java/net/multiphasicapps/classfile/MemberName.java.

19
20
21
22
23
24
25
26
27
28
{
	/**
	 * Returns the identifier.
	 *
	 * @return The identifier.
	 * @since 2018/09/09
	 */
	public abstract String identifier();
}








|


19
20
21
22
23
24
25
26
27
28
{
	/**
	 * Returns the identifier.
	 *
	 * @return The identifier.
	 * @since 2018/09/09
	 */
	String identifier();
}

Name change from runt/libs/tool-classfile/net/multiphasicapps/classfile/MemberNameAndType.java to modules/tool-classfile/src/main/java/net/multiphasicapps/classfile/MemberNameAndType.java.

19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
{
	/**
	 * Returns the name of the member.
	 *
	 * @return The member name.
	 * @since 2018/09/09
	 */
	public abstract MemberName name();
	
	/**
	 * Returns the type of the member.
	 *
	 * @return The member type.
	 * @since 2018/09/09
	 */
	public abstract MemberDescriptor type();
}








|







|


19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
{
	/**
	 * Returns the name of the member.
	 *
	 * @return The member name.
	 * @since 2018/09/09
	 */
	MemberName name();
	
	/**
	 * Returns the type of the member.
	 *
	 * @return The member type.
	 * @since 2018/09/09
	 */
	MemberDescriptor type();
}

Name change from runt/libs/tool-classfile/net/multiphasicapps/classfile/MemberReference.java to modules/tool-classfile/src/main/java/net/multiphasicapps/classfile/MemberReference.java.

Name change from runt/libs/tool-classfile/net/multiphasicapps/classfile/Method.java to modules/tool-classfile/src/main/java/net/multiphasicapps/classfile/Method.java.

14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import dev.shadowtail.classfile.nncc.NearNativeByteCodeHandler;
import dev.shadowtail.classfile.xlate.ByteCodeProcessor;
import java.io.DataInputStream;
import java.io.IOException;
import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
import net.multiphasicapps.collections.UnmodifiableArrayList;

/**
 * This represents a method which is used to execute byte code.
 *
 * @since 2017/09/30
 */
public final class Method







<
<

<







14
15
16
17
18
19
20


21

22
23
24
25
26
27
28
import dev.shadowtail.classfile.nncc.NearNativeByteCodeHandler;
import dev.shadowtail.classfile.xlate.ByteCodeProcessor;
import java.io.DataInputStream;
import java.io.IOException;
import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import java.util.HashSet;


import java.util.Set;


/**
 * This represents a method which is used to execute byte code.
 *
 * @since 2017/09/30
 */
public final class Method
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
			
			// {@squirreljme.error JC3g The specified method does not have
			// the correct matching for abstract and if code exists or not.
			// (The current
			// class; The method name; The method type; The method flags)}
			if ((code == null) != (flags.isAbstract() | flags.isNative()))
				throw new InvalidClassFormatException(String.format(
					"JC3g %s %s %s", __tn, name, type, flags));
			
			// Create
			rv[i] = new Method(__ver, __cf, __tn, __pool, flags, name, type,
				code, annotations);
		}
		
		// All done!
		return rv;
	}
}








|











366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
			
			// {@squirreljme.error JC3g The specified method does not have
			// the correct matching for abstract and if code exists or not.
			// (The current
			// class; The method name; The method type; The method flags)}
			if ((code == null) != (flags.isAbstract() | flags.isNative()))
				throw new InvalidClassFormatException(String.format(
					"JC3g %s %s %s %s", __tn, name, type, flags));
			
			// Create
			rv[i] = new Method(__ver, __cf, __tn, __pool, flags, name, type,
				code, annotations);
		}
		
		// All done!
		return rv;
	}
}

Name change from runt/libs/tool-classfile/net/multiphasicapps/classfile/MethodDescriptor.java to modules/tool-classfile/src/main/java/net/multiphasicapps/classfile/MethodDescriptor.java.

248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
	 * 
	 * @return The descriptor as it appears on the Java Stack.
	 * @since 2017/09/16
	 */
	public JavaType[] javaStack()
	{
		// Handle all arguments now
		int n = argumentCount();
		List<JavaType> rv = new ArrayList<>(n * 2);
		for (int i = 0; i < n; i++)
		{
			FieldDescriptor a;
			JavaType j;
			rv.add(j = new JavaType(a = argument(i)));
			
			// Add top of long/double but with unique distinct types
			if (j.isWide())
				rv.add(j.topType());
		}
		
		return rv.<JavaType>toArray(new JavaType[rv.size()]);







|





|







248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
	 * 
	 * @return The descriptor as it appears on the Java Stack.
	 * @since 2017/09/16
	 */
	public JavaType[] javaStack()
	{
		// Handle all arguments now
		int n = this.argumentCount();
		List<JavaType> rv = new ArrayList<>(n * 2);
		for (int i = 0; i < n; i++)
		{
			FieldDescriptor a;
			JavaType j;
			rv.add(j = new JavaType(a = this.argument(i)));
			
			// Add top of long/double but with unique distinct types
			if (j.isWide())
				rv.add(j.topType());
		}
		
		return rv.<JavaType>toArray(new JavaType[rv.size()]);

Name change from runt/libs/tool-classfile/net/multiphasicapps/classfile/MethodFlag.java to modules/tool-classfile/src/main/java/net/multiphasicapps/classfile/MethodFlag.java.

Name change from runt/libs/tool-classfile/net/multiphasicapps/classfile/MethodFlags.java to modules/tool-classfile/src/main/java/net/multiphasicapps/classfile/MethodFlags.java.

30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
			Flags.<MethodFlag>__decode(__i, MethodFlag.values()));
	}
	
	/**
	 * Initializes the method flags.
	 *
	 * @param __oc The outer class.
	 * @param __nm The name of the method.
	 * @param __fl The method flags.
	 * @since 2016/04/23
	 */
	public MethodFlags(ClassFlags __oc, MethodName __mn, MethodFlag... __fl)
	{
		super(MethodFlag.class, __fl);
		
		__checkFlags(__oc, __mn);
	}
	
	/**
	 * Initializes the method flags.
	 *
	 * @param __oc The outer class.
	 * @param __nm The name of the method.
	 * @param __fl The method flags.
	 * @since 2016/04/23
	 */
	public MethodFlags(ClassFlags __oc, MethodName __mn,
		Iterable<MethodFlag> __fl)
	{
		super(MethodFlag.class, __fl);
		
		__checkFlags(__oc, __mn);
	}
	
	/**
	 * Decodes method flags from the bit field.
	 *
	 * @param __oc The outer class flags.
	 * @param __nm The name of the method.
	 * @param __i The bitfield to decode.
	 * @since 2017/07/07
	 */
	public MethodFlags(ClassFlags __oc, MethodName __mn, int __i)
	{
		this(__oc, __mn, Flags.<MethodFlag>__decode(__i, MethodFlag.values()));
	}
	
	/**
	 * Returns {@code true} if this is abstract.
	 *
	 * @return {@code true} if abstract.
	 * @since 2016/03/20
	 */
	public boolean isAbstract()
	{
		return contains(MethodFlag.ABSTRACT);
	}
	
	/**
	 * Returns {@code true} if this is a bridge method.
	 *
	 * @return {@code true} if a bridge method.
	 * @since 2016/03/20
	 */
	public boolean isBridge()
	{
		return contains(MethodFlag.BRIDGE);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/03/20
	 */
	@Override
	public boolean isFinal()
	{
		return contains(MethodFlag.FINAL);
	}
	
	/**
	 * Returns {@code true} if this is a native method.
	 *
	 * @return {@code true} if it is native.
	 * @since 2016/03/20
	 */
	public boolean isNative()
	{
		return contains(MethodFlag.NATIVE);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/03/20
	 */
	@Override
	public boolean isPrivate()
	{
		return contains(MethodFlag.PRIVATE);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/03/20
	 */
	@Override
	public boolean isProtected()
	{
		return contains(MethodFlag.PROTECTED);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/03/20
	 */
	@Override
	public boolean isPublic()
	{
		return contains(MethodFlag.PUBLIC);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/03/20
	 */
	@Override
	public boolean isStatic()
	{
		return contains(MethodFlag.STATIC);
	}
	
	/**
	 * Returns {@code true} if this is strict.
	 *
	 * @return {@code true} if strict.
	 * @since 2016/03/20
	 */
	public boolean isStrict()
	{
		return contains(MethodFlag.STRICT);
	}
	
	/**
	 * Returns {@code true} if this is synchronized.
	 *
	 * @return {@code true} if synchronized.
	 * @since 2016/03/20
	 */
	public boolean isSynchronized()
	{
		return contains(MethodFlag.SYNCHRONIZED);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/03/20
	 */
	@Override
	public boolean isSynthetic()
	{
		return contains(MethodFlag.SYNTHETIC);
	}
	
	/**
	 * Returns {@code true} if this uses variable arguments.
	 *
	 * @return {@code true} if it uses variable arguments.
	 * @since 2016/03/20
	 */
	public boolean isVarArgs()
	{
		return contains(MethodFlag.VARARGS);
	}
	
	/**
	 * Checks that the given flags are valid.
	 *
	 * @param __oc The outer class.
	 * @param __mn The name of the method.







|







|






|








|






|
















|










|









|










|









|









|









|









|










|










|









|










|







30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
			Flags.<MethodFlag>__decode(__i, MethodFlag.values()));
	}
	
	/**
	 * Initializes the method flags.
	 *
	 * @param __oc The outer class.
	 * @param __mn The name of the method.
	 * @param __fl The method flags.
	 * @since 2016/04/23
	 */
	public MethodFlags(ClassFlags __oc, MethodName __mn, MethodFlag... __fl)
	{
		super(MethodFlag.class, __fl);
		
		this.__checkFlags(__oc, __mn);
	}
	
	/**
	 * Initializes the method flags.
	 *
	 * @param __oc The outer class.
	 * @param __mn The name of the method.
	 * @param __fl The method flags.
	 * @since 2016/04/23
	 */
	public MethodFlags(ClassFlags __oc, MethodName __mn,
		Iterable<MethodFlag> __fl)
	{
		super(MethodFlag.class, __fl);
		
		this.__checkFlags(__oc, __mn);
	}
	
	/**
	 * Decodes method flags from the bit field.
	 *
	 * @param __oc The outer class flags.
	 * @param __mn The name of the method.
	 * @param __i The bitfield to decode.
	 * @since 2017/07/07
	 */
	public MethodFlags(ClassFlags __oc, MethodName __mn, int __i)
	{
		this(__oc, __mn, Flags.<MethodFlag>__decode(__i, MethodFlag.values()));
	}
	
	/**
	 * Returns {@code true} if this is abstract.
	 *
	 * @return {@code true} if abstract.
	 * @since 2016/03/20
	 */
	public boolean isAbstract()
	{
		return this.contains(MethodFlag.ABSTRACT);
	}
	
	/**
	 * Returns {@code true} if this is a bridge method.
	 *
	 * @return {@code true} if a bridge method.
	 * @since 2016/03/20
	 */
	public boolean isBridge()
	{
		return this.contains(MethodFlag.BRIDGE);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/03/20
	 */
	@Override
	public boolean isFinal()
	{
		return this.contains(MethodFlag.FINAL);
	}
	
	/**
	 * Returns {@code true} if this is a native method.
	 *
	 * @return {@code true} if it is native.
	 * @since 2016/03/20
	 */
	public boolean isNative()
	{
		return this.contains(MethodFlag.NATIVE);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/03/20
	 */
	@Override
	public boolean isPrivate()
	{
		return this.contains(MethodFlag.PRIVATE);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/03/20
	 */
	@Override
	public boolean isProtected()
	{
		return this.contains(MethodFlag.PROTECTED);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/03/20
	 */
	@Override
	public boolean isPublic()
	{
		return this.contains(MethodFlag.PUBLIC);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/03/20
	 */
	@Override
	public boolean isStatic()
	{
		return this.contains(MethodFlag.STATIC);
	}
	
	/**
	 * Returns {@code true} if this is strict.
	 *
	 * @return {@code true} if strict.
	 * @since 2016/03/20
	 */
	public boolean isStrict()
	{
		return this.contains(MethodFlag.STRICT);
	}
	
	/**
	 * Returns {@code true} if this is synchronized.
	 *
	 * @return {@code true} if synchronized.
	 * @since 2016/03/20
	 */
	public boolean isSynchronized()
	{
		return this.contains(MethodFlag.SYNCHRONIZED);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/03/20
	 */
	@Override
	public boolean isSynthetic()
	{
		return this.contains(MethodFlag.SYNTHETIC);
	}
	
	/**
	 * Returns {@code true} if this uses variable arguments.
	 *
	 * @return {@code true} if it uses variable arguments.
	 * @since 2016/03/20
	 */
	public boolean isVarArgs()
	{
		return this.contains(MethodFlag.VARARGS);
	}
	
	/**
	 * Checks that the given flags are valid.
	 *
	 * @param __oc The outer class.
	 * @param __mn The name of the method.
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
		if (__oc == null || __mn == null)
			throw new NullPointerException("NARG");
		
		// {@squirreljme.error JC3l An {@code abstract} method cannot be
		// {@code private}, {@code static}, {@code final},
		// {@code synchronized}, {@code native}, or {@code strictfp}. (The
		// method flags)}
		if (isAbstract())
			if (isPrivate() || isStatic() || isFinal() || isSynchronized() ||
				isNative() || isStrict())
				throw new InvalidClassFormatException(
					String.format("JC3l %s", this));
		
		// If the class is an interface it cannot have specific flags set
		// Ignore checking these interface flags if we are in an interface and
		// this is a static constructor because otherwise the check will fail
		// since there cannot be static items
		if (__oc.isInterface() && !__mn.isStaticInitializer())
			for (MethodFlag f : MethodFlag.values())
			{
				// Must have these
				boolean must = (f == MethodFlag.PUBLIC ||
					f == MethodFlag.ABSTRACT);
				
				// Could have these
				boolean maybe = (f == MethodFlag.SYNTHETIC ||
					f == MethodFlag.VARARGS || f == MethodFlag.BRIDGE);
				
				// Is it set?
				boolean has = contains(f);
				
				// {@squirreljme.error JC3m Flags for interface method has an
				// incorrect set of flags. (The method flags)}
				if (must != has && !maybe)
					throw new InvalidClassFormatException(
						String.format("JC3m %s", this));
			}
	}
}








|
|
|



















|










216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
		if (__oc == null || __mn == null)
			throw new NullPointerException("NARG");
		
		// {@squirreljme.error JC3l An {@code abstract} method cannot be
		// {@code private}, {@code static}, {@code final},
		// {@code synchronized}, {@code native}, or {@code strictfp}. (The
		// method flags)}
		if (this.isAbstract())
			if (this.isPrivate() || this.isStatic() || this.isFinal() || this
				.isSynchronized() || this.isNative() || this.isStrict())
				throw new InvalidClassFormatException(
					String.format("JC3l %s", this));
		
		// If the class is an interface it cannot have specific flags set
		// Ignore checking these interface flags if we are in an interface and
		// this is a static constructor because otherwise the check will fail
		// since there cannot be static items
		if (__oc.isInterface() && !__mn.isStaticInitializer())
			for (MethodFlag f : MethodFlag.values())
			{
				// Must have these
				boolean must = (f == MethodFlag.PUBLIC ||
					f == MethodFlag.ABSTRACT);
				
				// Could have these
				boolean maybe = (f == MethodFlag.SYNTHETIC ||
					f == MethodFlag.VARARGS || f == MethodFlag.BRIDGE);
				
				// Is it set?
				boolean has = this.contains(f);
				
				// {@squirreljme.error JC3m Flags for interface method has an
				// incorrect set of flags. (The method flags)}
				if (must != has && !maybe)
					throw new InvalidClassFormatException(
						String.format("JC3m %s", this));
			}
	}
}

Name change from runt/libs/tool-classfile/net/multiphasicapps/classfile/MethodHandle.java to modules/tool-classfile/src/main/java/net/multiphasicapps/classfile/MethodHandle.java.

Name change from runt/libs/tool-classfile/net/multiphasicapps/classfile/MethodName.java to modules/tool-classfile/src/main/java/net/multiphasicapps/classfile/MethodName.java.

71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
	 * Is this any initializer for a method.
	 *
	 * @return If this is any initializer method.
	 * @since 2017/10/12
	 */
	public boolean isAnyInitializer()
	{
		return isInstanceInitializer() || isStaticInitializer();
	}
	
	/**
	 * Returns {@code true} if this represents the instance initializer.
	 *
	 * @return {@code true} if this is the instance initializer.
	 * @since 2017/07/28







|







71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
	 * Is this any initializer for a method.
	 *
	 * @return If this is any initializer method.
	 * @since 2017/10/12
	 */
	public boolean isAnyInitializer()
	{
		return this.isInstanceInitializer() || this.isStaticInitializer();
	}
	
	/**
	 * Returns {@code true} if this represents the instance initializer.
	 *
	 * @return {@code true} if this is the instance initializer.
	 * @since 2017/07/28

Name change from runt/libs/tool-classfile/net/multiphasicapps/classfile/MethodNameAndType.java to modules/tool-classfile/src/main/java/net/multiphasicapps/classfile/MethodNameAndType.java.

Name change from runt/libs/tool-classfile/net/multiphasicapps/classfile/MethodReference.java to modules/tool-classfile/src/main/java/net/multiphasicapps/classfile/MethodReference.java.

Name change from runt/libs/tool-classfile/net/multiphasicapps/classfile/NameAndType.java to modules/tool-classfile/src/main/java/net/multiphasicapps/classfile/NameAndType.java.

Name change from runt/libs/tool-classfile/net/multiphasicapps/classfile/Pool.java to modules/tool-classfile/src/main/java/net/multiphasicapps/classfile/Pool.java.

9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// ---------------------------------------------------------------------------

package net.multiphasicapps.classfile;

import java.io.DataInputStream;
import java.io.IOException;
import java.io.UTFDataFormatException;
import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.Deque;

/**
 * This class decodes the constant pool and provides generic access to the
 * contents of it.
 *
 * @since 2017/06/08
 */







<

<







9
10
11
12
13
14
15

16

17
18
19
20
21
22
23
// ---------------------------------------------------------------------------

package net.multiphasicapps.classfile;

import java.io.DataInputStream;
import java.io.IOException;
import java.io.UTFDataFormatException;

import java.util.Arrays;


/**
 * This class decodes the constant pool and provides generic access to the
 * contents of it.
 *
 * @since 2017/06/08
 */
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
			{
					// UTF-8 String
					// The string is wrapped in a wrapper class so that String
					// constants are actual String references. It is illegal for
					// UTF-8 constants to be directly used by the byte code so
					// this prevents their usage from occuring by causing a
					// class cast exception
				case TAG_UTF8:
					try
					{
						data = new UTFConstantEntry(__in.readUTF());
					}
					
					// {@squirreljme.error JC3r Modified UTF-8 data is not in
					// the correct format.}
					catch (UTFDataFormatException e)
					{
						throw new InvalidClassFormatException("JC3r", e);
					}
					break;
					
					// Reference to two entries
				case TAG_FIELDREF:
				case TAG_METHODREF:
				case TAG_INTERFACEMETHODREF:
				case TAG_NAMEANDTYPE:
					data = new int[]{__in.readUnsignedShort(),
						__in.readUnsignedShort()};
					break;
					
					// References to single entry
				case TAG_CLASS:
				case TAG_STRING:
					data = new int[]{__in.readUnsignedShort()};
					break;
					
					// Integer
				case TAG_INTEGER:
					data = new ConstantValueInteger(
						Integer.valueOf(__in.readInt()));
					break;
					
					// Long
				case TAG_LONG:
					data = new ConstantValueLong(
						Long.valueOf(__in.readLong()));
					break;
					
					// Float
				case TAG_FLOAT:
					data = new ConstantValueFloat(
						Float.valueOf(__in.readFloat()));
					break;
					
					// Double
				case TAG_DOUBLE:
					data = new ConstantValueDouble(
						Double.valueOf(__in.readDouble()));
					break;
					
					// {@squirreljme.error JC3s Java ME does not support
					// dynamic invocation (such as method handles or lambda
					// expressions).}
				case TAG_METHODHANDLE:
				case TAG_METHODTYPE:
				case TAG_INVOKEDYNAMIC:
					throw new InvalidClassFormatException("JC3s");
				
					// {@squirreljme.error JC3t Unknown tag type in the
					// constant pool. (The constant pool tag)}
				default:
					throw new InvalidClassFormatException(
						String.format("JC3t %d", tag));
			}
			rawdata[i] = data;
			
			// Skip long/double?
			if (tag == TAG_LONG || tag == TAG_DOUBLE)
			{
				rawdata[++i] = new WideConstantTopEntry();
				tags[i] = TAG_WIDETOP;
			}
		}
		
		// Go through tags again and initialize their raw data into type-safe
		// classes 
		Object[] entries = new Object[count];
		try
		{
			__initializeEntries(entries, tags, rawdata);
		}
		
		// {@squirreljme.error JC3u The constant pool is not valid.}
		catch (ClassCastException|IndexOutOfBoundsException|
			NullPointerException e)
		{
			throw new InvalidClassFormatException("JC3u", e);







|














|
|
|
|





|
|




|





|





|





|







|
|
|











|


|








|







197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
			{
					// UTF-8 String
					// The string is wrapped in a wrapper class so that String
					// constants are actual String references. It is illegal for
					// UTF-8 constants to be directly used by the byte code so
					// this prevents their usage from occuring by causing a
					// class cast exception
				case Pool.TAG_UTF8:
					try
					{
						data = new UTFConstantEntry(__in.readUTF());
					}
					
					// {@squirreljme.error JC3r Modified UTF-8 data is not in
					// the correct format.}
					catch (UTFDataFormatException e)
					{
						throw new InvalidClassFormatException("JC3r", e);
					}
					break;
					
					// Reference to two entries
				case Pool.TAG_FIELDREF:
				case Pool.TAG_METHODREF:
				case Pool.TAG_INTERFACEMETHODREF:
				case Pool.TAG_NAMEANDTYPE:
					data = new int[]{__in.readUnsignedShort(),
						__in.readUnsignedShort()};
					break;
					
					// References to single entry
				case Pool.TAG_CLASS:
				case Pool.TAG_STRING:
					data = new int[]{__in.readUnsignedShort()};
					break;
					
					// Integer
				case Pool.TAG_INTEGER:
					data = new ConstantValueInteger(
						Integer.valueOf(__in.readInt()));
					break;
					
					// Long
				case Pool.TAG_LONG:
					data = new ConstantValueLong(
						Long.valueOf(__in.readLong()));
					break;
					
					// Float
				case Pool.TAG_FLOAT:
					data = new ConstantValueFloat(
						Float.valueOf(__in.readFloat()));
					break;
					
					// Double
				case Pool.TAG_DOUBLE:
					data = new ConstantValueDouble(
						Double.valueOf(__in.readDouble()));
					break;
					
					// {@squirreljme.error JC3s Java ME does not support
					// dynamic invocation (such as method handles or lambda
					// expressions).}
				case Pool.TAG_METHODHANDLE:
				case Pool.TAG_METHODTYPE:
				case Pool.TAG_INVOKEDYNAMIC:
					throw new InvalidClassFormatException("JC3s");
				
					// {@squirreljme.error JC3t Unknown tag type in the
					// constant pool. (The constant pool tag)}
				default:
					throw new InvalidClassFormatException(
						String.format("JC3t %d", tag));
			}
			rawdata[i] = data;
			
			// Skip long/double?
			if (tag == Pool.TAG_LONG || tag == Pool.TAG_DOUBLE)
			{
				rawdata[++i] = new WideConstantTopEntry();
				tags[i] = Pool.TAG_WIDETOP;
			}
		}
		
		// Go through tags again and initialize their raw data into type-safe
		// classes 
		Object[] entries = new Object[count];
		try
		{
			Pool.__initializeEntries(entries, tags, rawdata);
		}
		
		// {@squirreljme.error JC3u The constant pool is not valid.}
		catch (ClassCastException|IndexOutOfBoundsException|
			NullPointerException e)
		{
			throw new InvalidClassFormatException("JC3u", e);
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
			int tag = __tags[i],
				sequence;
			
			// Determine the sequence based on the tag
			switch (tag)
			{
				case 0:
				case TAG_UTF8:
				case TAG_INTEGER:
				case TAG_FLOAT:
				case TAG_LONG:
				case TAG_DOUBLE:
				case TAG_WIDETOP:
					sequence = 0;
					break;
				
				case TAG_CLASS:
				case TAG_STRING:
					sequence = 1;
					break;
				
				case TAG_NAMEANDTYPE:
					sequence = 2;
					break;
				
				case TAG_FIELDREF:
				case TAG_METHODREF:
				case TAG_INTERFACEMETHODREF:
					sequence = 3;
					break;
					
				default:
					throw new todo.OOPS();
			}
			







|
|
|
|
|
|



|
|



|



|
|
|







327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
			int tag = __tags[i],
				sequence;
			
			// Determine the sequence based on the tag
			switch (tag)
			{
				case 0:
				case Pool.TAG_UTF8:
				case Pool.TAG_INTEGER:
				case Pool.TAG_FLOAT:
				case Pool.TAG_LONG:
				case Pool.TAG_DOUBLE:
				case Pool.TAG_WIDETOP:
					sequence = 0;
					break;
				
				case Pool.TAG_CLASS:
				case Pool.TAG_STRING:
					sequence = 1;
					break;
				
				case Pool.TAG_NAMEANDTYPE:
					sequence = 2;
					break;
				
				case Pool.TAG_FIELDREF:
				case Pool.TAG_METHODREF:
				case Pool.TAG_INTERFACEMETHODREF:
					sequence = 3;
					break;
					
				default:
					throw new todo.OOPS();
			}
			
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
			// Process tags
			Object in = __rawdata[i],
				out;
			switch (tag)
			{
					// These are copied directly
				case 0:
				case TAG_UTF8:
				case TAG_INTEGER:
				case TAG_FLOAT:
				case TAG_LONG:
				case TAG_DOUBLE:
				case TAG_WIDETOP:
					out = in;
					break;
					
					// Name of a class
				case TAG_CLASS:
					out = new ClassName(((UTFConstantEntry)
						__entries[((int[])in)[0]]).toString());
					break;
					
					// String constant
				case TAG_STRING:
					out = new ConstantValueString(
						((UTFConstantEntry)__entries[((int[])in)[0]]).
							toString());
					break;
					
					// Name and type information
				case TAG_NAMEANDTYPE:
					{
						int[] ina = (int[])in;
						out = new NameAndType(
							((UTFConstantEntry)__entries[ina[0]]).toString(),
							((UTFConstantEntry)__entries[ina[1]]).toString());
					}
					break;
					
					// Field and method references
				case TAG_FIELDREF:
				case TAG_METHODREF:
				case TAG_INTERFACEMETHODREF:
					{
						int[] ina = (int[])in;
						ClassName cn = (ClassName)__entries[ina[0]];
						NameAndType nat = (NameAndType)__entries[ina[1]];
						
						if (tag == TAG_FIELDREF)
							out = new FieldReference(cn,
								new FieldName(nat.name()),
								new FieldDescriptor(nat.type()));
						else
							out = new MethodReference(cn,
								new MethodName(nat.name()),
								new MethodDescriptor(nat.type()),
								tag == TAG_INTERFACEMETHODREF);
					}
					break;
				
					// Unhandled, should not happen
				default:
					throw new RuntimeException(String.format("OOPS %d", tag));
			}
			
			__entries[i] = out;
		}
	}
}








|
|
|
|
|
|




|





|






|









|
|
|





|







|













374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
			// Process tags
			Object in = __rawdata[i],
				out;
			switch (tag)
			{
					// These are copied directly
				case 0:
				case Pool.TAG_UTF8:
				case Pool.TAG_INTEGER:
				case Pool.TAG_FLOAT:
				case Pool.TAG_LONG:
				case Pool.TAG_DOUBLE:
				case Pool.TAG_WIDETOP:
					out = in;
					break;
					
					// Name of a class
				case Pool.TAG_CLASS:
					out = new ClassName(((UTFConstantEntry)
						__entries[((int[])in)[0]]).toString());
					break;
					
					// String constant
				case Pool.TAG_STRING:
					out = new ConstantValueString(
						((UTFConstantEntry)__entries[((int[])in)[0]]).
							toString());
					break;
					
					// Name and type information
				case Pool.TAG_NAMEANDTYPE:
					{
						int[] ina = (int[])in;
						out = new NameAndType(
							((UTFConstantEntry)__entries[ina[0]]).toString(),
							((UTFConstantEntry)__entries[ina[1]]).toString());
					}
					break;
					
					// Field and method references
				case Pool.TAG_FIELDREF:
				case Pool.TAG_METHODREF:
				case Pool.TAG_INTERFACEMETHODREF:
					{
						int[] ina = (int[])in;
						ClassName cn = (ClassName)__entries[ina[0]];
						NameAndType nat = (NameAndType)__entries[ina[1]];
						
						if (tag == Pool.TAG_FIELDREF)
							out = new FieldReference(cn,
								new FieldName(nat.name()),
								new FieldDescriptor(nat.type()));
						else
							out = new MethodReference(cn,
								new MethodName(nat.name()),
								new MethodDescriptor(nat.type()),
								tag == Pool.TAG_INTERFACEMETHODREF);
					}
					break;
				
					// Unhandled, should not happen
				default:
					throw new RuntimeException(String.format("OOPS %d", tag));
			}
			
			__entries[i] = out;
		}
	}
}

Name change from runt/libs/tool-classfile/net/multiphasicapps/classfile/PrimitiveType.java to modules/tool-classfile/src/main/java/net/multiphasicapps/classfile/PrimitiveType.java.

71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
	 * Is this a wide type?
	 *
	 * @return If this is a wide type.
	 * @since 2017/10/16
	 */
	public final boolean isWide()
	{
		return this == LONG || this == DOUBLE;
	}
	
	/**
	 * Does this type promote to int?
	 *
	 * @return If this type promotes to int.
	 * @since 2017/10/16







|







71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
	 * Is this a wide type?
	 *
	 * @return If this is a wide type.
	 * @since 2017/10/16
	 */
	public final boolean isWide()
	{
		return this == PrimitiveType.LONG || this == PrimitiveType.DOUBLE;
	}
	
	/**
	 * Does this type promote to int?
	 *
	 * @return If this type promotes to int.
	 * @since 2017/10/16

Name change from runt/libs/tool-classfile/net/multiphasicapps/classfile/SimpleStorageType.java to modules/tool-classfile/src/main/java/net/multiphasicapps/classfile/SimpleStorageType.java.

Name change from runt/libs/tool-classfile/net/multiphasicapps/classfile/StackMapTable.java to modules/tool-classfile/src/main/java/net/multiphasicapps/classfile/StackMapTable.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.classfile;

import java.io.ByteArrayInputStream;
import java.io.DataInputStream;
import java.io.IOException;
import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import java.util.Iterator;
import java.util.Map;
import net.multiphasicapps.collections.SortedTreeMap;
import net.multiphasicapps.collections.UnmodifiableIterator;
import net.multiphasicapps.collections.UnmodifiableMap;












<
<
<







1
2
3
4
5
6
7
8
9
10
11
12



13
14
15
16
17
18
19
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.classfile;




import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import java.util.Iterator;
import java.util.Map;
import net.multiphasicapps.collections.SortedTreeMap;
import net.multiphasicapps.collections.UnmodifiableIterator;
import net.multiphasicapps.collections.UnmodifiableMap;

Name change from runt/libs/tool-classfile/net/multiphasicapps/classfile/StackMapTableEntry.java to modules/tool-classfile/src/main/java/net/multiphasicapps/classfile/StackMapTableEntry.java.

Name change from runt/libs/tool-classfile/net/multiphasicapps/classfile/StackMapTableState.java to modules/tool-classfile/src/main/java/net/multiphasicapps/classfile/StackMapTableState.java.

65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
		__s = __s.clone();
		
		// Clear elements above the stack top
		for (int i = __d; i < ns; i++)
			__s[i] = null;
		
		// Verify each state
		__verify(__l);
		__verify(__s);
		
		// Set
		this._locals = __l;
		this._stack = __s;
		this.depth = __d;
	}
	







|
|







65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
		__s = __s.clone();
		
		// Clear elements above the stack top
		for (int i = __d; i < ns; i++)
			__s[i] = null;
		
		// Verify each state
		StackMapTableState.__verify(__l);
		StackMapTableState.__verify(__s);
		
		// Set
		this._locals = __l;
		this._stack = __s;
		this.depth = __d;
	}
	
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
		Reference<String> ref = this._string;
		String rv;
		
		// Cache?
		if (ref == null || null == (rv = ref.get()))
		{
			StringBuilder sb = new StringBuilder("{locals=");
			__stringize(this._locals, sb);
			sb.append(", stack(");
			sb.append(this.depth);
			sb.append(")=");
			__stringize(this._stack, sb);
			sb.append("}");
			
			this._string = new WeakReference<>((rv = sb.toString()));
		}
		
		return rv;
	}







|



|







160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
		Reference<String> ref = this._string;
		String rv;
		
		// Cache?
		if (ref == null || null == (rv = ref.get()))
		{
			StringBuilder sb = new StringBuilder("{locals=");
			StackMapTableState.__stringize(this._locals, sb);
			sb.append(", stack(");
			sb.append(this.depth);
			sb.append(")=");
			StackMapTableState.__stringize(this._stack, sb);
			sb.append("}");
			
			this._string = new WeakReference<>((rv = sb.toString()));
		}
		
		return rv;
	}

Name change from runt/libs/tool-classfile/net/multiphasicapps/classfile/TableSwitch.java to modules/tool-classfile/src/main/java/net/multiphasicapps/classfile/TableSwitch.java.

Name change from runt/libs/tool-classfile/net/multiphasicapps/classfile/UTFConstantEntry.java to modules/tool-classfile/src/main/java/net/multiphasicapps/classfile/UTFConstantEntry.java.

Name change from runt/libs/tool-classfile/net/multiphasicapps/classfile/WideConstantTopEntry.java to modules/tool-classfile/src/main/java/net/multiphasicapps/classfile/WideConstantTopEntry.java.

Name change from runt/libs/tool-classfile/net/multiphasicapps/classfile/__StackMapParser__.java to modules/tool-classfile/src/main/java/net/multiphasicapps/classfile/__StackMapParser__.java.

9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// ---------------------------------------------------------------------------

package net.multiphasicapps.classfile;

import java.io.ByteArrayInputStream;
import java.io.DataInputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

/**
 * This class is used to parse the stack map and initialize the initial
 * snapshot states for jump targets within the method.
 *
 * @since 2017/04/16







<
<

<







9
10
11
12
13
14
15


16

17
18
19
20
21
22
23
// ---------------------------------------------------------------------------

package net.multiphasicapps.classfile;

import java.io.ByteArrayInputStream;
import java.io.DataInputStream;
import java.io.IOException;


import java.util.LinkedHashMap;

import java.util.Map;

/**
 * This class is used to parse the stack map and initialize the initial
 * snapshot states for jump targets within the method.
 *
 * @since 2017/04/16
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
				nextlocals[i] = StackMapTableEntry.NOTHING;
		
		// Where states go
		Map<Integer, StackMapTableState> targets = new LinkedHashMap<>();
		this._targets = targets;
		
		// Record state
		__next(0, true, -1, -1);
		
		// Parse the stack map table
		try (DataInputStream in = xin)
		{
			// Parsing the class stack map table
			if (!__new)
			{
				// Read the number of entries in the table
				int ne = xin.readUnsignedShort();
			
				// All entries in the table are full frames
				for (int i = 0; i < ne; i++)
					__next(__oldStyle(), true, -1, i);
			}
		
			// The modern stack map table
			else
			{
				// Read the number of entries in the table
				int ne = xin.readUnsignedShort();
			
				// Read them all
				for (int i = 0; i < ne; i++)
				{
					// Read the frame type
					int type = xin.readUnsignedByte();
					int addr;
				
					// Full frame?
					if (type == 255)
						addr = __fullFrame();
				
					// Same frame?
					else if (type >= 0 && type <= 63)
						addr = __sameFrame(type);
				
					// Same locals but a single stack item
					else if (type >= 64 && type <= 127)
						addr = __sameLocalsSingleStack(type - 64);
				
					// Same locals, single stack item, explicit delta
					else if (type == 247)
						addr = __sameLocalsSingleStackExplicit();
				
					// Chopped frame
					else if (type >= 248 && type <= 250)
						addr = __choppedFrame(251 - type);
				
					// Same frame but with a supplied delta
					else if (type == 251)
						addr = __sameFrameDelta();
				
					// Appended frame
					else if (type >= 252 && type <= 254)
						addr = __appendFrame(type - 251);
				
					// {@squirreljme.error JC44 Unknown StackMapTable
					// verification type. (The verification type)}
					else
						throw new InvalidClassFormatException(
							String.format("JC44 %d", type));
					
					// Setup next
					__next(addr, false, type, i);
				}
			}
		}
		
		// {@squirreljme.error JC45 Failed to parse the stack map table.}
		catch (IOException e)
		{







|












|

















|



|



|



|



|



|



|








|







128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
				nextlocals[i] = StackMapTableEntry.NOTHING;
		
		// Where states go
		Map<Integer, StackMapTableState> targets = new LinkedHashMap<>();
		this._targets = targets;
		
		// Record state
		this.__next(0, true, -1, -1);
		
		// Parse the stack map table
		try (DataInputStream in = xin)
		{
			// Parsing the class stack map table
			if (!__new)
			{
				// Read the number of entries in the table
				int ne = xin.readUnsignedShort();
			
				// All entries in the table are full frames
				for (int i = 0; i < ne; i++)
					this.__next(this.__oldStyle(), true, -1, i);
			}
		
			// The modern stack map table
			else
			{
				// Read the number of entries in the table
				int ne = xin.readUnsignedShort();
			
				// Read them all
				for (int i = 0; i < ne; i++)
				{
					// Read the frame type
					int type = xin.readUnsignedByte();
					int addr;
				
					// Full frame?
					if (type == 255)
						addr = this.__fullFrame();
				
					// Same frame?
					else if (type >= 0 && type <= 63)
						addr = this.__sameFrame(type);
				
					// Same locals but a single stack item
					else if (type >= 64 && type <= 127)
						addr = this.__sameLocalsSingleStack(type - 64);
				
					// Same locals, single stack item, explicit delta
					else if (type == 247)
						addr = this.__sameLocalsSingleStackExplicit();
				
					// Chopped frame
					else if (type >= 248 && type <= 250)
						addr = this.__choppedFrame(251 - type);
				
					// Same frame but with a supplied delta
					else if (type == 251)
						addr = this.__sameFrameDelta();
				
					// Appended frame
					else if (type >= 252 && type <= 254)
						addr = this.__appendFrame(type - 251);
				
					// {@squirreljme.error JC44 Unknown StackMapTable
					// verification type. (The verification type)}
					else
						throw new InvalidClassFormatException(
							String.format("JC44 %d", type));
					
					// Setup next
					this.__next(addr, false, type, i);
				}
			}
		}
		
		// {@squirreljme.error JC45 Failed to parse the stack map table.}
		catch (IOException e)
		{
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
			
			// If it is not empty, ignore it
			if (!s.equals(StackMapTableEntry.NOTHING))
				continue;
			
			// Set it
			StackMapTableEntry aa;
			nextlocals[i] = (aa = __loadInfo());
			__addlocs--;
			
			// If a wide element was added, then the next one becomes TOP
			if (aa.isWide())
				nextlocals[++i] = aa.topType();
		}
		







|







247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
			
			// If it is not empty, ignore it
			if (!s.equals(StackMapTableEntry.NOTHING))
				continue;
			
			// Set it
			StackMapTableEntry aa;
			nextlocals[i] = (aa = this.__loadInfo());
			__addlocs--;
			
			// If a wide element was added, then the next one becomes TOP
			if (aa.isWide())
				nextlocals[++i] = aa.topType();
		}
		
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
			throw new InvalidClassFormatException(
				String.format("JC48 %d %d", nl, maxlocals));
		int i, o;
		StackMapTableEntry[] nextlocals = this._nextlocals;
		for (i = 0, o = 0; i < nl; i++)
		{
			StackMapTableEntry e;
			nextlocals[o++] = (e = __loadInfo());
			
			// Add top?
			if (e.isWide())
				nextlocals[o++] = e.topType();
		}
		for (;o < maxlocals; o++)
			nextlocals[o] = StackMapTableEntry.NOTHING;
		
		// Read in stack variables
		StackMapTableEntry[] nextstack = this._nextstack;
		int ns = in.readUnsignedShort();
		for (i = 0, o = 0; i < ns; i++)
		{
			StackMapTableEntry e;
			nextstack[o++] = (e = __loadInfo());
			
			// Add top?
			if (e.isWide())
				nextstack[o++] = e.topType();
		}
		this._stacktop = o;
		







|














|







346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
			throw new InvalidClassFormatException(
				String.format("JC48 %d %d", nl, maxlocals));
		int i, o;
		StackMapTableEntry[] nextlocals = this._nextlocals;
		for (i = 0, o = 0; i < nl; i++)
		{
			StackMapTableEntry e;
			nextlocals[o++] = (e = this.__loadInfo());
			
			// Add top?
			if (e.isWide())
				nextlocals[o++] = e.topType();
		}
		for (;o < maxlocals; o++)
			nextlocals[o] = StackMapTableEntry.NOTHING;
		
		// Read in stack variables
		StackMapTableEntry[] nextstack = this._nextstack;
		int ns = in.readUnsignedShort();
		for (i = 0, o = 0; i < ns; i++)
		{
			StackMapTableEntry e;
			nextstack[o++] = (e = this.__loadInfo());
			
			// Add top?
			if (e.isWide())
				nextstack[o++] = e.topType();
		}
		this._stacktop = o;
		
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
	 * @since 2016/03/26
	 */
	private int __sameLocalsSingleStack(int __delta)
		throws IOException
	{
		// Load single entry
		StackMapTableEntry ent;
		this._nextstack[0] = (ent = __loadInfo());
		
		// If the entry is wide then the top type will not be specified as it
		// will be implicit, so we need to set the according type
		if (ent.isWide())
		{
			this._nextstack[1] = ent.topType();
			this._stacktop = 2;







|







614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
	 * @since 2016/03/26
	 */
	private int __sameLocalsSingleStack(int __delta)
		throws IOException
	{
		// Load single entry
		StackMapTableEntry ent;
		this._nextstack[0] = (ent = this.__loadInfo());
		
		// If the entry is wide then the top type will not be specified as it
		// will be implicit, so we need to set the according type
		if (ent.isWide())
		{
			this._nextstack[1] = ent.topType();
			this._stacktop = 2;
645
646
647
648
649
650
651
652
653
654
655
	 * @return The address information.
	 * @throws IOException On read errors.
	 * @since 2016/03/26
	 */
	private int __sameLocalsSingleStackExplicit()
		throws IOException
	{
		return __sameLocalsSingleStack(this.in.readUnsignedShort());
	}
}








|



642
643
644
645
646
647
648
649
650
651
652
	 * @return The address information.
	 * @throws IOException On read errors.
	 * @since 2016/03/26
	 */
	private int __sameLocalsSingleStackExplicit()
		throws IOException
	{
		return this.__sameLocalsSingleStack(this.in.readUnsignedShort());
	}
}

Name change from runt/libs/tool-classfile/net/multiphasicapps/classfile/package-info.java to modules/tool-classfile/src/main/java/net/multiphasicapps/classfile/package-info.java.

Name change from runt/libs/tool-classfile.test/TestClassLoad.java to modules/tool-classfile/src/test/java/TestClassLoad.java.

Name change from runt/libs/tool-classfile.test/TestMinimizedLoad.java to modules/tool-classfile/src/test/java/TestMinimizedLoad.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

import dev.shadowtail.classfile.mini.MinimizedClassFile;
import dev.shadowtail.classfile.mini.Minimizer;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import net.multiphasicapps.classfile.ClassFile;
import net.multiphasicapps.tac.TestRunnable;

/**
 * Tests that minimizing is performed properly and loading minimized classes
 * works as well.










<

<







1
2
3
4
5
6
7
8
9
10

11

12
13
14
15
16
17
18
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------


import dev.shadowtail.classfile.mini.Minimizer;

import java.io.InputStream;
import net.multiphasicapps.classfile.ClassFile;
import net.multiphasicapps.tac.TestRunnable;

/**
 * Tests that minimizing is performed properly and loading minimized classes
 * works as well.

Name change from runt/libs/tool-classfile.test/TestMinimizer.java to modules/tool-classfile/src/test/java/TestMinimizer.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

import dev.shadowtail.classfile.mini.MinimizedClassFile;
import dev.shadowtail.classfile.mini.Minimizer;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import net.multiphasicapps.classfile.ClassFile;
import net.multiphasicapps.tac.TestRunnable;

/**










<







1
2
3
4
5
6
7
8
9
10

11
12
13
14
15
16
17
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------


import dev.shadowtail.classfile.mini.Minimizer;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import net.multiphasicapps.classfile.ClassFile;
import net.multiphasicapps.tac.TestRunnable;

/**

Name change from runt/libs/tool-classfile.test/ByteDeque.data.__mime to modules/tool-classfile/src/test/resources/ByteDeque.data.__mime.

Name change from runt/libs/tool-classfile.test/InflaterInputStream.data.__mime to modules/tool-classfile/src/test/resources/InflaterInputStream.data.__mime.

Name change from runt/libs/tool-classfile.test/TestClassLoad.in to modules/tool-classfile/src/test/resources/TestClassLoad.in.

Name change from runt/libs/tool-classfile.test/TestMinimizedLoad.in to modules/tool-classfile/src/test/resources/TestMinimizedLoad.in.

Name change from runt/libs/tool-classfile.test/TestMinimizer.in to modules/tool-classfile/src/test/resources/TestMinimizer.in.

Added modules/tool-jarfile/build.gradle.















































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import cc.squirreljme.plugin.swm.JavaMEMidletType

description = "This project takes input Jar files and " +
	"compiles/converts them into a format that is more easily used by " +
	"SummerCoat and RatufaCoat."
version = rootProject.version

squirreljme
{
	javaDocErrorCode = "BC"
	swmType = JavaMEMidletType.LIBRARY
	swmName = "Jar File Tools"
	swmVendor = "Stephanie Gawroriski"
}

dependencies
{
	implementation project(":modules:cldc-compact")

	implementation project(":modules:tool-classfile")
	implementation project(":modules:common-vm")
	implementation project(":modules:io")
}

Name change from runt/libs/tool-jarfile/dev/shadowtail/jarfile/BootstrapState.java to modules/tool-jarfile/src/main/java/dev/shadowtail/jarfile/BootstrapState.java.

342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
		// If it was loaded already, ignore
		Map<String, Integer> interns = this._interns;
		if (interns.containsKey(__s))
			return interns.get(__s);
		
		// Allocate string object
		LoadedClassInfo strci = this.findClass("java/lang/String");
		int strp = initializer.allocate(strci.allocationSize());
		
		// Cache it
		interns.put(__s, strp);
		
		// Setup class information
		initializer.memWriteInt(Modifier.RAM_OFFSET,
			strp + Constants.OBJECT_CLASS_OFFSET,
			strci.infoPointer());
		initializer.memWriteInt(
			strp + Constants.OBJECT_COUNT_OFFSET,
			999999);
		
		// Write pointer to character array data
		initializer.memWriteInt(Modifier.RAM_OFFSET,
			strp + strci.fieldInstanceOffset(
				new FieldName("_chars"),
				new FieldDescriptor("[C")),
			this.buildCharArray(__s.toCharArray()));
		
		// Use the string pointer
		return strp;







|





|


|




|







342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
		// If it was loaded already, ignore
		Map<String, Integer> interns = this._interns;
		if (interns.containsKey(__s))
			return interns.get(__s);
		
		// Allocate string object
		LoadedClassInfo strci = this.findClass("java/lang/String");
		int strp = this.initializer.allocate(strci.allocationSize());
		
		// Cache it
		interns.put(__s, strp);
		
		// Setup class information
		this.initializer.memWriteInt(Modifier.RAM_OFFSET,
			strp + Constants.OBJECT_CLASS_OFFSET,
			strci.infoPointer());
		this.initializer.memWriteInt(
			strp + Constants.OBJECT_COUNT_OFFSET,
			999999);
		
		// Write pointer to character array data
		this.initializer.memWriteInt(Modifier.RAM_OFFSET,
			strp + strci.fieldInstanceOffset(
				new FieldName("_chars"),
				new FieldDescriptor("[C")),
			this.buildCharArray(__s.toCharArray()));
		
		// Use the string pointer
		return strp;

Name change from runt/libs/tool-jarfile/dev/shadowtail/jarfile/ClassNameAndMinimizedField.java to modules/tool-jarfile/src/main/java/dev/shadowtail/jarfile/ClassNameAndMinimizedField.java.

Name change from runt/libs/tool-jarfile/dev/shadowtail/jarfile/ClassNameAndMinimizedMethod.java to modules/tool-jarfile/src/main/java/dev/shadowtail/jarfile/ClassNameAndMinimizedMethod.java.

Name change from runt/libs/tool-jarfile/dev/shadowtail/jarfile/Initializer.java to modules/tool-jarfile/src/main/java/dev/shadowtail/jarfile/Initializer.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package dev.shadowtail.jarfile;

import cc.squirreljme.jvm.Constants;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;












<







1
2
3
4
5
6
7
8
9
10
11

12
13
14
15
16
17
18
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package dev.shadowtail.jarfile;


import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
			__sz = 1;
		
		// Round allocation to 4-bytes
		__sz = (__sz + 3) & (~3);
		
		// Calculate the next size of the boot area
		int nowat = this._size,
			chunksize = __sz + CHUNK_LENGTH,
			nextat = nowat + chunksize;
		
		// If the memory space is too small, grow it
		byte[] bytes = this._bytes;
		if (nextat > bytes.length)
			this._bytes = (bytes = Arrays.copyOf(bytes, nextat + 2048));
		
		// The return address is after the chunk length
		int rv = nowat + CHUNK_LENGTH;
		
		// Record size of chunk and the next chunk position in RAM
		this.memWriteInt(null,
			nowat + CHUNK_SIZE_OFFSET, chunksize);
		this.memWriteInt(Modifier.RAM_OFFSET,
			nowat + CHUNK_NEXT_OFFSET, nextat);
		
		// Continue at the end
		this._size = nextat;
		return rv;
	}
	
	/**







|








|



|

|







65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
			__sz = 1;
		
		// Round allocation to 4-bytes
		__sz = (__sz + 3) & (~3);
		
		// Calculate the next size of the boot area
		int nowat = this._size,
			chunksize = __sz + Initializer.CHUNK_LENGTH,
			nextat = nowat + chunksize;
		
		// If the memory space is too small, grow it
		byte[] bytes = this._bytes;
		if (nextat > bytes.length)
			this._bytes = (bytes = Arrays.copyOf(bytes, nextat + 2048));
		
		// The return address is after the chunk length
		int rv = nowat + Initializer.CHUNK_LENGTH;
		
		// Record size of chunk and the next chunk position in RAM
		this.memWriteInt(null,
			nowat + Initializer.CHUNK_SIZE_OFFSET, chunksize);
		this.memWriteInt(Modifier.RAM_OFFSET,
			nowat + Initializer.CHUNK_NEXT_OFFSET, nextat);
		
		// Continue at the end
		this._size = nextat;
		return rv;
	}
	
	/**
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
		byte[] bytes = this._bytes;
		int size = this._size;
		
		// Round up to prevent uneven sizes
		size = (size + 3) & (~3);
		
		// Give extra bytes for the terminator chunk
		size += CHUNK_LENGTH;
		
		// Write initializer RAM
		try (ByteArrayOutputStream baos = new ByteArrayOutputStream(4096);
			DataOutputStream dos = new DataOutputStream(baos))
		{
			// Write initializer memory chunk
			dos.writeInt(size);







|







241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
		byte[] bytes = this._bytes;
		int size = this._size;
		
		// Round up to prevent uneven sizes
		size = (size + 3) & (~3);
		
		// Give extra bytes for the terminator chunk
		size += Initializer.CHUNK_LENGTH;
		
		// Write initializer RAM
		try (ByteArrayOutputStream baos = new ByteArrayOutputStream(4096);
			DataOutputStream dos = new DataOutputStream(baos))
		{
			// Write initializer memory chunk
			dos.writeInt(size);

Name change from runt/libs/tool-jarfile/dev/shadowtail/jarfile/JarMinimizer.java to modules/tool-jarfile/src/main/java/dev/shadowtail/jarfile/JarMinimizer.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package dev.shadowtail.jarfile;

import cc.squirreljme.jvm.ClassInfo;
import cc.squirreljme.jvm.Constants;
import cc.squirreljme.vm.VMClassLibrary;
import dev.shadowtail.classfile.mini.DualPoolEncoder;
import dev.shadowtail.classfile.mini.DualPoolEncodeResult;
import dev.shadowtail.classfile.mini.MinimizedClassFile;
import dev.shadowtail.classfile.mini.MinimizedField;
import dev.shadowtail.classfile.mini.MinimizedMethod;
import dev.shadowtail.classfile.mini.MinimizedPoolEntryType;
import dev.shadowtail.classfile.mini.Minimizer;
import dev.shadowtail.classfile.pool.AccessedField;
import dev.shadowtail.classfile.pool.ClassPool;
import dev.shadowtail.classfile.pool.DualClassRuntimePool;
import dev.shadowtail.classfile.pool.DualClassRuntimePoolBuilder;
import dev.shadowtail.classfile.pool.InvokedMethod;
import dev.shadowtail.classfile.pool.InvokeType;
import dev.shadowtail.classfile.pool.MethodIndex;
import dev.shadowtail.classfile.pool.UsedString;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.io.InputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Deque;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import net.multiphasicapps.classfile.FieldDescriptor;
import net.multiphasicapps.classfile.FieldName;
import net.multiphasicapps.classfile.ClassFile;
import net.multiphasicapps.classfile.ClassName;
import net.multiphasicapps.classfile.ClassNames;
import net.multiphasicapps.classfile.InvalidClassFormatException;
import net.multiphasicapps.classfile.MethodDescriptor;
import net.multiphasicapps.classfile.MethodName;
import net.multiphasicapps.classfile.MethodNameAndType;
import net.multiphasicapps.io.TableSectionOutputStream;

/**
 * This class is responsible for creating minimized Jar files which will then
 * be built into a ROM and used by SummerCoat and RatufaCoat.
 *
 * @since 2019/04/27











<
<

<

|
<
<
<

<
<
<

<
<
<
<


|

<

<
<

<
<
<
<
<
<
<


<
<
<

<







1
2
3
4
5
6
7
8
9
10
11


12

13
14



15



16




17
18
19
20

21


22







23
24



25

26
27
28
29
30
31
32
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package dev.shadowtail.jarfile;



import cc.squirreljme.vm.VMClassLibrary;

import dev.shadowtail.classfile.mini.DualPoolEncodeResult;
import dev.shadowtail.classfile.mini.DualPoolEncoder;



import dev.shadowtail.classfile.mini.Minimizer;



import dev.shadowtail.classfile.pool.DualClassRuntimePoolBuilder;




import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;

import java.io.OutputStream;


import java.util.Arrays;







import net.multiphasicapps.classfile.ClassFile;
import net.multiphasicapps.classfile.ClassName;



import net.multiphasicapps.classfile.MethodName;

import net.multiphasicapps.io.TableSectionOutputStream;

/**
 * This class is responsible for creating minimized Jar files which will then
 * be built into a ROM and used by SummerCoat and RatufaCoat.
 *
 * @since 2019/04/27
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
		}
		
		// Doing bootstrapping?
		if (bootstrap != null)
		{
			// The class being booted
			LoadedClassInfo booting = bootstrap.findClass(
				"cc/squirreljme/jvm/Bootstrap");
			
			// Get all the bootstrap information before it is written!
			int bootpool = booting.poolPointer();
			int bootsfbp = bootstrap.staticFieldAreaAddress();
			int bootmeth = booting.methodCodeAddress(
				new MethodName("__start"), null);
			int bootidba = bootstrap.findClass("[B").infoPointer();
			int bootidbd = bootstrap.findClass("[[B").infoPointer();
			
			// Get the handler for system calls and such
			LoadedClassInfo tshclass = bootstrap.findClass(
				"cc/squirreljme/jvm/task/TaskSysCallHandler");
			int scmeth = tshclass.methodCodeAddress(
				new MethodName("taskSysCall"), null),
				scpool = tshclass.poolPointer();
			
			// Setup the BootRAM
			TableSectionOutputStream.Section bootram = out.addSection(
				bootstrap.initializer.toByteArray(), 4);







|











|







241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
		}
		
		// Doing bootstrapping?
		if (bootstrap != null)
		{
			// The class being booted
			LoadedClassInfo booting = bootstrap.findClass(
				"cc/squirreljme/jvm/boot/Bootstrap");
			
			// Get all the bootstrap information before it is written!
			int bootpool = booting.poolPointer();
			int bootsfbp = bootstrap.staticFieldAreaAddress();
			int bootmeth = booting.methodCodeAddress(
				new MethodName("__start"), null);
			int bootidba = bootstrap.findClass("[B").infoPointer();
			int bootidbd = bootstrap.findClass("[[B").infoPointer();
			
			// Get the handler for system calls and such
			LoadedClassInfo tshclass = bootstrap.findClass(
				"cc/squirreljme/jvm/boot/task/TaskSysCallHandler");
			int scmeth = tshclass.methodCodeAddress(
				new MethodName("taskSysCall"), null),
				scpool = tshclass.poolPointer();
			
			// Setup the BootRAM
			TableSectionOutputStream.Section bootram = out.addSection(
				bootstrap.initializer.toByteArray(), 4);

Name change from runt/libs/tool-jarfile/dev/shadowtail/jarfile/LoadedClassInfo.java to modules/tool-jarfile/src/main/java/dev/shadowtail/jarfile/LoadedClassInfo.java.

18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import dev.shadowtail.classfile.pool.AccessedField;
import dev.shadowtail.classfile.pool.BasicPool;
import dev.shadowtail.classfile.pool.BasicPoolEntry;
import dev.shadowtail.classfile.pool.ClassInfoPointer;
import dev.shadowtail.classfile.pool.ClassPool;
import dev.shadowtail.classfile.pool.DualClassRuntimePool;
import dev.shadowtail.classfile.pool.InvokedMethod;
import dev.shadowtail.classfile.pool.InvokeType;
import dev.shadowtail.classfile.pool.MethodIndex;
import dev.shadowtail.classfile.pool.UsedString;
import java.lang.ref.Reference;
import java.util.Deque;
import java.util.LinkedList;
import net.multiphasicapps.classfile.FieldDescriptor;
import net.multiphasicapps.classfile.FieldName;
import net.multiphasicapps.classfile.ClassFile;
import net.multiphasicapps.classfile.ClassName;
import net.multiphasicapps.classfile.ClassNames;
import net.multiphasicapps.classfile.InvalidClassFormatException;
import net.multiphasicapps.classfile.MethodDescriptor;
import net.multiphasicapps.classfile.MethodName;
import net.multiphasicapps.classfile.MethodNameAndType;

/**
 * Boot information for a class.
 *
 * @since 2019/04/30
 */
public final class LoadedClassInfo







<





|
|
|
<
<



<







18
19
20
21
22
23
24

25
26
27
28
29
30
31
32


33
34
35

36
37
38
39
40
41
42
import dev.shadowtail.classfile.pool.AccessedField;
import dev.shadowtail.classfile.pool.BasicPool;
import dev.shadowtail.classfile.pool.BasicPoolEntry;
import dev.shadowtail.classfile.pool.ClassInfoPointer;
import dev.shadowtail.classfile.pool.ClassPool;
import dev.shadowtail.classfile.pool.DualClassRuntimePool;
import dev.shadowtail.classfile.pool.InvokedMethod;

import dev.shadowtail.classfile.pool.MethodIndex;
import dev.shadowtail.classfile.pool.UsedString;
import java.lang.ref.Reference;
import java.util.Deque;
import java.util.LinkedList;
import net.multiphasicapps.classfile.ClassName;
import net.multiphasicapps.classfile.FieldDescriptor;
import net.multiphasicapps.classfile.FieldName;


import net.multiphasicapps.classfile.InvalidClassFormatException;
import net.multiphasicapps.classfile.MethodDescriptor;
import net.multiphasicapps.classfile.MethodName;


/**
 * Boot information for a class.
 *
 * @since 2019/04/30
 */
public final class LoadedClassInfo

Name change from runt/libs/tool-jarfile/dev/shadowtail/jarfile/MinimizedJarHeader.java to modules/tool-jarfile/src/main/java/dev/shadowtail/jarfile/MinimizedJarHeader.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package dev.shadowtail.jarfile;

import java.io.DataInputStream;
import java.io.InputStream;
import java.io.IOException;
import net.multiphasicapps.classfile.InvalidClassFormatException;

/**
 * This represents the header for a minimized Jar file.
 *
 * @since 2019/04/27
 */












|
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package dev.shadowtail.jarfile;

import java.io.DataInputStream;
import java.io.IOException;
import java.io.InputStream;
import net.multiphasicapps.classfile.InvalidClassFormatException;

/**
 * This represents the header for a minimized Jar file.
 *
 * @since 2019/04/27
 */
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
		
		// Need to read fields
		DataInputStream din = new DataInputStream(__in);
		
		// {@squirreljme.error BC0a Invalid minimized Jar magic number.
		// (The read magic number; The expected magic number)}
		int wasmagic;
		if (MAGIC_NUMBER != (wasmagic = din.readInt()))
			throw new InvalidClassFormatException(String.format(
				"BC0a %08x %08x", wasmagic, MAGIC_NUMBER));
		
		// Build
		return new MinimizedJarHeader(
			/* numrc */ din.readInt(),
			/* tocoffset */ din.readInt(),
			
			// Manifest







|

|







150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
		
		// Need to read fields
		DataInputStream din = new DataInputStream(__in);
		
		// {@squirreljme.error BC0a Invalid minimized Jar magic number.
		// (The read magic number; The expected magic number)}
		int wasmagic;
		if (MinimizedJarHeader.MAGIC_NUMBER != (wasmagic = din.readInt()))
			throw new InvalidClassFormatException(String.format(
				"BC0a %08x %08x", wasmagic, MinimizedJarHeader.MAGIC_NUMBER));
		
		// Build
		return new MinimizedJarHeader(
			/* numrc */ din.readInt(),
			/* tocoffset */ din.readInt(),
			
			// Manifest

Name change from runt/libs/tool-jarfile/dev/shadowtail/jarfile/Modifier.java to modules/tool-jarfile/src/main/java/dev/shadowtail/jarfile/Modifier.java.

Name change from runt/libs/tool-jarfile/dev/shadowtail/jarfile/Operation.java to modules/tool-jarfile/src/main/java/dev/shadowtail/jarfile/Operation.java.

Name change from runt/libs/tool-jarfile/dev/shadowtail/jarfile/package-info.java to modules/tool-jarfile/src/main/java/dev/shadowtail/jarfile/package-info.java.

Added modules/tool-jdwp/build.gradle.











































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import cc.squirreljme.plugin.swm.JavaMEMidletType

description = "This contains the implementation of the JDWP " +
	"which enables JDWP-complaint debuggers to connect with SquirrelJME to " +
	"enable its debugging."
version = rootProject.version

squirreljme
{
	javaDocErrorCode = "BH"
	swmType = JavaMEMidletType.LIBRARY
	swmName = "Java Debug Wire Protocol"
	swmVendor = "Stephanie Gawroriski"
}

dependencies
{
	implementation project(":modules:cldc-compact")

	implementation project(":modules:gcf")
}

Name change from runt/libs/tool-jdwp/dev/shadowtail/jdwp/CommandPacket.java to modules/tool-jdwp/src/main/java/dev/shadowtail/jdwp/CommandPacket.java.

Name change from runt/libs/tool-jdwp/dev/shadowtail/jdwp/Packet.java to modules/tool-jdwp/src/main/java/dev/shadowtail/jdwp/Packet.java.

Name change from runt/libs/tool-jdwp/dev/shadowtail/jdwp/ReplyPacket.java to modules/tool-jdwp/src/main/java/dev/shadowtail/jdwp/ReplyPacket.java.

Name change from runt/libs/tool-jdwp/dev/shadowtail/jdwp/package-info.java to modules/tool-jdwp/src/main/java/dev/shadowtail/jdwp/package-info.java.

Added modules/tool-manifest-reader/build.gradle.









































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import cc.squirreljme.plugin.swm.JavaMEMidletType

description = "This provides a decoder for standardJava " +
	"manifest files."
version = rootProject.version

squirreljme
{
	javaDocErrorCode = "BB"
	swmType = JavaMEMidletType.LIBRARY
	swmName = "Manifest File Decoder"
	swmVendor = "Stephanie Gawroriski"
}

dependencies
{
	implementation project(":modules:cldc-compact")

	implementation project(":modules:collections")
}

Name change from runt/libs/tool-manifest-reader/net/multiphasicapps/tool/manifest/JavaManifest.java to modules/tool-manifest-reader/src/main/java/net/multiphasicapps/tool/manifest/JavaManifest.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.tool.manifest;

import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.IOException;
import java.io.Reader;
import java.util.AbstractMap;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import net.multiphasicapps.collections.UnmodifiableMap;

/**
 * This contains decoders for the standard Java manifest format.













|
|
|


<







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

19
20
21
22
23
24
25
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.tool.manifest;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.util.AbstractMap;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import net.multiphasicapps.collections.UnmodifiableMap;

/**
 * This contains decoders for the standard Java manifest format.
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
	 *
	 * @param __c The character to check.
	 * @return {@code true} if a key character.
	 * @since 2016/05/29
	 */
	private static boolean __isKeyChar(char __c)
	{
		return __isAlphaNum(__c) || __c == '_' || __c == '-';
	}
	
	/**
	 * Returns {@code true} if the character is specified to be a newline
	 * character.
	 *
	 * @param __c The character to check.







|







300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
	 *
	 * @param __c The character to check.
	 * @return {@code true} if a key character.
	 * @since 2016/05/29
	 */
	private static boolean __isKeyChar(char __c)
	{
		return JavaManifest.__isAlphaNum(__c) || __c == '_' || __c == '-';
	}
	
	/**
	 * Returns {@code true} if the character is specified to be a newline
	 * character.
	 *
	 * @param __c The character to check.

Name change from runt/libs/tool-manifest-reader/net/multiphasicapps/tool/manifest/JavaManifestAttributes.java to modules/tool-manifest-reader/src/main/java/net/multiphasicapps/tool/manifest/JavaManifestAttributes.java.

Name change from runt/libs/tool-manifest-reader/net/multiphasicapps/tool/manifest/JavaManifestException.java to modules/tool-manifest-reader/src/main/java/net/multiphasicapps/tool/manifest/JavaManifestException.java.

Name change from runt/libs/tool-manifest-reader/net/multiphasicapps/tool/manifest/JavaManifestKey.java to modules/tool-manifest-reader/src/main/java/net/multiphasicapps/tool/manifest/JavaManifestKey.java.

37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
		// Check
		if (__s == null)
			throw new NullPointerException("NARG");
		
		// Lower-case all letters
		StringBuilder sb = new StringBuilder();
		for (int i = 0, n = __s.length(); i < n; i++)
			sb.append(__toLower(__s.charAt(i)));
		this.string = sb.toString();
		
		// Remember input string for case purposes
		this.inputstring = __s;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/05/29
	 */
	@Override
	public boolean equals(Object __o)
	{
		// Is another key?
		if (__o instanceof JavaManifestKey)
			return __equals(((JavaManifestKey)__o).string);
		return false;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/05/29
	 */







|















|







37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
		// Check
		if (__s == null)
			throw new NullPointerException("NARG");
		
		// Lower-case all letters
		StringBuilder sb = new StringBuilder();
		for (int i = 0, n = __s.length(); i < n; i++)
			sb.append(JavaManifestKey.__toLower(__s.charAt(i)));
		this.string = sb.toString();
		
		// Remember input string for case purposes
		this.inputstring = __s;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/05/29
	 */
	@Override
	public boolean equals(Object __o)
	{
		// Is another key?
		if (__o instanceof JavaManifestKey)
			return this.__equals(((JavaManifestKey)__o).string);
		return false;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/05/29
	 */
119
120
121
122
123
124
125

126
127
128
129
130
131
132
133
		
		// Would not be equal
		if (na != nb)
			return false;
		
		// Check characters
		for (int i = 0; i < na; i++)

			if (__toLower(a.charAt(i)) != __toLower(__b.charAt(i)))
				return false;
		
		// Matches
		return true;
	}
	
	/**







>
|







119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
		
		// Would not be equal
		if (na != nb)
			return false;
		
		// Check characters
		for (int i = 0; i < na; i++)
			if (JavaManifestKey.__toLower(a.charAt(i)) != JavaManifestKey
				.__toLower(__b.charAt(i)))
				return false;
		
		// Matches
		return true;
	}
	
	/**

Name change from runt/libs/tool-manifest-reader/net/multiphasicapps/tool/manifest/package-info.java to modules/tool-manifest-reader/src/main/java/net/multiphasicapps/tool/manifest/package-info.java.

Added modules/tool-manifest-writer/build.gradle.









































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import cc.squirreljme.plugin.swm.JavaMEMidletType

description = "This project allows for creating standard " +
	"Java manifest files using a mutable class."
version = rootProject.version

squirreljme
{
	javaDocErrorCode = "AB"
	swmType = JavaMEMidletType.LIBRARY
	swmName = "Mutable Java Manifest"
	swmVendor = "Stephanie Gawroriski"
}

dependencies
{
	implementation project(":modules:cldc-compact")

	implementation project(":modules:tool-manifest-reader")
}

Name change from runt/libs/tool-manifest-writer/net/multiphasicapps/tool/manifest/writer/MutableJavaManifest.java to modules/tool-manifest-writer/src/main/java/net/multiphasicapps/tool/manifest/writer/MutableJavaManifest.java.

8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.tool.manifest.writer;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.Writer;
import java.util.AbstractMap;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Set;







|
|







8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.tool.manifest.writer;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.Writer;
import java.util.AbstractMap;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Set;
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
		
		// Go through and add
		for (Map.Entry<String, JavaManifestAttributes> e :
			__man.entrySet())
		{
			// Create new attribute set
			MutableJavaManifestAttributes attr;
			put(e.getKey(), (attr = new MutableJavaManifestAttributes()));
			
			// Copy values
			for (Map.Entry<JavaManifestKey, String> f :
				e.getValue().entrySet())
				attr.put(f.getKey(), f.getValue());
		}
		
		// If no main attributes were set then make sure they exist
		if (!containsKey(""))
			put("", new MutableJavaManifestAttributes());
	}
	
	/**
	 * Initializes the mutable manifest using a copy of the data from the
	 * given mutable manifest.
	 *
	 * @param __man The mutable manifest to copy from.







|








|
|







72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
		
		// Go through and add
		for (Map.Entry<String, JavaManifestAttributes> e :
			__man.entrySet())
		{
			// Create new attribute set
			MutableJavaManifestAttributes attr;
			this.put(e.getKey(), (attr = new MutableJavaManifestAttributes()));
			
			// Copy values
			for (Map.Entry<JavaManifestKey, String> f :
				e.getValue().entrySet())
				attr.put(f.getKey(), f.getValue());
		}
		
		// If no main attributes were set then make sure they exist
		if (!this.containsKey(""))
			this.put("", new MutableJavaManifestAttributes());
	}
	
	/**
	 * Initializes the mutable manifest using a copy of the data from the
	 * given mutable manifest.
	 *
	 * @param __man The mutable manifest to copy from.
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
		
		// Go through and add
		for (Map.Entry<String, MutableJavaManifestAttributes> e :
			__man.entrySet())
		{
			// Create new attribute set
			MutableJavaManifestAttributes attr;
			put(e.getKey(), (attr = new MutableJavaManifestAttributes()));
			
			// Copy values
			for (Map.Entry<JavaManifestKey, String> f :
				e.getValue().entrySet())
				attr.put(f.getKey(), f.getValue());
		}
		
		// If no main attributes were set then make sure they exist
		if (!containsKey(""))
			put("", new MutableJavaManifestAttributes());
	}
	
	/**
	 * Builds the specified manifest.
	 *
	 * @return The built manifest.
	 * @throws RuntimeException If the manifest could not be built.







|








|
|







106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
		
		// Go through and add
		for (Map.Entry<String, MutableJavaManifestAttributes> e :
			__man.entrySet())
		{
			// Create new attribute set
			MutableJavaManifestAttributes attr;
			this.put(e.getKey(), (attr = new MutableJavaManifestAttributes()));
			
			// Copy values
			for (Map.Entry<JavaManifestKey, String> f :
				e.getValue().entrySet())
				attr.put(f.getKey(), f.getValue());
		}
		
		// If no main attributes were set then make sure they exist
		if (!this.containsKey(""))
			this.put("", new MutableJavaManifestAttributes());
	}
	
	/**
	 * Builds the specified manifest.
	 *
	 * @return The built manifest.
	 * @throws RuntimeException If the manifest could not be built.
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
	 * Returns the mapping of main attributes.
	 *
	 * @return The main attribute mapping.
	 * @since 2016/09/19
	 */
	public final MutableJavaManifestAttributes getMainAttributes()
	{
		return get("");
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/09/19
	 */
	@Override







|







175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
	 * Returns the mapping of main attributes.
	 *
	 * @return The main attribute mapping.
	 * @since 2016/09/19
	 */
	public final MutableJavaManifestAttributes getMainAttributes()
	{
		return this.get("");
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/09/19
	 */
	@Override
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
		throws IOException, NullPointerException
	{
		// Check
		if (__os == null)
			throw new NullPointerException("NARG");
		
		// Write main attribute first
		__write(__os, getMainAttributes());
		
		// Write other attributes
		for (Map.Entry<String, MutableJavaManifestAttributes> e :
			this.attributes.entrySet())
		{
			// Ignore the main attribute
			String k = e.getKey();
			if (k.equals(""))
				continue;
			
			// Sub-attributes are always spaced after the previous one
			__os.append("\r\n");
			
			// Write the name
			__write(__os, "Name", k);
			
			// Write values
			__write(__os, e.getValue());
		}
		
		// Java ME has no flushable so we only know two classes which are
		if (__os instanceof OutputStream)
			((OutputStream)__os).flush();
		else if (__os instanceof Writer)
			((Writer)__os).flush();







|














|


|







237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
		throws IOException, NullPointerException
	{
		// Check
		if (__os == null)
			throw new NullPointerException("NARG");
		
		// Write main attribute first
		this.__write(__os, this.getMainAttributes());
		
		// Write other attributes
		for (Map.Entry<String, MutableJavaManifestAttributes> e :
			this.attributes.entrySet())
		{
			// Ignore the main attribute
			String k = e.getKey();
			if (k.equals(""))
				continue;
			
			// Sub-attributes are always spaced after the previous one
			__os.append("\r\n");
			
			// Write the name
			this.__write(__os, "Name", k);
			
			// Write values
			this.__write(__os, e.getValue());
		}
		
		// Java ME has no flushable so we only know two classes which are
		if (__os instanceof OutputStream)
			((OutputStream)__os).flush();
		else if (__os instanceof Writer)
			((Writer)__os).flush();
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
		if (__w == null || __a == null)
			throw new NullPointerException("NARG");
		
		// The attribute version is always first
		JavaManifestKey verk = new JavaManifestKey("MANIFEST-VERSION");
		String ver = __a.get(verk);
		if (ver != null)
			__write(__w, "MANIFEST-VERSION", ver);
		else
			__write(__w, "MANIFEST-VERSION", "1.0");
		
		// Write all value
		for (Map.Entry<JavaManifestKey, String> e : __a.entrySet())
		{
			// Do not write the version twice
			JavaManifestKey k = e.getKey();
			if (verk.equals(k))
				continue;
			
			// Write pair
			__write(__w, k.inputString(), e.getValue());
		}
	}
	
	/**
	 * Writes the given key and value to the output.
	 *
	 * @param __w The stream to write to.







|

|










|







286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
		if (__w == null || __a == null)
			throw new NullPointerException("NARG");
		
		// The attribute version is always first
		JavaManifestKey verk = new JavaManifestKey("MANIFEST-VERSION");
		String ver = __a.get(verk);
		if (ver != null)
			this.__write(__w, "MANIFEST-VERSION", ver);
		else
			this.__write(__w, "MANIFEST-VERSION", "1.0");
		
		// Write all value
		for (Map.Entry<JavaManifestKey, String> e : __a.entrySet())
		{
			// Do not write the version twice
			JavaManifestKey k = e.getKey();
			if (verk.equals(k))
				continue;
			
			// Write pair
			this.__write(__w, k.inputString(), e.getValue());
		}
	}
	
	/**
	 * Writes the given key and value to the output.
	 *
	 * @param __w The stream to write to.
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
				char c = s.charAt(i);
				if (c < ' ')
					continue;
				
				// Would be on a new line?
				int nextcol = col + 1;
				boolean newline = false;
				if (nextcol >= _COLUMN_LIMIT)
				{
					// If the current character is a space then it will
					// be lost on the following line.
					if (c == ' ')
						__w.append(' ');
					__w.append("\r\n");
					newline = true;







|







337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
				char c = s.charAt(i);
				if (c < ' ')
					continue;
				
				// Would be on a new line?
				int nextcol = col + 1;
				boolean newline = false;
				if (nextcol >= MutableJavaManifest._COLUMN_LIMIT)
				{
					// If the current character is a space then it will
					// be lost on the following line.
					if (c == ' ')
						__w.append(' ');
					__w.append("\r\n");
					newline = true;

Name change from runt/libs/tool-manifest-writer/net/multiphasicapps/tool/manifest/writer/MutableJavaManifestAttributes.java to modules/tool-manifest-writer/src/main/java/net/multiphasicapps/tool/manifest/writer/MutableJavaManifestAttributes.java.

194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
	public String putValue(String __k, String __v)
	{
		// Check
		if (__k == null || __v == null)
			throw new NullPointerException("NARG");
		
		// Forward
		return put(new JavaManifestKey(__k), __v);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/09/29
	 */
	@Override







|







194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
	public String putValue(String __k, String __v)
	{
		// Check
		if (__k == null || __v == null)
			throw new NullPointerException("NARG");
		
		// Forward
		return this.put(new JavaManifestKey(__k), __v);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/09/29
	 */
	@Override

Name change from runt/libs/tool-manifest-writer/net/multiphasicapps/tool/manifest/writer/package-info.java to modules/tool-manifest-writer/src/main/java/net/multiphasicapps/tool/manifest/writer/package-info.java.

Added modules/tool-packfile/build.gradle.















































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import cc.squirreljme.plugin.swm.JavaMEMidletType

description = "This project is used to build the packed ROM " +
	"files needed by SummerCoat and RatufaCoat to function."
version = rootProject.version

squirreljme
{
	javaDocErrorCode = "BI"
	swmType = JavaMEMidletType.LIBRARY
	swmName = "Compiled JAR Packfile Support"
	swmVendor = "Stephanie Gawroriski"
}

dependencies
{
	implementation project(":modules:cldc-compact")

	implementation project(":modules:common-vm")
	implementation project(":modules:tool-classfile")
	implementation project(":modules:tool-jarfile")
	implementation project(":modules:io")
}

Name change from runt/libs/tool-packfile/dev/shadowtail/packfile/MinimizedPackHeader.java to modules/tool-packfile/src/main/java/dev/shadowtail/packfile/MinimizedPackHeader.java.

Name change from runt/libs/tool-packfile/dev/shadowtail/packfile/PackMinimizer.java to modules/tool-packfile/src/main/java/dev/shadowtail/packfile/PackMinimizer.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package dev.shadowtail.packfile;

import cc.squirreljme.jvm.Constants;
import cc.squirreljme.vm.VMClassLibrary;
import dev.shadowtail.classfile.mini.DualPoolEncoder;
import dev.shadowtail.classfile.mini.DualPoolEncodeResult;
import dev.shadowtail.classfile.pool.DualClassRuntimePoolBuilder;
import dev.shadowtail.jarfile.JarMinimizer;
import dev.shadowtail.jarfile.MinimizedJarHeader;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.io.InputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Deque;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import net.multiphasicapps.classfile.InvalidClassFormatException;
import net.multiphasicapps.io.TableSectionOutputStream;

/**
 * This class is used to pack multiple JAR files into a single packed ROM, so
 * that it is all contained within a single unit.
 *











<

|
|




<
<


<
<
<
<
<
<
<







1
2
3
4
5
6
7
8
9
10
11

12
13
14
15
16
17
18


19
20







21
22
23
24
25
26
27
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package dev.shadowtail.packfile;


import cc.squirreljme.vm.VMClassLibrary;
import dev.shadowtail.classfile.mini.DualPoolEncodeResult;
import dev.shadowtail.classfile.mini.DualPoolEncoder;
import dev.shadowtail.classfile.pool.DualClassRuntimePoolBuilder;
import dev.shadowtail.jarfile.JarMinimizer;
import dev.shadowtail.jarfile.MinimizedJarHeader;
import java.io.ByteArrayOutputStream;


import java.io.IOException;
import java.io.OutputStream;







import net.multiphasicapps.classfile.InvalidClassFormatException;
import net.multiphasicapps.io.TableSectionOutputStream;

/**
 * This class is used to pack multiple JAR files into a single packed ROM, so
 * that it is all contained within a single unit.
 *

Name change from runt/libs/tool-packfile/dev/shadowtail/packfile/package-info.java to modules/tool-packfile/src/main/java/dev/shadowtail/packfile/package-info.java.

Added modules/vodafone-api/build.gradle.









































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import cc.squirreljme.plugin.swm.JavaMEMidletType

description = "Proprietary Vodafone API"
version = rootProject.version

squirreljme
{
	javaDocErrorCode = "LA"
	swmType = JavaMEMidletType.API
	swmName = "Vodafone API"
	swmVendor = "Stephanie Gawroriski"
}

dependencies
{
	implementation project(":modules:cldc-compact")

	implementation project(":modules:meep-midlet")
	implementation project(":modules:midp-lcdui")
}

Added modules/vodafone-api/src/main/java/com/vodafone/v10/graphics/j3d/ActionTable.java.







































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package com.vodafone.v10.graphics.j3d;

import java.io.IOException;

public class ActionTable
{
    public ActionTable(byte[] var1)
	{
		throw new todo.TODO();
	}

    public ActionTable(String var1) throws IOException
	{
		throw new todo.TODO();
	}

    public final  int getNumAction()
	{
		throw new todo.TODO();
	}

    public final  int getNumFrame(int var1)
	{
		throw new todo.TODO();
	}
}

Added modules/vodafone-api/src/main/java/com/vodafone/v10/graphics/j3d/AffineTrans.java.





































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package com.vodafone.v10.graphics.j3d;

@SuppressWarnings("FieldNamingConvention")
public class AffineTrans
{
    public int m00;
    public int m01;
    public int m02;
    public int m03;
    public int m10;
    public int m11;
    public int m12;
    public int m13;
    public int m20;
    public int m21;
    public int m22;
    public int m23;

    public AffineTrans()
	{
		throw new todo.TODO();
	}

    public AffineTrans(int[][] var1)
	{
		throw new todo.TODO();
	}

    public void set(int[][] var1)
	{
		throw new todo.TODO();
	}

    public Vector3D transPoint(Vector3D var1)
	{
		throw new todo.TODO();
	}

    public void multiply(AffineTrans var1)
	{
		throw new todo.TODO();
	}

    public void multiply(AffineTrans var1, AffineTrans var2)
	{
		throw new todo.TODO();
	}

    public void rotationX(int var1)
	{
		throw new todo.TODO();
	}

    public void rotationY(int var1)
	{
		throw new todo.TODO();
	}

    public void rotationZ(int var1)
	{
		throw new todo.TODO();
	}

    public void rotationV(Vector3D var1, int var2)
	{
		throw new todo.TODO();
	}

    public void setViewTrans(Vector3D var1, Vector3D var2, Vector3D var3)
	{
		throw new todo.TODO();
	}
}

Added modules/vodafone-api/src/main/java/com/vodafone/v10/graphics/j3d/Effect3D.java.













































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package com.vodafone.v10.graphics.j3d;

public class Effect3D
{
    public static final int NORMAL_SHADING = 0;
    public static final int TOON_SHADING = 1;

    public Effect3D()
	{
		throw new todo.TODO();
	}

    public Effect3D(Light var1, int var2, boolean var3, Texture var4)
	{
		throw new todo.TODO();
	}

    public Light getLight()
	{
		throw new todo.TODO();
	}

    public void setLight(Light var1)
	{
		throw new todo.TODO();
	}

    public int getShading()
	{
		throw new todo.TODO();
	}

    public void setShading(int var1)
	{
		throw new todo.TODO();
	}

    public int getThreshold()
	{
		throw new todo.TODO();
	}

    public int getThresholdHigh()
	{
		throw new todo.TODO();
	}

    public int getThresholdLow()
	{
		throw new todo.TODO();
	}

    public void setThreshold(int var1, int var2, int var3)
	{
		throw new todo.TODO();
	}

    public boolean isSemiTransparentEnabled()
	{
		throw new todo.TODO();
	}

    public void setSemiTransparentEnabled(boolean var1)
	{
		throw new todo.TODO();
	}

    public Texture getSphereMap()
	{
		throw new todo.TODO();
	}

    public void setSphereMap(Texture var1)
	{
		throw new todo.TODO();
	}
}

Added modules/vodafone-api/src/main/java/com/vodafone/v10/graphics/j3d/Figure.java.













































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package com.vodafone.v10.graphics.j3d;

import java.io.IOException;

public class Figure
{
    public Figure(byte[] var1)
	{
		throw new todo.TODO();
	}

    public Figure(String var1)
    	throws IOException
	{
		throw new todo.TODO();
	}

    public void setPosture(ActionTable var1, int var2, int var3)
	{
		throw new todo.TODO();
	}

    public void setTexture(Texture var1)
	{
		throw new todo.TODO();
	}
}


Added modules/vodafone-api/src/main/java/com/vodafone/v10/graphics/j3d/FigureLayout.java.

































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package com.vodafone.v10.graphics.j3d;

public class FigureLayout
{
    public FigureLayout()
	{
		throw new todo.TODO();
	}

    public FigureLayout(AffineTrans var1, int var2, int var3, int var4,
    	int var5)
	{
		throw new todo.TODO();
	}

    public AffineTrans getAffineTrans()
	{
		throw new todo.TODO();
	}

    public void setAffineTrans(AffineTrans var1)
	{
		throw new todo.TODO();
	}

    public int getScaleX()
	{
		throw new todo.TODO();
	}

    public int getScaleY()
	{
		throw new todo.TODO();
	}

    public void setScale(int var1, int var2)
	{
		throw new todo.TODO();
	}

    public int getCenterX()
	{
		throw new todo.TODO();
	}

    public int getCenterY()
	{
		throw new todo.TODO();
	}

    public void setCenter(int var1, int var2)
	{
		throw new todo.TODO();
	}
}

Added modules/vodafone-api/src/main/java/com/vodafone/v10/graphics/j3d/Graphics3D.java.



































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package com.vodafone.v10.graphics.j3d;

public interface Graphics3D
{
    void drawFigure(Figure var1, int var2, int var3, FigureLayout var4,
    	Effect3D var5);
}

Added modules/vodafone-api/src/main/java/com/vodafone/v10/graphics/j3d/Light.java.











































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package com.vodafone.v10.graphics.j3d;

public class Light
{
    public Light()
	{
		throw new todo.TODO();
	}

    public Light(Vector3D var1, int var2, int var3)
	{
		throw new todo.TODO();
	}

    public int getDirIntensity()
	{
		throw new todo.TODO();
	}

    public void setDirIntensity(int var1)
	{
		throw new todo.TODO();
	}

    public int getAmbIntensity()
	{
		throw new todo.TODO();
	}

    public void setAmbIntensity(int var1)
	{
		throw new todo.TODO();
	}

    public Vector3D getDirection()
	{
		throw new todo.TODO();
	}

    public void setDirection(Vector3D var1)
	{
		throw new todo.TODO();
	}
}

Added modules/vodafone-api/src/main/java/com/vodafone/v10/graphics/j3d/Texture.java.



















































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package com.vodafone.v10.graphics.j3d;

import java.io.IOException;

public class Texture {
    public Texture(byte[] var1, boolean var2)
	{
		throw new todo.TODO();
	}

    public Texture(String var1, boolean var2)
    	throws IOException
	{
		throw new todo.TODO();
	}
}

Added modules/vodafone-api/src/main/java/com/vodafone/v10/graphics/j3d/Util3D.java.

























































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package com.vodafone.v10.graphics.j3d;

public class Util3D
{
    public static final  int sqrt(int var0)
	{
		throw new todo.TODO();
	}

    public static final  int sin(int var0)
	{
		throw new todo.TODO();
	}

    public static final  int cos(int var0)
	{
		throw new todo.TODO();
	}
}

Added modules/vodafone-api/src/main/java/com/vodafone/v10/graphics/j3d/Vector3D.java.















































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package com.vodafone.v10.graphics.j3d;

public class Vector3D
{
    public int x;
    public int y;
    public int z;

    public Vector3D()
	{
		throw new todo.TODO();
	}

    public Vector3D(int var1, int var2, int var3)
	{
		throw new todo.TODO();
	}

    public int getX()
	{
		throw new todo.TODO();
	}

    public int getY()
	{
		throw new todo.TODO();
	}

    public int getZ()
	{
		throw new todo.TODO();
	}

    public void setX(int var1)
	{
		throw new todo.TODO();
	}

    public void setY(int var1)
	{
		throw new todo.TODO();
	}

    public void setZ(int var1)
	{
		throw new todo.TODO();
	}

    public void set(int var1, int var2, int var3)
	{
		throw new todo.TODO();
	}

    public void unit()
	{
		throw new todo.TODO();
	}

    public int innerProduct(Vector3D var1)
	{
		throw new todo.TODO();
	}

    public void outerProduct(Vector3D var1)
	{
		throw new todo.TODO();
	}

    public static  int innerProduct(Vector3D var0, Vector3D var1)
	{
		throw new todo.TODO();
	}

    public static  Vector3D outerProduct(Vector3D var0, Vector3D var1)
	{
		throw new todo.TODO();
	}
}

Added modules/vodafone-api/src/main/java/com/vodafone/v10/graphics/sprite/SpriteCanvas.java.



































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package com.vodafone.v10.graphics.sprite;

import javax.microedition.lcdui.Canvas;

public abstract class SpriteCanvas
	extends Canvas
{
    public SpriteCanvas(int var1, int var2)
	{
		throw new todo.TODO();
	}

    public void createFrameBuffer(int var1, int var2)
	{
		throw new todo.TODO();
	}

    public void disposeFrameBuffer()
	{
		throw new todo.TODO();
	}

    public static  int getVirtualWidth()
	{
		throw new todo.TODO();
	}

    public static  int getVirtualHeight()
	{
		throw new todo.TODO();
	}

    public void setPalette(int var1, int var2)
	{
		throw new todo.TODO();
	}

    public void setPattern(int var1, byte[] var2)
	{
		throw new todo.TODO();
	}

    public static  short createCharacterCommand(int var0, boolean var1, int var2, boolean var3, boolean var4, int var5)
	{
		throw new todo.TODO();
	}

    public void drawSpriteChar(short var1, short var2, short var3)
	{
		throw new todo.TODO();
	}

    public void drawBackground(short var1, short var2, short var3)
	{
		throw new todo.TODO();
	}

    public void copyArea(int var1, int var2, int var3, int var4, int var5, int var6)
	{
		throw new todo.TODO();
	}

    public void copyFullScreen(int var1, int var2)
	{
		throw new todo.TODO();
	}

    public void drawFrameBuffer(int var1, int var2)
	{
		throw new todo.TODO();
	}
}

Added modules/vodafone-api/src/main/java/com/vodafone/v10/midlet/ResidentMIDlet.java.

















































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package com.vodafone.v10.midlet;

import com.vodafone.v10.system.device.MailListener;
import com.vodafone.v10.system.device.RingStateListener;
import com.vodafone.v10.system.device.ScheduledAlarmListener;
import com.vodafone.v10.system.device.TelephonyListener;
import javax.microedition.midlet.MIDlet;

public abstract class ResidentMIDlet
	extends MIDlet
	implements TelephonyListener, MailListener, ScheduledAlarmListener,
		RingStateListener
{
    protected ResidentMIDlet()
	{
		throw new todo.TODO();
	}

    public abstract void ring();

    public abstract void hungup();

    public abstract void received(int var1);

    public abstract void notice(String var1);

    public abstract void ringStarted();

    public abstract void ringStopped();
}

Added modules/vodafone-api/src/main/java/com/vodafone/v10/sound/Sound.java.













































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package com.vodafone.v10.sound;

import java.io.IOException;

public class Sound
{
    public Sound(String var1)
    	throws IOException
	{
		if (false)
			throw new IOException();
		throw new todo.TODO();
	}

    public Sound(byte[] var1)
	{
		throw new todo.TODO();
	}

    public int getSize()
	{
		throw new todo.TODO();
	}

    public int getUseTracks()
	{
		throw new todo.TODO();
	}
}

Added modules/vodafone-api/src/main/java/com/vodafone/v10/sound/SoundEventType.java.



































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package com.vodafone.v10.sound;

public interface SoundEventType
{
    int EV_END = -1;
    int EV_LOOP = -2;
    int EV_PAUSE = -3;
    int EV_USER_0 = 0;
    int EV_USER_1 = 1;
    int EV_USER_2 = 2;
    int EV_USER_3 = 3;
    int EV_USER_4 = 4;
    int EV_USER_5 = 5;
    int EV_USER_6 = 6;
    int EV_USER_7 = 7;
    int EV_USER_8 = 8;
    int EV_USER_9 = 9;
    int EV_USER_10 = 10;
    int EV_USER_11 = 11;
    int EV_USER_12 = 12;
    int EV_USER_13 = 13;
    int EV_USER_14 = 14;
    int EV_USER_15 = 15;
}

Added modules/vodafone-api/src/main/java/com/vodafone/v10/sound/SoundPlayer.java.





















































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package com.vodafone.v10.sound;

public class SoundPlayer
{
    public static  SoundPlayer getPlayer()
	{
		throw new todo.TODO();
	}

    public SoundTrack getTrack()
	{
		throw new todo.TODO();
	}

    public SoundTrack getTrack(int var1)
	{
		throw new todo.TODO();
	}

    public int getTrackCount()
	{
		throw new todo.TODO();
	}

    public void disposePlayer()
	{
		throw new todo.TODO();
	}

    public void disposeTrack(SoundTrack var1)
	{
		throw new todo.TODO();
	}

    public void kill()
	{
		throw new todo.TODO();
	}

    public void pause()
	{
		throw new todo.TODO();
	}

    public void resume()
	{
		throw new todo.TODO();
	}
}

Added modules/vodafone-api/src/main/java/com/vodafone/v10/sound/SoundTrack.java.



































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package com.vodafone.v10.sound;

public class SoundTrack
{
    public static final int NO_DATA = 0;
    public static final int READY = 1;
    public static final int PLAYING = 2;
    public static final int PAUSED = 3;

    public void setSound(Sound var1)
	{
		throw new todo.TODO();
	}

    public Sound getSound()
	{
		throw new todo.TODO();
	}

    public void removeSound()
	{
		throw new todo.TODO();
	}

    public void play()
	{
		throw new todo.TODO();
	}

    public void play(int var1)
	{
		throw new todo.TODO();
	}

    public void stop()
	{
		throw new todo.TODO();
	}

    public void pause()
	{
		throw new todo.TODO();
	}

    public void resume()
	{
		throw new todo.TODO();
	}

    public void mute(boolean var1)
	{
		throw new todo.TODO();
	}

    public int getState()
	{
		throw new todo.TODO();
	}

    public void setVolume(int var1)
	{
		throw new todo.TODO();
	}

    public int getVolume()
	{
		throw new todo.TODO();
	}

    public void setPanpot(int var1)
	{
		throw new todo.TODO();
	}

    public int getPanpot()
	{
		throw new todo.TODO();
	}

    public void setSubjectTo(SoundTrack var1)
	{
		throw new todo.TODO();
	}

    public SoundTrack getSyncMaster()
	{
		throw new todo.TODO();
	}

    public int getID()
	{
		throw new todo.TODO();
	}

    public void setEventListener(SoundTrackListener var1)
	{
		throw new todo.TODO();
	}

    public boolean isMute()
	{
		throw new todo.TODO();
	}
}

Added modules/vodafone-api/src/main/java/com/vodafone/v10/sound/SoundTrackListener.java.































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package com.vodafone.v10.sound;

public interface SoundTrackListener
{
    void eventOccurred(int var1);
}

Added modules/vodafone-api/src/main/java/com/vodafone/v10/system/device/DeviceControl.java.





















































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package com.vodafone.v10.system.device;

public class DeviceControl {
    public static final int BATTERY = 1;
    public static final int FIELD_INTENSITY = 2;
    public static final int KEY_STATE = 3;
    public static final int VIBRATION = 4;
    public static final int BACK_LIGHT = 5;
    public static final int EIGHT_DIRECTIONS = 6;

    public static final  DeviceControl getDefaultDeviceControl()
	{
		throw new todo.TODO();
	}

    public int getDeviceState(int var1)
	{
		throw new todo.TODO();
	}

    public boolean isDeviceActive(int var1)
	{
		throw new todo.TODO();
	}

    public boolean setDeviceActive(int var1, boolean var2)
	{
		throw new todo.TODO();
	}

    public void blink(int var1, int var2, int var3)
	{
		throw new todo.TODO();
	}

    public boolean setKeyRepeatState(int var1, boolean var2)
	{
		throw new todo.TODO();
	}

    public boolean getKeyRepeatState(int var1)
	{
		throw new todo.TODO();
	}

    public static  void setMailListener(MailListener var0)
	{
		throw new todo.TODO();
	}

    public static  void setScheduledAlarmListener(ScheduledAlarmListener var0)
	{
		throw new todo.TODO();
	}

    public static  void setTelephonyListener(TelephonyListener var0)
	{
		throw new todo.TODO();
	}

    public static  void setRingStateListener(RingStateListener var0)
	{
		throw new todo.TODO();
	}
}

Added modules/vodafone-api/src/main/java/com/vodafone/v10/system/device/MailListener.java.









































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package com.vodafone.v10.system.device;

public interface MailListener
{
    int SMS = 1;
    int MMS = 2;
    int CBS = 3;
    int WEB = 4;

    void received(int var1);
}

Added modules/vodafone-api/src/main/java/com/vodafone/v10/system/device/RingStateListener.java.



































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package com.vodafone.v10.system.device;

public interface RingStateListener
{
    void ringStarted();

    void ringStopped();
}

Added modules/vodafone-api/src/main/java/com/vodafone/v10/system/device/ScheduledAlarmListener.java.































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package com.vodafone.v10.system.device;

public interface ScheduledAlarmListener
{
    void notice(String var1);
}

Added modules/vodafone-api/src/main/java/com/vodafone/v10/system/device/TelephonyListener.java.



































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package com.vodafone.v10.system.device;

public interface TelephonyListener
{
    void ring();

    void hungup();
}

Added modules/vodafone-api/src/main/java/com/vodafone/v10/system/media/ImageResourceOperator.java.





















































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package com.vodafone.v10.system.media;

class ImageResourceOperator implements ResourceOperator {
    public int getResourceType()
	{
		throw new todo.TODO();
	}

    public int getResourceCount()
	{
		throw new todo.TODO();
	}

    public int getResourceID(int var1)
	{
		throw new todo.TODO();
	}

    public String getResourceName(int var1)
	{
		throw new todo.TODO();
	}

    public String[] getResourceNames()
	{
		throw new todo.TODO();
	}

    public void setResourceByID(MediaPlayer var1, int var2)
	{
		throw new todo.TODO();
	}

    public void setResourceByTitle(MediaPlayer var1, String var2)
	{
		throw new todo.TODO();
	}

    public void setResource(MediaPlayer var1, int var2)
	{
		throw new todo.TODO();
	}

    public int getIndexOfResource(int var1)
	{
		throw new todo.TODO();
	}
}

Added modules/vodafone-api/src/main/java/com/vodafone/v10/system/media/MediaPlayer.java.





































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package com.vodafone.v10.system.media;

import java.io.IOException;
import javax.microedition.lcdui.Canvas;
import javax.microedition.lcdui.Graphics;

public class MediaPlayer extends Canvas {
    public static final int NO_DATA = 0;
    public static final int READY = 1;
    public static final int PLAYING = 2;
    public static final int PAUSED = 3;
    public static final int ERROR = 65536;

    public MediaPlayer(byte[] var1) {
    }

    public MediaPlayer(String var1) throws IOException {
    }

    public void setMediaData(byte[] var1)
	{
		throw new todo.TODO();
	}

    public void setMediaData(String var1) throws IOException
	{
		throw new todo.TODO();
	}

    public int getState()
	{
		throw new todo.TODO();
	}

    public int getMediaWidth()
	{
		throw new todo.TODO();
	}

    public int getMediaHeight()
	{
		throw new todo.TODO();
	}

    public int getWidth()
	{
		throw new todo.TODO();
	}

    public int getHeight()
	{
		throw new todo.TODO();
	}

    public void setContentPos(int var1, int var2)
	{
		throw new todo.TODO();
	}

    public void play()
	{
		throw new todo.TODO();
	}

    public void play(boolean var1)
	{
		throw new todo.TODO();
	}

    public void stop()
	{
		throw new todo.TODO();
	}

    public void pause()
	{
		throw new todo.TODO();
	}

    public void resume()
	{
		throw new todo.TODO();
	}

    public void setMediaPlayerListener(MediaPlayerListener var1)
	{
		throw new todo.TODO();
	}

    protected  void paint(Graphics var1)
	{
		throw new todo.TODO();
	}

    protected  void showNotify()
	{
		throw new todo.TODO();
	}

    protected  void hideNotify()
	{
		throw new todo.TODO();
	}
}

Added modules/vodafone-api/src/main/java/com/vodafone/v10/system/media/MediaPlayerListener.java.





































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package com.vodafone.v10.system.media;

public interface MediaPlayerListener {
    int PLAYED = 0;
    int STOPPED = 1;
    int PAUSED = 2;

    void mediaStateChanged(int var1);
}

Added modules/vodafone-api/src/main/java/com/vodafone/v10/system/media/MelodyResourceOperator.java.























































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package com.vodafone.v10.system.media;

class MelodyResourceOperator
	implements ResourceOperator
{
    public int getResourceType()
	{
		throw new todo.TODO();
	}

    public int getResourceCount()
	{
		throw new todo.TODO();
	}

    public int getResourceID(int var1)
	{
		throw new todo.TODO();
	}

    public String getResourceName(int var1)
	{
		throw new todo.TODO();
	}

    public String[] getResourceNames()
	{
		throw new todo.TODO();
	}

    public void setResourceByID(MediaPlayer var1, int var2)
	{
		throw new todo.TODO();
	}

    public void setResourceByTitle(MediaPlayer var1, String var2)
	{
		throw new todo.TODO();
	}

    public void setResource(MediaPlayer var1, int var2)
	{
		throw new todo.TODO();
	}

    public int getIndexOfResource(int var1)
	{
		throw new todo.TODO();
	}
}

Added modules/vodafone-api/src/main/java/com/vodafone/v10/system/media/ResourceOperator.java.































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package com.vodafone.v10.system.media;

public interface ResourceOperator
{
    int getResourceType();

    int getResourceCount();

    int getResourceID(int var1);

    String getResourceName(int var1);

    String[] getResourceNames();

    void setResourceByID(MediaPlayer var1, int var2);

    void setResourceByTitle(MediaPlayer var1, String var2);

    void setResource(MediaPlayer var1, int var2);

    int getIndexOfResource(int var1);
}

Added modules/vodafone-api/src/main/java/com/vodafone/v10/system/media/ResourceOperatorManager.java.





















































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package com.vodafone.v10.system.media;

public class ResourceOperatorManager
{
    public static final int MELODY_RESOURCE = 0;
    public static final int IMAGE_RESOURCE = 1;

    public ResourceOperatorManager()
	{
		throw new todo.TODO();
	}

    public static  ResourceOperator getResourceOperator(int var0)
	{
		throw new todo.TODO();
	}
}

Added modules/vodafone-api/src/main/java/com/vodafone/v10/util/FixedPoint.java.









































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package com.vodafone.v10.util;

public class FixedPoint
{
    public FixedPoint()
	{
		throw new todo.TODO();
	}

    public FixedPoint(int var1)
	{
		throw new todo.TODO();
	}

    public int getInteger()
	{
		throw new todo.TODO();
	}

    public int getDecimal()
	{
		throw new todo.TODO();
	}

    public void setValue(int var1)
	{
		throw new todo.TODO();
	}

    public FixedPoint add(FixedPoint var1)
	{
		throw new todo.TODO();
	}

    public FixedPoint add(int var1)
	{
		throw new todo.TODO();
	}

    public FixedPoint subtract(FixedPoint var1)
	{
		throw new todo.TODO();
	}

    public FixedPoint subtract(int var1)
	{
		throw new todo.TODO();
	}

    public FixedPoint multiply(FixedPoint var1)
	{
		throw new todo.TODO();
	}

    public FixedPoint multiply(int var1)
	{
		throw new todo.TODO();
	}

    public FixedPoint divide(FixedPoint var1)
	{
		throw new todo.TODO();
	}

    public FixedPoint divide(int var1)
	{
		throw new todo.TODO();
	}

    public FixedPoint sin(FixedPoint var1)
	{
		throw new todo.TODO();
	}

    public FixedPoint cos(FixedPoint var1)
	{
		throw new todo.TODO();
	}

    public FixedPoint tan(FixedPoint var1)
	{
		throw new todo.TODO();
	}

    public FixedPoint asin(FixedPoint var1)
	{
		throw new todo.TODO();
	}

    public FixedPoint acos(FixedPoint var1)
	{
		throw new todo.TODO();
	}

    public FixedPoint atan(FixedPoint var1)
	{
		throw new todo.TODO();
	}

    public FixedPoint sqrt()
	{
		throw new todo.TODO();
	}

    public FixedPoint inverse()
	{
		throw new todo.TODO();
	}

    public FixedPoint pow()
	{
		throw new todo.TODO();
	}

    public boolean isInfinite()
	{
		throw new todo.TODO();
	}

    public FixedPoint clone()
	{
		throw new todo.TODO();
	}

    public static  FixedPoint getPI()
	{
		throw new todo.TODO();
	}

    public static  FixedPoint getMaximum()
	{
		throw new todo.TODO();
	}

    public static  FixedPoint getMinimum()
	{
		throw new todo.TODO();
	}
}

Added modules/vodafone-api/src/main/java/com/vodafone/v10/util/Vector2D.java.

















































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package com.vodafone.v10.util;

public class Vector2D
{
    public Vector2D(FixedPoint var1, FixedPoint var2)
	{
		throw new todo.TODO();
	}

    public Vector2D(int var1, int var2)
	{
		throw new todo.TODO();
	}

    public Vector2D()
	{
		throw new todo.TODO();
	}

    public void add(Vector2D var1)
	{
		throw new todo.TODO();
	}

    public void add(int var1, int var2)
	{
		throw new todo.TODO();
	}

    public void subtract(Vector2D var1)
	{
		throw new todo.TODO();
	}

    public void subtract(int var1, int var2)
	{
		throw new todo.TODO();
	}

    public void normalize()
	{
		throw new todo.TODO();
	}

    public static  FixedPoint innerProduct(Vector2D var0, Vector2D var1)
	{
		throw new todo.TODO();
	}

    public static  FixedPoint outerProduct(Vector2D var0, Vector2D var1)
	{
		throw new todo.TODO();
	}

    public void setValue(int var1, int var2)
	{
		throw new todo.TODO();
	}

    public void setValue(FixedPoint var1, FixedPoint var2)
	{
		throw new todo.TODO();
	}

    public FixedPoint getX()
	{
		throw new todo.TODO();
	}

    public FixedPoint getY()
	{
		throw new todo.TODO();
	}

    public Vector2D clone()
	{
		throw new todo.TODO();
	}
}

Added modules/zip/build.gradle.









































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import cc.squirreljme.plugin.swm.JavaMEMidletType

description = "The library contains the support for ZIP " +
	"files and any data interfaces needed for ZIP files."
version = rootProject.version

squirreljme
{
	javaDocErrorCode = "BF"
	swmType = JavaMEMidletType.LIBRARY
	swmName = "ZIP Support"
	swmVendor = "Stephanie Gawroriski"
}

dependencies
{
	implementation project(":modules:cldc")

	implementation project(":modules:io")
}

Name change from runt/libs/zip/net/multiphasicapps/zip/IBM437CodePage.java to modules/zip/src/main/java/net/multiphasicapps/zip/IBM437CodePage.java.

32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
	 *
	 * @param __b Byte to translate.
	 * @return The translated value.
	 * @since 2016/03/07
	 */
	public static char byteToChar(byte __b)
	{
		return byteToChar(((int)__b) & 0xFF);
	}
	
	/**
	 * Translates the given integer to a character.
	 *
	 * @param __b Integer to translate.
	 * @return The translated value.







|







32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
	 *
	 * @param __b Byte to translate.
	 * @return The translated value.
	 * @since 2016/03/07
	 */
	public static char byteToChar(byte __b)
	{
		return IBM437CodePage.byteToChar(((int)__b) & 0xFF);
	}
	
	/**
	 * Translates the given integer to a character.
	 *
	 * @param __b Integer to translate.
	 * @return The translated value.
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
		if (__arr == null)
			throw new NullPointerException("NARG");
		if (__off < 0 || __len < 0 || (__off + __len) < 0 ||
			(__off + __len) > __arr.length)
			throw new IllegalArgumentException("BAOB");
		
		// Result is of the same size
		char rv[] = new char[__len];
		
		// Go through it
		for (int i = 0; i < __len; i++)
			rv[i] = byteToChar(__arr[__off + i]);
		
		// Build it
		return new String(rv);
	}
}








|



|






216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
		if (__arr == null)
			throw new NullPointerException("NARG");
		if (__off < 0 || __len < 0 || (__off + __len) < 0 ||
			(__off + __len) > __arr.length)
			throw new IllegalArgumentException("BAOB");
		
		// Result is of the same size
		char[] rv = new char[__len];
		
		// Go through it
		for (int i = 0; i < __len; i++)
			rv[i] = IBM437CodePage.byteToChar(__arr[__off + i]);
		
		// Build it
		return new String(rv);
	}
}

Name change from runt/libs/zip/net/multiphasicapps/zip/ZipAttributeCompatibility.java to modules/zip/src/main/java/net/multiphasicapps/zip/ZipAttributeCompatibility.java.

86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
	
	/**
	 * Initializes the base compatibility information.
	 *
	 * @param __id The identifier used.
	 * @since 2016/08/07
	 */
	private ZipAttributeCompatibility(int __id)
	{
		this.id = __id;
	}
	
	/**
	 * Returns the version identifier.
	 *







|







86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
	
	/**
	 * Initializes the base compatibility information.
	 *
	 * @param __id The identifier used.
	 * @since 2016/08/07
	 */
	ZipAttributeCompatibility(int __id)
	{
		this.id = __id;
	}
	
	/**
	 * Returns the version identifier.
	 *

Name change from runt/libs/zip/net/multiphasicapps/zip/ZipCRCConstants.java to modules/zip/src/main/java/net/multiphasicapps/zip/ZipCRCConstants.java.

15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
 * algorithm parameters.
 *
 * @since 2016/07/19
 */
public interface ZipCRCConstants
{
	/** The polynomial for the CRC algorithm. */
	public static final int CRC_POLYNOMIAL =
		0x04C11DB7;
	
	/** The initial CRC remainder. */
	public static final int CRC_REMAINDER =
		0xFFFFFFFF;
	
	/** The final XOR value. */
	public static final int CRC_FINALXOR =
		0xFFFFFFFF;
	
	/** Reflect the data? */
	public static final boolean CRC_REFLECT_DATA =
		true;
	
	/** Reflect the remainder? */
	public static final boolean CRC_REFLECT_REMAINDER =
		true;
}








|



|



|



|



|



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
 * algorithm parameters.
 *
 * @since 2016/07/19
 */
public interface ZipCRCConstants
{
	/** The polynomial for the CRC algorithm. */
	int CRC_POLYNOMIAL =
		0x04C11DB7;
	
	/** The initial CRC remainder. */
	int CRC_REMAINDER =
		0xFFFFFFFF;
	
	/** The final XOR value. */
	int CRC_FINALXOR =
		0xFFFFFFFF;
	
	/** Reflect the data? */
	boolean CRC_REFLECT_DATA =
		true;
	
	/** Reflect the remainder? */
	boolean CRC_REFLECT_REMAINDER =
		true;
}

Name change from runt/libs/zip/net/multiphasicapps/zip/ZipCompressionType.java to modules/zip/src/main/java/net/multiphasicapps/zip/ZipCompressionType.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.zip;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.InputStream;
import java.io.IOException;
import java.io.OutputStream;
import net.multiphasicapps.io.Checksum;
import net.multiphasicapps.io.ChecksumInputStream;
import net.multiphasicapps.io.CompressionLevel;
import net.multiphasicapps.io.DecompressionInputStream;
import net.multiphasicapps.io.DeflaterOutputStream;
import net.multiphasicapps.io.InflaterInputStream;












|
<

<







1
2
3
4
5
6
7
8
9
10
11
12
13

14

15
16
17
18
19
20
21
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.zip;

import java.io.IOException;

import java.io.InputStream;

import java.io.OutputStream;
import net.multiphasicapps.io.Checksum;
import net.multiphasicapps.io.ChecksumInputStream;
import net.multiphasicapps.io.CompressionLevel;
import net.multiphasicapps.io.DecompressionInputStream;
import net.multiphasicapps.io.DeflaterOutputStream;
import net.multiphasicapps.io.InflaterInputStream;
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
	DEFLATE(20, 8),
	
	/** End. */
	;
	
	/** The default compression algorithm to use. */
	public static final ZipCompressionType DEFAULT_COMPRESSION =
		DEFLATE;
	
	/** The version needed to extract. */
	protected final int extractversion;
	
	/** The compression method. */
	protected final int method;
	
	/**
	 * Initializes the enumeration.
	 *
	 * @param __xv The version needed to extract.
	 * @param __m The compression method identifier.
	 * @since 2016/07/15
	 */
	private ZipCompressionType(int __xv, int __m)
	{
		this.extractversion = __xv;
		this.method = __m;
	}
	
	/**
	 * Returns the version which is needed to extract this data.







|














|







34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
	DEFLATE(20, 8),
	
	/** End. */
	;
	
	/** The default compression algorithm to use. */
	public static final ZipCompressionType DEFAULT_COMPRESSION =
		ZipCompressionType.DEFLATE;
	
	/** The version needed to extract. */
	protected final int extractversion;
	
	/** The compression method. */
	protected final int method;
	
	/**
	 * Initializes the enumeration.
	 *
	 * @param __xv The version needed to extract.
	 * @param __m The compression method identifier.
	 * @since 2016/07/15
	 */
	ZipCompressionType(int __xv, int __m)
	{
		this.extractversion = __xv;
		this.method = __m;
	}
	
	/**
	 * Returns the version which is needed to extract this data.
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
	 * @throws IOException If the stream could not be initialized.
	 * @throws NullPointerException On null arguments.
	 * @since 2016/07/19
	 */
	public final DecompressionInputStream inputStream(InputStream __is)
		throws IOException, NullPointerException
	{
		return inputStream(__is, null);
	}
	
	/**
	 * Creates an input stream which wraps another for input which is used
	 * to read the associated data.
	 *
	 * @param __is The input stream to read from.







|







80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
	 * @throws IOException If the stream could not be initialized.
	 * @throws NullPointerException On null arguments.
	 * @since 2016/07/19
	 */
	public final DecompressionInputStream inputStream(InputStream __is)
		throws IOException, NullPointerException
	{
		return this.inputStream(__is, null);
	}
	
	/**
	 * Creates an input stream which wraps another for input which is used
	 * to read the associated data.
	 *
	 * @param __is The input stream to read from.

Name change from runt/libs/zip/net/multiphasicapps/zip/ZipEntryAttribute.java to modules/zip/src/main/java/net/multiphasicapps/zip/ZipEntryAttribute.java.

Name change from runt/libs/zip/net/multiphasicapps/zip/ZipException.java to modules/zip/src/main/java/net/multiphasicapps/zip/ZipException.java.

23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
	/**
	 * Initializes exception with no message.
	 *
	 * @since 2016/08/02
	 */
	public ZipException()
	{
		super();
	}
	
	/**
	 * Initializes exception with the given message.
	 *
	 * @param __msg The exception message.
	 * @since 2016/08/02







<







23
24
25
26
27
28
29

30
31
32
33
34
35
36
	/**
	 * Initializes exception with no message.
	 *
	 * @since 2016/08/02
	 */
	public ZipException()
	{

	}
	
	/**
	 * Initializes exception with the given message.
	 *
	 * @param __msg The exception message.
	 * @since 2016/08/02

Name change from runt/libs/zip/net/multiphasicapps/zip/ZipUnixAccessMode.java to modules/zip/src/main/java/net/multiphasicapps/zip/ZipUnixAccessMode.java.

Name change from runt/libs/zip/net/multiphasicapps/zip/__NoCompressionInputStream__.java to modules/zip/src/main/java/net/multiphasicapps/zip/__NoCompressionInputStream__.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.zip;

import java.io.InputStream;
import java.io.IOException;
import net.multiphasicapps.io.DecompressionInputStream;

/**
 * This is an input stream which offers no compression but keeps count of
 * the read bytes.
 *
 * @since 2017/08/22












|
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.zip;

import java.io.IOException;
import java.io.InputStream;
import net.multiphasicapps.io.DecompressionInputStream;

/**
 * This is an input stream which offers no compression but keeps count of
 * the read bytes.
 *
 * @since 2017/08/22

Name change from runt/libs/zip/net/multiphasicapps/zip/blockreader/ArrayBlockAccessor.java to modules/zip/src/main/java/net/multiphasicapps/zip/blockreader/ArrayBlockAccessor.java.

Name change from runt/libs/zip/net/multiphasicapps/zip/blockreader/BlockAccessor.java to modules/zip/src/main/java/net/multiphasicapps/zip/blockreader/BlockAccessor.java.

27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
	 *
	 * @param __addr The address to read from.
	 * @return The read byte.
	 * @throws EOFException If the read is past the end of file.
	 * @throws IOException On read/write errors.
	 * @since 2016/12/29
	 */
	public abstract byte read(long __addr)
		throws EOFException, IOException;
	
	/**
	 * Reads data from the block and writes to the destination array.
	 *
	 * @param __addr The address to start reading from.
	 * @param __b The destination array to write values to.
	 * @param __o The offset into the array.
	 * @param __l The maximum number of bytes to read.
	 * @return The number of bytes read or a negative value if the address
	 * exceeds the bounds of the block.
	 * @throws ArrayIndexOutOfBoundsException If the offset and/or length are
	 * negative or exceeds the array bounds.
	 * @throws IOException On read errors.
	 * @throws NullPointerException On null arguments.
	 * @since 2016/12/27
	 */
	public abstract int read(long __addr, byte[] __b, int __o, int __l)
		throws ArrayIndexOutOfBoundsException, IOException,
			NullPointerException;
	
	/**
	 * Returns the number of bytes which are available for reading.
	 *
	 * @return The number of bytes in the block.
	 * @throws IOException If it could not be determined.
	 * @since 2016/12/27
	 */
	public abstract long size()
		throws IOException;
}








|

















|










|



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
	 *
	 * @param __addr The address to read from.
	 * @return The read byte.
	 * @throws EOFException If the read is past the end of file.
	 * @throws IOException On read/write errors.
	 * @since 2016/12/29
	 */
	byte read(long __addr)
		throws EOFException, IOException;
	
	/**
	 * Reads data from the block and writes to the destination array.
	 *
	 * @param __addr The address to start reading from.
	 * @param __b The destination array to write values to.
	 * @param __o The offset into the array.
	 * @param __l The maximum number of bytes to read.
	 * @return The number of bytes read or a negative value if the address
	 * exceeds the bounds of the block.
	 * @throws ArrayIndexOutOfBoundsException If the offset and/or length are
	 * negative or exceeds the array bounds.
	 * @throws IOException On read errors.
	 * @throws NullPointerException On null arguments.
	 * @since 2016/12/27
	 */
	int read(long __addr, byte[] __b, int __o, int __l)
		throws ArrayIndexOutOfBoundsException, IOException,
			NullPointerException;
	
	/**
	 * Returns the number of bytes which are available for reading.
	 *
	 * @return The number of bytes in the block.
	 * @throws IOException If it could not be determined.
	 * @since 2016/12/27
	 */
	long size()
		throws IOException;
}

Name change from runt/libs/zip/net/multiphasicapps/zip/blockreader/FileChannelBlockAccessor.java to modules/zip/src/main/java/net/multiphasicapps/zip/blockreader/FileChannelBlockAccessor.java.

82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
	{
		// {@squirreljme.error BF07 Cannot read from a negative offset.}
		if (__addr < 0)
			throw new IOException("BF07");
		
		// Just forward to the array variant
		byte[] val = new byte[1];
		int rv = read(__addr, val, 0, 1);
		
		// {@squirreljme.error BF08 Read past end of file.}
		if (rv < 0)
			throw new EOFException("BF08");
		
		return val[0];
	}







|







82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
	{
		// {@squirreljme.error BF07 Cannot read from a negative offset.}
		if (__addr < 0)
			throw new IOException("BF07");
		
		// Just forward to the array variant
		byte[] val = new byte[1];
		int rv = this.read(__addr, val, 0, 1);
		
		// {@squirreljme.error BF08 Read past end of file.}
		if (rv < 0)
			throw new EOFException("BF08");
		
		return val[0];
	}

Name change from runt/libs/zip/net/multiphasicapps/zip/blockreader/ZipBlockEntry.java to modules/zip/src/main/java/net/multiphasicapps/zip/blockreader/ZipBlockEntry.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.zip.blockreader;

import java.io.InputStream;
import java.io.IOException;
import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import net.multiphasicapps.zip.IBM437CodePage;
import net.multiphasicapps.zip.ZipCompressionType;
import net.multiphasicapps.zip.ZipException;

/**












|
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.zip.blockreader;

import java.io.IOException;
import java.io.InputStream;
import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import net.multiphasicapps.zip.IBM437CodePage;
import net.multiphasicapps.zip.ZipCompressionType;
import net.multiphasicapps.zip.ZipException;

/**
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
	
	/** The offset to the file name length. */
	private static final int _CENTRAL_DIRECTORY_NAME_LENGTH_OFFSET =
		28;
	
	/** The offset to the extra data length. */
	private static final int _CENTRAL_DIRECTORY_EXTRA_LENGTH_OFFSET =
		_CENTRAL_DIRECTORY_NAME_LENGTH_OFFSET + 2;
	
	/** The offset to the comment length. */
	private static final int _CENTRAL_DIRECTORY_COMMENT_LENGTH_OFFSET =
		_CENTRAL_DIRECTORY_EXTRA_LENGTH_OFFSET + 2;
	
	/** The relative offset to the local header. */
	private static final int _CENTRAL_DIRECTORY_LOCAL_HEADER_OFFSET =
		42;
	
	/** The minimum length of the central directory entry. */
	private static final int _CENTRAL_DIRECTORY_MIN_LENGTH =







|



|







59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
	
	/** The offset to the file name length. */
	private static final int _CENTRAL_DIRECTORY_NAME_LENGTH_OFFSET =
		28;
	
	/** The offset to the extra data length. */
	private static final int _CENTRAL_DIRECTORY_EXTRA_LENGTH_OFFSET =
		ZipBlockEntry._CENTRAL_DIRECTORY_NAME_LENGTH_OFFSET + 2;
	
	/** The offset to the comment length. */
	private static final int _CENTRAL_DIRECTORY_COMMENT_LENGTH_OFFSET =
		ZipBlockEntry._CENTRAL_DIRECTORY_EXTRA_LENGTH_OFFSET + 2;
	
	/** The relative offset to the local header. */
	private static final int _CENTRAL_DIRECTORY_LOCAL_HEADER_OFFSET =
		42;
	
	/** The minimum length of the central directory entry. */
	private static final int _CENTRAL_DIRECTORY_MIN_LENGTH =
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
	 * @throws IOException On read errors.
	 * @throws ZipException If the ZIP is malformed.
	 * @since 2017/01/03
	 */
	public boolean isDirectory()
		throws IOException, ZipException
	{
		return __internalToString().endsWith("/");
	}
	
	/**
	 * Returns the time this entry was last modified.
	 *
	 * @return The last modified time or {@code Long.MIN_VALUE} if it is not
	 * valid.







|







139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
	 * @throws IOException On read errors.
	 * @throws ZipException If the ZIP is malformed.
	 * @since 2017/01/03
	 */
	public boolean isDirectory()
		throws IOException, ZipException
	{
		return this.__internalToString().endsWith("/");
	}
	
	/**
	 * Returns the time this entry was last modified.
	 *
	 * @return The last modified time or {@code Long.MIN_VALUE} if it is not
	 * valid.
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219

220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
	 * Returns the name of this entry.
	 *
	 * @return The entry name.
	 * @since 2017/03/01
	 */
	public String name()
	{
		return toString();
	}
	
	/**
	 * Opens the input stream for this entry's data.
	 *
	 * @return The entry data.
	 * @throws IOException On read errors.
	 * @throws ZipException If it could not be opened.
	 * @since 2016/12/30
	 */
	public InputStream open()
		throws IOException, ZipException
	{
		// {@squirreljme.error BF0a Cannot open the entry because it is a
		// directory. (The name of the entry)}
		String s;
		if (isDirectory())
			throw new ZipException(String.format("BF0a %s", toString()));
		
		ZipBlockReader owner = this.owner;
		BlockAccessor accessor = this.accessor;
		long position = this.position;
		
		// {@squirreljme.error BF0b Could not read the central
		// directory data.}
		byte[] data = new byte[_CENTRAL_DIRECTORY_MIN_LENGTH];
		if (_CENTRAL_DIRECTORY_MIN_LENGTH != accessor.read(position,
			data, 0, _CENTRAL_DIRECTORY_MIN_LENGTH))
			throw new ZipException("BF0b");
		
		// The version needed to extract should not have the upper byte set
		// but some archive writing software sets the upper byte to match the
		// OS with the version in the made by bit.
		int ver = __ArrayData__.readUnsignedShort(
			_CENTRAL_DIRECTORY_EXTRACT_VERSION_OFFSET, data),
			made = __ArrayData__.readUnsignedShort(
			_CENTRAL_DIRECTORY_MADE_BY_VERSION_OFFSET, data);
		if ((ver & 0xFF00) != 0 && (made & 0xFF00) == (ver & 0xFF00))
			ver &= 0xFF;
		
		// {@squirreljme.error BF0c Cannot open the entry because it uses
		// too new of a version. (The version number)}
		if (_MAX_CENTRAL_DIR_VERSION < ver)
			throw new ZipException(String.format("BF0c %d", ver));
		
		// Need these later to determine how much data is available and how it
		// is stored.
		int method = __ArrayData__.readUnsignedShort(
				_CENTRAL_DIRECTORY_METHOD_OFFSET, data);
		int crc = __ArrayData__.readSignedInt(_CENTRAL_DIRECTORY_CRC_OFFSET,

			data);
		long uncompressed = __ArrayData__.readUnsignedInt(
				_CENTRAL_DIRECTORY_UNCOMPRESSED_OFFSET, data),
			compressed = __ArrayData__.readUnsignedInt(
				_CENTRAL_DIRECTORY_COMPRESSED_OFFSET, data);
			
		// Determine the offset to the local header which precedes the data
		// of the entry
		long lhoffset = owner._zipbaseaddr + __ArrayData__.readUnsignedInt(
			_CENTRAL_DIRECTORY_LOCAL_HEADER_OFFSET, data);
		
		// {@squirreljme.error BF0d Could not read the local file header from
		// the ZIP file.}
		byte[] header = new byte[_LOCAL_HEADER_MIN_LENGTH];
		if (_LOCAL_HEADER_MIN_LENGTH != accessor.read(lhoffset, header, 0,
			_LOCAL_HEADER_MIN_LENGTH))
			throw new ZipException("BF0d");
		
		// {@squirreljme.error BF0e The magic number for the local file header
		// is not valid.}
		if (__ArrayData__.readSignedInt(0, header) !=
			_LOCAL_HEADER_MAGIC_NUMBER)
			throw new ZipException("BF0e");
		
		// Need to know the file name and comment lengths, since they may
		// differ in the local header for some reason
		int lhfnl = __ArrayData__.readUnsignedShort(
				_LOCAL_HEADER_NAME_LENGTH_OFFSET, header), 
			lhcml = __ArrayData__.readUnsignedShort(
				_LOCAL_HEADER_COMMENT_LENGTH_OFFSET, header);
		
		// The base address of the data is after the local header position
		long database = lhoffset + _LOCAL_HEADER_MIN_LENGTH + lhfnl + lhcml;
		
		// Get base stream before compression
		InputStream base = new __BlockAccessorRegionInputStream__(accessor,
			database, compressed);
		
		// {@squirreljme.error BF0f Unknown compression method for entry. (The
		// method identifier)}







|
















|
|







|
|
|






|

|





|





|
|
>


|

|




|



|
|
|




|
<





|

|


|







162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241

242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
	 * Returns the name of this entry.
	 *
	 * @return The entry name.
	 * @since 2017/03/01
	 */
	public String name()
	{
		return this.toString();
	}
	
	/**
	 * Opens the input stream for this entry's data.
	 *
	 * @return The entry data.
	 * @throws IOException On read errors.
	 * @throws ZipException If it could not be opened.
	 * @since 2016/12/30
	 */
	public InputStream open()
		throws IOException, ZipException
	{
		// {@squirreljme.error BF0a Cannot open the entry because it is a
		// directory. (The name of the entry)}
		String s;
		if (this.isDirectory())
			throw new ZipException(String.format("BF0a %s", this.toString()));
		
		ZipBlockReader owner = this.owner;
		BlockAccessor accessor = this.accessor;
		long position = this.position;
		
		// {@squirreljme.error BF0b Could not read the central
		// directory data.}
		byte[] data = new byte[ZipBlockEntry._CENTRAL_DIRECTORY_MIN_LENGTH];
		if (ZipBlockEntry._CENTRAL_DIRECTORY_MIN_LENGTH != accessor.read(position,
			data, 0, ZipBlockEntry._CENTRAL_DIRECTORY_MIN_LENGTH))
			throw new ZipException("BF0b");
		
		// The version needed to extract should not have the upper byte set
		// but some archive writing software sets the upper byte to match the
		// OS with the version in the made by bit.
		int ver = __ArrayData__.readUnsignedShort(
			ZipBlockEntry._CENTRAL_DIRECTORY_EXTRACT_VERSION_OFFSET, data),
			made = __ArrayData__.readUnsignedShort(
				ZipBlockEntry._CENTRAL_DIRECTORY_MADE_BY_VERSION_OFFSET, data);
		if ((ver & 0xFF00) != 0 && (made & 0xFF00) == (ver & 0xFF00))
			ver &= 0xFF;
		
		// {@squirreljme.error BF0c Cannot open the entry because it uses
		// too new of a version. (The version number)}
		if (ZipBlockEntry._MAX_CENTRAL_DIR_VERSION < ver)
			throw new ZipException(String.format("BF0c %d", ver));
		
		// Need these later to determine how much data is available and how it
		// is stored.
		int method = __ArrayData__.readUnsignedShort(
			ZipBlockEntry._CENTRAL_DIRECTORY_METHOD_OFFSET, data);
		int crc = __ArrayData__.readSignedInt(
			ZipBlockEntry._CENTRAL_DIRECTORY_CRC_OFFSET,
			data);
		long uncompressed = __ArrayData__.readUnsignedInt(
			ZipBlockEntry._CENTRAL_DIRECTORY_UNCOMPRESSED_OFFSET, data),
			compressed = __ArrayData__.readUnsignedInt(
				ZipBlockEntry._CENTRAL_DIRECTORY_COMPRESSED_OFFSET, data);
			
		// Determine the offset to the local header which precedes the data
		// of the entry
		long lhoffset = owner._zipbaseaddr + __ArrayData__.readUnsignedInt(
			ZipBlockEntry._CENTRAL_DIRECTORY_LOCAL_HEADER_OFFSET, data);
		
		// {@squirreljme.error BF0d Could not read the local file header from
		// the ZIP file.}
		byte[] header = new byte[ZipBlockEntry._LOCAL_HEADER_MIN_LENGTH];
		if (ZipBlockEntry._LOCAL_HEADER_MIN_LENGTH != accessor.read(lhoffset, header, 0,
			ZipBlockEntry._LOCAL_HEADER_MIN_LENGTH))
			throw new ZipException("BF0d");
		
		// {@squirreljme.error BF0e The magic number for the local file header
		// is not valid.}
		if (__ArrayData__.readSignedInt(0, header) != ZipBlockEntry._LOCAL_HEADER_MAGIC_NUMBER)

			throw new ZipException("BF0e");
		
		// Need to know the file name and comment lengths, since they may
		// differ in the local header for some reason
		int lhfnl = __ArrayData__.readUnsignedShort(
			ZipBlockEntry._LOCAL_HEADER_NAME_LENGTH_OFFSET, header),
			lhcml = __ArrayData__.readUnsignedShort(
				ZipBlockEntry._LOCAL_HEADER_COMMENT_LENGTH_OFFSET, header);
		
		// The base address of the data is after the local header position
		long database = lhoffset + ZipBlockEntry._LOCAL_HEADER_MIN_LENGTH + lhfnl + lhcml;
		
		// Get base stream before compression
		InputStream base = new __BlockAccessorRegionInputStream__(accessor,
			database, compressed);
		
		// {@squirreljme.error BF0f Unknown compression method for entry. (The
		// method identifier)}
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
	 * @since 2016/12/30
	 */
	@Override
	public String toString()
	{
		try
		{
			return __internalToString();
		}
			
		// {@squirreljme.error BF0g Could not read the name of the
		// entry.}
		catch (IOException e)
		{
			throw new RuntimeException("BF0g", e);







|







273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
	 * @since 2016/12/30
	 */
	@Override
	public String toString()
	{
		try
		{
			return this.__internalToString();
		}
			
		// {@squirreljme.error BF0g Could not read the name of the
		// entry.}
		catch (IOException e)
		{
			throw new RuntimeException("BF0g", e);
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
		if (ref == null || null == (rv = ref.get()))
		{
			BlockAccessor accessor = this.accessor;
			long position = this.position;
			
			// {@squirreljme.error BF0h Could not read the central
			// directory data.}
			byte[] data = new byte[_CENTRAL_DIRECTORY_MIN_LENGTH];
			if (_CENTRAL_DIRECTORY_MIN_LENGTH != accessor.read(position,
				data, 0, _CENTRAL_DIRECTORY_MIN_LENGTH))
				throw new ZipException("BF0h");
			
			// Read file name length
			int fnl = __ArrayData__.readUnsignedShort(
				_CENTRAL_DIRECTORY_NAME_LENGTH_OFFSET, data);
			
			// {@squirreljme.error BF0i Could not read the file name.}
			byte[] rawname = new byte[fnl];
			if (fnl != accessor.read(
				position + _CENTRAL_DIRECTORY_MIN_LENGTH, rawname, 0, fnl))
				throw new ZipException("BF0i");
			
			// UTF-8 Encoded?
			if ((__ArrayData__.readUnsignedShort(
				_CENTRAL_DIRECTORY_FLAG_OFFSET, data) &
				GPF_ENCODING_UTF8) != 0)
				rv = new String(rawname, 0, fnl, "utf-8");
			
			// DOS codepage
			else
				rv = IBM437CodePage.toString(rawname, 0, fnl);
			
			// Store for later







|
|
|




|




|




|
<







306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330

331
332
333
334
335
336
337
		if (ref == null || null == (rv = ref.get()))
		{
			BlockAccessor accessor = this.accessor;
			long position = this.position;
			
			// {@squirreljme.error BF0h Could not read the central
			// directory data.}
			byte[] data = new byte[ZipBlockEntry._CENTRAL_DIRECTORY_MIN_LENGTH];
			if (ZipBlockEntry._CENTRAL_DIRECTORY_MIN_LENGTH != accessor.read(position,
				data, 0, ZipBlockEntry._CENTRAL_DIRECTORY_MIN_LENGTH))
				throw new ZipException("BF0h");
			
			// Read file name length
			int fnl = __ArrayData__.readUnsignedShort(
				ZipBlockEntry._CENTRAL_DIRECTORY_NAME_LENGTH_OFFSET, data);
			
			// {@squirreljme.error BF0i Could not read the file name.}
			byte[] rawname = new byte[fnl];
			if (fnl != accessor.read(
				position + ZipBlockEntry._CENTRAL_DIRECTORY_MIN_LENGTH, rawname, 0, fnl))
				throw new ZipException("BF0i");
			
			// UTF-8 Encoded?
			if ((__ArrayData__.readUnsignedShort(
				ZipBlockEntry._CENTRAL_DIRECTORY_FLAG_OFFSET, data) & ZipBlockEntry.GPF_ENCODING_UTF8) != 0)

				rv = new String(rawname, 0, fnl, "utf-8");
			
			// DOS codepage
			else
				rv = IBM437CodePage.toString(rawname, 0, fnl);
			
			// Store for later

Name change from runt/libs/zip/net/multiphasicapps/zip/blockreader/ZipBlockReader.java to modules/zip/src/main/java/net/multiphasicapps/zip/blockreader/ZipBlockReader.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.zip.blockreader;

import java.io.Closeable;
import java.io.InputStream;
import java.io.IOException;
import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import java.nio.file.Path;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.NoSuchElementException;
import net.multiphasicapps.zip.ZipException;

/**
 * This class is used to read ZIP files in a random access fashion.
 *
 * @since 2016/12/27













|
|


<
<

<







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17


18

19
20
21
22
23
24
25
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.zip.blockreader;

import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.lang.ref.Reference;
import java.lang.ref.WeakReference;


import java.util.Iterator;

import java.util.NoSuchElementException;
import net.multiphasicapps.zip.ZipException;

/**
 * This class is used to read ZIP files in a random access fashion.
 *
 * @since 2016/12/27
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
	
	/** The offset to the file name length. */
	private static final int _CENTRAL_DIRECTORY_NAME_LENGTH_OFFSET =
		28;
	
	/** The offset to the extra data length. */
	private static final int _CENTRAL_DIRECTORY_EXTRA_LENGTH_OFFSET =
		_CENTRAL_DIRECTORY_NAME_LENGTH_OFFSET + 2;
	
	/** The offset to the comment length. */
	private static final int _CENTRAL_DIRECTORY_COMMENT_LENGTH_OFFSET =
		_CENTRAL_DIRECTORY_EXTRA_LENGTH_OFFSET + 2;
	
	/** The minimum length of the central directory entry. */
	private static final int _CENTRAL_DIRECTORY_MIN_LENGTH =
		46;
	
	/** The magic number for the end directory. */
	private static final int _END_DIRECTORY_MAGIC_NUMBER =
		0x06054B50;
	
	/** The offset to the field for the number of entries in this disk. */
	private static final int _END_DIRECTORY_DISK_ENTRIES_OFFSET =
		8;
	
	/** The offset to the size of the central directory. */
	private static final int _END_DIRECTORY_CENTRAL_DIR_SIZE_OFFSET =
		_END_DIRECTORY_DISK_ENTRIES_OFFSET + 4;
	
	/** The offset to the offset of the central directory. */
	private static final int _END_DIRECTORY_CENTRAL_DIR_OFFSET_OFFSET =
		_END_DIRECTORY_CENTRAL_DIR_SIZE_OFFSET + 4;
	
	/** The minimum length of the end central directory record. */
	private static final int _END_DIRECTORY_MIN_LENGTH =
		22;
	
	/** The maximum length of the end central directory record. */
	private static final int _END_DIRECTORY_MAX_LENGTH =
		_END_DIRECTORY_MIN_LENGTH + 65535;
	
	/** The accessor to use for ZIP files. */
	protected final BlockAccessor accessor;
	
	/** The number of entries in this ZIP. */
	protected final int numentries;
	







|



|















|



|







|







33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
	
	/** The offset to the file name length. */
	private static final int _CENTRAL_DIRECTORY_NAME_LENGTH_OFFSET =
		28;
	
	/** The offset to the extra data length. */
	private static final int _CENTRAL_DIRECTORY_EXTRA_LENGTH_OFFSET =
		ZipBlockReader._CENTRAL_DIRECTORY_NAME_LENGTH_OFFSET + 2;
	
	/** The offset to the comment length. */
	private static final int _CENTRAL_DIRECTORY_COMMENT_LENGTH_OFFSET =
		ZipBlockReader._CENTRAL_DIRECTORY_EXTRA_LENGTH_OFFSET + 2;
	
	/** The minimum length of the central directory entry. */
	private static final int _CENTRAL_DIRECTORY_MIN_LENGTH =
		46;
	
	/** The magic number for the end directory. */
	private static final int _END_DIRECTORY_MAGIC_NUMBER =
		0x06054B50;
	
	/** The offset to the field for the number of entries in this disk. */
	private static final int _END_DIRECTORY_DISK_ENTRIES_OFFSET =
		8;
	
	/** The offset to the size of the central directory. */
	private static final int _END_DIRECTORY_CENTRAL_DIR_SIZE_OFFSET =
		ZipBlockReader._END_DIRECTORY_DISK_ENTRIES_OFFSET + 4;
	
	/** The offset to the offset of the central directory. */
	private static final int _END_DIRECTORY_CENTRAL_DIR_OFFSET_OFFSET =
		ZipBlockReader._END_DIRECTORY_CENTRAL_DIR_SIZE_OFFSET + 4;
	
	/** The minimum length of the end central directory record. */
	private static final int _END_DIRECTORY_MIN_LENGTH =
		22;
	
	/** The maximum length of the end central directory record. */
	private static final int _END_DIRECTORY_MAX_LENGTH =
		ZipBlockReader._END_DIRECTORY_MIN_LENGTH + 65535;
	
	/** The accessor to use for ZIP files. */
	protected final BlockAccessor accessor;
	
	/** The number of entries in this ZIP. */
	protected final int numentries;
	
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
			throw new NullPointerException("NARG");
		
		// Set
		this.accessor = __b;
		this._accessor = __b;
		
		// Locate the end of the central directory
		byte[] dirbytes = new byte[_END_DIRECTORY_MIN_LENGTH];
		long endat = __locateCentralDirEnd(__b, dirbytes);
		
		// Get the number of entries which are in this disk and not in the
		// archive as a whole, since multi-archive ZIP files are not supported
		int numentries = __ArrayData__.readUnsignedShort(
			_END_DIRECTORY_DISK_ENTRIES_OFFSET, dirbytes);
		this.numentries = numentries;
		
		// Need the size of the central directory to determine where it
		// actually starts
		long csz = __b.size();
		long cdirsize = __ArrayData__.readUnsignedInt(
			_END_DIRECTORY_CENTRAL_DIR_SIZE_OFFSET, dirbytes);
		
		// This is the position of the start of the central directory
		long cdirbase = endat - cdirsize;
		this.cdirbase = cdirbase;
		
		// {@squirreljme.error BF0j The central directory is larger than the
		// ZIP file, the ZIP is truncated. (The central directory size; The
		// size of the ZIP file)}
		if (cdirsize > csz)
			throw new ZipException(String.format("BF0j %d %d", cdirsize, csz));
		
		// Determine the base address of the ZIP file since all entries
		// are relative from the start point
		long zipbaseaddr = csz - (__ArrayData__.readUnsignedInt(
			_END_DIRECTORY_CENTRAL_DIR_OFFSET_OFFSET, dirbytes) + cdirsize +
			(csz - endat));
		this._zipbaseaddr = zipbaseaddr;
		
		// {@squirreljme.error BF0k The base address of the ZIP file exceeds
		// the bound of the ZIP file. (The central directory size; The size of
		// the ZIP file)}
		if (zipbaseaddr < 0 || zipbaseaddr > csz)
			throw new ZipException(String.format("BF0k %d %d", zipbaseaddr,
				csz));
		
		// Setup entry list
		this._entries = __newEntryReferenceList(numentries);
		
		// Initialize entry offsets
		this._offsets = __readOffsets();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/12/27
	 */
	@Override







|
|




|






|














|











|


|







142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
			throw new NullPointerException("NARG");
		
		// Set
		this.accessor = __b;
		this._accessor = __b;
		
		// Locate the end of the central directory
		byte[] dirbytes = new byte[ZipBlockReader._END_DIRECTORY_MIN_LENGTH];
		long endat = ZipBlockReader.__locateCentralDirEnd(__b, dirbytes);
		
		// Get the number of entries which are in this disk and not in the
		// archive as a whole, since multi-archive ZIP files are not supported
		int numentries = __ArrayData__.readUnsignedShort(
			ZipBlockReader._END_DIRECTORY_DISK_ENTRIES_OFFSET, dirbytes);
		this.numentries = numentries;
		
		// Need the size of the central directory to determine where it
		// actually starts
		long csz = __b.size();
		long cdirsize = __ArrayData__.readUnsignedInt(
			ZipBlockReader._END_DIRECTORY_CENTRAL_DIR_SIZE_OFFSET, dirbytes);
		
		// This is the position of the start of the central directory
		long cdirbase = endat - cdirsize;
		this.cdirbase = cdirbase;
		
		// {@squirreljme.error BF0j The central directory is larger than the
		// ZIP file, the ZIP is truncated. (The central directory size; The
		// size of the ZIP file)}
		if (cdirsize > csz)
			throw new ZipException(String.format("BF0j %d %d", cdirsize, csz));
		
		// Determine the base address of the ZIP file since all entries
		// are relative from the start point
		long zipbaseaddr = csz - (__ArrayData__.readUnsignedInt(
			ZipBlockReader._END_DIRECTORY_CENTRAL_DIR_OFFSET_OFFSET, dirbytes) + cdirsize +
			(csz - endat));
		this._zipbaseaddr = zipbaseaddr;
		
		// {@squirreljme.error BF0k The base address of the ZIP file exceeds
		// the bound of the ZIP file. (The central directory size; The size of
		// the ZIP file)}
		if (zipbaseaddr < 0 || zipbaseaddr > csz)
			throw new ZipException(String.format("BF0k %d %d", zipbaseaddr,
				csz));
		
		// Setup entry list
		this._entries = ZipBlockReader.__newEntryReferenceList(numentries);
		
		// Initialize entry offsets
		this._offsets = this.__readOffsets();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2016/12/27
	 */
	@Override
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
	 * @since 2016/12/30
	 */
	public boolean contains(String __s)
		throws IOException, NullPointerException
	{
		try
		{
			return get(__s) != null;
		}
		
		// Does not exist
		catch (ZipEntryNotFoundException e)
		{
			return false;
		}







|







213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
	 * @since 2016/12/30
	 */
	public boolean contains(String __s)
		throws IOException, NullPointerException
	{
		try
		{
			return this.get(__s) != null;
		}
		
		// Does not exist
		catch (ZipEntryNotFoundException e)
		{
			return false;
		}
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
	 * @since 2016/12/30
	 */
	public InputStream open(String __s)
		throws IOException, NullPointerException, ZipEntryNotFoundException
	{
		// {@squirreljme.error BF0m The specified entry does not exist
		// within the ZIP file. (The entry name)}
		ZipBlockEntry ent = get(__s);
		if (ent == null)
			throw new ZipEntryNotFoundException(String.format("BF0m %s", __s));
		
		// Open it
		return ent.open();
	}
	







|







276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
	 * @since 2016/12/30
	 */
	public InputStream open(String __s)
		throws IOException, NullPointerException, ZipEntryNotFoundException
	{
		// {@squirreljme.error BF0m The specified entry does not exist
		// within the ZIP file. (The entry name)}
		ZipBlockEntry ent = this.get(__s);
		if (ent == null)
			throw new ZipEntryNotFoundException(String.format("BF0m %s", __s));
		
		// Open it
		return ent.open();
	}
	
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
		// Setup return value
		int numentries = this.numentries;
		long[] rv = new long[numentries];
		
		// Read in every entry within the ZIP
		BlockAccessor accessor = this.accessor;
		long at = this.cdirbase;
		byte[] cdirent = new byte[_CENTRAL_DIRECTORY_MIN_LENGTH];
		for (int i = 0; i < numentries; i++)
		{
			// Entry is placed at this position
			rv[i] = at;
			
			// {@squirreljme.error BF0n Central directory extends past the end
			// of the file. (The current entry; The current read position; The
			// size of the file)}
			if (accessor.read(at, cdirent, 0, _CENTRAL_DIRECTORY_MIN_LENGTH) !=
				_CENTRAL_DIRECTORY_MIN_LENGTH)
				throw new ZipException(String.format("BF0n %d %d %d", i, at,
					accessor.size()));
			
			// {@squirreljme.error BF0o The entry does not have a valid
			// magic number. (The entry index)}
			if (__ArrayData__.readSignedInt(0, cdirent) !=
				_CENTRAL_DIRECTORY_MAGIC_NUMBER)
				throw new ZipException(String.format("BF0o %d", i));
			
			// Read lengths for file name, comment, and extra data
			int fnl = __ArrayData__.readUnsignedShort(
					_CENTRAL_DIRECTORY_NAME_LENGTH_OFFSET, cdirent),
				cml = __ArrayData__.readUnsignedShort(
					_CENTRAL_DIRECTORY_EXTRA_LENGTH_OFFSET, cdirent),
				edl = __ArrayData__.readUnsignedShort(
					_CENTRAL_DIRECTORY_COMMENT_LENGTH_OFFSET, cdirent);
			
			// Next entry is just after this point
			at += fnl + cml + edl + _CENTRAL_DIRECTORY_MIN_LENGTH;
		}
		
		// Done
		return rv;
	}
	
	/**







|








|
|





|
<




|

|

|


|







312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335

336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
		// Setup return value
		int numentries = this.numentries;
		long[] rv = new long[numentries];
		
		// Read in every entry within the ZIP
		BlockAccessor accessor = this.accessor;
		long at = this.cdirbase;
		byte[] cdirent = new byte[ZipBlockReader._CENTRAL_DIRECTORY_MIN_LENGTH];
		for (int i = 0; i < numentries; i++)
		{
			// Entry is placed at this position
			rv[i] = at;
			
			// {@squirreljme.error BF0n Central directory extends past the end
			// of the file. (The current entry; The current read position; The
			// size of the file)}
			if (accessor.read(at, cdirent, 0,
				ZipBlockReader._CENTRAL_DIRECTORY_MIN_LENGTH) != ZipBlockReader._CENTRAL_DIRECTORY_MIN_LENGTH)
				throw new ZipException(String.format("BF0n %d %d %d", i, at,
					accessor.size()));
			
			// {@squirreljme.error BF0o The entry does not have a valid
			// magic number. (The entry index)}
			if (__ArrayData__.readSignedInt(0, cdirent) != ZipBlockReader._CENTRAL_DIRECTORY_MAGIC_NUMBER)

				throw new ZipException(String.format("BF0o %d", i));
			
			// Read lengths for file name, comment, and extra data
			int fnl = __ArrayData__.readUnsignedShort(
				ZipBlockReader._CENTRAL_DIRECTORY_NAME_LENGTH_OFFSET, cdirent),
				cml = __ArrayData__.readUnsignedShort(
					ZipBlockReader._CENTRAL_DIRECTORY_EXTRA_LENGTH_OFFSET, cdirent),
				edl = __ArrayData__.readUnsignedShort(
					ZipBlockReader._CENTRAL_DIRECTORY_COMMENT_LENGTH_OFFSET, cdirent);
			
			// Next entry is just after this point
			at += fnl + cml + edl + ZipBlockReader._CENTRAL_DIRECTORY_MIN_LENGTH;
		}
		
		// Done
		return rv;
	}
	
	/**
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402

403
404
405
406
407
408
409
		// Check
		if (__b == null || __db == null)
			throw new NullPointerException("NARG");
		
		// {@squirreljme.error BF0p The file is too small to be a ZIP file.
		// (The size of file)}
		long size = __b.size();
		if (size < _END_DIRECTORY_MIN_LENGTH)
			throw new ZipException(String.format("BF0p %d", size));
		
		// Constantly search for the end of the central directory
		for (long at = size - _END_DIRECTORY_MIN_LENGTH, end =
			Math.max(0, size - _END_DIRECTORY_MAX_LENGTH); at >= end; at--)
		{
			// Read single byte to determine if it might start a header
			byte b = __b.read(at);
			if (b != 0x50)
				continue;
			
			// Read entire buffer (but not the comment in)
			__b.read(at, __db, 0, _END_DIRECTORY_MIN_LENGTH);
			
			// Need to check the magic number
			if (__ArrayData__.readSignedInt(0, __db) !=
				_END_DIRECTORY_MAGIC_NUMBER)
				continue;
			
			// Length must match the end also
			if (__ArrayData__.readUnsignedShort(_END_DIRECTORY_MIN_LENGTH - 2,
				__db) != (size - (at + _END_DIRECTORY_MIN_LENGTH)))

				continue;
			
			// Central directory is here
			return at;
		}
		
		// {@squirreljme.error BF0q Could not find the end of the central







|



|
|







|


|
<



|
|
>







369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392

393
394
395
396
397
398
399
400
401
402
403
404
405
		// Check
		if (__b == null || __db == null)
			throw new NullPointerException("NARG");
		
		// {@squirreljme.error BF0p The file is too small to be a ZIP file.
		// (The size of file)}
		long size = __b.size();
		if (size < ZipBlockReader._END_DIRECTORY_MIN_LENGTH)
			throw new ZipException(String.format("BF0p %d", size));
		
		// Constantly search for the end of the central directory
		for (long at = size - ZipBlockReader._END_DIRECTORY_MIN_LENGTH, end =
			 Math.max(0, size - ZipBlockReader._END_DIRECTORY_MAX_LENGTH); at >= end; at--)
		{
			// Read single byte to determine if it might start a header
			byte b = __b.read(at);
			if (b != 0x50)
				continue;
			
			// Read entire buffer (but not the comment in)
			__b.read(at, __db, 0, ZipBlockReader._END_DIRECTORY_MIN_LENGTH);
			
			// Need to check the magic number
			if (__ArrayData__.readSignedInt(0, __db) != ZipBlockReader._END_DIRECTORY_MAGIC_NUMBER)

				continue;
			
			// Length must match the end also
			if (__ArrayData__.readUnsignedShort(
				ZipBlockReader._END_DIRECTORY_MIN_LENGTH - 2,
				__db) != (size - (at + ZipBlockReader._END_DIRECTORY_MIN_LENGTH)))
				continue;
			
			// Central directory is here
			return at;
		}
		
		// {@squirreljme.error BF0q Could not find the end of the central

Name change from runt/libs/zip/net/multiphasicapps/zip/blockreader/ZipEntryNotFoundException.java to modules/zip/src/main/java/net/multiphasicapps/zip/blockreader/ZipEntryNotFoundException.java.

Name change from runt/libs/zip/net/multiphasicapps/zip/blockreader/__ArrayData__.java to modules/zip/src/main/java/net/multiphasicapps/zip/blockreader/__ArrayData__.java.

Name change from runt/libs/zip/net/multiphasicapps/zip/blockreader/__BlockAccessorRegionInputStream__.java to modules/zip/src/main/java/net/multiphasicapps/zip/blockreader/__BlockAccessorRegionInputStream__.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.zip.blockreader;

import java.io.InputStream;
import java.io.IOException;

/**
 * This is used to read directly from the block accessor.
 *
 * @since 2017/01/03
 */
class __BlockAccessorRegionInputStream__












|
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.zip.blockreader;

import java.io.IOException;
import java.io.InputStream;

/**
 * This is used to read directly from the block accessor.
 *
 * @since 2017/01/03
 */
class __BlockAccessorRegionInputStream__
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
	 * Initializes the block region input.
	 *
	 * @param __ba The block accessor to read data from.
	 * @param __start The start address of the read.
	 * @param __len The number of bytes to read.
	 * @throws IllegalArgumentException If the start and/or length are
	 * negative.
	 * @thorws NullPointerException On null arguments.
	 * @since 2017/01/03
	 */
	__BlockAccessorRegionInputStream__(BlockAccessor __ba, long __start,
		long __len)
		throws IllegalArgumentException, NullPointerException
	{
		// Check







|







34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
	 * Initializes the block region input.
	 *
	 * @param __ba The block accessor to read data from.
	 * @param __start The start address of the read.
	 * @param __len The number of bytes to read.
	 * @throws IllegalArgumentException If the start and/or length are
	 * negative.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/01/03
	 */
	__BlockAccessorRegionInputStream__(BlockAccessor __ba, long __start,
		long __len)
		throws IllegalArgumentException, NullPointerException
	{
		// Check
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
	public int read()
		throws IOException
	{
		// Forward to multi-byte version
		byte[] b = new byte[1];
		for (;;)
		{
			int rv = read(b, 0, 1);
			
			// EOF?
			if (rv < 0)
				return -1;
			
			// Return value otherwise
			return b[0] & 0xFF;
		}
	}
	
	/**
	 * {@inheritDoc]
	 * @since 2017/01/03
	 */
	@Override
	public int read(byte[] __b, int __o, int __l)
		throws ArrayIndexOutOfBoundsException, IOException,
			NullPointerException
	{







|











|







80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
	public int read()
		throws IOException
	{
		// Forward to multi-byte version
		byte[] b = new byte[1];
		for (;;)
		{
			int rv = this.read(b, 0, 1);
			
			// EOF?
			if (rv < 0)
				return -1;
			
			// Return value otherwise
			return b[0] & 0xFF;
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/01/03
	 */
	@Override
	public int read(byte[] __b, int __o, int __l)
		throws ArrayIndexOutOfBoundsException, IOException,
			NullPointerException
	{

Name change from runt/libs/zip/net/multiphasicapps/zip/blockreader/__CRCInputStream__.java to modules/zip/src/main/java/net/multiphasicapps/zip/blockreader/__CRCInputStream__.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.zip.blockreader;

import java.io.InputStream;
import java.io.IOException;
import net.multiphasicapps.io.CRC32Calculator;
import net.multiphasicapps.zip.ZipCRCConstants;

/**
 * This is used to check that the CRC is valid.
 *
 * @since 2017/01/03












|
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.zip.blockreader;

import java.io.IOException;
import java.io.InputStream;
import net.multiphasicapps.io.CRC32Calculator;
import net.multiphasicapps.zip.ZipCRCConstants;

/**
 * This is used to check that the CRC is valid.
 *
 * @since 2017/01/03
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
		
		// Set
		this.in = __in;
		this.crc = __crc;
	}
	
	/**
	 * {@inheritDoc]
	 * @since 2017/01/03
	 */
	@Override
	public int available()
		throws IOException
	{
		// Forward as it may be calculable
		return this.in.available();
	}
	
	/**
	 * {@inheritDoc]
	 * @since 2017/01/03
	 */
	@Override
	public void close()
		throws IOException
	{
		// Forward
		this.in.close();
	}
	
	/**
	 * {@inheritDoc]
	 * @since 2017/01/03
	 */
	@Override
	public int read()
		throws IOException
	{
		// Read in







|











|











|







56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
		
		// Set
		this.in = __in;
		this.crc = __crc;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/01/03
	 */
	@Override
	public int available()
		throws IOException
	{
		// Forward as it may be calculable
		return this.in.available();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/01/03
	 */
	@Override
	public void close()
		throws IOException
	{
		// Forward
		this.in.close();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/01/03
	 */
	@Override
	public int read()
		throws IOException
	{
		// Read in
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
		this._count += 1;
		
		// Return
		return rv;
	}
	
	/**
	 * {@inheritDoc]
	 * @since 2017/01/03
	 */
	@Override
	public int read(byte[] __b, int __o, int __l)
		throws ArrayIndexOutOfBoundsException, IOException,
			NullPointerException
	{







|







114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
		this._count += 1;
		
		// Return
		return rv;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/01/03
	 */
	@Override
	public int read(byte[] __b, int __o, int __l)
		throws ArrayIndexOutOfBoundsException, IOException,
			NullPointerException
	{

Name change from runt/libs/zip/net/multiphasicapps/zip/blockreader/package-info.java to modules/zip/src/main/java/net/multiphasicapps/zip/blockreader/package-info.java.

Name change from runt/libs/zip/net/multiphasicapps/zip/package-info.java to modules/zip/src/main/java/net/multiphasicapps/zip/package-info.java.

Name change from runt/libs/zip/net/multiphasicapps/zip/streamreader/ZipStreamEntry.java to modules/zip/src/main/java/net/multiphasicapps/zip/streamreader/ZipStreamEntry.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.zip.streamreader;

import java.io.InputStream;
import java.io.IOException;
import net.multiphasicapps.io.CRC32Calculator;
import net.multiphasicapps.io.DecompressionInputStream;
import net.multiphasicapps.io.DynamicHistoryInputStream;
import net.multiphasicapps.zip.ZipCompressionType;
import net.multiphasicapps.zip.ZipCRCConstants;
import net.multiphasicapps.zip.ZipException;

/**
 * This provides an interface to interact with a single entry within a ZIP
 * stream.
 *
 * This class is not thread safe.












|
|



|
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.zip.streamreader;

import java.io.IOException;
import java.io.InputStream;
import net.multiphasicapps.io.CRC32Calculator;
import net.multiphasicapps.io.DecompressionInputStream;
import net.multiphasicapps.io.DynamicHistoryInputStream;
import net.multiphasicapps.zip.ZipCRCConstants;
import net.multiphasicapps.zip.ZipCompressionType;
import net.multiphasicapps.zip.ZipException;

/**
 * This provides an interface to interact with a single entry within a ZIP
 * stream.
 *
 * This class is not thread safe.
128
129
130
131
132
133
134
135

136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
		DecompressionInputStream dis;
		this.cin = (dis = __method.inputStream(__ins, this.crc));
		this.undefined = __undef;
		this.detectseof = dis.detectsEOF();
		this.expectedcrc = __crc;
		this.expecteduncompsize = __uncomp;
		this.expectedcompsize = __comp;
		this._peeking = (__undef ? new byte[_MAX_DESCRIPTOR_SIZE] : null);

	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/08/22
	 */
	@Override
	public void close()
		throws IOException
	{
		if (!this._closed)
		{
			// Mark closed
			this._closed = true;
			
			// Read all input bytes until EOF, except when EOF was already
			// reached
			if (!this._eof)
			{
				byte[] buf = new byte[512];
				while (read(buf) >= 0)
					;
			}
			
			// Tell the ZIP reader that this entry is gone and the next
			// can be read
			this.zipreader.__closeEntry(this);
		}







|
>



















|
|







128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
		DecompressionInputStream dis;
		this.cin = (dis = __method.inputStream(__ins, this.crc));
		this.undefined = __undef;
		this.detectseof = dis.detectsEOF();
		this.expectedcrc = __crc;
		this.expecteduncompsize = __uncomp;
		this.expectedcompsize = __comp;
		this._peeking = (__undef ?
			new byte[ZipStreamEntry._MAX_DESCRIPTOR_SIZE] : null);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/08/22
	 */
	@Override
	public void close()
		throws IOException
	{
		if (!this._closed)
		{
			// Mark closed
			this._closed = true;
			
			// Read all input bytes until EOF, except when EOF was already
			// reached
			if (!this._eof)
			{
				byte[] buf = new byte[4096];
				while (this.read(buf) >= 0)
					;
			}
			
			// Tell the ZIP reader that this entry is gone and the next
			// can be read
			this.zipreader.__closeEntry(this);
		}
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214











215
216
217
218
219
220
221
	public int read()
		throws IOException
	{
		// Try reading a single byte
		byte[] solo = this._solo;
		for (;;)
		{
			int rv = read(solo, 0, 1);
			
			// EOF?
			if (rv < 0)
				return rv;
			
			// Try again
			else if (rv == 0)
				continue;
			
			// Return that byte
			else
				return (solo[0] & 0xFF);
		}
	}











	
	/**
	 * {@inheritDoc}
	 * @since 2017/08/22
	 */
	@Override
	public int read(byte[] __b, int __o, int __l)







|














>
>
>
>
>
>
>
>
>
>
>







194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
	public int read()
		throws IOException
	{
		// Try reading a single byte
		byte[] solo = this._solo;
		for (;;)
		{
			int rv = this.read(solo, 0, 1);
			
			// EOF?
			if (rv < 0)
				return rv;
			
			// Try again
			else if (rv == 0)
				continue;
			
			// Return that byte
			else
				return (solo[0] & 0xFF);
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2020/02/29
	 */
	@Override
	public int read(byte[] __b)
		throws IOException, NullPointerException
	{
		return this.read(__b, 0, __b.length);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/08/22
	 */
	@Override
	public int read(byte[] __b, int __o, int __l)
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273




274



275
276
277
278
279
280
281
282
		// If so then a data descriptor will need to be checked
		if (this.undefined)
		{
			// If EOF is detectable then read in the contents until such
			// things occur. Then read the data descriptor to verify that it
			// actually is correct
			if (this.detectseof)
				return __detectedRead(__b, __o, __l);
			
			// Otherwise, the input stream has to be peeked constantly to
			// detect the data descriptor.
			else
				return __probingRead(__b, __o, __l);
		}
		
		// Read of a defined number of bytes
		else
			return __definedRead(__b, __o, __l);
	}
	
	/**
	 * This is a read of input which has a defined size.
	 *
	 * @param __b The array to read into.
	 * @param __o The offset into the array.
	 * @param __l The number of bytes to potentially read.
	 * @return The number of bytes read.
	 * @throws IOException On read errors.
	 * @since 2017/08/23
	 */
	private int __definedRead(byte[] __b, int __o, int __l)
		throws IOException
	{
		// Needed to check things
		DecompressionInputStream cin = this.cin;
		long cinusz = cin.uncompressedBytes(),
			cincsz = cin.compressedBytes();
		




		// Never read more than the maximum in unsigned bytes



		int rest = (int)(this.expecteduncompsize - cinusz);
		if (__l > rest)
			__l = rest;
		
		// Read data
		int rc = this.cin.read(__b, __o, __l);
		
		// EOF reached?







|




|




|




















>
>
>
>
|
>
>
>
|







248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
		// If so then a data descriptor will need to be checked
		if (this.undefined)
		{
			// If EOF is detectable then read in the contents until such
			// things occur. Then read the data descriptor to verify that it
			// actually is correct
			if (this.detectseof)
				return this.__detectedRead(__b, __o, __l);
			
			// Otherwise, the input stream has to be peeked constantly to
			// detect the data descriptor.
			else
				return this.__probingRead(__b, __o, __l);
		}
		
		// Read of a defined number of bytes
		else
			return this.__definedRead(__b, __o, __l);
	}
	
	/**
	 * This is a read of input which has a defined size.
	 *
	 * @param __b The array to read into.
	 * @param __o The offset into the array.
	 * @param __l The number of bytes to potentially read.
	 * @return The number of bytes read.
	 * @throws IOException On read errors.
	 * @since 2017/08/23
	 */
	private int __definedRead(byte[] __b, int __o, int __l)
		throws IOException
	{
		// Needed to check things
		DecompressionInputStream cin = this.cin;
		long cinusz = cin.uncompressedBytes(),
			cincsz = cin.compressedBytes();
		
		// Determine remaining counts
		int remun = (int)(this.expecteduncompsize - cinusz);
		int remco = (int)(this.expectedcompsize - cincsz);
		
		// Never read more than the maximum in unsigned bytes, however
		// we want to read as many compressed bytes as possible because streams
		// which are completely empty with otherwise never read the ending
		// bytes if the streams are empty.
		int rest = (remun == 0 ? remco : remun);
		if (__l > rest)
			__l = rest;
		
		// Read data
		int rc = this.cin.read(__b, __o, __l);
		
		// EOF reached?
303
304
305
306
307
308
309










310
311
312
313
314
315
316
					crc.checksum(), expecteduncompsize, cinusz,
					expectedcompsize, cincsz));
			
			// Nothing read
			return -1;
		}
		










		// Mark as read
		this._readuncomp += rc;
		return rc;
	}
	
	/**
	 * Read of undefined size data, but where the EOF is detectable.







>
>
>
>
>
>
>
>
>
>







322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
					crc.checksum(), expecteduncompsize, cinusz,
					expectedcompsize, cincsz));
			
			// Nothing read
			return -1;
		}
		
		// {@squirreljme.error BF72 While reading an exact-size entry no
		// compressed data was read and EOF was not returned, it is possible
		// that the ZIP is corrupted. (Expected compressed size; Currently
		// read uncompressed bytes/The expected uncompressed size; Currently
		// read compressed bytes/The expected compressed size; The file)}
		else if (rc == 0 && rest == 0)
			throw new ZipException(String.format("BF72 %d (%d/%d) (%d/%d) %s",
				this.expecteduncompsize, cinusz, this.expecteduncompsize,
				cincsz, this.expectedcompsize, this.filename));
		
		// Mark as read
		this._readuncomp += rc;
		return rc;
	}
	
	/**
	 * Read of undefined size data, but where the EOF is detectable.
327
328
329
330
331
332
333



334

335
336
337
338
339
340
341
342
343
344
345
346
347

348
349
350
351
352
353
354
355
356
357
358
359
	{
		// This is as simple as reading the input bytes
		DecompressionInputStream cin = this.cin;
		int rc = cin.read(__b, __o, __l);
		
		// If EOF was not reached, then just return with the read bytes
		if (rc >= 0)



			return rc;

		
		// EOF was reached from the compressed stream, so the data descriptor
		// has to immedietly follow
		DynamicHistoryInputStream dhin = this.dhin;
		byte[] peeking = this._peeking;
		
		// Mark EOF so future reads fail
		this._eof = true;
		
		// {@squirreljme.error BF0v Could not find end of entry because the
		// entry exceeds the bounds of the ZIP file. (The number of read
		// bytes)}
		int probed = dhin.peek(0, peeking, 0, _MAX_DESCRIPTOR_SIZE);

		if (probed < _HEADERLESS_DESCRIPTOR_SIZE)
			throw new ZipException(String.format("BF0v %d", probed));
		
		// The specification says the descriptor is optional
		int offset = (_DESCRIPTOR_MAGIC_NUMBER ==
			ZipStreamReader.__readInt(peeking, 0) ? 4 : 0);

		// Read descriptor fields
		int ddcrc = ZipStreamReader.__readInt(peeking, offset),
			ddcomp = ZipStreamReader.__readInt(peeking, offset + 4),
			dduncomp = ZipStreamReader.__readInt(peeking, offset + 8);








>
>
>

>












|
>
|



|







356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
	{
		// This is as simple as reading the input bytes
		DecompressionInputStream cin = this.cin;
		int rc = cin.read(__b, __o, __l);
		
		// If EOF was not reached, then just return with the read bytes
		if (rc >= 0)
		{
			if (rc == 0 && this._eof)
				return -1;
			return rc;
		}
		
		// EOF was reached from the compressed stream, so the data descriptor
		// has to immedietly follow
		DynamicHistoryInputStream dhin = this.dhin;
		byte[] peeking = this._peeking;
		
		// Mark EOF so future reads fail
		this._eof = true;
		
		// {@squirreljme.error BF0v Could not find end of entry because the
		// entry exceeds the bounds of the ZIP file. (The number of read
		// bytes)}
		int probed = dhin.peek(0, peeking, 0,
			ZipStreamEntry._MAX_DESCRIPTOR_SIZE);
		if (probed < ZipStreamEntry._HEADERLESS_DESCRIPTOR_SIZE)
			throw new ZipException(String.format("BF0v %d", probed));
		
		// The specification says the descriptor is optional
		int offset = (ZipStreamEntry._DESCRIPTOR_MAGIC_NUMBER ==
			ZipStreamReader.__readInt(peeking, 0) ? 4 : 0);

		// Read descriptor fields
		int ddcrc = ZipStreamReader.__readInt(peeking, offset),
			ddcomp = ZipStreamReader.__readInt(peeking, offset + 4),
			dduncomp = ZipStreamReader.__readInt(peeking, offset + 8);

402
403
404
405
406
407
408
409

410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442


443
444
445
446
		// introduces much overhead
		int d = 0;
		for (int i = __o, e = __o + __l; i < e; i++, d++)
		{
			// {@squirreljme.error BF0x Could not find end of entry because the
			// entry exceeds the bounds of the ZIP file. (The number of read
			// bytes)}
			int probed = dhin.peek(0, peeking, 0, _MAX_DESCRIPTOR_SIZE);

			if (probed < _HEADERLESS_DESCRIPTOR_SIZE)
				throw new ZipException(String.format("BF0x %d", probed));
		
			// According to the specification, the magic number is optional and
			// might not be specified
			// Regardless if it is or not, potentially skip it
			int offset = (_DESCRIPTOR_MAGIC_NUMBER ==
				ZipStreamReader.__readInt(peeking, 0) ? 4 : 0);
		
			// Read descriptor fields
			int ddcrc = ZipStreamReader.__readInt(peeking, offset),
				ddcomp = ZipStreamReader.__readInt(peeking, offset + 4),
				dduncomp = ZipStreamReader.__readInt(peeking, offset + 8);
			
			// EOF occurs?
			if (ddcomp == cin.compressedBytes() &&
				dduncomp == cin.uncompressedBytes() &&
				ddcrc == crc.checksum())
			{
				// Mark EOF
				this._eof = true;
				return (d == 0 ? -1 : d);
			}
			
			// {@squirreljme.error BF0y Reached end of file before the end
			// of the ZIP entry could be found.}
			int rc = cin.read();
			if (rc < 0)
				throw new ZipException("BF0y");
			__b[i] = (byte)rc; 
		}
		
		// Read count


		return d;
	}
}








|
>
|





|














|











>
>




436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
		// introduces much overhead
		int d = 0;
		for (int i = __o, e = __o + __l; i < e; i++, d++)
		{
			// {@squirreljme.error BF0x Could not find end of entry because the
			// entry exceeds the bounds of the ZIP file. (The number of read
			// bytes)}
			int probed = dhin.peek(0, peeking, 0,
				ZipStreamEntry._MAX_DESCRIPTOR_SIZE);
			if (probed < ZipStreamEntry._HEADERLESS_DESCRIPTOR_SIZE)
				throw new ZipException(String.format("BF0x %d", probed));
		
			// According to the specification, the magic number is optional and
			// might not be specified
			// Regardless if it is or not, potentially skip it
			int offset = (ZipStreamEntry._DESCRIPTOR_MAGIC_NUMBER ==
				ZipStreamReader.__readInt(peeking, 0) ? 4 : 0);
		
			// Read descriptor fields
			int ddcrc = ZipStreamReader.__readInt(peeking, offset),
				ddcomp = ZipStreamReader.__readInt(peeking, offset + 4),
				dduncomp = ZipStreamReader.__readInt(peeking, offset + 8);
			
			// EOF occurs?
			if (ddcomp == cin.compressedBytes() &&
				dduncomp == cin.uncompressedBytes() &&
				ddcrc == crc.checksum())
			{
				// Mark EOF
				this._eof = true;
				return (d <= 0 ? -1 : d);
			}
			
			// {@squirreljme.error BF0y Reached end of file before the end
			// of the ZIP entry could be found.}
			int rc = cin.read();
			if (rc < 0)
				throw new ZipException("BF0y");
			__b[i] = (byte)rc; 
		}
		
		// Read count
		if (d == 0 && this._eof)
			return -1;
		return d;
	}
}

Name change from runt/libs/zip/net/multiphasicapps/zip/streamreader/ZipStreamReader.java to modules/zip/src/main/java/net/multiphasicapps/zip/streamreader/ZipStreamReader.java.

8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.zip.streamreader;

import java.io.Closeable;
import java.io.EOFException;
import java.io.InputStream;
import java.io.IOException;
import net.multiphasicapps.io.CRC32Calculator;
import net.multiphasicapps.io.DataEndianess;
import net.multiphasicapps.io.DynamicHistoryInputStream;
import net.multiphasicapps.io.ExtendedDataInputStream;
import net.multiphasicapps.zip.IBM437CodePage;
import net.multiphasicapps.zip.ZipCompressionType;
import net.multiphasicapps.zip.ZipException;








|
|
<







8
9
10
11
12
13
14
15
16

17
18
19
20
21
22
23
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.zip.streamreader;

import java.io.Closeable;
import java.io.EOFException;
import java.io.IOException;
import java.io.InputStream;

import net.multiphasicapps.io.DataEndianess;
import net.multiphasicapps.io.DynamicHistoryInputStream;
import net.multiphasicapps.io.ExtendedDataInputStream;
import net.multiphasicapps.zip.IBM437CodePage;
import net.multiphasicapps.zip.ZipCompressionType;
import net.multiphasicapps.zip.ZipException;

52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
	protected final DynamicHistoryInputStream input;
	
	/** This is used after an input structure is detected. */
	protected final ExtendedDataInputStream data;
	
	/** This can hold the local header except for the comment and filename. */
	private final byte[] _localheader =
		new byte[_MINIMUM_HEADER_SIZE];
	
	/** The current entry being read, cannot next entry if this is the case. */
	private volatile ZipStreamEntry _entry;
	
	/** End of file reached? */
	private volatile boolean _eof;
	







|







51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
	protected final DynamicHistoryInputStream input;
	
	/** This is used after an input structure is detected. */
	protected final ExtendedDataInputStream data;
	
	/** This can hold the local header except for the comment and filename. */
	private final byte[] _localheader =
		new byte[ZipStreamReader._MINIMUM_HEADER_SIZE];
	
	/** The current entry being read, cannot next entry if this is the case. */
	private volatile ZipStreamEntry _entry;
	
	/** End of file reached? */
	private volatile boolean _eof;
	
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
			if (rhcount < 4)
			{
				this._eof = true;
				return null;
			}
		
			// Does not match the magic number for local headers
			int lhskip = __skipLocalHeader(localheader);
			
			// Not one
			if (lhskip > 0)
			{
				// Read
				try
				{







|







161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
			if (rhcount < 4)
			{
				this._eof = true;
				return null;
			}
		
			// Does not match the magic number for local headers
			int lhskip = ZipStreamReader.__skipLocalHeader(localheader);
			
			// Not one
			if (lhskip > 0)
			{
				// Read
				try
				{
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
			
			// Read the rest of the header
			rhcount = input.peek(0, localheader);
			
			// EOF reached (cannot fit a local header in this many bytes)
			// Ignore the somewhat malformed ZIP since it could be part of
			// another file structure due to polyglots
			if (rhcount < _MINIMUM_HEADER_SIZE)
			{
				this._eof = true;
				return null;
			}
			
			// Deferred exception?
			ZipException defer = null;
			
			// Check the version needed for extracting
			// Note that some ZIP writing software sets the upper byte when it
			// should not. Since the made by version is not stored in the
			// local file header, the byte will just be stripped.
			int xver = __readUnsignedShort(localheader, 4) & 0xFF;
			boolean deny = false;
			deny |= (xver < 0 || xver > _MAX_EXTRACT_VERSION);
			
			// {@squirreljme.error BF11 Zip version not suppored. (The
			// version)}
			if (defer == null && deny)
				defer = new ZipException(String.format("BF11 %d",
					xver));
			
			// Read bit flags
			int gpfs = __readUnsignedShort(localheader, 6);
			boolean utf = (0 != (gpfs & (1 << 11)));
			boolean undefinedsize = (0 != (gpfs & (1 << 3)));
			
			// Cannot read encrypted entries
			deny |= (0 != (gpfs & 1));
			
			// {@squirreljme.error BF12 Encrypted entries not supported.}
			if (defer == null && deny)
				defer = new ZipException("BF12");
			
			// Read the compression method
			ZipCompressionType cmeth = ZipCompressionType.forMethod(
				__readUnsignedShort(localheader, 8));
			deny |= (cmeth == null);
			
			// {@squirreljme.error BF13 Compression method not supported.
			// (The method)}
			if (defer == null && deny)
				defer = new ZipException(String.format("BF13 %d", cmeth));
			
			// Read CRC32
			int crc = __readInt(localheader, 14);
			
			// Read Compressed size
			int csz = __readInt(localheader, 18);
			if (!undefinedsize)
				deny |= (csz < 0);
			
			// Uncompressed size
			int usz = __readInt(localheader, 22);
			if (!undefinedsize)
				deny |= (usz < 0);
			
			// {@squirreljme.error BF14 Entry exceeds 2GiB in size.
			// (The compressed size; The uncompressed size)}
			if (defer == null && deny)
				defer = new ZipException(String.format("BF14 %d %d", csz,
					usz));
			
			// File name length
			int fnl = __readUnsignedShort(localheader, 26);
			
			// Comment length
			int cml = __readUnsignedShort(localheader, 28);
			
			// If denying, read a single byte and try again, this could
			// just be very ZIP-like data or the local header number could
			// be a constant in an executable.
			if (deny)
			{
				// Defer the issue, if set







|












|

|








|












|





|


|


|




|










|


|







188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
			
			// Read the rest of the header
			rhcount = input.peek(0, localheader);
			
			// EOF reached (cannot fit a local header in this many bytes)
			// Ignore the somewhat malformed ZIP since it could be part of
			// another file structure due to polyglots
			if (rhcount < ZipStreamReader._MINIMUM_HEADER_SIZE)
			{
				this._eof = true;
				return null;
			}
			
			// Deferred exception?
			ZipException defer = null;
			
			// Check the version needed for extracting
			// Note that some ZIP writing software sets the upper byte when it
			// should not. Since the made by version is not stored in the
			// local file header, the byte will just be stripped.
			int xver = ZipStreamReader.__readUnsignedShort(localheader, 4) & 0xFF;
			boolean deny = false;
			deny |= (xver < 0 || xver > ZipStreamReader._MAX_EXTRACT_VERSION);
			
			// {@squirreljme.error BF11 Zip version not suppored. (The
			// version)}
			if (defer == null && deny)
				defer = new ZipException(String.format("BF11 %d",
					xver));
			
			// Read bit flags
			int gpfs = ZipStreamReader.__readUnsignedShort(localheader, 6);
			boolean utf = (0 != (gpfs & (1 << 11)));
			boolean undefinedsize = (0 != (gpfs & (1 << 3)));
			
			// Cannot read encrypted entries
			deny |= (0 != (gpfs & 1));
			
			// {@squirreljme.error BF12 Encrypted entries not supported.}
			if (defer == null && deny)
				defer = new ZipException("BF12");
			
			// Read the compression method
			ZipCompressionType cmeth = ZipCompressionType.forMethod(
				ZipStreamReader.__readUnsignedShort(localheader, 8));
			deny |= (cmeth == null);
			
			// {@squirreljme.error BF13 Compression method not supported.
			// (The method)}
			if (defer == null && deny)
				defer = new ZipException(String.format("BF13 %s", cmeth));
			
			// Read CRC32
			int crc = ZipStreamReader.__readInt(localheader, 14);
			
			// Read Compressed size
			int csz = ZipStreamReader.__readInt(localheader, 18);
			if (!undefinedsize)
				deny |= (csz < 0);
			
			// Uncompressed size
			int usz = ZipStreamReader.__readInt(localheader, 22);
			if (!undefinedsize)
				deny |= (usz < 0);
			
			// {@squirreljme.error BF14 Entry exceeds 2GiB in size.
			// (The compressed size; The uncompressed size)}
			if (defer == null && deny)
				defer = new ZipException(String.format("BF14 %d %d", csz,
					usz));
			
			// File name length
			int fnl = ZipStreamReader.__readUnsignedShort(localheader, 26);
			
			// Comment length
			int cml = ZipStreamReader.__readUnsignedShort(localheader, 28);
			
			// If denying, read a single byte and try again, this could
			// just be very ZIP-like data or the local header number could
			// be a constant in an executable.
			if (deny)
			{
				// Defer the issue, if set
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
			// Otherwise use codepage handling, Java ME only has two
			// character sets available
			else
				filename = IBM437CodePage.toString(rawname, 0, fnl);
			
			// Skip the comment
			data.readFully(localheader, 0, Math.min(cml,
				_MINIMUM_HEADER_SIZE));
			
			// Create entry so the data can actually be used
			ZipStreamEntry rv = new ZipStreamEntry(this, filename,
				undefinedsize, crc, csz, usz, cmeth, input);
			this._entry = rv;
			return rv;
		}







|







291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
			// Otherwise use codepage handling, Java ME only has two
			// character sets available
			else
				filename = IBM437CodePage.toString(rawname, 0, fnl);
			
			// Skip the comment
			data.readFully(localheader, 0, Math.min(cml,
				ZipStreamReader._MINIMUM_HEADER_SIZE));
			
			// Create entry so the data can actually be used
			ZipStreamEntry rv = new ZipStreamEntry(this, filename,
				undefinedsize, crc, csz, usz, cmeth, input);
			this._entry = rv;
			return rv;
		}

Name change from runt/libs/zip/net/multiphasicapps/zip/streamreader/package-info.java to modules/zip/src/main/java/net/multiphasicapps/zip/streamreader/package-info.java.

Name change from runt/libs/zip/net/multiphasicapps/zip/streamwriter/ZipStreamWriter.java to modules/zip/src/main/java/net/multiphasicapps/zip/streamwriter/ZipStreamWriter.java.

9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// ---------------------------------------------------------------------------

package net.multiphasicapps.zip.streamwriter;

import java.io.Closeable;
import java.io.IOException;
import java.io.OutputStream;
import java.util.Calendar;
import java.util.LinkedList;
import java.util.List;
import net.multiphasicapps.io.CRC32Calculator;
import net.multiphasicapps.io.DataEndianess;
import net.multiphasicapps.io.ExtendedDataOutputStream;
import net.multiphasicapps.zip.ZipCompressionType;
import net.multiphasicapps.zip.ZipCRCConstants;

/**
 * This class is used to write to ZIP files in an unknown and stream based
 * manner where the size of the contents is completely unknown.
 *
 * When the stream is closed, the central directory of the ZIP file will be
 * written to the end of the file.







<

<



|
|







9
10
11
12
13
14
15

16

17
18
19
20
21
22
23
24
25
26
27
28
// ---------------------------------------------------------------------------

package net.multiphasicapps.zip.streamwriter;

import java.io.Closeable;
import java.io.IOException;
import java.io.OutputStream;

import java.util.LinkedList;

import net.multiphasicapps.io.CRC32Calculator;
import net.multiphasicapps.io.DataEndianess;
import net.multiphasicapps.io.ExtendedDataOutputStream;
import net.multiphasicapps.zip.ZipCRCConstants;
import net.multiphasicapps.zip.ZipCompressionType;

/**
 * This class is used to write to ZIP files in an unknown and stream based
 * manner where the size of the contents is completely unknown.
 *
 * When the stream is closed, the central directory of the ZIP file will be
 * written to the end of the file.
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
		// Write all entries
		int bestversion = this._bestversion;
		for (__TOCEntry__ entry : toc)
		{
			// The entry position
			long epos = output.size();
			
			if (epos > _MAX_FILE_SIZE)
				throw new IOException();
			
			// Write directory header
			output.writeInt(_CENTRAL_DIRECTORY_MAGIC_NUMBER);
			
			// The created by version (use the highest version)
			output.writeShort(bestversion);
			
			// Version needed to extract
			ZipCompressionType ecomp = entry._compression;
			output.writeShort(ecomp.extractVersion());
			
			// General purpose flags
			output.writeShort(_GENERAL_PURPOSE_FLAGS);
			
			// Compression method
			output.writeShort(ecomp.method());
			
			// Date/time ZIP was created (closed)
			output.writeShort(time);
			output.writeShort(date);







|



|









|







139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
		// Write all entries
		int bestversion = this._bestversion;
		for (__TOCEntry__ entry : toc)
		{
			// The entry position
			long epos = output.size();
			
			if (epos > ZipStreamWriter._MAX_FILE_SIZE)
				throw new IOException();
			
			// Write directory header
			output.writeInt(ZipStreamWriter._CENTRAL_DIRECTORY_MAGIC_NUMBER);
			
			// The created by version (use the highest version)
			output.writeShort(bestversion);
			
			// Version needed to extract
			ZipCompressionType ecomp = entry._compression;
			output.writeShort(ecomp.extractVersion());
			
			// General purpose flags
			output.writeShort(ZipStreamWriter._GENERAL_PURPOSE_FLAGS);
			
			// Compression method
			output.writeShort(ecomp.method());
			
			// Date/time ZIP was created (closed)
			output.writeShort(time);
			output.writeShort(date);
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
			output.write(efn);
		}
		
		// The position where it ends
		long cdend = output.size();
		
		// Write magic number
		output.writeInt(_END_DIRECTORY_MAGIC_NUMBER);
		
		// Only a single disk is written
		output.writeShort(0);
		output.writeShort(0);
		
		// Number of entries on this disk and in all of them
		output.writeShort(numtoc);







|







195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
			output.write(efn);
		}
		
		// The position where it ends
		long cdend = output.size();
		
		// Write magic number
		output.writeInt(ZipStreamWriter._END_DIRECTORY_MAGIC_NUMBER);
		
		// Only a single disk is written
		output.writeShort(0);
		output.writeShort(0);
		
		// Number of entries on this disk and in all of them
		output.writeShort(numtoc);
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
	 * @throws IOException On write errors.
	 * @throws NullPointerException On null arguments.
	 * @since 2016/12/27
	 */
	public OutputStream nextEntry(String __name)
		throws IOException, NullPointerException
	{
		return nextEntry(__name, ZipCompressionType.DEFAULT_COMPRESSION);
	}
	
	/**
	 * Starts writing a new entry in the output ZIP.
	 *
	 * @param __name The name of the entry.
	 * @param __comp The compression method used.







|







241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
	 * @throws IOException On write errors.
	 * @throws NullPointerException On null arguments.
	 * @since 2016/12/27
	 */
	public OutputStream nextEntry(String __name)
		throws IOException, NullPointerException
	{
		return this.nextEntry(__name, ZipCompressionType.DEFAULT_COMPRESSION);
	}
	
	/**
	 * Starts writing a new entry in the output ZIP.
	 *
	 * @param __name The name of the entry.
	 * @param __comp The compression method used.
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
		// Setup contents
		__TOCEntry__ last = new __TOCEntry__(this.output.size(), utfname,
			__comp);
		toc.addLast(last);
		
		// Write ZIP header data
		ExtendedDataOutputStream output = this.output;
		output.writeInt(_LOCAL_FILE_MAGIC_NUMBER);
		
		// Extract version
		output.writeShort(__comp.extractVersion());
		
		// General purpose flag
		output.writeShort(_GENERAL_PURPOSE_FLAGS);
		
		// Method
		output.writeShort(__comp.method());
		
		// Modification date/time
		output.writeShort(0);
		output.writeShort(0);







|





|







294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
		// Setup contents
		__TOCEntry__ last = new __TOCEntry__(this.output.size(), utfname,
			__comp);
		toc.addLast(last);
		
		// Write ZIP header data
		ExtendedDataOutputStream output = this.output;
		output.writeInt(ZipStreamWriter._LOCAL_FILE_MAGIC_NUMBER);
		
		// Extract version
		output.writeShort(__comp.extractVersion());
		
		// General purpose flag
		output.writeShort(ZipStreamWriter._GENERAL_PURPOSE_FLAGS);
		
		// Method
		output.writeShort(__comp.method());
		
		// Modification date/time
		output.writeShort(0);
		output.writeShort(0);
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
		// Get sizes
		long uncomp = outer._size;
		long comp = inner._size;
		
		// {@squirreljme.error BF1c Either one or both of the compressed
		// or uncompressed file sizes exceeds 4GiB. (The uncompressed size;
		// The compressed size)}
		if (uncomp >= _MAX_FILE_SIZE || comp >= _MAX_FILE_SIZE)
			throw new IOException(String.format("BF1c %d %d", uncomp,
				comp));
		
		// Store sizes
		last._uncompressed = uncomp;
		last._compressed = comp;
		
		// Determine CRC
		int crc = outer.crccalc.checksum();
		last._crc = crc;
		
		// The magic number of the data descriptor is not needed, however
		// it helps prevent some abiguity when the input data stream is
		// not compressed and contains a ZIP file.
		ExtendedDataOutputStream output = this.output;
		output.writeInt(_DATA_DESCRIPTOR_MAGIC_NUMBER);
		
		// Write CRC and sizes
		output.writeInt((int)crc);
		output.writeInt((int)comp);
		output.writeInt((int)uncomp);
		
		// Clear streams to allow for next entry







|















|







374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
		// Get sizes
		long uncomp = outer._size;
		long comp = inner._size;
		
		// {@squirreljme.error BF1c Either one or both of the compressed
		// or uncompressed file sizes exceeds 4GiB. (The uncompressed size;
		// The compressed size)}
		if (uncomp >= ZipStreamWriter._MAX_FILE_SIZE || comp >= ZipStreamWriter._MAX_FILE_SIZE)
			throw new IOException(String.format("BF1c %d %d", uncomp,
				comp));
		
		// Store sizes
		last._uncompressed = uncomp;
		last._compressed = comp;
		
		// Determine CRC
		int crc = outer.crccalc.checksum();
		last._crc = crc;
		
		// The magic number of the data descriptor is not needed, however
		// it helps prevent some abiguity when the input data stream is
		// not compressed and contains a ZIP file.
		ExtendedDataOutputStream output = this.output;
		output.writeInt(ZipStreamWriter._DATA_DESCRIPTOR_MAGIC_NUMBER);
		
		// Write CRC and sizes
		output.writeInt((int)crc);
		output.writeInt((int)comp);
		output.writeInt((int)uncomp);
		
		// Clear streams to allow for next entry

Name change from runt/libs/zip/net/multiphasicapps/zip/streamwriter/__TOCEntry__.java to modules/zip/src/main/java/net/multiphasicapps/zip/streamwriter/__TOCEntry__.java.

Name change from runt/libs/zip/net/multiphasicapps/zip/streamwriter/package-info.java to modules/zip/src/main/java/net/multiphasicapps/zip/streamwriter/package-info.java.

Changes to readme.mkd.

57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
 * [Contributing to SquirrelJME](contributing.mkd)
 * _End-User Documents_
   * [Building](building.mkd)
   * [Changelog](changelog.mkd)
   * [Compatibility](compatibility.mkd)
   * [History](history.mkd)
   * [Release Roadmap](route.mkd)
   * [Usage](usage.mkd)
 * _Developer Resources_
   * [CircleCI Status](
     https://circleci.com/gh/XerTheSquirrel/SquirrelJME/tree/trunk)
   * [Developer Guide](developer-guide.mkd)
   * [Developer Notes](assets/developer-notes/index.mkd)
   * [Design Document](design.mkd)
   * [Porting SquirrelJME](porting.mkd)







<







57
58
59
60
61
62
63

64
65
66
67
68
69
70
 * [Contributing to SquirrelJME](contributing.mkd)
 * _End-User Documents_
   * [Building](building.mkd)
   * [Changelog](changelog.mkd)
   * [Compatibility](compatibility.mkd)
   * [History](history.mkd)
   * [Release Roadmap](route.mkd)

 * _Developer Resources_
   * [CircleCI Status](
     https://circleci.com/gh/XerTheSquirrel/SquirrelJME/tree/trunk)
   * [Developer Guide](developer-guide.mkd)
   * [Developer Notes](assets/developer-notes/index.mkd)
   * [Design Document](design.mkd)
   * [Porting SquirrelJME](porting.mkd)

Deleted runt/TIMESPACE.MF.

1
2
3
4
5
6
Manifest-Version: 1.0
X-SquirrelJME-Timespace-Title: Run Time
X-SquirrelJME-Timespace-Type: runtime
X-SquirrelJME-Timespace-Description: This contains everything which 
 should be available to the run-time for SquirrelJME.

<
<
<
<
<
<












Deleted runt/apis/NAMESPACE.MF.

1
2
3
4
5
6
Manifest-Version: 1.0
X-SquirrelJME-Namespace-Title: APIs
X-SquirrelJME-Namespace-Type: api
X-SquirrelJME-Namespace-Description: This namespace contains 
 definitions and/or implementations of standard APIs.

<
<
<
<
<
<












Deleted runt/apis/cldc-compact.test/META-INF/TEST.MF.

1
2
Manifest-Version: 1.0

<
<




Deleted runt/apis/cldc-compact/META-INF/MANIFEST.MF.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
Manifest-Version: 1.0
X-SquirrelJME-UUID: a41e003e-598d-4ba0-a935-33b2cf30d9cb
X-SquirrelJME-Error: ZZ
X-SquirrelJME-Name: Connection Limited Device Configuration (Compact)
X-SquirrelJME-Vendor: Stephanie Gawroriski
X-SquirrelJME-Version: 1.8
X-SquirrelJME-Group: required
X-SquirrelJME-Description: This is the standard JavaME 8 Connection 
 Limited  Device Configuration which contains the core classes used 
 by Java ME.
X-SquirrelJME-NoDependsConfiguration: true
X-SquirrelJME-DefinedConfigurations: CLDC-1.8-Compact CLDC-1.1 
 CLDC-1.0

<
<
<
<
<
<
<
<
<
<
<
<
<
<




























Deleted runt/apis/cldc/META-INF/MANIFEST.MF.

1
2
3
4
5
6
7
8
9
10
11
12
Manifest-Version: 1.0
X-SquirrelJME-UUID: cb4e0a64-b9d8-4899-995c-fcdce1749288
X-SquirrelJME-Error: ZY
X-SquirrelJME-Name: Connection Limited Device Configuration
X-SquirrelJME-Vendor: Stephanie Gawroriski
X-SquirrelJME-Version: 1.8
X-SquirrelJME-Description: This is the standard Java ME 8 Connection 
 Limited Device Configuration which contains the full set of classes 
 used by JavaME.
Microedition-Configuration: CLDC-1.8-Compact
X-SquirrelJME-DefinedConfigurations: CLDC-1.8

<
<
<
<
<
<
<
<
<
<
<
<
























Deleted runt/apis/dio-adc/META-INF/MANIFEST.MF.

1
2
3
4
5
6
7
8
9
10
11
12
Manifest-Version: 1.0
X-SquirrelJME-Type: liblet
X-SquirrelJME-Name: JavaME 8 Device I/O (ADC)
X-SquirrelJME-Vendor: Stephanie Gawroriski
X-SquirrelJME-Version: 0.3.0
X-SquirrelJME-Description: This provides access to analog to digital con
 verters.
X-SquirrelJME-Depends: dio
X-SquirrelJME-Error: CV
X-SquirrelJME-DefinedStandards: dio.adc;;1.0.1
X-SquirrelJME-UUID: ee88b4c5-ed8c-4465-805b-84b0ac6984f0
Microedition-Configuration: CLDC-1.8
<
<
<
<
<
<
<
<
<
<
<
<
























Deleted runt/apis/dio-atcmd/META-INF/MANIFEST.MF.

1
2
3
4
5
6
7
8
9
10
11
12
Manifest-Version: 1.0
X-SquirrelJME-Type: liblet
X-SquirrelJME-Name: JavaME 8 Device I/O (AT Device)
X-SquirrelJME-Vendor: Stephanie Gawroriski
X-SquirrelJME-Version: 0.3.0
X-SquirrelJME-Description: This provides access to devices which use the
  standard AT command set.
X-SquirrelJME-Depends: dio dio-modem
X-SquirrelJME-Error: CZ
X-SquirrelJME-DefinedStandards: dio.atcmd;;1.0.1
X-SquirrelJME-UUID: e7560687-abe6-428c-88cd-ec2ab5aa7640
Microedition-Configuration: CLDC-1.8
<
<
<
<
<
<
<
<
<
<
<
<
























Deleted runt/apis/dio-counter/META-INF/MANIFEST.MF.

1
2
3
4
5
6
7
8
9
10
11
Manifest-Version: 1.0
X-SquirrelJME-Type: liblet
X-SquirrelJME-Name: JavaME 8 Device I/O (Counters)
X-SquirrelJME-Vendor: Stephanie Gawroriski
X-SquirrelJME-Version: 0.3.0
X-SquirrelJME-Description: This provides access to hardware counters.
X-SquirrelJME-Depends: dio dio-gpio
X-SquirrelJME-Error: DQ
X-SquirrelJME-DefinedStandards: dio.counter;;1.0.1
X-SquirrelJME-UUID: be0423c3-2f29-4dec-abf1-d6385cdfd723
Microedition-Configuration: CLDC-1.8-Compact
<
<
<
<
<
<
<
<
<
<
<






















Deleted runt/apis/dio-dac/META-INF/MANIFEST.MF.

1
2
3
4
5
6
7
8
9
10
11
12
Manifest-Version: 1.0
X-SquirrelJME-Type: liblet
X-SquirrelJME-Name: JavaME 8 Device I/O (DAC)
X-SquirrelJME-Vendor: Stephanie Gawroriski
X-SquirrelJME-Version: 0.3.0
X-SquirrelJME-Description: This provides access to digital to analog con
 verters.
X-SquirrelJME-Depends: dio
X-SquirrelJME-Error: CW
X-SquirrelJME-DefinedStandards: dio.dac;;1.0.1
X-SquirrelJME-UUID: d5bbdfa5-192a-4921-b48a-08ecc15e8499
Microedition-Configuration: CLDC-1.8
<
<
<
<
<
<
<
<
<
<
<
<
























Deleted runt/apis/dio-generic/META-INF/MANIFEST.MF.

1
2
3
4
5
6
7
8
9
10
11
Manifest-Version: 1.0
X-SquirrelJME-Type: liblet
X-SquirrelJME-Name: JavaME 8 Device I/O (Generic)
X-SquirrelJME-Vendor: Stephanie Gawroriski
X-SquirrelJME-Version: 0.3.0
X-SquirrelJME-Description: This provides access to generic devices.
X-SquirrelJME-Depends: dio
X-SquirrelJME-Error: DS
X-SquirrelJME-DefinedStandards: dio.generic;;1.0.1
X-SquirrelJME-UUID: 8ea65d38-ad58-4ce8-9b02-1ca66a7d8adf
Microedition-Configuration: CLDC-1.8
<
<
<
<
<
<
<
<
<
<
<






















Deleted runt/apis/dio-gpio/META-INF/MANIFEST.MF.

1
2
3
4
5
6
7
8
9
10
11
Manifest-Version: 1.0
X-SquirrelJME-Type: liblet
X-SquirrelJME-Name: JavaME 8 Device I/O (GPIO)
X-SquirrelJME-Vendor: Stephanie Gawroriski
X-SquirrelJME-Version: 0.3.0
X-SquirrelJME-Description: This provides access to GPIO pins.
X-SquirrelJME-Depends: dio
X-SquirrelJME-Error: CS
X-SquirrelJME-DefinedStandards: dio.gpio;;1.0.1
X-SquirrelJME-UUID: 2edaf7ea-cdf1-497f-80d0-2a738759b21f
Microedition-Configuration: CLDC-1.8
<
<
<
<
<
<
<
<
<
<
<






















Deleted runt/apis/dio-i2cbus/META-INF/MANIFEST.MF.

1
2
3
4
5
6
7
8
9
10
11
Manifest-Version: 1.0
X-SquirrelJME-Type: liblet
X-SquirrelJME-Name: JavaME 8 Device I/O (I2C)
X-SquirrelJME-Vendor: Stephanie Gawroriski
X-SquirrelJME-Version: 0.3.0
X-SquirrelJME-Description: This provides access to the I2C bus.
X-SquirrelJME-Depends: dio
X-SquirrelJME-Error: CT
X-SquirrelJME-DefinedStandards: dio.i2cbus;;1.0.1
X-SquirrelJME-UUID: 0d788331-6b08-45b6-a506-bb61efe926a9
Microedition-Configuration: CLDC-1.8
<
<
<
<
<
<
<
<
<
<
<






















Deleted runt/apis/dio-mmio/META-INF/MANIFEST.MF.

1
2
3
4
5
6
7
8
9
10
11
12
Manifest-Version: 1.0
X-SquirrelJME-Type: liblet
X-SquirrelJME-Name: JavaME 8 Device I/O (MMIO)
X-SquirrelJME-Vendor: Stephanie Gawroriski
X-SquirrelJME-Version: 0.3.0
X-SquirrelJME-Description: This provides access to memory mapped I/O dev
 ices.
X-SquirrelJME-Depends: dio
X-SquirrelJME-Error: DT
X-SquirrelJME-DefinedStandards: dio.mmio;;1.0.1
X-SquirrelJME-UUID: 2ca1c809-eca9-41ae-94d3-b4f850a6b14f
Microedition-Configuration: CLDC-1.8
<
<
<
<
<
<
<
<
<
<
<
<
























Deleted runt/apis/dio-modem/META-INF/MANIFEST.MF.

1
2
3
4
5
6
7
8
9
10
11
Manifest-Version: 1.0
X-SquirrelJME-Type: liblet
X-SquirrelJME-Name: JavaME 8 Device I/O (Modems)
X-SquirrelJME-Vendor: Stephanie Gawroriski
X-SquirrelJME-Version: 0.3.0
X-SquirrelJME-Description: This provides access to dial-up modems.
X-SquirrelJME-Depends: dio
X-SquirrelJME-Error: CY
X-SquirrelJME-DefinedStandards: dio.modem;;1.0.1
X-SquirrelJME-UUID: 7dd14ab6-78db-43ae-8d62-78f6b94103e2
Microedition-Configuration: CLDC-1.8
<
<
<
<
<
<
<
<
<
<
<






















Deleted runt/apis/dio-pwm/META-INF/MANIFEST.MF.

1
2
3
4
5
6
7
8
9
10
11
Manifest-Version: 1.0
X-SquirrelJME-Type: liblet
X-SquirrelJME-Name: JavaME 8 Device I/O (PWM)
X-SquirrelJME-Vendor: Stephanie Gawroriski
X-SquirrelJME-Version: 0.3.0
X-SquirrelJME-Description: This provides access to PWM devices.
X-SquirrelJME-Depends: dio dio-gpio
X-SquirrelJME-Error: DR
X-SquirrelJME-DefinedStandards: dio.pwm;;1.0.1
X-SquirrelJME-UUID: 8e9685ee-2479-4d22-b5f7-12358d385225
Microedition-Configuration: CLDC-1.8-Compact
<
<
<
<
<
<
<
<
<
<
<






















Deleted runt/apis/dio-spibus/META-INF/MANIFEST.MF.

1
2
3
4
5
6
7
8
9
10
11
Manifest-Version: 1.0
X-SquirrelJME-Type: liblet
X-SquirrelJME-Name: JavaME 8 Device I/O (SPI)
X-SquirrelJME-Vendor: Stephanie Gawroriski
X-SquirrelJME-Version: 0.3.0
X-SquirrelJME-Description: This provides access to the SPI bus.
X-SquirrelJME-Depends: dio
X-SquirrelJME-Error: CU
X-SquirrelJME-DefinedStandards: dio.spibus;;1.0.1
X-SquirrelJME-UUID: a1890b74-ba77-4661-8e2a-020d36bfba34
Microedition-Configuration: CLDC-1.8
<
<
<
<
<
<
<
<
<
<
<






















Deleted runt/apis/dio-uart/META-INF/MANIFEST.MF.

1
2
3
4
5
6
7
8
9
10
11
Manifest-Version: 1.0
X-SquirrelJME-Type: liblet
X-SquirrelJME-Name: JavaME 8 Device I/O (UART)
X-SquirrelJME-Vendor: Stephanie Gawroriski
X-SquirrelJME-Version: 0.3.0
X-SquirrelJME-Description: This provides access to serial UARTs.
X-SquirrelJME-Depends: dio dio-modem
X-SquirrelJME-Error: CX
X-SquirrelJME-DefinedStandards: dio.uart;;1.0.1
X-SquirrelJME-UUID: dc4c49eb-90b2-4845-9a87-bba0d21e2160
Microedition-Configuration: CLDC-1.8-Compact
<
<
<
<
<
<
<
<
<
<
<






















Deleted runt/apis/dio-watchdog/META-INF/MANIFEST.MF.

1
2
3
4
5
6
7
8
9
10
11
Manifest-Version: 1.0
X-SquirrelJME-Type: liblet
X-SquirrelJME-Name: JavaME 8 Device I/O (Watchdog)
X-SquirrelJME-Vendor: Stephanie Gawroriski
X-SquirrelJME-Version: 0.3.0
X-SquirrelJME-Description: This provides access to the watchdog.
X-SquirrelJME-Depends: dio
X-SquirrelJME-Error: DP
X-SquirrelJME-DefinedStandards: dio.watchdog;;1.0.1
X-SquirrelJME-UUID: 0b4cb53e-3479-4133-b6f3-9de977c1e8db
Microedition-Configuration: CLDC-1.8
<
<
<
<
<
<
<
<
<
<
<






















Deleted runt/apis/dio/META-INF/MANIFEST.MF.

1
2
3
4
5
6
7
8
9
10
11
12
Manifest-Version: 1.0
X-SquirrelJME-Type: liblet
X-SquirrelJME-Name: JavaME 8 Device I/O
X-SquirrelJME-Vendor: Stephanie Gawroriski
X-SquirrelJME-Version: 0.3.0
X-SquirrelJME-Description: This provides the base support for devices 
 that may be provided by an implementation.
X-SquirrelJME-Depends: cldc
X-SquirrelJME-Error: CR
X-SquirrelJME-DefinedStandards: dio;;1.0.1
X-SquirrelJME-UUID: b45e9ac9-53bc-4e2a-9265-b5b5bca3d482
Microedition-Configuration: CLDC-1.8-Compact
<
<
<
<
<
<
<
<
<
<
<
<
























Deleted runt/apis/gcf/META-INF/MANIFEST.MF.

1
2
3
4
5
6
7
8
9
10
11
12
Manifest-Version: 1.0
X-SquirrelJME-Type: liblet
X-SquirrelJME-Name: Generic Connection Framework
X-SquirrelJME-Vendor: Stephanie Gawroriski
X-SquirrelJME-Version: 0.3.0
X-SquirrelJME-Depends: meep-midlet
X-SquirrelJME-Description: This projects contains the Generic 
 connection framework which is used to create connections to other 
 resources.
X-SquirrelJME-Error: EC
X-SquirrelJME-UUID: 1358142d-037f-4421-9a52-0534764a45d3
Microedition-Configuration: CLDC-1.8-Compact
<
<
<
<
<
<
<
<
<
<
<
<
























Deleted runt/apis/m3g/META-INF/MANIFEST.MF.

1
2
3
4
5
6
7
8
9
10
11
12
Manifest-Version: 1.0
X-SquirrelJME-Type: liblet
X-SquirrelJME-Name: Mobile 3D Graphics API
X-SquirrelJME-Vendor: Stephanie Gawroriski
X-SquirrelJME-Version: 0.3.0
X-SquirrelJME-Description: This contains an implementation of the J2ME 
 Mobile 3D Graphics API. In SquirrelJME it utilizes OpenGL ES to perform
  the rendering as required.
X-SquirrelJME-Depends: opengles
X-SquirrelJME-Error: EK
X-SquirrelJME-UUID: f9f9a2bc-de6e-4225-82c1-47b5b0523e77
Microedition-Configuration: CLDC-1.8-Compact
<
<
<
<
<
<
<
<
<
<
<
<
























Deleted runt/apis/media-api/META-INF/MANIFEST.MF.

1
2
3
4
5
6
7
8
9
10
Manifest-Version: 1.0
X-SquirrelJME-Type: liblet
X-SquirrelJME-Name: Media API
X-SquirrelJME-Vendor: Stephanie Gawroriski
X-SquirrelJME-Version: 0.3.0
X-SquirrelJME-Description: This project contains the implementation of 
 the MIDP 3.0 Media API which is also specified in JSR 135.
X-SquirrelJME-Error: EA
X-SquirrelJME-UUID: 1be6eb96-52e4-4762-a1d0-5dd95e0c9f39
Microedition-Configuration: CLDC-1.8-Compact
<
<
<
<
<
<
<
<
<
<




















Deleted runt/apis/meep-cellular/META-INF/MANIFEST.MF.

1
2
3
4
5
6
7
8
9
10
11
Manifest-Version: 1.0
X-SquirrelJME-Type: liblet
X-SquirrelJME-Name: MEEP Cellular Networking
X-SquirrelJME-Vendor: Stephanie Gawroriski
X-SquirrelJME-Version: 0.3.0
X-SquirrelJME-Description: This provides an implementation which is used
  to access cellular networks.
X-SquirrelJME-Error: DH
X-SquirrelJME-DefinedStandards: microedition.cellular;;
X-SquirrelJME-UUID: eac4a39d-b264-44ca-9e77-38a96a6e30cc
Microedition-Configuration: CLDC-1.8-Compact
<
<
<
<
<
<
<
<
<
<
<






















Deleted runt/apis/meep-concurrency/META-INF/MANIFEST.MF.

1
2
3
4
5
6
7
8
9
10
11
Manifest-Version: 1.0
X-SquirrelJME-Type: liblet
X-SquirrelJME-Name: MEEP Concurrency
X-SquirrelJME-Vendor: Stephanie Gawroriski
X-SquirrelJME-Version: 0.3.0
X-SquirrelJME-Description: The concurrency APIs allows multiple 
 applications to run at the same time.
X-SquirrelJME-Error: DK
X-SquirrelJME-DefinedStandards: microedition.concurrency;;
X-SquirrelJME-UUID: 70d937c9-e6d1-4618-a299-8182ea5e612e
Microedition-Configuration: CLDC-1.8-Compact
<
<
<
<
<
<
<
<
<
<
<






















Deleted runt/apis/meep-event/META-INF/MANIFEST.MF.

1
2
3
4
5
6
7
8
9
10
11
12
Manifest-Version: 1.0
X-SquirrelJME-Type: liblet
X-SquirrelJME-Name: MEEP Event Management
X-SquirrelJME-Vendor: Stephanie Gawroriski
X-SquirrelJME-Version: 0.3.0
X-SquirrelJME-Description: This provides an interface which allows an 
 application to receive events from the system along withsending events 
 to other running applications.
X-SquirrelJME-Error: DI
X-SquirrelJME-DefinedStandards: microedition.event;;
X-SquirrelJME-UUID: a4f80eca-c186-420b-b160-e47e612695a1
Microedition-Configuration: CLDC-1.8-Compact
<
<
<
<
<
<
<
<
<
<
<
<
























Deleted runt/apis/meep-key/META-INF/MANIFEST.MF.

1
2
3
4
5
6
7
8
9
10
11
Manifest-Version: 1.0
X-SquirrelJME-Type: liblet
X-SquirrelJME-Name: MEEP Key Events
X-SquirrelJME-Vendor: Stephanie Gawroriski
X-SquirrelJME-Version: 0.3.0
X-SquirrelJME-Description: This contains classes for handling key and 
 other user input events.
X-SquirrelJME-Error: DB
X-SquirrelJME-DefinedStandards: microedition.key;;
X-SquirrelJME-UUID: 90e52d37-a976-4f38-a194-9c65d34b6615
Microedition-Configuration: CLDC-1.8-Compact
<
<
<
<
<
<
<
<
<
<
<






















Deleted runt/apis/meep-liblets/META-INF/MANIFEST.MF.

1
2
3
4
5
6
7
8
9
10
11
Manifest-Version: 1.0
X-SquirrelJME-Type: liblet
X-SquirrelJME-Name: MEEP Application Suites and LIBlets
X-SquirrelJME-Vendor: Stephanie Gawroriski
X-SquirrelJME-Version: 0.3.0
X-SquirrelJME-Description: This provides support for application suites 
 and LIBlets.
X-SquirrelJME-Error: DL
X-SquirrelJME-DefinedStandards: microedition.liblets;;
X-SquirrelJME-UUID: aa14fb14-9806-40b6-9e27-6cc15cc2b457
Microedition-Configuration: CLDC-1.8-Compact
<
<
<
<
<
<
<
<
<
<
<






















Deleted runt/apis/meep-lui/META-INF/MANIFEST.MF.

1
2
3
4
5
6
7
8
9
10
11
12
Manifest-Version: 1.0
X-SquirrelJME-Type: liblet
X-SquirrelJME-Name: MEEP Line Based Interface
X-SquirrelJME-Vendor: Stephanie Gawroriski
X-SquirrelJME-Version: 0.3.0
X-SquirrelJME-Description: This contains the base support for the line 
 based interface.
X-SquirrelJME-Depends: meep-key collections gcf
X-SquirrelJME-Error: DA
X-SquirrelJME-DefinedStandards: microedition.lui;;
X-SquirrelJME-UUID: 67a3561d-4c0d-495e-b4b6-6ec07a9ed71b
Microedition-Configuration: CLDC-1.8-Compact
<
<
<
<
<
<
<
<
<
<
<
<
























Deleted runt/apis/meep-midlet/META-INF/MANIFEST.MF.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
Manifest-Version: 1.0
X-SquirrelJME-Type: liblet
X-SquirrelJME-Name: MEEP MIDlet Interface
X-SquirrelJME-Vendor: Stephanie Gawroriski
X-SquirrelJME-Version: 0.3.0
X-SquirrelJME-Description: This contains the MIDlet interface which 
 acts as the main entry point for all MIDlets.
X-SquirrelJME-Error: AD
X-SquirrelJME-Group: required
X-SquirrelJME-DefinedStandards: microedition.midlet;;
X-SquirrelJME-UUID: 1d9e3c4f-b0ec-4e83-b656-0454dd661868
X-SquirrelJME-Depends: tool-manifest-reader strings collections
Microedition-Configuration: CLDC-1.8-Compact

<
<
<
<
<
<
<
<
<
<
<
<
<
<




























Deleted runt/apis/meep-power/META-INF/MANIFEST.MF.

1
2
3
4
5
6
7
8
9
10
11
12
Manifest-Version: 1.0
X-SquirrelJME-Type: liblet
X-SquirrelJME-Name: MEEP Power Management
X-SquirrelJME-Vendor: Stephanie Gawroriski
X-SquirrelJME-Version: 0.3.0
X-SquirrelJME-Description: This provides support for quering the current
  electrical state of the device along with the setting of potential new
  power modes.
X-SquirrelJME-Error: DJ
X-SquirrelJME-DefinedStandards: microedition.power;;
X-SquirrelJME-UUID: 0962c312-3747-4111-8cae-1f133045cec6
Microedition-Configuration: CLDC-1.8-Compact
<
<
<
<
<
<
<
<
<
<
<
<
























Deleted runt/apis/meep-provisioning/META-INF/MANIFEST.MF.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
Manifest-Version: 1.0
X-SquirrelJME-Type: liblet
X-SquirrelJME-Name: MEEP Provisioning
X-SquirrelJME-Vendor: Stephanie Gawroriski
X-SquirrelJME-Version: 0.3.0
X-SquirrelJME-Description: This provides support for provisioning new 
 MIDlets and LIBlets which may exist on the network and can beseen in a 
 way as a remote application downloader and installerexcept by a more 
 concrete means. It is possible for applicationsto automatically be upda
 ted.
X-SquirrelJME-Error: DM
X-SquirrelJME-DefinedStandards: microedition.provisioning;;
X-SquirrelJME-UUID: 98ab129b-9ad6-4546-9782-9ef69c8f237a
Microedition-Configuration: CLDC-1.8-Compact
<
<
<
<
<
<
<
<
<
<
<
<
<
<




























Deleted runt/apis/meep-rms.test/META-INF/TEST.MF.

1
2
Manifest-Version: 1.0

<
<




Deleted runt/apis/meep-rms/META-INF/MANIFEST.MF.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
Manifest-Version: 1.0
X-SquirrelJME-Type: liblet
X-SquirrelJME-Name: MEEP Record Management System
X-SquirrelJME-Vendor: Stephanie Gawroriski
X-SquirrelJME-Version: 0.3.0
X-SquirrelJME-Description: This contains the implementation of the 
 record management system which is used to manage records whichmay be 
 used instead of the filesystem (if a filesystem is notsupported).
X-SquirrelJME-Error: DC
X-SquirrelJME-DefinedStandards: microedition.rms;;
X-SquirrelJME-UUID: e4276324-c1ea-4e3e-b264-ffac3b0e235d
X-SquirrelJME-Depends: meep-midlet tool-manifest-writer 
 meep-swm
Microedition-Configuration: CLDC-1.8
<
<
<
<
<
<
<
<
<
<
<
<
<
<




























Deleted runt/apis/meep-securityframework/META-INF/MANIFEST.MF.

1
2
3
4
5
6
7
8
9
10
11
Manifest-Version: 1.0
X-SquirrelJME-Type: liblet
X-SquirrelJME-Name: MEEP Security Framework
X-SquirrelJME-Vendor: Stephanie Gawroriski
X-SquirrelJME-Version: 0.3.0
X-SquirrelJME-Description: This is used to control and potentially grant
  or deny access to specific features that applicationsmay use.
X-SquirrelJME-Error: DO
X-SquirrelJME-DefinedStandards: microedition.securityframework;;
X-SquirrelJME-UUID: f0dbaace-ab99-4e1c-b967-959d8fa4b70a
Microedition-Configuration: CLDC-1.8-Compact
<
<
<
<
<
<
<
<
<
<
<






















Deleted runt/apis/meep-swm/META-INF/MANIFEST.MF.

1
2
3
4
5
6
7
8
9
10
11
12
13
Manifest-Version: 1.0
X-SquirrelJME-Name: MEEP Application Management System
X-SquirrelJME-Vendor: Stephanie Gawroriski
X-SquirrelJME-Version: 0.3.0
X-SquirrelJME-Description: This contains the application management 
 system, this allows programs (provided they have the correct 
 permissions) to launch other programs and install new applications 
 which may have been sourced from other locations.
X-SquirrelJME-Depends: collections meep-midlet
X-SquirrelJME-Error: DG
X-SquirrelJME-DefinedStandards: microedition.swm;;
X-SquirrelJME-UUID: 30e471c6-3fd7-4c78-b97e-0d6e3af8d0e1
Microedition-Configuration: CLDC-1.8-Compact
<
<
<
<
<
<
<
<
<
<
<
<
<


























Deleted runt/apis/midp-lcdui.test/META-INF/TEST.MF.

1
2
Manifest-Version: 1.0

<
<




Deleted runt/apis/midp-lcdui/META-INF/MANIFEST.MF.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
Manifest-Version: 1.0
X-SquirrelJME-Type: liblet
X-SquirrelJME-Name: LCDUI
X-SquirrelJME-Vendor: Stephanie Gawroriski
X-SquirrelJME-Version: 0.3.0
X-SquirrelJME-Description: This contains the standard MIDP LCD User 
 Interface which uses graphical text, widgets, and images to interact 
 with the user. Unlike the MEEP Line User Interface, this requires a 
 much more capable graphical system.
X-SquirrelJME-Depends: meep-midlet gcf io collections
X-SquirrelJME-Error: EB
X-SquirrelJME-DefinedStandards: microedition.lcdui;;
X-SquirrelJME-UUID: bdd52a0a-1d53-4d80-b54d-6ab5316603f9
Microedition-Configuration: CLDC-1.8-Compact
<
<
<
<
<
<
<
<
<
<
<
<
<
<




























Deleted runt/apis/opengles/META-INF/MANIFEST.MF.

1
2
3
4
5
6
7
8
9
10
11
Manifest-Version: 1.0
X-SquirrelJME-Type: liblet
X-SquirrelJME-Name: OpenGL ES
X-SquirrelJME-Vendor: Stephanie Gawroriski
X-SquirrelJME-Version: 0.3.0
X-SquirrelJME-Description: This project contains the base support needed
  for OpenGL ES 1.1 functionality defined by JSR 239.
X-SquirrelJME-Depends: midp-lcdui
X-SquirrelJME-Error: EJ
X-SquirrelJME-UUID: d46fcedc-9cdd-4315-87a5-6ecb1dafc2a7
Microedition-Configuration: CLDC-1.8
<
<
<
<
<
<
<
<
<
<
<






















Deleted runt/klib/NAMESPACE.MF.

1
2
3
4
5
6
7
Manifest-Version: 1.0
X-SquirrelJME-Namespace-Title: Kernel Libraries
X-SquirrelJME-Namespace-Type: liblet
X-SquirrelJME-Namespace-Description: This contains kernel libraries which 
 may be included but which should not be part of the user level system. 
 The libraries here are for system use only.

<
<
<
<
<
<
<














Deleted runt/klib/profile-meep/META-INF/MANIFEST.MF.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
Manifest-Version: 1.0
X-SquirrelJME-UUID: a825a13b-6c9e-4429-ae36-6f878abc1f6f
X-SquirrelJME-Error: AR
X-SquirrelJME-Name: MEEP 8.0 Profile
X-SquirrelJME-Vendor: Stephanie Gawroriski
X-SquirrelJME-Version: 0.3.0
X-SquirrelJME-Description: This defines the MEEP profile and is a 
 virtual project depends on others.
X-SquirrelJME-DefinedProfiles: MIDP-1.0 MIDP-2.0 MIDP-2.1 MIDP-3.0 
 MIDP-3.1 MEEP-8
X-SquirrelJME-Depends: gcf media-api meep-cellular meep-concurrency 
 meep-event meep-key meep-liblets meep-lui meep-midlet meep-power 
 meep-provisioning meep-rms meep-securityframework meep-swm 
 midp-lcdui
Microedition-Configuration: CLDC-1.8-Compact

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
































Deleted runt/klib/supervisor/META-INF/MANIFEST.MF.

1
2
3
4
5
6
7
8
9
10
11
12
Manifest-Version: 1.0
X-SquirrelJME-UUID: aad0dd9a-2cd6-4577-b085-6ad567d71bab
X-SquirrelJME-Error: SV
X-SquirrelJME-Name: SquirrelJME Supervisor
X-SquirrelJME-Vendor: Stephanie Gawroriski
X-SquirrelJME-Version: 0.3.0
X-SquirrelJME-Description: This package contains the SquirrelJME 
 supervisor which is a very small and standalone implementation of 
 the basic libraries to be as small and as minimal as possible. It 
 is responsible for the internal JVM operations.
X-SquirrelJME-NoDependsConfiguration: true

<
<
<
<
<
<
<
<
<
<
<
<
























Deleted runt/klib/supervisor/cc/squirreljme/jvm/Assembly.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm;

/**
 * This class is used special by the compiler to transform all the various
 * operations into regular instructions rather than method calls.
 *
 * The compiler will take all of the method arguments and instead use their
 * inputs and outputs from the values of registers instead. However due to
 * this, this means that these instructions are purely primitive in that
 * they must not depend on any aspect of the virtual machine.
 *
 * @since 2019/04/20
 */
public final class Assembly
{
	/**
	 * Not used.
	 *
	 * @since 2019/04/20
	 */
	private Assembly()
	{
	}
	
	/**
	 * Returns the array length of the given object.
	 *
	 * @param __o The object to get the length of.
	 * @return The length of the array.
	 * @since 2019/05/24
	 */
	public static native int arrayLength(Object __o);
	
	/**
	 * Atomic comparison and set.
	 *
	 * @param __comp The value to compare and if matches, {@code __set} is
	 * written.
	 * @param __set The value to set if matched.
	 * @param __addr The address to write to.
	 * @return The value that was read before the set.
	 * @since 2019/07/01
	 */
	public static native int atomicCompareGetAndSet(int __comp, int __set,
		int __addr);
	
	/**
	 * Atomically decrements a value and returns the result.
	 *
	 * @param __addr The address to decrement.
	 * @return The get value.
	 * @since 2019/07/01
	 */
	public static native int atomicDecrementAndGet(int __addr);
	
	/**
	 * Atomically increments a value.
	 *
	 * @param __addr The address to increment.
	 * @since 2019/07/01
	 */
	public static native void atomicIncrement(int __addr);
	
	/**
	 * Trigger breakpoint within the virtual machine.
	 *
	 * @since 2019/04/21
	 */
	public static native void breakpoint();
	
	/**
	 * Returns the class info pointer of {@code boolean}.
	 *
	 * @return The class info pointer.
	 * @since 2020/01/19
	 */
	public static native int classInfoOfBoolean();
	
	/**
	 * Returns the class info pointer of {@code byte}.
	 *
	 * @return The class info pointer.
	 * @since 2020/01/19
	 */
	public static native int classInfoOfByte();
	
	/**
	 * Returns the class info pointer of {@code char}.
	 *
	 * @return The class info pointer.
	 * @since 2020/01/19
	 */
	public static native int classInfoOfCharacter();
	
	/**
	 * Returns the class info pointer of {@code double}.
	 *
	 * @return The class info pointer.
	 * @since 2020/01/19
	 */
	public static native int classInfoOfDouble();
	
	/**
	 * Returns the class info pointer of {@code float}.
	 *
	 * @return The class info pointer.
	 * @since 2020/01/19
	 */
	public static native int classInfoOfFloat();
	
	/**
	 * Returns the class info pointer of {@code int}.
	 *
	 * @return The class info pointer.
	 * @since 2020/01/19
	 */
	public static native int classInfoOfInteger();
	
	/**
	 * Returns the class info pointer of {@code long}.
	 *
	 * @return The class info pointer.
	 * @since 2020/01/19
	 */
	public static native int classInfoOfLong();
	
	/**
	 * Returns the class info pointer of {@code short}.
	 *
	 * @return The class info pointer.
	 * @since 2020/01/19
	 */
	public static native int classInfoOfShort();
	
	/**
	 * Packs the given two integers to a double value.
	 *
	 * @param __hi The high value.
	 * @param __lo The low value.
	 * @return The double value.
	 * @since 2019/06/21
	 */
	public static native double doublePack(int __hi, int __lo);
	
	/**
	 * Double to raw long bits.
	 *
	 * @param __d The input double.
	 * @return The raw long bits.
	 * @since 2018/11/03
	 */
	public static native long doubleToRawLongBits(double __d);
	
	/**
	 * Performs explicit exception handling.
	 *
	 * @since 2019/04/28
	 */
	public static native void exceptionHandle();
	
	/**
	 * Float to raw int bits.
	 *
	 * @param __d The input float.
	 * @return The raw int bits.
	 * @since 2018/11/04
	 */
	public static native int floatToRawIntBits(float __f);
	
	/**
	 * Integer bits to float.
	 *
	 * @param __b The input bits.
	 * @return The resulting float.
	 * @since 2018/11/04
	 */
	public static native float intBitsToFloat(int __b);
	
	/**
	 * Invoke method at pointer.
	 *
	 * @param __addr The address to invoke.
	 * @since 2019/04/28
	 */
	public static native void invoke(int __addr);
	
	/**
	 * Invoke method at pointer, with arguments.
	 *
	 * @param __addr The address to invoke.
	 * @param __a Argument.
	 * @since 2019/04/28
	 */
	public static native void invoke(int __addr, int __a);
	
	/**
	 * Invoke method at pointer, with arguments.
	 *
	 * @param __addr The address to invoke.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @since 2019/04/28
	 */
	public static native void invoke(int __addr, int __a, int __b);
	
	/**
	 * Invoke method at pointer, with arguments.
	 *
	 * @param __addr The address to invoke.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @since 2019/04/28
	 */
	public static native void invoke(int __addr, int __a, int __b, int __c);
	
	/**
	 * Invoke method at pointer, with arguments.
	 *
	 * @param __addr The address to invoke.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @since 2019/04/28
	 */
	public static native void invoke(int __addr, int __a, int __b, int __c,
		int __d);
	
	/**
	 * Invoke method at pointer, with arguments.
	 *
	 * @param __addr The address to invoke.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @param __e Argument.
	 * @since 2019/04/28
	 */
	public static native void invoke(int __addr, int __a, int __b, int __c,
		int __d, int __e);
	
	/**
	 * Invoke method at pointer, with arguments.
	 *
	 * @param __addr The address to invoke.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @param __e Argument.
	 * @param __f Argument.
	 * @since 2019/04/28
	 */
	public static native void invoke(int __addr, int __a, int __b, int __c,
		int __d, int __e, int __f);
	
	/**
	 * Invoke method at pointer, with arguments.
	 *
	 * @param __addr The address to invoke.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @param __e Argument.
	 * @param __f Argument.
	 * @param __g Argument.
	 * @since 2019/04/28
	 */
	public static native void invoke(int __addr, int __a, int __b, int __c,
		int __d, int __e, int __f, int __g);
	
	/**
	 * Invoke method at pointer, with arguments.
	 *
	 * @param __addr The address to invoke.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @param __e Argument.
	 * @param __f Argument.
	 * @param __g Argument.
	 * @param __h Argument.
	 * @since 2019/04/28
	 */
	public static native void invoke(int __addr, int __a, int __b, int __c,
		int __d, int __e, int __f, int __g, int __h);
	
	/**
	 * Invoke method at pointer.
	 *
	 * @param __addr The address to invoke.
	 * @return The result of the invocation.
	 * @since 2019/04/28
	 */
	public static native int invokeV(int __addr);
	
	/**
	 * Invoke method at pointer, with arguments.
	 *
	 * @param __addr The address to invoke.
	 * @param __a Argument.
	 * @return The result of the invocation.
	 * @since 2019/04/28
	 */
	public static native int invokeV(int __addr, int __a);
	
	/**
	 * Invoke method at pointer, with arguments.
	 *
	 * @param __addr The address to invoke.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @return The result of the invocation.
	 * @since 2019/04/28
	 */
	public static native int invokeV(int __addr, int __a, int __b);
	
	/**
	 * Invoke method at pointer, with arguments.
	 *
	 * @param __addr The address to invoke.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @return The result of the invocation.
	 * @since 2019/04/28
	 */
	public static native int invokeV(int __addr, int __a, int __b, int __c);
	
	/**
	 * Invoke method at pointer, with arguments.
	 *
	 * @param __addr The address to invoke.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @return The result of the invocation.
	 * @since 2019/04/28
	 */
	public static native int invokeV(int __addr, int __a, int __b, int __c,
		int __d);
	
	/**
	 * Invoke method at pointer, with arguments.
	 *
	 * @param __addr The address to invoke.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @param __e Argument.
	 * @return The result of the invocation.
	 * @since 2019/04/28
	 */
	public static native int invokeV(int __addr, int __a, int __b, int __c,
		int __d, int __e);
	
	/**
	 * Invoke method at pointer, with arguments.
	 *
	 * @param __addr The address to invoke.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @param __e Argument.
	 * @param __f Argument.
	 * @return The result of the invocation.
	 * @since 2019/04/28
	 */
	public static native int invokeV(int __addr, int __a, int __b, int __c,
		int __d, int __e, int __f);
	
	/**
	 * Invoke method at pointer, with arguments.
	 *
	 * @param __addr The address to invoke.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @param __e Argument.
	 * @param __f Argument.
	 * @param __g Argument.
	 * @return The result of the invocation.
	 * @since 2019/04/28
	 */
	public static native int invokeV(int __addr, int __a, int __b, int __c,
		int __d, int __e, int __f, int __g);
	
	/**
	 * Invoke method at pointer, with arguments.
	 *
	 * @param __addr The address to invoke.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @param __e Argument.
	 * @param __f Argument.
	 * @param __g Argument.
	 * @param __h Argument.
	 * @return The result of the invocation.
	 * @since 2019/04/28
	 */
	public static native int invokeV(int __addr, int __a, int __b, int __c,
		int __d, int __e, int __f, int __g, int __h);
	
	/**
	 * Invoke method at pointer.
	 *
	 * @param __addr The address to invoke.
	 * @return The result of the invocation.
	 * @since 2019/12/08
	 */
	public static native long invokeVL(int __addr, int __pool);
	
	/**
	 * Invoke method at pointer, with arguments.
	 *
	 * @param __addr The address to invoke.
	 * @param __a Argument.
	 * @return The result of the invocation.
	 * @since 2019/12/08
	 */
	public static native long invokeVL(int __addr, int __pool, int __a);
	
	/**
	 * Invoke method at pointer, with arguments.
	 *
	 * @param __addr The address to invoke.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @return The result of the invocation.
	 * @since 2019/12/08
	 */
	public static native long invokeVL(int __addr, int __pool, int __a,
		int __b);
	
	/**
	 * Invoke method at pointer, with arguments.
	 *
	 * @param __addr The address to invoke.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @return The result of the invocation.
	 * @since 2019/12/08
	 */
	public static native long invokeVL(int __addr, int __pool, int __a,
		int __b, int __c);
	
	/**
	 * Invoke method at pointer, with arguments.
	 *
	 * @param __addr The address to invoke.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @return The result of the invocation.
	 * @since 2019/12/08
	 */
	public static native long invokeVL(int __addr, int __pool, int __a, 
		int __b, int __c, int __d);
	
	/**
	 * Invoke method at pointer, with arguments.
	 *
	 * @param __addr The address to invoke.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @param __e Argument.
	 * @return The result of the invocation.
	 * @since 2019/12/08
	 */
	public static native long invokeVL(int __addr, int __pool, int __a, 
		int __b, int __c, int __d, int __e);
	
	/**
	 * Invoke method at pointer, with arguments.
	 *
	 * @param __addr The address to invoke.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @param __e Argument.
	 * @param __f Argument.
	 * @return The result of the invocation.
	 * @since 2019/12/08
	 */
	public static native long invokeVL(int __addr, int __pool, int __a, 
		int __b, int __c, int __d, int __e, int __f);
	
	/**
	 * Invoke method at pointer, with arguments.
	 *
	 * @param __addr The address to invoke.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @param __e Argument.
	 * @param __f Argument.
	 * @param __g Argument.
	 * @return The result of the invocation.
	 * @since 2019/12/08
	 */
	public static native long invokeVL(int __addr, int __pool, int __a, 
		int __b, int __c, int __d, int __e, int __f, int __g);
	
	/**
	 * Invoke method at pointer, with arguments.
	 *
	 * @param __addr The address to invoke.
	 * @param __pool The pool pointer to load.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @param __e Argument.
	 * @param __f Argument.
	 * @param __g Argument.
	 * @param __h Argument.
	 * @return The result of the invocation.
	 * @since 2019/12/08
	 */
	public static native long invokeVL(int __addr, int __pool, int __a, 
		int __b, int __c, int __d, int __e, int __f, int __g, int __h);
	
	/**
	 * Loads a value from the constant pool at the given index.
	 *
	 * @return The index of the value in the constant pool.
	 * @since 2019/04/28
	 */
	public static native int loadPool(int __i);
	
	/**
	 * Long bits to double.
	 *
	 * @param __b The input bits.
	 * @return The resulting double.
	 * @since 2018/11/03
	 */
	public static native double longBitsToDouble(long __b);
	
	/**
	 * Packs the given two integers to a long value.
	 *
	 * @param __hi The high value.
	 * @param __lo The low value.
	 * @return The long value.
	 * @since 2019/06/21
	 */
	public static native long longPack(int __hi, int __lo);
	
	/**
	 * Unpack high value from long.
	 *
	 * @param __v The long value.
	 * @return The unpacked fragment.
	 * @since 2019/06/21
	 */
	public static native int longUnpackHigh(long __v);
	
	/**
	 * Unpack low value from long.
	 *
	 * @param __v The long value.
	 * @return The unpacked fragment.
	 * @since 2019/06/21
	 */
	public static native int longUnpackLow(long __v);
	
	/**
	 * Reads byte from address.
	 *
	 * @param __p The pointer.
	 * @param __o The offset.
	 * @return The result of the read.
	 * @since 2019/04/22
	 */
	public static native int memReadByte(int __p, int __o);
	
	/**
	 * Reads integer from address.
	 *
	 * @param __p The pointer.
	 * @param __o The offset.
	 * @return The result of the read.
	 * @since 2019/04/21
	 */
	public static native int memReadInt(int __p, int __o);
	
	/**
	 * Reads big endian Java integer from address.
	 *
	 * @param __p The pointer.
	 * @param __o The offset.
	 * @return The result of the read.
	 * @since 2019/05/29
	 */
	public static native int memReadJavaInt(int __p, int __o);
	
	/**
	 * Reads big endian Java short from address.
	 *
	 * @param __p The pointer.
	 * @param __o The offset.
	 * @return The result of the read.
	 * @since 2019/05/29
	 */
	public static native int memReadJavaShort(int __p, int __o);
	
	/**
	 * Reads short from address.
	 *
	 * @param __p The pointer.
	 * @param __o The offset.
	 * @return The result of the read.
	 * @since 2019/04/22
	 */
	public static native int memReadShort(int __p, int __o);
	
	/**
	 * Writes byte to address.
	 *
	 * @param __p The pointer.
	 * @param __o The offset.
	 * @param __v The value to write.
	 * @since 2019/04/21
	 */
	public static native void memWriteByte(int __p, int __o, int __v);
	
	/**
	 * Writes integer to address.
	 *
	 * @param __p The pointer.
	 * @param __o The offset.
	 * @param __v The value to write.
	 * @since 2019/04/21
	 */
	public static native void memWriteInt(int __p, int __o, int __v);
	
	/**
	 * Writes big endian Java integer to address.
	 *
	 * @param __p The pointer.
	 * @param __o The offset.
	 * @param __v The value to write.
	 * @since 2019/05/29
	 */
	public static native void memWriteJavaInt(int __p, int __o, int __v);
	
	/**
	 * Writes big endian Java short to address.
	 *
	 * @param __p The pointer.
	 * @param __o The offset.
	 * @param __v The value to write.
	 * @since 2019/05/29
	 */
	public static native void memWriteJavaShort(int __p, int __o, int __v);
	
	/**
	 * Writes short to address.
	 *
	 * @param __p The pointer.
	 * @param __o The offset.
	 * @param __v The value to write.
	 * @since 2019/04/21
	 */
	public static native void memWriteShort(int __p, int __o, int __v);
	
	/**
	 * Used to convert an object to a pointer.
	 *
	 * @param __o The object.
	 * @return The pointer of the object.
	 * @since 2019/04/21
	 */
	public static native int objectToPointer(Object __o);
	
	/**
	 * Used to convert an object to a pointer, do use reference queing for it
	 * so that if the object is a candidate for reference counting it will
	 * be uncounted.
	 *
	 * @param __o The object.
	 * @return The pointer of the object.
	 * @since 2019/04/21
	 */
	public static native int objectToPointerRefQueue(Object __o);
	
	/**
	 * Used to convert a pointer to an object.
	 *
	 * @param __p The pointer.
	 * @return The object of the pointer.
	 * @since 2019/04/21
	 */
	public static native Object pointerToObject(int __p);
	
	/**
	 * Used to convert a pointer to a class info type.
	 *
	 * @param __p The pointer.
	 * @return The object of the pointer.
	 * @since 2019/04/21
	 */
	public static native ClassInfo pointerToClassInfo(int __p);
	
	/**
	 * Perform reference counting logic on object.
	 *
	 * @param __p The object to count up.
	 * @since 2019/05/25
	 */
	public static native void refCount(int __p);
	
	/**
	 * Perform reference uncounting logic on object.
	 *
	 * @param __p The object to count down.
	 * @since 2019/05/25
	 */
	public static native void refUncount(int __p);
	
	/**
	 * Return from the current frame.
	 *
	 * @since 2019/04/21
	 */
	public static native void returnFrame();
	
	/**
	 * Returns from the current frame, returning the given value.
	 *
	 * @param __v The value to return.
	 * @since 2019/04/28
	 */
	public static native void returnFrame(int __v);
	
	/**
	 * Returns from the current frame, returning both values.
	 *
	 * @param __h The high value.
	 * @param __l The low value.
	 * @since 2019/04/28
	 */
	public static native void returnFrame(int __h, int __l);
	
	/**
	 * Returns the exception register.
	 *
	 * @return The exception register.
	 * @since 2019/04/28
	 */
	public static native int specialGetExceptionRegister();
	
	/**
	 * Returns the value of the current pool register.
	 *
	 * @return The value of the pool register.
	 * @since 2019/05/01
	 */
	public static native int specialGetPoolRegister();
	
	/**
	 * Returns the value of the return register, for long return values this
	 * is the first high register.
	 *
	 * @return The value of the return register.
	 * @since 2019/04/28
	 */
	public static native int specialGetReturnRegister();
	
	/**
	 * Returns the value of the return register, the first high value.
	 *
	 * @return The value of the return register, the first high value.
	 * @since 2019/04/28
	 */
	public static native int specialGetReturnHighRegister();
	
	/**
	 * Returns the value of the return register, the second low value.
	 *
	 * @return The value of the return register, the second low value.
	 * @since 2019/04/28
	 */
	public static native int specialGetReturnLowRegister();
	
	/**
	 * Reads the value of the static field register.
	 *
	 * @return The value of the static field register.
	 * @since 2019/04/22
	 */
	public static native int specialGetStaticFieldRegister();
	
	/**
	 * Returns the register representing the current thread.
	 *
	 * @return The current thread register.
	 * @since 2019/04/22
	 */
	public static native int specialGetThreadRegister();
	
	/**
	 * Sets the value of the exception register.
	 *
	 * @param __v The value to use.
	 * @since 2019/04/28
	 */
	public static native void specialSetExceptionRegister(int __v);
	
	/**
	 * Sets the value of the constant pool register.
	 *
	 * @param __v The new value of the constant pool register.
	 * @since 2019/05/01
	 */
	public static native void specialSetPoolRegister(int __v);
	
	/**
	 * Sets the value of the static field register.
	 *
	 * @param __v The new value of the static field register.
	 * @since 2019/04/22
	 */
	public static native void specialSetStaticFieldRegister(int __v);
	
	/**
	 * Sets the current thread pointer.
	 *
	 * @param __v The value to use.
	 * @since 2019/04/27
	 */
	public static native void specialSetThreadRegister(int __v);
	
	/**
	 * Invoke system call at the given index.
	 *
	 * @param __addr The address to invoke.
	 * @since 2019/05/23
	 */
	public static native void sysCall(short __si);
	
	/**
	 * Invoke system call at the given index, with arguments.
	 *
	 * @param __si System call index.
	 * @param __a Argument.
	 * @since 2019/05/23
	 */
	public static native void sysCall(short __si, int __a);
	
	/**
	 * Invoke system call at the given index, with arguments.
	 *
	 * @param __si System call index.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @since 2019/05/23
	 */
	public static native void sysCall(short __si, int __a, int __b);
	
	/**
	 * Invoke system call at the given index, with arguments.
	 *
	 * @param __si System call index.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @since 2019/05/23
	 */
	public static native void sysCall(short __si, int __a, int __b, int __c);
	
	/**
	 * Invoke system call at the given index, with arguments.
	 *
	 * @param __si System call index.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @since 2019/05/23
	 */
	public static native void sysCall(short __si, int __a, int __b, int __c,
		int __d);
	
	/**
	 * Invoke system call at the given index, with arguments.
	 *
	 * @param __si System call index.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @param __e Argument.
	 * @since 2019/05/23
	 */
	public static native void sysCall(short __si, int __a, int __b, int __c,
		int __d, int __e);
	
	/**
	 * Invoke system call at the given index, with arguments.
	 *
	 * @param __si System call index.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @param __e Argument.
	 * @param __f Argument.
	 * @since 2019/05/23
	 */
	public static native void sysCall(short __si, int __a, int __b, int __c,
		int __d, int __e, int __f);
	
	/**
	 * Invoke system call at the given index, with arguments.
	 *
	 * @param __si System call index.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @param __e Argument.
	 * @param __f Argument.
	 * @param __g Argument.
	 * @since 2019/05/23
	 */
	public static native void sysCall(short __si, int __a, int __b, int __c,
		int __d, int __e, int __f, int __g);
	
	/**
	 * Invoke system call at the given index, with arguments.
	 *
	 * @param __si System call index.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @param __e Argument.
	 * @param __f Argument.
	 * @param __g Argument.
	 * @param __h Argument.
	 * @since 2019/05/23
	 */
	public static native void sysCall(short __si, int __a, int __b, int __c,
		int __d, int __e, int __f, int __g, int __h);
	
	/**
	 * Invoke pure system call at the given index.
	 *
	 * @param __addr The address to invoke.
	 * @since 2019/05/27
	 */
	public static native void sysCallP(short __si);
	
	/**
	 * Invoke pure system call at the given index, with arguments.
	 *
	 * @param __si System call index.
	 * @param __a Argument.
	 * @since 2019/05/27
	 */
	public static native void sysCallP(short __si, int __a);
	
	/**
	 * Invoke pure system call at the given index, with arguments.
	 *
	 * @param __si System call index.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @since 2019/05/27
	 */
	public static native void sysCallP(short __si, int __a, int __b);
	
	/**
	 * Invoke pure system call at the given index, with arguments.
	 *
	 * @param __si System call index.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @since 2019/05/27
	 */
	public static native void sysCallP(short __si, int __a, int __b, int __c);
	
	/**
	 * Invoke pure system call at the given index, with arguments.
	 *
	 * @param __si System call index.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @since 2019/05/27
	 */
	public static native void sysCallP(short __si, int __a, int __b, int __c,
		int __d);
	
	/**
	 * Invoke pure system call at the given index, with arguments.
	 *
	 * @param __si System call index.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @param __e Argument.
	 * @since 2019/05/27
	 */
	public static native void sysCallP(short __si, int __a, int __b, int __c,
		int __d, int __e);
	
	/**
	 * Invoke pure system call at the given index, with arguments.
	 *
	 * @param __si System call index.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @param __e Argument.
	 * @param __f Argument.
	 * @since 2019/05/27
	 */
	public static native void sysCallP(short __si, int __a, int __b, int __c,
		int __d, int __e, int __f);
	
	/**
	 * Invoke pure system call at the given index, with arguments.
	 *
	 * @param __si System call index.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @param __e Argument.
	 * @param __f Argument.
	 * @param __g Argument.
	 * @since 2019/05/27
	 */
	public static native void sysCallP(short __si, int __a, int __b, int __c,
		int __d, int __e, int __f, int __g);
	
	/**
	 * Invoke pure system call at the given index, with arguments.
	 *
	 * @param __si System call index.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @param __e Argument.
	 * @param __f Argument.
	 * @param __g Argument.
	 * @param __h Argument.
	 * @since 2019/05/27
	 */
	public static native void sysCallP(short __si, int __a, int __b, int __c,
		int __d, int __e, int __f, int __g, int __h);
	
	/**
	 * Invoke pure system call at the given index.
	 *
	 * @param __si System call index.
	 * @return The result of the invocation.
	 * @since 2019/05/27
	 */
	public static native int sysCallPV(short __si);
	
	/**
	 * Invoke pure system call at the given index, with arguments.
	 *
	 * @param __si System call index.
	 * @param __a Argument.
	 * @return The result of the invocation.
	 * @since 2019/05/27
	 */
	public static native int sysCallPV(short __si, int __a);
	
	/**
	 * Invoke pure system call at the given index, with arguments.
	 *
	 * @param __si System call index.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @return The result of the invocation.
	 * @since 2019/05/27
	 */
	public static native int sysCallPV(short __si, int __a, int __b);
	
	/**
	 * Invoke pure system call at the given index, with arguments.
	 *
	 * @param __si System call index.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @return The result of the invocation.
	 * @since 2019/05/27
	 */
	public static native int sysCallPV(short __si, int __a, int __b, int __c);
	
	/**
	 * Invoke pure system call at the given index, with arguments.
	 *
	 * @param __si System call index.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @return The result of the invocation.
	 * @since 2019/05/27
	 */
	public static native int sysCallPV(short __si, int __a, int __b, int __c,
		int __d);
	
	/**
	 * Invoke pure system call at the given index, with arguments.
	 *
	 * @param __si System call index.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @param __e Argument.
	 * @return The result of the invocation.
	 * @since 2019/05/27
	 */
	public static native int sysCallPV(short __si, int __a, int __b, int __c,
		int __d, int __e);
	
	/**
	 * Invoke pure system call at the given index, with arguments.
	 *
	 * @param __si System call index.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @param __e Argument.
	 * @param __f Argument.
	 * @return The result of the invocation.
	 * @since 2019/05/27
	 */
	public static native int sysCallPV(short __si, int __a, int __b, int __c,
		int __d, int __e, int __f);
	
	/**
	 * Invoke pure system call at the given index, with arguments.
	 *
	 * @param __si System call index.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @param __e Argument.
	 * @param __f Argument.
	 * @param __g Argument.
	 * @return The result of the invocation.
	 * @since 2019/05/27
	 */
	public static native int sysCallPV(short __si, int __a, int __b, int __c,
		int __d, int __e, int __f, int __g);
	
	/**
	 * Invoke pure system call at the given index, with arguments.
	 *
	 * @param __si System call index.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @param __e Argument.
	 * @param __f Argument.
	 * @param __g Argument.
	 * @param __h Argument.
	 * @return The result of the invocation.
	 * @since 2019/05/27
	 */
	public static native int sysCallPV(short __si, int __a, int __b, int __c,
		int __d, int __e, int __f, int __g, int __h);
		
	/**
	 * Invoke pure system call at the given index.
	 *
	 * @param __si System call index.
	 * @return The result of the invocation.
	 * @since 2019/05/27
	 */
	public static native long sysCallPVL(short __si);
	
	/**
	 * Invoke pure system call at the given index, with arguments.
	 *
	 * @param __si System call index.
	 * @param __a Argument.
	 * @return The result of the invocation.
	 * @since 2019/05/27
	 */
	public static native long sysCallPVL(short __si, int __a);
	
	/**
	 * Invoke pure system call at the given index, with arguments.
	 *
	 * @param __si System call index.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @return The result of the invocation.
	 * @since 2019/05/27
	 */
	public static native long sysCallPVL(short __si, int __a, int __b);
	
	/**
	 * Invoke pure system call at the given index, with arguments.
	 *
	 * @param __si System call index.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @return The result of the invocation.
	 * @since 2019/05/27
	 */
	public static native long sysCallPVL(short __si, int __a, int __b, int __c);
	
	/**
	 * Invoke pure system call at the given index, with arguments.
	 *
	 * @param __si System call index.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @return The result of the invocation.
	 * @since 2019/05/27
	 */
	public static native long sysCallPVL(short __si, int __a, int __b, int __c,
		int __d);
	
	/**
	 * Invoke pure system call at the given index, with arguments.
	 *
	 * @param __si System call index.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @param __e Argument.
	 * @return The result of the invocation.
	 * @since 2019/05/27
	 */
	public static native long sysCallPVL(short __si, int __a, int __b, int __c,
		int __d, int __e);
	
	/**
	 * Invoke pure system call at the given index, with arguments.
	 *
	 * @param __si System call index.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @param __e Argument.
	 * @param __f Argument.
	 * @return The result of the invocation.
	 * @since 2019/05/27
	 */
	public static native long sysCallPVL(short __si, int __a, int __b, int __c,
		int __d, int __e, int __f);
	
	/**
	 * Invoke pure system call at the given index, with arguments.
	 *
	 * @param __si System call index.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @param __e Argument.
	 * @param __f Argument.
	 * @param __g Argument.
	 * @return The result of the invocation.
	 * @since 2019/05/27
	 */
	public static native long sysCallPVL(short __si, int __a, int __b, int __c,
		int __d, int __e, int __f, int __g);
	
	/**
	 * Invoke pure system call at the given index, with arguments.
	 *
	 * @param __si System call index.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @param __e Argument.
	 * @param __f Argument.
	 * @param __g Argument.
	 * @param __h Argument.
	 * @return The result of the invocation.
	 * @since 2019/05/27
	 */
	public static native long sysCallPVL(short __si, int __a, int __b, int __c,
		int __d, int __e, int __f, int __g, int __h);
	
	/**
	 * Invoke system call at the given index.
	 *
	 * @param __si System call index.
	 * @return The result of the invocation.
	 * @since 2019/05/23
	 */
	public static native int sysCallV(short __si);
	
	/**
	 * Invoke system call at the given index, with arguments.
	 *
	 * @param __si System call index.
	 * @param __a Argument.
	 * @return The result of the invocation.
	 * @since 2019/05/23
	 */
	public static native int sysCallV(short __si, int __a);
	
	/**
	 * Invoke system call at the given index, with arguments.
	 *
	 * @param __si System call index.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @return The result of the invocation.
	 * @since 2019/05/23
	 */
	public static native int sysCallV(short __si, int __a, int __b);
	
	/**
	 * Invoke system call at the given index, with arguments.
	 *
	 * @param __si System call index.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @return The result of the invocation.
	 * @since 2019/05/23
	 */
	public static native int sysCallV(short __si, int __a, int __b, int __c);
	
	/**
	 * Invoke system call at the given index, with arguments.
	 *
	 * @param __si System call index.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @return The result of the invocation.
	 * @since 2019/05/23
	 */
	public static native int sysCallV(short __si, int __a, int __b, int __c,
		int __d);
	
	/**
	 * Invoke system call at the given index, with arguments.
	 *
	 * @param __si System call index.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @param __e Argument.
	 * @return The result of the invocation.
	 * @since 2019/05/23
	 */
	public static native int sysCallV(short __si, int __a, int __b, int __c,
		int __d, int __e);
	
	/**
	 * Invoke system call at the given index, with arguments.
	 *
	 * @param __si System call index.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @param __e Argument.
	 * @param __f Argument.
	 * @return The result of the invocation.
	 * @since 2019/05/23
	 */
	public static native int sysCallV(short __si, int __a, int __b, int __c,
		int __d, int __e, int __f);
	
	/**
	 * Invoke system call at the given index, with arguments.
	 *
	 * @param __si System call index.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @param __e Argument.
	 * @param __f Argument.
	 * @param __g Argument.
	 * @return The result of the invocation.
	 * @since 2019/05/23
	 */
	public static native int sysCallV(short __si, int __a, int __b, int __c,
		int __d, int __e, int __f, int __g);
	
	/**
	 * Invoke system call at the given index, with arguments.
	 *
	 * @param __si System call index.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @param __e Argument.
	 * @param __f Argument.
	 * @param __g Argument.
	 * @param __h Argument.
	 * @return The result of the invocation.
	 * @since 2019/05/23
	 */
	public static native int sysCallV(short __si, int __a, int __b, int __c,
		int __d, int __e, int __f, int __g, int __h);
		
	/**
	 * Invoke system call at the given index.
	 *
	 * @param __si System call index.
	 * @return The result of the invocation.
	 * @since 2019/05/23
	 */
	public static native long sysCallVL(short __si);
	
	/**
	 * Invoke system call at the given index, with arguments.
	 *
	 * @param __si System call index.
	 * @param __a Argument.
	 * @return The result of the invocation.
	 * @since 2019/05/23
	 */
	public static native long sysCallVL(short __si, int __a);
	
	/**
	 * Invoke system call at the given index, with arguments.
	 *
	 * @param __si System call index.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @return The result of the invocation.
	 * @since 2019/05/23
	 */
	public static native long sysCallVL(short __si, int __a, int __b);
	
	/**
	 * Invoke system call at the given index, with arguments.
	 *
	 * @param __si System call index.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @return The result of the invocation.
	 * @since 2019/05/23
	 */
	public static native long sysCallVL(short __si, int __a, int __b, int __c);
	
	/**
	 * Invoke system call at the given index, with arguments.
	 *
	 * @param __si System call index.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @return The result of the invocation.
	 * @since 2019/05/23
	 */
	public static native long sysCallVL(short __si, int __a, int __b, int __c,
		int __d);
	
	/**
	 * Invoke system call at the given index, with arguments.
	 *
	 * @param __si System call index.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @param __e Argument.
	 * @return The result of the invocation.
	 * @since 2019/05/23
	 */
	public static native long sysCallVL(short __si, int __a, int __b, int __c,
		int __d, int __e);
	
	/**
	 * Invoke system call at the given index, with arguments.
	 *
	 * @param __si System call index.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @param __e Argument.
	 * @param __f Argument.
	 * @return The result of the invocation.
	 * @since 2019/05/23
	 */
	public static native long sysCallVL(short __si, int __a, int __b, int __c,
		int __d, int __e, int __f);
	
	/**
	 * Invoke system call at the given index, with arguments.
	 *
	 * @param __si System call index.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @param __e Argument.
	 * @param __f Argument.
	 * @param __g Argument.
	 * @return The result of the invocation.
	 * @since 2019/05/23
	 */
	public static native long sysCallVL(short __si, int __a, int __b, int __c,
		int __d, int __e, int __f, int __g);
	
	/**
	 * Invoke system call at the given index, with arguments.
	 *
	 * @param __si System call index.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @param __e Argument.
	 * @param __f Argument.
	 * @param __g Argument.
	 * @param __h Argument.
	 * @return The result of the invocation.
	 * @since 2019/05/23
	 */
	public static native long sysCallVL(short __si, int __a, int __b, int __c,
		int __d, int __e, int __f, int __g, int __h);
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<










































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted runt/klib/supervisor/cc/squirreljme/jvm/CallStackItem.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm;

/**
 * This represents a single item within the call stack request.
 *
 * @since 2019/06/16
 */
public interface CallStackItem
{
	/** The class name. */
	public static final byte CLASS_NAME =
		0;
	
	/** The method name. */
	public static final byte METHOD_NAME =
		1;
	
	/** The method type. */
	public static final byte METHOD_TYPE =
		2;
	
	/** The current file. */
	public static final byte SOURCE_FILE =
		3;
	
	/** Source line. */
	public static final byte SOURCE_LINE =
		4;
	
	/** The PC address. */
	public static final byte PC_ADDRESS =
		5;
	
	/** Java operation. */
	public static final byte JAVA_OPERATION =
		6;
	
	/** Java PC address. */
	public static final byte JAVA_PC_ADDRESS =
		7;
	
	/** The current task ID. */
	public static final byte TASK_ID =
		8;
	
	/** The number of supported items. */
	public static final byte NUM_ITEMS =
		9;
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






















































































































Deleted runt/klib/supervisor/cc/squirreljme/jvm/ClassInfo.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm;

/**
 * This contains class information which is used to define the information
 * that is needed to parse it properly.
 *
 * @since 2019/05/25
 */
public final class ClassInfo
{
	/** The magic number which should be used. */
	public static final int MAGIC_NUMBER =
		0x4C6F7665;
	
	/** Self pointer. */
	public final int selfptr;
	
	/** Magic number used to detect corruption. */
	public final int magic;
	
	/** Class information flags. */
	public final int flags;
	
	/** The pointer to the minimized class file. */
	public final int miniptr;
	
	/** The pointer to the class name. */
	public final int namep;
	
	/** The allocation size of this class. */
	public final int size;
	
	/** The base offset for fields in this class. */
	public final int base;
	
	/** The number of objects in the instance fields, for GC. */
	public final int numobjects;
	
	/** The dimensions this class uses, if it is an array. */
	public final int dimensions;
	
	/** The cell size of components if this is an array. */
	public final int cellsize;
	
	/** The super class data. */
	public final ClassInfo superclass;
	
	/** Interfaces. */
	public final ClassInfo[] interfaceclasses;
	
	/** The component class. */
	public final ClassInfo componentclass;
	
	/** Pointer to the class object. */
	public final Class<?> classobjptr;
	
	/** Virtual invoke VTable. */
	public final int[] vtablevirtual;
	
	/** Virtual invoke VTable pool entries. */
	public final int[] vtablepool;
	
	/** The pointer to the constant pool of this class. */
	public final int pool;
	
	/** The JAR this class is a part of. */
	public final int jardx;
	
	/** The total method count. */
	public final int nummethods;
	
	/** The depth of this class. */
	public final int classdepth;
	
	/** The static field pointer offset for the class. */
	public final int sfoffset;
	
	/** The pointer of the default constructor. */
	public final int defaultnew;
	
	/**
	 * Class information constructor.
	 *
	 * @param __sp Self pointer.
	 * @param __fl Class information flags.
	 * @param __minip Pointer to the hardware class data in ROM.
	 * @param __namep The name pointer.
	 * @param __sz The size of this class.
	 * @param __bz The base offset for fields.
	 * @param __no The number of objects in the field instance.
	 * @param __dim Dimensions.
	 * @param __csz Cell size.
	 * @param __scl The super class data.
	 * @param __icl Interface classes.
	 * @param __ccl Component class.
	 * @param __cop Pointer to the class object.
	 * @param __vtv Virtual invoke VTable address.
	 * @param __vtp Virtual invoke VTable pool addresses.
	 * @param __pool The pointer to the class constant pool.
	 * @param __jardx The JAR Index.
	 * @param __nm The number of methods that are used.
	 * @param __cd The class depth.
	 * @param __sfp The static field offset.
	 * @param __dn The default constructor.
	 * @since 2019/04/26
	 */
	public ClassInfo(int __sp, int __fl, int __minip, int __namep, int __sz,
		int __bz, int __no, int __dim, int __csz, ClassInfo __scl,
		ClassInfo[] __icl, ClassInfo __ccl, Class<?> __cop, int[] __vtv,
		int[] __vtp, int __pool, int __jardx, int __nm, int __cd, int __sfp,
		int __dn)
	{
		// Always implicitly set magic
		this.magic = MAGIC_NUMBER;
		
		// Set
		this.selfptr = __sp;
		this.flags = __fl;
		this.miniptr = __minip;
		this.namep = __namep;
		this.size = __sz;
		this.base = __bz;
		this.numobjects = __no;
		this.dimensions = __dim;
		this.cellsize = __csz;
		this.superclass = __scl;
		this.interfaceclasses = (__icl == null ? new ClassInfo[0] : __icl);
		this.componentclass = __ccl;
		this.classobjptr = __cop;
		this.vtablevirtual = (__vtv == null ? new int[0] : __vtv);
		this.vtablepool = (__vtp == null ? new int[0] : __vtp);
		this.pool = __pool;
		this.jardx = __jardx;
		this.nummethods = __nm;
		this.classdepth = __cd;
		this.sfoffset = __sfp;
		this.defaultnew = __dn;
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<










































































































































































































































































































Deleted runt/klib/supervisor/cc/squirreljme/jvm/ClassLoadingAdjustments.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm;

/**
 * Adjustments to class loading.
 *
 * @since 2019/12/15
 */
public final class ClassLoadingAdjustments
{
	/**
	 * Is this class deferred loaded?
	 *
	 * @param __cl The class to check.
	 * @return If the class is deferred loaded.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/12/15
	 */
	public static final boolean isDeferredLoad(String __cl)
		throws NullPointerException
	{
		switch (__cl)
		{
				// Primitive types
			case "boolean":
			case "byte":
			case "short":
			case "char":
			case "int":
			case "float":
			case "long":
			case "double":
			
				// Primitive array types
			case "[Z":
			case "[B":
			case "[S":
			case "[C":
			case "[I":
			case "[F":
			case "[J":
			case "[D":
				
				// Common Java objects
			case "java/io/IOException":
			case "java/io/PrintStream":
			case "java/lang/Appendable":
			case "java/lang/ArithmeticException":
			case "java/lang/ArrayIndexOutOfBoundsException":
			case "java/lang/AssertionError":
			case "java/lang/AutoCloseable":
			case "java/lang/Boolean":
			case "java/lang/Byte":
			case "java/lang/Character":
			case "java/lang/Class":
			case "java/lang/ClassCastException":
			case "java/lang/Cloneable":
			case "java/lang/Closeable":
			case "java/lang/Comparable":
			case "java/lang/Double":
			case "java/lang/Enum":
			case "java/lang/Error":
			case "java/lang/Float":
			case "java/lang/IllegalArgumentException":
			case "java/lang/IllegalMonitorStateException":
			case "java/lang/IllegalStateException":
			case "java/lang/IllegalThreadStateException":
			case "java/lang/IndexOutOfBoundsException":
			case "java/lang/Integer":
			case "java/lang/InterruptedException":
			case "java/lang/Long":
			case "java/lang/Math":
			case "java/lang/NegativeArraySizeException":
			case "java/lang/NoClassDefFoundError":
			case "java/lang/NoSuchElementException":
			case "java/lang/NullPointerException":
			case "java/lang/Number":
			case "java/lang/Object":
			case "java/lang/OutOfMemoryError":
			case "java/lang/Runtime":
			case "java/lang/RuntimeException":
			case "java/lang/Short":
			case "java/lang/String":
			case "java/lang/StringBuffer":
			case "java/lang/StringBuilder":
			case "java/lang/StringIndexOutOfBoundsException":
			case "java/lang/System":
			case "java/lang/Thread":
			case "java/lang/Throwable":
			case "java/lang/VirtualMachineError":
			case "java/lang/ref/Reference":
			case "java/lang/ref/ReferenceQueue":
			case "java/lang/ref/WeakReference":
			case "java/util/Deque":
			case "java/util/Formatter":
			case "java/util/Iterable":
			case "java/util/Iterator":
			case "java/util/List":
			case "java/util/Map":
			case "java/util/Objects":
			case "java/util/Queue":
			case "java/util/Random":
			case "java/util/Set":
			
				// SquirrelJME special classes
			case "cc/squirreljme/jvm/Assembly":
			case "cc/squirreljme/jvm/ClassInfo":
			case "cc/squirreljme/jvm/Constants":
			case "cc/squirreljme/jvm/IPCCallback":
			case "cc/squirreljme/jvm/IPCException":
			case "cc/squirreljme/jvm/IPCManager":
			case "cc/squirreljme/jvm/JVMFunction":
			case "cc/squirreljme/jvm/SoftDouble":
			case "cc/squirreljme/jvm/SoftFloat":
			case "cc/squirreljme/jvm/SoftInteger":
			case "cc/squirreljme/jvm/SoftLong":
			case "cc/squirreljme/jvm/SystemCallError":
			case "cc/squirreljme/jvm/SystemCallIndex":
			
				// Common array classes
			case "[Lcc/squirreljme/jvm/ClassInfo;":
			case "[Ljava/lang/String;":
				return false;
				
			default:
				return true;
		}
	}
	
	/**
	 * Is this class deferred loaded in relation to the current class?
	 *
	 * @param __self The current class.
	 * @param __cl The class to check.
	 * @return If the class is deferred loaded.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/12/15
	 */
	public static final boolean isDeferredLoad(String __self, String __cl)
		throws NullPointerException
	{
		if (__self == null || __cl == null)
			throw new NullPointerException("NARG");
		
		// Same class is never deferred
		if (__self.equals(__cl))
			return false;
		
		// Is within the same package?
		int ls = __self.lastIndexOf('/');
		if (ls >= 0 && __self.regionMatches(0, __cl, 0, ls))
			return false;
		
		// Use default defer logic
		return ClassLoadingAdjustments.isDeferredLoad(__cl);
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<












































































































































































































































































































































Deleted runt/klib/supervisor/cc/squirreljme/jvm/ConfigRomType.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm;

/**
 * This represents an option in the configuration ROM.
 *
 * @since 2019/06/14
 */
public interface ConfigRomType
{
	/** End of configuration. */
	public static final byte END =
		0;
	
	/** Java VM Version. */
	public static final byte JAVA_VM_VERSION =
		1;
	
	/** Java VM Name. */
	public static final byte JAVA_VM_NAME =
		2;
	
	/** Java VM Vendor. */
	public static final byte JAVA_VM_VENDOR =
		3;
	
	/** Java VM E-Mail. */
	public static final byte JAVA_VM_EMAIL =
		4;
	
	/** Java VM URL. */
	public static final byte JAVA_VM_URL =
		5;
	
	/** The guest depth. */
	public static final byte GUEST_DEPTH =
		6;
	
	/** Main class. */
	public static final byte MAIN_CLASS =
		7;
	
	/** Main program arguments. */
	public static final byte MAIN_ARGUMENTS =
		8;
	
	/** Is this a MIDlet? */
	public static final byte IS_MIDLET =
		9;
	
	/** Define system propertly. */
	public static final byte DEFINE_PROPERTY =
		10;
	
	/** Classpath to use. */
	public static final byte CLASS_PATH =
		11;
	
	/** System call static field pointer. */
	public static final byte SYSCALL_STATIC_FIELD_POINTER =
		12;
	
	/** System call method pointer. */
	public static final byte SYSCALL_CODE_POINTER =
		13;
	
	/** System call pool pointer. */
	public static final byte SYSCALL_POOL_POINTER =
		14;
	
	/** Number of available options. */
	public static final byte NUM_OPTIONS =
		15;
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






































































































































































Deleted runt/klib/supervisor/cc/squirreljme/jvm/Constants.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm;

/**
 * Virtual machine constants.
 *
 * @since 2019/05/26
 */
public interface Constants
{
	/** The offset for the object's class type. */
	public static final byte OBJECT_CLASS_OFFSET =
		0;
	
	/** The offset for the object's reference count. */
	public static final byte OBJECT_COUNT_OFFSET =
		4;
	
	/** Object monitor owner offset. */
	public static final byte OBJECT_MONITOR_OFFSET =
		8;
	
	/** Object monitor count offset. */
	public static final byte OBJECT_MONITOR_COUNT_OFFSET =
		12;
	
	/** Base size for object types. */
	public static final byte OBJECT_BASE_SIZE =
		16;
	
	/** The offset for array length. */
	public static final byte ARRAY_LENGTH_OFFSET =
		16;
	
	/** The base size for arrays. */
	public static final byte ARRAY_BASE_SIZE =
		20;
	
	/** Constant pool cell size. */
	public static final byte POOL_CELL_SIZE =
		4;
	
	/** Bad magic number. */
	public static final int BAD_MAGIC =
		0xE7E5E7E4;
	
	/** Class info flag: Is array type? */
	public static final short CIF_IS_ARRAY =
		0x0001;
	
	/** Class info flag: Is array of objects? */
	public static final short CIF_IS_ARRAY_OF_OBJECTS =
		0x0002;
	
	/** Is this a primitive type? */
	public static final short CIF_IS_PRIMITIVE =
		0x0004;
	
	/** Offset for the configuration key. */
	public static final byte CONFIG_KEY_OFFSET =
		0;
	
	/** Offset for the configuration size. */
	public static final byte CONFIG_SIZE_OFFSET =
		2;
	
	/** Size of the header for configuration items. */
	public static final byte CONFIG_HEADER_SIZE =
		4;
	
	/** The thread ID for out-of-bound IPC events. */
	public static final int OOB_IPC_THREAD =
		0xFFFFFFFF;
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






































































































































































Deleted runt/klib/supervisor/cc/squirreljme/jvm/DeviceFeedbackType.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm;

/**
 * This represents the type of feedback to perform for a device.
 *
 * @since 2019/10/05
 */
public interface DeviceFeedbackType
{
	/** Vibrate. */
	public static final byte VIBRATE =
		1;
	
	/** Blink/Pulse LED, be aware of conditions such as epilepsy. */
	public static final byte BLINK_LED =
		2;
	
	/** The number of feedback types. */
	public static final byte NUM_FEEDBACK_TYPES =
		3;
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






























































Deleted runt/klib/supervisor/cc/squirreljme/jvm/Framebuffer.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm;

/**
 * This is used to get/set the property of the framebuffer.
 *
 * @since 2019/06/20
 */
public interface Framebuffer
{
	/**
	 * Returns the address of the framebuffer.
	 *
	 * @return The framebuffer address.
	 */
	public static final byte CONTROL_ADDRESS =
		1;
	
	/**
	 * Returns the width of the framebuffer.
	 *
	 * @return The framebuffer width.
	 */
	public static final byte CONTROL_WIDTH =
		2;
	
	/**
	 * Returns the height of the framebuffer.
	 *
	 * @return The framebuffer height.
	 */
	public static final byte CONTROL_HEIGHT =
		3;
	
	/**
	 * Returns the scanline length.
	 *
	 * @return The framebuffer scanline length.
	 */
	public static final byte CONTROL_SCANLEN =
		4;
	
	/**
	 * Flush the display because it has been drawn.
	 */
	public static final byte CONTROL_FLUSH =
		5;
	
	/**
	 * Returns the pixel format of the screen.
	 *
	 * @return The pixel format of the screen.
	 */
	public static final byte CONTROL_FORMAT =
		6;
	
	/**
	 * Returns the scanline length in bytes.
	 *
	 * @return The scanline length in bytes.
	 */
	public static final byte CONTROL_SCANLEN_BYTES =
		7;
	
	/**
	 * Returns the number of bytes per pixel.
	 *
	 * @return The bytes per pixel.
	 */
	public static final byte CONTROL_BYTES_PER_PIXEL =
		8;
	
	/**
	 * Returns the number of available pixels.
	 *
	 * @return The number of pixels.
	 */
	public static final byte CONTROL_NUM_PIXELS =
		9;
	
	/**
	 * Bits per pixel.
	 *
	 * @return The bits per pixel.
	 */
	public static final byte CONTROL_BITS_PER_PIXEL =
		10;
	
	/**
	 * Get backlight level.
	 *
	 * @return The current backlight level.
	 */
	public static final byte CONTROL_BACKLIGHT_LEVEL_GET =
		11;
	
	/**
	 * Set backlight level.
	 *
	 * @param 1 The level to set.
	 */
	public static final byte CONTROL_BACKLIGHT_LEVEL_SET =
		12;
	
	/**
	 * Maximum backlight level.
	 *
	 * @return The maximum backlight level.
	 */
	public static final byte CONTROL_BACKLIGHT_LEVEL_MAX =
		13;
	
	/**
	 * Uploads an integer array of pixel data to the framebuffer.
	 *
	 * @param 1 The address of the array to upload.
	 * @since 2019/12/21
	 */
	public static final byte CONTROL_UPLOAD_ARRAY_INT =
		14;
	
	/**
	 * The array which backs the framebuffer, if there is one.
	 *
	 * @return The backing array object, if there is one.
	 * @since 2019/12/28
	 */
	public static final byte CONTROL_BACKING_ARRAY_OBJECT =
		15;
		
	/**
	 * Returns the capabilities of the display.
	 *
	 * @return The display capabilities.
	 * @since 2020/01/10
	 */
	public static final byte CONTROL_GET_CAPABILITIES =
		16;
	
	/**
	 * Query acceleration function.
	 *
	 * @param 1 The graphics function.
	 * @return A non-zero value if this is supported.
	 * @since 2020/01/10
	 */
	public static final byte CONTROL_ACCEL_FUNC_QUERY =
		17;
	
	/**
	 * Perform acceleration function.
	 *
	 * @param 1 The graphics function.
	 * @param ... Parameters to the function.
	 * @return A value that is according to the invoked function, if it is
	 * supported or possible.
	 * @since 2020/01/10
	 */
	public static final byte CONTROL_ACCEL_FUNC_INVOKE =
		18;
	
	/**
	 * Requests that the framebuffer be repainted.
	 *
	 * @param 1 The X coordinate.
	 * @param 2 The Y coordinate.
	 * @param 3 The width.
	 * @param 4 The height.
	 * @return Returns {@code 0} if the repaint was not queued and it must be
	 * handled by the code running the application, 
	 * @since 2020/01/15
	 */
	public static final byte CONTROL_REPAINT_REQUEST =
		19;
	
	/**
	 * Sets the title of the framebuffer if applicable.
	 *
	 * @param 1 Character array buffer pointer.
	 * @since 2020/01/15
	 */
	public static final byte CONTROL_SET_TITLE =
		20;
	
	/** The number of framebuffer controls. */
	public static final byte NUM_CONTROLS =
		21;
	
	/** Screen is RGB 32-bit. */
	public static final byte FORMAT_INTEGER_RGB888 =
		0;
	
	/** Screen is 8-bit indexed. */
	public static final byte FORMAT_BYTE_INDEXED =
		1;
	
	/** Screen is 16-bit RGB565. */
	public static final byte FORMAT_SHORT_RGB565 =
		2;
	
	/** Screen is packed 1 bit values. */
	public static final byte FORMAT_PACKED_ONE =
		3;
	
	/** Screen is packed 2 bit values. */
	public static final byte FORMAT_PACKED_TWO =
		4;
	
	/** Screen is packed 4 bit values. */
	public static final byte FORMAT_PACKED_FOUR =
		5;
	
	/** Has touch-screen. */
	public static final byte CAPABILITY_TOUCH =
		0x01;
	
	/** Has keyboard. */
	public static final byte CAPABILITY_KEYBOARD =
		0x02;
	
	/** The JVM pushes to the IPC handler when events happen. */
	public static final byte CAPABILITY_IPC_EVENTS =
		0x04;
	
	/** Has screen flipping? */
	public static final byte CAPABILITY_SCREEN_FLIP =
		0x08;
	
	/** Screen has color that is not just a single shade. */
	public static final byte CAPABILITY_COLOR =
		0x10;
	
	/** Set color. */
	public static final byte ACCEL_FUNC_SET_COLOR =
		0;
	
	/** Draw line. */
	public static final byte ACCEL_FUNC_DRAW_LINE =
		1;
	
	/** Get the X clip. */
	public static final byte ACCEL_FUNC_GET_CLIP_X =
		2;
	
	/** Get the Y clip. */
	public static final byte ACCEL_FUNC_GET_CLIP_Y =
		3;
	
	/** Get the width clip. */
	public static final byte ACCEL_FUNC_GET_CLIP_WIDTH =
		4;
	
	/** Get the height clip. */
	public static final byte ACCEL_FUNC_GET_CLIP_HEIGHT =
		5;
	
	/** Set the clip. */
	public static final byte ACCEL_FUNC_SET_CLIP =
		6;
	
	/** Draw rectangle. */
	public static final byte ACCEL_FUNC_DRAW_RECT =
		7;
	
	/** Get the alpha color. */
	public static final byte ACCEL_FUNC_GET_ALPHA_COLOR =
		8;
	
	/** Set the alpha color. */
	public static final byte ACCEL_FUNC_SET_ALPHA_COLOR =
		9;
	
	/** Fill rectangle. */
	public static final byte ACCEL_FUNC_FILL_RECT =
		10;
	
	/** Sets the fonts for the graphics. */
	public static final byte ACCEL_FUNC_SET_FONT =
		11;
	
	/** Gets the font to use for drawing. */
	public static final byte ACCEL_FUNC_GET_FONT =
		12;
	
	/** Draw sub-characters. */
	public static final byte ACCEL_FUNC_DRAW_SUB_CHARS =
		13;
	
	/** Draw text. */
	public static final byte ACCEL_FUNC_DRAW_TEXT =
		14;
	
	/** Get stroke style. */
	public static final byte ACCEL_FUNC_GET_STROKE_STYLE =
		15;
	
	/** Set stroke style. */
	public static final byte ACCEL_FUNC_SET_STROKE_STYLE =
		16;
	
	/** Copy area. */
	public static final byte ACCEL_FUNC_COPY_AREA =
		17;
	
	/** Draw arc. */
	public static final byte ACCEL_FUNC_DRAW_ARC =
		18;
	
	/** Draw ARGB16. */
	public static final byte ACCEL_FUNC_DRAW_ARGB16 =
		19;
	
	/** Draw character. */
	public static final byte ACCEL_FUNC_DRAW_CHAR =
		20;
	
	/** Draw characters. */
	public static final byte ACCEL_FUNC_DRAW_CHARS =
		21;
	
	/** Draw RGB. */
	public static final byte ACCEL_FUNC_DRAW_RGB =
		22;
	
	/** Draw RGB16. */
	public static final byte ACCEL_FUNC_DRAW_RGB16 =
		23;
	
	/** Draw round rectangle. */
	public static final byte ACCEL_FUNC_DRAW_ROUND_RECT =
		24;
	
	/** Fill arc. */
	public static final byte ACCEL_FUNC_FILL_ARC =
		25;
	
	/** Fill round rectangle. */
	public static final byte ACCEL_FUNC_FILL_ROUND_RECT =
		26;
	
	/** Fill triangle. */
	public static final byte ACCEL_FUNC_FILL_TRIANGLE =
		27;
	
	/** Get blending mode. */
	public static final byte ACCEL_FUNC_GET_BLENDING_MODE =
		28;
	
	/** Get display color. */
	public static final byte ACCEL_FUNC_GET_DISPLAY_COLOR =
		29;
	
	/** Set blending mode. */
	public static final byte ACCEL_FUNC_SET_BLENDING_MODE =
		30;
	
	/** Draw region. */
	public static final byte ACCEL_FUNC_DRAW_REGION =
		31;
	
	/** Number of acceleration functions. */
	public static final byte NUM_ACCEL_FUNC =
		32;
	
	/** The IPC ID for the graphics callbacks. */
	public static final int IPC_ID =
		0x47665821;
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


















































































































































































































































































































































































































































































































































































































































































































































































Deleted runt/klib/supervisor/cc/squirreljme/jvm/Globals.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm;

import cc.squirreljme.jvm.task.TaskManager;
import cc.squirreljme.jvm.task.ThreadManager;

/**
 * This class contains all of the globals which are used by the supervisor.
 *
 * @since 2019/10/06
 */
public final class Globals
{
	/** Manager for tasks. */
	private static TaskManager _TASK_MANAGER;
	
	/** The thread manager. */
	private static ThreadManager _THREAD_MANAGER;
	
	/**
	 * Not used.
	 *
	 * @since 2019/10/06
	 */
	private Globals()
	{
	}
	
	/**
	 * Gets the task manager.
	 *
	 * @return The task manager.
	 * @since 2019/10/06
	 */
	public static final TaskManager getTaskManager()
	{
		TaskManager rv = Globals._TASK_MANAGER;
		if (rv == null)
			Globals._TASK_MANAGER = (rv = new TaskManager());
		return rv;
	}
	
	/**
	 * Gets the thread manager.
	 *
	 * @return The thread manager.
	 * @since 2019/10/13
	 */
	public static final ThreadManager getThreadManager()
	{
		ThreadManager rv = Globals._THREAD_MANAGER;
		if (rv == null)
			Globals._THREAD_MANAGER = (rv = new ThreadManager());
		return rv;
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


































































































































Deleted runt/klib/supervisor/cc/squirreljme/jvm/IPCException.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm;

/**
 * This is an exception which was thrown in a cross RPC call.
 *
 * @since 2019/12/28
 */
public class IPCException
	extends RuntimeException
{
	/** The class name note pointer. */
	protected final int classnotepointer;
	
	/**
	 * Initializes the exception with an unknown type.
	 *
	 * @since 2019/12/28
	 */
	public IPCException()
	{
		this.classnotepointer = 0;
	}
	
	/**
	 * Initializes the IPC Exception.
	 *
	 * @param __cnp The class note pointer which was used.
	 * @since 2019/12/28
	 */
	public IPCException(int __cnp)
	{
		this.classnotepointer = __cnp;
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
























































































Deleted runt/klib/supervisor/cc/squirreljme/jvm/JVMFunction.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm;

/**
 * This class contains the functions of the virtual machine.
 *
 * @since 2019/05/25
 */
public final class JVMFunction
{
	/** The task ID. */
	static final byte _TASK_ID =
		0;
	
	/** Last error state. */
	static volatile int _LAST_ERROR;
	
	/**
	 * Not used.
	 *
	 * @since 2019/05/25
	 */
	private JVMFunction()
	{
	}
	
	/**
	 * Checks if the given object can be stored in the array.
	 *
	 * @param __p The array pointer.
	 * @param __v The value to check.
	 * @return If this object can be stored in the array then {@code 1} will
	 * be returned, otherwise {@code 0} will.
	 * @since 2019/04/27
	 */
	public static final int jvmCanArrayStore(int __p, int __v)
	{
		// Access of invalid object?
		if (__p == Constants.BAD_MAGIC || __v == Constants.BAD_MAGIC)
			Assembly.breakpoint();
		
		// Can always store null values
		if (__v == 0)
			return 1;
		
		// Get array class info
		int aip = Assembly.memReadInt(__p, Constants.OBJECT_CLASS_OFFSET);
		ClassInfo aicl = Assembly.pointerToClassInfo(aip);
		
		// Check if the value we are putting in is an instance of the given
		// class component type
		return JVMFunction.jvmIsInstance(__v, aicl.componentclass.selfptr);
	}
	
	/**
	 * Returns the component type of the array
	 *
	 * @param __clid The class ID
	 * @return The component type of the array or {@code 0} if it is not an
	 * array.
	 * @since 2019/04/27
	 */
	public static final int jvmComponentType(int __clid)
	{
		// Access of invalid class?
		if (__clid == Constants.BAD_MAGIC)
			Assembly.breakpoint();
		
		Assembly.breakpoint();
		throw new todo.TODO();
	}
	
	/**
	 * Performs aggressive garbage collection of the JVM heap to free as much
	 * memory as possible.
	 *
	 * @since 2019/04/25
	 */
	public static final void jvmGarbageCollect()
	{
		Assembly.breakpoint();
		throw new todo.TODO();
	}
	
	/**
	 * Garbage collects a single object.
	 *
	 * @param __p The object to garbage collect.
	 * @since 2019/04/25
	 */
	public static final void jvmGarbageCollectObject(int __p)
	{
		// Access of invalid object?
		if (__p == 0 || __p == Constants.BAD_MAGIC)
			Assembly.breakpoint();
		
		// Report this code!
		int nref = Assembly.memReadInt(__p, Constants.OBJECT_COUNT_OFFSET);
		if (nref < 0)
		{
			// Report to the console this happened
			todo.DEBUG.code('G', 'C', __p);
			todo.DEBUG.code('G', '#', nref);
			
			// Break here, since this is not good
			Assembly.breakpoint();
			
			// Stop here
			return;
		}
		
		// Attempt to garbage collect object with no class or is invalid
		int pcl = Assembly.memReadInt(__p, Constants.OBJECT_CLASS_OFFSET);
		if (pcl == 0 || pcl == Constants.BAD_MAGIC)
			Assembly.breakpoint();
		
		// {@squirreljme.error SV0i Garbage collecting an object which is
		// currently locked by a thread.}
		if (0 != Assembly.atomicCompareGetAndSet(0, 0,
			__p + Constants.OBJECT_MONITOR_OFFSET))
			throw new VirtualMachineError("SV0i");
		
		// Get class info for this type
		ClassInfo pinfo = Assembly.pointerToClassInfo(pcl);
		
		// If this is an array, elements have to be uncounted
		// Instance fields can be skipped for non-object arrays
		if ((pinfo.flags & Constants.CIF_IS_ARRAY) != 0)
		{
			// This only needs to be done for objects
			if ((pinfo.flags & Constants.CIF_IS_ARRAY_OF_OBJECTS) != 0)
			{
				// Go through all elements and uncount them
				int n = Assembly.memReadInt(__p,
					Constants.ARRAY_LENGTH_OFFSET);
				for (int i = 0, bp = __p + Constants.ARRAY_BASE_SIZE, xp = 0;
					i < n; i++, xp += 4)
					Assembly.refUncount(Assembly.memReadInt(bp, xp));
			}
		}
		
		// Otherwise uncount the instance field information
		else
		{
			// Go through all classes in the class chain
			for (ClassInfo ro = pinfo; ro != null; ro = ro.superclass)
			{
				// Actual base position for the objects in the instances
				int rbase = __p + ro.base;
				
				// Clear all offsets in the object
				int rnobj = ro.numobjects;
				for (int i = 0, px = 0; i < rnobj; i++, px += 4)
					Assembly.refUncount(Assembly.memReadInt(rbase, px));
			}
		}
		
		// Free this memory
		Allocator.free(__p);
	}
	
	/**
	 * Initializes the given class.
	 *
	 * @param __ns The noted string.
	 * @return The loaded class info.
	 * @since 2019/12/15
	 */
	public static final ClassInfo jvmInitClass(int __ns)
	{
		Assembly.breakpoint();
		throw new todo.TODO();
	}
	
	/**
	 * Searches the interface vtables for the class of object {@code __p}
	 * and searches for an interface implementation of class {@code __icl} and
	 * if one is found then the pointer for index {@code __mdx} is returned.
	 *
	 * @param __p The object to do a interface lookup on.
	 * @param __icl The interface class to find.
	 * @param __mdx The method index to relate to, of the interface class.
	 * @return The pointer to the code to be invoked in the low-word and the
	 * pool of the target class in the high-word.
	 * @since 2019/04/30
	 */
	public static final long jvmInterfacePointer(int __p, int __icl, int __mdx)
	{
		// Access of invalid object?
		if (__p == Constants.BAD_MAGIC)
			Assembly.breakpoint();
		
		Assembly.breakpoint();
		throw new todo.TODO();
		// Assembly.longPack(hi, lo)
	}
	
	/**
	 * Checks whether the given pointer is an array.
	 *
	 * @param __p The pointer to check.
	 * @return Either {@code 1} if it is an array or {@code 0} if it is not.
	 * @since 2019/04/27
	 */
	public static final int jvmIsArray(int __p)
	{
		// Access of invalid object?
		if (__p == Constants.BAD_MAGIC)
			Assembly.breakpoint();
		
		Assembly.breakpoint();
		throw new todo.TODO();
	}
	
	/**
	 * Checks whether the given pointer is an instance of the given class.
	 *
	 * @param __p The pointer to check.
	 * @param __cldx The class type to check.
	 * @return Either {@code 1} if the class is an instance or {@code 0} if
	 * it is not.
	 * @since 2019/04/22
	 */
	public static final int jvmIsInstance(int __p, int __cldx)
	{
		// Access of invalid object?
		if (__p == Constants.BAD_MAGIC)
			Assembly.breakpoint();
		
		// Not instance of null class
		if (__p == 0)
			return 0;
		
		// If the object's class type is a direct match then quickly return
		int pcl = Assembly.memReadInt(__p, Constants.OBJECT_CLASS_OFFSET);
		if (pcl == __cldx)
			return 1;
		
		// Corrupted object?
		if (pcl == 0 || pcl == Constants.BAD_MAGIC)
			Assembly.breakpoint();
		
		// Scan through super classes and check
		ClassInfo mine = Assembly.pointerToClassInfo(pcl);
		for (ClassInfo seek = mine; seek != null; seek = seek.superclass)
		{
			// Get self pointer
			int selfptr = seek.selfptr;
			
			// Make sure we are not reading bad memory
			if (selfptr == Constants.BAD_MAGIC)
			{
				Assembly.breakpoint();
				throw new VirtualMachineError();
			}
			
			// Same as this one?
			if (selfptr == __cldx)
				return 1;
			
			// See if our class or any of our super class implemented
			// interfaces matches the target class
			for (ClassInfo xface : mine.interfaceclasses)
			{
				int ifaceptr = xface.selfptr;
				
				// Make sure we are not reading bad memory
				if (ifaceptr == Constants.BAD_MAGIC)
				{
					Assembly.breakpoint();
					throw new VirtualMachineError();
				}
				
				// Is a match?
				if (ifaceptr == __cldx)
					return 1;
			}
		}
		
		// Not a match
		return 0;
	}
	
	/**
	 * Returns the {@link Class} instance for the given class info pointer,
	 * if none has been created yet then it will be created as needed.
	 *
	 * @param <T> The class type.
	 * @param __cldx The class index pointer.
	 * @return The resulting class.
	 * @since 2019/05/26
	 */
	public static final <T> Class<T> jvmLoadClass(int __cldx)
	{
		// Access of invalid class?
		if (__cldx == Constants.BAD_MAGIC)
			Assembly.breakpoint();
		
		Assembly.breakpoint();
		throw new todo.TODO();
	}
	
	/**
	 * Loads a string from memory and returns an `intern()` string value.
	 *
	 * @param __p The pointer to load the string bytes from.
	 * @return The resulting and interned string.
	 * @since 2019/05/26
	 */
	public static final String jvmLoadString(int __p)
	{
		// If a null pointer was just requested, then treat as null
		if (__p == 0)
			return null;
		
		// Access of invalid object?
		if (__p == Constants.BAD_MAGIC)
			Assembly.breakpoint();
		
		// Read length of the raw bytes
		int rawlen = Assembly.memReadJavaShort(__p, 0) & 0xFFFF;
		
		// Load the string data into bytes
		byte[] bytes = new byte[rawlen];
		for (int i = 0, base = __p + 2; i < rawlen; i++)
			bytes[i] = (byte)Assembly.memReadByte(base, i);
		
		// Initialize, but do not intern the string even though that is the
		// expected result of the JVM. It just keeps the strings sticking
		// around in the supervisor when they could be freed.
		return new String(bytes);
	}
	
	/**
	 * Reads a long value from the given address
	 *
	 * @param __addr The address to access.
	 * @param __off The address offset.
	 * @return The read value.
	 * @since 2019/05/29
	 */
	public static final long jvmMemReadLong(int __addr, int __off)
	{
		// Big endian!
		if (Assembly.sysCallPV(SystemCallIndex.BYTE_ORDER_LITTLE) == 0)
			return Assembly.longPack(
				Assembly.memReadInt(__addr, __off),
				Assembly.memReadInt(__addr + 4, __off));
		
		// Little endian!
		else
			return Assembly.longPack(
				Assembly.memReadInt(__addr + 4, __off),
				Assembly.memReadInt(__addr, __off));
	}
	
	/**
	 * Writes a long value to the given address
	 *
	 * @param __addr The address to access.
	 * @param __off The address offset.
	 * @param __hv The high value.
	 * @param __lv The low value.
	 * @since 2019/05/29
	 */
	public static final void jvmMemWriteLong(int __addr, int __off, int __hv,
		int __lv)
	{
		// Big endian!
		if (Assembly.sysCallPV(SystemCallIndex.BYTE_ORDER_LITTLE) == 0)
		{
			Assembly.memWriteInt(__addr, __off, __hv);
			Assembly.memWriteInt(__addr + 4, __off, __lv);
		}
		
		// Little endian!
		else
		{
			Assembly.memWriteInt(__addr + 4, __off, __hv);
			Assembly.memWriteInt(__addr, __off, __lv);
		}
	}
	
	/**
	 * Writes a long value to the given address
	 *
	 * @param __addr The address to access.
	 * @param __off The address offset.
	 * @param __v The value
	 * @since 2019/05/29
	 */
	public static final void jvmMemWriteLong(int __addr, int __off, long __v)
	{
		JVMFunction.jvmMemWriteLong(__addr, __off,
			Assembly.longUnpackHigh(__v), Assembly.longUnpackLow(__v));
	}
	
	/**
	 * Enters the monitor for the given object.
	 *
	 * @param __p The object to enter.
	 * @since 2019/04/26
	 */
	public static final void jvmMonitorEnter(int __p)
	{
		// Access of invalid object?
		if (__p == Constants.BAD_MAGIC)
			Assembly.breakpoint();
		
		// {@squirreljme.error SV0b Cannot enter the monitor of a null object.}
		if (__p == 0)
			throw new NullPointerException("SV0b");
		
		// Get our own thread ID
		int ourtid = Assembly.specialGetThreadRegister();
		
		// {@squirreljme.error SV0d Current thread does not have a thread
		// identifier?}
		if (ourtid == 0)
			throw new VirtualMachineError("SV0d");
		
		// Wait for the lock to happen, we spin-lock in the supervisor so
		// that locking actions are a bit more responsive since they should
		// not be locked for long
		for (int lockp = __p + Constants.OBJECT_MONITOR_OFFSET;;)
		{
			// If we try to set the value and it happens to be 0 (nobody was
			// locking this object) or our thread ID (we already own it) then
			// stop and leave the loop
			int oldv = Assembly.atomicCompareGetAndSet(0, ourtid, lockp);
			if (oldv == 0 || oldv == ourtid)
				break;
		}
		
		// Since we own this lock, count the lock count up
		Assembly.atomicIncrement(__p + Constants.OBJECT_MONITOR_COUNT_OFFSET);
	}
	
	/**
	 * Exits the monitor for the given object.
	 *
	 * @param __p The object to exit.
	 * @since 2019/04/26
	 */
	public static final void jvmMonitorExit(int __p)
	{
		// Access of invalid object?
		if (__p == Constants.BAD_MAGIC)
			Assembly.breakpoint();
		
		// {@squirreljme.error SV0c Cannot exit the monitor of a null object.}
		if (__p == 0)
			throw new NullPointerException("SV0c");
			
		// Get our own thread ID
		int ourtid = Assembly.specialGetThreadRegister();
		
		// {@squirreljme.error SV0e Current thread does not have a thread
		// identifier?}
		if (ourtid == 0)
			throw new VirtualMachineError("SV0e");
		
		// We can only mess with our counter if we own the lock itself, so
		// compare against our own thread and only allow this to be done if
		// it matches our own
		int lkp = __p + Constants.OBJECT_MONITOR_OFFSET;
		int oldv = Assembly.atomicCompareGetAndSet(ourtid, ourtid, lkp);
		
		// {@squirreljme.error SV0f Current thread does not own the monitor
		// for this object, so it cannot be unlocked.}
		if (oldv != ourtid)
			throw new IllegalMonitorStateException("SV0f");
		
		// Pointer to the lock count
		int countp = __p + Constants.OBJECT_MONITOR_COUNT_OFFSET;
		
		// We can read our current count by comparing and setting zero
		int curcount = Assembly.atomicCompareGetAndSet(0, 0, countp);
		
		// {@squirreljme.error SV0g Too many monitor exits on objects.}
		if (curcount <= 0)
			throw new IllegalMonitorStateException("SV0g");
		
		// Reduce the count accordingly, if we reach zero we clear the lock
		if (Assembly.atomicDecrementAndGet(countp) == 0)
			if (ourtid != Assembly.atomicCompareGetAndSet(ourtid, 0, lkp))
			{
				// {@squirreljme.error SV0h The owning thread for the object
				// was changed during unlock?}
				throw new IllegalMonitorStateException("SV0h");
			}
	}
	
	/**
	 * Allocates a new object.
	 *
	 * @param __cl The class type.
	 * @return The resulting class pointer.
	 * @since 2019/05/24
	 */
	public static final int jvmNew(int __cl)
	{
		// Access of invalid class?
		if (__cl == Constants.BAD_MAGIC)
			Assembly.breakpoint();
		
		// Cannot allocate a null class
		if (__cl == 0)
			Assembly.breakpoint();
		
		// Get the class information for the object to allocate
		ClassInfo info = Assembly.pointerToClassInfo(__cl);
		
		// Allocate the memory
		int rv = Allocator.allocate(
			_TASK_ID | Allocator.CHUNK_BIT_IS_OBJECT, info.size);
		if (rv == 0)
			return 0;
		
		// Write class information with an initial count of one
		Assembly.memWriteInt(rv, Constants.OBJECT_CLASS_OFFSET,
			__cl);
		Assembly.memWriteInt(rv, Constants.OBJECT_COUNT_OFFSET,
			1);
		
		// Use this pointer
		return rv;
	}
	
	/**
	 * Allocates a new array.
	 *
	 * @param __at The array type.
	 * @param __len The length of the array.
	 * @return The resulting array pointer.
	 * @throws NegativeArraySizeException If an attempt is made to allocate
	 * an array of a negative size.
	 * @throws OutOfMemoryError If there is not enough memory left.
	 * @since 2019/04/24
	 */
	public static final int jvmNewArray(int __at, int __len)
		throws NegativeArraySizeException, OutOfMemoryError
	{
		// Access of invalid class?
		if (__at == Constants.BAD_MAGIC)
			Assembly.breakpoint();
		
		// Do not initialize null class
		if (__at == 0)
			Assembly.breakpoint();
		
		// Cannot allocate negative length
		if (__len < 0)
			return 0;
		
		// Get the class information for the array we want to allocate
		ClassInfo info = Assembly.pointerToClassInfo(__at);
		
		// Determine the actual size of allocation
		int allocsize = info.size + (info.cellsize * __len);
		
		// Allocate the memory
		int rv = Allocator.allocate(
			_TASK_ID | Allocator.CHUNK_BIT_IS_OBJECT, allocsize);
		if (rv == 0)
			return 0;
		
		// Write class information with an initial count of one
		Assembly.memWriteInt(rv, Constants.OBJECT_CLASS_OFFSET,
			__at);
		Assembly.memWriteInt(rv, Constants.OBJECT_COUNT_OFFSET,
			1);
		
		// Write length of array
		Assembly.memWriteInt(rv, Constants.ARRAY_LENGTH_OFFSET,
			__len);
		
		// Use this pointer
		return rv;
	}
	
	/**
	 * If this is an invoked then it just throws an exception to indicate that
	 * an illegal abstract method or unlinked method was called.
	 *
	 * @since 2019/05/26
	 */
	public static final void jvmPureVirtualCall()
	{
		Assembly.breakpoint();
		throw new VirtualMachineError();
	}
	
	/**
	 * This handles an unpure system call which may modify the behavior of
	 * any system call which needs to be done. Some system calls might not be
	 * supported by the host machine or they might not make sense (such as
	 * garbage collection), so as such this allows their behavior to modified.
	 *
	 * @param __si System call index.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @param __e Argument.
	 * @param __f Argument.
	 * @param __g Argument.
	 * @param __h Argument.
	 * @return The result.
	 * @since 2019/05/27
	 */
	public static final long jvmSystemCall(short __si, int __a, int __b,
		int __c, int __d, int __e, int __f, int __g, int __h)
	{
		// Override the behavior of system calls?
		switch (__si)
		{
				// Query index, this allows system calls to be replaced
				// and implemented if the native system lacks it or there is
				// a deprecation/enhancement or otherwise
			case SystemCallIndex.QUERY_INDEX:
				switch (__a)
				{
					case SystemCallIndex.GARBAGE_COLLECT:
					case SystemCallIndex.LOAD_STRING:
						return 1;
					
						// Otherwise, check if the native system supports
					default:
						return Assembly.sysCallPVL(__si, __a);
				}
				
				// Built-in system calls may set an error state
			case SystemCallIndex.ERROR_GET:
				switch (__a)
				{
						// Use last error state
					case SystemCallIndex.LOAD_STRING:
						return JVMFunction._LAST_ERROR;
					
						// Forward otherwise
					default:
						return Assembly.sysCallPV(__si, __a);
				}
			
				// Perform garbage collection
			case SystemCallIndex.GARBAGE_COLLECT:
				JVMFunction.jvmGarbageCollect();
				return 0;
				
				// Load string
			case SystemCallIndex.LOAD_STRING:
				JVMFunction._LAST_ERROR = 0;
				return Assembly.objectToPointer(
					JVMFunction.jvmLoadString(__a));
				
				// Use native handler
			default:
				return Assembly.sysCallPVL(__si, __a, __b, __c, __d, __e, __f,
					__g, __h);
		}
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted runt/klib/supervisor/cc/squirreljme/jvm/SoftDouble.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm;

/**
 * Software math operations on 64-bit double.
 *
 * @since 2019/05/24
 */
public class SoftDouble
{
	/**
	 * Not used.
	 *
	 * @since 2019/05/24
	 */
	private SoftDouble()
	{
	}
	
	/**
	 * Adds two values.
	 *
	 * @param __ah A high.
	 * @param __al A low.
	 * @param __bh B high.
	 * @param __bl B low.
	 * @return The result.
	 * @since 2019/05/24
	 */
	public static double add(int __ah, int __al, int __bh, int __bl)
	{
		Assembly.breakpoint();
		throw new todo.TODO();
	}
	
	/**
	 * Compares two values.
	 *
	 * @param __ah A high.
	 * @param __al A low.
	 * @param __bh B high.
	 * @param __bl B low.
	 * @return The result.
	 * @since 2019/05/24
	 */
	public static int cmpl(int __ah, int __al, int __bh, int __bl)
	{
		Assembly.breakpoint();
		throw new todo.TODO();
	}
	
	/**
	 * Compares two values.
	 *
	 * @param __ah A high.
	 * @param __al A low.
	 * @param __bh B high.
	 * @param __bl B low.
	 * @return The result.
	 * @since 2019/05/24
	 */
	public static int cmpg(int __ah, int __al, int __bh, int __bl)
	{
		Assembly.breakpoint();
		throw new todo.TODO();
	}
	
	/**
	 * Divides two values.
	 *
	 * @param __ah A high.
	 * @param __al A low.
	 * @param __bh B high.
	 * @param __bl B low.
	 * @return The result.
	 * @since 2019/05/24
	 */
	public static double div(int __ah, int __al, int __bh, int __bl)
	{
		Assembly.breakpoint();
		throw new todo.TODO();
	}
	
	/**
	 * Multiplies two values.
	 *
	 * @param __ah A high.
	 * @param __al A low.
	 * @param __bh B high.
	 * @param __bl B low.
	 * @return The result.
	 * @since 2019/05/24
	 */
	public static double mul(int __ah, int __al, int __bh, int __bl)
	{
		Assembly.breakpoint();
		throw new todo.TODO();
	}
	
	/**
	 * Negates a value.
	 *
	 * @param __ah A high.
	 * @param __al A low.
	 * @return The result.
	 * @since 2019/05/24
	 */
	public static double neg(int __ah, int __al)
	{
		Assembly.breakpoint();
		throw new todo.TODO();
	}
	
	/**
	 * ORs value, used for constants.
	 *
	 * @param __ah A high.
	 * @param __al A low.
	 * @param __bh B high.
	 * @param __bl B low.
	 * @return The result.
	 * @since 2019/05/27
	 */
	public static double or(int __ah, int __al, int __bh, int __bl)
	{
		return Assembly.doublePack(__ah | __bh, __al | __bl);
	}
	
	/**
	 * Remainders a value.
	 *
	 * @param __ah A high.
	 * @param __al A low.
	 * @param __bh B high.
	 * @param __bl B low.
	 * @return The result.
	 * @since 2019/05/24
	 */
	public static double rem(int __ah, int __al, int __bh, int __bl)
	{
		Assembly.breakpoint();
		throw new todo.TODO();
	}
	
	/**
	 * Subtracts values.
	 *
	 * @param __ah A high.
	 * @param __al A low.
	 * @param __bh B high.
	 * @param __bl B low.
	 * @return The result.
	 * @since 2019/05/24
	 */
	public static double sub(int __ah, int __al, int __bh, int __bl)
	{
		Assembly.breakpoint();
		throw new todo.TODO();
	}
	
	/**
	 * Converts to float.
	 *
	 * @param __ah A high.
	 * @param __al A low.
	 * @return The result.
	 * @since 2019/05/24
	 */
	public static float toFloat(int __ah, int __al)
	{
		Assembly.breakpoint();
		throw new todo.TODO();
	}
	
	/**
	 * Converts to integer.
	 *
	 * @param __ah A high.
	 * @param __al A low.
	 * @return The result.
	 * @since 2019/05/24
	 */
	public static int toInteger(int __ah, int __al)
	{
		Assembly.breakpoint();
		throw new todo.TODO();
	}
	
	/**
	 * Converts to long.
	 *
	 * @param __ah A high.
	 * @param __al A low.
	 * @return The result.
	 * @since 2019/05/24
	 */
	public static long toLong(int __ah, int __al)
	{
		Assembly.breakpoint();
		throw new todo.TODO();
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






































































































































































































































































































































































































































Deleted runt/klib/supervisor/cc/squirreljme/jvm/SoftFloat.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm;

/**
 * Software math operations on 32-bit floats.
 *
 * @since 2019/05/24
 */
public class SoftFloat
{
	/**
	 * Not used.
	 *
	 * @since 2019/05/24
	 */
	private SoftFloat()
	{
	}
	
	/**
	 * Adds two values.
	 *
	 * @param __a A.
	 * @param __b B.
	 * @return The result.
	 * @since 2019/05/24
	 */
	public static float add(int __a, int __b)
	{
		Assembly.breakpoint();
		throw new todo.TODO();
	}
	
	/**
	 * Compares two values.
	 *
	 * @param __a A.
	 * @param __b B.
	 * @return The result.
	 * @since 2019/05/24
	 */
	public static int cmpl(int __a, int __b)
	{
		Assembly.breakpoint();
		throw new todo.TODO();
	}
	
	/**
	 * Compares two values.
	 *
	 * @param __a A.
	 * @param __b B.
	 * @return The result.
	 * @since 2019/05/24
	 */
	public static int cmpg(int __a, int __b)
	{
		Assembly.breakpoint();
		throw new todo.TODO();
	}
	
	/**
	 * Divides two values.
	 *
	 * @param __a A.
	 * @param __b B.
	 * @return The result.
	 * @since 2019/05/24
	 */
	public static float div(int __a, int __b)
	{
		Assembly.breakpoint();
		throw new todo.TODO();
	}
	
	/**
	 * Multiplies two values.
	 *
	 * @param __a A.
	 * @param __b B.
	 * @return The result.
	 * @since 2019/05/24
	 */
	public static float mul(int __a, int __b)
	{
		Assembly.breakpoint();
		throw new todo.TODO();
	}
	
	/**
	 * Negates a value.
	 *
	 * @param __a A.
	 * @return The result.
	 * @since 2019/05/24
	 */
	public static float neg(int __a)
	{
		Assembly.breakpoint();
		throw new todo.TODO();
	}
	
	/**
	 * Ors a value, used for constant loading.
	 *
	 * @param __a A.
	 * @param __b B.
	 * @return The result.
	 * @since 2019/05/24
	 */
	public static float or(int __a, int __b)
	{
		return Assembly.intBitsToFloat(__a | __b);
	}
	
	/**
	 * Remainders a value.
	 *
	 * @param __a A.
	 * @param __b B.
	 * @return The result.
	 * @since 2019/05/24
	 */
	public static float rem(int __a, int __b)
	{
		Assembly.breakpoint();
		throw new todo.TODO();
	}
	
	/**
	 * Subtracts values.
	 *
	 * @param __a A.
	 * @param __b B.
	 * @return The result.
	 * @since 2019/05/24
	 */
	public static float sub(int __a, int __b)
	{
		Assembly.breakpoint();
		throw new todo.TODO();
	}
	
	/**
	 * Converts to double.
	 *
	 * @param __a A.
	 * @return The result.
	 * @since 2019/05/24
	 */
	public static double toDouble(int __a)
	{
		Assembly.breakpoint();
		throw new todo.TODO();
	}
	
	/**
	 * Converts to integer.
	 *
	 * @param __a A.
	 * @return The result.
	 * @since 2019/05/24
	 */
	public static int toInteger(int __a)
	{
		Assembly.breakpoint();
		throw new todo.TODO();
	}
	
	/**
	 * Converts to long.
	 *
	 * @param __a A.
	 * @return The result.
	 * @since 2019/05/24
	 */
	public static long toLong(int __a)
	{
		Assembly.breakpoint();
		throw new todo.TODO();
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






























































































































































































































































































































































































Deleted runt/klib/supervisor/cc/squirreljme/jvm/SoftInteger.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm;

/**
 * Software integer operations.
 *
 * @since 2019/05/27
 */
public class SoftInteger
{
	/**
	 * Not used.
	 *
	 * @since 2019/05/27
	 */
	private SoftInteger()
	{
	}
	
	/**
	 * Converts to double.
	 *
	 * @param __a A.
	 * @return The result.
	 * @since 2019/05/24
	 */
	public static double toDouble(int __a)
	{
		Assembly.breakpoint();
		throw new todo.TODO();
	}
	
	/**
	 * Converts to float.
	 *
	 * @param __a A.
	 * @return The result.
	 * @since 2019/05/24
	 */
	public static float toFloat(int __a)
	{
		Assembly.breakpoint();
		throw new todo.TODO();
	}
	
	/**
	 * Converts to long.
	 *
	 * @param __a A.
	 * @return The result.
	 * @since 2019/05/24
	 */
	public static long toLong(int __a)
	{
		// If the integer has the sign bit, then it will be sign extended
		// meaning all the upper bits get set
		if ((__a & 0x80000000) != 0)
			return Assembly.longPack(0xFFFFFFFF, __a);
		
		// Otherwise the top is just zero
		else
			return Assembly.longPack(0, __a);
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


















































































































































Deleted runt/klib/supervisor/cc/squirreljme/jvm/SoftLong.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm;

/**
 * Software math operations on 64-bit integer types.
 *
 * @since 2019/05/24
 */
public final class SoftLong
{
	/**
	 * Not used.
	 *
	 * @since 2019/05/24
	 */
	private SoftLong()
	{
	}
	
	/**
	 * Adds two values.
	 *
	 * @param __ah A high.
	 * @param __al A low.
	 * @param __bh B high.
	 * @param __bl B low.
	 * @return The result.
	 * @since 2019/05/24
	 */
	public static long add(int __ah, int __al, int __bh, int __bl)
	{
		// Add the higher/lower parts
		int ch = __ah + __bh,
			cl = __al + __bl;
		
		// If the low addition carried a bit over, then set that bit in the
		// high part
		if ((cl + 0x80000000) < (__al + 0x80000000))
			ch++;
		
		// Return result
		return Assembly.longPack(ch, cl);
	}
	
	/**
	 * Ands two values.
	 *
	 * @param __ah A high.
	 * @param __al A low.
	 * @param __bh B high.
	 * @param __bl B low.
	 * @return The result.
	 * @since 2019/05/24
	 */
	public static long and(int __ah, int __al, int __bh, int __bl)
	{
		return Assembly.longPack(__ah & __bh, __al & __bl);
	}
	
	/**
	 * Compares two values.
	 *
	 * @param __ah A high.
	 * @param __al A low.
	 * @param __bh B high.
	 * @param __bl B low.
	 * @return The result.
	 * @since 2019/05/24
	 */
	public static int cmp(int __ah, int __al, int __bh, int __bl)
	{
		// Compare high values firsts
		if (__ah < __bh)
			return -1;
		else if (__ah > __bh)
			return 1;
		
		// Compare low values with unsigned comparison
		__al += Integer.MIN_VALUE;
		__bl += Integer.MIN_VALUE;
		if (__al < __bl)
			return -1;
		else if (__al > __bl)
			return 1;
		return 0;
	}
	
	/**
	 * Divides two values.
	 *
	 * @param __ah A high.
	 * @param __al A low.
	 * @param __bh B high.
	 * @param __bl B low.
	 * @return The result.
	 * @since 2019/05/24
	 */
	public static long div(int __ah, int __al, int __bh, int __bl)
	{
		// Dividing by zero?
		if (__bh == 0 && __bl == 0)
			throw new ArithmeticException();
		
		return SoftLong.__div(false, Assembly.longPack(__ah, __al),
			Assembly.longPack(__bh, __bl));
	}
	
	/**
	 * Multiplies two values.
	 *
	 * @param __ah A high.
	 * @param __al A low.
	 * @param __bh B high.
	 * @param __bl B low.
	 * @return The result.
	 * @since 2019/05/24
	 */
	public static long mul(int __ah, int __al, int __bh, int __bl)
	{
		Assembly.breakpoint();
		throw new todo.TODO();
	}
	
	/**
	 * Negates a value.
	 *
	 * @param __ah A high.
	 * @param __al A low.
	 * @return The result.
	 * @since 2019/05/24
	 */
	public static long neg(int __ah, int __al)
	{
		// Negate and check for overflow
		int nh = (~__ah),
			nl = (~__al + 1);
		if (nl == 0)
			nh++;
		
		// Return result
		return Assembly.longPack(nh, nl);
	}
	
	/**
	 * Ors a value.
	 *
	 * @param __ah A high.
	 * @param __al A low.
	 * @param __bh B high.
	 * @param __bl B low.
	 * @return The result.
	 * @since 2019/05/24
	 */
	public static long or(int __ah, int __al, int __bh, int __bl)
	{
		return Assembly.longPack(__ah | __bh, __al | __bl);
	}
	
	/**
	 * Remainders a value.
	 *
	 * @param __ah A high.
	 * @param __al A low.
	 * @param __bh B high.
	 * @param __bl B low.
	 * @return The result.
	 * @since 2019/05/24
	 */
	public static long rem(int __ah, int __al, int __bh, int __bl)
	{
		// Dividing by zero?
		if (__bh == 0 && __bl == 0)
			throw new ArithmeticException();
		
		return SoftLong.__div(true, Assembly.longPack(__ah, __al),
			Assembly.longPack(__bh, __bl));
	}
	
	/**
	 * Shifts value left by bits.
	 *
	 * @param __ah A high.
	 * @param __al A low.
	 * @param __s Shift amount.
	 * @return The result.
	 * @since 2019/05/24
	 */
	public static long shl(int __ah, int __al, int __s)
	{
		// Mask the shift amount
		__s &= 0x3F;
		
		// Doing nothing?
		if (__s == 0)
			return Assembly.longPack(__ah, __al);
		
		// Shifting all the low bits to the high bits
		else if (__s >= 32)
			return Assembly.longPack(__al << (__s - 32), 0);
		
		// Merge of bits (shift in range of 1-31)
		else
			return Assembly.longPack((__ah << __s) | (__al >>> (32 - __s)),
				(__al << __s));
	}
	
	/**
	 * Shifts value right by bits.
	 *
	 * @param __ah A high.
	 * @param __al A low.
	 * @param __s Shift amount.
	 * @return The result.
	 * @since 2019/05/24
	 */
	public static long shr(int __ah, int __al, int __s)
	{
		// Mask the shift amount
		__s &= 0x3F;
		
		// Doing nothing?
		if (__s == 0)
			return Assembly.longPack(__ah, __al);
		
		// Shifting all the high bits low
		else if (__s >= 32)
			return Assembly.longPack((__ah & 0x80000000) >> 31,
				__ah >> (__s - 32));
		
		// Merge of bits (shift in range of 1-31)
		else
			return Assembly.longPack((__ah >> __s),
				(__ah << (32 - __s)) | (__al >>> __s));
	}
	
	/**
	 * Subtracts values.
	 *
	 * @param __ah A high.
	 * @param __al A low.
	 * @param __bh B high.
	 * @param __bl B low.
	 * @return The result.
	 * @since 2019/05/24
	 */
	public static long sub(int __ah, int __al, int __bh, int __bl)
	{
		// The same as add, but the second operand is negated
		long nb = SoftLong.neg(__bh, __bl);
		return SoftLong.add(__ah, __al,
			Assembly.longUnpackHigh(nb), Assembly.longUnpackLow(nb));
	}
	
	/**
	 * Converts to double.
	 *
	 * @param __a A.
	 * @return The result.
	 * @since 2019/05/24
	 */
	public static double toDouble(int __ah, int __al)
	{
		Assembly.breakpoint();
		throw new todo.TODO();
	}
	
	/**
	 * Converts to float.
	 *
	 * @param __ah A high.
	 * @param __al A low.
	 * @return The result.
	 * @since 2019/05/24
	 */
	public static float toFloat(int __ah, int __al)
	{
		Assembly.breakpoint();
		throw new todo.TODO();
	}
	
	/**
	 * Converts to integer.
	 *
	 * @param __ah A high.
	 * @param __al A low.
	 * @return The result.
	 * @since 2019/05/24
	 */
	public static int toInteger(int __ah, int __al)
	{
		// Just return the low order bits
		return __al;
	}
	
	/**
	 * Shifts value bits right unsigned.
	 *
	 * @param __ah A high.
	 * @param __al A low.
	 * @param __s Shift amount.
	 * @return The result.
	 * @since 2019/05/24
	 */
	public static long ushr(int __ah, int __al, int __s)
	{
		// Mask the shift amount
		__s &= 0x3F;
		
		// Doing nothing?
		if (__s == 0)
			return Assembly.longPack(__ah, __al);
		
		// Shifting all the high bits low
		else if (__s >= 32)
			return Assembly.longPack(0, __ah >>> (__s - 32));
		
		// Merge of bits (shift in range of 1-31)
		else
			return Assembly.longPack((__ah >>> __s),
				(__ah << (32 - __s)) | (__al >>> __s));
	}
	
	/**
	 * Xors two values.
	 *
	 * @param __ah A high.
	 * @param __al A low.
	 * @param __bh B high.
	 * @param __bl B low.
	 * @return The result.
	 * @since 2019/05/24
	 */
	public static long xor(int __ah, int __al, int __bh, int __bl)
	{
		return Assembly.longPack(__ah ^ __bh, __al ^ __bl);
	}
	
	/**
	 * Divides and remainders two values.
	 *
	 * @param __dorem Return the remainder?
	 * @param __num The numerator.
	 * @param __den The denominator.
	 * @return The result.
	 * @since 2019/05/24
	 */
	private static long __div(boolean __dorem, long __num, long __den)
	{
		// Wikipedia (http://en.wikipedia.org/wiki/Division_%28digital%29)
		// if D == 0 then throw DivisionByZeroException end
		// Q := 0 # initialize quotient and remainder to zero
		// R := 0
		// for i = n-1...0 do  # " where n is no of bits "
		//   R := R << 1       # left-shift R by 1 bit
		//   R(0) := N(i)      # set the least-significant bit
		//              # of R equal to bit i of the numerator
		//   if R >= D then
		//     R = R - D
		//     Q(i) := 1
		//   end
		// end
		long inquot = 0, inrem = 0;
		boolean isneg;
		
		// Disallow division by zero
		if (__den == 0)
			return 0;
		
		// Negative?
		isneg = ((__num < 0 && __den >= 0) || (__num >= 0 && __den < 0));
		
		// Force Positive
		__num = (__num < 0 ? -__num : __num);
		__den = (__den < 0 ? -__den : __den);
		
		// Perform Math
		for (int i = 63; i >= 0; i--)
		{
			inrem <<= 1;
			inrem &= 0xFFFFFFFFFFFFFFFEL;
			inrem |= ((__num >>> i) & 1L);
			
			// Unsigned comparison
			if ((inrem + Long.MIN_VALUE) >= (__den + Long.MIN_VALUE))
			{
				inrem -= __den;
				inquot |= (1L << i);
			}
		}
		
		// Make Negative
		if (isneg)
			inquot = -inquot;
		
		// Return
		return (__dorem ? inrem : inquot);
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<














































































































































































































































































































































































































































































































































































































































































































































































































































Deleted runt/klib/supervisor/cc/squirreljme/jvm/SupervisorPropertyIndex.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm;

/**
 * This indicates an index for a supervisor register which is controlled and
 * only settable by the supervisor. It is used in system call handling and
 * otherwise.
 *
 * @since 2019/10/04
 */
public interface SupervisorPropertyIndex
{
	/** The static field register of the task syscall handler. */
	public static final byte TASK_SYSCALL_STATIC_FIELD_POINTER =
		1;
	
	/** The method pointer of the task syscall method. */
	public static final byte TASK_SYSCALL_METHOD_HANDLER =
		2;
	
	/** The pool pointer of the task syscall method. */
	public static final byte TASK_SYSCALL_METHOD_POOL_POINTER =
		3;
	
	/** The number of available properties. */
	public static final byte NUM_PROPERTIES =
		4;
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<










































































Deleted runt/klib/supervisor/cc/squirreljme/jvm/SystemCallError.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm;

/**
 * This interface contains the various error codes for all of the system calls.
 *
 * @since 2019/05/23
 */
public final class SystemCallError
{
	/** No error, or success. */
	public static final byte NO_ERROR =
		0;
	
	/** The system call is not supported. */
	public static final byte UNSUPPORTED_SYSTEM_CALL =
		-1;
	
	/** The pipe descriptor is not valid. */
	public static final byte PIPE_DESCRIPTOR_INVALID =
		-2;
	
	/** Write error when writing to the pipe. */
	public static final byte PIPE_DESCRIPTOR_BAD_WRITE =
		-3;
	
	/** Value out of range. */
	public static final byte VALUE_OUT_OF_RANGE =
		-4;
	
	/** No frame buffer exists. */
	public static final byte NO_FRAMEBUFFER =
		-5;
	
	/** Permission denied. */
	public static final byte PERMISSION_DENIED =
		-6;
	
	/** Interrupted. */
	public static final byte INTERRUPTED =
		-7;
	
	/** Unknown error. */
	public static final byte UNKNOWN =
		-8;
	
	/** End of file reached. */
	public static final byte END_OF_FILE =
		-9;
	
	/** Error with IPC Call. */
	public static final byte IPC_ERROR =
		-10;
	
	/**
	 * Not used.
	 *
	 * @since 2019/05/23
	 */
	private SystemCallError()
	{
	}
	
	/**
	 * Checks if an error was set, if it was an exception is thrown.
	 *
	 * @param __si The system call to check.
	 * @throws SystemCallException If there was an error.
	 * @since 2020/01/12
	 */
	public static final void checkError(short __si)
		throws SystemCallException
	{
		int code = SystemCallError.getError(__si);
		if (code != NO_ERROR)
			throw new SystemCallException(__si, code);
	}
	
	/**
	 * Returns the error state.
	 *
	 * @param __si The system call index.
	 * @return The error, 0 will be on success.
	 * @since 2019/05/23
	 */
	public static final int getError(short __si)
	{
		return Assembly.sysCallV(SystemCallIndex.ERROR_GET, __si);
	}
	
	/**
	 * Converts the error to a string.
	 *
	 * @param __err The input error.
	 * @return The resulting string.
	 * @since 2020/01/12
	 */
	public static final String toString(int __err)
	{
		switch (__err)
		{
			case NO_ERROR:					return "NoError";
			case UNSUPPORTED_SYSTEM_CALL:	return "UnsupportedSystemCall";
			case PIPE_DESCRIPTOR_INVALID:	return "PDInvalid";
			case PIPE_DESCRIPTOR_BAD_WRITE:	return "PDBadWrite";
			case VALUE_OUT_OF_RANGE:		return "ValueOutOfRange";
			case NO_FRAMEBUFFER:			return "NoFramebuffer";
			case PERMISSION_DENIED:			return "PermissionDenied";
			case INTERRUPTED:				return "Interrupted";
			case UNKNOWN:					return "Unknown";
			case END_OF_FILE:				return "EndOfFile";
			case IPC_ERROR:					return "IPCError";
			
				// Some Other ID?
			default:
				return "ERROR" + __err;
		}
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
































































































































































































































































Deleted runt/klib/supervisor/cc/squirreljme/jvm/SystemCallException.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm;

/**
 * Exception that may be thrown by {@link SystemCallError.checkError(int)}.
 *
 * @since 2020/01/12
 */
public class SystemCallException
	extends RuntimeException
{
	/** The system call ID. */
	public final int callid;
	
	/** The error code. */
	public final int code;
	
	/**
	 * Initializes the exception with no message or cause.
	 *
	 * @since 2019/10/21
	 */
	public SystemCallException(int __sid, int __ec)
	{
		this.callid = __sid;
		this.code = __ec;
	}
	
	/**
	 * Initializes the exception with the given message and no cause.
	 *
	 * @param __m The message.
	 * @since 2019/10/21
	 */
	public SystemCallException(int __sid, int __ec, String __m)
	{
		super(__m);
		
		this.callid = __sid;
		this.code = __ec;
	}
	
	/**
	 * Initializes the exception with the given message and cause.
	 *
	 * @param __m The message.
	 * @param __t The cause.
	 * @since 2019/10/21
	 */
	public SystemCallException(int __sid, int __ec, String __m, Throwable __t)
	{
		super(__m, __t);
		
		this.callid = __sid;
		this.code = __ec;
	}
	
	/**
	 * Initializes the exception with the given cause and no message.
	 *
	 * @param __t The cause.
	 * @since 2019/10/21
	 */
	public SystemCallException(int __sid, int __ec, Throwable __t)
	{
		super(__t);
		
		this.callid = __sid;
		this.code = __ec;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2020/01/12
	 */
	@Override
	public String getMessage()
	{
		return "[SID=" + this.callid + ", ERR=" + this.code + "]: " +
			super.getMessage();
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






















































































































































































Deleted runt/klib/supervisor/cc/squirreljme/jvm/SystemCallIndex.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm;

/**
 * This contains the index of system calls.
 *
 * @since 2019/05/23
 */
public interface SystemCallIndex
{
	/**
	 * Checks if the system call is supported.
	 *
	 * @param 1 The system call index to query.
	 * @return Zero if not supported, otherwise a non-zero value.
	 */
	public static final byte QUERY_INDEX =
		0;
	
	/**
	 * Gets the last error code.
	 *
	 * This value that stores the error state is thread-local and it may be
	 * stored with a precision of at least 16-bits.
	 *
	 * If the system call index is not valid then it is assumed to be
	 * {@link #QUERY_INDEX}.
	 *
	 * @param 1 The system call index to query.
	 * @return The last error code, will be zero if the last command succeeded.
	 */
	public static final byte ERROR_GET =
		1;
	
	/**
	 * Sets the last error code.
	 *
	 * This value that stores the error state is thread-local and it may be
	 * stored with a precision of at least 16-bits.
	 *
	 * If the system call index is not valid then it is assumed to be
	 * {@link #QUERY_INDEX}.
	 *
	 * @param 1 The system call index to query.
	 * @param 2 The value to set error register to.
	 * @return Zero on success
	 */
	public static final byte ERROR_SET =
		2;
	
	/**
	 * Current wall clock milliseconds.
	 *
	 * @return The current milliseconds time.
	 */
	public static final byte TIME_MILLI_WALL =
		3;
	
	/**
	 * Returns the cross-IPC exception class which has been stored.
	 *
	 * This system call should have the same effect regardless of whether it
	 * is a supervisor thread or user thread, it does not get forwarded
	 * to the task system call handler.
	 *
	 * @return The exception which has been stored.
	 */
	public static final byte EXCEPTION_LOAD =
		4;
	
	/**
	 * Current monotonic clock nanoseconds (low).
	 *
	 * @return The monotonic nanoseconds time.
	 */
	public static final byte TIME_NANO_MONO =
		5;
	
	/**
	 * Stores the cross-IPC exception class for system call errors.
	 *
	 * This system call should have the same effect regardless of whether it
	 * is a supervisor thread or user thread, it does not get forwarded
	 * to the task system call handler.
	 *
	 * @param 1 The exception to store.
	 * @return The old value that was stored in the register.
	 */
	public static final byte EXCEPTION_STORE =
		6;
	
	/**
	 * VM Information: Free memory in bytes.
	 *
	 * @return The free memory amount in bytes.
	 */
	public static final byte VMI_MEM_FREE =
		7;
	
	/**
	 * VM Information: Used memory in bytes.
	 *
	 * @return The used memory amount in bytes.
	 */
	public static final byte VMI_MEM_USED =
		8;
	
	/**
	 * VM Information: Max memory in bytes.
	 *
	 * @return The max memory amount in bytes.
	 */
	public static final byte VMI_MEM_MAX =
		9;
	
	/**
	 * Suggests that the garbage collector should run, note that this may be
	 * a deferred operation and might not be immediate.
	 *
	 * @return Generally zero although any other value could be returned.
	 */
	public static final byte GARBAGE_COLLECT =
		10;
	
	/**
	 * Exits the VM with the given exit code.
	 *
	 * @param 1 The exit code to exit the process with.
	 * @return This generally does not return, if it does then the error code
	 * will likely specify why this failed.
	 */
	public static final byte EXIT =
		11;
	
	/**
	 * The API Level of the VM, this has been deprecated since the current
	 * SquirrelJME API specified in these system calls better handles various
	 * features.
	 *
	 * @return The API level of the virtual machine.
	 */
	@Deprecated
	public static final byte API_LEVEL =
		12;
	
	/**
	 * The pipe descriptor for stdin.
	 *
	 * @return The pipe descriptor for standard input.
	 */
	public static final byte PD_OF_STDIN =
		13;
	
	/**
	 * The pipe descriptor for stdout.
	 *
	 * @return The pipe descriptor for standard output.
	 */
	public static final byte PD_OF_STDOUT =
		14;
	
	/**
	 * The pipe descriptor for stderr.
	 *
	 * @return The pipe descriptor for standard error.
	 */
	public static final byte PD_OF_STDERR =
		15;
	
	/**
	 * Pipe descriptor: Write single byte.
	 *
	 * @param 1 The pipe descriptor.
	 * @param 2 The value of the byte to write, only the lowest 8-bits is used.
	 * @return The number of bytes written to the output, if this returns
	 * a value lower than zero then it indicates an error.
	 */
	public static final byte PD_WRITE_BYTE =
		16;
	
	/**
	 * Bulk sets the memory inside of a region, this follows the same pattern
	 * as C's {@code memset()} operation.
	 *
	 * @param 1 The address to set.
	 * @param 2 The value to set the region with.
	 * @param 3 The number of bytes to set.
	 * @return The number of bytes actually written, if this is zero then
	 * it is likely the system call is not supported.
	 */
	public static final byte MEM_SET =
		17;
	
	/**
	 * Bulk sets the memory inside of a region writing full integer values at
	 * a time which is generally faster, this follows the same pattern as C's
	 * {@code memset()} operation.
	 *
	 * @param 1 The address to set.
	 * @param 2 The value to set the region with.
	 * @param 3 The number of bytes to set, the lower 2-bits ({@code 0x3}) will
	 * be masked off so the length is always a multiple of four.
	 * @return The number of bytes actually written, if this is zero then
	 * it is likely the system call is not supported.
	 */
	public static final byte MEM_SET_INT =
		18;
	
	/**
	 * Get the height of the call stack.
	 *
	 * @return The height of the call stack.
	 */
	public static final byte CALL_STACK_HEIGHT =
		19;
	
	/**
	 * Gets the specified call stack item.
	 *
	 * @param 1 The number of frames from the top of the call stack to get the
	 * items for, zero will be the top-most item.
	 * @param 2 The item to obtain as specified in {@link CallStackItem}.
	 * @return The value of the item, if it is undefined or not supported
	 * then zero will be returned.
	 */
	public static final byte CALL_STACK_ITEM =
		20;
	
	/**
	 * Returns the string of the given pointer.
	 *
	 * @param 1 The pointer to the modified UTF encoded string.
	 * @return An instance of {@link String}.
	 */
	public static final byte LOAD_STRING =
		21;
	
	/**
	 * Fatal ToDo hit.
	 *
	 * @param 1 The code to use for the To Do.
	 * @return This should not return unless it is not supported.
	 */
	public static final byte FATAL_TODO =
		22;
	
	/**
	 * This is used to indicate that the supervisor booted correctly and that
	 * execution control is normal.
	 *
	 * @return Generally zero as no value is intended to be returned.
	 */
	public static final byte SUPERVISOR_BOOT_OKAY =
		23;
	
	/**
	 * Get, set, or change a property of the framebuffer, the properties which
	 * are defined are specified in {@link Framebuffer}.
	 *
	 * @param 1 The frame buffer property to select.
	 * @param ... Undefined, this depends on the property selected.
	 * @return Whatever value the frame buffer property will return.
	 */
	public static final byte FRAMEBUFFER =
		24;
	
	/**
	 * Returns the native byte order of the system the virtual machine is
	 * running on.
	 *
	 * @return Non-zero if little endian, otherwise zero will be big endian.
	 */
	public static final byte BYTE_ORDER_LITTLE =
		25;
	
	/**
	 * Returns the pointer to the option JAR data.
	 *
	 * @param 1 The option JAR slot to request.
	 * @return A pointer to the data or zero if there is no option JAR defined
	 * in the requested slot.
	 */
	public static final byte OPTION_JAR_DATA =
		26;
	
	/**
	 * Returns the size of the option JAR data.
	 *
	 * @param 1 The option JAR slot to request.
	 * @return The size of the specified option JAR or zero if there is no
	 * option JAR defined in the requested slot.
	 */
	public static final byte OPTION_JAR_SIZE =
		27;
	
	/**
	 * Loads the specified class.
	 *
	 * @param 1 The Modified UTF specifying the class name.
	 * @return The pointer to the loaded class info, will be zero on failure.
	 */
	public static final byte LOAD_CLASS_UTF =
		28;
	
	/**
	 * Loads the specified class.
	 *
	 * @param 1 A byte array encoded in UTF-8 which contains the class name.
	 * @return The pointer to the loaded class info, will be zero on failure.
	 */
	public static final byte LOAD_CLASS_BYTES =
		29;
	
	/**
	 * Sets the value of a supervisor property.
	 *
	 * Supervisor properties are local to a thread.
	 *
	 * Only the supervisor is allowed to set these properties.
	 *
	 * @param 1 The supervisor property to set.
	 * @param 2 The new value of the property.
	 * @return A non-zero value if this was successful.
	 */
	public static final byte SUPERVISOR_PROPERTY_SET =
		30;
	
	/**
	 * Gets the value of a supervisor property.
	 *
	 * Supervisor properties are local to a thread.
	 *
	 * @param 1 The supervisor property to get.
	 * @return The value of that property, error should be checked to ensure
	 * that it did not fail.
	 */
	public static final byte SUPERVISOR_PROPERTY_GET =
		31;
	
	/**
	 * Sets the task ID of the current thread frame.
	 *
	 * Only the supervisor is allowed to set tihus.
	 *
	 * @param 1 The task ID to set.
	 * @return A non-zero value if this was successful.
	 */
	public static final byte FRAME_TASK_ID_SET =
		32;
	
	/**
	 * Gets the value of a thread register.
	 *
	 * @return The value of the task ID.
	 */
	public static final byte FRAME_TASK_ID_GET =
		33;
	
	/**
	 * Perform a feedback operation.
	 *
	 * @param 1 The type of feedback to perform.
	 * @param 2 The duration of the feedback.
	 * @return Non-zero on success.
	 */
	public static final byte DEVICE_FEEDBACK =
		34;
	
	/**
	 * Sleep for the given number of nanoseconds.
	 *
	 * @param 1 The number of milliseconds to sleep for.
	 * @param 2 The number of nanoseconds to sleep for.
	 * @return Returns zero unless sleep was interrupted.
	 */
	public static final byte SLEEP =
		35;
	
	/**
	 * If the framebuffer is shared with the console, this tells the console
	 * printer to not send messages to the screen as it will corrupt the
	 * display on the screen.
	 */
	public static final byte SQUELCH_FB_CONSOLE =
		36;
	
	/**
	 * Perform IPC call.
	 *
	 * @param 1 The task to call, {@code 0} is the supervisor.
	 * @param 2 The IPC identifier which specifies which service this was
	 * associated with.
	 * @param ... Any arguments to the call.
	 * @return The value returned from the remote call.
	 */
	public static final byte IPC_CALL =
		37;
	
	/**
	 * The number of system calls that are defined in this run-time.
	 *
	 * One must NEVER utilize this value in a system call as it will have
	 * unintended consequences of requesting future API values.
	 */
	public static final byte NUM_SYSCALLS =
		38;
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted runt/klib/supervisor/cc/squirreljme/jvm/package-info.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

/**
 * This contains JVM specific implementation details along with the supervisor.
 *
 * @since 2019/05/25
 */

package cc.squirreljme.jvm;

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


































Deleted runt/klib/supervisor/java/lang/ArithmeticException.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.lang;

/**
 * This is thrown when there is a divide by zero.
 *
 * @since 2018/12/04
 */
public class ArithmeticException
	extends RuntimeException
{
	/**
	 * Initializes the exception with no message or cause.
	 *
	 * @since 2018/12/04
	 */
	public ArithmeticException()
	{
	}
	
	/**
	 * Initializes the exception with the given message and no cause.
	 *
	 * @since 2018/12/04
	 */
	public ArithmeticException(String __m)
	{
		super(__m);
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
















































































Deleted runt/klib/supervisor/java/lang/ArrayIndexOutOfBoundsException.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.lang;

/**
 * This is thrown when there is an out of bounds array access.
 *
 * @since 2019/05/26
 */
public class ArrayIndexOutOfBoundsException
	extends IndexOutOfBoundsException
{
	/**
	 * Initializes the exception with no message or cause.
	 *
	 * @since 2019/05/26
	 */
	public ArrayIndexOutOfBoundsException()
	{
	}
	
	/**
	 * Initializes the exception with the given message and no cause.
	 *
	 * @param __m The message.
	 * @since 2019/05/26
	 */
	public ArrayIndexOutOfBoundsException(String __m)
	{
		super(__m);
	}
	
	/**
	 * Initializes the exception with the given message and no cause.
	 *
	 * @param __m The message.
	 * @since 2019/05/26
	 */
	public ArrayIndexOutOfBoundsException(int __m)
	{
		super(Integer.valueOf(__m).toString());
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






































































































Deleted runt/klib/supervisor/java/lang/ArrayStoreException.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.lang;

/**
 * This is thrown when an attempt is made to store into an array of a
 * mismatched type.
 *
 * @since 2019/06/11
 */
public class ArrayStoreException
	extends RuntimeException
{
	/**
	 * Initializes the exception with no message or cause.
	 *
	 * @since 2019/06/11
	 */
	public ArrayStoreException()
	{
	}
	
	/**
	 * Initializes the exception with the given message and no cause.
	 *
	 * @param __m The message.
	 * @since 2019/06/11
	 */
	public ArrayStoreException(String __m)
	{
		super(__m);
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


















































































Deleted runt/klib/supervisor/java/lang/AutoCloseable.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.lang;

/**
 * This interface is used with the classes which are initialized in the
 * {@code try-with-resources} block, after the entire block has been finished
 * the {@link #close()} method is called automatically. This makes it much
 * simpler to free resources and no longer requires a {@code finally} with a
 * local variable mess to handle closing of streams.
 *
 * {@code
 *
 * try (FileInputStream fis = new FileInputStream("foo"))
 * {
 *     // fis is VISIBLE here.
 *     // Do stuff with file.
 * }
 * catch (IOException ioe)
 * {
 *     // fis is NOT VISIBLE here.
 *     // Handle exception or rethrow as needed
 * }
 * finally
 * {
 *     // fis is NOT VISIBLE here.
 *     // Other things to do regardless of success or an exception.
 * }
 * // The variable fis is NOT VISIBLE here and when this point of code has
 * // been reached, fis.close() would have been called.
 * 
 * }
 *
 * @see Closeable
 * @since 2015/03/23
 */
public interface AutoCloseable
{
	/**
	 * This releases all (or most) of the resources associated with
	 * an implementing class. When used with a try-with-resources block, this
	 * is automatically called after the scope of block has been left (it is
	 * executed after {@code finally}).
	 *
	 * It is recommended that a resource is actually closed (or at least
	 * marked as such) before an exception is thrown.
	 *
	 * Unlike {@link java.io.Closeable#close()} (and provided the class does
	 * not extend {@link java.io.Closeable}), calling this multiple times may
	 * produce side effects rather than doing nothing on a closed resource.
	 * However, it is stronly recommended and encouraged to follow the "do
	 * nothing when closed" behavior of {@link java.io.Closeable}.
	 *
	 * @throws Exception If there was an error closing the specified object.
	 * @since 2015/03/23
	 */
	public abstract void close()
		throws Exception;
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<








































































































































Deleted runt/klib/supervisor/java/lang/Boolean.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.lang;

/**
 * This represents a boxed boolean value.
 *
 * @since 2019/05/25
 */
public final class Boolean
{
	/** The boolean value. */
	private final boolean _value;
	
	/**
	 * Initializes the boolean value.
	 *
	 * @param __v The value to use.
	 * @since 2019/09/22
	 */
	public Boolean(boolean __v)
	{
		this._value = __v;
	}
	
	/**
	 * Returns the value of the boolean.
	 *
	 * @return The boolean value.
	 * @since 2019/09/22.
	 */
	public final boolean booleanValue()
	{
		return this._value;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2019/09/22
	 */
	@Override
	public final boolean equals(Object __o)
	{
		if (__o == this)
			return true;
		
		if (!(__o instanceof Boolean))
			return false;
		
		return this._value == ((Boolean)__o)._value;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2019/09/22
	 */
	@Override
	public final int hashCode()
	{
		return (this._value ? 1 : 0);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2019/09/22
	 */
	@Override
	public final String toString()
	{
		return (this._value ? "true" : "false");
	}
	
	/**
	 * Boxes the given boolean.
	 *
	 * @param __v The boolean to box.
	 * @return The boxed boolean value.
	 * @since 2019/09/22
	 */
	public static final Boolean valueOf(boolean __v)
	{
		return new Boolean(__v);
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
























































































































































































Deleted runt/klib/supervisor/java/lang/Byte.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.lang;

/**
 * This represents a boxed byte.
 *
 * @since 2019/05/25
 */
public final class Byte
	extends Number
{
	/** The value of this byte. */
	private final byte _value;
	
	/**
	 * Initializes the byte.
	 *
	 * @param __v The value.
	 * @since 2019/12/14
	 */
	public Byte(byte __v)
	{
		this._value = __v;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2019/12/14
	 */
	@Override
	public String toString()
	{
		return Integer.toString(this._value, 10);
	}
	
	/**
	 * Wraps the given byte value.
	 *
	 * @param __v The value to wrap.
	 * @return The wrapped byte.
	 * @since 2019/12/14
	 */
	public static final Byte valueOf(byte __v)
	{
		return new Byte(__v);
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
















































































































Deleted runt/klib/supervisor/java/lang/Character.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.lang;

/**
 * This represents a boxed character.
 *
 * @since 2019/05/25
 */
public final class Character
{
	/** The maximum radix for digit conversions. */
	public static final int MAX_RADIX =
		36;
	
	/** The maximum value for characters. */
	public static final char MAX_VALUE =
		65535;
	
	/** The minimum radix for digit conversions. */
	public static final int MIN_RADIX =
		2;
	
	/**
	 * Returns the character for the given digit and radix.
	 *
	 * @param __dig The digit to convert to a character.
	 * @param __r The radix to use for conversion.
	 * @return The character for the digit or NUL if the digit is out of range
	 * or the radix is out of range.
	 * @since 2018/10/13
	 */
	public static char forDigit(int __dig, int __r)
	{
		if (__dig < 0 || __dig >= __r || __r < Character.MIN_RADIX ||
			__r > Character.MAX_RADIX)
			return '\0';
		
		if (__dig < 10)
			return (char)('0' + __dig);
		return (char)('a' + (__dig - 10));
	}
	
	/**
	 * Converts the specified character to lower case without considering
	 * locale.
	 *
	 * @param __c The character to convert.
	 * @return The converted character.
	 * @since 2020/01/18
	 */
	public static char toLowerCase(char __c)
	{
		if (__c >= 'A' && __c <= 'Z')
			return (char)(__c + ('a' + (__c - 'A')));
		return __c;
	}
	
	/**
	 * Converts the specified character to lower case without considering
	 * locale.
	 *
	 * @param __c The character to convert.
	 * @return The converted character.
	 * @since 2020/01/18
	 */
	public static char toUpperCase(char __c)
	{
		if (__c >= 'a' && __c <= 'z')
			return (char)(__c + ('A' + (__c - 'a')));
		return __c;
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


































































































































































Deleted runt/klib/supervisor/java/lang/Class.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.lang;

import cc.squirreljme.jvm.Assembly;

/**
 * This represents the Java accessible class object which describes this
 * class.
 *
 * @param <C> The class type.
 * @since 2019/05/26
 */
public final class Class<C>
{
	/**
	 * Returns the super class of this class.
	 *
	 * @return The super class of this class.
	 * @since 2019/05/26
	 */
	public final Class<?> getSuperclass()
	{
		Assembly.breakpoint();
		throw new todo.TODO();
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






































































Deleted runt/klib/supervisor/java/lang/ClassCastException.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.lang;

/**
 * This is thrown when the class is not the correct type.
 *
 * @since 2019/05/25
 */
public class ClassCastException
	extends RuntimeException
{
	/**
	 * Initializes the exception with no message or cause.
	 *
	 * @since 2019/05/25
	 */
	public ClassCastException()
	{
	}
	
	/**
	 * Initializes the exception with the given message and no cause.
	 *
	 * @param __m The message.
	 * @since 2019/05/25
	 */
	public ClassCastException(String __m)
	{
		super(__m);
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
















































































Deleted runt/klib/supervisor/java/lang/CloneNotSupportedException.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.lang;

/**
 * This is thrown when cloning is not supported for the given object.
 *
 * @since 2018/12/04
 */
public class CloneNotSupportedException
	extends Exception
{
	/**
	 * Initializes the exception with no message or cause.
	 *
	 * @since 2018/12/04
	 */
	public CloneNotSupportedException()
	{
	}
	
	/**
	 * Initializes the exception with the given message and no cause.
	 *
	 * @since 2018/12/04
	 */
	public CloneNotSupportedException(String __m)
	{
		super(__m);
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
















































































Deleted runt/klib/supervisor/java/lang/Comparable.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.lang;

/**
 * This interface is used to set two classes as being comparable to other
 * classes.
 *
 * It is not required to but comparisons performed by this interface should
 * be comparable to {@link Object#equals(Object)} so that
 * {@code a.equals(b) == (a.compareTo(b) == 0)}.
 *
 * It is recommended to implement this class so that
 * {@code a.compareTo(b) == -b.compareTo(a)} is true, this makes the
 * comparisons consistent. However this might not be feasible for speed
 * purposes so it is highly recommended to at least have comparible negative,
 * zero, and positive.
 *
 * @param <T> The type to compare.
 * @since 2018/09/19
 */
public interface Comparable<T>
{
	/**
	 * Compares this instance to the argument passed, 
	 *
	 * Note that {@code NullPointerException} should be thrown for {@code __b}
	 * since {@code __b.compareTo(this)} would thrown an exception.
	 *
	 * @param __b The object to compare against.
	 * @return The result of the comparison, negative values mean
	 * {@code this < __b}, zero means {@code this == __b}, and positive values
	 * mean {@code this > __b}.
	 * @since 2018/09/19
	 */
	public abstract int compareTo(T __b);
}


<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






























































































Deleted runt/klib/supervisor/java/lang/Deprecated.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.lang;

import java.lang.annotation.Annotation;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * This is a flagging annotation which may be attached to classes, fields,
 * and methods to indicate that it should no longer be used in the future and
 * alternatives should be searched for and used instead.
 *
 * @since 2016/04/12
 */
@Documented
@Retention(value=RetentionPolicy.RUNTIME)
@Target(value={ElementType.CONSTRUCTOR, ElementType.FIELD,
	ElementType.LOCAL_VARIABLE, ElementType.METHOD, ElementType.PACKAGE,
	ElementType.PARAMETER, ElementType.TYPE})
public @interface Deprecated
{
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




































































Deleted runt/klib/supervisor/java/lang/Enum.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.lang;

import cc.squirreljme.jvm.Assembly;

/**
 * This is the base class for enum types.
 *
 * @param <E> The enum type.
 * @since 2018/09/24
 */
public abstract class Enum<E extends Enum<E>>
	implements Comparable<E>
{
	/** The name of the enum. */
	private final String _name;
	
	/** The ordinal of the enumeration. */
	private final int _ordinal;
	
	/**
	 * Initializes the enum properties.
	 *
	 * @param __s The enum name.
	 * @param __o The enum ordinal.
	 * @throws IllegalArgumentException If the ordinal is negative.
	 * @throws NullPointerException If no name was specified.
	 * @since 2018/09/24
	 */
	protected Enum(String __s, int __o)
		throws IllegalArgumentException, NullPointerException
	{
		// Enum has no string
		if (__s == null)
			throw new NullPointerException();
		
		// Enum has negative ordinal
		if (__o < 0)
			throw new IllegalArgumentException();
		
		this._name = __s;
		this._ordinal = __o;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/09/24
	 */
	@Override
	protected final Object clone()
		throws CloneNotSupportedException
	{
		// Enums cannot be cloned.
		throw new CloneNotSupportedException();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/09/24
	 */
	@Override
	public final int compareTo(E __o)
		throws ClassCastException, NullPointerException
	{
		if (__o == null)
			throw new NullPointerException();
		
		// Cannot compare enums of a different type.
		if (this.getDeclaringClass() != __o.getDeclaringClass())
			throw new ClassCastException();
		
		// Just ordinal subtraction
		return this.ordinal() - __o.ordinal();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/09/24
	 */
	@Override
	public final boolean equals(Object __o)
	{
		return this == __o;
	}
	
	/**
	 * Returns the class that declares this enum, this may be different from
	 * {@link Object#getClass()}.
	 *
	 * @return The declaring class of this enum.
	 * @since 2018/09/24
	 */
	@SuppressWarnings({"unchecked"})
	public final Class<E> getDeclaringClass()
	{
		// Enums are either directly extending or extending a base class which
		// then extends this class, so we just need to look a few places up
		// the tree
		Class<?> me = this.getClass(),
			ext = me.getSuperclass();
		if (ext == Enum.class)
			return (Class<E>)((Object)me);
		return (Class<E>)((Object)ext);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/09/24
	 */
	@Override
	public final int hashCode()
	{
		return super.hashCode();
	}
	
	/**
	 * Returns the name of the constant.
	 *
	 * @return The constant name.
	 * @since 2018/09/24
	 */
	public final String name()
	{
		return this._name;
	}
	
	/**
	 * Returns the ordinal of the constant.
	 *
	 * @return The ordinal constant.
	 * @since 2018/09/24
	 */
	public final int ordinal()
	{
		return this._ordinal;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/09/24
	 */
	@Override
	public String toString()
	{
		return this._name;
	}
	
	/**
	 * From the given enumeration, find a value which matches the given name.
	 *
	 * @param <T> The enumeration type to search in.
	 * @param __cl The class to lookup.
	 * @param __s The string to search for.
	 * @return The enumeration value.
	 * @throws IllegalArgumentException If the value was not found.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/12/07
	 */
	public static <T extends Enum<T>> T valueOf(Class<T> __cl, String __s)
		throws IllegalArgumentException, NullPointerException
	{
		if (__cl == null || __s == null)
			throw new NullPointerException("NARG");
		
		Assembly.breakpoint();
		throw new todo.TODO();
		/*
		// Get the data for this class because the enum information will be
		// in here somewhere
		ClassData data = ObjectAccess.classData(__cl);
		
		// {@squirreljme.error SV02 Cannot get the value of a non-enumeration
		// type or it has no implicit {@code values()} method.}
		StaticMethod getvalues = data.enumValues();
		if (getvalues == null)
			throw new ClassCastException("SV02");
		
		// Go through and check all the names
		for (Enum e : (Enum[])ObjectAccess.invokeStatic(getvalues))
			if (__s.equals(e.name()))
				return __cl.cast(e);
		
		// {@squirreljme.error SV03 Not an enumeration value. (The value)}
		throw new IllegalArgumentException(String.format("SV03 %s", __s));
		*/
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<










































































































































































































































































































































































































Deleted runt/klib/supervisor/java/lang/Error.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.lang;

/**
 * This represents an error which should not be caught.
 *
 * @since 2019/05/25
 */
public class Error
	extends Throwable
{
	/**
	 * Initializes the exception with no message or cause.
	 *
	 * @since 2019/05/25
	 */
	public Error()
	{
	}
	
	/**
	 * Initializes the exception with the given message and no cause.
	 *
	 * @param __m The message.
	 * @since 2019/05/25
	 */
	public Error(String __m)
	{
		super(__m);
	}
	
	/**
	 * Initializes the exception with the given message and cause.
	 *
	 * @param __m The message.
	 * @param __t The cause.
	 * @since 2019/05/25
	 */
	public Error(String __m, Throwable __t)
	{
		super(__m, __t);
	}
	
	/**
	 * Initializes the exception with the given cause and no message.
	 *
	 * @param __t The cause.
	 * @since 2019/05/25
	 */
	public Error(Throwable __t)
	{
		super(__t);
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






























































































































Deleted runt/klib/supervisor/java/lang/Exception.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.lang;

/**
 * For any exceptions which extend this class and not {@link RuntimeException}
 * they will act as checked exceptions by the compiler, thus they will need
 * to be handled accordingly.
 *
 * @since 2018/09/16
 */
public class Exception
	extends Throwable
{
	/**
	 * Initializes the exception with no message or cause.
	 *
	 * @since 2018/09/16
	 */
	public Exception()
	{
	}
	
	/**
	 * Initializes the exception with the given message and no cause.
	 *
	 * @param __m The message.
	 * @since 2018/09/16
	 */
	public Exception(String __m)
	{
		super(__m);
	}
	
	/**
	 * Initializes the exception with the given message and cause.
	 *
	 * @param __m The message.
	 * @param __t The cause.
	 * @since 2018/09/16
	 */
	public Exception(String __m, Throwable __t)
	{
		super(__m, __t);
	}
	
	/**
	 * Initializes the exception with the given cause and no message.
	 *
	 * @param __t The cause.
	 * @since 2018/09/16
	 */
	public Exception(Throwable __t)
	{
		super(__t);
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




































































































































Deleted runt/klib/supervisor/java/lang/IllegalArgumentException.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.lang;

/**
 * This is thrown when the argument of a method is not correct.
 *
 * @since 2018/10/12
 */
public class IllegalArgumentException
	extends RuntimeException
{
	/**
	 * Initializes the exception with no message or cause.
	 *
	 * @since 2018/10/12
	 */
	public IllegalArgumentException()
	{
	}
	
	/**
	 * Initializes the exception with the given message and no cause.
	 *
	 * @param __m The message.
	 * @since 2018/10/12
	 */
	public IllegalArgumentException(String __m)
	{
		super(__m);
	}
	
	/**
	 * Initializes the exception with the given message and cause.
	 *
	 * @param __m The message.
	 * @param __t The cause.
	 * @since 2018/10/12
	 */
	public IllegalArgumentException(String __m, Throwable __t)
	{
		super(__m, __t);
	}
	
	/**
	 * Initializes the exception with the given cause and no message.
	 *
	 * @param __t The cause.
	 * @since 2018/10/12
	 */
	public IllegalArgumentException(Throwable __t)
	{
		super(__t);
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
































































































































Deleted runt/klib/supervisor/java/lang/IllegalMonitorStateException.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.lang;

/**
 * This is usually thrown when an attempt is made to use a monitor which is
 * not owned by the current thread.
 *
 * @since 2018/12/04
 */
public class IllegalMonitorStateException
	extends RuntimeException
{
	/**
	 * Initializes the exception with no message or cause.
	 *
	 * @since 2018/12/04
	 */
	public IllegalMonitorStateException()
	{
	}
	
	/**
	 * Initializes the exception with the given message and no cause.
	 *
	 * @since 2018/12/04
	 */
	public IllegalMonitorStateException(String __m)
	{
		super(__m);
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


















































































Deleted runt/klib/supervisor/java/lang/IllegalStateException.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.lang;

/**
 * This is thrown when a certain state is invalid.
 *
 * @since 2018/12/04
 */
public class IllegalStateException
	extends RuntimeException
{
	/**
	 * Initializes the exception with no message or cause.
	 *
	 * @since 2018/12/04
	 */
	public IllegalStateException()
	{
	}
	
	/**
	 * Initializes the exception with the given message and no cause.
	 *
	 * @param __m The message.
	 * @since 2018/12/04
	 */
	public IllegalStateException(String __m)
	{
		super(__m);
	}
	
	/**
	 * Initializes the exception with the given message and cause.
	 *
	 * @param __m The message.
	 * @param __t The cause.
	 * @since 2018/12/04
	 */
	public IllegalStateException(String __m, Throwable __t)
	{
		super(__m, __t);
	}
	
	/**
	 * Initializes the exception with the given cause and no message.
	 *
	 * @param __t The cause.
	 * @since 2018/12/04
	 */
	public IllegalStateException(Throwable __t)
	{
		super(__t);
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
































































































































Deleted runt/klib/supervisor/java/lang/IndexOutOfBoundsException.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.lang;

/**
 * This is thrown when an index access was out of bounds.
 *
 * @since 2019/05/26
 */
public class IndexOutOfBoundsException
	extends RuntimeException
{
	/**
	 * Initializes the exception with no message or cause.
	 *
	 * @since 2019/05/26
	 */
	public IndexOutOfBoundsException()
	{
	}
	
	/**
	 * Initializes the exception with the given message and no cause.
	 *
	 * @param __m The message.
	 * @since 2019/05/26
	 */
	public IndexOutOfBoundsException(String __m)
	{
		super(__m);
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
















































































Deleted runt/klib/supervisor/java/lang/Integer.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.lang;

import cc.squirreljme.jvm.Assembly;

/**
 * This represents a boxed integer.
 *
 * @since 2019/05/25
 */
public final class Integer
	extends Number
{
	/** Minimum value. */
	public static final int MIN_VALUE =
		0x80000000;
	
	/** Maximum value. */
	public static final int MAX_VALUE =
		0x7FFFFFFF;
	
	/** The value of this integer. */
	private transient int _value;
	
	/**
	 * Initializes this integer.
	 *
	 * @param __v The value used.
	 * @since 2019/06/14
	 */
	public Integer(int __v)
	{
		this._value = __v;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2019/06/18
	 */
	@Override
	public String toString()
	{
		return Integer.toString(this._value, 10);
	}
	
	/**
	 * Converts the value to a string using the given radix.
	 *
	 * @param __v The input value.
	 * @param __r The radix of the string, if it exceeds the maximum
	 * permitted radix specified in {@link Character} then this is set to 10.
	 * @return The resulting string.
	 * @since 2018/09/23
	 */
	public static String toString(int __v, int __r)
	{
		// If the radix is not valid, then just force to 10
		if (__r < Character.MIN_RADIX || __r > Character.MAX_RADIX)
			__r = 10;
		
		StringBuilder sb = new StringBuilder();
		
		// Negative? Remember it but we need to swap the sign
		boolean negative;
		if ((negative = (__v < 0)))
			__v = -__v;
		
		// Insert characters at the end of the string, they will be reversed
		// later, it is easier this way
		for (boolean digit = false;;)
		{
			// Determine the current place
			int mod = (int)(__v % __r);
			
			// Do not print if any other digit was stored
			if (__v == 0 && digit)
				break;
			
			// Print character
			sb.append((char)(mod < 10 ? '0' + mod : 'a' + (mod - 10)));
			digit = true;
			
			// Stop printing characters
			if (__v == 0)
				break;
			
			// Use the remaining division
			else
				__v = __v / __r;
		}
		
		// Add the sign in
		if (negative)
			sb.append('-');
			
		// Because the values are added in the opposite order, reverse it
		sb.reverse();
		
		return sb.toString();
	}
	
	/**
	 * Returns a boxed value.
	 *
	 * @param __v The value to use.
	 * @return The boxed value.
	 * @since 2019/05/26
	 */
	public static final Integer valueOf(int __v)
	{
		return new Integer(__v);
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




















































































































































































































































Deleted runt/klib/supervisor/java/lang/InterruptedException.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.lang;

/**
 * This is thrown when a thread is interrupted.
 *
 * Note that this does not clear the interrupt status of a thread.
 *
 * @since 2018/11/21
 */
public class InterruptedException
	extends Exception
{
	/**
	 * Initializes the exception with no message or cause.
	 *
	 * @since 2018/11/21
	 */
	public InterruptedException()
	{
	}
	
	/**
	 * Initializes the exception with the given message and no cause.
	 *
	 * @param __m The message.
	 * @since 2018/11/21
	 */
	public InterruptedException(String __m)
	{
		super(__m);
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






















































































Deleted runt/klib/supervisor/java/lang/Long.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.lang;

import cc.squirreljme.jvm.Assembly;

/**
 * This represents a boxed long value.
 *
 * @since 2019/05/25
 */
public final class Long
	extends Number
{
	/** The maximum value. */
	public static final long MAX_VALUE =
		9223372036854775807L;
	
	/** The minimum value. */
	public static final long MIN_VALUE =
		-9223372036854775808L;
	
	/** The size of the type in bits. */
	public static final int SIZE =
		64;
	
	/** The value of this long. */
	private transient long _value;
	
	/**
	 * Initializes this long.
	 *
	 * @param __v The value used.
	 * @since 2019/06/20
	 */
	public Long(long __v)
	{
		this._value = __v;
	}
	
	/**
	 * Returns the long value.
	 *
	 * @return The long value.
	 * @since 2019/06/21
	 */
	public long longValue()
	{
		return this._value;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2019/06/20
	 */
	@Override
	public String toString()
	{
		return Long.toString(this._value, 10);
	}
	
	/**
	 * Converts the value to a string using the given radix.
	 *
	 * @param __v The input value.
	 * @param __r The radix of the string, if it exceeds the maximum
	 * permitted radix specified in {@link Character} then this is set to 10.
	 * @return The resulting string.
	 * @since 2018/09/23
	 */
	public static String toString(long __v, int __r)
	{
		// If the radix is not valid, then just force to 10
		if (__r < Character.MIN_RADIX || __r > Character.MAX_RADIX)
			__r = 10;
		
		StringBuilder sb = new StringBuilder();
		
		// Negative? Remember it but we need to swap the sign
		boolean negative;
		if ((negative = (__v < 0)))
			__v = -__v;
		
		// Insert characters at the end of the string, they will be reversed
		// later, it is easier this way
		for (boolean digit = false;;)
		{
			// Determine the current place
			int mod = (int)(__v % __r);
			
			// Do not print if any other digit was stored
			if (__v == 0 && digit)
				break;
			
			// Print character
			sb.append((char)(mod < 10 ? '0' + mod : 'a' + (mod - 10)));
			digit = true;
			
			// Stop printing characters
			if (__v == 0)
				break;
			
			// Use the remaining division
			else
				__v = __v / __r;
		}
		
		// Add the sign in
		if (negative)
			sb.append('-');
			
		// Because the values are added in the opposite order, reverse it
		sb.reverse();
		
		return sb.toString();
	}
	
	/**
	 * Returns a boxed value.
	 *
	 * @param __v The value to use.
	 * @return The boxed value.
	 * @since 2019/06/20
	 */
	public static final Long valueOf(long __v)
	{
		return new Long(__v);
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


















































































































































































































































































Deleted runt/klib/supervisor/java/lang/Math.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.lang;

/**
 * Math functions.
 *
 * @since 2019/11/30
 */
public class Math
{
	/**
	 * Returns the higher of the two values.
	 *
	 * @param __a The first.
	 * @param __b The second.
	 * @return The higher value.
	 * @since 2018/09/29
	 */
	public static int max(int __a, int __b)
	{
		if (__a > __b)
			return __a;
		return __b;
	}
	
	/**
	 * Returns the lower of the two values.
	 *
	 * @param __a The first.
	 * @param __b The second.
	 * @return The lower value.
	 * @since 2018/09/29
	 */
	public static int min(int __a, int __b)
	{
		if (__a < __b)
			return __a;
		return __b;
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


































































































Deleted runt/klib/supervisor/java/lang/NegativeArraySizeException.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.lang;

/**
 * This is thrown when there was an attempt to create an array of a negative
 * size.
 *
 * @since 2019/05/26
 */
public class NegativeArraySizeException
	extends RuntimeException
{
	/**
	 * Initializes the exception with no message or cause.
	 *
	 * @since 2019/05/26
	 */
	public NegativeArraySizeException()
	{
	}
	
	/**
	 * Initializes the exception with the given message and no cause.
	 *
	 * @param __m The message.
	 * @since 2019/05/26
	 */
	public NegativeArraySizeException(String __m)
	{
		super(__m);
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


















































































Deleted runt/klib/supervisor/java/lang/NullPointerException.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.lang;

/**
 * This is thrown when there is a null pointer.
 *
 * @since 2019/05/25
 */
public class NullPointerException
	extends RuntimeException
{
	/**
	 * Initializes the exception with no message or cause.
	 *
	 * @since 2019/05/25
	 */
	public NullPointerException()
	{
	}
	
	/**
	 * Initializes the exception with the given message and no cause.
	 *
	 * @param __m The message.
	 * @since 2019/05/25
	 */
	public NullPointerException(String __m)
	{
		super(__m);
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
















































































Deleted runt/klib/supervisor/java/lang/Number.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.lang;

/**
 * This is the base class for number types.
 *
 * @since 2019/05/25
 */
public abstract class Number
{
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<








































Deleted runt/klib/supervisor/java/lang/Object.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.lang;

import cc.squirreljme.jvm.Assembly;
import cc.squirreljme.jvm.CallStackItem;
import cc.squirreljme.jvm.Constants;
import cc.squirreljme.jvm.JVMFunction;
import cc.squirreljme.jvm.SystemCallIndex;

/**
 * This class defines the base class for every class which exists.
 *
 * @since 2019/05/25
 */
public class Object
{
	/**
	 * Clones this object.
	 *
	 * @return The clone of this object.
	 * @since 2019/05/26
	 */
	protected Object clone()
		throws CloneNotSupportedException
	{
		Assembly.breakpoint();
		throw new todo.TODO();
	}
	
	/**
	 * Returns the class type for this object.
	 *
	 * @return The class type.
	 * @since 2019/05/26
	 */
	public final Class<?> getClass()
	{
		Assembly.breakpoint();
		throw new todo.TODO();
	}
	
	/**
	 * Returns the hash code for this object.
	 *
	 * @return The object hash code.
	 * @since 2019/05/25
	 */
	public int hashCode()
	{
		return Assembly.objectToPointer(this);
	}
	
	/**
	 * Checks if this object is equal to another object.
	 *
	 * @param __o The object to check.
	 * @return If the objects are equal.
	 * @since 2019/05/25
	 */
	public boolean equals(Object __o)
	{
		return this == __o;
	}
	
	/**
	 * Returns the string representation of this object.
	 *
	 * @return The string representation.
	 * @since 2019/05/25
	 */
	public String toString()
	{
		return JVMFunction.jvmLoadString(Assembly.pointerToClassInfo(
			Assembly.memReadInt(Assembly.objectToPointer(this),
			Constants.OBJECT_CLASS_OFFSET)).namep) +
			"@" + Integer.toString(this.hashCode(), 16);
	}
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<












































































































































































Deleted runt/klib/supervisor/java/lang/OutOfMemoryError.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.lang;

/**
 * This is thrown when the virtual machine has ran out of memory.
 *
 * @since 2019/05/26
 */
public class OutOfMemoryError
	extends VirtualMachineError
{
	/**
	 * Initializes the exception with no message or cause.
	 *
	 * @since 2019/05/26
	 */
	public OutOfMemoryError()
	{
	}
	
	/**
	 * Initializes the exception with the given message and no cause.
	 *
	 * @param __m The message.
	 * @since 2019/05/26
	 */
	public OutOfMemoryError(String __m)
	{
		super(__m);
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
















































































Deleted runt/klib/supervisor/java/lang/Override.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.lang;

import java.lang.annotation.Annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * This is a flagging annotation which is attached to a method to indicate that
 * it overrides a method in the super class. When the compiler encounters
 * this, it makes sure that it actually overrides a method. If it does not
 * then a compilation error occurs. Using this all the time is recommended when
 * a method is intended to be overidden.
 *
 * As an example, if the base class has the following method:
 *
 * {@code
 * public static int foo(long __a);
 * }
 *
 * And a class which extends the base class has the following method:
 *
 * {@code
 * public static int foo(int __a);
 * }
 *
 * If it is intended to add a new {@code foo} which handles {@code int} instead
 * of {@code long} then this annotation should not be used, however it it is
 * intended to replace it (and specifying {@code int} was a mistake) then this
 * should be used.
 *
 * @since 2016/04/12
 */
@Target(value={ElementType.METHOD})
@Retention(value=RetentionPolicy.SOURCE)
public @interface Override
{
}


<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






































































































Deleted runt/klib/supervisor/java/lang/RuntimeException.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.lang;

/**
 * This is the base for any exception which is unchecked.
 *
 * @since 2019/05/25
 */
public class RuntimeException
	extends Throwable
{
	/**
	 * Initializes the exception with no message or cause.
	 *
	 * @since 2019/05/25
	 */
	public RuntimeException()
	{
	}
	
	/**
	 * Initializes the exception with the given message and no cause.
	 *
	 * @param __m The message.
	 * @since 2019/05/25
	 */
	public RuntimeException(String __m)
	{
		super(__m);
	}
	
	/**
	 * Initializes the exception with the given message and cause.
	 *
	 * @param __m The message.
	 * @param __t The cause.
	 * @since 2019/05/25
	 */
	public RuntimeException(String __m, Throwable __t)
	{
		super(__m, __t);
	}
	
	/**
	 * Initializes the exception with the given cause and no message.
	 *
	 * @param __t The cause.
	 * @since 2019/05/25
	 */
	public RuntimeException(Throwable __t)
	{
		super(__t);
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






























































































































Deleted runt/klib/supervisor/java/lang/Short.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.lang;

/**
 * This represents a boxed short.
 *
 * @since 2019/05/25
 */
public final class Short
	extends Number
{
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<










































Deleted runt/klib/supervisor/java/lang/String.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.lang;

import cc.squirreljme.jvm.Assembly;

/**
 * This represents a string.
 *
 * @since 2019/05/25
 */
public final class String
{
	/** The first interned string. */
	private static volatile String _FIRST_INTERN;
	
	/** The backing array. */
	transient final char[] _chars;
	
	/** The hashcode for this string. */
	transient int _hashcode;
	
	/** The next intern string in the chain. */
	private transient volatile String _nextintern;
	
	/**
	 * Initializes an empty string.
	 *
	 * @since 2019/05/26
	 */
	public String()
	{
		this._chars = new char[0];
	}
	
	/**
	 * Initializes a string which uses characters which are a copy of the given
	 * character array, using the offset and length.
	 *
	 * @param __c The characters to copy.
	 * @param __o The offset.
	 * @param __l The length.
	 * @throws IndexOutOfBoundsException If the offset and/or length are
	 * negative or exceed the array size.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/09/22
	 */
	public String(char[] __c, int __o, int __l)
		throws IndexOutOfBoundsException, NullPointerException
	{
		if (__c == null)
			throw new NullPointerException("NARG");
		if (__o < 0 || __l < 0 || (__o + __l) > __c.length)
			throw new IndexOutOfBoundsException("IOOB");
		
		// Copy characters
		char[] copy = new char[__l];
		for (int i = __o, o = 0; o < __l; i++, o++)
			copy[o] = __c[i];
		
		// Just use the copied buffer
		this._chars = copy;
	}
	
	/**
	 * Initializes string decoded from the given UTF-8 byte.
	 *
	 * @param __b The UTF-8 bytes to decode.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/05/26
	 */
	public String(byte[] __b)
		throws NullPointerException
	{
		if (__b == null)
			throw new NullPointerException("NARG");
		
		// Create temporary output which has the input characters and such so
		// this will be the maximum used
		int bn = __b.length;
		char[] temp = new char[bn];
		
		// Translate UTF-8 sequences
		int nc = 0;
		for (int i = 0; i < bn;)
		{
			// Get character
			int c = __b[i++] & 0xFF;
			
			// Single byte
			if ((c & 0b1000_0000) == 0)
				temp[nc++] = (char)c;
			
			// Double byte
			else if ((c & 0b1110_0000) == 0b1100_0000)
			{
				c = ((c & 0b0001_1111) << 6);
				c |= (__b[i++] & 0b111111);
				temp[nc++] = (char)c;
			}
			
			// Triple byte
			else if ((c & 0b1111_0000) == 0b1110_0000)
			{
				c = ((c & 0b0000_1111) << 12);
				c |= ((__b[i++] & 0b111111) << 6);
				c |= (__b[i++] & 0b111111);
				temp[nc++] = (char)c;
			}
		}
		
		// Use direct array if the same length
		if (nc == bn)
			this._chars = temp;
		
		// Too short, copy only used chars
		else
		{
			char[] chars = new char[nc];
			for (int i = 0; i < nc; i++)
				chars[i] = temp[i];
			this._chars = chars;
		}
	}
	
	/**
	 * Returns the character at the given index.
	 *
	 * @param __i The index to get.
	 * @return The character here.
	 * @throws IndexOutOfBoundsException If it is not within bounds.
	 * @since 2019/05/27
	 */
	public final char charAt(int __i)
		throws IndexOutOfBoundsException
	{
		char[] chars = this._chars;
		if (__i < 0 || __i >= chars.length)
			throw new IndexOutOfBoundsException();
		return chars[__i];
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2019/05/26
	 */
	@Override
	public final boolean equals(Object __o)
	{
		if (this == __o)
			return true;
		
		if (!(__o instanceof String))
			return false;
		
		String o = (String)__o;
		if (this.hashCode() != o.hashCode())
			return false;
			
		// Character data
		char[] ac = this._chars,
			bc = o._chars;
		
		// If the length differs, they are not equal
		int n = ac.length;
		if (n != bc.length)
			return false;
		
		// Compare individual characters
		for (int i = 0; i < n; i++)
			if (ac[i] != bc[i])
				return false;
		
		// Would be a match!
		return true;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2019/05/26
	 */
	@Override
	public final int hashCode()
	{
		// If the hashcode was already determined before then use that
		// cache
		int rv = this._hashcode;
		if (rv != 0)
			return rv;
		
		// Calculate the hashCode(), the JavaDoc gives the following formula:
		// == s[0]*31^(n-1) + s[1]*31^(n-2) + ... + s[n-1] .... yikes!
		char[] ch = this._chars;
		for (int i = 0, n = ch.length; i < n; i++)
			rv = ((rv << 5) - rv) + ch[i];
		
		// Cache hashcode for later
		this._hashcode = rv;
		return rv;
	}
	
	/**
	 * Returns a string which is a unique internal representation of a string.
	 *
	 * @return The unique interned string.
	 * @since 2019/05/26
	 */
	public final String intern()
	{
		// If no strings have ever been interned before, make this intern
		String first = _FIRST_INTERN;
		if (first == null)
		{
			_FIRST_INTERN = this;
			return this;
		}
		
		// Go through the linked list chain finding our string
		String at = first;
		while (at != null)
		{
			// Use the target string if it is the same
			if (this.equals(at))
				return at;
			
			// Go to the next link
			at = at._nextintern;
		}
		
		// Next intern is the first and the first becomes this one
		this._nextintern = first;
		_FIRST_INTERN = this;
		
		// Return our string since it was not in the chain
		return this;
	}
	
	/**
	 * Returns the last occurance of the given character.
	 *
	 * @param __c The character to find.
	 * @return The last occurance of the character or {@code -1} if it was
	 * not found.
	 * @since 2018/09/29
	 */
	public int lastIndexOf(int __c)
	{
		return this.lastIndexOf(__c, Integer.MAX_VALUE);
	}
	
	/**
	 * Returns the last occurance of the given character going backwards from
	 * the given index.
	 *
	 * @param __c The character to find.
	 * @param __dx The index to start at, this is clipped to within the
	 * string bounds accordingly although if it is negative no searching is
	 * done.
	 * @return The last occurance of the character or {@code -1} if it was
	 * not found.
	 * @since 2018/09/29
	 */
	public int lastIndexOf(int __c, int __dx)
	{
		// Never going to find anything at all
		if (__dx < 0)
			return -1;
		
		// Cap index
		char[] ch = this._chars;
		int n = ch.length;
		if (__dx >= n)
			__dx = n - 1;
		
		for (; __dx >= 0; __dx--)
			if (__c == ch[__dx])
				return __dx;
		
		// Not found
		return -1;
	}
	
	/**
	 * Returns the string length.
	 *
	 * @return The string length.
	 * @since 2019/05/27
	 */
	public final int length()
	{
		return this._chars.length;
	}
	
	/**
	 * Compares the given string regions to see if they match.
	 *
	 * @param __toff The offset for this string.
	 * @param __o The other string to compare against.
	 * @param __ooff The offset of the target string.
	 * @param __len The number of characters to compare.
	 * @return If the region matches or not.
	 * @throws NullPointerException On null arguments.
	 * @since 2020/01/18
	 */
	public boolean regionMatches(int __toff, String __o, int __ooff, int __len)
	{
		return this.regionMatches(false, __toff, __o, __ooff, __len);
	}
	
	/**
	 * Compares the given string regions to see if they match.
	 *
	 * @param __igncase Is case to be ignored?
	 * @param __toff The offset for this string.
	 * @param __b The other string to compare against.
	 * @param __boff The offset of the target string.
	 * @param __len The number of characters to compare.
	 * @return If the region matches or not.
	 * @throws NullPointerException On null arguments.
	 * @since 2020/01/18
	 */
	public boolean regionMatches(boolean __igncase, int __toff, String __b,
		int __boff, int __len)
	{
		if (__b == null)
			throw new NullPointerException("NARG");
		
		// Automatically false
		if (__toff < 0 || __boff < 0 ||
			__toff + __len > this.length() || __boff + __len > __b.length())
			return false;
		
		// A quirk of the standard is that negative lengths are not an error
		// but are treated as matches
		if (__len < 0)
			return true;
		
		// Disregarding case
		if (__igncase)
			for (int i = 0; i < __len; i++, __toff++, __boff++)
			{
				char a = this.charAt(__toff),
					b = __b.charAt(__boff);
				
				if (Character.toLowerCase(a) != Character.toLowerCase(b) &&
					Character.toUpperCase(a) != Character.toUpperCase(b))
					return false;
			}
		
		// Regarding case
		else
			for (int i = 0; i < __len; i++, __toff++, __boff++)
				if (this.charAt(__toff) != __b.charAt(__boff))
					return false;
		
		// Matches
		return true;
	}
	
	/**
	 * Returns a substring of this string starting at the given index.
	 *
	 * @param __s The index to start at.
	 * @return The sub-string for that index.
	 * @throws IndexOutOfBoundsException If the start is outside of the bounds.
	 * @since 2019/11/15
	 */
	public String substring(int __s)
		throws IndexOutOfBoundsException
	{
		// A substring starting at the zero character is the same
		if (__s == 0)
			return this;
		
		// Call other
		return this.substring(__s, this.length());
	}
	
	/**
	 * Returns a substring of this string.
	 *
	 * @param __s The starting index.
	 * @param __e The ending index.
	 * @throws IndexOutOfBoundsException If the string region is outside of
	 * bounds.
	 * @since 2019/11/15
	 */
	public String substring(int __s, int __e)
		throws IndexOutOfBoundsException
	{
		// {@squirreljme.error SV0s String substring is outside of bounds.}
		if (__s < 0 || __s > __e || __e > this.length())
			throw new IndexOutOfBoundsException("SV0s");
		
		return new String(this._chars, __s, (__e - __s));
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2019/05/26
	 */
	@Override
	public final String toString()
	{
		return this;
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






























































































































































































































































































































































































































































































































































































































































































































































































































































Deleted runt/klib/supervisor/java/lang/StringBuilder.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.lang;

/**
 * This class is used to build instances of string.
 *
 * @since 2019/05/25
 */
public final class StringBuilder
{
	/** Default capacity of the internal array. */
	private static final int _DEFAULT_CAPACITY =
		16;
	
	/** The internal buffer for storing characters. */
	private char[] _buffer;
	
	/** The characters which are in the buffer. */
	private int _at;
	
	/** The limit of the string buffer. */
	private int _limit;
	
	/**
	 * Initializes with the default capacity.
	 *
	 * @since 2018/09/22
	 */
	public StringBuilder()
	{
		this(StringBuilder._DEFAULT_CAPACITY);
	}
	
	/**
	 * Initailizes with the given capacity.
	 *
	 * @param __c The initial capacity.
	 * @throws NegativeArraySizeException If the capacity is negative.
	 * @since 2018/09/22
	 */
	public StringBuilder(int __c)
		throws NegativeArraySizeException
	{
		if (__c < 0)
			throw new NegativeArraySizeException();
		
		// Initialize buffer
		this._buffer = new char[__c];
		this._limit = __c;
	}
	
	/**
	 * Appends a character into this one.
	 *
	 * @param __v The value to append.
	 * @return {@code this}.
	 * @since 2019/06/18
	 */
	public final StringBuilder append(char __v)
	{
		// Before we go deeper check if the buffer needs to grow
		int limit = this._limit,
			at = this._at;
		char[] buffer = (at + 1 > limit ? this.__buffer(1) : this._buffer);
		
		// Add to the end
		buffer[at] = __v;
		this._at = at + 1;
		
		// Self
		return this;
	}
	
	/**
	 * Appends an integer into this one.
	 *
	 * @param __v The value to append.
	 * @return {@code this}.
	 * @since 2019/11/24
	 */
	public final StringBuilder append(int __v)
	{
		return this.append(Integer.toString(__v, 10));
	}
	
	/**
	 * Appends an object into this one.
	 *
	 * @param __v The value to append.
	 * @return {@code this}.
	 * @since 2019/11/25
	 */
	public final StringBuilder append(Object __v)
	{
		return this.append((__v == null ? "null" : __v.toString()));
	}
	
	/**
	 * Appends a string into this one.
	 *
	 * @param __v The value to append.
	 * @return {@code this}.
	 * @since 2019/05/25
	 */
	public final StringBuilder append(String __v)
	{
		// Print null?
		if (__v == null)
			__v = "null";
		
		// Length to append
		int len = __v.length();
		
		// Get buffer properties
		int limit = this._limit,
			at = this._at;
		char[] buffer = (at + len > limit ? this.__buffer(len) : this._buffer);
		
		// Place input characters at this point
		for (int i = 0; i < len; i++)
			buffer[at++] = __v.charAt(i);
		
		// Set new size
		this._at = at;
		
		return this;
	}
	
	/**
	 * Reverses all of the characters in the string.
	 *
	 * @return {@code this}.
	 * @since 2018/09/23
	 */
	public StringBuilder reverse()
	{
		// Get the buffer
		char[] buffer = this._buffer;
		int at = this._at;
		
		// Swap all the characters, a less than be because if it reaches the
		// center there will be no need to swap anything
		for (int a = 0, b = at - 1; a < b; a++, b--)
		{
			char x = buffer[a];
			buffer[a] = buffer[b];
			buffer[b] = x;
		}
		
		// Self
		return this;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2019/06/18
	 */
	@Override
	public final String toString()
	{
		return new String(this._buffer, 0, this._at);
	}
	
	/**
	 * Obtains the buffer, potentially resizing it to fit the given amount
	 * of characters.
	 *
	 * @param __l The number of characters to add.
	 * @return The buffer.
	 * @since 2018/09/23
	 */
	private final char[] __buffer(int __l)
	{
		// Get buffer properties
		char[] buffer = this._buffer;
		int limit = this._limit,
			at = this._at;
		
		// Need to resize the buffer to fit this?
		int nextat = at + __l;
		if (nextat > limit)
		{
			int newcapacity = nextat + StringBuilder._DEFAULT_CAPACITY;
			
			// Copy characters over
			char[] extra = new char[newcapacity];
			for (int i = 0; i < at; i++)
				extra[i] = buffer[i];
			
			this._buffer = (buffer = extra);
			this._limit = newcapacity;
		}
		
		return buffer;
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


























































































































































































































































































































































































































Deleted runt/klib/supervisor/java/lang/SuppressWarnings.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.lang;

import java.lang.annotation.Annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * Suppresses warnings that are generated by the compiler so that they do not
 * appear for the given method. Duplicates are permitted and values which are
 * unknown are ignored.
 *
 * The following warnings may have support to be disabled, although it is not
 * required: {@code all}, {@code boxing}, {@code cast}, {@code dep-ann},
 * {@code deprecation}, {@code fallthrough}, {@code finally}, {@code hiding},
 * {@code incomplete-switch}, {@code nls}, {@code null}, {@code rawtypes},
 * {@code restriction}, {@code serial}, {@code static-access},
 * {@code synthetic-access}, {@code unchecked},
 * {@code unqualified-field-access}, and {@code unused}.
 *
 * @since 2018/09/19
 */
@Target(value={ElementType.TYPE, ElementType.FIELD, ElementType.METHOD,
	ElementType.PARAMETER, ElementType.CONSTRUCTOR,
	ElementType.LOCAL_VARIABLE})
@Retention(value=RetentionPolicy.SOURCE)
public @interface SuppressWarnings
{
	/** The warnings that should be suppressed. */
	String[] value();
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






















































































Deleted runt/klib/supervisor/java/lang/System.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.lang;

import cc.squirreljme.jvm.Assembly;
import cc.squirreljme.jvm.SystemCallIndex;

/**
 * This contains some basic system functions.
 *
 * @since 2019/06/20
 */
public final class System
{
	/**
	 * Returns the current time on the system's clock in UTC since the epoch
	 * (January 1, 1970 UTC).
	 *
	 * Note that this clock is not monotonic in that if a system adjusts the
	 * system clock this method may return values lower than previous calls
	 * which are made.
	 *
	 * Depending on the host hardware and operating system, the granularity of
	 * this clock may or may not be accurate.
	 *
	 * @return The number of milliseconds since the epoch.
	 * @since 2017/11/10
	 */
	public static long currentTimeMillis()
	{
		// Returns the current time in UTC, not local time zone.
		return Assembly.sysCallPVL(SystemCallIndex.TIME_MILLI_WALL);
	}
	
	/**
	 * Returns the number of nanoseconds which have passed from a previously
	 * unspecified time. The returned value might not be accurate to the
	 * nanosecond. This clock is monotonic and does not suffer from time
	 * shifts caused by clock adjustments.
	 *
	 * The value returned here is specific to the current virtual machine and
	 * cannot be used elsewhere. Even two virtual machines running on the
	 * same system can use completely different values.
	 *
	 * After about 292 years (2 to the 63rd power nanoseconds) using signed
	 * comparison to calculate the amount of time that has passed will no
	 * longer function properly. For extremely long running processes it is
	 * recommended to treat the values as unsigned to extend past this limit
	 * or handle the overflow of the time value to represent any time
	 * quantity, this of course requires that time be checked every 292 or
	 * 584 years).
	 *
	 * @return The number of nanoseconds which have passed.
	 * @since 2016/06/16
	 */
	public static long nanoTime()
	{
		// Returns the current monotonic clock time
		return Assembly.sysCallPVL(SystemCallIndex.TIME_NANO_MONO);
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<










































































































































Deleted runt/klib/supervisor/java/lang/Throwable.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.lang;

import cc.squirreljme.jvm.Assembly;
import cc.squirreljme.jvm.Constants;
import cc.squirreljme.jvm.CallStackItem;
import cc.squirreljme.jvm.JVMFunction;
import cc.squirreljme.jvm.SystemCallIndex;
import cc.squirreljme.jvm.SystemCallError;
import cc.squirreljme.jvm.SystemCallIndex;

/**
 * This is the base class for all throwable types.
 *
 * @since 2019/05/25
 */
public class Throwable
{
	/** The message to use. */
	transient final String _message;
	
	/** The cause of this exception. */
	transient final Throwable _cause;
	
	/** The call trace. */
	transient final int[] _rawtrace;
	
	/** Suppressed exceptions. */
	transient volatile Throwable[] _suppressed;
	
	/**
	 * Initializes the exception with no message or cause.
	 *
	 * @since 2019/05/25
	 */
	public Throwable()
	{
		this(null, null);
	}
	
	/**
	 * Initializes the exception with the given message and no cause.
	 *
	 * @param __m The message.
	 * @since 2019/05/25
	 */
	public Throwable(String __m)
	{
		this(__m, null);
	}
	
	/**
	 * Initializes the exception with the given message and cause.
	 *
	 * @param __m The message.
	 * @param __t The cause.
	 * @since 2019/05/25
	 */
	public Throwable(String __m, Throwable __t)
	{
		// Hit a breakpoint if this is OOM
		if (this instanceof OutOfMemoryError)
			Assembly.breakpoint();
		
		this._message = __m;
		this._cause = __t;
		
		// Get the trace
		this._rawtrace = Throwable.__trace();
		
		// Print this trace
		this.printStackTrace();
	}
	
	/**
	 * Initializes the exception with the given cause and no message.
	 *
	 * @param __t The cause.
	 * @since 2019/05/25
	 */
	public Throwable(Throwable __t)
	{
		this(null, __t);
	}
	
	/**
	 * Adds a suppressed throwable which will be thrown alongside this
	 * throwable. This is mainly used with try-with-resources although a
	 * programmer may wish to add related throwables that additionally
	 * happened.
	 *
	 * @param __t The throwable to suppress.
	 * @throws IllegalArgumentException If the passed throwable is this.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/09/15
	 */
	public final void addSuppressed(Throwable __t)
		throws IllegalArgumentException, NullPointerException
	{
		if (__t == null)
			throw new NullPointerException("NARG");
		
		// {@squirreljme.error SV05 Cannot add a suppressed exception which
		// is this exception.}
		if (__t == this)
			throw new IllegalArgumentException("SV05");
		
		// No suppressed exceptions were set, initialize
		Throwable[] suppressed = this._suppressed;
		if (suppressed == null)
			this._suppressed = new Throwable[]{__t};
		
		// Otherwise rebuild the array and add it
		else
		{
			int n = suppressed.length;
			Throwable[] copy = new Throwable[n + 1];
			for (int i = 0; i < n; i++)
				copy[i] = suppressed[i];
			copy[n] = __t;
			
			// Use this instead
			this._suppressed = copy;
		}
	}
	
	/**
	 * Returns the message.
	 *
	 * @return The message used.
	 * @since 2019/06/16
	 */
	public String getMessage()
	{
		return this._message;
	}
	
	/**
	 * Prints the nicely formatted stack trace.
	 *
	 * @since 2019/06/17
	 */
	public void printStackTrace()
	{
		// This could fail in the event something is very wrong!
		try
		{
			// Print this and any causes!
			for (Throwable rover = this; rover != null; rover = rover._cause)
			{
				// Is this the main trace or a caused by?
				todo.DEBUG.note("%s Stack Trace: (%s) %s", (rover == this ?
					"Supervisor" : "Caused By"), JVMFunction.jvmLoadString(
						Assembly.pointerToClassInfo( Assembly.memReadInt(
						Assembly.objectToPointer(this),
						Constants.OBJECT_CLASS_OFFSET)).namep),
						rover.toString());
				
				// Obtain the raw trace that was captured on construction
				int[] rawtrace = this._rawtrace;
				int rawn = rawtrace.length;
				
				// Print all the items in it
				StringBuilder sb = new StringBuilder();
				for (int b = 0; b < rawn; b += CallStackItem.NUM_ITEMS)
				{
					// Print it out
					todo.DEBUG.note("    %s::%s:%s T%d (%s:%d) A@%d J@%d/%d",
						JVMFunction.jvmLoadString(
							rawtrace[b + CallStackItem.CLASS_NAME]),
						JVMFunction.jvmLoadString(
							rawtrace[b + CallStackItem.METHOD_NAME]),
						JVMFunction.jvmLoadString(
							rawtrace[b + CallStackItem.METHOD_TYPE]),
						rawtrace[b + CallStackItem.TASK_ID],
						JVMFunction.jvmLoadString(
							rawtrace[b + CallStackItem.SOURCE_FILE]),
						rawtrace[b + CallStackItem.SOURCE_LINE],
						Integer.toString(
							rawtrace[b + CallStackItem.PC_ADDRESS], 16),
						rawtrace[b + CallStackItem.JAVA_OPERATION],
						rawtrace[b + CallStackItem.JAVA_PC_ADDRESS]);
				}
			}
		}
		
		// If printing out this trace failed then use the backup mechanism!
		catch (Throwable t)
		{
			// Print the original trace
			this.printStackTraceBackup();
			
			// Print the raw backup trace for the trace we tried to print
			// to figure out what potentially went wrong?
			todo.DEBUG.codeBarrier('p', 'T');
			t.printStackTraceBackup();
			todo.DEBUG.codeBarrier('P', 't');
		}
	}
	
	/**
	 * Print a stack trace using only codes so that it may still be used
	 * accordingly as such.
	 *
	 * @since 2019/09/22
	 */
	public void printStackTraceBackup()
	{
		// Print this and any causes!
		for (Throwable rover = this; rover != null; rover = rover._cause)
		{
			// Supervisor or caused by?
			todo.DEBUG.code('T', (rover == this ? 'S' : 'C'),
				Assembly.objectToPointer(rover));
			
			// The thrown type
			todo.DEBUG.code('T', 'Y', Assembly.memReadInt(
				Assembly.objectToPointer(this),
				Constants.OBJECT_CLASS_OFFSET));
			
			// Obtain the raw trace that was captured on construction
			int[] rawtrace = this._rawtrace;
			int rawn = rawtrace.length;
			
			// Print all the items in it
			for (int base = 0; base < rawn; base += CallStackItem.NUM_ITEMS)
				try
				{
					// Indicate start of element
					todo.DEBUG.code('T', '-');
					
					// Print out the raw details
					todo.DEBUG.codeUtf('T', 'c',
						rawtrace[base + CallStackItem.CLASS_NAME]);
					todo.DEBUG.codeUtf('T', 'n',
						rawtrace[base + CallStackItem.METHOD_NAME]);
					todo.DEBUG.codeUtf('T', 'y',
						rawtrace[base + CallStackItem.METHOD_TYPE]);
					todo.DEBUG.codeUtf('T', '#',
						rawtrace[base + CallStackItem.TASK_ID]);
					todo.DEBUG.codeUtf('T', 'f',
						rawtrace[base + CallStackItem.SOURCE_FILE]);
					todo.DEBUG.code('T', 'l',
						rawtrace[base + CallStackItem.SOURCE_LINE]);
					todo.DEBUG.code('T', 'a',
						rawtrace[base + CallStackItem.PC_ADDRESS]);
					todo.DEBUG.code('T', 'j',
						rawtrace[base + CallStackItem.JAVA_PC_ADDRESS]);
					todo.DEBUG.code('T', 'o',
						rawtrace[base + CallStackItem.JAVA_OPERATION]);
				}
				
				// Error getting stack trace element
				catch (Throwable t)
				{
					todo.DEBUG.code('X', 'T', base);
				}
			
			// Indicate end of current set
			todo.DEBUG.code('T', '<');
		}
		
		// Indicate end of trace log
		todo.DEBUG.code('T', '_');
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2019/06/24
	 */
	@Override
	public String toString()
	{
		return this._message;
	}
	
	/**
	 * Returns the call stack.
	 *
	 * @return The resulting call stack.
	 * @since 2019/06/17
	 */
	private static final int[] __trace()
	{
		// Get the call height, ignore if not supported!
		int callheight = Assembly.sysCallPV(SystemCallIndex.CALL_STACK_HEIGHT);
		if (callheight <= 0 || Assembly.sysCallPV(SystemCallIndex.ERROR_GET,
			SystemCallIndex.CALL_STACK_HEIGHT) != SystemCallError.NO_ERROR)
			return new int[0];
		
		// Remove the top-most frame because it will be this method
		callheight--;
		
		// Get the call parameters
		int[] rv = new int[callheight * CallStackItem.NUM_ITEMS];
		for (int z = 0, base = 0; z < callheight; z++,
			base += CallStackItem.NUM_ITEMS)
			for (int i = 0; i < CallStackItem.NUM_ITEMS; i++)
			{
				// Get parameter
				int vx = Assembly.sysCallPV(SystemCallIndex.CALL_STACK_ITEM,
					1 + z, i);
				
				// Nullify unknown or invalid parameters
				if (Assembly.sysCallPV(SystemCallIndex.ERROR_GET,
					SystemCallIndex.CALL_STACK_ITEM) !=
					SystemCallError.NO_ERROR)
					vx = 0;
				
				// Fill in
				rv[base + i] = vx;
			}
		
		// Return the raw parameters
		return rv;
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<












































































































































































































































































































































































































































































































































































































































































Deleted runt/klib/supervisor/java/lang/VirtualMachineError.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.lang;

/**
 * This is thrown when there is a problem with the virtual machine.
 *
 * @since 2019/05/26
 */
public class VirtualMachineError
	extends Error
{
	/**
	 * Initializes the exception with no message or cause.
	 *
	 * @since 2019/05/26
	 */
	public VirtualMachineError()
	{
	}
	
	/**
	 * Initializes the exception with the given message and no cause.
	 *
	 * @param __m The message.
	 * @since 2019/05/26
	 */
	public VirtualMachineError(String __m)
	{
		super(__m);
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
















































































Deleted runt/klib/supervisor/java/lang/annotation/Annotation.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.lang.annotation;

/**
 * This is the common interface in which all annotation types are inherited
 * from.
 *
 * If a random class or interface implements this interface and it is not an
 * annotation type, then it is not an annotation.
 *
 * @since 2014/10/13
 */
public interface Annotation
{
	/**
	 * Returns the annotation type used for this annotation.
	 *
	 * @return The annotation type.
	 * @since 2014/10/13
	 */
	public abstract Class<? extends Annotation> annotationType();
	
	/**
	 * Checks the logical equality to another annotation type, they are both
	 * considered to be equal when all of their members are equal and they are
	 * of the same type.
	 *
	 * Primitive types are checked directly except for floating point types
	 * which are equality checked through their wrapper classes.
	 *
	 * Floating point NaN values are considered to be equal, that is the
	 * {@code ==} operator is not used.
	 *
	 * {@link String}, {@link Class}, and enumerations are considered equal if
	 * their normal {@code equals()} evaluates to true.
	 *
	 * Two arrays are equal if {@code Arrays.equals(a, b)} evaluates to
	 * {@code true}.
	 *
	 * @param __o The other object to check against.
	 * @return {@code true} if they are logically equivalent.
	 * @since 2014/10/13
	 */
	public abstract boolean equals(Object __o);
	
	/**
	 * Calculates the hash code which is a sum of the hash codes of its members
	 * in a specifically defined pattern.
	 *
	 * The base hash code for a member is {@code (127 *
	 * ((String)memberName).hashCode()) ^ specialValue}. The variable
	 * {@code specialValue} is defined depending on the
	 * context. If it is a primitive type, then the hash code that would be
	 * returned if they were object types (their wrapper classes) is used. If
	 * an array then {@code Arrays.hashCode()} is used. Otherwise, it is the
	 * normal hashCode of the specified value.
	 *
	 * @return The hash code for this annotation.
	 * @since 2014/10/13
	 */
	public abstract int hashCode();
	
	/**
	 * Returns an implementation dependent string which represents the
	 * annotation and all of its values.
	 *
	 * @return The string representation of this annotation.
	 * @since 2014/10/13
	 */
	public abstract String toString();
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


































































































































































Deleted runt/klib/supervisor/java/lang/annotation/Documented.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.lang.annotation;

/**
 * This indicates that the specified annotation should be documented by the
 * Java documentation tool whenever it is used.
 *
 * @since 2014/10/13
 */
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.ANNOTATION_TYPE})
public @interface Documented
{
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
















































Deleted runt/klib/supervisor/java/lang/annotation/ElementType.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.lang.annotation;

/**
 * Specifies the type of element that the annotation is permitted to be
 * attached to in the source code.
 *
 * @since 2014/10/13
 */
public enum ElementType
{
	/** Annotation types). */
	ANNOTATION_TYPE(),
	
	/** Constructors. */
	CONSTRUCTOR(),
	
	/** Fields. */
	FIELD(),
	
	/** Local variables. */
	LOCAL_VARIABLE(),
	
	/** Methods. */
	METHOD(),
	
	/** Packages. */
	PACKAGE(),
	
	/** Parameter of a method. */
	PARAMETER(),
	
	/** A class, interface, or enumeration. */
	TYPE(),
	
	/** End. */
	;
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
































































































Deleted runt/klib/supervisor/java/lang/annotation/Inherited.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.lang.annotation;

/**
 * Indicates that the annotation type should automatically be inherited so that
 * the subclass type appears to have this annotation when it is requested. That
 * is, if an annotation with this annotation is requested it will keep going up
 * the superclasses until it is found.
 *
 * This only affects classes which use an annotation with this annotation, as
 * such interfaces are excluded.
 *
 * @since 2014/10/13
 */
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.ANNOTATION_TYPE})
public @interface Inherited
{
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


























































Deleted runt/klib/supervisor/java/lang/annotation/Retention.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.lang.annotation;

/**
 * This is used to indicate how far into the compilation and runtime process
 * should keep a visible mark on an annotation.
 *
 * @since 2014/10/13
 */
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.ANNOTATION_TYPE})
public @interface Retention
{
	/**
	 * Specifies where the annotation exists during and after compilation of
	 * source code.
	 *
	 * @return The storage of the annotation.
	 * @see RetentionPolicy
	 * @since 2014/10/13
	 */
	RetentionPolicy value();
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


































































Deleted runt/klib/supervisor/java/lang/annotation/RetentionPolicy.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.lang.annotation;

/**
 * Specifies how far through compilation and running of code that an annotation
 * should be visible.
 *
 * @since 2014/10/13
 */
public enum RetentionPolicy
{
	/** Kept after compilation, but not visible at runtime. */
	CLASS(),
	
	/** Kept after compilation and visible at runtime. */
	RUNTIME(),
	
	/** Removed after compilation, does not appear in the class file. */
	SOURCE(),
	
	/** End. */
	;
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


































































Deleted runt/klib/supervisor/java/lang/annotation/Target.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.lang.annotation;

/**
 * Specifies the context in which the annotation is valid.
 *
 * @since 2014/10/13
 */
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.ANNOTATION_TYPE})
public @interface Target
{
	/**
	 * A list of valid contexts where the annotation may be used.
	 *
	 * @return An array of permitted targets.
	 * @since 2014/10/13
	 */
	ElementType[] value();
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




























































Deleted runt/klib/supervisor/java/lang/package-info.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

/**
 * Base Java language support.
 *
 * @since 2019/05/25
 */

package java.lang;

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


































Deleted runt/klib/supervisor/java/util/HashMap.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.util;

import cc.squirreljme.jvm.Assembly;

/**
 * This represents a standard hash map.
 *
 * @since 2019/06/24
 */
public class HashMap<K, V>
{
	/** The number of buckets to use. */
	private static final int _BUCKET_COUNT =
		16;
	
	/** Mask for buckets. */
	private static final int _BUCKET_MASK =
		0xF;
	
	/** Buckets available. */
	private final __Bucket__[] _buckets =
		new __Bucket__[_BUCKET_COUNT];
	
	/**
	 * Checks if the map contains the given key.
	 *
	 * @param __k The key to check.
	 * @return If a key is contained in it.
	 * @since 2019/06/24
	 */
	public boolean containsKey(Object __k)
	{
		// Calculate hash code
		int hash = __k.hashCode();
		
		// Find existing bucket
		__Bucket__ bucket = this._buckets[hash & _BUCKET_MASK];
		if (bucket == null)
			return false;
		
		// Go through items
		for (__Item__ i : bucket._items)
			if (i != null && i._hash == hash && HashMap.__equals(__k, i._key))
				return true;
		
		// Not found
		return false;
	}
	
	/**
	 * Gets a value from the map.
	 *
	 * @param __k The key to get.
	 * @return The value.
	 * @since 2019/06/24
	 */
	@SuppressWarnings({"unchecked"})
	public V get(K __k)
	{
		// Calculate hash code
		int hash = __k.hashCode();
		
		// Find existing bucket
		__Bucket__ bucket = this._buckets[hash & _BUCKET_MASK];
		if (bucket == null)
			return null;
		
		// Go through items
		for (__Item__ i : bucket._items)
			if (i != null && i._hash == hash && HashMap.__equals(__k, i._key))
				return (V)i._value;
		
		// Not found
		return null;
	}
	
	/**
	 * Puts an item into the map.
	 *
	 * @param __k The key.
	 * @param __v The value.
	 * @return The old item, if any.
	 * @since 2019/06/24
	 */
	@SuppressWarnings({"unchecked"})
	public V put(K __k, V __v)
	{
		// Calculate hash code
		int hash = __k.hashCode(),
			bkid = hash & _BUCKET_MASK;
		
		// Find existing bucket, create if missing
		__Bucket__ bucket = this._buckets[bkid];
		if (bucket == null)
			this._buckets[bkid] = (bucket = new __Bucket__());
		
		// Check if it already exists in the map
		__Item__[] items = bucket._items;
		int n = items.length,
			empty = -1;
		for (int i = 0; i < n; i++)
		{
			__Item__ it = items[i];
			
			// Is empty slot, use it
			if (it == null)
				empty = i;
			
			// Matching key, replace
			else if (it._hash == hash && HashMap.__equals(__k, it._key))
			{
				V rv = (V)it._value;
				it._value = __v;
				return rv;
			}
		}
		
		// Add new item at the end
		__Item__[] newitems = new __Item__[n + 1];
		for (int i = 0; i < n; i++)
			newitems[i] = items[i];
		__Item__ it = new __Item__(hash, __k);
		newitems[n] = it;
		it._value = __v;
		
		// Store new items
		bucket._items = newitems;
		
		// There was no previous old value
		return null;
	}
	
	/**
	 * Returns if two objects are equal to each other.
	 *
	 * @param __a The first object.
	 * @param __b The second object.
	 * @return If they are equal or not.
	 * @since 2019/06/24
	 */
	private static final boolean __equals(Object __a, Object __b)
	{
		// Either side is null
		if (__a == null || __b == null)
			return (__a == __b);
		
		// Use equality check
		return __a.equals(__b);
	}
	
	/**
	 * This represents a single bucket within the map.
	 *
	 * @since 2019/06/24
	 */
	private static final class __Bucket__
	{
		/** Items within the bucket. */
		__Item__[] _items =
			new __Item__[_BUCKET_COUNT];
	}
	
	/**
	 * A single item within a bucket.
	 *
	 * @since 2019/06/24
	 */
	private static final class __Item__
	{
		/** The hashcode. */
		final int _hash;
		
		/** The key. */
		final Object _key;
		
		/** The value. */
		Object _value;
		
		/**
		 * Initializes the item.
		 *
		 * @param __h The hash.
		 * @param __k The key.
		 */
		__Item__(int __h, Object __k)
		{
			this._hash = __h;
			this._key = __k;
		}
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


















































































































































































































































































































































































































Deleted runt/klib/supervisor/java/util/Objects.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.util;

/**
 * Object utilties.
 *
 * @since 2019/11/25
 */
public class Objects
{
	/**
	 * Checks whether two objects are equal to each other, if one of the
	 * values is {@code null} then this returns {@code false}, otherwise
	 * equality is checked. If both values are {@code null} then {@code true}
	 * is returned.
	 *
	 * @param __a The object which gets {@link Object#equals(Object)} called.
	 * @param __b The parameter to that call.
	 * @return {@code true} if they are both equal or both {@code null}.
	 * @since 2016/04/12
	 */
	public static boolean equals(Object __a, Object __b)
	{
		// Which sides are null
		boolean na = (__a == null);
		boolean nb = (__b == null);
		
		// One side is null, but the other is not
		if (na != nb)
			return false;
		
		// Both sides are null (just need to check one)
		else if (na)
			return true;
		
		// Standard equals
		return __a.equals(__b);
	}
	
	/**
	 * Returns the hash code of the given object or {@code 0} if it is
	 * {@code null}.
	 *
	 * @param __a The object to get the hashcode of.
	 * @return The object's hash code or {@code 0} if it is {@code null}.
	 * @since 2016/04/12
	 */
	public static int hashCode(Object __a)
	{
		if (__a == null)
			return 0;
		return __a.hashCode();
	}
	
	/**
	 * Converts the specified object to a string, if the input value is
	 * {@code null} then {@code "null"} is returned.
	 *
	 * @param __a The value to get the string of.
	 * @return The string of the given value or {@code "null"} if the input is
	 * {@code null}.
	 * @since 2016/04/12
	 */
	public static String toString(Object __a)
	{
		if (__a == null)
			return "null";
		return __a.toString();
	}
	
	/**
	 * Converts the specified object to a string, if the input value is
	 * {@code null} then {@code __b} is returned.
	 *
	 * @param __a The object to get the string of.
	 * @param __b The value to return if {@code __a} is {@code null}.
	 * @return The string represention of {@code __a} or else {@code __b} if
	 * the input is {@code null}.
	 * @since 2016/04/12
	 */
	public static String toString(Object __a, String __b)
	{
		if (__a == null)
			return __b;
		return __a.toString();
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
































































































































































































Deleted runt/klib/supervisor/java/util/package-info.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

/**
 * Standard Java utility classes.
 *
 * @since 2019/06/24
 */

package java.util;

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


































Deleted runt/klib/supervisor/todo/DEBUG.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package todo;

import cc.squirreljme.jvm.Assembly;
import cc.squirreljme.jvm.SystemCallError;
import cc.squirreljme.jvm.SystemCallIndex;

/**
 * Contains basic debug output printing.
 *
 * @since 2019/05/26
 */
public final class DEBUG
{
	/**
	 * Not used.
	 *
	 * @since 2019/05/26
	 */
	private DEBUG()
	{
	}
	
	/**
	 * Prints a very basic debug code.
	 *
	 * @param __a First character.
	 * @param __b Second character.
	 * @since 2019/09/22
	 */
	public static final void code(char __a, char __b)
	{
		// Get the pipe descriptor for standard error, ignore if it fails
		int fd = Assembly.sysCallV(SystemCallIndex.PD_OF_STDERR);
		if (SystemCallError.getError(SystemCallIndex.PD_OF_STDERR) != 0)
			return;
		
		// Pipe characters
		DEBUG.__pipe(fd, __a);
		DEBUG.__pipe(fd, __b);
		
		// Ending newline
		DEBUG.__pipe(fd, '\n');
	}
	
	/**
	 * Prints a very basic debug code.
	 *
	 * @param __a First character.
	 * @param __b Second character.
	 * @param __v Value.
	 * @since 2019/06/13
	 */
	public static final void code(char __a, char __b, int __v)
	{
		// Get the pipe descriptor for standard error, ignore if it fails
		int fd = Assembly.sysCallV(SystemCallIndex.PD_OF_STDERR);
		if (SystemCallError.getError(SystemCallIndex.PD_OF_STDERR) != 0)
			return;
		
		// Pipe characters
		DEBUG.__pipe(fd, __a);
		DEBUG.__pipe(fd, __b);
		DEBUG.__pipe(fd, ' ');
		
		// Print digit as hex, this should print all 8 digits
		for (int i = 28; i >= 0; i -= 4)
		{
			// Get upper most hex
			int h = ((__v >>> i) & 0xF);
			
			// Print letter or number?
			DEBUG.__pipe(fd, (char)(h >= 10 ? 'a' + (h - 10) : '0' + h));
		}
		
		// Ending newline
		DEBUG.__pipe(fd, '\n');
	}
	
	/**
	 * Prints a barrier in printing!
	 *
	 * @param __a First character.
	 * @param __b Second character.
	 * @since 2019/09/22
	 */
	public static final void codeBarrier(char __a, char __b)
	{
		// Get the pipe descriptor for standard error, ignore if it fails
		int fd = Assembly.sysCallV(SystemCallIndex.PD_OF_STDERR);
		if (SystemCallError.getError(SystemCallIndex.PD_OF_STDERR) != 0)
			return;
		
		// Pipe characters
		DEBUG.__pipe(fd, __a);
		DEBUG.__pipe(fd, __b);
		DEBUG.__pipe(fd, ' ' );
		
		// Print barrier
		for (int i = 0; i < 20; i++)
			DEBUG.__pipe(fd, '*');
		
		// Ending newline
		DEBUG.__pipe(fd, '\n');
	}
	
	/**
	 * Prints a very basic debug code with a String Utf pointer.
	 *
	 * @param __a First character.
	 * @param __b Second character.
	 * @param __v UTF String pointer.
	 * @since 2019/09/22
	 */
	public static final void codeUtf(char __a, char __b, int __v)
	{
		// Get the pipe descriptor for standard error, ignore if it fails
		int fd = Assembly.sysCallV(SystemCallIndex.PD_OF_STDERR);
		if (SystemCallError.getError(SystemCallIndex.PD_OF_STDERR) != 0)
			return;
		
		// Pipe characters
		DEBUG.__pipe(fd, __a);
		DEBUG.__pipe(fd, __b);
		DEBUG.__pipe(fd, ' ');
		
		// If there is no string, then print null
		if (__v == 0)
		{
			DEBUG.__pipe(fd, 'n');
			DEBUG.__pipe(fd, 'u');
			DEBUG.__pipe(fd, 'l');
			DEBUG.__pipe(fd, 'l');
		}
		
		// Otherwise decode and print the string out
		else
		{
			// Read string length
			int len = Assembly.memReadJavaShort(__v, 0) & 0xFFFF;
			
			// Print string characters out
			for (int i = 0; i < len; i++)
			{
				// Read character
				char c = (char)(Assembly.memReadByte(__v, 2 + i) & 0xFF);
				
				// Special handling according to input character
				boolean slash = false;
				switch (c)
				{
					case '\t': c = 't'; break;
					case '\r': c = 'r'; break;
					case '\n': c = 'n'; break;
					case '\b': c = 'b'; break;
				}
				
				// Print it out
				if (slash)
					DEBUG.__pipe(fd, '\\');
				DEBUG.__pipe(fd, c);
			}
		}
		
		// Ending newline
		DEBUG.__pipe(fd, '\n');
	}
	
	/**
	 * Prints a debug note.
	 *
	 * @param __fmt The string format, compatible with Java except that it
	 * is very limited in the formats it supports.
	 * @param __args Arguments to the note.
	 * @since 2019/05/26
	 */
	public static final void note(String __fmt, Object... __args)
	{
		// Get the pipe descriptor for standard error, ignore if it fails
		int fd = Assembly.sysCallV(SystemCallIndex.PD_OF_STDERR);
		if (SystemCallError.getError(SystemCallIndex.PD_OF_STDERR) != 0)
			return;
		
		// Debug
		/*DEBUG.code('N', 'f', Assembly.objectToPointer(__fmt));
		DEBUG.code('N', 'a', Assembly.objectToPointer(__args));*/
		
		// Argument pointer
		int argp = 0;
		
		// Print char by char to the console
		boolean percent = false;
		for (int i = 0, n = __fmt.length(); i < n; i++)
		{
			// Read character here
			char c = __fmt.charAt(i);
			
			// Handle percent
			if (percent)
			{
				// Clear flag
				percent = false;
				
				// Plain percent
				if (c == '%')
					DEBUG.__pipe(fd, '%');
				
				// Newline
				else if (c == 'n')
					DEBUG.__pipe(fd, '\n');
				
				// Just treat as string
				else if (argp < __args.length)
				{
					// Get string form of it
					Object av = __args[argp++];
					String sv = (av == null ? "null" : av.toString());
					
					// Pipe through all string characters
					for (int j = 0, q = sv.length(); j < q; j++)
						DEBUG.__pipe(fd, sv.charAt(j));
				}
				
				// Unknown sequence?
				else
					DEBUG.__pipe(fd, '?');
			}
			
			// Flag percent
			else if (c == '%')
				percent = true;
			
			// Plain character
			else
				DEBUG.__pipe(fd, c);
		}
		
		// End with newline sequence
		DEBUG.__pipe(fd, '\n');
	}
	
	/**
	 * Pipes out the given character.
	 *
	 * @param __fd The pipe descriptor.
	 * @param __c The character to pipe.
	 * @since 2019/06/11
	 */
	private static final void __pipe(int __fd, char __c)
	{
		// This uses non-wrapped calls since because this is the supervisor
		// we want to print out the bytes without performing wrapping and
		// virtualization of call IDs
		
		// Single byte sequence
		if (__c <= 0x7F)
		{
			// Forward
			Assembly.sysCallPV(SystemCallIndex.PD_WRITE_BYTE,
				__fd, __c & 0xFF);
		}
		
		// Double byte sequence
		else
		{
			// Forward
			Assembly.sysCallPV(SystemCallIndex.PD_WRITE_BYTE,
				__fd, (__c >>> 6) | 0b1100_0000);
			Assembly.sysCallPV(SystemCallIndex.PD_WRITE_BYTE,
				__fd, (__c & 0b111111));
		}
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




















































































































































































































































































































































































































































































































































































Deleted runt/klib/supervisor/todo/TODO.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package todo;

import cc.squirreljme.jvm.Assembly;
import cc.squirreljme.jvm.SystemCallIndex;

/**
 * This is a class which when constructed indicates that stuff needs to be
 * done.
 *
 * @since 2019/05/25
 */
public class TODO
	extends Error
{
	/**
	 * Initializes the ToDo.
	 *
	 * @since 2019/05/25
	 */
	public TODO()
	{
		this(null);
	}
	
	/**
	 * Initializes the ToDo.
	 *
	 * @param __m The exception message.
	 * @since 2019/11/25
	 */
	public TODO(String __m)
	{
		super(__m);
		
		// Print stack trace
		todo.DEBUG.note("****** TODO HIT! ******");
		this.printStackTrace();
		todo.DEBUG.note("****** TODO HIT! ******");
		
		// Stop now
		Assembly.sysCallPV(SystemCallIndex.FATAL_TODO);
		Assembly.breakpoint();
		Assembly.sysCallPV(SystemCallIndex.EXIT, 1);
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<














































































































Deleted runt/klib/supervisor/todo/package-info.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

/**
 * This package contains the debugging and stuff to be done.
 *
 * @since 2019/05/25
 */

package todo;

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


































Deleted runt/kmid/NAMESPACE.MF.

1
2
3
4
5
6
7
Manifest-Version: 1.0
X-SquirrelJME-Namespace-Title: Kernel MIDlets
X-SquirrelJME-Namespace-Type: midlet
X-SquirrelJME-Namespace-Description: These are applications which are 
 ran like normal applications but are intended to only be executed by 
 the kernel itself.

<
<
<
<
<
<
<














Deleted runt/kmid/launcher/META-INF/MANIFEST.MF.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Manifest-Version: 1.0
X-SquirrelJME-Type: liblet
X-SquirrelJME-Name: SquirrelJME Launcher (Graphical)
X-SquirrelJME-Vendor: Stephanie Gawroriski
X-SquirrelJME-Version: 0.3.0
X-SquirrelJME-Description: This project contains the graphical launcher 
 that SquirrelJME uses to act as a front end interface to running user p
 rograms.
X-SquirrelJME-Depends: midp-lcdui meep-midlet meep-swm
X-SquirrelJME-Error: EP
X-SquirrelJME-UUID: 2ec9b1c4-3adb-4dd0-acfa-48f878dd6cdd
MIDlet-1: SquirrelJME Launcher (Graphical), ,
 cc.squirreljme.runtime.launcher.ui.MidletMain
X-SquirrelJME-NoLauncher: true
Microedition-Configuration: CLDC-1.8-Compact
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






























Deleted runt/libs/NAMESPACE.MF.

1
2
3
4
5
6
7
Manifest-Version: 1.0
X-SquirrelJME-Namespace-Title: Run-time Libraries
X-SquirrelJME-Namespace-Type: liblet
X-SquirrelJME-Namespace-Description: This namespace contains the extra 
 run-time libraries which could be used by user applications and 
 system applications/libraries as needed.

<
<
<
<
<
<
<














Deleted runt/libs/all-vms/META-INF/MANIFEST.MF.

1
2
3
4
5
6
7
8
9
10
11
Manifest-Version: 1.0
X-SquirrelJME-UUID: b1e1bc61-6e1f-43be-ac98-cdcb66dbeb02
X-SquirrelJME-Error: AL
X-SquirrelJME-Name: All Virtual Machines
X-SquirrelJME-Vendor: Stephanie Gawroriski
X-SquirrelJME-Version: 0.3.0
X-SquirrelJME-Description: This is a virtual package which depends on 
 all the virtual machines which are available.
X-SquirrelJME-Depends: springcoat-vm summercoat-vm
Microedition-Configuration: CLDC-1.8-Compact

<
<
<
<
<
<
<
<
<
<
<






















Deleted runt/libs/collections/META-INF/MANIFEST.MF.

1
2
3
4
5
6
7
8
9
10
Manifest-Version: 1.0
X-SquirrelJME-UUID: f119ce1b-cd4f-4c7b-a229-5f12448f5d1c
X-SquirrelJME-Error: AC
X-SquirrelJME-Name: Collections
X-SquirrelJME-Vendor: Stephanie Gawroriski
X-SquirrelJME-Version: 0.3.0
X-SquirrelJME-Description: This class contains various collections 
 which can be used to store objects.
Microedition-Configuration: CLDC-1.8-Compact

<
<
<
<
<
<
<
<
<
<




















Deleted runt/libs/common-vm-stubs/META-INF/MANIFEST.MF.

1
2
3
4
5
6
7
8
9
10
11
Manifest-Version: 1.0
X-SquirrelJME-UUID: 101f95b0-320f-44c8-a26a-e60343fefb76
X-SquirrelJME-Error: AJ
X-SquirrelJME-Name: SpringCoat VM Java ME Stubs
X-SquirrelJME-Vendor: Stephanie Gawroriski
X-SquirrelJME-Version: 0.3.0
X-SquirrelJME-Description: This project contains the stubs which are 
 needed by non-SquirrelJME Java ME systems, since internal SquirrelJME 
 APIs are used in some classes.
Microedition-Configuration: CLDC-1.8-Compact

<
<
<
<
<
<
<
<
<
<
<






















Deleted runt/libs/common-vm-stubs/cc/squirreljme/runtime/cldc/asm/AtomicOperation.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.cldc.asm;

import cc.squirreljme.runtime.cldc.annotation.Api;
import cc.squirreljme.runtime.cldc.lang.ApiLevel;

/**
 * This class contains utilities for atomic operations.
 *
 * @since 2018/09/08
 */
public final class AtomicOperation
{
	/**
	 * Not used.
	 *
	 * @since 2018/09/08
	 */
	private AtomicOperation()
	{
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
































































Deleted runt/libs/common-vm-stubs/cc/squirreljme/runtime/cldc/asm/ConsoleOutput.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.cldc.asm;

import cc.squirreljme.runtime.cldc.annotation.Api;
import cc.squirreljme.runtime.cldc.lang.ApiLevel;
import java.io.IOException;

/**
 * Used for printing to the console.
 *
 * @since 2018/09/21
 */
public final class ConsoleOutput
{
	/** Standard output. */
	public static final int OUTPUT =
		1;
	
	/** Standard error. */
	public static final int ERROR =
		2;
	
	/** End of file. */
	public static final int ERROR_EOF =
		-1;
	
	/** Invalid file descriptor. */
	public static final int ERROR_INVALIDFD =
		-2;
	
	/**
	 * Not used.
	 *
	 * @since 2018/09/21
	 */
	private ConsoleOutput()
	{
	}
	
	/**
	 * Reads the display console, that is anything which was output to the
	 * console itself.
	 *
	 * @param __dim The output dimensions of the console, columns and rows.
	 * This array must always have a length of at least two.
	 * @param __b The output byte array.
	 * @param __o The offset.
	 * @param __l The length.
	 * @return The number of bytes which were read, this will be the minimum
	 * of either {@code __dim[0] * __dim[1]} or {@code __l}. Zero may be
	 * returned if this is not supported.
	 * @since 2018/12/16
	 */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final int displayRead(int[] __dim,
		byte[] __b, int __o, int __l)
	{
		// Not supported so always returns zero as nothing read
		return 0;
	}
	
	/**
	 * Flushes the stream.
	 *
	 * @param __fd The file descriptor to flush.
	 * @return Zero on success, negative values for failure.
	 * @since 2018/12/08
	 */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final int flush(int __fd)
	{
		if (__fd == OUTPUT)
			System.out.flush();
		
		else if (__fd == ERROR)
			System.err.flush();
		
		// Unknown
		else
			return ERROR_INVALIDFD;
		
		return 0;
	}
	
	/**
	 * Writes the character to the console output.
	 *
	 * @param __fd The file descriptor to write to.
	 * @param __c The byte to write, only the lowest 8-bits are used.
	 * @return Zero on success, negative values for EOF.
	 * @since 2018/09/21
	 */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final int write(int __fd, int __c)
	{
		if (__fd == OUTPUT)
			System.out.write(__c);
		
		else if (__fd == ERROR)
			System.err.write(__c);
		
		// Unknown
		else
			return ERROR_INVALIDFD;
		
		return 0;
	}
	
	/**
	 * Writes the given bytes to the console output.
	 *
	 * @param __fd The file descriptor to write to.
	 * @param __b The bytes to write.
	 * @param __o The offset.
	 * @param __l The length.
	 * @return Zero on success, negative values for failure.
	 * @since 2018/12/05
	 */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final int write(int __fd,
		byte[] __b, int __o, int __l)
	{
		if (__fd == OUTPUT)
			System.out.write(__b, __o, __l);
		
		else if (__fd == ERROR)
			System.err.write(__b, __o, __l);
		
		// Unknown
		else
			return ERROR_INVALIDFD;
		
		return 0;
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


































































































































































































































































































Deleted runt/libs/common-vm-stubs/cc/squirreljme/runtime/cldc/asm/NativeDisplayAccess.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.cldc.asm;

import cc.squirreljme.runtime.cldc.annotation.Api;
import cc.squirreljme.runtime.cldc.lang.ApiLevel;

/**
 * This class provides access to the native display system that is used by the
 * LCDUI code to display widgets and such to the screen. Any application may
 * access the screen directly and must manage exclusivity by itself if such a
 * thing is applicable for a single shared screen resource.
 *
 * @since 2018/11/09
 */
@Deprecated
public final class NativeDisplayAccess
{
	/** The number of parameters available. */
	public static final int NUM_PARAMETERS =
		8;
	
	/** The pixel format. */
	public static final int PARAMETER_PIXELFORMAT =
		0;
	
	/** The buffer width. */
	public static final int PARAMETER_BUFFERWIDTH =
		1;
	
	/** The buffer height. */
	public static final int PARAMETER_BUFFERHEIGHT =
		2;
	
	/** Alpha channel is used? */
	public static final int PARAMETER_ALPHA =
		3;
	
	/** Buffer pitch. */
	public static final int PARAMETER_PITCH =
		4;
	
	/** Buffer offset. */
	public static final int PARAMETER_OFFSET =
		5;
	
	/** Virtual X offset. */
	public static final int PARAMETER_VIRTXOFF =
		6;
	
	/** Virtual Y offset. */
	public static final int PARAMETER_VIRTYOFF =
		7;
	
	/**
	 * Not used.
	 *
	 * @since 2018/11/09
	 */
	private NativeDisplayAccess()
	{
	}
	
	/**
	 * Initialize and/or reset accelerated graphics operations.
	 *
	 * @param __id The display to initialize for.
	 * @return {@code true} if acceleration is supported.
	 * @since 2018/11/19
	 */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final boolean accelGfx(int __id)
	{
		return false;
	}
	
	/**
	 * Performs accelerated graphics operation.
	 *
	 * @param __id The display ID.
	 * @param __func The function to call.
	 * @param __args Arguments to the operation.
	 * @return The result of the operation.
	 * @since 2018/11/19
	 */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final Object accelGfxFunc(int __id, int __func,
		Object... __args)
	{
		return null;
	}
	
	/**
	 * Returns the capabilities of the display.
	 *
	 * @param __id The display ID.
	 * @return The capabilities of the display.
	 * @since 2018/11/17
	 */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final int capabilities(int __id)
	{
		return -1;
	}
	
	/**
	 * Requests that the display should be repainted.
	 *
	 * @param __id The display ID.
	 * @param __x The X coordinate.
	 * @param __y The Y coordinate.
	 * @param __w The width.
	 * @param __h The height.
	 * @since 2018/12/03
	 */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final void displayRepaint(int __id,
		int __x, int __y, int __w, int __h)
	{
	}
	
	/**
	 * Returns the object representing the framebuffer data.
	 *
	 * @param __id The display ID.
	 * @return The framebuffer array.
	 * @since 2018/11/18
	 */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final Object framebufferObject(int __id)
	{
		return null;
	}
	
	/**
	 * Returns the palette of the framebuffer.
	 *
	 * @param __id The display ID.
	 * @return The palette of the framebuffer.
	 * @since 2018/11/18
	 */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final int[] framebufferPalette(int __id)
	{
		return null;
	}
	
	/**
	 * Returns the parameters of the framebuffer.
	 *
	 * @param __id The display ID.
	 * @return The framebuffer parameters.
	 * @since 2018/11/18
	 */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final int[] framebufferParameters(int __id)
	{
		return new int[0];
	}
	
	/**
	 * Returns the state count of this framebuffer which is used to detect
	 * when the parameters have changed, where they must all be recalculated
	 * (that is the framebuffer wrapper must be recreated).
	 *
	 * @param __id The display ID.
	 * @return The state count for the framebuffer.
	 * @since 2018/12/02
	 */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final int framebufferStateCount(int __id)
	{
		return 0;
	}
	
	/**
	 * Is the specified display upsidedown?
	 *
	 * @param __id The ID of the display.
	 * @return If the display is upsidedown.
	 * @since 2018/11/17
	 */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final boolean isUpsideDown(int __id)
	{
		return false;
	}
	
	/**
	 * Returns the number of permanent displays which are currently attached to
	 * the system.
	 *
	 * @return The number of displays attached to the system.
	 * @since 2018/11/16
	 */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final int numDisplays()
	{
		return 0;
	}
	
	/**
	 * Registers the class to be called for when display events are to be
	 * called.
	 *
	 * @param __cb The callback.
	 * @since 2018/12/03
	 */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final void registerEventCallback(
		NativeDisplayEventCallback __cb)
	{
	}
	
	/**
	 * Sets the title of the display.
	 *
	 * @param __id The display ID.
	 * @param __t The title to use.
	 * @since 2018/11/18
	 */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final void setDisplayTitle(int __id, String __t)
	{
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






















































































































































































































































































































































































































































































Deleted runt/libs/common-vm-stubs/cc/squirreljme/runtime/cldc/asm/ObjectAccess.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.cldc.asm;

import cc.squirreljme.runtime.cldc.annotation.Api;
import cc.squirreljme.runtime.cldc.lang.ApiLevel;
import cc.squirreljme.runtime.cldc.lang.ClassData;
import cc.squirreljme.runtime.cldc.ref.PrimitiveReference;
import cc.squirreljme.runtime.cldc.ref.PrimitiveWeakReference;

/**
 * This contains accessors for object information.
 *
 * @since 2018/09/22
 */
public final class ObjectAccess
{
	/** Monitor is not owned by this thread. */
	public static final int MONITOR_NOT_OWNED =
		-1;
	
	/** Monitor did not interrupt. */
	public static final int MONITOR_NOT_INTERRUPTED =
		0;
	
	/** Monitor did interrupt. */
	public static final int MONITOR_INTERRUPTED =
		1;
	
	/**
	 * Not used.
	 *
	 * @since 2018/09/22
	 */
	private ObjectAccess()
	{
	}
	
	/**
	 * Allocates an object but does not construct it
	 *
	 * @param __cl The class to allocate.
	 * @return An object for the class, it is not initialized with a
	 * constructor. Returns {@code null} if no more memory is available.
	 * @since 2018/12/04
	 */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final Object allocateObject(String __cl)
	{
		return null;
	}
	
	/**
	 * Returns the length of the given array.
	 *
	 * @param __a The array to get the length of.
	 * @return The length of the array or {@code -1} if it is not an
	 * array.
	 * @since 2018/09/25
	 */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final int arrayLength(Object __a)
	{
		if (__a instanceof Object[])
			return ((Object[])__a).length;
		else if (__a instanceof boolean[])
			return ((boolean[])__a).length;
		else if (__a instanceof byte[])
			return ((byte[])__a).length;
		else if (__a instanceof short[])
			return ((short[])__a).length;
		else if (__a instanceof char[])
			return ((char[])__a).length;
		else if (__a instanceof int[])
			return ((int[])__a).length;
		else if (__a instanceof long[])
			return ((long[])__a).length;
		else if (__a instanceof float[])
			return ((float[])__a).length;
		else if (__a instanceof double[])
			return ((double[])__a).length;
		return -1;
	}
	
	/**
	 * Creates a new array of the given type, this is the actual array and
	 * not the component.
	 *
	 * @param __t The array type, not the component type.
	 * @param __l The array length.
	 * @return An array allocated to the given length.
	 * @since 2018/09/25
	 */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final Object arrayNew(Class<?> __t, int __l)
	{
		return null;
	}
	
	/**
	 * Returns the class object for the specified class by its binary name.
	 *
	 * @param __s The class to lookup, the binary name is used.
	 * @return The class for the given binary name, or {@code null} if it
	 * does not exist.
	 * @since 2018/09/23 
	 */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final Class<?> classByName(String __s)
	{
		try
		{
			return Class.forName(__s.replace('/', '.'));
		}
		catch (ClassNotFoundException e)
		{
			return null;
		}
	}
	
	/**
	 * Returns the class data which is attached to the given class object.
	 *
	 * @param __cl The class to get the data from.
	 * @return The resulting class data.
	 * @since 2018/12/04
	 */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final ClassData classData(Class<?> __cl)
	{
		// {@squirreljme.error AJ01 Cannot obtain class data.}
		throw new Error("AJ01");
	}
	
	/**
	 * Returns the class object for the given object.
	 *
	 * @param __v The object to get the class of.
	 * @return The class of the given object, or {@code null} if it has no
	 * class.
	 * @since 2018/09/22
	 */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final Class<?> classOf(Object __v)
	{
		if (__v == null)
			return null;
		return __v.getClass();
	}
	
	/**
	 * Checks if the given thread holds the given object in a lock.
	 *
	 * @param __ntid The native thread ID.
	 * @param __o The object to check.
	 * @return If the lock is held.
	 * @since 2018/11/21
	 */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final boolean holdsLock(int __ntid, Object __o)
	{
		if (__ntid == Thread.currentThread().getId())
			Thread.holdsLock(__o);
		
		// {@squirreljme.error AJ02 Cannot check if another thread holds
		// a lock for an object.}
		throw new Error("AJ02");
	}
	
	/**
	 * Returns the identity hashcode of the object.
	 *
	 * @return The identity hashcode.
	 * @since 2018/10/14
	 */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final int identityHashCode(Object __o)
	{
		return System.identityHashCode(__o);
	}
	
	/**
	 * Invokes the specified static method.
	 *
	 * @param __m The method to invoke.
	 * @param __args Arguments to the method, the parameters will be passed
	 * as-is and will not be unboxed, so the method must accept boxed values.
	 * @return The value to return from the method, {@code void} will return
	 * {@code null}.
	 * @since 2018/11/20
	 */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final Object invokeStatic(StaticMethod __m, Object... __args)
	{
		// {@squirreljme.error AJ03 Cannot invoke static method.}
		throw new Error("AJ03");
	}
	
	/**
	 * Notifies threads waiting on the monitor.
	 *
	 * @param __o The object to notify.
	 * @param __all Notify all threads?
	 * @return If the monitor was a success or not.
	 * @since 2018/11/20
	 */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final int monitorNotify(Object __o, boolean __all)
	{
		try
		{
			if (__all)
				__o.notifyAll();
			else
				__o.notify();
			
			return MONITOR_NOT_INTERRUPTED;
		}
		catch (IllegalMonitorStateException e)
		{
			return MONITOR_NOT_OWNED;
		}
	}
	
	/**
	 * Waits for a notification on a monitor.
	 *
	 * @param __o The object to wait on.
	 * @param __ms The milliseconds.
	 * @param __ns The nanoseconds.
	 * @return The wait status.
	 * @since 2018/11/21
	 */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final int monitorWait(Object __o, long __ms,
		int __ns)
	{
		try
		{
			if (__ms == 0 && __ns == 0)
				__o.wait();
			else
				__o.wait(__ms, __ns);
			
			return MONITOR_NOT_INTERRUPTED;
		}
		catch (IllegalMonitorStateException e)
		{
			return MONITOR_NOT_OWNED;
		}
		catch (InterruptedException e)
		{
			return MONITOR_INTERRUPTED;
		}
	}
	
	/**
	 * Creates a new primitive weak reference. Note that it is not valid to
	 * operate on this object as a normal object, it is a special
	 * representation.
	 *
	 * @return The primitive weak reference.
	 * @since 2018/09/23
	 */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final PrimitiveReference newWeakReference()
	{
		return new __WeakRef__();
	}
	
	/**
	 * Gets the given reference.
	 *
	 * @param __r The reference to read from.
	 * @return The reference value, may be {@code null} if the input reference
	 * is not valid, it was garbage collected, or it was never set.
	 * @since 2018/09/23
	 */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final Object referenceGet(PrimitiveReference __r)
	{
		return ((__WeakRef__)__r).__get();
	}
	
	/**
	 * Sets the given reference to the given value.
	 *
	 * @param __r The reference to set.
	 * @param __v The value to set.
	 * @since 2018/09/23
	 */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final void referenceSet(PrimitiveReference __r,
		Object __v)
	{
		((__WeakRef__)__r).__set(__v);
	}
	
	/**
	 * Returns the class object for the specified class by its binary name.
	 *
	 * @param <C> The class to type this as.
	 * @param __s The class to lookup, the binary name is used.
	 * @return The class for the given binary name, or {@code null} if it
	 * does not exist.
	 * @since 2018/09/23 
	 */
	@SuppressWarnings({"unchecked"})
	public static final <C> Class<C> classByNameType(String __s)
	{
		return (Class<C>)((Object)ObjectAccess.classByName(__s));
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




































































































































































































































































































































































































































































































































































































































































Deleted runt/libs/common-vm-stubs/cc/squirreljme/runtime/cldc/asm/ResourceAccess.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.cldc.asm;

import cc.squirreljme.runtime.cldc.annotation.Api;
import cc.squirreljme.runtime.cldc.lang.ApiLevel;

/**
 * This class provides access to resources and their raw data streams.
 *
 * Access to resources relies on the suites, so the correct suite must be
 * specified. {@link Class#getResourceAsStream(String)} should handle this.
 *
 * @since 2018/10/07
 */
public final class ResourceAccess
{
	/** Resource does not exist. */
	public static final int OPEN_STATUS_NO_RESOURCE =
		-1;
	
	/** JAR does not exist. */
	public static final int OPEN_STATUS_NO_JAR =
		-2;
	
	/** IOException. */
	public static final int OPEN_STATUS_IOEXCEPTION =
		-3;
	
	/** Read returned EOF. */
	public static final int READ_STATUS_EOF =
		-1;
	
	/** Read returned unknown file descriptor. */
	public static final int READ_STATUS_UNKNOWN_FD =
		-2;
	
	/** Read returned IOException. */
	public static final int READ_STATUS_IOEXCEPTION =
		-3;
	
	/** Descriptor was not found. */
	public static final int CLOSE_STATUS_UNKNOWN_FD =
		-2;
	
	/** Close resulted in any IOException. */
	public static final int CLOSE_STATUS_IOEXCEPTION =
		-3;
	
	/**
	 * Returns the number of bytes which are known to be available. This is
	 * not required to be supported but is available for usage if it would
	 * result in optimization.
	 *
	 * If this is not supported by a resource then zero or a negative value
	 * may be returned.
	 *
	 * @param __fd The file descriptor to check.
	 * @return The number of available bytes.
	 * @since 2018/10/07
	 */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final int available(int __fd)
	{
		return READ_STATUS_UNKNOWN_FD;
	}
	
	/**
	 * Closes the given resource.
	 *
	 * @param __fd The resource descriptor to close.
	 * @return A negative value indicating the reason for the failure.
	 * @since 2018/10/07
	 */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final int close(int __fd)
	{
		return CLOSE_STATUS_UNKNOWN_FD;
	}
	
	/**
	 * Opens the specified resource in the given JAR.
	 *
	 * @param __jar The JAR the resource is in, this specifies the name of a
	 * suite.
	 * @param __res The name of the resource to load.
	 * @return The file descriptor or a negative value if it does not exist.
	 * If {@code -2} is returned that means there was an exception trying to
	 * load the resource.
	 * @since 2018/10/07
	 */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final int open(String __jar, String __res)
	{
		return OPEN_STATUS_NO_JAR;
	}
	
	/**
	 * Reads data from the given resource.
	 *
	 * @param __fd The file descriptor to read from.
	 * @param __b The output byte array.
	 * @param __o The offset.
	 * @param __l The length.
	 * @return The number of bytes read or a negative value if the end of
	 * stream was reached.
	 * @since 2018/10/07
	 */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final int read(int __fd, byte[] __b, int __o,
		int __l)
	{
		return READ_STATUS_UNKNOWN_FD;
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
























































































































































































































































Deleted runt/libs/common-vm-stubs/cc/squirreljme/runtime/cldc/asm/SuiteAccess.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.cldc.asm;

import cc.squirreljme.runtime.cldc.annotation.Api;
import cc.squirreljme.runtime.cldc.lang.ApiLevel;

/**
 * Access to suites and other suites which are available for usage.
 *
 * @since 2018/10/26
 */
public class SuiteAccess
{
	/**
	 * Returns the suites which are available for usage.
	 *
	 * @return The suites which are available for usage.
	 * @since 2018/10/26
	 */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final String[] availableSuites()
	{
		return new String[0];
	}
	
	/**
	 * Returns the current classpath that is being used.
	 *
	 * @return The current classpath.
	 * @since 2018/12/06
	 */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final String[] currentClassPath()
	{
		return new String[0];
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






























































































Deleted runt/libs/common-vm-stubs/cc/squirreljme/runtime/cldc/asm/SystemAccess.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.cldc.asm;

import cc.squirreljme.runtime.cldc.annotation.Api;
import cc.squirreljme.runtime.cldc.lang.ApiLevel;

/**
 * Access to system related details.
 *
 * @since 2018/10/13
 */
public final class SystemAccess
{
	/**
	 * Not used.
	 *
	 * @since 2018/10/13
	 */
	private SystemAccess()
	{
	}
	
	/**
	 * Exits the process with the system exit code.
	 *
	 * @param __code The exit code.
	 * @since 2018/10/13
	 */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final void exit(int __code)
	{
		System.exit(__code);
	}
	
	/**
	 * Returns the specified environment variable, it is unspecified and
	 * system dependent if variables are case sensitive or not. Locale may
	 * be considered by the host system additionally. If environment variables
	 * do not exist in the environment then only {@code null} will be
	 * returned.
	 *
	 * @param __e The environment variable to get.
	 * @return The value of that variable or {@code null} if it is not set.
	 * @since 2018/10/14
	 */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final String getEnv(String __e)
	{
		return null;
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


























































































































Deleted runt/libs/common-vm-stubs/cc/squirreljme/runtime/cldc/asm/SystemProperties.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.cldc.asm;

import cc.squirreljme.runtime.cldc.annotation.Api;
import cc.squirreljme.runtime.cldc.lang.ApiLevel;
import cc.squirreljme.runtime.cldc.lang.OperatingSystemType;
import cc.squirreljme.runtime.cldc.SquirrelJME;

/**
 * Access to system properties.
 *
 * @since 2018/09/20
 */
public final class SystemProperties
{
	/**
	 * Not used.
	 *
	 * @since 2018/09/20
	 */
	private SystemProperties()
	{
	}
	
	/**
	 * Returns the API level of the virtual machine.
	 *
	 * @return The API level.
	 * @since 2018/12/05
	 */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static int apiLevel()
	{
		return ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225;
	}
	
	/**
	 * Returns the approximated path where the VM's executable exists. This
	 * will be the actual JVM's JAR or EXE file.
	 *
	 * @return The approximated executable path or {@code null} if it is not
	 * known.
	 * @since 2018/12/08
	 */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final String executablePath()
	{
		return null;
	}
	
	/**
	 * Returns the depth of the guests within the virtual machine.
	 *
	 * @return The number of guests.
	 * @since 2018/11/04
	 */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final int guestDepth()
	{
		return 0;
	}
	
	/**
	 * The class to use for a given implementation of something.
	 *
	 * @param __n The class name to lookup.
	 * @return The class that should get its instance created or {@code null}
	 * if there is no implementation.
	 * @since 2018/12/13
	 */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final String implementationClass(String __n)
	{
		return null;
	}
	
	/**
	 * Returns the e-mail to contact for the virtual machine.
	 *
	 * @return The contact e-mail for the virtual machine.
	 * @since 2017/10/02
	 */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static String javaVMEmail()
	{
		return "xer@multiphasicapps.net";
	}
	
	/**
	 * Returns the name of the Java virtual machine.
	 *
	 * @return The name of the virtual machine.
	 * @since 2017/10/02
	 */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static String javaVMName()
	{
		return "Common VM Stub Environment";
	}
	
	/**
	 * Returns the URL to the virtual machine's vendor's URL.
	 *
	 * @return The URL of the JVM's virtual machine.
	 * @since 2017/10/02
	 */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static String javaVMURL()
	{
		return "http://multiphasicapps.net/";
	}
	
	/**
	 * Returns the vendor of the Java virtual machine.
	 *
	 * @return The vendor of the Java virtual machine.
	 * @since 2017/10/02
	 */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static String javaVMVendor()
	{
		return "Stephanie Gawroriski";
	}
	
	/**
	 * Returns the full version of the Java virtual machine.
	 *
	 * @return The full Java virtual machine version.
	 * @since 2017/08/13
	 */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static String javaVMVersion()
	{
		return "0.3.0";
	}
	
	/**
	 * Returns the type of operating SquirrelJME is running on.
	 *
	 * @return The type of operating system SquirrelJME is running on.
	 * @since 2018/10/14
	 */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final int operatingSystemType()
	{
		return OperatingSystemType.UNKNOWN;
	}
	
	/**
	 * Returns a system property for the given value.
	 *
	 * @param __k The key to get.
	 * @return The value of the property, will be {@code null} if it is not
	 * valid.
	 * @since 2018/09/20
	 */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static String systemProperty(String __k)
	{
		return System.getProperty(__k);
	}
	
	/**
	 * Returns the version of the class libraries.
	 *
	 * @return The class library version.
	 * @since 2017/10/02
	 */
	public static String javaRuntimeVersion()
	{
		return SquirrelJME.RUNTIME_VERSION;
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<














































































































































































































































































































































































Deleted runt/libs/common-vm-stubs/cc/squirreljme/runtime/cldc/asm/TaskAccess.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.cldc.asm;

import cc.squirreljme.runtime.cldc.annotation.Api;
import cc.squirreljme.runtime.cldc.lang.ApiLevel;

/**
 * This class provides access to tasks which are running.
 *
 * @since 2018/11/04
 */
public final class TaskAccess
{
	/** The entry point is not valid. */
	public static final int ERROR_INVALID_ENTRY =
		-2;
	
	/** Library in the classpath is missing. */
	public static final int ERROR_MISSING_LIBRARY =
		-3;
	
	/** Exit code indicating bad task things. */
	public static final int EXIT_CODE_FATAL_EXCEPTION =
		127;
	
	/**
	 * Not used.
	 *
	 * @since 2018/11/04
	 */
	private TaskAccess()
	{
	}
	
	/**
	 * Returns the ID of the current thread.
	 *
	 * @return The current thread ID.
	 * @since 2018/11/20
	 */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final int currentThread()
	{
		return (int)Thread.currentThread().getId();
	}
	
	/**
	 * Sets the priority of the thread.
	 *
	 * @param __tid The thread ID.
	 * @param __p The priority.
	 * @since 2018/12/07
	 */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final void setThreadPriority(int __tid, int __p)
	{
	}
	
	/**
	 * Signals a hardware interrupt on the given thread.
	 *
	 * @param __tid The thread to signal.
	 * @since 2018/11/21
	 */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final void signalInterrupt(int __tid)
	{
		// {@squirreljme.error AJ04 Cannot interrupt threads using this method
		// as it is not implemented.}
		throw new Error("AJ04");
	}
	
	/**
	 * Causes the thread to sleep for the given milliseconds and nanoseconds.
	 *
	 * If both values are zero this means to yield instead.
	 *
	 * @param __ms The milliseconds to sleep for.
	 * @param __ns The nanoseconds to sleep for, in the range of 0-999999.
	 * @return {@code true} if the thread was interrupted, otherwise
	 * {@code false}.
	 * @since 2018/11/04
	 */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final boolean sleep(long __ms, int __ns)
	{
		try
		{
			if (__ms == 0 && __ns == 0)
				Thread.yield();
			else
				Thread.sleep(__ms, __ns);
			
			return true;
		}
		catch (InterruptedException e)
		{
			return false;
		}
	}
	
	/**
	 * Starts the specified task.
	 *
	 * @param __cp The classpath used.
	 * @param __main The main entry point.
	 * @param __args Arguments to start the task with.
	 * @return The task identifier or a negative number if the task could
	 * not start.
	 * @since 2018/11/04
	 */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final int startTask(String[] __cp, String __main,
		String[] __args)
	{
		return -1;
	}
	
	/**
	 * Starts the given thread.
	 *
	 * @param __t The thread which is to run, the execution point of the
	 * thread is the {@link Thread#__start()} method.
	 * @param __n The name hint of this thread.
	 * @return The thread ID.
	 * @since 2018/11/17
	 */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final int startThread(Thread __t, String __n)
	{
		__t.start();
		return (int)__t.getId();
	}
	
	/**
	 * Returns the status of the target task.
	 *
	 * @param __tid The task to get the status of.
	 * @return The status for the given task.
	 * @since 2018/11/04
	 */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final int taskStatus(int __tid)
	{
		return -1;
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


























































































































































































































































































































Deleted runt/libs/common-vm-stubs/cc/squirreljme/runtime/cldc/asm/__WeakRef__.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.cldc.asm;

import cc.squirreljme.runtime.cldc.ref.PrimitiveWeakReference;
import java.lang.ref.Reference;
import java.lang.ref.WeakReference;

/**
 * Primitive weak reference.
 *
 * @since 2018/12/05
 */
class __WeakRef__
	implements PrimitiveWeakReference
{
	/** The reference. */
	volatile Reference<Object> _ref;
	
	/**
	 * Gets the value.
	 *
	 * @return The value.
	 * @since 2018/12/05
	 */
	final Object __get()
	{
		synchronized (this)
		{
			Reference<Object> ref = this._ref;
			if (ref == null)
				return null;
			return ref.get();
		}
	}
	
	/**
	 * Sets the value.
	 *
	 * @param __v The value.
	 * @since 2018/12/05
	 */
	final void __set(Object __v)
	{
		synchronized (this)
		{
			Reference<Object> ref = this._ref;
			
			// {@squirreljme.error AJ05 Cannot set weak reference which has
			// already been set.}
			if (__v == null)
				if (ref == null)
				{
					// Do nothing
				}
				else
					ref.clear();
			else
				if (ref == null)
					this._ref = new WeakReference<>(__v);
				else
					throw new Error("AJ05");
		}
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




















































































































































Deleted runt/libs/common-vm-stubs/cc/squirreljme/runtime/cldc/asm/package-info.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

/**
 * This package contains static methods which in which invocations of methods
 * in the package are replaced by the compiler using native means.
 *
 * @since 2017/12/27
 */

package cc.squirreljme.runtime.cldc.asm;

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






































Deleted runt/libs/common-vm/META-INF/MANIFEST.MF.

1
2
3
4
5
6
7
8
9
10
11
12
13
Manifest-Version: 1.0
X-SquirrelJME-UUID: d8b70873-cf2b-4a8b-9cb4-a0a6cb1412fd
X-SquirrelJME-Error: AK
X-SquirrelJME-Name: Common Virtual Machine Classes
X-SquirrelJME-Vendor: Stephanie Gawroriski
X-SquirrelJME-Version: 0.3.0
X-SquirrelJME-Description: This contains classes which are common across 
 the various SquirrelJME VMs, and these only need to be written once 
 as such.
X-SquirrelJME-Depends: midp-lcdui meep-swm meep-midlet tool-profiler 
 tool-manifest-reader zip
Microedition-Configuration: CLDC-1.8

<
<
<
<
<
<
<
<
<
<
<
<
<


























Deleted runt/libs/common-vm/cc/squirreljme/vm/VMEntryShadedMIDlet.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.vm;

import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;

/**
 * This is the main entry point for MIDlets to the VM.
 *
 * @since 2018/11/16
 */
public class VMEntryShadedMIDlet
	extends MIDlet
{
	/**
	 * {@inheritDoc}
	 * @since 2018/11/16
	 */
	@Override
	protected final void destroyApp(boolean __uc)
		throws MIDletStateChangeException
	{
		// Not used
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/11/16
	 */
	@Override
	protected final void startApp()
		throws MIDletStateChangeException
	{
		VMFactory.shadedMain();
	}
}


<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






























































































Deleted runt/libs/common-vm/cc/squirreljme/vm/VMEntryShadedMain.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.vm;

/**
 * Shaded main entry point for the virtual machine.
 *
 * @since 2018/11/17
 */
public class VMEntryShadedMain
{
	/**
	 * Main entry class.
	 *
	 * @param __args Program arguments.
	 * @since 2018/11/16
	 */
	public static void main(String... __args)
	{
		VMFactory.shadedMain(__args);
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






























































Deleted runt/libs/common-vm/cc/squirreljme/vm/VMNativeDisplayAccess.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.vm;

import cc.squirreljme.runtime.cldc.asm.NativeDisplayAccess;
import cc.squirreljme.runtime.cldc.asm.NativeDisplayEventCallback;
import cc.squirreljme.runtime.lcdui.event.NonStandardKey;
import cc.squirreljme.runtime.lcdui.gfx.GraphicsFunction;
import cc.squirreljme.runtime.lcdui.gfx.PixelFormat;
import cc.squirreljme.runtime.lcdui.gfx.SerializedGraphics;
import javax.microedition.lcdui.Canvas;
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.Graphics;

/**
 * This class provides the framebuffer needed by SquirrelJME which is backed
 * on top of LCDUI itself. This just provides a single display.
 *
 * @since 2018/11/17
 */
@Deprecated
public class VMNativeDisplayAccess
{
	/** The pixel format to use for the framebuffer. */
	public static final PixelFormat FRAMEBUFFER_PIXELFORMAT =
		PixelFormat.INTEGER_RGB888;
	
	/** The display to back on, lazily initialized to prevent crashing. */
	Display _usedisplay;
	
	/** The framebuffer RGB data. */
	volatile int[] _fbrgb;
	
	/** The framebuffer width. */
	volatile int _fbw =
		-1;
	
	/** The framebuffer height. */
	volatile int _fbh =
		-1;
	
	/** The canvas for display. */
	volatile VMCanvas _canvas;
	
	/** Doing a repaint? */
	volatile boolean _repaint;
	
	/** Repaint parameters. */
	volatile int _repaintx,
		_repainty,
		_repaintw,
		_repainth;
	
	/** Accelerated graphics instance. */
	volatile Graphics _accelgfx;
	
	/** The state count of the framebuffer. */
	volatile int _statecount;
	
	/** Event callback. */
	volatile NativeDisplayEventCallback _callback;
	
	/**
	 * Initialize and/or reset accelerated graphics operations.
	 *
	 * @param __id The display to initialize for.
	 * @return {@code true} if acceleration is supported.
	 * @since 2018/11/19
	 */
	public final boolean accelGfx(int __id)
	{
		if (__id != 0)
			return false;
		
		// Check for framebuffer update
		this.__checkFramebuffer();
		
		// Setup instance
		int fbw = this._fbw;
		this._accelgfx = FRAMEBUFFER_PIXELFORMAT.createGraphics(
			this._fbrgb, null, fbw, this._fbh, false, fbw, 0, 0, 0);
		return true;
	}
	
	/**
	 * Performs accelerated graphics operation.
	 *
	 * @param __id The display ID.
	 * @param __func The function to call.
	 * @param __args Arguments to the operation.
	 * @return The result of the operation.
	 * @since 2018/11/19
	 */
	public final Object accelGfxFunc(int __id, int __func, Object... __args)
	{
		if (__id != 0)
			return null;
		
		// Deserialize and forward
		return SerializedGraphics.deserialize(this._accelgfx,
			GraphicsFunction.of(__func), __args);
	}

	/**
	 * Returns the capabilities of the display.
	 *
	 * @param __id The display ID.
	 * @return The capabilities of the display.
	 * @since 2018/11/17
	 */
	public final int capabilities(int __id)
	{
		// Only a single display is supported
		if (__id != 0)
			return 0;
		
		// Just directly pass the capabilities of this display
		return this.__display().getCapabilities();
	}
	
	/**
	 * Requests that the display should be repainted.
	 *
	 * @param __id The display ID.
	 * @param __x The X coordinate.
	 * @param __y The Y coordinate.
	 * @param __w The width.
	 * @param __h The height.
	 * @since 2018/12/03
	 */
	public final void displayRepaint(int __id,
		int __x, int __y, int __w, int __h)
	{
		if (__id != 0)
			return;
		
		this.__checkFramebuffer().repaint(__x, __y, __w, __h);
	}
	
	/**
	 * Returns the object representing the framebuffer data.
	 *
	 * @param __id The display ID.
	 * @return The framebuffer array.
	 * @since 2018/11/18
	 */
	public final Object framebufferObject(int __id)
	{
		if (__id != 0)
			return null;
		
		// Check for framebuffer update
		this.__checkFramebuffer();
		
		// Return the raw RGB array
		return this._fbrgb;
	}
	
	/**
	 * Specifies that the framebuffer has been painted.
	 *
	 * @param __id The display ID.
	 * @since 2018/11/18
	 */
	public final void framebufferPainted(int __id)
	{
		if (__id != 0)
			return;
		
		this.__checkFramebuffer().repaint();
	}
	
	/**
	 * Returns the palette of the framebuffer.
	 *
	 * @param __id The display ID.
	 * @return The palette of the framebuffer.
	 * @since 2018/11/18
	 */
	public final int[] framebufferPalette(int __id)
	{
		if (__id != 0)
			return null;
		
		// No palette is used
		return null;
	}
	
	/**
	 * Returns the parameters of the framebuffer.
	 *
	 * @param __id The display ID.
	 * @return The framebuffer parameters.
	 * @since 2018/11/18
	 */
	public final int[] framebufferParameters(int __id)
	{
		if (__id != 0)
			return null;
		
		// Check for framebuffer update
		this.__checkFramebuffer();
		
		// Fill in basic parameters
		int[] rv = new int[NativeDisplayAccess.NUM_PARAMETERS];
		
		// These are the only used fields
		int fbw = this._fbw,
			fbh = this._fbh;
		
		// Build parameters
		rv[NativeDisplayAccess.PARAMETER_PIXELFORMAT] =
			FRAMEBUFFER_PIXELFORMAT.ordinal();
		rv[NativeDisplayAccess.PARAMETER_BUFFERWIDTH] = fbw;
		rv[NativeDisplayAccess.PARAMETER_BUFFERHEIGHT] = fbh;
		rv[NativeDisplayAccess.PARAMETER_ALPHA] = 0;
		rv[NativeDisplayAccess.PARAMETER_PITCH] = fbw;
		rv[NativeDisplayAccess.PARAMETER_OFFSET] = 0;
		rv[NativeDisplayAccess.PARAMETER_VIRTXOFF] = 0;
		rv[NativeDisplayAccess.PARAMETER_VIRTYOFF] = 0;
		
		return rv;
	}
	
	/**
	 * Returns the state count of this framebuffer which is used to detect
	 * when the parameters have changed, where they must all be recalculated
	 * (that is the framebuffer wrapper must be recreated).
	 *
	 * @param __id The display ID.
	 * @return The state count for the framebuffer.
	 * @since 2018/12/02
	 */
	public final int framebufferStateCount(int __id)
	{
		if (__id != 0)
			return -1;
		
		// Check for framebuffer update
		this.__checkFramebuffer();
		
		return this._statecount;
	}
	
	/**
	 * Is the specified display upsidedown?
	 *
	 * @param __id The ID of the display.
	 * @return If the display is upsidedown.
	 * @since 2018/11/17
	 */
	public final boolean isUpsideDown(int __id)
	{
		if (__id != 0)
			return false;
		
		// Only certain orientations are considered upside-down
		switch (this.__display().getOrientation())
		{
			case Display.ORIENTATION_LANDSCAPE_180:
			case Display.ORIENTATION_PORTRAIT_180:
				return true;
			
				// Not upsidedown
			default:
				return false;
		}
	}
	
	/**
	 * Returns the number of displays which are available.
	 *
	 * @return The number of available displays.
	 * @since 2018/11/17
	 */
	public final int numDisplays()
	{
		return 1;
	}
	
	/**
	 * Registers the event callback.
	 *
	 * @param __e The event to call.
	 * @since 2018/12/03
	 */
	public final void registerEventCallback(NativeDisplayEventCallback __e)
	{
		// Do not change to self!
		NativeDisplayEventCallback old = this._callback;
		if (old == __e)
			return;	
		
		// Tell the old handler that the callback is now gone
		if (old != null)
			try
			{
				old.lostCallback();
			}
			catch (Throwable e)
			{
				e.printStackTrace();
			}
		
		// Set new
		this._callback = __e;
	}
	
	/**
	 * Sets the title of the display.
	 *
	 * @param __id The display ID.
	 * @param __t The title to use.
	 * @since 2018/11/18
	 */
	public final void setDisplayTitle(int __id, String __t)
	{
		if (__id != 0)
			return;
		
		this.__checkFramebuffer().setTitle(__t);
	}
	
	/**
	 * Checks if the framebuffer needs updating.
	 *
	 * @return The canvas used.
	 * @since 2018/11/18
	 */
	private final VMCanvas __checkFramebuffer()
	{
		// Need to create the canvas?
		VMCanvas canvas = this._canvas;
		if (canvas == null)
		{
			// Setup canvas to use
			this._canvas = (canvas = new VMCanvas());
			
			// Listener for function commands
			canvas.setCommandListener(new __CommandListener__());
			
			// Add function key wrappers to forward commands which have
			// occurred
			for (int i = 1; i <= 24; i++)
				canvas.addCommand(new Command("F" + i, Command.SCREEN,
					i - 1));
			
			// Add exit command
			canvas.addCommand(new Command("Exit", Command.EXIT,
				Integer.MAX_VALUE));
			
			// Make this canvas full screen so that the commands go away
			canvas.setFullScreenMode(true);
			
			// Assume that the client will draw over every pixel, note that
			// if the client has this done with a false, then the client will
			// clear the framebuffer while drawing over it.
			canvas.setPaintMode(true);
			
			// Display the canvas now that all the properties are known
			this.__display().setCurrent(canvas);
		}
		
		// Properties have changed? Recreate the buffer data
		int cw = canvas.getWidth(),
			ch = canvas.getHeight();
		if (this._fbrgb == null || cw != this._fbw || ch != this._fbh)
		{
			int n = cw * ch;
			int[] fbrgb;
			this._fbrgb = (fbrgb = new int[n]);
			this._fbw = cw;
			this._fbh = ch;
			
			// Initialize the framebuffer to white
			for (int i = 0; i < n; i++)
				fbrgb[i] = 0xFFFFFF;
			
			// Increase the state count
			this._statecount++;
		}
		
		return canvas;
	}
	
	/**
	 * Returns the display this is currently using.
	 *
	 * @return The currently backed display.
	 * @since 2018/11/17
	 */
	private final Display __display()
	{
		Display rv = this._usedisplay;
		if (rv == null)
			this._usedisplay = (rv = Display.getDisplays(0)[0]);
		return rv;
	}
	
	/**
	 * Listens for commands.
	 *
	 * @since 2018/11/18
	 */
	final class __CommandListener__
		implements CommandListener
	{
		/**
		 * {@inheritDoc}
		 * @since 2018/11/18
		 */
		@Override
		public void commandAction(Command __c, Displayable __d)
		{
			NativeDisplayEventCallback cb =
				VMNativeDisplayAccess.this._callback;
			if (cb == null)
				return;
			
			// Exiting the VM?
			if (__c.getCommandType() == Command.EXIT)
				cb.exitRequest(0);
			
			// Function menu key
			else if (__c.getLabel().startsWith("F"))
				cb.command(0, __c.getPriority());
		}
	}
	
	/**
	 * Contains the canvas which is drawn on.
	 *
	 * @since 2018/11/18
	 */
	@Deprecated
	public final class VMCanvas
		extends Canvas
	{
		/** Key time index tracking. */
		private volatile int _keyindex;
		
		/**
		 * {@inheritDoc}
		 * @since 2018/12/01
		 */
		@Override
		public void hideNotify()
		{
			NativeDisplayEventCallback cb =
				VMNativeDisplayAccess.this._callback;
			if (cb == null)
				return;
			
			cb.shown(0, 0);
		}
		
		/**
		 * {@inheritDoc}
		 * @since 2018/12/01
		 */
		@Override
		public void keyPressed(int __code)
		{
			this.__postKey(NativeDisplayEventCallback.KEY_PRESSED, __code);
		}
			
		/**
		 * {@inheritDoc}
		 * @since 2018/12/01
		 */
		@Override
		public void keyReleased(int __code)
		{
			this.__postKey(NativeDisplayEventCallback.KEY_RELEASED, __code);
		}
			
		/**
		 * {@inheritDoc}
		 * @since 2018/12/01
		 */
		@Override
		public void keyRepeated(int __code)
		{
			this.__postKey(NativeDisplayEventCallback.KEY_REPEATED, __code);
		}
		
		/**
		 * {@inheritDoc}
		 * @since 2018/11/18
		 */
		@Override
		public void paint(Graphics __g)
		{
			NativeDisplayEventCallback cb =
				VMNativeDisplayAccess.this._callback;
			if (cb == null)
				return;
			
			int x = __g.getClipX(),
				y = __g.getClipY(),
				w = __g.getClipWidth(),
				h = __g.getClipHeight();
			
			// Call paint code
			cb.paintDisplay(0, x, y, w, h);
			
			// Just draw the raw RGB data
			int fbw = VMNativeDisplayAccess.this._fbw;
			__g.drawRGB(VMNativeDisplayAccess.this._fbrgb,
				0,
				fbw,
				0,
				0,
				fbw,
				VMNativeDisplayAccess.this._fbh,
				false);
		}
			
		/**
		 * {@inheritDoc}
		 * @since 2018/12/02
		 */
		@Override
		public void pointerDragged(int __x, int __y)
		{
			NativeDisplayEventCallback cb =
				VMNativeDisplayAccess.this._callback;
			if (cb == null)
				return;
			
			cb.pointerEvent(0,
				NativeDisplayEventCallback.POINTER_DRAGGED, __x, __y,
				++this._keyindex);
		}
			
		/**
		 * {@inheritDoc}
		 * @since 2018/12/02
		 */
		@Override
		public void pointerPressed(int __x, int __y)
		{
			NativeDisplayEventCallback cb =
				VMNativeDisplayAccess.this._callback;
			if (cb == null)
				return;
			
			cb.pointerEvent(0,
				NativeDisplayEventCallback.POINTER_PRESSED, __x, __y,
				++this._keyindex);
		}
			
		/**
		 * {@inheritDoc}
		 * @since 2018/12/02
		 */
		@Override
		public void pointerReleased(int __x, int __y)
		{
			NativeDisplayEventCallback cb =
				VMNativeDisplayAccess.this._callback;
			if (cb == null)
				return;
			
			cb.pointerEvent(0,
				NativeDisplayEventCallback.POINTER_RELEASED, __x, __y,
				++this._keyindex);
		}
		
		/**
		 * {@inheritDoc}
		 * @since 2018/12/01
		 */
		@Override
		public void showNotify()
		{
			NativeDisplayEventCallback cb =
				VMNativeDisplayAccess.this._callback;
			if (cb == null)
				return;
			
			cb.shown(0, 1);
		}
		
		/**
		 * {@inheritDoc}
		 * @since 2018/11/18
		 */
		@Override
		public void sizeChanged(int __w, int __h)
		{
			// The framebuffer will need to be redone
			VMNativeDisplayAccess.this.__checkFramebuffer();
			
			NativeDisplayEventCallback cb =
				VMNativeDisplayAccess.this._callback;
			if (cb == null)
				return;
			
			// Post
			cb.sizeChanged(0, __w, __h);
		}
		
		/**
		 * Post key event.
		 *
		 * @param __et The event type to post.
		 * @param __kc The keycode used.
		 * @throws NullPointerException On null arguments.
		 * @since 2018/12/01
		 */
		final void __postKey(int __et, int __kc)
			throws NullPointerException
		{
			NativeDisplayEventCallback cb =
				VMNativeDisplayAccess.this._callback;
			if (cb == null)
				return;
			
			// Try to map to a game key if possible
			/*
			try
			{
				switch (this.getGameAction(__kc))
				{
					case Canvas.UP:
						__kc = NonStandardKey.VGAME_UP;
						break;
						
					case Canvas.DOWN:
						__kc = NonStandardKey.VGAME_DOWN;
						break;
						
					case Canvas.LEFT:
						__kc = NonStandardKey.VGAME_LEFT;
						break;
						
					case Canvas.RIGHT:
						__kc = NonStandardKey.VGAME_RIGHT;
						break;
					
					case Canvas.FIRE:
						__kc = NonStandardKey.VGAME_FIRE;
						break;
					
					case Canvas.GAME_A:
						__kc = NonStandardKey.VGAME_A;
						break;
					
					case Canvas.GAME_B:
						__kc = NonStandardKey.VGAME_B;
						break;
					
					case Canvas.GAME_C:
						__kc = NonStandardKey.VGAME_C;
						break;
					
					case Canvas.GAME_D:
						__kc = NonStandardKey.VGAME_D;
						break;
					
						// Unknown, do not remap!
					default:
						break;
				}
			}
			
			// Ignore unknown game keys
			catch (IllegalArgumentException e)
			{
			}*/
			
			// Post event
			cb.keyEvent(0, __et, __kc, 0, ++this._keyindex);
		}
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted runt/libs/io.test/META-INF/TEST.MF.

1
2
Manifest-Version: 1.0

<
<




Deleted runt/libs/io/META-INF/MANIFEST.MF.

1
2
3
4
5
6
7
8
9
Manifest-Version: 1.0
X-SquirrelJME-Name: Generic Input/Output
X-SquirrelJME-Vendor: Stephanie Gawroriski
X-SquirrelJME-Version: 0.3.0
X-SquirrelJME-Description: This provides slightly more powerful data 
 input and output streams which can be used to read and write data.
X-SquirrelJME-Error: BD
X-SquirrelJME-UUID: 6897c4e3-8267-4438-949c-b6242cd1b3a8
Microedition-Configuration: CLDC-1.8-Compact
<
<
<
<
<
<
<
<
<


















Deleted runt/libs/markdown-writer/META-INF/MANIFEST.MF.

1
2
3
4
5
6
7
8
9
10
11
Manifest-Version: 1.0
X-SquirrelJME-Type: liblet
X-SquirrelJME-Name: Markdown Writer
X-SquirrelJME-Vendor: Stephanie Gawroriski
X-SquirrelJME-Version: 0.3.0
X-SquirrelJME-Description: This project contains a formatted markdown 
 writer which allows documents to be written to a standard stream yet 
 have state on which properties to apply to the output.
X-SquirrelJME-Error: CG
X-SquirrelJME-UUID: df4c851d-8e50-4efb-bd60-e4e8e5a2f7a3
Microedition-Configuration: CLDC-1.8-Compact
<
<
<
<
<
<
<
<
<
<
<






















Deleted runt/libs/springcoat-vm/META-INF/MANIFEST.MF.

1
2
3
4
5
6
7
8
9
10
11
12
13
Manifest-Version: 1.0
X-SquirrelJME-UUID: 82dcdfbb-27da-48a6-87f7-7a0a8810360f
X-SquirrelJME-Error: BK
X-SquirrelJME-Name: SpringCoat Virtual Machine
X-SquirrelJME-Vendor: Stephanie Gawroriski
X-SquirrelJME-Version: 0.2.0
X-SquirrelJME-Depends: tool-classfile tool-manifest-reader meep-swm 
 tool-profiler meep-midlet common-vm
X-SquirrelJME-Description: This is a SpringCoat virtual machine which 
 is an unoptimized pure interpreter aimed for the purpose of being an 
 educational stepping stone to other future virtual machines.
Microedition-Configuration: CLDC-1.8

<
<
<
<
<
<
<
<
<
<
<
<
<


























Deleted runt/libs/strings/META-INF/MANIFEST.MF.

1
2
3
4
5
6
7
8
9
10
11
Manifest-Version: 1.0
X-SquirrelJME-UUID: abb9b55c-8519-404f-bbf8-e8d449111d13
X-SquirrelJME-Error: AM
X-SquirrelJME-Name: Basic String Utilities
X-SquirrelJME-Vendor: Stephanie Gawroriski
X-SquirrelJME-Version: 0.3.0
X-SquirrelJME-Description: This project contains basic string utilities 
 which are useful when parsing strings.
X-SquirrelJME-Depends: collections
Microedition-Configuration: CLDC-1.8-Compact

<
<
<
<
<
<
<
<
<
<
<






















Deleted runt/libs/summercoat-vm/META-INF/MANIFEST.MF.

1
2
3
4
5
6
7
8
9
10
11
12
13
Manifest-Version: 1.0
X-SquirrelJME-UUID: 217c48ac-ed98-48ea-9f61-aceb3175baa0
X-SquirrelJME-Error: AE
X-SquirrelJME-Name: SummerCoat Virtual Machine
X-SquirrelJME-Vendor: Stephanie Gawroriski
X-SquirrelJME-Version: 0.3.0
X-SquirrelJME-Depends: tool-classfile tool-manifest-reader meep-swm 
 tool-profiler meep-midlet common-vm tool-jarfile tool-packfile
X-SquirrelJME-Description: This is the SummerCoat VM which is a more 
 optimized register based virtual machine which should result in faster 
 code execution.
Microedition-Configuration: CLDC-1.8

<
<
<
<
<
<
<
<
<
<
<
<
<


























Deleted runt/libs/tool-classfile.test/META-INF/TEST.MF.

1
2
Manifest-Version: 1.0

<
<




Deleted runt/libs/tool-classfile/META-INF/MANIFEST.MF.

1
2
3
4
5
6
7
8
9
10
Manifest-Version: 1.0
X-SquirrelJME-UUID: 8d3e10bc-91f3-411d-a89e-db7397afab58
X-SquirrelJME-Error: JC
X-SquirrelJME-Name: Class File Reader
X-SquirrelJME-Vendor: Stephanie Gawroriski
X-SquirrelJME-Version: 0.3.0
X-SquirrelJME-Description: This contains support for reading class files.
X-SquirrelJME-Depends: collections io
Microedition-Configuration: CLDC-1.8-Compact

<
<
<
<
<
<
<
<
<
<




















Deleted runt/libs/tool-compiler.test/CuteCompilerTest.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

import net.multiphasicapps.javac.cute.CuteCompilerService;

/**
 * This tests the cute compiler.
 *
 * @since 2019/06/30
 */
public class CuteCompilerTest
	extends __BaseCompiler__
{
	/**
	 * Tests the cute compiler.
	 *
	 * @since 2019/06/30
	 */
	public CuteCompilerTest()
	{
		super(new CuteCompilerService());
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




























































Deleted runt/libs/tool-compiler.test/DefaultCompilerTest.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

import net.multiphasicapps.javac.DefaultCompiler;

/**
 * Tests the default compiler.
 *
 * @since 2019/06/30
 */
public class DefaultCompilerTest
	extends __BaseCompiler__
{
	/**
	 * Tests the default compiler.
	 *
	 * @since 2019/06/30
	 */
	public DefaultCompilerTest()
	{
		super(DefaultCompiler.getService());
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




























































Deleted runt/libs/tool-compiler.test/META-INF/TEST.MF.

1
2
Manifest-Version: 1.0

<
<




Deleted runt/libs/tool-compiler.test/__BaseCompiler__.in.

1

<


Deleted runt/libs/tool-compiler.test/__BaseCompiler__.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

import net.multiphasicapps.javac.Compiler;
import net.multiphasicapps.javac.CompilerException;
import net.multiphasicapps.javac.CompilerInput;
import net.multiphasicapps.javac.CompilerInputLocation;
import net.multiphasicapps.javac.CompilerOptions;
import net.multiphasicapps.javac.CompilerPathSet;
import net.multiphasicapps.javac.CompilerService;
import net.multiphasicapps.javac.ResourcePathSet;
import net.multiphasicapps.javac.NullCompilerOutput;
import net.multiphasicapps.tac.TestRunnable;
import net.multiphasicapps.tac.UntestableException;

/**
 * This tests the cute compiler.
 *
 * @since 2019/06/30
 */
abstract class __BaseCompiler__
	extends TestRunnable
{
	/** Class files to compile. */
	static final String[] _JAVA_FILES =
		{"CrossTypeParameter.java", "HelloSquirrels.java",
		"IntAnnotation.java"};
	
	/** The compiler service to use. */
	protected final CompilerService service;
	
	/**
	 * Initializes the compiler.
	 *
	 * @param __cc The compiler to use.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/06/30
	 */
	__BaseCompiler__(CompilerService __cc)
		throws NullPointerException
	{
		if (__cc == null)
			throw new NullPointerException("NARG");
		
		this.service = __cc;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2019/06/30
	 */
	@Override
	public void test()
	{
		// Not yet implemented!
		if (true)
			throw new UntestableException("Compiler support not implemented!");
		
		// Get service
		CompilerService service = this.service;
		
		// Class library
		CompilerPathSet cldc = new ResourcePathSet(
				this.getClass(), "/mini-cldc/"),
			src = new ResourcePathSet(this.getClass(), "/class-files/");
		
		// Go through sources
		for (String javafile : _JAVA_FILES)
			try
			{
				// Get new compiler
				Compiler compiler = service.createInstance();
				
				// Setup properties
				compiler.setLocation(CompilerInputLocation.CLASS, cldc);
				compiler.setLocation(CompilerInputLocation.SOURCE, src);
				compiler.addInput(src.input(javafile));
				
				// Run the compiler
				compiler.compile(new NullCompilerOutput()).run();
				
				// Okay!
				this.secondary(javafile, true);
			}
			catch (CompilerException e)
			{
				// Did not work!
				this.secondary(javafile, e);
			}
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




































































































































































































Deleted runt/libs/tool-compiler.test/class-files/CrossTypeParameter.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

/**
 * This is used to test where a type parameter is used for another type
 * parameter.
 *
 * @param <T> Type A.
 * @param <E> Type B.
 * @since 2018/05/10
 */
public class CrossTypeParameter<T extends List<E>, E extends List<T>>
{
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<












































Deleted runt/libs/tool-compiler.test/class-files/HelloSquirrels.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

/**
 * Just prints a cute message.
 *
 * @since 2018/05/01
 */
@IntAnnotation(2 + 2)
public class HelloSquirrels
{
	/**
	 * Main entry point.
	 *
	 * @param __args Program arguments.
	 * @since 2018/05/01
	 */
	public static void main(String... __args)
	{
		System.out.println("Hello squirrels! You are so cute!");
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




























































Deleted runt/libs/tool-compiler.test/class-files/IntAnnotation.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * Contains an integer annotation.
 *
 * @since 2018/05/01
 */
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.TYPE})
@Documented
public @interface IntAnnotation
{
	/**
	 * The value for this annotation.
	 *
	 * @since 2018/05/01
	 */
	public int value() default 0;
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




































































Deleted runt/libs/tool-compiler.test/class-files/list.

1
2
3
4
CrossTypeParameter.java
HelloSquirrels.java
IntAnnotation.java
list
<
<
<
<








Deleted runt/libs/tool-compiler.test/mini-cldc/compile.sh.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/bin/sh -e

# Compile sources
javac -source 1.7 -target 1.7 -d . -bootclasspath source-files -classpath source-files \
	source-files/*/*/*.java \
	source-files/*/*/*.java

# UUEncode classes
find | grep '\.class$' | while read __file
do
	uuencode -m "$__file" "$__file" > "$__file.__mime"
	rm "$__file"
done

# Build list
find | sed 's/^\.\///g' | sed 's/\.__mime//g' > list
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
































Deleted runt/libs/tool-compiler.test/mini-cldc/java/lang/Class.class.__mime.

1
2
3
4
5
6
7
8
9
10
11
begin-base64 644 ./java/lang/Class.class
yv66vgAAADMAEgoAAwAPBwAQBwARAQAGPGluaXQ+AQADKClWAQAEQ29kZQEA
D0xpbmVOdW1iZXJUYWJsZQEADWdldFN1cGVyY2xhc3MBABMoKUxqYXZhL2xh
bmcvQ2xhc3M7AQAJU2lnbmF0dXJlAQAWKClMamF2YS9sYW5nL0NsYXNzPCo+
OwEAKDxDOkxqYXZhL2xhbmcvT2JqZWN0Oz5MamF2YS9sYW5nL09iamVjdDsB
AApTb3VyY2VGaWxlAQAKQ2xhc3MuamF2YQwABAAFAQAPamF2YS9sYW5nL0Ns
YXNzAQAQamF2YS9sYW5nL09iamVjdAAxAAIAAwAAAAAAAgABAAQABQABAAYA
AAAdAAEAAQAAAAUqtwABsQAAAAEABwAAAAYAAQAAABMAEQAIAAkAAgAGAAAA
GgABAAEAAAACAbAAAAABAAcAAAAGAAEAAAAdAAoAAAACAAsAAgAKAAAAAgAM
AA0AAAACAA4=
====
<
<
<
<
<
<
<
<
<
<
<






















Deleted runt/libs/tool-compiler.test/mini-cldc/java/lang/ClassCastException.class.__mime.

1
2
3
4
5
6
7
8
9
10
begin-base64 644 ./java/lang/ClassCastException.class
yv66vgAAADMAEAoABAAMCgAEAA0HAA4HAA8BAAY8aW5pdD4BAAMoKVYBAARD
b2RlAQAPTGluZU51bWJlclRhYmxlAQAVKExqYXZhL2xhbmcvU3RyaW5nOylW
AQAKU291cmNlRmlsZQEAF0NsYXNzQ2FzdEV4Y2VwdGlvbi5qYXZhDAAFAAYM
AAUACQEAHGphdmEvbGFuZy9DbGFzc0Nhc3RFeGNlcHRpb24BABpqYXZhL2xh
bmcvUnVudGltZUV4Y2VwdGlvbgAhAAMABAAAAAAAAgABAAUABgABAAcAAAAh
AAEAAQAAAAUqtwABsQAAAAEACAAAAAoAAgAAABoABAAbAAEABQAJAAEABwAA
ACIAAgACAAAABiortwACsQAAAAEACAAAAAoAAgAAACUABQAmAAEACgAAAAIA
Cw==
====
<
<
<
<
<
<
<
<
<
<




















Deleted runt/libs/tool-compiler.test/mini-cldc/java/lang/CloneNotSupportedException.class.__mime.

1
2
3
4
5
6
7
8
9
10
begin-base64 644 ./java/lang/CloneNotSupportedException.class
yv66vgAAADMAEAoABAAMCgAEAA0HAA4HAA8BAAY8aW5pdD4BAAMoKVYBAARD
b2RlAQAPTGluZU51bWJlclRhYmxlAQAVKExqYXZhL2xhbmcvU3RyaW5nOylW
AQAKU291cmNlRmlsZQEAH0Nsb25lTm90U3VwcG9ydGVkRXhjZXB0aW9uLmph
dmEMAAUABgwABQAJAQAkamF2YS9sYW5nL0Nsb25lTm90U3VwcG9ydGVkRXhj
ZXB0aW9uAQATamF2YS9sYW5nL0V4Y2VwdGlvbgAhAAMABAAAAAAAAgABAAUA
BgABAAcAAAAhAAEAAQAAAAUqtwABsQAAAAEACAAAAAoAAgAAABsABAAcAAEA
BQAJAAEABwAAACIAAgACAAAABiortwACsQAAAAEACAAAAAoAAgAAACUABQAm
AAEACgAAAAIACw==
====
<
<
<
<
<
<
<
<
<
<




















Deleted runt/libs/tool-compiler.test/mini-cldc/java/lang/Comparable.class.__mime.

1
2
3
4
5
6
7
8
begin-base64 644 ./java/lang/Comparable.class
yv66vgAAADMADAcACgcACwEACWNvbXBhcmVUbwEAFShMamF2YS9sYW5nL09i
amVjdDspSQEACVNpZ25hdHVyZQEABihUVDspSQEAKDxUOkxqYXZhL2xhbmcv
T2JqZWN0Oz5MamF2YS9sYW5nL09iamVjdDsBAApTb3VyY2VGaWxlAQAPQ29t
cGFyYWJsZS5qYXZhAQAUamF2YS9sYW5nL0NvbXBhcmFibGUBABBqYXZhL2xh
bmcvT2JqZWN0BgEAAQACAAAAAAABBAEAAwAEAAEABQAAAAIABgACAAUAAAAC
AAcACAAAAAIACQ==
====
<
<
<
<
<
<
<
<
















Deleted runt/libs/tool-compiler.test/mini-cldc/java/lang/Enum.class.__mime.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
begin-base64 644 ./java/lang/Enum.class
yv66vgAAADMATgoAFAA5BwA6CgACADkHADsKAAQAOQkAEAA8CQAQAD0HAD4K
AAgAOQoAEAA/BwBACgALADkKABAAQQoAFABCCgARAEMHAEQHAEUKABQARgoA
EABHBwBIBwBJAQAFX25hbWUBABJMamF2YS9sYW5nL1N0cmluZzsBAAhfb3Jk
aW5hbAEAAUkBAAY8aW5pdD4BABYoTGphdmEvbGFuZy9TdHJpbmc7SSlWAQAE
Q29kZQEAD0xpbmVOdW1iZXJUYWJsZQEADVN0YWNrTWFwVGFibGUHAEoBAApF
eGNlcHRpb25zAQAFY2xvbmUBABQoKUxqYXZhL2xhbmcvT2JqZWN0OwEACWNv
bXBhcmVUbwEAEyhMamF2YS9sYW5nL0VudW07KUkBAAlTaWduYXR1cmUBAAYo
VEU7KUkBAAZlcXVhbHMBABUoTGphdmEvbGFuZy9PYmplY3Q7KVoBABFnZXRE
ZWNsYXJpbmdDbGFzcwEAEygpTGphdmEvbGFuZy9DbGFzczsBABgoKUxqYXZh
L2xhbmcvQ2xhc3M8VEU7PjsBAAhoYXNoQ29kZQEAAygpSQEABG5hbWUBABQo
KUxqYXZhL2xhbmcvU3RyaW5nOwEAB29yZGluYWwBAAh0b1N0cmluZwEAB3Zh
bHVlT2YBADUoTGphdmEvbGFuZy9DbGFzcztMamF2YS9sYW5nL1N0cmluZzsp
TGphdmEvbGFuZy9FbnVtOwEARjxUOkxqYXZhL2xhbmcvRW51bTxUVDs+Oz4o
TGphdmEvbGFuZy9DbGFzczxUVDs+O0xqYXZhL2xhbmcvU3RyaW5nOylUVDsB
ABUoTGphdmEvbGFuZy9PYmplY3Q7KUkBAEY8RTpMamF2YS9sYW5nL0VudW08
VEU7Pjs+TGphdmEvbGFuZy9PYmplY3Q7TGphdmEvbGFuZy9Db21wYXJhYmxl
PFRFOz47AQAKU291cmNlRmlsZQEACUVudW0uamF2YQwAGgBLAQAeamF2YS9s
YW5nL051bGxQb2ludGVyRXhjZXB0aW9uAQAiamF2YS9sYW5nL0lsbGVnYWxB
cmd1bWVudEV4Y2VwdGlvbgwAFgAXDAAYABkBACRqYXZhL2xhbmcvQ2xvbmVO
b3RTdXBwb3J0ZWRFeGNlcHRpb24MACkAKgEAHGphdmEvbGFuZy9DbGFzc0Nh
c3RFeGNlcHRpb24MADAALQwATAAqDABNACoBAA5qYXZhL2xhbmcvRW51bQEA
D2phdmEvbGFuZy9DbGFzcwwALAAtDAAjACQBABBqYXZhL2xhbmcvT2JqZWN0
AQAUamF2YS9sYW5nL0NvbXBhcmFibGUBABBqYXZhL2xhbmcvU3RyaW5nAQAD
KClWAQAIZ2V0Q2xhc3MBAA1nZXRTdXBlcmNsYXNzBCEAEAAUAAEAFQACABIA
FgAXAAAAEgAYABkAAAALAAQAGgAbAAIAHAAAAHIAAgADAAAAJyq3AAErxwAL
uwACWbcAA78cnAALuwAEWbcABb8qK7UABioctQAHsQAAAAIAHQAAACIACAAA
ACcABAApAAgAKgAQAC0AFAAuABwAMAAhADEAJgAyAB4AAAARAAL/ABAAAwcA
EAcAHwEAAAsAIAAAAAYAAgAEAAIAFAAhACIAAgAcAAAAIAACAAEAAAAIuwAI
WbcACb8AAAABAB0AAAAGAAEAAAA9ACAAAAAEAAEACAARACMAJAADABwAAABb
AAIAAgAAACkrxwALuwACWbcAA78qtgAKK7YACqUAC7sAC1m3AAy/KrYADSu2
AA1krAAAAAIAHQAAABYABQAAAEgABABJAAwATAAXAE0AHwBQAB4AAAAEAAIM
EgAgAAAABgACAAsAAgAlAAAAAgAmABEAJwAoAAEAHAAAAC4AAgACAAAACyor
pgAHBKcABAOsAAAAAgAdAAAABgABAAAAWgAeAAAABQACCUABABEAKQAqAAIA
HAAAAFMAAgADAAAAGiq2AA5MK7YAD00sEhCmAAgrwAARsCzAABGwAAAAAgAd
AAAAFgAFAAAAagAFAGsACgBsABAAbQAVAG4AHgAAAAsAAf0AFQcAEQcAEQAl
AAAAAgArABEALAAtAAEAHAAAAB0AAQABAAAABSq3ABKsAAAAAQAdAAAABgAB
AAAAeAARAC4ALwABABwAAAAdAAEAAQAAAAUqtAAGsAAAAAEAHQAAAAYAAQAA
AIMAEQAwAC0AAQAcAAAAHQABAAEAAAAFKrQAB6wAAAABAB0AAAAGAAEAAACO
AAEAMQAvAAEAHAAAAB0AAQABAAAABSq0AAawAAAAAQAdAAAABgABAAAAmAAJ
ADIAMwADABwAAAAaAAEAAgAAAAIBsAAAAAEAHQAAAAYAAQAAAKkAIAAAAAYA
AgAEAAIAJQAAAAIANBBBACMANQABABwAAAAhAAIAAgAAAAkqK8AAELYAE6wA
AAABAB0AAAAGAAEAAAATAAIAJQAAAAIANgA3AAAAAgA4
====
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
























































































Deleted runt/libs/tool-compiler.test/mini-cldc/java/lang/Error.class.__mime.

1
2
3
4
5
6
7
8
9
10
11
12
13
begin-base64 644 ./java/lang/Error.class
yv66vgAAADMAFgoABgAQCgAGABEKAAYAEgoABgATBwAUBwAVAQAGPGluaXQ+
AQADKClWAQAEQ29kZQEAD0xpbmVOdW1iZXJUYWJsZQEAFShMamF2YS9sYW5n
L1N0cmluZzspVgEAKihMamF2YS9sYW5nL1N0cmluZztMamF2YS9sYW5nL1Ro
cm93YWJsZTspVgEAGChMamF2YS9sYW5nL1Rocm93YWJsZTspVgEAClNvdXJj
ZUZpbGUBAApFcnJvci5qYXZhDAAHAAgMAAcACwwABwAMDAAHAA0BAA9qYXZh
L2xhbmcvRXJyb3IBABNqYXZhL2xhbmcvVGhyb3dhYmxlACEABQAGAAAAAAAE
AAEABwAIAAEACQAAACEAAQABAAAABSq3AAGxAAAAAQAKAAAACgACAAAAGgAE
ABsAAQAHAAsAAQAJAAAAIgACAAIAAAAGKiu3AAKxAAAAAQAKAAAACgACAAAA
JQAFACYAAQAHAAwAAQAJAAAAIwADAAMAAAAHKisstwADsQAAAAEACgAAAAoA
AgAAADEABgAyAAEABwANAAEACQAAACIAAgACAAAABiortwAEsQAAAAEACgAA
AAoAAgAAADwABQA9AAEADgAAAAIADw==
====
<
<
<
<
<
<
<
<
<
<
<
<
<


























Deleted runt/libs/tool-compiler.test/mini-cldc/java/lang/Exception.class.__mime.

1
2
3
4
5
6
7
8
9
10
11
12
13
begin-base64 644 ./java/lang/Exception.class
yv66vgAAADMAFgoABgAQCgAGABEKAAYAEgoABgATBwAUBwAVAQAGPGluaXQ+
AQADKClWAQAEQ29kZQEAD0xpbmVOdW1iZXJUYWJsZQEAFShMamF2YS9sYW5n
L1N0cmluZzspVgEAKihMamF2YS9sYW5nL1N0cmluZztMamF2YS9sYW5nL1Ro
cm93YWJsZTspVgEAGChMamF2YS9sYW5nL1Rocm93YWJsZTspVgEAClNvdXJj
ZUZpbGUBAA5FeGNlcHRpb24uamF2YQwABwAIDAAHAAsMAAcADAwABwANAQAT
amF2YS9sYW5nL0V4Y2VwdGlvbgEAE2phdmEvbGFuZy9UaHJvd2FibGUAIQAF
AAYAAAAAAAQAAQAHAAgAAQAJAAAAIQABAAEAAAAFKrcAAbEAAAABAAoAAAAK
AAIAAAAdAAQAHgABAAcACwABAAkAAAAiAAIAAgAAAAYqK7cAArEAAAABAAoA
AAAKAAIAAAAoAAUAKQABAAcADAABAAkAAAAjAAMAAwAAAAcqKyy3AAOxAAAA
AQAKAAAACgACAAAANAAGADUAAQAHAA0AAQAJAAAAIgACAAIAAAAGKiu3AASx
AAAAAQAKAAAACgACAAAAPwAFAEAAAQAOAAAAAgAP
====
<
<
<
<
<
<
<
<
<
<
<
<
<


























Deleted runt/libs/tool-compiler.test/mini-cldc/java/lang/IllegalArgumentException.class.__mime.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
begin-base64 644 ./java/lang/IllegalArgumentException.class
yv66vgAAADMAFgoABgAQCgAGABEKAAYAEgoABgATBwAUBwAVAQAGPGluaXQ+
AQADKClWAQAEQ29kZQEAD0xpbmVOdW1iZXJUYWJsZQEAFShMamF2YS9sYW5n
L1N0cmluZzspVgEAKihMamF2YS9sYW5nL1N0cmluZztMamF2YS9sYW5nL1Ro
cm93YWJsZTspVgEAGChMamF2YS9sYW5nL1Rocm93YWJsZTspVgEAClNvdXJj
ZUZpbGUBAB1JbGxlZ2FsQXJndW1lbnRFeGNlcHRpb24uamF2YQwABwAIDAAH
AAsMAAcADAwABwANAQAiamF2YS9sYW5nL0lsbGVnYWxBcmd1bWVudEV4Y2Vw
dGlvbgEAGmphdmEvbGFuZy9SdW50aW1lRXhjZXB0aW9uACEABQAGAAAAAAAE
AAEABwAIAAEACQAAACEAAQABAAAABSq3AAGxAAAAAQAKAAAACgACAAAAGwAE
ABwAAQAHAAsAAQAJAAAAIgACAAIAAAAGKiu3AAKxAAAAAQAKAAAACgACAAAA
JgAFACcAAQAHAAwAAQAJAAAAIwADAAMAAAAHKisstwADsQAAAAEACgAAAAoA
AgAAADIABgAzAAEABwANAAEACQAAACIAAgACAAAABiortwAEsQAAAAEACgAA
AAoAAgAAAD0ABQA+AAEADgAAAAIADw==
====
<
<
<
<
<
<
<
<
<
<
<
<
<
<




























Deleted runt/libs/tool-compiler.test/mini-cldc/java/lang/NullPointerException.class.__mime.

1
2
3
4
5
6
7
8
9
10
begin-base64 644 ./java/lang/NullPointerException.class
yv66vgAAADMAEAoABAAMCgAEAA0HAA4HAA8BAAY8aW5pdD4BAAMoKVYBAARD
b2RlAQAPTGluZU51bWJlclRhYmxlAQAVKExqYXZhL2xhbmcvU3RyaW5nOylW
AQAKU291cmNlRmlsZQEAGU51bGxQb2ludGVyRXhjZXB0aW9uLmphdmEMAAUA
BgwABQAJAQAeamF2YS9sYW5nL051bGxQb2ludGVyRXhjZXB0aW9uAQAaamF2
YS9sYW5nL1J1bnRpbWVFeGNlcHRpb24AIQADAAQAAAAAAAIAAQAFAAYAAQAH
AAAAIQABAAEAAAAFKrcAAbEAAAABAAgAAAAKAAIAAAAaAAQAGwABAAUACQAB
AAcAAAAiAAIAAgAAAAYqK7cAArEAAAABAAgAAAAKAAIAAAAlAAUAJgABAAoA
AAACAAs=
====
<
<
<
<
<
<
<
<
<
<




















Deleted runt/libs/tool-compiler.test/mini-cldc/java/lang/Object.class.__mime.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
begin-base64 644 ./java/lang/Object.class
yv66vgAAADMAGggAFwcAGAEABjxpbml0PgEAAygpVgEABENvZGUBAA9MaW5l
TnVtYmVyVGFibGUBAAVjbG9uZQEAFCgpTGphdmEvbGFuZy9PYmplY3Q7AQAK
RXhjZXB0aW9ucwcAGQEACGdldENsYXNzAQATKClMamF2YS9sYW5nL0NsYXNz
OwEACVNpZ25hdHVyZQEAFigpTGphdmEvbGFuZy9DbGFzczwqPjsBAAZlcXVh
bHMBABUoTGphdmEvbGFuZy9PYmplY3Q7KVoBAAhoYXNoQ29kZQEAAygpSQEA
CHRvU3RyaW5nAQAUKClMamF2YS9sYW5nL1N0cmluZzsBAApTb3VyY2VGaWxl
AQALT2JqZWN0LmphdmEBAAlBZG9yYWJsZSEBABBqYXZhL2xhbmcvT2JqZWN0
AQAkamF2YS9sYW5nL0Nsb25lTm90U3VwcG9ydGVkRXhjZXB0aW9uACEAAgAA
AAAAAAAGAAEAAwAEAAEABQAAABkAAAABAAAAAbEAAAABAAYAAAAGAAEAAAAR
AAQABwAIAAIABQAAABoAAQABAAAAAgGwAAAAAQAGAAAABgABAAAAHAAJAAAA
BAABAAoAEQALAAwAAgAFAAAAGgABAAEAAAACAbAAAAABAAYAAAAGAAEAAAAn
AA0AAAACAA4AAQAPABAAAQAFAAAAGgABAAIAAAACA6wAAAABAAYAAAAGAAEA
AAAyAAEAEQASAAEABQAAABoAAQABAAAAAgOsAAAAAQAGAAAABgABAAAAPQAB
ABMAFAABAAUAAAAbAAEAAQAAAAMSAbAAAAABAAYAAAAGAAEAAABIAAEAFQAA
AAIAFg==
====
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


































Deleted runt/libs/tool-compiler.test/mini-cldc/java/lang/Override.class.__mime.

1
2
3
4
5
6
7
8
9
10
11
begin-base64 644 ./java/lang/Override.class
yv66vgAAADMAEQcADgcADwcAEAEAClNvdXJjZUZpbGUBAA1PdmVycmlkZS5q
YXZhAQAZUnVudGltZVZpc2libGVBbm5vdGF0aW9ucwEAHUxqYXZhL2xhbmcv
YW5ub3RhdGlvbi9UYXJnZXQ7AQAFdmFsdWUBACJMamF2YS9sYW5nL2Fubm90
YXRpb24vRWxlbWVudFR5cGU7AQAGTUVUSE9EAQAgTGphdmEvbGFuZy9hbm5v
dGF0aW9uL1JldGVudGlvbjsBACZMamF2YS9sYW5nL2Fubm90YXRpb24vUmV0
ZW50aW9uUG9saWN5OwEABlNPVVJDRQEAEmphdmEvbGFuZy9PdmVycmlkZQEA
EGphdmEvbGFuZy9PYmplY3QBAB9qYXZhL2xhbmcvYW5ub3RhdGlvbi9Bbm5v
dGF0aW9uJgEAAQACAAEAAwAAAAAAAgAEAAAAAgAFAAYAAAAbAAIABwABAAhb
AAFlAAkACgALAAEACGUADAAN
====
<
<
<
<
<
<
<
<
<
<
<






















Deleted runt/libs/tool-compiler.test/mini-cldc/java/lang/RuntimeException.class.__mime.

1
2
3
4
5
6
7
8
9
10
11
12
13
begin-base64 644 ./java/lang/RuntimeException.class
yv66vgAAADMAFgoABgAQCgAGABEKAAYAEgoABgATBwAUBwAVAQAGPGluaXQ+
AQADKClWAQAEQ29kZQEAD0xpbmVOdW1iZXJUYWJsZQEAFShMamF2YS9sYW5n
L1N0cmluZzspVgEAKihMamF2YS9sYW5nL1N0cmluZztMamF2YS9sYW5nL1Ro
cm93YWJsZTspVgEAGChMamF2YS9sYW5nL1Rocm93YWJsZTspVgEAClNvdXJj
ZUZpbGUBABVSdW50aW1lRXhjZXB0aW9uLmphdmEMAAcACAwABwALDAAHAAwM
AAcADQEAGmphdmEvbGFuZy9SdW50aW1lRXhjZXB0aW9uAQATamF2YS9sYW5n
L1Rocm93YWJsZQAhAAUABgAAAAAABAABAAcACAABAAkAAAAhAAEAAQAAAAUq
twABsQAAAAEACgAAAAoAAgAAABoABAAbAAEABwALAAEACQAAACIAAgACAAAA
BiortwACsQAAAAEACgAAAAoAAgAAACUABQAmAAEABwAMAAEACQAAACMAAwAD
AAAAByorLLcAA7EAAAABAAoAAAAKAAIAAAAxAAYAMgABAAcADQABAAkAAAAi
AAIAAgAAAAYqK7cABLEAAAABAAoAAAAKAAIAAAA8AAUAPQABAA4AAAACAA8=
====
<
<
<
<
<
<
<
<
<
<
<
<
<


























Deleted runt/libs/tool-compiler.test/mini-cldc/java/lang/String.class.__mime.

1
2
3
4
5
6
7
begin-base64 644 ./java/lang/String.class
yv66vgAAADMADQoAAwAKBwALBwAMAQAGPGluaXQ+AQADKClWAQAEQ29kZQEA
D0xpbmVOdW1iZXJUYWJsZQEAClNvdXJjZUZpbGUBAAtTdHJpbmcuamF2YQwA
BAAFAQAQamF2YS9sYW5nL1N0cmluZwEAEGphdmEvbGFuZy9PYmplY3QAMQAC
AAMAAAAAAAEAAQAEAAUAAQAGAAAAHQABAAEAAAAFKrcAAbEAAAABAAcAAAAG
AAEAAAARAAEACAAAAAIACQ==
====
<
<
<
<
<
<
<














Deleted runt/libs/tool-compiler.test/mini-cldc/java/lang/SuppressWarnings.class.__mime.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
begin-base64 644 ./java/lang/SuppressWarnings.class
yv66vgAAADMAFwcAFAcAFQcAFgEABXZhbHVlAQAVKClbTGphdmEvbGFuZy9T
dHJpbmc7AQAKU291cmNlRmlsZQEAFVN1cHByZXNzV2FybmluZ3MuamF2YQEA
GVJ1bnRpbWVWaXNpYmxlQW5ub3RhdGlvbnMBAB1MamF2YS9sYW5nL2Fubm90
YXRpb24vVGFyZ2V0OwEAIkxqYXZhL2xhbmcvYW5ub3RhdGlvbi9FbGVtZW50
VHlwZTsBAARUWVBFAQAFRklFTEQBAAZNRVRIT0QBAAlQQVJBTUVURVIBAAtD
T05TVFJVQ1RPUgEADkxPQ0FMX1ZBUklBQkxFAQAgTGphdmEvbGFuZy9hbm5v
dGF0aW9uL1JldGVudGlvbjsBACZMamF2YS9sYW5nL2Fubm90YXRpb24vUmV0
ZW50aW9uUG9saWN5OwEABlNPVVJDRQEAGmphdmEvbGFuZy9TdXBwcmVzc1dh
cm5pbmdzAQAQamF2YS9sYW5nL09iamVjdAEAH2phdmEvbGFuZy9hbm5vdGF0
aW9uL0Fubm90YXRpb24mAQABAAIAAQADAAAAAQQBAAQABQAAAAIABgAAAAIA
BwAIAAAANAACAAkAAQAEWwAGZQAKAAtlAAoADGUACgANZQAKAA5lAAoAD2UA
CgAQABEAAQAEZQASABM=
====
<
<
<
<
<
<
<
<
<
<
<
<
<
<




























Deleted runt/libs/tool-compiler.test/mini-cldc/java/lang/Throwable.class.__mime.

1
2
3
4
5
6
7
8
9
10
11
12
begin-base64 644 ./java/lang/Throwable.class
yv66vgAAADMAEAoAAwANBwAOBwAPAQAGPGluaXQ+AQADKClWAQAEQ29kZQEA
D0xpbmVOdW1iZXJUYWJsZQEAFShMamF2YS9sYW5nL1N0cmluZzspVgEAKihM
amF2YS9sYW5nL1N0cmluZztMamF2YS9sYW5nL1Rocm93YWJsZTspVgEAGChM
amF2YS9sYW5nL1Rocm93YWJsZTspVgEAClNvdXJjZUZpbGUBAA5UaHJvd2Fi
bGUuamF2YQwABAAFAQATamF2YS9sYW5nL1Rocm93YWJsZQEAEGphdmEvbGFu
Zy9PYmplY3QAIQACAAMAAAAAAAQAAQAEAAUAAQAGAAAAIQABAAEAAAAFKrcA
AbEAAAABAAcAAAAKAAIAAAAZAAQAGgABAAQACAABAAYAAAAhAAEAAgAAAAUq
twABsQAAAAEABwAAAAoAAgAAACMABAAkAAEABAAJAAEABgAAACEAAQADAAAA
BSq3AAGxAAAAAQAHAAAACgACAAAALgAEAC8AAQAEAAoAAQAGAAAAIQABAAIA
AAAFKrcAAbEAAAABAAcAAAAKAAIAAAA4AAQAOQABAAsAAAACAAw=
====
<
<
<
<
<
<
<
<
<
<
<
<
























Deleted runt/libs/tool-compiler.test/mini-cldc/java/lang/annotation/Annotation.class.__mime.

1
2
3
4
5
6
7
8
9
10
begin-base64 644 ./java/lang/annotation/Annotation.class
yv66vgAAADMAEQcADwcAEAEADmFubm90YXRpb25UeXBlAQATKClMamF2YS9s
YW5nL0NsYXNzOwEACVNpZ25hdHVyZQEANygpTGphdmEvbGFuZy9DbGFzczwr
TGphdmEvbGFuZy9hbm5vdGF0aW9uL0Fubm90YXRpb247PjsBAAZlcXVhbHMB
ABUoTGphdmEvbGFuZy9PYmplY3Q7KVoBAAhoYXNoQ29kZQEAAygpSQEACHRv
U3RyaW5nAQAUKClMamF2YS9sYW5nL1N0cmluZzsBAApTb3VyY2VGaWxlAQAP
QW5ub3RhdGlvbi5qYXZhAQAfamF2YS9sYW5nL2Fubm90YXRpb24vQW5ub3Rh
dGlvbgEAEGphdmEvbGFuZy9PYmplY3QGAQABAAIAAAAAAAQEAQADAAQAAQAF
AAAAAgAGBAEABwAIAAAEAQAJAAoAAAQBAAsADAAAAAEADQAAAAIADg==
====
<
<
<
<
<
<
<
<
<
<




















Deleted runt/libs/tool-compiler.test/mini-cldc/java/lang/annotation/ElementType.class.__mime.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
begin-base64 644 ./java/lang/annotation/ElementType.class
yv66vgAAADMARAkABAAyCgAzADQHACMHADUKABgANgoAGAA3CAAZCgAEADcJ
AAQAOAgAGwkABAA5CAAcCQAEADoIAB0JAAQAOwgAHgkABAA8CAAfCQAEAD0I
ACAJAAQAPggAIQkABAA/BwBAAQAPQU5OT1RBVElPTl9UWVBFAQAiTGphdmEv
bGFuZy9hbm5vdGF0aW9uL0VsZW1lbnRUeXBlOwEAC0NPTlNUUlVDVE9SAQAF
RklFTEQBAA5MT0NBTF9WQVJJQUJMRQEABk1FVEhPRAEAB1BBQ0tBR0UBAAlQ
QVJBTUVURVIBAARUWVBFAQAHJFZBTFVFUwEAI1tMamF2YS9sYW5nL2Fubm90
YXRpb24vRWxlbWVudFR5cGU7AQAGdmFsdWVzAQAlKClbTGphdmEvbGFuZy9h
bm5vdGF0aW9uL0VsZW1lbnRUeXBlOwEABENvZGUBAA9MaW5lTnVtYmVyVGFi
bGUBAAd2YWx1ZU9mAQA2KExqYXZhL2xhbmcvU3RyaW5nOylMamF2YS9sYW5n
L2Fubm90YXRpb24vRWxlbWVudFR5cGU7AQAGPGluaXQ+AQAWKExqYXZhL2xh
bmcvU3RyaW5nO0kpVgEACVNpZ25hdHVyZQEAAygpVgEACDxjbGluaXQ+AQA0
TGphdmEvbGFuZy9FbnVtPExqYXZhL2xhbmcvYW5ub3RhdGlvbi9FbGVtZW50
VHlwZTs+OwEAClNvdXJjZUZpbGUBABBFbGVtZW50VHlwZS5qYXZhDAAiACMH
ACMMAEEAQgEAIGphdmEvbGFuZy9hbm5vdGF0aW9uL0VsZW1lbnRUeXBlDAAo
AEMMACoAKwwAGQAaDAAbABoMABwAGgwAHQAaDAAeABoMAB8AGgwAIAAaDAAh
ABoBAA5qYXZhL2xhbmcvRW51bQEABWNsb25lAQAUKClMamF2YS9sYW5nL09i
amVjdDsBADUoTGphdmEvbGFuZy9DbGFzcztMamF2YS9sYW5nL1N0cmluZzsp
TGphdmEvbGFuZy9FbnVtO0AxAAQAGAAAAAlAGQAZABoAAEAZABsAGgAAQBkA
HAAaAABAGQAdABoAAEAZAB4AGgAAQBkAHwAaAABAGQAgABoAAEAZACEAGgAA
EBoAIgAjAAAABAAJACQAJQABACYAAAAiAAEAAAAAAAqyAAG2AALAAAOwAAAA
AQAnAAAABgABAAAAEwAJACgAKQABACYAAAAiAAIAAQAAAAoSBCq4AAXAAASw
AAAAAQAnAAAABgABAAAAEwACACoAKwACACYAAAAfAAMAAwAAAAcqKxy3AAax
AAAAAQAnAAAABgABAAAAEwAsAAAAAgAtAAgALgAtAAEAJgAAAN0ABAAAAAAA
pbsABFkSBwO3AAizAAm7AARZEgoEtwAIswALuwAEWRIMBbcACLMADbsABFkS
Dga3AAizAA+7AARZEhAHtwAIswARuwAEWRISCLcACLMAE7sABFkSFBAGtwAI
swAVuwAEWRIWEAe3AAizABcQCL0ABFkDsgAJU1kEsgALU1kFsgANU1kGsgAP
U1kHsgARU1kIsgATU1kQBrIAFVNZEAeyABdTswABsQAAAAEAJwAAACYACQAA
ABYADQAZABoAHAAnAB8ANAAiAEEAJQBOACgAXAArAGoAEwACACwAAAACAC8A
MAAAAAIAMQ==
====
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






























































Deleted runt/libs/tool-compiler.test/mini-cldc/java/lang/annotation/Retention.class.__mime.

1
2
3
4
5
6
7
8
9
10
11
12
13
begin-base64 644 ./java/lang/annotation/Retention.class
yv66vgAAADMAEgcADwcAEAcAEQEABXZhbHVlAQAoKClMamF2YS9sYW5nL2Fu
bm90YXRpb24vUmV0ZW50aW9uUG9saWN5OwEAClNvdXJjZUZpbGUBAA5SZXRl
bnRpb24uamF2YQEAGVJ1bnRpbWVWaXNpYmxlQW5ub3RhdGlvbnMBACBMamF2
YS9sYW5nL2Fubm90YXRpb24vUmV0ZW50aW9uOwEAJkxqYXZhL2xhbmcvYW5u
b3RhdGlvbi9SZXRlbnRpb25Qb2xpY3k7AQAHUlVOVElNRQEAHUxqYXZhL2xh
bmcvYW5ub3RhdGlvbi9UYXJnZXQ7AQAiTGphdmEvbGFuZy9hbm5vdGF0aW9u
L0VsZW1lbnRUeXBlOwEAD0FOTk9UQVRJT05fVFlQRQEAHmphdmEvbGFuZy9h
bm5vdGF0aW9uL1JldGVudGlvbgEAEGphdmEvbGFuZy9PYmplY3QBAB9qYXZh
L2xhbmcvYW5ub3RhdGlvbi9Bbm5vdGF0aW9uJgEAAQACAAEAAwAAAAEEAQAE
AAUAAAACAAYAAAACAAcACAAAABsAAgAJAAEABGUACgALAAwAAQAEWwABZQAN
AA4=
====
<
<
<
<
<
<
<
<
<
<
<
<
<


























Deleted runt/libs/tool-compiler.test/mini-cldc/java/lang/annotation/RetentionPolicy.class.__mime.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
begin-base64 644 ./java/lang/annotation/RetentionPolicy.class
yv66vgAAADMAMAkABAAjCgAkACUHABQHACYKAA4AJwoADgAoCAAPCgAEACgJ
AAQAKQgAEQkABAAqCAASCQAEACsHACwBAAVDTEFTUwEAJkxqYXZhL2xhbmcv
YW5ub3RhdGlvbi9SZXRlbnRpb25Qb2xpY3k7AQAHUlVOVElNRQEABlNPVVJD
RQEAByRWQUxVRVMBACdbTGphdmEvbGFuZy9hbm5vdGF0aW9uL1JldGVudGlv
blBvbGljeTsBAAZ2YWx1ZXMBACkoKVtMamF2YS9sYW5nL2Fubm90YXRpb24v
UmV0ZW50aW9uUG9saWN5OwEABENvZGUBAA9MaW5lTnVtYmVyVGFibGUBAAd2
YWx1ZU9mAQA6KExqYXZhL2xhbmcvU3RyaW5nOylMamF2YS9sYW5nL2Fubm90
YXRpb24vUmV0ZW50aW9uUG9saWN5OwEABjxpbml0PgEAFihMamF2YS9sYW5n
L1N0cmluZztJKVYBAAlTaWduYXR1cmUBAAMoKVYBAAg8Y2xpbml0PgEAOExq
YXZhL2xhbmcvRW51bTxMamF2YS9sYW5nL2Fubm90YXRpb24vUmV0ZW50aW9u
UG9saWN5Oz47AQAKU291cmNlRmlsZQEAFFJldGVudGlvblBvbGljeS5qYXZh
DAATABQHABQMAC0ALgEAJGphdmEvbGFuZy9hbm5vdGF0aW9uL1JldGVudGlv
blBvbGljeQwAGQAvDAAbABwMAA8AEAwAEQAQDAASABABAA5qYXZhL2xhbmcv
RW51bQEABWNsb25lAQAUKClMamF2YS9sYW5nL09iamVjdDsBADUoTGphdmEv
bGFuZy9DbGFzcztMamF2YS9sYW5nL1N0cmluZzspTGphdmEvbGFuZy9FbnVt
O0AxAAQADgAAAARAGQAPABAAAEAZABEAEAAAQBkAEgAQAAAQGgATABQAAAAE
AAkAFQAWAAEAFwAAACIAAQAAAAAACrIAAbYAAsAAA7AAAAABABgAAAAGAAEA
AAATAAkAGQAaAAEAFwAAACIAAgABAAAAChIEKrgABcAABLAAAAABABgAAAAG
AAEAAAATAAIAGwAcAAIAFwAAAB8AAwADAAAAByorHLcABrEAAAABABgAAAAG
AAEAAAATAB0AAAACAB4ACAAfAB4AAQAXAAAAZQAEAAAAAABBuwAEWRIHA7cA
CLMACbsABFkSCgS3AAizAAu7AARZEgwFtwAIswANBr0ABFkDsgAJU1kEsgAL
U1kFsgANU7MAAbEAAAABABgAAAASAAQAAAAWAA0AGQAaABwAJwATAAIAHQAA
AAIAIAAhAAAAAgAi
====
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


















































Deleted runt/libs/tool-compiler.test/mini-cldc/java/lang/annotation/Target.class.__mime.

1
2
3
4
5
6
7
8
9
10
11
12
begin-base64 644 ./java/lang/annotation/Target.class
yv66vgAAADMAEgcADwcAEAcAEQEABXZhbHVlAQAlKClbTGphdmEvbGFuZy9h
bm5vdGF0aW9uL0VsZW1lbnRUeXBlOwEAClNvdXJjZUZpbGUBAAtUYXJnZXQu
amF2YQEAGVJ1bnRpbWVWaXNpYmxlQW5ub3RhdGlvbnMBACBMamF2YS9sYW5n
L2Fubm90YXRpb24vUmV0ZW50aW9uOwEAJkxqYXZhL2xhbmcvYW5ub3RhdGlv
bi9SZXRlbnRpb25Qb2xpY3k7AQAHUlVOVElNRQEAHUxqYXZhL2xhbmcvYW5u
b3RhdGlvbi9UYXJnZXQ7AQAiTGphdmEvbGFuZy9hbm5vdGF0aW9uL0VsZW1l
bnRUeXBlOwEAD0FOTk9UQVRJT05fVFlQRQEAG2phdmEvbGFuZy9hbm5vdGF0
aW9uL1RhcmdldAEAEGphdmEvbGFuZy9PYmplY3QBAB9qYXZhL2xhbmcvYW5u
b3RhdGlvbi9Bbm5vdGF0aW9uJgEAAQACAAEAAwAAAAEEAQAEAAUAAAACAAYA
AAACAAcACAAAABsAAgAJAAEABGUACgALAAwAAQAEWwABZQANAA4=
====
<
<
<
<
<
<
<
<
<
<
<
<
























Deleted runt/libs/tool-compiler.test/mini-cldc/java/util/List.class.__mime.

1
2
3
4
5
6
begin-base64 644 ./java/util/List.class
yv66vgAAADMACQcABwcACAEACVNpZ25hdHVyZQEAKDxUOkxqYXZhL2xhbmcv
T2JqZWN0Oz5MamF2YS9sYW5nL09iamVjdDsBAApTb3VyY2VGaWxlAQAJTGlz
dC5qYXZhAQAOamF2YS91dGlsL0xpc3QBABBqYXZhL2xhbmcvT2JqZWN0BgEA
AQACAAAAAAAAAAIAAwAAAAIABAAFAAAAAgAG
====
<
<
<
<
<
<












Deleted runt/libs/tool-compiler.test/mini-cldc/list.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
.
source-files
source-files/java
source-files/java/lang
source-files/java/lang/Object.java
source-files/java/lang/Error.java
source-files/java/lang/IllegalArgumentException.java
source-files/java/lang/String.java
source-files/java/lang/Enum.java
source-files/java/lang/Comparable.java
source-files/java/lang/RuntimeException.java
source-files/java/lang/Override.java
source-files/java/lang/Throwable.java
source-files/java/lang/package-info.java
source-files/java/lang/NullPointerException.java
source-files/java/lang/annotation
source-files/java/lang/annotation/Inherited.java
source-files/java/lang/annotation/Retention.java
source-files/java/lang/annotation/Target.java
source-files/java/lang/annotation/Annotation.java
source-files/java/lang/annotation/RetentionPolicy.java
source-files/java/lang/annotation/Documented.java
source-files/java/lang/annotation/ElementType.java
source-files/java/lang/SuppressWarnings.java
source-files/java/lang/Exception.java
source-files/java/lang/Class.java
source-files/java/lang/CloneNotSupportedException.java
source-files/java/lang/ClassCastException.java
source-files/java/util
source-files/java/util/List.java
java
java/lang
java/lang/Error.class
java/lang/Override.class
java/lang/SuppressWarnings.class
java/lang/Class.class
java/lang/Exception.class
java/lang/String.class
java/lang/Throwable.class
java/lang/RuntimeException.class
java/lang/IllegalArgumentException.class
java/lang/ClassCastException.class
java/lang/CloneNotSupportedException.class
java/lang/annotation
java/lang/annotation/RetentionPolicy.class
java/lang/annotation/ElementType.class
java/lang/annotation/Target.class
java/lang/annotation/Retention.class
java/lang/annotation/Annotation.class
java/lang/Enum.class
java/lang/Object.class
java/lang/NullPointerException.class
java/lang/Comparable.class
java/util
java/util/List.class
compile.sh
list
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


















































































































Deleted runt/libs/tool-compiler.test/mini-cldc/source-files/java/lang/Class.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.lang;

/**
 * This represents the Java accessible class object which describes this
 * class.
 *
 * @param <C> The class type.
 * @since 2019/05/26
 */
public final class Class<C>
{
	/**
	 * Returns the super class of this class.
	 *
	 * @return The super class of this class.
	 * @since 2019/05/26
	 */
	public final Class<?> getSuperclass()
	{
		return null;
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
































































Deleted runt/libs/tool-compiler.test/mini-cldc/source-files/java/lang/ClassCastException.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.lang;

/**
 * This is thrown when the class is not the correct type.
 *
 * @since 2019/05/25
 */
public class ClassCastException
	extends RuntimeException
{
	/**
	 * Initializes the exception with no message or cause.
	 *
	 * @since 2019/05/25
	 */
	public ClassCastException()
	{
	}
	
	/**
	 * Initializes the exception with the given message and no cause.
	 *
	 * @param __m The message.
	 * @since 2019/05/25
	 */
	public ClassCastException(String __m)
	{
		super(__m);
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
















































































Deleted runt/libs/tool-compiler.test/mini-cldc/source-files/java/lang/CloneNotSupportedException.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.lang;

/**
 * This is thrown when cloning is not supported for the given object.
 *
 * @since 2018/12/04
 */
public class CloneNotSupportedException
	extends Exception
{
	/**
	 * Initializes the exception with no message or cause.
	 *
	 * @since 2018/12/04
	 */
	public CloneNotSupportedException()
	{
	}
	
	/**
	 * Initializes the exception with the given message and no cause.
	 *
	 * @since 2018/12/04
	 */
	public CloneNotSupportedException(String __m)
	{
		super(__m);
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
















































































Deleted runt/libs/tool-compiler.test/mini-cldc/source-files/java/lang/Comparable.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.lang;

/**
 * This interface is used to set two classes as being comparable to other
 * classes.
 *
 * It is not required to but comparisons performed by this interface should
 * be comparable to {@link Object#equals(Object)} so that
 * {@code a.equals(b) == (a.compareTo(b) == 0)}.
 *
 * It is recommended to implement this class so that
 * {@code a.compareTo(b) == -b.compareTo(a)} is true, this makes the
 * comparisons consistent. However this might not be feasible for speed
 * purposes so it is highly recommended to at least have comparible negative,
 * zero, and positive.
 *
 * @param <T> The type to compare.
 * @since 2018/09/19
 */
public interface Comparable<T>
{
	/**
	 * Compares this instance to the argument passed, 
	 *
	 * Note that {@code NullPointerException} should be thrown for {@code __b}
	 * since {@code __b.compareTo(this)} would thrown an exception.
	 *
	 * @param __b The object to compare against.
	 * @return The result of the comparison, negative values mean
	 * {@code this < __b}, zero means {@code this == __b}, and positive values
	 * mean {@code this > __b}.
	 * @since 2018/09/19
	 */
	public abstract int compareTo(T __b);
}


<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






























































































Deleted runt/libs/tool-compiler.test/mini-cldc/source-files/java/lang/Enum.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.lang;

/**
 * This is the base class for enum types.
 *
 * @param <E> The enum type.
 * @since 2018/09/24
 */
public abstract class Enum<E extends Enum<E>>
	implements Comparable<E>
{
	/** The name of the enum. */
	private final String _name;
	
	/** The ordinal of the enumeration. */
	private final int _ordinal;
	
	/**
	 * Initializes the enum properties.
	 *
	 * @param __s The enum name.
	 * @param __o The enum ordinal.
	 * @throws IllegalArgumentException If the ordinal is negative.
	 * @throws NullPointerException If no name was specified.
	 * @since 2018/09/24
	 */
	protected Enum(String __s, int __o)
		throws IllegalArgumentException, NullPointerException
	{
		// Enum has no string
		if (__s == null)
			throw new NullPointerException();
		
		// Enum has negative ordinal
		if (__o < 0)
			throw new IllegalArgumentException();
		
		this._name = __s;
		this._ordinal = __o;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/09/24
	 */
	@Override
	protected final Object clone()
		throws CloneNotSupportedException
	{
		// Enums cannot be cloned.
		throw new CloneNotSupportedException();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/09/24
	 */
	@Override
	public final int compareTo(E __o)
		throws ClassCastException, NullPointerException
	{
		if (__o == null)
			throw new NullPointerException();
		
		// Cannot compare enums of a different type.
		if (this.getDeclaringClass() != __o.getDeclaringClass())
			throw new ClassCastException();
		
		// Just ordinal subtraction
		return this.ordinal() - __o.ordinal();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/09/24
	 */
	@Override
	public final boolean equals(Object __o)
	{
		return this == __o;
	}
	
	/**
	 * Returns the class that declares this enum, this may be different from
	 * {@link Object#getClass()}.
	 *
	 * @return The declaring class of this enum.
	 * @since 2018/09/24
	 */
	@SuppressWarnings({"unchecked"})
	public final Class<E> getDeclaringClass()
	{
		// Enums are either directly extending or extending a base class which
		// then extends this class, so we just need to look a few places up
		// the tree
		Class<?> me = this.getClass(),
			ext = me.getSuperclass();
		if (ext == Enum.class)
			return (Class<E>)((Object)me);
		return (Class<E>)((Object)ext);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/09/24
	 */
	@Override
	public final int hashCode()
	{
		return super.hashCode();
	}
	
	/**
	 * Returns the name of the constant.
	 *
	 * @return The constant name.
	 * @since 2018/09/24
	 */
	public final String name()
	{
		return this._name;
	}
	
	/**
	 * Returns the ordinal of the constant.
	 *
	 * @return The ordinal constant.
	 * @since 2018/09/24
	 */
	public final int ordinal()
	{
		return this._ordinal;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/09/24
	 */
	@Override
	public String toString()
	{
		return this._name;
	}
	
	/**
	 * From the given enumeration, find a value which matches the given name.
	 *
	 * @param <T> The enumeration type to search in.
	 * @param __cl The class to lookup.
	 * @param __s The string to search for.
	 * @return The enumeration value.
	 * @throws IllegalArgumentException If the value was not found.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/12/07
	 */
	public static <T extends Enum<T>> T valueOf(Class<T> __cl, String __s)
		throws IllegalArgumentException, NullPointerException
	{
		return null;
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
























































































































































































































































































































































Deleted runt/libs/tool-compiler.test/mini-cldc/source-files/java/lang/Error.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.lang;

/**
 * This represents an error which should not be caught.
 *
 * @since 2019/05/25
 */
public class Error
	extends Throwable
{
	/**
	 * Initializes the exception with no message or cause.
	 *
	 * @since 2019/05/25
	 */
	public Error()
	{
	}
	
	/**
	 * Initializes the exception with the given message and no cause.
	 *
	 * @param __m The message.
	 * @since 2019/05/25
	 */
	public Error(String __m)
	{
		super(__m);
	}
	
	/**
	 * Initializes the exception with the given message and cause.
	 *
	 * @param __m The message.
	 * @param __t The cause.
	 * @since 2019/05/25
	 */
	public Error(String __m, Throwable __t)
	{
		super(__m, __t);
	}
	
	/**
	 * Initializes the exception with the given cause and no message.
	 *
	 * @param __t The cause.
	 * @since 2019/05/25
	 */
	public Error(Throwable __t)
	{
		super(__t);
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






























































































































Deleted runt/libs/tool-compiler.test/mini-cldc/source-files/java/lang/Exception.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.lang;

/**
 * For any exceptions which extend this class and not {@link RuntimeException}
 * they will act as checked exceptions by the compiler, thus they will need
 * to be handled accordingly.
 *
 * @since 2018/09/16
 */
public class Exception
	extends Throwable
{
	/**
	 * Initializes the exception with no message or cause.
	 *
	 * @since 2018/09/16
	 */
	public Exception()
	{
	}
	
	/**
	 * Initializes the exception with the given message and no cause.
	 *
	 * @param __m The message.
	 * @since 2018/09/16
	 */
	public Exception(String __m)
	{
		super(__m);
	}
	
	/**
	 * Initializes the exception with the given message and cause.
	 *
	 * @param __m The message.
	 * @param __t The cause.
	 * @since 2018/09/16
	 */
	public Exception(String __m, Throwable __t)
	{
		super(__m, __t);
	}
	
	/**
	 * Initializes the exception with the given cause and no message.
	 *
	 * @param __t The cause.
	 * @since 2018/09/16
	 */
	public Exception(Throwable __t)
	{
		super(__t);
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




































































































































Deleted runt/libs/tool-compiler.test/mini-cldc/source-files/java/lang/IllegalArgumentException.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.lang;

/**
 * This is thrown when the argument of a method is not correct.
 *
 * @since 2018/10/12
 */
public class IllegalArgumentException
	extends RuntimeException
{
	/**
	 * Initializes the exception with no message or cause.
	 *
	 * @since 2018/10/12
	 */
	public IllegalArgumentException()
	{
	}
	
	/**
	 * Initializes the exception with the given message and no cause.
	 *
	 * @param __m The message.
	 * @since 2018/10/12
	 */
	public IllegalArgumentException(String __m)
	{
		super(__m);
	}
	
	/**
	 * Initializes the exception with the given message and cause.
	 *
	 * @param __m The message.
	 * @param __t The cause.
	 * @since 2018/10/12
	 */
	public IllegalArgumentException(String __m, Throwable __t)
	{
		super(__m, __t);
	}
	
	/**
	 * Initializes the exception with the given cause and no message.
	 *
	 * @param __t The cause.
	 * @since 2018/10/12
	 */
	public IllegalArgumentException(Throwable __t)
	{
		super(__t);
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
































































































































Deleted runt/libs/tool-compiler.test/mini-cldc/source-files/java/lang/NullPointerException.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.lang;

/**
 * This is thrown when there is a null pointer.
 *
 * @since 2019/05/25
 */
public class NullPointerException
	extends RuntimeException
{
	/**
	 * Initializes the exception with no message or cause.
	 *
	 * @since 2019/05/25
	 */
	public NullPointerException()
	{
	}
	
	/**
	 * Initializes the exception with the given message and no cause.
	 *
	 * @param __m The message.
	 * @since 2019/05/25
	 */
	public NullPointerException(String __m)
	{
		super(__m);
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
















































































Deleted runt/libs/tool-compiler.test/mini-cldc/source-files/java/lang/Object.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.lang;

/**
 * Object class.
 *
 * @since 2019/06/30
 */
public class Object
{
	/**
	 * Returns null.
	 *
	 * @return null.
	 * @since 2019/06/30
	 */
	protected Object clone()
		throws CloneNotSupportedException
	{
		return null;
	}

	/**
	 * Returns null.
	 *
	 * @return null.
	 * @since 2019/06/30
	 */
	public final Class<?> getClass()
	{
		return null;
	}
	
	/**
	 * Equals.
	 *
	 * @return Always {@code false}.
	 * @since 2019/06/30
	 */
	public boolean equals(Object __o)
	{
		return false;
	}

	/**
	 * Hash code.
	 *
	 * @return The hash code.
	 * @since 2019/06/30
	 */
	public int hashCode()
	{
		return 0;
	}

	/**
	 * String form.
	 *
	 * @return This as a string.
	 * @since 2019/06/30
	 */
	public String toString()
	{
		return "Adorable!";
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






















































































































































Deleted runt/libs/tool-compiler.test/mini-cldc/source-files/java/lang/Override.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.lang;

import java.lang.annotation.Annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * This is a flagging annotation which is attached to a method to indicate that
 * it overrides a method in the super class. When the compiler encounters
 * this, it makes sure that it actually overrides a method. If it does not
 * then a compilation error occurs. Using this all the time is recommended when
 * a method is intended to be overidden.
 *
 * As an example, if the base class has the following method:
 *
 * {@code
 * public static int foo(long __a);
 * }
 *
 * And a class which extends the base class has the following method:
 *
 * {@code
 * public static int foo(int __a);
 * }
 *
 * If it is intended to add a new {@code foo} which handles {@code int} instead
 * of {@code long} then this annotation should not be used, however it it is
 * intended to replace it (and specifying {@code int} was a mistake) then this
 * should be used.
 *
 * @since 2016/04/12
 */
@Target(value={ElementType.METHOD})
@Retention(value=RetentionPolicy.SOURCE)
public @interface Override
{
}


<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






































































































Deleted runt/libs/tool-compiler.test/mini-cldc/source-files/java/lang/RuntimeException.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.lang;

/**
 * This is the base for any exception which is unchecked.
 *
 * @since 2019/05/25
 */
public class RuntimeException
	extends Throwable
{
	/**
	 * Initializes the exception with no message or cause.
	 *
	 * @since 2019/05/25
	 */
	public RuntimeException()
	{
	}
	
	/**
	 * Initializes the exception with the given message and no cause.
	 *
	 * @param __m The message.
	 * @since 2019/05/25
	 */
	public RuntimeException(String __m)
	{
		super(__m);
	}
	
	/**
	 * Initializes the exception with the given message and cause.
	 *
	 * @param __m The message.
	 * @param __t The cause.
	 * @since 2019/05/25
	 */
	public RuntimeException(String __m, Throwable __t)
	{
		super(__m, __t);
	}
	
	/**
	 * Initializes the exception with the given cause and no message.
	 *
	 * @param __t The cause.
	 * @since 2019/05/25
	 */
	public RuntimeException(Throwable __t)
	{
		super(__t);
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






























































































































Deleted runt/libs/tool-compiler.test/mini-cldc/source-files/java/lang/String.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.lang;

/**
 * String class.
 *
 * @since 2019/06/30
 */
public final class String
{
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<








































Deleted runt/libs/tool-compiler.test/mini-cldc/source-files/java/lang/SuppressWarnings.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.lang;

import java.lang.annotation.Annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * Suppresses warnings that are generated by the compiler so that they do not
 * appear for the given method. Duplicates are permitted and values which are
 * unknown are ignored.
 *
 * The following warnings may have support to be disabled, although it is not
 * required: {@code all}, {@code boxing}, {@code cast}, {@code dep-ann},
 * {@code deprecation}, {@code fallthrough}, {@code finally}, {@code hiding},
 * {@code incomplete-switch}, {@code nls}, {@code null}, {@code rawtypes},
 * {@code restriction}, {@code serial}, {@code static-access},
 * {@code synthetic-access}, {@code unchecked},
 * {@code unqualified-field-access}, and {@code unused}.
 *
 * @since 2018/09/19
 */
@Target(value={ElementType.TYPE, ElementType.FIELD, ElementType.METHOD,
	ElementType.PARAMETER, ElementType.CONSTRUCTOR,
	ElementType.LOCAL_VARIABLE})
@Retention(value=RetentionPolicy.SOURCE)
public @interface SuppressWarnings
{
	/** The warnings that should be suppressed. */
	String[] value();
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






















































































Deleted runt/libs/tool-compiler.test/mini-cldc/source-files/java/lang/Throwable.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.lang;

/**
 * This is the base class for all throwable types.
 *
 * @since 2019/05/25
 */
public class Throwable
{
	/**
	 * Initializes the exception with no message or cause.
	 *
	 * @since 2019/05/25
	 */
	public Throwable()
	{
	}
	
	/**
	 * Initializes the exception with the given message and no cause.
	 *
	 * @param __m The message.
	 * @since 2019/05/25
	 */
	public Throwable(String __m)
	{
	}
	
	/**
	 * Initializes the exception with the given message and cause.
	 *
	 * @param __m The message.
	 * @param __t The cause.
	 * @since 2019/05/25
	 */
	public Throwable(String __m, Throwable __t)
	{
	}
	
	/**
	 * Initializes the exception with the given cause and no message.
	 *
	 * @param __t The cause.
	 * @since 2019/05/25
	 */
	public Throwable(Throwable __t)
	{
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






















































































































Deleted runt/libs/tool-compiler.test/mini-cldc/source-files/java/lang/annotation/Annotation.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.lang.annotation;

/**
 * This is the common interface in which all annotation types are inherited
 * from.
 *
 * If a random class or interface implements this interface and it is not an
 * annotation type, then it is not an annotation.
 *
 * @since 2014/10/13
 */
public interface Annotation
{
	/**
	 * Returns the annotation type used for this annotation.
	 *
	 * @return The annotation type.
	 * @since 2014/10/13
	 */
	public abstract Class<? extends Annotation> annotationType();
	
	/**
	 * Checks the logical equality to another annotation type, they are both
	 * considered to be equal when all of their members are equal and they are
	 * of the same type.
	 *
	 * Primitive types are checked directly except for floating point types
	 * which are equality checked through their wrapper classes.
	 *
	 * Floating point NaN values are considered to be equal, that is the
	 * {@code ==} operator is not used.
	 *
	 * {@link String}, {@link Class}, and enumerations are considered equal if
	 * their normal {@code equals()} evaluates to true.
	 *
	 * Two arrays are equal if {@code Arrays.equals(a, b)} evaluates to
	 * {@code true}.
	 *
	 * @param __o The other object to check against.
	 * @return {@code true} if they are logically equivalent.
	 * @since 2014/10/13
	 */
	public abstract boolean equals(Object __o);
	
	/**
	 * Calculates the hash code which is a sum of the hash codes of its members
	 * in a specifically defined pattern.
	 *
	 * The base hash code for a member is {@code (127 *
	 * ((String)memberName).hashCode()) ^ specialValue}. The variable
	 * {@code specialValue} is defined depending on the
	 * context. If it is a primitive type, then the hash code that would be
	 * returned if they were object types (their wrapper classes) is used. If
	 * an array then {@code Arrays.hashCode()} is used. Otherwise, it is the
	 * normal hashCode of the specified value.
	 *
	 * @return The hash code for this annotation.
	 * @since 2014/10/13
	 */
	public abstract int hashCode();
	
	/**
	 * Returns an implementation dependent string which represents the
	 * annotation and all of its values.
	 *
	 * @return The string representation of this annotation.
	 * @since 2014/10/13
	 */
	public abstract String toString();
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


































































































































































Deleted runt/libs/tool-compiler.test/mini-cldc/source-files/java/lang/annotation/Documented.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.lang.annotation;

/**
 * This indicates that the specified annotation should be documented by the
 * Java documentation tool whenever it is used.
 *
 * @since 2014/10/13
 */
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.ANNOTATION_TYPE})
public @interface Documented
{
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
















































Deleted runt/libs/tool-compiler.test/mini-cldc/source-files/java/lang/annotation/ElementType.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.lang.annotation;

/**
 * Specifies the type of element that the annotation is permitted to be
 * attached to in the source code.
 *
 * @since 2014/10/13
 */
public enum ElementType
{
	/** Annotation types). */
	ANNOTATION_TYPE(),
	
	/** Constructors. */
	CONSTRUCTOR(),
	
	/** Fields. */
	FIELD(),
	
	/** Local variables. */
	LOCAL_VARIABLE(),
	
	/** Methods. */
	METHOD(),
	
	/** Packages. */
	PACKAGE(),
	
	/** Parameter of a method. */
	PARAMETER(),
	
	/** A class, interface, or enumeration. */
	TYPE(),
	
	/** End. */
	;
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
































































































Deleted runt/libs/tool-compiler.test/mini-cldc/source-files/java/lang/annotation/Inherited.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.lang.annotation;

/**
 * Indicates that the annotation type should automatically be inherited so that
 * the subclass type appears to have this annotation when it is requested. That
 * is, if an annotation with this annotation is requested it will keep going up
 * the superclasses until it is found.
 *
 * This only affects classes which use an annotation with this annotation, as
 * such interfaces are excluded.
 *
 * @since 2014/10/13
 */
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.ANNOTATION_TYPE})
public @interface Inherited
{
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


























































Deleted runt/libs/tool-compiler.test/mini-cldc/source-files/java/lang/annotation/Retention.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.lang.annotation;

/**
 * This is used to indicate how far into the compilation and runtime process
 * should keep a visible mark on an annotation.
 *
 * @since 2014/10/13
 */
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.ANNOTATION_TYPE})
public @interface Retention
{
	/**
	 * Specifies where the annotation exists during and after compilation of
	 * source code.
	 *
	 * @return The storage of the annotation.
	 * @see RetentionPolicy
	 * @since 2014/10/13
	 */
	RetentionPolicy value();
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


































































Deleted runt/libs/tool-compiler.test/mini-cldc/source-files/java/lang/annotation/RetentionPolicy.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.lang.annotation;

/**
 * Specifies how far through compilation and running of code that an annotation
 * should be visible.
 *
 * @since 2014/10/13
 */
public enum RetentionPolicy
{
	/** Kept after compilation, but not visible at runtime. */
	CLASS(),
	
	/** Kept after compilation and visible at runtime. */
	RUNTIME(),
	
	/** Removed after compilation, does not appear in the class file. */
	SOURCE(),
	
	/** End. */
	;
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


































































Deleted runt/libs/tool-compiler.test/mini-cldc/source-files/java/lang/annotation/Target.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.lang.annotation;

/**
 * Specifies the context in which the annotation is valid.
 *
 * @since 2014/10/13
 */
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.ANNOTATION_TYPE})
public @interface Target
{
	/**
	 * A list of valid contexts where the annotation may be used.
	 *
	 * @return An array of permitted targets.
	 * @since 2014/10/13
	 */
	ElementType[] value();
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




























































Deleted runt/libs/tool-compiler.test/mini-cldc/source-files/java/lang/package-info.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

/**
 * Java language package.
 *
 * @since 2019/06/30
 */

package java.lang;

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


































Deleted runt/libs/tool-compiler.test/mini-cldc/source-files/java/util/List.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.util;

/**
 * List interface.
 *
 * @param <T> List type.
 * @since 2019/06/30
 */
public interface List<T>
{
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<










































Deleted runt/libs/tool-compiler/META-INF/MANIFEST.MF.

1
2
3
4
5
6
7
8
9
10
11
Manifest-Version: 1.0
X-SquirrelJME-UUID: 8fbf0127-aca6-477f-8220-cde2ce21da48
X-SquirrelJME-Error: AQ
X-SquirrelJME-Name: Java Compiler
X-SquirrelJME-Vendor: Stephanie Gawroriski
X-SquirrelJME-Version: 0.3.0
X-SquirrelJME-Description: This project is used to compile and 
 document Java source code. 
X-SquirrelJME-Depends: collections zip io tool-classfile collections
Microedition-Configuration: CLDC-1.8

<
<
<
<
<
<
<
<
<
<
<






















Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/ByteArrayCompilerInput.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac;

import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.util.Arrays;

/**
 * This is input for the compiler which uses the specified byte array as
 * input.
 *
 * @since 2018/03/06
 */
public final class ByteArrayCompilerInput
	implements CompilerInput
{
	/** The name of the input. */
	protected final String name;
	
	/** The last modified time. */
	protected final long lastmodifiedtime;
	
	/** The data for the compiler. */
	private final byte[] _data;
	
	/**
	 * Initializes the compiler input at the current time.
	 *
	 * @param __name The name of the input.
	 * @param __data The data to use for the input.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/03/06
	 */
	public ByteArrayCompilerInput(String __name, byte[] __data)
		throws NullPointerException
	{
		this(__name, System.currentTimeMillis(), __data);
	}
	
	/**
	 * Initializes the compiler input.
	 *
	 * @param __name The name of the input.
	 * @param __lmt The time this input was last modified.
	 * @param __data The data to use for the input.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/03/06
	 */
	public ByteArrayCompilerInput(String __name, long __lmt, byte[] __data)
		throws NullPointerException
	{
		if (__name == null || __data == null)
			throw new NullPointerException("NARG");
		
		this.name = __name;
		this.lastmodifiedtime = __lmt;
		this._data = __data.clone();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/03/06
	 */
	@Override
	public final boolean equals(Object __o)
	{
		if (__o == this)
			return true;
		
		if (!(__o instanceof ByteArrayCompilerInput))
			return false;
		
		ByteArrayCompilerInput o = (ByteArrayCompilerInput)__o;
		return this.name.equals(o.name) &&
			Arrays.equals(this._data, o._data);
	}

	/**
	 * {@inheritDoc}
	 * @since 2018/03/06
	 */
	@Override
	public final String fileName()
		throws CompilerException
	{
		return this.name;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/03/06
	 */
	@Override
	public final int hashCode()
	{
		return this.name.hashCode();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/03/06
	 */
	@Override
	public final long lastModifiedTime()
		throws CompilerException
	{
		return this.lastmodifiedtime;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/03/06
	 */
	@Override
	public final InputStream open()
		throws CompilerException, NoSuchInputException
	{
		return new ByteArrayInputStream(this._data);
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




































































































































































































































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/CompilationFailedException.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac;

/**
 * This is thrown when compilation has failed because of an error.
 *
 * @since 2017/11/29
 */
public class CompilationFailedException
	extends CompilerException
{
	/**
	 * Initialize the exception with no message or cause.
	 *
	 * @since 2017/11/29
	 */
	public CompilationFailedException()
	{
	}
	
	/**
	 * Initialize the exception with a message and no cause.
	 *
	 * @param __m The message.
	 * @since 2017/11/29
	 */
	public CompilationFailedException(String __m)
	{
		super(__m);
	}
	
	/**
	 * Initialize the exception with a message and cause.
	 *
	 * @param __m The message.
	 * @param __c The cause.
	 * @since 2017/11/29
	 */
	public CompilationFailedException(String __m, Throwable __c)
	{
		super(__m, __c);
	}
	
	/**
	 * Initialize the exception with no message and with a cause.
	 *
	 * @param __c The cause.
	 * @since 2017/11/29
	 */
	public CompilationFailedException(Throwable __c)
	{
		super(__c);
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
































































































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/Compiler.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac;

import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintStream;
import java.io.Writer;
import java.util.HashMap;
import java.util.LinkedHashSet;
import java.util.Map;
import java.util.Set;

/**
 * This interface is used to describe a compiler which is used to compile
 * Java source code into Java class files.
 *
 * Where the compilation log is initially output is undefined and unspecified
 * and it may be to standard error, a file on the disk, or not output at all.
 *
 * This class must be thread safe.
 *
 * This class is mutable, when {@link #compile()} is called all the options
 * will be passed to the compiler instance and any instance of this class may
 * be used again or modified as such.
 *
 * There should be a default set of options specified for the compiler.
 *
 * By default all locations should have {@link EmptyPathSet} as their initial
 * instance.
 *
 * @since 2017/11/28
 */
public abstract class Compiler
{
	/** Internal lock. */
	private final Object _lock =
		new Object();
	
	/** Input for the compiler. */
	private final Set<CompilerInput> _input =
		new LinkedHashSet<>();
	
	/** Paths for each location. */
	private final Map<CompilerInputLocation, CompilerPathSet[]> _locations =
		new HashMap<>();
	
	/** Compiler options. */
	private volatile CompilerOptions _options =
		new CompilerOptions();
	
	/** Writer for compilation errors. */
	private volatile PrintStream _writer =
		System.err;
	
	/**
	 * Base initialization.
	 *
	 * @since 2017/11/29
	 */
	{
		// Setup path sets with default locations
		Map<CompilerInputLocation, CompilerPathSet[]> locs = this._locations;
		for (CompilerInputLocation l : CompilerInputLocation.values())
			locs.put(l, new CompilerPathSet[]{EmptyPathSet.instance()});
	}
	
	/**
	 * Creates a new runnable which runs the compiler when it is ran using
	 * the given input.
	 *
	 * @param __out The location where generated files are to be placed.
	 * @param __log Compilation log.
	 * @param __opt The options for compilation.
	 * @param __paths The paths to use for input files.
	 * @param __input The files to implicitly compile.
	 * @return A runnable which when ran calls the actual compiler.
	 * @throws CompilerException If the runnable could not be created because
	 * of an issue with the options or the compiler.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/11/29
	 */
	protected abstract Runnable newCompilerRunnable(CompilerOutput __out,
		PrintStream __log, CompilerOptions __opt,
		CompilerPathSet[][] __paths, CompilerInput[] __input)
		throws CompilerException, NullPointerException;
	
	/**
	 * Adds the specified input to be compiled by the compiler.
	 *
	 * @param __i The input file to add to the compiler.
	 * @return If the input was added and it resulted in the change of the
	 * inputs, that is this follows the same semantics as
	 * {@link java.util.Collection#add(Object)}.
	 * @throws CompilerException If the input could not be added.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/11/28
	 */
	public final boolean addInput(CompilerInput __i)
		throws CompilerException, NullPointerException
	{
		if (__i == null)
			throw new NullPointerException("NARG");
		
		synchronized (this._lock)
		{
			return this._input.add(__i);
		}
	}
	
	/**
	 * Creates an instance of {@link Runnable} which can be used to perform
	 * compilation.
	 *
	 * @param __o The output where the result of compilation is placed.
	 * @return {@code true} if compilation has succeeded.
	 * @throws CompilerException If any parameter used for compilation is
	 * not valid.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/11/28
	 */
	public final Runnable compile(CompilerOutput __o)
		throws CompilerException, NullPointerException
	{
		if (__o == null)
			throw new NullPointerException("NARG");
		
		// Input for the compiler
		CompilerInput[] rvinput;
		CompilerOptions rvoptions;
		CompilerPathSet[][] rvpathsets;
		PrintStream rvwriter;
		
		// Read input options
		synchronized (this._lock)
		{
			rvoptions = this._options;
			rvwriter = this._writer;
			
			// Copy input
			Set<CompilerInput> input = this._input;
			rvinput = input.<CompilerInput>toArray(
				new CompilerInput[input.size()]);
			
			// {@squirreljme.error AQ01 No input files.}
			if (rvinput.length <= 0)
				throw new CompilerException("AQ01");
			
			// Copy path sets
			Map<CompilerInputLocation, CompilerPathSet[]> locations =
				this._locations;
			CompilerInputLocation[] cils = CompilerInputLocation.values();
			int ncils = cils.length;
			rvpathsets = new CompilerPathSet[ncils][];
			for (CompilerInputLocation cil : cils)
				rvpathsets[cil.ordinal()] = locations.get(cil).clone();
		}
		
		// Setup the compilation thread
		return newCompilerRunnable(__o, rvwriter, rvoptions, rvpathsets,
			rvinput);
	}
	
	/**
	 * Returns all of the input which has been specified for compilation.
	 *
	 * @return An array containing all of the input for the compiler.
	 * @throws CompilerException If this could not be obtained.
	 * @since 2017/11/28
	 */
	public final CompilerInput[] input()
		throws CompilerException
	{
		throw new todo.TODO();
	}
	
	/**
	 * Returns the path set which is used for the given location.
	 *
	 * @param __l The location to get the path set for.
	 * @return The current path set used for the given location.
	 * @throws CompilerException If there was an error removing it.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/11/28
	 */
	public final CompilerPathSet[] location(CompilerInputLocation __l)
		throws CompilerException, NullPointerException
	{
		if (__l == null)
			throw new NullPointerException("NARG");
		
		throw new todo.TODO();
	}
	
	/**
	 * Returns the options which are currently specified for this compiler.
	 *
	 * @return The current compiler options.
	 * @throws CompilerException If the options could not be obtained.
	 * @since 2017/11/28
	 */
	public final CompilerOptions options()
		throws CompilerException
	{
		return this._options;
	}
	
	/**
	 * Removes the specified input file so that it is not compiled.
	 *
	 * @param __i The input to remove.
	 * @return If the input was removed or not.
	 * @throws CompilerException If there was an issue removing the input.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/11/28
	 */
	public final boolean removeInput(CompilerInput __i)
		throws CompilerException, NullPointerException
	{
		if (__i == null)
			throw new NullPointerException("NARG");
		
		throw new todo.TODO();
	}
	
	/**
	 * Sets the specified location to the given path set.
	 *
	 * @param __l The locatioin to set.
	 * @param __s The path sets to use.
	 * @return The path set which was previously specified.
	 * @throws CompilerException If it could not be set for some reason.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/11/28
	 */
	public final CompilerPathSet[] setLocation(CompilerInputLocation __l,
		CompilerPathSet... __s)
		throws CompilerException, NullPointerException
	{
		if (__l == null || __s == null)
			throw new NullPointerException("NARG");
		
		// Defensive check for nulls
		__s = __s.clone();
		for (CompilerPathSet s : __s)
			if (s == null)
				throw new NullPointerException("NARG");
		
		Map<CompilerInputLocation, CompilerPathSet[]> locs = this._locations;
		synchronized (this._lock)
		{
			return locs.put(__l, __s).clone();
		}
	}
	
	/**
	 * Sets the compilation options that are to be used during compilation.
	 *
	 * @param __o The options to set.
	 * @return The old compilation options.
	 * @throws CompilerException If the options are not valid for this
	 * compiler.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/11/28
	 */
	public final CompilerOptions setOptions(CompilerOptions __o)
		throws CompilerException, NullPointerException
	{
		if (__o == null)
			throw new NullPointerException("NARG");
		
		throw new todo.TODO();
	}
	
	/**
	 * Sets the output stream which is used to output the compilation log.
	 *
	 * @param __o The output stream to write text to.
	 * @throws CompilerException If it could not be set.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/11/29
	 */
	public final void setWriter(OutputStream __o)
		throws CompilerException, NullPointerException
	{
		if (__o == null)
			throw new NullPointerException("NARG");
		
		// Normalize
		PrintStream use = (__o instanceof PrintStream ?
			(PrintStream)__o : new PrintStream(__o));
		
		synchronized (this._lock)
		{
			this._writer = use;
		}
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






































































































































































































































































































































































































































































































































































































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/CompilerException.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac;

/**
 * This is thrown when there is an issue with compilation.
 *
 * @since 2017/09/05
 */
public class CompilerException
	extends RuntimeException
	implements FileNameLineAndColumn
{
	/** The column where the error occured. */
	protected final int column;
	
	/** The line where the error occured. */
	protected final int line;
	
	/** The file being processed. */
	protected final String filename;
	
	/**
	 * Initialize the exception with no message or cause.
	 *
	 * @since 2017/09/05
	 */
	public CompilerException()
	{
		this.column = -1;
		this.line = -1;
		this.filename = null;
	}
	
	/**
	 * Initialize the exception with a message and no cause.
	 *
	 * @param __m The message.
	 * @since 2017/09/05
	 */
	public CompilerException(String __m)
	{
		super(__m);
		
		this.column = -1;
		this.line = -1;
		this.filename = null;
	}
	
	/**
	 * Initialize the exception with a message and cause.
	 *
	 * @param __m The message.
	 * @param __c The cause.
	 * @since 2017/09/05
	 */
	public CompilerException(String __m, Throwable __c)
	{
		super(__m, __c);
		
		this.column = -1;
		this.line = -1;
		this.filename = null;
	}
	
	/**
	 * Initialize the exception with no message and with a cause.
	 *
	 * @param __c The cause.
	 * @since 2017/09/05
	 */
	public CompilerException(Throwable __c)
	{
		super(__c);
		
		this.column = -1;
		this.line = -1;
		this.filename = null;
	}
	
	/**
	 * Initialize the exception with no message or cause.
	 *
	 * @param __la Location awareness information.
	 * @since 2017/03/12
	 */
	public CompilerException(LocationAware __la)
	{
		this.filename = ((__la instanceof FileName) ?
			((FileName)__la).fileName() : null);
		
		if (__la instanceof LineAndColumn)
		{
			LineAndColumn lc = (LineAndColumn)__la;
			this.column = lc.column();
			this.line = lc.line();
		}
		else
		{
			this.column = -1;
			this.line = -1;
		}
	}
	
	/**
	 * Initialize the exception with a message and no cause.
	 *
	 * @param __la Location awareness information.
	 * @param __m The message.
	 * @since 2017/03/12
	 */
	public CompilerException(LocationAware __la, String __m)
	{
		super(__m);
		
		this.filename = ((__la instanceof FileName) ?
			((FileName)__la).fileName() : null);
		
		if (__la instanceof LineAndColumn)
		{
			LineAndColumn lc = (LineAndColumn)__la;
			this.column = lc.column();
			this.line = lc.line();
		}
		else
		{
			this.column = -1;
			this.line = -1;
		}
	}
	
	/**
	 * Initialize the exception with a message and cause.
	 *
	 * @param __la Location awareness information.
	 * @param __m The message.
	 * @param __c The cause.
	 * @since 2017/03/12
	 */
	public CompilerException(LocationAware __la, String __m, Throwable __c)
	{
		super(__m, __c);
		
		this.filename = ((__la instanceof FileName) ?
			((FileName)__la).fileName() : null);
		
		if (__la instanceof LineAndColumn)
		{
			LineAndColumn lc = (LineAndColumn)__la;
			this.column = lc.column();
			this.line = lc.line();
		}
		else
		{
			this.column = -1;
			this.line = -1;
		}
	}
	
	/**
	 * Initialize the exception with no message and with a cause.
	 *
	 * @param __la Location awareness information.
	 * @param __c The cause.
	 * @since 2017/03/12
	 */
	public CompilerException(LocationAware __la, Throwable __c)
	{
		super(__c);
		
		this.filename = ((__la instanceof FileName) ?
			((FileName)__la).fileName() : null);
		
		if (__la instanceof LineAndColumn)
		{
			LineAndColumn lc = (LineAndColumn)__la;
			this.column = lc.column();
			this.line = lc.line();
		}
		else
		{
			this.column = -1;
			this.line = -1;
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/03/12
	 */
	@Override
	public final int column()
	{
		return this.column;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/03/12
	 */
	@Override
	public final String fileName()
	{
		return this.filename;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/03/12
	 */
	@Override
	public final int line()
	{
		return this.line;
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


































































































































































































































































































































































































































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/CompilerInput.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac;

import java.io.InputStream;

/**
 * This is used as input for the compiler and is used for source code and/or
 * class binaries.
 *
 * All instances of this class must be thread safe.
 *
 * Inputs which would logically refer to the same file must be equal to each
 * other. As such it is required that {@link #equals(Object)} and
 * {@link #hashCode()} are correctly implemented.
 *
 * @since 2017/11/28
 */
public interface CompilerInput
	extends FileName
{
	/**
	 * {@inheritDoc}
	 * @since 2017/11/28
	 */
	@Override
	public abstract boolean equals(Object __o);
	
	/**
	 * {@inheritDoc}
	 * @since 2017/11/28
	 */
	@Override
	public abstract int hashCode();
	
	/**
	 * Returns the last modified date of the input file in UTC milliseconds
	 * since the epoch.
	 *
	 * @return The last modfiied date of the input.
	 * @throws CompilerException If it could not be determined.
	 * @since 2018/03/06
	 */
	public abstract long lastModifiedTime()
		throws CompilerException;

	/**
	 * Returns the name of the input file.
	 *
	 * @return The input file name.
	 * @throws CompilerException If the name could not be obtained.
	 * @since 2017/11/28
	 */
	@Override
	public abstract String fileName()
		throws CompilerException;
	
	/**
	 * Opens an input stream for this input.
	 *
	 * @return The stream for the given input.
	 * @throws CompilerException If the stream could not be opened for any
	 * reason.
	 * @throws NoSuchInputException If the input does not exist.
	 * @since 2017/11/28
	 */
	public abstract InputStream open()
		throws CompilerException, NoSuchInputException;
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




























































































































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/CompilerInputLocation.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac;

/**
 * This specifies the locations which are used for input and is needed for
 * lookup of classes and source code.
 *
 * @since 2017/11/28
 */
public enum CompilerInputLocation
{
	/**
	 * Source code.
	 *
	 * Note that this location is used for lookup of source code as needed.
	 */
	SOURCE,
	
	/** Classes. */
	CLASS,
	
	/** End. */
	;
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/CompilerJavaVersion.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac;

/**
 * Specifies the version of the Java language which the compiler should target.
 *
 * @since 2017/11/29
 */
public enum CompilerJavaVersion
{
	/** Target Java 7. */
	JAVA_7,
	
	/** End. */
	;
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




















































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/CompilerLogger.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac;

import java.io.PrintStream;

/**
 * This is used to a class which can easily output messages for the compiler
 * to the given log.
 *
 * @since 2018/03/12
 */
public final class CompilerLogger
{
	/** The stream to print to. */
	protected final PrintStream out;
	
	/**
	 * Initializes the logger.
	 *
	 * @param __out The stream to print to.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/03/12
	 */
	public CompilerLogger(PrintStream __out)
		throws NullPointerException
	{
		if (__out == null)
			throw new NullPointerException("NARG");
		
		this.out = __out;
	}
	
	/**
	 * Logs the specified message.
	 *
	 * @param __t The type of message to display.
	 * @param __la Location awareness information, this may be {@code null}.
	 * @param __m The formatted message to show.
	 * @param __args The arguments to the formatted message.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/03/06
	 */
	public final void message(MessageType __t, LocationAware __la,
		String __m, Object... __args)
		throws NullPointerException
	{
		if (__t == null || __m == null)
			throw new NullPointerException("NARG");
		
		// Force to exist
		if (__args == null)
			__args = new String[0];
		
		// Print specially formatted messages
		PrintStream out = this.out;
		
		// File
		if (__la instanceof FileName)
			out.print(((FileName)__la).fileName());
		
		// Use a fallback name if it is possible
		else
			out.print("<unknown>");
		
		// Use estimate line and column information if it was not specified
		int line = -1,
			column = -1;
		if (__la instanceof LineAndColumn)
		{
			LineAndColumn lc = (LineAndColumn)__la;
			
			line = lc.line();
			column = lc.column();
		}
		
		// Printing row?
		if (line >= 0)
		{
			out.print(':');
			out.print(line);
		}
		
		// Printing the column?
		if (column >= 0)
		{
			out.print(',');
			out.print(column);
		}
		
		// Print spacer and the message type
		out.print(": [");
		out.print(__t);
		out.print("] ");
		
		// Print the message itself
		out.println(String.format(__m, __args));
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
























































































































































































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/CompilerOptions.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac;

/**
 * This class is used to specify the options which are used for compilation
 * such as those which would be passed via the command line.
 *
 * This class is immutable.
 *
 * @since 2017/11/28
 */
public final class CompilerOptions
{
	/** Enable debugging output? */
	protected final boolean debug;
	
	/** The version of the Java language to target. */
	protected final CompilerJavaVersion version;
	
	/**
	 * Initializes the compiler with the default set of options.
	 *
	 * @since 2017/11/29
	 */
	public CompilerOptions()
	{
		this.debug = true;
		this.version = CompilerJavaVersion.JAVA_7;
	}
	
	/**
	 * Generate extra debugging information?
	 *
	 * @return If extra debugging information is to be provided.
	 * @since 2017/11/29
	 */
	public final boolean debug()
	{
		return this.debug;
	}
	
	/**
	 * Returns the Java language version to target.
	 *
	 * @return The target language.
	 * @since 2017/11/29
	 */
	public final CompilerJavaVersion version()
	{
		return this.version;
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




























































































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/CompilerOutput.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac;

import java.io.IOException;
import java.io.OutputStream;

/**
 * This interface is used to allow classes utilizing the compiler to place
 * output files in a target JAR potentially. It is possible for multiple
 * outputs to be open at the same time, as such cases should be handled where
 * they must sequentially be output.
 *
 * All instances of this class must be thread safe.
 *
 * @since 2017/11/28
 */
public interface CompilerOutput
{
	/**
	 * Flushes the output.
	 *
	 * @throws CompilerException If there was an error flushing.
	 * @since 2017/11/28
	 */
	public abstract void flush()
		throws CompilerException;
	
	/**
	 * This is called when a file has been or is being compiled and it is
	 * required to output the file.
	 *
	 * @param __n The name of the file being written, this should match the
	 * same format that is used in ZIP files.
	 * @return An output stream which writes bytes to the output.
	 * @throws CompilerException If the output could not be created.
	 * @throws NullPointerException On null arguments.
	 * @since 2016/09/18
	 */
	public abstract OutputStream output(String __n)
		throws CompilerException, NullPointerException;
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






































































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/CompilerPathSet.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac;

import java.io.Closeable;

/**
 * A path set represents the contents of a binary JAR file or a tree of
 * source code within a directory.
 *
 * Entries are named according to how they would appear in ZIP files with
 * no distinction of directories being made (so a file would be called for
 * example {@code META-INF/MANIFEST.MF} regardless of the host system).
 *
 * Iteration goes over the contents of the path set.
 *
 * All instances of this class must be thread safe.
 *
 * @since 2017/11/28
 */
public interface CompilerPathSet
	extends Closeable, Iterable<CompilerInput>
{
	/**
	 * {@inheritDoc}
	 * @throws CompilerException If closing the path set has failed.
	 * @since 2017/11/28
	 */
	@Override
	public abstract void close()
		throws CompilerException;
	
	/**
	 * Obtians the specified 
	 *
	 * @param __n The name of the file to open.
	 * @return The input for the given file.
	 * @throws CompilerException If some other error happened while trying to
	 * obtain the input.
	 * @throws NoSuchInputException If the input by the specified name does
	 * not exist.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/11/28
	 */
	public abstract CompilerInput input(String __n)
		throws CompilerException, NoSuchInputException, NullPointerException;
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
















































































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/CompilerService.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac;

/**
 * This is used with {@link java.util.ServiceLoader} and is used to create
 * instances of the Java compiler when needed. This allows multiple compilers
 * to exist at the same time.
 *
 * Creation of the compiler should instead be done by
 * {@link DefaultCompiler#createInstance()}.
 *
 * @see DefaultCompiler
 * @since 2017/11/28
 */
public interface CompilerService
{
	/**
	 * Returns a new instance of the compiler.
	 *
	 * @return A new instance of the compiler, this may return {@code null} if
	 * a compiler cannot be provided.
	 * @since 2017/11/28
	 */
	public abstract Compiler createInstance();
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/DefaultCompiler.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac;

import java.util.ServiceLoader;
import net.multiphasicapps.javac.cute.CuteCompiler;
import net.multiphasicapps.javac.cute.CuteCompilerService;

/**
 * This creates an instance of a compiler and should be the class which is
 * used to initializes the compiler. If no compiler services are provided then
 * the default internal compiler will be used instead.
 *
 * @since 2017/11/28
 */
public final class DefaultCompiler
{
	/**
	 * {@squirreljme.property net.multiphasicapps.javac.forcedefault=(boolean)
	 * If this is set to {@code true} then the default built-in compiler will
	 * be used.}
	 */
	private static final String _FORCE_DEFAULT_PROPERTY =
		"net.multiphasicapps.javac.forcedefault";
	
	/**
	 * Not used.
	 *
	 * @since 2017/11/28
	 */
	private DefaultCompiler()
	{
	}
	
	/**
	 * Creates a new instance of a compiler.
	 *
	 * @return The new compiler instance.
	 * @since 2017/11/28
	 */
	public static final Compiler createInstance()
	{
		// Create compiler instance
		return DefaultCompiler.getService().createInstance();
	}
	
	/**
	 * Returns the default compiler service, if any.
	 *
	 * @return The default compiler service.
	 * @since 2019/06/30
	 */
	public static final CompilerService getService()
	{
		// Go through services if it is not forced to default
		if (!Boolean.getBoolean(_FORCE_DEFAULT_PROPERTY))
			for (CompilerService cs : ServiceLoader.<CompilerService>load(
				CompilerService.class))
			return cs;
		
		// No services, use the built-in compiler
		return new CuteCompilerService();
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


















































































































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/DefaultDocumentation.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac;

/**
 * This creates an instance of the default documentation service.
 *
 * @since 2019/06/30
 */
public class DefaultDocumentation
{
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<








































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/DistinctPathSet.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac;

import java.util.Arrays;
import java.util.Iterator;

/**
 * This is a path set which uses distinct compiler inputs to provide input
 * for the compiler.
 *
 * @since 2018/03/06
 */
public final class DistinctPathSet
	implements CompilerPathSet
{
	/** The inputs. */
	private final CompilerInput[] _input;
	
	/**
	 * Initializes the distinct path set.
	 *
	 * @param __in The inputs to use for the path set.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/03/06
	 */
	public DistinctPathSet(CompilerInput... __in)
		throws NullPointerException
	{
		if (__in == null)
			throw new NullPointerException("NARG");
		
		// Ensure there are no null values
		__in = __in.clone();
		for (CompilerInput ci : __in)
			if (ci == null)
				throw new NullPointerException("NARG");
		
		this._input = __in;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/03/06
	 */
	@Override
	public final void close()
		throws CompilerException
	{
		// Does nothing
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/03/06
	 */
	@Override
	public final Iterator<CompilerInput> iterator()
		throws CompilerException
	{
		return Arrays.<CompilerInput>asList(this._input).iterator();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/03/06
	 */
	@Override
	public final CompilerInput input(String __n)
		throws CompilerException, NoSuchInputException, NullPointerException
	{
		if (__n == null)
			throw new NullPointerException("NARG");
		
		for (CompilerInput ci : this._input)
			if (__n.equals(ci.fileName()))
				return ci;
		
		// {@squirreljme.error AQ02 Could not find the specified input in the
		// distinct path set. (The input)}
		throw new NoSuchInputException(String.format("AQ02 %s", __n));
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
























































































































































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/DocumentationService.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac;

/**
 * This interface represents a documentation service.
 *
 * @since 2019/06/30
 */
public interface DocumentationService
{
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<








































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/EmptyPathSet.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac;

import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import java.util.Iterator;
import net.multiphasicapps.collections.EmptyIterator;

/**
 * This is the empty path set and is used to provide no actual files, it is
 * the default path set used for input.
 *
 * @since 2017/11/28
 */
public final class EmptyPathSet
	implements CompilerPathSet
{
	/** The cache for the path set. */
	private static Reference<EmptyPathSet> _SET;
	
	/**
	 * Not publically created.
	 *
	 * @since 2017/11/28
	 */
	private EmptyPathSet()
	{
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/11/28
	 */
	@Override
	public void close()
	{
		// Does nothing
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/11/28
	 */
	@Override
	public CompilerInput input(String __n)
	{
		if (__n == null)
			throw new NullPointerException("NARG");
		
		// {@squirreljme.erorr AQ06 Cannot obtain the specified file from
		// the empty path set. (The name of the file)}
		throw new NoSuchInputException(String.format("AQ06 %s", __n));
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/11/28
	 */
	@Override
	public Iterator<CompilerInput> iterator()
	{
		return EmptyIterator.<CompilerInput>empty();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/11/28
	 */
	@Override
	public String toString()
	{
		return "EmptyPathSet";
	}
	
	/**
	 * Returns the same instance of the empty path set.
	 *
	 * @return The same instance of the empty path set.
	 * @since 2017/11/28
	 */
	public static final EmptyPathSet instance()
	{
		Reference<EmptyPathSet> ref = EmptyPathSet._SET;
		EmptyPathSet rv;
		
		if (ref == null || null == (rv = ref.get()))
			EmptyPathSet._SET = new WeakReference<>((rv = new EmptyPathSet()));
		
		return rv;
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<










































































































































































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/FileInput.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac;

import java.io.InputStream;
import java.io.IOException;
import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import java.nio.file.attribute.FileTime;
import java.nio.file.Files;
import java.nio.file.NoSuchFileException;
import java.nio.file.Path;
import java.nio.file.StandardOpenOption;

/**
 * This is input which uses a given file as input.
 *
 * @since 2017/11/28
 */
public final class FileInput
	implements CompilerInput
{
	/** The path to the file. */
	protected final Path path;
	
	/** The name of the file. */
	protected final String name;
	
	/** String representation. */
	private Reference<String> _string;
	
	/**
	 * Initializes the file input.
	 *
	 * @param __p The path to the file.
	 * @param __n The name of the file.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/11/28
	 */
	public FileInput(Path __p, String __n)
		throws NullPointerException
	{
		if (__p == null || __n == null)
			throw new NullPointerException("NARG");
		
		this.path = __p;
		this.name = __n;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/11/28
	 */
	@Override
	public final boolean equals(Object __o)
	{
		if (this == __o)
			return true;
		
		if (!(__o instanceof FileInput))
			return false;
		
		FileInput o = (FileInput)__o;
		return this.path.equals(o.path) &&
			this.name.equals(o.name);
	}

	/**
	 * {@inheritDoc}
	 * @since 2017/11/28
	 */
	@Override
	public final String fileName()
		throws CompilerException
	{
		return this.name;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/11/28
	 */
	@Override
	public final int hashCode()
	{
		return this.path.hashCode() ^
			this.name.hashCode();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/03/06
	 */
	@Override
	public final long lastModifiedTime()
		throws CompilerException
	{
		// Read the file time
		try
		{
			FileTime ft = Files.getLastModifiedTime(this.path);
			if (ft != null)
				return ft.toMillis();
			else
				return Long.MIN_VALUE;
		}
		
		// {@squirreljme.error AQ03 Could not obtain the last modified time.}
		catch (IOException e)
		{
			throw new CompilerException("AQ03", e);
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/11/28
	 */
	@Override
	public final InputStream open()
		throws CompilerException, NoSuchInputException
	{
		Path path = this.path;
		try
		{
			return Files.newInputStream(path, StandardOpenOption.READ);
		}
		
		// {@squirreljme.error AQ04 The specified path does not exist.
		// (The path to the file)}
		catch (NoSuchFileException e)
		{
			throw new NoSuchInputException(String.format("AQ04 %s", path), e);
		}
		
		// {@squirreljme.error AQ05 Could not read from the specified path.
		// (The path to the file)}
		catch (IOException e)
		{
			throw new NoSuchInputException(String.format("AQ05 %s", path), e);
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/11/28
	 */
	@Override
	public String toString()
	{
		Reference<String> ref = this._string;
		String rv;
		
		if (ref == null || null == (rv = ref.get()))
			this._string = new WeakReference<>((rv = String.format("%s(%s)",
				this.name, this.path)));
		
		return rv;
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


















































































































































































































































































































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/FileName.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac;

/**
 * This interface represents something which represents the name of a file.
 *
 * @since 2018/03/12
 */
public interface FileName
	extends LocationAware
{
	/**
	 * Returns the file that is input represents or the file being processed.
	 *
	 * @return The file being process or {@code null} if it is not known.
	 * @since 2018/03/12
	 */
	public abstract String fileName();
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


























































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/FileNameLineAndColumn.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac;

/**
 * This extends the line and column information and additionally provides
 * file information on top, if it is valid.
 *
 * @since 2018/03/12
 */
public interface FileNameLineAndColumn
	extends FileName, LineAndColumn, LocationAware
{
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<














































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/FilePathSet.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac;

import java.io.IOException;
import java.nio.file.DirectoryStream;
import java.nio.file.Files;
import java.nio.file.NoSuchFileException;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Deque;
import java.util.Iterator;
import java.util.List;

/**
 * This is a path set which is used to access files on the file system.
 *
 * @since 2017/11/28
 */
public final class FilePathSet
	implements CompilerPathSet
{
	/** The root directory of the path set. */
	protected final Path root;
	
	/**
	 * Initializes the path set over the given directory.
	 *
	 * @return __root The root directory
	 * @throws IOException On read errors.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/11/28
	 */
	public FilePathSet(Path __root)
		throws NullPointerException
	{
		if (__root == null)
			throw new NullPointerException("NARG");
		
		// Set
		this.root = __root;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/11/28
	 */
	@Override
	public void close()
		throws CompilerException
	{
		// Does nothing
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/11/28
	 */
	@Override
	public CompilerInput input(String __n)
		throws CompilerException, NoSuchInputException, NullPointerException
	{
		if (__n == null)
			throw new NullPointerException("NARG");
		
		// Store original name for the exception
		String origname = __n;
		
		// Resolve path elements
		Path path = this.root;
		while (!__n.isEmpty())
		{
			// Get name sub-fragment
			int sl = __n.indexOf('/');
			if (sl < 0)
				sl = __n.length();
			
			// Resolve it
			path = path.resolve(Paths.get(__n.substring(0, sl)));
			
			// Split down
			sl++;
			if (sl < __n.length())
				__n = __n.substring(sl);
			else
				break;
		}
		
		// {@squirreljme.error AQ06 The specified input does not exist in
		// the path set filesystem. (The name; The expected path)}
		if (Files.exists(path) && !Files.isDirectory(path))
			return new FileInput(path, origname);
		throw new NoSuchInputException(String.format("AQ06 %s %s", origname,
			path));
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/11/28
	 */
	@Override
	public Iterator<CompilerInput> iterator()
		throws CompilerException
	{
		// First iterate through every sub-directory and build a set of paths
		// from the root
		Deque<Path> queue = new ArrayDeque<>();
		queue.add(this.root);
		
		// Return value will be an array
		List<CompilerInput> rv = new ArrayList<>();
		
		// Process every directory
		while (!queue.isEmpty())
			try (DirectoryStream<Path> ds = Files.newDirectoryStream(
				queue.removeFirst()))
			{
				for (Path p : ds)
				{
					// Handle directories later
					if (Files.isDirectory(p))
					{
						queue.addLast(p);
						continue;
					}
					
					// Add files to input
					rv.add(new FileInput(p,
						FilePathSet.__pathToName(root, p)));
				}
			}
			
			// {@squirreljme.error AQ07 Could not list directory contents.}
			catch (IOException e)
			{
				throw new CompilerException("AQ07", e);
			}
		
		// Return iterator over entries
		return Arrays.<CompilerInput>asList(rv.<CompilerInput>toArray(
			new CompilerInput[rv.size()])).iterator();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/11/28
	 */
	@Override
	public String toString()
	{
		return this.root.toString();
	}
	
	/**
	 * Converts a path found from the walk to a string used for package
	 * contents.
	 *
	 * @param __root Root directory.
	 * @param __sub Sub-path based on the root.
	 * @return The normalized name used for the contents key.
	 * @throws NullPointerException On null arguments.
	 * @since 2016/01/29
	 */
	private static String __pathToName(Path __root, Path __sub)
		throws NullPointerException
	{
		// Check
		if (__root == null || __sub == null)
			throw new NullPointerException("NARG");
		
		// Calculate base
		Path base = __root.relativize(__sub);
		
		// Build it
		StringBuilder sb = new StringBuilder();
		for (Path comp : base)
		{
			// Directory slash
			if (sb.length() > 0)
				sb.append('/');
			
			// Add component
			sb.append(comp.toString());
		}
		
		// Translate it
		return sb.toString();
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


















































































































































































































































































































































































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/LineAndColumn.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac;

/**
 * This interface specifies that the class provides row and column information
 * which can be used to locate errors and warnings in code.
 *
 * @since 2018/03/06
 */
public interface LineAndColumn
	extends LocationAware
{
	/**
	 * Returns the current column.
	 *
	 * @return The current column.
	 * @since 2018/03/06
	 */
	public abstract int column();
	
	/**
	 * Returns the current line.
	 *
	 * @return The current line.
	 * @since 2018/03/06
	 */
	public abstract int line();
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<












































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/LocationAware.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac;

/**
 * This is a base interface which specifies that a given class may implement
 * the file name and/or line and column location information. This is used to
 * reduce the constructor count for some classes.
 *
 * @since 2018/03/12
 */
public interface LocationAware
{
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<














































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/MergedPathSet.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

/**
 * This is a path set which allows multiple path sets to be merged into one
 * so that the later ones replace the earlier ones.
 *
 * @since 2018/03/06
 */
public final class MergedPathSet
	implements CompilerPathSet 
{
	/** The input sets. */
	private final CompilerPathSet[] _sets;
	
	/**
	 * Initializes the merged path set.
	 *
	 * @param __sets The sets to merge together.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/03/06
	 */
	public MergedPathSet(CompilerPathSet... __sets)
		throws NullPointerException
	{
		if (__sets == null)
			throw new NullPointerException("NARG");
		
		// Ensure there are no null values
		__sets = __sets.clone();
		for (CompilerPathSet cps : __sets)
			if (cps == null)
				throw new NullPointerException("NARG");
		
		this._sets = __sets;
	}
	
	/**
	 * Initializes a merged path set from an iterable sequence.
	 *
	 * @param __sets The sets to merge together.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/01/17
	 */
	public MergedPathSet(Iterable<CompilerPathSet> __sets)
		throws NullPointerException
	{
		if (__sets == null)
			throw new NullPointerException("NARG");
		
		// Ensure non-null and store into list for later usage
		List<CompilerPathSet> rv = new ArrayList<>();
		for (CompilerPathSet s : __sets)
			if (s == null)
				throw new NullPointerException("NARG");
			else
				rv.add(s);
		
		this._sets = rv.<CompilerPathSet>toArray(
			new CompilerPathSet[rv.size()]);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/03/06
	 */
	@Override
	public final void close()
		throws CompilerException
	{
		CompilerException tossed = null;
		for (CompilerPathSet cps : this._sets)
			try
			{
				cps.close();
			}
			catch (CompilerException e)
			{
				// {@squirreljme.error AQ08 Could not close the merged path
				// set.}
				if (tossed == null)
					tossed = new CompilerException("AQ08");
				
				tossed.addSuppressed(tossed);
			}
		
		if (tossed != null)
			throw tossed;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/03/06
	 */
	@Override
	public final Iterator<CompilerInput> iterator()
		throws CompilerException
	{
		// Use a map since the compiler input might not refer to the same
		// file even if the same name is used
		Map<String, CompilerInput> rv = new LinkedHashMap<>();
		
		// The latest version of an input is returned in the iterator for
		// a given name
		for (CompilerPathSet cps : this._sets)
			for (CompilerInput in : cps)
				rv.put(in.fileName(), in);
		
		// Return view of the map
		Collection<CompilerInput> values = rv.values();
		return Arrays.<CompilerInput>asList(
			values.<CompilerInput>toArray(new CompilerInput[values.size()])).
			iterator();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/03/06
	 */
	@Override
	public final CompilerInput input(String __n)
		throws CompilerException, NoSuchInputException, NullPointerException
	{
		if (__n == null)
			throw new NullPointerException("NARG");
		
		// Go through the final sets first because those replace the earlier
		// ones
		CompilerPathSet[] sets = this._sets;
		for (int i = sets.length - 1; i >= 0; i--)
			try
			{
				return sets[i].input(__n);
			}
			catch (NoSuchInputException e)
			{
			}
		
		// {@squirreljme.error AQ09 Could not find the specified input in the
		// merged path set. (The input)}
		throw new NoSuchInputException(String.format("AQ09 %s", __n));
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


































































































































































































































































































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/MessageType.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac;

/**
 * This indicates the message to display.
 *
 * @since 2018/03/06
 */
public enum MessageType
{
	/** Information. */
	INFO,
	
	/** Warning. */
	WARNING,
	
	/** Error. */
	ERROR,
	
	/** Lint to detect for possible errors. */
	LINT,
	
	/** End. */
	;
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/NoSuchInputException.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac;

/**
 * This is thrown when the specified input file does not exists.
 *
 * @since 2017/11/28
 */
public class NoSuchInputException
	extends CompilerException
{
	/**
	 * Initialize the exception with no message or cause.
	 *
	 * @since 2017/11/28
	 */
	public NoSuchInputException()
	{
	}
	
	/**
	 * Initialize the exception with a message and no cause.
	 *
	 * @param __m The message.
	 * @since 2017/11/28
	 */
	public NoSuchInputException(String __m)
	{
		super(__m);
	}
	
	/**
	 * Initialize the exception with a message and cause.
	 *
	 * @param __m The message.
	 * @param __c The cause.
	 * @since 2017/11/28
	 */
	public NoSuchInputException(String __m, Throwable __c)
	{
		super(__m, __c);
	}
	
	/**
	 * Initialize the exception with no message and with a cause.
	 *
	 * @param __c The cause.
	 * @since 2017/11/28
	 */
	public NoSuchInputException(Throwable __c)
	{
		super(__c);
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
































































































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/NullCompilerOutput.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac;

import java.io.IOException;
import java.io.OutputStream;
import net.multiphasicapps.io.NullOutputStream;

/**
 * This is a compiler output which writes to nowhere.
 *
 * @since 2019/06/30
 */
public final class NullCompilerOutput
	implements CompilerOutput
{
	/**
	 * {@inheritDoc}
	 * @since 2019/06/30
	 */
	@Override
	public final void flush()
		throws CompilerException
	{
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2019/06/30
	 */
	@Override
	public final OutputStream output(String __n)
		throws CompilerException, NullPointerException
	{
		return new NullOutputStream();
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


























































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/ResourceCompilerInput.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac;

import java.io.InputStream;
import java.io.IOException;

/**
 * This is a resource input which uses a class name.
 *
 * @since 2019/06/30
 */
public final class ResourceCompilerInput
	implements CompilerInput
{
	/** The pivot to use. */
	protected final Class<?> pivot;
	
	/** The resource name used. */
	protected final String rcname;
	
	/** The file name used. */
	protected final String filename;
	
	/**
	 * Initializes the resource input.
	 *
	 * @param __pivot The class pivot used.
	 * @param __rc The resource name.
	 * @param __fn The file name.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/06/30
	 */
	public ResourceCompilerInput(Class<?> __pivot, String __rc, String __fn)
		throws NullPointerException
	{
		if (__pivot == null || __rc == null || __fn == null)
			throw new NullPointerException("NARG");
		
		this.pivot = __pivot;
		this.rcname = __rc;
		this.filename = __fn;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2019/06/30
	 */
	@Override
	public final boolean equals(Object __o)
	{
		if (this == __o)
			return true;
		
		if (!(__o instanceof ResourceCompilerInput))
			return false;
		
		ResourceCompilerInput o = (ResourceCompilerInput)__o;
		return this.pivot.equals(o.pivot) &&
			this.rcname.equals(o.rcname) &&
			this.filename.equals(o.filename);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2019/06/30
	 */
	@Override
	public final int hashCode()
	{
		return this.pivot.hashCode() ^
			this.rcname.hashCode() ^
			this.filename.hashCode();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2019/06/30
	 */
	@Override
	public final long lastModifiedTime()
		throws CompilerException
	{
		return Long.MIN_VALUE;
	}

	/**
	 * {@inheritDoc}
	 * @since 2019/06/30
	 */
	@Override
	public final String fileName()
		throws CompilerException
	{
		return this.filename;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2019/06/30
	 */
	@Override
	public final InputStream open()
		throws CompilerException, NoSuchInputException
	{
		// {@squirreljme.error AQ39 No resource input exists. (The filename)}
		InputStream rv = this.pivot.getResourceAsStream(this.rcname);
		if (rv == null)
			throw new NoSuchInputException("AQ39 " + this.filename);
		return rv;
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
















































































































































































































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/ResourcePathSet.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import net.multiphasicapps.collections.EmptyIterator;
import net.multiphasicapps.collections.UnmodifiableIterator;

/**
 * This is a path set which uses the class resource area as input.
 *
 * @since 2019/06/30
 */
public class ResourcePathSet
	implements CompilerPathSet
{
	/** The pivot class to lookup resources from. */
	protected final Class<?> pivot;
	
	/** The prefix to use for lookup. */
	protected final String prefix;
	
	/**
	 * Initializes the resource path set.
	 *
	 * @param __cl The class to load resources from.
	 * @param __prefix The resource prefix.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/06/30
	 */
	public ResourcePathSet(Class<?> __cl, String __prefix)
		throws NullPointerException
	{
		if (__cl == null || __prefix == null)
			throw new NullPointerException("NARG");
		
		this.pivot = __cl;
		this.prefix = __prefix;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2019/06/30
	 */
	@Override
	public final void close()
		throws CompilerException
	{
		// Does nothing
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2019/06/30
	 */
	@Override
	public final Iterator<CompilerInput> iterator()
	{
		// Try to read the list file
		try (InputStream in = pivot.getResourceAsStream(this.prefix + "list"))
		{
			// If there is none, then just return no files
			if (in == null)
				return EmptyIterator.<CompilerInput>empty();
			
			// Read in lines
			List<CompilerInput> inputs = new ArrayList<>();
			try (BufferedReader br = new BufferedReader(
				new InputStreamReader(in)))
			{
				// Read in
				for (;;)
				{
					String ln = br.readLine();
					
					if (ln == null)
						break;
					
					// Try to see if this even exists
					try
					{
						inputs.add(this.input(ln));
					}
					
					// It does not, so ignore
					catch (NoSuchInputException e)
					{
					}
				}
			}
			
			// Return input list
			return UnmodifiableIterator.<CompilerInput>of(
				inputs.<CompilerInput>toArray(
					new CompilerInput[inputs.size()]));
		}
		
		// {@squirreljme.error AQ3b Could not read list file.}
		catch (IOException e)
		{
			throw new CompilerException("AQ3b", e);
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2019/06/30
	 */
	@Override
	public final CompilerInput input(String __n)
		throws CompilerException, NoSuchInputException, NullPointerException
	{
		// Build full resource name
		Class<?> pivot = this.pivot;
		String rcname = this.prefix + __n;
		
		// Only return if it exists
		try (InputStream in = pivot.getResourceAsStream(rcname))
		{
			// {@squirreljme.error AQ38 No input resource exists. (The name)}
			if (in == null)
				throw new NoSuchInputException("AQ38 " + __n);
			
			// Build it
			return new ResourceCompilerInput(pivot, rcname, __n);
		}
		
		// {@squirreljme.error AQ3a Exception closing class resource.}
		catch (IOException e)
		{
			throw new CompilerException("AQ3a", e);
		}
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<








































































































































































































































































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/SimpleFileNameLineAndColumn.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac;

import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import java.util.Objects;

/**
 * This contains a simple representation of the file, line, and column
 * information.
 *
 * This class is immutable.
 *
 * @since 2018/03/12
 */
public final class SimpleFileNameLineAndColumn
	implements FileNameLineAndColumn
{
	/** The file name. */
	protected final String filename;
	
	/** The line. */
	protected final int line;
	
	/** The column. */
	protected final int column;
	
	/** String representation. */
	private Reference<String> _string;
	
	/**
	 * Initializes this class with unknown information.
	 *
	 * @since 2018/03/12
	 */
	public SimpleFileNameLineAndColumn()
	{
		this.filename = null;
		this.line = -1;
		this.column = -1;
	}
	
	/**
	 * Initializes with all of the given information.
	 *
	 * @param __fn The file name.
	 * @param __lc The line and column information.
	 * @since 2018/03/12
	 */
	public SimpleFileNameLineAndColumn(String __fn, LineAndColumn __lc)
	{
		this.filename = __fn;
		this.line = (__lc == null ? -1 : __lc.line());
		this.column = (__lc == null ? -1 : __lc.column());
	}
	
	/**
	 * Initializes with all of the given information.
	 *
	 * @param __fn The file name.
	 * @param __lc The line and column information.
	 * @since 2018/03/12
	 */
	public SimpleFileNameLineAndColumn(FileName __fn, LineAndColumn __lc)
	{
		this.filename = (__fn == null ? null : __fn.fileName());
		this.line = (__lc == null ? -1 : __lc.line());
		this.column = (__lc == null ? -1 : __lc.column());
	}
	
	/**
	 * Initializes with all of the given information.
	 *
	 * @param __fn The file name.
	 * @param __lin The line.
	 * @param __col The column.
	 * @since 2018/03/12
	 */
	public SimpleFileNameLineAndColumn(String __fn, int __lin, int __col)
	{
		this.filename = __fn;
		this.line = __lin;
		this.column = __col;
	}
	
	/**
	 * Initializes with all of the given information.
	 *
	 * @param __fn The file name.
	 * @param __lin The line.
	 * @param __col The column.
	 * @since 2018/03/12
	 */
	public SimpleFileNameLineAndColumn(FileName __fn, int __lin, int __col)
	{
		this.filename = (__fn == null ? null : __fn.fileName());
		this.line = __lin;
		this.column = __col;
	}
	
	/**
	 * Initializes with all of the given information.
	 *
	 * @param __fn The file name.
	 * @since 2018/03/12
	 */
	public SimpleFileNameLineAndColumn(FileName __fn)
	{
		this.filename = (__fn == null ? null : __fn.fileName());
		
		if (__fn instanceof LineAndColumn)
		{
			LineAndColumn lc = (LineAndColumn)__fn;
			this.line = lc.line();
			this.column = lc.column();
		}
		else
		{
			this.line = -1;
			this.column = -1;
		}
	}
	
	/**
	 * Initializes with all of the given information.
	 *
	 * @param __flc The file name, line, and column information.
	 * @since 2018/03/12
	 */
	public SimpleFileNameLineAndColumn(FileNameLineAndColumn __flc)
	{
		if (__flc == null)
		{
			this.filename = null;
			this.line = -1;
			this.column = -1;
		}
		else
		{
			this.filename = __flc.fileName();
			this.line = __flc.line();
			this.column = __flc.column();
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/03/12
	 */
	@Override
	public final int column()
	{
		return this.column;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/03/12
	 */
	@Override
	public final boolean equals(Object __o)
	{
		if (__o == this)
			return true;
		
		if (!(__o instanceof SimpleFileNameLineAndColumn))
			return false;
		
		SimpleFileNameLineAndColumn o = (SimpleFileNameLineAndColumn)__o;
		return Objects.equals(this.filename, o.filename) &&
			this.line == o.line &&
			this.column == o.column;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/03/12
	 */
	@Override
	public final String fileName()
	{
		return this.filename;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/03/12
	 */
	@Override
	public final int hashCode()
	{
		return Objects.hashCode(this.filename) ^
			this.line ^
			(this.column << 16);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/03/12
	 */
	@Override
	public final int line()
	{
		return this.line;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/03/12
	 */
	@Override
	public final String toString()
	{
		Reference<String> ref = this._string;
		String rv;
		
		if (ref == null || null == (rv = ref.get()))
			this._string = new WeakReference<>((rv =
				String.format("%s:%d,%d", this.filename, this.line,
					this.column)));
		
		return rv;
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




















































































































































































































































































































































































































































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/StringFileName.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac;

/**
 * This represents a file name that represents a string, it is used for
 * location awareness.
 *
 * @since 2018/05/05
 */
public final class StringFileName
	implements FileName
{
	/** The file name that is used. */
	protected final String filename;
	
	/**
	 * Initializes the string file name.
	 *
	 * @param __fn The filename to use.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/05/05
	 */
	public StringFileName(String __fn)
		throws NullPointerException
	{
		if (__fn == null)
			throw new NullPointerException("NARG");
		
		this.filename = __fn;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/05/05
	 */
	@Override
	public final boolean equals(Object __o)
	{
		throw new todo.TODO();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/05/05
	 */
	@Override
	public final int hashCode()
	{
		return this.filename.hashCode();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/05/05
	 */
	@Override
	public final String fileName()
	{
		return this.filename;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/05/05
	 */
	@Override
	public final String toString()
	{
		return this.filename;
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


































































































































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/ZipCompilerOutput.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac;

import java.io.ByteArrayOutputStream;
import java.io.Closeable;
import java.io.InputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Map;
import net.multiphasicapps.zip.streamwriter.ZipStreamWriter;
import net.multiphasicapps.zip.ZipCompressionType;

/**
 * This is used to wrap output to a ZIP file.
 *
 * @since 2017/11/28
 */
public final class ZipCompilerOutput
	implements Closeable, CompilerOutput
{
	/** Lock. */
	protected final Object lock =
		new Object();
	
	/** The output ZIP. */
	protected final ZipStreamWriter zip;
	
	/** Outputs which are currently being written to (not closed). */
	private final Map<String, __Stream__> _waiting =
		new LinkedHashMap<>();
	
	/** Output streams which have been closed, to be written to the ZIP. */
	private final Map<String, __Stream__> _done =
		new LinkedHashMap<>();
	
	/**
	 * Initializes the output which writes to the given output stream which
	 * is wrapped by a ZIP.
	 *
	 * @param __out The output stream.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/12/24
	 */
	public ZipCompilerOutput(OutputStream __out)
		throws NullPointerException
	{
		if (__out == null)
			throw new NullPointerException("NARG");
		
		this.zip = new ZipStreamWriter(__out);
	}
	
	/**
	 * Initialize the output which writes to the given ZIP file.
	 *
	 * @param __out The output ZIP to write to.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/11/28
	 */
	public ZipCompilerOutput(ZipStreamWriter __out)
		throws NullPointerException
	{
		if (__out == null)
			throw new NullPointerException("NARG");
		
		this.zip = __out;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/11/28
	 */
	@Override
	public void close()
		throws IOException
	{
		// Flush self so the contents are written
		this.flush();
		
		// Flush and close the ZIP
		ZipStreamWriter zip = this.zip;
		zip.flush();
		zip.close();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/11/28
	 */
	@Override
	public void flush()
		throws CompilerException
	{
		// Lock
		synchronized (this.lock)
		{
			// Nothing to be done?
			Map<String, __Stream__> done = this._done;
			if (done.isEmpty())
				return;
			
			// Go through all the done files
			Iterator<Map.Entry<String, __Stream__>> it = done.entrySet().
				iterator();
			ZipStreamWriter zip = this.zip;
			while (it.hasNext())
			{
				// Get the details
				Map.Entry<String, __Stream__> e = it.next();
				String k = e.getKey();
				__Stream__ v = e.getValue();
				
				// Never write it again
				it.remove();
				
				// Write to the output
				try (OutputStream os = zip.nextEntry(k))
				{
					v.wrapped.writeTo(os);
				}
				
				// {@squirreljme.error AQ0a Failed to write the specified file
				// to the output stream. (The file name)}
				catch (RuntimeException|IOException f)
				{
					throw new CompilerException(
						String.format("AQ0a %s", k), f);
				}
			}
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/11/28
	 */
	@Override
	public OutputStream output(String __n)
		throws CompilerException, NullPointerException
	{
		if (__n == null)
			throw new NullPointerException("NARG");
		
		// Lock
		synchronized (this.lock)
		{
			// Setup new stream
			__Stream__ rv = new __Stream__(__n);
			
			// Store into the files being written
			Map<String, __Stream__> waiting = this._waiting;
			waiting.put(__n, rv);
			
			// Return it
			return rv;
		}
	}
	
	/**
	 * Wrapped streams for potential flushing.
	 *
	 * @since 2016/09/20
	 */
	private final class __Stream__
		extends OutputStream
	{
		/** The wrapped stream to write to. */
		protected final ByteArrayOutputStream wrapped =
			new ByteArrayOutputStream();
		
		/** The name of this file. */
		protected final String name;
		
		/** Has this been closed? */
		private volatile boolean _closed;
		
		/**
		 * Initializes the stream.
		 *
		 * @param __n The name of this file.
		 * @throws NullPointerException On null arguments.
		 * @since 2016/09/20
		 */
		private __Stream__(String __n)
			throws NullPointerException
		{
			// Check
			if (__n == null)
				throw new NullPointerException("NARG");
			
			// Set
			this.name = __n;
		}
		
		/**
		 * {@inheritDoc}
		 * @since 2016/09/20
		 */
		@Override
		public void close()
			throws IOException
		{
			// Need to lock on the compiler output to prevent race conditions
			// where a file is closed multiple times and placed into the done
			// queue multiple times
			ZipCompilerOutput ccout = ZipCompilerOutput.this;
			synchronized (ccout.lock)
			{
				// Ignore if closed
				if (this._closed)
					return;
			
				// Mark closed
				this._closed = true;
				
				// Get both queues
				Map<String, __Stream__> waiting = ccout._waiting;
				Map<String, __Stream__> done = ccout._done;
				
				// Remove from the waiting queue
				String name = this.name;
				waiting.remove(name);
				
				// And add to the done queue
				done.put(name, this);
				
				// Flush the compiler output early to write as many files as
				// possible so they do not crowd memory
				ccout.flush();
			}
		}
		
		/**
		 * {@inheritDoc}
		 * @since 2016/09/20
		 */
		@Override
		public void flush()
			throws IOException
		{
			// Flushing a byte array output is pointless
		}
		
		/**
		 * {@inheritDoc}
		 * @since 2016/09/20
		 */
		@Override
		public void write(int __b)
			throws IOException
		{
			// {@squirreljme.error AQ0b Cannot write a single byte after the
			// output has been closed.}
			if (this._closed)
				throw new IOException("AQ0b");
			
			// Forward
			this.wrapped.write(__b);
		}
		
		/**
		 * {@inheritDoc}
		 * @since 2016/09/20
		 */
		@Override
		public void write(byte[] __b, int __o, int __l)
			throws IOException
		{
			// {@squirreljme.error AQ0c Cannot write multiple bytes after the
			// output has been closed.}
			if (this._closed)
				throw new IOException("AQ0c");
			
			// Forward
			this.wrapped.write(__b, __o, __l);
		}
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




































































































































































































































































































































































































































































































































































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/ZipInput.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac;

import java.io.InputStream;
import java.io.IOException;
import net.multiphasicapps.zip.blockreader.ZipBlockEntry;

/**
 * This wraps a single entry within a ZIP file.
 *
 * @since 2017/11/29
 */
public final class ZipInput
	implements CompilerInput
{
	/** The entry to wrap. */
	protected final ZipBlockEntry entry;
	
	/**
	 * Initializes the ZIP input.
	 *
	 * @param __e The entry to wrap.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/11/29
	 */
	public ZipInput(ZipBlockEntry __e)
		throws NullPointerException
	{
		if (__e == null)
			throw new NullPointerException("NARG");
		
		this.entry = __e;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/11/29
	 */
	@Override
	public final boolean equals(Object __o)
	{
		if (this == __o)
			return true;
		
		if (!(__o instanceof ZipInput))
			return false;
		
		return this.entry.equals(((ZipInput)__o).entry);
	}

	/**
	 * {@inheritDoc}
	 * @since 2017/11/29
	 */
	@Override
	public final String fileName()
		throws CompilerException
	{
		return this.entry.name();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/11/29
	 */
	@Override
	public final int hashCode()
	{
		return this.fileName().hashCode();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/03/06
	 */
	@Override
	public final long lastModifiedTime()
		throws CompilerException
	{
		return this.entry.lastModifiedTime();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/11/29
	 */
	@Override
	public final InputStream open()
		throws CompilerException, NoSuchInputException
	{
		try
		{
			return this.entry.open();
		}
		
		// {@squirreljme.error AQ0d Failed to open the ZIP entry. (The name
		// of the entry)}
		catch (IOException e)
		{
			throw new CompilerException(
				String.format("AQ0d %s", this.fileName()), e);
		}
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




































































































































































































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/ZipPathSet.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import net.multiphasicapps.zip.blockreader.ZipBlockEntry;
import net.multiphasicapps.zip.blockreader.ZipBlockReader;
import net.multiphasicapps.zip.blockreader.ZipEntryNotFoundException;

/**
 * This is a path set which may be used on top of a ZIP file.
 *
 * @since 2017/11/28
 */
public final class ZipPathSet
	implements CompilerPathSet
{
	/** The ZIP to use as input. */
	protected final ZipBlockReader zip;
	
	/**
	 * Initializes the path set over ZIP files.
	 *
	 * @return __zip The ZIP file to wrap and treat as a path set.
	 * @throws IOException On read errors.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/11/28
	 */
	public ZipPathSet(ZipBlockReader __zip)
		throws IOException, NullPointerException
	{
		if (__zip == null)
			throw new NullPointerException("NARG");
		
		this.zip = __zip;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/11/28
	 */
	@Override
	public void close()
	{
		// Close the target ZIP
		try
		{
			this.zip.close();
		}
		
		// {@squirreljme.error AQ0e Could not close the source ZIP.}
		catch (IOException e)
		{
			throw new CompilerException("AQ0e", e);
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/11/28
	 */
	@Override
	public CompilerInput input(String __n)
	{
		if (__n == null)
			throw new NullPointerException("NARG");
		
		try
		{
			return new ZipInput(this.zip.get(__n));
		}
		
		// {@squirreljme.error AQ0f No such entry exists within the ZIP.
		// (The name of the entry)}
		catch (ZipEntryNotFoundException e)
		{
			throw new NoSuchInputException(String.format("AQ0f %s", __n), e);
		}
		
		// {@squirreljme.error AQ0g Read error attempting to open the input
		// entry. (The name of the entry)}
		catch (IOException e)
		{
			throw new NoSuchInputException(String.format("AQ0g %s", __n), e);
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/11/28
	 */
	@Override
	public Iterator<CompilerInput> iterator()
	{
		return new ZipPathSetIterator(this.zip.iterator());
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/11/28
	 */
	@Override
	public String toString()
	{
		return this.zip.toString();
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<














































































































































































































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/ZipPathSetIterator.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac;

import java.io.IOException;
import java.util.Iterator;
import java.util.NoSuchElementException;
import net.multiphasicapps.zip.blockreader.ZipBlockEntry;

/**
 * This iterates over entries in the ZIP and provides input for those entries.
 *
 * @since 2017/11/29
 */
public final class ZipPathSetIterator
	implements Iterator<CompilerInput>
{
	/** The used iterator. */
	protected final Iterator<ZipBlockEntry> iterator;
	
	/**
	 * Initializes the iterator.
	 *
	 * @param __i The entry iterator to iterate over.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/11/29
	 */
	public ZipPathSetIterator(Iterator<ZipBlockEntry> __i)
		throws NullPointerException
	{
		if (__i == null)
			throw new NullPointerException("NARG");
		
		this.iterator = __i;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/11/29
	 */
	@Override
	public boolean hasNext()
	{
		return this.iterator.hasNext();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/11/29
	 */
	@Override
	public CompilerInput next()
	{
		// Go through entries
		for (Iterator<ZipBlockEntry> iterator = this.iterator;;)
		{
			// Ignore directories
			ZipBlockEntry ze = iterator.next();
			try
			{
				if (ze.isDirectory())
					continue;
			}
			catch (IOException e)
			{
				// {@squirreljme.error AQ3c Could not check if entry was
				// a directory or not.}
				throw new CompilerException("AQ3c", e);
			}
			
			return new ZipInput(ze);
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/11/29
	 */
	@Override
	public void remove()
	{
		throw new UnsupportedOperationException("RORO");
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


























































































































































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/classtree/BinaryUnit.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac.classtree;

import net.multiphasicapps.javac.CompilerInput;

/**
 * This represents a unit which is a binary class file.
 *
 * @since 2019/01/17
 */
public final class BinaryUnit
	extends Unit
{
	/** The input unit. */
	protected final CompilerInput input;
	
	/**
	 * Initializes the unit.
	 *
	 * @param __i The input unit.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/01/17
	 */
	public BinaryUnit(CompilerInput __i)
		throws NullPointerException
	{
		if (__i == null)
			throw new NullPointerException("NARG");
		
		this.input = __i;
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




















































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/classtree/Package.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac.classtree;

import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
import net.multiphasicapps.collections.SortedTreeMap;

/**
 * This class describes a package which contains a bunch of classes that exist
 * within the package.
 *
 * @since 2019/01/17
 */
public final class Package
{
	/** The name of the package. */
	protected final String name;
	
	/** Units which are in this package. */
	private final Map<String, Unit> _units;
	
	/** String representation. */
	private Reference<String> _string;
	
	/**
	 * Initializes the package with all of the contained units.
	 *
	 * @param __n The name of this package.
	 * @param __m The package and maps.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/01/18
	 */
	public Package(String __n, Map<String, Unit> __m)
		throws NullPointerException
	{
		if (__n == null || __m == null)
			throw new NullPointerException("NARG");
		
		// Copy values
		Map<String, Unit> units = new SortedTreeMap<>();
		for (Map.Entry<String, Unit> e : __m.entrySet())
		{
			String k = e.getKey();
			Unit v = e.getValue();
			if (k == null || v == null)
				throw new NullPointerException("NARG");
			
			units.put(k, v);
		}
		
		this.name = __n;
		this._units = units;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2019/01/19
	 */
	@Override
	public final String toString()
	{
		Reference<String> ref = this._string;
		String rv;
		
		if (ref == null || null == (rv = ref.get()))
			this._string = new WeakReference<>(
				(rv = this._units.toString()));
		
		return rv;
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<








































































































































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/classtree/Packages.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac.classtree;

import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import java.util.Arrays;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
import net.multiphasicapps.collections.SortedTreeMap;
import net.multiphasicapps.javac.CompilerException;
import net.multiphasicapps.javac.CompilerInput;
import net.multiphasicapps.javac.CompilerPathSet;

/**
 * This is the root of the class hierachy which contains all of the various
 * packages with classes in them.
 *
 * @since 2019/01/17
 */
public final class Packages
{
	/** The mapping of available packages. */
	private final Map<String, Package> _packages;
	
	/** String representation. */
	private Reference<String> _string;
	
	/**
	 * Initializes the package tree.
	 *
	 * @param __m The input map.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/01/18
	 */
	public Packages(Map<String, Map<String, Unit>> __m)
		throws NullPointerException
	{
		if (__m == null)
			throw new NullPointerException("NARG");
		
		// Translate everything
		Map<String, Package> packages = new SortedTreeMap<>();
		for (Map.Entry<String, Map<String, Unit>> e : __m.entrySet())
		{
			// Make sure there are no nulls
			String k = e.getKey();
			Map<String, Unit> v = e.getValue();
			if (k == null || v == null)
				throw new NullPointerException("NARG");
			
			packages.put(k, new Package(k, v));
		}
		
		this._packages = packages;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2019/01/19
	 */
	@Override
	public final String toString()
	{
		Reference<String> ref = this._string;
		String rv;
		
		if (ref == null || null == (rv = ref.get()))
			this._string = new WeakReference<>(
				(rv = this._packages.toString()));
		
		return rv;
	}
	
	/**
	 * Loads packages from the input path sets, from classes and sources and
	 * performing resolution of them.
	 *
	 * @param __css The path sets to iterate through and load packages from.
	 * @return The packages and all of the defined classes within the entire
	 * sets of input.
	 * @throws CompilerException If an input could not be read.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/01/17
	 */
	public static final Packages loadPackages(CompilerPathSet... __css)
		throws CompilerException, NullPointerException
	{
		return Packages.loadPackages(Arrays.<CompilerPathSet>asList(__css));
	}
	
	/**
	 * Loads packages from the input path sets, from classes and sources and
	 * performing resolution of them.
	 *
	 * @param __its The path sets to iterate through and load packages from.
	 * @return The packages and all of the defined classes within the entire
	 * sets of input.
	 * @throws CompilerException If an input could not be read.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/01/17
	 */
	public static final Packages loadPackages(
		Iterable<CompilerPathSet>... __its)
		throws CompilerException, NullPointerException
	{
		if (__its == null)
			throw new NullPointerException("NARG");
		
		// Packages and classes in each package
		Map<String, Map<String, Unit>> rv = new HashMap<>();
		
		// Iterate through everything and load accordingly
		for (Iterable<CompilerPathSet> it : __its)
			for (CompilerPathSet s : it)
				for (CompilerInput i : s)
				{
					String fn = i.fileName();
					
					// Extract directory (package) and the base name
					String dirname, basename, ident;
					int ls = fn.lastIndexOf('/');
					if (ls >= 0)
					{
						dirname = fn.substring(0, ls);
						basename = fn.substring(ls + 1);
					}
					else
					{
						dirname = "";
						basename = fn;
					}
					
					// Is source file?
					boolean issource;
					
					// Ignore anything with slashes in it, since those are not
					// valid Java files
					if (fn.indexOf('-') >= 0)
						continue;
					
					// Source code file to parse
					else if (fn.endsWith(".java"))
					{
						issource = true;
						ident = basename.substring(0, basename.length() - 5);
					}
					
					// Class file to parse
					else if (fn.endsWith(".class"))
					{
						issource = false;
						ident = basename.substring(0, basename.length() - 6);
					}
					
					// Unknown, ignore
					else
						continue;
					
					// Determine the package the piece belongs in
					Map<String, Unit> pkg = rv.get(dirname);
					if (pkg == null)
						rv.put(dirname, (pkg = new HashMap<>()));
					
					// Make a unit for the class
					pkg.put(ident, (issource ? new SourceUnit(i) :
						new BinaryUnit(i)));
				}
		
		return new Packages(rv);
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<












































































































































































































































































































































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/classtree/SourceUnit.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac.classtree;

import net.multiphasicapps.javac.CompilerInput;

/**
 * This is a unit which represents a source file.
 *
 * @since 2019/01/17
 */
public final class SourceUnit
	extends Unit
{
	/** The input unit. */
	protected final CompilerInput input;
	
	/**
	 * Initializes the unit.
	 *
	 * @param __i The input unit.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/01/17
	 */
	public SourceUnit(CompilerInput __i)
		throws NullPointerException
	{
		if (__i == null)
			throw new NullPointerException("NARG");
		
		this.input = __i;
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




















































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/classtree/Unit.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac.classtree;

/**
 * This is a base unit which is a source for the class tree structure.
 *
 * @since 2019/01/17
 */
public abstract class Unit
{
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<










































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/classtree/package-info.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

/**
 * This contains the class tree which is used to structure classes in a package
 * to class hierarchy.
 *
 * @since 2019/01/17
 */

package net.multiphasicapps.javac.classtree;

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/cute/ClassNode.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac.cute;

import net.multiphasicapps.classfile.ClassName;
import net.multiphasicapps.javac.CompilerInput;

/**
 * This represents a class node which is represented by an input file.
 *
 * @since 2018/03/06
 */
@Deprecated
public abstract class ClassNode
{
	/** The file used for input. */
	protected final CompilerInput input;
	
	/** The class this node provides information for. */
	protected final ClassName name;
	
	/**
	 * Initializes the base node.
	 *
	 * @param __name The name of the node.
	 * @param __input The input which contains the node data.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/03/06
	 */
	ClassNode(ClassName __name, CompilerInput __input)
		throws NullPointerException
	{
		if (__name == null || __input == null)
			throw new NullPointerException("NARG");
		
		this.name = __name;
		this.input = __input;
	}
	
	/**
	 * Returns the compiler input used as the source for node.
	 *
	 * @return The compiler input used as the source.
	 * @since 2018/03/06
	 */
	public final CompilerInput compilerInput()
	{
		return this.input;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/03/06
	 */
	@Override
	public final boolean equals(Object __o)
	{
		if (__o == this)
			return true;
		
		if (!(__o instanceof ClassNode))
			return false;
		
		return this.name.equals(((ClassNode)__o).name);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/03/06
	 */
	@Override
	public final int hashCode()
	{
		return this.name.hashCode();
	}
	
	/**
	 * Returns the name of the node.
	 *
	 * @return The node name.
	 * @since 2018/03/06
	 */
	public final ClassName name()
	{
		return this.name;
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
































































































































































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/cute/CompilerState.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac.cute;

import java.io.PrintStream;
import java.util.ArrayDeque;
import java.util.Deque;
import java.util.List;
import java.util.Map;
import net.multiphasicapps.classfile.ClassName;
import net.multiphasicapps.collections.SortedTreeMap;
import net.multiphasicapps.javac.CompilerInput;
import net.multiphasicapps.javac.CompilerInputLocation;
import net.multiphasicapps.javac.CompilerLogger;
import net.multiphasicapps.javac.CompilerPathSet;
import net.multiphasicapps.javac.FileNameLineAndColumn;
import net.multiphasicapps.javac.LineAndColumn;
import net.multiphasicapps.javac.NoSuchInputException;

/**
 * This contains the current state of the compiler.
 *
 * @since 2018/03/06
 */
@Deprecated
public final class CompilerState
{
	/** Logging. */
	protected final CompilerLogger log;
	
	/** The class and source paths. */
	protected final Map<CompilerInputLocation, List<CompilerPathSet>> paths;
	
	/** Class nodes which have been loaded for structuring. */
	final Map<ClassName, ClassNode> _nodes =
		new SortedTreeMap<>();
	
	/** Class nodes which need to be compiled. */
	final Deque<SourcedClassNode> _tocompile =
		new ArrayDeque<>();
	
	/** Last processed input file. */
	volatile CompilerInput _lastinput;
	
	/**
	 * Initializes the compiler state.
	 *
	 * @param __log The logging output.
	 * @param __ps Path sets for the compiler, used to build the class
	 * structure before compilation is performed.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/03/06
	 */
	public CompilerState(CompilerLogger __log,
		Map<CompilerInputLocation, List<CompilerPathSet>> __ps)
		throws NullPointerException
	{
		if (__log == null || __ps == null)
			throw new NullPointerException("NARG");
		
		this.log = __log;
		this.paths = __ps;
	}
	
	/**
	 * Returns the class node for the given class.
	 *
	 * @param __cn The class node to get.
	 * @return The class node
	 * @throws MissingClassNodeException If the class node does not exist.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/03/06
	 */
	public final ClassNode classNode(ClassName __cn)
		throws MissingClassNodeException, NullPointerException
	{
		if (__cn == null)
			throw new NullPointerException("NARG");
		
		// If a node has already been loaded then use it
		Map<ClassName, ClassNode> nodes = this._nodes;
		ClassNode rv = nodes.get(__cn);
		if (rv != null)
			return rv;
		
		// Primitive types and arrays are completely special and are
		// generated by the class code
		if (__cn.isPrimitive() || __cn.isArray())
			throw new todo.TODO();
		
		// Search the class path first before looking for sources to compile
		Map<CompilerInputLocation, List<CompilerPathSet>> paths = this.paths;
		String classfilename = __cn.binaryName() + ".class";
		for (CompilerPathSet ps : paths.get(CompilerInputLocation.CLASS))
			try
			{
				CompilerInput ci = ps.input(classfilename);
				
				throw new todo.TODO();
			}
			catch (NoSuchInputException e)
			{
			}
		
		// It is possible for inner classes to be referred to before the
		// outer class has been seen, so look in the base class instead and see
		// if that exists
		String sourcename = __cn.binaryName().toString(),
			baselookname = sourcename;
		int ls = sourcename.lastIndexOf('/'),
			ld = sourcename.lastIndexOf('$');
		if (ld >= 0 && ld > ls)
			baselookname = sourcename.substring(0, ld);
		
		// Go through source files instead and try to find a node to compile
		boolean badhit = false;
		for (int z = 0; z < 2; z++)
		{
			// The loop goes through things twice because someone could be
			// very evil and name a class a bunch of dollar signs despite not
			// being an actual inner class. To to prevent these evil classes
			// from being missed, go back around and try to find and load them
			// as their normal name
			String trylook = (z == 0 ? baselookname + ".java" :
				sourcename + ".java");
			for (CompilerPathSet ps : paths.get(CompilerInputLocation.SOURCE))
				try
				{
					// Always use the base name because the requested thing
					// could be an inner class and the outer class will need to
					// be loaded before it can properly be used
					CompilerInput ci = ps.input(trylook);
				
					// Load in node, it is automatically added by the
					// constructor
					SourcedClassNode.__loadNodes(ci, this);
				
					// If the source file pertains to the given name then it
					// will be returned here, otherwise it will fail for
					// cases where evil dollar signs are used or if a class
					// is in the wrong file.
					rv = nodes.get(__cn);
					if (rv != null)
						return rv;
					
					// This is used to detect where the wrong class is
					// declared in the wrong file.
					badhit = true;
				}
				catch (NoSuchInputException e)
				{
				}
		}
		
		// {@squirreljme.error AQ0h Could not locate the node for the given
		// class name, the source file where the class should have been located
		// did not actually contain the class. (The class name)}
		if (badhit)
			throw new MissingClassNodeException(
				String.format("AQ0h %s", __cn));
		
		// {@squirreljme.error AQ0i Could not locate the node for the given
		// class name. (The class name)}
		throw new MissingClassNodeException(String.format("AQ0i %s", __cn));
	}
	
	/**
	 * Returns the output for compilation logs.
	 *
	 * @return The compilation log output.
	 * @since 2018/03/12
	 */
	public final CompilerLogger log()
	{
		return this.log;
	}
	
	/**
	 * Returns the next class node to compile.
	 *
	 * @return The next node to compile or {@code null} if there are no
	 * nodes to currently compile.
	 * @since 2018/03/06
	 */
	public final SourcedClassNode nextCompile()
	{
		Deque<SourcedClassNode> tocompile = this._tocompile;
		return tocompile.pollFirst();
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<














































































































































































































































































































































































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/cute/CuteCompiler.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac.cute;

import java.io.PrintStream;
import net.multiphasicapps.javac.Compiler;
import net.multiphasicapps.javac.CompilerException;
import net.multiphasicapps.javac.CompilerInput;
import net.multiphasicapps.javac.CompilerInputLocation;
import net.multiphasicapps.javac.CompilerOptions;
import net.multiphasicapps.javac.CompilerOutput;
import net.multiphasicapps.javac.CompilerPathSet;

/**
 * This is used to create instances of the cute compiler.
 *
 * @since 2017/11/28
 */
public class CuteCompiler
	extends Compiler
{
	/**
	 * {@inheritDoc}
	 * @since 2017/11/29
	 */
	@Override
	protected Runnable newCompilerRunnable(CompilerOutput __out,
		PrintStream __log, CompilerOptions __opt,
		CompilerPathSet[][] __paths, CompilerInput[] __input)
		throws CompilerException, NullPointerException
	{
		if (__out == null || __log == null || __opt == null ||
			__paths == null || __input == null)
			throw new NullPointerException("NARG");
		
		return new CuteRunnable(__out, __log, __opt, __paths, __input);
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






























































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/cute/CuteCompilerService.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac.cute;

import net.multiphasicapps.javac.Compiler;
import net.multiphasicapps.javac.CompilerService;

/**
 * This creates instances of the cute compiler.
 *
 * @since 2019/06/30
 */
public final class CuteCompilerService
	implements CompilerService
{
	/**
	 * {@inheritDoc}
	 * @since 2019/06/30
	 */
	@Override
	public final Compiler createInstance()
	{
		return new CuteCompiler();
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/cute/CuteRunnable.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac.cute;

import java.io.PrintStream;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import net.multiphasicapps.classfile.ClassName;
import net.multiphasicapps.classfile.InvalidClassFormatException;
import net.multiphasicapps.collections.UnmodifiableList;
import net.multiphasicapps.collections.UnmodifiableMap;
import net.multiphasicapps.collections.UnmodifiableSet;
import net.multiphasicapps.javac.classtree.Packages;
import net.multiphasicapps.javac.Compiler;
import net.multiphasicapps.javac.CompilerException;
import net.multiphasicapps.javac.CompilerInput;
import net.multiphasicapps.javac.CompilerInputLocation;
import net.multiphasicapps.javac.CompilerLogger;
import net.multiphasicapps.javac.CompilerOptions;
import net.multiphasicapps.javac.CompilerOutput;
import net.multiphasicapps.javac.CompilerPathSet;
import net.multiphasicapps.javac.FileNameLineAndColumn;
import net.multiphasicapps.javac.LineAndColumn;
import net.multiphasicapps.javac.LocationAware;
import net.multiphasicapps.javac.MessageType;
import net.multiphasicapps.javac.structure.RuntimeInput;

/**
 * This is the runnable which performs the actual compilation tasks and
 * generates the output code accordingly as needed.
 *
 * @since 2018/03/06
 */
public class CuteRunnable
	implements Runnable
{
	/** Output for the compiler. */
	protected final CompilerOutput out;
	
	/** Logging for the compiler. */
	protected final CompilerLogger log;
	
	/** Options for the compiler. */
	protected final CompilerOptions options;
	
	/** Paths for the compiler. */
	protected final Map<CompilerInputLocation, List<CompilerPathSet>> paths;
	
	/** Input for the compiler. */
	protected final List<CompilerInput> input;
	
	/**
	 * Initializes the compiler.
	 *
	 * @param __out The output for generated classes.
	 * @param __log The output for console logs.
	 * @param __opt The options for the compiler.
	 * @param __paths Input paths for compiler input, implied source code and
	 * class files.
	 * @param __input The input files to compile.
	 * @throws CompilerException If the input or options are not correct.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/03/06
	 */
	public CuteRunnable(CompilerOutput __out,
		PrintStream __log, CompilerOptions __opt,
		CompilerPathSet[][] __paths, CompilerInput[] __input)
		throws CompilerException, NullPointerException
	{
		if (__out == null || __log == null || __opt == null ||
			__paths == null || __input == null)
			throw new NullPointerException("NARG");
		
		this.out = __out;
		this.log = new CompilerLogger(__log);
		this.options = __opt;
		
		// Copy paths
		Map<CompilerInputLocation, List<CompilerPathSet>> paths =
			new HashMap<>();
		for (CompilerInputLocation cil : CompilerInputLocation.values())
			paths.put(cil, UnmodifiableList.<CompilerPathSet>of(
				Arrays.<CompilerPathSet>asList(
				__paths[cil.ordinal()].clone())));
		this.paths = UnmodifiableMap.<CompilerInputLocation,
			List<CompilerPathSet>>of(paths);
		
		// Copy input
		this.input = UnmodifiableList.<CompilerInput>of(
			Arrays.<CompilerInput>asList(__input.clone()));
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/03/06
	 */
	@Override
	public void run()
		throws CompilerException
	{
		CompilerLogger log = this.log;
		
		// Load packages and the classes which belong in each package
		Map<CompilerInputLocation, List<CompilerPathSet>> paths = this.paths;
		Packages packages = Packages.loadPackages(
			paths.get(CompilerInputLocation.CLASS),
			paths.get(CompilerInputLocation.SOURCE));
		todo.DEBUG.note("Packages: %s", packages);
		
		// OLDER CODE BELOW
		if (true)
			throw new todo.TODO();
		
		// Setup input which processes input classes
		RuntimeInput ri = new RuntimeInput(
			paths.get(CompilerInputLocation.CLASS),
			paths.get(CompilerInputLocation.SOURCE));
		
		// Run compilation step
		try
		{
			// Process input files to load their structures
			for (CompilerInput ci : this.input)
				ri.processSourceFiles(ci.fileName());
			
			if (true)
				throw new todo.TODO();
		}
		
		// Caught compiler exception so report it and retoss
		catch (CompilerException|InvalidClassFormatException e)
		{
			// Print the root causes of the exception
			Throwable t = e;
			while (t != null)
			{
				// {@squirreljme.error AQ0j Failed to compile.}
				log.message(MessageType.ERROR,
					((t instanceof LocationAware) ?
						(LocationAware)t : null),
					"AQ0j %s", t.getMessage());
				
				// {@squirreljme.error AQ0k Failed to compile. (An exception
				// or error was suppressed)}
				for (Throwable s : t.getSuppressed())
					log.message(MessageType.ERROR,
						((s instanceof LocationAware) ?
							(LocationAware)s : null),
						"AQ0k %s", s.getMessage());
				
				// Keep going down
				t = t.getCause();
			}
			
			// Print trace
			e.printStackTrace();
			
			// Keep it going
			throw e;
		}
	}
	
	/**
	 * Converts a file name to a class name.
	 *
	 * @param __n The file name to convert.
	 * @return The resulting class name.
	 * @throws CompilerException If the name could not be converted to a
	 * class name.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/03/06
	 */
	static final ClassName __fileToClassName(String __n)
		throws CompilerException, NullPointerException
	{
		if (__n == null)
			throw new NullPointerException("NARG");
		
		// {@squirreljme.error AQ0l Cannot determine classname of file because
		// it has an unknown suffix. (The file name)}
		String suffix;
		if (!__n.endsWith(".java"))
			if (!__n.endsWith(".class"))
				throw new CompilerException(String.format("AQ0l %s", __n));
			else
				suffix = ".class";
		else
			suffix = ".java";
		
		// Convert path form to class form
		return new ClassName(__n.substring(0, __n.length() - suffix.length()));
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
































































































































































































































































































































































































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/cute/MissingClassNodeException.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac.cute;

import net.multiphasicapps.javac.CompilerException;

/**
 * This is thrown when a class node is requested and it does not exist.
 *
 * @since 2018/03/06
 */
public class MissingClassNodeException
	extends CompilerException
{
	/**
	 * Initialize the exception with no message or cause.
	 *
	 * @since 2018/03/06
	 */
	public MissingClassNodeException()
	{
	}
	
	/**
	 * Initialize the exception with a message and no cause.
	 *
	 * @param __m The message.
	 * @since 2018/03/06
	 */
	public MissingClassNodeException(String __m)
	{
		super(__m);
	}
	
	/**
	 * Initialize the exception with a message and cause.
	 *
	 * @param __m The message.
	 * @param __c The cause.
	 * @since 2018/03/06
	 */
	public MissingClassNodeException(String __m, Throwable __c)
	{
		super(__m, __c);
	}
	
	/**
	 * Initialize the exception with no message and with a cause.
	 *
	 * @param __c The cause.
	 * @since 2018/03/06
	 */
	public MissingClassNodeException(Throwable __c)
	{
		super(__c);
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




































































































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/cute/SourcedClassNode.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac.cute;

import java.io.InputStream;
import java.io.IOException;
import net.multiphasicapps.classfile.ClassName;
import net.multiphasicapps.javac.CompilerException;
import net.multiphasicapps.javac.CompilerInput;
import net.multiphasicapps.javac.CompilerLogger;
import net.multiphasicapps.javac.MessageType;
import net.multiphasicapps.javac.syntax.CompilationUnitSyntax;
import net.multiphasicapps.javac.token.BufferedTokenSource;

/**
 * This is a class node which is based on input source code and is compiled
 * by the compiler as it contains instructions to generate.
 *
 * @since 2018/03/06
 */
@Deprecated
public final class SourcedClassNode
	extends ClassNode
{
	/**
	 * Initializes a node which has semi-parsed structure information and
	 * builds a remaining structure from it.
	 *
	 * @param __name The name of the node.
	 * @param __input The input which contains the node data.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/03/06
	 */
	private SourcedClassNode(ClassName __name, CompilerInput __input)
		throws NullPointerException
	{
		super(__name, __input);
		
		throw new todo.TODO();
	}
	
	/**
	 * Parses the input source file and generates nodes and adds them to the
	 * compiler state, the parsed nodes contain incompletely compiled class
	 * file data.
	 *
	 * @param __input The input which contains the node data.
	 * @param __state The compiler state which is used to initialize more
	 * nodes.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/03/06
	 */
	static final void __loadNodes(CompilerInput __input, CompilerState __state)
		throws NullPointerException
	{
		if (__input == null || __state == null)
			throw new NullPointerException("NARG");
			
		CompilerLogger log = __state.log();
		
		// Store last processed file for debug purposes
		__state._lastinput = __input;
		
		// {@squirreljme.error AQ0m Parsing input source file for classes to
		// compile.}
		log.message(MessageType.INFO, __input, "AQ0m");
		
		// Setup streamlined tokenizers to parse the classes
		CompilationUnitSyntax compunit;
		try (InputStream in = __input.open())
		{
			// Load the structure
			compunit = CompilationUnitSyntax.parse(
				new BufferedTokenSource(__input.fileName(), in));
		}
		
		// {@squirreljme.error AQ0n Could not read the input source file.
		// (The input source file)}
		catch (IOException e)
		{
			throw new CompilerException(__input,
				String.format("AQ0n %s", __input.fileName()), e);
		}
		
		throw new todo.TODO();
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
































































































































































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/cute/package-info.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

/**
 * This package contains the default compiler which is provided as a default.
 * It is intended to be minimal, small, easy to maintain, and fast.
 *
 * @since 2017/11/28
 */

package net.multiphasicapps.javac.cute;

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/structure/AnnotationModifier.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac.structure;

import net.multiphasicapps.javac.syntax.AnnotationSyntax;

/**
 * This represents a modifier which is associated with a package, class,
 * member, or field and it represents the value of an annotation.
 *
 * @since 2018/05/07
 */
@Deprecated
public final class AnnotationModifier
	implements StructureModifier
{
	/**
	 * {@inheritDoc}
	 * @since 2018/05/07
	 */
	@Override
	public final boolean equals(Object __o)
	{
		throw new todo.TODO();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/05/07
	 */
	@Override
	public final int hashCode()
	{
		throw new todo.TODO();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/05/07
	 */
	@Override
	public final String toString()
	{
		throw new todo.TODO();
	}
	
	/**
	 * Parses the input annotation and sets the modifier for it.
	 *
	 * @param __syn The input syntax.
	 * @param __nl The name lookup for annotation types.
	 * @return The output modifier.
	 * @throws NullPointerException On null arguments.
	 * @throws StructureException On null arguments.
	 * @since 2018/05/12
	 */
	public static AnnotationModifier parse(AnnotationSyntax __syn,
		NameLookup __nl)
		throws NullPointerException, StructureException
	{
		if (__syn == null || __nl == null)
			throw new NullPointerException("NARG");
		
		throw new todo.TODO();
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






















































































































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/structure/BasicModifier.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac.structure;

/**
 * This represents a basic modifier.
 *
 * @since 2018/05/12
 */
@Deprecated
public enum BasicModifier
	implements StructureModifier
{
	/** Public access. */
	PUBLIC,
	
	/** Protected access. */
	PROTECTED,
	
	/** Private access. */
	PRIVATE,
	
	/** Static access. */
	STATIC,
	
	/** Abstract. */
	ABSTRACT,
	
	/** Final. */
	FINAL,
	
	/** Native. */
	NATIVE,
	
	/** Synchronized. */
	SYNCHRONIZED,
	
	/** Transient. */
	TRANSIENT,
	
	/** Volatile. */
	VOLATILE,
	
	/** Strict floating point. */
	STRICTFP,
	
	/** End. */
	;
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




















































































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/structure/ClassConstructorStructure.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac.structure;

import net.multiphasicapps.javac.syntax.UnparsedExpressions;

/**
 * This represents the structure of a class constructor.
 *
 * @since 2018/05/08
 */
@Deprecated
public final class ClassConstructorStructure
	implements ClassMemberStructure
{
	/** The modifiers used for the class. */
	protected final StructureModifiers modifiers;
	
	/** The type parameters. */
	protected final TypeParameters typeparameters;
	
	/** The formal parameters. */
	protected final FormalParameters formalparameters;
	
	/** The unparsed code block, if any. */
	protected final UnparsedExpressions code;
	
	/** The thrown types. */
	private final TypeSymbol[] _thrown;
	
	/**
	 * Initializes the class constructor structure.
	 *
	 * @param __mods The modifiers to the constructor.
	 * @param __tparms The type parameters used.
	 * @param __parms The formal parameters used.
	 * @param __thrown The thrown types.
	 * @param __code Method code that should exist for the constructor.
	 * @throws NullPointerException On null arguments.
	 * @throws StructureException If the sturcture is not valid.
	 * @since 2018/05/10
	 */
	public ClassConstructorStructure(StructureModifiers __mods,
		TypeParameters __tparms, FormalParameters __parms,
		Iterable<TypeSymbol> __thrown, UnparsedExpressions __code)
		throws NullPointerException, StructureException
	{
		if (__mods == null || __tparms == null || __parms == null ||
			__thrown == null || __code == null)
			throw new NullPointerException("NARG");
		
		if (true)
			throw new todo.TODO();
		
		this.modifiers = __mods;
		this.typeparameters = __tparms;
		this.formalparameters = __parms;
		this.code = __code;
		
		throw new todo.TODO();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/05/14
	 */
	@Override
	public final boolean equals(Object __o)
	{
		throw new todo.TODO();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/05/14
	 */
	@Override
	public final int hashCode()
	{
		throw new todo.TODO();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/05/08
	 */
	@Override
	public final ClassConstructorSymbol symbol()
	{
		throw new todo.TODO();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/05/14
	 */
	@Override
	public final String toString()
	{
		throw new todo.TODO();
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






























































































































































































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/structure/ClassConstructorSymbol.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac.structure;

/**
 * This symbol represents the constructor of a class.
 *
 * @since 2018/05/08
 */
@Deprecated
public final class ClassConstructorSymbol
	implements StructureSymbol
{
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<














































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/structure/ClassMemberStructure.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac.structure;

/**
 * This represents a structure which may be the member of a class.
 *
 * @since 2018/05/08
 */
@Deprecated
public interface ClassMemberStructure
	extends Structure
{
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<














































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/structure/ClassNameLookup.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac.structure;

import net.multiphasicapps.javac.syntax.ClassSyntax;
import net.multiphasicapps.javac.syntax.TypeParameterSyntax;
import net.multiphasicapps.javac.syntax.TypeParametersSyntax;
import net.multiphasicapps.javac.syntax.TypeSyntax;

/**
 * This is used to lookup fields, methods, and identifiers within a class
 * scope.
 *
 * @since 2018/05/08
 */
@Deprecated
public final class ClassNameLookup
	implements NameLookup
{
	/** The parent name lookup. */
	protected final NameLookup parent;	
	
	/** The class to name lookup for. */
	protected final ClassSyntax current;
	
	/**
	 * Initializes the class name lookup.
	 *
	 * @param __parent The parent name lookup.
	 * @param __cur The current class.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/05/08
	 */
	public ClassNameLookup(NameLookup __parent, ClassSyntax __cur)
		throws NullPointerException
	{
		if (__parent == null || __cur == null)
			throw new NullPointerException("NARG");
		
		this.parent = __parent;
		this.current = __cur;
		
		// Determine if there are any type parameters which need their meaning
		// defined
		for (TypeParameterSyntax typeparam : __cur.typeParameters())
			throw new todo.TODO();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/05/10
	 */
	@Override
	public final TypeSymbol lookupType(TypeSyntax __ts)
		throws NullPointerException, StructureException
	{
		if (__ts == null)
			throw new NullPointerException("NARG");
		
		throw new todo.TODO();
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<














































































































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/structure/ClassSymbol.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac.structure;

import net.multiphasicapps.classfile.BinaryName;

/**
 * This is a symbol which represents the name of a class.
 *
 * @since 2018/05/05
 */
@Deprecated
public class ClassSymbol
	implements StructureSymbol
{
	/** The binary name of the class. */
	protected final BinaryName binaryname;
	
	/**
	 * Initializes the class symbol.
	 *
	 * @param __bn The binary name to use.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/05/05
	 */
	public ClassSymbol(BinaryName __bn)
		throws NullPointerException
	{
		if (__bn == null)
			throw new NullPointerException("NARG");
		
		this.binaryname = __bn;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/05/05
	 */
	@Override
	public final boolean equals(Object __o)
	{
		throw new todo.TODO();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/05/05
	 */
	@Override
	public final int hashCode()
	{
		throw new todo.TODO();
	}
	
	/**
	 * Translates this class symbol to the name of the class file this will
	 * belong to.
	 *
	 * @return The class file name.
	 * @since 2018/05/05
	 */
	public final String toClassFileName()
	{
		throw new todo.TODO();
	}
	
	/**
	 * Translates this class symbol to the name of the source code files that
	 * may be used for this class, this results in multiple files potentially
	 * being produced as there may be unknown sub-classes.
	 *
	 * @return The source file names used for this class.
	 * @since 2018/05/05
	 */
	public final String[] toSourceFileNames()
	{
		throw new todo.TODO();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/05/05
	 */
	@Override
	public final String toString()
	{
		throw new todo.TODO();
	}
	
	/**
	 * Converts the given file name to the class symbol it should be
	 * associated with.
	 *
	 * @param __fn The filename.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/05/05
	 */
	public static ClassSymbol fromSourceFileName(String __fn)
		throws NullPointerException
	{
		if (__fn == null)
			throw new NullPointerException("NARG");
		
		throw new todo.TODO();
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






































































































































































































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/structure/ClassSyntaxParser.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac.structure;

import java.util.ArrayList;
import java.util.List;
import net.multiphasicapps.javac.syntax.ClassConstructorSyntax;
import net.multiphasicapps.javac.syntax.ClassSyntax;
import net.multiphasicapps.javac.syntax.MemberSyntax;
import net.multiphasicapps.javac.syntax.QualifiedIdentifierSyntax;
import net.multiphasicapps.javac.syntax.TypeParametersSyntax;
import net.multiphasicapps.javac.syntax.TypeParameterSyntax;
import net.multiphasicapps.javac.syntax.TypeSyntax;

/**
 * This class parses individual classes.
 *
 * @since 2018/05/08
 */
@Deprecated
public final class ClassSyntaxParser
	implements Runnable
{
	/** The parent class, may be {@code null}. */
	protected final ClassSyntax parent;
	
	/** The current class. */
	protected final ClassSyntax current;
	
	/** The run-time input. */
	protected final RuntimeInput runtime;
	
	/** The name lookup for this class. */
	protected final ClassNameLookup namelookup;
	
	/**
	 * Initializes the class syntax parser.
	 *
	 * @param __parent The parent class, may be {@code null}.
	 * @param __cur The current class being parsed.
	 * @param __pnl The parent name lookup.
	 * @param __ri The runtime input.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/05/08
	 */
	public ClassSyntaxParser(ClassSyntax __parent, ClassSyntax __cur,
		NameLookup __pnl, RuntimeInput __ri)
		throws NullPointerException
	{
		if (__cur == null || __pnl == null || __ri == null)
			throw new NullPointerException("NARG");
		
		this.parent = __parent;
		this.current = __cur;
		this.runtime = __ri;
		this.namelookup = new ClassNameLookup(__pnl, __cur);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/05/08
	 */
	@Override
	public final void run()
	{
		ClassSyntax current = this.current;
		ClassNameLookup namelookup = this.namelookup;
		RuntimeInput runtime = this.runtime;
		
		// Handle extends of the class
		for (TypeSyntax t : current.extending())
			throw new todo.TODO();
		
		// Handle implements of the class
		for (TypeSyntax t : current.implementing())
			throw new todo.TODO();
		
		// Handle class members
		List<ClassMemberStructure> members = new ArrayList<>();
		for (MemberSyntax m : current.members())
		{
			// Is just another class to be parsed
			if (m instanceof ClassSyntax)
			{
				ClassSyntax xm = (ClassSyntax)m;
				
				// Run that class through the processor
				new ClassSyntaxParser(current, xm,
					new ClassNameLookup(namelookup, xm), runtime).run();
				
				throw new todo.TODO();
			}
			
			// Class constructor
			else if (m instanceof ClassConstructorSyntax)
				members.add(this.__parseConstructor(
					(ClassConstructorSyntax)m));
			
			// Unhandled member type
			else
				throw new RuntimeException(String.format("OOPS %s",
					m.getClass()));
		}
		
		// Build class structure
		throw new todo.TODO();
	}
	
	/**
	 * Parses the class constructor syntax and returns a structure for the
	 * class constructor.
	 *
	 * @param __syn The input syntax.
	 * @return The resulting structure.
	 * @throws NullPointerException On null arguments.
	 * @throws StructureException If the structure is not valid.
	 * @since 2018/05/08
	 */
	private final ClassConstructorStructure __parseConstructor(
		ClassConstructorSyntax __syn)
		throws NullPointerException, StructureException
	{
		if (__syn == null)
			throw new NullPointerException("NARG");
		
		ClassSyntax current = this.current;
		ClassNameLookup namelookup = this.namelookup;
		
		// Parse type parameters
		TypeParameters typeparms = TypeParameters.parseSyntax(
			__syn.typeParameters(), namelookup);
		
		// Setup lookup with type parameters because arguments and throwables
		// will need to know the types and such
		TypeParametersNameLookup tpnl = new TypeParametersNameLookup(
			typeparms, namelookup);
		
		// Parse formal parameters and perform name lookup
		FormalParameters fparms = FormalParameters.parseSyntax(
			__syn.formalParameters(), tpnl);
		
		// Parse thrown types
		List<TypeSymbol> thrown = new ArrayList<>();
		for (QualifiedIdentifierSyntax qi : __syn.thrownTypes())
			thrown.add(namelookup.lookupType(new TypeSyntax(qi)));
		
		// Construct class symbol
		return new ClassConstructorStructure(StructureModifiers.parse(
			__syn.modifiers(), namelookup), typeparms, fparms, thrown,
			__syn.code());
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


































































































































































































































































































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/structure/CompilationUnitNameLookup.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac.structure;

import net.multiphasicapps.classfile.BinaryName;
import net.multiphasicapps.javac.syntax.CompilationUnitSyntax;
import net.multiphasicapps.javac.syntax.TypeSyntax;

/**
 * This is a name lookup which looks within a compilation unit to determine the
 * name symbol of something.
 *
 * The Java language standard at the compilation unit level defines three
 * relevant lookups for ambigious identifiers:
 *
 * Otherwise, if a field of that name is declared in the compilation unit
 * (S7.3) containing the Identifier by a single-static-import declaration
 * (S7.5.3), or by a static-import-on-demand declaration (S7.5.4) then the
 * AmbiguousName is reclassified as an ExpressionName.
 *
 * And then:
 *
 * Otherwise, if a type of that name is declared in the compilation unit (S7.3)
 * containing the Identifier, either by a single-type-import declaration
 * (S7.5.1), or by a type-import-on-demand declaration (S7.5.2), or by a
 * single-static-import declaration (S7.5.3), or by a static-import-on-demand
 * declaration (S7.5.4), then the AmbiguousName is reclassified as a TypeName.
 *
 * And finally:
 *
 * Otherwise, the AmbiguousName is reclassified as a PackageName. A later step
 * determines whether or not a package of that name actually exists.
 *
 * @since 2018/05/08
 */
@Deprecated
public class CompilationUnitNameLookup
	implements NameLookup
{
	/** The run-time to use for class lookup. */
	protected final RuntimeInput runtime;
	
	/**
	 * Initializes the compilation unit name lookup.
	 *
	 * @param __cus The compilation unit to initialize for.
	 * @param __ri The input
	 * @throws NullPointerException On null arguments.
	 * @since 2018/05/08
	 */
	public CompilationUnitNameLookup(CompilationUnitSyntax __cus,
		RuntimeInput __ri)
		throws NullPointerException
	{
		if (__cus == null || __ri == null)
			throw new NullPointerException("NARG");
		
		this.runtime = __ri;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/05/10
	 */
	@Override
	public final TypeSymbol lookupType(TypeSyntax __ts)
		throws NullPointerException, StructureException
	{
		if (__ts == null)
			throw new NullPointerException("NARG");
		
		throw new todo.TODO();
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






































































































































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/structure/CompilationUnitParser.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac.structure;

import net.multiphasicapps.classfile.BinaryName;
import net.multiphasicapps.javac.syntax.ClassSyntax;
import net.multiphasicapps.javac.syntax.CompilationUnitSyntax;

/**
 * This class is used to parse compilation units.
 *
 * @since 2018/05/07
 */
@Deprecated
public final class CompilationUnitParser
	implements Runnable
{
	/** The compilation unit being parsed. */
	protected final CompilationUnitSyntax input;
	
	/** The runtime information. */
	protected final RuntimeInput runtime;
	
	/** The output where it is to be stored. */
	protected final Structures output;
	
	/**
	 * Initializes the parser.
	 *
	 * @param __in The compilation unit input.
	 * @param __ri The run-time input.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/05/07
	 */
	public CompilationUnitParser(CompilationUnitSyntax __in, RuntimeInput __ri)
		throws NullPointerException
	{
		if (__in == null || __ri == null)
			throw new NullPointerException("NARG");
		
		this.input = __in;
		this.runtime = __ri;
		this.output = __ri.structures();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/05/07
	 */
	@Override
	public final void run()
	{
		CompilationUnitSyntax input = this.input;
		RuntimeInput runtime = this.runtime;
		Structures output = this.output;
		
		// Get the package this is in
		BinaryName bninpackage = input.inPackage();
		PackageSymbol inpackage = (bninpackage == null ? null :
			new PackageSymbol(bninpackage));
		
		// Check if the package for this class needs to be processed (searched
		// for annotations and such)
		if (inpackage != null && !output.contains(inpackage))
			runtime.processPackage(inpackage);
		
		// Setup compilation unit name lookup at the top level, which uses
		// import statements, packages, and the classes that exist for
		// identifiers
		CompilationUnitNameLookup nl = new CompilationUnitNameLookup(input,
			runtime);
		
		// Process each individual class
		for (ClassSyntax cs : input.classes())
			new ClassSyntaxParser(null, cs, nl, runtime).run();
		
		throw new todo.TODO();
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
















































































































































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/structure/FormalParameter.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac.structure;

import java.util.Arrays;
import net.multiphasicapps.classfile.FieldName;

/**
 * This represents a single formal parameter which is used as input for a
 * method.
 *
 * @since 2018/05/10
 */
@Deprecated
public final class FormalParameter
{
	/** The name of the parameter. */
	protected final FieldName name;
	
	/**
	 * Initializes the single formal parameter.
	 *
	 * @param __ams The annotations which modify the parameter.
	 * @param __final Is this parameter final?
	 * @param __type The type of the parameter.
	 * @param __name The name of the parameter.
	 * @throws NullPointerException On null arguments.
	 * @throws StructureException If the formal parameter is not valid.
	 * @since 2018/05/10
	 */
	public FormalParameter(AnnotationModifier[] __ams, boolean __final,
		TypeSymbol __type, FieldName __name)
		throws NullPointerException, StructureException
	{
		this(Arrays.<AnnotationModifier>asList((__ams == null ?
			new AnnotationModifier[0] : __ams)), __final, __type, __name);
	}
	
	/**
	 * Initializes the single formal parameter.
	 *
	 * @param __ams The annotations which modify the parameter.
	 * @param __final Is this parameter final?
	 * @param __type The type of the parameter.
	 * @param __name The name of the parameter.
	 * @throws NullPointerException On null arguments.
	 * @throws StructureException If the formal parameter is not valid.
	 * @since 2018/05/10
	 */
	public FormalParameter(Iterable<AnnotationModifier> __ams, boolean __final,
		TypeSymbol __type, FieldName __name)
		throws NullPointerException, StructureException
	{
		if (__ams == null || __type == null || __name == null)
			throw new NullPointerException("NARG");
		
		throw new todo.TODO();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/05/10
	 */
	@Override
	public final boolean equals(Object __o)
	{
		throw new todo.TODO();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/05/10
	 */
	@Override
	public final int hashCode()
	{
		throw new todo.TODO();
	}
	
	/**
	 * Returns the name of the parameter.
	 *
	 * @return The parameter name.
	 * @since 2018/05/10
	 */
	public final FieldName name()
	{
		return this.name;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/05/10
	 */
	@Override
	public final String toString()
	{
		throw new todo.TODO();
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


























































































































































































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/structure/FormalParameters.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac.structure;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import net.multiphasicapps.classfile.FieldName;
import net.multiphasicapps.javac.syntax.AnnotationSyntax;
import net.multiphasicapps.javac.syntax.FormalParametersSyntax;
import net.multiphasicapps.javac.syntax.FormalParameterSyntax;
import net.multiphasicapps.javac.syntax.ModifiersSyntax;
import net.multiphasicapps.javac.syntax.ModifierSyntax;

/**
 * This represents a group of formal parameters.
 *
 * @since 2018/05/10
 */
@Deprecated
public final class FormalParameters
{
	/** The formal parameters which are used. */
	private final FormalParameter[] _parameters;
	
	/**
	 * Initializes the formal parameters.
	 *
	 * @param __fp The input formal parameters.
	 * @throws NullPointerException On null arguments.
	 * @throws StructureException If the formal parameters are not valid.
	 * @since 2018/05/10
	 */
	public FormalParameters(FormalParameter... __fp)
		throws NullPointerException, StructureException
	{
		this(Arrays.<FormalParameter>asList((__fp != null ? __fp :
			new FormalParameter[0])));
	}
	
	/**
	 * Initializes the formal parameters.
	 *
	 * @param __tp The input formal parameters.
	 * @throws NullPointerException On null arguments.
	 * @throws StructureException If the formal parameters are not valid.
	 * @since 2018/05/10
	 */
	public FormalParameters(Iterable<FormalParameter> __fp)
		throws NullPointerException, StructureException
	{
		if (__fp == null)
			throw new NullPointerException("NARG");
		
		Set<FieldName> names = new HashSet<>();
		List<FormalParameter> rv = new ArrayList<>();
		for (FormalParameter fp : __fp)
		{
			if (fp == null)
				throw new NullPointerException("NARG");
			
			// {@squirreljme.error AQ0o Duplicate parameter name. (The name
			// of the parameter)}
			FieldName name = fp.name();
			if (names.contains(name))
				throw new StructureException(String.format("AQ0o %s", name));
			names.add(name);
			
			rv.add(fp);
		}
		
		this._parameters = rv.<FormalParameter>toArray(
			new FormalParameter[rv.size()]);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/05/10
	 */
	@Override
	public final boolean equals(Object __o)
	{
		throw new todo.TODO();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/05/10
	 */
	@Override
	public final int hashCode()
	{
		throw new todo.TODO();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/05/10
	 */
	@Override
	public final String toString()
	{
		throw new todo.TODO();
	}
	
	/**
	 * Parses formal parameters.
	 *
	 * @param __syn The syntax used to make up the formal parameters.
	 * @param __nl The name lookup which is used for types and annotations.
	 * @throws NullPointerException On null arguments.
	 * @throws StructureException If the formal parameters are not correct.
	 * @since 2018/05/10
	 */
	public static FormalParameters parseSyntax(FormalParametersSyntax __syn,
		NameLookup __nl)
		throws NullPointerException, StructureException
	{
		if (__syn == null || __nl == null)
			throw new NullPointerException("NARG");
		
		// Parse each one and wrap
		List<FormalParameter> rv = new ArrayList<>();
		for (FormalParameterSyntax syn : __syn)
		{
			// Need to check the modifiers to determine if they are annotated
			// in any way
			ModifiersSyntax modifiers = syn.modifiers();
			List<AnnotationModifier> ams = new ArrayList<>();
			for (ModifierSyntax modifier : modifiers)
				if (modifier instanceof AnnotationSyntax)
				{
					throw new todo.TODO();
				}
			
			// Setup formal parameter
			rv.add(new FormalParameter(ams, modifiers.isFinal(),
				__nl.lookupType(syn.type()), syn.name()));
		}
		
		// Create
		return new FormalParameters(rv);
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






















































































































































































































































































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/structure/NameLookup.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac.structure;

import net.multiphasicapps.javac.syntax.TypeSyntax;

/**
 * This class manages the lookup for names and may recursively lookup what a
 * name means depending on the scope.
 *
 * @since 2018/05/07
 */
@Deprecated
public interface NameLookup
{
	/**
	 * Looks up the specified type syntax and returns the symbol for it.
	 *
	 * @param __ts The type syntax to locate.
	 * @return The symbol for the given type.
	 * @throws NullPointerException On null arguments.
	 * @throws StructureException If no such symbol exists.
	 * @since 2018/05/10
	 */
	public abstract TypeSymbol lookupType(TypeSyntax __ts)
		throws NullPointerException, StructureException;
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<








































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/structure/PackageInfoParser.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac.structure;

import java.util.ArrayList;
import java.util.List;
import net.multiphasicapps.javac.syntax.AnnotationSyntax;
import net.multiphasicapps.javac.syntax.CompilationUnitSyntax;
import net.multiphasicapps.javac.syntax.ModifiersSyntax;
import net.multiphasicapps.javac.syntax.ModifierSyntax;

/**
 * This parses the package information source file and for the most part is
 * used to handle the annotations accordingly if there are any.
 *
 * @since 2018/05/07
 */
@Deprecated
public final class PackageInfoParser
	implements Runnable
{
	/** The compilation unit being parsed. */
	protected final CompilationUnitSyntax input;
	
	/** The runtime information. */
	protected final RuntimeInput runtime;
	
	/** The output where it is to be stored. */
	protected final Structures output;
	
	/**
	 * Initializes the parser.
	 *
	 * @param __in The compilation unit input.
	 * @param __ri The run-time input.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/05/07
	 */
	public PackageInfoParser(CompilationUnitSyntax __in, RuntimeInput __ri)
		throws NullPointerException
	{
		if (__in == null || __ri == null)
			throw new NullPointerException("NARG");
		
		this.input = __in;
		this.runtime = __ri;
		this.output = __ri.structures();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/05/07
	 */
	@Override
	public final void run()
	{
		CompilationUnitSyntax input = this.input;
		Structures output = this.output;
		
		// Parse package annotations, if any
		List<AnnotationModifier> annotations = new ArrayList<>();
		for (ModifierSyntax modifier : input.packageModifiers().modifiers())
		{
			// Only annotation are valid for packages
			AnnotationSyntax as = (AnnotationSyntax)modifier;
			
			throw new todo.TODO();
		}
		
		// Store it
		output.put(new PackageStructure(new PackageSymbol(input.inPackage()),
			annotations));
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






































































































































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/structure/PackageStructure.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac.structure;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * This structure represents a single package.
 *
 * @since 2018/05/07
 */
@Deprecated
public final class PackageStructure
	implements Structure
{
	/** The symbol used. */
	protected final PackageSymbol symbol;
	
	/** The annotation modifiers. */
	private final AnnotationModifier[] _annotations;
	
	/**
	 * Initializes the package structure.
	 *
	 * @param __sym The symbol for the package.
	 * @param __ams The annotation modifiers.
	 * @throws NullPointerException On null arguments.
	 * @throws StructureException If the structure is not valid.
	 * @since 2018/05/07
	 */
	public PackageStructure(PackageSymbol __sym, AnnotationModifier[] __ams)
		throws NullPointerException, StructureException
	{
		this(__sym, Arrays.<AnnotationModifier>asList(
			(__ams == null ? new AnnotationModifier[0] : __ams)));
	}
	
	/**
	 * Initializes the package structure.
	 *
	 * @param __sym The symbol for the package.
	 * @param __ams The annotation modifiers.
	 * @throws NullPointerException On null arguments.
	 * @throws StructureException If the structure is not valid.
	 * @since 2018/05/07
	 */
	public PackageStructure(PackageSymbol __sym,
		Iterable<AnnotationModifier> __ams)
		throws NullPointerException, StructureException
	{
		if (__sym == null || __ams == null)
			throw new NullPointerException("NARG");
		
		List<AnnotationModifier> annotations = new ArrayList<>();
		for (AnnotationModifier am : __ams)
			if (am == null)
				throw new NullPointerException("NARG");
			else
				annotations.add(am);
		
		this.symbol = __sym;
		this._annotations = annotations.<AnnotationModifier>toArray(
			new AnnotationModifier[annotations.size()]);
	}
	
	/**
	 * Returns the used annotations.
	 *
	 * @return The used annotations.
	 * @since 2018/05/07
	 */
	public final AnnotationModifier[] annotations()
	{
		return this._annotations;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/05/07
	 */
	@Override
	public final boolean equals(Object __o)
	{
		if (this == __o)
			return true;
		
		if (!(__o instanceof PackageStructure))
			return false;
		
		PackageStructure o = (PackageStructure)__o;
		throw new todo.TODO();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/05/07
	 */
	@Override
	public final int hashCode()
	{
		throw new todo.TODO();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/05/07
	 */
	@Override
	public final PackageSymbol symbol()
	{
		return this.symbol;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/05/07
	 */
	@Override
	public final String toString()
	{
		throw new todo.TODO();
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<












































































































































































































































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/structure/PackageSymbol.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac.structure;

import net.multiphasicapps.classfile.BinaryName;

/**
 * This represents the symbol name of a package, it is mostly intended to
 * handle {@code package-info} files and potentially associate any annotations
 * to the package itself.
 *
 * @since 2018/05/05
 */
@Deprecated
public final class PackageSymbol
	implements StructureSymbol
{
	/** The binary name of the package. */
	protected final BinaryName name;
	
	/**
	 * Initializes the symbol.
	 *
	 * @param __bn The binary name used.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/05/07
	 */
	public PackageSymbol(BinaryName __n)
		throws NullPointerException
	{
		if (__n == null)
			throw new NullPointerException("NARG");
		
		this.name = __n;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/05/05
	 */
	@Override
	public final boolean equals(Object __o)
	{
		if (this == __o)
			return true;
		
		if (!(__o instanceof PackageSymbol))
			return false;
		
		PackageSymbol o = (PackageSymbol)__o;
		return this.name.equals(o.name);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/05/05
	 */
	@Override
	public final int hashCode()
	{
		return this.name.hashCode();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/05/05
	 */
	@Override
	public final String toString()
	{
		return this.name.toString();
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




































































































































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/structure/RuntimeInput.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac.structure;

import java.io.InputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Objects;
import java.util.Set;
import net.multiphasicapps.classfile.BinaryName;
import net.multiphasicapps.classfile.ClassIdentifier;
import net.multiphasicapps.classfile.InvalidClassFormatException;
import net.multiphasicapps.javac.CompilerInput;
import net.multiphasicapps.javac.CompilerPathSet;
import net.multiphasicapps.javac.NoSuchInputException;
import net.multiphasicapps.javac.StringFileName;
import net.multiphasicapps.javac.syntax.ClassSyntax;
import net.multiphasicapps.javac.syntax.CompilationUnitSyntax;
import net.multiphasicapps.javac.syntax.ModifiersSyntax;
import net.multiphasicapps.javac.syntax.SyntaxException;
import net.multiphasicapps.javac.token.BufferedTokenSource;

/**
 * This class contians the input for the .
 *
 * @since 2018/05/03
 */
@Deprecated
public final class RuntimeInput
{
	/** Output structure information. */
	protected final Structures structures =
		new Structures();
	
	/** The class path. */
	private final CompilerPathSet[] _classpath;
	
	/** The source path. */
	private final CompilerPathSet[] _sourcepath;
	
	/** Files which have been processed. */
	private final Set<String> _didfiles =
		new HashSet<>();
	
	/**
	 * Initializes the runtime input.
	 *
	 * @param __class The class path.
	 * @param __src The source path.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/05/03
	 */
	public RuntimeInput(CompilerPathSet[] __class, CompilerPathSet[] __src)
		throws NullPointerException
	{
		this(Arrays.<CompilerPathSet>asList((__class == null ?
			new CompilerPathSet[0] : __class)),
			Arrays.<CompilerPathSet>asList((__src == null ?
			new CompilerPathSet[0] : __src)));
	}
	
	/**
	 * Initializes the runtime input.
	 *
	 * @param __class The class path.
	 * @param __src The source path.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/05/03
	 */
	public RuntimeInput(Iterable<CompilerPathSet> __class,
		Iterable<CompilerPathSet> __src)
		throws NullPointerException
	{
		if (__class == null || __src == null)
			throw new NullPointerException("NARG");
		
		// Check classpath
		List<CompilerPathSet> classes = new ArrayList<>();
		for (CompilerPathSet p : __class)
			if (p == null)
				throw new NullPointerException("NARG");
			else
				classes.add(p);
		
		// Check sources
		List<CompilerPathSet> sources = new ArrayList<>();
		for (CompilerPathSet p : __src)
			if (p == null)
				throw new NullPointerException("NARG");
			else
				sources.add(p);
		
		this._classpath = classes.<CompilerPathSet>toArray(
			new CompilerPathSet[classes.size()]);
		this._sourcepath = sources.<CompilerPathSet>toArray(
			new CompilerPathSet[sources.size()]);
	}
	
	/**
	 * Prcoesses a single class file.
	 *
	 * @param __fn The class file name to process.
	 * @throws NullPointerException On null arguments.
	 * @throws StructureException If the class structure is not valid.
	 * @since 2018/05/05
	 */
	public final void processClassFile(String __fn)
		throws NullPointerException, StructureException
	{
		if (__fn == null)
			throw new NullPointerException("NARG");
		
		throw new todo.TODO();
	}
	
	/**
	 * Processes the specified package and initializes it from class files
	 * or source code.
	 *
	 * @param __ps The package to initialize.
	 * @throws NullPointerException On null arguments.
	 * @throws StructureException If the specified package does not exist or
	 * is not valid.
	 * @since 2018/05/08
	 */
	public final void processPackage(PackageSymbol __ps)
		throws NullPointerException, StructureException
	{
		if (__ps == null)
			throw new NullPointerException("NARG");
		
		throw new todo.TODO();
	}
	
	/**
	 * Processes a single source file.
	 *
	 * @param __fn The input file to process.
	 * @throws StructureException If the source structure is not valid.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/05/05
	 */
	public final void processSourceFile(String __fn)
		throws StructureException, NullPointerException
	{
		if (__fn == null)
			throw new NullPointerException("NARG");
		
		// Only process class files once
		Set<String> didfiles = this._didfiles;
		if (didfiles.contains(__fn))
			return;
		didfiles.add(__fn);
		
		// Used for location awareness
		StringFileName sfn = new StringFileName(__fn);
		
		// {@squirreljme.error AQ0p Cannot process source file which does not
		// end in {@code .java}.}
		if (!__fn.toLowerCase().endsWith(".java"))
			throw new StructureException(sfn, "AQ0p");
		
		// Get basename and package name, used to quickly determine some things
		String basename = __fn.substring(0, __fn.length() - 5);
		int lastslash = basename.lastIndexOf('/');
		String rawinpackage = (lastslash < 0 ? null :
				basename.substring(0, lastslash)),
			baseclassname = (lastslash < 0 ? basename :
				basename.substring(lastslash + 1));
		
		// The package the class is in
		BinaryName inpackage = (rawinpackage == null ? null :
			new BinaryName(rawinpackage));
		
		// This will essentially check that the class is named with valid
		// characters
		BinaryName classname;
		try
		{
			// The package information has no class name
			if (baseclassname.equals("package-info"))
				classname = null;
			else
				classname = new BinaryName(basename);
		}
		catch (InvalidClassFormatException e)
		{
			// {@squirreljme.error AQ0q Cannot parse the source file because
			// it does not have a valid name.}
			throw new StructureException(sfn,
				String.format("AQ0q %s", basename));
		}
		
		// Determine the identifier of the class
		ClassIdentifier classident = (classname == null ? null :
			new ClassIdentifier(baseclassname));
		
		// Search for the source file
		CompilerInput ci = null;
		for (CompilerPathSet ps : this._sourcepath)
			try
			{
				if (null != (ci = ps.input(__fn)))
					break;
			}
			catch (NoSuchInputException e)
			{
			}
		
		// {@squirreljme.error AQ0r The source file does not exist.}
		if (ci == null)
			throw new StructureException(sfn, "AQ0r");
		
		// Parse the syntax for the compilation unit and hope it works
		CompilationUnitSyntax cus;
		try (InputStream in = ci.open();
			BufferedTokenSource bts = new BufferedTokenSource(__fn, in))
		{
			cus = CompilationUnitSyntax.parse(bts);
		}
		
		// {@squirreljme.error AQ0s Could not parse the syntax for the source
		// file because it failed to read or has invalid syntax.}
		catch (IOException|SyntaxException e)
		{
			throw new StructureException(sfn, "AQ0s", e);
		}
		
		// Debug the layout
		todo.DEBUG.note("%s", cus);
		
		// {@squirreljme.error AQ0t Source code file specified a package which
		// does not match the package represented in the source code itself.
		// (The package the source is in; The package the source code actually
		// specified)}
		BinaryName cuspackage = cus.inPackage();
		if (!Objects.equals(inpackage, cuspackage))
			throw new StructureException(sfn, String.format("AQ0t %s %s",
				inpackage, cuspackage));
		
		// Determine if the class was placed in the correct file
		List<ClassSyntax> classes = cus.classes();
		if (classname != null)
		{
			// {@squirreljme.error AQ0u Source file declares no classes.}
			if (classes.size() <= 0)
				throw new StructureException(sfn, "AQ0u");
			
			// Find the public class
			ClassSyntax pubclass = null;
			for (ClassSyntax cs : classes)
			{
				ModifiersSyntax mods = cs.modifiers();
				if (mods.isPublic())
				{
					// {@squirreljme.error AQ0v Class file contains multiple
					// public classes. (The first found public class; The
					// second found public class)}
					if (pubclass != null)
						throw new StructureException(sfn,
							String.format("AQ0v %s %s", pubclass.name(),
							cs.name()));
					
					pubclass = cs;
				}
			}
			
			// If only a single class is declared and no public class exists
			// then the only class which exists there must have a matching
			// name
			if (pubclass == null && classes.size() == 1)
				pubclass = classes.get(0);
			
			// {@squirreljme.error AQ0w The name of the public class in the
			// file does not match the expected name of the source file.
			// (The public class name)}
			if (pubclass != null && !classident.equals(pubclass.name()))
				throw new StructureException(sfn,
					String.format("AQ0w %s", pubclass.name()));
		}
		
		// Is a package-info file
		else
		{
			// {@squirreljme.error AQ0x Source package-info files cannot
			// specify any classes.}
			if (classes.size() != 0)
				throw new StructureException(sfn, "AQ0x");
		}
		
		// So now that the source file has been parsed the resulting syntax
		// needs to be parsed itself to load structure data from it
		if (classname != null)
			new CompilationUnitParser(cus, this).run();
		else
			new PackageInfoParser(cus, this).run();
	}
	
	/**
	 * Processes source code files and loads their required structure
	 * information performing basic compilation of them.
	 *
	 * @param __fn The source file name to process.
	 * @throws StructureException If the parsed structures are not correct.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/05/03
	 */
	public final void processSourceFiles(String... __fn)
		throws StructureException, NullPointerException
	{
		this.processSourceFiles(Arrays.<String>asList((__fn == null ?
			new String[0] : __fn)));
	}
	
	/**
	 * Processes source code files and loads their required structure
	 * information performing basic compilation of them.
	 *
	 * @param __fn The source file name to process.
	 * @throws StructureException If the parsed structures are not correct.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/05/03
	 */
	public final void processSourceFiles(Iterable<String> __fn)
		throws StructureException, NullPointerException
	{
		if (__fn == null)
			throw new NullPointerException("NARG");
		
		// Process each file
		for (String filename : __fn)
		{
			if (filename == null)
				throw new NullPointerException("NARG");	
			
			this.processSourceFile(filename);
		}
	}
	
	/**
	 * Returns the structures where classes have been read into.
	 *
	 * @return The structures used.
	 * @since 2018/05/05
	 */
	public final Structures structures()
	{
		return this.structures;
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




















































































































































































































































































































































































































































































































































































































































































































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/structure/Structure.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac.structure;

/**
 * This interface represents structure representation.
 *
 * @since 2018/05/07
 */
@Deprecated
public interface Structure
{
	/**
	 * Returns the symbol for the structure.
	 *
	 * @return The structure symbol.
	 * @since 2018/05/07
	 */
	public abstract StructureSymbol symbol();
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


























































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/structure/StructureException.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac.structure;

import net.multiphasicapps.javac.CompilerException;
import net.multiphasicapps.javac.LocationAware;

/**
 * This is thrown when the structure of a class file or source code is not
 * correct.
 *
 * @since 2018/05/03
 */
@Deprecated
public class StructureException
	extends CompilerException
{
	/**
	 * Initialize the exception with no message or cause.
	 *
	 * @since 2018/05/03
	 */
	public StructureException()
	{
	}
	
	/**
	 * Initialize the exception with a message and no cause.
	 *
	 * @param __m The message.
	 * @since 2018/05/03
	 */
	public StructureException(String __m)
	{
		super(__m);
	}
	
	/**
	 * Initialize the exception with a message and cause.
	 *
	 * @param __m The message.
	 * @param __c The cause.
	 * @since 2018/05/03
	 */
	public StructureException(String __m, Throwable __c)
	{
		super(__m, __c);
	}
	
	/**
	 * Initialize the exception with no message and with a cause.
	 *
	 * @param __c The cause.
	 * @since 2018/05/03
	 */
	public StructureException(Throwable __c)
	{
		super(__c);
	}
	
	/**
	 * Initialize the exception with no message or cause.
	 *
	 * @param __la Location awareness information.
	 * @since 2018/05/03
	 */
	public StructureException(LocationAware __la)
	{
		super(__la);
	}
	
	/**
	 * Initialize the exception with a message and no cause.
	 *
	 * @param __la Location awareness information.
	 * @param __m The message.
	 * @since 2018/05/03
	 */
	public StructureException(LocationAware __la, String __m)
	{
		super(__la, __m);
	}
	
	/**
	 * Initialize the exception with a message and cause.
	 *
	 * @param __la Location awareness information.
	 * @param __m The message.
	 * @param __c The cause.
	 * @since 2018/05/03
	 */
	public StructureException(LocationAware __la, String __m,
		Throwable __c)
	{
		super(__la, __m, __c);
	}
	
	/**
	 * Initialize the exception with no message and with a cause.
	 *
	 * @param __la Location awareness information.
	 * @param __c The cause.
	 * @since 2018/05/03
	 */
	public StructureException(LocationAware __la, Throwable __c)
	{
		super(__la, __c);
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<












































































































































































































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/structure/StructureModifier.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac.structure;

/**
 * This interface represents any modifier which may be associated with a class,
 * member, or parameter.
 *
 * @since 2018/05/12
 */
@Deprecated
public interface StructureModifier
{
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<














































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/structure/StructureModifiers.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac.structure;

import java.util.Arrays;
import java.util.LinkedHashSet;
import java.util.Set;
import net.multiphasicapps.javac.syntax.AnnotationSyntax;
import net.multiphasicapps.javac.syntax.BasicModifierSyntax;
import net.multiphasicapps.javac.syntax.ModifiersSyntax;
import net.multiphasicapps.javac.syntax.ModifierSyntax;

/**
 * Represents modifiers that may be associated with a structure.
 *
 * @since 2018/05/10
 */
@Deprecated
public final class StructureModifiers
{
	/** The modifiers which are available. */
	private final Set<StructureModifier> _modifiers;
	
	/**
	 * Initializes the modifiers.
	 *
	 * @param __m The input modifiers.
	 * @throws NullPointerException On null arguments.
	 * @throws StructureException If the modifiers are not valid.
	 * @since 2018/05/12
	 */
	public StructureModifiers(StructureModifier... __m)
		throws NullPointerException, StructureException
	{
		this(Arrays.<StructureModifier>asList((__m != null ? __m :
			new StructureModifier[0])));
	}
	
	/**
	 * Initializes the modifiers.
	 *
	 * @param __m The input modifiers.
	 * @throws NullPointerException On null arguments.
	 * @throws StructureException If the modifiers are not valid.
	 * @since 2018/05/12
	 */
	public StructureModifiers(Iterable<StructureModifier> __m)
		throws NullPointerException, StructureException
	{
		if (__m == null)
			throw new NullPointerException("NARG");
		
		Set<StructureModifier> rv = new LinkedHashSet<>();
		for (StructureModifier m : __m)
		{
			if (m == null)
				throw new NullPointerException("NARG");
			
			// {@squirreljme.error AQ0y Duplicate modifier. (The modifier)}
			if (rv.contains(m))
				throw new StructureException(String.format("AQ0y %s", m));
			
			rv.add(m);
		}
		
		this._modifiers = rv;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/05/10
	 */
	@Override
	public final boolean equals(Object __o)
	{
		throw new todo.TODO();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/05/10
	 */
	@Override
	public final int hashCode()
	{
		throw new todo.TODO();
	}
	
	/**
	 * Is this abstract?
	 *
	 * @return If this is abstract.
	 * @since 2018/05/13
	 */
	public final boolean isAbstract()
	{
		return this._modifiers.contains(BasicModifierSyntax.ABSTRACT);
	}
	
	/**
	 * Is this final?
	 *
	 * @return If this is final.
	 * @since 2018/05/13
	 */
	public final boolean isFinal()
	{
		return this._modifiers.contains(BasicModifierSyntax.FINAL);
	}
	
	/**
	 * Is this native?
	 *
	 * @return If this is native.
	 * @since 2018/05/13
	 */
	public final boolean isNative()
	{
		return this._modifiers.contains(BasicModifierSyntax.NATIVE);
	}
	
	/**
	 * Is this private?
	 *
	 * @return If this is private.
	 * @since 2018/05/13
	 */
	public final boolean isPrivate()
	{
		return this._modifiers.contains(BasicModifierSyntax.PRIVATE);
	}
	
	/**
	 * Is this protected?
	 *
	 * @return If this is protected.
	 * @since 2018/05/13
	 */
	public final boolean isProtected()
	{
		return this._modifiers.contains(BasicModifierSyntax.PROTECTED);
	}
	
	/**
	 * Is this public?
	 *
	 * @return If this is public.
	 * @since 2018/05/13
	 */
	public final boolean isPublic()
	{
		return this._modifiers.contains(BasicModifierSyntax.PUBLIC);
	}
	
	/**
	 * Is this static?
	 *
	 * @return If this is static.
	 * @since 2018/05/13
	 */
	public final boolean isStatic()
	{
		return this._modifiers.contains(BasicModifierSyntax.STATIC);
	}
	
	/**
	 * Is this using strict floating point?
	 *
	 * @return If this is using struct floating point.
	 * @since 2018/05/13
	 */
	public final boolean isStrictFloatingPoint()
	{
		return this._modifiers.contains(BasicModifierSyntax.STRICTFP);
	}
	
	/**
	 * Is this synchronized?
	 *
	 * @return If this is synchronized.
	 * @since 2018/05/13
	 */
	public final boolean isSynchronized()
	{
		return this._modifiers.contains(BasicModifierSyntax.SYNCHRONIZED);
	}
	
	/**
	 * Is this transient?
	 *
	 * @return If this is transient.
	 * @since 2018/05/13
	 */
	public final boolean isTransient()
	{
		return this._modifiers.contains(BasicModifierSyntax.TRANSIENT);
	}
	
	/**
	 * Is this volatile?
	 *
	 * @return If this is volatile.
	 * @since 2018/05/13
	 */
	public final boolean isVolatile()
	{
		return this._modifiers.contains(BasicModifierSyntax.VOLATILE);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/05/10
	 */
	@Override
	public final String toString()
	{
		throw new todo.TODO();
	}
	
	/**
	 * Parses the given modifiers syntax and builds modifier structures from
	 * them.
	 *
	 * @param __syn The input syntax.
	 * @param __nl The lookup for names (used for annotation).
	 * @return The parsed modifiers.
	 * @throws NullPointerException On null arguments.
	 * @throws StructureException If the modifiers are not valid.
	 * @since 2018/05/10
	 */
	public static StructureModifiers parse(ModifiersSyntax __syn,
		NameLookup __nl)
		throws NullPointerException, StructureException
	{
		if (__syn == null || __nl == null)
			throw new NullPointerException("NARG");
		
		// Go through all modifiers
		Set<StructureModifier> rv = new LinkedHashSet<>();
		for (ModifierSyntax mod : __syn)
		{
			// Is this just an annotation?
			if (mod instanceof AnnotationSyntax)
				rv.add(AnnotationModifier.parse((AnnotationSyntax)mod, __nl));
			
			// Standard modifier
			else if (mod instanceof BasicModifierSyntax)
			{
				BasicModifier got;
				switch ((BasicModifierSyntax)mod)
				{
					case PUBLIC:
						got = BasicModifier.PUBLIC;
						break;
						
					case PROTECTED:
						got = BasicModifier.PROTECTED;
						break;
						
					case PRIVATE:
						got = BasicModifier.PRIVATE;
						break;
						
					case STATIC:
						got = BasicModifier.STATIC;
						break;
						
					case ABSTRACT:
						got = BasicModifier.ABSTRACT;
						break;
						
					case FINAL:
						got = BasicModifier.FINAL;
						break;
						
					case NATIVE:
						got = BasicModifier.NATIVE;
						break;
						
					case SYNCHRONIZED:
						got = BasicModifier.SYNCHRONIZED;
						break;
						
					case TRANSIENT:
						got = BasicModifier.TRANSIENT;
						break;
						
					case VOLATILE:
						got = BasicModifier.VOLATILE;
						break;
						
					case STRICTFP:
						got = BasicModifier.STRICTFP;
						break;
						
					default:
						throw new todo.OOPS();
				}
				
				rv.add(got);
			}
			
			// {@squirreljme.error AQ0z Unsupported modifier type. (The type)}
			else
				throw new RuntimeException(String.format("AQ0z %s",
					mod.getClass()));
		}
		
		return new StructureModifiers(rv);
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
































































































































































































































































































































































































































































































































































































































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/structure/StructureSymbol.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac.structure;

/**
 * This interface represents a symbol which can be used to lookup a class.
 *
 * @since 2018/05/03
 */
@Deprecated
public interface StructureSymbol
{
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<












































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/structure/Structures.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac.structure;

import java.util.LinkedHashMap;
import java.util.Map;

/**
 * This class contains the structure information.
 *
 * @since 2018/05/05
 */
@Deprecated
public final class Structures
{
	/** Mapping of symbols to structures. */
	private final Map<StructureSymbol, Structure> _structures =
		new LinkedHashMap<>();
	
	/**
	 * Checks if the loaded structure contains a symbol for the given class.
	 *
	 * @param __sym The symbol to lookup.
	 * @return If the symbol exists in the structure.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/05/05
	 */
	public final boolean contains(StructureSymbol __sym)
		throws NullPointerException
	{
		if (__sym == null)
			throw new NullPointerException("NARG");
		
		return this._structures.containsKey(__sym);
	}
	
	/**
	 * Puts the specified structure into the structure map.
	 *
	 * @param __s The structure to put.
	 * @throws NullPointerException On null arguments.
	 * @throws StructureException If the structure already exists.
	 * @since 2018/05/07
	 */
	public final void put(Structure __s)
		throws NullPointerException, StructureException
	{
		if (__s == null)
			throw new NullPointerException("NARG");
		
		// {@squirreljme.error AQ10 Structure has no symbol.}
		StructureSymbol sym = __s.symbol();
		if (sym == null)
			throw new NullPointerException("AQ10");
		
		// {@squirreljme.error AQ11 A structure already exists with the
		// given symbol. (The symbol)}
		Map<StructureSymbol, Structure> structures = this._structures;
		if (structures.containsKey(sym))
			throw new StructureException(String.format("AQ11 %s", sym));
		
		// Associate that structure with this symbol
		structures.put(sym, __s);
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




















































































































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/structure/TypeParameter.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac.structure;

import net.multiphasicapps.classfile.Identifier;

/**
 * This represents a single type parameter which is used to describe generic
 * type information.
 *
 * @since 2018/05/10
 */
@Deprecated
public final class TypeParameter
{
	/**
	 * {@inheritDoc}
	 * @since 2018/05/10
	 */
	@Override
	public final boolean equals(Object __o)
	{
		throw new todo.TODO();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/05/10
	 */
	@Override
	public final int hashCode()
	{
		throw new todo.TODO();
	}
	
	/**
	 * Returns the identifier which represents the type.
	 *
	 * @return The symbol identifier.
	 * @since 2018/05/10
	 */
	public final TypeParameterSymbol symbol()
	{
		throw new todo.TODO();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/05/10
	 */
	@Override
	public final String toString()
	{
		throw new todo.TODO();
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


































































































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/structure/TypeParameterSymbol.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac.structure;

import net.multiphasicapps.classfile.Identifier;

/**
 * This is a symbol which represents the type name of the type parameter.
 *
 * @since 2018/05/10
 */
@Deprecated
public final class TypeParameterSymbol
	implements StructureSymbol
{
	/**
	 * {@inheritDoc}
	 * @since 2018/05/10
	 */
	@Override
	public final boolean equals(Object __o)
	{
		throw new todo.TODO();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/05/10
	 */
	@Override
	public final int hashCode()
	{
		throw new todo.TODO();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/05/10
	 */
	@Override
	public final String toString()
	{
		throw new todo.TODO();
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<












































































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/structure/TypeParameters.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac.structure;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import net.multiphasicapps.classfile.Identifier;
import net.multiphasicapps.javac.syntax.TypeParametersSyntax;
import net.multiphasicapps.javac.syntax.TypeParameterSyntax;

/**
 * This represents multiple {@link TypeParameter} and is used to describe
 * all of the type parameters used for methods and classes.
 *
 * @since 2018/05/10
 */
@Deprecated
public final class TypeParameters
{
	/** The type parameters used. */
	private final TypeParameter[] _typeparams;
	
	/**
	 * Initializes the type parameters.
	 *
	 * @param __tp The input type parameters.
	 * @throws NullPointerException On null arguments.
	 * @throws StructureException If the type parameters are not valid.
	 * @since 2018/05/10
	 */
	public TypeParameters(TypeParameter... __tp)
		throws NullPointerException, StructureException
	{
		this(Arrays.<TypeParameter>asList((__tp != null ? __tp :
			new TypeParameter[0])));
	}
	
	/**
	 * Initializes the type parameters.
	 *
	 * @param __tp The input type parameters.
	 * @throws NullPointerException On null arguments.
	 * @throws StructureException If the type parameters are not valid.
	 * @since 2018/05/10
	 */
	public TypeParameters(Iterable<TypeParameter> __tp)
		throws NullPointerException, StructureException
	{
		if (__tp == null)
			throw new NullPointerException("NARG");
		
		// Find duplicate identifiers
		Set<TypeParameterSymbol> idents = new HashSet<>();
		List<TypeParameter> params = new ArrayList<>();
		for (TypeParameter tp : __tp)
			if (tp == null)
				throw new NullPointerException("NARG");
			else
			{
				params.add(tp);
				
				// {@squirreljme.error AQ12 Duplicate type parameter
				// identifier. (The identifier)}
				TypeParameterSymbol i = tp.symbol();
				if (idents.contains(i))
					throw new StructureException(String.format("AQ12 %s", i));
				idents.add(i);
			}
		
		this._typeparams = params.<TypeParameter>toArray(
			new TypeParameter[params.size()]);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/05/10
	 */
	@Override
	public final boolean equals(Object __o)
	{
		throw new todo.TODO();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/05/10
	 */
	@Override
	public final int hashCode()
	{
		throw new todo.TODO();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/05/10
	 */
	@Override
	public final String toString()
	{
		throw new todo.TODO();
	}
	
	/**
	 * Parses the input type parameters and performs resolution and lookup
	 * of the types.
	 *
	 * @param __syn The syntax to parse.
	 * @param __nl The name lookup for types.
	 * @throws NullPointerException On null arguments.
	 * @throws StructureException If a type is not valid.
	 * @since 2018/05/10
	 */
	public static TypeParameters parseSyntax(TypeParametersSyntax __syn,
		NameLookup __nl)
		throws NullPointerException, StructureException
	{
		if (__syn == null || __nl == null)
			throw new NullPointerException("NARG");
		
		// Parse each one
		List<TypeParameter> rv = new ArrayList<>();
		for (TypeParameterSyntax s : __syn)
			throw new todo.TODO();
		
		return new TypeParameters(rv);
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
























































































































































































































































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/structure/TypeParametersNameLookup.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac.structure;

import net.multiphasicapps.javac.syntax.TypeSyntax;

/**
 * This is a name lookup which additionally supports lookup into a set of
 * type parameters.
 *
 * @since 2018/05/10
 */
@Deprecated
public final class TypeParametersNameLookup
	implements NameLookup
{
	/** The type parameters to look within. */
	protected final TypeParameters typeparameters;
	
	/** The parent name lookup. */
	protected final NameLookup parent;
	
	/**
	 * Initializes the type parameter lookup.
	 *
	 * @param __tp The type parameters to look in.
	 * @param __parent The parent name lookup for when no type parameter was
	 * found.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/05/10
	 */
	public TypeParametersNameLookup(TypeParameters __tp, NameLookup __parent)
		throws NullPointerException
	{
		if (__tp == null || __parent == null)
			throw new NullPointerException("NARG");
		
		this.typeparameters = __tp;
		this.parent = __parent;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/05/10
	 */
	@Override
	public final TypeSymbol lookupType(TypeSyntax __ts)
		throws NullPointerException, StructureException
	{
		if (__ts == null)
			throw new NullPointerException("NARG");
		
		throw new todo.TODO();
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
































































































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/structure/TypeSymbol.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac.structure;

/**
 * This is used for any symbol which represents a type such as a class or
 * generic type parameter.
 *
 * @since 2018/05/10
 */
@Deprecated
public interface TypeSymbol
	extends StructureSymbol
{
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
















































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/structure/package-info.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

/**
 * This package contains the parser and the structure representation of the
 * input class path and source code. This parses class files and source files
 * and enables resolution of the virtual machine state.
 *
 * @since 2018/05/03
 */

@Deprecated
package net.multiphasicapps.javac.structure;

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<










































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/syntax/AnnotationArrayValueSyntax.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac.syntax;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * This represents an annotation value that represents multiple values in an
 * array.
 *
 * @since 2018/05/02
 */
public final class AnnotationArrayValueSyntax
	implements AnnotationValueSyntax
{
	/** The value which make up this value. */
	private final AnnotationValueSyntax[] _values;
	
	/**
	 * Initializes the array value annotation.
	 *
	 * @param __v The values which make up the annotation.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/05/02
	 */
	public AnnotationArrayValueSyntax(AnnotationValueSyntax... __v)
		throws NullPointerException
	{
		this(Arrays.<AnnotationValueSyntax>asList((__v == null ?
			new AnnotationValueSyntax[0] : __v)));
	}
	
	/**
	 * Initializes the array value annotation.
	 *
	 * @param __v The values which make up the annotation.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/05/02
	 */
	public AnnotationArrayValueSyntax(Iterable<AnnotationValueSyntax> __v)
		throws NullPointerException
	{
		if (__v == null)
			throw new NullPointerException("NARG");
		
		List<AnnotationValueSyntax> values = new ArrayList<>();
		for (AnnotationValueSyntax v : __v)
		{
			if (v == null)
				throw new NullPointerException("NARG");
			
			values.add(v);
		}
		
		this._values = values.<AnnotationValueSyntax>toArray(
			new AnnotationValueSyntax[values.size()]);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/05/02
	 */
	@Override
	public final boolean equals(Object __o)
	{
		if (__o == this)
			return true;
		
		if (!(__o instanceof AnnotationArrayValueSyntax))
			return false;
		
		AnnotationArrayValueSyntax o = (AnnotationArrayValueSyntax)__o;
		return Arrays.equals(this._values, o._values);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/05/02
	 */
	@Override
	public final int hashCode()
	{
		int hash = 0;
		for (Object v : this._values)
			hash ^= v.hashCode();
		return hash;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/05/02
	 */
	@Override
	public final String toString()
	{
		throw new todo.TODO();
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


























































































































































































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/syntax/AnnotationKeyValueSyntax.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac.syntax;

import net.multiphasicapps.classfile.MethodName;

/**
 * This represents an annotation value which is a value assigned to a key.
 *
 * @since 2018/05/03
 */
public final class AnnotationKeyValueSyntax
	implements AnnotationValueSyntax
{
	/** The key. */
	protected final MethodName key;
	
	/** The value. */
	protected final AnnotationValueSyntax value;
	
	/**
	 * Initializes the key/value pair.
	 *
	 * @param __k The key.
	 * @param __v The value.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/05/03
	 */
	public AnnotationKeyValueSyntax(MethodName __k, AnnotationValueSyntax __v)
		throws NullPointerException
	{
		if (__k == null || __v == null)
			throw new NullPointerException("NARG");
		
		this.key = __k;
		this.value = __v;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/05/03
	 */
	@Override
	public final boolean equals(Object __o)
	{
		if (__o == this)
			return true;
		
		if (!(__o instanceof AnnotationKeyValueSyntax))
			return false;
		
		AnnotationKeyValueSyntax o = (AnnotationKeyValueSyntax)__o;
		return this.key.equals(o.key) &&
			this.value.equals(o.value);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/05/03
	 */
	@Override
	public final int hashCode()
	{
		return this.key.hashCode() ^
			this.value.hashCode();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/05/03
	 */
	@Override
	public final String toString()
	{
		throw new todo.TODO();
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<












































































































































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/syntax/AnnotationMethodSyntax.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac.syntax;

import net.multiphasicapps.classfile.MethodName;
import net.multiphasicapps.javac.token.BufferedTokenSource;
import net.multiphasicapps.javac.token.Token;
import net.multiphasicapps.javac.token.TokenSource;
import net.multiphasicapps.javac.token.TokenType;

/**
 * This represents the method used in an annotation.
 *
 * @since 2018/04/28
 */
public final class AnnotationMethodSyntax
	implements MethodSyntax
{
	/**
	 * {@inheritDoc}
	 * @since 2018/04/28
	 */
	@Override
	public final boolean equals(Object __o)
	{
		throw new todo.TODO();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/04/28
	 */
	@Override
	public final int hashCode()
	{
		throw new todo.TODO();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/04/29
	 */
	@Override
	public final ModifiersSyntax modifiers()
	{
		throw new todo.TODO();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/04/29
	 */
	@Override
	public final MethodName name()
	{
		throw new todo.TODO();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/04/28
	 */
	@Override
	public final String toString()
	{
		throw new todo.TODO();
	}
	
	/**
	 * Parses a single annotation method.
	 *
	 * @param __mods The modifiers to the method.
	 * @param __in The input tokens.
	 * @return The parsed annotation method.
	 * @throws NullPointerException On null arguments.
	 * @throws SyntaxParseException If it is not a valid method.
	 * @since 2018/04/28
	 */
	public static AnnotationMethodSyntax parse(ModifiersSyntax __mods,
		BufferedTokenSource __in)
		throws NullPointerException, SyntaxParseException
	{
		if (__mods == null || __in == null)
			throw new NullPointerException("NARG");
		
		throw new todo.TODO();
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


































































































































































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/syntax/AnnotationSyntax.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac.syntax;

import java.util.Arrays;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import net.multiphasicapps.classfile.MethodName;
import net.multiphasicapps.javac.syntax.expr.ExpressionSyntax;
import net.multiphasicapps.javac.syntax.expr.ExpressionSyntaxParsers;
import net.multiphasicapps.javac.token.BufferedTokenSource;
import net.multiphasicapps.javac.token.Token;
import net.multiphasicapps.javac.token.TokenSource;
import net.multiphasicapps.javac.token.TokenType;

/**
 * This represents a single annotation.
 *
 * @since 2018/04/21
 */
public final class AnnotationSyntax
	implements AnnotationValueSyntax, ModifierSyntax
{
	/** The identifier which identifies the annotation. */
	protected final QualifiedIdentifierSyntax identifier;
	
	/** The parameters to the annotation */
	private final AnnotationValueSyntax[] _values;
	
	/**
	 * Initializes the annotation which is just a marker.
	 *
	 * @param __qi The identifier used to identify the annotation.
	 * @param __values The values to the annotation.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/05/01
	 */
	public AnnotationSyntax(QualifiedIdentifierSyntax __qi,
		AnnotationValueSyntax... __values)
		throws NullPointerException
	{
		this(__qi, Arrays.<AnnotationValueSyntax>asList(
			(__values == null ? new AnnotationValueSyntax[0] : __values)));
	}
	
	/**
	 * Initializes the annotation which contains the given unparsed arguments.
	 *
	 * @param __qi The identifier used to identify the annotation.
	 * @param __values The values to the annotation.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/05/01
	 */
	public AnnotationSyntax(QualifiedIdentifierSyntax __qi,
		Iterable<AnnotationValueSyntax> __values)
		throws NullPointerException
	{
		if (__qi == null || __values == null)
			throw new NullPointerException("NARG");
		
		// Check values
		List<AnnotationValueSyntax> values = new ArrayList<>();
		for (AnnotationValueSyntax v : __values)
		{
			if (v == null)
				throw new NullPointerException("NARG");
			
			values.add(v);
		}
		
		this.identifier = __qi;
		this._values = values.<AnnotationValueSyntax>toArray(
			new AnnotationValueSyntax[values.size()]);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/04/21
	 */
	@Override
	public final boolean equals(Object __o)
	{
		if (__o == this)
			return true;
		
		if (!(__o instanceof AnnotationSyntax))
			return false;
		
		AnnotationSyntax o = (AnnotationSyntax)__o;
		return this.identifier.equals(o.identifier) &&
			Arrays.equals(this._values, o._values);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/04/21
	 */
	@Override
	public final int hashCode()
	{
		int hash = 0;
		for (Object v : this._values)
			hash ^= v.hashCode();
		
		return this.identifier.hashCode() ^ hash;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/04/21
	 */
	@Override
	public final String toString()
	{
		throw new todo.TODO();
	}
	
	/**
	 * This parses a single annotation.
	 *
	 * @param __in The input token source.
	 * @return The parsed annotation.
	 * @throws NullPointerException On null arguments.
	 * @throws SyntaxParseException If the annotation is not valid.
	 * @since 2018/04/21
	 */
	public static AnnotationSyntax parse(BufferedTokenSource __in)
		throws NullPointerException, SyntaxParseException
	{
		if (__in == null)
			throw new NullPointerException("NARG");
		
		// {@squirreljme.error AQ13 Expected at symbol at start of annotation.}
		Token token = __in.next();
		if (token.type() != TokenType.SYMBOL_AT)
			throw new SyntaxParseException(token, "AQ13");
		
		// Read qualified identifier which identifies the type used for the
		// annotation
		QualifiedIdentifierSyntax qi = QualifiedIdentifierSyntax.parse(__in);
		
		// If there is no open parenthesis then it is just a marker
		token = __in.peek();
		if (token.type() != TokenType.SYMBOL_OPEN_PARENTHESIS)
			return new AnnotationSyntax(qi);
		
		// Consume token, not needed
		__in.next();
		
		// Quick check to see if there are no values to parse
		token = __in.peek();
		if (token.type() == TokenType.SYMBOL_CLOSED_PARENTHESIS)
		{
			__in.next();
			return new AnnotationSyntax(qi);
		}
		
		// Annotations may now have values so handle them accordingly
		List<AnnotationValueSyntax> values = new ArrayList<>();
		for (;;)
		{
			// Read single annotation value which may be a key
			values.add(AnnotationSyntax.parseKey(__in));
			
			// No more values?
			token = __in.peek();
			if (token.type() == TokenType.SYMBOL_CLOSED_PARENTHESIS)
			{
				__in.next();
				break;
			}
			
			// Reading more of them
			else if (token.type() == TokenType.SYMBOL_COMMA)
			{
				__in.next();
				continue;
			}
			
			// {@squirreljme.error AQ14 Expected comma or closing parenthesis
			// at end of annotation expression.}
			else
				throw new SyntaxParseException(token, "AQ14");
		}
		
		// Build annotation
		return new AnnotationSyntax(qi, values);
	}
	
	/**
	 * Parses either a value or a key and a value.
	 *
	 * @param __in The input token source.
	 * @return The parsed value.
	 * @throws NullPointerException On null arguments.
	 * @throws SyntaxParseException If the value is not valid.
	 * @since 2018/05/03
	 */
	public static AnnotationValueSyntax parseKey(BufferedTokenSource __in)
		throws NullPointerException, SyntaxParseException
	{
		if (__in == null)
			throw new NullPointerException("NARG");
		
		Token token = __in.peek(),
			after = __in.peek(1);
		
		// Does this contain a key associated with a value?
		if (token.type() == TokenType.IDENTIFIER &&
			after.type() == TokenType.OPERATOR_ASSIGN)
		{
			// Consume identifier and the equals
			token = __in.next();
			after = __in.next();
			
			todo.DEBUG.note("Annotation kv: %s %s", token, after);
			
			// Setup key and parse value too
			return new AnnotationKeyValueSyntax(
				new MethodName(token.characters()),
				AnnotationSyntax.parseValue(__in));
		}
		
		// Just a value
		return AnnotationSyntax.parseValue(__in);
	}
	
	/**
	 * This parses a single value.
	 *
	 * @param __in The input token source.
	 * @return The parsed value.
	 * @throws NullPointerException On null arguments.
	 * @throws SyntaxParseException If the value is not valid.
	 * @since 2018/05/02
	 */
	public static AnnotationValueSyntax parseValue(BufferedTokenSource __in)
		throws NullPointerException, SyntaxParseException
	{
		if (__in == null)
			throw new NullPointerException("NARG");
		
		Token token = __in.peek();
		
		// Recursive read of annotation argument
		if (token.type() == TokenType.SYMBOL_AT)
			return AnnotationSyntax.parse(__in);
		
		// Is a kind of array
		else if (token.type() == TokenType.SYMBOL_OPEN_BRACE)
		{
			// Consume that
			__in.next();
			
			// Quick end of array value?
			token = __in.peek();
			if (token.type() == TokenType.SYMBOL_CLOSED_BRACE)
			{
				__in.next();
				return new AnnotationArrayValueSyntax();
			}
			
			// Read in values
			List<AnnotationValueSyntax> values = new ArrayList<>();
			for (;;)
			{
				// Read in next value
				values.add(AnnotationSyntax.parseValue(__in));
				
				// Stop parsing?
				token = __in.peek();
				if (token.type() == TokenType.SYMBOL_CLOSED_BRACE)
				{
					__in.next();
					break;
				}
				
				// Continue
				else if (token.type() == TokenType.SYMBOL_COMMA)
				{
					// Consume that
					__in.next();
					
					// There could be a comma before the closing brace
					token = __in.peek();
					if (token.type() == TokenType.SYMBOL_CLOSED_BRACE)
					{
						__in.next();
						break;
					}
					
					// Keep reading more
					continue;
				}
				
				// {@squirreljme.error AQ15 Expected comma or closing brace
				// after annotation value.}
				else
					throw new SyntaxParseException(token, "AQ15");
			}
			
			// Finish values
			return new AnnotationArrayValueSyntax(values);
		}
		
		// Normal expression
		else
			 return ExpressionSyntaxParsers.parseExpression(__in);
	}	
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
































































































































































































































































































































































































































































































































































































































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/syntax/AnnotationValueSyntax.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac.syntax;

/**
 * This interface is used to represent anything that can be used as a value
 * for an annotation.
 *
 * @since 2018/05/02
 */
public interface AnnotationValueSyntax
{
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<












































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/syntax/BasicFieldSyntax.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac.syntax;

import net.multiphasicapps.classfile.FieldName;
import net.multiphasicapps.javac.token.BufferedTokenSource;
import net.multiphasicapps.javac.token.Token;
import net.multiphasicapps.javac.token.TokenSource;
import net.multiphasicapps.javac.token.TokenType;

/**
 * This represents a basic field.
 *
 * @since 2018/04/28
 */
public final class BasicFieldSyntax
	implements FieldSyntax
{
	/**
	 * {@inheritDoc}
	 * @since 2018/04/28
	 */
	@Override
	public final boolean equals(Object __o)
	{
		throw new todo.TODO();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/04/28
	 */
	@Override
	public final int hashCode()
	{
		throw new todo.TODO();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/04/29
	 */
	@Override
	public final ModifiersSyntax modifiers()
	{
		throw new todo.TODO();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/04/29
	 */
	@Override
	public final FieldName name()
	{
		throw new todo.TODO();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/04/28
	 */
	@Override
	public final String toString()
	{
		throw new todo.TODO();
	}
	
	/**
	 * Parses a basic field that is contained within a class.
	 *
	 * @param __mods The modifiers to the field.
	 * @param __in The input tokens.
	 * @return The parsed field.
	 * @throws NullPointerException On null arguments.
	 * @throws SyntaxParseException If it is not a valid field.
	 * @since 2018/04/28
	 */
	public static BasicFieldSyntax parse(ModifiersSyntax __mods,
		BufferedTokenSource __in)
		throws NullPointerException, SyntaxParseException
	{
		if (__mods == null || __in == null)
			throw new NullPointerException("NARG");
		
		throw new todo.TODO();
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


































































































































































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/syntax/BasicModifierSyntax.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac.syntax;

/**
 * This represents a basic modifier.
 *
 * @since 2018/04/21
 */
public enum BasicModifierSyntax
	implements ModifierSyntax
{
	/** Public access. */
	PUBLIC,
	
	/** Protected access. */
	PROTECTED,
	
	/** Private access. */
	PRIVATE,
	
	/** Static access. */
	STATIC,
	
	/** Abstract. */
	ABSTRACT,
	
	/** Final. */
	FINAL,
	
	/** Native. */
	NATIVE,
	
	/** Synchronized. */
	SYNCHRONIZED,
	
	/** Transient. */
	TRANSIENT,
	
	/** Volatile. */
	VOLATILE,
	
	/** Strict floating point. */
	STRICTFP,
	
	/** End. */
	;
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


















































































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/syntax/BasicTypeSyntax.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac.syntax;

/**
 * This represents a basic type.
 *
 * @since 2018/04/30
 */
public enum BasicTypeSyntax
	implements SimpleTypeSyntax
{
	/** Byte. */
	BYTE,
	
	/** Short. */
	SHORT,
	
	/** Character. */
	CHARACTER,
	
	/** Integer. */
	INTEGER,
	
	/** Long. */
	LONG,
	
	/** Float. */
	FLOAT,
	
	/** Double. */
	DOUBLE,
	
	/** End. */
	;
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


























































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/syntax/ClassConstructorSyntax.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac.syntax;

import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import net.multiphasicapps.classfile.ClassIdentifier;
import net.multiphasicapps.classfile.MethodName;
import net.multiphasicapps.collections.UnmodifiableArrayList;
import net.multiphasicapps.javac.token.BufferedTokenSource;
import net.multiphasicapps.javac.token.Token;
import net.multiphasicapps.javac.token.TokenSource;
import net.multiphasicapps.javac.token.TokenType;

/**
 * This represents a constructor that is available for a class.
 *
 * @since 2018/04/28
 */
public final class ClassConstructorSyntax
	implements MapView, MethodSyntax
{
	/** ModifiersSyntax to the constructor. */
	protected final ModifiersSyntax modifiers;
	
	/** TypeSyntax parameters used. */
	protected final TypeParametersSyntax typeparameters;
	
	/** The identifier of the constructor. */
	protected final MethodName name;
	
	/** The code which makes up the constructor. */
	protected final UnparsedExpressions code;
	
	/** The formal parameters. */
	protected final FormalParametersSyntax parameters;
	
	/** The thrown classes. */
	private final QualifiedIdentifierSyntax[] _thrown;
	
	/** Map view. */
	private Reference<Map<String, Object>> _map;
	
	/** String form. */
	private Reference<String> _string;
	
	/**
	 * Initializes the constructor information.
	 *
	 * @param __mods Constructor modifiers.
	 * @param __tparms TypeSyntax parameters used.
	 * @param __ident The identifier for the constructor.
	 * @param __params TypeSyntax parameters.
	 * @param __thrown Exceptions which are thrown by the constructor.
	 * @param __code The code which makes up the constructor.
	 * @throws NullPointerException On null arguments.
	 * @throws SyntaxDefinitionException If the definition is not valid.
	 * @since 2018/04/29
	 */
	public ClassConstructorSyntax(ModifiersSyntax __mods,
		TypeParametersSyntax __tparms, ClassIdentifier __ident,
		FormalParametersSyntax __params, QualifiedIdentifierSyntax[] __thrown,
		UnparsedExpressions __code)
		throws NullPointerException, SyntaxDefinitionException
	{
		if (__mods == null || __tparms == null || __ident == null ||
			__params == null || __thrown == null || __code == null)
			throw new NullPointerException("NARG");
		
		// Check throwables for null
		Set<QualifiedIdentifierSyntax> thrown = new LinkedHashSet<>();
		for (QualifiedIdentifierSyntax t : (__thrown = __thrown.clone()))
		{
			if (t == null)
				throw new NullPointerException("NARG");
			
			// {@squirreljme.error AQ16 Duplicated throw statement. (The throw
			// statement which was duplicated)}
			if (thrown.contains(t))
				throw new SyntaxDefinitionException(
					String.format("AQ16 %s", t));
			
			thrown.add(t);
		}
		
		// {@squirreljme.error AQ17 Illegal modifiers specified for class
		// constructor. (The modifiers)}
		if (__mods.isStatic() || __mods.isAbstract() || __mods.isFinal() ||
			__mods.isNative() || __mods.isSynchronized() ||
			__mods.isTransient() || __mods.isVolatile() ||
			__mods.isStrictFloatingPoint())
			throw new SyntaxDefinitionException(
				String.format("AQ17 %s", __mods));
		
		this.modifiers = __mods;
		this.typeparameters = __tparms;
		this.name = new MethodName(__ident.toString());
		this.parameters = __params;
		this.code = __code;
		this._thrown = __thrown;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2019/01/17
	 */
	@Override
	public Map<String, Object> asMap()
	{
		Reference<Map<String, Object>> ref = this._map;
		Map<String, Object> rv;
		
		if (ref == null || null == (rv = ref.get()))
			this._map = new WeakReference<>((rv = new __TreeBuilder__().
				add("modifiers", this.modifiers).
				add("typeparams", this.typeparameters).
				add("name", this.name).
				add("parameters", this.parameters).
				addList("thrown", (Object[])this._thrown).
				add("code", this.code).build()));
		
		return rv;
	}
	
	/**
	 * Returns the code for this constructor if there is any.
	 *
	 * @return The method code, may be {@code null} if there is none.
	 * @since 2018/05/08
	 */
	public final UnparsedExpressions code()
	{
		return this.code;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/04/28
	 */
	@Override
	public final boolean equals(Object __o)
	{
		throw new todo.TODO();
	}
	
	/**
	 * Returns the formal parameters for the constructor.
	 *
	 * @return The constructor formal parameters.
	 * @since 2018/05/08
	 */
	public final FormalParametersSyntax formalParameters()
	{
		return this.parameters;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/04/28
	 */
	@Override
	public final int hashCode()
	{
		throw new todo.TODO();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/04/29
	 */
	@Override
	public final ModifiersSyntax modifiers()
	{
		return this.modifiers;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/04/29
	 */
	@Override
	public final MethodName name()
	{
		return this.name;
	}
	
	/**
	 * Returns the types which are thrown from this constructor.
	 *
	 * @return The types which are thrown.
	 * @since 2018/05/08
	 */
	public final List<QualifiedIdentifierSyntax> thrownTypes()
	{
		return UnmodifiableArrayList.<QualifiedIdentifierSyntax>of(
			this._thrown);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/04/28
	 */
	@Override
	public final String toString()
	{
		Reference<String> ref = this._string;
		String rv;
		
		if (ref == null || null == (rv = ref.get()))
			this._string = new WeakReference<>((rv = this.asMap().toString()));
		
		return rv;
	}
	
	/**
	 * Returns the type parameters for the constructor.
	 *
	 * @return The constructor type parameters.
	 * @since 2018/05/08
	 */
	public final TypeParametersSyntax typeParameters()
	{
		return this.typeparameters;
	}
	
	/**
	 * Parses a single class constrictor.
	 *
	 * @param __mods The modifiers to the method.
	 * @param __typeparams TypeSyntax parameters.
	 * @param __in The input tokens.
	 * @return The parsed constructor.
	 * @throws NullPointerException On null arguments.
	 * @throws SyntaxParseException If it is not a valid constructor.
	 * @since 2018/04/28
	 */
	public static ClassConstructorSyntax parse(ModifiersSyntax __mods,
		TypeParametersSyntax __typeparams, BufferedTokenSource __in)
		throws NullPointerException, SyntaxParseException
	{
		if (__mods == null || __typeparams == null || __in == null)
			throw new NullPointerException("NARG");
		
		// {@squirreljme.error AQ18 Expected identifier at start of
		// constructor.}
		Token token = __in.next();
		if (token.type() != TokenType.IDENTIFIER)
			throw new SyntaxParseException(token, "AQ18");
		ClassIdentifier identifier = new ClassIdentifier(token.characters());
		
		// Parse formal parameters
		FormalParametersSyntax params = FormalParametersSyntax.parse(__in);
		
		// Parse throws
		QualifiedIdentifierSyntax[] thrown;
		token = __in.peek();
		if (token.type() == TokenType.KEYWORD_THROWS)
		{
			__in.next();
			thrown = QualifiedIdentifierSyntax.parseList(__in);
		}
		else
			thrown = new QualifiedIdentifierSyntax[0];
		
		// Parse constructor block and build
		return new ClassConstructorSyntax(__mods, __typeparams, identifier,
			params, thrown, UnparsedExpressions.parseBlock(__in));
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




















































































































































































































































































































































































































































































































































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/syntax/ClassInitializerSyntax.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac.syntax;

import net.multiphasicapps.classfile.MethodName;
import net.multiphasicapps.javac.token.BufferedTokenSource;
import net.multiphasicapps.javac.token.Token;
import net.multiphasicapps.javac.token.TokenSource;
import net.multiphasicapps.javac.token.TokenType;

/**
 * This represents an initializer for a method.
 *
 * @since 2018/04/28
 */
public final class ClassInitializerSyntax
	implements MethodSyntax
{
	/**
	 * {@inheritDoc}
	 * @since 2018/04/28
	 */
	@Override
	public final boolean equals(Object __o)
	{
		throw new todo.TODO();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/04/28
	 */
	@Override
	public final int hashCode()
	{
		throw new todo.TODO();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/04/29
	 */
	@Override
	public final ModifiersSyntax modifiers()
	{
		throw new todo.TODO();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/04/29
	 */
	@Override
	public final MethodName name()
	{
		throw new todo.TODO();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/04/28
	 */
	@Override
	public final String toString()
	{
		throw new todo.TODO();
	}
	
	/**
	 * Parses a single class initializer.
	 *
	 * @param __mods The modifiers to the method.
	 * @param __in The input tokens.
	 * @return The parsed initializer.
	 * @throws NullPointerException On null arguments.
	 * @throws SyntaxParseException If it is not a valid method.
	 * @since 2018/04/28
	 */
	public static ClassInitializerSyntax parse(ModifiersSyntax __mods,
		BufferedTokenSource __in)
		throws NullPointerException, SyntaxParseException
	{
		if (__mods == null || __in == null)
			throw new NullPointerException("NARG");
		
		throw new todo.TODO();
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


































































































































































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/syntax/ClassSyntax.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac.syntax;

import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import net.multiphasicapps.classfile.ClassIdentifier;
import net.multiphasicapps.classfile.FieldName;
import net.multiphasicapps.classfile.MethodName;
import net.multiphasicapps.collections.UnmodifiableArrayList;
import net.multiphasicapps.javac.token.BufferedTokenSource;
import net.multiphasicapps.javac.token.Token;
import net.multiphasicapps.javac.token.TokenSource;
import net.multiphasicapps.javac.token.TokenType;

/**
 * This class represents the structure of a class, it will contains members
 * such as fields, methods, and other classes.
 *
 * @since 2018/04/21
 */
public final class ClassSyntax
	implements MapView, MemberSyntax
{
	/** The type of class this is. */
	protected final ClassSyntaxType type;
	
	/** The modifiers to the class. */
	protected final ModifiersSyntax modifiers;
	
	/** The name of the class. */
	protected final ClassIdentifier name;
	
	/** The type parameters of the class. */
	protected final TypeParametersSyntax typeparams;
	
	/** The extending types. */
	private final TypeSyntax[] _extends;
	
	/** The implementing types. */
	private final TypeSyntax[] _implements;
	
	/** The members of the class. */
	private final MemberSyntax[] _members;
	
	/** Map view. */
	private Reference<Map<String, Object>> _map;
	
	/** String form. */
	private Reference<String> _string;
	
	/**
	 * Initializes the class structure information.
	 *
	 * @param __structtype The type of structure used.
	 * @param __mods The modifiers to the class.
	 * @param __name The name of the class.
	 * @param __typeparms The type parameters of the class.
	 * @param __extending The classes this class extends.
	 * @param __implementing The classes this class implements.
	 * @param __members The members of this class.
	 * @throws NullPointerException On null arguments.
	 * @throws SyntaxDefinitionException If the structure is not valid.
	 * @since 2018/04/27
	 */
	public ClassSyntax(ClassSyntaxType __structtype, ModifiersSyntax __mods,
		ClassIdentifier __name, TypeParametersSyntax __typeparms,
		TypeSyntax[] __extending, TypeSyntax[] __implementing,
		MemberSyntax[] __members)
		throws NullPointerException, SyntaxDefinitionException
	{
		if (__structtype == null || __mods == null || __name == null ||
			__typeparms == null || __extending == null ||
			__implementing == null || __members == null)
			throw new NullPointerException();
		
		// {@squirreljme.error AQ19 Illegal class modifiers specified with the
		// the given class type. (The class type; The class modifiers)}
		if (__mods.isNative() || __mods.isVolatile() || __mods.isTransient() ||
			__mods.isSynchronized() ||
			(__structtype == ClassSyntaxType.ENUM &&
				(__mods.isAbstract() || __mods.isFinal())) ||
			(__structtype == ClassSyntaxType.INTERFACE &&
				(__mods.isFinal())))
			throw new SyntaxDefinitionException(String.format("AQ19 %s %s",
				__structtype, __mods));
		
		// Check extends
		Set<TypeSyntax> doext = new LinkedHashSet<>();
		for (TypeSyntax t : __extending)
		{
			if (t == null)
				throw new NullPointerException("NARG");
			
			// {@squirreljme.error AQ1a Duplicate extends specified.
			// (The type)}
			if (doext.contains(t))
				throw new SyntaxDefinitionException(String.format("AQ1a %s",
					t));
			
			doext.add(t);
		}
		
		// {@squirreljme.error AQ1b The specified class of the given type
		// cannot extend the given types. (The class type; The inherited types}
		if (!__structtype.extendsType().isCompatibleCount(doext.size()))
			throw new SyntaxDefinitionException(
				String.format("AQ1b %s %s", __structtype, doext));
		
		// Check implements
		Set<TypeSyntax> doimp = new LinkedHashSet<>();
		for (TypeSyntax t : __implementing)
		{
			if (t == null)
				throw new NullPointerException("NARG");
			
			// {@squirreljme.error AQ1c Duplicate implements specified.
			// (The type)}
			if (doimp.contains(t))
				throw new SyntaxDefinitionException(String.format("AQ1c %s",
					t));
			
			doimp.add(t);
		}
		
		// {@squirreljme.error AQ1d The specified class of the given type
		// cannot implement the given types. (The class type; The inherited
		// types}
		if (!__structtype.implementsType().isCompatibleCount(doimp.size()))
			throw new SyntaxDefinitionException(
				String.format("AQ1d %s %s", __structtype, doext));
		
		// Check members
		List<MemberSyntax> membs = new ArrayList<>();
		for (MemberSyntax member : __members)
		{
			if (member == null)
				throw new NullPointerException("NARG");
			
			// Interfaces
			if (__structtype == ClassSyntaxType.INTERFACE)
			{
				// {@squirreljme.error AQ1e An interface cannot contain a
				// member represented by the given type. (The class type)}
				if (member instanceof ClassInitializerSyntax ||
					member instanceof ClassConstructorSyntax ||
					member instanceof AnnotationMethodSyntax ||
					member instanceof EnumFieldSyntax)
					throw new SyntaxDefinitionException(
						String.format("AQ1e %s", member.getClass()));
			}
			
			// Annotations
			else if (__structtype == ClassSyntaxType.ANNOTATION)
			{
				// {@squirreljme.error AQ1f An annotation cannot contain a
				// member represented by the given type. (The class type)}
				if (!(member instanceof ClassSyntax ||
					member instanceof BasicFieldSyntax ||
					member instanceof AnnotationMethodSyntax))
					throw new SyntaxDefinitionException(
						String.format("AQ1f %s", member.getClass()));
			}
			
			// Normal class or enum
			else
			{
				// {@squirreljme.error AQ1g An class or enum cannot contain a
				// member represented by the given type. (The class type)}
				if (member instanceof AnnotationMethodSyntax)
					throw new SyntaxDefinitionException(
						String.format("AQ1g %s", member.getClass()));
			}
			
			// Check constructor
			if (member instanceof ClassConstructorSyntax)
			{
				ClassConstructorSyntax c = (ClassConstructorSyntax)member;
				
				// {@squirreljme.error AQ1h Class constructor name does not
				// match the name of the class. (This class name; The
				// constructor name)}
				if (!__name.toString().equals(c.name().toString()))
					throw new SyntaxDefinitionException(
						String.format("AQ1h %s %s", __name, c.name()));
			}
			
			// Is valid
			membs.add(member);
		}
		
		// Set
		this.type = __structtype;
		this.modifiers = __mods;
		this.name = __name;
		this.typeparams = __typeparms;
		this._extends = doext.<TypeSyntax>toArray(
			new TypeSyntax[doext.size()]);
		this._implements = doimp.<TypeSyntax>toArray(
			new TypeSyntax[doimp.size()]);
		this._members = membs.<MemberSyntax>toArray(
			new MemberSyntax[membs.size()]);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2019/01/17
	 */
	@Override
	public Map<String, Object> asMap()
	{
		Reference<Map<String, Object>> ref = this._map;
		Map<String, Object> rv;
		
		if (ref == null || null == (rv = ref.get()))
			this._map = new WeakReference<>((rv = new __TreeBuilder__().
				add("type", this.type).
				add("modifiers", this.modifiers).
				add("name", this.name).
				add("typeparams", this.typeparams).
				addList("extends", (Object[])this._extends).
				addList("implements", (Object[])this._implements).
				addList("members", (Object[])this._members).build()));
		
		return rv;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/05/08
	 */
	@Override
	public final boolean equals(Object __o)
	{
		throw new todo.TODO();
	}
	
	/**
	 * Returns the types this class extends.
	 *
	 * @return The classes which this extends.
	 * @since 2018/05/08
	 */
	public final List<TypeSyntax> extending()
	{
		return UnmodifiableArrayList.<TypeSyntax>of(this._extends);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/05/08
	 */
	@Override
	public final int hashCode()
	{
		return this.type.hashCode() ^
			this.modifiers.hashCode() ^
			this.name.hashCode() ^
			this.typeparams.hashCode() ^
			Arrays.asList(this._extends).hashCode() ^
			Arrays.asList(this._implements).hashCode() ^
			Arrays.asList(this._members).hashCode();
	}
	
	/**
	 * Returns the types this class implements.
	 *
	 * @return The classes this implements.
	 * @since 2018/05/08
	 */
	public final List<TypeSyntax> implementing()
	{
		return UnmodifiableArrayList.<TypeSyntax>of(this._implements);
	}
	
	/**
	 * Returns the members of this class.
	 *
	 * @return The class members.
	 * @since 2018/05/08
	 */
	public final List<MemberSyntax> members()
	{
		return UnmodifiableArrayList.<MemberSyntax>of(this._members);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/04/29
	 */
	@Override
	public final ModifiersSyntax modifiers()
	{
		return this.modifiers;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/04/29
	 */
	@Override
	public final ClassIdentifier name()
	{
		return this.name;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/05/08
	 */
	@Override
	public final String toString()
	{
		Reference<String> ref = this._string;
		String rv;
		
		if (ref == null || null == (rv = ref.get()))
			this._string = new WeakReference<>((rv = this.asMap().toString()));
		
		return rv;
	}
	
	/**
	 * Returns the type of class this is.
	 *
	 * @return The class type.
	 * @since 2018/05/08
	 */
	public final ClassSyntaxType type()
	{
		return this.type;
	}
	
	/**
	 * Returns the type parameters for this class.
	 *
	 * @return The type parameters used.
	 * @since 2018/05/08
	 */
	public final TypeParametersSyntax typeParameters()
	{
		return this.typeparams;
	}
	
	/**
	 * Parses the body of the class.
	 *
	 * @param __structtype The structure type of the class.
	 * @param __in The input token source.
	 * @return The parsed members of the class.
	 * @throws NullPointerException On null arguments.
	 * @throws SyntaxParseException If the members of the body are not
	 * correct.
	 * @since 2018/04/27
	 */
	public static MemberSyntax[] parseClassBody(
		ClassSyntaxType __structtype, BufferedTokenSource __in)
		throws NullPointerException, SyntaxParseException
	{
		if (__in == null)
			throw new NullPointerException("NARG");
		
		// {@squirreljme.error AQ1i Expected opening brace at start of class.}
		Token token = __in.next();
		if (token.type() != TokenType.SYMBOL_OPEN_BRACE)
			throw new SyntaxParseException(token, "AQ1i");
		
		// Parse the enumeration constants, their fields and their class
		// values
		if (__structtype == ClassSyntaxType.ENUM)
		{
			throw new todo.TODO();
		}
		
		// Member parsing loop
		List<MemberSyntax> rv = new ArrayList<>();
		for (;;)
		{
			// End of members?
			token = __in.peek();
			if (token.type() == TokenType.SYMBOL_CLOSED_BRACE)
				return rv.<MemberSyntax>toArray(
					new MemberSyntax[rv.size()]);
			
			// Ignore semi-colons just lying around in the class
			else if (token.type() == TokenType.SYMBOL_SEMICOLON)
				continue;
			
			// Parse modifiers since this will modify how things are parsed
			ModifiersSyntax mods = ModifiersSyntax.parse(__in);
			
			// Always try to parse a class since any kind of class can include
			// classes
			try
			{
				// Parse the class
				__in.mark();
				rv.add(ClassSyntax.parseEntireClass(mods, __in));
				
				// Do not try parsing anything else for now
				__in.commit();
				continue;
			}
			catch (SyntaxParseException e)
			{
				__in.reset();
			}
			
			// Try to parse a method
			try
			{
				// Parse method
				__in.mark();
				rv.add(ClassSyntax.parseMethod(__structtype, mods, __in));
				
				// Valid method
				__in.commit();
				continue;
			}
			catch (SyntaxParseException e)
			{
				__in.reset();
			}
			
			// Try to parse a field
			try
			{
				// Parse field
				__in.mark();
				rv.add(ClassSyntax.parseField(__structtype, mods, __in));
				
				// Valid field
				__in.commit();
				continue;
			}
			catch (SyntaxParseException e)
			{
				__in.reset();
			}
			
			// {@squirreljme.error AQ1j The specified token does not
			// represent a member that is a class, field, or method.}
			throw new SyntaxParseException(__in, "AQ1j");
		}
	}
	
	/**
	 * Attempts to parse an entire class.
	 *
	 * @param __mods Class modifiers.
	 * @param __in The input token source.
	 * @return The parsed class structure.
	 * @throws NullPointerException On null arguments.
	 * @throws SyntaxParseException If this is not a class.
	 * @since 2018/04/22
	 */
	public static ClassSyntax parseEntireClass(ModifiersSyntax __mods,
		BufferedTokenSource __in)
		throws NullPointerException, SyntaxParseException
	{
		if (__mods == null || __in == null)
			throw new NullPointerException("NARG");
		
		Token token;
		
		// Determine the class type based on the next token
		ClassSyntaxType structtype;
		token = __in.next();
		switch (token.type())
		{
			case KEYWORD_CLASS:
				structtype = ClassSyntaxType.CLASS;
				break;
				
			case KEYWORD_ENUM:
				structtype = ClassSyntaxType.ENUM;
				break;
				
			case KEYWORD_INTERFACE:
				structtype = ClassSyntaxType.INTERFACE;
				break;
			
				// {@squirreljme.error AQ1k Expected interface to follow
				// at symbol for declaring an annotation type.}
			case SYMBOL_AT:
				token = __in.next();
				if (token.type() != TokenType.KEYWORD_INTERFACE)
					throw new SyntaxParseException(token, "AQ1k");
				structtype = ClassSyntaxType.ANNOTATION;
				break;
			
				// {@squirreljme.error AQ1l Unknown token while parsing class.}
			default:
				throw new SyntaxParseException(token, "AQ1l");
		}
		
		// {@squirreljme.error AQ1m Expected identifier to name the class as.}
		token = __in.next();
		if (token.type() != TokenType.IDENTIFIER)
			throw new SyntaxParseException(token, "AQ1m");
		ClassIdentifier name = new ClassIdentifier(token.characters());
		
		// Read type parameters?
		token = __in.peek();
		TypeParametersSyntax typeparms;
		if (structtype.hasTypeParameters() &&
			token.type() == TokenType.COMPARE_LESS_THAN)
			typeparms = TypeParametersSyntax.parse(__in);
		else
			typeparms = new TypeParametersSyntax();
		
		// Read extends
		token = __in.peek();
		TypeSyntax[] extending;
		if (token.type() == TokenType.KEYWORD_EXTENDS)
		{
			// Consume and parse list
			__in.next();
			switch (structtype.extendsType())
			{
				case SINGLE:
					extending = new TypeSyntax[]{TypeSyntax.parseType(__in)};
					break;
					
				case MULTIPLE:
					extending = TypeSyntax.parseTypes(__in);
					break;
					
					// {@squirreljme.error AQ1n This type of class cannot
					// extend other classes.}
				default:
					throw new SyntaxParseException(token, "AQ1n");
			}
		}
		else
			extending = new TypeSyntax[0];
		
		// Read implements
		token = __in.peek();
		TypeSyntax[] implementing;
		if (token.type() == TokenType.KEYWORD_IMPLEMENTS)
		{
			// Consume and parse list
			__in.next();
			switch (structtype.extendsType())
			{
				case MULTIPLE:
					implementing = TypeSyntax.parseTypes(__in);
					break;
					
					// {@squirreljme.error AQ1o This type of class cannot
					// implement interfaces.}
				default:
					throw new SyntaxParseException(token, "AQ1o");
			}
		}
		else
			implementing = new TypeSyntax[0];
		
		// Read class body which contains all the members
		MemberSyntax[] members = ClassSyntax.parseClassBody(structtype,
			__in);
		
		// {@squirreljme.error AQ1p Expected closing brace at end of class.}
		token = __in.next();
		if (token.type() != TokenType.SYMBOL_CLOSED_BRACE)
			throw new SyntaxParseException(token, "AQ1p");
		
		// Build class structure
		return new ClassSyntax(structtype, __mods, name, typeparms,
			extending, implementing, members);
	}
	
	/**
	 * Parses a single field which is appropriate for a given class type.
	 *
	 * @param __ct The structure of the class.
	 * @param __mods The modifiers to the field.
	 * @param __in The input tokens.
	 * @return The parsed field.
	 * @throws NullPointerException On null arguments.
	 * @throws SyntaxParseException If it is not a valid field.
	 * @since 2018/04/28
	 */
	public static FieldSyntax parseField(ClassSyntaxType __ct,
		ModifiersSyntax __mods, BufferedTokenSource __in)
		throws NullPointerException, SyntaxParseException
	{
		if (__ct == null || __mods == null || __in == null)
			throw new NullPointerException("NARG");
		
		// Always parse basic fields
		return BasicFieldSyntax.parse(__mods, __in);
	}
	
	/**
	 * Parses a single method which is appropriate for a given class type.
	 *
	 * @param __ct The structure of the class.
	 * @param __mods The modifiers to the method.
	 * @param __in The input tokens.
	 * @return The parsed method.
	 * @throws NullPointerException On null arguments.
	 * @throws SyntaxParseException If it is not a valid method.
	 * @since 2018/04/28
	 */
	public static MethodSyntax parseMethod(ClassSyntaxType __ct,
		ModifiersSyntax __mods, BufferedTokenSource __in)
		throws NullPointerException, SyntaxParseException
	{
		if (__ct == null || __mods == null || __in == null)
			throw new NullPointerException("NARG");
		
		// Annotations only have a single format
		if (__ct == ClassSyntaxType.ANNOTATION)
			return AnnotationMethodSyntax.parse(__mods, __in);
		
		// Initializer method?
		Token token = __in.peek();
		if ((__ct == ClassSyntaxType.CLASS ||
			__ct == ClassSyntaxType.ENUM) &&
			token.type() == TokenType.SYMBOL_OPEN_BRACE)
			try
			{
				// Might not be one
				__in.mark();
				ClassInitializerSyntax rv = ClassInitializerSyntax.
					parse(__mods, __in);
				
				// Is one
				__in.commit();
				return rv;
			}
			catch (SyntaxParseException e)
			{
				__in.reset();
			}
		
		// Parse any type parameters which are used
		TypeParametersSyntax typeparams;
		token = __in.peek();
		if (__ct != ClassSyntaxType.ANNOTATION &&
			token.type() == TokenType.COMPARE_LESS_THAN)
			typeparams = TypeParametersSyntax.parse(__in);
		else
			typeparams = new TypeParametersSyntax();
		
		// Constructor?
		token = __in.peek();
		if (__ct != ClassSyntaxType.INTERFACE &&
			token.type() == TokenType.IDENTIFIER &&
			__in.peek(1).type() == TokenType.SYMBOL_OPEN_PARENTHESIS)
			try
			{
				// Could be one
				__in.mark();
				ClassConstructorSyntax rv = ClassConstructorSyntax.
					parse(__mods, typeparams, __in);
				
				// Is one
				__in.commit();
				return rv;
			}
			catch (SyntaxParseException e)
			{
				__in.reset();
			}
		
		// General method
		return SimpleMethodSyntax.parse(__mods, typeparams, __in);
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/syntax/ClassSyntaxType.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac.syntax;

/**
 * This represents the type of class.
 *
 * @since 2018/04/21
 */
public enum ClassSyntaxType
{
	/** Normal class. */
	CLASS,
	
	/** Interface. */
	INTERFACE,
	
	/** Enumeration. */
	ENUM,
	
	/** Annotation. */
	ANNOTATION,
	
	/** End. */
	;
	
	/**
	 * Returns the type of inheritence that is used for extends.
	 *
	 * @return The inheritence type used for extends.
	 * @since 2018/04/24
	 */
	public final InheritenceTypeSyntax extendsType()
	{
		if (this == CLASS)
			return InheritenceTypeSyntax.SINGLE;
		else if (this == INTERFACE)
			return InheritenceTypeSyntax.MULTIPLE;
		return InheritenceTypeSyntax.NONE;
	}
	
	/**
	 * Does this type have type parameters?
	 *
	 * @return If it has type parameters.
	 * @since 2018/04/24
	 */
	public final boolean hasTypeParameters()
	{
		return this == CLASS || this == INTERFACE;
	}
	
	/**
	 * Returns the inheritence type used for implements.
	 *
	 * @return The inheritence type for implements.
	 * @since 2018/04/24
	 */
	public final InheritenceTypeSyntax implementsType()
	{
		if (this == CLASS || this == ENUM)
			return InheritenceTypeSyntax.MULTIPLE;
		return InheritenceTypeSyntax.NONE;
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




















































































































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/syntax/CompilationUnitSyntax.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac.syntax;

import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import net.multiphasicapps.classfile.BinaryName;
import net.multiphasicapps.collections.UnmodifiableArrayList;
import net.multiphasicapps.javac.token.BufferedTokenSource;
import net.multiphasicapps.javac.token.Token;
import net.multiphasicapps.javac.token.TokenSource;
import net.multiphasicapps.javac.token.TokenType;

/**
 * This represents the compilation unit which contains the package, the
 * import statements, and any declared classes.
 *
 * @since 2018/04/21
 */
public final class CompilationUnitSyntax
	implements MapView
{
	/** The modifiers for the package. */
	protected final ModifiersSyntax modifiers;
	
	/** The package this compilation unit is in. */
	protected final QualifiedIdentifierSyntax inpackage;
	
	/** The imports being performed. */
	private final ImportStatementSyntax[] _imports;
	
	/** The classes being declared. */
	private final ClassSyntax[] _classes;
	
	/** Map view. */
	private Reference<Map<String, Object>> _map;
	
	/** String form. */
	private Reference<String> _string;
	
	/**
	 * Initializes the compilation unit.
	 *
	 * @param __pmod The modifiers to the package.
	 * @param __pk The owning package.
	 * @throws NullPointerException On null arguments.
	 * @throws SyntaxDefinitionException If the compilation unit is not
	 * valid.
	 * @since 2018/04/30
	 */
	public CompilationUnitSyntax(ModifiersSyntax __pmod,
		QualifiedIdentifierSyntax __pk)
		throws NullPointerException, SyntaxDefinitionException
	{
		if (__pmod == null || __pk == null)
			throw new NullPointerException("NARG");
		
		// {@squirreljme.error AQ1q Only annotation are valid modifiers for
		// packages.}
		if (__pmod.isPublic() || __pmod.isProtected() || __pmod.isPrivate() ||
			__pmod.isStatic() || __pmod.isAbstract() || __pmod.isFinal() ||
			__pmod.isNative() || __pmod.isSynchronized() ||
			__pmod.isTransient() || __pmod.isVolatile() ||
			__pmod.isStrictFloatingPoint())
			throw new SyntaxDefinitionException(
				String.format("AQ1q %s", __pmod));
		
		this.modifiers = __pmod;
		this.inpackage = __pk;
		this._imports = new ImportStatementSyntax[0];
		this._classes = new ClassSyntax[0];
	}
	
	/**
	 * Initializes the compilation unit.
	 *
	 * @param __pk The owning package.
	 * @param __imports Imports that are used.
	 * @param __classes Classes which have been declared.
	 * @throws NullPointerException On null arguments.
	 * @throws SyntaxDefinitionException If the compilation unit is not
	 * valid.
	 * @since 2018/04/30
	 */
	public CompilationUnitSyntax(QualifiedIdentifierSyntax __pk,
		ImportStatementSyntax[] __imports, ClassSyntax[] __classes)
		throws NullPointerException, SyntaxDefinitionException
	{
		this(__pk, Arrays.<ImportStatementSyntax>asList(
			__imports == null ? new ImportStatementSyntax[0] : __imports),
			Arrays.<ClassSyntax>asList(__classes == null ?
			new ClassSyntax[0] : __classes));
	}
	
	/**
	 * Initializes the compilation unit.
	 *
	 * @param __pk The owning package.
	 * @param __imports Imports that are used.
	 * @param __classes Classes which have been declared.
	 * @throws NullPointerException On null arguments, except for {@code __pk}.
	 * @throws SyntaxDefinitionException If the compilation unit is not
	 * valid.
	 * @since 2018/04/30
	 */
	public CompilationUnitSyntax(QualifiedIdentifierSyntax __pk,
		Iterable<ImportStatementSyntax> __imports,
		Iterable<ClassSyntax> __classes)
		throws NullPointerException, SyntaxDefinitionException
	{
		if (__imports == null || __classes == null)
			throw new NullPointerException("NARG");
		
		// Check imports
		Set<ImportStatementSyntax> imports = new LinkedHashSet<>();
		for (ImportStatementSyntax v : __imports)
		{
			if (v == null)
				throw new NullPointerException("NARG");
			
			imports.add(v);
		}
		
		// Check classes
		List<ClassSyntax> classes = new ArrayList<>();
		for (ClassSyntax v : __classes)
		{
			if (v == null)
				throw new NullPointerException("NARG");
			
			// {@squirreljme.error AQ1r Classes contained within a compilation
			// unit cannot be static, protected, or private. (The modifiers)}
			ModifiersSyntax modifiers = v.modifiers();
			if (modifiers.isStatic() || modifiers.isProtected() ||
				modifiers.isPrivate())
				throw new SyntaxDefinitionException(
					String.format("AQ1r %s", modifiers));
			
			// Is okay to use
			classes.add(v);
		}
		
		this.modifiers = new ModifiersSyntax();
		this.inpackage = __pk;
		this._imports = imports.<ImportStatementSyntax>toArray(
			new ImportStatementSyntax[imports.size()]);
		this._classes = classes.<ClassSyntax>toArray(
			new ClassSyntax[classes.size()]);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2019/01/17
	 */
	@Override
	public Map<String, Object> asMap()
	{
		Reference<Map<String, Object>> ref = this._map;
		Map<String, Object> rv;
		
		if (ref == null || null == (rv = ref.get()))
			this._map = new WeakReference<>((rv = new __TreeBuilder__().
				add("packagemodifiers", this.modifiers).
				add("package", this.inpackage).
				addList("imports", (Object[])this._imports).
				addList("classes", (Object[])this._classes).build()));
		
		return rv;
	}
	
	/**
	 * Returns the classes which have been defined.
	 *
	 * @return The defined classes.
	 * @since 2018/05/07
	 */
	public final List<ClassSyntax> classes()
	{
		return UnmodifiableArrayList.<ClassSyntax>of(this._classes);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/04/21
	 */
	@Override
	public final boolean equals(Object __o)
	{
		throw new todo.TODO();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/04/21
	 */
	@Override
	public final int hashCode()
	{
		throw new todo.TODO();
	}
	
	/**
	 * Returns the package that this compilation unit is within.
	 *
	 * @return The package of the compilation unit or {@code null} if it is
	 * not in one.
	 * @since 2018/05/07
	 */
	public final BinaryName inPackage()
	{
		QualifiedIdentifierSyntax inpackage = this.inpackage;
		return (inpackage == null ? null : inpackage.name());
	}
	
	/**
	 * Returns the modifiers used for the package.
	 *
	 * @return The package modifiers.
	 * @since 2018/05/07
	 */
	public final ModifiersSyntax packageModifiers()
	{
		return this.modifiers;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/04/21
	 */
	@Override
	public final String toString()
	{
		Reference<String> ref = this._string;
		String rv;
		
		if (ref == null || null == (rv = ref.get()))
			this._string = new WeakReference<>((rv = this.asMap().toString()));
		
		return rv;
	}
	
	/**
	 * Parses the compilation unit of the class file.
	 *
	 * @param __in The input token source.
	 * @return The parsed compilation unit.
	 * @throws NullPointerException On null arguments.
	 * @throws SyntaxParseException If the syntax is not valid.
	 * @since 2018/04/21
	 */
	public static CompilationUnitSyntax parse(BufferedTokenSource __in)
		throws NullPointerException, SyntaxParseException
	{
		if (__in == null)
			throw new NullPointerException("NARG");
		
		// This may be set early for class parse
		ModifiersSyntax modifiers = null;
		
		// The package the class is in, if it is in one
		QualifiedIdentifierSyntax inpackage = null;
		
		// This may be a package-info file which contains annotations
		// associated with a package
		// Detect annotation types here in the event they have no modifiers
		Token token = __in.peek();
		if (token.type() == TokenType.SYMBOL_AT &&
			__in.peek(1).type() != TokenType.KEYWORD_INTERFACE)
			modifiers = ModifiersSyntax.parse(__in);
		
		// Read in the package statement, if it is there
		token = __in.peek();
		if (token.type() == TokenType.KEYWORD_PACKAGE)
		{
			// Consume package
			__in.next();
			
			// Read package declaration
			inpackage = QualifiedIdentifierSyntax.parse(__in);
			
			// {@squirreljme.error AQ1s Expected semi-colon to follow the
			// package statement.}
			token = __in.next();
			if (token.type() != TokenType.SYMBOL_SEMICOLON)
				throw new SyntaxParseException(token, "AQ1s");
			
			// Only semi-colons and EOF may follow
			if (modifiers != null)
			{
				// {@squirreljme.error AQ1t Expected end of file or semicolons
				// after an annotated package statement, annotated packages
				// are only valid in package-info.java.}
				while ((token = __in.next()).type() != TokenType.END_OF_FILE)
					if (token.type() != TokenType.SYMBOL_SEMICOLON)
						throw new SyntaxParseException(token, "AQ1t");
				
				return new CompilationUnitSyntax(modifiers, inpackage);
			}
		}
		
		// Read import statements but if there are modifiers then a class
		// must directly follow
		Set<ImportStatementSyntax> imports = new LinkedHashSet<>();
		if (modifiers == null)
			for (;;)
			{
				// Stop when there are no more imports
				token = __in.peek();
				if (token.type() != TokenType.KEYWORD_IMPORT)
					break;
				
				// Parse import statement
				imports.add(ImportStatementSyntax.parse(__in));
			}
		
		// Read in classes
		List<ClassSyntax> classes = new ArrayList<>();
		for (;;)
		{
			// Need to read in the class modifiers
			if (modifiers == null)
			{
				// Ignore semi-colons
				token = __in.peek();
				if (token.type() == TokenType.SYMBOL_SEMICOLON)
					continue;
				
				// But stop parsing on EOF
				else if (token.type() == TokenType.END_OF_FILE)
					break;
				
				// Parse modifiers
				modifiers = ModifiersSyntax.parse(__in);
			}
			
			// Read entire class container
			ClassSyntax struct = ClassSyntax.parseEntireClass(modifiers,
				__in);
			classes.add(struct);
			
			// Clear modifiers so that they are not used again
			modifiers = null;
		}
		
		return new CompilationUnitSyntax(inpackage, imports, classes);
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




















































































































































































































































































































































































































































































































































































































































































































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/syntax/EnumFieldSyntax.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac.syntax;

import net.multiphasicapps.classfile.FieldName;
import net.multiphasicapps.javac.token.BufferedTokenSource;
import net.multiphasicapps.javac.token.Token;
import net.multiphasicapps.javac.token.TokenSource;
import net.multiphasicapps.javac.token.TokenType;

/**
 * A field which represents an enumeration.
 *
 * @since 2018/04/30
 */
public final class EnumFieldSyntax
	implements FieldSyntax
{
	/**
	 * {@inheritDoc}
	 * @since 2018/04/30
	 */
	@Override
	public final boolean equals(Object __o)
	{
		throw new todo.TODO();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/04/30
	 */
	@Override
	public final int hashCode()
	{
		throw new todo.TODO();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/04/30
	 */
	@Override
	public final ModifiersSyntax modifiers()
	{
		throw new todo.TODO();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/04/30
	 */
	@Override
	public final FieldName name()
	{
		throw new todo.TODO();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/04/30
	 */
	@Override
	public final String toString()
	{
		throw new todo.TODO();
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


























































































































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/syntax/FieldSyntax.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac.syntax;

import net.multiphasicapps.classfile.FieldName;
import net.multiphasicapps.javac.token.BufferedTokenSource;
import net.multiphasicapps.javac.token.Token;
import net.multiphasicapps.javac.token.TokenSource;
import net.multiphasicapps.javac.token.TokenType;

/**
 * This represents a field which may have a value for a class.
 *
 * @since 2018/04/28
 */
public interface FieldSyntax
	extends MemberSyntax
{
	/**
	 * {@inheritDoc}
	 * @since 2018/04/29
	 */
	@Override
	public abstract FieldName name();
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/syntax/FormalParameterSyntax.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac.syntax;

import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import net.multiphasicapps.classfile.FieldName;
import net.multiphasicapps.javac.token.BufferedTokenSource;
import net.multiphasicapps.javac.token.Token;
import net.multiphasicapps.javac.token.TokenSource;
import net.multiphasicapps.javac.token.TokenType;

/**
 * This represents a single formal parameter which may be a part of a class.
 *
 * @since 2018/04/28
 */
public final class FormalParameterSyntax
	implements MapView
{
	/** The modifiers used. */
	protected final ModifiersSyntax modifiers;
	
	/** The type. */
	protected final TypeSyntax type;
	
	/** The name of the field. */
	protected final FieldName name;
	
	/** Map view. */
	private Reference<Map<String, Object>> _map;
	
	/** String form. */
	private Reference<String> _string;
	
	/**
	 * Initializes the formal parameter.
	 *
	 * @param __mods The modifiers for the parameter.
	 * @param __type The type used.
	 * @param __name The name of the parameter.
	 * @throws NullPointerException On null arguments.
	 * @throws SyntaxDefinitionException If the definition is not valid.
	 * @since 2018/04/30
	 */
	public FormalParameterSyntax(ModifiersSyntax __mods, TypeSyntax __type,
		FieldName __name)
		throws NullPointerException, SyntaxDefinitionException
	{
		if (__mods == null || __type == null || __name == null)
			throw new NullPointerException("NARG");
		
		// {@squirreljme.error AQ1u Illegal modifiers specified for formal
		// parameter. (The modifiers}}
		if (__mods.isPublic() || __mods.isProtected() || __mods.isPrivate() ||
			__mods.isStatic() || __mods.isAbstract() || __mods.isNative() ||
			__mods.isSynchronized() || __mods.isTransient() ||
			__mods.isVolatile() || __mods.isStrictFloatingPoint())
			throw new SyntaxDefinitionException(
				String.format("AQ1u %s", __mods));
		
		this.modifiers = __mods;
		this.type = __type;
		this.name = __name;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2019/01/17
	 */
	@Override
	public Map<String, Object> asMap()
	{
		Reference<Map<String, Object>> ref = this._map;
		Map<String, Object> rv;
		
		if (ref == null || null == (rv = ref.get()))
			this._map = new WeakReference<>((rv = new __TreeBuilder__().
				add("modifiers", this.modifiers).
				add("type", this.type).
				add("name", this.name).build()));
		
		return rv;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/04/28
	 */
	@Override
	public final boolean equals(Object __o)
	{
		throw new todo.TODO();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/04/28
	 */
	@Override
	public final int hashCode()
	{
		throw new todo.TODO();
	}
	
	/**
	 * Returns the modifiers that the formal parameter uses.
	 *
	 * @return The modifies for the formal parameter.
	 * @since 2018/05/10
	 */
	public final ModifiersSyntax modifiers()
	{
		return this.modifiers;
	}
	
	/**
	 * Returns the name of the parameter.
	 *
	 * @return The name of the parameter.
	 * @since 2018/05/10
	 */
	public final FieldName name()
	{
		return this.name;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/04/28
	 */
	@Override
	public final String toString()
	{
		Reference<String> ref = this._string;
		String rv;
		
		if (ref == null || null == (rv = ref.get()))
			this._string = new WeakReference<>((rv = this.asMap().toString()));
		
		return rv;
	}
	
	/**
	 * Returns the type of the formal parameter.
	 *
	 * @return The type used.
	 * @since 2018/05/10
	 */
	public final TypeSyntax type()
	{
		return this.type;
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<












































































































































































































































































































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/syntax/FormalParametersSyntax.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac.syntax;

import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import net.multiphasicapps.classfile.FieldName;
import net.multiphasicapps.classfile.MethodDescriptor;
import net.multiphasicapps.collections.UnmodifiableArrayList;
import net.multiphasicapps.collections.UnmodifiableIterator;
import net.multiphasicapps.javac.token.BufferedTokenSource;
import net.multiphasicapps.javac.token.Token;
import net.multiphasicapps.javac.token.TokenSource;
import net.multiphasicapps.javac.token.TokenType;

/**
 * This represents the formal parameters of a method.
 *
 * @since 2018/04/29
 */
public final class FormalParametersSyntax
	implements Iterable<FormalParameterSyntax>
{
	/** Parameters used. */
	private final FormalParameterSyntax[] _parameters;
	
	/** String form. */
	private Reference<String> _string;
	
	/**
	 * Initializes the formal parameters.
	 *
	 * @param __p The parameters used.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/04/29
	 */
	public FormalParametersSyntax(FormalParameterSyntax... __p)
		throws NullPointerException
	{
		this(Arrays.<FormalParameterSyntax>asList(
			(__p == null ? new FormalParameterSyntax[0] : __p)));
	}
	
	/**
	 * Initializes the formal parameters.
	 *
	 * @param __p The parameters used.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/04/29
	 */
	public FormalParametersSyntax(Iterable<FormalParameterSyntax> __p)
		throws NullPointerException
	{
		if (__p == null)
			throw new NullPointerException("NARG");
		
		List<FormalParameterSyntax> parms = new ArrayList<>();
		for (FormalParameterSyntax p : __p)
		{
			if (p == null)
				throw new NullPointerException("NARG");
			
			parms.add(p);
		}
		
		this._parameters = parms.<FormalParameterSyntax>toArray(
			new FormalParameterSyntax[parms.size()]);
	}
	
	/**
	 * Returns the descriptor for these parameters.
	 *
	 * @return The method descriptor used.
	 * @since 2018/04/29
	 */
	public final MethodDescriptor descriptor()
	{
		throw new todo.TODO();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/04/28
	 */
	@Override
	public final boolean equals(Object __o)
	{
		throw new todo.TODO();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/04/28
	 */
	@Override
	public final int hashCode()
	{
		throw new todo.TODO();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/05/10
	 */
	@Override
	public final Iterator<FormalParameterSyntax> iterator()
	{
		return UnmodifiableIterator.<FormalParameterSyntax>of(
			this._parameters);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/04/28
	 */
	@Override
	public final String toString()
	{
		Reference<String> ref = this._string;
		String rv;
		
		if (ref == null || null == (rv = ref.get()))
			this._string = new WeakReference<>((rv =
				Arrays.asList(this._parameters).toString()));
		
		return rv;
	}
	
	/**
	 * Parses formal parameters which are part of a description of a method.
	 *
	 * @param __in The input tokens.
	 * @return The parsed formal parameters.
	 * @throws NullPointerException On null arguments.
	 * @throws SyntaxParseException If a formal parameter is not correct.
	 * @since 2018/04/28
	 */
	public static FormalParametersSyntax parse(BufferedTokenSource __in)
		throws NullPointerException, SyntaxParseException
	{
		if (__in == null)
			throw new NullPointerException("NARG");
		
		// {@squirreljme.error AQ1v Expected opening parenthesis when parsing
		// formal parameters.}
		Token token = __in.next();
		if (token.type() != TokenType.SYMBOL_OPEN_PARENTHESIS)
			throw new SyntaxParseException("AQ1v");
		
		// Parse each one
		List<FormalParameterSyntax> rv = new ArrayList<>();
		for (;;)
		{
			token = __in.peek();
			
			// End of parameters
			if (token.type() == TokenType.SYMBOL_CLOSED_PARENTHESIS)
			{
				__in.next();
				break;
			}
			
			// Parse modifiers
			ModifiersSyntax mods = ModifiersSyntax.
				parseForFormalParameter(__in);
			
			// Parse type
			TypeSyntax type = TypeSyntax.parseType(__in);
			
			// Is this a variadic argument?
			boolean isvariadic;
			token = __in.peek();
			if ((isvariadic = (token.type() == TokenType.SYMBOL_ELLIPSES)))
				__in.next();
			
			// {@squirreljme.error AQ1w Expected identifier for the parameter
			// name.}
			token = __in.next();
			if (token.type() != TokenType.IDENTIFIER)
				throw new SyntaxParseException(token, "AQ1w");
			FieldName name = new FieldName(token.characters());
			
			// Add arrays accordingly
			int extradims = 0;
			while ((token = __in.peek()).type() ==
				TokenType.SYMBOL_OPEN_BRACKET)
			{
				// {@squirreljme.error AQ1x Expected closing bracket to follow
				// opening bracket for array declaration.}
				__in.next();
				if (__in.next().type() != TokenType.SYMBOL_CLOSED_BRACKET)
					throw new SyntaxParseException(token, "AQ1x");
				
				extradims++;
			}
			
			// Were there any extra dimensions?
			if (extradims > 0)
				type = type.withDimensions(type.dimensions() + extradims);
			
			// Setup parameter
			rv.add(new FormalParameterSyntax(mods, type, name));
			
			// {@squirreljme.error AQ1y Expected closing parenthesis to follow
			// variadic argument in formal parameter.}
			token = __in.peek();
			if (isvariadic && token.type() !=
				TokenType.SYMBOL_CLOSED_PARENTHESIS)
				throw new SyntaxParseException(token, "AQ1y");
			
			// Consume comma
			if (token.type() == TokenType.SYMBOL_COMMA)
				__in.next();
		}
		
		return new FormalParametersSyntax(rv);
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<














































































































































































































































































































































































































































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/syntax/GenericTypeSyntax.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac.syntax;

import net.multiphasicapps.javac.token.BufferedTokenSource;
import net.multiphasicapps.javac.token.Token;
import net.multiphasicapps.javac.token.TokenSource;
import net.multiphasicapps.javac.token.TokenType;

/**
 * This represents a generic type with a qualified identifier with potential
 * type bounds.
 *
 * @since 2018/04/30
 */
public final class GenericTypeSyntax
	implements SimpleTypeSyntax
{
	/** The identifier. */
	protected final QualifiedIdentifierSyntax identifier;
	
	/** Is there generic info? */
	protected final boolean hasgenerics;
	
	/**
	 * Initializes the generic type with no generic information.
	 *
	 * @param __id The identifier.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/04/30
	 */
	public GenericTypeSyntax(QualifiedIdentifierSyntax __id)
		throws NullPointerException
	{
		if (__id == null)
			throw new NullPointerException("NARG");
		
		this.identifier = __id;
		this.hasgenerics = false;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/04/30
	 */
	@Override
	public final boolean equals(Object __o)
	{
		throw new todo.TODO();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/04/30
	 */
	@Override
	public final int hashCode()
	{
		throw new todo.TODO();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/04/30
	 */
	@Override
	public final String toString()
	{
		if (!this.hasgenerics)
			return this.identifier.toString();
		
		throw new todo.TODO();
	}
	
	/**
	 * Parses the generic type.
	 *
	 * @param __in The input token source.
	 * @return The generic type.
	 * @throws NullPointerException On null arguments.
	 * @throws SyntaxParseException If the generic type is not valid.
	 * @since 2018/04/30
	 */
	public static GenericTypeSyntax parse(BufferedTokenSource __in)
		throws NullPointerException, SyntaxParseException
	{
		if (__in == null)
			throw new NullPointerException("NARG");
		
		// There will always be a qualified identifier
		QualifiedIdentifierSyntax ident =
			QualifiedIdentifierSyntax.parse(__in);
		
		// Is there generic type information?
		Token token = __in.peek();
		if (token.type() == TokenType.COMPARE_LESS_THAN)
			throw new todo.TODO();
		
		// Just a plain type
		return new GenericTypeSyntax(ident);
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






























































































































































































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/syntax/ImportStatementSyntax.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac.syntax;

import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import java.util.Map;
import net.multiphasicapps.classfile.BinaryName;
import net.multiphasicapps.classfile.InvalidClassFormatException;
import net.multiphasicapps.javac.token.BufferedTokenSource;
import net.multiphasicapps.javac.token.Token;
import net.multiphasicapps.javac.token.TokenSource;
import net.multiphasicapps.javac.token.TokenType;

/**
 * This represents a single import statement.
 *
 * @since 2018/04/21
 */
public final class ImportStatementSyntax
	implements MapView
{
	/** Is this static? */
	protected final boolean isstatic;
	
	/** The imported class. */
	protected final BinaryName what;
	
	/** Is it a wildcard? */
	protected final boolean wildcard;
	
	/** Map view. */
	private Reference<Map<String, Object>> _map;
	
	/** String representation. */
	private Reference<String> _string;
	
	/**
	 * Initializes the import declaration.
	 *
	 * @param __static Is this static?
	 * @param __what What is being imported.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/04/14
	 */
	public ImportStatementSyntax(boolean __static, BinaryName __what)
		throws NullPointerException
	{
		if (__what == null)
			throw new NullPointerException("NARG");
		
		this.isstatic = __static;
		this.what = __what;
		this.wildcard = __what.toString().endsWith("/*");
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2019/01/17
	 */
	@Override
	public Map<String, Object> asMap()
	{
		Reference<Map<String, Object>> ref = this._map;
		Map<String, Object> rv;
		
		if (ref == null || null == (rv = ref.get()))
			this._map = new WeakReference<>((rv = new __TreeBuilder__().
				add("static", this.isstatic).
				add("wildcard", this.wildcard).
				add("what", this.what).build()));
		
		return rv;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/04/13
	 */
	@Override
	public final boolean equals(Object __o)
	{
		if (__o == this)
			return true;
		
		if (!(__o instanceof ImportStatementSyntax))
			return false;
		
		ImportStatementSyntax o = (ImportStatementSyntax)__o;
		return this.isstatic == o.isstatic &&
			this.what.equals(o.what);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/04/13
	 */
	@Override
	public final int hashCode()
	{
		return this.what.hashCode();
	}
	
	/**
	 * Is this static?
	 *
	 * @return {@code true} if this is static.
	 * @since 2018/04/14
	 */
	public final boolean isStatic()
	{
		return this.isstatic;
	}
	
	/**
	 * Is this a wildcard?
	 *
	 * @return {@code true} if this is a wildcard statement.
	 * @since 2018/04/14
	 */
	public final boolean isWildcard()
	{
		return this.wildcard;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/04/13
	 */
	@Override
	public final String toString()
	{
		Reference<String> ref = this._string;
		String rv;
		
		if (ref == null || null == (rv = ref.get()))
			this._string = new WeakReference<>((rv = this.asMap().toString()));
		
		return rv;
	}
	
	/**
	 * Returns the identifier being imported.
	 *
	 * @return The imported identifier.
	 * @since 2018/04/14
	 */
	public final BinaryName what()
	{
		return this.what;
	}
	
	/**
	 * This parses a single import statement.
	 *
	 * @param __in The input token source.
	 * @return The parsed modifiers.
	 * @throws NullPointerException On null arguments.
	 * @throws SyntaxParseException If this is not a valid import statement.
	 * @since 2018/04/21
	 */
	public static ImportStatementSyntax parse(BufferedTokenSource __in)
		throws NullPointerException, SyntaxParseException
	{
		if (__in == null)
			throw new NullPointerException("NARG");
		
		// {@squirreljme.error AQ1z Expected "import" when parsing an import
		// statement.}
		Token token = __in.next();
		if (token.type() != TokenType.KEYWORD_IMPORT)
			throw new SyntaxParseException(token, "AQ1z");
		
		// Is this static?
		boolean isstatic;
		token = __in.peek();
		if ((isstatic = (token.type() == TokenType.KEYWORD_STATIC)))
			__in.next();
		
		// {@squirreljme.error AQ20 Expected identifier at start of import
		// statement.}
		token = __in.peek();
		if (token.type() != TokenType.IDENTIFIER)
			throw new SyntaxParseException(token, "AQ20");
		
		// Read identifier, due to the wildcard we cannot use
		// QualifiedIdentifierSyntax because an identifier must follow the dot
		StringBuilder sb = new StringBuilder();
		for (;;)
		{
			// {@squirreljme.error AQ21 Expected identifier while parsing the
			// import statement.}
			token = __in.next();
			if (token.type() != TokenType.IDENTIFIER)
				throw new SyntaxParseException(token, "AQ21");
			
			// Build
			sb.append(token.characters());
			
			// Done parsing?
			token = __in.next();
			if (token.type() == TokenType.SYMBOL_SEMICOLON)
				break;
			
			// Parse another statement
			else if (token.type() == TokenType.SYMBOL_DOT)
			{
				// This may be the wildcard statement
				token = __in.peek();
				if (token.type() == TokenType.OPERATOR_MULTIPLY)
				{
					// Consume it
					__in.next();
					
					// {@squirreljme.error AQ22 Expected semicolon to follow
					// the wildcard symbol in the import statement.}
					token = __in.next();
					if (token.type() != TokenType.SYMBOL_SEMICOLON)
						throw new SyntaxParseException(token, "AQ22");
					
					// Add asterisk to make it a wildcard
					sb.append("*");
					break;
				}
				
				// Use slash for binary names
				else
					sb.append("/");
			}
			
			// {@squirreljme.error AQ23 Expected dot or semi-colon to follow
			// the identifier in the import statement.}
			else
				throw new SyntaxParseException(token, "AQ23");
		}
		
		// Attempt to parse binary name
		try
		{
			return new ImportStatementSyntax(isstatic,
				new BinaryName(sb.toString()));
		}
		
		// {@squirreljme.error AQ24 Parsed import declaration is not a valid
		// binary name.}
		catch (InvalidClassFormatException e)
		{
			throw new SyntaxParseException(token, "AQ24");
		}
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<








































































































































































































































































































































































































































































































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/syntax/InheritenceTypeSyntax.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac.syntax;

/**
 * This represents the inheritence type of some class structures.
 *
 * @since 2018/04/24
 */
public enum InheritenceTypeSyntax
{
	/** No inheritence. */
	NONE,
	
	/** Single inheritence. */
	SINGLE,
	
	/** Multiple inheritence. */
	MULTIPLE,
	
	/** End. */
	;
	
	/**
	 * Is the inheritence count valid for the given type?
	 *
	 * @param __n The number of inherited elements.
	 * @return If it is valid or not.
	 * @since 2018/04/30
	 */
	public final boolean isCompatibleCount(int __n)
	{
		switch (this)
		{
			case NONE:
				return __n == 0;
				
			case SINGLE:
				return (__n == 0 || __n == 1);
				
			case MULTIPLE:
				return __n >= 0;
			
			default:
				throw new todo.OOPS();
		}
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


















































































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/syntax/MapView.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac.syntax;

import java.util.Map;

/**
 * This represents syntax which can be represented as a map. This only applies
 * to parts of the syntax tree which have multiple children nodes.
 *
 * @since 2019/01/17
 */
public interface MapView
{
	/**
	 * Returns a representation of this syntax as a map.
	 *
	 * @return The map representing of this syntax.
	 * @since 2019/01/17
	 */
	public abstract Map<String, Object> asMap();
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






























































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/syntax/MemberSyntax.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac.syntax;

import net.multiphasicapps.classfile.Identifier;

/**
 * This interface represents anything which can be a member of a class.
 *
 * @since 2018/04/27
 */
public interface MemberSyntax
{
	/**
	 * Returns the modifiers for the member.
	 *
	 * @return The member modifiers.
	 * @since 2018/04/29
	 */
	public abstract ModifiersSyntax modifiers();
	
	/**
	 * Returns the name of the member.
	 *
	 * @return The name of the member.
	 * @since 2018/04/29
	 */
	public abstract Identifier name();
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<












































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/syntax/MethodSyntax.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac.syntax;

import net.multiphasicapps.classfile.MethodName;
import net.multiphasicapps.javac.token.BufferedTokenSource;
import net.multiphasicapps.javac.token.Token;
import net.multiphasicapps.javac.token.TokenSource;
import net.multiphasicapps.javac.token.TokenType;

/**
 * This represents a method which is a member of a class and may contain Java
 * code to be compiled.
 *
 * @since 2018/04/27
 */
public interface MethodSyntax
	extends MemberSyntax
{
	/**
	 * {@inheritDoc}
	 * @since 2018/04/29
	 */
	@Override
	public abstract MethodName name();
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/syntax/ModifierSyntax.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac.syntax;

/**
 * This represents a modifier which may be associated with a class or member.
 *
 * @since 2018/04/21
 */
public interface ModifierSyntax
{
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<










































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/syntax/ModifiersSyntax.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac.syntax;

import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import java.util.Arrays;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.Set;
import net.multiphasicapps.javac.token.BufferedTokenSource;
import net.multiphasicapps.javac.token.Token;
import net.multiphasicapps.javac.token.TokenSource;
import net.multiphasicapps.javac.token.TokenType;

/**
 * This represents modifiers that are associated with something which may be
 * a basic keyword or an annotation.
 *
 * @since 2018/04/21
 */
public final class ModifiersSyntax
	implements Iterable<ModifierSyntax>
{
	/** The modifiers to use. */
	private final Set<ModifierSyntax> _modifiers;
	
	/** String representation. */
	private Reference<String> _string;
	
	/**
	 * Initializes the modifier set.
	 *
	 * @param __ms The modifiers to use.
	 * @throws NullPointerException If any modifier is null.
	 * @throws SyntaxDefinitionException If a modifier is duplicated or
	 * public, protected, or private are multiply specified.
	 * @since 2018/04/22
	 */
	public ModifiersSyntax(ModifierSyntax... __ms)
		throws NullPointerException, SyntaxDefinitionException
	{
		this(Arrays.<ModifierSyntax>asList(
			(__ms == null ? new ModifierSyntax[0] : __ms)));
	}
	
	/**
	 * Initializes the modifier set.
	 *
	 * @param __ms The modifiers to use.
	 * @throws NullPointerException If any modifier is null.
	 * @throws SyntaxDefinitionException If a modifier is duplicated or
	 * public, protected, or private are multiply specified.
	 * @since 2018/04/22
	 */
	public ModifiersSyntax(Iterable<ModifierSyntax> __ms)
		throws NullPointerException, SyntaxDefinitionException
	{
		if (__ms == null)
			throw new NullPointerException("NARG");
		
		// Check modifiers before using them
		Set<ModifierSyntax> modifiers = new LinkedHashSet<>();
		for (ModifierSyntax m : __ms)
		{
			if (m == null)
				throw new NullPointerException("NARG");
			
			// {@squirreljme.error AQ25 Duplicate modifier. (The modifier)}
			if (modifiers.contains(m))
				throw new SyntaxDefinitionException(String.format("AQ25 %s",
					m));
			
			modifiers.add(m);
		}
		
		// {@squirreljme.error AQ26 There may be only one or none specified for
		// public, protected, or private. (The modifiers)}
		boolean a = modifiers.contains(BasicModifierSyntax.PUBLIC),
			b = modifiers.contains(BasicModifierSyntax.PROTECTED),
			c = modifiers.contains(BasicModifierSyntax.PRIVATE);
		if ((a && b) || (a && c) || (b && c))
			throw new SyntaxDefinitionException(String.format("AQ26 %s",
				modifiers));
		
		// Store
		this._modifiers = modifiers;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/04/21
	 */
	@Override
	public final boolean equals(Object __o)
	{
		throw new todo.TODO();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/04/21
	 */
	@Override
	public final int hashCode()
	{
		throw new todo.TODO();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/05/07
	 */
	@Override
	public final Iterator<ModifierSyntax> iterator()
	{
		Set<ModifierSyntax> modifiers = this._modifiers;
		return Arrays.<ModifierSyntax>asList(modifiers.<ModifierSyntax>toArray(
			new ModifierSyntax[modifiers.size()])).iterator();
	}
	
	/**
	 * Is this abstract?
	 *
	 * @return If this is abstract.
	 * @since 2018/04/30
	 */
	public final boolean isAbstract()
	{
		return this._modifiers.contains(BasicModifierSyntax.ABSTRACT);
	}
	
	/**
	 * Is this final?
	 *
	 * @return If this is final.
	 * @since 2018/04/30
	 */
	public final boolean isFinal()
	{
		return this._modifiers.contains(BasicModifierSyntax.FINAL);
	}
	
	/**
	 * Is this native?
	 *
	 * @return If this is native.
	 * @since 2018/04/30
	 */
	public final boolean isNative()
	{
		return this._modifiers.contains(BasicModifierSyntax.NATIVE);
	}
	
	/**
	 * Is this private?
	 *
	 * @return If this is private.
	 * @since 2018/04/30
	 */
	public final boolean isPrivate()
	{
		return this._modifiers.contains(BasicModifierSyntax.PRIVATE);
	}
	
	/**
	 * Is this protected?
	 *
	 * @return If this is protected.
	 * @since 2018/04/30
	 */
	public final boolean isProtected()
	{
		return this._modifiers.contains(BasicModifierSyntax.PROTECTED);
	}
	
	/**
	 * Is this public?
	 *
	 * @return If this is public.
	 * @since 2018/04/30
	 */
	public final boolean isPublic()
	{
		return this._modifiers.contains(BasicModifierSyntax.PUBLIC);
	}
	
	/**
	 * Is this static?
	 *
	 * @return If this is static.
	 * @since 2018/04/30
	 */
	public final boolean isStatic()
	{
		return this._modifiers.contains(BasicModifierSyntax.STATIC);
	}
	
	/**
	 * Is this using strict floating point?
	 *
	 * @return If this is using struct floating point.
	 * @since 2018/04/30
	 */
	public final boolean isStrictFloatingPoint()
	{
		return this._modifiers.contains(BasicModifierSyntax.STRICTFP);
	}
	
	/**
	 * Is this synchronized?
	 *
	 * @return If this is synchronized.
	 * @since 2018/04/30
	 */
	public final boolean isSynchronized()
	{
		return this._modifiers.contains(BasicModifierSyntax.SYNCHRONIZED);
	}
	
	/**
	 * Is this transient?
	 *
	 * @return If this is transient.
	 * @since 2018/04/30
	 */
	public final boolean isTransient()
	{
		return this._modifiers.contains(BasicModifierSyntax.TRANSIENT);
	}
	
	/**
	 * Is this volatile?
	 *
	 * @return If this is volatile.
	 * @since 2018/04/30
	 */
	public final boolean isVolatile()
	{
		return this._modifiers.contains(BasicModifierSyntax.VOLATILE);
	}
	
	/**
	 * Returns the modifiers that have been declared.
	 *
	 * @return The declared modifiers.
	 * @since 2018/05/07
	 */
	public final ModifierSyntax[] modifiers()
	{
		Set<ModifierSyntax> modifiers = this._modifiers;
		return modifiers.<ModifierSyntax>toArray(
			new ModifierSyntax[modifiers.size()]);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/04/21
	 */
	@Override
	public final String toString()
	{
		Reference<String> ref = this._string;
		String rv;
		
		if (ref == null || null == (rv = ref.get()))
			this._string = new WeakReference<>((rv =
				this._modifiers.toString()));
		
		return rv;
	}
	
	/**
	 * This parses modifiers which are associated with something.
	 *
	 * @param __in The input token source.
	 * @return The parsed modifiers.
	 * @throws NullPointerException On null arguments.
	 * @throws SyntaxParseException If the modifiers are not valid.
	 * @since 2018/04/21
	 */
	public static ModifiersSyntax parse(BufferedTokenSource __in)
		throws NullPointerException, SyntaxParseException
	{
		if (__in == null)
			throw new NullPointerException("NARG");
		
		// Parse modifiers
		Set<ModifierSyntax> rv = new LinkedHashSet<>();
		for (;;)
		{
			Token token = __in.peek();
			ModifierSyntax got;
			
			// Is this an annotation? Do not parse @interface as an annotation
			// since that is not valid
			if (token.type() == TokenType.SYMBOL_AT &&
				__in.peek(1).type() != TokenType.KEYWORD_INTERFACE)
				got = AnnotationSyntax.parse(__in);
				
			// Basic modifier?
			else
			{
				// Depends
				switch (token.type())
				{
					case KEYWORD_PUBLIC:
						got = BasicModifierSyntax.PUBLIC;
						break;
						
					case KEYWORD_PROTECTED:
						got = BasicModifierSyntax.PROTECTED;
						break;
						
					case KEYWORD_PRIVATE:
						got = BasicModifierSyntax.PRIVATE;
						break;
						
					case KEYWORD_STATIC:
						got = BasicModifierSyntax.STATIC;
						break;
						
					case KEYWORD_ABSTRACT:
						got = BasicModifierSyntax.ABSTRACT;
						break;
						
					case KEYWORD_FINAL:
						got = BasicModifierSyntax.FINAL;
						break;
						
					case KEYWORD_NATIVE:
						got = BasicModifierSyntax.NATIVE;
						break;
						
					case KEYWORD_SYNCHRONIZED:
						got = BasicModifierSyntax.SYNCHRONIZED;
						break;
						
					case KEYWORD_TRANSIENT:
						got = BasicModifierSyntax.TRANSIENT;
						break;
						
					case KEYWORD_VOLATILE:
						got = BasicModifierSyntax.VOLATILE;
						break;
						
					case KEYWORD_STRICTFP:
						got = BasicModifierSyntax.STRICTFP;
						break;
					
						// No more modifiers to parse
					default:
						return new ModifiersSyntax(rv);
				}
				
				// Consume token to prevent infinite loop
				__in.next();
			}
			
			// {@squirreljme.error AQ27 Duplicate modifier. (The modifier)}
			if (rv.contains(got))
				throw new SyntaxParseException(token,
					String.format("AQ27 %s", got));
			rv.add(got);
		}
	}
	
	/**
	 * This parses modifiers which are associated with formal parameters.
	 *
	 * @param __in The input token source.
	 * @return The parsed modifiers for formal parameters.
	 * @throws NullPointerException On null arguments.
	 * @throws SyntaxParseException If the modifiers are not valid.
	 * @since 2018/04/29
	 */
	public static ModifiersSyntax parseForFormalParameter(
		BufferedTokenSource __in)
		throws NullPointerException, SyntaxParseException
	{
		if (__in == null)
			throw new NullPointerException("NARG");
		
		// Parse modifiers
		Set<ModifierSyntax> rv = new LinkedHashSet<>();
		for (;;)
		{
			Token token = __in.peek();
			ModifierSyntax got;
			
			// Annotated formal parameter
			if (token.type() == TokenType.SYMBOL_AT)
				got = AnnotationSyntax.parse(__in);
				
			// Basic modifier?
			else
			{
				// Depends
				switch (token.type())
				{
					case KEYWORD_FINAL:
						got = BasicModifierSyntax.FINAL;
						break;
						
						// No more modifiers to parse
					default:
						return new ModifiersSyntax(rv);
				}
				
				// Consume token to prevent infinite loop
				__in.next();
			}
			
			// {@squirreljme.error AQ28 Duplicate modifier while parsing
			// formal parameter modifiers. (The modifier)}
			if (rv.contains(got))
				throw new SyntaxParseException(token,
					String.format("AQ28 %s", got));
			rv.add(got);
		}
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






























































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/syntax/QualifiedIdentifierSyntax.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac.syntax;

import net.multiphasicapps.classfile.BinaryName;
import net.multiphasicapps.classfile.InvalidClassFormatException;
import net.multiphasicapps.javac.token.BufferedTokenSource;
import net.multiphasicapps.javac.token.Token;
import net.multiphasicapps.javac.token.TokenType;

/**
 * This represents a qualified identifier which represents the name of a class.
 *
 * @since 2018/04/10
 */
public final class QualifiedIdentifierSyntax
{
	/** The class this refers to. */
	protected final BinaryName name;
	
	/**
	 * Initializes the qualified identifier.
	 *
	 * @param __bn The identifier name.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/04/13
	 */
	public QualifiedIdentifierSyntax(BinaryName __bn)
		throws NullPointerException
	{
		if (__bn == null)
			throw new NullPointerException("NARG");
		
		this.name = __bn;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/04/13
	 */
	@Override
	public final boolean equals(Object __o)
	{
		if (__o == this)
			return true;
		
		if (!(__o instanceof QualifiedIdentifierSyntax))
			return false;
		
		return this.name.equals(((QualifiedIdentifierSyntax)__o).name);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/04/13
	 */
	@Override
	public final int hashCode()
	{
		return this.name.hashCode();
	}
	
	/**
	 * Returns the binary name of the identifier.
	 *
	 * @return The identifier binary name.
	 * @since 2018/05/07
	 */
	public final BinaryName name()
	{
		return this.name;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/04/13
	 */
	@Override
	public final String toString()
	{
		return this.name.toString();
	}
	
	/**
	 * Parses a qualified identifier.
	 *
	 * @param __t The input token source.
	 * @return The qualified identifier.
	 * @throws NullPointerException On null arguments.
	 * @throws SyntaxParseException If the identifier is not valid.
	 * @since 2018/04/13
	 */
	public static final QualifiedIdentifierSyntax parse(
		BufferedTokenSource __t)
		throws NullPointerException, SyntaxParseException
	{
		if (__t == null)
			throw new NullPointerException("NARG");
		
		// The token is always consumed
		Token token = __t.next();
		
		// {@squirreljme.error AQ29 Expected identifier while parsing qualified
		// identifier.
		if (token.type() != TokenType.IDENTIFIER)
			throw new SyntaxParseException(token, "AQ29");
		
		// Start with initial base
		StringBuilder sb = new StringBuilder();
		sb.append(token.characters());
		
		// Try to keep reading identifiers
		for (;;)
		{
			// Parsing no more
			token = __t.peek();
			if (token.type() != TokenType.SYMBOL_DOT)
				break;
			
			// Consume the dot
			__t.next();
			
			// {@squirreljme.error AQ2a Expected identifier to follow
			// dot in qualified identifier.}
			token = __t.next();
			if (token.type() != TokenType.IDENTIFIER)
				throw new SyntaxParseException(token, "AQ2a");
			
			// Add in
			sb.append('/');
			sb.append(token.characters());
		}
		
		// Might not be valid
		try
		{
			return new QualifiedIdentifierSyntax(
				new BinaryName(sb.toString()));
		}
		
		// {@squirreljme.error AQ2b The specified identifier is not a valid
		// binary name. (The identifier)}
		catch (InvalidClassFormatException e)
		{
			throw new SyntaxParseException(token,
				String.format("AQ2b %s", sb), e);
		}
	}
	
	/**
	 * Parses a list of qualified identifiers.
	 *
	 * @param __in The input tokens.
	 * @return The list of qualified identifiers.
	 * @throws NullPointerException On null arguments.
	 * @throws SyntaxParseException If the list is not valid.
	 * @since 2018/04/28
	 */
	public static final QualifiedIdentifierSyntax[] parseList(
		BufferedTokenSource __in)
		throws NullPointerException, SyntaxParseException
	{
		if (__in == null)
			throw new NullPointerException("NARG");
		
		throw new todo.TODO();
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


































































































































































































































































































































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/syntax/SimpleMethodSyntax.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac.syntax;

import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import java.util.LinkedHashSet;
import java.util.Map;
import java.util.Set;
import net.multiphasicapps.classfile.MethodName;
import net.multiphasicapps.javac.token.BufferedTokenSource;
import net.multiphasicapps.javac.token.Token;
import net.multiphasicapps.javac.token.TokenSource;
import net.multiphasicapps.javac.token.TokenType;

/**
 * This represents a simple method.
 *
 * @since 2018/04/28
 */
public final class SimpleMethodSyntax
	implements MapView, MethodSyntax
{
	/** ModifiersSyntax to the constructor. */
	protected final ModifiersSyntax modifiers;
	
	/** TypeSyntax parameters used. */
	protected final TypeParametersSyntax typeparameters;
	
	/** The identifier of the constructor. */
	protected final MethodName name;
	
	/** The code which makes up the constructor. */
	protected final UnparsedExpressions code;
	
	/** The formal parameters. */
	protected final FormalParametersSyntax parameters;
	
	/** The return type. */
	protected final TypeSyntax returntype;
	
	/** The thrown classes. */
	private final QualifiedIdentifierSyntax[] _thrown;
	
	/** Map view. */
	private Reference<Map<String, Object>> _map;
	
	/** String form. */
	private Reference<String> _string;
	
	/**
	 * Initializes simple method.
	 *
	 * @param __mods The modifiers.
	 * @param __rtype The return type.
	 * @param __ident The method name.
	 * @param __params The parameters.
	 * @param __thrown The thrown methods.
	 * @param __code The code block, may be {@code null} if abstract or native.
	 * @throws NullPointerException On null arguments except for
	 * {@code __code}.
	 * @throws SyntaxDefinitionException If the structure is not correct.
	 * @since 2018/04/30
	 */
	public SimpleMethodSyntax(ModifiersSyntax __mods,
		TypeParametersSyntax __tparms, TypeSyntax __rtype, MethodName __ident,
		FormalParametersSyntax __params, QualifiedIdentifierSyntax[] __thrown,
		UnparsedExpressions __code)
		throws NullPointerException, SyntaxDefinitionException
	{
		if (__mods == null || __tparms == null || __rtype == null ||
			__ident == null || __params == null || __thrown == null)
			throw new NullPointerException("NARG");
		
		// {@squirreljme.error AQ2c Mismatch between the method having code
		// or not and it being abstract and/or native.}
		if ((__mods.isAbstract() || __mods.isNative()) != (__code == null))
			throw new SyntaxDefinitionException("AQ2c");
		
		// Check throwables for null
		Set<QualifiedIdentifierSyntax> thrown = new LinkedHashSet<>();
		for (QualifiedIdentifierSyntax t : (__thrown = __thrown.clone()))
		{
			if (t == null)
				throw new NullPointerException("NARG");
			
			// {@squirreljme.error AQ2d Duplicated throw statement. (The throw
			// statement which was duplicated)}
			if (thrown.contains(t))
				throw new SyntaxDefinitionException(
					String.format("AQ2d %s", t));
			
			thrown.add(t);
		}
		
		// {@squirreljme.error AQ2e Illegal modifiers specified for simple
		// method. (The modifiers)}
		if ((__mods.isAbstract() && (__mods.isStatic() || __mods.isNative() ||
			__mods.isFinal())) || __mods.isVolatile() || __mods.isTransient())
			throw new SyntaxDefinitionException(
				String.format("AQ2e %s", __mods));
		
		this.modifiers = __mods;
		this.typeparameters = __tparms;
		this.returntype = __rtype;
		this.name = new MethodName(__ident.toString());
		this.parameters = __params;
		this.code = __code;
		this._thrown = __thrown;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2019/01/17
	 */
	@Override
	public Map<String, Object> asMap()
	{
		Reference<Map<String, Object>> ref = this._map;
		Map<String, Object> rv;
		
		if (ref == null || null == (rv = ref.get()))
			this._map = new WeakReference<>((rv = new __TreeBuilder__().
				add("modifiers", this.modifiers).
				add("typeparams", this.typeparameters).
				add("name", this.name).
				add("return", this.returntype).
				add("parameters", this.parameters).
				addList("thrown", (Object[])this._thrown).
				add("code", this.code).build()));
		
		return rv;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/04/28
	 */
	@Override
	public final boolean equals(Object __o)
	{
		throw new todo.TODO();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/04/28
	 */
	@Override
	public final int hashCode()
	{
		throw new todo.TODO();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/04/29
	 */
	@Override
	public final ModifiersSyntax modifiers()
	{
		throw new todo.TODO();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/04/29
	 */
	@Override
	public final MethodName name()
	{
		throw new todo.TODO();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/04/28
	 */
	@Override
	public final String toString()
	{
		Reference<String> ref = this._string;
		String rv;
		
		if (ref == null || null == (rv = ref.get()))
			this._string = new WeakReference<>((rv = this.asMap().toString()));
		
		return rv;
	}
	
	/**
	 * Parses a simple method.
	 *
	 * @param __mods The modifiers to the method.
	 * @param __typeparams TypeSyntax parameters.
	 * @param __in The input tokens.
	 * @return The parsed method.
	 * @throws NullPointerException On null arguments.
	 * @throws SyntaxParseException If it is not a valid method.
	 * @since 2018/04/28
	 */
	public static SimpleMethodSyntax parse(ModifiersSyntax __mods,
		TypeParametersSyntax __typeparams, BufferedTokenSource __in)
		throws NullPointerException, SyntaxParseException
	{
		if (__mods == null || __typeparams == null || __in == null)
			throw new NullPointerException("NARG");
		
		// Read return type
		Token token = __in.peek();
		TypeSyntax returntype;
		if (token.type() == TokenType.KEYWORD_VOID)
		{
			__in.next();
			returntype = TypeSyntax.VOID;
		}
		else
			returntype = TypeSyntax.parseType(__in);
		
		// {@squirreljme.error AQ2f Expected identifier to name the method.}
		token = __in.next();
		if (token.type() != TokenType.IDENTIFIER)
			throw new SyntaxParseException(token, "AQ2f");
		MethodName identifier = new MethodName(token.characters());
		
		// Parse formal parameters
		FormalParametersSyntax params = FormalParametersSyntax.parse(__in);
		
		// Parse throws
		QualifiedIdentifierSyntax[] thrown;
		token = __in.peek();
		if (token.type() == TokenType.KEYWORD_THROWS)
		{
			__in.next();
			thrown = QualifiedIdentifierSyntax.parseList(__in);
		}
		else
			thrown = new QualifiedIdentifierSyntax[0];
		
		// Parse potential code block?
		UnparsedExpressions code;
		if (__mods.isAbstract() || __mods.isNative())
		{
			// No code
			code = null;
			
			// {@squirreljme.error AQ2g Expected semicolon to follow abstract
			// or native method.}
			token = __in.next();
			if (token.type() != TokenType.SYMBOL_SEMICOLON)
				throw new SyntaxParseException(token, "AQ2g");
		}
		else
			code = UnparsedExpressions.parseBlock(__in);
		
		// Initialize simple method
		return new SimpleMethodSyntax(__mods, __typeparams, returntype,
			identifier, params, thrown, code);
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


























































































































































































































































































































































































































































































































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/syntax/SimpleTypeSyntax.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac.syntax;

/**
 * This interface represents a simple type.
 *
 * @since 2018/04/30
 */
public interface SimpleTypeSyntax
{
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<










































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/syntax/SyntaxDefinitionException.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac.syntax;

import net.multiphasicapps.javac.CompilerException;
import net.multiphasicapps.javac.LocationAware;

/**
 * This is thrown when a structure is not defined correcty.
 *
 * @since 2018/04/30
 */
public class SyntaxDefinitionException
	extends SyntaxException
{
	/**
	 * Initialize the exception with no message or cause.
	 *
	 * @since 2018/04/30
	 */
	public SyntaxDefinitionException()
	{
	}
	
	/**
	 * Initialize the exception with a message and no cause.
	 *
	 * @param __m The message.
	 * @since 2018/04/30
	 */
	public SyntaxDefinitionException(String __m)
	{
		super(__m);
	}
	
	/**
	 * Initialize the exception with a message and cause.
	 *
	 * @param __m The message.
	 * @param __c The cause.
	 * @since 2018/04/30
	 */
	public SyntaxDefinitionException(String __m, Throwable __c)
	{
		super(__m, __c);
	}
	
	/**
	 * Initialize the exception with no message and with a cause.
	 *
	 * @param __c The cause.
	 * @since 2018/04/30
	 */
	public SyntaxDefinitionException(Throwable __c)
	{
		super(__c);
	}
	
	/**
	 * Initialize the exception with no message or cause.
	 *
	 * @param __la Location awareness information.
	 * @since 2018/04/30
	 */
	public SyntaxDefinitionException(LocationAware __la)
	{
		super(__la);
	}
	
	/**
	 * Initialize the exception with a message and no cause.
	 *
	 * @param __la Location awareness information.
	 * @param __m The message.
	 * @since 2018/04/30
	 */
	public SyntaxDefinitionException(LocationAware __la, String __m)
	{
		super(__la, __m);
	}
	
	/**
	 * Initialize the exception with a message and cause.
	 *
	 * @param __la Location awareness information.
	 * @param __m The message.
	 * @param __c The cause.
	 * @since 2018/04/30
	 */
	public SyntaxDefinitionException(LocationAware __la, String __m,
		Throwable __c)
	{
		super(__la, __m, __c);
	}
	
	/**
	 * Initialize the exception with no message and with a cause.
	 *
	 * @param __la Location awareness information.
	 * @param __c The cause.
	 * @since 2018/04/30
	 */
	public SyntaxDefinitionException(LocationAware __la, Throwable __c)
	{
		super(__la, __c);
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<








































































































































































































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/syntax/SyntaxException.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac.syntax;

import net.multiphasicapps.javac.CompilerException;
import net.multiphasicapps.javac.LocationAware;

/**
 * This is the base class for exception that occur in the syntax parser.
 *
 * @since 2018/05/05
 */
public class SyntaxException
	extends CompilerException
{
	/**
	 * Initialize the exception with no message or cause.
	 *
	 * @since 2018/05/05
	 */
	public SyntaxException()
	{
	}
	
	/**
	 * Initialize the exception with a message and no cause.
	 *
	 * @param __m The message.
	 * @since 2018/05/05
	 */
	public SyntaxException(String __m)
	{
		super(__m);
	}
	
	/**
	 * Initialize the exception with a message and cause.
	 *
	 * @param __m The message.
	 * @param __c The cause.
	 * @since 2018/05/05
	 */
	public SyntaxException(String __m, Throwable __c)
	{
		super(__m, __c);
	}
	
	/**
	 * Initialize the exception with no message and with a cause.
	 *
	 * @param __c The cause.
	 * @since 2018/05/05
	 */
	public SyntaxException(Throwable __c)
	{
		super(__c);
	}
	
	/**
	 * Initialize the exception with no message or cause.
	 *
	 * @param __la Location awareness information.
	 * @since 2018/05/05
	 */
	public SyntaxException(LocationAware __la)
	{
		super(__la);
	}
	
	/**
	 * Initialize the exception with a message and no cause.
	 *
	 * @param __la Location awareness information.
	 * @param __m The message.
	 * @since 2018/05/05
	 */
	public SyntaxException(LocationAware __la, String __m)
	{
		super(__la, __m);
	}
	
	/**
	 * Initialize the exception with a message and cause.
	 *
	 * @param __la Location awareness information.
	 * @param __m The message.
	 * @param __c The cause.
	 * @since 2018/05/05
	 */
	public SyntaxException(LocationAware __la, String __m, Throwable __c)
	{
		super(__la, __m, __c);
	}
	
	/**
	 * Initialize the exception with no message and with a cause.
	 *
	 * @param __la Location awareness information.
	 * @param __c The cause.
	 * @since 2018/05/05
	 */
	public SyntaxException(LocationAware __la, Throwable __c)
	{
		super(__la, __c);
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






































































































































































































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/syntax/SyntaxParseException.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac.syntax;

import net.multiphasicapps.javac.CompilerException;
import net.multiphasicapps.javac.LocationAware;

/**
 * This is thrown when there is an issue with the input class structure and
 * that is not valid.
 *
 * @since 2018/04/21
 */
public class SyntaxParseException
	extends SyntaxException
{
	/**
	 * Initialize the exception with no message or cause.
	 *
	 * @since 2018/04/21
	 */
	public SyntaxParseException()
	{
	}
	
	/**
	 * Initialize the exception with a message and no cause.
	 *
	 * @param __m The message.
	 * @since 2018/04/21
	 */
	public SyntaxParseException(String __m)
	{
		super(__m);
	}
	
	/**
	 * Initialize the exception with a message and cause.
	 *
	 * @param __m The message.
	 * @param __c The cause.
	 * @since 2018/04/21
	 */
	public SyntaxParseException(String __m, Throwable __c)
	{
		super(__m, __c);
	}
	
	/**
	 * Initialize the exception with no message and with a cause.
	 *
	 * @param __c The cause.
	 * @since 2018/04/21
	 */
	public SyntaxParseException(Throwable __c)
	{
		super(__c);
	}
	
	/**
	 * Initialize the exception with no message or cause.
	 *
	 * @param __la Location awareness information.
	 * @since 2018/04/21
	 */
	public SyntaxParseException(LocationAware __la)
	{
		super(__la);
	}
	
	/**
	 * Initialize the exception with a message and no cause.
	 *
	 * @param __la Location awareness information.
	 * @param __m The message.
	 * @since 2018/04/21
	 */
	public SyntaxParseException(LocationAware __la, String __m)
	{
		super(__la, __m);
	}
	
	/**
	 * Initialize the exception with a message and cause.
	 *
	 * @param __la Location awareness information.
	 * @param __m The message.
	 * @param __c The cause.
	 * @since 2018/04/21
	 */
	public SyntaxParseException(LocationAware __la, String __m,
		Throwable __c)
	{
		super(__la, __m, __c);
	}
	
	/**
	 * Initialize the exception with no message and with a cause.
	 *
	 * @param __la Location awareness information.
	 * @param __c The cause.
	 * @since 2018/04/21
	 */
	public SyntaxParseException(LocationAware __la, Throwable __c)
	{
		super(__la, __c);
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<










































































































































































































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/syntax/TypeParameterSyntax.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac.syntax;

import net.multiphasicapps.javac.token.BufferedTokenSource;
import net.multiphasicapps.javac.token.Token;
import net.multiphasicapps.javac.token.TokenSource;
import net.multiphasicapps.javac.token.TokenType;

/**
 * This represents a single type parameter which may be associated with a
 * class or method.
 *
 * @since 2018/04/24
 */
public final class TypeParameterSyntax
{
	/**
	 * {@inheritDoc}
	 * @since 2018/04/28
	 */
	@Override
	public final boolean equals(Object __o)
	{
		throw new todo.TODO();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/04/28
	 */
	@Override
	public final int hashCode()
	{
		throw new todo.TODO();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/04/28
	 */
	@Override
	public final String toString()
	{
		throw new todo.TODO();
	}
	
	/**
	 * Parses a single type parameter.
	 *
	 * @param __in The input tokens.
	 * @return The parsed type parameter.
	 * @throws NullPointerException On null arguments.
	 * @throws SyntaxParseException If the type parameter could not be
	 * parsed.
	 * @since 2018/04/24
	 */
	public static TypeParameterSyntax parse(BufferedTokenSource __in)
		throws NullPointerException, SyntaxParseException
	{
		if (__in == null)
			throw new NullPointerException("NARG");
		
		throw new todo.TODO();
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






















































































































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/syntax/TypeParametersSyntax.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac.syntax;

import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import net.multiphasicapps.collections.UnmodifiableIterator;
import net.multiphasicapps.javac.token.BufferedTokenSource;
import net.multiphasicapps.javac.token.Token;
import net.multiphasicapps.javac.token.TokenSource;
import net.multiphasicapps.javac.token.TokenType;

/**
 * This represents multiple type parameters.
 *
 * @since 2018/04/30
 */
public final class TypeParametersSyntax
	implements Iterable<TypeParameterSyntax>
{
	/** Type parameters used. */
	private final TypeParameterSyntax[] _params;
	
	/** String form. */
	private Reference<String> _string;
	
	/**
	 * Initializes the type parameters.
	 *
	 * @param __t The types to use.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/04/30
	 */
	public TypeParametersSyntax(TypeParameterSyntax... __t)
		throws NullPointerException
	{
		this(Arrays.<TypeParameterSyntax>asList(
			(__t == null ? new TypeParameterSyntax[0] : __t)));
	}
	
	/**
	 * Initializes the type parameters.
	 *
	 * @param __t The types to use.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/04/30
	 */
	public TypeParametersSyntax(Iterable<TypeParameterSyntax> __t)
		throws NullPointerException
	{
		if (__t == null)
			throw new NullPointerException("NARG");
		
		List<TypeParameterSyntax> params = new ArrayList<>();
		for (TypeParameterSyntax t : __t)
		{
			if (__t == null)
				throw new NullPointerException("NARG");
			
			params.add(t);
		}
		
		this._params = params.<TypeParameterSyntax>toArray(
			new TypeParameterSyntax[params.size()]);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/04/28
	 */
	@Override
	public final boolean equals(Object __o)
	{
		throw new todo.TODO();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/04/28
	 */
	@Override
	public final int hashCode()
	{
		throw new todo.TODO();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/05/07
	 */
	@Override
	public final Iterator<TypeParameterSyntax> iterator()
	{
		return UnmodifiableIterator.<TypeParameterSyntax>of(this._params);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/04/28
	 */
	@Override
	public final String toString()
	{
		Reference<String> ref = this._string;
		String rv;
		
		if (ref == null || null == (rv = ref.get()))
			this._string = new WeakReference<>((rv =
				Arrays.asList(this._params).toString()));
		
		return rv;
	}
	
	/**
	 * Parses a list of multiple type parameters.
	 *
	 * @param __in The input tokens.
	 * @return The parsed type parameters.
	 * @throws NullPointerException On null arguments.
	 * @throws SyntaxParseException If the type parameters could not be
	 * parsed.
	 * @since 2018/04/24
	 */
	public static TypeParametersSyntax parse(BufferedTokenSource __in)
		throws NullPointerException, SyntaxParseException
	{
		if (__in == null)
			throw new NullPointerException("NARG");
		
		throw new todo.TODO();
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


































































































































































































































































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/syntax/TypeSyntax.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac.syntax;

import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import net.multiphasicapps.javac.token.BufferedTokenSource;
import net.multiphasicapps.javac.token.Token;
import net.multiphasicapps.javac.token.TokenSource;
import net.multiphasicapps.javac.token.TokenType;

/**
 * This represents the type that may be used in the language.
 *
 * @since 2018/04/24
 */
public final class TypeSyntax
{
	/** The void type. */
	public static final TypeSyntax VOID =
		new TypeSyntax(VoidTypeSyntax.VOID, 0);
	
	/** The simple type used. */
	protected final SimpleTypeSyntax simpletype;
	
	/** The dimensions. */
	protected final int dimensions;
	
	/** String form. */
	private Reference<String> _string;
	
	/**
	 * Initializes the type using a basic qualified identifier.
	 *
	 * @param __qi The qualified identifier used.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/05/10
	 */
	public TypeSyntax(QualifiedIdentifierSyntax __qi)
		throws NullPointerException
	{
		if (__qi == null)
			throw new NullPointerException("NARG");
		
		this.simpletype = new GenericTypeSyntax(__qi);
		this.dimensions = 0;
	}
	
	/**
	 * Initializes the type information.
	 *
	 * @param __st The simple type.
	 * @param __dims The dimensions used for the type.
	 * @throws IllegalArgumentException If the number of dimensions is
	 * negative.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/04/30
	 */
	public TypeSyntax(SimpleTypeSyntax __st, int __dims)
		throws IllegalArgumentException, NullPointerException
	{
		if (__st == null)
			throw new NullPointerException("NARG");
		
		// {@squirreljme.error AQ2h Types cannot have negative dimensions.}
		if (__dims < 0)
			throw new IllegalArgumentException("AQ2h");
		
		this.simpletype = __st;
		this.dimensions = __dims;
	}
	
	/**
	 * Returns the number of dimensions associated with the type.
	 *
	 * @return The number of dimensions associated with the type.
	 * @since 2018/04/30
	 */
	public final int dimensions()
	{
		return this.dimensions;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/04/28
	 */
	@Override
	public final boolean equals(Object __o)
	{
		throw new todo.TODO();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/04/28
	 */
	@Override
	public final int hashCode()
	{
		throw new todo.TODO();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/04/28
	 */
	@Override
	public final String toString()
	{
		Reference<String> ref = this._string;
		String rv;
		
		if (ref == null || null == (rv = ref.get()))
		{
			int dims = this.dimensions;
			this._string = new WeakReference<>(
				(rv = (this.simpletype.toString() +
					(dims <= 0 ? "" : "[" + dims + "]"))));
		}
		
		return rv;
	}
	
	/**
	 * Returns the type with the given number of array dimensions.
	 *
	 * @param __d The number of dimensions to use for the type.
	 * @return The type with the given dimension count.
	 * @throws IllegalArgumentException If the dimension count is negative.
	 * @since 2018/04/29
	 */
	public final TypeSyntax withDimensions(int __d)
		throws IllegalArgumentException
	{
		// {@squirreljme.error AQ2i Cannot initialize type with a negative
		// number of dimensions.}
		if (__d < 0)
			throw new IllegalArgumentException("AQ2i");
		
		throw new todo.TODO();
	}
	
	/**
	 * Parses a single type.
	 *
	 * @param __in The input token source.
	 * @return The parsed type.
	 * @throws NullPointerException On null arguments.
	 * @throws SyntaxParseException If the type is not valid.
	 * @since 2018/04/24
	 */
	public static TypeSyntax parseType(BufferedTokenSource __in)
		throws NullPointerException, SyntaxParseException
	{
		if (__in == null)
			throw new NullPointerException("NARG");
		
		// Determine the simple type
		Token token = __in.peek();
		SimpleTypeSyntax simple;
		switch (token.type())
		{
			case KEYWORD_BYTE:
				simple = BasicTypeSyntax.BYTE;
				__in.next();
				break;
				
			case KEYWORD_SHORT:
				simple = BasicTypeSyntax.SHORT;
				__in.next();
				break;
				
			case KEYWORD_CHAR:
				simple = BasicTypeSyntax.CHARACTER;
				__in.next();
				break;
				
			case KEYWORD_INT:
				simple = BasicTypeSyntax.INTEGER;
				__in.next();
				break;
				
			case KEYWORD_LONG:
				simple = BasicTypeSyntax.LONG;
				__in.next();
				break;
				
			case KEYWORD_FLOAT:
				simple = BasicTypeSyntax.FLOAT;
				__in.next();
				break;
				
			case KEYWORD_DOUBLE:
				simple = BasicTypeSyntax.DOUBLE;
				__in.next();
				break;
			
				// Probably class or method handler
			case IDENTIFIER:
				simple = GenericTypeSyntax.parse(__in);
				break;
			
				// {@squirreljme.error AQ2j Invalid type.}
			default:
				throw new SyntaxParseException(token, "AQ2j");
		}
		
		// Handle dimensions
		int dims = 0;
		while ((token = __in.peek()).type() == TokenType.SYMBOL_OPEN_BRACKET)
		{
			__in.next();
			
			// {@squirreljme.error AQ2k Expected closing bracket to follow
			// opening bracket when declaring type.}
			token = __in.next();
			if (token.type() != TokenType.SYMBOL_CLOSED_BRACKET)
				throw new SyntaxParseException(token, "AQ2k");
			dims++;
		}
		
		// Build type
		return new TypeSyntax(simple, dims);
	}
	
	/**
	 * Parses multiple types separated by a comma.
	 *
	 * @param __in The input token source.
	 * @return The parsed types.
	 * @throws NullPointerException On null arguments.
	 * @throws SyntaxParseException If the types are not valid.
	 * @since 2018/04/24
	 */
	public static TypeSyntax[] parseTypes(BufferedTokenSource __in)
		throws NullPointerException, SyntaxParseException
	{
		if (__in == null)
			throw new NullPointerException("NARG");
		
		throw new todo.TODO();
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


























































































































































































































































































































































































































































































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/syntax/UnparsedExpressions.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac.syntax;

import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import net.multiphasicapps.javac.token.BufferedTokenSource;
import net.multiphasicapps.javac.token.Token;
import net.multiphasicapps.javac.token.TokenSource;
import net.multiphasicapps.javac.token.TokenType;

/**
 * This class represents expressions which have not been parsed and are just
 * a raw set of tokens.
 *
 * @since 2018/04/28
 */
public final class UnparsedExpressions
{
	/** Tokens which make up the expression. */
	private final Token[] _tokens;
	
	/** The hashcode for these expressions. */
	private final int _hashcode;
	
	/** String form. */
	private Reference<String> _string;
	
	/**
	 * Initializes the unparsed expression.
	 *
	 * @param __t The input tokens.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/04/29
	 */
	public UnparsedExpressions(Iterable<Token> __t)
		throws NullPointerException
	{
		if (__t == null)
			throw new NullPointerException("NARG");
		
		// Copy tokens
		List<Token> tokens = new ArrayList<>();
		for (Token t : __t)
		{
			if (t == null)
				throw new NullPointerException("NARG");
			
			tokens.add(t);
		}
		
		// Finalize
		this._tokens = tokens.<Token>toArray(new Token[tokens.size()]);
		this._hashcode = tokens.hashCode();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/04/28
	 */
	@Override
	public final boolean equals(Object __o)
	{
		throw new todo.TODO();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/04/28
	 */
	@Override
	public final int hashCode()
	{
		return this._hashcode;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/04/28
	 */
	@Override
	public final String toString()
	{
		Reference<String> ref = this._string;
		String rv;
		
		if (ref == null || null == (rv = ref.get()))
			this._string = new WeakReference<>((rv =
				Arrays.asList(this._tokens).toString()));
		
		return rv;
	}
	
	/**
	 * Parses arguments which are included in a block of parenthesis.
	 *
	 * @param __in The input tokens.
	 * @return The unparsed expressions.
	 * @throws NullPointerException On null arguments.
	 * @throws SyntaxParseException If it could not be parsed.
	 * @since 2018/05/01
	 */
	public static UnparsedExpressions parseArguments(BufferedTokenSource __in)
		throws NullPointerException, SyntaxParseException
	{
		if (__in == null)
			throw new NullPointerException("NARG");
		
		return UnparsedExpressions.stackTypeParse(__in,
			TokenType.SYMBOL_OPEN_PARENTHESIS,
			TokenType.SYMBOL_CLOSED_PARENTHESIS);
	}
	
	/**
	 * Parses a block of expressions to not be parsed.
	 *
	 * @param __in The input tokens.
	 * @return The unparsed expressions.
	 * @throws NullPointerException On null arguments.
	 * @throws SyntaxParseException If the block is not valid.
	 * @since 2018/04/28
	 */
	public static UnparsedExpressions parseBlock(BufferedTokenSource __in)
		throws NullPointerException, SyntaxParseException
	{
		if (__in == null)
			throw new NullPointerException("NARG");
		
		return UnparsedExpressions.stackTypeParse(__in,
			TokenType.SYMBOL_OPEN_BRACE, TokenType.SYMBOL_CLOSED_BRACE);
	}
	
	/**
	 * Parses expressions keeping a stack of which ones that were opened and
	 * closed.
	 *
	 * @param __in The input tokens.
	 * @param __open The open type.
	 * @param __close The close type.
	 * @return The unparsed expressions.
	 * @since 2018/05/01
	 */
	public static UnparsedExpressions stackTypeParse(BufferedTokenSource __in,
		TokenType __open, TokenType __close)
		throws NullPointerException, SyntaxParseException
	{
		if (__in == null || __open == null || __close == null)
			throw new NullPointerException("NARG");
		
		// Input tokens
		List<Token> tokens = new LinkedList<>();
		
		// {@squirreljme.error AQ2l Expected start of expression to start with
		// a given symbol. (The expected symbol)}
		Token token = __in.next(),
			base = token;
		if (token.type() != __open)
			throw new SyntaxParseException(token, String.format("AQ2l %s",
				__open));
		tokens.add(token);
		
		// Just count braces and such
		for (int count = 1; count != 0;)
		{
			token = __in.next();
			
			// {@squirreljme.error AQ2m This token might not have been
			// closed properly as the end of file was reached.}
			if (token.type() == TokenType.END_OF_FILE)
				throw new SyntaxParseException(base, "AQ2m");
			
			// Add or remove braces
			else if (token.type() == __open)
				count++;
			else if (token.type() == __close)
				count--;
			
			// Add token always
			tokens.add(token);
		}
		
		// Build
		return new UnparsedExpressions(tokens);
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<












































































































































































































































































































































































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/syntax/VoidTypeSyntax.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac.syntax;

/**
 * This represents the void type.
 *
 * @since 2018/04/30
 */
public enum VoidTypeSyntax
	implements SimpleTypeSyntax
{
	/** Void. */
	VOID,
	
	/** End. */
	;
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






















































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/syntax/__TreeBuilder__.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac.syntax;

import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import net.multiphasicapps.collections.UnmodifiableList;
import net.multiphasicapps.collections.UnmodifiableMap;

/**
 * This is a utility class which can be used to build a tree from a structure,
 * a tree is essentially just a map of data.
 *
 * @since 2019/01/17
 */
final class __TreeBuilder__
{
	/** Resulting set. */
	private final Map<String, Object> _out =
		new LinkedHashMap<>();
	
	/**
	 * Adds the specified element.
	 *
	 * @param __k The key.
	 * @param __v The value.
	 * @return {@code this}.
	 * @throws NullPointerException If no key was specified.
	 * @since 2019/01/17
	 */
	public final __TreeBuilder__ add(String __k, Object __v)
		throws NullPointerException
	{
		if (__k == null)
			throw new NullPointerException("NARG");
		
		this._out.put(__k, __v);
		return this;
	}
	
	/**
	 * Adds the specified element.
	 *
	 * @param __k The key.
	 * @param __l The list.
	 * @return {@code this}.
	 * @throws NullPointerException If no key was specified.
	 * @since 2019/01/17
	 */
	public final __TreeBuilder__ addList(String __k, Object[] __l)
		throws NullPointerException
	{
		if (__k == null)
			throw new NullPointerException("NARG");
		
		this._out.put(__k, UnmodifiableList.of(
			Arrays.asList((__l == null ? new Object[0] : __l.clone()))));
		return this;
	}
	
	/**
	 * Builds the resulting map.
	 *
	 * @return The resulting map.
	 * @since 2019/01/17
	 */
	public final Map<String, Object> build()
	{
		return UnmodifiableMap.of(
			new LinkedHashMap<String, Object>(this._out));
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






































































































































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/syntax/expr/ExpressionAssignmentSyntax.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac.syntax.expr;

/**
 * This represents an expression on the left hand which is potentially operated
 * on an assigned to the value on the right hand.
 *
 * @since 2018/05/03
 */
public final class ExpressionAssignmentSyntax
	implements ExpressionSyntax
{
	/**
	 * {@inheritDoc}
	 * @since 2018/05/03
	 */
	@Override
	public final boolean equals(Object __o)
	{
		throw new todo.TODO();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/05/03
	 */
	@Override
	public final int hashCode()
	{
		throw new todo.TODO();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/05/03
	 */
	@Override
	public final String toString()
	{
		throw new todo.TODO();
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<








































































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/syntax/expr/ExpressionOneSyntax.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac.syntax.expr;

/**
 * This represents one of the upper expression syntax formats and is used as
 * a base to construct ternary operations.
 *
 * @since 2018/05/03
 */
public interface ExpressionOneSyntax
	extends ExpressionSyntax
{
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<














































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/syntax/expr/ExpressionSyntax.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac.syntax.expr;

import net.multiphasicapps.javac.syntax.AnnotationValueSyntax;

/**
 * This interface represents the base interface for all expression
 * representations.
 *
 * @since 2018/05/03
 */
public interface ExpressionSyntax
	extends AnnotationValueSyntax
{
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


















































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/syntax/expr/ExpressionSyntaxParsers.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac.syntax.expr;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import net.multiphasicapps.classfile.BinaryName;
import net.multiphasicapps.javac.syntax.QualifiedIdentifierSyntax;
import net.multiphasicapps.javac.syntax.SyntaxDefinitionException;
import net.multiphasicapps.javac.syntax.SyntaxParseException;
import net.multiphasicapps.javac.token.BufferedTokenSource;
import net.multiphasicapps.javac.token.Token;
import net.multiphasicapps.javac.token.TokenType;

/**
 * This class contains all of the parsers for each of the expression syntax
 * formats which are available.
 *
 * @since 2018/05/03
 */
public final class ExpressionSyntaxParsers
{
	/**
	 * Not used.
	 *
	 * @since 2018/05/03
	 */
	private ExpressionSyntaxParsers()
	{
	}
	
	/**
	 * Parses an expression.
	 *
	 * @param __in The input token source.
	 * @return The resulting expression.
	 * @throws NullPointerException On null arguments.
	 * @throws SyntaxParseException If the expression is not valid.
	 * @since 2018/05/03
	 */
	public static ExpressionSyntax parseExpression(BufferedTokenSource __in)
		throws NullPointerException, SyntaxParseException
	{
		if (__in == null)
			throw new NullPointerException("NARG");
		
		// Parse one expression
		ExpressionOneSyntax one = ExpressionSyntaxParsers.
			parseExpressionOne(__in);
		
		// Check for assignment operation
		Token token = __in.peek();
		if (token.type().isAssignmentOperator())
			throw new todo.TODO();
		
		// Just a plain expression syntax
		else
			return new PlainExpressionSyntax(one);
	}
	
	/**
	 * Parses an expression one.
	 *
	 * @param __in The input token source.
	 * @return The resulting expression.
	 * @throws NullPointerException On null arguments.
	 * @throws SyntaxParseException If the expression is not valid.
	 * @since 2018/05/03
	 */
	public static ExpressionOneSyntax parseExpressionOne(
		BufferedTokenSource __in)
		throws NullPointerException, SyntaxParseException
	{
		if (__in == null)
			throw new NullPointerException("NARG");
		
		// Parse an expression two
		ExpressionTwoSyntax two = ExpressionSyntaxParsers.
			parseExpressionTwo(__in);
		
		// May contain ternary operation
		Token token = __in.peek();
		if (token.type() == TokenType.SYMBOL_QUESTION)
			throw new todo.TODO();
		
		// Just a plain expression one
		else
			return new PlainExpressionOneSyntax(two);
	}
	
	/**
	 * Parses an expression two.
	 *
	 * @param __in The input token source.
	 * @return The resulting expression.
	 * @throws NullPointerException On null arguments.
	 * @throws SyntaxParseException If the expression is not valid.
	 * @since 2018/05/03
	 */
	public static ExpressionTwoSyntax parseExpressionTwo(
		BufferedTokenSource __in)
		throws NullPointerException, SyntaxParseException
	{
		if (__in == null)
			throw new NullPointerException("NARG");
		
		// Starts with an expression three
		ExpressionThreeSyntax three = ExpressionSyntaxParsers.
			parseExpressionThree(__in);
		
		// May be followed by instanceof
		Token token = __in.peek();
		if (token.type() == TokenType.KEYWORD_INSTANCEOF)
			throw new todo.TODO();
		
		// Otherwise it might be infix operations stacked on each other
		// Note that expression twos are not included in the same region so
		// a bunch of infix operations will stack on each other
		else if (token.type().isInfixOperation())
			throw new todo.TODO();
		
		// Is just a plain expression two syntax
		else
			return new PlainExpressionTwoSyntax(three);
	}
	
	/**
	 * Parses an expression three.
	 *
	 * @param __in The input token source.
	 * @return The resulting expression.
	 * @throws NullPointerException On null arguments.
	 * @throws SyntaxParseException If the expression is not valid.
	 * @since 2018/05/03
	 */
	public static ExpressionThreeSyntax parseExpressionThree(
		BufferedTokenSource __in)
		throws NullPointerException, SyntaxParseException
	{
		if (__in == null)
			throw new NullPointerException("NARG");
		
		// This could be a prefix operation
		Token token = __in.peek();
		PrefixOperatorType prefix;
		switch (token.type())
		{
			case OPERATOR_INCREMENT:
				prefix = PrefixOperatorType.INCREMENT;
				break;
			
			case OPERATOR_DECREMENT:
				prefix = PrefixOperatorType.DECREMENT;
				break;
			
			case OPERATOR_NOT:
				prefix = PrefixOperatorType.NOT;
				break;
			
			case OPERATOR_COMPLEMENT:
				prefix = PrefixOperatorType.ONES_COMPLEMENT;
				break;
			
			case OPERATOR_PLUS:
				prefix = PrefixOperatorType.POSITIVE;
				break;
			
			case OPERATOR_MINUS:
				prefix = PrefixOperatorType.NEGATIVE;
				break;
			
			default:
				prefix = null;
				break;
		}
		
		// This is a prefixed operation
		if (prefix != null)
		{
			__in.next();
			return new PrefixOpExpressionSyntax(prefix,
				ExpressionSyntaxParsers.parseExpressionThree(__in));
		}
		
		// Will be a type cast or an expression in a parenthesis (the latter
		// I am not too sure about as it does not make much sense, it could
		// be a language design decision for future proofing?)
		token = __in.peek();
		if (token.type() == TokenType.SYMBOL_OPEN_PARENTHESIS)
		{
			throw new todo.TODO();
		}
		
		// Parse a primary
		PrimarySyntax primary = ExpressionSyntaxParsers.parsePrimary(__in);
		
		// Read in selectors
		List<SelectorSyntax> selectors = new ArrayList<>();
		for (;;)
		{
			// Is not going to be a selector?
			token = __in.peek();
			if (token.type() != TokenType.SYMBOL_DOT &&
				token.type() != TokenType.SYMBOL_OPEN_BRACE)
				break;
			
			throw new todo.TODO();
		}
		
		// Read in postfix operations, if any
		List<PostfixOperatorType> postfixes = new ArrayList<>();
		for (;;)
		{
			token = __in.peek();
			
			// Increment?
			if (token.type() == TokenType.OPERATOR_INCREMENT)
			{
				__in.next();
				postfixes.add(PostfixOperatorType.INCREMENT);
			}
			
			// Decrement?
			else if (token.type() == TokenType.OPERATOR_DECREMENT)
			{
				__in.next();
				postfixes.add(PostfixOperatorType.DECREMENT);
			}
			
			// Unknown, stop parsing
			else
				break;
		}
		
		// Build expression
		return new PrimarySelectorAndPostfixExpression(primary,
			selectors, postfixes);
	}
	
	/**
	 * Parses a primary syntax.
	 *
	 * @param __in The input token source.
	 * @return The primary token.
	 * @throws NullPointerException On null arguments.
	 * @throws SyntaxParseException If it is not a valid primary syntax.
	 * @since 2018/05/03
	 */
	public static PrimarySyntax parsePrimary(BufferedTokenSource __in)
		throws NullPointerException, SyntaxParseException
	{
		if (__in == null)
			throw new NullPointerException("NARG");
		
		// It could be a literal value
		Token token = __in.peek();
		switch (token.type())
		{
			case LITERAL_NULL:
			case LITERAL_FALSE:
			case LITERAL_TRUE:
			case LITERAL_BINARY_INTEGER:
			case LITERAL_OCTAL_INTEGER:
			case LITERAL_DECIMAL_INTEGER:
			case LITERAL_HEXADECIMAL_INTEGER:
			case LITERAL_DECIMAL_FLOAT:
			case LITERAL_HEXADECIMAL_FLOAT:
			case LITERAL_STRING:
			case LITERAL_CHARACTER:
				__in.next();
				return new LiteralSyntax(token.characters());
			
				// Is not one
			default:
				break;
		}
		
		// Parenthesis operation
		token = __in.peek();
		if (token.type() == TokenType.SYMBOL_OPEN_PARENTHESIS)
			throw new todo.TODO();
		
		// This... something potentially
		else if (token.type() == TokenType.KEYWORD_THIS)
			throw new todo.TODO();
		
		// Super something
		else if (token.type() == TokenType.KEYWORD_SUPER)
			throw new todo.TODO();
		
		// New something
		else if (token.type() == TokenType.KEYWORD_NEW)
			throw new todo.TODO();
		
		// void.class
		else if (token.type() == TokenType.KEYWORD_VOID)
			throw new todo.TODO();
		
		// Non-wildcard type arguments
		else if (token.type() == TokenType.COMPARE_LESS_THAN)
			throw new todo.TODO();
		
		// Is a basic type (which could be an array) followed by .class
		else if (token.type().isBasicType())
			throw new todo.TODO();
		
		// Will be an identifier followed by something
		else if (token.type() == TokenType.IDENTIFIER)
		{
			// This is going to be a qualified identifier but modified slightly
			// since .<non-identifier> can appear which would break
			// QualifiedIdentifierSyntax
			StringBuilder sb = new StringBuilder();
			for (;;)
			{
				// {@squirreljme.error AQ2n Expected identifier while parsing
				// a primary expression.}
				token = __in.next();
				if (token.type() != TokenType.IDENTIFIER)
					throw new SyntaxParseException(token, "AQ2n");
				
				// Add that
				sb.append(token.characters());
				
				// Need to peek ahead because it might not be an identifier
				token = __in.peek();
				Token after = __in.peek(1);
				
				// Stop if this is not a .identifier but something else
				if (token.type() != TokenType.SYMBOL_DOT ||
					after.type() != TokenType.IDENTIFIER)
					break;
				
				// Add dot
				sb.append('.');
				__in.next();
			}
			
			// Build that
			IdentifierSyntax qi = new IdentifierSyntax(sb.toString());
			
			// Opening of an array
			token = __in.peek();
			if (token.type() == TokenType.SYMBOL_OPEN_BRACKET)
				throw new todo.TODO();
			
			// Method arguments
			else if (token.type() == TokenType.SYMBOL_OPEN_PARENTHESIS)
				throw new todo.TODO();
			
			// Sub-something on the argument
			else if (token.type() == TokenType.SYMBOL_DOT)
				throw new todo.TODO();
			
			// Is just going to be a plain identifier
			else
				return new PlainIdentifierSyntax(qi);
		}
		
		// {@squirreljme.error AQ2o This is not a valid primary expression.}
		else
			throw new SyntaxParseException(token, "AQ2o");
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<












































































































































































































































































































































































































































































































































































































































































































































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/syntax/expr/ExpressionThreeSyntax.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac.syntax.expr;

/**
 * Represents an expression three syntax.
 *
 * @since 2018/05/03
 */
public interface ExpressionThreeSyntax
	extends ExpressionSyntax
{
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<












































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/syntax/expr/ExpressionTwoSyntax.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac.syntax.expr;

/**
 * DESCRIBE THIS.
 *
 * @since 2018/05/03
 */
public interface ExpressionTwoSyntax
	extends ExpressionSyntax
{
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<












































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/syntax/expr/IdentifierSyntax.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac.syntax.expr;

/**
 * This represents an identifier.
 *
 * @since 2018/05/03
 */
public final class IdentifierSyntax
{
	/** The string which makes up the identifier. */
	protected final String string;
	
	/**
	 * Initializes the identifier syntax.
	 *
	 * @param __s The identifier string.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/05/03
	 */
	public IdentifierSyntax(String __s)
		throws NullPointerException
	{
		if (__s == null)
			throw new NullPointerException("NARG");
		
		this.string = __s;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/05/03
	 */
	@Override
	public final boolean equals(Object __o)
	{
		if (__o == this)
			return true;
		
		if (!(__o instanceof IdentifierSyntax))
			return false;
		
		IdentifierSyntax o = (IdentifierSyntax)__o;
		return this.string.equals(o.string);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/05/03
	 */
	@Override
	public final int hashCode()
	{
		return this.string.hashCode();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/05/03
	 */
	@Override
	public final String toString()
	{
		throw new todo.TODO();
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
























































































































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/syntax/expr/InfixExpressionsSyntax.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac.syntax.expr;

/**
 * This contains multiple infix operations (normal ones such as {@code 2 + 2}).
 *
 * @since 2018/05/03
 */
public final class InfixExpressionsSyntax
	implements ExpressionTwoSyntax
{
	/**
	 * {@inheritDoc}
	 * @since 2018/05/03
	 */
	@Override
	public final boolean equals(Object __o)
	{
		throw new todo.TODO();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/05/03
	 */
	@Override
	public final int hashCode()
	{
		throw new todo.TODO();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/05/03
	 */
	@Override
	public final String toString()
	{
		throw new todo.TODO();
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






































































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/syntax/expr/InstanceOfSyntax.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac.syntax.expr;

/**
 * This represents the {@code instanceof} operation on an expression.
 *
 * @since 2018/05/03
 */
public final class InstanceOfSyntax
	implements ExpressionTwoSyntax
{
	/**
	 * {@inheritDoc}
	 * @since 2018/05/03
	 */
	@Override
	public final boolean equals(Object __o)
	{
		throw new todo.TODO();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/05/03
	 */
	@Override
	public final int hashCode()
	{
		throw new todo.TODO();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/05/03
	 */
	@Override
	public final String toString()
	{
		throw new todo.TODO();
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






































































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/syntax/expr/LiteralSyntax.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac.syntax.expr;

/**
 * This represents a literal value which may be a {@code boolean}, number,
 * string, or {@code null}.
 *
 * @since 2018/05/03
 */
public final class LiteralSyntax
	implements PrimarySyntax
{
	/** The characters that make up the literal. */
	protected final String string;
	
	/**
	 * Initializes the literal.
	 *
	 * @param __s The characters that make up the literal.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/05/03
	 */
	public LiteralSyntax(String __s)
		throws NullPointerException
	{
		if (__s == null)
			throw new NullPointerException("NARG");
		
		this.string = __s;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/05/03
	 */
	@Override
	public final boolean equals(Object __o)
	{
		if (__o == this)
			return true;
		
		if (!(__o instanceof LiteralSyntax))
			return false;
		
		LiteralSyntax o = (LiteralSyntax)__o;
		return this.string.equals(o.string);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/05/03
	 */
	@Override
	public final int hashCode()
	{
		return this.string.hashCode();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/05/03
	 */
	@Override
	public final String toString()
	{
		throw new todo.TODO();
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




























































































































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/syntax/expr/PlainExpressionOneSyntax.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac.syntax.expr;

/**
 * This is just an expression one syntax which contains a single expression
 * two syntax and has no ternary operation.
 *
 * @since 2018/05/03
 */
public final class PlainExpressionOneSyntax
	implements ExpressionOneSyntax
{
	/** The expression used. */
	protected final ExpressionTwoSyntax expression;
	
	/**
	 * Initializes the plain syntax.
	 *
	 * @param __expr The expression used.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/05/03
	 */
	public PlainExpressionOneSyntax(ExpressionTwoSyntax __expr)
		throws NullPointerException
	{
		if (__expr == null)
			throw new NullPointerException("NARG");
		
		this.expression = __expr;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/05/03
	 */
	@Override
	public final boolean equals(Object __o)
	{
		if (__o == this)
			return true;
		
		if (!(__o instanceof PlainExpressionOneSyntax))
			return false;
		
		PlainExpressionOneSyntax o = (PlainExpressionOneSyntax)__o;
		return this.expression.equals(o.expression);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/05/03
	 */
	@Override
	public final int hashCode()
	{
		return this.expression.hashCode();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/05/03
	 */
	@Override
	public final String toString()
	{
		throw new todo.TODO();
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




























































































































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/syntax/expr/PlainExpressionSyntax.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac.syntax.expr;

/**
 * This represents an expression is just a plain single expression with no
 * assignments.
 *
 * @since 2018/05/03
 */
public final class PlainExpressionSyntax
	implements ExpressionSyntax
{
	/** The expression used. */
	protected final ExpressionOneSyntax expression;
	
	/**
	 * Initializes the plain syntax.
	 *
	 * @param __expr The expression used.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/05/03
	 */
	public PlainExpressionSyntax(ExpressionOneSyntax __expr)
		throws NullPointerException
	{
		if (__expr == null)
			throw new NullPointerException("NARG");
		
		this.expression = __expr;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/05/03
	 */
	@Override
	public final boolean equals(Object __o)
	{
		if (__o == this)
			return true;
		
		if (!(__o instanceof PlainExpressionSyntax))
			return false;
		
		PlainExpressionSyntax o = (PlainExpressionSyntax)__o;
		return this.expression.equals(o.expression);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/05/03
	 */
	@Override
	public final int hashCode()
	{
		return this.expression.hashCode();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/05/03
	 */
	@Override
	public final String toString()
	{
		throw new todo.TODO();
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




























































































































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/syntax/expr/PlainExpressionTwoSyntax.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac.syntax.expr;

/**
 * This represents a plain expression two syntax which does not have a block
 * or {@code instanceof}.
 *
 * @since 2018/05/03
 */
public final class PlainExpressionTwoSyntax
	implements ExpressionTwoSyntax
{
	/** The expression used. */
	protected final ExpressionThreeSyntax expression;
	
	/**
	 * Initializes the plain syntax.
	 *
	 * @param __expr The expression used.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/05/03
	 */
	public PlainExpressionTwoSyntax(ExpressionThreeSyntax __expr)
		throws NullPointerException
	{
		if (__expr == null)
			throw new NullPointerException("NARG");
		
		this.expression = __expr;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/05/03
	 */
	@Override
	public final boolean equals(Object __o)
	{
		if (__o == this)
			return true;
		
		if (!(__o instanceof PlainExpressionTwoSyntax))
			return false;
		
		PlainExpressionTwoSyntax o = (PlainExpressionTwoSyntax)__o;
		return this.expression.equals(o.expression);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/05/03
	 */
	@Override
	public final int hashCode()
	{
		return this.expression.hashCode();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/05/03
	 */
	@Override
	public final String toString()
	{
		throw new todo.TODO();
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




























































































































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/syntax/expr/PlainIdentifierSyntax.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac.syntax.expr;

/**
 * This is just a plain identifier.
 *
 * @since 2018/05/03
 */
public final class PlainIdentifierSyntax
	implements PrimarySyntax
{
	/** The identifier used. */
	protected final IdentifierSyntax identifier;
	
	/**
	 * Initializes the plain identifier.
	 *
	 * @param __i The identifier used.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/05/03
	 */
	public PlainIdentifierSyntax(IdentifierSyntax __i)
		throws NullPointerException
	{
		if (__i == null)
			throw new NullPointerException("NARG");
		
		this.identifier = __i;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/05/03
	 */
	@Override
	public final boolean equals(Object __o)
	{
		if (__o == this)
			return true;
		
		if (!(__o instanceof PlainIdentifierSyntax))
			return false;
		
		PlainIdentifierSyntax o = (PlainIdentifierSyntax)__o;
		return this.identifier.equals(o.identifier);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/05/03
	 */
	@Override
	public final int hashCode()
	{
		return this.identifier.hashCode();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/05/03
	 */
	@Override
	public final String toString()
	{
		throw new todo.TODO();
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


























































































































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/syntax/expr/PostfixOperatorType.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac.syntax.expr;

/**
 * This represents a postfix operation.
 *
 * @since 2018/05/03
 */
public enum PostfixOperatorType
{
	/** Increment. */
	INCREMENT,
	
	/** Decrement. */
	DECREMENT,
	
	/** End. */
	;
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


























































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/syntax/expr/PreEvaluateExpression.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac.syntax.expr;

/**
 * This is an expression which has a pre-evaluated within parenthesis which
 * is then performed on. It is in the form of {@code (expression)expression3}.
 *
 * Note that the only probably valid form of this syntax would be parenthesis
 * expressions which follow the expression.
 *
 * @since 2018/05/03
 */
public final class PreEvaluateExpression
	implements ExpressionThreeSyntax
{
	/**
	 * {@inheritDoc}
	 * @since 2018/05/03
	 */
	@Override
	public final boolean equals(Object __o)
	{
		throw new todo.TODO();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/05/03
	 */
	@Override
	public final int hashCode()
	{
		throw new todo.TODO();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/05/03
	 */
	@Override
	public final String toString()
	{
		throw new todo.TODO();
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<














































































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/syntax/expr/PrefixOpExpressionSyntax.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac.syntax.expr;

/**
 * This represents an expression which is prefixed by a prefix operation.
 *
 * @since 2018/05/03
 */
public final class PrefixOpExpressionSyntax
	implements ExpressionThreeSyntax
{
	/** The prefix operator. */
	protected final PrefixOperatorType operator;
	
	/** The expression being operated on. */
	protected final ExpressionThreeSyntax expression;
	
	/**
	 * Initializes the prefix operation.
	 *
	 * @param __op The operation being performed.
	 * @param __expr The expression to be operated on.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/05/03
	 */
	public PrefixOpExpressionSyntax(PrefixOperatorType __op,
		ExpressionThreeSyntax __expr)
		throws NullPointerException
	{
		if (__op == null || __expr == null)
			throw new NullPointerException("NARG");
		
		this.operator = __op;
		this.expression = __expr;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/05/03
	 */
	@Override
	public final boolean equals(Object __o)
	{
		throw new todo.TODO();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/05/03
	 */
	@Override
	public final int hashCode()
	{
		throw new todo.TODO();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/05/03
	 */
	@Override
	public final String toString()
	{
		throw new todo.TODO();
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
























































































































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/syntax/expr/PrefixOperatorType.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac.syntax.expr;

/**
 * Represents a prefix operation.
 *
 * @since 2018/05/02
 */
public enum PrefixOperatorType
{
	/** Increment. */
	INCREMENT,
	
	/** Decrement. */
	DECREMENT,
	
	/** Not. */
	NOT,
	
	/** One's complement. */
	ONES_COMPLEMENT,
	
	/** Positive. */
	POSITIVE,
	
	/** Negative. */
	NEGATIVE,
	
	/** End. */
	;
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


















































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/syntax/expr/PrimarySelectorAndPostfixExpression.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac.syntax.expr;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * This is an operation which performs selections on a primary value which is
 * then postfixed accordingly.
 *
 * @since 2018/05/03
 */
public final class PrimarySelectorAndPostfixExpression
	implements ExpressionThreeSyntax
{
	/** The primary. */
	protected final PrimarySyntax primary;
	
	/** The selectors. */
	private final SelectorSyntax[] _selectors;
	
	/** The postfix operations. */
	private final PostfixOperatorType[] _postfixes;
	
	/**
	 * Initializes the primary selection with possible selectors and
	 * postfixing.
	 *
	 * @param __primary The primary expression.
	 * @param __selectors The selectors to perform on it.
	 * @param __postfixes Any postfixes to be done.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/05/03
	 */
	public PrimarySelectorAndPostfixExpression(PrimarySyntax __primary,
		Iterable<SelectorSyntax> __selectors,
		Iterable<PostfixOperatorType> __postfixes)
		throws NullPointerException
	{
		if (__primary == null || __selectors == null || __postfixes == null)
			throw new NullPointerException("NARG");
		
		this.primary = __primary;
		
		// Check selectors
		List<SelectorSyntax> selectors = new ArrayList<>();
		for (SelectorSyntax v : __selectors)
		{
			if (v == null)
				throw new NullPointerException("NARG");
			
			selectors.add(v);
		}
		this._selectors = selectors.<SelectorSyntax>toArray(
			new SelectorSyntax[selectors.size()]);
		
		// Check postfixes
		List<PostfixOperatorType> postfixes = new ArrayList<>();
		for (PostfixOperatorType v : __postfixes)
		{
			if (v == null)
				throw new NullPointerException("NARG");
			
			postfixes.add(v);
		}
		this._postfixes = postfixes.<PostfixOperatorType>toArray(
			new PostfixOperatorType[postfixes.size()]);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/05/03
	 */
	@Override
	public final boolean equals(Object __o)
	{
		if (__o == this)
			return true;
		
		if (!(__o instanceof PrimarySelectorAndPostfixExpression))
			return false;
		
		PrimarySelectorAndPostfixExpression o =
			(PrimarySelectorAndPostfixExpression)__o;
		return this.primary.equals(o.primary) &&
			Arrays.equals(this._selectors, o._selectors) &&
			Arrays.equals(this._postfixes, o._postfixes);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/05/03
	 */
	@Override
	public final int hashCode()
	{
		int hash = 0;
		for (Object v : this._selectors)
			hash ^= v.hashCode();
		for (Object v : this._postfixes)
			hash ^= v.hashCode();
		return this.primary.hashCode() ^ hash;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/05/03
	 */
	@Override
	public final String toString()
	{
		throw new todo.TODO();
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


























































































































































































































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/syntax/expr/PrimarySyntax.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac.syntax.expr;

/**
 * This interface represents a primary expression.
 *
 * @since 2018/05/03
 */
public interface PrimarySyntax
	extends ExpressionSyntax
{
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<












































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/syntax/expr/SelectorSyntax.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac.syntax.expr;

/**
 * This represents a selector.
 *
 * @since 2018/05/03
 */
public interface SelectorSyntax
	extends ExpressionSyntax
{
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<












































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/syntax/expr/TernaryOperationSyntax.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac.syntax.expr;

/**
 * This represents an operation which operates potentially on multiple
 * ternary operations.
 *
 * @since 2018/05/03
 */
public final class TernaryOperationSyntax
	implements ExpressionOneSyntax
{
	/**
	 * {@inheritDoc}
	 * @since 2018/05/03
	 */
	@Override
	public final boolean equals(Object __o)
	{
		throw new todo.TODO();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/05/03
	 */
	@Override
	public final int hashCode()
	{
		throw new todo.TODO();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/05/03
	 */
	@Override
	public final String toString()
	{
		throw new todo.TODO();
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<








































































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/syntax/expr/TypeCastSyntax.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac.syntax.expr;

/**
 * This is an expression which is a type cast.
 *
 * @since 2018/05/03
 */
public final class TypeCastSyntax
	implements ExpressionThreeSyntax
{
	/**
	 * {@inheritDoc}
	 * @since 2018/05/03
	 */
	@Override
	public final boolean equals(Object __o)
	{
		throw new todo.TODO();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/05/03
	 */
	@Override
	public final int hashCode()
	{
		throw new todo.TODO();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/05/03
	 */
	@Override
	public final String toString()
	{
		throw new todo.TODO();
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






































































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/syntax/expr/package-info.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

/**
 * This class contains the representation and the parsers for expressions
 * that exist within the language. Expressions for the most part contain
 * actual code that may be executed.
 *
 * @since 2018/05/02
 */

package net.multiphasicapps.javac.syntax.expr;

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<








































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/syntax/package-info.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

/**
 * This package contains the information about classes and members.
 *
 * @since 2018/04/21
 */

package net.multiphasicapps.javac.syntax;

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/token/BufferedTokenSource.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac.token;

import java.io.Closeable;
import java.io.InputStream;
import java.io.IOException;
import java.io.Reader;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Deque;
import java.util.LinkedList;
import java.util.List;
import net.multiphasicapps.javac.FileNameLineAndColumn;

/**
 * This is a token source which performs buffering of an input set of tokens
 * enabling token sources and such to be marked, committed, and reset similarly
 * to input streams. It additionally provides peeking functionality.
 *
 * The marking system is stack based and as such multiple marks will push
 * onto other marks, while commits or resets will pop those marks.
 *
 * @since 2018/04/18
 */
public final class BufferedTokenSource
	implements Closeable, FileNameLineAndColumn, TokenSource
{
	/** The input token source to read from. */
	protected final TokenSource input;
	
	/** Marks which have been made. */
	private final Deque<Integer> _marks =
		new ArrayDeque<>();
	
	/** Tokens which are currently being peeked. */
	private final List<Token> _peeked =
		new LinkedList<>();
	
	/** The current position in the peek queue where the token is at. */
	private int _peekedpos;
	
	/** The last token which was returned. */
	private Token _last;
	
	/** The token which was last peeked. */
	private Token _lastpeek;
	
	/**
	 * Initializes the buffered token source from the given stream and input
	 * stream.
	 *
	 * @param __fn The name of the file being read.
	 * @param __in The input file stream.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/04/21
	 */
	public BufferedTokenSource(String __fn, InputStream __in)
		throws NullPointerException
	{
		this(new Tokenizer(__fn, __in));
	}
	
	/**
	 * Initializes the buffered token source from the given stream and input
	 * stream.
	 *
	 * @param __fn The name of the file being read.
	 * @param __in The input file stream.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/04/21
	 */
	public BufferedTokenSource(String __fn, Reader __in)
		throws NullPointerException
	{
		this(new Tokenizer(__fn, __in));
	}
	
	/**
	 * Initializes the buffered token source.
	 *
	 * @param __t The input token source.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/04/18
	 */
	public BufferedTokenSource(TokenSource __t)
		throws NullPointerException
	{
		if (__t == null)
			throw new NullPointerException("NARG");
		
		this.input = __t;
	}
	
	/**
	 * Closes the input token source.
	 *
	 * @throws TokenizerException If it cannot be closed.
	 * @since 2018/04/18
	 */
	@Override
	public final void close()
		throws TokenizerException
	{
		// Close it if the input is closeable
		TokenSource input = this.input;
		if (input instanceof Closeable)
			try
			{
				((Closeable)this.input).close();
			}
			catch (IOException e)
			{
				// {@squirreljme.error AQ2p Could not close the token source.}
				throw new TokenizerException("AQ2p", e);
			}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/04/18
	 */
	@Override
	public final int column()
	{
		Token last = this._last;
		if (last != null)
			return last.column();
		return this.input.column();
	}
	
	/**
	 * Commits the current position in the marked set (and internally removes
	 * the mark) so that the token stream is set to the given position rather
	 * than being used as a mark. So a commit being performed later in a
	 * stream will make it so that all the previously read tokens were
	 * actually read from the input so that they cannot be reversed.
	 *
	 * @throws IllegalStateException If there are no marks.
	 * @since 2018/04/18
	 */
	public final void commit()
		throws IllegalStateException
	{
		// {@squirreljme.error AQ2q Cannot reset a mark when there have been
		// no marks which were made.}
		Deque<Integer> marks = this._marks;
		int n = marks.size();
		if (n == 0)
			throw new IllegalStateException("AQ2q");
		
		// Remove the last mark but keep the peek position the
		marks.remove(n - 1);
		
		// If this was the last mark then all tokens which were read before
		// this will just be dropped
		if (n <= 1)
		{
			// Drain all peeked tokens to the current position
			int peekedpos = this._peekedpos;
			List<Token> peeked = this._peeked;
			for (int i = 0; i < peekedpos; i++)
				peeked.remove(0);
			
			// Set the peek position to zero so that the next read position
			// is the first token in the queue
			this._peekedpos = 0;
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/04/18
	 */
	@Override
	public final String fileName()
	{
		Token last = this._last;
		if (last != null)
			return last.fileName();
		return this.input.fileName();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/04/18
	 */
	@Override
	public final int line()
	{
		Token last = this._last;
		if (last != null)
			return last.line();
		return this.input.line();
	}
	
	/**
	 * Marks the current position in the token stream and pushes it to the
	 * marking stack so that a future {@link #commit()} or {@link #reset()}
	 * will either set the given position or clear it.
	 *
	 * @since 2018/04/18
	 */
	public final void mark()
	{
		// The current peek position is just stored
		this._marks.addLast(this._peekedpos);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/04/18
	 */
	@Override
	public final Token next()
	{
		// Always peek the first token to be returned
		Token rv = this.peek(0);
		
		// If there are no marks that exist, 
		int peekedpos = this._peekedpos;
		Deque<Integer> marks = this._marks;
		if (marks.isEmpty())
			this._peeked.remove(0);
		
		// Otherwise increase the peek index so that the next token is offset
		// by the peek position
		else
			this._peekedpos = peekedpos + 1;
		
		// Debug
		todo.DEBUG.note("Next (%d, m=%d): %s", peekedpos, marks.size(), rv);
		
		// Store the last token for positioning information
		this._last = rv;
		return rv;
	}
	
	/**
	 * Returns the token that would be returned on the call to {@link #next()}
	 *
	 * @return The next token that would be returned.
	 * @throws TokenizerException On read errors.
	 * @since 2018/03/12
	 */
	public final Token peek()
		throws TokenizerException
	{
		// Just read the first token
		return this.peek(0);
	}
	
	/**
	 * Returns the token which seen in the future from a given token offset.
	 *
	 * @param __o The number of tokens to read into the future.
	 * @return The next token that would be returned.
	 * @throws IndexOutOfBoundsException If a negative index was specified.
	 * @throws TokenizerException On read errors.
	 * @since 2018/03/12
	 */
	public final Token peek(int __o)
		throws IndexOutOfBoundsException, TokenizerException
	{
		// {@squirreljme.error AQ2r Cannot peek a token with a negative
		// offset.}
		if (__o < 0)
			throw new IndexOutOfBoundsException("AQ2r");
		
		TokenSource input = this.input;
		
		// Offset by the peek position because if marking is enabled then peek
		// mode will always be used
		__o += this._peekedpos;
		
		// Need to fill the queue with peeked tokens in order to peek this
		// far ahead?
		List<Token> peeked = this._peeked;
		int n = peeked.size();
		while (__o >= n)
			peeked.add(n++, input.next());
		
		// Return the peeked token here
		Token rv = peeked.get(__o);
		
		// Debug
		Token lastpeek = this._lastpeek;
		if (lastpeek != rv)
		{
			todo.DEBUG.note("Peek (%d, m=%d): %s", __o, this._marks.size(),
				rv);
			this._lastpeek = rv;
		}
		
		// Use that
		return rv;
	}
	
	/**
	 * Resets and clears the last mark and returns the token source stream
	 * to the position it was marked at.
	 *
	 * @throws IllegalStateException If there are no marks.
	 * @since 2018/04/18
	 */
	public final void reset()
		throws IllegalStateException
	{
		// {@squirreljme.error AQ2s Cannot reset a mark when there have been
		// no marks which were made.}
		Deque<Integer> marks = this._marks;
		int n = marks.size();
		if (n == 0)
			throw new IllegalStateException("AQ2s");
		
		// The peek position becomes the index of the last mark
		this._peekedpos = marks.removeLast();
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
















































































































































































































































































































































































































































































































































































































































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/token/CharacterTest.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac.token;

/**
 * This is used for testing of characters so that the {@link Tokenizer} class
 * is not filled with large methods that perform many checks.
 *
 * @since 2017/09/09
 */
public final class CharacterTest
{
	/**
	 * Not used.
	 *
	 * @since 2017/09/09
	 */
	private CharacterTest()
	{
	}
	
	/**
	 * This checks the specified character to determine if it is valid for
	 * being part of an identifier after the first character.
	 *
	 * @param __c The character to check.
	 * @return If this is valid for the part of an identifier.
	 * @since 2017/09/09
	 */
	public static boolean isIdentifierPart(int __c)
	{
		return (isIdentifierStart(__c) ||
			(__c >= 0x0001 && __c < 0x0009) ||
			(__c >= 0x000E && __c < 0x001C) ||
			(__c >= 0x0030 && __c < 0x003A) ||
			(__c >= 0x007F && __c < 0x00A0) ||
			__c == 0x00AD ||
			(__c >= 0x0300 && __c < 0x0370) ||
			(__c >= 0x0483 && __c < 0x0488) ||
			(__c >= 0x0591 && __c < 0x05BE) ||
			__c == 0x05BF ||
			(__c >= 0x05C1 && __c < 0x05C3) ||
			(__c >= 0x05C4 && __c < 0x05C6) ||
			__c == 0x05C7 ||
			(__c >= 0x0600 && __c < 0x0605) ||
			(__c >= 0x0610 && __c < 0x061B) ||
			(__c >= 0x064B && __c < 0x066A) ||
			__c == 0x0670 ||
			(__c >= 0x06D6 && __c < 0x06DE) ||
			(__c >= 0x06DF && __c < 0x06E5) ||
			(__c >= 0x06E7 && __c < 0x06E9) ||
			(__c >= 0x06EA && __c < 0x06EE) ||
			(__c >= 0x06F0 && __c < 0x06FA) ||
			__c == 0x070F ||
			__c == 0x0711 ||
			(__c >= 0x0730 && __c < 0x074B) ||
			(__c >= 0x07A6 && __c < 0x07B1) ||
			(__c >= 0x07C0 && __c < 0x07CA) ||
			(__c >= 0x07EB && __c < 0x07F4) ||
			(__c >= 0x0816 && __c < 0x081A) ||
			(__c >= 0x081B && __c < 0x0824) ||
			(__c >= 0x0825 && __c < 0x0828) ||
			(__c >= 0x0829 && __c < 0x082E) ||
			(__c >= 0x0859 && __c < 0x085C) ||
			(__c >= 0x08E4 && __c < 0x08FF) ||
			(__c >= 0x0900 && __c < 0x0904) ||
			(__c >= 0x093A && __c < 0x093D) ||
			(__c >= 0x093E && __c < 0x0950) ||
			(__c >= 0x0951 && __c < 0x0958) ||
			(__c >= 0x0962 && __c < 0x0964) ||
			(__c >= 0x0966 && __c < 0x0970) ||
			(__c >= 0x0981 && __c < 0x0984) ||
			__c == 0x09BC ||
			(__c >= 0x09BE && __c < 0x09C5) ||
			(__c >= 0x09C7 && __c < 0x09C9) ||
			(__c >= 0x09CB && __c < 0x09CE) ||
			__c == 0x09D7 ||
			(__c >= 0x09E2 && __c < 0x09E4) ||
			(__c >= 0x09E6 && __c < 0x09F0) ||
			(__c >= 0x0A01 && __c < 0x0A04) ||
			__c == 0x0A3C ||
			(__c >= 0x0A3E && __c < 0x0A43) ||
			(__c >= 0x0A47 && __c < 0x0A49) ||
			(__c >= 0x0A4B && __c < 0x0A4E) ||
			__c == 0x0A51 ||
			(__c >= 0x0A66 && __c < 0x0A72) ||
			__c == 0x0A75 ||
			(__c >= 0x0A81 && __c < 0x0A84) ||
			__c == 0x0ABC ||
			(__c >= 0x0ABE && __c < 0x0AC6) ||
			(__c >= 0x0AC7 && __c < 0x0ACA) ||
			(__c >= 0x0ACB && __c < 0x0ACE) ||
			(__c >= 0x0AE2 && __c < 0x0AE4) ||
			(__c >= 0x0AE6 && __c < 0x0AF0) ||
			(__c >= 0x0B01 && __c < 0x0B04) ||
			__c == 0x0B3C ||
			(__c >= 0x0B3E && __c < 0x0B45) ||
			(__c >= 0x0B47 && __c < 0x0B49) ||
			(__c >= 0x0B4B && __c < 0x0B4E) ||
			(__c >= 0x0B56 && __c < 0x0B58) ||
			(__c >= 0x0B62 && __c < 0x0B64) ||
			(__c >= 0x0B66 && __c < 0x0B70) ||
			__c == 0x0B82 ||
			(__c >= 0x0BBE && __c < 0x0BC3) ||
			(__c >= 0x0BC6 && __c < 0x0BC9) ||
			(__c >= 0x0BCA && __c < 0x0BCE) ||
			__c == 0x0BD7 ||
			(__c >= 0x0BE6 && __c < 0x0BF0) ||
			(__c >= 0x0C01 && __c < 0x0C04) ||
			(__c >= 0x0C3E && __c < 0x0C45) ||
			(__c >= 0x0C46 && __c < 0x0C49) ||
			(__c >= 0x0C4A && __c < 0x0C4E) ||
			(__c >= 0x0C55 && __c < 0x0C57) ||
			(__c >= 0x0C62 && __c < 0x0C64) ||
			(__c >= 0x0C66 && __c < 0x0C70) ||
			(__c >= 0x0C82 && __c < 0x0C84) ||
			__c == 0x0CBC ||
			(__c >= 0x0CBE && __c < 0x0CC5) ||
			(__c >= 0x0CC6 && __c < 0x0CC9) ||
			(__c >= 0x0CCA && __c < 0x0CCE) ||
			(__c >= 0x0CD5 && __c < 0x0CD7) ||
			(__c >= 0x0CE2 && __c < 0x0CE4) ||
			(__c >= 0x0CE6 && __c < 0x0CF0) ||
			(__c >= 0x0D02 && __c < 0x0D04) ||
			(__c >= 0x0D3E && __c < 0x0D45) ||
			(__c >= 0x0D46 && __c < 0x0D49) ||
			(__c >= 0x0D4A && __c < 0x0D4E) ||
			__c == 0x0D57 ||
			(__c >= 0x0D62 && __c < 0x0D64) ||
			(__c >= 0x0D66 && __c < 0x0D70) ||
			(__c >= 0x0D82 && __c < 0x0D84) ||
			__c == 0x0DCA ||
			(__c >= 0x0DCF && __c < 0x0DD5) ||
			__c == 0x0DD6 ||
			(__c >= 0x0DD8 && __c < 0x0DE0) ||
			(__c >= 0x0DF2 && __c < 0x0DF4) ||
			__c == 0x0E31 ||
			(__c >= 0x0E34 && __c < 0x0E3B) ||
			(__c >= 0x0E47 && __c < 0x0E4F) ||
			(__c >= 0x0E50 && __c < 0x0E5A) ||
			__c == 0x0EB1 ||
			(__c >= 0x0EB4 && __c < 0x0EBA) ||
			(__c >= 0x0EBB && __c < 0x0EBD) ||
			(__c >= 0x0EC8 && __c < 0x0ECE) ||
			(__c >= 0x0ED0 && __c < 0x0EDA) ||
			(__c >= 0x0F18 && __c < 0x0F1A) ||
			(__c >= 0x0F20 && __c < 0x0F2A) ||
			__c == 0x0F35 ||
			__c == 0x0F37 ||
			__c == 0x0F39 ||
			(__c >= 0x0F3E && __c < 0x0F40) ||
			(__c >= 0x0F71 && __c < 0x0F85) ||
			(__c >= 0x0F86 && __c < 0x0F88) ||
			(__c >= 0x0F8D && __c < 0x0F98) ||
			(__c >= 0x0F99 && __c < 0x0FBD) ||
			__c == 0x0FC6 ||
			(__c >= 0x102B && __c < 0x103F) ||
			(__c >= 0x1040 && __c < 0x104A) ||
			(__c >= 0x1056 && __c < 0x105A) ||
			(__c >= 0x105E && __c < 0x1061) ||
			(__c >= 0x1062 && __c < 0x1065) ||
			(__c >= 0x1067 && __c < 0x106E) ||
			(__c >= 0x1071 && __c < 0x1075) ||
			(__c >= 0x1082 && __c < 0x108E) ||
			(__c >= 0x108F && __c < 0x109E) ||
			(__c >= 0x135D && __c < 0x1360) ||
			(__c >= 0x1712 && __c < 0x1715) ||
			(__c >= 0x1732 && __c < 0x1735) ||
			(__c >= 0x1752 && __c < 0x1754) ||
			(__c >= 0x1772 && __c < 0x1774) ||
			(__c >= 0x17B4 && __c < 0x17D4) ||
			__c == 0x17DD ||
			(__c >= 0x17E0 && __c < 0x17EA) ||
			(__c >= 0x180B && __c < 0x180E) ||
			(__c >= 0x1810 && __c < 0x181A) ||
			__c == 0x18A9 ||
			(__c >= 0x1920 && __c < 0x192C) ||
			(__c >= 0x1930 && __c < 0x193C) ||
			(__c >= 0x1946 && __c < 0x1950) ||
			(__c >= 0x19B0 && __c < 0x19C1) ||
			(__c >= 0x19C8 && __c < 0x19CA) ||
			(__c >= 0x19D0 && __c < 0x19DA) ||
			(__c >= 0x1A17 && __c < 0x1A1C) ||
			(__c >= 0x1A55 && __c < 0x1A5F) ||
			(__c >= 0x1A60 && __c < 0x1A7D) ||
			(__c >= 0x1A7F && __c < 0x1A8A) ||
			(__c >= 0x1A90 && __c < 0x1A9A) ||
			(__c >= 0x1B00 && __c < 0x1B05) ||
			(__c >= 0x1B34 && __c < 0x1B45) ||
			(__c >= 0x1B50 && __c < 0x1B5A) ||
			(__c >= 0x1B6B && __c < 0x1B74) ||
			(__c >= 0x1B80 && __c < 0x1B83) ||
			(__c >= 0x1BA1 && __c < 0x1BAE) ||
			(__c >= 0x1BB0 && __c < 0x1BBA) ||
			(__c >= 0x1BE6 && __c < 0x1BF4) ||
			(__c >= 0x1C24 && __c < 0x1C38) ||
			(__c >= 0x1C40 && __c < 0x1C4A) ||
			(__c >= 0x1C50 && __c < 0x1C5A) ||
			(__c >= 0x1CD0 && __c < 0x1CD3) ||
			(__c >= 0x1CD4 && __c < 0x1CE9) ||
			__c == 0x1CED ||
			(__c >= 0x1CF2 && __c < 0x1CF5) ||
			(__c >= 0x1DC0 && __c < 0x1DE7) ||
			(__c >= 0x1DFC && __c < 0x1E00) ||
			(__c >= 0x200B && __c < 0x2010) ||
			(__c >= 0x202A && __c < 0x202F) ||
			(__c >= 0x2060 && __c < 0x2065) ||
			(__c >= 0x206A && __c < 0x2070) ||
			(__c >= 0x20D0 && __c < 0x20DD) ||
			__c == 0x20E1 ||
			(__c >= 0x20E5 && __c < 0x20F1) ||
			(__c >= 0x2CEF && __c < 0x2CF2) ||
			__c == 0x2D7F ||
			(__c >= 0x2DE0 && __c < 0x2E00) ||
			(__c >= 0x302A && __c < 0x3030) ||
			(__c >= 0x3099 && __c < 0x309B) ||
			(__c >= 0xA620 && __c < 0xA62A) ||
			__c == 0xA66F ||
			(__c >= 0xA674 && __c < 0xA67E) ||
			__c == 0xA69F ||
			(__c >= 0xA6F0 && __c < 0xA6F2) ||
			__c == 0xA802 ||
			__c == 0xA806 ||
			__c == 0xA80B ||
			(__c >= 0xA823 && __c < 0xA828) ||
			(__c >= 0xA880 && __c < 0xA882) ||
			(__c >= 0xA8B4 && __c < 0xA8C5) ||
			(__c >= 0xA8D0 && __c < 0xA8DA) ||
			(__c >= 0xA8E0 && __c < 0xA8F2) ||
			(__c >= 0xA900 && __c < 0xA90A) ||
			(__c >= 0xA926 && __c < 0xA92E) ||
			(__c >= 0xA947 && __c < 0xA954) ||
			(__c >= 0xA980 && __c < 0xA984) ||
			(__c >= 0xA9B3 && __c < 0xA9C1) ||
			(__c >= 0xA9D0 && __c < 0xA9DA) ||
			(__c >= 0xAA29 && __c < 0xAA37) ||
			__c == 0xAA43 ||
			(__c >= 0xAA4C && __c < 0xAA4E) ||
			(__c >= 0xAA50 && __c < 0xAA5A) ||
			__c == 0xAA7B ||
			__c == 0xAAB0 ||
			(__c >= 0xAAB2 && __c < 0xAAB5) ||
			(__c >= 0xAAB7 && __c < 0xAAB9) ||
			(__c >= 0xAABE && __c < 0xAAC0) ||
			__c == 0xAAC1 ||
			(__c >= 0xAAEB && __c < 0xAAF0) ||
			(__c >= 0xAAF5 && __c < 0xAAF7) ||
			(__c >= 0xABE3 && __c < 0xABEB) ||
			(__c >= 0xABEC && __c < 0xABEE) ||
			(__c >= 0xABF0 && __c < 0xABFA) ||
			__c == 0xFB1E ||
			(__c >= 0xFE00 && __c < 0xFE10) ||
			(__c >= 0xFE20 && __c < 0xFE27) ||
			__c == 0xFEFF ||
			(__c >= 0xFF10 && __c < 0xFF1A) ||
			(__c >= 0xFFF9 && __c < 0xFFFC));
	}
	
	/**
	 * This checks the specified character to determine if it is valid for
	 * being used at the start of an identifier.
	 *
	 * @param __c The character to check.
	 * @return If this is valid for the start of an identifier.
	 * @since 2017/09/09
	 */
	public static boolean isIdentifierStart(int __c)
	{
		return (__c == 0x0024 ||
			(__c >= 0x0041 && __c < 0x005B) ||
			__c == 0x005F ||
			(__c >= 0x0061 && __c < 0x007B) ||
			(__c >= 0x00A2 && __c < 0x00A6) ||
			__c == 0x00AA ||
			__c == 0x00B5 ||
			__c == 0x00BA ||
			(__c >= 0x00C0 && __c < 0x00D7) ||
			(__c >= 0x00D8 && __c < 0x00F7) ||
			(__c >= 0x00F8 && __c < 0x02C2) ||
			(__c >= 0x02C6 && __c < 0x02D2) ||
			(__c >= 0x02E0 && __c < 0x02E5) ||
			__c == 0x02EC ||
			__c == 0x02EE ||
			(__c >= 0x0370 && __c < 0x0375) ||
			(__c >= 0x0376 && __c < 0x0378) ||
			(__c >= 0x037A && __c < 0x037E) ||
			__c == 0x0386 ||
			(__c >= 0x0388 && __c < 0x038B) ||
			__c == 0x038C ||
			(__c >= 0x038E && __c < 0x03A2) ||
			(__c >= 0x03A3 && __c < 0x03F6) ||
			(__c >= 0x03F7 && __c < 0x0482) ||
			(__c >= 0x048A && __c < 0x0528) ||
			(__c >= 0x0531 && __c < 0x0557) ||
			__c == 0x0559 ||
			(__c >= 0x0561 && __c < 0x0588) ||
			__c == 0x058F ||
			(__c >= 0x05D0 && __c < 0x05EB) ||
			(__c >= 0x05F0 && __c < 0x05F3) ||
			__c == 0x060B ||
			(__c >= 0x0620 && __c < 0x064B) ||
			(__c >= 0x066E && __c < 0x0670) ||
			(__c >= 0x0671 && __c < 0x06D4) ||
			__c == 0x06D5 ||
			(__c >= 0x06E5 && __c < 0x06E7) ||
			(__c >= 0x06EE && __c < 0x06F0) ||
			(__c >= 0x06FA && __c < 0x06FD) ||
			__c == 0x06FF ||
			__c == 0x0710 ||
			(__c >= 0x0712 && __c < 0x0730) ||
			(__c >= 0x074D && __c < 0x07A6) ||
			__c == 0x07B1 ||
			(__c >= 0x07CA && __c < 0x07EB) ||
			(__c >= 0x07F4 && __c < 0x07F6) ||
			__c == 0x07FA ||
			(__c >= 0x0800 && __c < 0x0816) ||
			__c == 0x081A ||
			__c == 0x0824 ||
			__c == 0x0828 ||
			(__c >= 0x0840 && __c < 0x0859) ||
			__c == 0x08A0 ||
			(__c >= 0x08A2 && __c < 0x08AD) ||
			(__c >= 0x0904 && __c < 0x093A) ||
			__c == 0x093D ||
			__c == 0x0950 ||
			(__c >= 0x0958 && __c < 0x0962) ||
			(__c >= 0x0971 && __c < 0x0978) ||
			(__c >= 0x0979 && __c < 0x0980) ||
			(__c >= 0x0985 && __c < 0x098D) ||
			(__c >= 0x098F && __c < 0x0991) ||
			(__c >= 0x0993 && __c < 0x09A9) ||
			(__c >= 0x09AA && __c < 0x09B1) ||
			__c == 0x09B2 ||
			(__c >= 0x09B6 && __c < 0x09BA) ||
			__c == 0x09BD ||
			__c == 0x09CE ||
			(__c >= 0x09DC && __c < 0x09DE) ||
			(__c >= 0x09DF && __c < 0x09E2) ||
			(__c >= 0x09F0 && __c < 0x09F4) ||
			__c == 0x09FB ||
			(__c >= 0x0A05 && __c < 0x0A0B) ||
			(__c >= 0x0A0F && __c < 0x0A11) ||
			(__c >= 0x0A13 && __c < 0x0A29) ||
			(__c >= 0x0A2A && __c < 0x0A31) ||
			(__c >= 0x0A32 && __c < 0x0A34) ||
			(__c >= 0x0A35 && __c < 0x0A37) ||
			(__c >= 0x0A38 && __c < 0x0A3A) ||
			(__c >= 0x0A59 && __c < 0x0A5D) ||
			__c == 0x0A5E ||
			(__c >= 0x0A72 && __c < 0x0A75) ||
			(__c >= 0x0A85 && __c < 0x0A8E) ||
			(__c >= 0x0A8F && __c < 0x0A92) ||
			(__c >= 0x0A93 && __c < 0x0AA9) ||
			(__c >= 0x0AAA && __c < 0x0AB1) ||
			(__c >= 0x0AB2 && __c < 0x0AB4) ||
			(__c >= 0x0AB5 && __c < 0x0ABA) ||
			__c == 0x0ABD ||
			__c == 0x0AD0 ||
			(__c >= 0x0AE0 && __c < 0x0AE2) ||
			__c == 0x0AF1 ||
			(__c >= 0x0B05 && __c < 0x0B0D) ||
			(__c >= 0x0B0F && __c < 0x0B11) ||
			(__c >= 0x0B13 && __c < 0x0B29) ||
			(__c >= 0x0B2A && __c < 0x0B31) ||
			(__c >= 0x0B32 && __c < 0x0B34) ||
			(__c >= 0x0B35 && __c < 0x0B3A) ||
			__c == 0x0B3D ||
			(__c >= 0x0B5C && __c < 0x0B5E) ||
			(__c >= 0x0B5F && __c < 0x0B62) ||
			__c == 0x0B71 ||
			__c == 0x0B83 ||
			(__c >= 0x0B85 && __c < 0x0B8B) ||
			(__c >= 0x0B8E && __c < 0x0B91) ||
			(__c >= 0x0B92 && __c < 0x0B96) ||
			(__c >= 0x0B99 && __c < 0x0B9B) ||
			__c == 0x0B9C ||
			(__c >= 0x0B9E && __c < 0x0BA0) ||
			(__c >= 0x0BA3 && __c < 0x0BA5) ||
			(__c >= 0x0BA8 && __c < 0x0BAB) ||
			(__c >= 0x0BAE && __c < 0x0BBA) ||
			__c == 0x0BD0 ||
			__c == 0x0BF9 ||
			(__c >= 0x0C05 && __c < 0x0C0D) ||
			(__c >= 0x0C0E && __c < 0x0C11) ||
			(__c >= 0x0C12 && __c < 0x0C29) ||
			(__c >= 0x0C2A && __c < 0x0C34) ||
			(__c >= 0x0C35 && __c < 0x0C3A) ||
			__c == 0x0C3D ||
			(__c >= 0x0C58 && __c < 0x0C5A) ||
			(__c >= 0x0C60 && __c < 0x0C62) ||
			(__c >= 0x0C85 && __c < 0x0C8D) ||
			(__c >= 0x0C8E && __c < 0x0C91) ||
			(__c >= 0x0C92 && __c < 0x0CA9) ||
			(__c >= 0x0CAA && __c < 0x0CB4) ||
			(__c >= 0x0CB5 && __c < 0x0CBA) ||
			__c == 0x0CBD ||
			__c == 0x0CDE ||
			(__c >= 0x0CE0 && __c < 0x0CE2) ||
			(__c >= 0x0CF1 && __c < 0x0CF3) ||
			(__c >= 0x0D05 && __c < 0x0D0D) ||
			(__c >= 0x0D0E && __c < 0x0D11) ||
			(__c >= 0x0D12 && __c < 0x0D3B) ||
			__c == 0x0D3D ||
			__c == 0x0D4E ||
			(__c >= 0x0D60 && __c < 0x0D62) ||
			(__c >= 0x0D7A && __c < 0x0D80) ||
			(__c >= 0x0D85 && __c < 0x0D97) ||
			(__c >= 0x0D9A && __c < 0x0DB2) ||
			(__c >= 0x0DB3 && __c < 0x0DBC) ||
			__c == 0x0DBD ||
			(__c >= 0x0DC0 && __c < 0x0DC7) ||
			(__c >= 0x0E01 && __c < 0x0E31) ||
			(__c >= 0x0E32 && __c < 0x0E34) ||
			(__c >= 0x0E3F && __c < 0x0E47) ||
			(__c >= 0x0E81 && __c < 0x0E83) ||
			__c == 0x0E84 ||
			(__c >= 0x0E87 && __c < 0x0E89) ||
			__c == 0x0E8A ||
			__c == 0x0E8D ||
			(__c >= 0x0E94 && __c < 0x0E98) ||
			(__c >= 0x0E99 && __c < 0x0EA0) ||
			(__c >= 0x0EA1 && __c < 0x0EA4) ||
			__c == 0x0EA5 ||
			__c == 0x0EA7 ||
			(__c >= 0x0EAA && __c < 0x0EAC) ||
			(__c >= 0x0EAD && __c < 0x0EB1) ||
			(__c >= 0x0EB2 && __c < 0x0EB4) ||
			__c == 0x0EBD ||
			(__c >= 0x0EC0 && __c < 0x0EC5) ||
			__c == 0x0EC6 ||
			(__c >= 0x0EDC && __c < 0x0EE0) ||
			__c == 0x0F00 ||
			(__c >= 0x0F40 && __c < 0x0F48) ||
			(__c >= 0x0F49 && __c < 0x0F6D) ||
			(__c >= 0x0F88 && __c < 0x0F8D) ||
			(__c >= 0x1000 && __c < 0x102B) ||
			__c == 0x103F ||
			(__c >= 0x1050 && __c < 0x1056) ||
			(__c >= 0x105A && __c < 0x105E) ||
			__c == 0x1061 ||
			(__c >= 0x1065 && __c < 0x1067) ||
			(__c >= 0x106E && __c < 0x1071) ||
			(__c >= 0x1075 && __c < 0x1082) ||
			__c == 0x108E ||
			(__c >= 0x10A0 && __c < 0x10C6) ||
			__c == 0x10C7 ||
			__c == 0x10CD ||
			(__c >= 0x10D0 && __c < 0x10FB) ||
			(__c >= 0x10FC && __c < 0x1249) ||
			(__c >= 0x124A && __c < 0x124E) ||
			(__c >= 0x1250 && __c < 0x1257) ||
			__c == 0x1258 ||
			(__c >= 0x125A && __c < 0x125E) ||
			(__c >= 0x1260 && __c < 0x1289) ||
			(__c >= 0x128A && __c < 0x128E) ||
			(__c >= 0x1290 && __c < 0x12B1) ||
			(__c >= 0x12B2 && __c < 0x12B6) ||
			(__c >= 0x12B8 && __c < 0x12BF) ||
			__c == 0x12C0 ||
			(__c >= 0x12C2 && __c < 0x12C6) ||
			(__c >= 0x12C8 && __c < 0x12D7) ||
			(__c >= 0x12D8 && __c < 0x1311) ||
			(__c >= 0x1312 && __c < 0x1316) ||
			(__c >= 0x1318 && __c < 0x135B) ||
			(__c >= 0x1380 && __c < 0x1390) ||
			(__c >= 0x13A0 && __c < 0x13F5) ||
			(__c >= 0x1401 && __c < 0x166D) ||
			(__c >= 0x166F && __c < 0x1680) ||
			(__c >= 0x1681 && __c < 0x169B) ||
			(__c >= 0x16A0 && __c < 0x16EB) ||
			(__c >= 0x16EE && __c < 0x16F1) ||
			(__c >= 0x1700 && __c < 0x170D) ||
			(__c >= 0x170E && __c < 0x1712) ||
			(__c >= 0x1720 && __c < 0x1732) ||
			(__c >= 0x1740 && __c < 0x1752) ||
			(__c >= 0x1760 && __c < 0x176D) ||
			(__c >= 0x176E && __c < 0x1771) ||
			(__c >= 0x1780 && __c < 0x17B4) ||
			__c == 0x17D7 ||
			(__c >= 0x17DB && __c < 0x17DD) ||
			(__c >= 0x1820 && __c < 0x1878) ||
			(__c >= 0x1880 && __c < 0x18A9) ||
			__c == 0x18AA ||
			(__c >= 0x18B0 && __c < 0x18F6) ||
			(__c >= 0x1900 && __c < 0x191D) ||
			(__c >= 0x1950 && __c < 0x196E) ||
			(__c >= 0x1970 && __c < 0x1975) ||
			(__c >= 0x1980 && __c < 0x19AC) ||
			(__c >= 0x19C1 && __c < 0x19C8) ||
			(__c >= 0x1A00 && __c < 0x1A17) ||
			(__c >= 0x1A20 && __c < 0x1A55) ||
			__c == 0x1AA7 ||
			(__c >= 0x1B05 && __c < 0x1B34) ||
			(__c >= 0x1B45 && __c < 0x1B4C) ||
			(__c >= 0x1B83 && __c < 0x1BA1) ||
			(__c >= 0x1BAE && __c < 0x1BB0) ||
			(__c >= 0x1BBA && __c < 0x1BE6) ||
			(__c >= 0x1C00 && __c < 0x1C24) ||
			(__c >= 0x1C4D && __c < 0x1C50) ||
			(__c >= 0x1C5A && __c < 0x1C7E) ||
			(__c >= 0x1CE9 && __c < 0x1CED) ||
			(__c >= 0x1CEE && __c < 0x1CF2) ||
			(__c >= 0x1CF5 && __c < 0x1CF7) ||
			(__c >= 0x1D00 && __c < 0x1DC0) ||
			(__c >= 0x1E00 && __c < 0x1F16) ||
			(__c >= 0x1F18 && __c < 0x1F1E) ||
			(__c >= 0x1F20 && __c < 0x1F46) ||
			(__c >= 0x1F48 && __c < 0x1F4E) ||
			(__c >= 0x1F50 && __c < 0x1F58) ||
			__c == 0x1F59 ||
			__c == 0x1F5B ||
			__c == 0x1F5D ||
			(__c >= 0x1F5F && __c < 0x1F7E) ||
			(__c >= 0x1F80 && __c < 0x1FB5) ||
			(__c >= 0x1FB6 && __c < 0x1FBD) ||
			__c == 0x1FBE ||
			(__c >= 0x1FC2 && __c < 0x1FC5) ||
			(__c >= 0x1FC6 && __c < 0x1FCD) ||
			(__c >= 0x1FD0 && __c < 0x1FD4) ||
			(__c >= 0x1FD6 && __c < 0x1FDC) ||
			(__c >= 0x1FE0 && __c < 0x1FED) ||
			(__c >= 0x1FF2 && __c < 0x1FF5) ||
			(__c >= 0x1FF6 && __c < 0x1FFD) ||
			(__c >= 0x203F && __c < 0x2041) ||
			__c == 0x2054 ||
			__c == 0x2071 ||
			__c == 0x207F ||
			(__c >= 0x2090 && __c < 0x209D) ||
			(__c >= 0x20A0 && __c < 0x20BB) ||
			__c == 0x2102 ||
			__c == 0x2107 ||
			(__c >= 0x210A && __c < 0x2114) ||
			__c == 0x2115 ||
			(__c >= 0x2119 && __c < 0x211E) ||
			__c == 0x2124 ||
			__c == 0x2126 ||
			__c == 0x2128 ||
			(__c >= 0x212A && __c < 0x212E) ||
			(__c >= 0x212F && __c < 0x213A) ||
			(__c >= 0x213C && __c < 0x2140) ||
			(__c >= 0x2145 && __c < 0x214A) ||
			__c == 0x214E ||
			(__c >= 0x2160 && __c < 0x2189) ||
			(__c >= 0x2C00 && __c < 0x2C2F) ||
			(__c >= 0x2C30 && __c < 0x2C5F) ||
			(__c >= 0x2C60 && __c < 0x2CE5) ||
			(__c >= 0x2CEB && __c < 0x2CEF) ||
			(__c >= 0x2CF2 && __c < 0x2CF4) ||
			(__c >= 0x2D00 && __c < 0x2D26) ||
			__c == 0x2D27 ||
			__c == 0x2D2D ||
			(__c >= 0x2D30 && __c < 0x2D68) ||
			__c == 0x2D6F ||
			(__c >= 0x2D80 && __c < 0x2D97) ||
			(__c >= 0x2DA0 && __c < 0x2DA7) ||
			(__c >= 0x2DA8 && __c < 0x2DAF) ||
			(__c >= 0x2DB0 && __c < 0x2DB7) ||
			(__c >= 0x2DB8 && __c < 0x2DBF) ||
			(__c >= 0x2DC0 && __c < 0x2DC7) ||
			(__c >= 0x2DC8 && __c < 0x2DCF) ||
			(__c >= 0x2DD0 && __c < 0x2DD7) ||
			(__c >= 0x2DD8 && __c < 0x2DDF) ||
			__c == 0x2E2F ||
			(__c >= 0x3005 && __c < 0x3008) ||
			(__c >= 0x3021 && __c < 0x302A) ||
			(__c >= 0x3031 && __c < 0x3036) ||
			(__c >= 0x3038 && __c < 0x303D) ||
			(__c >= 0x3041 && __c < 0x3097) ||
			(__c >= 0x309D && __c < 0x30A0) ||
			(__c >= 0x30A1 && __c < 0x30FB) ||
			(__c >= 0x30FC && __c < 0x3100) ||
			(__c >= 0x3105 && __c < 0x312E) ||
			(__c >= 0x3131 && __c < 0x318F) ||
			(__c >= 0x31A0 && __c < 0x31BB) ||
			(__c >= 0x31F0 && __c < 0x3200) ||
			(__c >= 0x3400 && __c < 0x4DB6) ||
			(__c >= 0x4E00 && __c < 0x9FCD) ||
			(__c >= 0xA000 && __c < 0xA48D) ||
			(__c >= 0xA4D0 && __c < 0xA4FE) ||
			(__c >= 0xA500 && __c < 0xA60D) ||
			(__c >= 0xA610 && __c < 0xA620) ||
			(__c >= 0xA62A && __c < 0xA62C) ||
			(__c >= 0xA640 && __c < 0xA66F) ||
			(__c >= 0xA67F && __c < 0xA698) ||
			(__c >= 0xA6A0 && __c < 0xA6F0) ||
			(__c >= 0xA717 && __c < 0xA720) ||
			(__c >= 0xA722 && __c < 0xA789) ||
			(__c >= 0xA78B && __c < 0xA78F) ||
			(__c >= 0xA790 && __c < 0xA794) ||
			(__c >= 0xA7A0 && __c < 0xA7AB) ||
			(__c >= 0xA7F8 && __c < 0xA802) ||
			(__c >= 0xA803 && __c < 0xA806) ||
			(__c >= 0xA807 && __c < 0xA80B) ||
			(__c >= 0xA80C && __c < 0xA823) ||
			__c == 0xA838 ||
			(__c >= 0xA840 && __c < 0xA874) ||
			(__c >= 0xA882 && __c < 0xA8B4) ||
			(__c >= 0xA8F2 && __c < 0xA8F8) ||
			__c == 0xA8FB ||
			(__c >= 0xA90A && __c < 0xA926) ||
			(__c >= 0xA930 && __c < 0xA947) ||
			(__c >= 0xA960 && __c < 0xA97D) ||
			(__c >= 0xA984 && __c < 0xA9B3) ||
			__c == 0xA9CF ||
			(__c >= 0xAA00 && __c < 0xAA29) ||
			(__c >= 0xAA40 && __c < 0xAA43) ||
			(__c >= 0xAA44 && __c < 0xAA4C) ||
			(__c >= 0xAA60 && __c < 0xAA77) ||
			__c == 0xAA7A ||
			(__c >= 0xAA80 && __c < 0xAAB0) ||
			__c == 0xAAB1 ||
			(__c >= 0xAAB5 && __c < 0xAAB7) ||
			(__c >= 0xAAB9 && __c < 0xAABE) ||
			__c == 0xAAC0 ||
			__c == 0xAAC2 ||
			(__c >= 0xAADB && __c < 0xAADE) ||
			(__c >= 0xAAE0 && __c < 0xAAEB) ||
			(__c >= 0xAAF2 && __c < 0xAAF5) ||
			(__c >= 0xAB01 && __c < 0xAB07) ||
			(__c >= 0xAB09 && __c < 0xAB0F) ||
			(__c >= 0xAB11 && __c < 0xAB17) ||
			(__c >= 0xAB20 && __c < 0xAB27) ||
			(__c >= 0xAB28 && __c < 0xAB2F) ||
			(__c >= 0xABC0 && __c < 0xABE3) ||
			(__c >= 0xAC00 && __c < 0xD7A4) ||
			(__c >= 0xD7B0 && __c < 0xD7C7) ||
			(__c >= 0xD7CB && __c < 0xD7FC) ||
			(__c >= 0xF900 && __c < 0xFA6E) ||
			(__c >= 0xFA70 && __c < 0xFADA) ||
			(__c >= 0xFB00 && __c < 0xFB07) ||
			(__c >= 0xFB13 && __c < 0xFB18) ||
			__c == 0xFB1D ||
			(__c >= 0xFB1F && __c < 0xFB29) ||
			(__c >= 0xFB2A && __c < 0xFB37) ||
			(__c >= 0xFB38 && __c < 0xFB3D) ||
			__c == 0xFB3E ||
			(__c >= 0xFB40 && __c < 0xFB42) ||
			(__c >= 0xFB43 && __c < 0xFB45) ||
			(__c >= 0xFB46 && __c < 0xFBB2) ||
			(__c >= 0xFBD3 && __c < 0xFD3E) ||
			(__c >= 0xFD50 && __c < 0xFD90) ||
			(__c >= 0xFD92 && __c < 0xFDC8) ||
			(__c >= 0xFDF0 && __c < 0xFDFD) ||
			(__c >= 0xFE33 && __c < 0xFE35) ||
			(__c >= 0xFE4D && __c < 0xFE50) ||
			__c == 0xFE69 ||
			(__c >= 0xFE70 && __c < 0xFE75) ||
			(__c >= 0xFE76 && __c < 0xFEFD) ||
			__c == 0xFF04 ||
			(__c >= 0xFF21 && __c < 0xFF3B) ||
			__c == 0xFF3F ||
			(__c >= 0xFF41 && __c < 0xFF5B) ||
			(__c >= 0xFF66 && __c < 0xFFBF) ||
			(__c >= 0xFFC2 && __c < 0xFFC8) ||
			(__c >= 0xFFCA && __c < 0xFFD0) ||
			(__c >= 0xFFD2 && __c < 0xFFD8) ||
			(__c >= 0xFFDA && __c < 0xFFDD) ||
			(__c >= 0xFFE0 && __c < 0xFFE2) ||
			(__c >= 0xFFE5 && __c < 0xFFE7));
	}
	
	/**
	 * Is the specified character deemed an end of line?
	 *
	 * @param __c The character to check.
	 * @return If it is the end of the line.
	 * @since 2017/09/05
	 */
	public static boolean isNewline(int __c)
	{
		return __c < 0 || __c == '\r' || __c == '\n';
	}
	
	/**
	 * Is this character the start of a symbol.
	 *
	 * @param __c The character to test.
	 * @return If it is the start of a symbol.
	 * @since 2018/03/06
	 */
	public static boolean isSymbolStart(int __c)
	{
		return __c == '^' || __c == '~' || __c == '<' || __c == '=' ||
			__c == '>' || __c == '|' || __c == '-' || __c == ',' ||
			__c == ';' || __c == ':' || __c == '!' || __c == '?' ||
			__c == '/' || __c == '.' || __c == '(' || __c == ')' ||
			__c == '[' || __c == ']' || __c == '{' || __c == '}' ||
			__c == '*' || __c == '&' || __c == '%' || __c == '+' ||
			__c == '@';
	}
	
	/**
	 * Is this a character which is possible being in a number literal.
	 *
	 * @param __c The character check.
	 * @return If the character may be placed in a number literal.
	 * @since 2018/03/06
	 */
	public static boolean isPossibleNumberChar(int __c)
	{
		return __c == 'l' || __c == 'L' ||
			__c == 'x' || __c == 'X' ||
			__c == '+' || __c == '-' ||
			__c == 'p' || __c == 'P' ||
			__c == 'e' || __c == 'E' ||
			__c == '.' || __c == '_' ||
			(__c >= '0' && __c <= '9') ||
			(__c >= 'a' && __c <= 'f') ||	// includes bdf
			(__c >= 'A' && __c <= 'F');		// includes BDF
	}
	
	/**
	 * Is the specified character whitespace?
	 *
	 * @param __c The character to check.
	 * @return If it is whitespace.
	 * @since 2017/09/05
	 */
	public static boolean isWhite(int __c)
	{
		return __c == ' ' || __c == '\t' || __c == '\f' || __c == '\r' ||
			__c == '\n';
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


























































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/token/LogicalReader.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac.token;

import java.io.Closeable;
import java.io.IOException;
import java.io.Reader;
import net.multiphasicapps.javac.FileNameLineAndColumn;

/**
 * This is a logical reader which provides line and column position information
 * along with decoding of unicode escape sequences.
 *
 * @since 2017/09/09
 */
public class LogicalReader
	implements Closeable, FileNameLineAndColumn
{
	/** The size of tabs. */
	private static final int _TAB_SIZE =
		4;
	
	/** The reader to source from. */
	protected final Reader in;
	
	/** The file name. */
	protected final String filename;
	
	/** The current line. */
	private volatile int _line =
		1;
	
	/** The current column. */
	private volatile int _column =
		1;
	
	/** Was the last character CR? */
	private volatile boolean _wascr;
	
	/** The character which was in the queue after the slash. */
	private volatile int _slashrem =
		-1;
	
	/**
	 * Initializes the logical reader.
	 *
	 * @param __fn The name of the file.
	 * @param __r The stream to read from.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/09/09
	 */
	public LogicalReader(String __fn, Reader __r)
		throws NullPointerException
	{
		// Check
		if (__fn == null || __r == null)
			throw new NullPointerException("NARG");
		
		// Set
		this.filename = __fn;
		this.in = __r;
	}
	
	
	/**
	 * {@inheritDoc}
	 * @since 2017/09/09
	 */
	@Override
	public void close()
		throws IOException
	{
		this.in.close();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/09/09
	 */
	@Override
	public int column()
	{
		return this._column;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/09/09
	 */
	@Override
	public int line()
	{
		return this._line;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/03/12
	 */
	@Override
	public String fileName()
	{
		return this.filename;
	}
	
	/**
	 * Reads the next character.
	 *
	 * @return The next character or a negative value on EOF.
	 * @throws IOException On read errors.
	 * @since 2017/09/09
	 */
	public int read()
		throws IOException
	{
		// An escape sequence was attempted to be read but it was not a
		// unicode escape sequence
		int slashrem = this._slashrem;
		if (slashrem >= 0)
		{
			this._slashrem = -1;
			return slashrem;
		}
		
		// Usually a single character will be read from the source unless it is
		// a escape sequence for unicode characters
		Reader in = this.in;
		boolean escaped = false,
			unicode = false;
		int unicodeval = 0,
			unicodemask = 0;
		for (;;)
		{
			// Full unicode mask read, return the read value
			if (unicode && unicodemask >= 0xFFFF)
				return unicodeval;
			
			// EOF?
			int c = in.read();
			if (c < 0)
			{
				// {@squirreljme.error AQ2t Unicode sequence truncated at
				// end of file.}
				if (unicode)
					throw new TokenizerException(this, "AQ2t");
				
				// Make sure the escape is returned before EOF
				if (escaped)
					return '\\';
				return -1;
			}
			
			// Reset carriage return check, this is for Windows line endings
			// which consist of CRLF pairs which must not be incremented as
			// if they were two lines
			boolean wascr = this._wascr;
			this._wascr = (c == '\r');
			
			// Do line/column counting now because some characters could end
			// up taking up much more space especially if they are escape
			// sequences. Logically there could be boop\nbap where the \n is
			// unicode escaped. For text editor compatibility that is not
			// treated as a new line when related to the count
			if (c == '\n' || wascr)
			{
				// Go to the next line
				this._line++;
				this._column = 1;
			}
			
			// Tab sets to the tab size
			else if (c == '\t')
			{
				int column = this._column;
				column = column + (_TAB_SIZE - (column % _TAB_SIZE));
				this._column = column;
			}
			
			// Single character increase
			else
				this._column++;
			
			// Reading unicode sequence
			if (unicode)
			{
				// Calculate hex value
				int val = Character.digit((char)c, 16);
				
				// Reading digits
				if (val >= 0 && unicodemask < 0xFFFF)
				{
					// Shift in value
					unicodeval <<= 4;
					unicodeval |= val;
					
					// Move mask up
					unicodemask <<= 4;
					unicodemask |= 0xF;
					
					// Read more of the value
					continue;
				}
				
				// Either another character or something else?
				else
				{
					// {@squirreljme.error AQ2u Invalid unicode escape
					// sequence. (The line; The column)}
					if (unicodemask != 0 || c != 'u')
						throw new TokenizerException(this, 
							String.format("AQ2u %d %d", this._line,
							this._column));
					
					// Just skip the u, there can be tons of them
					continue;
				}
			}
			
			// In escape mode
			else if (escaped)
			{
				// Unicode escape sequence?
				if (c == 'u')
				{
					// Enter unicode mode so that the sequence gets
					// counted properly
					unicode = true;
					continue;
				}
				
				// Not one, recycle it
				else
				{
					this._slashrem = c;
					return '\\';
				}
			}
			
			// not escaped
			else
			{
				// Could be a unicode sequence
				if (c == '\\')
				{
					escaped = true;
					continue;
				}
				
				// Return normal character
				else
					return c;
			}
		}
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
















































































































































































































































































































































































































































































































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/token/Token.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac.token;

import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import java.util.List;
import java.util.Objects;
import net.multiphasicapps.collections.UnmodifiableArrayList;
import net.multiphasicapps.javac.FileNameLineAndColumn;

/**
 * This represents a single token which contains a type and the characters
 * which make up the token.
 *
 * @since 2017/09/04
 */
public final class Token
	implements FileNameLineAndColumn
{
	/** The type of token this is, */
	protected final TokenType type;
	
	/** The token string data. */
	protected final String chars;
	
	/** The file name this token was read from. */
	protected final String filename;
	
	/** The line the token is on. */
	protected final int line;
	
	/** The column the token is on. */
	protected final int column;
	
	/** Token comments. */
	private final Token[] _comments;
	
	/** String representation. */
	private Reference<String> _string;
	
	/**
	 * Initializes the token.
	 *
	 * @param __t The type of token this is.
	 * @param __c The characters which make up the token.
	 * @param __fn The file name this was read from.
	 * @param __l The line the token is on.
	 * @param __o The column the token is on.
	 * @param __comments Comments which are associated with the token.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/09/06
	 */
	public Token(TokenType __t, String __c, String __fn, int __l, int __o,
		Token... __comments)
		throws NullPointerException
	{
		// Check
		if (__t == null || __c == null || __fn == null)
			throw new NullPointerException("NARG");
		
		this.type = __t;
		this.chars = __c;
		this.filename = __fn;
		this.line = __l;
		this.column = __o;
		
		// Smartly copy comments
		if (__comments == null)
			this._comments = new Token[0];
		else if (__comments.length == 0)
			this._comments = __comments;
		else
		{
			__comments = __comments.clone();
			for (Token t : __comments)
				if (t == null)
					throw new NullPointerException("NARG");
			this._comments = __comments;
		}
	}
	
	/**
	 * Initializes the token based off the other token but with the specified
	 * comments.
	 *
	 * @param __t The base token.
	 * @param __comments The token comments.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/04/18
	 */
	public Token(Token __t, Token... __comments)
		throws NullPointerException
	{
		this(__t.type(), __t.characters(), __t.fileName(), __t.line(),
			__t.column(), __comments);
	}
	
	/**
	 * Returns the token characters.
	 *
	 * @return The token characters.
	 * @since 2017/09/06
	 */
	public String characters()
	{
		return this.chars;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/09/09
	 */
	@Override
	public int column()
	{
		return this.column;
	}
	
	/**
	 * Returns the comments associated with this token.
	 *
	 * @return The token comments.
	 * @since 2018/03/12
	 */
	public final List<Token> comments()
	{
		return UnmodifiableArrayList.<Token>of(this._comments);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/09/04
	 */
	@Override
	public boolean equals(Object __o)
	{
		if (this == __o)
			return true;
		
		if (!(__o instanceof Token))
			return false;
		
		Token o = (Token)__o;
		return this.type.equals(o.type) &&
			this.chars.equals(o.chars) &&
			Objects.equals(this.filename, o.filename) &&
			this.line == o.line &&
			this.column == o.column;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/03/12
	 */
	@Override
	public final String fileName()
	{
		return this.filename;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/09/04
	 */
	@Override
	public int hashCode()
	{
		return this.type.hashCode() ^ this.chars.hashCode() ^
			Objects.hashCode(this.filename) ^
			this.line ^ (~this.column);
	}
	
	/**
	 * Is this a comment?
	 *
	 * @return If this is a comment or not.
	 * @since 2018/03/07
	 */
	public final boolean isComment()
	{
		return this.type == TokenType.COMMENT;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/09/09
	 */
	@Override
	public int line()
	{
		return this.line;
	}
	
	/**
	 * Does this token need a space following it to be valid?
	 *
	 * @return If a space is needed to follow to make it valid.
	 * @since 2018/03/07
	 */
	public final boolean needFollowingSpace()
	{
		TokenType type = this.type;
		return type.isIdentifier() ||
			type.isKeyword() ||
			type.isLiteral() ||
			type == TokenType.OPERATOR_PLUS ||
			type == TokenType.OPERATOR_MINUS ||
			type == TokenType.OPERATOR_INCREMENT ||
			type == TokenType.OPERATOR_DECREMENT;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/09/04
	 */
	@Override
	public String toString()
	{
		Reference<String> ref = this._string;
		String rv;
		
		if (ref == null || null == (rv = ref.get()))
			this._string = new WeakReference<>((rv = String.format(
				"%s@%s:%d,%d: %s", this.type, this.filename, this.line,
				this.column, this.chars)));
		
		return rv;
	}
	
	/**
	 * Returns the type of token this is.
	 *
	 * @return The token type.
	 * @since 2017/09/06
	 */
	public TokenType type()
	{
		return this.type;
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




















































































































































































































































































































































































































































































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/token/TokenSource.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac.token;

import net.multiphasicapps.javac.FileNameLineAndColumn;

/**
 * This interface represents a source for tokens.
 *
 * @since 2018/04/18
 */
public interface TokenSource
	extends FileNameLineAndColumn
{
	/**
	 * Returns the next token from the input source.
	 *
	 * @return The next token, if there are no more tokens left then a special
	 * end of file token should be used instead.
	 * @throws TokenizerException If the read input token is not valid.
	 * @since 2018/04/18
	 */
	public abstract Token next()
		throws TokenizerException;
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/token/TokenType.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac.token;

/**
 * This represents the type of token which was parsed.
 *
 * @since 2017/09/04
 */
public enum TokenType
{
	/** End of file. */
	END_OF_FILE,
	
	/** A comment. */
	COMMENT,
	
	/** Identifier. */
	IDENTIFIER,
	
	/** Keyword abstract. */
	KEYWORD_ABSTRACT,
	
	/** Keyword assert. */
	KEYWORD_ASSERT,
	
	/** Keyword boolean. */
	KEYWORD_BOOLEAN,
	
	/** Keyword break. */
	KEYWORD_BREAK,
	
	/** Keyword byte. */
	KEYWORD_BYTE,
	
	/** Keyword case. */
	KEYWORD_CASE,
	
	/** Keyword catch. */
	KEYWORD_CATCH,
	
	/** Keyword char. */
	KEYWORD_CHAR,
	
	/** Keyword class. */
	KEYWORD_CLASS,
	
	/** Keyword continue. */
	KEYWORD_CONTINUE,
	
	/** Keyword default. */
	KEYWORD_DEFAULT,
	
	/** Keyword do. */
	KEYWORD_DO,
	
	/** Keyword double. */
	KEYWORD_DOUBLE,
	
	/** Keyword else. */
	KEYWORD_ELSE,
	
	/** Keyword enum. */
	KEYWORD_ENUM,
	
	/** Keyword extends. */
	KEYWORD_EXTENDS,
	
	/** Keyword final. */
	KEYWORD_FINAL,
	
	/** Keyword finally. */
	KEYWORD_FINALLY,
	
	/** Keyword float. */
	KEYWORD_FLOAT,
	
	/** Keyword for. */
	KEYWORD_FOR,
	
	/** Keyword if. */
	KEYWORD_IF,
	
	/** Keyword implements. */
	KEYWORD_IMPLEMENTS,
	
	/** Keyword import. */
	KEYWORD_IMPORT,
	
	/** Keyword instanceof. */
	KEYWORD_INSTANCEOF,
	
	/** Keyword int. */
	KEYWORD_INT,
	
	/** Keyword interface. */
	KEYWORD_INTERFACE,
	
	/** Keyword long. */
	KEYWORD_LONG,
	
	/** Keyword native. */
	KEYWORD_NATIVE,
	
	/** Keyword new. */
	KEYWORD_NEW,
	
	/** Keyword package. */
	KEYWORD_PACKAGE,
	
	/** Keyword private. */
	KEYWORD_PRIVATE,
	
	/** Keyword protected. */
	KEYWORD_PROTECTED,
	
	/** Keyword public. */
	KEYWORD_PUBLIC,
	
	/** Keyword return. */
	KEYWORD_RETURN,
	
	/** Keyword short. */
	KEYWORD_SHORT,
	
	/** Keyword static. */
	KEYWORD_STATIC,
	
	/** Keyword strictfp. */
	KEYWORD_STRICTFP,
	
	/** Keyword super. */
	KEYWORD_SUPER,
	
	/** Keyword switch. */
	KEYWORD_SWITCH,
	
	/** Keyword synchronized. */
	KEYWORD_SYNCHRONIZED,
	
	/** Keyword this. */
	KEYWORD_THIS,
	
	/** Keyword throw. */
	KEYWORD_THROW,
	
	/** Keyword throws. */
	KEYWORD_THROWS,
	
	/** Keyword transient. */
	KEYWORD_TRANSIENT,
	
	/** Keyword try. */
	KEYWORD_TRY,
	
	/** Keyword void. */
	KEYWORD_VOID,
	
	/** Keyword volatile. */
	KEYWORD_VOLATILE,
	
	/** Keyword while. */
	KEYWORD_WHILE,
	
	/** The null literal. */
	LITERAL_NULL,
	
	/** The false literal. */
	LITERAL_FALSE,
	
	/** The true literal. */
	LITERAL_TRUE,
	
	/** Binary integer literal. */
	LITERAL_BINARY_INTEGER,
	
	/** Octal integer literal. */
	LITERAL_OCTAL_INTEGER,
	
	/** Decimal integer literal. */
	LITERAL_DECIMAL_INTEGER,
	
	/** Hexadecimal integer literal. */
	LITERAL_HEXADECIMAL_INTEGER,
	
	/** Decimal float literal. */
	LITERAL_DECIMAL_FLOAT,
	
	/** Hexadecimal float literal. */
	LITERAL_HEXADECIMAL_FLOAT,
	
	/** String literal. */
	LITERAL_STRING,
	
	/** Character literal. */
	LITERAL_CHARACTER,
	
	/** Compare for equality. */
	COMPARE_EQUALS,
	
	/** Compare for inequality. */
	COMPARE_NOT_EQUALS,
	
	/** Compare less than. */
	COMPARE_LESS_THAN,
	
	/** Compare less than or equals to. */
	COMPARE_LESS_OR_EQUAL,
	
	/** Compare greater than. */
	COMPARE_GREATER_THAN,
	
	/** Compare greater than or equal. */
	COMPARE_GREATER_OR_EQUAL,
	
	/** Compare AND. */
	COMPARE_AND,
	
	/** Compare OR. */
	COMPARE_OR,
	
	/** Assign operator. */
	OPERATOR_ASSIGN,
	
	/** Add operator. */
	OPERATOR_PLUS,
	
	/** Add and assign operator. */
	OPERATOR_PLUS_ASSIGN,
	
	/** Subtract operator. */
	OPERATOR_MINUS,
	
	/** Subtract and assign operator. */
	OPERATOR_MINUS_ASSIGN,
	
	/** Multiply operator. */
	OPERATOR_MULTIPLY,
	
	/** Multiply and assign operator. */
	OPERATOR_MULTIPLY_ASSIGN,
	
	/** Divide operator. */
	OPERATOR_DIVIDE,
	
	/** Divide and assign operator. */
	OPERATOR_DIVIDE_ASSIGN,
	
	/** Remainder operator. */
	OPERATOR_REMAINDER,
	
	/** Remainder and assign operator. */
	OPERATOR_REMAINDER_ASSIGN,
	
	/** Shift left. */
	OPERATOR_SHIFT_LEFT,
	
	/** Shift left and assign. */
	OPERATOR_SHIFT_LEFT_ASSIGN,
	
	/** Signed Shift right. */
	OPERATOR_SSHIFT_RIGHT,
	
	/** Signed Shift right and assign. */
	OPERATOR_SSHIFT_RIGHT_ASSIGN,
	
	/** Unsigned Shift right. */
	OPERATOR_USHIFT_RIGHT,
	
	/** Unsigned Shift right and assign. */
	OPERATOR_USHIFT_RIGHT_ASSIGN,
	
	/** Ternary question operator. */
	SYMBOL_QUESTION,
	
	/** The NOT operator. */
	OPERATOR_NOT,
	
	/** The NOT and assign operator. */
	OPERATOR_NOT_ASSIGN,
	
	/** The AND operator. */
	OPERATOR_AND,
	
	/** The AND and assign operator. */
	OPERATOR_AND_ASSIGN,
	
	/** The XOR operator. */
	OPERATOR_XOR,
	
	/** The XOR and assign operator. */
	OPERATOR_XOR_ASSIGN,
	
	/** The OR operator. */
	OPERATOR_OR,
	
	/** The OR and assign operator. */
	OPERATOR_OR_ASSIGN,
	
	/** Bitwise complement. */
	OPERATOR_COMPLEMENT,
	
	/** Increment. */
	OPERATOR_INCREMENT,
	
	/** Decrement. */
	OPERATOR_DECREMENT,
	
	/** Ternary colon operator or label. */
	SYMBOL_COLON,
	
	/** Double colon. */
	SYMBOL_DOUBLE_COLON,
	
	/** Open parenthesis. */
	SYMBOL_OPEN_PARENTHESIS,
	
	/** Closed parenthesis. */
	SYMBOL_CLOSED_PARENTHESIS,
	
	/** Open brace. */
	SYMBOL_OPEN_BRACE,
	
	/** Closed brace. */
	SYMBOL_CLOSED_BRACE,
	
	/** Open bracket. */
	SYMBOL_OPEN_BRACKET,
	
	/** Closed bracket. */
	SYMBOL_CLOSED_BRACKET,
	
	/** Semicolon. */
	SYMBOL_SEMICOLON,
	
	/** Comma. */
	SYMBOL_COMMA,
	
	/** The dot separator. */
	SYMBOL_DOT,
	
	/** The ellipses. */
	SYMBOL_ELLIPSES,
	
	/** Lambda symbol. */
	SYMBOL_LAMBDA,
	
	/** At symbol for annotations. */
	SYMBOL_AT,
	
	/** End. */
	;
	
	/**
	 * Is this an assignment operator?
	 *
	 * @return If this is an assignment operator.
	 * @since 2018/05/03
	 */
	public final boolean isAssignmentOperator()
	{
		switch (this)
		{
			case OPERATOR_ASSIGN:
			case OPERATOR_PLUS_ASSIGN:
			case OPERATOR_MINUS_ASSIGN:
			case OPERATOR_MULTIPLY_ASSIGN:
			case OPERATOR_DIVIDE_ASSIGN:
			case OPERATOR_REMAINDER_ASSIGN:
			case OPERATOR_SHIFT_LEFT_ASSIGN:
			case OPERATOR_SSHIFT_RIGHT_ASSIGN:
			case OPERATOR_USHIFT_RIGHT_ASSIGN:
			case OPERATOR_NOT_ASSIGN:
			case OPERATOR_AND_ASSIGN:
			case OPERATOR_XOR_ASSIGN:
			case OPERATOR_OR_ASSIGN:
				return true;
			
			default:
				return false;
		}
	}
	
	/**
	 * Is this a basic type?
	 *
	 * @return If this is a basic type.
	 * @since 2018/05/03
	 */
	public final boolean isBasicType()
	{
		switch (this)
		{
			case KEYWORD_BYTE:
			case KEYWORD_SHORT:
			case KEYWORD_CHAR:
			case KEYWORD_INT:
			case KEYWORD_LONG:
			case KEYWORD_FLOAT:
			case KEYWORD_DOUBLE:
			case KEYWORD_BOOLEAN:
				return true;
			
			default:
				return false;
		}
	}
	
	/**
	 * Is this a modifier to a class?
	 *
	 * @return If this is a class modifier.
	 * @since 2018/03/10
	 */
	public final boolean isClassModifier()
	{
		switch (this)
		{
			case KEYWORD_ABSTRACT:
			case KEYWORD_FINAL:
			case KEYWORD_PRIVATE:
			case KEYWORD_PROTECTED:
			case KEYWORD_PUBLIC:
			case KEYWORD_STATIC:
			case KEYWORD_STRICTFP:
				return true;
			
			default:
				return false;
		}
	}
	
	/**
	 * Is this a comment?
	 *
	 * @return If this is a comment or not.
	 * @since 2017/09/06
	 */
	public final boolean isComment()
	{
		switch (this)
		{
				// Comments
			case COMMENT:
				return true;
			
				// Not a comment
			default:
				return false;
		}
	}
	
	/**
	 * Is this an identifier?
	 *
	 * @return If this is an identifier.
	 * @since 2018/03/07
	 */
	public final boolean isIdentifier()
	{
		return this == IDENTIFIER;
	}
	
	/**
	 * Is this a keyword?
	 *
	 * @return If this is a keyword.
	 * @since 2018/03/07
	 */
	public final boolean isKeyword()
	{
		switch (this)
		{
			case KEYWORD_ABSTRACT:
			case KEYWORD_ASSERT:
			case KEYWORD_BOOLEAN:
			case KEYWORD_BREAK:
			case KEYWORD_BYTE:
			case KEYWORD_CASE:
			case KEYWORD_CATCH:
			case KEYWORD_CHAR:
			case KEYWORD_CLASS:
			case KEYWORD_CONTINUE:
			case KEYWORD_DEFAULT:
			case KEYWORD_DO:
			case KEYWORD_DOUBLE:
			case KEYWORD_ELSE:
			case KEYWORD_ENUM:
			case KEYWORD_EXTENDS:
			case KEYWORD_FINAL:
			case KEYWORD_FINALLY:
			case KEYWORD_FLOAT:
			case KEYWORD_FOR:
			case KEYWORD_IF:
			case KEYWORD_IMPLEMENTS:
			case KEYWORD_IMPORT:
			case KEYWORD_INSTANCEOF:
			case KEYWORD_INT:
			case KEYWORD_INTERFACE:
			case KEYWORD_LONG:
			case KEYWORD_NATIVE:
			case KEYWORD_NEW:
			case KEYWORD_PACKAGE:
			case KEYWORD_PRIVATE:
			case KEYWORD_PROTECTED:
			case KEYWORD_PUBLIC:
			case KEYWORD_RETURN:
			case KEYWORD_SHORT:
			case KEYWORD_STATIC:
			case KEYWORD_STRICTFP:
			case KEYWORD_SUPER:
			case KEYWORD_SWITCH:
			case KEYWORD_SYNCHRONIZED:
			case KEYWORD_THIS:
			case KEYWORD_THROW:
			case KEYWORD_THROWS:
			case KEYWORD_TRANSIENT:
			case KEYWORD_TRY:
			case KEYWORD_VOID:
			case KEYWORD_VOLATILE:
			case KEYWORD_WHILE:
				return true;
			
			default:
				return false;
		}	
	}
	
	/**
	 * Is this an infix operation?
	 *
	 * @return If this is an infix operation.
	 * @since 2018/05/03
	 */
	public final boolean isInfixOperation()
	{
		switch (this)
		{
			case COMPARE_OR:
			case COMPARE_AND:
			case COMPARE_EQUALS:
			case COMPARE_NOT_EQUALS:
			case COMPARE_LESS_THAN:
			case COMPARE_GREATER_THAN:
			case COMPARE_LESS_OR_EQUAL:
			case COMPARE_GREATER_OR_EQUAL:
			case OPERATOR_OR:
			case OPERATOR_XOR:
			case OPERATOR_AND:
			case OPERATOR_SHIFT_LEFT:
			case OPERATOR_SSHIFT_RIGHT:
			case OPERATOR_USHIFT_RIGHT:
			case OPERATOR_PLUS:
			case OPERATOR_MINUS:
			case OPERATOR_MULTIPLY:
			case OPERATOR_DIVIDE:
			case OPERATOR_REMAINDER:
				return true;
			
			default:
				return false;
		}
	}
	
	/**
	 * Is this a literal?
	 *
	 * @return If this is a literal.
	 * @since 2018/03/07
	 */
	public final boolean isLiteral()
	{
		switch (this)
		{
			case LITERAL_NULL:
			case LITERAL_FALSE:
			case LITERAL_TRUE:
			case LITERAL_BINARY_INTEGER:
			case LITERAL_OCTAL_INTEGER:
			case LITERAL_DECIMAL_INTEGER:
			case LITERAL_HEXADECIMAL_INTEGER:
			case LITERAL_DECIMAL_FLOAT:
			case LITERAL_HEXADECIMAL_FLOAT:
			case LITERAL_STRING:
				return true;
			
			default:
				return false;
		}
	}
	
	/**
	 * Is this the potential start of a class declaration?
	 *
	 * @return If this is the potential start of a class declaration.
	 * @since 2018/03/07
	 */
	public final boolean isPotentialClassStart()
	{
		switch (this)
		{
			case KEYWORD_ABSTRACT:
			case KEYWORD_ENUM:
			case KEYWORD_FINAL:
			case KEYWORD_INTERFACE:
			case KEYWORD_PRIVATE:
			case KEYWORD_PROTECTED:
			case KEYWORD_PUBLIC:
			case KEYWORD_STATIC:
			case KEYWORD_STRICTFP:
			case SYMBOL_AT:
				return true;
			
			default:
				return false;
		}
	}
	
	/**
	 * Is this a word?
	 *
	 * @return If this is a word.
	 * @since 2018/03/07
	 */
	public final boolean isWord()
	{
		return this == IDENTIFIER ||
			this.isKeyword();
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






























































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/token/Tokenizer.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac.token;

import java.io.Closeable;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.IOException;
import java.io.Reader;
import java.io.UnsupportedEncodingException;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Deque;
import java.util.LinkedList;
import java.util.List;
import net.multiphasicapps.collections.UnmodifiableList;
import net.multiphasicapps.javac.FileNameLineAndColumn;

/**
 * This class is the tokenizer which is used to provide tokens for the lexical
 * structure parser. This tokenizer does not return any comments and it will
 * perform decoupling of less than and greater than brackets which are used
 * for generic types.
 *
 * @since 2017/09/04
 */
public class Tokenizer
	implements Closeable, FileNameLineAndColumn, TokenSource
{
	/** Operators used. */
	private static final List<String> _OPERATORS =
		UnmodifiableList.<String>of(Arrays.<String>asList("(", ")", "{", "}",
			"[", "]", ";", ",", ".", "=", ">", "<", "!", "~", "?", ":", "::",
			"==", "<=", ">=", "!=", "&&", "||", "++", "--", "+", "-", "*", "/",
			"&", "|", "^", "%", "<<", ">>", ">>>", "+=", "-=", "*=", "/=",
			"&=", "|=", "^=", "%=", "<<=", ">>=", ">>>=", "->", "@"));
	
	/** Operator character code merge. */
	private static final int[] _OPERATOR_MERGE;
	
	/** No comments used. */
	private static final Token[] _NO_COMMENTS =
		new Token[0];
	
	/** The input file name. */
	protected final String filename;
	
	/** Input character source. */
	protected final LogicalReader in;
	
	/** The comments which are waiting in the queue. */
	private final Deque<Token> _comments =
		new LinkedList<>();
	
	/** Is there a character waiting? */
	private boolean _nxwaiting;
	
	/** The next character that is waiting. */
	private int _nxchar;
	
	/** The next line. */
	private int _nxline =
		1;
	
	/** The next column. */
	private int _nxcolumn =
		1;
	
	/** The current line. */
	private int _curline =
		1;
	
	/** The current column. */
	private int _curcolumn =
		1;
	
	/** The current token's line. */
	private int _atline =
		1;
	
	/** The current token's column. */
	private int _atcolumn =
		1;
	
	/** The number of tokens which are waiting to be decomposed. */
	private int _decomposewait;
	
	/** The number of characters which have been decomposed. */
	private int _decomposedid;
	
	/** The number of open angle brackets. */
	private int _opencount;
	
	/** Used for angle bracket decomposition. */
	private TokenType _lasttype;
	
	/**
	 * Initializes the merged operator set.
	 *
	 * @since 2018/03/07
	 */
	static
	{
		List<String> operators = Tokenizer._OPERATORS;
		int numops = operators.size();
		int[] merge = new int[numops];
		for (int i = 0; i < numops; i++)
		{
			// Start with empty space
			int val = 0xFF_FF_FF_FF;
			
			// Go through all characters in the operation and shift them in
			String op = operators.get(i);
			for (int j = 0, opn = op.length(); j < opn; j++)
			{
				val <<= 8;
				val |= ((int)op.charAt(j)) & 0x7F;
			}
			
			merge[i] = val;
		}
		
		_OPERATOR_MERGE = merge;
	}
	
	/**
	 * Initializes the tokenizer for Java source code.
	 *
	 * @param __is The tokenizer input, it is treated as UTF-8.
	 * @throws NullPointerException On null arguments.
	 * @throws RuntimeException If UTF-8 is not supported, but this should
	 * not occur.
	 * @since 2017/09/04
	 */
	public Tokenizer(String __fn, InputStream __is)
		throws NullPointerException, RuntimeException
	{
		this(__fn, __wrap(__is));
	}
	
	/**
	 * Initializes the tokenizer for Java source code.
	 *
	 * @param __r The reader to read characters from.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/09/04
	 */
	public Tokenizer(String __fn, Reader __r)
	{
		// Check
		if (__fn == null || __r == null)
			throw new NullPointerException("NARG");
		
		this.filename = __fn;
		this.in = new LogicalReader(__fn, __r);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/03/06
	 */
	@Override
	public void close()
		throws TokenizerException
	{
		try
		{
			this.in.close();
		}
		catch (IOException e)
		{
			// {@squirreljme.error AQ2v Failed to close the tokenizer.}
			throw new TokenizerException(this, "AQ2v", e);
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/03/06
	 */
	@Override
	public final int column()
	{
		return this._atcolumn;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/03/12
	 */
	@Override
	public final String fileName()
	{
		return this.in.fileName();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/03/06
	 */
	@Override
	public final int line()
	{
		return this._atline;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/09/05
	 */
	@Override
	public final Token next()
		throws TokenizerException
	{
		int decomposewait = this._decomposewait;
		
		// Push any comment tokens to the comment queue, do not read tokens
		// however if there are tokens waiting to be decomposed
		Deque<Token> comments = this._comments;
		Token rv = null;
		if (decomposewait <= 0)
			for (;;)
			{
				// If it is a comment, it gets commented
				rv = this.__decodeToken();
				if (rv.type() == TokenType.COMMENT)
					comments.addLast(rv);
				
				// Stop on non-comments
				else
					break;
			}
		
		// Any comments which were read will always be drained
		Token[] usecomments;
		int numcomments;
		if ((numcomments = comments.size()) > 0)
		{
			usecomments = comments.<Token>toArray(new Token[numcomments]);
			comments.clear();
		}
		
		// No comments to use
		else
			usecomments = Tokenizer._NO_COMMENTS;
		
		// Are there tokens waiting to be decomposed?
		if (decomposewait > 0)
		{
			// Used for true positioning of characters
			int line = this._atline,
				column = this._atcolumn,
				decomposedid = this._decomposedid;
			
			// Remove a decomposed token
			this._decomposewait = decomposewait - 1;
			this._decomposedid = decomposedid + 1;
			
			// Build a decomposed token
			return new Token(TokenType.COMPARE_GREATER_THAN, ">",
				this.filename, line, column + decomposedid, usecomments);
		}
		
		// Used to determine how many braces have been opened
		int opencount = this._opencount;
		
		// Determine if decomposition is to be performed
		TokenType type = rv.type();
		TokenType lasttype = this._lasttype;
		int maxdecouple = 0;
		switch (type)
		{
				// Count open angle brackets but only if they follow
				// dots or identifiers
				// Foo<Bar>
				// foo.<Bar>boop()
			case COMPARE_LESS_THAN:
				if (lasttype != null &&
					(lasttype == TokenType.IDENTIFIER ||
					lasttype == TokenType.SYMBOL_DOT))
					this._opencount = opencount + 1;
				break;
			
				// Closing bracket, never close it negatively
			case COMPARE_GREATER_THAN:
				if (opencount > 0)
					this._opencount = opencount - 1;
				break;
			
				// Decouple two closers
			case OPERATOR_SSHIFT_RIGHT:
				maxdecouple = 2;
				break;
			
				// Decouple three closers
			case OPERATOR_USHIFT_RIGHT:
				maxdecouple = 3;
				break;
		
				// These may appear in the middle of generic brackets so
				// if they are read do not clear the count
				// Primitive types may be used in arrays such as for
				// Foo<Bar[]>
			case IDENTIFIER:
			case KEYWORD_EXTENDS:
			case KEYWORD_BOOLEAN:
			case KEYWORD_BYTE:
			case KEYWORD_SHORT:
			case KEYWORD_CHAR:
			case KEYWORD_INT:
			case KEYWORD_LONG:
			case KEYWORD_FLOAT:
			case KEYWORD_DOUBLE:
			case SYMBOL_OPEN_BRACKET:
			case SYMBOL_CLOSED_BRACKET:
			case SYMBOL_QUESTION:
			case SYMBOL_DOT:
			case SYMBOL_COMMA:
				break;
			
				// Every other symbol cannot appear in a generic
				// declaration so there is no possible chance that this was
				// meant to be used for generics
			default:
				opencount = 0;
				break;
		}
		
		// Use for later processing
		this._lasttype = type;
		
		// There are tokens which may be decoupled
		if (maxdecouple > 0)
		{
			// If there are more things to decouple than things which are
			// open then it is possible there is something illegal like
			// `Foo<Bar>> 2` or similar, otherwise that illegal bitshift will
			// end up being turned into `> >` logically
			if (maxdecouple > opencount)
				opencount = 0;
			
			// Translate the >> or >>> into multiple tokens according to
			// the decoupling count
			else
			{
				// Set the token to be returned which is initially decoupled
				// Since the original token is being decoupled, just ignore
				// whatever was originally here
				rv = new Token(TokenType.COMPARE_GREATER_THAN, ">",
					this.filename, rv.line(), rv.column(), usecomments);
				
				// Set these initial values because a decoupled token will
				// always be returned
				this._decomposewait = maxdecouple - 1;
				this._decomposedid = 1;
				
				// Treat decoupled tokens as closing statements
				this._opencount = opencount - maxdecouple;
			}
		}
		
		// Use that original token
		return rv;
	}
	
	/**
	 * Returns the next raw token which was read from the input.
	 *
	 * @return The read token.
	 * @throws TokenizerException If the token is not valid.
	 * @since 2018/04/18
	 */
	private final Token __decodeToken()
		throws TokenizerException
	{
		// Loop to skip whitespace
		for (;;)
		{
			// Record before read because the read will make the column count
			// and possibly even the row be off by one
			int line = this._curline,
				column = this._curcolumn;
			
			// Stop at EOF
			int c = this.__nextChar();
			if (c < 0)
			{
				// Just keep sending EOF tokens forever
				return __token(TokenType.END_OF_FILE, "");
			}
			
			// Skip whitespace
			if (CharacterTest.isWhite(c))
				continue;
			
			// Token position, used for debugging
			this._atline = line;
			this._atcolumn = column;
			
			// Forward slash: comments, /, or /=.
			if (c == '/')
				return __determineForwardSlash();
			
			// Equal sign
			else if (c == '=')
				return __determineEquals();
			
			// Dot
			else if (c == '.')
			{
				// If the following character is a number then this is a
				// decimal digit
				int p = this.__peekChar();
				if (p >= '0' && p <= '9')
					return this.__getNumberLiteral((char)p);
				
				// If it is a dot then it could be ...
				else if (p == '.')
				{
					// Consume that character
					this.__nextChar();
					
					// {@squirreljme.error AQ2w Invalid elipses, three
					// dots were expected but only two were read.}
					p = this.__nextChar();
					if (p != '.')
						throw new TokenizerException(this, "AQ2w");
					
					return this.__token(TokenType.SYMBOL_ELLIPSES, "...");
				}
				
				// Otherwise just a dot
				return this.__token(TokenType.SYMBOL_DOT, ".");
			}
			
			// Ternary colon, case, label, or method reference
			else if (c == ':')
			{
				// Could be a double colon
				int peek = this.__peekChar();
				if (peek == ':')
				{
					this.__nextChar();
					return this.__token(TokenType.SYMBOL_DOUBLE_COLON, "::");
				}
				
				// Only a single one
				return this.__token(TokenType.SYMBOL_COLON, ":");
			}
			
			// Identifiers
			else if (CharacterTest.isIdentifierStart((char)c))
				return __getIdentifier((char)c);
			
			// Integer/float literals
			else if (c >= '0' && c <= '9')
				return __getNumberLiteral((char)c);
			
			// String
			else if (c == '\"')
				return this.__getString();
			
			// Is start is a potential symbol
			else if (CharacterTest.isSymbolStart(c))
				return this.__determineOperator(c);
			
			// {@squirreljme.error AQ2x Unknown character while tokenizing the
			// Java source code. (The character; The line; The column)}
			else
				throw new TokenizerException(this,
					String.format("AQ2x %c %d %d", (char)c, line, column));
		}
	}
	
	/**
	 * Decides how to parse an equal sign.
	 *
	 * @return The read token.
	 * @throws TokenizerException If the token is not valid.
	 * @since 2017/09/11
	 */
	private Token __determineEquals()
		throws TokenizerException
	{
		// Checking for equality?
		int d = __peekChar();
		if (d == '=')
		{
			__nextChar();
			return __token(TokenType.COMPARE_EQUALS, "==");
		}
		
		// Just an assignment
		else
			return __token(TokenType.OPERATOR_ASSIGN, "=");
	}
	
	/**
	 * Decides what to do with a forward slash.
	 *
	 * @return The read token.
	 * @throws TokenizerException If the token is not valid.
	 * @since 2017/09/09
	 */
	private Token __determineForwardSlash()
		throws TokenizerException
	{
		int c = __peekChar();
		
		// Not-divide
		if (c == '*' || c == '/' || c == '=')
		{
			// Eat character
			__nextChar();
			
			// Multi-line comment
			if (c == '*')
				return __getMultiLineComment();
		
			// Single line comment
			else if (c == '/')
				return __getSingleLineComment();
		
			// Divide and assign
			else
				return __token(TokenType.OPERATOR_DIVIDE_ASSIGN,
					"/=");
		}
		
		// Divide otherwise
		else
			return __token(TokenType.OPERATOR_DIVIDE, "/");
	}
	
	/**
	 * Decides how to decode a given sequence to read an operator from it.
	 *
	 * @param __c The starting character.
	 * @return The resulting token.
	 * @throws TokenizerException If the token is not valid.
	 * @since 2018/03/06
	 */
	private Token __determineOperator(int __c)
		throws TokenizerException
	{
		List<String> operators = Tokenizer._OPERATORS;
		int numops = operators.size();
		int[] merge = Tokenizer._OPERATOR_MERGE;
		
		// Setup candidate list
		boolean[] candidate = new boolean[numops],
			oldcandidate = new boolean[numops];
		for (int i = 0; i < numops; i++)
		{
			oldcandidate[i] = true;
			candidate[i] = true;
		}
		
		// Setup current fill
		int fill = 0xFF_FF_FF_00 | (__c < 128 ? __c & 0x7F : 0xFE),
			mask = 0x00_00_00_FF;
		
		// Determine which token is used for the character
		boolean needconsume = false;
		int foundop = -1,
			newcandidates = 0,
			tempfoundop = -1;
		for (;;)
		{
			// Get old values which is used to determine a match
			int oldnewcandidates = newcandidates,
				oldtempfoundfop = tempfoundop;
			
			// Clear for a new run;
			newcandidates = 0;
			tempfoundop = -1;
			
			// Determine which characters map
			for (int i = 0; i < numops; i++)
			{
				// Do not check this token
				boolean iscandidate = candidate[i];
				oldcandidate[i] = candidate[i];
				if (!iscandidate)
					continue;
				
				// Cannot be the character
				if ((fill & mask) != (merge[i] & mask))
					candidate[i] = false;
				
				// Could be the characters
				else
				{
					newcandidates++;
					tempfoundop = i;
				}
			}
			
			// Only one character is valid?
			// The check here makes the search for single character sequences
			// and >>>= valid
			if (newcandidates == 1)
			{
				// Need to consume the character?
				if (needconsume)
					this.__nextChar();
				
				foundop = tempfoundop;
				break;
			}
			
			// Nothing is valid, then an old one is valid
			else if (newcandidates == 0)
			{
				// Unmask and unfill
				int unfill = (fill >>> 8) | 0xFF_00_00_00,
					unmask = (mask >>> 8);
				
				// Go through the old candidate list and determine the
				// character to use.
				for (int i = 0; i < numops; i++)
				{
					if (!oldcandidate[i])
						continue;
					
					// Must match the sequence exactly including the upper
					// bits because those are considered invalid
					if (unfill == merge[i])
					{
						foundop = i;
						break;
					}
				}
				
				// {@squirreljme.error AQ2y Could not determine the
				// operator to decode.}
				if (foundop < 0)
					throw new TokenizerException(this, "AQ2y");
				break;
			}
			
			// Need to consume the character before trying again?
			if (needconsume)
				this.__nextChar();
			
			// Peek in next character
			needconsume = true;
			__c = this.__peekChar();
			
			// Fill in character
			fill <<= 8;
			fill |= (__c >= 0 && __c < 128 ? __c & 0x7F : 0xFE);
			
			// Already at the maximum mask, nothing else to try
			if (mask == 0xFF_FF_FF_FF)
				break;
			
			// Increase mask to confirm checking area
			mask <<= 8;
			mask |= 0xFF;
		}
		
		// {@squirreljme.error AQ2z Could not decode an operator.}
		if (foundop < 0)
			throw new TokenizerException(this, "AQ2z");
		
		return this.__tokenOperator(operators.get(foundop));
	}
	
	/**
	 * Reads an identifier.
	 *
	 * @param __ic The initial character.
	 * @return The read identifier.
	 * @throws TokenizerException If the token is not valid.
	 * @since 2017/09/10
	 */
	private Token __getIdentifier(char __ic)
		throws TokenizerException
	{
		StringBuilder sb = new StringBuilder();
		sb.append(__ic);
		for (;;)
		{
			// Only consider identifier parts
			int c = __peekChar();
			if (c < 0 || !CharacterTest.isIdentifierPart((char)c))
			{
				String s = sb.toString();
				TokenType t;
				switch (s)
				{
						// {@squirreljme.error AQ30 The specified keywords
						// are reserved and not valid. (The keyword)}
					case "const":
					case "goto":
						throw new TokenizerException(this, String.format(
							"AQ30 %s", __token(TokenType.IDENTIFIER, s)));
					
					case "abstract":	t = TokenType.KEYWORD_ABSTRACT; break;
					case "assert":		t = TokenType.KEYWORD_ASSERT; break;
					case "boolean":		t = TokenType.KEYWORD_BOOLEAN; break;
					case "break":		t = TokenType.KEYWORD_BREAK; break;
					case "byte":		t = TokenType.KEYWORD_BYTE; break;
					case "case":		t = TokenType.KEYWORD_CASE; break;
					case "catch":		t = TokenType.KEYWORD_CATCH; break;
					case "char":		t = TokenType.KEYWORD_CHAR; break;
					case "class":		t = TokenType.KEYWORD_CLASS; break;
					case "continue":	t = TokenType.KEYWORD_CONTINUE; break;
					case "default":		t = TokenType.KEYWORD_DEFAULT; break;
					case "do":			t = TokenType.KEYWORD_DO; break;
					case "double":		t = TokenType.KEYWORD_DOUBLE; break;
					case "else":		t = TokenType.KEYWORD_ELSE; break;
					case "enum":		t = TokenType.KEYWORD_ENUM; break;
					case "extends":		t = TokenType.KEYWORD_EXTENDS; break;
					case "final":		t = TokenType.KEYWORD_FINAL; break;
					case "finally":		t = TokenType.KEYWORD_FINALLY; break;
					case "float":		t = TokenType.KEYWORD_FLOAT; break;
					case "for":			t = TokenType.KEYWORD_FOR; break;
					case "if":			t = TokenType.KEYWORD_IF; break;
					case "implements":
						t = TokenType.KEYWORD_IMPLEMENTS;
						break;
						
					case "import":		t = TokenType.KEYWORD_IMPORT; break;
					case "instanceof":
						t = TokenType.KEYWORD_INSTANCEOF;
						break;
					case "int":			t = TokenType.KEYWORD_INT; break;
					case "interface":	t = TokenType.KEYWORD_INTERFACE; break;
					case "long":		t = TokenType.KEYWORD_LONG; break;
					case "native":		t = TokenType.KEYWORD_NATIVE; break;
					case "new":			t = TokenType.KEYWORD_NEW; break;
					case "package":		t = TokenType.KEYWORD_PACKAGE; break;
					case "private":		t = TokenType.KEYWORD_PRIVATE; break;
					case "protected":	t = TokenType.KEYWORD_PROTECTED; break;
					case "public":		t = TokenType.KEYWORD_PUBLIC; break;
					case "return":		t = TokenType.KEYWORD_RETURN; break;
					case "short":		t = TokenType.KEYWORD_SHORT; break;
					case "static":		t = TokenType.KEYWORD_STATIC; break;
					case "strictfp":	t = TokenType.KEYWORD_STRICTFP; break;
					case "super":		t = TokenType.KEYWORD_SUPER; break;
					case "switch":		t = TokenType.KEYWORD_SWITCH; break;
					case "synchronized":
						t = TokenType.KEYWORD_SYNCHRONIZED;
						break;
						
					case "this":		t = TokenType.KEYWORD_THIS; break;
					case "throw":		t = TokenType.KEYWORD_THROW; break;
					case "throws":		t = TokenType.KEYWORD_THROWS; break;
					case "transient":	t = TokenType.KEYWORD_TRANSIENT; break;
					case "try":			t = TokenType.KEYWORD_TRY; break;
					case "void":		t = TokenType.KEYWORD_VOID; break;
					case "volatile":	t = TokenType.KEYWORD_VOLATILE; break;
					case "while":		t = TokenType.KEYWORD_WHILE; break;
					case "null":		t = TokenType.LITERAL_NULL; break;
					case "false":		t = TokenType.LITERAL_FALSE; break;
					case "true":		t = TokenType.LITERAL_TRUE; break;
					default:			t = TokenType.IDENTIFIER; break;
				}
				
				return __token(t, s); 
			}
			
			// Consume it
			sb.append((char)__nextChar());
		}
	}
	
	/**
	 * Reads a multi-line comment.
	 *
	 * @return The comment token.
	 * @throws TokenizerException If the token is not valid.
	 * @since 2017/09/11
	 */
	private Token __getMultiLineComment()
		throws TokenizerException
	{
		StringBuilder sb = new StringBuilder();
		for (;;)
		{
			// {@squirreljme.error AQ31 End of file reached while reading a
			// multi-line comment.}
			int c = __peekChar();
			if (c < 0)
				throw new TokenizerException(this, "AQ31");
			
			// Potential end of comment?
			if (c == '*')
			{
				// Need to potentially detect the slash
				c = __nextChar();
				int d = __peekChar();
				
				// Finish it, do not include the */
				if (d == '/')
				{
					// Eat the slash otherwise divide operators will always
					// follow multi-line comments
					__nextChar();
					return __token(TokenType.COMMENT, sb);
				}
				
				// Just some asterisk
				else
					sb.append((char)c);
			}
			
			// Normal
			else
				sb.append((char)__nextChar());
		}
	}
	
	/**
	 * Decodes a number literal which could be an integer or floating point
	 * value.
	 *
	 * @param __c The initial read character.
	 * @return The decoded token.
	 * @throws TokenizerException If the token is not valid.
	 * @since 2017/09/11
	 */
	private Token __getNumberLiteral(char __c)
		throws TokenizerException
	{
		// Read a decimal point?
		boolean gotdec = (__c == '.');
		
		// All possibilities are available at start
		boolean isbinint = true,
			isoctint = true,
			isdecint = true,
			ishexint = true,
			isdecfloat = true,
			ishexfloat = true;
		
		// Only decimal values
		if (__c >= '1' && __c <= '9')
			isbinint = isoctint = ishexint = ishexfloat = false;
		
		// Otherwise cannot be an integer. Note that it can still be a decimal
		// float because 0009.7 is possible to be decoded still.
		else
			isdecint = false;
		
		// Resulting token
		StringBuilder sb = new StringBuilder();
		sb.append(__c);
		
		// Literal processing is a bit complex and as such there is much
		// handling for state within this loop. One general thing to remember
		// is that something which appears invalid for one state can be
		// completely valid for another state.
		// So this basically just tries to invalidate everything
		for (int inchars = 1;;)
		{
			// If the next character is one of these then it cannot possibly
			// part of a number
			int peek = this.__peekChar();
			if (peek < 0 || CharacterTest.isWhite(peek) ||
				!CharacterTest.isPossibleNumberChar(peek))
			{
				// {@squirreljme.error AQ32 An identifier character cannot
				// follow a numerical literal. (The next character)}
				if (CharacterTest.isIdentifierPart(peek))
					throw new TokenizerException(this, 
						String.format("AQ32 %c", peek));
				break;
			}
			
			// Debug
			todo.DEBUG.note("Literal char: %c", peek);
			
			// {@squirreljme.error AQ33 Number has multiple decimal points,
			// only one is valid.}
			if (peek == '.')
			{
				if (gotdec)
					throw new TokenizerException(this, "AQ33");
				gotdec = true;
			}
			
			// Binary literal?
			if (isbinint)
			{
				throw new todo.TODO();
			}
			
			// Octal literal?
			if (isoctint)
			{
				throw new todo.TODO();
			}
			
			// Decimal literal?
			if (isdecint)
			{
				throw new todo.TODO();
			}
			
			// Hexadecimal literal?
			if (ishexint)
			{
				throw new todo.TODO();
			}
			
			// Float literal?
			if (isdecfloat)
			{
				throw new todo.TODO();
			}
			
			// Hexfloat literal?
			if (ishexfloat)
			{
				throw new todo.TODO();
			}
			
			// If this point is reached then the character is valid
			sb.append((char)this.__nextChar());
			inchars++;
			
			// {@squirreljme.error AQ34 No numberal literals left to put
			// the literal under as they have all been ruled out. (The
			// current string sequence)}
			if (!isbinint && !isbinint && !isoctint && !isdecint &&
				!ishexint && !isdecfloat && !ishexfloat)
				throw new TokenizerException(this, 
					String.format("AQ34 %s", sb));
		}
		
		// Token only had a length of one so these will never be valid
		// because they require prefixes
		int outlen = sb.length();
		if (outlen == 1)
			isbinint = ishexint = ishexfloat = false;
		
		// Determine the best type for the token
		TokenType type;
		if (isbinint)
			type = TokenType.LITERAL_BINARY_INTEGER;
		else if (isoctint)
			type = TokenType.LITERAL_OCTAL_INTEGER;
		else if (isdecint)
			type = TokenType.LITERAL_DECIMAL_INTEGER;
		else if (ishexint)
			type = TokenType.LITERAL_HEXADECIMAL_INTEGER;
		else if (isdecfloat)
			type = TokenType.LITERAL_DECIMAL_FLOAT;
		else if (ishexfloat)
			type = TokenType.LITERAL_HEXADECIMAL_FLOAT;
		
		// {@squirreljme.error AQ35 Could not determine type of number
		// literal is used for the given string. (The token string)}
		else
			throw new TokenizerException(this, 
				String.format("AQ35 %s", sb.toString()));
		
		// Use that!
		return __token(type, sb.toString());
	}
	
	/**
	 * Reads a single line comment.
	 *
	 * @return The decoded token.
	 * @throws TokenizerException If the token is not valid.
	 * @since 2017/09/09
	 */
	private Token __getSingleLineComment()
		throws TokenizerException
	{
		StringBuilder sb = new StringBuilder();
		for (;;)
		{
			// Stop if it is consider the end of line
			int c = __peekChar();
			if (c < 0 || CharacterTest.isNewline(c))
				return __token(TokenType.COMMENT, sb);
			
			// Otherwise consume it
			sb.append((char)__nextChar());
		}
	}
	
	/**
	 * Decodes a string.
	 *
	 * @return The resulting string.
	 * @throws TokenizerException If the token is not valid.
	 * @since 2018/03/06
	 */
	private Token __getString()
		throws TokenizerException
	{
		StringBuilder sb = new StringBuilder("\"");
		boolean escaped = false;
		for (;;)
		{
			int c = __nextChar();
			if (c == '\\')
				escaped = true;
			else if (!escaped && c == '\"')
			{
				sb.append((char)c);
				return __token(TokenType.LITERAL_STRING, sb);
			}
			
			// Consume it
			sb.append((char)c);
		}
	}
	
	/**
	 * Returns the next character.
	 *
	 * @return The next character.
	 * @throws TokenizerException If the next token could not be read.
	 * @since 2017/09/09
	 */
	private int __nextChar()
		throws TokenizerException
	{
		// Peek character so it is in the buffer
		__peekChar();
		
		// Position needed for finding errors
		this._curline = this._nxline;
		this._curcolumn = this._nxcolumn;
		
		// Use the next character
		int rv = this._nxchar;
		this._nxwaiting = false;
		this._nxchar = -1;
		return rv;
	}
	
	/**
	 * Peeks the next character.
	 *
	 * @return The next character.
	 * @throws TokenizerException If the next character could not be peeked.
	 * @since 2017/09/09
	 */
	private int __peekChar()
		throws TokenizerException
	{
		try
		{
			// Use the pre-existing character
			if (this._nxwaiting)
				return this._nxchar;
			
			// Read in next character
			LogicalReader in = this.in;
			int c = in.read(),
				ln = in.line(),
				cl = in.column();
			
			// Set details
			this._nxchar = c;
			this._nxline = ln;
			this._nxcolumn = cl;
			this._nxwaiting = true;
			
			// Need to know the actual character
			return c;
		}
		
		// {@squirreljme.error AQ36 Could not read the next character.}
		catch (IOException e)
		{
			throw new TokenizerException(this, "AQ36", e);
		}
	}
	
	/**
	 * Creates a token and returns it.
	 *
	 * @param __t The type of token to create.
	 * @param __s The string making up the token characters.
	 * @return The created token.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/09/09
	 */
	private Token __token(TokenType __t, CharSequence __s)
		throws NullPointerException
	{
		// Check
		if (__t == null || __s == null)
			throw new NullPointerException("NARG");
		
		return new Token(__t, __s.toString(), this.in.fileName(), this._atline,
			this._atcolumn);
	}
	
	/**
	 * Parses the specified sequence as an operator.
	 *
	 * @param __s The sequence to decode.
	 * @return The token for the operator.
	 * @throws NullPointerException On null arguments.
	 * @throws TokenizerException If the sequence is not valid.
	 * @since 2018/03/06
	 */
	private Token __tokenOperator(CharSequence __s)
		throws NullPointerException, TokenizerException
	{
		if (__s == null)
			throw new NullPointerException("NARG");
		
		// Depends on the sequence
		String s = __s.toString();
		TokenType type;
		switch (s)
		{
			case "^":	type = TokenType.OPERATOR_XOR; break;
			case "^=":	type = TokenType.OPERATOR_XOR_ASSIGN; break;
			case "~":	type = TokenType.OPERATOR_COMPLEMENT; break;
			case "<":	type = TokenType.COMPARE_LESS_THAN; break;
			case "<<":	type = TokenType.OPERATOR_SHIFT_LEFT; break;
			case "<<=":	type = TokenType.OPERATOR_SHIFT_LEFT_ASSIGN; break;
			case "<=":	type = TokenType.COMPARE_LESS_OR_EQUAL; break;
			case "=":	type = TokenType.OPERATOR_ASSIGN; break;
			case "==":	type = TokenType.COMPARE_EQUALS; break;
			case ">":	type = TokenType.COMPARE_GREATER_THAN; break;
			case ">=":	type = TokenType.COMPARE_GREATER_OR_EQUAL; break;
			case ">>":	type = TokenType.OPERATOR_SSHIFT_RIGHT; break;
			case ">>=":	type = TokenType.OPERATOR_SSHIFT_RIGHT_ASSIGN; break;
			case ">>>":	type = TokenType.OPERATOR_USHIFT_RIGHT; break;
			case ">>>=":type = TokenType.OPERATOR_USHIFT_RIGHT_ASSIGN; break;
			case "|":	type = TokenType.OPERATOR_OR; break;
			case "|=":	type = TokenType.OPERATOR_OR_ASSIGN; break;
			case "||":	type = TokenType.COMPARE_OR; break;
			case "-":	type = TokenType.OPERATOR_MINUS; break;
			case "->":	type = TokenType.SYMBOL_LAMBDA; break;
			case "-=":	type = TokenType.OPERATOR_MINUS_ASSIGN; break;
			case "--":	type = TokenType.OPERATOR_DECREMENT; break;
			case ",":	type = TokenType.SYMBOL_COMMA; break;
			case ";":	type = TokenType.SYMBOL_SEMICOLON; break;
			case ":":	type = TokenType.SYMBOL_COLON; break;
			case "::":	type = TokenType.SYMBOL_DOUBLE_COLON; break;
			case "!":	type = TokenType.OPERATOR_NOT; break;
			case "!=":	type = TokenType.COMPARE_NOT_EQUALS; break;
			case "?":	type = TokenType.SYMBOL_QUESTION; break;
			case "/":	type = TokenType.OPERATOR_DIVIDE; break;
			case "/=":	type = TokenType.OPERATOR_DIVIDE_ASSIGN; break;
			case ".":	type = TokenType.SYMBOL_DOT; break;
			case "(":	type = TokenType.SYMBOL_OPEN_PARENTHESIS; break;
			case ")":	type = TokenType.SYMBOL_CLOSED_PARENTHESIS; break;
			case "[":	type = TokenType.SYMBOL_OPEN_BRACKET; break;
			case "]":	type = TokenType.SYMBOL_CLOSED_BRACKET; break;
			case "{":	type = TokenType.SYMBOL_OPEN_BRACE; break;
			case "}":	type = TokenType.SYMBOL_CLOSED_BRACE; break;
			case "*":	type = TokenType.OPERATOR_MULTIPLY; break;
			case "*=":	type = TokenType.OPERATOR_MULTIPLY_ASSIGN; break;
			case "&":	type = TokenType.OPERATOR_AND; break;
			case "&=":	type = TokenType.OPERATOR_AND_ASSIGN; break;
			case "&&":	type = TokenType.COMPARE_AND; break;
			case "%":	type = TokenType.OPERATOR_REMAINDER; break;
			case "%=":	type = TokenType.OPERATOR_REMAINDER_ASSIGN; break;
			case "+":	type = TokenType.OPERATOR_PLUS; break;
			case "+=":	type = TokenType.OPERATOR_PLUS_ASSIGN; break;
			case "++":	type = TokenType.OPERATOR_INCREMENT; break;
			case "@":	type = TokenType.SYMBOL_AT; break;
			
				// {@squirreljme.error AQ37 Could not determine the used
				// operator for the given sequence. (The sequence)}
			default:
				throw new TokenizerException(this, 
					String.format("AQ37 %s", s));
		}
		
		// Generate
		return this.__token(type, s);
	}

	/**
	 * Wraps the input stream for reading UTF-8.
	 *
	 * @param __is The read to read from.
	 * @return The wrapped reader.
	 * @throws RuntimeException If UTF-8 is not supported but this should
	 * never happen.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/09/04
	 */
	private static Reader __wrap(InputStream __is)
		throws RuntimeException, NullPointerException
	{
		// Check
		if (__is == null)
			throw new NullPointerException("NARG");

		// Could fail, but it never should
		try
		{
			return new InputStreamReader(__is, "utf-8");
		}

		// Should never happen
		catch (UnsupportedEncodingException e)
		{
			throw new todo.OOPS(e);
		}
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/token/TokenizerException.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.javac.token;

import net.multiphasicapps.javac.CompilerException;
import net.multiphasicapps.javac.LocationAware;

/**
 * This is thrown when there is an issue with the tokenizer.
 *
 * @since 2017/09/05
 */
public class TokenizerException
	extends CompilerException
{
	/**
	 * Initialize the exception with no message or cause.
	 *
	 * @since 2018/03/12
	 */
	public TokenizerException()
	{
	}
	
	/**
	 * Initialize the exception with a message and no cause.
	 *
	 * @param __m The message.
	 * @since 2018/03/12
	 */
	public TokenizerException(String __m)
	{
		super(__m);
	}
	
	/**
	 * Initialize the exception with a message and cause.
	 *
	 * @param __m The message.
	 * @param __c The cause.
	 * @since 2018/03/12
	 */
	public TokenizerException(String __m, Throwable __c)
	{
		super(__m, __c);
	}
	
	/**
	 * Initialize the exception with no message and with a cause.
	 *
	 * @param __c The cause.
	 * @since 2018/03/12
	 */
	public TokenizerException(Throwable __c)
	{
		super(__c);
	}
	
	/**
	 * Initialize the exception with no message or cause.
	 *
	 * @param __la Location awareness information.
	 * @since 2018/03/12
	 */
	public TokenizerException(LocationAware __la)
	{
		super(__la);
	}
	
	/**
	 * Initialize the exception with a message and no cause.
	 *
	 * @param __la Location awareness information.
	 * @param __m The message.
	 * @since 2018/03/12
	 */
	public TokenizerException(LocationAware __la, String __m)
	{
		super(__la, __m);
	}
	
	/**
	 * Initialize the exception with a message and cause.
	 *
	 * @param __la Location awareness information.
	 * @param __m The message.
	 * @param __c The cause.
	 * @since 2018/03/12
	 */
	public TokenizerException(LocationAware __la, String __m, Throwable __c)
	{
		super(__la, __m, __c);
	}
	
	/**
	 * Initialize the exception with no message and with a cause.
	 *
	 * @param __la Location awareness information.
	 * @param __c The cause.
	 * @since 2018/03/12
	 */
	public TokenizerException(LocationAware __la, Throwable __c)
	{
		super(__la, __c);
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






































































































































































































































Deleted runt/libs/tool-compiler/net/multiphasicapps/javac/token/package-info.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

/**
 * This package contains the tokenizers for Java source code which is needed
 * by the documenter and compiler to parse Java source code.
 *
 * @since 2017/09/04
 */

package net.multiphasicapps.javac.token;

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






































Deleted runt/libs/tool-jarfile/META-INF/MANIFEST.MF.

1
2
3
4
5
6
7
8
9
10
11
12
Manifest-Version: 1.0
X-SquirrelJME-UUID: 7734bfb5-c8e0-678e-2be9-dd49a60664fd
X-SquirrelJME-Error: BC
X-SquirrelJME-Name: Jar File Tools
X-SquirrelJME-Vendor: Stephanie Gawroriski
X-SquirrelJME-Version: 0.3.0
X-SquirrelJME-Description: This project takes input Jar files and 
 compiles/converts them into a format that is more easily used by 
 SummerCoat and RatufaCoat.
X-SquirrelJME-Depends: tool-classfile common-vm
Microedition-Configuration: CLDC-1.8-Compact

<
<
<
<
<
<
<
<
<
<
<
<
























Deleted runt/libs/tool-jdwp/META-INF/MANIFEST.MF.

1
2
3
4
5
6
7
8
9
10
11
12
Manifest-Version: 1.0
X-SquirrelJME-UUID: 837556ab-1eda-9b6a-56d1-5386e3c80cd2
X-SquirrelJME-Error: BH
X-SquirrelJME-Name: Java Debug Wire Protocol
X-SquirrelJME-Vendor: Stephanie Gawroriski
X-SquirrelJME-Version: 0.3.0
X-SquirrelJME-Description: This contains the implementation of the JDWP 
 which enables JDWP-complaint debuggers to connect with SquirrelJME to 
 enable its debugging.
X-SquirrelJME-Depends: gcf
Microedition-Configuration: CLDC-1.8-Compact

<
<
<
<
<
<
<
<
<
<
<
<
























Deleted runt/libs/tool-manifest-reader/META-INF/MANIFEST.MF.

1
2
3
4
5
6
7
8
9
10
Manifest-Version: 1.0
X-SquirrelJME-Name: Manifest File Decoder
X-SquirrelJME-Vendor: Stephanie Gawroriski
X-SquirrelJME-Version: 0.3.0
X-SquirrelJME-Description: This provides a decoder for standardJava 
 manifest files.
X-SquirrelJME-Error: BB
X-SquirrelJME-UUID: fb9af740-e959-43c5-b405-fb001edd09c5
X-SquirrelJME-Depends: collections
Microedition-Configuration: CLDC-1.8-Compact
<
<
<
<
<
<
<
<
<
<




















Deleted runt/libs/tool-manifest-writer/META-INF/MANIFEST.MF.

1
2
3
4
5
6
7
8
9
10
11
Manifest-Version: 1.0
X-SquirrelJME-UUID: 890370ee-0c73-4552-a49e-b38c6c2c9bd1
X-SquirrelJME-Error: AB
X-SquirrelJME-Name: Mutable Java Manifest
X-SquirrelJME-Vendor: Stephanie Gawroriski
X-SquirrelJME-Version: 0.3.0
X-SquirrelJME-Depends: tool-manifest-reader
X-SquirrelJME-Description: This project allows for creating standard 
 Java manifest files using a mutable class.
Microedition-Configuration: CLDC-1.8-Compact

<
<
<
<
<
<
<
<
<
<
<






















Deleted runt/libs/tool-packfile/META-INF/MANIFEST.MF.

1
2
3
4
5
6
7
8
9
10
11
Manifest-Version: 1.0
X-SquirrelJME-UUID: 7bb22625-48a1-4abc-8764-96c48b829bc1
X-SquirrelJME-Error: BI
X-SquirrelJME-Name: Compiled JAR Packfile Support
X-SquirrelJME-Vendor: Stephanie Gawroriski
X-SquirrelJME-Version: 0.3.0
X-SquirrelJME-Depends: tool-jarfile
X-SquirrelJME-Description: This project is used to build the packed ROM 
 files needed by SummerCoat and RatufaCoat to function.
Microedition-Configuration: CLDC-1.8-Compact

<
<
<
<
<
<
<
<
<
<
<






















Deleted runt/libs/tool-profiler/META-INF/MANIFEST.MF.

1
2
3
4
5
6
7
8
9
10
Manifest-Version: 1.0
X-SquirrelJME-UUID: f3ffd3f9-32b0-4fe2-8b06-d5d2211ab55a
X-SquirrelJME-Error: AH
X-SquirrelJME-Name: tool-profiler
X-SquirrelJME-Vendor: Stephanie Gawroriski
X-SquirrelJME-Version: 0.3.0
X-SquirrelJME-Description: tool-profiler
X-SquirrelJME-Depends: io
Microedition-Configuration: CLDC-1.8-Compact

<
<
<
<
<
<
<
<
<
<




















Deleted runt/libs/zip/META-INF/MANIFEST.MF.

1
2
3
4
5
6
7
8
9
10
11
Manifest-Version: 1.0
X-SquirrelJME-Type: liblet
X-SquirrelJME-Name: ZIP Support
X-SquirrelJME-Vendor: Stephanie Gawroriski
X-SquirrelJME-Version: 0.3.0
X-SquirrelJME-Description: The library contains the support for ZIP 
 files and any data interfaces needed for ZIP files.
X-SquirrelJME-Depends: io
X-SquirrelJME-Error: BF
X-SquirrelJME-UUID: 34332adb-2c68-4805-8adf-873e3ed6e136
Microedition-Configuration: CLDC-1.8
<
<
<
<
<
<
<
<
<
<
<






















Deleted runt/mids/NAMESPACE.MF.

1
2
3
4
5
6
Manifest-Version: 1.0
X-SquirrelJME-Namespace-Title: Run-time MIDlets
X-SquirrelJME-Namespace-Type: midlet
X-SquirrelJME-Namespace-Description: This contains programs which may be 
 run by the user and are potentially by default provided by SquirrelJME.

<
<
<
<
<
<












Deleted runt/mids/demo-hello/META-INF/MANIFEST.MF.

1
2
3
4
5
6
7
8
9
10
11
Manifest-Version: 1.0
X-SquirrelJME-UUID: 076215a5-723a-482e-89e9-08c60ef7f1cb
X-SquirrelJME-Error: BT
X-SquirrelJME-Name: Hello (Demo)
X-SquirrelJME-Vendor: Stephanie Gawroriski
X-SquirrelJME-Version: 0.3.0
X-SquirrelJME-Description: This is a basic demo which prints a hello 
 message and prints some details about the virtual machine.
Microedition-Configuration: CLDC-1.8-Compact
Main-Class: net.multiphasicapps.demo.hello.Hello

<
<
<
<
<
<
<
<
<
<
<






















Deleted runt/mids/lcdui-demo/META-INF/MANIFEST.MF.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
Manifest-Version: 1.0
X-SquirrelJME-UUID: 63e1de74-9cde-45e4-878c-ce335f0288db
X-SquirrelJME-Error: AW
X-SquirrelJME-Name: LCDUI Graphics Demo
X-SquirrelJME-Vendor: Stephanie Gawroriski
X-SquirrelJME-Version: 0.3.0
X-SquirrelJME-Description: This is a demo which is used to demonstrate 
 how the graphic operations operate.
X-SquirrelJME-Depends: midp-lcdui
Microedition-Configuration: CLDC-1.8-Compact
MIDlet-1: Font Demo, fonts.xpm, net.multiphasicapps.lcduidemo.Fonts
MIDlet-2: Mystify Your Squirrels!, mystify.xpm, 
 net.multiphasicapps.lcduidemo.Mystify
MIDlet-3: Events Demo, event.xpm, 
 net.multiphasicapps.lcduidemo.Events
MIDlet-4: List Demo, list.xpm, 
 net.multiphasicapps.lcduidemo.Lists
MIDlet-5: Image Demo (XPM), image.xpm, 
 net.multiphasicapps.lcduidemo.XPMDemo
MIDlet-6: Image Demo (PNG), image.xpm, 
 net.multiphasicapps.lcduidemo.PNGDemo
MIDlet-7: Image Demo (JPEG), image.xpm, 
 net.multiphasicapps.lcduidemo.JPEGDemo

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
















































Deleted runt/mids/squirrel-quarrel/META-INF/MANIFEST.MF.

1
2
3
4
5
6
7
8
9
10
11
12
13
Manifest-Version: 1.0
X-SquirrelJME-UUID: 00111ef0-e4a8-45e3-a3c7-5a953d183f8f
X-SquirrelJME-Error: BE
X-SquirrelJME-Name: Squirrel Quarrel
X-SquirrelJME-Vendor: Stephanie Gawroriski
X-SquirrelJME-Version: 0.3.0
X-SquirrelJME-Description: A turn based strategy involving squirrels and 
 lots of acorns! Keep on your claws and horde them all!
X-SquirrelJME-Depends: tool-manifest-reader midp-lcdui
Microedition-Configuration: CLDC-1.8-Compact
MIDlet-1: Squirrel Quarrel, icon.xpm, 
 dev.shadowtail.squirrelquarrel.MainMidlet

<
<
<
<
<
<
<
<
<
<
<
<
<


























Deleted runt/runtime.mkd.

1
2
3
4
5
6
7
8
9
10
11
12
# Run-time Projects

This contains all of the projects which are intended to be ran at run-time or
within the run-time environment.

 * `apis/` -- Standard APIs and JSRs.
 * `klib/` -- Libraries which are to be considered part of the system.
 * `kmid/` -- MIDlets which are considered to be part of the system.
 * `libs/` -- Libraries intended to be used by users.
 * `mids/` -- MIDlets intended to be used by users.
 * `test/` -- Test framework.

<
<
<
<
<
<
<
<
<
<
<
<
























Added settings.gradle.





































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// Modules and available platforms
include "modules"
include "emulators"
include "tools"

// Recursively include all modules
file(rootProject.projectDir.toPath().resolve("modules"))
	.eachDir(
	{ subdir ->
		if (subdir.toPath().resolve("build.gradle").toFile().exists())
		{
			include "modules:" + subdir.name
		}
	})

// Recursively include all emulators
file(rootProject.projectDir.toPath().resolve("emulators"))
	.eachDir(
	{ subdir ->
		if (subdir.toPath().resolve("build.gradle").toFile().exists())
		{
			include "emulators:" + subdir.name
		}
	})

// Recursively include all tools
file(rootProject.projectDir.toPath().resolve("tools"))
	.eachDir(
	{ subdir ->
		if (subdir.toPath().resolve("build.gradle").toFile().exists())
		{
			include "tools:" + subdir.name
		}
	})

Deleted test/TIMESPACE.MF.

1
2
3
4
5
6
Manifest-Version: 1.0
X-SquirrelJME-Timespace-Title: Tests
X-SquirrelJME-Timespace-Type: test
X-SquirrelJME-Timespace-Description: The timespace contains all of the
 tests.

<
<
<
<
<
<












Deleted test/libs/NAMESPACE.MF.

1
2
3
4
5
Manifest-Version: 1.0
X-SquirrelJME-Namespace-Title: Test Libraries
X-SquirrelJME-Namespace-Type: liblet
X-SquirrelJME-Namespace-Description: This contains test libraries.

<
<
<
<
<










Deleted test/libs/tac.test/META-INF/TEST.MF.

1
2
Manifest-Version: 1.0

<
<




Deleted test/libs/tac/META-INF/MANIFEST.MF.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
Manifest-Version: 1.0
X-SquirrelJME-UUID: 648f4184-68ee-4cfd-ae8c-99e438246e97
X-SquirrelJME-Error: BU
X-SquirrelJME-Name: Testing, Acceptance, and Comparison
X-SquirrelJME-Vendor: Stephanie Gawroriski
X-SquirrelJME-Version: 0.3.0
X-SquirrelJME-Description: This project contains the testing, acceptance, 
 and comparison framework which is used to test and compare differring 
 executions of the virtual machine.
Microedition-Configuration: CLDC-1.8-Compact
Microedition-Profile: MEEP-8
X-SquirrelJME-Depends: meep-midlet tool-manifest-reader 
 tool-manifest-writer collections

<
<
<
<
<
<
<
<
<
<
<
<
<
<




























Deleted test/mids/NAMESPACE.MF.

1
2
3
4
5
6
Manifest-Version: 1.0
X-SquirrelJME-Namespace-Title: Test MIDlets
X-SquirrelJME-Namespace-Type: midlet
X-SquirrelJME-Namespace-Description: Programs that can be run to do the 
 actual test stuff.

<
<
<
<
<
<












Deleted test/mids/dump-class/META-INF/MANIFEST.MF.

1
2
3
4
5
6
7
8
9
10
11
12
Manifest-Version: 1.0
X-SquirrelJME-UUID: 54f1baae-2912-41a3-a065-6ed0f881cdf2
X-SquirrelJME-Error: AY
X-SquirrelJME-Name: Class Dumper
X-SquirrelJME-Vendor: Stephanie Gawroriski
X-SquirrelJME-Version: 0.3.0
X-SquirrelJME-Description: This dumps information about a class file similar to 
 the javap tool.
X-SquirrelJME-Depends: tool-classfile zip
Microedition-Configuration: CLDC-1.8-Compact
Main-Class: net.multiphasicapps.dumpclass.Main

<
<
<
<
<
<
<
<
<
<
<
<
























Deleted test/mids/dump-zip/META-INF/MANIFEST.MF.

1
2
3
4
5
6
7
8
9
10
11
Manifest-Version: 1.0
X-SquirrelJME-UUID: 4b20ba4f-4ec6-4b1f-b5c2-738b8b19da60
X-SquirrelJME-Error: AX
X-SquirrelJME-Name: ZIP File Dumper
X-SquirrelJME-Vendor: Stephanie Gawroriski
X-SquirrelJME-Version: 0.3.0
X-SquirrelJME-Description: This dumps ZIP files.
X-SquirrelJME-Depends: zip io
Microedition-Configuration: CLDC-1.8
Main-Class: net.multiphasicapps.dumpzip.Main

<
<
<
<
<
<
<
<
<
<
<






















Deleted test/mids/javap/META-INF/MANIFEST.MF.

1
2
3
4
5
6
7
8
9
10
11
12
13
Manifest-Version: 1.0
X-SquirrelJME-UUID: ca0e8a3e-f97d-aeca-1f61-070d76624d0e
X-SquirrelJME-Error: AV
X-SquirrelJME-Name: Java Class and SquirrelJME Class Dumper
X-SquirrelJME-Vendor: Stephanie Gawroriski
X-SquirrelJME-Version: 0.3.0
X-SquirrelJME-Description: This utility is used to dump class files 
 and SquirrelJME Minimized classes. This is intended for debugging 
 purposes to inspect various classes and how they look.
X-SquirrelJME-Depends: tool-classfile io
Main-Class: dev.shadowtail.javap.Main
Microedition-Configuration: CLDC-1.8-Compact

<
<
<
<
<
<
<
<
<
<
<
<
<


























Deleted test/mids/javap/dev/shadowtail/javap/Main.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package dev.shadowtail.javap;

/**
 * Main entry class.
 *
 * @since 2019/04/14
 */
public class Main
{
	/**
	 * Main entry point.
	 *
	 * @param __args Arguments.
	 * @since 2019/04/14
	 */
	public static final void main(String... __args)
	{
		throw new todo.TODO();
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




























































Deleted test/mids/javap/dev/shadowtail/javap/package-info.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

/**
 * This package contains the javap utility.
 *
 * @since 2019/04/14
 */

package dev.shadowtail.javap;

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


































Deleted test/mids/tac-runner/META-INF/MANIFEST.MF.

1
2
3
4
5
6
7
8
9
10
11
12
13
Manifest-Version: 1.0
X-SquirrelJME-UUID: daf7dd87-8de8-4918-b4b0-c36c42e55688
X-SquirrelJME-Error: AI
X-SquirrelJME-Name: TAC Runner
X-SquirrelJME-Vendor: Stephanie Gawroriski
X-SquirrelJME-Version: 0.3.0
X-SquirrelJME-Description: This is a system which interacts with 
 SquirrelJME and is able to launch and execute various tests within 
 the environment automatically.
X-SquirrelJME-Depends: meep-swm
Microedition-Configuration: CLDC-1.8-Compact
Main-Class: net.multiphasicapps.tac.runner.Main

<
<
<
<
<
<
<
<
<
<
<
<
<


























Deleted test/mids/uudecode/META-INF/MANIFEST.MF.

1
2
3
4
5
6
7
8
9
10
11
12
Manifest-Version: 1.0
X-SquirrelJME-UUID: 24c42d7e-8681-4e75-a5fc-0cc7b5117d05
X-SquirrelJME-Error: AZ
X-SquirrelJME-Name: MIME File Decoder
X-SquirrelJME-Vendor: Stephanie Gawroriski
X-SquirrelJME-Version: 0.3.0
X-SquirrelJME-Description: This decodes MIME encoded files (or base64 
 data) and outputs to standard output.
X-SquirrelJME-Depends: io
Microedition-Configuration: CLDC-1.8
Main-Class: net.multiphasicapps.uudecode.Main

<
<
<
<
<
<
<
<
<
<
<
<
























Added tools/build.gradle.

Added tools/dump-class/build.gradle.

































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
plugins
{
	id "java"
	id "application"
}

description = "This dumps information about a class file similar to " +
	"the javap tool."
mainClassName = "net.multiphasicapps.dumpclass.Main"

dependencies
{
	implementation project(":modules:tool-classfile")
	implementation project(":modules:zip")
	implementation project(":modules:io")
}

Name change from test/mids/dump-class/net/multiphasicapps/dumpclass/Main.java to tools/dump-class/src/main/java/net/multiphasicapps/dumpclass/Main.java.

8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.dumpclass;

import dev.shadowtail.classfile.nncc.NativeCode;
import dev.shadowtail.classfile.nncc.NativeInstruction;
import java.io.InputStream;
import java.io.IOException;
import java.io.PrintStream;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.nio.file.StandardOpenOption;
import java.util.Map;
import net.multiphasicapps.classfile.Annotation;
import net.multiphasicapps.classfile.AnnotationTable;







|
|







8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.dumpclass;

import dev.shadowtail.classfile.nncc.NativeCode;
import dev.shadowtail.classfile.nncc.NativeInstruction;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintStream;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.nio.file.StandardOpenOption;
import java.util.Map;
import net.multiphasicapps.classfile.Annotation;
import net.multiphasicapps.classfile.AnnotationTable;

Name change from test/mids/dump-class/net/multiphasicapps/dumpclass/package-info.java to tools/dump-class/src/main/java/net/multiphasicapps/dumpclass/package-info.java.

Added tools/dump-zip/build.gradle.





























>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
plugins
{
	id "java"
	id "application"
}

description = "This dumps ZIP files."
mainClassName = "net.multiphasicapps.dumpzip.Main"

dependencies
{
	implementation project(":modules:io")
	implementation project(":modules:zip")
}

Name change from test/mids/dump-zip/net/multiphasicapps/dumpzip/FileChannelBlockAccessor.java to tools/dump-zip/src/main/java/net/multiphasicapps/dumpzip/FileChannelBlockAccessor.java.

67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
	{
		// {@squirreljme.error AX01 Cannot read from a negative offset.}
		if (__addr < 0)
			throw new IOException("AX01");
		
		// Just forward to the array variant
		byte[] val = new byte[1];
		int rv = read(__addr, val, 0, 1);
		
		// {@squirreljme.error AX02 Read past end of file.}
		if (rv < 0)
			throw new EOFException("AX02");
		
		return val[0];
	}







|







67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
	{
		// {@squirreljme.error AX01 Cannot read from a negative offset.}
		if (__addr < 0)
			throw new IOException("AX01");
		
		// Just forward to the array variant
		byte[] val = new byte[1];
		int rv = this.read(__addr, val, 0, 1);
		
		// {@squirreljme.error AX02 Read past end of file.}
		if (rv < 0)
			throw new EOFException("AX02");
		
		return val[0];
	}

Name change from test/mids/dump-zip/net/multiphasicapps/dumpzip/Main.java to tools/dump-zip/src/main/java/net/multiphasicapps/dumpzip/Main.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.dumpzip;

import java.io.InputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.nio.channels.Channels;
import java.nio.channels.FileChannel;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardOpenOption;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Deque;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import net.multiphasicapps.io.HexDumpOutputStream;
import net.multiphasicapps.zip.blockreader.ZipBlockEntry;
import net.multiphasicapps.zip.blockreader.ZipBlockReader;
import net.multiphasicapps.zip.streamreader.ZipStreamEntry;












|
|






<

<







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

21

22
23
24
25
26
27
28
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.dumpzip;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.nio.channels.Channels;
import java.nio.channels.FileChannel;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardOpenOption;

import java.util.ArrayList;

import java.util.HashSet;
import java.util.List;
import java.util.Set;
import net.multiphasicapps.io.HexDumpOutputStream;
import net.multiphasicapps.zip.blockreader.ZipBlockEntry;
import net.multiphasicapps.zip.blockreader.ZipBlockReader;
import net.multiphasicapps.zip.streamreader.ZipStreamEntry;
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
					for (;;)
						try (ZipStreamEntry e = zsr.nextEntry())
						{
							// No more entries
							if (e == null)
								break;
							
							__dump(filter, (lastentry = e.name()), e);
						}
				}
			
			// As a block
			else
				try (ZipBlockReader zsr = new ZipBlockReader(
					new FileChannelBlockAccessor(fc)))
				{
					// Go through all entries
					for (ZipBlockEntry entry : zsr)
						try (InputStream in = entry.open())
						{
							__dump(filter, (lastentry = entry.name()), in);
						}
				}
		}
	
		// {@squirreljme.error AX04 Failed to properly read the specified
		// file. (The file name; The last entry read)}
		catch (IOException e)







|












|







84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
					for (;;)
						try (ZipStreamEntry e = zsr.nextEntry())
						{
							// No more entries
							if (e == null)
								break;
							
							Main.__dump(filter, (lastentry = e.name()), e);
						}
				}
			
			// As a block
			else
				try (ZipBlockReader zsr = new ZipBlockReader(
					new FileChannelBlockAccessor(fc)))
				{
					// Go through all entries
					for (ZipBlockEntry entry : zsr)
						try (InputStream in = entry.open())
						{
							Main.__dump(filter, (lastentry = entry.name()), in);
						}
				}
		}
	
		// {@squirreljme.error AX04 Failed to properly read the specified
		// file. (The file name; The last entry read)}
		catch (IOException e)

Name change from test/mids/dump-zip/net/multiphasicapps/dumpzip/package-info.java to tools/dump-zip/src/main/java/net/multiphasicapps/dumpzip/package-info.java.

Added tools/pcf-to-sqf/build.gradle.





































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
plugins
{
	id "java"
	id "application"
}

description = "This converts PCF font data into SQF fonts " +
	"which are smaller, simpler, and faster to read than supporting PCF " +
	"from within SquirrelJME."
mainClassName = "net.multiphasicapps.pcftosqf.Main"

dependencies
{
	implementation project(":modules:cldc-compact")
	implementation project(":modules:midp-lcdui")
	implementation project(":modules:io")
	implementation project(":modules:collections")
}

Name change from bldt/mids/pcf-to-sqf/net/multiphasicapps/pcftosqf/GlyphNames.java to tools/pcf-to-sqf/src/main/java/net/multiphasicapps/pcftosqf/GlyphNames.java.

Name change from bldt/mids/pcf-to-sqf/net/multiphasicapps/pcftosqf/Main.java to tools/pcf-to-sqf/src/main/java/net/multiphasicapps/pcftosqf/Main.java.

10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27

package net.multiphasicapps.pcftosqf;

import cc.squirreljme.runtime.lcdui.font.SQFFont;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.nio.file.StandardOpenOption;
import net.multiphasicapps.pcftosqf.pcf.PCFFont;

/**
 * This is the main entry point for the font conversion.
 *
 * @since 2018/11/27
 */







<


<







10
11
12
13
14
15
16

17
18

19
20
21
22
23
24
25

package net.multiphasicapps.pcftosqf;

import cc.squirreljme.runtime.lcdui.font.SQFFont;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;

import java.nio.file.Files;
import java.nio.file.Paths;

import net.multiphasicapps.pcftosqf.pcf.PCFFont;

/**
 * This is the main entry point for the font conversion.
 *
 * @since 2018/11/27
 */

Name change from bldt/mids/pcf-to-sqf/net/multiphasicapps/pcftosqf/SQFConverter.java to tools/pcf-to-sqf/src/main/java/net/multiphasicapps/pcftosqf/SQFConverter.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.pcftosqf;

import java.io.OutputStream;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import net.multiphasicapps.pcftosqf.pcf.PCFFont;
import net.multiphasicapps.pcftosqf.pcf.PCFGlyphMap;
import net.multiphasicapps.pcftosqf.pcf.PCFMetric;

/**












|
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.pcftosqf;

import java.io.IOException;
import java.io.OutputStream;
import java.util.HashMap;
import java.util.Map;
import net.multiphasicapps.pcftosqf.pcf.PCFFont;
import net.multiphasicapps.pcftosqf.pcf.PCFGlyphMap;
import net.multiphasicapps.pcftosqf.pcf.PCFMetric;

/**

Name change from bldt/mids/pcf-to-sqf/net/multiphasicapps/pcftosqf/package-info.java to tools/pcf-to-sqf/src/main/java/net/multiphasicapps/pcftosqf/package-info.java.

Name change from bldt/mids/pcf-to-sqf/net/multiphasicapps/pcftosqf/pcf/PCFAccelerators.java to tools/pcf-to-sqf/src/main/java/net/multiphasicapps/pcftosqf/pcf/PCFAccelerators.java.

209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
		// Read minimum and maximum bounds
		PCFMetric minbounds = PCFMetric.readUncompressed(__dis);
		PCFMetric maxbounds = PCFMetric.readUncompressed(__dis);
		
		// These are optional only if the given format is used
		PCFMetric inkminbounds = null,
			inkmaxbounds = null;
		if ((format & _PCF_ACCEL_W_INKBOUNDS) != 0)
		{
			inkminbounds = PCFMetric.readUncompressed(__dis);
			inkmaxbounds = PCFMetric.readUncompressed(__dis);
		}
		
		return new PCFAccelerators(format, nooverlap, constantmetrics,
			terminalfont, constantwidth, inkinside, inkmetrics, drawdirection,







|







209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
		// Read minimum and maximum bounds
		PCFMetric minbounds = PCFMetric.readUncompressed(__dis);
		PCFMetric maxbounds = PCFMetric.readUncompressed(__dis);
		
		// These are optional only if the given format is used
		PCFMetric inkminbounds = null,
			inkmaxbounds = null;
		if ((format & PCFAccelerators._PCF_ACCEL_W_INKBOUNDS) != 0)
		{
			inkminbounds = PCFMetric.readUncompressed(__dis);
			inkmaxbounds = PCFMetric.readUncompressed(__dis);
		}
		
		return new PCFAccelerators(format, nooverlap, constantmetrics,
			terminalfont, constantwidth, inkinside, inkmetrics, drawdirection,

Name change from bldt/mids/pcf-to-sqf/net/multiphasicapps/pcftosqf/pcf/PCFBitmap.java to tools/pcf-to-sqf/src/main/java/net/multiphasicapps/pcftosqf/pcf/PCFBitmap.java.

10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29

package net.multiphasicapps.pcftosqf.pcf;

import java.io.DataInputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import net.multiphasicapps.collections.SortedTreeSet;
import net.multiphasicapps.collections.UnmodifiableMap;

/**
 * This represents the bitmap from within a PCF file.
 *
 * @since 2018/11/28
 */
public final class PCFBitmap







<




<







10
11
12
13
14
15
16

17
18
19
20

21
22
23
24
25
26
27

package net.multiphasicapps.pcftosqf.pcf;

import java.io.DataInputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;

import java.util.List;
import java.util.Map;
import java.util.Set;
import net.multiphasicapps.collections.SortedTreeSet;


/**
 * This represents the bitmap from within a PCF file.
 *
 * @since 2018/11/28
 */
public final class PCFBitmap
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
					return rv;
				return this.index - __o.index;
			}
		}
		
		// Go through all the offsets and determine all of the bounds
		Set<__Index__> index = new SortedTreeSet<>();
		for (int i = 0; i < numglyphs; i++)
			index.add(new __Index__(__offsets[i], i));
		
		// Need to determine the bounds for every glyph to extract the data
		// for it, so mark when an index ends and such. So go through
		// and mark where a new glyph starts.
		int datalen = __data.length;
		boolean[] boops = new boolean[datalen];







|







93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
					return rv;
				return this.index - __o.index;
			}
		}
		
		// Go through all the offsets and determine all of the bounds
		Set<__Index__> index = new SortedTreeSet<>();
		for (int i = 0; i < this.numglyphs; i++)
			index.add(new __Index__(__offsets[i], i));
		
		// Need to determine the bounds for every glyph to extract the data
		// for it, so mark when an index ends and such. So go through
		// and mark where a new glyph starts.
		int datalen = __data.length;
		boolean[] boops = new boolean[datalen];

Name change from bldt/mids/pcf-to-sqf/net/multiphasicapps/pcftosqf/pcf/PCFEncoding.java to tools/pcf-to-sqf/src/main/java/net/multiphasicapps/pcftosqf/pcf/PCFEncoding.java.

Name change from bldt/mids/pcf-to-sqf/net/multiphasicapps/pcftosqf/pcf/PCFFont.java to tools/pcf-to-sqf/src/main/java/net/multiphasicapps/pcftosqf/pcf/PCFFont.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.pcftosqf.pcf;

import java.io.ByteArrayInputStream;	
import java.io.DataInputStream;
import java.io.InputStream;
import java.io.IOException;
import java.util.Arrays;
import java.util.List;
import java.util.Set;
import net.multiphasicapps.collections.SortedTreeSet;
import net.multiphasicapps.collections.UnmodifiableList;

/**












|

|
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.pcftosqf.pcf;

import java.io.ByteArrayInputStream;
import java.io.DataInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
import java.util.List;
import java.util.Set;
import net.multiphasicapps.collections.SortedTreeSet;
import net.multiphasicapps.collections.UnmodifiableList;

/**

Name change from bldt/mids/pcf-to-sqf/net/multiphasicapps/pcftosqf/pcf/PCFGlyphMap.java to tools/pcf-to-sqf/src/main/java/net/multiphasicapps/pcftosqf/pcf/PCFGlyphMap.java.

Name change from bldt/mids/pcf-to-sqf/net/multiphasicapps/pcftosqf/pcf/PCFGlyphNames.java to tools/pcf-to-sqf/src/main/java/net/multiphasicapps/pcftosqf/pcf/PCFGlyphNames.java.

Name change from bldt/mids/pcf-to-sqf/net/multiphasicapps/pcftosqf/pcf/PCFMetric.java to tools/pcf-to-sqf/src/main/java/net/multiphasicapps/pcftosqf/pcf/PCFMetric.java.

10
11
12
13
14
15
16
17
18
19
20
21
22
23
24

package net.multiphasicapps.pcftosqf.pcf;

import java.io.DataInputStream;
import java.io.IOException;
import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import java.util.Arrays;

/**
 * This contains a single metric within a PCF file.
 *
 * @since 2018/11/27
 */
public final class PCFMetric







<







10
11
12
13
14
15
16

17
18
19
20
21
22
23

package net.multiphasicapps.pcftosqf.pcf;

import java.io.DataInputStream;
import java.io.IOException;
import java.lang.ref.Reference;
import java.lang.ref.WeakReference;


/**
 * This contains a single metric within a PCF file.
 *
 * @since 2018/11/27
 */
public final class PCFMetric
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
	{
		if (__dis == null)
			throw new NullPointerException("NARG");
		
		PCFMetric[] rv;
		
		// Are these compressed metrics
		if (((Integer.reverseBytes(__dis.readInt())) &
			_PCF_COMPRESSED_METRICS) != 0)
		{
			// Read length
			int n = __dis.readUnsignedShort();
			rv = new PCFMetric[n];
			
			// Read all metrics			
			for (int i = 0; i < n; i++)







|
<







130
131
132
133
134
135
136
137

138
139
140
141
142
143
144
	{
		if (__dis == null)
			throw new NullPointerException("NARG");
		
		PCFMetric[] rv;
		
		// Are these compressed metrics
		if (((Integer.reverseBytes(__dis.readInt())) & PCFMetric._PCF_COMPRESSED_METRICS) != 0)

		{
			// Read length
			int n = __dis.readUnsignedShort();
			rv = new PCFMetric[n];
			
			// Read all metrics			
			for (int i = 0; i < n; i++)

Name change from bldt/mids/pcf-to-sqf/net/multiphasicapps/pcftosqf/pcf/PCFProperties.java to tools/pcf-to-sqf/src/main/java/net/multiphasicapps/pcftosqf/pcf/PCFProperties.java.

Name change from bldt/mids/pcf-to-sqf/net/multiphasicapps/pcftosqf/pcf/PCFScalableWidths.java to tools/pcf-to-sqf/src/main/java/net/multiphasicapps/pcftosqf/pcf/PCFScalableWidths.java.

Name change from bldt/mids/pcf-to-sqf/net/multiphasicapps/pcftosqf/pcf/PCFTableEntry.java to tools/pcf-to-sqf/src/main/java/net/multiphasicapps/pcftosqf/pcf/PCFTableEntry.java.

Name change from bldt/mids/pcf-to-sqf/net/multiphasicapps/pcftosqf/pcf/package-info.java to tools/pcf-to-sqf/src/main/java/net/multiphasicapps/pcftosqf/pcf/package-info.java.

Added tools/sqf-to-c/build.gradle.





























>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
plugins
{
	id "java"
	id "application"
}

description = "Converts a SQF to a C file, so that RatufaCoat " +
	"can use it to draw a basic console screen and such."
mainClassName = "dev.shadowtail.sqftoc.Main"

dependencies
{
	implementation project(":modules:midp-lcdui")
}

Name change from bldt/mids/sqf-to-c/dev/shadowtail/sqftoc/Main.java to tools/sqf-to-c/src/main/java/dev/shadowtail/sqftoc/Main.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package dev.shadowtail.sqftoc;

import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
import java.io.PrintStream;
import cc.squirreljme.runtime.lcdui.font.SQFFont;

/**
 * Converts SQF to C file.
 *
 * @since 2019/06/20
 */
public class Main











|


<







1
2
3
4
5
6
7
8
9
10
11
12
13
14

15
16
17
18
19
20
21
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package dev.shadowtail.sqftoc;

import cc.squirreljme.runtime.lcdui.font.SQFFont;
import java.io.DataInputStream;
import java.io.PrintStream;


/**
 * Converts SQF to C file.
 *
 * @since 2019/06/20
 */
public class Main
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
			sb.append(__b[i]);
			
			// Add comma if this is not the last byte
			if (i < n - 1)
				sb.append(", ");
			
			// Dump if column limit was reached
			if (sb.length() >= COLUMNS)
			{
				// If it ends with a space, remove it (is annoying to have)
				if (sb.charAt(sb.length() - 1) == ' ')
					sb.setLength(sb.length() - 1);
				
				// Print out
				__ps.printf("\t%s%n", sb);







|







120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
			sb.append(__b[i]);
			
			// Add comma if this is not the last byte
			if (i < n - 1)
				sb.append(", ");
			
			// Dump if column limit was reached
			if (sb.length() >= Main.COLUMNS)
			{
				// If it ends with a space, remove it (is annoying to have)
				if (sb.charAt(sb.length() - 1) == ' ')
					sb.setLength(sb.length() - 1);
				
				// Print out
				__ps.printf("\t%s%n", sb);

Name change from bldt/mids/sqf-to-c/dev/shadowtail/sqftoc/package-info.java to tools/sqf-to-c/src/main/java/dev/shadowtail/sqftoc/package-info.java.

Added tools/txt-to-pbm/build.gradle.



























>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
plugins
{
	id "java"
	id "application"
}

description = "Text to PBM"
mainClassName = "dev.shadowtail.txttopbm.Main"

dependencies
{
	implementation project(":modules:midp-lcdui")
}

Name change from bldt/mids/txt-to-pbm/dev/shadowtail/txttopbm/Main.java to tools/txt-to-pbm/src/main/java/dev/shadowtail/txttopbm/Main.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package dev.shadowtail.txttopbm;

import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardOpenOption;
import java.util.Deque;
import java.util.LinkedList;
import java.util.List;
import javax.microedition.lcdui.Font;
import javax.microedition.lcdui.Image;
import javax.microedition.lcdui.Graphics;

/**
 * This class is used to convert a text file to a PBM.
 *
 * @since 2019/06/15
 */
public class Main












<

<


<




<

|
|







1
2
3
4
5
6
7
8
9
10
11
12

13

14
15

16
17
18
19

20
21
22
23
24
25
26
27
28
29
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package dev.shadowtail.txttopbm;

import java.io.BufferedReader;

import java.io.InputStreamReader;

import java.io.PrintStream;
import java.nio.file.Files;

import java.nio.file.Paths;
import java.nio.file.StandardOpenOption;
import java.util.Deque;
import java.util.LinkedList;

import javax.microedition.lcdui.Font;
import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;

/**
 * This class is used to convert a text file to a PBM.
 *
 * @since 2019/06/15
 */
public class Main

Name change from bldt/mids/txt-to-pbm/dev/shadowtail/txttopbm/package-info.java to tools/txt-to-pbm/src/main/java/dev/shadowtail/txttopbm/package-info.java.

Added tools/uudecode/build.gradle.





























>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
plugins
{
	id "java"
	id "application"
}

description = "This decodes MIME encoded files (or base64 " +
	"data) and outputs to standard output."
mainClassName = "net.multiphasicapps.uudecode.Main"

dependencies
{
	implementation project(":modules:io")
}

Name change from test/mids/uudecode/net/multiphasicapps/uudecode/Main.java to tools/uudecode/src/main/java/net/multiphasicapps/uudecode/Main.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.uudecode;

import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintStream;
import java.io.Reader;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardOpenOption;
import java.util.Deque;
import java.util.LinkedList;
import net.multiphasicapps.io.Base64Alphabet;
import net.multiphasicapps.io.Base64Decoder;
import net.multiphasicapps.io.MIMEFileDecoder;












|
|
|




<







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19

20
21
22
23
24
25
26
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.uudecode;

import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintStream;
import java.io.Reader;
import java.nio.file.Files;

import java.nio.file.Paths;
import java.nio.file.StandardOpenOption;
import java.util.Deque;
import java.util.LinkedList;
import net.multiphasicapps.io.Base64Alphabet;
import net.multiphasicapps.io.Base64Decoder;
import net.multiphasicapps.io.MIMEFileDecoder;
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
			for (String a : __args)
				if (a != null)
					args.offerLast(a);
		
		// No arguments passed?
		if (args.isEmpty())
		{
			__printHelp();
			System.exit(-1);
		}
		
		// Try to parse command line options
		boolean ignorepadding = false,
			rawdata = false;
__outer:







|







47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
			for (String a : __args)
				if (a != null)
					args.offerLast(a);
		
		// No arguments passed?
		if (args.isEmpty())
		{
			Main.__printHelp();
			System.exit(-1);
		}
		
		// Try to parse command line options
		boolean ignorepadding = false,
			rawdata = false;
__outer:
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
					break __outer;
				
					// {@squirreljme.error AZ01 Unknown command line switch.
					// (The switch)}
				default:
					if (peek.startsWith("-"))
						throw new IllegalArgumentException(String.format(
							"AZ01 %d", peek));
					break __outer;
			}
		}
		
		// Go through and handle each file
		OutputStream out = System.out;
		while (!args.isEmpty())
			try (Reader file = new InputStreamReader(Files.newInputStream(
				Paths.get(args.pollFirst()), StandardOpenOption.READ));
				InputStream in = __wrap(file, ignorepadding, rawdata))
			{
				byte[] buf = new byte[512];
				for (;;)
				{
					int rc = in.read(buf);
					
					if (rc < 0)







|









|







82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
					break __outer;
				
					// {@squirreljme.error AZ01 Unknown command line switch.
					// (The switch)}
				default:
					if (peek.startsWith("-"))
						throw new IllegalArgumentException(String.format(
							"AZ01 %s", peek));
					break __outer;
			}
		}
		
		// Go through and handle each file
		OutputStream out = System.out;
		while (!args.isEmpty())
			try (Reader file = new InputStreamReader(Files.newInputStream(
				Paths.get(args.pollFirst()), StandardOpenOption.READ));
				InputStream in = Main.__wrap(file, ignorepadding, rawdata))
			{
				byte[] buf = new byte[512];
				for (;;)
				{
					int rc = in.read(buf);
					
					if (rc < 0)

Deleted usage.mkd.

1
2
3
4
5
6
7
8
# SquirrelJME Usage

Specific distributions include their usage document, however you may still
access the usage information for each virtual machine.

 * [JavaME (Shaded)](assets/doc/usage-javame.mkd)
 * [JavaSE (Shaded)](assets/doc/usage-javase.mkd)

<
<
<
<
<
<
<
<
















Deleted utils-dev/GitHubWikiReformat.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

import java.io.*;
import java.nio.file.*;
import java.util.*;
import java.util.regex.*;

/**
 * Reformats a Wiki page for the GitHub Wiki.
 *
 * This is assumed to be running on Linux.
 *
 * @since 2018/09/02
 */
public class GitHubWikiReformat
{
	/**
	 * Main entry point.
	 *
	 * @param __args The first argument is the file being looked at, a relative
	 * path from the root.
	 * @throws Throwable On any exception.
	 * @since 2018/09/02
	 */
	public static void main(String... __args)
		throws Throwable
	{
		if (__args == null || __args.length != 1 || __args[0] == null)
			throw new IllegalArgumentException("Expected path specifying " +
				"the file being modified.");
		
		// Turn it into a path, make root to simplify it
		Path file = Paths.get("/", __args[0]),
			parent = file.getParent();
		System.err.printf("Reformatting %s (in %s)...%n", file, parent);
		
		// Read original file into string
		String original;
		try (Reader r = new InputStreamReader(System.in, "utf-8"))
		{
			StringBuilder sb = new StringBuilder();
			
			for (;;)
			{
				int c = r.read();
				
				if (c < 0)
					break;
				
				sb.append((char)c);
			}
			
			original = sb.toString();
		}
		
		// Pattern used to search for file sequences
		Pattern want = Pattern.compile("\\([^)]*\\.mkd\\)");
		
		// Output result
		StringBuilder out = new StringBuilder();
		
		// Replace patterns
		Matcher match = want.matcher(original);
		for (int lastdx = 0;;)
		{
			// Try to find it
			if (!match.find())
			{
				// Add everything from the last match to the end
				out.append(original.substring(lastdx));
				
				// Stop
				break;
			}
			
			// Starting and end points, used to sub-sequence
			int start = match.start(),
				end = match.end();
			
			// Add everything from the last index to this match
			out.append(original.substring(lastdx, start));
			
			// Set last index to the end of our match, so it is not picked up
			// again
			lastdx = end;
			
			// The opening parenthesis was lost
			out.append('(');
			
			// Some magic needs to be performed on the path, make it a
			// relative path always
			Path origpath = Paths.get(parent + "/" +
				original.substring(start + 1, end - 1));
			
			// Remove the leading slash
			String storepath = origpath.toString().substring(1);
			
			// Convert characters specially
			out.append("@@gh@" +
				storepath.replaceAll(Pattern.quote("/"), "@d@").
				replaceAll(Pattern.quote("-"), "@h@").
				replaceAll(Pattern.quote(".mkd"), ""));
			
			// The ending parenthesis was lost
			out.append(')');
		}
		
		System.out.print(out);
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<














































































































































































































































Deleted utils-dev/ReorderErrors.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

import java.io.InputStream;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardOpenOption;
import java.util.HashMap;
import java.util.jar.Attributes;
import java.util.jar.Manifest;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Objects;
import java.util.regex.Pattern;
import java.util.Set;
import java.util.TreeSet;

/**
 * This class goes through all projects and reorders the error codes so that
 * they appear in order. This program should really only be ran when error
 * codes are a complete mess after a refactor and they need to cleaned up.
 *
 * @since 2017/10/26
 */
public class ReorderErrors
{
	/** The error specifier. */
	private static final String _ERROR_SPECIFIER =
		"@squirreljme.error";
	
	/** The path to reorder errors for. */
	protected final Path path;
	
	/** The prefix for this project. */
	protected final String projectprefix;
	
	/** The next available error code. */
	private volatile Code _nextcode;
	
	/**
	 * Initializes the error reordering on the given path.
	 *
	 * @param __p The path to reorder.
	 * @throws IOException On read errors.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/10/26
	 */
	public ReorderErrors(Path __p)
		throws IOException, NullPointerException
	{
		if (__p == null)
			throw new NullPointerException("NARG");
		
		this.path = __p;
		
		// Read in manifest
		Manifest man;
		try (InputStream in = Files.newInputStream(path.resolve("META-INF").
			resolve("MANIFEST.MF")))
		{
			man = new Manifest(in);
		}
		
		// Get the error prefix
		Attributes attr = man.getMainAttributes();
		String prefix = attr.getValue("X-SquirrelJME-Error");
		if (prefix == null)
			throw new IOException("No error prefix");
		String projectprefix = prefix.trim();
		this.projectprefix = projectprefix;
		
		// The initial code to work with
		this._nextcode = new Code(projectprefix, 1);
	}
	
	/**
	 * Processes everything.
	 *
	 * @throws IOException On read/write errors.
	 * @since 2017/10/26
	 */
	public void run()
		throws IOException
	{
		Path path = this.path;
		
		// Obtain Java source files
		Set<Path> files = new TreeSet<>();
		Files.walk(path).filter((__p) -> !Files.isDirectory(__p)).
			filter((__p) -> __p.toString().endsWith(".java")).
			forEach(files::add);
		
		// Go through all files since they must be parsed to recode versions
		for (Path file : files)
			__process(file);
	}
	
	/**
	 * Processes the given path.
	 *
	 * @param __p The file to process.
	 * @throws IOException On read/write errors.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/01/15
	 */
	private void __process(Path __p)
		throws IOException, NullPointerException
	{
		if (__p == null)
			throw new NullPointerException("NARG");
		
		// Read in all bytes from the file since they will be managed and
		// handled specially depending on which error codes were found
		// Treat as string to extract all the error codes
		String sdata = new String(Files.readAllBytes(__p), "utf-8");
		
		// The first character of the prefix
		String projectprefix = this.projectprefix;
		char firstchar = projectprefix.charAt(0);
		
		// The output string
		StringBuilder out = new StringBuilder(sdata.length());
		
		// Go through all bytes to find sequences for replacing
		boolean replacedsomething = false,
			replacedthiserrorcode = false,
			firstrun = true;
		Code replaceme = new Code(projectprefix, 0),
			withthis = new Code(projectprefix, 0),
			nextcode = this._nextcode;
		char reallylastchar = 0;
		for (int i = 0, n = sdata.length(); i < n; i++)
		{
			char c = sdata.charAt(i),
				lastchar = reallylastchar;
			reallylastchar = c;
			
			// Potentially a code to be replaced
			if (i + 4 < n && c == firstchar &&
				!Character.isAlphabetic(lastchar) &&
				!Character.isDigit(lastchar) && lastchar != '_')
			{
				// Replacing code
				if (sdata.substring(i, i + 4).
					equalsIgnoreCase(replaceme.toString()))
				{
					replacedsomething = true;
					out.append(withthis.toString());
					i += 3;
					
					// Mark for debugging
					replacedthiserrorcode = true;
				}
				
				// Copy as is
				else
					out.append(c);
			}
			
			// Declaration of a new prefix to replace
			else if (c == '@')
			{
				// This is an error declaration
				if (sdata.substring(i).startsWith(_ERROR_SPECIFIER))
				{
					// Ignore whitespace until the code
					int codepos = -1;
					for (int j = i + _ERROR_SPECIFIER.length(); j < n; j++)
					{
						// Ignore whitespace
						char d = sdata.charAt(j);
						if (Character.isWhitespace(d))
							continue;
						
						codepos = j;
						break;
					}
					
					// Is a valid code position
					if (codepos >= 0)
					{
						// Used to detect potentially misused codes
						if (!firstrun && !replacedthiserrorcode)
							System.err.printf("!!!!! NEVER USED %s in %s?%n",
								replaceme, __p);
						replacedthiserrorcode = false;
						firstrun = false;
						
						replaceme = new Code(
							sdata.substring(codepos, codepos + 4));
						withthis = nextcode;
						nextcode = nextcode.next();
					}
					
					// Always copy the character
					out.append(c);
				}
				
				// Not an error sequence
				else
					out.append(c);
			}
			
			// Unknown, just pass it through
			else
				out.append(c);
		}
		
		if (replacedsomething && !replacedthiserrorcode)
			System.err.printf("!!!!! NEVER USED %s in %s?%n", replaceme, __p);
		
		// Store next code for later
		this._nextcode = nextcode;
		
		// Rewrite to file
		if (replacedsomething)
		{
			if (false)
			{
				System.out.println("----------------------------------");
				System.out.printf("FILE: %s%n", __p);
				System.out.println(out);
			}
			else
				Files.write(__p, out.toString().getBytes("utf-8"),
					StandardOpenOption.WRITE,
					StandardOpenOption.TRUNCATE_EXISTING);
		}
	}
	
	/**
	 * Main entry point.
	 *
	 * @param __args Program arguments.
	 * @since 2017/10/26
	 */
	public static void main(String... __args)
	{
		if (__args == null)
			__args = new String[0];
		
		for (String a : __args)
			try
			{
				new ReorderErrors(Paths.get(a)).run();
			}
			catch (IOException e)
			{
				e.printStackTrace();
			}
	}
	
	/**
	 * This represents a prefix and an error code.
	 *
	 * @since 2017/10/27
	 */
	public static final class Code
	{
		/** The prefix code. */
		protected final String prefix;
		
		/** The error code number. */
		protected final int number;
		
		/**
		 * Initializes the code.
		 *
		 * @param __full The full code.
		 * @throws IllegalArgumentException If the prefix or number are not
		 * valid.
		 * @throws NullPointerException On null arguments.
		 * @since 2017/10/27
		 */
		public Code(String __full)
			throws IllegalArgumentException, NullPointerException
		{
			this(__full.substring(0, 2), __full.substring(2, 4));
		}
		
		/**
		 * Initializes the code.
		 *
		 * @param __pre The prefix code.
		 * @param __num The error code number.
		 * @throws IllegalArgumentException If the prefix or number are not
		 * valid.
		 * @throws NullPointerException On null arguments.
		 * @since 2017/10/27
		 */
		public Code(String __pre, String __num)
			throws IllegalArgumentException, NullPointerException
		{
			this(__pre, Integer.parseInt(
				Objects.<String>requireNonNull(__num), 36));
		}
		
		/**
		 * Initializes the code.
		 *
		 * @param __pre The prefix code.
		 * @param __num The error code number.
		 * @throws IllegalArgumentException If the prefix is not valid.
		 * @throws NullPointerException On null arguments.
		 * @since 2017/10/27
		 */
		public Code(String __pre, int __num)
			throws IllegalArgumentException, NullPointerException
		{
			if (__pre == null)
				throw new NullPointerException("NARG");
			
			if (__pre.length() != 2)
				throw new IllegalArgumentException(
					"Prefix must have length of two.");
			
			// The high number comes from base 36 encoding
			if (__num < 0 || __num > 1295)
				throw new IllegalArgumentException(String.format(
					"Error code number ouf of range: %d.", __num));
			
			this.prefix = __pre.toUpperCase();
			this.number = __num;
		}
		
		/**
		 * {@inheritDoc}
		 * @since 2017/10/27
		 */
		@Override
		public boolean equals(Object __o)
		{
			if (!(__o instanceof Code))
				return false;
			
			Code o = (Code)__o;
			return this.prefix.equals(o.prefix) &&
				this.number == o.number;
		}
		
		/**
		 * {@inheritDoc}
		 * @since 2017/10/27
		 */
		@Override
		public int hashCode()
		{
			return this.prefix.hashCode() + this.number;
		}
		
		/**
		 * Returns the next index.
		 *
		 * @return The next index.
		 * @since 2018/01/15
		 */
		public Code next()
		{
			return new Code(this.prefix, this.number + 1);
		}
		
		/**
		 * Returns the number as a string.
		 *
		 * @return The numnber as a string.
		 * @since 2017/10/27
		 */
		public String numberAsString()
		{
			String base = Integer.toString(number, 36).toLowerCase();
			if (base.length() == 1)
				return "0" + base;
			return base;
		}
		
		/**
		 * {@inheritDoc}
		 * @since 2017/10/27
		 */
		@Override
		public String toString()
		{
			return this.prefix + numberAsString();
		}
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
























































































































































































































































































































































































































































































































































































































































































































































































































Deleted utils-dev/SortImports.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

import java.io.IOException;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardOpenOption;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;

/**
 * This class will read in imports from a file and then sort them so that they
 * are in alphabetical order.
 *
 * @since 2018/01/14
 */
public class SortImports
{
	public static final Comparator<String> INSENSITIVE_COMPARATOR =
		new Comparator<String>()
		{
			/**
			 * {@inheritDoc}
			 * @since 2018/01/04
			 */
			@Override
			public int compare(String __a, String __b)
			{
				// Use case insensitive comparison first
				int rv = __a.compareToIgnoreCase(__b);
				if (rv != 0)
					return rv;
				
				// If two strings are the same case, wise, sort it again
				// using case sensitive, so that two similar strings with
				// the same case still sort accordingly as if there were no
				// case, but capital letters are first.
				return __a.compareTo(__b);
			}
		};
	
	/** The file to sort. */
	protected final Path path;
	
	/**
	 * Initializes the sorter.
	 *
	 * @param __p The path to sort.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/01/14
	 */
	public SortImports(Path __p)
		throws NullPointerException
	{
		if (__p == null)
			throw new NullPointerException("NARG");
		
		this.path = __p;
	}
	
	/**
	 * Runs the sorting script.
	 *
	 * @throws IOException On read/write errors.
	 * @since 2018/01/14
	 */
	public void run()
		throws IOException
	{
		// Read all lines in file, it is unspecified if the list is modifiable
		// so make sure it is
		Path path = this.path;
		List<String> inlines = new ArrayList<>(Files.readAllLines(path,
			Charset.forName("utf-8")));
		
		// Find the lines which are import statements
		int n = inlines.size(),
			start = -1,
			end = -1;
		boolean wasimport = false;
		for (int i = 0; i < n; i++)
		{
			boolean isimport = inlines.get(i).startsWith("import");
			
			// Now is an import
			if (isimport)
			{
				// Ignore
				if (wasimport)
					continue;
				
				// Mark start
				else
				{
					start = i;
					wasimport = true;
				}
			}
			
			// Not an import
			else
			{
				// Was an import? Mark end
				if (wasimport)
				{
					end = i;
					break;
				}
				
				// Otherwise find other lines
				else
					continue;
			}
		}
		
		// No import statements?
		if (start < 0 || end < 0)
			return;
		
		// Get sub-list to sort
		List<String> sub = inlines.subList(start, end);
		
		// Sort that
		Collections.sort(sub, INSENSITIVE_COMPARATOR);
		
		// Write out entire file again
		Files.write(path, inlines, Charset.forName("utf-8"),
			StandardOpenOption.WRITE, StandardOpenOption.TRUNCATE_EXISTING);
	}
	
	/**
	 * Main entry point.
	 *
	 * @param __args Program arguments.
	 * @since 2018/10/14
	 */
	public static void main(String... __args)
		throws IOException
	{
		for (String s : __args)
			new SortImports(Paths.get(s)).run();
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






















































































































































































































































































































Deleted utils-dev/TodoProgression.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.io.PrintStream;
import java.io.Reader;
import java.util.Arrays;
import java.util.UUID;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
import java.util.TreeSet;

/**
 * This program reads standard input and builds a CSV for TODO progression.
 *
 * @since 2018/03/29
 */
public class TodoProgression
{
	/** Project detail. */
	protected final Map<UUID, Project> projects =
		new TreeMap<>();
	
	/** Tags which exist. */
	protected final Set<String> tags =
		new TreeSet<>();
	
	/** The last read tag. */
	protected String lasttag;
	
	/**
	 * Registers data.
	 *
	 * @param __tag The tag the checkout is called.
	 * @param __name The name of the project.
	 * @param __uuid The project UUID.
	 * @param __n The number of TODOs in the project.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/03/29
	 */
	public void register(String __tag, String __name, UUID __uuid, int __n)
		throws NullPointerException
	{
		if (__tag == null || __name == null || __uuid == null)
			throw new NullPointerException("NARG");
		
		this.lasttag = __tag;
		
		Map<UUID, Project> projects = this.projects;
		Project p = projects.get(__uuid);
		if (p == null)
			projects.put(__uuid, (p = new Project(__uuid)));
		
		// Count for project
		p.count(__tag, __name, __n);
	}
	
	/**
	 * Writes the results to the output stream.
	 *
	 * @param __ps The output stream.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/03/29
	 */
	public void write(PrintStream __ps)
		throws NullPointerException
	{
		if (__ps == null)
			throw new NullPointerException("NARG");
		
		Set<String> tags = this.tags;
		
		// Build row one for column headers
		__ps.print("name");
		for (String t : tags)
		{
			__ps.print(',');
			__ps.print(t);
		}
		
		// End with line
		__ps.println();
		
		// Sort projects by their name then UUID so they appear consistent
		// and alphabetically sorted
		Set<Project> sorted = new TreeSet<>(projects.values());
		
		// Go through all projects and dump their data, ignore the UUID and
		// only use the latest name
		for (Project p : sorted)
		{
			// Print name
			__ps.print(p.lastname);
			
			// Print all counts
			Map<String, Integer> counts = p.counts;
			for (String t : tags)
			{
				// Comma before
				__ps.print(',');
				
				// Only print value if it is not null
				Integer i = counts.get(t);
				if (i != null)
					__ps.print(i);
			}
			
			// End line for the column
			__ps.println();
		}
	}
	
	/**
	 * Main entry point.
	 *
	 * @param __args Not used.
	 * @since 2018/03/29
	 */
	public static void main(String... __args)
		throws IOException
	{
		TodoProgression tp = new TodoProgression();
		
		// Read in inputs
		try (BufferedReader br = new BufferedReader(
			new InputStreamReader(System.in)))
		{
			String ln;
			while (null != (ln = br.readLine()))
			{
				// Split forms
				String[] fields = ln.split("[ \t]");
				
				// Extract project name
				String name = fields[1];
				int ls = name.lastIndexOf('/');
				if (ls >= 0)
					name = name.substring(ls + 1);
				
				// Register data
				tp.register(fields[0], name, UUID.fromString(fields[2]),
					Integer.parseInt(fields[3]));
			}
		}
		
		// Write output
		tp.write(System.out);
	}
	
	/**
	 * Generates a hashcode from the UUID.
	 *
	 * @param __uuid The input UUID to hash.
	 * @return The hashcode for the UUID.
	 * @since 2018/03/29
	 */
	static final int __hashUUID(UUID __uuid)
	{
		return Long.hashCode(__uuid.getLeastSignificantBits()) ^
			~Long.hashCode(__uuid.getMostSignificantBits());
	}
	
	/**
	 * Used to keep track of projects.
	 *
	 * @since 2018/03/29
	 */
	public class Project
		implements Comparable<Project>
	{
		/** The project UUID. */
		protected final UUID uuid;
		
		/** Todo counts. */
		protected final Map<String, Integer> counts =
			new TreeMap<>();
		
		/** The last name used. */
		protected volatile String lastname;
		
		/**
		 * Initializes the project information.
		 *
		 * @param __uuid The project UUID.
		 * @throws NullPointerException On null arguments.
		 * @since 2018/03/29
		 */
		public Project(UUID __uuid)
			throws NullPointerException
		{
			if (__uuid == null)
				throw new NullPointerException("NARG");
			
			this.uuid = __uuid;
		}
		
		/**
		 * {@inheritDoc}
		 * @since 2018/03/29
		 */
		@Override
		public int compareTo(Project __p)
		{
			if (this == __p)
				return 0;
			
			// Make it so projects which are alive still appear first
			String lasttag = TodoProgression.this.lasttag;
			int rv = Boolean.compare(this.counts.get(lasttag) == null,
				__p.counts.get(lasttag) == null);
			if (rv != 0)
				return rv;
			
			// Make it so names appear first
			rv = this.lastname.compareTo(__p.lastname);
			if (rv != 0)
				return rv;
			return this.uuid.compareTo(__p.uuid);
		}
		
		/**
		 * Counts TODO for the project at a given state.
		 *
		 * @param __tag The tag of the date.
		 * @param __name The name of the project.
		 * @param __n The number of TODOs.
		 * @throws NullPointerException On null arguments.
		 * @since 2018/03/29
		 */
		public void count(String __tag, String __name, int __n)
			throws NullPointerException
		{
			this.lastname = __name + "@" +
				String.format("%08x", __hashUUID(this.uuid));
			this.counts.put(__tag, __n);
			
			TodoProgression.this.tags.add(__tag);
		}
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






















































































































































































































































































































































































































































































































Deleted utils-dev/__reorderallerrors.sh.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/sh
# ---------------------------------------------------------------------------
# Multi-Phasic Applications: SquirrelJME
#     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
#     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
# ---------------------------------------------------------------------------
# SquirrelJME is under the GNU General Public License v3+, or later.
# See license.mkd for licensing and copyright information.
# ---------------------------------------------------------------------------
# DESCRIPTION: This goes through all projects and reorders all of their errors

# Force C locale
export LC_ALL=C

# Directory of this script
__exedir="$(dirname -- "$0")"

# Go through every single project
"$__exedir/lsprojects.sh" | while read __project
do
	echo ">> $__project"
	"$__exedir/reordererrors.sh" "$__exedir/../$__project"
	fossil commit -m "Reorder errors in $__project"
done

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


















































Deleted utils-dev/__sortimports.sh.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/sh
# ---------------------------------------------------------------------------
# Multi-Phasic Applications: SquirrelJME
#     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
#     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
# ---------------------------------------------------------------------------
# SquirrelJME is under the GNU General Public License v3+, or later.
# See license.mkd for licensing and copyright information.
# ---------------------------------------------------------------------------
# DESCRIPTION: Describe this.

# Force C locale
export LC_ALL=C

# Directory of this script
__exedir="$(dirname -- "$0")"

# Compile sorting script
if ! javac -d . "$__exedir/SortImports.java"
then
	echo "Failed to compile sorting program!" 1>&2
	exit 1
fi

# Go through all projects
"$__exedir/lsprojects.sh" | while read __project
do
	# Get project base path
	__path="$__exedir/../$__project"
	
	# Go through all Java files to sort imports
	find "$__path" -type f | grep '\.java$' | while read __file
	do
		java SortImports "$__file"
	done
	
	# Commit these changes
	fossil commit -m "Sort imports for $__project."
done

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
















































































Changes to utils-dev/autobuild.sh.

13
14
15
16
17
18
19



20
21
22
23
24
25
26

# Force C locale
export LC_ALL=C

# Directory of this script
__exedir="$(dirname -- "$0")"
__realexedir="$("$__exedir/absolute.sh" "$__exedir")"




# Current build date, for record keeping
__date="$(date --utc +%s) $(date --utc)"

# Directory to place final things instead of in fossil?
__indir=""
if [ ! -z "$1" ]







>
>
>







13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29

# Force C locale
export LC_ALL=C

# Directory of this script
__exedir="$(dirname -- "$0")"
__realexedir="$("$__exedir/absolute.sh" "$__exedir")"

echo "This script is deprecated!"
exit 1

# Current build date, for record keeping
__date="$(date --utc +%s) $(date --utc)"

# Directory to place final things instead of in fossil?
__indir=""
if [ ! -z "$1" ]

Deleted utils-dev/binscp.sh.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/sh
# ---------------------------------------------------------------------------
# Multi-Phasic Applications: SquirrelJME
#     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
#     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
# ---------------------------------------------------------------------------
# SquirrelJME is under the GNU General Public License v3+, or later.
# See license.mkd for licensing and copyright information.
# ---------------------------------------------------------------------------
# DESCRIPTION: Writes the bins classpath

# Force C locale
export LC_ALL=C

# Directory of this script
__exedir="$(dirname -- "$0")"

# Look in the local bins directory
__peg="0"
for __jar in bins/*.jar
do
	if [ "$__peg" -eq "0" ]
	then
		__peg="1"
	else
		printf '%s' ":"
	fi
	printf '%s' "$__jar"
done

# New line
echo ""
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
































































Deleted utils-dev/boot/BootstrapCompiler.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.concurrent.Callable;
import java.util.List;
import java.util.regex.Pattern;

/**
 * This class contains the ability to call a compiler from the bootstrap.
 *
 * For modern Java systems with a capable class library it will use the
 * internal class libraries.
 *
 * If one is not detected then it will call the host compiler by creating
 * processes as needed to perform the compilation.
 *
 * @since 2019/09/28
 */
public abstract class BootstrapCompiler
{
	/** Pre-cached compiler instance. */
	private static BootstrapCompiler _COMPILER;
	
	/**
	 * Performs the actual compilation step.
	 *
	 * @return {@code true} if compilation is a success.
	 * @since 2019/09/29
	 */
	public abstract boolean compile(Path __srcpath, Path __outpath,
		Iterable<Path> __classpath, Iterable<Path> __sources,
		Iterable<String> __args);
	
	/**
	 * Returns an instance of the compiler needed to build the basic
	 * SquirrelJME system.
	 *
	 * @throws UnsupportedOperationException If no compiler is supported.
	 * @since 2019/09/28
	 */
	public static final BootstrapCompiler getCompiler()
		throws UnsupportedOperationException
	{
		// Use pre-cached compiler
		BootstrapCompiler rv = BootstrapCompiler._COMPILER;
		if (rv != null)
			return rv;
		
		// Try using the standard tool compiler
		try
		{
			rv = StandardToolCompiler.getInstance();
		}
		
		// Is not supported, so try getting the one from the command line
		catch (UnsupportedOperationException e)
		{
			// Print the possible reason the built-in compiler is not
			// available
			e.printStackTrace();
			
			// Try getting command line compiler instead
			rv = CommandLineCompiler.getInstance();
		}
		
		// Cache and return
		BootstrapCompiler._COMPILER = rv;
		return rv;
	}
	
	/**
	 * This is a Java compiler which exists on the command line.
	 *
	 * @since 2019/09/28
	 */
	public static final class CommandLineCompiler
		extends BootstrapCompiler
	{
		/** The executable where the Java compiler lives. */
		protected final Path javac;
		
		/**
		 * Initializes the command line compiler.
		 *
		 * @param __exec The executable location.
		 * @throws NullPointerException On null arguments.
		 * @since 2019/09/29
		 */
		public CommandLineCompiler(Path __exec)
			throws NullPointerException
		{
			if (__exec == null)
				throw new NullPointerException("NARG");
			
			this.javac = __exec;
		}
		
		/**
		 * {@inheritDoc}
		 * @since 2019/09/29
		 */
		@Override
		public boolean compile(Path __srcpath, Path __outpath,
			Iterable<Path> __classpath, Iterable<Path> __sources,
			Iterable<String> __args)
		{
			// Build commands for the process
			List<String> args = new ArrayList<>();
			
			// The Java executable
			args.add(this.javac.toString());
			
			// Arguments to pass as extra
			if (__args != null)
				for (String arg : __args)
					args.add(arg);
			
			// Add source path
			if (__srcpath != null)
			{
				args.add("-sourcepath");
				args.add(__srcpath.toString());
			}
			
			// Output path
			if (__outpath != null)
			{
				args.add("-d");
				args.add(__outpath.toString());
			}
			
			// Add the class path
			if (__classpath != null)
			{
				StringBuilder cpsb = new StringBuilder();
				
				// Go through the path
				for (Path p : __classpath)
				{
					// Prefix with separator?
					if (cpsb.length() > 0)
						cpsb.append(File.pathSeparator);
					
					// Add otherwise
					cpsb.append(p.toString());
				}
				
				// Set it
				args.add("-classpath");
				args.add(cpsb.toString());
			}
			
			// Add all sources
			if (__sources != null)
				for (Path src : __sources)
					args.add(src.toString());
			
			// Start and wait for the compilation to run
			try
			{
				Process fork = new ProcessBuilder(args).start();
				
				for (;;)
					try
					{
						return fork.waitFor() == 0;
					}
					catch (InterruptedException e)
					{
						// Ignore
					}
			}
			catch (IOException e)
			{
				// {@squirreljme.error NB27 Failed to invoke the compiler.
				// (The compiler arguments)}
				throw new RuntimeException("NB27 " + args, e);
			}
		}
		
		/**
		 * Returns an instance of the compiler.
		 *
		 * @return The compiler instance.
		 * @throws UnsupportedOperationException If it is not a valid compiler.
		 * @since 2019/09/28
		 */
		public static final CommandLineCompiler getInstance()
			throws UnsupportedOperationException
		{
			// The Java compiler executable
			Path javac = null;
			
			// Check environment for the compiler
			String env = System.getenv("JAVAC");
			if (env != null)
				javac = CommandLineCompiler.findInPath(Paths.get(env));
			
			// Standard Java compiler
			if (javac == null)
				javac = CommandLineCompiler.findInPath(Paths.get("javac"));
			
			// Eclipse Java compiler
			if (javac == null)
				javac = CommandLineCompiler.findInPath(Paths.get("ecj"));
			
			// {@squirreljme.error NB26 No Java compiler found.}
			if (javac == null)
				throw new UnsupportedOperationException("NB26");
			
			// Use this
			return new CommandLineCompiler(javac);
		}
		
		/**
		 * Locates the given executable in the PATH variable.
		 *
		 * @param __v The executable to find.
		 * @throws NullPointerException On null arguments.
		 * @since 2019/09/29
		 */
		public static final Path findInPath(Path __v)
			throws NullPointerException
		{
			if (__v == null)
				throw new NullPointerException("NARG");
			
			// Check path variable
			String pathvar = System.getenv("PATH");
			if (pathvar != null)
				for (String pathseg : pathvar.split(
					Pattern.quote(File.pathSeparator)))
				{
					Path p = Paths.get(pathseg).resolve(__v);
					if (Files.isExecutable(p))
						return p;
				}
			
			// Check if current path is executable
			if (Files.isExecutable(__v))
				return __v;
			
			// Otherwise nothing works
			return null;
		}
	}
	
	/**
	 * This is a Java compiler which uses the standard tool system.
	 *
	 * This uses the following classes:
	 *  - {@code javax.tools.JavaCompiler}.
	 *  - {@code javax.tools.JavaFileManager}.
	 *  - {@code javax.tools.StandardJavaFileManager}.
	 *  - {@code javax.tools.StandardLocation}.
	 *  - {@code javax.tools.ToolProvider}.
	 *
	 * To make this work on systems which do not provide standard tool
	 * interfaces in the compiler this will only access them using
	 * reflection and such.
	 *
	 * @since 2019/09/28
	 */
	public static final class StandardToolCompiler
		extends BootstrapCompiler
	{
		/** The Java compiler instance. */
		protected final Object javac;
		
		/**
		 * Initializes the standard compiler.
		 *
		 * @param __javac The standard Java compiler instance.
		 * @throws NullPointerException On null arguments.
		 * @since 2019/09/29
		 */
		public StandardToolCompiler(Object __javac)
			throws NullPointerException
		{
			if (__javac == null)
				throw new NullPointerException("NARG");
			
			this.javac = __javac;
		}
		
		/**
		 * {@inheritDoc}
		 * @since 2019/09/29
		 */
		@Override
		public boolean compile(Path __srcpath, Path __outpath,
			Iterable<Path> __classpath, Iterable<Path> __sources,
			Iterable<String> __args)
		{
			// Java compiler instance
			Object javac = this.javac;
			
			// Get stnadard file manager
			Object jfm = __Tool__.JAVA_COMPILER.invoke(
				"getStandardFileManager", javac, null, null, null);
			
			// Set source location
			__Tool__.STANDARD_JAVA_FILE_MANAGER.invoke(
				"setLocation", jfm, 
				__Tool__.STANDARD_LOCATION.enumConstant("SOURCE_PATH"),
				Arrays.<File>asList(__srcpath.toFile()));
			
			// Output to given directory
			__Tool__.STANDARD_JAVA_FILE_MANAGER.invoke(
				"setLocation", jfm,
				__Tool__.STANDARD_LOCATION.enumConstant("CLASS_OUTPUT"),
				Arrays.<File>asList(__outpath.toFile()));
			
			// Translate and set the class path
			List<File> classpath = new ArrayList<>();
			for (Path entry : __classpath)
				classpath.add(entry.toFile());
			__Tool__.STANDARD_JAVA_FILE_MANAGER.invoke(
				"setLocation", jfm,
				__Tool__.STANDARD_LOCATION.enumConstant("CLASS_PATH"),
				classpath);
			
			// Translate source paths to file
			List<File> sources = new ArrayList<>();
			for (Path entry : __sources)
				sources.add(entry.toFile());
			
			// Create compilation task
			Callable task = __Tool__.JAVA_COMPILER.<Callable>invoke(
				Callable.class, "getTask", javac,
				null, jfm, null, __args, null,
				__Tool__.STANDARD_JAVA_FILE_MANAGER.invoke(
					"getJavaFileObjectsFromFiles", jfm, sources));
			
			// Execute the task
			try
			{
				return ((Boolean)task.call()).booleanValue();
			}
			catch (Exception e)
			{
				// {@squirreljme.error NB25 Compiler invocation failed.}
				throw new RuntimeException("NB25", e);
			}
		}
		
		/**
		 * Returns an instance of the compiler.
		 *
		 * @return The compiler instance.
		 * @throws UnsupportedOperationException If it is not a valid compiler.
		 * @since 2019/09/28
		 */
		public static final StandardToolCompiler getInstance()
			throws UnsupportedOperationException
		{
			// {@squirreljme.error NB23 No standard Java compiler exists.}
			Object javac = __Tool__.TOOL_PROVIDER.invoke(
				"getSystemJavaCompiler", null);
			if (javac == null)
				throw new UnsupportedOperationException("NB23");
			
			// Make compiler with this instance
			return new StandardToolCompiler(javac);
		}
	}
	
	/**
	 * Enumeration to represent the standard tool classes.
	 *
	 * @since 2019/09/28
	 */
	static enum __Tool__
	{
		/** Java compiler. */
		JAVA_COMPILER("javax.tools.JavaCompiler"),
		
		/** Java file manager. */
		JAVA_FILE_MANAGER("javax.tools.JavaFileManager"),
		
		/** Standard Java File Manager. */
		STANDARD_JAVA_FILE_MANAGER("javax.tools.StandardJavaFileManager"),
		
		/** Standard location. */
		STANDARD_LOCATION("javax.tools.StandardLocation"),
		
		/** Tool provider. */
		TOOL_PROVIDER("javax.tools.ToolProvider");
		
		/** End. */
		;
		
		/** The class to access. */
		protected final String desireclass;
		
		/** Cached class. */
		private Class<?> _cacheclass;
		
		/**
		 * Initializes the entry.
		 *
		 * @param __dc The desired class.
		 * @throws NullPointerException On null arguments.
		 * @since 2019/09/28
		 */
		private __Tool__(String __dc)
			throws NullPointerException
		{
			if (__dc == null)
				throw new NullPointerException("NARG");
			
			this.desireclass = __dc;
		}
		
		/**
		 * Returns the enum constant of the given name.
		 *
		 * @param __name The name of the enum constant.
		 * @return The resulting constant.
		 * @throws NullPointerException On null arguments.
		 * @throws UnsupportedOperationException If the constant is not valid.
		 * @since 2019/09/29
		 */
		public final Enum<?> enumConstant(String __name)
			throws NullPointerException, UnsupportedOperationException
		{
			if (__name == null)
				throw new NullPointerException("NARG");
			
			// Working with this class
			Class<?> cl = this.lookupClass();
			
			// If there are no values, then this is likely not an enumeration
			Object[] values = cl.getEnumConstants();
			if (values != null)
			{
				// Find it
				for (Object value : values)
					if (__name.equals(((Enum)value).name()))
						return Enum.class.cast(value);
			}
			
			// {@squirreljme.error NB24 Enumeration constant not found.
			// (The class name; The constant name)}
			throw new UnsupportedOperationException(
				String.format("NB24 %s %s", cl.getName(), __name));
		}
		
		/**
		 * Looks up the specified class.
		 *
		 * @return The resulting class.
		 * @throws UnsupportedOperationException If it does not exist.
		 * @since 2019/09/28
		 */
		public final Class<?> lookupClass()
			throws UnsupportedOperationException
		{
			// Already cached?
			Class<?> rv = this._cacheclass;
			if (rv != null)
				return rv;
			
			// Lookup otherwise
			try
			{
				this._cacheclass = (rv = Class.forName(this.desireclass));
			}
			
			// {@squirreljme.error NB20 Could not lookup compiler class.}
			catch (ClassNotFoundException e)
			{
				throw new UnsupportedOperationException("NB20", e);
			}
			
			// Return it
			return rv;
		}
		
		/**
		 * Invokes the given method and returns the given class type.
		 *
		 * @param <T> The type to return.
		 * @param __t The type to return.
		 * @param __name The name of the method.
		 * @param __v The value to invoke on.
		 * @param __args Arguments to the method.
		 * @return The return value of the method.
		 * @throws ClassCastException If the type is not correct.
		 * @throws NullPointerException On null arguments.
		 * @since 2019/09/29
		 */
		public final <T> T invoke(Class<T> __t, String __name, Object __v,
			Object... __args)
			throws ClassCastException, NullPointerException
		{
			if (__t == null)
				throw new NullPointerException("NARG");
			
			return __t.cast(this.invoke(__name, __v, __args));
		}
		
		/**
		 * Invokes the given method.
		 *
		 * @param __name The name of the method.
		 * @param __v The value to invoke on.
		 * @param __args Arguments to the method.
		 * @return The return value of the method.
		 * @throws NullPointerException On null arguments.
		 * @since 2019/09/29
		 */
		public final Object invoke(String __name, Object __v, Object... __args)
			throws NullPointerException
		{
			if (__name == null)
				throw new NullPointerException("NARG");
			
			// Lookup our class
			Class<?> cl = this.lookupClass();
			
			// Number of arguments to match against
			int numargs = (__args == null ? 0 : __args.length);
			
			// Find matching according to name and argument count
			for (Method m : cl.getMethods())
				if (__name.equals(m.getName()) &&
					numargs == m.getParameterCount())
				try
				{
					return m.invoke(__v,
						(__args == null ? new Object[0] : __args));
				}
				catch (IllegalAccessException|InvocationTargetException e)
				{
					// {@squirreljme.error NB22 Could not invoke the given
					// method. (The class name; The method name)}
					throw new RuntimeException(String.format("NB22 %s %s",
						cl.getName(), __name), e);
				}
			
			// {@squirreljme.error NB21 Could not find the method with the
			// given name in the given class. (The class name; The method)}
			throw new UnsupportedOperationException(
				String.format("NB21 %s %s", cl.getName(), __name));
		}
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<










































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted utils-dev/boot/BuildProject.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

import java.io.File;
import java.io.InputStream;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.StandardCopyOption;
import java.nio.file.StandardOpenOption;
import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.jar.Attributes;
import java.util.jar.Manifest;
import java.util.Map;
import java.util.Set;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;

/**
 * This represents a single project which may be built.
 *
 * @since 2016/10/27
 */
public class BuildProject
{
	/** The project base path. */
	protected final Path basepath;
	
	/** The project name. */
	protected final String name;
	
	/** The output path for this JAR. */
	protected final Path jarout;
	
	/** Dependencies of this build project. */
	protected final Set<String> depends;
	
	/** Projects that are available. */
	private final Map<String, BuildProject> _projects;
	
	/** In compilation? */
	private volatile boolean _incompile;
	
	/** Was the source date calculated? */
	private volatile long _sourcedate =
		Long.MIN_VALUE;
	
	/**
	 * Initializes the build project.
	 *
	 * @param __b The project base path.
	 * @param __mp The manifest path.
	 * @param __bjo Build JAR output.
	 * @throws IOException On read/write errors.
	 * @throws NullPointerException On null arguments.
	 * @since 2016/10/27
	 */
	BuildProject(Path __b, Path __mp, Path __bjo,
		Map<String, BuildProject> __projs)
		throws IOException, NullPointerException
	{
		// Check
		if (__b == null || __mp == null || __bjo == null || __projs == null)
			throw new NullPointerException("NARG");
		
		// Set
		this.basepath = __b;
		this._projects = __projs;
		
		// Load the manifest
		Manifest man;
		try (InputStream in = Files.newInputStream(
			__mp, StandardOpenOption.READ))
		{
			man = new Manifest(in);
		}
		
		// Handle main attributes
		Attributes attr = man.getMainAttributes();
		
		// The project name depends on the uppermost name of the directory
		String name;
		this.name = (name = __correctProjectName(
			__b.getFileName().toString()));
		
		// Where is this output?
		this.jarout = __bjo.resolve(name + ".jar");
		
		// Determine dependencies
		Set<String> depends = new LinkedHashSet<>();
		String rd = attr.getValue("X-SquirrelJME-Depends");
		if (rd != null)
			for (String s : rd.split("[ \t]"))
				depends.add(__correctProjectName(s.trim()));
		
		// Force a dependency on the CLDC Compact library
		if (!name.equals("cldc-compact"))
			depends.add(__correctProjectName("cldc-compact"));
		
		// Set
		this.depends = depends;
	}
	
	/**
	 * Returns the date of the binary.
	 *
	 * The value here is not cached.
	 *
	 * @return The date of the binary.
	 * @since 2016/10/27
	 */
	public long binaryDate()
	{
		// If it does not exist, the date is not valid
		Path jarout = this.jarout;
		if (!Files.exists(jarout))
			return Long.MIN_VALUE;
		
		// Calculate
		try
		{
			Long[] out = new Long[1];
			out[0] = Long.MIN_VALUE;
			NewBootstrap.<Long[]>__walk(jarout, out, NewBootstrap.DATE);
			return out[0];
		}
		
		// Ignore
		catch (IOException e)
		{
			return Long.MIN_VALUE;
		}
	}
	
	/**
	 * Compiles this project and any dependencies it may have.
	 *
	 * @return The set of projects which were compiled.
	 * @throws IOException On read/write errors.
	 * @since 2016/10/27
	 */
	public Set<BuildProject> compile()
		throws IOException
	{
		Set<BuildProject> rv = new LinkedHashSet<>();
		
		// Build loop
		try
		{
			// {@squirreljme.error NB02 The specified project eventually
			// depends on itself. (The project name)}
			if (this._incompile)
				throw new IllegalStateException(String.format(
					"NB02 %s", this.name));
			
			// Currently compiling
			this._incompile = true;
			
			// Compile dependencies first
			Map<String, BuildProject> projects = this._projects;
			for (String dep : this.depends)
			{
				// {@squirreljme.error NB06 The dependency of a given
				// project does not exist. (This project; The project it
				// depends on)}
				BuildProject dp = projects.get(dep);
				if (dp == null)
					throw new IllegalStateException(String.format(
						"NB06 %s %s", this.name, dep));
				
				// Compile the dependency and add it to the merge group
				for (BuildProject bp : dp.compile())
					rv.add(bp);
			}
			
			// Other complation state
			__compileStep(rv);
		}
		
		// Clear compile state
		finally
		{
			this._incompile = false;
		}
		
		// Add self to dependency chain
		rv.add(this);
		
		// Return it
		return rv;
	}
	
	/**
	 * Returns the name of this project.
	 *
	 * @return The project name.
	 * @since 2016/10/27
	 */
	public String projectName()
	{
		return this.name;
	}
	
	/**
	 * Returns the date when the project sources were last touched.
	 *
	 * @return The project sources date.
	 * @since 2016/10/27
	 */
	public long sourcesDate()
	{
		// Use cached value
		long rv = this._sourcedate;
		if (rv != Long.MIN_VALUE)
			return rv;
		
		// Calculate otherwise
		try
		{
			Long[] out = new Long[1];
			out[0] = Long.MIN_VALUE;
			NewBootstrap.<Long[]>__walk(this.basepath, out, NewBootstrap.DATE);
			this._sourcedate = (rv = out[0]);
		}
		
		// Ignore
		catch (IOException e)
		{
		}
		
		// Return it
		return rv;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/02/25
	 */
	@Override
	public String toString()
	{
		return this.name;
	}
	
	/**
	 * Secondary compilation step.
	 *
	 * @param __deps Dependencies used.
	 * @throws IOException On read/write errors.
	 * @throws NullPointerException On null arguments.
	 * @since 2016/10/27
	 */
	private void __compileStep(Set<BuildProject> __deps)
		throws IOException, NullPointerException
	{
		// Check
		if (__deps == null)
			throw new NullPointerException("NARG");
		
		// Best dependency date
		long depdate = Long.MIN_VALUE;
		for (BuildProject bp : __deps)
			depdate = Math.max(depdate, bp.binaryDate());
		
		// Do not recompile if it is up to date
		long srcdate = sourcesDate(),
			bindate =  binaryDate();
		Path jarout = this.jarout;
		if (Files.exists(jarout) && srcdate <= bindate &&
			bindate > depdate)
			return;
		
		// {@squirreljme.error NB09 Now compiling the specified project.
		// (The name of the project being compiled)}
		String name = this.name;
		System.err.printf("NB09 %s%n", name);
		
		// Try finding the compiler
		BootstrapCompiler javac = BootstrapCompiler.getCompiler();
		
		// Need to clear files
		Path tempdir = null;
		try
		{
			// Create temporary directory
			tempdir = Files.createTempDirectory(
				"squirreljme-build-" + name);
			
			// Source code is just this project
			final Path basepath = this.basepath;
			
			// Get all source code to be compiled
			final Set<Path> fsources = new LinkedHashSet<>();
			NewBootstrap.<Object>__walk(basepath, null,
				new Consumer<Path, Object, IOException>()
				{
					/**
					 * {@inheritDoc}
					 * @since 2016/10/27
					 */
					@Override
					public void accept(Path __p, Object __s)
						throws IOException
					{
						// Ignore directories
						if (Files.isDirectory(__p))
							return;
						
						// Add to sources if it is a source file
						if (__p.getFileName().toString().endsWith(".java"))
							fsources.add(__p);
					}
				});
			
			// If there are no sources to compile, do not bother
			if (!fsources.isEmpty())
			{
				// The class path is just the dependencies
				Set<Path> fdeps = new LinkedHashSet<>();
				for (BuildProject bp : __deps)
					fdeps.add(bp.jarout);
				
				// {@squirreljme.error NB08 Compilation of this project
				// failed. (The name of this project)}
				if (!javac.compile(basepath, tempdir, fdeps, fsources,
					Arrays.<String>asList("-source", "1.7",
					"-target", "1.7", "-g", "-Xlint:deprecation",
					"-Xlint:unchecked")))
					throw new RuntimeException(String.format("NB08 %s",
						name));
			}
			
			// Create directory used for output
			Path jpar = jarout.getParent();
			if (jpar != null)
				Files.createDirectories(jpar);
			
			// Generate JAR output
			Path tempjar = Files.createTempFile("buildjar", "jar");
			try (final ZipOutputStream zos = new ZipOutputStream(Files.
				newOutputStream(tempjar,
				StandardOpenOption.WRITE, StandardOpenOption.CREATE)))
			{
				// Write files in the output and input
				final byte[] buf = new byte[4096];
				Consumer<Path, Path, IOException> func =
					new Consumer<Path, Path, IOException>()
					{
						/**
						 * {@inheritDoc}
						 * @since 2016/10/28
						 */
						@Override
						public void accept(Path __p, Path __s)
							throws IOException
						{
							ZipOutputStream out = zos;
							
							// Ignore directories
							if (Files.isDirectory(__p) || __p.
								getFileName().toString().endsWith("java"))
								return;
							
							// Ignore files ending in .java
							Path fn = __p.getFileName();
							String fns = __p.getFileName().toString();
							if (fns.endsWith(".java"))
								return;
							
							// Detect MIME files?
							boolean ismime = false;
							if (fns.endsWith(".__mime"))
							{
								ismime = true;
								fns = fns.substring(0, fns.length() - 7);
							}
							
							// Create new entry
							out.putNextEntry(
								new ZipEntry(NewBootstrap.__zipName(__s,
									__p.resolveSibling(fns))));
							
							// Copy data
							try (InputStream src = Files.newInputStream(__p,
									StandardOpenOption.READ);
								InputStream is = (!ismime ? src :
									new MIMEFileDecoder(src)))
							{
								for (;;)
								{
									int rc = is.read(buf);
									
									// EOF?
									if (rc < 0)
										break;
									
									// Copy
									out.write(buf, 0, rc);
								}
							}
							
							// Close
							out.closeEntry();
						}
					};
				
				// Add sources and classes
				NewBootstrap.<Path>__walk(basepath, basepath, func);
				NewBootstrap.<Path>__walk(tempdir, tempdir, func);
				
				// Finish it
				zos.finish();
				zos.flush();
				
				// Move JAR
				Files.move(tempjar, jarout,
					StandardCopyOption.REPLACE_EXISTING);
			}
			
			// Failed, delete output JAR
			catch (IOException|RuntimeException|Error e)
			{
				// Delete file
				try
				{
					Files.delete(tempjar);
				}
				catch (IOException f)
				{
					// Ignore
				}
				
				// Rethrow
				throw e;
			}
		}
		
		// Always clear at the end
		finally
		{
			if (tempdir != null)
				try
				{
					NewBootstrap.<Object>__walk(tempdir, null,
						NewBootstrap.DELETE);
				}
				catch (IOException e)
				{
					// Ignore
				}
		}
	}
	
	/**
	 * Lowercases the specified string.
	 *
	 * @param __s The string to check.
	 * @return The string in correct form.
	 * @throws IllegalArgumentException If it is not valid.
	 * @throws NullPointerException On null arguments.
	 * @since 2016/10/27
	 */
	private static String __correctProjectName(String __s)
		throws IllegalArgumentException, NullPointerException
	{
		// Check
		if (__s == null)
			throw new NullPointerException("NARG");
		
		// Check if any characters need lowering first
		int n = __s.length();
		boolean dolower = false;
		for (int i = 0; i < n; i++)
		{
			char c = __s.charAt(i);
			
			// Lowercase?
			if (c >= 'A' && c <= 'Z')
				dolower = true;
			
			// Legal character?
			else if ((c >= 'a' && c <= 'z') || (c >= '0' && c <= '9') ||
				c == '-')
				continue;
			
			// {@squirreljme.error NB01 Illegal character used in project
			// name. (The input project name)}
			else
				throw new IllegalArgumentException(String.format("NB01 %s",
					__s));
		}
		
		// Use original string
		if (!dolower)
			return __s;
		
		// Lowercase everything
		StringBuilder sb = new StringBuilder(n);
		for (int i = 0; i < n; i++)
		{
			char c = __s.charAt(i);
			
			// Lowercase?
			if (c >= 'A' && c <= 'Z')
				sb.append((char)((c - 'A') + 'a'));
			
			// Keep
			else
				sb.append(c);
		}
		
		// Use that
		return sb.toString();
	}
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






















































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted utils-dev/boot/Consumer.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

/**
 * Consumes a value which may throw an exception.
 *
 * @param <V> The value to consume.
 * @param <S> A secondary value that may be passed.
 * @param <E> The exception to potentially throw.
 * @since 2016/10/27
 */
public interface Consumer<V, S, E extends Exception>
{
	/**
	 * Accepts a value.
	 *
	 * @param __v The value to access.
	 * @param __s An optional secondary value.
	 * @throws E If this given exception type is thrown.
	 * @since 2016/10/27
	 */
	public abstract void accept(V __v, S __s)
		throws E;
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






























































Deleted utils-dev/boot/MIMECharAlphabet.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

/**
 * This represents the alphabet that is used for Base64.
 *
 * @since 2018/03/05
 */
public enum MIMECharAlphabet
{
	/** The basic and MIME alphabet. */
	BASIC('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
		'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
		'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
		'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
		'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/', '='),
	
	/** The URL alphabet. */
	URL('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
		'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
		'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
		'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
		'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '-', '_', '='),
	
	/** End. */
	;
	
	/** The alphabet for the characters. */
	final char[] _alphabet;
	
	/**
	 * Initializes the alphabet.
	 *
	 * @param __alphabet The alphabet.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/03/05
	 */
	private MIMECharAlphabet(char... __alphabet)
		throws NullPointerException
	{
		if (__alphabet == null)
			throw new NullPointerException("NARG");
		
		this._alphabet = __alphabet;
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<










































































































Deleted utils-dev/boot/MIMECharDecoder.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.io.IOException;
import java.io.Reader;

/**
 * This decodes the base64 character set, ignoring invalid characters, and
 * provides the binary data for the input. If the padding character is
 * reached or if the input stream runs out of characters then EOF is
 * triggered.
 *
 * @since 2018/03/05
 */
public final class MIMECharDecoder
	extends InputStream
{
	/** The source reader. */
	protected final Reader in;
	
	/** Ignore padding characters. */
	protected final boolean ignorepadding;
	
	/** The alphabet to use for decoding. */
	private final char[] _alphabet;
	
	/** The ASCII map for quick lookup. */
	private final byte[] _ascii;
	
	/** Output bytes to drain. */
	private final byte[] _drain =
		new byte[3];
	
	/** The current fill buffer. */
	private volatile int _buffer;
	
	/** The number of bits which are in the buffer. */
	private volatile int _bits;
	
	/** Has EOF been reached if the pad has been detected? */
	private volatile boolean _readeof;
	
	/** The current output drain position. */
	private volatile int _drained =
		-1;
	
	/** The maximum value for drained values. */
	private volatile int _drainedmax =
		-1;
	
	/**
	 * Initializes the decode the default MIME alphabet.
	 *
	 * @param __in The input set of characters.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/11/23
	 */
	public MIMECharDecoder(Reader __in)
	{
		this(__in, MIMECharAlphabet.BASIC);
	}
	
	/**
	 * Initializes the decoder using the specified alphabet.
	 *
	 * @param __in The input set of characters.
	 * @param __chars The pre-defined character set to use for the
	 * alphabet.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/03/05
	 */
	public MIMECharDecoder(Reader __in, MIMECharAlphabet __chars)
		throws NullPointerException
	{
		this(__in, __chars._alphabet, false);
	}
	
	/**
	 * Initializes the decoder using the specified custom alphabet.
	 *
	 * @param __in The input set of characters.
	 * @param __chars The characters to use for the alphabet.
	 * @throws IllegalArgumentException If the alphabet is of the incorrect
	 * size.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/03/05
	 */
	public MIMECharDecoder(Reader __in, String __chars)
		throws IllegalArgumentException, NullPointerException
	{
		this(__in, __chars.toCharArray(), false);
	}
	
	/**
	 * Initializes the decoder using the specified custom alphabet.
	 *
	 * @param __in The input set of characters.
	 * @param __chars The characters to use for the alphabet.
	 * @throws IllegalArgumentException If the alphabet is of the incorrect
	 * size.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/03/05
	 */
	public MIMECharDecoder(Reader __in, char[] __chars)
		throws IllegalArgumentException, NullPointerException
	{
		this(__in, __chars, false);
	}
	
	/**
	 * Initializes the decoder using the default alphabet.
	 *
	 * @param __in The input set of characters.
	 * @param __chars The pre-defined character set to use for the alphabet.
	 * @param __ip Ignore padding characters and do not treat them as the
	 * end of the stream.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/03/05
	 */
	public MIMECharDecoder(Reader __in, MIMECharAlphabet __chars,
		boolean __ip)
		throws NullPointerException
	{
		this(__in, __chars._alphabet, __ip);
	}
	
	/**
	 * Initializes the decoder using the specified custom alphabet.
	 *
	 * @param __in The input set of characters.
	 * @param __chars The characters to use for the alphabet.
	 * @param __ip Ignore padding characters and do not treat them as the
	 * end of the stream.
	 * @throws IllegalArgumentException If the alphabet is of the incorrect
	 * size.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/03/05
	 */
	public MIMECharDecoder(Reader __in, String __chars, boolean __ip)
		throws IllegalArgumentException, NullPointerException
	{
		this(__in, __chars.toCharArray(), __ip);
	}
	
	/**
	 * Initializes the decoder using the specified custom alphabet.
	 *
	 * @param __in The input set of characters.
	 * @param __chars The characters to use for the alphabet.
	 * @param __ip Ignore padding characters and do not treat them as the
	 * end of the stream.
	 * @throws IllegalArgumentException If the alphabet is of the incorrect
	 * size.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/03/05
	 */
	public MIMECharDecoder(Reader __in, char[] __chars, boolean __ip)
		throws IllegalArgumentException, NullPointerException
	{
		if (__in == null || __chars == null)
			throw new NullPointerException("NARG");
		
		// {@squirreljme.erorr NB8g The alphabet to use for the base64
		// decoder must be 64 characters plus one padding character.
		// (The character count)}
		int n;
		if ((n = __chars.length) != 65)
			throw new IllegalArgumentException(
				String.format("NB8g %d", n));
		
		// Set
		this.in = __in;
		this.ignorepadding = __ip;
		this._alphabet = (__chars = __chars.clone());
		
		// Build ASCII map for quick in-range character lookup
		byte[] ascii = new byte[128];
		for (int i = 0; i < 128; i++)
			ascii[i] = -1;
		for (int i = 0; i < 65; i++)
		{
			int dx = __chars[i];
			if (dx < 128)
				ascii[dx] = (byte)i;
		}
		this._ascii = ascii;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/11/25
	 */
	@Override
	public final int available()
		throws IOException
	{
		int drained = this._drained;
		
		// There are bytes which are ready and in the drain that we do not
		// need to block reading them?
		if (drained != -1)
			return this._drainedmax - drained;
		return 0;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/03/05
	 */
	@Override
	public final void close()
		throws IOException
	{
		this.in.close();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/03/05
	 */
	@Override
	public final int read()
		throws IOException
	{
		// If there is stuff to be drained, quickly drain that so we do not
		// need to go deeper into the heavier method
		int drained = this._drained;
		if (drained != -1)
		{
			// Read in drained character
			int rv = this._drain[drained++] & 0xFF;
			
			// Reached the drain limit?
			if (drained == this._drainedmax)
			{
				this._drained = -1;
				this._drainedmax = -1;
			}
			
			// Would still be drain
			else
				this._drained = drained;
			
			// Return the value
			return rv;
		}
		
		// Previously read EOF, so this will just return EOF
		if (this._readeof)
			return -1;
		
		// Otherwise decode and read
		byte[] next = new byte[1];
		for (;;)
		{
			int rc = this.read(next, 0, 1);
			
			// EOF?
			if (rc < 0)
				return -1;
			
			// Missed read
			else if (rc == 0)
				continue;
			
			return (next[0] & 0xFF);
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/11/25
	 */
	@Override
	public final int read(byte[] __b)
		throws IOException, NullPointerException
	{
		if (__b == null)
			throw new NullPointerException("NARG");
		
		return this.read(__b, 0, __b.length);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/03/05
	 */
	@Override
	public final int read(byte[] __b, int __o, int __l)
		throws IndexOutOfBoundsException, IOException, NullPointerException
	{
		if (__b == null)
			throw new NullPointerException("NARG");
		if (__o < 0 || __l < 0 || (__o + __l) > __b.length)
			throw new IndexOutOfBoundsException("IOOB");
		
		// Did a previous read cause a padded EOF?
		boolean readeof = this._readeof;
		
		// Need lookups
		Reader in = this.in;
		boolean ignorepadding = this.ignorepadding;
		char[] alphabet = this._alphabet;
		byte[] ascii = this._ascii;
		byte[] drain = this._drain;
		
		// This buffer is filled into as needed when input characters are
		// read
		int buffer = this._buffer,
			bits = this._bits,
			drained = this._drained,
			drainedmax = this._drainedmax;
		
		// Keep trying to fill bytes in
		int rv = 0;
		while (rv < __l)
		{
			// Still need to drain bytes away
			if (drained != -1 && drained < drainedmax)
			{
				// Drain it
				__b[__o++] = drain[drained++];
				rv++;
				
				// Drained all the characters
				if (drained == drainedmax)
					drained = drainedmax = -1;
				
				// Try again
				else
					continue;
			}
			
			// EOF was reached
			if (readeof)
				break;
			
			// Read in character and decode it
			int ch = in.read();
			
			// Is EOF?
			if (ch < 0)
			{
				// {@squirreljme.error BD20 Read EOF from input when there
				// were expected to be more characters or the ending
				// padding character. (The bits in the buffer)}
				if (bits != 0)
					throw new IOException("BD20 " + bits);
				
				// Did read EOF
				readeof = true;
				break;
			}
			
			// Determine the value of the character
			if (ch < 128)
				ch = ascii[ch];
			else
			{
				ch = -1;
				for (int i = 0; i < 65; i++)
					if (i == alphabet[i])
					{
						ch = i;
						break;
					}
			}
			
			// Invalid, ignore and continue
			if (ch == -1 || (ignorepadding && ch == 64))
				continue;
			
			// Decoded padding character
			else if (ch == 64)
			{
				// {@squirreljme.error BD21 Did not expect a padding
				// character.
				// (The number of decoded bits in queue)}
				if (bits == 0 || bits == 24)
					throw new IOException("BD21 " + bits);
				
				// Only want to store a single extra byte since that is
				// all that is valid
				else if (bits < 16)
				{
					// {@squirreljme.error BD22 Expected another padding
					// character.}
					if (in.read() != alphabet[64])
						throw new IOException("BD22");
					
					drain[0] = (byte)(buffer >>> 4);
					
					drainedmax = 1;
				}
				
				// Otherwise there will be two characters to drain
				else
				{
					drain[0] = (byte)(buffer >>> 10);
					drain[1] = (byte)(buffer >>> 2);
					
					drainedmax = 2;
				}
				
				// Need to drain all
				drained = 0;
					
				// Clear the buffer
				buffer = bits = 0;
				
				// Did read EOF
				readeof = true;
			}
			
			// Normal data
			else
			{
				// Shift in six bits
				buffer <<= 6;
				buffer |= ch;
				bits += 6;
				
				// Drain and empty the buffer
				if (bits == 24)
				{
					// Fill the drain
					drain[0] = (byte)(buffer >>> 16);
					drain[1] = (byte)(buffer >>> 8);
					drain[2] = (byte)buffer;
					
					// Set these to drain
					drained = 0;
					drainedmax = 3;
					
					// Clear the buffer
					buffer = bits = 0;
				}
			}
		}
		
		// Store state for next run
		this._buffer = buffer;
		this._bits = bits;
		this._readeof = readeof;
		this._drained = drained;
		this._drainedmax = drainedmax;
		
		// Return the read count
		if (readeof && rv == 0)
			return -1;
		return rv;
	}
	
	/**
	 * Decodes the input string to byte values.
	 *
	 * @param __in The string to decode.
	 * @param __ab The alphabet to use.
	 * @return The resulting byte array.
	 * @throws IllegalArgumentException If the input string is not valid.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/11/06
	 */
	public static final byte[] decode(String __in, MIMECharAlphabet __ab)
		throws IllegalArgumentException, NullPointerException
	{
		return MIMECharDecoder.decode(__in, __ab, false);
	}
	
	/**
	 * Decodes the input string to byte values.
	 *
	 * @param __in The string to decode.
	 * @param __ab The alphabet to use.
	 * @param __ip Is padding ignored?
	 * @return The resulting byte array.
	 * @throws IllegalArgumentException If the input string is not valid.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/11/04
	 */
	public static final byte[] decode(String __in, MIMECharAlphabet __ab,
		boolean __ip)
		throws IllegalArgumentException, NullPointerException
	{
		if (__in == null || __ab == null)
			throw new NullPointerException("NARG");
		
		// Wrap in a reader to decode
		try (ByteArrayOutputStream baos = new ByteArrayOutputStream())
		{
			byte[] buf = new byte[32];
			
			// Loop handle bytes
			try (InputStream in = new MIMECharDecoder(
				new StringReader(__in), __ab, __ip))
			{
				for (;;)
				{
					int rc = in.read(buf);
					
					// EOF?
					if (rc < 0)
						break;
					
					// Copy
					baos.write(buf, 0, rc);
				}
			}
			
			// Return resulting byte array
			return baos.toByteArray();
		}
		
		// {@squirreljme.error NB82 Could not decode the input string.}
		catch (IOException e)
		{
			throw new IllegalArgumentException("NB82", e);
		}
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted utils-dev/boot/MIMEFileDecoder.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.IOException;
import java.io.Reader;
import java.io.UnsupportedEncodingException;

/**
 * This class is used to decode input streams which have been encoded in
 * the MIME Base64 format. This file format is genearted by
 * {@code uuencode -m}.
 * This format usually begins with {@code begin-base64 mode filename} and
 * ends with the padding sequence {@code ====}.
 *
 * This class is not thread safe.
 *
 * @since 2018/03/05
 */
public final class MIMEFileDecoder
	extends InputStream
{
	/** The input base64 data. */
	protected MIMECharDecoder mime;
	
	/** The read mode. */
	private int _mode =
		Integer.MIN_VALUE;
	
	/** The read filename. */
	private String _filename;
	
	/**
	 * Initializes the MIME file decoder using the default encoding.
	 *
	 * @param __in The input source.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/11/30
	 */
	public MIMEFileDecoder(InputStream __in)
		throws NullPointerException
	{
		this(new InputStreamReader(__in));
	}
	
	/**
	 * Initializes the MIME file decoder using the given encoding.
	 *
	 * @param __in The input source.
	 * @param __enc The encoding used.
	 * @throws NullPointerException On null arguments.
	 * @throws UnsupportedEncodingException If the encoding is not
	 * supported.
	 * @since 2018/11/30
	 */
	public MIMEFileDecoder(InputStream __in, String __enc)
		throws NullPointerException, UnsupportedEncodingException
	{
		this(new InputStreamReader(__in, __enc));
	}
	
	/**
	 * Initializes the MIME file decoder from the given set of characters.
	 *
	 * @param __in The input source.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/03/05
	 */
	public MIMEFileDecoder(Reader __in)
		throws NullPointerException
	{
		if (__in == null)
			throw new NullPointerException("NARG");
		
		// Directly wrap the reader with the MIME decoder which reads from
		// a source reader that is internally maintained
		this.mime = new MIMECharDecoder(new __SubReader__(__in));
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/11/25
	 */
	@Override
	public final int available()
		throws IOException
	{
		return this.mime.available();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/03/05
	 */
	@Override
	public final void close()
		throws IOException
	{
		this.mime.close();
	}
	
	/**
	 * Returns the filename which was read.
	 *
	 * @return The read filename, {@code null} will be returned if it has
	 * not been read yet or has not been specified.
	 * @since 2018/03/05
	 */
	public final String filename()
	{
		return this._filename;
	}
	
	/**
	 * Returns the UNIX mode of the stream.
	 *
	 * @return The UNIX mode, a negative value will be returned if it has
	 * not been read yet.
	 * @since 2018/03/05
	 */
	public final int mode()
	{
		return this._mode;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/03/05
	 */
	@Override
	public final int read()
		throws IOException
	{
		return this.mime.read();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/11/25
	 */
	@Override
	public final int read(byte[] __b)
		throws IOException
	{
		return this.mime.read(__b);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/03/05
	 */
	@Override
	public final int read(byte[] __b, int __o, int __l)
		throws IndexOutOfBoundsException, IOException, NullPointerException
	{
		return this.mime.read(__b, __o, __l);
	}
	
	/**
	 * This is a sub-reader which handles parsing of the MIME header and
	 * otherwise just passing the data to the MIMECharDecoder instance.
	 *
	 * @since 2018/11/25
	 */
	private final class __SubReader__
		extends Reader
	{
		/** The line-by-line reader for data. */
		protected final BufferedReader in;
		
		/** The input character buffer. */
		private final StringBuilder _sb =
			new StringBuilder(80);
		
		/** The current read in the buffer. */
		private int _at;
		
		/** The current limit of the buffer. */
		private int _limit;
		
		/** Did we read the header? */
		private boolean _didheader;
		
		/** Did we read the footer? */
		private boolean _didfooter;
		
		/**
		 * Initializes the sub-reader for the MIME data.
		 *
		 * @param __in The source reader.
		 * @throws NullPointerException On null arguments.
		 * @since 2018/11/24
		 */
		__SubReader__(Reader __in)
			throws NullPointerException
		{
			if (__in == null)
				throw new NullPointerException("NARG");
			
			this.in = new BufferedReader(__in, 80);
		}
		
		/**
		 * {@inheritDoc}
		 * @since 2018/11/25
		 */
		@Override
		public void close()
			throws IOException
		{
			this.in.close();
		}
		
		/**
		 * {@inheritDoc}
		 * @since 2018/11/25
		 */
		@Override
		public int read()
			throws IOException
		{
			// Read header?
			if (!this._didheader)
				this.__readHeader();
			
			// If the footer was read, this means EOF
			if (this._didfooter)
				return -1;
			
			// Need to read more from the buffer
			int at = this._at,
				limit = this._limit;
			if (at >= limit)
			{
				// Read line next
				if (!this.__readNext())
					return -1;
				
				// Re-read
				at = this._at;
				limit = this._limit;
			}
			
			// Read the next character
			int rv = this._sb.charAt(at);
			this._at = at + 1;
			return rv;
		}
		
		/**
		 * {@inheritDoc}
		 * @since 2018/11/25
		 */
		@Override
		public int read(char[] __c)
			throws IOException
		{
			if (__c == null)
				throw new NullPointerException("NARG");
			
			return this.read(__c, 0, __c.length);
		}
		
		/**
		 * {@inheritDoc}
		 * @since 2018/11/25
		 */
		@Override
		public int read(char[] __c, int __o, int __l)
			throws IOException
		{
			if (__c == null)
				throw new NullPointerException("NARG");
			if (__o < 0 || __l < 0 || (__o + __l) > __c.length)
				throw new IndexOutOfBoundsException("IOOB");
			
			// Read header?
			if (!this._didheader)
				this.__readHeader();
			
			// If the footer was read, this means EOF
			if (this._didfooter)
				return -1;
			
			// Where to read from
			StringBuilder sb = this._sb;
			int at = this._at,
				limit = this._limit;
			
			// Read in all characters
			int rv = 0;
			while (rv < __l)
			{
				// Need to read more?
				if (at >= limit)
				{
					// EOF?
					if (!this.__readNext())
						return (rv == 0 ? -1 : rv);
					
					// Re-read
					at = this._at;
					limit = this._limit;
				}
				
				// Read the next character
				__c[__o++] = sb.charAt(at++);
			}
			
			// Store new at position
			this._at = at;
			
			return rv;
		}
		
		/**
		 * Reads the header information.
		 *
		 * @throws IOException On read errors.
		 * @since 2018/11/25
		 */
		private final void __readHeader()
			throws IOException
		{
			BufferedReader in = this.in;
			
			// {@squirreljme.error BD23 Unexpected end of file while trying
			// to read MIME header.}
			String ln = in.readLine();
			if (ln == null)
				throw new IOException("BD23");
			
			// The header is in this format:
			// begin-base64 <unixmode> <filename>
			// {@squirreljme.error BD24 MIME encoded does not start with
			// MIME header.}
			if (!ln.startsWith("begin-base64"))
				throw new IOException("BD24");
			
			// UNIX mode?
			int fs = ln.indexOf(' ');
			if (fs >= 0)
			{
				int ss = ln.indexOf(' ', fs + 1);
				
				// Decode octal mode bits
				MIMEFileDecoder.this._mode = Integer.parseInt(
					ln.substring(fs + 1, (ss < 0 ? ln.length() : ss)), 8);
				
				// Filename?
				if (ss >= 0)
					MIMEFileDecoder.this._filename =
						ln.substring(ss + 1);
			}
			
			// Set as read
			this._didheader = true;
		}
		
		/**
		 * Reads the next line into the character.
		 *
		 * @return If a line was read.
		 * @throws IOException On read errors.
		 * @since 2018/11/25
		 */
		private final boolean __readNext()
			throws IOException
		{
			// {@squirreljme.error BD25 Unexpected EOF while read the MIME
			// file data.}
			String ln = this.in.readLine();
			if (ln == null)
				throw new IOException("BD25");
			
			// End of MIME data?
			if (ln.equals("===="))
			{
				// Footer was read, so EOF now
				this._didfooter = true;
				
				// Was EOF
				return false;
			}
			
			// Fill buffer
			StringBuilder sb = this._sb;
			sb.setLength(0);
			sb.append(ln);
			
			// Set properties
			this._at = 0;
			this._limit = ln.length();
			
			// Was not EOF
			return true;
		}
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
















































































































































































































































































































































































































































































































































































































































































































































































































































Deleted utils-dev/boot/NewBootstrap.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.IOException;
import java.nio.file.attribute.FileTime;
import java.nio.file.DirectoryStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardCopyOption;
import java.nio.file.StandardOpenOption;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.jar.Attributes;
import java.util.jar.Manifest;
import java.util.Map;
import java.util.regex.Pattern;
import java.util.Set;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
import java.util.zip.ZipOutputStream;

/**
 * This class implements a bootstrap which is capable to build an environment
 * which is capable of building SquirrelJME target binaries.
 *
 * You should only compile and run this class manually if your system is not
 * able to use the pre-existing build scripts. If this is the case then you
 * must set the following system properties:
 *
 * {@code cc.squirreljme.bootstrap.binary} is the location
 * where output binaries are to be placed when they are compiled, along with
 * the bootstrap.
 * {@code cc.squirreljme.builder.root} is the location
 * of the SquirrelJME source tree.
 *
 * @since 2016/10/26
 */
public class NewBootstrap
	implements Runnable
{
	/** Deletes files. */
	public static final Consumer<Path, Object, IOException> DELETE =
		new Consumer<Path, Object, IOException>()
		{
			/**
			 * {@inheritDoc}
			 * @since 2016/10/27
			 */
			@Override
			public void accept(Path __v, Object __s)
				throws IOException
			{
				Files.delete(__v);
			}
		};
	
	/** Returns the latest date. */
	public static final Consumer<Path, Long[], IOException> DATE =
		new Consumer<Path, Long[], IOException>()
		{
			/**
			 * {@inheritDoc}
			 * @since 2016/10/27
			 */
			@Override
			public void accept(Path __v, Long[] __s)
				throws IOException
			{
				// Dates on directories might not truly be valid
				if (Files.isDirectory(__v))
					return;
				
				// Get date
				FileTime ft = Files.getLastModifiedTime(__v);
				long millis = ft.toMillis();
				
				// If it is newer, use that
				if (millis > __s[0])
					__s[0] = millis;
			}
		};
	
	/** Cache of the compiler so it does not need to be read multiple times. */
	private static BootstrapCompiler _javac;
	
	/** The binary path. */
	protected final Path binarypath;
	
	/** The source path. */
	protected final Path sourcepath;
	
	/** The input launch arguments. */
	protected final String[] launchargs;
	
	/** Projects available for usage. */
	protected final Map<String, BuildProject> projects;
	
	/** The output bootstrap binary. */
	protected final Path bootstrapout;
	
	/** The directory where JARs are placed. */
	protected final Path buildjarout;
	
	/**
	 * Initializes the bootstrap base.
	 *
	 * @param __bin The binary output directory.
	 * @param __src The source input namespace directories.
	 * @param __args Arguments to the bootstrap.
	 * @throws IOException On read/write errors.
	 * @throws NullPointerException On null arguments.
	 * @since 2016/10/26
	 */
	public NewBootstrap(Path __bin, Path __src, String[] __args)
		throws IOException, NullPointerException
	{
		// Check
		if (__bin == null || __src == null || __args == null)
			throw new NullPointerException("NARG");
		
		// Set
		this.binarypath = __bin;
		this.sourcepath = __src;
		this.launchargs = __args.clone();
		this.buildjarout = __bin.resolve("bootsjme");
		this.bootstrapout = __bin.resolve("sjmeboot.jar");
		
		// Load all projects in the build directory
		Map<String, BuildProject> projects = new LinkedHashMap<>();
		this.projects = projects;
		
		// Java SE special host libraries
		__loadProjects(projects, __src.resolve("bldt/javase/libs"));
		
		// Run-time projects
		__loadProjects(projects, __src.resolve("runt/apis"));
		__loadProjects(projects, __src.resolve("runt/libs"));
		__loadProjects(projects, __src.resolve("runt/mids"));
		__loadProjects(projects, __src.resolve("runt/klib"));
		__loadProjects(projects, __src.resolve("runt/kmid"));
		
		// JIT-time projects
		__loadProjects(projects, __src.resolve("jitt/libs"));
		
		// Build-time projects
		__loadProjects(projects, __src.resolve("bldt/libs"));
		__loadProjects(projects, __src.resolve("bldt/mids"));
	}
		
	/**
	 * {@inheritDoc}
	 * @since 2016/10/26
	 */
	@Override
	public void run()
	{
		// {@squirreljme.error NB03 The entry point project does not exist.}
		Map<String, BuildProject> projects = this.projects;
		BuildProject bp = projects.get("builder");
		if (bp == null)
			throw new IllegalStateException("NB03");
		
		// Could fail
		Path tempjar = null;
		try
		{
			// Compile JARs to be merged together as one
			Set<BuildProject> mergethese = bp.compile();
			
			// Get the time and date for the JARs to merge
			Path bootjar = this.bootstrapout;
			Long[] out = new Long[1];
			out[0] = Long.MIN_VALUE;
			NewBootstrap.<Long[]>__walk(this.buildjarout, out, DATE);
			long depjartime = out[0];
			
			// Get the time of the output JAR
			long bootjartime;
			if (Files.exists(bootjar))
			{
				out[0] = Long.MIN_VALUE;
				NewBootstrap.<Long[]>__walk(bootjar, out, DATE);
				bootjartime = out[0];
			}
			else
				bootjartime = Long.MIN_VALUE;
			
			// Repackage
			if (bootjartime == Long.MIN_VALUE || depjartime > bootjartime)
			{
				// {@squirreljme.error NB0a Merging output JAR file.}
				System.err.println("NB0a");
				
				// {@squirreljme.error NB0b Expected the entry point boot JAR
				// to be within the merge JAR set.}
				List<BuildProject> mergeorder = new ArrayList<>(mergethese);
				if (!mergeorder.remove(bp))
					throw new RuntimeException("NB0b");
				
				// Make the boot JAR always first
				mergeorder.add(0, bp);
				
				// {@squirreljme.error NB0d Expected the CLDC libraries to be
				// present in the build.}
				BuildProject cldccompact = projects.get("cldc-compact");
				if (!mergeorder.remove(cldccompact))
					throw new RuntimeException("NB0d");
				
				// Make the CLDC compact JAR always last, so that its system
				// entries are always shaded last. This is because they need
				// to be replaced accordingly to operate correctly
				mergeorder.add(cldccompact);
				
				// Create temporary JAR
				tempjar = Files.createTempFile("squirreljme-boot-out", ".jar");
				
				// Open output
				Map<String, BuildProject> shaded = new HashMap<>();
				Map<String, Set<String>> services = new LinkedHashMap<>();
				try (ZipOutputStream zos = new ZipOutputStream(Files.
					newOutputStream(tempjar,
					StandardOpenOption.WRITE, StandardOpenOption.CREATE)))
				{
					// Set no compression because the Simulated JVM does
					// not support ZIP compression (compatibility)
					zos.setLevel(0);
					
					// Copy contents from other JARs
					for (BuildProject dp : mergeorder)
						__mergeInto(dp, zos, dp == bp, services, shaded);
					
					// Write services as needed
					byte[] buf = new byte[512];
					for (Map.Entry<String, Set<String>> e :
						services.entrySet())
					{
						// Write service descriptor
						zos.putNextEntry(
							new ZipEntry("META-INF/services/" + e.getKey()));
			
						// Write classes to provide services for 
						for (String v : e.getValue())
						{
							// Write name followed by \r\n pair
							zos.write(v.getBytes("utf-8"));
							zos.write('\r');
							zos.write('\n');
						}
			
						// Always end in a blank line
						zos.write('\r');
						zos.write('\n');
			
						// Done writing it
						zos.closeEntry();
					}
						
					// Finish it
					zos.finish();
					zos.flush();
				}
				
				// Move it
				Files.move(tempjar, bootjar,
					StandardCopyOption.REPLACE_EXISTING);
			}
		}
		
		// {@squirreljme.error NB04 Failed to compile the bootstrap due to
		// a read/write error.}
		catch (IOException e)
		{
			throw new RuntimeException("NB04", e);
		}
		
		// Cleanup temporary JAR if it was created
		finally
		{
			if (tempjar != null)
				try
				{
					Files.delete(tempjar);
				}
				catch (IOException e)
				{
				}
		}
	}
	
	/**
	 * Loads projects in the given directory and places them into the existing
	 * map if they do not exist.
	 *
	 * @param __t The target project mapping.
	 * @param __p The source path.
	 * @throws IOException On read errors.
	 * @throws NullPointerException On null arguments.
	 * @since 2017/02/20
	 */
	private void __loadProjects(Map<String, BuildProject> __t, Path __p)
		throws IOException, NullPointerException
	{
		// Check
		if (__t == null || __p == null)
			throw new NullPointerException("NARG");
		
		// Go through files
		try (DirectoryStream<Path> ds = Files.newDirectoryStream(__p))
		{
			// Go through all directories
			for (Path p : ds)
			{
				// Must be a directory
				if (!Files.isDirectory(p))
					continue;
			
				// See if the manifest exists
				Path man = p.resolve("META-INF").resolve("MANIFEST.MF");
				if (!Files.exists(man))
					continue;
			
				// Load project
				BuildProject bp = new BuildProject(p, man, this.buildjarout,
					this.projects);
				
				// Add project, but never replace projects (this way the
				// build directory takes priority)
				String pn = bp.projectName();
				if (!__t.containsKey(pn))
					__t.put(bp.projectName(), bp);
			}
		}
	}
	
	/**
	 * Main entry point for the new bootstrap system.
	 *
	 * @param __args Program arguments.
	 * @throws IOException On any read/write errors.
	 * @since 2016/10/26
	 */
	public static void main(String... __args)
		throws IOException
	{
		// Compiling under JamVM fails because it cannot find a resource
		// bundle for the Java compiler
		if (__args != null && __args.length >= 1 &&
			"--toolsflaw".equals(__args[0]))
		{
			__detectToolsFlaw();
			return;
		}
		
		// Get directories for input and output
		Path bin = Paths.get(System.getProperty(
			"cc.squirreljme.bootstrap.binary")),
			src = Paths
			.get(System.getProperty(
			"cc.squirreljme.builder.root"));
		
		// Only build?
		NewBootstrap nb = new NewBootstrap(bin, src, __args);
		
		// Run it
		nb.run();
	}
	
	/**
	 * This method detects if the virtual machine has a flaw where it cannot
	 * find the javac resource because of odd handling of JARs dynamically
	 * loaded at run-time.
	 *
	 * If the flaw needs to have a work-around then a JAR will be printed
	 * to standard output.
	 *
	 * @sine 2018/01/13
	 */
	private static final void __detectToolsFlaw()
	{
		String vmname = System.getProperty("java.vm.name", "");
		
		// JamVM has an issue where when tools.jar is dynamically loaded it
		// will fail to find the named resource. This will cause all
		// compilation with the system Java compiler to fail.
		if (vmname.equalsIgnoreCase("jamvm"))
		{
			// The JAR to locate will be in the specified location, likely
			// /usr/lib/jvm/java-7-openjdk-powerpc/lib/tools.jar
			Path jhome = Paths.get(System.getProperty("java.home", ""));
			
			// Maybe it is here?
			Path mightbe = jhome.resolve("tools.jar");
			if (Files.exists(mightbe))
			{
				System.out.println(mightbe);
				return;
			}
			
			// Try to see if we can get in the library directory
			jhome = jhome.getParent();
			if (jhome != null)
				jhome = jhome.resolve("lib");
				
			// It could be here
			mightbe = jhome.resolve("tools.jar");
			if (Files.exists(mightbe))
			{
				System.out.println(mightbe);
				return;
			}
			
			// These paths will need to be searched for the tools.jar
			// It will be in a path like:
			String[] bootpaths = System.getProperty("sun.boot.class.path", "").
				split(Pattern.quote(
				System.getProperty("path.separator", ":")));
			
			// Go through each path and try to find tools.jar
			for (String rbp : bootpaths)
			{
				Path p = Paths.get(rbp);
				
				// If this refers to a file then try to its directory
				if (!Files.isDirectory(p))
					p = p.getParent();
				
				// Ignore it because it could not be found
				if (p == null || !Files.isDirectory(p))
					continue;
				
				// If there is a tools.jar here, indicate that
				p = p.resolve("tools.jar");
				if (Files.exists(p))
				{
					System.out.println(p);
					return;
				}
			}
		}
	}
	
	/**
	 * Merges the input JAR into the output JAR.
	 *
	 * @param __bp The source.
	 * @param __zos The destination.
	 * @param __useman Use the manifest?
	 * @param __svs Service list.
	 * @param __shade Used to detect shading.
	 * @throws IOException On read/write errors.
	 * @throws NullPointerException On null arguments.
	 * @since 2016/10/28
	 */
	private static void __mergeInto(BuildProject __bp, ZipOutputStream __zos,
		boolean __useman, Map<String, Set<String>> __svs,
		Map<String, BuildProject> __shade)
		throws IOException, NullPointerException
	{
		// Check
		if (__bp == null || __zos == null || __svs == null || __shade == null)
			throw new NullPointerException("NARG");
		
		// Go through the input
		try (ZipInputStream zis = new ZipInputStream(Files.newInputStream(
			__bp.jarout, StandardOpenOption.READ)))
		{
			// Copy all entries
			ZipEntry e;
			byte[] buf = new byte[4096];
			while (null != (e = zis.getNextEntry()))
			{
				// If the entry is the manifest, only use it if it was
				// requested
				String name = e.getName();
				boolean ismanifest;
				if ((ismanifest = name.equals("META-INF/MANIFEST.MF")))
					if (!__useman)
					{
						zis.closeEntry();
						continue;
					}
				
				// This is a service, needs to be handled later
				if (name.startsWith("META-INF/services/") &&
					name.length() > "META-INF/services/".length())
				{
					// Record service to write later
					String k = name.substring("META-INF/services/".length());
					Set<String> into = __svs.get(k);
					if (into == null)
						__svs.put(k, (into = new LinkedHashSet<>()));
					
					// Read in services completely
					byte[] data = null;
					try (ByteArrayOutputStream baos =
						new ByteArrayOutputStream())
					{
						// Copy loop
						for (;;)
						{
							int rc = zis.read(buf);
					
							// EOF?
							if (rc < 0)
								break;
					
							// Write
							baos.write(buf, 0, rc);
						}
						
						// Write in
						baos.flush();
						data = baos.toByteArray();
					}
					
					// Parse the data
					try (BufferedReader br = new BufferedReader(
						new InputStreamReader(new ByteArrayInputStream(data))))
					{
						for (;;)
						{
							String ln = br.readLine();
							
							// EOF?
							if (ln == null)
								break;
							
							// Ignore whitespace and empty lines
							ln = ln.trim();
							if (ln.length() <= 0)
								continue;
							
							// Add service
							into.add(ln);
						}
					}
					
					// Do not write this entry
					continue;
				}
				
				// {@squirreljme.error NB0c The specified entry has been
				// shaded out, an earlier file is taking priority. (The entry;
				// The base project; The current project)}
				BuildProject shadeout = __shade.get(name);
				if (shadeout != null)
				{
					System.err.printf("NB0c %s %s %s%n", e, shadeout.name,
						__bp.name);
					continue;
				}
				__shade.put(name, __bp);
				
				// Write to target
				__zos.putNextEntry(e);
				
				// Input source for where to read actual data
				InputStream sourcedata;
				Manifest realman = null;
				if (!ismanifest || !__useman)
					sourcedata = zis;
				
				// Make a fake manifest which is used instead
				else
				{
					Manifest fakeman = new Manifest(zis);
					Attributes fakeattr = fakeman.getMainAttributes();
					
					// Copy the real manifest so that it is placed in the
					// output tree
					realman = new Manifest(fakeman);
					
					// Move the main-class to a fake class
					fakeattr.putValue("X-SquirrelJME-Booted-Main-Class",
						fakeattr.getValue("Main-Class"));
					
					// Use instead a wrapped main which sets up the CLDC stuff
					// as needed so the run-time functions
					fakeattr.putValue("Main-Class",
						"cc.squirreljme.runtime.javase.Main");
					
					// Read from the fake manifest instead
					try (ByteArrayOutputStream baos = 
						new ByteArrayOutputStream())
					{
						fakeman.write(baos);
						baos.flush();
						
						// Use this manifest as the source instead
						sourcedata = new ByteArrayInputStream(
							baos.toByteArray());
					}
				}
				
				// Copy loop
				for (;;)
				{
					int rc = sourcedata.read(buf);
					
					// EOF?
					if (rc < 0)
						break;
					
					// Write
					__zos.write(buf, 0, rc);
				}
				
				// Close
				__zos.closeEntry();
				zis.closeEntry();
				
				// Write real manifest as backup?
				if (realman != null)
				{
					__zos.putNextEntry(
						new ZipEntry("SQUIRRELJME-BOOTSTRAP.MF"));
					realman.write(__zos);
					__zos.closeEntry();
				}
			}
		}
	}
	
	/**
	 * Walks the given path and calls the given consumer for every file and
	 * directory.
	 *
	 * @param <S> The secondary value to pass.
	 * @param __p The path to walk.
	 * @param __s The secondary value.
	 * @param __c The function to call for paths.
	 * @throws IOException On read errors.
	 * @throws NullPointerException On null arguments, except for the secondary
	 * value.
	 * @since 2016/09/18
	 */
	static <S> void __walk(Path __p, S __s,
		Consumer<Path, S, IOException> __c)
		throws IOException, NullPointerException
	{
		// Check
		if (__p == null || __c == null)
			throw new NullPointerException("NARG");
		
		// If a directory, walk through all the files
		if (Files.isDirectory(__p))
			try (DirectoryStream<Path> ds = Files.newDirectoryStream(__p))
			{
				for (Path s : ds)
					__walk(s, __s, __c);
			}
		
		// Always accept, directories are accepted last since directories
		// cannot be deleted if they are not empty
		__c.accept(__p, __s);
	}
	
	/**
	 * Calculates the name that a file would appear as inside of a ZIP file.
	 *
	 * @param __root The root path.
	 * @param __p The file to add.
	 * @return The ZIP compatible name.
	 * @throws NullPointerException On null arguments.
	 * @since 2016/03/21
	 */
	static String __zipName(Path __root, Path __p)
		throws NullPointerException
	{
		// Check
		if (__root == null || __p == null)
			throw new NullPointerException();
		
		// Calculate relative name
		Path rel = __root.toAbsolutePath().relativize(__p.toAbsolutePath());
		
		// Build name
		StringBuilder sb = new StringBuilder();
		for (Path comp : rel)
		{
			// Prefix slash
			if (sb.length() > 0)
				sb.append('/');
			
			// Add component
			sb.append(comp);
		}
		
		// Return it
		return sb.toString();
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<










































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted utils-dev/boot/README.

1
2
3
This directory contains the bootstrap classes used to enter the
pseudo-environment used to build SquirrelJME.

<
<
<






Deleted utils-dev/boot/StringReader.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

import java.io.Reader;

/**
 * This is a reader which can read from a string.
 *
 * This class is not thread safe.
 *
 * @since 2018/11/04
 */
public class StringReader
	extends Reader
{
	/** The string to read from. */
	protected final String string;
	
	/** The string length. */
	protected final int length;
	
	/** The current position. */
	private int _at;
	
	/**
	 * Initializes the reader.
	 *
	 * @param __s The input string.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/11/04
	 */
	public StringReader(String __s)
		throws NullPointerException
	{
		if (__s == null)
			throw new NullPointerException("NARG");
		
		this.string = __s;
		this.length = __s.length();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/11/04
	 */
	@Override
	public void close()
	{
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/11/04
	 */
	@Override
	public int read(char[] __c, int __o, int __l)
		throws IndexOutOfBoundsException, NullPointerException
	{
		if (__c == null)
			throw new NullPointerException("NARG");
		if (__o < 0 || __l < 0 || (__o + __l) > __c.length)
			throw new IndexOutOfBoundsException("IOOB");
		
		// Determine the current position and string length
		int at = this._at,
			length = this.length,
			left = length - at;
		
		// EOF?
		if (at >= length)
			return -1;
		
		// Can only read so many characters
		String string = this.string;
		int max = Math.min(__l, left),
			limit = at + max;
		for (int o = __o; at < limit; at++, o++)
			__c[o] = string.charAt(at);
		
		// Set position for next time
		this._at = at;
		
		return max;
	}
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






















































































































































































Deleted utils-dev/builderrors.sh.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#!/bin/sh
# ---------------------------------------------------------------------------
# Multi-Phasic Applications: SquirrelJME
#     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
#     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
# ---------------------------------------------------------------------------
# SquirrelJME is under the GNU General Public License v3+, or later.
# See license.mkd for licensing and copyright information.
# ---------------------------------------------------------------------------
# DESCRIPTION: Builds the error file

# Force C locale
export LC_ALL=C

# Directory of this script
__exedir="$(dirname -- "$0")"

# Header
echo "# List of Errors"
echo ""
__old="00"

# Process all errors
"$__exedir/listerror.sh" "$__exedir/.." 2> /dev/null | while read __line
do
	# Code prefix
	__pref="$(echo "$__line" | cut -c 1-2)"
	
	# Did the prefix change?
	if [ "$__old" != "$__pref" ]
	then
		
		# Output
		echo ""
		echo "# "'`'"$__pref"'` -- '"_$("$__exedir/prefixerrortoproject.sh" "$__pref")_"
		echo ""
		__old="$__pref"
	fi
	
	# Extract code and description
	__code="$(echo "$__line" | cut -c 1-4)"
	__desc="$(echo "$__line" | cut -c 5- | sed 's/\([_\*<(\`]\)/\\\1/g')"
	
	# Are there parameters?
	if echo "$__desc" | grep '([^)]*)[ \t]\{1,\}\\<' > /dev/null
	then
		# Extract and remove them
		__parm="$(echo "$__desc" |
			sed 's/^.*(\([^)]*\))[ \t]\{1,\}\\<.*$/\1/g' |
			sed 's/[ \t]\{2,\}/ /g')"
		__desc="$(echo "$__desc" |
			sed 's/([^)]*)[ \t]\{1,\}\\</\\</g' |
			sed 's/[ \t]\{2,\}/ /g')"
		
		# Base output
		echo " * ***"'`'"$__code"'`'"***: $__desc"
		
		# No delimeter?
		__nodelim="$(echo "$__parm" | grep '\;' > /dev/null; echo $?)"
		
		# Output all parameters
		__i=1
		while true
		do
			# Extract item
			__item="$(echo "$__parm" | cut -d ';' -f "$__i" |
				sed 's/^[ \t]*//g;s/[ \t]*$//g')"
			
			# Nothing
			if [ -z "$__item" ]
			then
				break
			fi
			
			# Print it
			echo "   * $__item"
			
			# Increase
			__i="$(expr "$__i" + 1)"
			
			# Stop if no delimeters are used
			if [ "$__nodelim" -ne "0" ]
			then
				break;
			fi
		done
		
	# There are none
	else
		echo " * ***"'`'"$__code"'`'"***: $__desc"
	fi
done

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


























































































































































































Deleted utils-dev/buildwine.sh.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/sh
# ---------------------------------------------------------------------------
# Multi-Phasic Applications: SquirrelJME
#     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
#     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
# ---------------------------------------------------------------------------
# SquirrelJME is under the GNU General Public License v3+, or later.
# See license.mkd for licensing and copyright information.
# ---------------------------------------------------------------------------
# DESCRIPTION: Runs the build system using the Wine version of the compilers
# and run-time instead of one on the native system (used to test cross
# platformness).

# Force C locale
export LC_ALL=C

# Directory of this script
__exedir="$(dirname -- "$0")"

wine cmd.exe /C "$(winepath -w "$__exedir/../build.cmd")" "$@"

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<










































Deleted utils-dev/buildwithcutejavac.sh.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/sh
# ---------------------------------------------------------------------------
# Multi-Phasic Applications: SquirrelJME
#     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
#     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
# ---------------------------------------------------------------------------
# SquirrelJME is under the GNU General Public License v3+, or later.
# See license.mkd for licensing and copyright information.
# ---------------------------------------------------------------------------
# DESCRIPTION: Describe this.

# Force C locale
export LC_ALL=C

# Directory of this script
__exedir="$(dirname -- "$0")"

export JAVA_OPTIONS="-Dnet.multiphasicapps.javac.forcedefault=true \
	-Dcc.squirreljme.builder.output=cute"
"$__exedir/../build.sh" "$@"
exit $?

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<












































Deleted utils-dev/check80col.sh.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/bin/sh
# ---------------------------------------------------------------------------
# Multi-Phasic Applications: SquirrelJME
#     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
#     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
# ---------------------------------------------------------------------------
# SquirrelJME is under the GNU General Public License v3, or later.
# For more information see license.txt.
# ---------------------------------------------------------------------------
# DESCRIPTION: Makes sure that no file exceeds 80 columns

# Force C locale
export LC_ALL=C

# Directory of this script
__exedir="$(dirname -- "$0")"

# Base directory of code
__rootdir="."

# Go through all files
echo "The following files exceed 79 characters" 1>&2
find "$__rootdir" -type f | while read -r __file
do
	# Base file name
	__name="$(basename -- "$__file")"	
	
	# Ignore the fossil file
	if [ "$__name" = "_FOSSIL_" ]
	then
		continue
	fi
	
	# Obtain extension
	__ext=""
		
	# Count number of lines past 80
	__nl="$(expand -t 4 < "$__file" | sed 's/^\(.\{0,79\}\)$//;/^$/d' | \
		wc -l)"
	
	# File has lines above 80
	if [ "$__nl" -ge "1" ]
	then
		# For line count cheat on stderr
		printf '%s' "$__file"
		
		# Cheat space on stderr
		printf '%s' " ($__nl)" 1>&2
		
		# Ending line
		echo
	fi
done

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<












































































































Deleted utils-dev/checkascii.sh.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/sh
# ---------------------------------------------------------------------------
# Multi-Phasic Applications: SquirrelJME
#     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
#     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
# ---------------------------------------------------------------------------
# SquirrelJME is under the GNU General Public License v3, or later.
# For more information see license.txt.
# ---------------------------------------------------------------------------
# DESCRIPTION: Checks for files which do no contain the valid ASCII range.

# Force C locale
export LC_ALL=C

# Directory of this script
__exedir="$(dirname -- "$0")"

# Base directory of code
__rootdir="."

# Go through all files
echo "The following files contain non-ascii characters" 1>&2
find "$__rootdir" -type f | while read -r __file
do
	# Base file name
	__name="$(basename -- "$__file")"	
	
	# Ignore the fossil file
	if [ "$__name" = "_FOSSIL_" ] || [ "$__name" = ".fslckout" ]
	then
		continue
	fi
	
	# Grep it
	if grep -E '[^\x0A\x20-\x7E\t\r]' < "$__file" > /dev/null
	then
		echo "$__file"
	fi
done

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
















































































Deleted utils-dev/clist/cldc.ugz.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
begin-base64 644 cldc.gz
H4sICMsquVYCA2NsZGMAdVbdcusoDL7nYbavcPI77UxSZ+u0ndk7ipWEEwxe
wOnxPv1KgA1O2xtbSCCEfj7p129+4w/SsGV/OoGF5gV4A3ZavlvpaTl4WFjL
hyfd9b72FnibmVXvM3eljAP+oYCtuedhf6bSHlrHQwWZZJtqu/kjoPPSaLaV
Cg5gW+kcLZ+qLCr1FXSy/0mj2bbvPDTlodlN5SK982ClHsVJ0+txSzZujW25
z5peteu7zli8YKOFaaQ+Z2HS9is4V3F9ZouuA90EtyxQeGnBS5EPJN828AeN
qk5L0+vG3YlrbywUPOfAErWx1li26L3Jrl8ao4DrECK2unBbw789aBEXXJB1
K8Wdi98Vd8XTAiu9N+gOjGfjt2RWuc9oQHY9OWIuCpasTNvhjSEfoLMgOG5k
a9MTZ6N7DHi4o4i5MtyzJ6XgzNVCCHCFJ0a2PfctaP9FsDdaop9qj9d8EX7P
PV4w3M29DGOKhnuJZkYXXTCMEG39OVBP2nmuveQhMAXbw3melYUQecE/O6mv
fLxjZzBr9txf2DMa6eUtllot/yusfDbBtjWcYmjCyWdT9+KylaBGRq/UwUi6
uzjatx9g0+8+uauP3yA8C0/cQ2vsEDVVNzRfNsBeeq2DzUh42U7/rCIxiuKt
QfSY+kPeM3L2XHNyT33BNGJYflhM6RdxaFpI1Uyrn6NACWkxbd651bjRsXpw
HloWI00/8xmsL4o4OPINrJsqqhBWHYZoHtI3aX2P+cbFReoUs1zvD1xr43ks
1EyujQhpixWwUUDUcegA0+IChBgNew6RRujpADEnOBg8bgseHamDUVIM7Mjt
GXx5qYUT7iLcpkqfqL976IG9A79mYTyl8fxSzmraaI2hL1PsxfQejubRlBhx
QL+8anSnuJCZhe+NuMIMJ6/afOr56XT71HbSj9LrpMxn3hj5rxjpewEC23gW
ycpSXgTkSFwstTF3KKsSPV38gHbjS5VDHB20wIzQpncBQOeXrOI+dvd3sc81
y2Gq6Rn6oSjtnDezUU3CnqVCd2GK7k0zK2tNzYcc+0UJyqi7fCsbD5V21wDX
e96ooORlz5wkNSlvWin25vYzwOMT6UWxtsoM6oYqkmuJeI9oPASIQyLvmkSo
ftN2JSpMonFYmK//wkupfdHdC0UFjWel827u6NAtWTaQfWdr5rlAO0ybG1ey
OSDw5m0EzNXo/giuahYuP9lYYCg2/HSItIWPCyGqtBq+swZbEI4Itik8OLIK
ZfNAPXCPYPiBFcqW3EkRvDKy4qOmZVgdCa2jDpfgl8Umi6XvrSnSacZWVGl0
Q4Ho35Ir2isKU3svFVt8OE9zRyEdWTsM3rTY826iI26NqzjBYGtVswM1Qljo
jGuSRzJuIArLlCsavHCIyTdn0o3ziacxx2h0COKjx3KUJynuIB/HQBpi6JqQ
shgccc1iGmZSm2CbG2ohM0Cj38Iq9dTYaimBH7m70HPpT6+gf8T8sVxC4kEz
bswr2h5X4anTZzpI22Oqpj5z39sdjrqmowESJnIo4hl9/4LZZ9r0i+mAgGJv
UgA66yTPfWqLof0lyc6EuZlsDB5K7fporqBxerGMUvAfnA8DEZf2yN2VvYUa
Cp1qfHNOoQdlzmcaDPBmh9PtIxqlIg4EOCj8GgU7uCGu7cx5HC+QfAFhbENU
YpDGckaRbacg64qQM2r8H8yl478tDQAA
====
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






























































Deleted utils-dev/debug.sh.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/sh
# ---------------------------------------------------------------------------
# Multi-Phasic Applications: SquirrelJME
#     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
#     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
# ---------------------------------------------------------------------------
# SquirrelJME is under the GNU General Public License v3+, or later.
# See license.mkd for licensing and copyright information.
# ---------------------------------------------------------------------------
# DESCRIPTION: Runs the build command with debugging.

# Force C locale
export LC_ALL=C

# Directory of this script
__exedir="$(dirname -- "$0")"

# Run it
export JAVA_OPTIONS="-zero -agentlib:jdwp=transport=dt_socket,server=y,address=8000"
"$__exedir/../build.sh" "$@"
exit $?

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<












































Deleted utils-dev/debughostedlaunch.sh.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/sh
# ---------------------------------------------------------------------------
# Multi-Phasic Applications: SquirrelJME
#     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
#     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
# ---------------------------------------------------------------------------
# SquirrelJME is under the GNU General Public License v3+, or later.
# See license.mkd for licensing and copyright information.
# ---------------------------------------------------------------------------
# DESCRIPTION: Describe this.

# Force C locale
export LC_ALL=C

# Directory of this script
__exedir="$(dirname -- "$0")"

# Run it
export HOSTED_JAVA_OPTIONS="-zero -agentlib:jdwp=transport=dt_socket,server=y,address=8000"
"$__exedir/hostedlaunch.sh" "$@"
exit $?

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<












































Deleted utils-dev/depends.sh.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/bin/sh
# ---------------------------------------------------------------------------
# Multi-Phasic Applications: SquirrelJME
#     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
#     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
# ---------------------------------------------------------------------------
# SquirrelJME is under the GNU General Public License v3, or later.
# See license.mkd for licensing and copyright information.
# ---------------------------------------------------------------------------
# DESCRIPTION: Prints the dependencies of a project.

# Force C locale
export LC_ALL=C

# Directory of this script
__exedir="$(dirname -- "$0")"

# Project to get dependencies for
if [ "$#" -le "0" ]
then
	__name="$("$__exedir/projectname.sh")"
else
	__name="$1"
fi

# Recursive
__recursive_deps()
{
	# Convert manifest data
	__md="$(tr '\n' '\v' < \
		"$("$__exedir/projectwhere.sh" "$1")/META-INF/MANIFEST.MF" | \
		sed 's/\v //g' | tr '\v' '\n')"
	
	# Get dependencies
	__pd="$(echo "$__md" | grep -i 'x-squirreljme-depends' |
		sed 's/^[^:]*:[ \t]*//' | sed 's/,/ /g')"
	
	# If this is not cldc-compact, depend on it
	if [ "$1" != "cldc-compact" ]
	then
		echo "cldc-compact"
		
		# Depend on the normal CLDC
		if [ "$1" != "cldc" ]
		then
			echo "cldc"
		fi
	fi
		
	# Add them all
	(for __dep in $__pd
	do
		# That dependency
		echo "$__dep"
		
		# Recursive run
		__recursive_deps "$__dep"
	done) | sort | uniq | while read __line
	do
		echo "$__line"
	done
}

# Run
__recursive_deps "$__name" | sort | uniq

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




































































































































Deleted utils-dev/dependspath.sh.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/bin/sh
# ---------------------------------------------------------------------------
# Multi-Phasic Applications: SquirrelJME
#     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
#     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
# ---------------------------------------------------------------------------
# SquirrelJME is under the GNU General Public License v3, or later.
# See license.mkd for licensing and copyright information.
# ---------------------------------------------------------------------------
# DESCRIPTION: Depends as classpath

# Force C locale
export LC_ALL=C

# Directory of this script
__exedir="$(dirname -- "$0")"

# Project to get dependencies for
if [ "$#" -le "0" ]
then
	__name="$("$__exedir/projectname.sh")"
else
	__name="$1"
fi

# Go through them all
__i="0"
"$__exedir/depends.sh" "$__name" | while read __line
do
	# Separator?
	if [ "$__i" -eq "1" ] 
	then
		printf '%s' ":"
	fi
	__i="1"
	
	# Add line
	printf '%s' "bins/$__line.jar"
done
echo ""

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


















































































Deleted utils-dev/errorprefixes.sh.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/sh
# ---------------------------------------------------------------------------
# Multi-Phasic Applications: SquirrelJME
#     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
#     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
# ---------------------------------------------------------------------------
# SquirrelJME is under the GNU General Public License v3, or later.
# See license.mkd for licensing and copyright information.
# ---------------------------------------------------------------------------
# DESCRIPTION: This shows the list of error prefixes.

# Force C locale
export LC_ALL=C

# Directory of this script
__exedir="$(dirname -- "$0")"

# Go through all projects
("$__exedir/lsprojects.sh" | sed 's/\/$//g' | while read __project
do
	__man="$__exedir/../$__project/META-INF/MANIFEST.MF"
	if [ -f "$__man" ]
	then
		__err="$(sed \
			'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' \
			< "$__man" | grep '^X-SQUIRRELJME-ERROR[ \t]*:' |
			sed 's/^X-SQUIRRELJME-ERROR[ \t]*:[ \t]*\([^ \t]*\)[ \t]*/\1/')"
		if [ -n "$__err" ]
		then
			echo "$__err $__project"
		fi
	fi
done) | sort

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




































































Deleted utils-dev/genwebdemo.sh.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/sh
# ---------------------------------------------------------------------------
# Multi-Phasic Applications: SquirrelJME
#     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
#     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
# ---------------------------------------------------------------------------
# SquirrelJME is under the GNU General Public License v3+, or later.
# See license.mkd for licensing and copyright information.
# ---------------------------------------------------------------------------
# DESCRIPTION: Generates the web demo.

# Force C locale
export LC_ALL=C

# Directory of this script
__exedir="$(dirname -- "$0")"

# Demo file location
__demo="webdemo.html"

# Build the web demo
if "$__exedir/../build.sh" "webdemo" "$__demo"
then
	# Go to fossil directory
	cd "$__exedir"
	
	# Update
	fossil uv add "$__demo" --as "webdemo.html"

# Failed
else
	# Fail
	echo "Failed to build the web demo."
	exit 1
fi

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<








































































Deleted utils-dev/githubwikimap.sh.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/sh
# ---------------------------------------------------------------------------
# Multi-Phasic Applications: SquirrelJME
#     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
#     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
# ---------------------------------------------------------------------------
# SquirrelJME is under the GNU General Public License v3+, or later.
# See license.mkd for licensing and copyright information.
# ---------------------------------------------------------------------------
# DESCRIPTION: Maps a file so that it works and links properly in the wiki
# Operates on standard input

# Force C locale
export LC_ALL=C

# Directory of this script
__exedir="$(dirname -- "$0")"

# Newlines to vertical tabs so formatting becomes easier
# Split any markdown kind of looking block to its own line
tr '\n' '\v' | sed 's/(\([^)]*\.mkd\))/(\n@@@@\1\n)/g' |
	sed '/^@@@@.*\.mkd$/s/\//@d@/g' |
	sed '/^@@@@.*\.mkd$/s/-/@h@/g' |
	sed '/^@@@@/s/\.mkd//g' |
	sed 's/^@@@@//g' |
	tr -d '\n' |
	tr '\v' '\n'

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
























































Deleted utils-dev/githubwikiunversionsync.sh.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
#!/bin/sh
# ---------------------------------------------------------------------------
# Multi-Phasic Applications: SquirrelJME
#     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
#     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
# ---------------------------------------------------------------------------
# SquirrelJME is under the GNU General Public License v3+, or later.
# See license.mkd for licensing and copyright information.
# ---------------------------------------------------------------------------
# DESCRIPTION: Pushes everything in the fossil unversioned space to the GitHub
# Wiki.
#
# Note that the GitHub Wiki has severe limitations:
#  * Directories just do not exist in any way when it comes to content.
#  * Links to other Wiki pages are in this format: `
#    `developer-notes_@_stephanie-gawroriski_@_2013_@_12_@_22` which refers to
#    that page, so I believe wiki links need to handle that accordingly.
#    I tested it and that works, so any kind of link to a markdown file must
#    for the most part remove the extension and use the slash form.
#
# So to correct for this, the directory separator is mapped to `_@_` so that
# the given information exists and it can easily be remapped back to
# a directory.

# Force C locale
export LC_ALL=C

# Directory of this script
__exedir="$(dirname -- "$0")"

# Where the working Wiki is stored
__tmp="/tmp/$$"
__cat="/tmp/$$.cat"
__boop="/tmp/$$.boop"

# Need this to better process files
if ! javac -d . "$__exedir/GitHubWikiReformat.java"
then
	echo "Failed to compile Java helper!"
	exit 1
fi

# Clone the Wiki
if ! git clone git@github.com:XerTheSquirrel/SquirrelJME.wiki.git "$__tmp"
then
	echo "Failed to clone the Wiki."
	exit 1
fi

# Map Fossil filename to Git
__fossil_to_git()
{
	if [ "$(basename "$1" .mkd)" = "$1" ]
	then
		echo "$1"
	else
		echo "@@gh@$1" | sed 's/\.mkd$/.md/' | sed 's/\//@d@/g' |
			sed 's/-/@h@/g'
	fi
}

# Map Git filename to Fossil
__git_to_fossil()
{
	if [ "$(basename "$1" .md)" = "$1" ]
	then
		echo "$1"
	else
		echo "$1" | sed 's/\.md$/.mkd/' | sed 's/@d@/\//g' |
			sed 's/@h@/-/g' | sed 's/^@@gh@//g'
	fi
}

# Determine if any files in the git repository need to be deleted
(cd "$__tmp" && git ls-files) | while read __file
do
	# Names are mapped
	__fossilfile="$(__git_to_fossil "$__file")"	
	
	# Need to actually cat the file	since there is no way to check if it is
	# an actual file, an invalid file is just blank
	fossil unversion cat "$__fossilfile" > "$__cat"
	if [ ! -s "$__cat" ]
	then
		echo "Deleting $__file (as $__fossilfile)..."
		if ! (cd "$__tmp" && git rm "$__file")
		then
			echo "Failed to delete file $__file!"
		fi
	fi
done

# Go through the unversioned set of files and add all of the files that exist
fossil unversion ls | while read __file
do
	echo "Storing $__file..."
	
	# Need to map the fossil filename to git
	__gitfile="$(__fossil_to_git "$__file")"	
	
	# The directory needs to exist first!
	mkdir -p $(dirname "$__tmp/$__gitfile")
	mkdir -p $(dirname "$__tmp/$__file")
	fossil unversion cat "$__file" > "$__boop"
	
	echo "Mapping $__file to $__gitfile..."
	
	# If the file is a markdown file then the extensions need to be remapped
	# so everything works, due to GitHub Wiki limitations
	if echo "$__file" | grep '\.mkd$' > /dev/null
	then
		echo "Remapping $__file for GitHub Wiki..."
		java GitHubWikiReformat "$__file" < "$__boop" > "$__tmp/$__gitfile" 
		
		# Make an original copy of it, for record keeping and so it can
		# potentially be reversed
		mv -f -- "$__boop" "$__tmp/$__file"
		
		# Store the original file
		if ! (cd "$__tmp" && git add "$__gitfile")
		then
			echo "Failed to add file $__file (as $__gitfile)!"
		fi
		
	# Otherwise a 1:1 copy
	else
		mv -f -- "$__boop" "$__tmp/$__file" 
	fi
	
	# Add to the changes
	if ! (cd "$__tmp" && git add "$__file")
	then
		echo "Failed to add file $__file (as $__file)!"
	fi 
done

# Commit changes to the repository
if ! (cd "$__tmp" && git commit -v -m "Synchronize Unversion Space" --author "SquirrelJME <nobody@squirreljme.cc>")
then
	echo "Failed to commit!"
fi

# Push changes
if true
then
	if ! (cd "$__tmp" && git push)
	then
		echo "Failed to push!"
	fi
fi

# Cleanup
rm -rf -- "$__tmp"
rm -f -- "$__cat" "$__boop" "$__boop.1" "$__boop.2"



<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


























































































































































































































































































































Deleted utils-dev/hacks/AnInterface.jas.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
; -*- Mode: Jasmin; indent-tabs-mode: t; tab-width: 4 -*-
; ---------------------------------------------------------------------------
; Multi-Phasic Applications: SquirrelJME
;     Copyright (C) 2013-2016 Stephanie Gawroriski <xer@multiphasicapps.net>
;     Copyright (C) 2013-2016 Multi-Phasic Applications <multiphasicapps.net>
; ---------------------------------------------------------------------------
; SquirrelJME is under the GNU General Public License v3+, or later.
; For more information see license.mkd.
; ---------------------------------------------------------------------------

.interface AnInterface
.super java/lang/Object

; Returns an integer
.method public abstract foo()I
.end method


<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




































Deleted utils-dev/hacks/BooleanArrayStore.jas.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
; -*- Mode: Jasmin; indent-tabs-mode: t; tab-width: 4 -*-
; ---------------------------------------------------------------------------
; Multi-Phasic Applications: SquirrelJME
;     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
;     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
; ---------------------------------------------------------------------------
; SquirrelJME is under the GNU General Public License v3+, or later.
; See license.mkd for licensing and copyright information.
; ---------------------------------------------------------------------------
; Output:
; 1
; 0
; 1
; 0
; 1
; 0
; 1

.class BooleanArrayStore
.super java/lang/Object

; Returns the input boolean value
.method public static main([Ljava/lang/String;)V
	.limit locals 42
	.limit stack 42
	
	; Storing seven values here
	bipush 7			; 7
	istore 2			; -
	
	; Create boolean array
	bipush 100			; 100
	newarray boolean	; boolean[]

	; Load loop count, stop at zero
__loopcheck:
	iload 2				; boolean[], #2
	ifeq __loopend		; boolean[]
	
	; Keep the array on the stack
	dup					; boolean[], boolean[]
	
	; Store temporary into array
	bipush 7			; boolean[], boolean[], 7
	iload 2				; boolean[], boolean[], 7, #2
	bastore				; boolean[]
	
	; Load back from array
	dup					; boolean[], boolean[]
	bipush 7			; boolean[], boolean[], 7
	baload				; boolean[], [7]
	
	; Print
						; boolean[], [7], PrintStream
	getstatic java/lang/System/out Ljava/io/PrintStream;
	swap				; boolean[], PrintStream, [7]
						; boolean[]
	invokevirtual java/io/PrintStream/println(I)V
	
	; Decrement local and jump back to loop then
	iinc 2 -1			; boolean[]
	goto __loopcheck	; boolean[]
__loopend:

	; End
	return
.end method

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<








































































































































Deleted utils-dev/hacks/ImplementsAnInterface.jas.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
; -*- Mode: Jasmin; indent-tabs-mode: t; tab-width: 4 -*-
; ---------------------------------------------------------------------------
; Multi-Phasic Applications: SquirrelJME
;     Copyright (C) 2013-2016 Stephanie Gawroriski <xer@multiphasicapps.net>
;     Copyright (C) 2013-2016 Multi-Phasic Applications <multiphasicapps.net>
; ---------------------------------------------------------------------------
; SquirrelJME is under the GNU General Public License v3+, or later.
; For more information see license.mkd.
; ---------------------------------------------------------------------------

.class ImplementsAnInterface
.super java/lang/Object
.implements AnInterface

.method public <init>()V
	.limit stack 3
	aload 0
	invokespecial java/lang/Object/<init>()V
	return
.end method

; Just returns 42
.method public foo()I
	ldc 42
	ireturn
.end method

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






















































Deleted utils-dev/hacks/IntPrimCall.jas.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
; -*- Mode: Jasmin; indent-tabs-mode: t; tab-width: 4 -*-
; ---------------------------------------------------------------------------
; Multi-Phasic Applications: SquirrelJME
;     Copyright (C) 2013-2016 Stephanie Gawroriski <xer@multiphasicapps.net>
;     Copyright (C) 2013-2016 Multi-Phasic Applications <multiphasicapps.net>
; ---------------------------------------------------------------------------
; SquirrelJME is under the GNU General Public License v3+, or later.
; For more information see license.mkd.
; ---------------------------------------------------------------------------
; This is a test of the virtual machine where methods of all the int-based
; primitive types are passed to methods using wide values rather than
; correctly narrowed ones

.class IntPrimCall
.super java/lang/Object

; Returns the input boolean value
.method public static callBoolean(Z)Z
	iload_0
	invokestatic IntPrimCall/printIntValue(I)V
	iload_0
	ireturn
.end method

; Returns the input byte value
.method public static callByte(B)B
	iload_0
	invokestatic IntPrimCall/printIntValue(I)V
	iload_0
	ireturn
.end method

; Returns the input short value
.method public static callShort(S)S
	iload_0
	invokestatic IntPrimCall/printIntValue(I)V
	iload_0
	ireturn
.end method

; Returns the input char value
.method public static callCharacter(C)C
	iload_0
	invokestatic IntPrimCall/printIntValue(I)V
	iload_0
	ireturn
.end method

; Returns the input int value
.method public static callInteger(I)I
	iload_0
	invokestatic IntPrimCall/printIntValue(I)V
	iload_0
	ireturn
.end method

; Prints an integer value
.method public static printInt(I)V
	.limit stack 2
	getstatic java/lang/System/out Ljava/io/PrintStream;
	iload_0
	invokevirtual java/io/PrintStream/println(I)V
	return
.end method

; Prints an integer value
.method public static printIntValue(I)V
	.limit stack 7
	getstatic java/lang/System/out Ljava/io/PrintStream;
	; object
	
	ldc "<0x%08X>: "
	; object string
	
	ldc 1
	; object string int
	
	anewarray Ljava/lang/Object;
	; object string array
	
	dup
	; object string array array
	
	ldc 0
	; object string array array int
	
	iload_0
	; object string array array int int
	
	invokestatic java/lang/Integer/valueOf(I)Ljava/lang/Integer;
	; object string array array int object
	
	aastore
	; object string array
	
	invokevirtual java/io/PrintStream/printf(Ljava/lang/String;[Ljava/lang/Object;)Ljava/io/PrintStream;
	return
.end method

; Prints a string value
.method public static printString(Ljava/lang/String;)V
	.limit stack 3
	getstatic java/lang/System/out Ljava/io/PrintStream;
	dup
	aload_0
	invokevirtual java/io/PrintStream/print(Ljava/lang/String;)V
	ldc ":\t"
	invokevirtual java/io/PrintStream/print(Ljava/lang/String;)V
	return
.end method

; Sends very large values to each method and then prints their resulting
; value
.method public static main([Ljava/lang/String;)V
	; Should be enough, despite lots of waste
	.limit stack 42
	
	; Even
	ldc "boo 0xCAFEBABE"
	invokestatic IntPrimCall/printString(Ljava/lang/String;)V
	ldc 0xCAFEBABE
	invokestatic IntPrimCall/callBoolean(Z)Z
	invokestatic IntPrimCall/printInt(I)V
	
	; Odd
	ldc "boo 0xCAFEBABF"
	invokestatic IntPrimCall/printString(Ljava/lang/String;)V
	ldc 0xCAFEBABF
	invokestatic IntPrimCall/callBoolean(Z)Z
	invokestatic IntPrimCall/printInt(I)V
	
	; Positive unless masked
	ldc "boo 0x7FFFFFFF"
	invokestatic IntPrimCall/printString(Ljava/lang/String;)V
	ldc 0x7FFFFFFF
	invokestatic IntPrimCall/callBoolean(Z)Z
	invokestatic IntPrimCall/printInt(I)V
	
	; bool-even
	ldc "boo 0x7FFFFFFE"
	invokestatic IntPrimCall/printString(Ljava/lang/String;)V
	ldc 0x7FFFFFFE
	invokestatic IntPrimCall/callBoolean(Z)Z
	invokestatic IntPrimCall/printInt(I)V
	
	; byte-pos
	ldc "boo 0x7FFFFF7F"
	invokestatic IntPrimCall/printString(Ljava/lang/String;)V
	ldc 0x7FFFFF7F
	invokestatic IntPrimCall/callBoolean(Z)Z
	invokestatic IntPrimCall/printInt(I)V
	
	;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
	
	; Even
	ldc "byt 0xCAFEBABE"
	invokestatic IntPrimCall/printString(Ljava/lang/String;)V
	ldc 0xCAFEBABE
	invokestatic IntPrimCall/callByte(B)B
	invokestatic IntPrimCall/printInt(I)V
	
	; Odd
	ldc "byt 0xCAFEBABF"
	invokestatic IntPrimCall/printString(Ljava/lang/String;)V
	ldc 0xCAFEBABF
	invokestatic IntPrimCall/callByte(B)B
	invokestatic IntPrimCall/printInt(I)V
	
	; Positive unless masked
	ldc "byt 0x7FFFFFFF"
	invokestatic IntPrimCall/printString(Ljava/lang/String;)V
	ldc 0x7FFFFFFF
	invokestatic IntPrimCall/callByte(B)B
	invokestatic IntPrimCall/printInt(I)V
	
	; bool-even
	ldc "byt 0x7FFFFFFE"
	invokestatic IntPrimCall/printString(Ljava/lang/String;)V
	ldc 0x7FFFFFFE
	invokestatic IntPrimCall/callByte(B)B
	invokestatic IntPrimCall/printInt(I)V
	
	; byte-pos
	ldc "byt 0x7FFFFF7F"
	invokestatic IntPrimCall/printString(Ljava/lang/String;)V
	ldc 0x7FFFFF7F
	invokestatic IntPrimCall/callByte(B)B
	invokestatic IntPrimCall/printInt(I)V
	
	;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
	
	; Even
	ldc "sho 0xCAFEBABE"
	invokestatic IntPrimCall/printString(Ljava/lang/String;)V
	ldc 0xCAFEBABE
	invokestatic IntPrimCall/callShort(S)S
	invokestatic IntPrimCall/printInt(I)V
	
	; Odd
	ldc "sho 0xCAFEBABF"
	invokestatic IntPrimCall/printString(Ljava/lang/String;)V
	ldc 0xCAFEBABF
	invokestatic IntPrimCall/callShort(S)S
	invokestatic IntPrimCall/printInt(I)V
	
	; Positive unless masked
	ldc "sho 0x7FFFFFFF"
	invokestatic IntPrimCall/printString(Ljava/lang/String;)V
	ldc 0x7FFFFFFF
	invokestatic IntPrimCall/callShort(S)S
	invokestatic IntPrimCall/printInt(I)V
	
	; bool-even
	ldc "sho 0x7FFFFFFE"
	invokestatic IntPrimCall/printString(Ljava/lang/String;)V
	ldc 0x7FFFFFFE
	invokestatic IntPrimCall/callShort(S)S
	invokestatic IntPrimCall/printInt(I)V
	
	; byte-pos
	ldc "sho 0x7FFFFF7F"
	invokestatic IntPrimCall/printString(Ljava/lang/String;)V
	ldc 0x7FFFFF7F
	invokestatic IntPrimCall/callShort(S)S
	invokestatic IntPrimCall/printInt(I)V
	
	;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
	
	; Even
	ldc "cha 0xCAFEBABE"
	invokestatic IntPrimCall/printString(Ljava/lang/String;)V
	ldc 0xCAFEBABE
	invokestatic IntPrimCall/callCharacter(C)C
	invokestatic IntPrimCall/printInt(I)V
	
	; Odd
	ldc "cha 0xCAFEBABF"
	invokestatic IntPrimCall/printString(Ljava/lang/String;)V
	ldc 0xCAFEBABF
	invokestatic IntPrimCall/callCharacter(C)C
	invokestatic IntPrimCall/printInt(I)V
	
	; Positive unless masked
	ldc "cha 0x7FFFFFFF"
	invokestatic IntPrimCall/printString(Ljava/lang/String;)V
	ldc 0x7FFFFFFF
	invokestatic IntPrimCall/callCharacter(C)C
	invokestatic IntPrimCall/printInt(I)V
	
	; bool-even
	ldc "cha 0x7FFFFFFE"
	invokestatic IntPrimCall/printString(Ljava/lang/String;)V
	ldc 0x7FFFFFFE
	invokestatic IntPrimCall/callCharacter(C)C
	invokestatic IntPrimCall/printInt(I)V
	
	; byte-pos
	ldc "cha 0x7FFFFF7F"
	invokestatic IntPrimCall/printString(Ljava/lang/String;)V
	ldc 0x7FFFFF7F
	invokestatic IntPrimCall/callCharacter(C)C
	invokestatic IntPrimCall/printInt(I)V
	
	;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
	
	; Even
	ldc "int 0xCAFEBABE"
	invokestatic IntPrimCall/printString(Ljava/lang/String;)V
	ldc 0xCAFEBABE
	invokestatic IntPrimCall/callInteger(I)I
	invokestatic IntPrimCall/printInt(I)V
	
	; Odd
	ldc "int 0xCAFEBABF"
	invokestatic IntPrimCall/printString(Ljava/lang/String;)V
	ldc 0xCAFEBABF
	invokestatic IntPrimCall/callInteger(I)I
	invokestatic IntPrimCall/printInt(I)V
	
	; Positive unless masked
	ldc "int 0x7FFFFFFF"
	invokestatic IntPrimCall/printString(Ljava/lang/String;)V
	ldc 0x7FFFFFFF
	invokestatic IntPrimCall/callInteger(I)I
	invokestatic IntPrimCall/printInt(I)V
	
	; bool-even
	ldc "int 0x7FFFFFFE"
	invokestatic IntPrimCall/printString(Ljava/lang/String;)V
	ldc 0x7FFFFFFE
	invokestatic IntPrimCall/callInteger(I)I
	invokestatic IntPrimCall/printInt(I)V
	
	; byte-pos
	ldc "int 0x7FFFFF7F"
	invokestatic IntPrimCall/printString(Ljava/lang/String;)V
	ldc 0x7FFFFF7F
	invokestatic IntPrimCall/callInteger(I)I
	invokestatic IntPrimCall/printInt(I)V
	
	return
.end method

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






























































































































































































































































































































































































































































































































































































































Deleted utils-dev/hacks/InterfaceA.jas.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
; -*- Mode: Jasmin; indent-tabs-mode: t; tab-width: 4 -*-
; ---------------------------------------------------------------------------
; Multi-Phasic Applications: SquirrelJME
;     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
;     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
; ---------------------------------------------------------------------------
; SquirrelJME is under the GNU General Public License v3+, or later.
; See license.mkd for licensing and copyright information.
; ---------------------------------------------------------------------------

.interface InterfaceA
.super java/lang/Object
.implements InterfaceB

<
<
<
<
<
<
<
<
<
<
<
<
<
<




























Deleted utils-dev/hacks/InterfaceB.jas.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
; -*- Mode: Jasmin; indent-tabs-mode: t; tab-width: 4 -*-
; ---------------------------------------------------------------------------
; Multi-Phasic Applications: SquirrelJME
;     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
;     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
; ---------------------------------------------------------------------------
; SquirrelJME is under the GNU General Public License v3+, or later.
; See license.mkd for licensing and copyright information.
; ---------------------------------------------------------------------------

.interface InterfaceB
.super java/lang/Object
.implements InterfaceA

<
<
<
<
<
<
<
<
<
<
<
<
<
<




























Deleted utils-dev/hacks/InvokeVirtualAnInterface.jas.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
; -*- Mode: Jasmin; indent-tabs-mode: t; tab-width: 4 -*-
; ---------------------------------------------------------------------------
; Multi-Phasic Applications: SquirrelJME
;     Copyright (C) 2013-2016 Stephanie Gawroriski <xer@multiphasicapps.net>
;     Copyright (C) 2013-2016 Multi-Phasic Applications <multiphasicapps.net>
; ---------------------------------------------------------------------------
; SquirrelJME is under the GNU General Public License v3+, or later.
; For more information see license.mkd.
; ---------------------------------------------------------------------------

.class InvokeVirtualAnInterface
.super java/lang/Object

.method public static main([Ljava/lang/String;)V
	.limit stack 42
	
	; Needed for later printing
	getstatic java/lang/System/out Ljava/io/PrintStream;
	
	; Create instance of interface thing
	new ImplementsAnInterface
	dup
	invokespecial ImplementsAnInterface/<init>()V
	
	; Get int value
	invokevirtual AnInterface/foo()I
	;invokeinterface AnInterface/foo()I 1
	
	; Print it
	invokevirtual java/io/PrintStream/println(I)V
	
	; Stop
	return
.end method
	
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






































































Deleted utils-dev/hacks/LCDUIChoiceInsert.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

import javax.microedition.midlet.MIDlet;

import javax.microedition.lcdui.ChoiceGroup;

/**
 * This tests whether insert for choice allows size() or not.
 *
 * @since 2017/08/21
 */
public class LCDUIChoiceInsert
	extends MIDlet
{
	public void destroyApp(boolean __v)
	{
	}
	
	public void startApp()
	{
		ChoiceGroup cg = new ChoiceGroup("Test", ChoiceGroup.EXCLUSIVE);
		
		System.err.println("A");
		cg.insert(cg.size(), "A", null);
		
		System.err.println("B");
		cg.insert(cg.size(), "B", null);
		
		System.err.println("C");
		cg.insert(cg.size() + 1, "C", null);
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


















































































Deleted utils-dev/hacks/SuperA.jas.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
; -*- Mode: Jasmin; indent-tabs-mode: t; tab-width: 4 -*-
; ---------------------------------------------------------------------------
; Multi-Phasic Applications: SquirrelJME
;     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
;     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
; ---------------------------------------------------------------------------
; SquirrelJME is under the GNU General Public License v3+, or later.
; See license.mkd for licensing and copyright information.
; ---------------------------------------------------------------------------

.class SuperA
.super java/lang/Object

.method public <init>()V
	.limit stack 2
	aload_0
	invokespecial java/lang/Object/<init>()V
	return
.end method

.method public foo()V
	.limit stack 2
	getstatic java/lang/System/out Ljava/io/PrintStream;
	ldc "SuperA"
	invokevirtual java/io/PrintStream/println(Ljava/lang/String;)V
	return
.end method

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
























































Deleted utils-dev/hacks/SuperAA.jas.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
; -*- Mode: Jasmin; indent-tabs-mode: t; tab-width: 4 -*-
; ---------------------------------------------------------------------------
; Multi-Phasic Applications: SquirrelJME
;     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
;     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
; ---------------------------------------------------------------------------
; SquirrelJME is under the GNU General Public License v3+, or later.
; See license.mkd for licensing and copyright information.
; ---------------------------------------------------------------------------

.class SuperAA
.super java/lang/Object

.method public <init>()V
	.limit stack 2
	aload_0
	invokespecial java/lang/Object/<init>()V
	return
.end method

.method public foo()V
	.limit stack 2
	getstatic java/lang/System/out Ljava/io/PrintStream;
	ldc "SuperAA"
	invokevirtual java/io/PrintStream/println(Ljava/lang/String;)V
	return
.end method

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
























































Deleted utils-dev/hacks/SuperAB.jas.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
; -*- Mode: Jasmin; indent-tabs-mode: t; tab-width: 4 -*-
; ---------------------------------------------------------------------------
; Multi-Phasic Applications: SquirrelJME
;     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
;     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
; ---------------------------------------------------------------------------
; SquirrelJME is under the GNU General Public License v3+, or later.
; See license.mkd for licensing and copyright information.
; ---------------------------------------------------------------------------

.class abstract SuperAB
.super SuperAA

.method public <init>()V
	.limit stack 2
	aload_0
	invokespecial SuperAA/<init>()V
	return
.end method

.method public foo()V
	.limit stack 2
	getstatic java/lang/System/out Ljava/io/PrintStream;
	ldc "SuperAB"
	invokevirtual java/io/PrintStream/println(Ljava/lang/String;)V
	return
.end method

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
























































Deleted utils-dev/hacks/SuperAC.jas.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
; -*- Mode: Jasmin; indent-tabs-mode: t; tab-width: 4 -*-
; ---------------------------------------------------------------------------
; Multi-Phasic Applications: SquirrelJME
;     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
;     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
; ---------------------------------------------------------------------------
; SquirrelJME is under the GNU General Public License v3+, or later.
; See license.mkd for licensing and copyright information.
; ---------------------------------------------------------------------------

.class SuperAC
.super SuperAB

.method public <init>()V
	.limit stack 2
	aload_0
	invokespecial SuperAB/<init>()V
	return
.end method

.method public foo()V
	.limit stack 2
	getstatic java/lang/System/out Ljava/io/PrintStream;
	ldc "SuperAC"
	invokevirtual java/io/PrintStream/println(Ljava/lang/String;)V
	
	aload_0
	invokespecial SuperAA/foo()V
	return
.end method

.method public static main([Ljava/lang/String;)V
	.limit stack 2
	new SuperAC
	dup
	invokespecial SuperAC/<init>()V
	invokevirtual SuperAC/foo()V
	return
.end method

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
















































































Deleted utils-dev/hacks/SuperB.jas.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
; -*- Mode: Jasmin; indent-tabs-mode: t; tab-width: 4 -*-
; ---------------------------------------------------------------------------
; Multi-Phasic Applications: SquirrelJME
;     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
;     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
; ---------------------------------------------------------------------------
; SquirrelJME is under the GNU General Public License v3+, or later.
; See license.mkd for licensing and copyright information.
; ---------------------------------------------------------------------------

.class abstract SuperB
.super SuperA

.method public <init>()V
	.limit stack 2
	aload_0
	invokespecial SuperA/<init>()V
	return
.end method

.method public abstract foo()V
.end method
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<












































Deleted utils-dev/hacks/SuperBA.jas.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
; -*- Mode: Jasmin; indent-tabs-mode: t; tab-width: 4 -*-
; ---------------------------------------------------------------------------
; Multi-Phasic Applications: SquirrelJME
;     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
;     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
; ---------------------------------------------------------------------------
; SquirrelJME is under the GNU General Public License v3+, or later.
; See license.mkd for licensing and copyright information.
; ---------------------------------------------------------------------------

.class SuperBA
.super java/lang/Object

.method public <init>()V
	.limit stack 2
	aload_0
	invokespecial java/lang/Object/<init>()V
	return
.end method

.method public foo()V
	.limit stack 2
	getstatic java/lang/System/out Ljava/io/PrintStream;
	ldc "SuperBA"
	invokevirtual java/io/PrintStream/println(Ljava/lang/String;)V
	return
.end method

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
























































Deleted utils-dev/hacks/SuperBB.jas.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
; -*- Mode: Jasmin; indent-tabs-mode: t; tab-width: 4 -*-
; ---------------------------------------------------------------------------
; Multi-Phasic Applications: SquirrelJME
;     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
;     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
; ---------------------------------------------------------------------------
; SquirrelJME is under the GNU General Public License v3+, or later.
; See license.mkd for licensing and copyright information.
; ---------------------------------------------------------------------------

.class abstract SuperBB
.super SuperBA

.method public <init>()V
	.limit stack 2
	aload_0
	invokespecial SuperBA/<init>()V
	return
.end method

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<








































Deleted utils-dev/hacks/SuperBC.jas.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
; -*- Mode: Jasmin; indent-tabs-mode: t; tab-width: 4 -*-
; ---------------------------------------------------------------------------
; Multi-Phasic Applications: SquirrelJME
;     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
;     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
; ---------------------------------------------------------------------------
; SquirrelJME is under the GNU General Public License v3+, or later.
; See license.mkd for licensing and copyright information.
; ---------------------------------------------------------------------------

.class SuperBC
.super SuperBB

.method public <init>()V
	.limit stack 2
	aload_0
	invokespecial SuperBB/<init>()V
	return
.end method

.method public foo()V
	.limit stack 2
	getstatic java/lang/System/out Ljava/io/PrintStream;
	ldc "SuperBC"
	invokevirtual java/io/PrintStream/println(Ljava/lang/String;)V
	
	aload_0
	invokespecial SuperBA/foo()V
	return
.end method

.method public static main([Ljava/lang/String;)V
	.limit stack 2
	new SuperBC
	dup
	invokespecial SuperBC/<init>()V
	invokevirtual SuperBC/foo()V
	return
.end method

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
















































































Deleted utils-dev/hacks/SuperC.jas.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
; -*- Mode: Jasmin; indent-tabs-mode: t; tab-width: 4 -*-
; ---------------------------------------------------------------------------
; Multi-Phasic Applications: SquirrelJME
;     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
;     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
; ---------------------------------------------------------------------------
; SquirrelJME is under the GNU General Public License v3+, or later.
; See license.mkd for licensing and copyright information.
; ---------------------------------------------------------------------------

.class SuperC
.super SuperB

.method public <init>()V
	.limit stack 2
	aload_0
	invokespecial SuperB/<init>()V
	return
.end method

.method public foo()V
	.limit stack 2
	getstatic java/lang/System/out Ljava/io/PrintStream;
	ldc "SuperC"
	invokevirtual java/io/PrintStream/println(Ljava/lang/String;)V
	
	aload_0
	invokespecial SuperA/foo()V
	return
.end method

.method public static main([Ljava/lang/String;)V
	.limit stack 2
	new SuperC
	dup
	invokespecial SuperC/<init>()V
	invokevirtual SuperC/foo()V
	return
.end method

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
















































































Deleted utils-dev/hacks/a/NewProtected.jas.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
; -*- Mode: Jasmin; indent-tabs-mode: t; tab-width: 4 -*-
; ---------------------------------------------------------------------------
; Multi-Phasic Applications: SquirrelJME
;     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
;     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
; ---------------------------------------------------------------------------
; SquirrelJME is under the GNU General Public License v3+, or later.
; See license.mkd for licensing and copyright information.
; ---------------------------------------------------------------------------
; This constructs a/ProtectedConstructorA and b/ProtectedConstructorB to
; see if running works.

.class a/NewProtected
.super java/lang/Object

.method public static main([Ljava/lang/String;)V
	.limit stack 42
	
	; Use new on a protected class in this package
	getstatic java/lang/System/out Ljava/io/PrintStream;
	new a/ProtectedConstructorA
	dup
	invokespecial a/ProtectedConstructorA/<init>()V
	invokevirtual java/io/PrintStream/println(Ljava/lang/Object;)V
	
	; Use new on a protected class in another package
	getstatic java/lang/System/out Ljava/io/PrintStream;
	new b/ProtectedConstructorB
	dup
	invokespecial b/ProtectedConstructorB/<init>()V
	invokevirtual java/io/PrintStream/println(Ljava/lang/Object;)V
	
	; Done
	return
.end method

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<








































































Deleted utils-dev/hacks/a/ProtectedConstructorA.jas.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
; -*- Mode: Jasmin; indent-tabs-mode: t; tab-width: 4 -*-
; ---------------------------------------------------------------------------
; Multi-Phasic Applications: SquirrelJME
;     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
;     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
; ---------------------------------------------------------------------------
; SquirrelJME is under the GNU General Public License v3+, or later.
; See license.mkd for licensing and copyright information.
; ---------------------------------------------------------------------------

.class a/ProtectedConstructorA
.super java/lang/Object

.method protected <init>()V
	.limit stack 3
	
	; Construct
	aload 0
	invokespecial java/lang/Object/<init>()V
	
	; Note
	getstatic java/lang/System/out Ljava/io/PrintStream;
	ldc "Constructor A"
	invokevirtual java/io/PrintStream/println(Ljava/lang/Object;)V
	
	; Done
	return
.end method

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


























































Deleted utils-dev/hacks/b/ProtectedConstructorB.jas.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
; -*- Mode: Jasmin; indent-tabs-mode: t; tab-width: 4 -*-
; ---------------------------------------------------------------------------
; Multi-Phasic Applications: SquirrelJME
;     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
;     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
; ---------------------------------------------------------------------------
; SquirrelJME is under the GNU General Public License v3+, or later.
; See license.mkd for licensing and copyright information.
; ---------------------------------------------------------------------------

.class b/ProtectedConstructorB
.super java/lang/Object

.method protected <init>()V
	.limit stack 3
	
	; Construct
	aload 0
	invokespecial java/lang/Object/<init>()V
	
	; Note
	getstatic java/lang/System/out Ljava/io/PrintStream;
	ldc "Constructor B"
	invokevirtual java/io/PrintStream/println(Ljava/lang/Object;)V
	
	; Done
	return
.end method

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


























































Deleted utils-dev/hacks/jadize.sh.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#!/bin/sh
# ---------------------------------------------------------------------------
# Multi-Phasic Applications: SquirrelJME
#     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
#     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
# ---------------------------------------------------------------------------
# SquirrelJME is under the GNU General Public License v3+, or later.
# See license.mkd for licensing and copyright information.
# ---------------------------------------------------------------------------
# DESCRIPTION: This compiles the specified program and turns it into a JAD.

# Force C locale
export LC_ALL=C

# Directory of this script
__exedir="$(dirname -- "$0")"

# Check
if [ "$#" -ne "1" ]
then
	echo "Usage: $0 (file.jas/file.java)" 1>&2
	exit 1
fi

# Determine names
__jav="$(basename "$1" .java)"
__jas="$(basename "$1" .jas)"
__bas="$(basename "$(basename "$1" .java)" .jas)"
__cls="$__bas.class"
__jar="$__bas.jar"
__jad="$__bas.jad"

# Compiling Java source?
if [ "$__bas" = "$__jav" ]
then
	# Compile some base SquirrelJME APIs needed to run some of these
	for __api in midp-lcdui
	do
		if ! "$__exedir/../../build.sh" build "$__api"
		then
			echo "Failed to compile API $__api" 1>&2
			exit 5
		fi
	done
	
	# Compile
	if ! javac -source 1.3 -target 1.3 -d "." \
		-cp "$("$__exedir/../binscp.sh")" "$1"
	then
		echo "Failed to compile $1" 1>&2
		exit 4
	fi

# Assembling byte code
elif [ "$__bas" = "$__jas" ]
then
	if ! jasmin -d . "$1" 
	then
		echo "Failed to assemble $1" 1>&2
		exit 3
	fi

# Unknown?
else
	echo "Do not know how to compile $1" 1>&2
	exit 2
fi

# Create manifest
echo "Manifest-Version: 1.0
MIDlet-1: $__bas,,$__bas
MIDlet-Name: $__bas
MIDlet-Vendor: $__bas
MIDlet-Version: 1.0
MicroEdition-Configuration: CLDC-1.1
MicroEdition-Profile: MIDP-2.0
" > "$__jad"

# Create JAR file
if ! jar cfm "$__jar" "$__jad" "$__cls"
then
	echo "Failed to create JAR $__jar" 1>&2
	exit 6
fi

# Recreate a valid JAD
echo "Manifest-Version: 1.0
MIDlet-1: $__bas,,$__bas
MIDlet-Name: $__bas
MIDlet-Vendor: $__bas
MIDlet-Version: 1.0
MIDlet-Jar-URL: $__jar
MIDlet-Jar-Size: $(stat -c %s "$__jar")
MicroEdition-Configuration: CLDC-1.1
MicroEdition-Profile: MIDP-2.0
" > "$__jad"

# Note
echo "Built $__jar and $__jad" 1>&2
exit 0

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<










































































































































































































Deleted utils-dev/hostedlaunch.sh.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
#!/bin/sh
# ---------------------------------------------------------------------------
# Multi-Phasic Applications: SquirrelJME
#     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
#     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
# ---------------------------------------------------------------------------
# SquirrelJME is under the GNU General Public License v3+, or later.
# See license.mkd for licensing and copyright information.
# ---------------------------------------------------------------------------
# DESCRIPTION: Runs a target project or JAR in a hosted environment.

# Force C locale
export LC_ALL=C

# Directory of this script
__exedir="$(dirname -- "$0")"

# May be replaced
: ${JAVA:=java}

__print_usage()
{
	echo "Usage: $0 [-w] [-p #] (project[:#]|file.jar)" 1>&2
	echo "" 1>&2
	echo "  [-w]   Run with Wine instead" 1>&2
	echo "  [-p #] Can be 0 or greater to specify that an alternative" 1>&2
	echo "         application be used for a given program." 1>&2
}

# Usage
if [ "$#" -lt 1 ]
then
	__print_usage
	exit 1
fi

# Parse arguments
__javacmd="$JAVA"
__sepchar=":"
__numb=-1
while getopts wp: __opt
do
	case "$__opt" in
		w)
			__javacmd="$__exedir/winejava.sh"
			__sepchar=";"
			;;
		
		p)
			__numb="$OPTARG"
			;;
		
		*)
			__print_usage
			exit 1
			;;
	esac
done

# Done
shift $(($OPTIND - 1))

# File is the first one
__file="$1"
shift

__proj="$(basename "$__file" .jar | sed 's/:[0-9]\{1,\}$//')"

# The file to run
if [ -f "$__file" ]
then
	__run="$__file"
elif [ -f "bins/bbld/$__proj.jar" ]
then
	__run="bins/bbld/$__proj.jar"
else
	__run="$__file"
fi

# Attempt building it if it has not been detected to be a normal JAR but a
# standard project
if [ ! -f "$__file" ]
then
	if ! "$__exedir/../build.sh" build -b "$__proj"
	then
		echo "Could not build $__proj." 1>&2
		exit 1
	fi

# Build these projects because they are standard and may be relied upon for
# running a given file
else
	for __maybe in midp-lcdui meep-rms media-api
	do
		if ! "$__exedir/../build.sh" build -b "$__maybe"
		then
			echo "Failed to build $__maybe" 1>&2
			exit 1
		fi
	done
fi

# Generates classpath
__gen_classpath()
{
	__rv=""
	
	# Prepend target if it exists
	if [ -f "$1" ]
	then
		__rv="$1"
	fi
	
	# Build classpath
	for __jar in sjmeboot.jar bins/bbld/*.jar
	do
		if [ "$__rv" != "" ]
		then
			__rv="$__rv$__sepchar"
		fi
		
		# Append
		__rv="$__rv$__jar"
	done
	
	# Use it
	echo "$__rv"
}

# Run the JVM with the bootstrap followed
__main="$("$__exedir/mainclass.sh" "$__run")"
"$__javacmd" -classpath "$(__gen_classpath "$__run")" \
	$HOSTED_JAVA_OPTIONS \
	$JAVA_OPTIONS \
	"-Dcc.squirreljme.builder.root=$__exedir/.." \
	"-Dcc.squirreljme.runtime.javase.servermain=$__main" \
	"-Dcc.squirreljme.runtime.javase.program=$__numb" \
	"-Dcc.squirreljme.runtime.javase.file=$__file" \
	cc.squirreljme.runtime.javase.Main "$@"
exit $?

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


























































































































































































































































































Deleted utils-dev/listerror.sh.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/sh
# ---------------------------------------------------------------------------
# Multi-Phasic Applications: SquirrelJME
#     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
#     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
# ---------------------------------------------------------------------------
# SquirrelJME is under the GNU General Public License v3, or later.
# See license.mkd for licensing and copyright information.
# ---------------------------------------------------------------------------
# DESCRIPTION: This scans all source files for special JavaDoc tags which
# describe what the error codes mean.

# Force C locale
export LC_ALL=C

# Directory of this script
__exedir="$(dirname -- "$0")"

# Allow a custom directory to be specified
if [ "$#" -ge "1" ]
then
	__dir="$1"
else
	__dir="$(pwd)"
fi

# Get the directory of the project
__base="$("$__exedir/projectbase.sh" "$__dir")"

# Print error code, potentially
echo "******** LIST OF ERRORS *********" 1>&2
if [ -f "$__base/META-INF/MANIFEST.MF" ]
then
	__code="$(grep -i 'x-squirreljme-error' < "$__base/META-INF/MANIFEST.MF" |
		cut -d ':' -f 2 | tr -d ' ')"
	
	echo "Project Error Code: $__code" 1>&2
fi

# List errors
(grep -rl '{@squirreljme\.error[ \t]\{1,\}....' "$__base" | \
	grep -e '\.java$' -e '\.c$' -e '\.h$' | while read __file
do
	tr '\n' '\f' < "$__file" | sed 's/{@code[ \t]\{1,\}\([^}]*\)}/\1/g' |
		sed 's/{@squirreljme\.error[ \t]\{1,\}\([^}]*\)}/\v##ER \1 ##FI\v/g' |
		sed 's/\/\///g' | sed 's/\/\*//g' | tr '\v' '\n' |
		grep '##ER' | sed 's/^##ER[ \t]*//g' |
		sed 's/##FI/<'"$(basename $__file)"'>/g' |
		sed 's/\f[ \t]*\*[ \t]*/ /g' |
		tr '\f' ' '| sed 's/[ \t\f]\{2,\}/ /g'
done) | sort | uniq
echo "*********************************" 1>&2

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<










































































































Deleted utils-dev/longclass.sh.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/bin/sh
# ---------------------------------------------------------------------------
# Multi-Phasic Applications: SquirrelJME
#     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
#     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
# ---------------------------------------------------------------------------
# SquirrelJME is under the GNU General Public License v3+, or later.
# See license.mkd for licensing and copyright information.
# ---------------------------------------------------------------------------
# DESCRIPTION: This takes a file and determines the name of the class in its
# full form.

# Force C locale
export LC_ALL=C

# Directory of this script
__exedir="$(dirname -- "$0")"

while [ "$#" -ge "1" ]
do
	echo "$("$__exedir/packageidentifier.sh" "$1").$(
		basename -- "$1" .java)"
	
	# Handle more arguments
	shift
done

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






















































Deleted utils-dev/longclasses.sh.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/sh
# ---------------------------------------------------------------------------
# Multi-Phasic Applications: SquirrelJME
#     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
#     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
# ---------------------------------------------------------------------------
# SquirrelJME is under the GNU General Public License v3+, or later.
# See license.mkd for licensing and copyright information.
# ---------------------------------------------------------------------------
# DESCRIPTION: This scans the directory tree for classes which are really
# long and have really long names, it will list them all.

# Force C locale
export LC_ALL=C

# Directory of this script
__exedir="$(dirname -- "$0")"

find "$__exedir/.." -type f | grep '\.java$' | while read __file
do
	__classname="$("$__exedir/longclass.sh" "$__file")"
	__charlen="$(printf '%s' "$__classname" | wc -c)"
	
	# SquirrelJME forces 79 columns, so this means
	# "import ;" causes a loss of 8 from 79, so characters cannot exceed
	# 71, otherwise it is too long. But for consistency this will be 70
	if [ "$__charlen" -ge "70" ]
	then
		echo "$__classname ($__charlen) <$("$__exedir/projectname.sh" "$__file")>"
	fi
done

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
































































Deleted utils-dev/lsall.sh.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/sh
# ---------------------------------------------------------------------------
# Multi-Phasic Applications: SquirrelJME
#     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
#     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
# ---------------------------------------------------------------------------
# SquirrelJME is under the GNU General Public License v3, or later.
# See license.mkd for licensing and copyright information.
# ---------------------------------------------------------------------------
# DESCRIPTION: List all files in all namespaces

# Force C locale
export LC_ALL=C

# Directory of this script
__exedir="$(dirname -- "$0")"

# Find files in all namespaces
for __ns in $("$__exedir/lsnamespaces.sh")
do
	find "$__exedir/../$__ns" -type f
done

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<














































Deleted utils-dev/lsnamespaces.sh.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/sh
# ---------------------------------------------------------------------------
# Multi-Phasic Applications: SquirrelJME
#     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
#     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
# ---------------------------------------------------------------------------
# SquirrelJME is under the GNU General Public License v3, or later.
# See license.mkd for licensing and copyright information.
# ---------------------------------------------------------------------------
# DESCRIPTION: This lists the namespaces which are available

# Force C locale
export LC_ALL=C

# Directory of this script
__exedir="$(dirname -- "$0")"

# Allow a custom root to be specified
if [ "$#" -ge "1" ]
then
	__root="$1"
else
	__root="$__exedir/.."
fi

# Old SquirrelJME layout which appears before x-date-201611
if [ -d "$__root/src" ]
then
	echo "src"
	
# Modern SquirrelJME
else
	# Scan every directory for namespaces
	(find "$__root" -type d | while read __dir
	do
		if [ -f "$__dir/NAMESPACE.MF" ]
		then
			"$__exedir/relative.sh" "$__root" "$__dir"
		fi
	done) | sort
fi

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




















































































Deleted utils-dev/lsprojects.sh.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/sh
# ---------------------------------------------------------------------------
# Multi-Phasic Applications: SquirrelJME
#     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
#     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
# ---------------------------------------------------------------------------
# SquirrelJME is under the GNU General Public License v3+, or later.
# See license.mkd for licensing and copyright information.
# ---------------------------------------------------------------------------
# DESCRIPTION: List all relative projects from the base of the source code.

# Force C locale
export LC_ALL=C

# Directory of this script
__exedir="$(dirname -- "$0")"

# Allow a custom root to be specified
if [ "$#" -ge "1" ]
then
	__root="$1"
else
	__root="$__exedir/.."
fi

# Go through all namespaces
("$__exedir/lsnamespaces.sh" "$__root" | while read __dir
do
	# And directories within the namespaces
	for __file in "$__root/$__dir/"*
	do
		# Ignore non-directories
		if [ ! -d "$__file" ]
		then
			continue
		fi
		
		# If there is a project here, print that directory
		if [ -f "$__file/META-INF/MANIFEST.MF" ] ||
			[ -f "$__file/META-INF/TEST.MF" ]
		then
			"$__exedir/relative.sh" "$__root" "$__file"
		fi
	done
done) | sort

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




























































































Deleted utils-dev/mainclass.sh.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/sh
# ---------------------------------------------------------------------------
# Multi-Phasic Applications: SquirrelJME
#     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
#     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
# ---------------------------------------------------------------------------
# SquirrelJME is under the GNU General Public License v3+, or later.
# See license.mkd for licensing and copyright information.
# ---------------------------------------------------------------------------
# DESCRIPTION: Prints the main class for a project.

# Force C locale
export LC_ALL=C

# Directory of this script
__exedir="$(dirname -- "$0")"

# Print program usage
if [ "$#" -lt "1" ]
then
	echo "Usage: $0 [program]" 1>&2
	exit 1
fi

(if [ -f "$1" ]
then
	unzip -p "$1" META-INF/MANIFEST.MF
else
	__base="$("$__exedir/projectwhere.sh" "$1")"
	if [ -f "$__base/META-INF/TEST.MF" ]
	then
		echo "Main-Class: cc.squirreljme.tests._$(basename -- "$__base" .test |
			sed 's/-/_/g').MainTest"
	else
		cat "$__base/META-INF/MANIFEST.MF"
	fi
fi ) | tr -d '\r' | tr '\n' '|' | sed 's/| //g' | tr '|' '\n' | \
	while read __line
do
	echo "$__line" | grep -i '^ *main-class' | cut -d ':' -f 2 | \
		sed 's/^ *//g;s/ *$//g'
	echo "$__line" | grep -i '^ *midlet-1' | cut -d ':' -f 2 | \
		cut -d ',' -f 3 | sed 's/^ *//g;s/ *$//g'
done | sort | head -n 1


<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




























































































Deleted utils-dev/namespacebase.sh.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/sh
# ---------------------------------------------------------------------------
# Multi-Phasic Applications: SquirrelJME
#     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
#     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
# ---------------------------------------------------------------------------
# SquirrelJME is under the GNU General Public License v3+, or later.
# See license.mkd for licensing and copyright information.
# ---------------------------------------------------------------------------
# DESCRIPTION: Prints the base directory of a namespace.

# Force C locale
export LC_ALL=C

# Directory of this script
__exedir="$(dirname -- "$0")"

# Get the base to use
if [ "$#" -eq "0" ]
then
	__base="$(pwd)"
else
	__base="$1"
fi

# Keep adding .. until the version identifier is found
# Include two sets of .. in the event that we are in a given namespace
# Also try others since we may be in the namespace root.
while true
do
	__base="$("$__exedir/absolute.sh" "$__base")"
	
	# Find the manifest for a project
	__above="$("$__exedir/absolute.sh" "$__base/../")"
	if [ -f "$__base/NAMESPACE.MF" ] ||
		[ -f "$__above/TIMESPACE.MF" ] ||
		[ -f "$__above/squirreljme-version" ] ||
		[ -f "$__base/squirreljme-version" ] ||
		[ "$__base" = "/" ]
	then
		echo "$__base"
		break
	fi
	
	# Otherwise go up
	__base="$__base/.."
done

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
































































































Deleted utils-dev/namespacename.sh.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/sh
# ---------------------------------------------------------------------------
# Multi-Phasic Applications: SquirrelJME
#     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
#     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
# ---------------------------------------------------------------------------
# SquirrelJME is under the GNU General Public License v3+, or later.
# See license.mkd for licensing and copyright information.
# ---------------------------------------------------------------------------
# DESCRIPTION: Prints the name of the namespace.

# Force C locale
export LC_ALL=C

# Directory of this script
__exedir="$(dirname -- "$0")"

# Target a given directory or not
if [ "$#" -eq "0" ]
then
	__dir="$(pwd)"
else
	__dir="$1"
fi

# The namespace name is the last component of the base directory
"$__exedir/namespacebase.sh" "$__dir" | sed 's/.*\/\(.*\)$/\1/'

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
























































Deleted utils-dev/nexterror.sh.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
#!/bin/sh
# ---------------------------------------------------------------------------
# Multi-Phasic Applications: SquirrelJME
#     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
#     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
# ---------------------------------------------------------------------------
# SquirrelJME is under the GNU General Public License v3, or later.
# See license.mkd for licensing and copyright information.
# ---------------------------------------------------------------------------
# DESCRIPTION: Find the next error code that is available.

# Force C locale
export LC_ALL=C

# Directory of this script
__exedir="$(dirname -- "$0")"

# Letter to number
__letter_to_number()
{
	case "$1" in
		A) __num="0";;
		B) __num="1";;
		C) __num="2";;
		D) __num="3";;
		E) __num="4";;
		F) __num="5";;
		G) __num="6";;
		H) __num="7";;
		I) __num="8";;
		J) __num="9";;
		K) __num="10";;
		L) __num="11";;
		M) __num="12";;
		N) __num="13";;
		O) __num="14";;
		P) __num="15";;
		Q) __num="16";;
		R) __num="17";;
		S) __num="18";;
		T) __num="19";;
		U) __num="20";;
		V) __num="21";;
		W) __num="22";;
		X) __num="23";;
		Y) __num="24";;
		Z) __num="25";;
		*) __num="0";;
	esac
	
	# Print it
	echo "$__num"
}

# Converts a number to a letter
__number_to_letter()
{
	case "$1" in
		0) __let="A";;
		1) __let="B";;
		2) __let="C";;
		3) __let="D";;
		4) __let="E";;
		5) __let="F";;
		6) __let="G";;
		7) __let="H";;
		8) __let="I";;
		9) __let="J";;
		10) __let="K";;
		11) __let="L";;
		12) __let="M";;
		13) __let="N";;
		14) __let="O";;
		15) __let="P";;
		16) __let="Q";;
		17) __let="R";;
		18) __let="S";;
		19) __let="T";;
		20) __let="U";;
		21) __let="V";;
		22) __let="W";;
		23) __let="X";;
		24) __let="Y";;
		25) __let="Z";;
		*) __num="A";;
	esac
	
	# Print it
	echo "$__let"
}

# Letter pair to number
__pair_to_number()
{
	__a="$(echo "$1" | cut -c 1)"
	__b="$(echo "$1" | cut -c 2)"
	
	# Convert
	expr $(expr "$(__letter_to_number $__a)" '*' "26") '+' \
		"$(__letter_to_number $__b)"
}

# Pair to number
__number_to_pair()
{
	__hi="$(expr "$1" / 26)"
	__lo="$(expr "$1" % 26)"
	
	# Convert
	echo "$(__number_to_letter $__hi)$(__number_to_letter $__lo)"
}

# Prefixes with banned prefixes
__prefixes()
{
	# Print banned ones
	echo "AN banned"
	echo "AS banned"
	echo "BJ banned"
	echo "BS banned"
	echo "FC banned"
	echo "FK banned"
	echo "FU banned"
	echo "NB banned"
	
	# Reserved for user usage
	echo "UA reserved"
	echo "UB reserved"
	echo "UC reserved"
	echo "UD reserved"
	echo "UE reserved"
	echo "UF reserved"
	echo "UG reserved"
	echo "UH reserved"
	echo "UI reserved"
	echo "UJ reserved"
	echo "UK reserved"
	echo "UL reserved"
	echo "UM reserved"
	echo "UN reserved"
	echo "UO reserved"
	echo "UP reserved"
	echo "UQ reserved"
	echo "UR reserved"
	echo "US reserved"
	echo "UT reserved"
	echo "UU reserved"
	echo "UV reserved"
	echo "UW reserved"
	echo "UX reserved"
	echo "UY reserved"
	echo "UZ reserved"
	
	# Print normals
	"$__exedir/errorprefixes.sh"
}

# The last number used
__last="0"

# Go through error code list
__prefixes | sort | while read __line
do
	# Get code and extract number from it
	__code="$(echo "$__line" | cut -d ' ' -f 1)"
	__numb="$(__pair_to_number $__code)"
	
	echo "$__numb"
done | while read __number
do
	# Difference between this number and the last
	__diff="$(expr "$__number" - "$__last")"	
	__was="$__last"
	__last="$__number"
	
	# If the difference is at least 2 then there is a free slot after the last
	if [ "$__diff" -ge "2" ]
	then
		__number_to_pair "$(expr "$__was" + 1)"
		break
	fi
done

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<














































































































































































































































































































































































Changes to utils-dev/old/NewManifest.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21

22
23
24
25
26
27
28
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

import java.io.InputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.jar.Manifest;
import java.util.List;
import java.util.Map;
import java.util.NavigableMap;
import java.util.Objects;
import java.util.TreeMap;


/**
 * This translates from the old manifest format to the new manifest format.
 *
 * @since 2016/10/22
 */
public class NewManifest










|
|
<


<





>







1
2
3
4
5
6
7
8
9
10
11
12

13
14

15
16
17
18
19
20
21
22
23
24
25
26
27
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

import java.io.IOException;
import java.io.InputStream;

import java.util.Arrays;
import java.util.Comparator;

import java.util.List;
import java.util.Map;
import java.util.NavigableMap;
import java.util.Objects;
import java.util.TreeMap;
import java.util.jar.Manifest;

/**
 * This translates from the old manifest format to the new manifest format.
 *
 * @since 2016/10/22
 */
public class NewManifest

Deleted utils-dev/packageidentifier.sh.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/bin/sh
# ---------------------------------------------------------------------------
# Multi-Phasic Applications: SquirrelJME
#     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
#     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
# ---------------------------------------------------------------------------
# SquirrelJME is under the GNU General Public License v3+, or later.
# See license.mkd for licensing and copyright information.
# ---------------------------------------------------------------------------
# DESCRIPTION: This returns the identifier of the package a path is in.

# Force C locale
export LC_ALL=C

# Directory of this script
__exedir="$(dirname -- "$0")"

# Get the base to use
if [ "$#" -eq "0" ]
then
	__dir="$(pwd)"
else
	__dir="$1"
fi

# Java files could be passed and the script is not really that smart enough
# to know if a passed input was really a directory or just a file, so just
# for the most part try to guess
__fn="$(basename -- "$__dir")"
if echo "$__fn" | grep -e '\.java$' -e '\.class$' -e '\.jas$' -e '\.j$' > /dev/null
then
	__dir="$__dir/.."
fi

# Build the package by continually going up until the target directory was
# reached
__base="$("$__exedir/projectbase.sh" "$__dir")"
__at="$("$__exedir/absolute.sh" "$__dir")"
__result=""
while true
do
	# Make sure it is always absolute
	__at="$("$__exedir/absolute.sh" "$__at")"
	
	# Stop if the base was reached
	if [ "$__base" -ef "$__at" ]
	then	
		break
	fi
	
	# Need to prefix with dot?
	if [ ! -z "$__result" ]
	then
		__result=".$__result"
	fi
	
	# Get the base and append it to the root
	__result="$(echo "$__at" | sed 's/.*\/\(.*\)$/\1/')$__result"
	
	# Go back up
	__at="$__at/.."
done

# Always make sure the package is valid somewhat
if [ -z "$__result" ]
then
	echo "unknown.package"
else
	echo "$__result"
fi

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<














































































































































Deleted utils-dev/packagepath.sh.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/sh
# ---------------------------------------------------------------------------
# Multi-Phasic Applications: SquirrelJME
#     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
#     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
# ---------------------------------------------------------------------------
# SquirrelJME is under the GNU General Public License v3+, or later.
# See license.mkd for licensing and copyright information.
# ---------------------------------------------------------------------------
# DESCRIPTION: This returns the directory based form for a package.

# Force C locale
export LC_ALL=C

# Directory of this script
__exedir="$(dirname -- "$0")"

# Target a given directory or not
if [ "$#" -eq "0" ]
then
	__dir="$(pwd)"
else
	__dir="$1"
fi

# Same as the package identifier but with dots instead
"$__exedir/packageidentifier.sh" "$__dir" | tr '.' '/'

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
























































Deleted utils-dev/practice/mips-32+i,big.linux.generic.zip.uue.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
begin-base64 644 mips-32+i,big.linux.generic.zip
UEsDBBQAAAAIAPiWBkkLV9KzPQEAAMwRAAAFABwAaGVsbG9VVAkAA/Nqplfz
aqZXdXgLAAEE6AMAAAToAwAA7ZjPSsNAEMa/TdO0qNDQU/EUMQf1sF566EEw
HhSFCkKfIKFpDISmJhvw5iv4CoK+ga/mue5utjWNJ8Hj/GDyZWa+yZ89zsv1
9IZZDFss9OWVIcBI6hhwP3V9DA8dnKAHZwV5BxfSUwe0V4Uto57f7U9MdHW9
7k8QmACGJhzTJwiCIAiCIAiCIAjiX2FgDKxd9W2wiy4C/8Od+A6GvjV4l+UD
qW9Kb+Msy73ZU5UWRZyVR3v1mPj1+OA1uJIySJaVfkvPZuDlYykKEUbg93cP
Mx5G6SILkxK8iJN0ucjBRfwswOehCMHlKA+FKNKoEnH5p5/bXwFnUFuNQKV6
tzBq9PsmP1zp3YP6XpW705bP1gcFHBt1jE95vJZPcWp8nXq/sd1xbNic93m+
Xn/9lN05dhcgrKGdhk+d82Xb9w1QSwMEFAAAAAgA+JYGSXBXTuRwAAAAmgAA
AAcAHABoZWxsby5zVVQJAAPzaqZX82qmV3V4CwABBOgDAAAE6AMAANNLSSxJ
5OLMSM3JyS8uKcrMS7fi1EssTs7MrFJQ8gCJKgQXlmYWFaXmFCvG5ClxcemV
pFaUcHHlJmbmWXFx5iQqqCQa6CgYQpmGOgpIZkEFjYDyFkB2poJKGVCtiYGB
CRdncWVxcmJODheKuCFCHABQSwECHgMUAAAACAD4lgZJC1fSsz0BAADMEQAA
BQAYAAAAAAAAAAAA7YEAAAAAaGVsbG9VVAUAA/Nqpld1eAsAAQToAwAABOgD
AABQSwECHgMUAAAACAD4lgZJcFdO5HAAAACaAAAABwAYAAAAAAABAAAApIF8
AQAAaGVsbG8uc1VUBQAD82qmV3V4CwABBOgDAAAE6AMAAFBLBQYAAAAAAgAC
AJgAAAAtAgAAAAA=
====
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






































Deleted utils-dev/practice/mips-32+i,little.linux.generic.zip.uue.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
begin-base64 644 mips-32+i,little.linux.generic.zip
UEsDBBQAAAAIAG+XBkkO9Yy41wAAANgBAAAFABwAaGVsbG9VVAkAA9Frplek
bKZXdXgLAAEE6AMAAAToAwAAq3f1cWNkZGSAASYGDgYQbwODA4MJkBYAcQQY
gGwFBmYGDQZWBhaQsoIpQGIKUA0ISwDZIMwCxQjTHMD4ApAEYVawGCNYHiLm
CMYKQDYIs0HlSxgwwYMGR6gsi4ojA6vNBYalKkIMbCpL+JlUeIDiC6G0R2pO
Tr5CcGFpZlFRak6xIhe6QXrFGcUlRSWJSQx6RanpmXlp+Qx6JakVJQx6KYkl
iVhsxg64Ie4tYIKHAyQMYIAFyheBhgcbNEw3QP0KAwJQWgqqjhkeLtjVwdTA
wAc0dbCwBwBQSwMEFAAAAAgA+JYGSXBXTuRwAAAAmgAAAAcAHABoZWxsby5z
VVQJAAPzaqZX82qmV3V4CwABBOgDAAAE6AMAANNLSSxJ5OLMSM3JyS8uKcrM
S7fi1EssTs7MrFJQ8gCJKgQXlmYWFaXmFCvG5ClxcemVpFaUcHHlJmbmWXFx
5iQqqCQa6CgYQpmGOgpIZkEFjYDyFkB2poJKGVCtiYGBCRdncWVxcmJODheK
uCFCHABQSwECHgMUAAAACABvlwZJDvWMuNcAAADYAQAABQAYAAAAAAAAAAAA
7YEAAAAAaGVsbG9VVAUAA9Frpld1eAsAAQToAwAABOgDAABQSwECHgMUAAAA
CAD4lgZJcFdO5HAAAACaAAAABwAYAAAAAAABAAAApIEWAQAAaGVsbG8uc1VU
BQAD82qmV3V4CwABBOgDAAAE6AMAAFBLBQYAAAAAAgACAJgAAADHAQAAAAA=
====
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
































Deleted utils-dev/practice/practice.mkd.

1
2
3
4
5
6
# Practice Binary ZIPs

This directory contains very minimal and simple binaries which are to
be used on the target system to test the initial setup of the
emulator. These binaries should be in ZIPs and be as simple as
possible. All executables should be named `hello`.
<
<
<
<
<
<












Deleted utils-dev/prefixerrortoproject.sh.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/sh
# ---------------------------------------------------------------------------
# Multi-Phasic Applications: SquirrelJME
#     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
#     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
# ---------------------------------------------------------------------------
# SquirrelJME is under the GNU General Public License v3+, or later.
# See license.mkd for licensing and copyright information.
# ---------------------------------------------------------------------------
# DESCRIPTION: Gets the project name from the error prefix.

# Force C locale
export LC_ALL=C

# Directory of this script
__exedir="$(dirname -- "$0")"

if [ "$#" -ne "1" ]
then
	echo "Usage: $0 (prefix)" 1>&2
	exit 1
fi

# Go through prefixes and try to find it
"$__exedir/errorprefixes.sh" | while read __line
do
	__co="$(echo "$__line" | cut -d ' ' -f 1)"
	__pr="$(echo "$__line" | cut -d ' ' -f 2)"
	
	if [ "$__co" = "$1" ]
	then
		echo "$__pr"
		break
	fi
done

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<








































































Deleted utils-dev/projectbase.sh.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/sh
# ---------------------------------------------------------------------------
# Multi-Phasic Applications: SquirrelJME
#     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
#     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
# ---------------------------------------------------------------------------
# SquirrelJME is under the GNU General Public License v3, or later.
# See license.mkd for licensing and copyright information.
# ---------------------------------------------------------------------------
# DESCRIPTION: Gets the base of the current project

# Force C locale
export LC_ALL=C

# Directory of this script
__exedir="$(dirname -- "$0")"

# Get the base to use
if [ "$#" -eq "0" ]
then
	__base="$(pwd)"
else
	__base="$1"
fi

# Keep adding .. until the version identifier is found
# Include two sets of .. in the event that we are in a given project
# Also try others since we may be in the project root.
while true
do
	__base="$("$__exedir/absolute.sh" "$__base")"
	
	# Find the manifest for a project
	if [ -f "$__base/META-INF/MANIFEST.MF" ] ||
		[ -f "$__base/META-INF/TEST.MF" ] ||
		[ -f "$("$__exedir/absolute.sh" "$__base/../NAMESPACE.MF")" ] ||
		[ -f "$__base/squirreljme-version" ] ||
		[ "$__base" = "/" ]
	then
		echo "$__base"
		break
	fi
	
	# Otherwise go up
	__base="$__base/.."
done

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






























































































Deleted utils-dev/projectname.sh.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/sh
# ---------------------------------------------------------------------------
# Multi-Phasic Applications: SquirrelJME
#     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
#     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
# ---------------------------------------------------------------------------
# SquirrelJME is under the GNU General Public License v3, or later.
# See license.mkd for licensing and copyright information.
# ---------------------------------------------------------------------------
# DESCRIPTION: Prints the name of a project.

# Force C locale
export LC_ALL=C

# Directory of this script
__exedir="$(dirname -- "$0")"

# Target a given directory or not
if [ "$#" -eq "0" ]
then
	__dir="$(pwd)"
else
	__dir="$1"
fi

# The project name is the last component of the base directory
"$__exedir/projectbase.sh" "$__dir" | sed 's/.*\/\(.*\)$/\1/'

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
























































Deleted utils-dev/projectuuid.sh.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/sh
# ---------------------------------------------------------------------------
# Multi-Phasic Applications: SquirrelJME
#     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
#     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
# ---------------------------------------------------------------------------
# SquirrelJME is under the GNU General Public License v3+, or later.
# See license.mkd for licensing and copyright information.
# ---------------------------------------------------------------------------
# DESCRIPTION: This returns the UUID of the specified project, this is used
# to keep track of which projects were just renames and such and which ones
# are new.

# Force C locale
export LC_ALL=C

# Directory of this script
__exedir="$(dirname -- "$0")"

# Project to get dependencies for
if [ "$#" -le "0" ]
then
	__now="$(pwd)"
else
	__now="$1"
fi

# Get the base of the project
__base="$("$__exedir/projectbase.sh" "$__now")"


# Go through the manifest which can contain multiple fields for the UUID
# since the field has changed throughout the project
if [ -f "$__base/META-INF/MANIFEST.MF" ]
then
	# Determine Default fallback UUID
	__defl="00000000-0000-0000-0000-$(fossil sha1sum - < \
		"$__base/META-INF/MANIFEST.MF" | cut -c 1-12)"
	
	# Get sum
	echo "X-SquirrelJME-UUID:$__defl" | cat "$__base/META-INF/MANIFEST.MF" - |
	grep -i -e 'X-Hairball-UUID' -e 'X-SquirrelJME-UUID' | \
		cut -d ':' -f 2 | head -n 1 | tr -d ' '

# Not known othewise
else
	echo "00000000-0000-0000-0000-000000000000"
fi



<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






































































































Deleted utils-dev/projectwhere.sh.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/sh
# ---------------------------------------------------------------------------
# Multi-Phasic Applications: SquirrelJME
#     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
#     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
# ---------------------------------------------------------------------------
# SquirrelJME is under the GNU General Public License v3+, or later.
# See license.mkd for licensing and copyright information.
# ---------------------------------------------------------------------------
# DESCRIPTION: Returns the path where the project is located

# Force C locale
export LC_ALL=C

# Directory of this script
__exedir="$(dirname -- "$0")"

# Project to get path for
if [ "$#" -le "0" ]
then
	__name="$("$__exedir/projectname.sh")"
else
	__name="$1"
fi

# Non-name test
__ntname="$(basename -- "$__name" ".test")"

# Go through all namespaces
for __ns in $("$__exedir/lsnamespaces.sh")
do
	# Ignore build
	if [ "$__ns" = "build" ]
	then
		continue
	fi
	
	# Try to find exact project name
	__try="$__exedir/../$__ns/$__name"
	__tst="$__exedir/../$__ns/$__ntname"
	if [ -f "$__try/META-INF/MANIFEST.MF" ] ||
		[ -f "$__try/META-INF/TEST.MF" ]
	then
		echo "$__try"
		exit 0
	fi
done

# Not found
exit 1

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






































































































Deleted utils-dev/qemuize.sh.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/bin/sh
# ---------------------------------------------------------------------------
# Multi-Phasic Applications: SquirrelJME
#     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
#     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
# ---------------------------------------------------------------------------
# SquirrelJME is under the GNU General Public License v3, or later.
# See license.mkd for licensing and copyright information.
# ---------------------------------------------------------------------------
# DESCRIPTION: Likely a Linux only script, run the build to a given ZIP then
# extract it and try running it.

# Force C locale
export LC_ALL=C

# Directory of this script
__exedir="$(dirname -- "$0")"

# If no arguments were pass then pass no arguments so that the target list
# and help text is printed
if [ "$#" -eq "0" ]
then
	"$__exedir/../build.sh"
	exit $?
fi

# Perform the build and run it
rm -f "$$.zip"
__jo="$JAVA_OPTIONS"
if JAVA_OPTIONS="-Dcc.squirreljme.builder.dumptarget=true \
	-Dcc.squirreljme.builder.hexdump=true $__jo" \
	"$__exedir/../build.sh" "$@" "$$.zip"
then
	# Unzip then delete the ZIP
	unzip -o "$$.zip" squirreljme
	rm -f "$$.zip"
	
	# Run it
	ls -alh squirreljme
	chmod +x squirreljme
	./squirreljme
	exit $?
else
	# Failed, so fail
	rm -f "$$.zip"
	echo "Failed build..."
	exit 1
fi

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


































































































Deleted utils-dev/reordererrors.sh.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/sh
# ---------------------------------------------------------------------------
# Multi-Phasic Applications: SquirrelJME
#     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
#     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
# ---------------------------------------------------------------------------
# SquirrelJME is under the GNU General Public License v3+, or later.
# See license.mkd for licensing and copyright information.
# ---------------------------------------------------------------------------
# DESCRIPTION: This runs the error reordering script.

# Force C locale
export LC_ALL=C

# Directory of this script
__exedir="$(dirname -- "$0")"

# Need to compile the program
__cls="ReorderErrors"
__src="$__exedir/$__cls.java"
__odr="/tmp"
__out="$__odr/$__cls.class"

# Need to compile?
if [ ! -f "$__out" ] || [ "$__src" -nt "$__out" ]
then
	if ! javac -d "$__odr" "$__src"
	then
		echo "Failed to compile"
		exit 1
	fi
fi

# Execute it
java -classpath "$__odr" "$__cls" "$@"
exit $?

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<










































































Deleted utils-dev/reportdoc.sh.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
#!/bin/sh
# ---------------------------------------------------------------------------
# Multi-Phasic Applications: SquirrelJME
#     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
#     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
# ---------------------------------------------------------------------------
# SquirrelJME is under the GNU General Public License v3, or later.
# See license.mkd for licensing and copyright information.
# ---------------------------------------------------------------------------
# DESCRIPTION: Builds the port index.

# Force C locale
export LC_ALL=C

# Directory of this script
__exedir="$(dirname -- "$0")"

(for __file in *__dev.mkd *__user.mkd
do
	# Must exist
	if [ ! -f "$__file" ]
	then
		continue
	fi
	
	# Get the base before the user or developer marker
	__base="$(echo "$__file" | sed 's/^\(.*\)__[a-zA-Z]*\.mkd$/\1/g')"
	__type="$(echo "$__file" | sed 's/^.*__\([a-zA-Z]*\)\.mkd$/\1/g')"
	
	# Dot form of it
	__dots="$(echo "$__base" | sed 'y/_/./')"
	
	# Extract bits
	__arch="$(echo "$__dots" | cut -d '.' -f 1)"
	__name="$(echo "$__dots" | cut -d '.' -f 2)"
	__vari="$(echo "$__dots" | cut -d '.' -f 3)"
	
	# Rename generic arch so it is first
	if [ "$__arch" = "generic" ]
	then
		__arch="000generic"
	fi
	
	# Rename user so it is first
	if [ "$__type" = "user" ]
	then
		__type="000user"
	fi
	
	# output
	echo "$__arch.$__name.$__vari.$__type"
done) | sort | while read __line
do
	# Extract bits
	__arch="$(echo "$__line" | cut -d '.' -f 1)"
	__name="$(echo "$__line" | cut -d '.' -f 2)"
	__vari="$(echo "$__line" | cut -d '.' -f 3)"
	__type="$(echo "$__line" | cut -d '.' -f 4)"
	
	# Change generic back
	if [ "$__arch" = "000generic" ]
	then
		__arch="generic"
	fi
	
	# Revert user
	if [ "$__type" = "000user" ]
	then
		__type="user"
	fi
	
	# Repass
	echo "$__arch.$__name.$__vari.$__type"
done | while read __line
do
	# Extract bits
	__arch="$(echo "$__line" | cut -d '.' -f 1)"
	__name="$(echo "$__line" | cut -d '.' -f 2)"
	__vari="$(echo "$__line" | cut -d '.' -f 3)"
	__type="$(echo "$__line" | cut -d '.' -f 4)"
	
	# Split triplet
	__trip="$__arch.$__name.$__vari"
	
	# The base file form
	__xfil="${__arch}_${__name}_${__vari}"
	
	# Change generic to an asterisk to represent any
	if [ "$__arch" = "generic" ]
	then
		__disarch="*"
	else
		__disarch="$__arch"
	fi
	
	# New header
	if [ "$__last" != "$__trip" ]
	then
		echo " * _$__disarch.$__name.${__vari}_"
		__last="$__trip"
	fi
	
	# Depends on the type
	case "$__type" in
		"dev")
			echo "   * [Developer](${__xfil}__dev.mkd)"
			;;
		
		"user")
			echo "   * [User](${__xfil}__user.mkd)"
			;;
	esac
done

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




































































































































































































































Deleted utils-dev/simjvm.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
/* ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// --------------------------------------------------------------------------*/

/**
 * Simulated Java Virtual Machine.
 *
 * @since 2019/09/02
 */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define _DEBUG

/**
 * Arguments which modify the starting state of the JVM.
 *
 * @since 2019/09/29
 */
typedef struct simjvm_arguments
{
} simjvm_arguments;

/**
 * Processes the command line arguments used to start the JVM.
 *
 * @param out Output arguments.
 * @param argc Argument count.
 * @param argv Argument strings.
 * @since 2019/09/29
 */
int simjvm_initialize_arguments(simjvm_arguments* out, int argc, char** argv)
{
	int i, filemode;
	char* arg;
	char* next;
	
	/* The pointer must be valid! */
	if (out == NULL || argv == NULL)
		return 1;
	
	/* Starts not in file mode. */
	filemode = 0;
	
	/* Go through all arguments, first skipped because executable. */
	for (i = 1; i < argc; i++)
	{
		/* Get this argument and the next. */
		arg = argv[i];
		next = (i + 1 < argc ? argv[i + 1] : NULL);
		
		/* Print it for debug. */
		fprintf(stderr, "DEBUG: %s\n", arg);
		
		fprintf(stderr, "TODO!\n");
		exit(EXIT_FAILURE);
	}
	
	return 1;
}

/**
 * Main entry point.
 *
 * @param argc Argument count.
 * @param argv Argument strings.
 * @since 2019/09/02
 */
int main(int argc, char** argv)
{
	simjvm_arguments jvmargs;
	
	/* Show welcome message. */
	fprintf(stderr, "SquirrelJME Simulated JVM 0.1\n");
	fprintf(stderr, "Copyright (C) 2019 Stephanie Gawroriski\n");
	fprintf(stderr, "https://squirreljme.cc/\n");
	fprintf(stderr, "\n");
	
	/* Show a warning message why this JVM is being used instead. */
	fprintf(stderr, "This virtual machine is being used to bootstrap the ");
	fprintf(stderr, "build of SquirrelJME because a Java run-time has not ");
	fprintf(stderr, "detected on the host machine or one which was not ");
	fprintf(stderr, "elected to be used. The purpose of this Simulated JVM ");
	fprintf(stderr, "is to allow for building SquirrelJME on any system.\n");
	fprintf(stderr, "\n");
	
	/* Process arguments. */
	memset(&jvmargs, 0, sizeof(jvmargs));
	if (simjvm_initialize_arguments(&jvmargs, argc, argv) != 0)
	{
		fprintf(stderr, "Could not parse arguments!\n");
		return EXIT_FAILURE;
	}
	
	fprintf(stderr, "TODO!\n");
	return EXIT_FAILURE;
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<














































































































































































































Deleted utils-dev/sxp.sh.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/bin/sh
# ---------------------------------------------------------------------------
# Multi-Phasic Applications: SquirrelJME
#     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
# ---------------------------------------------------------------------------
# SquirrelJME is under the GNU General Public License v3+, or later.
# See license.mkd for licensing and copyright information.
# ---------------------------------------------------------------------------
# DESCRIPTION: This creates a PNG image from a text output, so it can be drawn
# into and such.

# Force C locale
export LC_ALL=C

# Directory of this script
__exedir="$(dirname -- "$0")"

# Calculate hosted launch script location
__hosted="$("$__exedir/absolute.sh" "$__exedir/hostedlaunch.sh")"

# Go to temp dir
__tempdir="/tmp/sx"
if [ ! -d "$__tempdir" ]
then
	mkdir -p "$__tempdir"
fi
cd "$__tempdir"

# Arguments
__pkg="$1"
__cls="$2"

# All methods or a single one?
if [ "$#" -eq "3" ]
then
	__mth=""
	__out="$3"
else
	__mth="$3"
	__out="$4"
fi

# Execute handler, export file first
if "$__hosted" sxs "$__pkg" "$__cls" "$__mth" > "/tmp/$$"
then
	# Then convert it to a PBM
	if "$__hosted" txt-to-pbm "/tmp/$$" > "/tmp/$$.pbm"
	then
		if which pnmtopng > /dev/null
		then
			# Scale it
			pnmscale 2 "/tmp/$$.pbm" > "/tmp/$$.pbm.2"
			mv -f "/tmp/$$.pbm.2" "/tmp/$$.pbm"
			
			# Convert
			pnmtopng "/tmp/$$.pbm" > "$__out"
			
			# Cleanup
			rm -f "/tmp/$$.pbm"
		else
			mv -f "/tmp/$$.pbm" "$__out"
		fi
	else
		# Cleanup
		rm -f "/tmp/$$.pbm"
	fi
fi

# Cleanup
rm -f "/tmp/$$"
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<












































































































































Deleted utils-dev/sxs.sh.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/sh
# ---------------------------------------------------------------------------
# Multi-Phasic Applications: SquirrelJME
#     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
# ---------------------------------------------------------------------------
# SquirrelJME is under the GNU General Public License v3+, or later.
# See license.mkd for licensing and copyright information.
# ---------------------------------------------------------------------------
# DESCRIPTION: This quickly and easily launches the side by side debug.

# Force C locale
export LC_ALL=C

# Directory of this script
__exedir="$(dirname -- "$0")"

# Calculate hosted launch script location
__hosted="$("$__exedir/absolute.sh" "$__exedir/hostedlaunch.sh")"

# Go to temp dir
__tempdir="/tmp/sx"
if [ ! -d "$__tempdir" ]
then
	mkdir -p "$__tempdir"
fi
cd "$__tempdir"

# Execute handler
"$__hosted" sxs "$@"
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


























































Deleted utils-dev/tagslist.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
x-date-201603
x-date-201604
x-date-201605
x-date-201606
x-date-201607
x-date-201608
x-date-201609
x-date-201610
x-date-201611
x-date-201612
x-date-201701
x-date-201702
x-date-201703
x-date-201704
x-date-201705
x-date-201706
x-date-201707
x-date-201708
x-date-201709
x-date-201710
x-date-201711
x-date-201712
x-date-201801
x-date-201802
x-date-201803
x-date-201804
trunk
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






















































Changes to utils-dev/test/WeightedDownsample.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

import java.awt.Color;
import java.awt.color.ColorSpace;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
import java.awt.image.WritableRaster;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.AbstractMap;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;











<


|
|






<







1
2
3
4
5
6
7
8
9
10
11

12
13
14
15
16
17
18
19
20
21

22
23
24
25
26
27
28
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

import java.awt.Color;

import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Graphics2D;
import java.awt.color.ColorSpace;
import java.awt.image.BufferedImage;
import java.awt.image.WritableRaster;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;

Deleted utils-dev/todocount.sh.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/sh
# ---------------------------------------------------------------------------
# Multi-Phasic Applications: SquirrelJME
#     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
#     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
# ---------------------------------------------------------------------------
# SquirrelJME is under the GNU General Public License v3+, or later.
# See license.mkd for licensing and copyright information.
# ---------------------------------------------------------------------------
# DESCRIPTION: Counts the number of TODOs in the current project

# Force C locale
export LC_ALL=C

# Directory of this script
__exedir="$(dirname -- "$0")"

# Allow a custom directory to be specified
if [ "$#" -ge "1" ]
then
	__dir="$1"
else
	__dir="$(pwd)"
fi

# Get the directory of the project
__base="$("$__exedir/projectbase.sh" "$__dir")"

# Keep counts of everything per project
find "$__base" -type f | while read __file
do
	grep -c -e 'todo\.TODO' -e 'Error("TODO")' "$__file"
done | datamash -t ' ' sum 1

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




































































Deleted utils-dev/todoprogression.sh.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/bin/sh
# ---------------------------------------------------------------------------
# Multi-Phasic Applications: SquirrelJME
#     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
#     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
# ---------------------------------------------------------------------------
# SquirrelJME is under the GNU General Public License v3+, or later.
# See license.mkd for licensing and copyright information.
# ---------------------------------------------------------------------------
# DESCRIPTION: This counts the progression of TODO statements across the
# entire project over the course of the project.
#
# This detects:
#  * 'new Error("TODO")'
#  * 'new todo.TODO()'

# Force C locale
export LC_ALL=C

# Directory of this script
__exedir="$(dirname -- "$0")"

# Requires the FUSE root
if [ "$#" -le "0" ]
then
	echo "Usage: $0 [Fossil Fuse Root]"
	exit 1
fi

# Need to compile the program
__cls="TodoProgression"
__src="$__exedir/$__cls.java"
__odr="/tmp"
__out="$__odr/$__cls.class"

# Need to compile?
if [ ! -f "$__out" ] || [ "$__src" -nt "$__out" ]
then
	if ! javac -d "$__odr" "$__src"
	then
		echo "Failed to compile"
		exit 1
	fi
fi

# The root where fuse projects are
__fuse="$1"

# Go through the tag list to get the tags to check for progression
cat "$__exedir/tagslist" | while read __tag
do
	# Get the base directory for that tag
	__base="$__fuse/checkins/$__tag/"
	
	# Go through all projects in the base
	"$__exedir/lsprojects.sh" "$__base" | while read __project
	do
		__uuid="$("$__exedir/projectuuid.sh" "$__base/$__project")"
		__count="$("$__exedir/todocount.sh" "$__base/$__project")"
		
		echo "$__tag" "$__project" "$__uuid" "$__count"
	done
done | java -classpath "$__odr" "$__cls" "$@"
exit $?

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


































































































































Deleted utils-dev/todototals.sh.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/sh
# ---------------------------------------------------------------------------
# Multi-Phasic Applications: SquirrelJME
#     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
#     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
# ---------------------------------------------------------------------------
# SquirrelJME is under the GNU General Public License v3+, or later.
# See license.mkd for licensing and copyright information.
# ---------------------------------------------------------------------------
# DESCRIPTION: Prints the totals for all namespaces.

# Force C locale
export LC_ALL=C

# Directory of this script
__exedir="$(dirname -- "$0")"

# Allow a custom root to be specified
if [ "$#" -ge "1" ]
then
	__root="$1"
else
	__root="$__exedir/.."
fi

# Count through all projects
"$__exedir/lsprojects.sh" | while read __project
do
	__count="$("$__exedir/todocount.sh" "$__root/$__project")"
	
	echo "$__project $__count"
done

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


































































Deleted utils-dev/updateerror.sh.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/sh
# ---------------------------------------------------------------------------
# Multi-Phasic Applications: SquirrelJME
#     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
#     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
# ---------------------------------------------------------------------------
# SquirrelJME is under the GNU General Public License v3+, or later.
# See license.mkd for licensing and copyright information.
# ---------------------------------------------------------------------------
# DESCRIPTION: Updates the error script.

# Force C locale
export LC_ALL=C

# Directory of this script
__exedir="$(dirname -- "$0")"

# Needs to be in a repository
cd "$__exedir"

# Build
"$__exedir/builderrors.sh" > /tmp/$$

# Did the errors actually change?
if [ "$(fossil unversion cat "errors.mkd" | fossil sha1sum - | \
	cut -d ' ' -f 1)" != "$(fossil sha1sum - < /tmp/$$ | cut -d ' ' -f 1)" ]
then
	echo "Errors updated"
	fossil unversion add /tmp/$$ --as "errors.mkd"
else
	echo "Errors untouched"
fi
rm -f /tmp/$$

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




































































Deleted utils-dev/updatejavadoc.sh.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
#!/bin/sh
# ---------------------------------------------------------------------------
# Multi-Phasic Applications: SquirrelJME
#     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
#     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
# ---------------------------------------------------------------------------
# SquirrelJME is under the GNU General Public License v3, or later.
# See license.mkd for licensing and copyright information.
# ---------------------------------------------------------------------------
# DESCRIPTION: Generates the JavaDoc and synchronizes the changes into the
# fossil unversioned space

# Force C locale
export LC_ALL=C

# Directory of this script
__exedir="$(dirname -- "$0")"

# Generate JavaDoc
__javadocfailed=0
if true
then
	rm -rf "javadoc"
	if ! "$__exedir/javadoc.sh"
	then
		echo "Failed to generate JavaDoc, will only update errors"
		__javadocfailed=1
	fi
fi

# Remember this point
__docroot="$(pwd)/javadoc"

# Go to the project home directory so fossil works
cd "$__exedir/.."
__srcdir="$__exedir/.."

# Generate and update errors list
echo "Generating error list..."
"$__exedir/updateerror.sh"

# Do not bother updating the docs
if [ "$__javadocfailed" -ne "0" ]
then
	echo "Failed to build the doc generator, cannot update."
	exit 1
fi

# Count the number of documents that should exist
__ad="$("$__exedir/lsall.sh" | grep '\.java$' | wc -l)"
__hd="$(expr "$(expr "$__ad" "/" "2")" "+" "$(expr "$__ad" "/" "4")")"

# If half of the documents fail to generate, then do not generate at all
__nd="$(cd "$__docroot"; find -type f | grep '\.mkd$' | wc -l)"
if [ "$__nd" -lt "$__hd" ]
then
	echo "Not enough documents, not going to update."
	echo "$__nd did not meet threshold of $__hd for $__ad sources."
	exit 1
fi

# Files in javadoc and unversioned space
# Add a line that is different from A and B
(cd "$__docroot"; find -type f | grep '\.mkd$' | sed 's/\.\///g'; \
	echo "@IgnoreA") | sort > /tmp/$$.a
(fossil unversion ls | grep '^javadoc\/' | grep '\.mkd$' | \
	sed 's/^javadoc\///g'; echo "@IgnoreB") | sort > /tmp/$$.b

# Go through all files
# Set the unified diff surrounding change count to a really high value so that
# all changes can possibly be detected. Otherwise, there would need to be a
# second pass for files which were not changed, just to see if they were
# changed (sort, sort, uniq).
diff -U 99999 /tmp/$$.b /tmp/$$.a | grep '^[\-\+ ][^\-\+]' | \
	while read -r __line
do
	# Get the change mode and the file
	__mode="$(echo "$__line" | cut -c 1)"
	__file="$(echo "$__line" | cut -c 2-)"
	
	# Space gone away?
	if [ "$__mode" != "-" ] && [ "$__mode" != "+" ]
	then
		__file="$__mode$__file"
		__mode="="
	fi
	
	# Ignore?
	__fcha="$(echo "$__file" | cut -c 1)"
	if [ "$__fcha" = "@" ]
	then
		continue
	fi
	
	# The unversioned target
	__targ="javadoc/$__file"
	
	# Debug
	echo "$__mode $__file -> $__targ"
	
	# Adding file?
	if [ "$__mode" = "+" ]
	then
		fossil unversion add "$__docroot/$__file" --as "$__targ"
	
	# Removing file?
	elif [ "$__mode" = "-" ]
	then
		fossil unversion rm "$__targ"
	
	# Updating, if changed
	else
		# Get sha1 for both files
		__was="$(fossil unversion cat "$__targ" | fossil sha1sum - | \
			cut -d ' ' -f 1)"
		__now="$(fossil sha1sum - < "$__docroot/$__file" | \
			cut -d ' ' -f 1)"
		
		# Did the file change?
		if [ "$__was" != "$__now" ]
		then
			fossil unversion add "$__docroot/$__file" --as "$__targ"
		fi
	fi
done

# Cleanup
rm -f /tmp/$$.a
rm -f /tmp/$$.b

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




































































































































































































































































Deleted utils-dev/vmlaunch.sh.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/bin/sh
# ---------------------------------------------------------------------------
# Multi-Phasic Applications: SquirrelJME
#     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
#     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
# ---------------------------------------------------------------------------
# SquirrelJME is under the GNU General Public License v3+, or later.
# See license.mkd for licensing and copyright information.
# ---------------------------------------------------------------------------
# DESCRIPTION: Launches the specified program using a VM.

# Force C locale
export LC_ALL=C

# Directory of this script
__exedir="$(dirname -- "$0")"

# May be replaced
: ${JAVA:=java}

__print_usage()
{
	echo "Usage: $0 [-w] [-p #] (project[:#]|file.jar)" 1>&2
	echo "" 1>&2
	echo "  [-w]   Run with Wine instead" 1>&2
	echo "  [-p #] Can be 0 or greater to specify that an alternative" 1>&2
	echo "         application be used for a given program." 1>&2
}

# Usage
if [ "$#" -lt 1 ]
then
	__print_usage
	exit 1
fi

# Parse arguments
__wine=0
__numb=-1
while getopts wp: __opt
do
	case "$__opt" in
		w)
			__wine=1
			;;
		
		p)
			__numb="$OPTARG"
			;;
		
		*)
			__print_usage
			exit 1
			;;
	esac
done

# Done
shift $(($OPTIND - 1))

# File is the first one
if [ "$__numb" = "-1" ]
then
	__file="$1"
else
	__file="$1:$__numb"
fi
shift

# Forward to the VM launcher
if [ "$__wine" -ne "0" ]
then
	"$__exedir/buildwine.sh" -B launch "$__file" "$@"
	exit $?
else
	"$__exedir/../build.sh" -B launch "$__file" "$@"
	exit $?
fi

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






























































































































































Deleted utils-dev/wineemul.sh.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/sh
# ---------------------------------------------------------------------------
# Multi-Phasic Applications: SquirrelJME
#     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
#     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
# ---------------------------------------------------------------------------
# SquirrelJME is under the GNU General Public License v3+, or later.
# See license.mkd for licensing and copyright information.
# ---------------------------------------------------------------------------
# DESCRIPTION: Runs the specified JAD/JAR in the emulator
#
# !!! IF YOU GET THE FOLLOWING: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# Error: Cannot find any soundbank file
# Execution completed.
# ---------------------------------------------------------------------------
# You need to place gm.dls into c:\windows\system32\drivers
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

# Force C locale
export LC_ALL=C

# Directory of this script
__exedir="$(dirname -- "$0")"

# Path of the emulator
: ${EMULATOR_PATH:="$HOME/.wine/drive_c/WTK2.5.2_01/bin/emulator.exe"}
#: ${EMULATOR_PATH:="$HOME/.wine/drive_c/Java_ME_platform_SDK_3.4/bin/emulator.exe"}

# Usage
if [ "$#" -ne "1" ]
then
	echo "Usage: $0 (file.jad)"
	exit 1
fi

# Clear all old programs
if ! wine "$EMULATOR_PATH" -Xjam:remove=all
then
	echo "Could not remove all old programs, ignoring" 1>&2
fi

# Run the JAD
if ! wine "$EMULATOR_PATH" "-Xdescriptor:$(winepath -w "$1")" # -Xverbose:calls
then
	echo "Run failed" 1>&2
	exit 1
fi

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<