generated from ChewKeanHo/AutomataCI
-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
root: cleaned up HestiaKERNEL porting
It appears there were some modifications here and here during the HestiaKERNEL porting. Hence, let's clean them up for now. This patch cleans up the HestiaKERNEL porting in root repository. Co-authored-by: Shuralyov, Jean <[email protected]> Co-authored-by: Galyna, Cory <[email protected]> Co-authored-by: (Holloway) Chew, Kean Ho <[email protected]> Signed-off-by: (Holloway) Chew, Kean Ho <[email protected]>
- Loading branch information
1 parent
f4af2a0
commit 50936d6
Showing
34 changed files
with
193 additions
and
220 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# Copyright (c) 2024 (Holloway) Chew, Kean Ho <[email protected]> | ||
# Copyright 2024 (Holloway) Chew, Kean Ho <[email protected]> | ||
# | ||
# | ||
# BSD 3-Clause License | ||
|
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
#!/bin/sh | ||
# Copyright (c) 2024 (Holloway) Chew, Kean Ho <[email protected]> | ||
# Copyright 2024 (Holloway) Chew, Kean Ho <[email protected]> | ||
# | ||
# | ||
# BSD 3-Clause License | ||
|
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# Copyright (c) 2024 (Holloway) Chew, Kean Ho <[email protected]> | ||
# Copyright 2024 (Holloway) Chew, Kean Ho <[email protected]> | ||
# | ||
# | ||
# BSD 3-Clause License | ||
|
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
#!/bin/sh | ||
# Copyright (c) 2024 (Holloway) Chew, Kean Ho <[email protected]> | ||
# Copyright 2024 (Holloway) Chew, Kean Ho <[email protected]> | ||
# | ||
# | ||
# BSD 3-Clause License | ||
|
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# Copyright (c) 2024 (Holloway) Chew, Kean Ho <[email protected]> | ||
# Copyright 2024 (Holloway) Chew, Kean Ho <[email protected]> | ||
# | ||
# | ||
# BSD 3-Clause License | ||
|
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
#!/bin/sh | ||
# Copyright (c) 2024 (Holloway) Chew, Kean Ho <[email protected]> | ||
# Copyright 2024 (Holloway) Chew, Kean Ho <[email protected]> | ||
# | ||
# | ||
# BSD 3-Clause License | ||
|
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 |
---|---|---|
|
@@ -34,7 +34,7 @@ | |
|
||
function HestiaKERNEL-Is-Unicode { | ||
param ( | ||
[uint32]$___content | ||
[uint32[]]$___content | ||
) | ||
|
||
|
||
|
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
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# Copyright (c) 2024 (Holloway) Chew, Kean Ho <[email protected]> | ||
# Copyright 2024 (Holloway) Chew, Kean Ho <[email protected]> | ||
# | ||
# | ||
# BSD 3-Clause License | ||
|
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
#!/bin/sh | ||
# Copyright (c) 2024 (Holloway) Chew, Kean Ho <[email protected]> | ||
# Copyright 2024 (Holloway) Chew, Kean Ho <[email protected]> | ||
# | ||
# | ||
# BSD 3-Clause License | ||
|
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# Copyright (c) 2024 (Holloway) Chew, Kean Ho <[email protected]> | ||
# Copyright 2024 (Holloway) Chew, Kean Ho <[email protected]> | ||
# | ||
# | ||
# BSD 3-Clause License | ||
|
@@ -27,10 +27,9 @@ | |
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | ||
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
. "${env:LIBS_HESTIA}\HestiaKERNEL\Error_Codes.ps1" | ||
. "${env:LIBS_HESTIA}\HestiaKERNEL\Get_String_Encoder.ps1" | ||
. "${env:LIBS_HESTIA}\HestiaKERNEL\To_UTF8_From_Unicode.ps1" | ||
. "${env:LIBS_HESTIA}\HestiaKERNEL\To_UTF16_From_Unicode.ps1" | ||
. "${env:LIBS_HESTIA}\HestiaKERNEL\To_UTF32_From_Unicode.ps1" | ||
. "${env:LIBS_HESTIA}\HestiaKERNEL\Is_Unicode.ps1" | ||
. "${env:LIBS_HESTIA}\HestiaKERNEL\Unicode.ps1" | ||
|
||
|
||
|
@@ -43,26 +42,14 @@ function HestiaKERNEL-To-String-From-Unicode { | |
|
||
|
||
# validate input | ||
if ($___unicode.Length -eq 0) { | ||
if ($(HestiaKERNEL-Is-Unicode $___unicode) -ne ${env:HestiaKERNEL_ERROR_OK}) { | ||
return "" | ||
} | ||
|
||
|
||
# execute | ||
# process HestiaKERNEL.Unicode data type as the last resort | ||
switch (HestiaKERNEL-Get-String-Encoder) { | ||
${env:HestiaKERNEL_UTF8} { | ||
$___utf = HestiaKERNEL-To-UTF8-From-Unicode $___unicode | ||
} ${env:HestiaKERNEL_UTF16BE} { | ||
$___utf = HestiaKERNEL-To-UTF16-From-Unicode $___unicode | ||
} ${env:HestiaKERNEL_UTF32BE} { | ||
$___utf = HestiaKERNEL-To-UTF32-From-Unicode $___unicode | ||
} default { | ||
return "" | ||
} | ||
|
||
$___converted = "" | ||
foreach ($___byte in $___utf) { | ||
foreach ($___byte in $___unicode) { | ||
$___converted = "${___converted}$([string][char]$___byte)" | ||
} | ||
|
||
|
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
#!/bin/sh | ||
# Copyright (c) 2024 (Holloway) Chew, Kean Ho <[email protected]> | ||
# Copyright 2024 (Holloway) Chew, Kean Ho <[email protected]> | ||
# | ||
# | ||
# BSD 3-Clause License | ||
|
@@ -30,6 +30,7 @@ | |
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
. "${LIBS_HESTIA}/HestiaKERNEL/Error_Codes.sh" | ||
. "${LIBS_HESTIA}/HestiaKERNEL/Get_String_Encoder.sh" | ||
. "${LIBS_HESTIA}/HestiaKERNEL/Is_Unicode.sh" | ||
. "${LIBS_HESTIA}/HestiaKERNEL/To_UTF8_From_Unicode.sh" | ||
. "${LIBS_HESTIA}/HestiaKERNEL/To_UTF16_From_Unicode.sh" | ||
. "${LIBS_HESTIA}/HestiaKERNEL/To_UTF32_From_Unicode.sh" | ||
|
@@ -43,17 +44,10 @@ HestiaKERNEL_To_String_From_Unicode() { | |
|
||
|
||
# validate input | ||
if [ "$1" = "" ]; then | ||
printf -- "" | ||
return $HestiaKERNEL_ERROR_DATA_EMPTY | ||
fi | ||
|
||
case "$1" in | ||
*[!0123456789\ \,]*) | ||
if [ $(HestiaKERNEL_Is_Unicode "$1") -ne "$HestiaKERNEL_ERROR_OK" ]; then | ||
printf -- "" | ||
return $HestiaKERNEL_ERROR_DATA_INVALID | ||
;; | ||
esac | ||
fi | ||
|
||
|
||
# execute | ||
|
@@ -80,7 +74,6 @@ HestiaKERNEL_To_String_From_Unicode() { | |
return $HestiaKERNEL_ERROR_DATA_INVALID | ||
fi | ||
|
||
|
||
___converted="" | ||
while [ ! "$___utf" = "" ]; do | ||
___byte="${___utf%%, *}" | ||
|
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
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# Copyright (c) 2024 (Holloway) Chew, Kean Ho <[email protected]> | ||
# Copyright 2024 (Holloway) Chew, Kean Ho <[email protected]> | ||
# | ||
# | ||
# BSD 3-Clause License | ||
|
@@ -27,28 +27,30 @@ | |
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | ||
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
. "${env:LIBS_HESTIA}\HestiaKERNEL\Error_Codes.ps1" | ||
. "${env:LIBS_HESTIA}\HestiaKERNEL\Endian.ps1" | ||
. "${env:LIBS_HESTIA}\HestiaKERNEL\Is_Unicode.ps1" | ||
. "${env:LIBS_HESTIA}\HestiaKERNEL\Unicode.ps1" | ||
|
||
|
||
|
||
|
||
function HestiaKERNEL-To-UTF16-From-Unicode { | ||
param ( | ||
[uint32[]]$___content, | ||
[uint32[]]$___unicode, | ||
[string]$___bom, | ||
[string]$___endian | ||
) | ||
|
||
|
||
# validate input | ||
if ($___content.Length -eq 0) { | ||
return [uint8[]]@() | ||
if ($(HestiaKERNEL-Is-Unicode $___unicode) -ne ${env:HestiaKERNEL_ERROR_OK}) { | ||
return [byte[]]@() | ||
} | ||
|
||
|
||
# execute | ||
[System.Collections.Generic.List[uint8]]$___converted = @() | ||
[System.Collections.Generic.List[byte]]$___converted = @() | ||
if ($___bom -eq ${env:HestiaKERNEL_UTF_BOM}) { | ||
switch ($___endian) { | ||
${env:HestiaKERNEL_ENDIAN_LITTLE} { | ||
|
@@ -62,7 +64,7 @@ function HestiaKERNEL-To-UTF16-From-Unicode { | |
}} | ||
} | ||
|
||
foreach ($___char in $___content) { | ||
foreach ($___char in $___unicode) { | ||
# convert to UTF-16 bytes list | ||
# IMPORTANT NOTICE | ||
# (1) using single code-point algorithm (not the 2 16-bits). | ||
|
@@ -125,5 +127,5 @@ function HestiaKERNEL-To-UTF16-From-Unicode { | |
|
||
|
||
# report status | ||
return [uint8[]]$___converted | ||
return [byte[]]$___converted | ||
} |
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
#!/bin/sh | ||
# Copyright (c) 2024 (Holloway) Chew, Kean Ho <[email protected]> | ||
# Copyright 2024 (Holloway) Chew, Kean Ho <[email protected]> | ||
# | ||
# | ||
# BSD 3-Clause License | ||
|
@@ -30,29 +30,23 @@ | |
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
. "${LIBS_HESTIA}/HestiaKERNEL/Endian.sh" | ||
. "${LIBS_HESTIA}/HestiaKERNEL/Error_Codes.sh" | ||
. "${LIBS_HESTIA}/HestiaKERNEL/Is_Unicode.sh" | ||
. "${LIBS_HESTIA}/HestiaKERNEL/Unicode.sh" | ||
|
||
|
||
|
||
|
||
HestiaKERNEL_To_UTF16_From_Unicode() { | ||
#___content="$1" | ||
#___unicode="$1" | ||
#___bom="$2" | ||
#___endian="$3" | ||
|
||
|
||
# validate input | ||
if [ "$1" = "" ]; then | ||
printf -- "" | ||
return $HestiaKERNEL_ERROR_DATA_EMPTY | ||
fi | ||
|
||
case "$1" in | ||
*[!0123456789\ \,]*) | ||
if [ "$(HestiaKERNEL_Is_Unicode "$1")" -ne $HestiaKERNEL_ERROR_OK ]; then | ||
printf -- "" | ||
return $HestiaKERNEL_ERROR_DATA_INVALID | ||
;; | ||
esac | ||
fi | ||
|
||
|
||
# execute | ||
|
Oops, something went wrong.