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.
init: ported Is_Empty_{String,Unicode} primitive function
Since a number of level 1 Hestia libraries use string functions, we have to port its primitive ones into HestiaKERNEL library package. Hence, let's do this. This patch ports Is_Empty_{String,Unicode} primitive function into HestiaKERNEL library in init/ directory. 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
5fa1c33
commit abbb8c1
Showing
7 changed files
with
170 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Copyright 2024 (Holloway) Chew, Kean Ho <[email protected]> | ||
# | ||
# | ||
# Licensed under (Holloway) Chew, Kean Ho’s Liberal License (the "License"). | ||
# You must comply with the license to use the content. Get the License at: | ||
# | ||
# https://doi.org/10.5281/zenodo.13770769 | ||
# | ||
# You MUST ensure any interaction with the content STRICTLY COMPLIES with | ||
# the permissions and limitations set forth in the license. | ||
. "${env:LIBS_HESTIA}\HestiaKERNEL\Error_Codes.ps1" | ||
|
||
|
||
|
||
|
||
# IMPORTANT NOTICE | ||
# This function is made available for backward compatibility and educational | ||
# purposes (as a reminder on how to check without needing any other libraries) | ||
# only. In practice, you should always use the "equal to empty string" tester | ||
# directly such that: | ||
# (1) POSIX Compliant Shell : if [ "$var" = "" ]; then | ||
# (2) PowerShell : if ($var -eq "") { | ||
function HestiaKERNEL-Is-Empty-String { | ||
param ( | ||
[string]$___target | ||
) | ||
|
||
|
||
# execute | ||
if ($___target -eq "") { | ||
return ${env:HestiaKERNEL_ERROR_OK} | ||
} | ||
|
||
|
||
# report status | ||
return ${env:HestiaKERNEL_ERROR_DATA_EMPTY} | ||
} |
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,38 @@ | ||
#!/bin/sh | ||
# Copyright 2024 (Holloway) Chew, Kean Ho <[email protected]> | ||
# | ||
# | ||
# Licensed under (Holloway) Chew, Kean Ho’s Liberal License (the "License"). | ||
# You must comply with the license to use the content. Get the License at: | ||
# | ||
# https://doi.org/10.5281/zenodo.13770769 | ||
# | ||
# You MUST ensure any interaction with the content STRICTLY COMPLIES with | ||
# the permissions and limitations set forth in the license. | ||
. "${LIBS_HESTIA}/HestiaKERNEL/Error_Codes.sh" | ||
|
||
|
||
|
||
|
||
# IMPORTANT NOTICE | ||
# This function is made available for backward compatibility and educational | ||
# purposes (as a reminder on how to check without needing any other libraries) | ||
# only. In practice, you should always use the "equal to empty string" tester | ||
# directly such that: | ||
# (1) POSIX Compliant Shell : if [ "$var" = "" ]; then | ||
# (2) PowerShell : if ($var -eq "") { | ||
HestiaKERNEL_Is_Empty_String() { | ||
#___target="$1" | ||
|
||
|
||
# execute | ||
if [ "$1" = "" ]; then | ||
printf -- "%d" $HestiaKERNEL_ERROR_OK | ||
return $HestiaKERNEL_ERROR_OK | ||
fi | ||
|
||
|
||
# report status | ||
printf -- "%d" $HestiaKERNEL_ERROR_DATA_EMPTY | ||
return $HestiaKERNEL_ERROR_DATA_EMPTY | ||
} |
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,37 @@ | ||
# Copyright 2024 (Holloway) Chew, Kean Ho <[email protected]> | ||
# | ||
# | ||
# Licensed under (Holloway) Chew, Kean Ho’s Liberal License (the "License"). | ||
# You must comply with the license to use the content. Get the License at: | ||
# | ||
# https://doi.org/10.5281/zenodo.13770769 | ||
# | ||
# You MUST ensure any interaction with the content STRICTLY COMPLIES with | ||
# the permissions and limitations set forth in the license. | ||
. "${env:LIBS_HESTIA}\HestiaKERNEL\Error_Codes.ps1" | ||
|
||
|
||
|
||
|
||
# IMPORTANT NOTICE | ||
# This function is made available for backward compatibility and educational | ||
# purposes (as a reminder on how to check without needing any other libraries) | ||
# only. In practice, you should always use the "equal to empty array" tester | ||
# directly such that: | ||
# (1) POSIX Compliant Shell : if [ "$var" = "" ]; then | ||
# (2) PowerShell : if ($var.Length -le 0) { | ||
function HestiaKERNEL-Is-Empty-Unicode { | ||
param ( | ||
[uint32[]]$___target | ||
) | ||
|
||
|
||
# execute | ||
if ($___target.Length -le 0) { | ||
return ${env:HestiaKERNEL_ERROR_OK} | ||
} | ||
|
||
|
||
# report status | ||
return ${env:HestiaKERNEL_ERROR_DATA_EMPTY} | ||
} |
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,38 @@ | ||
#!/bin/sh | ||
# Copyright 2024 (Holloway) Chew, Kean Ho <[email protected]> | ||
# | ||
# | ||
# Licensed under (Holloway) Chew, Kean Ho’s Liberal License (the "License"). | ||
# You must comply with the license to use the content. Get the License at: | ||
# | ||
# https://doi.org/10.5281/zenodo.13770769 | ||
# | ||
# You MUST ensure any interaction with the content STRICTLY COMPLIES with | ||
# the permissions and limitations set forth in the license. | ||
. "${LIBS_HESTIA}/HestiaKERNEL/Error_Codes.sh" | ||
|
||
|
||
|
||
|
||
# IMPORTANT NOTICE | ||
# This function is made available for backward compatibility and educational | ||
# purposes (as a reminder on how to check without needing any other libraries) | ||
# only. In practice, you should always use the "equal to empty string" tester | ||
# directly such that: | ||
# (1) POSIX Compliant Shell : if [ "$var" = "" ]; then | ||
# (2) PowerShell : if ($var -eq "") { | ||
HestiaKERNEL_Is_Empty_Unicode() { | ||
#___target="$1" | ||
|
||
|
||
# execute | ||
if [ "$1" = "" ]; then | ||
printf -- "%d" $HestiaKERNEL_ERROR_OK | ||
return $HestiaKERNEL_ERROR_OK | ||
fi | ||
|
||
|
||
# report status | ||
printf -- "%d" $HestiaKERNEL_ERROR_DATA_EMPTY | ||
return $HestiaKERNEL_ERROR_DATA_EMPTY | ||
} |
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