Skip to content

Commit

Permalink
[applet] add ctype vplt
Browse files Browse the repository at this point in the history
  • Loading branch information
versaloon committed Aug 11, 2023
1 parent d3d4d84 commit 1cc9451
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 0 deletions.
11 changes: 11 additions & 0 deletions source/shell/sys/linux/include/simple_libc/ctype.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,17 @@ extern "C" {
#define CTYPE_B 0x80 // space
#define CTYPE_SP (CTYPE_S | CTYPE_P)

#if VSF_LINUX_APPLET_USE_LIBC_CTYPE == ENABLED
typedef struct vsf_linux_libc_ctype_vplt_t {
vsf_vplt_info_t info;

VSF_APPLET_VPLT_ENTRY_FUNC_DEF(__vsf_linux_ctype);
} vsf_linux_libc_ctype_vplt_t;
# ifndef __VSF_APPLET__
extern __VSF_VPLT_DECORATOR__ vsf_linux_libc_ctype_vplt_t vsf_linux_libc_ctype_vplt;
# endif
#endif

extern const char __vsf_linux_ctype[1 + 256];
#define __ismask(__x) (__vsf_linux_ctype[(int)(unsigned char)(__x) + 1])

Expand Down
10 changes: 10 additions & 0 deletions source/shell/sys/linux/lib/glibc/vsf_linux_glibc_ctype.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@
#if VSF_USE_LINUX == ENABLED && VSF_LINUX_USE_SIMPLE_LIBC == ENABLED && VSF_LINUX_USE_SIMPLE_CTYPE == ENABLED

#if VSF_LINUX_CFG_RELATIVE_PATH == ENABLED
# include "../../include/unistd.h"
# include "../../include/simple_libc/ctype.h"
#else
# include <unistd.h>
# include <ctype.h>
#endif

Expand Down Expand Up @@ -55,4 +57,12 @@ const char __vsf_linux_ctype[1 + 256] = {
CTYPE_L, CTYPE_L, CTYPE_L, CTYPE_P, CTYPE_P, CTYPE_P, CTYPE_P, CTYPE_C,
};

#if VSF_LINUX_APPLET_USE_LIBC_CTYPE == ENABLED && !defined(__VSF_APPLET__)
__VSF_VPLT_DECORATOR__ vsf_linux_libc_ctype_vplt_t vsf_linux_libc_ctype_vplt = {
VSF_APPLET_VPLT_INFO(vsf_linux_libc_ctype_vplt_t, 0, 0, true),

VSF_APPLET_VPLT_ENTRY_FUNC(__vsf_linux_ctype),
};
#endif

#endif // VSF_USE_LINUX && VSF_LINUX_USE_SIMPLE_LIBC && VSF_LINUX_USE_SIMPLE_CTYPE
4 changes: 4 additions & 0 deletions source/shell/sys/linux/vsf_linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -4761,6 +4761,7 @@ __VSF_VPLT_DECORATOR__ vsf_linux_vplt_t vsf_linux_vplt = {
# if VSF_APPLET_USE_SERVICE == ENABLED
.service_vplt = (void *)&vsf_service_vplt,
# endif
// libc_arch_vplt = (void *)&vsf_libc_arch_vplt,

.fundmental_vplt = (void *)&vsf_linux_fundmental_vplt,

Expand All @@ -4773,6 +4774,9 @@ __VSF_VPLT_DECORATOR__ vsf_linux_vplt_t vsf_linux_vplt = {
# if VSF_LINUX_APPLET_USE_LIBC_STRING == ENABLED
.libc_string_vplt = (void *)&vsf_linux_libc_string_vplt,
# endif
# if VSF_LINUX_APPLET_USE_LIBC_CTYPE == ENABLED
.libc_ctype_vplt = (void *)&vsf_linux_libc_ctype_vplt,
# endif
# if VSF_LINUX_APPLET_USE_LIBC_TIME == ENABLED
.libc_time_vplt = (void *)&vsf_linux_libc_time_vplt,
# endif
Expand Down
5 changes: 5 additions & 0 deletions source/shell/sys/linux/vsf_linux_cfg.h
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,9 @@
# if !defined(VSF_LINUX_APPLET_USE_LIBC_STRING) && VSF_LINUX_USE_SIMPLE_STRING == ENABLED
# define VSF_LINUX_APPLET_USE_LIBC_STRING ENABLED
# endif
# if !defined(VSF_LINUX_APPLET_USE_LIBC_CTYPE) && VSF_LINUX_USE_SIMPLE_CTYPE == ENABLED
# define VSF_LINUX_APPLET_USE_LIBC_CTYPE ENABLED
# endif
# if !defined(VSF_LINUX_APPLET_USE_LIBC_TIME) && VSF_LINUX_USE_SIMPLE_TIME == ENABLED
# define VSF_LINUX_APPLET_USE_LIBC_TIME ENABLED
# endif
Expand Down Expand Up @@ -378,6 +381,7 @@ typedef struct vsf_linux_vplt_t {
void *service_vplt;
void *kernel_vplt;
void *component_vplt;
void *libc_arch_vplt;

// fundmental, vsf APIs for linux
void *fundmental_vplt;
Expand All @@ -386,6 +390,7 @@ typedef struct vsf_linux_vplt_t {
void *libc_stdio_vplt;
void *libc_stdlib_vplt;
void *libc_string_vplt;
void *libc_ctype_vplt;
void *libc_time_vplt;
void *libc_setjmp_vplt;
void *libc_assert_vplt;
Expand Down

0 comments on commit 1cc9451

Please sign in to comment.