generated from platypusguy/jacobin-swift
-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
JACOBIN-608 Initial implementation of <clinit> for java/util/HexFormat
- Loading branch information
1 parent
6b36b75
commit 93403b0
Showing
2 changed files
with
62 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/* | ||
* Jacobin VM - A Java virtual machine | ||
* Copyright (c) 2024 by the Jacobin authors. Consult jacobin.org. | ||
* Licensed under Mozilla Public License 2.0 (MPL 2.0) All rights reserved. | ||
*/ | ||
|
||
package gfunction | ||
|
||
import "jacobin/statics" | ||
|
||
// Implementation of some of the functions in in Java/lang/Class. | ||
|
||
func Load_Util_HexFormat() { | ||
|
||
MethodSignatures["java/util/HexFormat.<clinit>()V"] = | ||
GMeth{ | ||
ParamSlots: 0, | ||
GFunction: hexMapClinit, | ||
} | ||
} | ||
|
||
// hashMapHash accepts a pointer to an object and returns | ||
// a uint64 MD5 hash value of the pointed-to thing | ||
func hexMapClinit(params []interface{}) interface{} { | ||
DIGITS := [256]int8{ | ||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | ||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | ||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | ||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, -1, -1, -1, -1, -1, -1, | ||
-1, 10, 11, 12, 13, 14, 15, -1, -1, -1, -1, -1, -1, -1, -1, -1, | ||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | ||
-1, 10, 11, 12, 13, 14, 15, -1, -1, -1, -1, -1, -1, -1, -1, -1, | ||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | ||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | ||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | ||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | ||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | ||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | ||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | ||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | ||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | ||
} | ||
sDigits := statics.Static{Type: "[B", Value: DIGITS} | ||
statics.AddStatic("java/util/HexFormat.DIGITS", sDigits) | ||
|
||
UPPERCASE_DIGITS := [16]int8{ | ||
'0', '1', '2', '3', '4', '5', '6', '7', | ||
'8', '9', 'A', 'B', 'C', 'D', 'E', 'F', | ||
} | ||
sUppercaseDigits := statics.Static{Type: "[B", Value: UPPERCASE_DIGITS} | ||
statics.AddStatic("java/util/HexFormat.UPPERCASE_DIGITS", sUppercaseDigits) | ||
|
||
LOWERCASE_DIGITS := [16]int8{ | ||
'0', '1', '2', '3', '4', '5', '6', '7', | ||
'8', '9', 'a', 'b', 'c', 'd', 'e', 'f', | ||
} | ||
sLowercaseDigits := statics.Static{Type: "[B", Value: LOWERCASE_DIGITS} | ||
statics.AddStatic("java/util/HexFormat.LOWERCASE_DIGITS", sLowercaseDigits) | ||
|
||
return nil | ||
} |