forked from OP-TEE/optee_os
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
libutils: isoc: implement more ctypes functions
Implement missing functions from ctypes.h. Signed-off-by: Yunjong Jeong <[email protected]> Acked-by: Jerome Forissier <[email protected]>
- Loading branch information
1 parent
1fcac77
commit 9c7ce04
Showing
8 changed files
with
85 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,10 @@ | ||
// SPDX-License-Identifier: BSD-2-Clause | ||
/* | ||
* Copyright (c) 2019, KAIST | ||
*/ | ||
#include <ctype.h> | ||
|
||
int __builtin_isalnum(int c) | ||
{ | ||
return isalpha(c) || isdigit(c); | ||
} |
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,12 @@ | ||
// SPDX-License-Identifier: BSD-2-Clause | ||
/* | ||
* Copyright (c) 2019, KAIST | ||
*/ | ||
#include <ctype.h> | ||
|
||
int __builtin_iscntrl(int c) | ||
{ | ||
if (c < 0x20 || c == 0x7f) | ||
return 1; | ||
return 0; | ||
} |
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,12 @@ | ||
// SPDX-License-Identifier: BSD-2-Clause | ||
/* | ||
* Copyright (c) 2019, KAIST | ||
*/ | ||
#include <ctype.h> | ||
|
||
int __builtin_isgraph(int c) | ||
{ | ||
if (c >= 0x21 && c < 0x7f) | ||
return 1; | ||
return 0; | ||
} |
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,10 @@ | ||
// SPDX-License-Identifier: BSD-2-Clause | ||
/* | ||
* Copyright (c) 2019, KAIST | ||
*/ | ||
#include <ctype.h> | ||
|
||
int __builtin_islower(int c) | ||
{ | ||
return (c >= 'a' && c <= 'z'); | ||
} |
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,12 @@ | ||
// SPDX-License-Identifier: BSD-2-Clause | ||
/* | ||
* Copyright (c) 2019, KAIST | ||
*/ | ||
#include <ctype.h> | ||
|
||
int __builtin_isprint(int c) | ||
{ | ||
if (c >= 0x20 && c < 0x7f) | ||
return 1; | ||
return 0; | ||
} |
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,10 @@ | ||
// SPDX-License-Identifier: BSD-2-Clause | ||
/* | ||
* Copyright (c) 2019, KAIST | ||
*/ | ||
#include <ctype.h> | ||
|
||
int __builtin_ispunct(int c) | ||
{ | ||
return isgraph(c) && !isalnum(c); | ||
} |
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,12 @@ | ||
// SPDX-License-Identifier: BSD-2-Clause | ||
/* | ||
* Copyright (c) 2019, KAIST | ||
*/ | ||
#include <ctype.h> | ||
|
||
int __builtin_toupper(int c) | ||
{ | ||
if (c >= 'a' && c <= 'z') | ||
return c - 'a' + 'A'; | ||
return c; | ||
} |