diff --git a/APP_Framework/Framework/transform_layer/xizi/transform.h b/APP_Framework/Framework/transform_layer/xizi/transform.h index 784e1a5b7..34c8f76ce 100644 --- a/APP_Framework/Framework/transform_layer/xizi/transform.h +++ b/APP_Framework/Framework/transform_layer/xizi/transform.h @@ -22,6 +22,7 @@ #define TRANSFORM_H #include +#include #include #include #include diff --git a/APP_Framework/Framework/transform_layer/xizi/user_api/posix_support/include/pthread.h b/APP_Framework/Framework/transform_layer/xizi/user_api/posix_support/include/pthread.h index fd108553c..780ab30b1 100644 --- a/APP_Framework/Framework/transform_layer/xizi/user_api/posix_support/include/pthread.h +++ b/APP_Framework/Framework/transform_layer/xizi/user_api/posix_support/include/pthread.h @@ -29,9 +29,8 @@ extern "C" { #include #include -#if defined(ARCH_ARM) +#if defined(ARCH_ARM) && !defined(LIB_MUSLLIB) #include "pthread arm.h" -#endif // enum { // PTHREAD_BARRIER_SERIAL_THREAD, @@ -94,7 +93,7 @@ int pthread_setname_np(pthread_t thread, const char *name); int pthread_timedjoin_np(pthread_t thread, void **retval, const struct timespec *abstime); /* function in pthread_mutex.c */ -int pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t *attr); +int pthread_mutex_init(pthread_mutex_t* mutex, const pthread_mutexattr_t* attr); int pthread_mutex_destroy(pthread_mutex_t *mutex); int pthread_mutex_lock(pthread_mutex_t *mutex); int pthread_mutex_unlock(pthread_mutex_t *mutex); @@ -105,7 +104,8 @@ int pthread_mutexattr_destroy(pthread_mutexattr_t *attr); int pthread_mutexattr_gettype(const pthread_mutexattr_t *attr, int *type); int pthread_mutexattr_settype(pthread_mutexattr_t *attr, int type); int pthread_mutexattr_setpshared(pthread_mutexattr_t *attr, int pshared); -int pthread_mutexattr_getpshared(pthread_mutexattr_t *attr, int *pshared); +int pthread_mutexattr_getpshared(const pthread_mutexattr_t *attr, int *pshared); +#endif #ifdef __cplusplus } diff --git a/APP_Framework/Framework/transform_layer/xizi/user_api/posix_support/pthread.c b/APP_Framework/Framework/transform_layer/xizi/user_api/posix_support/pthread.c index 90a163d48..7bc1aea0c 100644 --- a/APP_Framework/Framework/transform_layer/xizi/user_api/posix_support/pthread.c +++ b/APP_Framework/Framework/transform_layer/xizi/user_api/posix_support/pthread.c @@ -49,8 +49,8 @@ int pthread_create(pthread_t *thread, const pthread_attr_t *attr, return -1 ; ret = UserTaskStartup(pid); - *thread = pid; - + *thread = (pthread_t)pid; + return ret; } @@ -63,7 +63,7 @@ void pthread_exit(void *value_ptr){ pthread_t pthread_self(void){ pthread_t pthread ; - pthread = UserGetTaskID(); + pthread = (pthread_t)UserGetTaskID(); return pthread; } @@ -112,7 +112,7 @@ int pthread_join(pthread_t thread, void **retval) int pthread_kill(pthread_t thread, int sig) { /* This api should not be used, and will not be supported */ - UserTaskDelete(thread); + UserTaskDelete((int32_t)thread); return -1; } diff --git a/APP_Framework/Framework/transform_layer/xizi/user_api/posix_support/pthread_mutex.c b/APP_Framework/Framework/transform_layer/xizi/user_api/posix_support/pthread_mutex.c index 6237a555a..4782592c3 100644 --- a/APP_Framework/Framework/transform_layer/xizi/user_api/posix_support/pthread_mutex.c +++ b/APP_Framework/Framework/transform_layer/xizi/user_api/posix_support/pthread_mutex.c @@ -21,7 +21,117 @@ #include #include "include/pthread.h" +#include +#include +#if defined(ARCH_ARM) && defined(LIB_MUSLLIB) +int pthread_mutex_init(pthread_mutex_t* p_mutex, const pthread_mutexattr_t* attr) +{ + pthread_mutexattr_t mutexAttr; + uint32_t mutex_handle; + + // check p_mutex + if (p_mutex == NULL) { + return EINVAL; + } + + // set attr + if (attr == NULL) { + pthread_mutexattr_init(&mutexAttr); + } + else { + mutexAttr = *attr; + } + + // create mutex + mutex_handle = UserMutexCreate(); + if (mutex_handle < 0) { + return mutex_handle; + } + + p_mutex->stAttr = mutexAttr; + p_mutex->magic = _MUX_MAGIC; + p_mutex->handle = mutex_handle; + + return 0; +} + +int pthread_mutex_destroy(pthread_mutex_t *p_mutex) +{ + if ((p_mutex == NULL) || (p_mutex->magic != _MUX_MAGIC)) { + return EINVAL; + } + UserMutexDelete(p_mutex->handle); + p_mutex->handle = _MUX_INVALID_HANDLE; + p_mutex->magic = 0; + return 0; +} + +int pthread_mutex_lock(pthread_mutex_t *p_mutex) +{ + if ((p_mutex == NULL) || (p_mutex->magic != _MUX_MAGIC) || + (p_mutex->handle == _MUX_INVALID_HANDLE)) { + return EINVAL; + } + + return UserMutexObtain(p_mutex->handle, WAITING_FOREVER); +} + +int pthread_mutex_unlock(pthread_mutex_t *p_mutex) +{ + if ((p_mutex == NULL) || (p_mutex->magic != _MUX_MAGIC) || + (p_mutex->handle == _MUX_INVALID_HANDLE)) { + return EINVAL; + } + + return UserMutexAbandon(p_mutex->handle); +} + +int pthread_mutex_trylock(pthread_mutex_t *p_mutex) +{ + if ((p_mutex == NULL) || (p_mutex->magic != _MUX_MAGIC) || + (p_mutex->handle == _MUX_INVALID_HANDLE)) { + return EINVAL; + } + return UserMutexObtain(p_mutex->handle , 0); +} + +int pthread_mutexattr_init(pthread_mutexattr_t *attr) +{ + if (attr == NULL) { + return EINVAL; + } + attr->type = PTHREAD_MUTEX_DEFAULT; + return 0; +} + +int pthread_mutexattr_destroy(pthread_mutexattr_t *attr) +{ + if (attr == NULL) { + return EINVAL; + } + memset(attr, 0, sizeof(pthread_mutexattr_t)); + return 0; +} + +int pthread_mutexattr_gettype(const pthread_mutexattr_t *attr, int *type) +{ + if (attr == NULL) { + return EINVAL; + } + *type = attr->type; + return 0; +} + +int pthread_mutexattr_settype(pthread_mutexattr_t *attr, int type) +{ + if (attr == NULL) { + return EINVAL; + } + attr->type = type; + return 0; +} +#else int pthread_mutex_init(pthread_mutex_t *p_mutex, const pthread_mutexattr_t *attr) { *p_mutex = UserMutexCreate(); @@ -82,9 +192,11 @@ int pthread_mutexattr_settype(pthread_mutexattr_t *attr, int type) return 0; } -int pthread_mutexattr_getprotocol(const pthread_mutexattr_t *restrict attr, int *restrict protocol) -{ +#endif + +int pthread_mutexattr_getprotocol(const pthread_mutexattr_t* restrict attr, int* restrict protocol) +{ return 0; } @@ -118,7 +230,7 @@ int pthread_mutexattr_setpshared(pthread_mutexattr_t *attr, int pshared) return 0; } -int pthread_mutexattr_getpshared(pthread_mutexattr_t *attr, int *pshared) +int pthread_mutexattr_getpshared(const pthread_mutexattr_t *attr, int *pshared) { return 0; } diff --git a/Ubiquitous/XiZi/Makefile b/Ubiquitous/XiZi/Makefile index f46641059..673984c2d 100755 --- a/Ubiquitous/XiZi/Makefile +++ b/Ubiquitous/XiZi/Makefile @@ -2,7 +2,7 @@ MAKEFLAGS += --no-print-directory .PHONY:all clean distclean show_info menuconfig -.PHONY:COMPILE_APP COMPILE_KERNEL +.PHONY:COMPILE_APP COMPILE_KERNEL support :=kd233 stm32f407-st-discovery maix-go stm32f407zgt6 aiit-riscv64-board aiit-arm32-board hifive1-rev-B hifive1-emulator k210-emulator cortex-m3-emulator cortex-m4-emulator ok1052-c gapuino stm32f103-nano gd32vf103-rvstar cortex-m0-emulator rv32m1-vega nuvoton-m2354 @@ -41,30 +41,35 @@ export CPPPATHS export SRC_APP_DIR := ../../APP_Framework export SRC_KERNEL_DIR := arch board lib fs kernel resources tool export SRC_DIR:= $(SRC_APP_DIR) $(SRC_KERNEL_DIR) +export LIBCC +export MUSL_DIR := $(KERNEL_ROOT)/lib/musllib +export LWIP_DIR := $(KERNEL_ROOT)/resources/ethernet PART:= all: - ifeq ($(CONFIG_COMPILER_APP)_$(CONFIG_COMPILER_KERNEL),y_) -include path_app.mk PART += COMPILE_APP else ifeq ($(CONFIG_COMPILER_APP)_$(CONFIG_COMPILER_KERNEL),_y) -include path_kernel.mk PART += COMPILE_KERNEL else ifeq ($(CONFIG_COMPILER_APP)_$(CONFIG_COMPILER_KERNEL),y_y) -include path_app.mk -include path_kernel.mk PART := COMPILE_APP COMPILE_KERNEL else -include path_kernel.mk -CPPPATHS := $(KERNELPATHS) -PART := COMPILE_ALL +PART := + +ifeq ($(CONFIG_LIB_MUSLLIB), y) +PART += COMPILE_MUSL clean endif +ifeq ($(CONFIG_RESOURCES_LWIP), y) +PART += COMPILE_LWIP clean +endif + +PART += COMPILE_ALL +endif all: $(PART) @@ -78,7 +83,40 @@ COMPILE_ALL: @$(MAKE) -C build TARGET=XiZi-$(BOARD).elf LINK_FLAGS=LFLAGS @rm build/Makefile build/make.obj +COMPILE_MUSL: + @for dir in $(MUSL_DIR);do \ + $(MAKE) -C $$dir CONFIG_RESOURCES_LWIP=n; \ + done + @cp link_libc.mk build/Makefile + @$(MAKE) -C build TARGET=libmusl.a LINK_FLAGS=LFLAGS + @cp build/libmusl.a $(KERNEL_ROOT)/lib/musllib/libmusl.a + @rm build/Makefile build/make.obj +COMPILE_LWIP: + @for dir in $(LWIP_DIR);do \ + $(MAKE) -C $$dir COMPILE_TYPE=$@; \ + done + @cp link_lwip.mk build/Makefile + @$(MAKE) -C build TARGET=liblwip.a LINK_FLAGS=LFLAGS + @cp build/liblwip.a $(KERNEL_ROOT)/resources/ethernet/LwIP/liblwip.a + @rm build/Makefile build/make.obj + +COMPILE_KERNEL: + @for dir in $(SRC_KERNEL_DIR);do \ + $(MAKE) -C $$dir; \ + done + @cp link.mk build/Makefile + @$(MAKE) -C build COMPILE_TYPE="_kernel" TARGET=XiZi-$(BOARD)_kernel.elf LINK_FLAGS=LFLAGS + @rm build/Makefile build/make.obj + +COMPILE_APP: + @echo $(SRC_APP_DIR) + @for dir in $(SRC_APP_DIR);do \ + $(MAKE) -C $$dir; \ + done + @cp link.mk build/Makefile + @$(MAKE) -C build COMPILE_TYPE="_app" TARGET=XiZi-$(BOARD)_app.elf LINK_FLAGS=APPLFLAGS USE_APP_INCLUDEPATH=y + @rm build/Makefile build/make.obj show_info: @echo "CONFIG_COMPILER_APP is :" $(CONFIG_COMPILER_APP) diff --git a/Ubiquitous/XiZi/arch/arm/cortex-m0/prepare_ahwstack.c b/Ubiquitous/XiZi/arch/arm/cortex-m0/prepare_ahwstack.c index 6b597821d..1abd6562c 100644 --- a/Ubiquitous/XiZi/arch/arm/cortex-m0/prepare_ahwstack.c +++ b/Ubiquitous/XiZi/arch/arm/cortex-m0/prepare_ahwstack.c @@ -155,13 +155,15 @@ uint8 KTaskStackSetup(struct TaskDescriptor *task) StackContex->ExErrorStackContex.lr = (unsigned long)KTaskQuit; } #else - StackContex->ExErrorStackContex.lr = (unsigned long)KTaskQuit; + StackContex->ExErrorStackContex.lr = (unsigned long)KTaskQuit; + KPrintf("DEBUG: ExErrorStackContex.lr set KTaskQuit..\n"); #endif #if USE_FPU StackContex->flag = 0; #endif + KPrintf("DEBUG: KTaskStackSetup end, task: %i.\n", task->id.id); return EOK; } diff --git a/Ubiquitous/XiZi/board/aiit-arm32-board/config.mk b/Ubiquitous/XiZi/board/aiit-arm32-board/config.mk index 1ca74598e..246a8445f 100644 --- a/Ubiquitous/XiZi/board/aiit-arm32-board/config.mk +++ b/Ubiquitous/XiZi/board/aiit-arm32-board/config.mk @@ -5,6 +5,16 @@ export AFLAGS := -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard - export LFLAGS := -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections -Wl,--gc-sections,-Map=XiZi.map,-cref,-u,Reset_Handler -T $(BSP_ROOT)/link.lds export CXXFLAGS := -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections -Dgcc -O0 -gdwarf-2 -g +ifeq ($(CONFIG_LIB_MUSLLIB), y) +export LFLAGS += -nostdlib -nostdinc -fno-builtin -nodefaultlibs +export LIBCC := -lgcc +export LINK_MUSLLIB := $(KERNEL_ROOT)/lib/musllib/libmusl.a +endif + +ifeq ($(CONFIG_RESOURCES_LWIP), y) +export LINK_LWIP := $(KERNEL_ROOT)/resources/ethernet/LwIP/liblwip.a +endif + export APPLFLAGS := -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections -Wl,--gc-sections,-Map=XiZi-app.map,-cref,-u, -T $(BSP_ROOT)/link_userspace.lds export DEFINES := -DHAVE_CCONFIG_H -DSTM32F407xx -DUSE_HAL_DRIVER -DHAVE_SIGINFO diff --git a/Ubiquitous/XiZi/board/cortex-m0-emulator/config.mk b/Ubiquitous/XiZi/board/cortex-m0-emulator/config.mk index c87f4635d..a79b5fbf8 100644 --- a/Ubiquitous/XiZi/board/cortex-m0-emulator/config.mk +++ b/Ubiquitous/XiZi/board/cortex-m0-emulator/config.mk @@ -7,7 +7,6 @@ export CXXFLAGS := -mcpu=cortex-m0 -mthumb -ffunction-sections -fdata-sections - export APPLFLAGS := -mcpu=cortex-m0 -mthumb -ffunction-sections -fdata-sections -Wl,--gc-sections,-Map=XiZi-app.map,-cref,-u, -T $(BSP_ROOT)/link_userspace.lds - export DEFINES := -DHAVE_CCONFIG_H -g export ARCH = arm diff --git a/Ubiquitous/XiZi/board/cortex-m4-emulator/config.mk b/Ubiquitous/XiZi/board/cortex-m4-emulator/config.mk index 99f554bbb..fa6254e81 100644 --- a/Ubiquitous/XiZi/board/cortex-m4-emulator/config.mk +++ b/Ubiquitous/XiZi/board/cortex-m4-emulator/config.mk @@ -5,6 +5,16 @@ export AFLAGS := -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard - export LFLAGS := -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections -Wl,--gc-sections,-Map=XiZi-cortex-m4-emulator.map,-cref,-u,Reset_Handler -T $(BSP_ROOT)/link.lds export CXXFLAGS := -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections -Dgcc -O0 -gdwarf-2 -g -Werror +ifeq ($(CONFIG_LIB_MUSLLIB), y) +export LFLAGS += -nostdlib -nostdinc -fno-builtin -nodefaultlibs +export LIBCC := -lgcc +export LINK_MUSLLIB := $(KERNEL_ROOT)/lib/musllib/libmusl.a +endif + +ifeq ($(CONFIG_RESOURCES_LWIP), y) +export LINK_LWIP := $(KERNEL_ROOT)/resources/ethernet/LwIP/liblwip.a +endif + export APPLFLAGS := -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections -Wl,--gc-sections,-Map=XiZi-app.map,-cref,-u, -T $(BSP_ROOT)/link_userspace.lds diff --git a/Ubiquitous/XiZi/board/kd233/.defconfig b/Ubiquitous/XiZi/board/kd233/.defconfig index fca5c691d..23ee8c276 100644 --- a/Ubiquitous/XiZi/board/kd233/.defconfig +++ b/Ubiquitous/XiZi/board/kd233/.defconfig @@ -225,6 +225,7 @@ CONFIG_FS_VFS_DEVFS=y CONFIG_LIB=y CONFIG_LIB_POSIX=y CONFIG_LIB_NEWLIB=y +CONFIG_LIB_MUSLLIB=y CONFIG_LITTLEVGL2RTT_USING_DEMO=y diff --git a/Ubiquitous/XiZi/board/kd233/config.mk b/Ubiquitous/XiZi/board/kd233/config.mk index 02b55a7d3..fcfe0ce01 100644 --- a/Ubiquitous/XiZi/board/kd233/config.mk +++ b/Ubiquitous/XiZi/board/kd233/config.mk @@ -1,4 +1,6 @@ -export CFLAGS := -mcmodel=medany -march=rv64imafdc -mabi=lp64d -fno-common -ffunction-sections -fdata-sections -fstrict-volatile-bitfields -O0 -ggdb -fgnu89-inline -Werror +export CFLAGS := -mcmodel=medany -march=rv64imafdc -mabi=lp64d -fno-common -ffunction-sections -fdata-sections -fstrict-volatile-bitfields -O0 -ggdb -fgnu89-inline -Werror +# $(warning, "DEBUG, here add cflags.") +# export CFLAGS += -nostdlib -nostdinc -fno-builtin export AFLAGS := -c -mcmodel=medany -march=rv64imafdc -mabi=lp64d -x assembler-with-cpp -ggdb export LFLAGS := -mcmodel=medany -march=rv64imafdc -mabi=lp64d -nostartfiles -Wl,--gc-sections,-Map=XiZi-kd233.map,-cref,-u,_start -T $(BSP_ROOT)/link.lds diff --git a/Ubiquitous/XiZi/board/stm32f103-nano/config.mk b/Ubiquitous/XiZi/board/stm32f103-nano/config.mk index 3b4e2df0a..a5d587528 100644 --- a/Ubiquitous/XiZi/board/stm32f103-nano/config.mk +++ b/Ubiquitous/XiZi/board/stm32f103-nano/config.mk @@ -7,7 +7,6 @@ export CXXFLAGS := -mcpu=cortex-m3 -mthumb -ffunction-sections -fdata-sections - export APPLFLAGS := -mcpu=cortex-m3 -mthumb -ffunction-sections -fdata-sections -Wl,--gc-sections,-Map=XiZi-app.map,-cref,-u, -T $(BSP_ROOT)/link_userspace.lds - export DEFINES := -DHAVE_CCONFIG_H export ARCH = arm diff --git a/Ubiquitous/XiZi/board/stm32f407-st-discovery/config.mk b/Ubiquitous/XiZi/board/stm32f407-st-discovery/config.mk index a442aa7ac..6928d87a2 100644 --- a/Ubiquitous/XiZi/board/stm32f407-st-discovery/config.mk +++ b/Ubiquitous/XiZi/board/stm32f407-st-discovery/config.mk @@ -1,11 +1,21 @@ export CROSS_COMPILE ?=/usr/bin/arm-none-eabi- -export CFLAGS := -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections -Dgcc -O0 -gdwarf-2 -g -fgnu89-inline -Wa,-mimplicit-it=thumb -Werror -export AFLAGS := -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections -x assembler-with-cpp -Wa,-mimplicit-it=thumb -gdwarf-2 -export LFLAGS := -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections -Wl,--gc-sections,-Map=XiZi-stm32f407-st-discovery.map,-cref,-u,Reset_Handler -T $(BSP_ROOT)/link.lds -export CXXFLAGS := -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections -Dgcc -O0 -gdwarf-2 -g -Werror +export CFLAGS := -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 -ffunction-sections -fdata-sections -Dgcc -O0 -gdwarf-2 -g -fgnu89-inline -Wa,-mimplicit-it=thumb +export AFLAGS := -c -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 -ffunction-sections -fdata-sections -x assembler-with-cpp -Wa,-mimplicit-it=thumb -gdwarf-2 +export LFLAGS := -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 -ffunction-sections -fdata-sections -Wl,--gc-sections,-Map=XiZi-stm32f407-st-discovery.map,-cref,-u,Reset_Handler -T $(BSP_ROOT)/link.lds +export CXXFLAGS := -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 -ffunction-sections -fdata-sections -Dgcc -O0 -gdwarf-2 -g -Werror -export APPLFLAGS := -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections -Wl,--gc-sections,-Map=XiZi-app.map,-cref,-u, -T $(BSP_ROOT)/link_userspace.lds +ifeq ($(CONFIG_LIB_MUSLLIB), y) +export LFLAGS += -nostdlib -nostdinc -fno-builtin -nodefaultlibs +export LIBCC := -lgcc +export LINK_MUSLLIB := $(KERNEL_ROOT)/lib/musllib/libmusl.a +endif + +ifeq ($(CONFIG_RESOURCES_LWIP), y) +export LINK_LWIP := $(KERNEL_ROOT)/resources/ethernet/LwIP/liblwip.a +endif + +export APPLFLAGS := -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 -ffunction-sections -fdata-sections -Wl,--gc-sections,-Map=XiZi-app.map,-cref,-u, -T $(BSP_ROOT)/link_userspace.lds export DEFINES := -DHAVE_CCONFIG_H -DSTM32F407xx -DUSE_HAL_DRIVER -DHAVE_SIGINFO diff --git a/Ubiquitous/XiZi/board/stm32f407zgt6/config.mk b/Ubiquitous/XiZi/board/stm32f407zgt6/config.mk index 763de6a63..59c175c41 100644 --- a/Ubiquitous/XiZi/board/stm32f407zgt6/config.mk +++ b/Ubiquitous/XiZi/board/stm32f407zgt6/config.mk @@ -5,6 +5,16 @@ export AFLAGS := -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard - export LFLAGS := -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections -Wl,--gc-sections,-Map=XiZi.map,-cref,-u,Reset_Handler -T $(BSP_ROOT)/link.lds export CXXFLAGS := -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections -Dgcc -O0 -gdwarf-2 -g -Werror +ifeq ($(CONFIG_LIB_MUSLLIB), y) +export LFLAGS += -nostdlib -nostdinc -fno-builtin -nodefaultlibs +export LIBCC := -lgcc +export LINK_MUSLLIB := $(KERNEL_ROOT)/lib/musllib/libmusl.a +endif + +ifeq ($(CONFIG_RESOURCES_LWIP), y) +export LINK_LWIP := $(KERNEL_ROOT)/resources/ethernet/LwIP/liblwip.a +endif + export APPLFLAGS := -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections -Wl,--gc-sections,-Map=XiZi-app.map,-cref,-u, -T $(BSP_ROOT)/link_userspace.lds export DEFINES := -DHAVE_CCONFIG_H -DSTM32F407xx -DUSE_HAL_DRIVER -DHAVE_SIGINFO diff --git a/Ubiquitous/XiZi/board/xidatong-arm32/config.mk b/Ubiquitous/XiZi/board/xidatong-arm32/config.mk index 1e068925e..25338a2ec 100644 --- a/Ubiquitous/XiZi/board/xidatong-arm32/config.mk +++ b/Ubiquitous/XiZi/board/xidatong-arm32/config.mk @@ -1,14 +1,24 @@ export CROSS_COMPILE ?=/usr/bin/arm-none-eabi- export CFLAGS := -mcpu=cortex-m7 -mthumb -ffunction-sections -fdata-sections -Dgcc -O0 -gdwarf-2 -g -fgnu89-inline -Wa,-mimplicit-it=thumb -export AFLAGS := -c -mcpu=cortex-m7 -mthumb -ffunction-sections -fdata-sections -x assembler-with-cpp -Wa,-mimplicit-it=thumb -gdwarf-2 +export AFLAGS := -c -mcpu=cortex-m7 -mthumb -ffunction-sections -fdata-sections -x assembler-with-cpp -Wa,-mimplicit-it=thumb -gdwarf-2 ### if use USB function, use special lds file because USB uses ITCM +ifeq ($(CONFIG_LIB_MUSLLIB), y) +export LFLAGS += -nostdlib -nostdinc -fno-builtin -nodefaultlibs +export LIBCC := -lgcc +export LINK_MUSLLIB := $(KERNEL_ROOT)/lib/musllib/libmusl.a +endif + +ifeq ($(CONFIG_RESOURCES_LWIP), y) +export LINK_LWIP := $(KERNEL_ROOT)/resources/ethernet/LwIP/liblwip.a +endif + ifeq ($(CONFIG_BSP_USING_USB),y) -export LFLAGS := -mcpu=cortex-m7 -mthumb -ffunction-sections -fdata-sections -Wl,--gc-sections,-Map=XiZi-xidatong-arm32.map,-cref,-u,Reset_Handler -T $(BSP_ROOT)/link-usb.lds +export LFLAGS += -mcpu=cortex-m7 -mthumb -ffunction-sections -fdata-sections -Wl,--gc-sections,-Map=XiZi-xidatong-arm32.map,-cref,-u,Reset_Handler -T $(BSP_ROOT)/link-usb.lds else -export LFLAGS := -mcpu=cortex-m7 -mthumb -ffunction-sections -fdata-sections -Wl,--gc-sections,-Map=XiZi-xidatong-arm32.map,-cref,-u,Reset_Handler -T $(BSP_ROOT)/link.lds +export LFLAGS += -mcpu=cortex-m7 -mthumb -ffunction-sections -fdata-sections -Wl,--gc-sections,-Map=XiZi-xidatong-arm32.map,-cref,-u,Reset_Handler -T $(BSP_ROOT)/link.lds endif export CXXFLAGS := -mcpu=cortex-m7 -mthumb -ffunction-sections -fdata-sections -Dgcc -O0 -gdwarf-2 -g diff --git a/Ubiquitous/XiZi/board/xidatong-arm32/include/board.h b/Ubiquitous/XiZi/board/xidatong-arm32/include/board.h index 9e9e12d44..a7301a34f 100755 --- a/Ubiquitous/XiZi/board/xidatong-arm32/include/board.h +++ b/Ubiquitous/XiZi/board/xidatong-arm32/include/board.h @@ -33,7 +33,7 @@ Modification: #include "fsl_clock.h" #include "fsl_enet.h" #include "clock_config.h" -#include +// #include #include extern int heap_start; diff --git a/Ubiquitous/XiZi/compiler.mk b/Ubiquitous/XiZi/compiler.mk index 05331047a..87aba0280 100644 --- a/Ubiquitous/XiZi/compiler.mk +++ b/Ubiquitous/XiZi/compiler.mk @@ -1,5 +1,21 @@ -SRC_DIR_TEMP :=$(SRC_DIR) -SRC_DIR:= +ifeq ($(COMPILE_TYPE), COMPILE_MUSL) +SRC_DIR_TEMP := $(MUSL_DIR) +else ifeq ($(COMPILE_TYPE), COMPILE_LWIP) +SRC_DIR_TEMP := $(LWIP_DIR) +else +SRC_DIR_TEMP := $(SRC_DIR) +endif + +SRC_DIR := +MUSL_DIR := +LWIP_DIR := + +ifeq ($(USE_APP_INCLUDEPATH), y) + include $(KERNEL_ROOT)/path_app.mk +else + include $(KERNEL_ROOT)/path_kernel.mk +endif +export CPPPATHS := $(KERNELPATHS) CUR_DIR :=$(shell pwd) @@ -34,7 +50,7 @@ $(if $(strip $(LOCALC)),$(eval $(LOCALC): $(1) @if [ ! -d $$(@D) ]; then mkdir -p $$(@D); fi @echo cc $$< @/bin/echo -n $(dir $(LOCALC)) >>$(KERNEL_ROOT)/build/make.dep - @$(CROSS_COMPILE)gcc -MM $$(CFLAGS) -c $$< >>$(KERNEL_ROOT)/build/make.dep + @($(CROSS_COMPILE)gcc -MM $$(CFLAGS) -c $$<) >>$(KERNEL_ROOT)/build/make.dep @$(CROSS_COMPILE)gcc $$(CFLAGS) -c $$< -o $$@)) endef diff --git a/Ubiquitous/XiZi/fs/fatfs/fatfs.c b/Ubiquitous/XiZi/fs/fatfs/fatfs.c index 904f28c25..2314af45f 100644 --- a/Ubiquitous/XiZi/fs/fatfs/fatfs.c +++ b/Ubiquitous/XiZi/fs/fatfs/fatfs.c @@ -357,7 +357,7 @@ static int FatfsStat(struct MountPoint *mp, const char *path, FRESULT res; FILINFO fno; char *ff_path; - struct tm tm; + // struct tm tm; int year, mon, day, hour, min, sec; WORD tmp; @@ -465,7 +465,7 @@ DWORD GetFatTime(void) { DWORD fat_time = 0; -#ifdef LIB +#if defined LIB && !defined(LIB_MUSLLIB) time_t now; struct tm *p_tm; struct tm tm_now; diff --git a/Ubiquitous/XiZi/fs/shared/include/iot-vfs.h b/Ubiquitous/XiZi/fs/shared/include/iot-vfs.h index d1531e5c2..7a4062ba5 100644 --- a/Ubiquitous/XiZi/fs/shared/include/iot-vfs.h +++ b/Ubiquitous/XiZi/fs/shared/include/iot-vfs.h @@ -13,7 +13,6 @@ #ifndef _INC_IOT_VFS_H_ #define _INC_IOT_VFS_H_ -#include #include #define MAX_FILE_NAME 255 diff --git a/Ubiquitous/XiZi/fs/shared/include/iot-vfs_posix.h b/Ubiquitous/XiZi/fs/shared/include/iot-vfs_posix.h index af5631817..00f67aaee 100644 --- a/Ubiquitous/XiZi/fs/shared/include/iot-vfs_posix.h +++ b/Ubiquitous/XiZi/fs/shared/include/iot-vfs_posix.h @@ -25,14 +25,16 @@ int read(int fd, void *buf, size_t len); int write(int fd, const void *buf, size_t len); #endif -int open(const char *path, int flags, ...); + + +int open(const char* path, int flags, ...); int close(int fd); -int ioctl(int fd, int cmd, void *args); +int ioctl(int fd, int cmd, ...); off_t lseek(int fd, off_t offset, int whence); int rename(const char *from, const char *to); int unlink(const char *path); -int stat(const char *path, struct stat *buf); -int fstat(int fd, struct stat *buf); +// int stat(const char *path, struct stat *buf); +// int fstat(int fd, struct stat *buf); int fsync(int fd); int ftruncate(int fd, off_t length); diff --git a/Ubiquitous/XiZi/fs/shared/src/iot-vfs.c b/Ubiquitous/XiZi/fs/shared/src/iot-vfs.c index e1ef093d9..0983fecf0 100644 --- a/Ubiquitous/XiZi/fs/shared/src/iot-vfs.c +++ b/Ubiquitous/XiZi/fs/shared/src/iot-vfs.c @@ -573,7 +573,8 @@ int write(int fd, const void *buf, size_t len) return ret; } -int ioctl(int fd, int cmd, void *args) +#ifndef LIB_MUSLLIB +int ioctl(int fd, int cmd, ...) { int ret; struct FileDescriptor *fdp; @@ -589,7 +590,10 @@ int ioctl(int fd, int cmd, void *args) return -1; } - ret = fdp->mntp->fs->ioctl(fdp, cmd, args); + va_list ap; + va_start(ap, cmd); + ret = fdp->mntp->fs->ioctl(fdp, cmd, (void*)va_arg(ap, int)); + va_end(ap); if (ret < 0) { SYS_ERR("%s: ioctl file failed\n", __func__); KUpdateExstatus(ret); @@ -598,6 +602,7 @@ int ioctl(int fd, int cmd, void *args) return ret; } +#endif off_t lseek(int fd, off_t offset, int whence) { diff --git a/Ubiquitous/XiZi/kernel/include/xizi.h b/Ubiquitous/XiZi/kernel/include/xizi.h index ab021cee2..022058680 100644 --- a/Ubiquitous/XiZi/kernel/include/xizi.h +++ b/Ubiquitous/XiZi/kernel/include/xizi.h @@ -35,6 +35,12 @@ #include #include #include +#include +#include +#include +#include +#include +#include #include #include #include diff --git a/Ubiquitous/XiZi/kernel/include/xs_kdevice.h b/Ubiquitous/XiZi/kernel/include/xs_kdevice.h index c3d2bf3dc..c6b07695d 100644 --- a/Ubiquitous/XiZi/kernel/include/xs_kdevice.h +++ b/Ubiquitous/XiZi/kernel/include/xs_kdevice.h @@ -80,11 +80,11 @@ enum SIGN_OPER struct DeviceBlockArrange { - uint32 bank_num; - uint32 size_perbank; - uint32 block_size; - uint16 bank_start; - uint16 bank_end; + uint32_t bank_num; + uint32_t size_perbank; + uint32_t block_size; + uint16_t bank_start; + uint16_t bank_end; }; struct DeviceBlockAddr diff --git a/Ubiquitous/XiZi/kernel/include/xs_klist.h b/Ubiquitous/XiZi/kernel/include/xs_klist.h index 3234bf646..57920646c 100644 --- a/Ubiquitous/XiZi/kernel/include/xs_klist.h +++ b/Ubiquitous/XiZi/kernel/include/xs_klist.h @@ -23,7 +23,7 @@ #define XS_KLIST_H #include -#include "libc.h" +// #include #ifdef __cplusplus extern "C" { diff --git a/Ubiquitous/XiZi/kernel/include/xs_ktask.h b/Ubiquitous/XiZi/kernel/include/xs_ktask.h index 8e991998e..cce200f64 100644 --- a/Ubiquitous/XiZi/kernel/include/xs_ktask.h +++ b/Ubiquitous/XiZi/kernel/include/xs_ktask.h @@ -170,7 +170,7 @@ int32 UTaskCreate(const char *name, void KUpdateExstatus(x_err_t no); int *KObtainExstatus(void); -#if !defined(LIB_NEWLIB) && !defined(_WIN32) +#if !defined(LIB_NEWLIB) && !defined(LIB_MUSLLIB) && !defined(_WIN32) #ifndef errno #define errno *KObtainExstatus() #endif diff --git a/Ubiquitous/XiZi/kernel/include/xs_memory.h b/Ubiquitous/XiZi/kernel/include/xs_memory.h index 0d9c9f958..17ffea9bc 100644 --- a/Ubiquitous/XiZi/kernel/include/xs_memory.h +++ b/Ubiquitous/XiZi/kernel/include/xs_memory.h @@ -23,6 +23,7 @@ #define XS_MEMORY_H #include +#include #ifdef __cplusplus extern "C" { diff --git a/Ubiquitous/XiZi/kernel/thread/assign.c b/Ubiquitous/XiZi/kernel/thread/assign.c index 776b61f6a..93b4ef325 100644 --- a/Ubiquitous/XiZi/kernel/thread/assign.c +++ b/Ubiquitous/XiZi/kernel/thread/assign.c @@ -270,6 +270,7 @@ static inline void SwitchToFirstRunningTask(struct TaskDescriptor* task) Assign.ready_vector_done->remove(task); KTaskStatSetAsRunning(task); + KPrintf("DEBUG: calling SwitchKtaskContextTo, task: %i.\n", task->id.id); SwitchKtaskContextTo((x_ubase)&task->stack_point, task); } @@ -372,7 +373,7 @@ void StartupOsAssign(void) FirstRunningTask = ChooseTaskWithHighestPrio(&Assign.os_assign_read_vector); SetSystemRunningTask(FirstRunningTask); - + KPrintf("DEBUG: calling SwitchToFirstRunningTask.\n"); SwitchToFirstRunningTask(FirstRunningTask); } diff --git a/Ubiquitous/XiZi/kernel/thread/init.c b/Ubiquitous/XiZi/kernel/thread/init.c index 8504a3ba7..5ad6c9aa5 100644 --- a/Ubiquitous/XiZi/kernel/thread/init.c +++ b/Ubiquitous/XiZi/kernel/thread/init.c @@ -155,9 +155,10 @@ void _InitSubCmpts(struct InitSequenceDesc sub_cmpts[]) #ifdef KERNEL_COMPONENTS_INIT void EnvInitKTask(void *parameter) { + KPrintf("DEBUG: RUNNING ENV TASK\n"); x_base lock = 0; lock = DISABLE_INTERRUPT(); - _InitSubCmpts(prev_cmpts_init); + _InitSubCmpts(prev_cmpts_init); _InitSubCmpts(device_init); _InitSubCmpts(components_init); _InitSubCmpts(env_init); @@ -186,13 +187,15 @@ void CreateEnvInitTask(void) int32 env_init = 0; env_init = KTaskCreate("env_init", EnvInitKTask, NONE, - ENV_INIT_KTASK_STACK_SIZE, KTASK_PRIORITY_MAX - 1); - if(env_init < 0) { + ENV_INIT_KTASK_STACK_SIZE, KTASK_PRIORITY_MAX - 1); + KPrintf("DEBUG: Env KTaskCreate end. env_init: %i.\n", env_init); + if (env_init < 0) { KPrintf("env_init create failed ...%s %d.\n",__FUNCTION__,__LINE__); return; } - StartupKTask(env_init); + StartupKTask(env_init); + KPrintf("DEBUG: Env StartupTask end.\n"); } #endif /* KERNEL_COMPONENTS_INIT */ @@ -250,8 +253,8 @@ extern int InitUserspace(void); StartWatchdog(); #endif - StartupOsAssign(); - + KPrintf("DEBUG: calling StartipOsAssign.\n"); + StartupOsAssign(); return 0; } diff --git a/Ubiquitous/XiZi/lib/Kconfig b/Ubiquitous/XiZi/lib/Kconfig index b46c292c3..6937a73fb 100644 --- a/Ubiquitous/XiZi/lib/Kconfig +++ b/Ubiquitous/XiZi/lib/Kconfig @@ -1,23 +1,26 @@ menu "Lib" - - menuconfig LIB bool "Enable libc APIs from toolchain" default y - if LIB config LIB_POSIX bool "Enable POSIX layer for poll/select, stdin etc" default y endif + choice + prompt "select libc" + default LIB_NEWLIB + config LIB_NEWLIB + bool "use newlib as libc realization." + config LIB_MUSLLIB + bool "use musllib as libc realization." + endchoice source "$KERNEL_DIR/lib/libcpp/Kconfig" -source "$KERNEL_DIR/lib/newlib/Kconfig" - endmenu diff --git a/Ubiquitous/XiZi/lib/Makefile b/Ubiquitous/XiZi/lib/Makefile index 92ae7123c..cf537508c 100644 --- a/Ubiquitous/XiZi/lib/Makefile +++ b/Ubiquitous/XiZi/lib/Makefile @@ -1,5 +1,5 @@ SRC_DIR := - +MUSL_DIR := @@ -11,6 +11,10 @@ ifeq ($(CONFIG_LIB_CPLUSPLUS),y) SRC_DIR += libcpp endif +ifeq ($(CONFIG_LIB_MUSLLIB), y) +# SRC_DIR += musllib +# MUSL_DIR += musllib +endif include $(KERNEL_ROOT)/compiler.mk diff --git a/Ubiquitous/XiZi/lib/musllib/Kconfig b/Ubiquitous/XiZi/lib/musllib/Kconfig new file mode 100644 index 000000000..6195024ce --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/Kconfig @@ -0,0 +1,3 @@ +menuconfig LIB_MUSLLIB +bool "Enable Musllib " +default y \ No newline at end of file diff --git a/Ubiquitous/XiZi/lib/musllib/Makefile b/Ubiquitous/XiZi/lib/musllib/Makefile new file mode 100644 index 000000000..cfbfe3464 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/Makefile @@ -0,0 +1,5 @@ +SRC_DIR := src +MUSL_DIR := src + + +include $(KERNEL_ROOT)/compiler.mk \ No newline at end of file diff --git a/Ubiquitous/XiZi/lib/musllib/arch/arm/arch.mak b/Ubiquitous/XiZi/lib/musllib/arch/arm/arch.mak new file mode 100644 index 000000000..aa4d05cef --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/arch/arm/arch.mak @@ -0,0 +1 @@ +COMPAT_SRC_DIRS = compat/time32 diff --git a/Ubiquitous/XiZi/lib/musllib/arch/arm/atomic_arch.h b/Ubiquitous/XiZi/lib/musllib/arch/arm/atomic_arch.h new file mode 100644 index 000000000..9e3937cc0 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/arch/arm/atomic_arch.h @@ -0,0 +1,107 @@ +#include "libc.h" + +#if __ARM_ARCH_4__ || __ARM_ARCH_4T__ || __ARM_ARCH == 4 +#define BLX "mov lr,pc\n\tbx" +#else +#define BLX "blx" +#endif + +extern hidden uintptr_t __a_cas_ptr, __a_barrier_ptr; + +#if ((__ARM_ARCH_6__ || __ARM_ARCH_6K__ || __ARM_ARCH_6KZ__ || __ARM_ARCH_6ZK__) && !__thumb__) \ + || __ARM_ARCH_6T2__ || __ARM_ARCH_7A__ || __ARM_ARCH_7R__ || __ARM_ARCH >= 7 + +#define a_ll a_ll +static inline int a_ll(volatile int *p) +{ + int v; + __asm__ __volatile__ ("ldrex %0, %1" : "=r"(v) : "Q"(*p)); + return v; +} + +#define a_sc a_sc +static inline int a_sc(volatile int *p, int v) +{ + int r; + __asm__ __volatile__ ("strex %0,%2,%1" : "=&r"(r), "=Q"(*p) : "r"(v) : "memory"); + return !r; +} + +#if __ARM_ARCH_7A__ || __ARM_ARCH_7R__ || __ARM_ARCH >= 7 + +#define a_barrier a_barrier +static inline void a_barrier() +{ + __asm__ __volatile__ ("dmb ish" : : : "memory"); +} + +#endif + +#define a_pre_llsc a_barrier +#define a_post_llsc a_barrier + +#else + +#define a_cas a_cas +static inline int a_cas(volatile int *p, int t, int s) +{ + for (;;) { + register int r0 __asm__("r0") = t; + register int r1 __asm__("r1") = s; + register volatile int *r2 __asm__("r2") = p; + register uintptr_t r3 __asm__("r3") = __a_cas_ptr; + int old; + __asm__ __volatile__ ( + BLX " r3" + : "+r"(r0), "+r"(r3) : "r"(r1), "r"(r2) + : "memory", "lr", "ip", "cc" ); + if (!r0) return t; + if ((old=*p)!=t) return old; + } +} + +#endif + +#ifndef a_barrier +#define a_barrier a_barrier +static inline void a_barrier() +{ + register uintptr_t ip __asm__("ip") = __a_barrier_ptr; + __asm__ __volatile__( BLX " ip" : "+r"(ip) : : "memory", "cc", "lr" ); +} +#endif + +#define a_crash a_crash +static inline void a_crash() +{ + __asm__ __volatile__( +#ifndef __thumb__ + ".word 0xe7f000f0" +#else + ".short 0xdeff" +#endif + : : : "memory"); +} + +#if __ARM_ARCH >= 5 && (!__thumb__ || __thumb2__) + +#define a_clz_32 a_clz_32 +static inline int a_clz_32(uint32_t x) +{ + __asm__ ("clz %0, %1" : "=r"(x) : "r"(x)); + return x; +} + +#if __ARM_ARCH_6T2__ || __ARM_ARCH_7A__ || __ARM_ARCH_7R__ || __ARM_ARCH >= 7 + +#define a_ctz_32 a_ctz_32 +static inline int a_ctz_32(uint32_t x) +{ + uint32_t xr; + __asm__ ("rbit %0, %1" : "=r"(xr) : "r"(x)); + return a_clz_32(xr); +} + +#endif + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/arch/arm/bits/alltypes.h.in b/Ubiquitous/XiZi/lib/musllib/arch/arm/bits/alltypes.h.in new file mode 100644 index 000000000..d62bd7bde --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/arch/arm/bits/alltypes.h.in @@ -0,0 +1,21 @@ +#define _REDIR_TIME64 1 +#define _Addr int +#define _Int64 long long +#define _Reg int + +#if __ARMEB__ +#define __BYTE_ORDER 4321 +#else +#define __BYTE_ORDER 1234 +#endif + +#define __LONG_MAX 0x7fffffffL + +#ifndef __cplusplus +TYPEDEF unsigned wchar_t; +#endif + +TYPEDEF float float_t; +TYPEDEF double double_t; + +TYPEDEF struct { long long __ll; long double __ld; } max_align_t; diff --git a/Ubiquitous/XiZi/lib/musllib/arch/arm/bits/fcntl.h b/Ubiquitous/XiZi/lib/musllib/arch/arm/bits/fcntl.h new file mode 100644 index 000000000..4cb1753b7 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/arch/arm/bits/fcntl.h @@ -0,0 +1,40 @@ +#define O_CREAT 0100 +#define O_EXCL 0200 +#define O_NOCTTY 0400 +#define O_TRUNC 01000 +#define O_APPEND 02000 +#define O_NONBLOCK 04000 +#define O_DSYNC 010000 +#define O_SYNC 04010000 +#define O_RSYNC 04010000 +#define O_DIRECTORY 040000 +#define O_NOFOLLOW 0100000 +#define O_CLOEXEC 02000000 + +#define O_ASYNC 020000 +#define O_DIRECT 0200000 +#define O_LARGEFILE 0400000 +#define O_NOATIME 01000000 +#define O_PATH 010000000 +#define O_TMPFILE 020040000 +#define O_NDELAY O_NONBLOCK + +#define F_DUPFD 0 +#define F_GETFD 1 +#define F_SETFD 2 +#define F_GETFL 3 +#define F_SETFL 4 + +#define F_SETOWN 8 +#define F_GETOWN 9 +#define F_SETSIG 10 +#define F_GETSIG 11 + +#define F_GETLK 12 +#define F_SETLK 13 +#define F_SETLKW 14 + +#define F_SETOWN_EX 15 +#define F_GETOWN_EX 16 + +#define F_GETOWNER_UIDS 17 diff --git a/Ubiquitous/XiZi/lib/musllib/arch/arm/bits/fenv.h b/Ubiquitous/XiZi/lib/musllib/arch/arm/bits/fenv.h new file mode 100644 index 000000000..d85fc86d7 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/arch/arm/bits/fenv.h @@ -0,0 +1,23 @@ +#ifndef __ARM_PCS_VFP +#define FE_ALL_EXCEPT 0 +#define FE_TONEAREST 0 +#else +#define FE_INVALID 1 +#define FE_DIVBYZERO 2 +#define FE_OVERFLOW 4 +#define FE_UNDERFLOW 8 +#define FE_INEXACT 16 +#define FE_ALL_EXCEPT 31 +#define FE_TONEAREST 0 +#define FE_DOWNWARD 0x800000 +#define FE_UPWARD 0x400000 +#define FE_TOWARDZERO 0xc00000 +#endif + +typedef unsigned long fexcept_t; + +typedef struct { + unsigned long __cw; +} fenv_t; + +#define FE_DFL_ENV ((const fenv_t *) -1) diff --git a/Ubiquitous/XiZi/lib/musllib/arch/arm/bits/float.h b/Ubiquitous/XiZi/lib/musllib/arch/arm/bits/float.h new file mode 100644 index 000000000..c4a655e7b --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/arch/arm/bits/float.h @@ -0,0 +1,16 @@ +#define FLT_EVAL_METHOD 0 + +#define LDBL_TRUE_MIN 4.94065645841246544177e-324L +#define LDBL_MIN 2.22507385850720138309e-308L +#define LDBL_MAX 1.79769313486231570815e+308L +#define LDBL_EPSILON 2.22044604925031308085e-16L + +#define LDBL_MANT_DIG 53 +#define LDBL_MIN_EXP (-1021) +#define LDBL_MAX_EXP 1024 + +#define LDBL_DIG 15 +#define LDBL_MIN_10_EXP (-307) +#define LDBL_MAX_10_EXP 308 + +#define DECIMAL_DIG 17 diff --git a/Ubiquitous/XiZi/lib/musllib/arch/arm/bits/hwcap.h b/Ubiquitous/XiZi/lib/musllib/arch/arm/bits/hwcap.h new file mode 100644 index 000000000..a3d87312d --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/arch/arm/bits/hwcap.h @@ -0,0 +1,53 @@ +#define HWCAP_SWP (1 << 0) +#define HWCAP_HALF (1 << 1) +#define HWCAP_THUMB (1 << 2) +#define HWCAP_26BIT (1 << 3) +#define HWCAP_FAST_MULT (1 << 4) +#define HWCAP_FPA (1 << 5) +#define HWCAP_VFP (1 << 6) +#define HWCAP_EDSP (1 << 7) +#define HWCAP_JAVA (1 << 8) +#define HWCAP_IWMMXT (1 << 9) +#define HWCAP_CRUNCH (1 << 10) +#define HWCAP_THUMBEE (1 << 11) +#define HWCAP_NEON (1 << 12) +#define HWCAP_VFPv3 (1 << 13) +#define HWCAP_VFPv3D16 (1 << 14) +#define HWCAP_TLS (1 << 15) +#define HWCAP_VFPv4 (1 << 16) +#define HWCAP_IDIVA (1 << 17) +#define HWCAP_IDIVT (1 << 18) +#define HWCAP_VFPD32 (1 << 19) +#define HWCAP_IDIV (HWCAP_IDIVA | HWCAP_IDIVT) +#define HWCAP_LPAE (1 << 20) +#define HWCAP_EVTSTRM (1 << 21) + +#define HWCAP2_AES (1 << 0) +#define HWCAP2_PMULL (1 << 1) +#define HWCAP2_SHA1 (1 << 2) +#define HWCAP2_SHA2 (1 << 3) +#define HWCAP2_CRC32 (1 << 4) + +#define HWCAP_ARM_SWP (1 << 0) +#define HWCAP_ARM_HALF (1 << 1) +#define HWCAP_ARM_THUMB (1 << 2) +#define HWCAP_ARM_26BIT (1 << 3) +#define HWCAP_ARM_FAST_MULT (1 << 4) +#define HWCAP_ARM_FPA (1 << 5) +#define HWCAP_ARM_VFP (1 << 6) +#define HWCAP_ARM_EDSP (1 << 7) +#define HWCAP_ARM_JAVA (1 << 8) +#define HWCAP_ARM_IWMMXT (1 << 9) +#define HWCAP_ARM_CRUNCH (1 << 10) +#define HWCAP_ARM_THUMBEE (1 << 11) +#define HWCAP_ARM_NEON (1 << 12) +#define HWCAP_ARM_VFPv3 (1 << 13) +#define HWCAP_ARM_VFPv3D16 (1 << 14) +#define HWCAP_ARM_TLS (1 << 15) +#define HWCAP_ARM_VFPv4 (1 << 16) +#define HWCAP_ARM_IDIVA (1 << 17) +#define HWCAP_ARM_IDIVT (1 << 18) +#define HWCAP_ARM_VFPD32 (1 << 19) +#define HWCAP_ARM_IDIV (HWCAP_ARM_IDIVA | HWCAP_ARM_IDIVT) +#define HWCAP_ARM_LPAE (1 << 20) +#define HWCAP_ARM_EVTSTRM (1 << 21) diff --git a/Ubiquitous/XiZi/lib/musllib/arch/arm/bits/ioctl_fix.h b/Ubiquitous/XiZi/lib/musllib/arch/arm/bits/ioctl_fix.h new file mode 100644 index 000000000..ebb383daf --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/arch/arm/bits/ioctl_fix.h @@ -0,0 +1,2 @@ +#undef FIOQSIZE +#define FIOQSIZE 0x545e diff --git a/Ubiquitous/XiZi/lib/musllib/arch/arm/bits/ipcstat.h b/Ubiquitous/XiZi/lib/musllib/arch/arm/bits/ipcstat.h new file mode 100644 index 000000000..4f4fcb0c5 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/arch/arm/bits/ipcstat.h @@ -0,0 +1 @@ +#define IPC_STAT 0x102 diff --git a/Ubiquitous/XiZi/lib/musllib/arch/arm/bits/msg.h b/Ubiquitous/XiZi/lib/musllib/arch/arm/bits/msg.h new file mode 100644 index 000000000..7bbbb2bf4 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/arch/arm/bits/msg.h @@ -0,0 +1,18 @@ +struct msqid_ds { + struct ipc_perm msg_perm; + unsigned long __msg_stime_lo; + unsigned long __msg_stime_hi; + unsigned long __msg_rtime_lo; + unsigned long __msg_rtime_hi; + unsigned long __msg_ctime_lo; + unsigned long __msg_ctime_hi; + unsigned long msg_cbytes; + msgqnum_t msg_qnum; + msglen_t msg_qbytes; + pid_t msg_lspid; + pid_t msg_lrpid; + unsigned long __unused[2]; + time_t msg_stime; + time_t msg_rtime; + time_t msg_ctime; +}; diff --git a/Ubiquitous/XiZi/lib/musllib/arch/arm/bits/posix.h b/Ubiquitous/XiZi/lib/musllib/arch/arm/bits/posix.h new file mode 100644 index 000000000..30a38714f --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/arch/arm/bits/posix.h @@ -0,0 +1,2 @@ +#define _POSIX_V6_ILP32_OFFBIG 1 +#define _POSIX_V7_ILP32_OFFBIG 1 diff --git a/Ubiquitous/XiZi/lib/musllib/arch/arm/bits/ptrace.h b/Ubiquitous/XiZi/lib/musllib/arch/arm/bits/ptrace.h new file mode 100644 index 000000000..9556ef4b7 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/arch/arm/bits/ptrace.h @@ -0,0 +1,25 @@ +#define PTRACE_GETWMMXREGS 18 +#define PTRACE_SETWMMXREGS 19 +#define PTRACE_GET_THREAD_AREA 22 +#define PTRACE_SET_SYSCALL 23 +#define PTRACE_GETCRUNCHREGS 25 +#define PTRACE_SETCRUNCHREGS 26 +#define PTRACE_GETVFPREGS 27 +#define PTRACE_SETVFPREGS 28 +#define PTRACE_GETHBPREGS 29 +#define PTRACE_SETHBPREGS 30 +#define PTRACE_GETFDPIC 31 +#define PTRACE_GETFDPIC_EXEC 0 +#define PTRACE_GETFDPIC_INTERP 1 + +#define PT_GETWMMXREGS PTRACE_GETWMMXREGS +#define PT_SETWMMXREGS PTRACE_SETWMMXREGS +#define PT_GET_THREAD_AREA PTRACE_GET_THREAD_AREA +#define PT_SET_SYSCALL PTRACE_SET_SYSCALL +#define PT_GETCRUNCHREGS PTRACE_GETCRUNCHREGS +#define PT_SETCRUNCHREGS PTRACE_SETCRUNCHREGS +#define PT_GETVFPREGS PTRACE_GETVFPREGS +#define PT_SETVFPREGS PTRACE_SETVFPREGS +#define PT_GETHBPREGS PTRACE_GETHBPREGS +#define PT_SETHBPREGS PTRACE_SETHBPREGS +#define PT_GETFDPIC PTRACE_GETFDPIC diff --git a/Ubiquitous/XiZi/lib/musllib/arch/arm/bits/reg.h b/Ubiquitous/XiZi/lib/musllib/arch/arm/bits/reg.h new file mode 100644 index 000000000..0c7bffca0 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/arch/arm/bits/reg.h @@ -0,0 +1,3 @@ +#undef __WORDSIZE +#define __WORDSIZE 32 +/* FIXME */ diff --git a/Ubiquitous/XiZi/lib/musllib/arch/arm/bits/sem.h b/Ubiquitous/XiZi/lib/musllib/arch/arm/bits/sem.h new file mode 100644 index 000000000..544e3d2a5 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/arch/arm/bits/sem.h @@ -0,0 +1,18 @@ +struct semid_ds { + struct ipc_perm sem_perm; + unsigned long __sem_otime_lo; + unsigned long __sem_otime_hi; + unsigned long __sem_ctime_lo; + unsigned long __sem_ctime_hi; +#if __BYTE_ORDER == __LITTLE_ENDIAN + unsigned short sem_nsems; + char __sem_nsems_pad[sizeof(long)-sizeof(short)]; +#else + char __sem_nsems_pad[sizeof(long)-sizeof(short)]; + unsigned short sem_nsems; +#endif + long __unused3; + long __unused4; + time_t sem_otime; + time_t sem_ctime; +}; diff --git a/Ubiquitous/XiZi/lib/musllib/arch/arm/bits/setjmp.h b/Ubiquitous/XiZi/lib/musllib/arch/arm/bits/setjmp.h new file mode 100644 index 000000000..55e3a95bb --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/arch/arm/bits/setjmp.h @@ -0,0 +1 @@ +typedef unsigned long long __jmp_buf[32]; diff --git a/Ubiquitous/XiZi/lib/musllib/arch/arm/bits/shm.h b/Ubiquitous/XiZi/lib/musllib/arch/arm/bits/shm.h new file mode 100644 index 000000000..725fb4696 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/arch/arm/bits/shm.h @@ -0,0 +1,31 @@ +#define SHMLBA 4096 + +struct shmid_ds { + struct ipc_perm shm_perm; + size_t shm_segsz; + unsigned long __shm_atime_lo; + unsigned long __shm_atime_hi; + unsigned long __shm_dtime_lo; + unsigned long __shm_dtime_hi; + unsigned long __shm_ctime_lo; + unsigned long __shm_ctime_hi; + pid_t shm_cpid; + pid_t shm_lpid; + unsigned long shm_nattch; + unsigned long __pad1; + unsigned long __pad2; + unsigned long __pad3; + time_t shm_atime; + time_t shm_dtime; + time_t shm_ctime; +}; + +struct shminfo { + unsigned long shmmax, shmmin, shmmni, shmseg, shmall, __unused[4]; +}; + +struct shm_info { + int __used_ids; + unsigned long shm_tot, shm_rss, shm_swp; + unsigned long __swap_attempts, __swap_successes; +}; diff --git a/Ubiquitous/XiZi/lib/musllib/arch/arm/bits/signal.h b/Ubiquitous/XiZi/lib/musllib/arch/arm/bits/signal.h new file mode 100644 index 000000000..3c7898567 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/arch/arm/bits/signal.h @@ -0,0 +1,86 @@ +#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \ + || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) + +#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +#define MINSIGSTKSZ 2048 +#define SIGSTKSZ 8192 +#endif + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +typedef int greg_t, gregset_t[18]; +typedef struct sigcontext { + unsigned long trap_no, error_code, oldmask; + unsigned long arm_r0, arm_r1, arm_r2, arm_r3; + unsigned long arm_r4, arm_r5, arm_r6, arm_r7; + unsigned long arm_r8, arm_r9, arm_r10, arm_fp; + unsigned long arm_ip, arm_sp, arm_lr, arm_pc; + unsigned long arm_cpsr, fault_address; +} mcontext_t; +#else +typedef struct { + unsigned long __regs[21]; +} mcontext_t; +#endif + +struct sigaltstack { + void *ss_sp; + int ss_flags; + size_t ss_size; +}; + +typedef struct __ucontext { + unsigned long uc_flags; + struct __ucontext *uc_link; + stack_t uc_stack; + mcontext_t uc_mcontext; + sigset_t uc_sigmask; + unsigned long long uc_regspace[64]; +} ucontext_t; + +#define SA_NOCLDSTOP 1 +#define SA_NOCLDWAIT 2 +#define SA_SIGINFO 4 +#define SA_ONSTACK 0x08000000 +#define SA_RESTART 0x10000000 +#define SA_NODEFER 0x40000000 +#define SA_RESETHAND 0x80000000 +#define SA_RESTORER 0x04000000 + +#endif + +#define SIGHUP 1 +#define SIGINT 2 +#define SIGQUIT 3 +#define SIGILL 4 +#define SIGTRAP 5 +#define SIGABRT 6 +#define SIGIOT SIGABRT +#define SIGBUS 7 +#define SIGFPE 8 +#define SIGKILL 9 +#define SIGUSR1 10 +#define SIGSEGV 11 +#define SIGUSR2 12 +#define SIGPIPE 13 +#define SIGALRM 14 +#define SIGTERM 15 +#define SIGSTKFLT 16 +#define SIGCHLD 17 +#define SIGCONT 18 +#define SIGSTOP 19 +#define SIGTSTP 20 +#define SIGTTIN 21 +#define SIGTTOU 22 +#define SIGURG 23 +#define SIGXCPU 24 +#define SIGXFSZ 25 +#define SIGVTALRM 26 +#define SIGPROF 27 +#define SIGWINCH 28 +#define SIGIO 29 +#define SIGPOLL 29 +#define SIGPWR 30 +#define SIGSYS 31 +#define SIGUNUSED SIGSYS + +#define _NSIG 65 diff --git a/Ubiquitous/XiZi/lib/musllib/arch/arm/bits/stat.h b/Ubiquitous/XiZi/lib/musllib/arch/arm/bits/stat.h new file mode 100644 index 000000000..5d7828cf7 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/arch/arm/bits/stat.h @@ -0,0 +1,25 @@ +/* copied from kernel definition, but with padding replaced + * by the corresponding correctly-sized userspace types. */ + +struct stat { + dev_t st_dev; + int __st_dev_padding; + long __st_ino_truncated; + mode_t st_mode; + nlink_t st_nlink; + uid_t st_uid; + gid_t st_gid; + dev_t st_rdev; + int __st_rdev_padding; + off_t st_size; + blksize_t st_blksize; + blkcnt_t st_blocks; + struct { + long tv_sec; + long tv_nsec; + } __st_atim32, __st_mtim32, __st_ctim32; + ino_t st_ino; + struct timespec st_atim; + struct timespec st_mtim; + struct timespec st_ctim; +}; diff --git a/Ubiquitous/XiZi/lib/musllib/arch/arm/bits/stdint.h b/Ubiquitous/XiZi/lib/musllib/arch/arm/bits/stdint.h new file mode 100644 index 000000000..d1b271219 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/arch/arm/bits/stdint.h @@ -0,0 +1,20 @@ +typedef int32_t int_fast16_t; +typedef int32_t int_fast32_t; +typedef uint32_t uint_fast16_t; +typedef uint32_t uint_fast32_t; + +#define INT_FAST16_MIN INT32_MIN +#define INT_FAST32_MIN INT32_MIN + +#define INT_FAST16_MAX INT32_MAX +#define INT_FAST32_MAX INT32_MAX + +#define UINT_FAST16_MAX UINT32_MAX +#define UINT_FAST32_MAX UINT32_MAX + +#define INTPTR_MIN INT32_MIN +#define INTPTR_MAX INT32_MAX +#define UINTPTR_MAX UINT32_MAX +#define PTRDIFF_MIN INT32_MIN +#define PTRDIFF_MAX INT32_MAX +#define SIZE_MAX UINT32_MAX diff --git a/Ubiquitous/XiZi/lib/musllib/arch/arm/bits/syscall.h.in b/Ubiquitous/XiZi/lib/musllib/arch/arm/bits/syscall.h.in new file mode 100644 index 000000000..048fdea79 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/arch/arm/bits/syscall.h.in @@ -0,0 +1,409 @@ +#define __NR_restart_syscall 0 +#define __NR_exit 1 +#define __NR_fork 2 +#define __NR_read 3 +#define __NR_write 4 +#define __NR_open 5 +#define __NR_close 6 +#define __NR_creat 8 +#define __NR_link 9 +#define __NR_unlink 10 +#define __NR_execve 11 +#define __NR_chdir 12 +#define __NR_mknod 14 +#define __NR_chmod 15 +#define __NR_lchown 16 +#define __NR_lseek 19 +#define __NR_getpid 20 +#define __NR_mount 21 +#define __NR_setuid 23 +#define __NR_getuid 24 +#define __NR_ptrace 26 +#define __NR_pause 29 +#define __NR_access 33 +#define __NR_nice 34 +#define __NR_sync 36 +#define __NR_kill 37 +#define __NR_rename 38 +#define __NR_mkdir 39 +#define __NR_rmdir 40 +#define __NR_dup 41 +#define __NR_pipe 42 +#define __NR_times 43 +#define __NR_brk 45 +#define __NR_setgid 46 +#define __NR_getgid 47 +#define __NR_geteuid 49 +#define __NR_getegid 50 +#define __NR_acct 51 +#define __NR_umount2 52 +#define __NR_ioctl 54 +#define __NR_fcntl 55 +#define __NR_setpgid 57 +#define __NR_umask 60 +#define __NR_chroot 61 +#define __NR_ustat 62 +#define __NR_dup2 63 +#define __NR_getppid 64 +#define __NR_getpgrp 65 +#define __NR_setsid 66 +#define __NR_sigaction 67 +#define __NR_setreuid 70 +#define __NR_setregid 71 +#define __NR_sigsuspend 72 +#define __NR_sigpending 73 +#define __NR_sethostname 74 +#define __NR_setrlimit 75 +#define __NR_getrusage 77 +#define __NR_gettimeofday_time32 78 +#define __NR_settimeofday_time32 79 +#define __NR_getgroups 80 +#define __NR_setgroups 81 +#define __NR_symlink 83 +#define __NR_readlink 85 +#define __NR_uselib 86 +#define __NR_swapon 87 +#define __NR_reboot 88 +#define __NR_munmap 91 +#define __NR_truncate 92 +#define __NR_ftruncate 93 +#define __NR_fchmod 94 +#define __NR_fchown 95 +#define __NR_getpriority 96 +#define __NR_setpriority 97 +#define __NR_statfs 99 +#define __NR_fstatfs 100 +#define __NR_syslog 103 +#define __NR_setitimer 104 +#define __NR_getitimer 105 +#define __NR_stat 106 +#define __NR_lstat 107 +#define __NR_fstat 108 +#define __NR_vhangup 111 +#define __NR_wait4 114 +#define __NR_swapoff 115 +#define __NR_sysinfo 116 +#define __NR_fsync 118 +#define __NR_sigreturn 119 +#define __NR_clone 120 +#define __NR_setdomainname 121 +#define __NR_uname 122 +#define __NR_adjtimex 124 +#define __NR_mprotect 125 +#define __NR_sigprocmask 126 +#define __NR_init_module 128 +#define __NR_delete_module 129 +#define __NR_quotactl 131 +#define __NR_getpgid 132 +#define __NR_fchdir 133 +#define __NR_bdflush 134 +#define __NR_sysfs 135 +#define __NR_personality 136 +#define __NR_setfsuid 138 +#define __NR_setfsgid 139 +#define __NR__llseek 140 +#define __NR_getdents 141 +#define __NR__newselect 142 +#define __NR_flock 143 +#define __NR_msync 144 +#define __NR_readv 145 +#define __NR_writev 146 +#define __NR_getsid 147 +#define __NR_fdatasync 148 +#define __NR__sysctl 149 +#define __NR_mlock 150 +#define __NR_munlock 151 +#define __NR_mlockall 152 +#define __NR_munlockall 153 +#define __NR_sched_setparam 154 +#define __NR_sched_getparam 155 +#define __NR_sched_setscheduler 156 +#define __NR_sched_getscheduler 157 +#define __NR_sched_yield 158 +#define __NR_sched_get_priority_max 159 +#define __NR_sched_get_priority_min 160 +#define __NR_sched_rr_get_interval 161 +#define __NR_nanosleep 162 +#define __NR_mremap 163 +#define __NR_setresuid 164 +#define __NR_getresuid 165 +#define __NR_poll 168 +#define __NR_nfsservctl 169 +#define __NR_setresgid 170 +#define __NR_getresgid 171 +#define __NR_prctl 172 +#define __NR_rt_sigreturn 173 +#define __NR_rt_sigaction 174 +#define __NR_rt_sigprocmask 175 +#define __NR_rt_sigpending 176 +#define __NR_rt_sigtimedwait 177 +#define __NR_rt_sigqueueinfo 178 +#define __NR_rt_sigsuspend 179 +#define __NR_pread64 180 +#define __NR_pwrite64 181 +#define __NR_chown 182 +#define __NR_getcwd 183 +#define __NR_capget 184 +#define __NR_capset 185 +#define __NR_sigaltstack 186 +#define __NR_sendfile 187 +#define __NR_vfork 190 +#define __NR_ugetrlimit 191 +#define __NR_mmap2 192 +#define __NR_truncate64 193 +#define __NR_ftruncate64 194 +#define __NR_stat64 195 +#define __NR_lstat64 196 +#define __NR_fstat64 197 +#define __NR_lchown32 198 +#define __NR_getuid32 199 +#define __NR_getgid32 200 +#define __NR_geteuid32 201 +#define __NR_getegid32 202 +#define __NR_setreuid32 203 +#define __NR_setregid32 204 +#define __NR_getgroups32 205 +#define __NR_setgroups32 206 +#define __NR_fchown32 207 +#define __NR_setresuid32 208 +#define __NR_getresuid32 209 +#define __NR_setresgid32 210 +#define __NR_getresgid32 211 +#define __NR_chown32 212 +#define __NR_setuid32 213 +#define __NR_setgid32 214 +#define __NR_setfsuid32 215 +#define __NR_setfsgid32 216 +#define __NR_getdents64 217 +#define __NR_pivot_root 218 +#define __NR_mincore 219 +#define __NR_madvise 220 +#define __NR_fcntl64 221 +#define __NR_gettid 224 +#define __NR_readahead 225 +#define __NR_setxattr 226 +#define __NR_lsetxattr 227 +#define __NR_fsetxattr 228 +#define __NR_getxattr 229 +#define __NR_lgetxattr 230 +#define __NR_fgetxattr 231 +#define __NR_listxattr 232 +#define __NR_llistxattr 233 +#define __NR_flistxattr 234 +#define __NR_removexattr 235 +#define __NR_lremovexattr 236 +#define __NR_fremovexattr 237 +#define __NR_tkill 238 +#define __NR_sendfile64 239 +#define __NR_futex 240 +#define __NR_sched_setaffinity 241 +#define __NR_sched_getaffinity 242 +#define __NR_io_setup 243 +#define __NR_io_destroy 244 +#define __NR_io_getevents 245 +#define __NR_io_submit 246 +#define __NR_io_cancel 247 +#define __NR_exit_group 248 +#define __NR_lookup_dcookie 249 +#define __NR_epoll_create 250 +#define __NR_epoll_ctl 251 +#define __NR_epoll_wait 252 +#define __NR_remap_file_pages 253 +#define __NR_set_tid_address 256 +#define __NR_timer_create 257 +#define __NR_timer_settime32 258 +#define __NR_timer_gettime32 259 +#define __NR_timer_getoverrun 260 +#define __NR_timer_delete 261 +#define __NR_clock_settime32 262 +#define __NR_clock_gettime32 263 +#define __NR_clock_getres_time32 264 +#define __NR_clock_nanosleep_time32 265 +#define __NR_statfs64 266 +#define __NR_fstatfs64 267 +#define __NR_tgkill 268 +#define __NR_utimes 269 +#define __NR_fadvise64_64 270 +#define __NR_arm_fadvise64_64 270 +#define __NR_pciconfig_iobase 271 +#define __NR_pciconfig_read 272 +#define __NR_pciconfig_write 273 +#define __NR_mq_open 274 +#define __NR_mq_unlink 275 +#define __NR_mq_timedsend 276 +#define __NR_mq_timedreceive 277 +#define __NR_mq_notify 278 +#define __NR_mq_getsetattr 279 +#define __NR_waitid 280 +#define __NR_socket 281 +#define __NR_bind 282 +#define __NR_connect 283 +#define __NR_listen 284 +#define __NR_accept 285 +#define __NR_getsockname 286 +#define __NR_getpeername 287 +#define __NR_socketpair 288 +#define __NR_send 289 +#define __NR_sendto 290 +#define __NR_recv 291 +#define __NR_recvfrom 292 +#define __NR_shutdown 293 +#define __NR_setsockopt 294 +#define __NR_getsockopt 295 +#define __NR_sendmsg 296 +#define __NR_recvmsg 297 +#define __NR_semop 298 +#define __NR_semget 299 +#define __NR_semctl 300 +#define __NR_msgsnd 301 +#define __NR_msgrcv 302 +#define __NR_msgget 303 +#define __NR_msgctl 304 +#define __NR_shmat 305 +#define __NR_shmdt 306 +#define __NR_shmget 307 +#define __NR_shmctl 308 +#define __NR_add_key 309 +#define __NR_request_key 310 +#define __NR_keyctl 311 +#define __NR_semtimedop 312 +#define __NR_vserver 313 +#define __NR_ioprio_set 314 +#define __NR_ioprio_get 315 +#define __NR_inotify_init 316 +#define __NR_inotify_add_watch 317 +#define __NR_inotify_rm_watch 318 +#define __NR_mbind 319 +#define __NR_get_mempolicy 320 +#define __NR_set_mempolicy 321 +#define __NR_openat 322 +#define __NR_mkdirat 323 +#define __NR_mknodat 324 +#define __NR_fchownat 325 +#define __NR_futimesat 326 +#define __NR_fstatat64 327 +#define __NR_unlinkat 328 +#define __NR_renameat 329 +#define __NR_linkat 330 +#define __NR_symlinkat 331 +#define __NR_readlinkat 332 +#define __NR_fchmodat 333 +#define __NR_faccessat 334 +#define __NR_pselect6 335 +#define __NR_ppoll 336 +#define __NR_unshare 337 +#define __NR_set_robust_list 338 +#define __NR_get_robust_list 339 +#define __NR_splice 340 +#define __NR_sync_file_range2 341 +#define __NR_arm_sync_file_range 341 +#define __NR_tee 342 +#define __NR_vmsplice 343 +#define __NR_move_pages 344 +#define __NR_getcpu 345 +#define __NR_epoll_pwait 346 +#define __NR_kexec_load 347 +#define __NR_utimensat 348 +#define __NR_signalfd 349 +#define __NR_timerfd_create 350 +#define __NR_eventfd 351 +#define __NR_fallocate 352 +#define __NR_timerfd_settime32 353 +#define __NR_timerfd_gettime32 354 +#define __NR_signalfd4 355 +#define __NR_eventfd2 356 +#define __NR_epoll_create1 357 +#define __NR_dup3 358 +#define __NR_pipe2 359 +#define __NR_inotify_init1 360 +#define __NR_preadv 361 +#define __NR_pwritev 362 +#define __NR_rt_tgsigqueueinfo 363 +#define __NR_perf_event_open 364 +#define __NR_recvmmsg 365 +#define __NR_accept4 366 +#define __NR_fanotify_init 367 +#define __NR_fanotify_mark 368 +#define __NR_prlimit64 369 +#define __NR_name_to_handle_at 370 +#define __NR_open_by_handle_at 371 +#define __NR_clock_adjtime 372 +#define __NR_syncfs 373 +#define __NR_sendmmsg 374 +#define __NR_setns 375 +#define __NR_process_vm_readv 376 +#define __NR_process_vm_writev 377 +#define __NR_kcmp 378 +#define __NR_finit_module 379 +#define __NR_sched_setattr 380 +#define __NR_sched_getattr 381 +#define __NR_renameat2 382 +#define __NR_seccomp 383 +#define __NR_getrandom 384 +#define __NR_memfd_create 385 +#define __NR_bpf 386 +#define __NR_execveat 387 +#define __NR_userfaultfd 388 +#define __NR_membarrier 389 +#define __NR_mlock2 390 +#define __NR_copy_file_range 391 +#define __NR_preadv2 392 +#define __NR_pwritev2 393 +#define __NR_pkey_mprotect 394 +#define __NR_pkey_alloc 395 +#define __NR_pkey_free 396 +#define __NR_statx 397 +#define __NR_rseq 398 +#define __NR_io_pgetevents 399 +#define __NR_migrate_pages 400 +#define __NR_kexec_file_load 401 +#define __NR_clock_gettime64 403 +#define __NR_clock_settime64 404 +#define __NR_clock_adjtime64 405 +#define __NR_clock_getres_time64 406 +#define __NR_clock_nanosleep_time64 407 +#define __NR_timer_gettime64 408 +#define __NR_timer_settime64 409 +#define __NR_timerfd_gettime64 410 +#define __NR_timerfd_settime64 411 +#define __NR_utimensat_time64 412 +#define __NR_pselect6_time64 413 +#define __NR_ppoll_time64 414 +#define __NR_io_pgetevents_time64 416 +#define __NR_recvmmsg_time64 417 +#define __NR_mq_timedsend_time64 418 +#define __NR_mq_timedreceive_time64 419 +#define __NR_semtimedop_time64 420 +#define __NR_rt_sigtimedwait_time64 421 +#define __NR_futex_time64 422 +#define __NR_sched_rr_get_interval_time64 423 +#define __NR_pidfd_send_signal 424 +#define __NR_io_uring_setup 425 +#define __NR_io_uring_enter 426 +#define __NR_io_uring_register 427 +#define __NR_open_tree 428 +#define __NR_move_mount 429 +#define __NR_fsopen 430 +#define __NR_fsconfig 431 +#define __NR_fsmount 432 +#define __NR_fspick 433 +#define __NR_pidfd_open 434 +#define __NR_clone3 435 +#define __NR_close_range 436 +#define __NR_openat2 437 +#define __NR_pidfd_getfd 438 +#define __NR_faccessat2 439 +#define __NR_process_madvise 440 +#define __NR_epoll_pwait2 441 +#define __NR_mount_setattr 442 +#define __NR_landlock_create_ruleset 444 +#define __NR_landlock_add_rule 445 +#define __NR_landlock_restrict_self 446 + +#define __ARM_NR_breakpoint 0x0f0001 +#define __ARM_NR_cacheflush 0x0f0002 +#define __ARM_NR_usr26 0x0f0003 +#define __ARM_NR_usr32 0x0f0004 +#define __ARM_NR_set_tls 0x0f0005 +#define __ARM_NR_get_tls 0x0f0006 + diff --git a/Ubiquitous/XiZi/lib/musllib/arch/arm/bits/user.h b/Ubiquitous/XiZi/lib/musllib/arch/arm/bits/user.h new file mode 100644 index 000000000..3e5a4d21d --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/arch/arm/bits/user.h @@ -0,0 +1,36 @@ +typedef struct user_fpregs { + struct fp_reg { + unsigned sign1:1; + unsigned unused:15; + unsigned sign2:1; + unsigned exponent:14; + unsigned j:1; + unsigned mantissa1:31; + unsigned mantissa0:32; + } fpregs[8]; + unsigned fpsr:32; + unsigned fpcr:32; + unsigned char ftype[8]; + unsigned int init_flag; +} elf_fpregset_t; + +struct user_regs { + unsigned long uregs[18]; +}; +#define ELF_NGREG 18 +typedef unsigned long elf_greg_t, elf_gregset_t[ELF_NGREG]; + +struct user { + struct user_regs regs; + int u_fpvalid; + unsigned long u_tsize, u_dsize, u_ssize; + unsigned long start_code, start_stack; + long signal; + int reserved; + struct user_regs *u_ar0; + unsigned long magic; + char u_comm[32]; + int u_debugreg[8]; + struct user_fpregs u_fp; + struct user_fpregs *u_fp0; +}; diff --git a/Ubiquitous/XiZi/lib/musllib/arch/arm/crt_arch.h b/Ubiquitous/XiZi/lib/musllib/arch/arm/crt_arch.h new file mode 100644 index 000000000..99508b1db --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/arch/arm/crt_arch.h @@ -0,0 +1,18 @@ +__asm__( +".text \n" +".global " START " \n" +".type " START ",%function \n" +START ": \n" +" mov fp, #0 \n" +" mov lr, #0 \n" +" ldr a2, 1f \n" +" add a2, pc, a2 \n" +" mov a1, sp \n" +"2: and ip, a1, #-16 \n" +" mov sp, ip \n" +" bl " START "_c \n" +".weak _DYNAMIC \n" +".hidden _DYNAMIC \n" +".align 2 \n" +"1: .word _DYNAMIC-2b \n" +); diff --git a/Ubiquitous/XiZi/lib/musllib/arch/arm/kstat.h b/Ubiquitous/XiZi/lib/musllib/arch/arm/kstat.h new file mode 100644 index 000000000..af449c950 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/arch/arm/kstat.h @@ -0,0 +1,21 @@ +struct kstat { + dev_t st_dev; + int __st_dev_padding; + long __st_ino_truncated; + mode_t st_mode; + nlink_t st_nlink; + uid_t st_uid; + gid_t st_gid; + dev_t st_rdev; + int __st_rdev_padding; + off_t st_size; + blksize_t st_blksize; + blkcnt_t st_blocks; + long st_atime_sec; + long st_atime_nsec; + long st_mtime_sec; + long st_mtime_nsec; + long st_ctime_sec; + long st_ctime_nsec; + ino_t st_ino; +}; diff --git a/Ubiquitous/XiZi/lib/musllib/arch/arm/pthread_arch.h b/Ubiquitous/XiZi/lib/musllib/arch/arm/pthread_arch.h new file mode 100644 index 000000000..157e2eae6 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/arch/arm/pthread_arch.h @@ -0,0 +1,32 @@ +#if ((__ARM_ARCH_6K__ || __ARM_ARCH_6KZ__ || __ARM_ARCH_6ZK__) && !__thumb__) \ + || __ARM_ARCH_7A__ || __ARM_ARCH_7R__ || __ARM_ARCH >= 7 + +static inline uintptr_t __get_tp() +{ + uintptr_t tp; + __asm__ ( "mrc p15,0,%0,c13,c0,3" : "=r"(tp) ); + return tp; +} + +#else + +#if __ARM_ARCH_4__ || __ARM_ARCH_4T__ || __ARM_ARCH == 4 +#define BLX "mov lr,pc\n\tbx" +#else +#define BLX "blx" +#endif + +static inline uintptr_t __get_tp() +{ + extern hidden uintptr_t __a_gettp_ptr; + register uintptr_t tp __asm__("r0"); + __asm__ ( BLX " %1" : "=r"(tp) : "r"(__a_gettp_ptr) : "cc", "lr" ); + return tp; +} + +#endif + +#define TLS_ABOVE_TP +#define GAP_ABOVE_TP 8 + +#define MC_PC arm_pc diff --git a/Ubiquitous/XiZi/lib/musllib/arch/arm/reloc.h b/Ubiquitous/XiZi/lib/musllib/arch/arm/reloc.h new file mode 100644 index 000000000..d091d2ad9 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/arch/arm/reloc.h @@ -0,0 +1,32 @@ +#if __BYTE_ORDER == __BIG_ENDIAN +#define ENDIAN_SUFFIX "eb" +#else +#define ENDIAN_SUFFIX "" +#endif + +#if __ARM_PCS_VFP +#define FP_SUFFIX "hf" +#else +#define FP_SUFFIX "" +#endif + +#define LDSO_ARCH "arm" ENDIAN_SUFFIX FP_SUFFIX + +#define NO_LEGACY_INITFINI + +#define TPOFF_K 0 + +#define REL_SYMBOLIC R_ARM_ABS32 +#define REL_GOT R_ARM_GLOB_DAT +#define REL_PLT R_ARM_JUMP_SLOT +#define REL_RELATIVE R_ARM_RELATIVE +#define REL_COPY R_ARM_COPY +#define REL_DTPMOD R_ARM_TLS_DTPMOD32 +#define REL_DTPOFF R_ARM_TLS_DTPOFF32 +#define REL_TPOFF R_ARM_TLS_TPOFF32 +#define REL_TLSDESC R_ARM_TLS_DESC + +#define TLSDESC_BACKWARDS + +#define CRTJMP(pc,sp) __asm__ __volatile__( \ + "mov sp,%1 ; bx %0" : : "r"(pc), "r"(sp) : "memory" ) diff --git a/Ubiquitous/XiZi/lib/musllib/arch/arm/syscall_arch.h b/Ubiquitous/XiZi/lib/musllib/arch/arm/syscall_arch.h new file mode 100644 index 000000000..a877b2cff --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/arch/arm/syscall_arch.h @@ -0,0 +1,103 @@ +#define __SYSCALL_LL_E(x) \ +((union { long long ll; long l[2]; }){ .ll = x }).l[0], \ +((union { long long ll; long l[2]; }){ .ll = x }).l[1] +#define __SYSCALL_LL_O(x) 0, __SYSCALL_LL_E((x)) + +#ifdef __thumb__ + +/* Avoid use of r7 in asm constraints when producing thumb code, + * since it's reserved as frame pointer and might not be supported. */ +#define __ASM____R7__ +#define __asm_syscall(...) do { \ + __asm__ __volatile__ ( "mov %1,r7 ; mov r7,%2 ; svc 0 ; mov r7,%1" \ + : "=r"(r0), "=&r"((int){0}) : __VA_ARGS__ : "memory"); \ + return r0; \ + } while (0) + +#else + +#define __ASM____R7__ __asm__("r7") +#define __asm_syscall(...) do { \ + __asm__ __volatile__ ( "svc 0" \ + : "=r"(r0) : __VA_ARGS__ : "memory"); \ + return r0; \ + } while (0) +#endif + +/* For thumb2, we can allow 8-bit immediate syscall numbers, saving a + * register in the above dance around r7. Does not work for thumb1 where + * only movs, not mov, supports immediates, and we can't use movs because + * it doesn't support high regs. */ +#ifdef __thumb2__ +#define R7_OPERAND "rI"(r7) +#else +#define R7_OPERAND "r"(r7) +#endif + +static inline long __syscall0(long n) +{ + register long r7 __ASM____R7__ = n; + register long r0 __asm__("r0"); + __asm_syscall(R7_OPERAND); +} + +static inline long __syscall1(long n, long a) +{ + register long r7 __ASM____R7__ = n; + register long r0 __asm__("r0") = a; + __asm_syscall(R7_OPERAND, "0"(r0)); +} + +static inline long __syscall2(long n, long a, long b) +{ + register long r7 __ASM____R7__ = n; + register long r0 __asm__("r0") = a; + register long r1 __asm__("r1") = b; + __asm_syscall(R7_OPERAND, "0"(r0), "r"(r1)); +} + +static inline long __syscall3(long n, long a, long b, long c) +{ + register long r7 __ASM____R7__ = n; + register long r0 __asm__("r0") = a; + register long r1 __asm__("r1") = b; + register long r2 __asm__("r2") = c; + __asm_syscall(R7_OPERAND, "0"(r0), "r"(r1), "r"(r2)); +} + +static inline long __syscall4(long n, long a, long b, long c, long d) +{ + register long r7 __ASM____R7__ = n; + register long r0 __asm__("r0") = a; + register long r1 __asm__("r1") = b; + register long r2 __asm__("r2") = c; + register long r3 __asm__("r3") = d; + __asm_syscall(R7_OPERAND, "0"(r0), "r"(r1), "r"(r2), "r"(r3)); +} + +static inline long __syscall5(long n, long a, long b, long c, long d, long e) +{ + register long r7 __ASM____R7__ = n; + register long r0 __asm__("r0") = a; + register long r1 __asm__("r1") = b; + register long r2 __asm__("r2") = c; + register long r3 __asm__("r3") = d; + register long r4 __asm__("r4") = e; + __asm_syscall(R7_OPERAND, "0"(r0), "r"(r1), "r"(r2), "r"(r3), "r"(r4)); +} + +static inline long __syscall6(long n, long a, long b, long c, long d, long e, long f) +{ + register long r7 __ASM____R7__ = n; + register long r0 __asm__("r0") = a; + register long r1 __asm__("r1") = b; + register long r2 __asm__("r2") = c; + register long r3 __asm__("r3") = d; + register long r4 __asm__("r4") = e; + register long r5 __asm__("r5") = f; + __asm_syscall(R7_OPERAND, "0"(r0), "r"(r1), "r"(r2), "r"(r3), "r"(r4), "r"(r5)); +} + +#define SYSCALL_FADVISE_6_ARG + +#define SYSCALL_IPC_BROKEN_MODE diff --git a/Ubiquitous/XiZi/lib/musllib/arch/generic/bits/dirent.h b/Ubiquitous/XiZi/lib/musllib/arch/generic/bits/dirent.h new file mode 100644 index 000000000..c845fe82d --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/arch/generic/bits/dirent.h @@ -0,0 +1,11 @@ +#define _DIRENT_HAVE_D_RECLEN +#define _DIRENT_HAVE_D_OFF +#define _DIRENT_HAVE_D_TYPE + +struct dirent { + ino_t d_ino; + off_t d_off; + unsigned short d_reclen; + unsigned char d_type; + char d_name[256]; +}; diff --git a/Ubiquitous/XiZi/lib/musllib/arch/generic/bits/errno.h b/Ubiquitous/XiZi/lib/musllib/arch/generic/bits/errno.h new file mode 100644 index 000000000..d2e1eeee0 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/arch/generic/bits/errno.h @@ -0,0 +1,134 @@ +#define EPERM 1 +#define ENOENT 2 +#define ESRCH 3 +#define EINTR 4 +#define EIO 5 +#define ENXIO 6 +#define E2BIG 7 +#define ENOEXEC 8 +#define EBADF 9 +#define ECHILD 10 +#define EAGAIN 11 +#define ENOMEM 12 +#define EACCES 13 +#define EFAULT 14 +#define ENOTBLK 15 +#define EBUSY 16 +#define EEXIST 17 +#define EXDEV 18 +#define ENODEV 19 +#define ENOTDIR 20 +#define EISDIR 21 +#define EINVAL 22 +#define ENFILE 23 +#define EMFILE 24 +#define ENOTTY 25 +#define ETXTBSY 26 +#define EFBIG 27 +#define ENOSPC 28 +#define ESPIPE 29 +#define EROFS 30 +#define EMLINK 31 +#define EPIPE 32 +#define EDOM 33 +#define ERANGE 34 +#define EDEADLK 35 +#define ENAMETOOLONG 36 +#define ENOLCK 37 +#define ENOSYS 38 +#define ENOTEMPTY 39 +#define ELOOP 40 +#define EWOULDBLOCK EAGAIN +#define ENOMSG 42 +#define EIDRM 43 +#define ECHRNG 44 +#define EL2NSYNC 45 +#define EL3HLT 46 +#define EL3RST 47 +#define ELNRNG 48 +#define EUNATCH 49 +#define ENOCSI 50 +#define EL2HLT 51 +#define EBADE 52 +#define EBADR 53 +#define EXFULL 54 +#define ENOANO 55 +#define EBADRQC 56 +#define EBADSLT 57 +#define EDEADLOCK EDEADLK +#define EBFONT 59 +#define ENOSTR 60 +#define ENODATA 61 +#define ETIME 62 +#define ENOSR 63 +#define ENONET 64 +#define ENOPKG 65 +#define EREMOTE 66 +#define ENOLINK 67 +#define EADV 68 +#define ESRMNT 69 +#define ECOMM 70 +#define EPROTO 71 +#define EMULTIHOP 72 +#define EDOTDOT 73 +#define EBADMSG 74 +#define EOVERFLOW 75 +#define ENOTUNIQ 76 +#define EBADFD 77 +#define EREMCHG 78 +#define ELIBACC 79 +#define ELIBBAD 80 +#define ELIBSCN 81 +#define ELIBMAX 82 +#define ELIBEXEC 83 +#define EILSEQ 84 +#define ERESTART 85 +#define ESTRPIPE 86 +#define EUSERS 87 +#define ENOTSOCK 88 +#define EDESTADDRREQ 89 +#define EMSGSIZE 90 +#define EPROTOTYPE 91 +#define ENOPROTOOPT 92 +#define EPROTONOSUPPORT 93 +#define ESOCKTNOSUPPORT 94 +#define EOPNOTSUPP 95 +#define ENOTSUP EOPNOTSUPP +#define EPFNOSUPPORT 96 +#define EAFNOSUPPORT 97 +#define EADDRINUSE 98 +#define EADDRNOTAVAIL 99 +#define ENETDOWN 100 +#define ENETUNREACH 101 +#define ENETRESET 102 +#define ECONNABORTED 103 +#define ECONNRESET 104 +#define ENOBUFS 105 +#define EISCONN 106 +#define ENOTCONN 107 +#define ESHUTDOWN 108 +#define ETOOMANYREFS 109 +#define ETIMEDOUT 110 +#define ECONNREFUSED 111 +#define EHOSTDOWN 112 +#define EHOSTUNREACH 113 +#define EALREADY 114 +#define EINPROGRESS 115 +#define ESTALE 116 +#define EUCLEAN 117 +#define ENOTNAM 118 +#define ENAVAIL 119 +#define EISNAM 120 +#define EREMOTEIO 121 +#define EDQUOT 122 +#define ENOMEDIUM 123 +#define EMEDIUMTYPE 124 +#define ECANCELED 125 +#define ENOKEY 126 +#define EKEYEXPIRED 127 +#define EKEYREVOKED 128 +#define EKEYREJECTED 129 +#define EOWNERDEAD 130 +#define ENOTRECOVERABLE 131 +#define ERFKILL 132 +#define EHWPOISON 133 diff --git a/Ubiquitous/XiZi/lib/musllib/arch/generic/bits/fcntl.h b/Ubiquitous/XiZi/lib/musllib/arch/generic/bits/fcntl.h new file mode 100644 index 000000000..730a98cfe --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/arch/generic/bits/fcntl.h @@ -0,0 +1,46 @@ +#define O_CREAT 0100 +#define O_EXCL 0200 +#define O_NOCTTY 0400 +#define O_TRUNC 01000 +#define O_APPEND 02000 +#define O_NONBLOCK 04000 +#define O_DSYNC 010000 +#define O_SYNC 04010000 +#define O_RSYNC 04010000 +#define O_DIRECTORY 0200000 +#define O_NOFOLLOW 0400000 +#define O_CLOEXEC 02000000 + +#define O_ASYNC 020000 +#define O_DIRECT 040000 +#define O_LARGEFILE 0100000 +#define O_NOATIME 01000000 +#define O_PATH 010000000 +#define O_TMPFILE 020200000 +#define O_NDELAY O_NONBLOCK + +#define F_DUPFD 0 +#define F_GETFD 1 +#define F_SETFD 2 +#define F_GETFL 3 +#define F_SETFL 4 + +#define F_SETOWN 8 +#define F_GETOWN 9 +#define F_SETSIG 10 +#define F_GETSIG 11 + +#if __LONG_MAX == 0x7fffffffL +#define F_GETLK 12 +#define F_SETLK 13 +#define F_SETLKW 14 +#else +#define F_GETLK 5 +#define F_SETLK 6 +#define F_SETLKW 7 +#endif + +#define F_SETOWN_EX 15 +#define F_GETOWN_EX 16 + +#define F_GETOWNER_UIDS 17 diff --git a/Ubiquitous/XiZi/lib/musllib/arch/generic/bits/fenv.h b/Ubiquitous/XiZi/lib/musllib/arch/generic/bits/fenv.h new file mode 100644 index 000000000..edbdea2a5 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/arch/generic/bits/fenv.h @@ -0,0 +1,10 @@ +#define FE_ALL_EXCEPT 0 +#define FE_TONEAREST 0 + +typedef unsigned long fexcept_t; + +typedef struct { + unsigned long __cw; +} fenv_t; + +#define FE_DFL_ENV ((const fenv_t *) -1) diff --git a/Ubiquitous/XiZi/lib/musllib/arch/generic/bits/hwcap.h b/Ubiquitous/XiZi/lib/musllib/arch/generic/bits/hwcap.h new file mode 100644 index 000000000..e69de29bb diff --git a/Ubiquitous/XiZi/lib/musllib/arch/generic/bits/io.h b/Ubiquitous/XiZi/lib/musllib/arch/generic/bits/io.h new file mode 100644 index 000000000..e69de29bb diff --git a/Ubiquitous/XiZi/lib/musllib/arch/generic/bits/ioctl.h b/Ubiquitous/XiZi/lib/musllib/arch/generic/bits/ioctl.h new file mode 100644 index 000000000..60ae8b850 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/arch/generic/bits/ioctl.h @@ -0,0 +1,115 @@ +#define _IOC(a,b,c,d) ( ((a)<<30) | ((b)<<8) | (c) | ((d)<<16) ) +#define _IOC_NONE 0U +#define _IOC_WRITE 1U +#define _IOC_READ 2U + +#define _IO(a,b) _IOC(_IOC_NONE,(a),(b),0) +#define _IOW(a,b,c) _IOC(_IOC_WRITE,(a),(b),sizeof(c)) +#define _IOR(a,b,c) _IOC(_IOC_READ,(a),(b),sizeof(c)) +#define _IOWR(a,b,c) _IOC(_IOC_READ|_IOC_WRITE,(a),(b),sizeof(c)) + +#define TCGETS 0x5401 +#define TCSETS 0x5402 +#define TCSETSW 0x5403 +#define TCSETSF 0x5404 +#define TCGETA 0x5405 +#define TCSETA 0x5406 +#define TCSETAW 0x5407 +#define TCSETAF 0x5408 +#define TCSBRK 0x5409 +#define TCXONC 0x540A +#define TCFLSH 0x540B +#define TIOCEXCL 0x540C +#define TIOCNXCL 0x540D +#define TIOCSCTTY 0x540E +#define TIOCGPGRP 0x540F +#define TIOCSPGRP 0x5410 +#define TIOCOUTQ 0x5411 +#define TIOCSTI 0x5412 +#define TIOCGWINSZ 0x5413 +#define TIOCSWINSZ 0x5414 +#define TIOCMGET 0x5415 +#define TIOCMBIS 0x5416 +#define TIOCMBIC 0x5417 +#define TIOCMSET 0x5418 +#define TIOCGSOFTCAR 0x5419 +#define TIOCSSOFTCAR 0x541A +#define FIONREAD 0x541B +#define TIOCINQ FIONREAD +#define TIOCLINUX 0x541C +#define TIOCCONS 0x541D +#define TIOCGSERIAL 0x541E +#define TIOCSSERIAL 0x541F +#define TIOCPKT 0x5420 +#define FIONBIO 0x5421 +#define TIOCNOTTY 0x5422 +#define TIOCSETD 0x5423 +#define TIOCGETD 0x5424 +#define TCSBRKP 0x5425 +#define TIOCSBRK 0x5427 +#define TIOCCBRK 0x5428 +#define TIOCGSID 0x5429 +#define TIOCGRS485 0x542E +#define TIOCSRS485 0x542F +#define TIOCGPTN 0x80045430 +#define TIOCSPTLCK 0x40045431 +#define TIOCGDEV 0x80045432 +#define TCGETX 0x5432 +#define TCSETX 0x5433 +#define TCSETXF 0x5434 +#define TCSETXW 0x5435 +#define TIOCSIG 0x40045436 +#define TIOCVHANGUP 0x5437 +#define TIOCGPKT 0x80045438 +#define TIOCGPTLCK 0x80045439 +#define TIOCGEXCL 0x80045440 +#define TIOCGPTPEER 0x5441 +#define TIOCGISO7816 0x80285442 +#define TIOCSISO7816 0xc0285443 + +#define FIONCLEX 0x5450 +#define FIOCLEX 0x5451 +#define FIOASYNC 0x5452 +#define TIOCSERCONFIG 0x5453 +#define TIOCSERGWILD 0x5454 +#define TIOCSERSWILD 0x5455 +#define TIOCGLCKTRMIOS 0x5456 +#define TIOCSLCKTRMIOS 0x5457 +#define TIOCSERGSTRUCT 0x5458 +#define TIOCSERGETLSR 0x5459 +#define TIOCSERGETMULTI 0x545A +#define TIOCSERSETMULTI 0x545B + +#define TIOCMIWAIT 0x545C +#define TIOCGICOUNT 0x545D +#define FIOQSIZE 0x5460 + +#define TIOCM_LE 0x001 +#define TIOCM_DTR 0x002 +#define TIOCM_RTS 0x004 +#define TIOCM_ST 0x008 +#define TIOCM_SR 0x010 +#define TIOCM_CTS 0x020 +#define TIOCM_CAR 0x040 +#define TIOCM_RNG 0x080 +#define TIOCM_DSR 0x100 +#define TIOCM_CD TIOCM_CAR +#define TIOCM_RI TIOCM_RNG +#define TIOCM_OUT1 0x2000 +#define TIOCM_OUT2 0x4000 +#define TIOCM_LOOP 0x8000 + +#define FIOSETOWN 0x8901 +#define SIOCSPGRP 0x8902 +#define FIOGETOWN 0x8903 +#define SIOCGPGRP 0x8904 +#define SIOCATMARK 0x8905 +#if __LONG_MAX == 0x7fffffff +#define SIOCGSTAMP _IOR(0x89, 6, char[16]) +#define SIOCGSTAMPNS _IOR(0x89, 7, char[16]) +#else +#define SIOCGSTAMP 0x8906 +#define SIOCGSTAMPNS 0x8907 +#endif + +#include diff --git a/Ubiquitous/XiZi/lib/musllib/arch/generic/bits/ioctl_fix.h b/Ubiquitous/XiZi/lib/musllib/arch/generic/bits/ioctl_fix.h new file mode 100644 index 000000000..e69de29bb diff --git a/Ubiquitous/XiZi/lib/musllib/arch/generic/bits/ipc.h b/Ubiquitous/XiZi/lib/musllib/arch/generic/bits/ipc.h new file mode 100644 index 000000000..40d6f3a25 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/arch/generic/bits/ipc.h @@ -0,0 +1,11 @@ +struct ipc_perm { + key_t __ipc_perm_key; + uid_t uid; + gid_t gid; + uid_t cuid; + gid_t cgid; + mode_t mode; + int __ipc_perm_seq; + long __pad1; + long __pad2; +}; diff --git a/Ubiquitous/XiZi/lib/musllib/arch/generic/bits/ipcstat.h b/Ubiquitous/XiZi/lib/musllib/arch/generic/bits/ipcstat.h new file mode 100644 index 000000000..0018ad1e2 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/arch/generic/bits/ipcstat.h @@ -0,0 +1 @@ +#define IPC_STAT 2 diff --git a/Ubiquitous/XiZi/lib/musllib/arch/generic/bits/kd.h b/Ubiquitous/XiZi/lib/musllib/arch/generic/bits/kd.h new file mode 100644 index 000000000..33b873f49 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/arch/generic/bits/kd.h @@ -0,0 +1 @@ +#include diff --git a/Ubiquitous/XiZi/lib/musllib/arch/generic/bits/limits.h b/Ubiquitous/XiZi/lib/musllib/arch/generic/bits/limits.h new file mode 100644 index 000000000..e69de29bb diff --git a/Ubiquitous/XiZi/lib/musllib/arch/generic/bits/link.h b/Ubiquitous/XiZi/lib/musllib/arch/generic/bits/link.h new file mode 100644 index 000000000..4a94d8f89 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/arch/generic/bits/link.h @@ -0,0 +1 @@ +typedef uint32_t Elf_Symndx; diff --git a/Ubiquitous/XiZi/lib/musllib/arch/generic/bits/mman.h b/Ubiquitous/XiZi/lib/musllib/arch/generic/bits/mman.h new file mode 100644 index 000000000..e69de29bb diff --git a/Ubiquitous/XiZi/lib/musllib/arch/generic/bits/msg.h b/Ubiquitous/XiZi/lib/musllib/arch/generic/bits/msg.h new file mode 100644 index 000000000..2e23ca27f --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/arch/generic/bits/msg.h @@ -0,0 +1,12 @@ +struct msqid_ds { + struct ipc_perm msg_perm; + time_t msg_stime; + time_t msg_rtime; + time_t msg_ctime; + unsigned long msg_cbytes; + msgqnum_t msg_qnum; + msglen_t msg_qbytes; + pid_t msg_lspid; + pid_t msg_lrpid; + unsigned long __unused[2]; +}; diff --git a/Ubiquitous/XiZi/lib/musllib/arch/generic/bits/poll.h b/Ubiquitous/XiZi/lib/musllib/arch/generic/bits/poll.h new file mode 100644 index 000000000..e69de29bb diff --git a/Ubiquitous/XiZi/lib/musllib/arch/generic/bits/ptrace.h b/Ubiquitous/XiZi/lib/musllib/arch/generic/bits/ptrace.h new file mode 100644 index 000000000..e69de29bb diff --git a/Ubiquitous/XiZi/lib/musllib/arch/generic/bits/resource.h b/Ubiquitous/XiZi/lib/musllib/arch/generic/bits/resource.h new file mode 100644 index 000000000..e69de29bb diff --git a/Ubiquitous/XiZi/lib/musllib/arch/generic/bits/sem.h b/Ubiquitous/XiZi/lib/musllib/arch/generic/bits/sem.h new file mode 100644 index 000000000..5184eb597 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/arch/generic/bits/sem.h @@ -0,0 +1,14 @@ +struct semid_ds { + struct ipc_perm sem_perm; + time_t sem_otime; + time_t sem_ctime; +#if __BYTE_ORDER == __LITTLE_ENDIAN + unsigned short sem_nsems; + char __sem_nsems_pad[sizeof(long)-sizeof(short)]; +#else + char __sem_nsems_pad[sizeof(long)-sizeof(short)]; + unsigned short sem_nsems; +#endif + long __unused3; + long __unused4; +}; diff --git a/Ubiquitous/XiZi/lib/musllib/arch/generic/bits/shm.h b/Ubiquitous/XiZi/lib/musllib/arch/generic/bits/shm.h new file mode 100644 index 000000000..8d1937819 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/arch/generic/bits/shm.h @@ -0,0 +1,24 @@ +#define SHMLBA 4096 + +struct shmid_ds { + struct ipc_perm shm_perm; + size_t shm_segsz; + time_t shm_atime; + time_t shm_dtime; + time_t shm_ctime; + pid_t shm_cpid; + pid_t shm_lpid; + unsigned long shm_nattch; + unsigned long __pad1; + unsigned long __pad2; +}; + +struct shminfo { + unsigned long shmmax, shmmin, shmmni, shmseg, shmall, __unused[4]; +}; + +struct shm_info { + int __used_ids; + unsigned long shm_tot, shm_rss, shm_swp; + unsigned long __swap_attempts, __swap_successes; +}; diff --git a/Ubiquitous/XiZi/lib/musllib/arch/generic/bits/socket.h b/Ubiquitous/XiZi/lib/musllib/arch/generic/bits/socket.h new file mode 100644 index 000000000..e69de29bb diff --git a/Ubiquitous/XiZi/lib/musllib/arch/generic/bits/soundcard.h b/Ubiquitous/XiZi/lib/musllib/arch/generic/bits/soundcard.h new file mode 100644 index 000000000..fade986fe --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/arch/generic/bits/soundcard.h @@ -0,0 +1 @@ +#include diff --git a/Ubiquitous/XiZi/lib/musllib/arch/generic/bits/statfs.h b/Ubiquitous/XiZi/lib/musllib/arch/generic/bits/statfs.h new file mode 100644 index 000000000..f103f4e4f --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/arch/generic/bits/statfs.h @@ -0,0 +1,7 @@ +struct statfs { + unsigned long f_type, f_bsize; + fsblkcnt_t f_blocks, f_bfree, f_bavail; + fsfilcnt_t f_files, f_ffree; + fsid_t f_fsid; + unsigned long f_namelen, f_frsize, f_flags, f_spare[4]; +}; diff --git a/Ubiquitous/XiZi/lib/musllib/arch/generic/bits/termios.h b/Ubiquitous/XiZi/lib/musllib/arch/generic/bits/termios.h new file mode 100644 index 000000000..124f71d20 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/arch/generic/bits/termios.h @@ -0,0 +1,166 @@ +struct termios { + tcflag_t c_iflag; + tcflag_t c_oflag; + tcflag_t c_cflag; + tcflag_t c_lflag; + cc_t c_line; + cc_t c_cc[NCCS]; + speed_t __c_ispeed; + speed_t __c_ospeed; +}; + +#define VINTR 0 +#define VQUIT 1 +#define VERASE 2 +#define VKILL 3 +#define VEOF 4 +#define VTIME 5 +#define VMIN 6 +#define VSWTC 7 +#define VSTART 8 +#define VSTOP 9 +#define VSUSP 10 +#define VEOL 11 +#define VREPRINT 12 +#define VDISCARD 13 +#define VWERASE 14 +#define VLNEXT 15 +#define VEOL2 16 + +#define IGNBRK 0000001 +#define BRKINT 0000002 +#define IGNPAR 0000004 +#define PARMRK 0000010 +#define INPCK 0000020 +#define ISTRIP 0000040 +#define INLCR 0000100 +#define IGNCR 0000200 +#define ICRNL 0000400 +#define IUCLC 0001000 +#define IXON 0002000 +#define IXANY 0004000 +#define IXOFF 0010000 +#define IMAXBEL 0020000 +#define IUTF8 0040000 + +#define OPOST 0000001 +#define OLCUC 0000002 +#define ONLCR 0000004 +#define OCRNL 0000010 +#define ONOCR 0000020 +#define ONLRET 0000040 +#define OFILL 0000100 +#define OFDEL 0000200 +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) || defined(_XOPEN_SOURCE) +#define NLDLY 0000400 +#define NL0 0000000 +#define NL1 0000400 +#define CRDLY 0003000 +#define CR0 0000000 +#define CR1 0001000 +#define CR2 0002000 +#define CR3 0003000 +#define TABDLY 0014000 +#define TAB0 0000000 +#define TAB1 0004000 +#define TAB2 0010000 +#define TAB3 0014000 +#define BSDLY 0020000 +#define BS0 0000000 +#define BS1 0020000 +#define FFDLY 0100000 +#define FF0 0000000 +#define FF1 0100000 +#endif + +#define VTDLY 0040000 +#define VT0 0000000 +#define VT1 0040000 + +#define B0 0000000 +#define B50 0000001 +#define B75 0000002 +#define B110 0000003 +#define B134 0000004 +#define B150 0000005 +#define B200 0000006 +#define B300 0000007 +#define B600 0000010 +#define B1200 0000011 +#define B1800 0000012 +#define B2400 0000013 +#define B4800 0000014 +#define B9600 0000015 +#define B19200 0000016 +#define B38400 0000017 + +#define B57600 0010001 +#define B115200 0010002 +#define B230400 0010003 +#define B460800 0010004 +#define B500000 0010005 +#define B576000 0010006 +#define B921600 0010007 +#define B1000000 0010010 +#define B1152000 0010011 +#define B1500000 0010012 +#define B2000000 0010013 +#define B2500000 0010014 +#define B3000000 0010015 +#define B3500000 0010016 +#define B4000000 0010017 + +#define CSIZE 0000060 +#define CS5 0000000 +#define CS6 0000020 +#define CS7 0000040 +#define CS8 0000060 +#define CSTOPB 0000100 +#define CREAD 0000200 +#define PARENB 0000400 +#define PARODD 0001000 +#define HUPCL 0002000 +#define CLOCAL 0004000 + +#define ISIG 0000001 +#define ICANON 0000002 +#define ECHO 0000010 +#define ECHOE 0000020 +#define ECHOK 0000040 +#define ECHONL 0000100 +#define NOFLSH 0000200 +#define TOSTOP 0000400 +#define IEXTEN 0100000 + +#define TCOOFF 0 +#define TCOON 1 +#define TCIOFF 2 +#define TCION 3 + +#define TCIFLUSH 0 +#define TCOFLUSH 1 +#define TCIOFLUSH 2 + +#define TCSANOW 0 +#define TCSADRAIN 1 +#define TCSAFLUSH 2 + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +#define EXTA 0000016 +#define EXTB 0000017 +#define CBAUD 0010017 +#define CBAUDEX 0010000 +#define CIBAUD 002003600000 +#define CMSPAR 010000000000 +#define CRTSCTS 020000000000 + +#define XCASE 0000004 +#define ECHOCTL 0001000 +#define ECHOPRT 0002000 +#define ECHOKE 0004000 +#define FLUSHO 0010000 +#define PENDIN 0040000 +#define EXTPROC 0200000 + +#define XTABS 0014000 +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/arch/generic/bits/vt.h b/Ubiquitous/XiZi/lib/musllib/arch/generic/bits/vt.h new file mode 100644 index 000000000..834abfbc8 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/arch/generic/bits/vt.h @@ -0,0 +1 @@ +#include diff --git a/Ubiquitous/XiZi/lib/musllib/arch/generic/fp_arch.h b/Ubiquitous/XiZi/lib/musllib/arch/generic/fp_arch.h new file mode 100644 index 000000000..e69de29bb diff --git a/Ubiquitous/XiZi/lib/musllib/arch/riscv64/atomic_arch.h b/Ubiquitous/XiZi/lib/musllib/arch/riscv64/atomic_arch.h new file mode 100644 index 000000000..0c3825886 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/arch/riscv64/atomic_arch.h @@ -0,0 +1,38 @@ +#define a_barrier a_barrier +static inline void a_barrier() +{ + __asm__ __volatile__ ("fence rw,rw" : : : "memory"); +} + +#define a_cas a_cas +static inline int a_cas(volatile int *p, int t, int s) +{ + int old, tmp; + __asm__ __volatile__ ( + "\n1: lr.w.aqrl %0, (%2)\n" + " bne %0, %3, 1f\n" + " sc.w.aqrl %1, %4, (%2)\n" + " bnez %1, 1b\n" + "1:" + : "=&r"(old), "=&r"(tmp) + : "r"(p), "r"((long)t), "r"((long)s) + : "memory"); + return old; +} + +#define a_cas_p a_cas_p +static inline void *a_cas_p(volatile void *p, void *t, void *s) +{ + void *old; + int tmp; + __asm__ __volatile__ ( + "\n1: lr.d.aqrl %0, (%2)\n" + " bne %0, %3, 1f\n" + " sc.d.aqrl %1, %4, (%2)\n" + " bnez %1, 1b\n" + "1:" + : "=&r"(old), "=&r"(tmp) + : "r"(p), "r"(t), "r"(s) + : "memory"); + return old; +} diff --git a/Ubiquitous/XiZi/lib/musllib/arch/riscv64/bits/alltypes.h.in b/Ubiquitous/XiZi/lib/musllib/arch/riscv64/bits/alltypes.h.in new file mode 100644 index 000000000..4579d1740 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/arch/riscv64/bits/alltypes.h.in @@ -0,0 +1,18 @@ +#define _Addr long +#define _Int64 long +#define _Reg long + +#define __BYTE_ORDER 1234 +#define __LONG_MAX 0x7fffffffffffffffL + +#ifndef __cplusplus +TYPEDEF int wchar_t; +#endif + +TYPEDEF int blksize_t; +TYPEDEF unsigned int nlink_t; + +TYPEDEF float float_t; +TYPEDEF double double_t; + +TYPEDEF struct { long long __ll; long double __ld; } max_align_t; diff --git a/Ubiquitous/XiZi/lib/musllib/arch/riscv64/bits/fenv.h b/Ubiquitous/XiZi/lib/musllib/arch/riscv64/bits/fenv.h new file mode 100644 index 000000000..806ec40f1 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/arch/riscv64/bits/fenv.h @@ -0,0 +1,17 @@ +#define FE_INVALID 16 +#define FE_DIVBYZERO 8 +#define FE_OVERFLOW 4 +#define FE_UNDERFLOW 2 +#define FE_INEXACT 1 + +#define FE_ALL_EXCEPT 31 + +#define FE_TONEAREST 0 +#define FE_DOWNWARD 2 +#define FE_UPWARD 3 +#define FE_TOWARDZERO 1 + +typedef unsigned int fexcept_t; +typedef unsigned int fenv_t; + +#define FE_DFL_ENV ((const fenv_t *) -1) diff --git a/Ubiquitous/XiZi/lib/musllib/arch/riscv64/bits/float.h b/Ubiquitous/XiZi/lib/musllib/arch/riscv64/bits/float.h new file mode 100644 index 000000000..719c79085 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/arch/riscv64/bits/float.h @@ -0,0 +1,16 @@ +#define FLT_EVAL_METHOD 0 + +#define LDBL_TRUE_MIN 6.47517511943802511092443895822764655e-4966L +#define LDBL_MIN 3.36210314311209350626267781732175260e-4932L +#define LDBL_MAX 1.18973149535723176508575932662800702e+4932L +#define LDBL_EPSILON 1.92592994438723585305597794258492732e-34L + +#define LDBL_MANT_DIG 113 +#define LDBL_MIN_EXP (-16381) +#define LDBL_MAX_EXP 16384 + +#define LDBL_DIG 33 +#define LDBL_MIN_10_EXP (-4931) +#define LDBL_MAX_10_EXP 4932 + +#define DECIMAL_DIG 36 diff --git a/Ubiquitous/XiZi/lib/musllib/arch/riscv64/bits/posix.h b/Ubiquitous/XiZi/lib/musllib/arch/riscv64/bits/posix.h new file mode 100644 index 000000000..8068ce98d --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/arch/riscv64/bits/posix.h @@ -0,0 +1,2 @@ +#define _POSIX_V6_LP64_OFF64 1 +#define _POSIX_V7_LP64_OFF64 1 diff --git a/Ubiquitous/XiZi/lib/musllib/arch/riscv64/bits/reg.h b/Ubiquitous/XiZi/lib/musllib/arch/riscv64/bits/reg.h new file mode 100644 index 000000000..2633f39d7 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/arch/riscv64/bits/reg.h @@ -0,0 +1,2 @@ +#undef __WORDSIZE +#define __WORDSIZE 64 diff --git a/Ubiquitous/XiZi/lib/musllib/arch/riscv64/bits/setjmp.h b/Ubiquitous/XiZi/lib/musllib/arch/riscv64/bits/setjmp.h new file mode 100644 index 000000000..ad7e40160 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/arch/riscv64/bits/setjmp.h @@ -0,0 +1 @@ +typedef unsigned long __jmp_buf[26]; diff --git a/Ubiquitous/XiZi/lib/musllib/arch/riscv64/bits/signal.h b/Ubiquitous/XiZi/lib/musllib/arch/riscv64/bits/signal.h new file mode 100644 index 000000000..287367db7 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/arch/riscv64/bits/signal.h @@ -0,0 +1,118 @@ +#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \ + || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) + +#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +# define MINSIGSTKSZ 2048 +# define SIGSTKSZ 8192 +#endif + +typedef unsigned long __riscv_mc_gp_state[32]; + +struct __riscv_mc_f_ext_state { + unsigned int __f[32]; + unsigned int __fcsr; +}; + +struct __riscv_mc_d_ext_state { + unsigned long long __f[32]; + unsigned int __fcsr; +}; + +struct __riscv_mc_q_ext_state { + unsigned long long __f[64] __attribute__((aligned(16))); + unsigned int __fcsr; + unsigned int __reserved[3]; +}; + +union __riscv_mc_fp_state { + struct __riscv_mc_f_ext_state __f; + struct __riscv_mc_d_ext_state __d; + struct __riscv_mc_q_ext_state __q; +}; + +typedef struct mcontext_t { + __riscv_mc_gp_state __gregs; + union __riscv_mc_fp_state __fpregs; +} mcontext_t; + +#if defined(_GNU_SOURCE) +#define REG_PC 0 +#define REG_RA 1 +#define REG_SP 2 +#define REG_TP 4 +#define REG_S0 8 +#define REG_A0 10 +#endif + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +typedef unsigned long greg_t; +typedef unsigned long gregset_t[32]; +typedef union __riscv_mc_fp_state fpregset_t; +struct sigcontext { + gregset_t gregs; + fpregset_t fpregs; +}; +#endif + +struct sigaltstack { + void *ss_sp; + int ss_flags; + size_t ss_size; +}; + +typedef struct __ucontext +{ + unsigned long uc_flags; + struct __ucontext *uc_link; + stack_t uc_stack; + sigset_t uc_sigmask; + mcontext_t uc_mcontext; +} ucontext_t; + +#define SA_NOCLDSTOP 1 +#define SA_NOCLDWAIT 2 +#define SA_SIGINFO 4 +#define SA_ONSTACK 0x08000000 +#define SA_RESTART 0x10000000 +#define SA_NODEFER 0x40000000 +#define SA_RESETHAND 0x80000000 +#define SA_RESTORER 0x04000000 + +#endif + +#define SIGHUP 1 +#define SIGINT 2 +#define SIGQUIT 3 +#define SIGILL 4 +#define SIGTRAP 5 +#define SIGABRT 6 +#define SIGIOT SIGABRT +#define SIGBUS 7 +#define SIGFPE 8 +#define SIGKILL 9 +#define SIGUSR1 10 +#define SIGSEGV 11 +#define SIGUSR2 12 +#define SIGPIPE 13 +#define SIGALRM 14 +#define SIGTERM 15 +#define SIGSTKFLT 16 +#define SIGCHLD 17 +#define SIGCONT 18 +#define SIGSTOP 19 +#define SIGTSTP 20 +#define SIGTTIN 21 +#define SIGTTOU 22 +#define SIGURG 23 +#define SIGXCPU 24 +#define SIGXFSZ 25 +#define SIGVTALRM 26 +#define SIGPROF 27 +#define SIGWINCH 28 +#define SIGIO 29 +#define SIGPOLL SIGIO +#define SIGPWR 30 +#define SIGSYS 31 +#define SIGUNUSED SIGSYS + +#define _NSIG 65 diff --git a/Ubiquitous/XiZi/lib/musllib/arch/riscv64/bits/stat.h b/Ubiquitous/XiZi/lib/musllib/arch/riscv64/bits/stat.h new file mode 100644 index 000000000..b7f4221be --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/arch/riscv64/bits/stat.h @@ -0,0 +1,18 @@ +struct stat { + dev_t st_dev; + ino_t st_ino; + mode_t st_mode; + nlink_t st_nlink; + uid_t st_uid; + gid_t st_gid; + dev_t st_rdev; + unsigned long __pad; + off_t st_size; + blksize_t st_blksize; + int __pad2; + blkcnt_t st_blocks; + struct timespec st_atim; + struct timespec st_mtim; + struct timespec st_ctim; + unsigned __unused[2]; +}; diff --git a/Ubiquitous/XiZi/lib/musllib/arch/riscv64/bits/stdint.h b/Ubiquitous/XiZi/lib/musllib/arch/riscv64/bits/stdint.h new file mode 100644 index 000000000..1bb147f24 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/arch/riscv64/bits/stdint.h @@ -0,0 +1,20 @@ +typedef int32_t int_fast16_t; +typedef int32_t int_fast32_t; +typedef uint32_t uint_fast16_t; +typedef uint32_t uint_fast32_t; + +#define INT_FAST16_MIN INT32_MIN +#define INT_FAST32_MIN INT32_MIN + +#define INT_FAST16_MAX INT32_MAX +#define INT_FAST32_MAX INT32_MAX + +#define UINT_FAST16_MAX UINT32_MAX +#define UINT_FAST32_MAX UINT32_MAX + +#define INTPTR_MIN INT64_MIN +#define INTPTR_MAX INT64_MAX +#define UINTPTR_MAX UINT64_MAX +#define PTRDIFF_MIN INT64_MIN +#define PTRDIFF_MAX INT64_MAX +#define SIZE_MAX UINT64_MAX diff --git a/Ubiquitous/XiZi/lib/musllib/arch/riscv64/bits/syscall.h.in b/Ubiquitous/XiZi/lib/musllib/arch/riscv64/bits/syscall.h.in new file mode 100644 index 000000000..b534afe81 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/arch/riscv64/bits/syscall.h.in @@ -0,0 +1,304 @@ +#define __NR_io_setup 0 +#define __NR_io_destroy 1 +#define __NR_io_submit 2 +#define __NR_io_cancel 3 +#define __NR_io_getevents 4 +#define __NR_setxattr 5 +#define __NR_lsetxattr 6 +#define __NR_fsetxattr 7 +#define __NR_getxattr 8 +#define __NR_lgetxattr 9 +#define __NR_fgetxattr 10 +#define __NR_listxattr 11 +#define __NR_llistxattr 12 +#define __NR_flistxattr 13 +#define __NR_removexattr 14 +#define __NR_lremovexattr 15 +#define __NR_fremovexattr 16 +#define __NR_getcwd 17 +#define __NR_lookup_dcookie 18 +#define __NR_eventfd2 19 +#define __NR_epoll_create1 20 +#define __NR_epoll_ctl 21 +#define __NR_epoll_pwait 22 +#define __NR_dup 23 +#define __NR_dup3 24 +#define __NR_fcntl 25 +#define __NR_inotify_init1 26 +#define __NR_inotify_add_watch 27 +#define __NR_inotify_rm_watch 28 +#define __NR_ioctl 29 +#define __NR_ioprio_set 30 +#define __NR_ioprio_get 31 +#define __NR_flock 32 +#define __NR_mknodat 33 +#define __NR_mkdirat 34 +#define __NR_unlinkat 35 +#define __NR_symlinkat 36 +#define __NR_linkat 37 +#define __NR_umount2 39 +#define __NR_mount 40 +#define __NR_pivot_root 41 +#define __NR_nfsservctl 42 +#define __NR_statfs 43 +#define __NR_fstatfs 44 +#define __NR_truncate 45 +#define __NR_ftruncate 46 +#define __NR_fallocate 47 +#define __NR_faccessat 48 +#define __NR_chdir 49 +#define __NR_fchdir 50 +#define __NR_chroot 51 +#define __NR_fchmod 52 +#define __NR_fchmodat 53 +#define __NR_fchownat 54 +#define __NR_fchown 55 +#define __NR_openat 56 +#define __NR_close 57 +#define __NR_vhangup 58 +#define __NR_pipe2 59 +#define __NR_quotactl 60 +#define __NR_getdents64 61 +#define __NR_lseek 62 +#define __NR_read 63 +#define __NR_write 64 +#define __NR_readv 65 +#define __NR_writev 66 +#define __NR_pread64 67 +#define __NR_pwrite64 68 +#define __NR_preadv 69 +#define __NR_pwritev 70 +#define __NR_sendfile 71 +#define __NR_pselect6 72 +#define __NR_ppoll 73 +#define __NR_signalfd4 74 +#define __NR_vmsplice 75 +#define __NR_splice 76 +#define __NR_tee 77 +#define __NR_readlinkat 78 +#define __NR_newfstatat 79 +#define __NR_fstat 80 +#define __NR_sync 81 +#define __NR_fsync 82 +#define __NR_fdatasync 83 +#define __NR_sync_file_range 84 +#define __NR_timerfd_create 85 +#define __NR_timerfd_settime 86 +#define __NR_timerfd_gettime 87 +#define __NR_utimensat 88 +#define __NR_acct 89 +#define __NR_capget 90 +#define __NR_capset 91 +#define __NR_personality 92 +#define __NR_exit 93 +#define __NR_exit_group 94 +#define __NR_waitid 95 +#define __NR_set_tid_address 96 +#define __NR_unshare 97 +#define __NR_futex 98 +#define __NR_set_robust_list 99 +#define __NR_get_robust_list 100 +#define __NR_nanosleep 101 +#define __NR_getitimer 102 +#define __NR_setitimer 103 +#define __NR_kexec_load 104 +#define __NR_init_module 105 +#define __NR_delete_module 106 +#define __NR_timer_create 107 +#define __NR_timer_gettime 108 +#define __NR_timer_getoverrun 109 +#define __NR_timer_settime 110 +#define __NR_timer_delete 111 +#define __NR_clock_settime 112 +#define __NR_clock_gettime 113 +#define __NR_clock_getres 114 +#define __NR_clock_nanosleep 115 +#define __NR_syslog 116 +#define __NR_ptrace 117 +#define __NR_sched_setparam 118 +#define __NR_sched_setscheduler 119 +#define __NR_sched_getscheduler 120 +#define __NR_sched_getparam 121 +#define __NR_sched_setaffinity 122 +#define __NR_sched_getaffinity 123 +#define __NR_sched_yield 124 +#define __NR_sched_get_priority_max 125 +#define __NR_sched_get_priority_min 126 +#define __NR_sched_rr_get_interval 127 +#define __NR_restart_syscall 128 +#define __NR_kill 129 +#define __NR_tkill 130 +#define __NR_tgkill 131 +#define __NR_sigaltstack 132 +#define __NR_rt_sigsuspend 133 +#define __NR_rt_sigaction 134 +#define __NR_rt_sigprocmask 135 +#define __NR_rt_sigpending 136 +#define __NR_rt_sigtimedwait 137 +#define __NR_rt_sigqueueinfo 138 +#define __NR_rt_sigreturn 139 +#define __NR_setpriority 140 +#define __NR_getpriority 141 +#define __NR_reboot 142 +#define __NR_setregid 143 +#define __NR_setgid 144 +#define __NR_setreuid 145 +#define __NR_setuid 146 +#define __NR_setresuid 147 +#define __NR_getresuid 148 +#define __NR_setresgid 149 +#define __NR_getresgid 150 +#define __NR_setfsuid 151 +#define __NR_setfsgid 152 +#define __NR_times 153 +#define __NR_setpgid 154 +#define __NR_getpgid 155 +#define __NR_getsid 156 +#define __NR_setsid 157 +#define __NR_getgroups 158 +#define __NR_setgroups 159 +#define __NR_uname 160 +#define __NR_sethostname 161 +#define __NR_setdomainname 162 +#define __NR_getrlimit 163 +#define __NR_setrlimit 164 +#define __NR_getrusage 165 +#define __NR_umask 166 +#define __NR_prctl 167 +#define __NR_getcpu 168 +#define __NR_gettimeofday 169 +#define __NR_settimeofday 170 +#define __NR_adjtimex 171 +#define __NR_getpid 172 +#define __NR_getppid 173 +#define __NR_getuid 174 +#define __NR_geteuid 175 +#define __NR_getgid 176 +#define __NR_getegid 177 +#define __NR_gettid 178 +#define __NR_sysinfo 179 +#define __NR_mq_open 180 +#define __NR_mq_unlink 181 +#define __NR_mq_timedsend 182 +#define __NR_mq_timedreceive 183 +#define __NR_mq_notify 184 +#define __NR_mq_getsetattr 185 +#define __NR_msgget 186 +#define __NR_msgctl 187 +#define __NR_msgrcv 188 +#define __NR_msgsnd 189 +#define __NR_semget 190 +#define __NR_semctl 191 +#define __NR_semtimedop 192 +#define __NR_semop 193 +#define __NR_shmget 194 +#define __NR_shmctl 195 +#define __NR_shmat 196 +#define __NR_shmdt 197 +#define __NR_socket 198 +#define __NR_socketpair 199 +#define __NR_bind 200 +#define __NR_listen 201 +#define __NR_accept 202 +#define __NR_connect 203 +#define __NR_getsockname 204 +#define __NR_getpeername 205 +#define __NR_sendto 206 +#define __NR_recvfrom 207 +#define __NR_setsockopt 208 +#define __NR_getsockopt 209 +#define __NR_shutdown 210 +#define __NR_sendmsg 211 +#define __NR_recvmsg 212 +#define __NR_readahead 213 +#define __NR_brk 214 +#define __NR_munmap 215 +#define __NR_mremap 216 +#define __NR_add_key 217 +#define __NR_request_key 218 +#define __NR_keyctl 219 +#define __NR_clone 220 +#define __NR_execve 221 +#define __NR_mmap 222 +#define __NR_fadvise64 223 +#define __NR_swapon 224 +#define __NR_swapoff 225 +#define __NR_mprotect 226 +#define __NR_msync 227 +#define __NR_mlock 228 +#define __NR_munlock 229 +#define __NR_mlockall 230 +#define __NR_munlockall 231 +#define __NR_mincore 232 +#define __NR_madvise 233 +#define __NR_remap_file_pages 234 +#define __NR_mbind 235 +#define __NR_get_mempolicy 236 +#define __NR_set_mempolicy 237 +#define __NR_migrate_pages 238 +#define __NR_move_pages 239 +#define __NR_rt_tgsigqueueinfo 240 +#define __NR_perf_event_open 241 +#define __NR_accept4 242 +#define __NR_recvmmsg 243 +#define __NR_arch_specific_syscall 244 +#define __NR_wait4 260 +#define __NR_prlimit64 261 +#define __NR_fanotify_init 262 +#define __NR_fanotify_mark 263 +#define __NR_name_to_handle_at 264 +#define __NR_open_by_handle_at 265 +#define __NR_clock_adjtime 266 +#define __NR_syncfs 267 +#define __NR_setns 268 +#define __NR_sendmmsg 269 +#define __NR_process_vm_readv 270 +#define __NR_process_vm_writev 271 +#define __NR_kcmp 272 +#define __NR_finit_module 273 +#define __NR_sched_setattr 274 +#define __NR_sched_getattr 275 +#define __NR_renameat2 276 +#define __NR_seccomp 277 +#define __NR_getrandom 278 +#define __NR_memfd_create 279 +#define __NR_bpf 280 +#define __NR_execveat 281 +#define __NR_userfaultfd 282 +#define __NR_membarrier 283 +#define __NR_mlock2 284 +#define __NR_copy_file_range 285 +#define __NR_preadv2 286 +#define __NR_pwritev2 287 +#define __NR_pkey_mprotect 288 +#define __NR_pkey_alloc 289 +#define __NR_pkey_free 290 +#define __NR_statx 291 +#define __NR_io_pgetevents 292 +#define __NR_rseq 293 +#define __NR_kexec_file_load 294 +#define __NR_pidfd_send_signal 424 +#define __NR_io_uring_setup 425 +#define __NR_io_uring_enter 426 +#define __NR_io_uring_register 427 +#define __NR_open_tree 428 +#define __NR_move_mount 429 +#define __NR_fsopen 430 +#define __NR_fsconfig 431 +#define __NR_fsmount 432 +#define __NR_fspick 433 +#define __NR_pidfd_open 434 +#define __NR_clone3 435 +#define __NR_close_range 436 +#define __NR_openat2 437 +#define __NR_pidfd_getfd 438 +#define __NR_faccessat2 439 +#define __NR_process_madvise 440 +#define __NR_epoll_pwait2 441 +#define __NR_mount_setattr 442 +#define __NR_landlock_create_ruleset 444 +#define __NR_landlock_add_rule 445 +#define __NR_landlock_restrict_self 446 + +#define __NR_sysriscv __NR_arch_specific_syscall +#define __NR_riscv_flush_icache (__NR_sysriscv + 15) diff --git a/Ubiquitous/XiZi/lib/musllib/arch/riscv64/bits/user.h b/Ubiquitous/XiZi/lib/musllib/arch/riscv64/bits/user.h new file mode 100644 index 000000000..0d37de0b0 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/arch/riscv64/bits/user.h @@ -0,0 +1,6 @@ +#include + +#define ELF_NGREG 32 +#define ELF_NFPREG 33 +typedef unsigned long elf_greg_t, elf_gregset_t[ELF_NGREG]; +typedef union __riscv_mc_fp_state elf_fpregset_t; diff --git a/Ubiquitous/XiZi/lib/musllib/arch/riscv64/crt_arch.h b/Ubiquitous/XiZi/lib/musllib/arch/riscv64/crt_arch.h new file mode 100644 index 000000000..6b93fcfd1 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/arch/riscv64/crt_arch.h @@ -0,0 +1,19 @@ +__asm__( +".section .sdata,\"aw\"\n" +".text\n" +".global " START "\n" +".type " START ",%function\n" +START ":\n" +".weak __global_pointer$\n" +".hidden __global_pointer$\n" +".option push\n" +".option norelax\n\t" +"lla gp, __global_pointer$\n" +".option pop\n\t" +"mv a0, sp\n" +".weak _DYNAMIC\n" +".hidden _DYNAMIC\n\t" +"lla a1, _DYNAMIC\n\t" +"andi sp, sp, -16\n\t" +"tail " START "_c" +); diff --git a/Ubiquitous/XiZi/lib/musllib/arch/riscv64/kstat.h b/Ubiquitous/XiZi/lib/musllib/arch/riscv64/kstat.h new file mode 100644 index 000000000..92625f363 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/arch/riscv64/kstat.h @@ -0,0 +1,21 @@ +struct kstat { + dev_t st_dev; + ino_t st_ino; + mode_t st_mode; + nlink_t st_nlink; + uid_t st_uid; + gid_t st_gid; + dev_t st_rdev; + unsigned long __pad; + off_t st_size; + blksize_t st_blksize; + int __pad2; + blkcnt_t st_blocks; + long st_atime_sec; + long st_atime_nsec; + long st_mtime_sec; + long st_mtime_nsec; + long st_ctime_sec; + long st_ctime_nsec; + unsigned __unused[2]; +}; diff --git a/Ubiquitous/XiZi/lib/musllib/arch/riscv64/pthread_arch.h b/Ubiquitous/XiZi/lib/musllib/arch/riscv64/pthread_arch.h new file mode 100644 index 000000000..a20d7fba0 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/arch/riscv64/pthread_arch.h @@ -0,0 +1,13 @@ +static inline uintptr_t __get_tp() +{ + uintptr_t tp; + __asm__ __volatile__("mv %0, tp" : "=r"(tp)); + return tp; +} + +#define TLS_ABOVE_TP +#define GAP_ABOVE_TP 0 + +#define DTP_OFFSET 0x800 + +#define MC_PC __gregs[0] diff --git a/Ubiquitous/XiZi/lib/musllib/arch/riscv64/reloc.h b/Ubiquitous/XiZi/lib/musllib/arch/riscv64/reloc.h new file mode 100644 index 000000000..1ca138111 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/arch/riscv64/reloc.h @@ -0,0 +1,22 @@ +#if defined __riscv_float_abi_soft +#define RISCV_FP_SUFFIX "-sf" +#elif defined __riscv_float_abi_single +#define RISCV_FP_SUFFIX "-sp" +#elif defined __riscv_float_abi_double +#define RISCV_FP_SUFFIX "" +#endif + +#define LDSO_ARCH "riscv64" RISCV_FP_SUFFIX + +#define TPOFF_K 0 + +#define REL_SYMBOLIC R_RISCV_64 +#define REL_PLT R_RISCV_JUMP_SLOT +#define REL_RELATIVE R_RISCV_RELATIVE +#define REL_COPY R_RISCV_COPY +#define REL_DTPMOD R_RISCV_TLS_DTPMOD64 +#define REL_DTPOFF R_RISCV_TLS_DTPREL64 +#define REL_TPOFF R_RISCV_TLS_TPREL64 + +#define CRTJMP(pc,sp) __asm__ __volatile__( \ + "mv sp, %1 ; jr %0" : : "r"(pc), "r"(sp) : "memory" ) diff --git a/Ubiquitous/XiZi/lib/musllib/arch/riscv64/syscall_arch.h b/Ubiquitous/XiZi/lib/musllib/arch/riscv64/syscall_arch.h new file mode 100644 index 000000000..7fd042cd4 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/arch/riscv64/syscall_arch.h @@ -0,0 +1,78 @@ +#define __SYSCALL_LL_E(x) (x) +#define __SYSCALL_LL_O(x) (x) + +#define __asm_syscall(...) \ + __asm__ __volatile__ ("ecall\n\t" \ + : "=r"(a0) : __VA_ARGS__ : "memory"); \ + return a0; \ + +static inline long __syscall0(long n) +{ + register long a7 __asm__("a7") = n; + register long a0 __asm__("a0"); + __asm_syscall("r"(a7)) +} + +static inline long __syscall1(long n, long a) +{ + register long a7 __asm__("a7") = n; + register long a0 __asm__("a0") = a; + __asm_syscall("r"(a7), "0"(a0)) +} + +static inline long __syscall2(long n, long a, long b) +{ + register long a7 __asm__("a7") = n; + register long a0 __asm__("a0") = a; + register long a1 __asm__("a1") = b; + __asm_syscall("r"(a7), "0"(a0), "r"(a1)) +} + +static inline long __syscall3(long n, long a, long b, long c) +{ + register long a7 __asm__("a7") = n; + register long a0 __asm__("a0") = a; + register long a1 __asm__("a1") = b; + register long a2 __asm__("a2") = c; + __asm_syscall("r"(a7), "0"(a0), "r"(a1), "r"(a2)) +} + +static inline long __syscall4(long n, long a, long b, long c, long d) +{ + register long a7 __asm__("a7") = n; + register long a0 __asm__("a0") = a; + register long a1 __asm__("a1") = b; + register long a2 __asm__("a2") = c; + register long a3 __asm__("a3") = d; + __asm_syscall("r"(a7), "0"(a0), "r"(a1), "r"(a2), "r"(a3)) +} + +static inline long __syscall5(long n, long a, long b, long c, long d, long e) +{ + register long a7 __asm__("a7") = n; + register long a0 __asm__("a0") = a; + register long a1 __asm__("a1") = b; + register long a2 __asm__("a2") = c; + register long a3 __asm__("a3") = d; + register long a4 __asm__("a4") = e; + __asm_syscall("r"(a7), "0"(a0), "r"(a1), "r"(a2), "r"(a3), "r"(a4)) +} + +static inline long __syscall6(long n, long a, long b, long c, long d, long e, long f) +{ + register long a7 __asm__("a7") = n; + register long a0 __asm__("a0") = a; + register long a1 __asm__("a1") = b; + register long a2 __asm__("a2") = c; + register long a3 __asm__("a3") = d; + register long a4 __asm__("a4") = e; + register long a5 __asm__("a5") = f; + __asm_syscall("r"(a7), "0"(a0), "r"(a1), "r"(a2), "r"(a3), "r"(a4), "r"(a5)) +} + +#define VDSO_USEFUL +/* We don't have a clock_gettime function. +#define VDSO_CGT_SYM "__vdso_clock_gettime" +#define VDSO_CGT_VER "LINUX_2.6" */ + +#define IPC_64 0 diff --git a/Ubiquitous/XiZi/lib/musllib/include/aio.h b/Ubiquitous/XiZi/lib/musllib/include/aio.h new file mode 100644 index 000000000..453c41b74 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/aio.h @@ -0,0 +1,73 @@ +#ifndef _AIO_H +#define _AIO_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include + +#define __NEED_ssize_t +#define __NEED_off_t + +#include + +struct aiocb { + int aio_fildes, aio_lio_opcode, aio_reqprio; + volatile void *aio_buf; + size_t aio_nbytes; + struct sigevent aio_sigevent; + void *__td; + int __lock[2]; + volatile int __err; + ssize_t __ret; + off_t aio_offset; + void *__next, *__prev; + char __dummy4[32-2*sizeof(void *)]; +}; + +#define AIO_CANCELED 0 +#define AIO_NOTCANCELED 1 +#define AIO_ALLDONE 2 + +#define LIO_READ 0 +#define LIO_WRITE 1 +#define LIO_NOP 2 + +#define LIO_WAIT 0 +#define LIO_NOWAIT 1 + +int aio_read(struct aiocb *); +int aio_write(struct aiocb *); +int aio_error(const struct aiocb *); +ssize_t aio_return(struct aiocb *); +int aio_cancel(int, struct aiocb *); +int aio_suspend(const struct aiocb *const [], int, const struct timespec *); +int aio_fsync(int, struct aiocb *); + +int lio_listio(int, struct aiocb *__restrict const *__restrict, int, struct sigevent *__restrict); + +#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE) +#define aiocb64 aiocb +#define aio_read64 aio_read +#define aio_write64 aio_write +#define aio_error64 aio_error +#define aio_return64 aio_return +#define aio_cancel64 aio_cancel +#define aio_suspend64 aio_suspend +#define aio_fsync64 aio_fsync +#define lio_listio64 lio_listio +#define off64_t off_t +#endif + +#if _REDIR_TIME64 +__REDIR(aio_suspend, __aio_suspend_time64); +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/alloca.h b/Ubiquitous/XiZi/lib/musllib/include/alloca.h new file mode 100644 index 000000000..b8d183d14 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/alloca.h @@ -0,0 +1,19 @@ +#ifndef _ALLOCA_H +#define _ALLOCA_H + +#ifdef __cplusplus +extern "C" { +#endif + +#define __NEED_size_t +#include + +void *alloca(size_t); + +#define alloca __builtin_alloca + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/ar.h b/Ubiquitous/XiZi/lib/musllib/include/ar.h new file mode 100644 index 000000000..eafd51d0e --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/ar.h @@ -0,0 +1,25 @@ +#ifndef _AR_H +#define _AR_H + +#ifdef __cplusplus +extern "C" { +#endif + +#define ARMAG "!\n" +#define SARMAG 8 +#define ARFMAG "`\n" + +struct ar_hdr { + char ar_name[16]; + char ar_date[12]; + char ar_uid[6], ar_gid[6]; + char ar_mode[8]; + char ar_size[10]; + char ar_fmag[2]; +}; + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/arpa/ftp.h b/Ubiquitous/XiZi/lib/musllib/include/arpa/ftp.h new file mode 100644 index 000000000..fb0a46f2b --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/arpa/ftp.h @@ -0,0 +1,35 @@ +#ifndef _ARPA_FTP_H +#define _ARPA_FTP_H +#define PRELIM 1 +#define COMPLETE 2 +#define CONTINUE 3 +#define TRANSIENT 4 +#define ERROR 5 +#define TYPE_A 1 +#define TYPE_E 2 +#define TYPE_I 3 +#define TYPE_L 4 +#define FORM_N 1 +#define FORM_T 2 +#define FORM_C 3 +#define STRU_F 1 +#define STRU_R 2 +#define STRU_P 3 +#define MODE_S 1 +#define MODE_B 2 +#define MODE_C 3 +#define REC_ESC '\377' +#define REC_EOR '\001' +#define REC_EOF '\002' +#define BLK_EOR 0x80 +#define BLK_EOF 0x40 +#define BLK_ERRORS 0x20 +#define BLK_RESTART 0x10 +#define BLK_BYTECOUNT 2 +#ifdef FTP_NAMES +char *modenames[] = {"0", "Stream", "Block", "Compressed" }; +char *strunames[] = {"0", "File", "Record", "Page" }; +char *typenames[] = {"0", "ASCII", "EBCDIC", "Image", "Local" }; +char *formnames[] = {"0", "Nonprint", "Telnet", "Carriage-control" }; +#endif +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/arpa/inet.h b/Ubiquitous/XiZi/lib/musllib/include/arpa/inet.h new file mode 100644 index 000000000..37f8c11ee --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/arpa/inet.h @@ -0,0 +1,36 @@ +#ifndef _ARPA_INET_H +#define _ARPA_INET_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +uint32_t htonl(uint32_t); +uint16_t htons(uint16_t); +uint32_t ntohl(uint32_t); +uint16_t ntohs(uint16_t); + +in_addr_t inet_addr (const char *); +in_addr_t inet_network (const char *); +char *inet_ntoa (struct in_addr); +int inet_pton (int, const char *__restrict, void *__restrict); +const char *inet_ntop (int, const void *__restrict, char *__restrict, socklen_t); + +int inet_aton (const char *, struct in_addr *); +struct in_addr inet_makeaddr(in_addr_t, in_addr_t); +in_addr_t inet_lnaof(struct in_addr); +in_addr_t inet_netof(struct in_addr); + +#undef INET_ADDRSTRLEN +#undef INET6_ADDRSTRLEN +#define INET_ADDRSTRLEN 16 +#define INET6_ADDRSTRLEN 46 + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/arpa/nameser.h b/Ubiquitous/XiZi/lib/musllib/include/arpa/nameser.h new file mode 100644 index 000000000..581925a43 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/arpa/nameser.h @@ -0,0 +1,455 @@ +#ifndef _ARPA_NAMESER_H +#define _ARPA_NAMESER_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +#define __NAMESER 19991006 +#define NS_PACKETSZ 512 +#define NS_MAXDNAME 1025 +#define NS_MAXMSG 65535 +#define NS_MAXCDNAME 255 +#define NS_MAXLABEL 63 +#define NS_HFIXEDSZ 12 +#define NS_QFIXEDSZ 4 +#define NS_RRFIXEDSZ 10 +#define NS_INT32SZ 4 +#define NS_INT16SZ 2 +#define NS_INT8SZ 1 +#define NS_INADDRSZ 4 +#define NS_IN6ADDRSZ 16 +#define NS_CMPRSFLGS 0xc0 +#define NS_DEFAULTPORT 53 + +typedef enum __ns_sect { + ns_s_qd = 0, + ns_s_zn = 0, + ns_s_an = 1, + ns_s_pr = 1, + ns_s_ns = 2, + ns_s_ud = 2, + ns_s_ar = 3, + ns_s_max = 4 +} ns_sect; + +typedef struct __ns_msg { + const unsigned char *_msg, *_eom; + uint16_t _id, _flags, _counts[ns_s_max]; + const unsigned char *_sections[ns_s_max]; + ns_sect _sect; + int _rrnum; + const unsigned char *_msg_ptr; +} ns_msg; + +struct _ns_flagdata { int mask, shift; }; +extern const struct _ns_flagdata _ns_flagdata[]; + +#define ns_msg_id(handle) ((handle)._id + 0) +#define ns_msg_base(handle) ((handle)._msg + 0) +#define ns_msg_end(handle) ((handle)._eom + 0) +#define ns_msg_size(handle) ((handle)._eom - (handle)._msg) +#define ns_msg_count(handle, section) ((handle)._counts[section] + 0) +#define ns_msg_getflag(handle, flag) \ + (((handle)._flags & _ns_flagdata[flag].mask) >> _ns_flagdata[flag].shift) + +typedef struct __ns_rr { + char name[NS_MAXDNAME]; + uint16_t type; + uint16_t rr_class; + uint32_t ttl; + uint16_t rdlength; + const unsigned char *rdata; +} ns_rr; + +#define ns_rr_name(rr) (((rr).name[0] != '\0') ? (rr).name : ".") +#define ns_rr_type(rr) ((ns_type)((rr).type + 0)) +#define ns_rr_class(rr) ((ns_class)((rr).rr_class + 0)) +#define ns_rr_ttl(rr) ((rr).ttl + 0) +#define ns_rr_rdlen(rr) ((rr).rdlength + 0) +#define ns_rr_rdata(rr) ((rr).rdata + 0) + +typedef enum __ns_flag { + ns_f_qr, + ns_f_opcode, + ns_f_aa, + ns_f_tc, + ns_f_rd, + ns_f_ra, + ns_f_z, + ns_f_ad, + ns_f_cd, + ns_f_rcode, + ns_f_max +} ns_flag; + +typedef enum __ns_opcode { + ns_o_query = 0, + ns_o_iquery = 1, + ns_o_status = 2, + ns_o_notify = 4, + ns_o_update = 5, + ns_o_max = 6 +} ns_opcode; + +typedef enum __ns_rcode { + ns_r_noerror = 0, + ns_r_formerr = 1, + ns_r_servfail = 2, + ns_r_nxdomain = 3, + ns_r_notimpl = 4, + ns_r_refused = 5, + ns_r_yxdomain = 6, + ns_r_yxrrset = 7, + ns_r_nxrrset = 8, + ns_r_notauth = 9, + ns_r_notzone = 10, + ns_r_max = 11, + ns_r_badvers = 16, + ns_r_badsig = 16, + ns_r_badkey = 17, + ns_r_badtime = 18 +} ns_rcode; + +typedef enum __ns_update_operation { + ns_uop_delete = 0, + ns_uop_add = 1, + ns_uop_max = 2 +} ns_update_operation; + +struct ns_tsig_key { + char name[NS_MAXDNAME], alg[NS_MAXDNAME]; + unsigned char *data; + int len; +}; +typedef struct ns_tsig_key ns_tsig_key; + +struct ns_tcp_tsig_state { + int counter; + struct dst_key *key; + void *ctx; + unsigned char sig[NS_PACKETSZ]; + int siglen; +}; +typedef struct ns_tcp_tsig_state ns_tcp_tsig_state; + +#define NS_TSIG_FUDGE 300 +#define NS_TSIG_TCP_COUNT 100 +#define NS_TSIG_ALG_HMAC_MD5 "HMAC-MD5.SIG-ALG.REG.INT" + +#define NS_TSIG_ERROR_NO_TSIG -10 +#define NS_TSIG_ERROR_NO_SPACE -11 +#define NS_TSIG_ERROR_FORMERR -12 + +typedef enum __ns_type { + ns_t_invalid = 0, + ns_t_a = 1, + ns_t_ns = 2, + ns_t_md = 3, + ns_t_mf = 4, + ns_t_cname = 5, + ns_t_soa = 6, + ns_t_mb = 7, + ns_t_mg = 8, + ns_t_mr = 9, + ns_t_null = 10, + ns_t_wks = 11, + ns_t_ptr = 12, + ns_t_hinfo = 13, + ns_t_minfo = 14, + ns_t_mx = 15, + ns_t_txt = 16, + ns_t_rp = 17, + ns_t_afsdb = 18, + ns_t_x25 = 19, + ns_t_isdn = 20, + ns_t_rt = 21, + ns_t_nsap = 22, + ns_t_nsap_ptr = 23, + ns_t_sig = 24, + ns_t_key = 25, + ns_t_px = 26, + ns_t_gpos = 27, + ns_t_aaaa = 28, + ns_t_loc = 29, + ns_t_nxt = 30, + ns_t_eid = 31, + ns_t_nimloc = 32, + ns_t_srv = 33, + ns_t_atma = 34, + ns_t_naptr = 35, + ns_t_kx = 36, + ns_t_cert = 37, + ns_t_a6 = 38, + ns_t_dname = 39, + ns_t_sink = 40, + ns_t_opt = 41, + ns_t_apl = 42, + ns_t_tkey = 249, + ns_t_tsig = 250, + ns_t_ixfr = 251, + ns_t_axfr = 252, + ns_t_mailb = 253, + ns_t_maila = 254, + ns_t_any = 255, + ns_t_zxfr = 256, + ns_t_max = 65536 +} ns_type; + +#define ns_t_qt_p(t) (ns_t_xfr_p(t) || (t) == ns_t_any || \ + (t) == ns_t_mailb || (t) == ns_t_maila) +#define ns_t_mrr_p(t) ((t) == ns_t_tsig || (t) == ns_t_opt) +#define ns_t_rr_p(t) (!ns_t_qt_p(t) && !ns_t_mrr_p(t)) +#define ns_t_udp_p(t) ((t) != ns_t_axfr && (t) != ns_t_zxfr) +#define ns_t_xfr_p(t) ((t) == ns_t_axfr || (t) == ns_t_ixfr || \ + (t) == ns_t_zxfr) + +typedef enum __ns_class { + ns_c_invalid = 0, + ns_c_in = 1, + ns_c_2 = 2, + ns_c_chaos = 3, + ns_c_hs = 4, + ns_c_none = 254, + ns_c_any = 255, + ns_c_max = 65536 +} ns_class; + +typedef enum __ns_key_types { + ns_kt_rsa = 1, + ns_kt_dh = 2, + ns_kt_dsa = 3, + ns_kt_private = 254 +} ns_key_types; + +typedef enum __ns_cert_types { + cert_t_pkix = 1, + cert_t_spki = 2, + cert_t_pgp = 3, + cert_t_url = 253, + cert_t_oid = 254 +} ns_cert_types; + +#define NS_KEY_TYPEMASK 0xC000 +#define NS_KEY_TYPE_AUTH_CONF 0x0000 +#define NS_KEY_TYPE_CONF_ONLY 0x8000 +#define NS_KEY_TYPE_AUTH_ONLY 0x4000 +#define NS_KEY_TYPE_NO_KEY 0xC000 +#define NS_KEY_NO_AUTH 0x8000 +#define NS_KEY_NO_CONF 0x4000 +#define NS_KEY_RESERVED2 0x2000 +#define NS_KEY_EXTENDED_FLAGS 0x1000 +#define NS_KEY_RESERVED4 0x0800 +#define NS_KEY_RESERVED5 0x0400 +#define NS_KEY_NAME_TYPE 0x0300 +#define NS_KEY_NAME_USER 0x0000 +#define NS_KEY_NAME_ENTITY 0x0200 +#define NS_KEY_NAME_ZONE 0x0100 +#define NS_KEY_NAME_RESERVED 0x0300 +#define NS_KEY_RESERVED8 0x0080 +#define NS_KEY_RESERVED9 0x0040 +#define NS_KEY_RESERVED10 0x0020 +#define NS_KEY_RESERVED11 0x0010 +#define NS_KEY_SIGNATORYMASK 0x000F +#define NS_KEY_RESERVED_BITMASK ( NS_KEY_RESERVED2 | \ + NS_KEY_RESERVED4 | \ + NS_KEY_RESERVED5 | \ + NS_KEY_RESERVED8 | \ + NS_KEY_RESERVED9 | \ + NS_KEY_RESERVED10 | \ + NS_KEY_RESERVED11 ) +#define NS_KEY_RESERVED_BITMASK2 0xFFFF +#define NS_ALG_MD5RSA 1 +#define NS_ALG_DH 2 +#define NS_ALG_DSA 3 +#define NS_ALG_DSS NS_ALG_DSA +#define NS_ALG_EXPIRE_ONLY 253 +#define NS_ALG_PRIVATE_OID 254 + +#define NS_KEY_PROT_TLS 1 +#define NS_KEY_PROT_EMAIL 2 +#define NS_KEY_PROT_DNSSEC 3 +#define NS_KEY_PROT_IPSEC 4 +#define NS_KEY_PROT_ANY 255 + +#define NS_MD5RSA_MIN_BITS 512 +#define NS_MD5RSA_MAX_BITS 4096 +#define NS_MD5RSA_MAX_BYTES ((NS_MD5RSA_MAX_BITS+7/8)*2+3) +#define NS_MD5RSA_MAX_BASE64 (((NS_MD5RSA_MAX_BYTES+2)/3)*4) +#define NS_MD5RSA_MIN_SIZE ((NS_MD5RSA_MIN_BITS+7)/8) +#define NS_MD5RSA_MAX_SIZE ((NS_MD5RSA_MAX_BITS+7)/8) + +#define NS_DSA_SIG_SIZE 41 +#define NS_DSA_MIN_SIZE 213 +#define NS_DSA_MAX_BYTES 405 + +#define NS_SIG_TYPE 0 +#define NS_SIG_ALG 2 +#define NS_SIG_LABELS 3 +#define NS_SIG_OTTL 4 +#define NS_SIG_EXPIR 8 +#define NS_SIG_SIGNED 12 +#define NS_SIG_FOOT 16 +#define NS_SIG_SIGNER 18 +#define NS_NXT_BITS 8 +#define NS_NXT_BIT_SET( n,p) (p[(n)/NS_NXT_BITS] |= (0x80>>((n)%NS_NXT_BITS))) +#define NS_NXT_BIT_CLEAR(n,p) (p[(n)/NS_NXT_BITS] &= ~(0x80>>((n)%NS_NXT_BITS))) +#define NS_NXT_BIT_ISSET(n,p) (p[(n)/NS_NXT_BITS] & (0x80>>((n)%NS_NXT_BITS))) +#define NS_NXT_MAX 127 + +#define NS_OPT_DNSSEC_OK 0x8000U +#define NS_OPT_NSID 3 + +#define NS_GET16(s, cp) (void)((s) = ns_get16(((cp)+=2)-2)) +#define NS_GET32(l, cp) (void)((l) = ns_get32(((cp)+=4)-4)) +#define NS_PUT16(s, cp) ns_put16((s), ((cp)+=2)-2) +#define NS_PUT32(l, cp) ns_put32((l), ((cp)+=4)-4) + +unsigned ns_get16(const unsigned char *); +unsigned long ns_get32(const unsigned char *); +void ns_put16(unsigned, unsigned char *); +void ns_put32(unsigned long, unsigned char *); + +int ns_initparse(const unsigned char *, int, ns_msg *); +int ns_parserr(ns_msg *, ns_sect, int, ns_rr *); +int ns_skiprr(const unsigned char *, const unsigned char *, ns_sect, int); +int ns_name_uncompress(const unsigned char *, const unsigned char *, const unsigned char *, char *, size_t); + + +#define __BIND 19950621 + +typedef struct { + unsigned id :16; +#if __BYTE_ORDER == __BIG_ENDIAN + unsigned qr: 1; + unsigned opcode: 4; + unsigned aa: 1; + unsigned tc: 1; + unsigned rd: 1; + unsigned ra: 1; + unsigned unused :1; + unsigned ad: 1; + unsigned cd: 1; + unsigned rcode :4; +#else + unsigned rd :1; + unsigned tc :1; + unsigned aa :1; + unsigned opcode :4; + unsigned qr :1; + unsigned rcode :4; + unsigned cd: 1; + unsigned ad: 1; + unsigned unused :1; + unsigned ra :1; +#endif + unsigned qdcount :16; + unsigned ancount :16; + unsigned nscount :16; + unsigned arcount :16; +} HEADER; + +#define PACKETSZ NS_PACKETSZ +#define MAXDNAME NS_MAXDNAME +#define MAXCDNAME NS_MAXCDNAME +#define MAXLABEL NS_MAXLABEL +#define HFIXEDSZ NS_HFIXEDSZ +#define QFIXEDSZ NS_QFIXEDSZ +#define RRFIXEDSZ NS_RRFIXEDSZ +#define INT32SZ NS_INT32SZ +#define INT16SZ NS_INT16SZ +#define INT8SZ NS_INT8SZ +#define INADDRSZ NS_INADDRSZ +#define IN6ADDRSZ NS_IN6ADDRSZ +#define INDIR_MASK NS_CMPRSFLGS +#define NAMESERVER_PORT NS_DEFAULTPORT + +#define S_ZONE ns_s_zn +#define S_PREREQ ns_s_pr +#define S_UPDATE ns_s_ud +#define S_ADDT ns_s_ar + +#define QUERY ns_o_query +#define IQUERY ns_o_iquery +#define STATUS ns_o_status +#define NS_NOTIFY_OP ns_o_notify +#define NS_UPDATE_OP ns_o_update + +#define NOERROR ns_r_noerror +#define FORMERR ns_r_formerr +#define SERVFAIL ns_r_servfail +#define NXDOMAIN ns_r_nxdomain +#define NOTIMP ns_r_notimpl +#define REFUSED ns_r_refused +#define YXDOMAIN ns_r_yxdomain +#define YXRRSET ns_r_yxrrset +#define NXRRSET ns_r_nxrrset +#define NOTAUTH ns_r_notauth +#define NOTZONE ns_r_notzone + +#define DELETE ns_uop_delete +#define ADD ns_uop_add + +#define T_A ns_t_a +#define T_NS ns_t_ns +#define T_MD ns_t_md +#define T_MF ns_t_mf +#define T_CNAME ns_t_cname +#define T_SOA ns_t_soa +#define T_MB ns_t_mb +#define T_MG ns_t_mg +#define T_MR ns_t_mr +#define T_NULL ns_t_null +#define T_WKS ns_t_wks +#define T_PTR ns_t_ptr +#define T_HINFO ns_t_hinfo +#define T_MINFO ns_t_minfo +#define T_MX ns_t_mx +#define T_TXT ns_t_txt +#define T_RP ns_t_rp +#define T_AFSDB ns_t_afsdb +#define T_X25 ns_t_x25 +#define T_ISDN ns_t_isdn +#define T_RT ns_t_rt +#define T_NSAP ns_t_nsap +#define T_NSAP_PTR ns_t_nsap_ptr +#define T_SIG ns_t_sig +#define T_KEY ns_t_key +#define T_PX ns_t_px +#define T_GPOS ns_t_gpos +#define T_AAAA ns_t_aaaa +#define T_LOC ns_t_loc +#define T_NXT ns_t_nxt +#define T_EID ns_t_eid +#define T_NIMLOC ns_t_nimloc +#define T_SRV ns_t_srv +#define T_ATMA ns_t_atma +#define T_NAPTR ns_t_naptr +#define T_A6 ns_t_a6 +#define T_DNAME ns_t_dname +#define T_TSIG ns_t_tsig +#define T_IXFR ns_t_ixfr +#define T_AXFR ns_t_axfr +#define T_MAILB ns_t_mailb +#define T_MAILA ns_t_maila +#define T_ANY ns_t_any + +#define C_IN ns_c_in +#define C_CHAOS ns_c_chaos +#define C_HS ns_c_hs +#define C_NONE ns_c_none +#define C_ANY ns_c_any + +#define GETSHORT NS_GET16 +#define GETLONG NS_GET32 +#define PUTSHORT NS_PUT16 +#define PUTLONG NS_PUT32 + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/arpa/nameser_compat.h b/Ubiquitous/XiZi/lib/musllib/include/arpa/nameser_compat.h new file mode 100644 index 000000000..3aac25c98 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/arpa/nameser_compat.h @@ -0,0 +1,2 @@ +#include + diff --git a/Ubiquitous/XiZi/lib/musllib/include/arpa/telnet.h b/Ubiquitous/XiZi/lib/musllib/include/arpa/telnet.h new file mode 100644 index 000000000..e2ad97429 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/arpa/telnet.h @@ -0,0 +1,251 @@ +#ifndef _ARPA_TELNET_H +#define _ARPA_TELNET_H + +#define IAC 255 +#define DONT 254 +#define DO 253 +#define WONT 252 +#define WILL 251 +#define SB 250 +#define GA 249 +#define EL 248 +#define EC 247 +#define AYT 246 +#define AO 245 +#define IP 244 +#define BREAK 243 +#define DM 242 +#define NOP 241 +#define SE 240 +#define EOR 239 +#define ABORT 238 +#define SUSP 237 +#define xEOF 236 + +#define SYNCH 242 + +#define telcmds ((char [][6]){ "EOF", "SUSP", "ABORT", "EOR", "SE", "NOP", "DMARK", "BRK", "IP", "AO", "AYT", "EC", "EL", "GA", "SB", "WILL", "WONT", "DO", "DONT", "IAC", 0 }) + +#define TELCMD_FIRST xEOF +#define TELCMD_LAST IAC +#define TELCMD_OK(x) ((unsigned int)(x) <= TELCMD_LAST && \ + (unsigned int)(x) >= TELCMD_FIRST) +#define TELCMD(x) telcmds[(x)-TELCMD_FIRST] + +#define TELOPT_BINARY 0 +#define TELOPT_ECHO 1 +#define TELOPT_RCP 2 +#define TELOPT_SGA 3 +#define TELOPT_NAMS 4 +#define TELOPT_STATUS 5 +#define TELOPT_TM 6 +#define TELOPT_RCTE 7 +#define TELOPT_NAOL 8 +#define TELOPT_NAOP 9 +#define TELOPT_NAOCRD 10 +#define TELOPT_NAOHTS 11 +#define TELOPT_NAOHTD 12 +#define TELOPT_NAOFFD 13 +#define TELOPT_NAOVTS 14 +#define TELOPT_NAOVTD 15 +#define TELOPT_NAOLFD 16 +#define TELOPT_XASCII 17 +#define TELOPT_LOGOUT 18 +#define TELOPT_BM 19 +#define TELOPT_DET 20 +#define TELOPT_SUPDUP 21 +#define TELOPT_SUPDUPOUTPUT 22 +#define TELOPT_SNDLOC 23 +#define TELOPT_TTYPE 24 +#define TELOPT_EOR 25 +#define TELOPT_TUID 26 +#define TELOPT_OUTMRK 27 +#define TELOPT_TTYLOC 28 +#define TELOPT_3270REGIME 29 +#define TELOPT_X3PAD 30 +#define TELOPT_NAWS 31 +#define TELOPT_TSPEED 32 +#define TELOPT_LFLOW 33 +#define TELOPT_LINEMODE 34 +#define TELOPT_XDISPLOC 35 +#define TELOPT_OLD_ENVIRON 36 +#define TELOPT_AUTHENTICATION 37/* Authenticate */ +#define TELOPT_ENCRYPT 38 +#define TELOPT_NEW_ENVIRON 39 +#define TELOPT_EXOPL 255 + + +#define NTELOPTS (1+TELOPT_NEW_ENVIRON) +#ifdef TELOPTS +char *telopts[NTELOPTS+1] = { + "BINARY", "ECHO", "RCP", "SUPPRESS GO AHEAD", "NAME", + "STATUS", "TIMING MARK", "RCTE", "NAOL", "NAOP", + "NAOCRD", "NAOHTS", "NAOHTD", "NAOFFD", "NAOVTS", + "NAOVTD", "NAOLFD", "EXTEND ASCII", "LOGOUT", "BYTE MACRO", + "DATA ENTRY TERMINAL", "SUPDUP", "SUPDUP OUTPUT", + "SEND LOCATION", "TERMINAL TYPE", "END OF RECORD", + "TACACS UID", "OUTPUT MARKING", "TTYLOC", + "3270 REGIME", "X.3 PAD", "NAWS", "TSPEED", "LFLOW", + "LINEMODE", "XDISPLOC", "OLD-ENVIRON", "AUTHENTICATION", + "ENCRYPT", "NEW-ENVIRON", + 0, +}; +#define TELOPT_FIRST TELOPT_BINARY +#define TELOPT_LAST TELOPT_NEW_ENVIRON +#define TELOPT_OK(x) ((unsigned int)(x) <= TELOPT_LAST) +#define TELOPT(x) telopts[(x)-TELOPT_FIRST] +#endif + +#define TELQUAL_IS 0 +#define TELQUAL_SEND 1 +#define TELQUAL_INFO 2 +#define TELQUAL_REPLY 2 +#define TELQUAL_NAME 3 + +#define LFLOW_OFF 0 +#define LFLOW_ON 1 +#define LFLOW_RESTART_ANY 2 +#define LFLOW_RESTART_XON 3 + + +#define LM_MODE 1 +#define LM_FORWARDMASK 2 +#define LM_SLC 3 + +#define MODE_EDIT 0x01 +#define MODE_TRAPSIG 0x02 +#define MODE_ACK 0x04 +#define MODE_SOFT_TAB 0x08 +#define MODE_LIT_ECHO 0x10 + +#define MODE_MASK 0x1f + +#define MODE_FLOW 0x0100 +#define MODE_ECHO 0x0200 +#define MODE_INBIN 0x0400 +#define MODE_OUTBIN 0x0800 +#define MODE_FORCE 0x1000 + +#define SLC_SYNCH 1 +#define SLC_BRK 2 +#define SLC_IP 3 +#define SLC_AO 4 +#define SLC_AYT 5 +#define SLC_EOR 6 +#define SLC_ABORT 7 +#define SLC_EOF 8 +#define SLC_SUSP 9 +#define SLC_EC 10 +#define SLC_EL 11 +#define SLC_EW 12 +#define SLC_RP 13 +#define SLC_LNEXT 14 +#define SLC_XON 15 +#define SLC_XOFF 16 +#define SLC_FORW1 17 +#define SLC_FORW2 18 + +#define NSLC 18 + +#define SLC_NAMELIST "0", "SYNCH", "BRK", "IP", "AO", "AYT", "EOR", \ + "ABORT", "EOF", "SUSP", "EC", "EL", "EW", "RP", \ + "LNEXT", "XON", "XOFF", "FORW1", "FORW2", 0, +#ifdef SLC_NAMES +char *slc_names[] = { + SLC_NAMELIST +}; +#else +extern char *slc_names[]; +#define SLC_NAMES SLC_NAMELIST +#endif + +#define SLC_NAME_OK(x) ((unsigned int)(x) <= NSLC) +#define SLC_NAME(x) slc_names[x] + +#define SLC_NOSUPPORT 0 +#define SLC_CANTCHANGE 1 +#define SLC_VARIABLE 2 +#define SLC_DEFAULT 3 +#define SLC_LEVELBITS 0x03 + +#define SLC_FUNC 0 +#define SLC_FLAGS 1 +#define SLC_VALUE 2 + +#define SLC_ACK 0x80 +#define SLC_FLUSHIN 0x40 +#define SLC_FLUSHOUT 0x20 + +#define OLD_ENV_VAR 1 +#define OLD_ENV_VALUE 0 +#define NEW_ENV_VAR 0 +#define NEW_ENV_VALUE 1 +#define ENV_ESC 2 +#define ENV_USERVAR 3 + +#define AUTH_WHO_CLIENT 0 +#define AUTH_WHO_SERVER 1 +#define AUTH_WHO_MASK 1 + +#define AUTH_HOW_ONE_WAY 0 +#define AUTH_HOW_MUTUAL 2 +#define AUTH_HOW_MASK 2 + +#define AUTHTYPE_NULL 0 +#define AUTHTYPE_KERBEROS_V4 1 +#define AUTHTYPE_KERBEROS_V5 2 +#define AUTHTYPE_SPX 3 +#define AUTHTYPE_MINK 4 +#define AUTHTYPE_CNT 5 + +#define AUTHTYPE_TEST 99 + +#ifdef AUTH_NAMES +char *authtype_names[] = { + "NULL", "KERBEROS_V4", "KERBEROS_V5", "SPX", "MINK", 0, +}; +#else +extern char *authtype_names[]; +#endif + +#define AUTHTYPE_NAME_OK(x) ((unsigned int)(x) < AUTHTYPE_CNT) +#define AUTHTYPE_NAME(x) authtype_names[x] + +#define ENCRYPT_IS 0 +#define ENCRYPT_SUPPORT 1 +#define ENCRYPT_REPLY 2 +#define ENCRYPT_START 3 +#define ENCRYPT_END 4 +#define ENCRYPT_REQSTART 5 +#define ENCRYPT_REQEND 6 +#define ENCRYPT_ENC_KEYID 7 +#define ENCRYPT_DEC_KEYID 8 +#define ENCRYPT_CNT 9 + +#define ENCTYPE_ANY 0 +#define ENCTYPE_DES_CFB64 1 +#define ENCTYPE_DES_OFB64 2 +#define ENCTYPE_CNT 3 + +#ifdef ENCRYPT_NAMES +char *encrypt_names[] = { + "IS", "SUPPORT", "REPLY", "START", "END", + "REQUEST-START", "REQUEST-END", "ENC-KEYID", "DEC-KEYID", + 0, +}; +char *enctype_names[] = { + "ANY", "DES_CFB64", "DES_OFB64", 0, +}; +#else +extern char *encrypt_names[]; +extern char *enctype_names[]; +#endif + + +#define ENCRYPT_NAME_OK(x) ((unsigned int)(x) < ENCRYPT_CNT) +#define ENCRYPT_NAME(x) encrypt_names[x] + +#define ENCTYPE_NAME_OK(x) ((unsigned int)(x) < ENCTYPE_CNT) +#define ENCTYPE_NAME(x) enctype_names[x] + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/arpa/tftp.h b/Ubiquitous/XiZi/lib/musllib/include/arpa/tftp.h new file mode 100644 index 000000000..799c54f22 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/arpa/tftp.h @@ -0,0 +1,31 @@ +#ifndef _ARPA_TFTP_H +#define _ARPA_TFTP_H +#define SEGSIZE 512 +#define RRQ 01 +#define WRQ 02 +#define DATA 03 +#define ACK 04 +#define ERROR 05 +struct tftphdr { + short th_opcode; + union { + unsigned short tu_block; + short tu_code; + char tu_stuff[1]; + } th_u; + char th_data[1]; +}; +#define th_block th_u.tu_block +#define th_code th_u.tu_code +#define th_stuff th_u.tu_stuff +#define th_msg th_data +#define EUNDEF 0 +#define ENOTFOUND 1 +#define EACCESS 2 +#define ENOSPACE 3 +#define EBADOP 4 +#define EBADID 5 +#define EEXISTS 6 +#define ENOUSER 7 +#endif + diff --git a/Ubiquitous/XiZi/lib/musllib/include/assert.h b/Ubiquitous/XiZi/lib/musllib/include/assert.h new file mode 100644 index 000000000..d14ec94e7 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/assert.h @@ -0,0 +1,23 @@ +#include + +#undef assert + +#ifdef NDEBUG +#define assert(x) (void)0 +#else +#define assert(x) ((void)((x) || (__assert_fail(#x, __FILE__, __LINE__, __func__),0))) +#endif + +#if __STDC_VERSION__ >= 201112L && !defined(__cplusplus) +#define static_assert _Static_assert +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +_Noreturn void __assert_fail (const char *, const char *, int, const char *); + +#ifdef __cplusplus +} +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/bits/alltypes.h b/Ubiquitous/XiZi/lib/musllib/include/bits/alltypes.h new file mode 100644 index 000000000..0696b3dba --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/bits/alltypes.h @@ -0,0 +1,463 @@ +/* The time64 has not been used yet in liteos_m */ + +#define _REDIR_TIME64 0 +#define _Addr int +#define _Int64 long long +#define _Reg int + +#ifdef __ARMEB__ +#define __BYTE_ORDER 4321 +#else +#define __BYTE_ORDER 1234 +#endif + +#define __LONG_MAX 0x7fffffffL + +#ifndef __cplusplus +#if defined(__NEED_wchar_t) && !defined(__DEFINED_wchar_t) +typedef unsigned wchar_t; +#define __DEFINED_wchar_t +#endif + +#endif + +#if defined(__NEED_float_t) && !defined(__DEFINED_float_t) +typedef float float_t; +#define __DEFINED_float_t +#endif + +#if defined(__NEED_double_t) && !defined(__DEFINED_double_t) +typedef double double_t; +#define __DEFINED_double_t +#endif + + +#if defined(__NEED_max_align_t) && !defined(__DEFINED_max_align_t) +typedef struct { long long __ll; long double __ld; } max_align_t; +#define __DEFINED_max_align_t +#endif + +#define __LITTLE_ENDIAN 1234 +#define __BIG_ENDIAN 4321 +#define __USE_TIME_BITS64 1 + +#if defined(__NEED_size_t) && !defined(__DEFINED_size_t) +typedef unsigned _Addr size_t; +#define __DEFINED_size_t +#endif + +#if defined(__NEED_uintptr_t) && !defined(__DEFINED_uintptr_t) +typedef unsigned _Addr uintptr_t; +#define __DEFINED_uintptr_t +#endif + +#if defined(__NEED_ptrdiff_t) && !defined(__DEFINED_ptrdiff_t) +typedef _Addr ptrdiff_t; +#define __DEFINED_ptrdiff_t +#endif + +#if defined(__NEED_ssize_t) && !defined(__DEFINED_ssize_t) +typedef _Addr ssize_t; +#define __DEFINED_ssize_t +#endif + +#if defined(__NEED_intptr_t) && !defined(__DEFINED_intptr_t) +typedef _Addr intptr_t; +#define __DEFINED_intptr_t +#endif + +#if defined(__NEED_regoff_t) && !defined(__DEFINED_regoff_t) +typedef _Addr regoff_t; +#define __DEFINED_regoff_t +#endif + +#if defined(__NEED_register_t) && !defined(__DEFINED_register_t) +typedef _Reg register_t; +#define __DEFINED_register_t +#endif + +#if defined(__NEED_time_t) && !defined(__DEFINED_time_t) +typedef _Int64 time_t; +#define __DEFINED_time_t +#endif + +#if defined(__NEED_suseconds_t) && !defined(__DEFINED_suseconds_t) +typedef _Int64 suseconds_t; +#define __DEFINED_suseconds_t +#endif + + +#if defined(__NEED_int8_t) && !defined(__DEFINED_int8_t) +typedef signed char int8_t; +#define __DEFINED_int8_t +#endif + +#if defined(__NEED_int16_t) && !defined(__DEFINED_int16_t) +typedef signed short int16_t; +#define __DEFINED_int16_t +#endif + +#if defined(__NEED_int32_t) && !defined(__DEFINED_int32_t) +typedef signed int int32_t; +#define __DEFINED_int32_t +#endif + +#if defined(__NEED_int64_t) && !defined(__DEFINED_int64_t) +typedef signed _Int64 int64_t; +#define __DEFINED_int64_t +#endif + +#if defined(__NEED_intmax_t) && !defined(__DEFINED_intmax_t) +typedef signed _Int64 intmax_t; +#define __DEFINED_intmax_t +#endif + +#if defined(__NEED_uint8_t) && !defined(__DEFINED_uint8_t) +typedef unsigned char uint8_t; +#define __DEFINED_uint8_t +#endif + +#if defined(__NEED_uint16_t) && !defined(__DEFINED_uint16_t) +typedef unsigned short uint16_t; +#define __DEFINED_uint16_t +#endif + +#if defined(__NEED_uint32_t) && !defined(__DEFINED_uint32_t) +typedef unsigned int uint32_t; +#define __DEFINED_uint32_t +#endif + +#if defined(__NEED_uint64_t) && !defined(__DEFINED_uint64_t) +typedef unsigned _Int64 uint64_t; +#define __DEFINED_uint64_t +#endif + +#if defined(__NEED_u_int64_t) && !defined(__DEFINED_u_int64_t) +typedef unsigned _Int64 u_int64_t; +#define __DEFINED_u_int64_t +#endif + +#if defined(__NEED_uintmax_t) && !defined(__DEFINED_uintmax_t) +typedef unsigned _Int64 uintmax_t; +#define __DEFINED_uintmax_t +#endif + + +#if defined(__NEED_mode_t) && !defined(__DEFINED_mode_t) +typedef unsigned mode_t; +#define __DEFINED_mode_t +#endif + +#if defined(__NEED_nlink_t) && !defined(__DEFINED_nlink_t) +typedef unsigned _Reg nlink_t; +#define __DEFINED_nlink_t +#endif + +#if defined(__NEED_off_t) && !defined(__DEFINED_off_t) +typedef _Int64 off_t; +#define __DEFINED_off_t +#endif + +#if defined(__NEED_ino_t) && !defined(__DEFINED_ino_t) +typedef unsigned _Int64 ino_t; +#define __DEFINED_ino_t +#endif + +#if defined(__NEED_dev_t) && !defined(__DEFINED_dev_t) +typedef unsigned _Int64 dev_t; +#define __DEFINED_dev_t +#endif + +#if defined(__NEED_blksize_t) && !defined(__DEFINED_blksize_t) +typedef long blksize_t; +#define __DEFINED_blksize_t +#endif + +#if defined(__NEED_blkcnt_t) && !defined(__DEFINED_blkcnt_t) +typedef _Int64 blkcnt_t; +#define __DEFINED_blkcnt_t +#endif + +#if defined(__NEED_fsblkcnt_t) && !defined(__DEFINED_fsblkcnt_t) +typedef unsigned _Int64 fsblkcnt_t; +#define __DEFINED_fsblkcnt_t +#endif + +#if defined(__NEED_fsfilcnt_t) && !defined(__DEFINED_fsfilcnt_t) +typedef unsigned _Int64 fsfilcnt_t; +#define __DEFINED_fsfilcnt_t +#endif + + +#if defined(__NEED_wint_t) && !defined(__DEFINED_wint_t) +typedef unsigned wint_t; +#define __DEFINED_wint_t +#endif + +#if defined(__NEED_wctype_t) && !defined(__DEFINED_wctype_t) +typedef unsigned long wctype_t; +#define __DEFINED_wctype_t +#endif + + +#if defined(__NEED_timer_t) && !defined(__DEFINED_timer_t) +typedef void * timer_t; +#define __DEFINED_timer_t +#endif + +#if defined(__NEED_clockid_t) && !defined(__DEFINED_clockid_t) +typedef int clockid_t; +#define __DEFINED_clockid_t +#endif + +#if defined(__NEED_clock_t) && !defined(__DEFINED_clock_t) +typedef long clock_t; +#define __DEFINED_clock_t +#endif + +#if defined(__NEED_struct_timeval) && !defined(__DEFINED_struct_timeval) +struct timeval { time_t tv_sec; suseconds_t tv_usec; }; +#define __DEFINED_struct_timeval +#endif + +#if defined(__NEED_struct_timespec) && !defined(__DEFINED_struct_timespec) +struct timespec { time_t tv_sec; int :8*(sizeof(time_t)-sizeof(long))*(__BYTE_ORDER==4321); long tv_nsec; int :8*(sizeof(time_t)-sizeof(long))*(__BYTE_ORDER!=4321); }; +#define __DEFINED_struct_timespec +#endif + + +#if defined(__NEED_pid_t) && !defined(__DEFINED_pid_t) +typedef int pid_t; +#define __DEFINED_pid_t +#endif + +#if defined(__NEED_id_t) && !defined(__DEFINED_id_t) +typedef unsigned id_t; +#define __DEFINED_id_t +#endif + +#if defined(__NEED_uid_t) && !defined(__DEFINED_uid_t) +typedef unsigned uid_t; +#define __DEFINED_uid_t +#endif + +#if defined(__NEED_gid_t) && !defined(__DEFINED_gid_t) +typedef unsigned gid_t; +#define __DEFINED_gid_t +#endif + +#if defined(__NEED_key_t) && !defined(__DEFINED_key_t) +typedef int key_t; +#define __DEFINED_key_t +#endif + +#if defined(__NEED_useconds_t) && !defined(__DEFINED_useconds_t) +typedef unsigned useconds_t; +#define __DEFINED_useconds_t +#endif + + +#ifdef __cplusplus +#if defined(__NEED_pthread_t) && !defined(__DEFINED_pthread_t) +typedef unsigned long pthread_t; +#define __DEFINED_pthread_t +#endif + +#else +#if defined(__NEED_pthread_t) && !defined(__DEFINED_pthread_t) +typedef struct __pthread * pthread_t; +#define __DEFINED_pthread_t +#endif + +#endif +#if defined(__NEED_pthread_once_t) && !defined(__DEFINED_pthread_once_t) +typedef int pthread_once_t; +#define __DEFINED_pthread_once_t +#endif + +#if defined(__NEED_pthread_key_t) && !defined(__DEFINED_pthread_key_t) +typedef unsigned pthread_key_t; +#define __DEFINED_pthread_key_t +#endif + +#if defined(__NEED_pthread_spinlock_t) && !defined(__DEFINED_pthread_spinlock_t) +typedef int pthread_spinlock_t; +#define __DEFINED_pthread_spinlock_t +#endif + +#if defined(__NEED_pthread_mutexattr_t) && !defined(__DEFINED_pthread_mutexattr_t) +typedef struct { unsigned type; } pthread_mutexattr_t; +#define __DEFINED_pthread_mutexattr_t +#endif + +#if defined(__NEED_pthread_condattr_t) && !defined(__DEFINED_pthread_condattr_t) +typedef struct { int clock; } pthread_condattr_t; +#define __DEFINED_pthread_condattr_t +#endif + +#if defined(__NEED_pthread_barrierattr_t) && !defined(__DEFINED_pthread_barrierattr_t) +typedef struct { unsigned __attr; } pthread_barrierattr_t; +#define __DEFINED_pthread_barrierattr_t +#endif + +#if defined(__NEED_pthread_rwlockattr_t) && !defined(__DEFINED_pthread_rwlockattr_t) +typedef struct { unsigned __attr[2]; } pthread_rwlockattr_t; +#define __DEFINED_pthread_rwlockattr_t +#endif + + +#if defined(__NEED_struct__IO_FILE) && !defined(__DEFINED_struct__IO_FILE) +struct _IO_FILE { + unsigned flags; + unsigned char *rpos, *rend; + int (*close)(struct _IO_FILE *); + unsigned char *wend, *wpos; + unsigned char *mustbezero_1; + unsigned char *wbase; + size_t (*read)(struct _IO_FILE *, unsigned char *, size_t); + size_t (*write)(struct _IO_FILE *, const unsigned char *, size_t); + off_t (*seek)(struct _IO_FILE *, off_t, int); + unsigned char *buf; + size_t buf_size; + struct _IO_FILE *prev, *next; + int fd; + int pipe_pid; + int mode; + void *lock; + int lbf; + void *cookie; + off_t off; + char *getln_buf; + void *mustbezero_2; + unsigned char *shend; + off_t shlim, shcnt; + struct __locale_struct *locale; +}; +#define __DEFINED_struct__IO_FILE +#endif + +#if defined(__NEED_FILE) && !defined(__DEFINED_FILE) +typedef struct _IO_FILE FILE; +#define __DEFINED_FILE +#endif + + +#if defined(__NEED_va_list) && !defined(__DEFINED_va_list) +typedef __builtin_va_list va_list; +#define __DEFINED_va_list +#endif + +#if defined(__NEED___isoc_va_list) && !defined(__DEFINED___isoc_va_list) +typedef __builtin_va_list __isoc_va_list; +#define __DEFINED___isoc_va_list +#endif + + +#if defined(__NEED_mbstate_t) && !defined(__DEFINED_mbstate_t) +typedef struct __mbstate_t { unsigned __opaque1, __opaque2; } mbstate_t; +#define __DEFINED_mbstate_t +#endif + + +#if defined(__NEED_locale_t) && !defined(__DEFINED_locale_t) +typedef struct __locale_struct * locale_t; +#define __DEFINED_locale_t +#endif + + +#if defined(__NEED_sigset_t) && !defined(__DEFINED_sigset_t) +typedef unsigned long sigset_t; +#define __DEFINED_sigset_t +#endif + + +#if defined(__NEED_struct_iovec) && !defined(__DEFINED_struct_iovec) +struct iovec { void *iov_base; size_t iov_len; }; +#define __DEFINED_struct_iovec +#endif + + +#if defined(__NEED_socklen_t) && !defined(__DEFINED_socklen_t) +typedef unsigned socklen_t; +#define __DEFINED_socklen_t +#endif + +#if defined(__NEED_sa_family_t) && !defined(__DEFINED_sa_family_t) +typedef unsigned short sa_family_t; +#define __DEFINED_sa_family_t +#endif + +#if (defined(__NEED_sched_param) || defined(__NEED_pthread_attr_t)) && !defined(__DEFINED_sched_param) +struct sched_param { + int sched_priority; + int __reserved1; +#if _REDIR_TIME64 + long __reserved2[4]; +#else + struct { + time_t __reserved1; + long __reserved2; + } __reserved2[2]; +#endif + int __reserved3; +}; +#define __DEFINED_sched_param +#endif + +#if defined(__NEED_pthread_attr_t) && !defined(__DEFINED_pthread_attr_t) +typedef struct { + unsigned int detachstate; + unsigned int schedpolicy; + struct sched_param schedparam; + unsigned int inheritsched; + unsigned int scope; + unsigned int stackaddr_set; + void *stackaddr; + unsigned int stacksize_set; + size_t stacksize; +} pthread_attr_t; +#define __DEFINED_pthread_attr_t +#endif + +#if defined(__NEED_pthread_mutex_t) && !defined(__DEFINED_pthread_mutex_t) +typedef struct { unsigned int magic; unsigned int handle; pthread_mutexattr_t stAttr;} pthread_mutex_t; +#define __DEFINED_pthread_mutex_t +#endif + +#if defined(__NEED_mtx_t) && !defined(__DEFINED_mtx_t) +typedef struct { union { int __i[sizeof(long)==8?10:6]; volatile int __vi[sizeof(long)==8?10:6]; volatile void *volatile __p[sizeof(long)==8?5:6]; } __u; } mtx_t; +#define __DEFINED_mtx_t +#endif + +#if defined(__NEED_pthread_cond_t) && !defined(__DEFINED_pthread_cond_t) +// #include "../kernel/include/xs_event.h" +#include "xs_event.h" +typedef struct pthread_cond { + volatile int count; /**< The number of tasks blocked by condition */ + struct Event event; /**< Event object*/ + pthread_mutex_t* mutex; /**< Mutex locker for condition variable protection */ + volatile int value; /**< Condition variable state value*/ + int clock; +} pthread_cond_t; +#define __DEFINED_pthread_cond_t +#endif + +#if defined(__NEED_cnd_t) && !defined(__DEFINED_cnd_t) +typedef struct { union { int __i[12]; volatile int __vi[12]; void *__p[12*sizeof(int)/sizeof(void*)]; } __u; } cnd_t; +#define __DEFINED_cnd_t +#endif + +#if defined(__NEED_pthread_rwlock_t) && !defined(__DEFINED_pthread_rwlock_t) +typedef struct { union { int __i[sizeof(long)==8?14:8]; volatile int __vi[sizeof(long)==8?14:8]; void *__p[sizeof(long)==8?7:8]; } __u; } pthread_rwlock_t; +#define __DEFINED_pthread_rwlock_t +#endif + +#if defined(__NEED_pthread_barrier_t) && !defined(__DEFINED_pthread_barrier_t) +typedef struct { union { int __i[sizeof(long)==8?8:5]; volatile int __vi[sizeof(long)==8?8:5]; void *__p[sizeof(long)==8?4:5]; } __u; } pthread_barrier_t; +#define __DEFINED_pthread_barrier_t +#endif + + +#undef _Addr +#undef _Int64 +#undef _Reg diff --git a/Ubiquitous/XiZi/lib/musllib/include/bits/dirent.h b/Ubiquitous/XiZi/lib/musllib/include/bits/dirent.h new file mode 100644 index 000000000..c845fe82d --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/bits/dirent.h @@ -0,0 +1,11 @@ +#define _DIRENT_HAVE_D_RECLEN +#define _DIRENT_HAVE_D_OFF +#define _DIRENT_HAVE_D_TYPE + +struct dirent { + ino_t d_ino; + off_t d_off; + unsigned short d_reclen; + unsigned char d_type; + char d_name[256]; +}; diff --git a/Ubiquitous/XiZi/lib/musllib/include/bits/errno.h b/Ubiquitous/XiZi/lib/musllib/include/bits/errno.h new file mode 100644 index 000000000..4b1b0954f --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/bits/errno.h @@ -0,0 +1,135 @@ +#define ENOERR 0 +#define EPERM 1 +#define ENOENT 2 +#define ESRCH 3 +#define EINTR 4 +#define EIO 5 +#define ENXIO 6 +#define E2BIG 7 +#define ENOEXEC 8 +#define EBADF 9 +#define ECHILD 10 +#define EAGAIN 11 +#define ENOMEM 12 +#define EACCES 13 +#define EFAULT 14 +#define ENOTBLK 15 +#define EBUSY 16 +#define EEXIST 17 +#define EXDEV 18 +#define ENODEV 19 +#define ENOTDIR 20 +#define EISDIR 21 +#define EINVAL 22 +#define ENFILE 23 +#define EMFILE 24 +#define ENOTTY 25 +#define ETXTBSY 26 +#define EFBIG 27 +#define ENOSPC 28 +#define ESPIPE 29 +#define EROFS 30 +#define EMLINK 31 +#define EPIPE 32 +#define EDOM 33 +#define ERANGE 34 +#define EDEADLK 35 +#define ENAMETOOLONG 36 +#define ENOLCK 37 +#define ENOSYS 38 +#define ENOTEMPTY 39 +#define ELOOP 40 +#define EWOULDBLOCK EAGAIN +#define ENOMSG 42 +#define EIDRM 43 +#define ECHRNG 44 +#define EL2NSYNC 45 +#define EL3HLT 46 +#define EL3RST 47 +#define ELNRNG 48 +#define EUNATCH 49 +#define ENOCSI 50 +#define EL2HLT 51 +#define EBADE 52 +#define EBADR 53 +#define EXFULL 54 +#define ENOANO 55 +#define EBADRQC 56 +#define EBADSLT 57 +#define EDEADLOCK EDEADLK +#define EBFONT 59 +#define ENOSTR 60 +#define ENODATA 61 +#define ETIME 62 +#define ENOSR 63 +#define ENONET 64 +#define ENOPKG 65 +#define EREMOTE 66 +#define ENOLINK 67 +#define EADV 68 +#define ESRMNT 69 +#define ECOMM 70 +#define EPROTO 71 +#define EMULTIHOP 72 +#define EDOTDOT 73 +#define EBADMSG 74 +#define EOVERFLOW 75 +#define ENOTUNIQ 76 +#define EBADFD 77 +#define EREMCHG 78 +#define ELIBACC 79 +#define ELIBBAD 80 +#define ELIBSCN 81 +#define ELIBMAX 82 +#define ELIBEXEC 83 +#define EILSEQ 84 +#define ERESTART 85 +#define ESTRPIPE 86 +#define EUSERS 87 +#define ENOTSOCK 88 +#define EDESTADDRREQ 89 +#define EMSGSIZE 90 +#define EPROTOTYPE 91 +#define ENOPROTOOPT 92 +#define EPROTONOSUPPORT 93 +#define ESOCKTNOSUPPORT 94 +#define EOPNOTSUPP 95 +#define ENOTSUP EOPNOTSUPP +#define EPFNOSUPPORT 96 +#define EAFNOSUPPORT 97 +#define EADDRINUSE 98 +#define EADDRNOTAVAIL 99 +#define ENETDOWN 100 +#define ENETUNREACH 101 +#define ENETRESET 102 +#define ECONNABORTED 103 +#define ECONNRESET 104 +#define ENOBUFS 105 +#define EISCONN 106 +#define ENOTCONN 107 +#define ESHUTDOWN 108 +#define ETOOMANYREFS 109 +#define ETIMEDOUT 110 +#define ECONNREFUSED 111 +#define EHOSTDOWN 112 +#define EHOSTUNREACH 113 +#define EALREADY 114 +#define EINPROGRESS 115 +#define ESTALE 116 +#define EUCLEAN 117 +#define ENOTNAM 118 +#define ENAVAIL 119 +#define EISNAM 120 +#define EREMOTEIO 121 +#define EDQUOT 122 +#define ENOMEDIUM 123 +#define EMEDIUMTYPE 124 +#define ECANCELED 125 +#define ENOKEY 126 +#define EKEYEXPIRED 127 +#define EKEYREVOKED 128 +#define EKEYREJECTED 129 +#define EOWNERDEAD 130 +#define ENOTRECOVERABLE 131 +#define ERFKILL 132 +#define EHWPOISON 133 diff --git a/Ubiquitous/XiZi/lib/musllib/include/bits/fcntl.h b/Ubiquitous/XiZi/lib/musllib/include/bits/fcntl.h new file mode 100644 index 000000000..4cb1753b7 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/bits/fcntl.h @@ -0,0 +1,40 @@ +#define O_CREAT 0100 +#define O_EXCL 0200 +#define O_NOCTTY 0400 +#define O_TRUNC 01000 +#define O_APPEND 02000 +#define O_NONBLOCK 04000 +#define O_DSYNC 010000 +#define O_SYNC 04010000 +#define O_RSYNC 04010000 +#define O_DIRECTORY 040000 +#define O_NOFOLLOW 0100000 +#define O_CLOEXEC 02000000 + +#define O_ASYNC 020000 +#define O_DIRECT 0200000 +#define O_LARGEFILE 0400000 +#define O_NOATIME 01000000 +#define O_PATH 010000000 +#define O_TMPFILE 020040000 +#define O_NDELAY O_NONBLOCK + +#define F_DUPFD 0 +#define F_GETFD 1 +#define F_SETFD 2 +#define F_GETFL 3 +#define F_SETFL 4 + +#define F_SETOWN 8 +#define F_GETOWN 9 +#define F_SETSIG 10 +#define F_GETSIG 11 + +#define F_GETLK 12 +#define F_SETLK 13 +#define F_SETLKW 14 + +#define F_SETOWN_EX 15 +#define F_GETOWN_EX 16 + +#define F_GETOWNER_UIDS 17 diff --git a/Ubiquitous/XiZi/lib/musllib/include/bits/fenv.h b/Ubiquitous/XiZi/lib/musllib/include/bits/fenv.h new file mode 100644 index 000000000..d85fc86d7 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/bits/fenv.h @@ -0,0 +1,23 @@ +#ifndef __ARM_PCS_VFP +#define FE_ALL_EXCEPT 0 +#define FE_TONEAREST 0 +#else +#define FE_INVALID 1 +#define FE_DIVBYZERO 2 +#define FE_OVERFLOW 4 +#define FE_UNDERFLOW 8 +#define FE_INEXACT 16 +#define FE_ALL_EXCEPT 31 +#define FE_TONEAREST 0 +#define FE_DOWNWARD 0x800000 +#define FE_UPWARD 0x400000 +#define FE_TOWARDZERO 0xc00000 +#endif + +typedef unsigned long fexcept_t; + +typedef struct { + unsigned long __cw; +} fenv_t; + +#define FE_DFL_ENV ((const fenv_t *) -1) diff --git a/Ubiquitous/XiZi/lib/musllib/include/bits/float.h b/Ubiquitous/XiZi/lib/musllib/include/bits/float.h new file mode 100644 index 000000000..c4a655e7b --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/bits/float.h @@ -0,0 +1,16 @@ +#define FLT_EVAL_METHOD 0 + +#define LDBL_TRUE_MIN 4.94065645841246544177e-324L +#define LDBL_MIN 2.22507385850720138309e-308L +#define LDBL_MAX 1.79769313486231570815e+308L +#define LDBL_EPSILON 2.22044604925031308085e-16L + +#define LDBL_MANT_DIG 53 +#define LDBL_MIN_EXP (-1021) +#define LDBL_MAX_EXP 1024 + +#define LDBL_DIG 15 +#define LDBL_MIN_10_EXP (-307) +#define LDBL_MAX_10_EXP 308 + +#define DECIMAL_DIG 17 diff --git a/Ubiquitous/XiZi/lib/musllib/include/bits/hwcap.h b/Ubiquitous/XiZi/lib/musllib/include/bits/hwcap.h new file mode 100644 index 000000000..a3d87312d --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/bits/hwcap.h @@ -0,0 +1,53 @@ +#define HWCAP_SWP (1 << 0) +#define HWCAP_HALF (1 << 1) +#define HWCAP_THUMB (1 << 2) +#define HWCAP_26BIT (1 << 3) +#define HWCAP_FAST_MULT (1 << 4) +#define HWCAP_FPA (1 << 5) +#define HWCAP_VFP (1 << 6) +#define HWCAP_EDSP (1 << 7) +#define HWCAP_JAVA (1 << 8) +#define HWCAP_IWMMXT (1 << 9) +#define HWCAP_CRUNCH (1 << 10) +#define HWCAP_THUMBEE (1 << 11) +#define HWCAP_NEON (1 << 12) +#define HWCAP_VFPv3 (1 << 13) +#define HWCAP_VFPv3D16 (1 << 14) +#define HWCAP_TLS (1 << 15) +#define HWCAP_VFPv4 (1 << 16) +#define HWCAP_IDIVA (1 << 17) +#define HWCAP_IDIVT (1 << 18) +#define HWCAP_VFPD32 (1 << 19) +#define HWCAP_IDIV (HWCAP_IDIVA | HWCAP_IDIVT) +#define HWCAP_LPAE (1 << 20) +#define HWCAP_EVTSTRM (1 << 21) + +#define HWCAP2_AES (1 << 0) +#define HWCAP2_PMULL (1 << 1) +#define HWCAP2_SHA1 (1 << 2) +#define HWCAP2_SHA2 (1 << 3) +#define HWCAP2_CRC32 (1 << 4) + +#define HWCAP_ARM_SWP (1 << 0) +#define HWCAP_ARM_HALF (1 << 1) +#define HWCAP_ARM_THUMB (1 << 2) +#define HWCAP_ARM_26BIT (1 << 3) +#define HWCAP_ARM_FAST_MULT (1 << 4) +#define HWCAP_ARM_FPA (1 << 5) +#define HWCAP_ARM_VFP (1 << 6) +#define HWCAP_ARM_EDSP (1 << 7) +#define HWCAP_ARM_JAVA (1 << 8) +#define HWCAP_ARM_IWMMXT (1 << 9) +#define HWCAP_ARM_CRUNCH (1 << 10) +#define HWCAP_ARM_THUMBEE (1 << 11) +#define HWCAP_ARM_NEON (1 << 12) +#define HWCAP_ARM_VFPv3 (1 << 13) +#define HWCAP_ARM_VFPv3D16 (1 << 14) +#define HWCAP_ARM_TLS (1 << 15) +#define HWCAP_ARM_VFPv4 (1 << 16) +#define HWCAP_ARM_IDIVA (1 << 17) +#define HWCAP_ARM_IDIVT (1 << 18) +#define HWCAP_ARM_VFPD32 (1 << 19) +#define HWCAP_ARM_IDIV (HWCAP_ARM_IDIVA | HWCAP_ARM_IDIVT) +#define HWCAP_ARM_LPAE (1 << 20) +#define HWCAP_ARM_EVTSTRM (1 << 21) diff --git a/Ubiquitous/XiZi/lib/musllib/include/bits/io.h b/Ubiquitous/XiZi/lib/musllib/include/bits/io.h new file mode 100644 index 000000000..e69de29bb diff --git a/Ubiquitous/XiZi/lib/musllib/include/bits/ioctl.h b/Ubiquitous/XiZi/lib/musllib/include/bits/ioctl.h new file mode 100644 index 000000000..60ae8b850 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/bits/ioctl.h @@ -0,0 +1,115 @@ +#define _IOC(a,b,c,d) ( ((a)<<30) | ((b)<<8) | (c) | ((d)<<16) ) +#define _IOC_NONE 0U +#define _IOC_WRITE 1U +#define _IOC_READ 2U + +#define _IO(a,b) _IOC(_IOC_NONE,(a),(b),0) +#define _IOW(a,b,c) _IOC(_IOC_WRITE,(a),(b),sizeof(c)) +#define _IOR(a,b,c) _IOC(_IOC_READ,(a),(b),sizeof(c)) +#define _IOWR(a,b,c) _IOC(_IOC_READ|_IOC_WRITE,(a),(b),sizeof(c)) + +#define TCGETS 0x5401 +#define TCSETS 0x5402 +#define TCSETSW 0x5403 +#define TCSETSF 0x5404 +#define TCGETA 0x5405 +#define TCSETA 0x5406 +#define TCSETAW 0x5407 +#define TCSETAF 0x5408 +#define TCSBRK 0x5409 +#define TCXONC 0x540A +#define TCFLSH 0x540B +#define TIOCEXCL 0x540C +#define TIOCNXCL 0x540D +#define TIOCSCTTY 0x540E +#define TIOCGPGRP 0x540F +#define TIOCSPGRP 0x5410 +#define TIOCOUTQ 0x5411 +#define TIOCSTI 0x5412 +#define TIOCGWINSZ 0x5413 +#define TIOCSWINSZ 0x5414 +#define TIOCMGET 0x5415 +#define TIOCMBIS 0x5416 +#define TIOCMBIC 0x5417 +#define TIOCMSET 0x5418 +#define TIOCGSOFTCAR 0x5419 +#define TIOCSSOFTCAR 0x541A +#define FIONREAD 0x541B +#define TIOCINQ FIONREAD +#define TIOCLINUX 0x541C +#define TIOCCONS 0x541D +#define TIOCGSERIAL 0x541E +#define TIOCSSERIAL 0x541F +#define TIOCPKT 0x5420 +#define FIONBIO 0x5421 +#define TIOCNOTTY 0x5422 +#define TIOCSETD 0x5423 +#define TIOCGETD 0x5424 +#define TCSBRKP 0x5425 +#define TIOCSBRK 0x5427 +#define TIOCCBRK 0x5428 +#define TIOCGSID 0x5429 +#define TIOCGRS485 0x542E +#define TIOCSRS485 0x542F +#define TIOCGPTN 0x80045430 +#define TIOCSPTLCK 0x40045431 +#define TIOCGDEV 0x80045432 +#define TCGETX 0x5432 +#define TCSETX 0x5433 +#define TCSETXF 0x5434 +#define TCSETXW 0x5435 +#define TIOCSIG 0x40045436 +#define TIOCVHANGUP 0x5437 +#define TIOCGPKT 0x80045438 +#define TIOCGPTLCK 0x80045439 +#define TIOCGEXCL 0x80045440 +#define TIOCGPTPEER 0x5441 +#define TIOCGISO7816 0x80285442 +#define TIOCSISO7816 0xc0285443 + +#define FIONCLEX 0x5450 +#define FIOCLEX 0x5451 +#define FIOASYNC 0x5452 +#define TIOCSERCONFIG 0x5453 +#define TIOCSERGWILD 0x5454 +#define TIOCSERSWILD 0x5455 +#define TIOCGLCKTRMIOS 0x5456 +#define TIOCSLCKTRMIOS 0x5457 +#define TIOCSERGSTRUCT 0x5458 +#define TIOCSERGETLSR 0x5459 +#define TIOCSERGETMULTI 0x545A +#define TIOCSERSETMULTI 0x545B + +#define TIOCMIWAIT 0x545C +#define TIOCGICOUNT 0x545D +#define FIOQSIZE 0x5460 + +#define TIOCM_LE 0x001 +#define TIOCM_DTR 0x002 +#define TIOCM_RTS 0x004 +#define TIOCM_ST 0x008 +#define TIOCM_SR 0x010 +#define TIOCM_CTS 0x020 +#define TIOCM_CAR 0x040 +#define TIOCM_RNG 0x080 +#define TIOCM_DSR 0x100 +#define TIOCM_CD TIOCM_CAR +#define TIOCM_RI TIOCM_RNG +#define TIOCM_OUT1 0x2000 +#define TIOCM_OUT2 0x4000 +#define TIOCM_LOOP 0x8000 + +#define FIOSETOWN 0x8901 +#define SIOCSPGRP 0x8902 +#define FIOGETOWN 0x8903 +#define SIOCGPGRP 0x8904 +#define SIOCATMARK 0x8905 +#if __LONG_MAX == 0x7fffffff +#define SIOCGSTAMP _IOR(0x89, 6, char[16]) +#define SIOCGSTAMPNS _IOR(0x89, 7, char[16]) +#else +#define SIOCGSTAMP 0x8906 +#define SIOCGSTAMPNS 0x8907 +#endif + +#include diff --git a/Ubiquitous/XiZi/lib/musllib/include/bits/ioctl_fix.h b/Ubiquitous/XiZi/lib/musllib/include/bits/ioctl_fix.h new file mode 100644 index 000000000..ebb383daf --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/bits/ioctl_fix.h @@ -0,0 +1,2 @@ +#undef FIOQSIZE +#define FIOQSIZE 0x545e diff --git a/Ubiquitous/XiZi/lib/musllib/include/bits/ipc.h b/Ubiquitous/XiZi/lib/musllib/include/bits/ipc.h new file mode 100644 index 000000000..40d6f3a25 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/bits/ipc.h @@ -0,0 +1,11 @@ +struct ipc_perm { + key_t __ipc_perm_key; + uid_t uid; + gid_t gid; + uid_t cuid; + gid_t cgid; + mode_t mode; + int __ipc_perm_seq; + long __pad1; + long __pad2; +}; diff --git a/Ubiquitous/XiZi/lib/musllib/include/bits/ipcstat.h b/Ubiquitous/XiZi/lib/musllib/include/bits/ipcstat.h new file mode 100644 index 000000000..4f4fcb0c5 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/bits/ipcstat.h @@ -0,0 +1 @@ +#define IPC_STAT 0x102 diff --git a/Ubiquitous/XiZi/lib/musllib/include/bits/kd.h b/Ubiquitous/XiZi/lib/musllib/include/bits/kd.h new file mode 100644 index 000000000..33b873f49 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/bits/kd.h @@ -0,0 +1 @@ +#include diff --git a/Ubiquitous/XiZi/lib/musllib/include/bits/limits.h b/Ubiquitous/XiZi/lib/musllib/include/bits/limits.h new file mode 100644 index 000000000..e69de29bb diff --git a/Ubiquitous/XiZi/lib/musllib/include/bits/link.h b/Ubiquitous/XiZi/lib/musllib/include/bits/link.h new file mode 100644 index 000000000..4a94d8f89 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/bits/link.h @@ -0,0 +1 @@ +typedef uint32_t Elf_Symndx; diff --git a/Ubiquitous/XiZi/lib/musllib/include/bits/mman.h b/Ubiquitous/XiZi/lib/musllib/include/bits/mman.h new file mode 100644 index 000000000..e69de29bb diff --git a/Ubiquitous/XiZi/lib/musllib/include/bits/msg.h b/Ubiquitous/XiZi/lib/musllib/include/bits/msg.h new file mode 100644 index 000000000..7bbbb2bf4 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/bits/msg.h @@ -0,0 +1,18 @@ +struct msqid_ds { + struct ipc_perm msg_perm; + unsigned long __msg_stime_lo; + unsigned long __msg_stime_hi; + unsigned long __msg_rtime_lo; + unsigned long __msg_rtime_hi; + unsigned long __msg_ctime_lo; + unsigned long __msg_ctime_hi; + unsigned long msg_cbytes; + msgqnum_t msg_qnum; + msglen_t msg_qbytes; + pid_t msg_lspid; + pid_t msg_lrpid; + unsigned long __unused[2]; + time_t msg_stime; + time_t msg_rtime; + time_t msg_ctime; +}; diff --git a/Ubiquitous/XiZi/lib/musllib/include/bits/poll.h b/Ubiquitous/XiZi/lib/musllib/include/bits/poll.h new file mode 100644 index 000000000..e69de29bb diff --git a/Ubiquitous/XiZi/lib/musllib/include/bits/posix.h b/Ubiquitous/XiZi/lib/musllib/include/bits/posix.h new file mode 100644 index 000000000..30a38714f --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/bits/posix.h @@ -0,0 +1,2 @@ +#define _POSIX_V6_ILP32_OFFBIG 1 +#define _POSIX_V7_ILP32_OFFBIG 1 diff --git a/Ubiquitous/XiZi/lib/musllib/include/bits/ptrace.h b/Ubiquitous/XiZi/lib/musllib/include/bits/ptrace.h new file mode 100644 index 000000000..9556ef4b7 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/bits/ptrace.h @@ -0,0 +1,25 @@ +#define PTRACE_GETWMMXREGS 18 +#define PTRACE_SETWMMXREGS 19 +#define PTRACE_GET_THREAD_AREA 22 +#define PTRACE_SET_SYSCALL 23 +#define PTRACE_GETCRUNCHREGS 25 +#define PTRACE_SETCRUNCHREGS 26 +#define PTRACE_GETVFPREGS 27 +#define PTRACE_SETVFPREGS 28 +#define PTRACE_GETHBPREGS 29 +#define PTRACE_SETHBPREGS 30 +#define PTRACE_GETFDPIC 31 +#define PTRACE_GETFDPIC_EXEC 0 +#define PTRACE_GETFDPIC_INTERP 1 + +#define PT_GETWMMXREGS PTRACE_GETWMMXREGS +#define PT_SETWMMXREGS PTRACE_SETWMMXREGS +#define PT_GET_THREAD_AREA PTRACE_GET_THREAD_AREA +#define PT_SET_SYSCALL PTRACE_SET_SYSCALL +#define PT_GETCRUNCHREGS PTRACE_GETCRUNCHREGS +#define PT_SETCRUNCHREGS PTRACE_SETCRUNCHREGS +#define PT_GETVFPREGS PTRACE_GETVFPREGS +#define PT_SETVFPREGS PTRACE_SETVFPREGS +#define PT_GETHBPREGS PTRACE_GETHBPREGS +#define PT_SETHBPREGS PTRACE_SETHBPREGS +#define PT_GETFDPIC PTRACE_GETFDPIC diff --git a/Ubiquitous/XiZi/lib/musllib/include/bits/reg.h b/Ubiquitous/XiZi/lib/musllib/include/bits/reg.h new file mode 100644 index 000000000..0c7bffca0 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/bits/reg.h @@ -0,0 +1,3 @@ +#undef __WORDSIZE +#define __WORDSIZE 32 +/* FIXME */ diff --git a/Ubiquitous/XiZi/lib/musllib/include/bits/resource.h b/Ubiquitous/XiZi/lib/musllib/include/bits/resource.h new file mode 100644 index 000000000..e69de29bb diff --git a/Ubiquitous/XiZi/lib/musllib/include/bits/sem.h b/Ubiquitous/XiZi/lib/musllib/include/bits/sem.h new file mode 100644 index 000000000..544e3d2a5 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/bits/sem.h @@ -0,0 +1,18 @@ +struct semid_ds { + struct ipc_perm sem_perm; + unsigned long __sem_otime_lo; + unsigned long __sem_otime_hi; + unsigned long __sem_ctime_lo; + unsigned long __sem_ctime_hi; +#if __BYTE_ORDER == __LITTLE_ENDIAN + unsigned short sem_nsems; + char __sem_nsems_pad[sizeof(long)-sizeof(short)]; +#else + char __sem_nsems_pad[sizeof(long)-sizeof(short)]; + unsigned short sem_nsems; +#endif + long __unused3; + long __unused4; + time_t sem_otime; + time_t sem_ctime; +}; diff --git a/Ubiquitous/XiZi/lib/musllib/include/bits/setjmp.h b/Ubiquitous/XiZi/lib/musllib/include/bits/setjmp.h new file mode 100644 index 000000000..55e3a95bb --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/bits/setjmp.h @@ -0,0 +1 @@ +typedef unsigned long long __jmp_buf[32]; diff --git a/Ubiquitous/XiZi/lib/musllib/include/bits/shm.h b/Ubiquitous/XiZi/lib/musllib/include/bits/shm.h new file mode 100644 index 000000000..725fb4696 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/bits/shm.h @@ -0,0 +1,31 @@ +#define SHMLBA 4096 + +struct shmid_ds { + struct ipc_perm shm_perm; + size_t shm_segsz; + unsigned long __shm_atime_lo; + unsigned long __shm_atime_hi; + unsigned long __shm_dtime_lo; + unsigned long __shm_dtime_hi; + unsigned long __shm_ctime_lo; + unsigned long __shm_ctime_hi; + pid_t shm_cpid; + pid_t shm_lpid; + unsigned long shm_nattch; + unsigned long __pad1; + unsigned long __pad2; + unsigned long __pad3; + time_t shm_atime; + time_t shm_dtime; + time_t shm_ctime; +}; + +struct shminfo { + unsigned long shmmax, shmmin, shmmni, shmseg, shmall, __unused[4]; +}; + +struct shm_info { + int __used_ids; + unsigned long shm_tot, shm_rss, shm_swp; + unsigned long __swap_attempts, __swap_successes; +}; diff --git a/Ubiquitous/XiZi/lib/musllib/include/bits/signal.h b/Ubiquitous/XiZi/lib/musllib/include/bits/signal.h new file mode 100644 index 000000000..3c7898567 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/bits/signal.h @@ -0,0 +1,86 @@ +#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \ + || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) + +#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +#define MINSIGSTKSZ 2048 +#define SIGSTKSZ 8192 +#endif + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +typedef int greg_t, gregset_t[18]; +typedef struct sigcontext { + unsigned long trap_no, error_code, oldmask; + unsigned long arm_r0, arm_r1, arm_r2, arm_r3; + unsigned long arm_r4, arm_r5, arm_r6, arm_r7; + unsigned long arm_r8, arm_r9, arm_r10, arm_fp; + unsigned long arm_ip, arm_sp, arm_lr, arm_pc; + unsigned long arm_cpsr, fault_address; +} mcontext_t; +#else +typedef struct { + unsigned long __regs[21]; +} mcontext_t; +#endif + +struct sigaltstack { + void *ss_sp; + int ss_flags; + size_t ss_size; +}; + +typedef struct __ucontext { + unsigned long uc_flags; + struct __ucontext *uc_link; + stack_t uc_stack; + mcontext_t uc_mcontext; + sigset_t uc_sigmask; + unsigned long long uc_regspace[64]; +} ucontext_t; + +#define SA_NOCLDSTOP 1 +#define SA_NOCLDWAIT 2 +#define SA_SIGINFO 4 +#define SA_ONSTACK 0x08000000 +#define SA_RESTART 0x10000000 +#define SA_NODEFER 0x40000000 +#define SA_RESETHAND 0x80000000 +#define SA_RESTORER 0x04000000 + +#endif + +#define SIGHUP 1 +#define SIGINT 2 +#define SIGQUIT 3 +#define SIGILL 4 +#define SIGTRAP 5 +#define SIGABRT 6 +#define SIGIOT SIGABRT +#define SIGBUS 7 +#define SIGFPE 8 +#define SIGKILL 9 +#define SIGUSR1 10 +#define SIGSEGV 11 +#define SIGUSR2 12 +#define SIGPIPE 13 +#define SIGALRM 14 +#define SIGTERM 15 +#define SIGSTKFLT 16 +#define SIGCHLD 17 +#define SIGCONT 18 +#define SIGSTOP 19 +#define SIGTSTP 20 +#define SIGTTIN 21 +#define SIGTTOU 22 +#define SIGURG 23 +#define SIGXCPU 24 +#define SIGXFSZ 25 +#define SIGVTALRM 26 +#define SIGPROF 27 +#define SIGWINCH 28 +#define SIGIO 29 +#define SIGPOLL 29 +#define SIGPWR 30 +#define SIGSYS 31 +#define SIGUNUSED SIGSYS + +#define _NSIG 65 diff --git a/Ubiquitous/XiZi/lib/musllib/include/bits/socket.h b/Ubiquitous/XiZi/lib/musllib/include/bits/socket.h new file mode 100644 index 000000000..e69de29bb diff --git a/Ubiquitous/XiZi/lib/musllib/include/bits/soundcard.h b/Ubiquitous/XiZi/lib/musllib/include/bits/soundcard.h new file mode 100644 index 000000000..fade986fe --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/bits/soundcard.h @@ -0,0 +1 @@ +#include diff --git a/Ubiquitous/XiZi/lib/musllib/include/bits/stat.h b/Ubiquitous/XiZi/lib/musllib/include/bits/stat.h new file mode 100644 index 000000000..5d7828cf7 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/bits/stat.h @@ -0,0 +1,25 @@ +/* copied from kernel definition, but with padding replaced + * by the corresponding correctly-sized userspace types. */ + +struct stat { + dev_t st_dev; + int __st_dev_padding; + long __st_ino_truncated; + mode_t st_mode; + nlink_t st_nlink; + uid_t st_uid; + gid_t st_gid; + dev_t st_rdev; + int __st_rdev_padding; + off_t st_size; + blksize_t st_blksize; + blkcnt_t st_blocks; + struct { + long tv_sec; + long tv_nsec; + } __st_atim32, __st_mtim32, __st_ctim32; + ino_t st_ino; + struct timespec st_atim; + struct timespec st_mtim; + struct timespec st_ctim; +}; diff --git a/Ubiquitous/XiZi/lib/musllib/include/bits/statfs.h b/Ubiquitous/XiZi/lib/musllib/include/bits/statfs.h new file mode 100644 index 000000000..f103f4e4f --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/bits/statfs.h @@ -0,0 +1,7 @@ +struct statfs { + unsigned long f_type, f_bsize; + fsblkcnt_t f_blocks, f_bfree, f_bavail; + fsfilcnt_t f_files, f_ffree; + fsid_t f_fsid; + unsigned long f_namelen, f_frsize, f_flags, f_spare[4]; +}; diff --git a/Ubiquitous/XiZi/lib/musllib/include/bits/stdint.h b/Ubiquitous/XiZi/lib/musllib/include/bits/stdint.h new file mode 100644 index 000000000..d1b271219 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/bits/stdint.h @@ -0,0 +1,20 @@ +typedef int32_t int_fast16_t; +typedef int32_t int_fast32_t; +typedef uint32_t uint_fast16_t; +typedef uint32_t uint_fast32_t; + +#define INT_FAST16_MIN INT32_MIN +#define INT_FAST32_MIN INT32_MIN + +#define INT_FAST16_MAX INT32_MAX +#define INT_FAST32_MAX INT32_MAX + +#define UINT_FAST16_MAX UINT32_MAX +#define UINT_FAST32_MAX UINT32_MAX + +#define INTPTR_MIN INT32_MIN +#define INTPTR_MAX INT32_MAX +#define UINTPTR_MAX UINT32_MAX +#define PTRDIFF_MIN INT32_MIN +#define PTRDIFF_MAX INT32_MAX +#define SIZE_MAX UINT32_MAX diff --git a/Ubiquitous/XiZi/lib/musllib/include/bits/syscall.h b/Ubiquitous/XiZi/lib/musllib/include/bits/syscall.h new file mode 100644 index 000000000..858022690 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/bits/syscall.h @@ -0,0 +1,402 @@ +/** + * @defgroup syscall syscall + * @defgroup syscall system call ID definitions + * @ingroup syscall + */ + +#ifndef _SYSCALL_SYSCALL_H +#define _SYSCALL_SYSCALL_H + +#define ARG_NUM_0 0 +#define ARG_NUM_1 1 +#define ARG_NUM_2 2 +#define ARG_NUM_3 3 +#define ARG_NUM_4 4 +#define ARG_NUM_5 5 +#define ARG_NUM_6 6 +#define ARG_NUM_7 7 + +#define __NR_restart_syscall 0 +#define __NR_exit 1 +#define __NR_fork 2 +#define __NR_read 3 +#define __NR_write 4 +#define __NR_open 5 +#define __NR_close 6 +#define __NR_creat 8 +#define __NR_link 9 +#define __NR_unlink 10 +#define __NR_execve 11 +#define __NR_chdir 12 +#define __NR_mknod 14 +#define __NR_chmod 15 +#define __NR_lchown 16 +#define __NR_lseek 19 +#define __NR_getpid 20 +#define __NR_mount 21 +#define __NR_umount 22 +#define __NR_setuid 23 +#define __NR_getuid 24 +#define __NR_ptrace 26 +#define __NR_pause 29 +#define __NR_access 33 +#define __NR_nice 34 +#define __NR_sync 36 +#define __NR_kill 37 +#define __NR_rename 38 +#define __NR_mkdir 39 +#define __NR_rmdir 40 +#define __NR_dup 41 +#define __NR_pipe 42 +#define __NR_times 43 +#define __NR_brk 45 +#define __NR_setgid 46 +#define __NR_getgid 47 +#define __NR_geteuid 49 +#define __NR_getegid 50 +#define __NR_acct 51 +#define __NR_umount2 52 +#define __NR_ioctl 54 +#define __NR_fcntl 55 +#define __NR_setpgid 57 +#define __NR_umask 60 +#define __NR_chroot 61 +#define __NR_ustat 62 +#define __NR_dup2 63 +#define __NR_getppid 64 +#define __NR_getpgrp 65 +#define __NR_setsid 66 +#define __NR_sigaction 67 +#define __NR_setreuid 70 +#define __NR_setregid 71 +#define __NR_sigsuspend 72 +#define __NR_sigpending 73 +#define __NR_sethostname 74 +#define __NR_setrlimit 75 +#define __NR_getrusage 77 +#define __NR_gettimeofday_time32 78 +#define __NR_settimeofday_time32 79 +#define __NR_getgroups 80 +#define __NR_setgroups 81 +#define __NR_symlink 83 +#define __NR_readlink 85 +#define __NR_uselib 86 +#define __NR_swapon 87 +#define __NR_reboot 88 +#define __NR_munmap 91 +#define __NR_truncate 92 +#define __NR_ftruncate 93 +#define __NR_fchmod 94 +#define __NR_fchown 95 +#define __NR_getpriority 96 +#define __NR_setpriority 97 +#define __NR_statfs 99 +#define __NR_fstatfs 100 +#define __NR_syslog 103 +#define __NR_setitimer 104 +#define __NR_getitimer 105 +#define __NR_stat 106 +#define __NR_lstat 107 +#define __NR_fstat 108 +#define __NR_vhangup 111 +#define __NR_wait4 114 +#define __NR_swapoff 115 +#define __NR_sysinfo 116 +#define __NR_fsync 118 +#define __NR_sigreturn 119 +#define __NR_clone 120 +#define __NR_setdomainname 121 +#define __NR_uname 122 +#define __NR_adjtimex 124 +#define __NR_mprotect 125 +#define __NR_sigprocmask 126 +#define __NR_init_module 128 +#define __NR_delete_module 129 +#define __NR_quotactl 131 +#define __NR_getpgid 132 +#define __NR_fchdir 133 +#define __NR_bdflush 134 +#define __NR_sysfs 135 +#define __NR_personality 136 +#define __NR_setfsuid 138 +#define __NR_setfsgid 139 +#define __NR__llseek 140 +#define __NR_getdents 141 +#define __NR__newselect 142 +#define __NR_flock 143 +#define __NR_msync 144 +#define __NR_readv 145 +#define __NR_writev 146 +#define __NR_getsid 147 +#define __NR_fdatasync 148 +#define __NR__sysctl 149 +#define __NR_mlock 150 +#define __NR_munlock 151 +#define __NR_mlockall 152 +#define __NR_munlockall 153 +#define __NR_sched_setparam 154 +#define __NR_sched_getparam 155 +#define __NR_sched_setscheduler 156 +#define __NR_sched_getscheduler 157 +#define __NR_sched_yield 158 +#define __NR_sched_get_priority_max 159 +#define __NR_sched_get_priority_min 160 +#define __NR_sched_rr_get_interval 161 +#define __NR_nanosleep 162 +#define __NR_mremap 163 +#define __NR_setresuid 164 +#define __NR_getresuid 165 +#define __NR_poll 168 +#define __NR_nfsservctl 169 +#define __NR_setresgid 170 +#define __NR_getresgid 171 +#define __NR_prctl 172 +#define __NR_rt_sigreturn 173 +#define __NR_rt_sigaction 174 +#define __NR_rt_sigprocmask 175 +#define __NR_rt_sigpending 176 +#define __NR_rt_sigtimedwait 177 +#define __NR_rt_sigqueueinfo 178 +#define __NR_rt_sigsuspend 179 +#define __NR_pread64 180 +#define __NR_pwrite64 181 +#define __NR_chown 182 +#define __NR_getcwd 183 +#define __NR_capget 184 +#define __NR_capset 185 +#define __NR_sigaltstack 186 +#define __NR_sendfile 187 +#define __NR_vfork 190 +#define __NR_ugetrlimit 191 +#define __NR_mmap2 192 +#define __NR_truncate64 193 +#define __NR_ftruncate64 194 +#define __NR_stat64 195 +#define __NR_lstat64 196 +#define __NR_fstat64 197 +#define __NR_lchown32 198 +#define __NR_getuid32 199 +#define __NR_getgid32 200 +#define __NR_geteuid32 201 +#define __NR_getegid32 202 +#define __NR_setreuid32 203 +#define __NR_setregid32 204 +#define __NR_getgroups32 205 +#define __NR_setgroups32 206 +#define __NR_fchown32 207 +#define __NR_setresuid32 208 +#define __NR_getresuid32 209 +#define __NR_setresgid32 210 +#define __NR_getresgid32 211 +#define __NR_chown32 212 +#define __NR_setuid32 213 +#define __NR_setgid32 214 +#define __NR_setfsuid32 215 +#define __NR_setfsgid32 216 +#define __NR_getdents64 217 +#define __NR_pivot_root 218 +#define __NR_mincore 219 +#define __NR_madvise 220 +#define __NR_fcntl64 221 +#define __NR_gettid 224 +#define __NR_readahead 225 +#define __NR_setxattr 226 +#define __NR_lsetxattr 227 +#define __NR_fsetxattr 228 +#define __NR_getxattr 229 +#define __NR_lgetxattr 230 +#define __NR_fgetxattr 231 +#define __NR_listxattr 232 +#define __NR_llistxattr 233 +#define __NR_flistxattr 234 +#define __NR_removexattr 235 +#define __NR_lremovexattr 236 +#define __NR_fremovexattr 237 +#define __NR_tkill 238 +#define __NR_sendfile64 239 +#define __NR_futex 240 +#define __NR_sched_setaffinity 241 +#define __NR_sched_getaffinity 242 +#define __NR_io_setup 243 +#define __NR_io_destroy 244 +#define __NR_io_getevents 245 +#define __NR_io_submit 246 +#define __NR_io_cancel 247 +#define __NR_exit_group 248 +#define __NR_lookup_dcookie 249 +#define __NR_epoll_create 250 +#define __NR_epoll_ctl 251 +#define __NR_epoll_wait 252 +#define __NR_remap_file_pages 253 +#define __NR_set_thread_area 254 +#define __NR_get_thread_area 255 +#define __NR_set_tid_address 256 +#define __NR_timer_create 257 +#define __NR_timer_settime32 258 +#define __NR_timer_gettime32 259 +#define __NR_timer_getoverrun 260 +#define __NR_timer_delete 261 +#define __NR_clock_settime32 262 +#define __NR_clock_gettime32 263 +#define __NR_clock_getres_time32 264 +#define __NR_clock_nanosleep_time32 265 +#define __NR_statfs64 266 +#define __NR_fstatfs64 267 +#define __NR_tgkill 268 +#define __NR_utimes 269 +#define __NR_fadvise64_64 270 +#define __NR_arm_fadvise64_64 270 +#define __NR_pciconfig_iobase 271 +#define __NR_pciconfig_read 272 +#define __NR_pciconfig_write 273 +#define __NR_mq_open 274 +#define __NR_mq_unlink 275 +#define __NR_mq_timedsend 276 +#define __NR_mq_timedreceive 277 +#define __NR_mq_notify 278 +#define __NR_mq_getsetattr 279 +#define __NR_waitid 280 +#define __NR_socket 281 +#define __NR_bind 282 +#define __NR_connect 283 +#define __NR_listen 284 +#define __NR_accept 285 +#define __NR_getsockname 286 +#define __NR_getpeername 287 +#define __NR_socketpair 288 +#define __NR_send 289 +#define __NR_sendto 290 +#define __NR_recv 291 +#define __NR_recvfrom 292 +#define __NR_shutdown 293 +#define __NR_setsockopt 294 +#define __NR_getsockopt 295 +#define __NR_sendmsg 296 +#define __NR_recvmsg 297 +#define __NR_semop 298 +#define __NR_semget 299 +#define __NR_semctl 300 +#define __NR_msgsnd 301 +#define __NR_msgrcv 302 +#define __NR_msgget 303 +#define __NR_msgctl 304 +#define __NR_shmat 305 +#define __NR_shmdt 306 +#define __NR_shmget 307 +#define __NR_shmctl 308 +#define __NR_add_key 309 +#define __NR_request_key 310 +#define __NR_keyctl 311 +#define __NR_semtimedop 312 +#define __NR_vserver 313 +#define __NR_ioprio_set 314 +#define __NR_ioprio_get 315 +#define __NR_inotify_init 316 +#define __NR_inotify_add_watch 317 +#define __NR_inotify_rm_watch 318 +#define __NR_mbind 319 +#define __NR_get_mempolicy 320 +#define __NR_set_mempolicy 321 +#define __NR_openat 322 +#define __NR_mkdirat 323 +#define __NR_mknodat 324 +#define __NR_fchownat 325 +#define __NR_futimesat 326 +#define __NR_fstatat64 327 +#define __NR_unlinkat 328 +#define __NR_renameat 329 +#define __NR_linkat 330 +#define __NR_symlinkat 331 +#define __NR_readlinkat 332 +#define __NR_fchmodat 333 +#define __NR_faccessat 334 +#define __NR_pselect6 335 +#define __NR_ppoll 336 +#define __NR_unshare 337 +#define __NR_set_robust_list 338 +#define __NR_get_robust_list 339 +#define __NR_splice 340 +#define __NR_sync_file_range2 341 +#define __NR_arm_sync_file_range 341 +#define __NR_tee 342 +#define __NR_vmsplice 343 +#define __NR_move_pages 344 +#define __NR_getcpu 345 +#define __NR_epoll_pwait 346 +#define __NR_kexec_load 347 +#define __NR_utimensat 348 +#define __NR_signalfd 349 +#define __NR_timerfd_create 350 +#define __NR_eventfd 351 +#define __NR_fallocate 352 +#define __NR_timerfd_settime32 353 +#define __NR_timerfd_gettime32 354 +#define __NR_signalfd4 355 +#define __NR_eventfd2 356 +#define __NR_epoll_create1 357 +#define __NR_dup3 358 +#define __NR_pipe2 359 +#define __NR_inotify_init1 360 +#define __NR_preadv 361 +#define __NR_pwritev 362 +#define __NR_rt_tgsigqueueinfo 363 +#define __NR_perf_event_open 364 +#define __NR_recvmmsg 365 +#define __NR_accept4 366 +#define __NR_fanotify_init 367 +#define __NR_fanotify_mark 368 +#define __NR_prlimit64 369 +#define __NR_name_to_handle_at 370 +#define __NR_open_by_handle_at 371 +#define __NR_clock_adjtime 372 +#define __NR_syncfs 373 +#define __NR_sendmmsg 374 +#define __NR_setns 375 +#define __NR_process_vm_readv 376 +#define __NR_process_vm_writev 377 +#define __NR_kcmp 378 +#define __NR_finit_module 379 +#define __NR_sched_setattr 380 +#define __NR_sched_getattr 381 +#define __NR_renameat2 382 +#define __NR_seccomp 383 +#define __NR_getrandom 384 +#define __NR_memfd_create 385 +#define __NR_bpf 386 +#define __NR_execveat 387 +#define __NR_userfaultfd 388 +#define __NR_membarrier 389 +#define __NR_mlock2 390 +#define __NR_copy_file_range 391 +#define __NR_preadv2 392 +#define __NR_pwritev2 393 +#define __NR_pkey_mprotect 394 +#define __NR_pkey_alloc 395 +#define __NR_pkey_free 396 +#define __NR_statx 397 +#define __NR_rseq 398 +#define __NR_io_pgetevents 399 +#define __NR_migrate_pages 400 +#define __NR_kexec_file_load 401 +#define __NR_pidfd_send_signal 424 +#define __NR_io_uring_setup 425 +#define __NR_io_uring_enter 426 +#define __NR_io_uring_register 427 +#define __NR_open_tree 428 +#define __NR_move_mount 429 +#define __NR_fsopen 430 +#define __NR_fsconfig 431 +#define __NR_fsmount 432 +#define __NR_fspick 433 +#define __NR_pidfd_open 434 +#define __NR_clone3 435 + + +#define __ARM_NR_breakpoint 0x0f0001 +#define __ARM_NR_cacheflush 0x0f0002 +#define __ARM_NR_usr26 0x0f0003 +#define __ARM_NR_usr32 0x0f0004 +#define __ARM_NR_set_tls 0x0f0005 +#define __ARM_NR_get_tls 0x0f0006 + +#endif // _SYSCALL_SYSCALL_H diff --git a/Ubiquitous/XiZi/lib/musllib/include/bits/syscall_arch.h b/Ubiquitous/XiZi/lib/musllib/include/bits/syscall_arch.h new file mode 100644 index 000000000..a877b2cff --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/bits/syscall_arch.h @@ -0,0 +1,103 @@ +#define __SYSCALL_LL_E(x) \ +((union { long long ll; long l[2]; }){ .ll = x }).l[0], \ +((union { long long ll; long l[2]; }){ .ll = x }).l[1] +#define __SYSCALL_LL_O(x) 0, __SYSCALL_LL_E((x)) + +#ifdef __thumb__ + +/* Avoid use of r7 in asm constraints when producing thumb code, + * since it's reserved as frame pointer and might not be supported. */ +#define __ASM____R7__ +#define __asm_syscall(...) do { \ + __asm__ __volatile__ ( "mov %1,r7 ; mov r7,%2 ; svc 0 ; mov r7,%1" \ + : "=r"(r0), "=&r"((int){0}) : __VA_ARGS__ : "memory"); \ + return r0; \ + } while (0) + +#else + +#define __ASM____R7__ __asm__("r7") +#define __asm_syscall(...) do { \ + __asm__ __volatile__ ( "svc 0" \ + : "=r"(r0) : __VA_ARGS__ : "memory"); \ + return r0; \ + } while (0) +#endif + +/* For thumb2, we can allow 8-bit immediate syscall numbers, saving a + * register in the above dance around r7. Does not work for thumb1 where + * only movs, not mov, supports immediates, and we can't use movs because + * it doesn't support high regs. */ +#ifdef __thumb2__ +#define R7_OPERAND "rI"(r7) +#else +#define R7_OPERAND "r"(r7) +#endif + +static inline long __syscall0(long n) +{ + register long r7 __ASM____R7__ = n; + register long r0 __asm__("r0"); + __asm_syscall(R7_OPERAND); +} + +static inline long __syscall1(long n, long a) +{ + register long r7 __ASM____R7__ = n; + register long r0 __asm__("r0") = a; + __asm_syscall(R7_OPERAND, "0"(r0)); +} + +static inline long __syscall2(long n, long a, long b) +{ + register long r7 __ASM____R7__ = n; + register long r0 __asm__("r0") = a; + register long r1 __asm__("r1") = b; + __asm_syscall(R7_OPERAND, "0"(r0), "r"(r1)); +} + +static inline long __syscall3(long n, long a, long b, long c) +{ + register long r7 __ASM____R7__ = n; + register long r0 __asm__("r0") = a; + register long r1 __asm__("r1") = b; + register long r2 __asm__("r2") = c; + __asm_syscall(R7_OPERAND, "0"(r0), "r"(r1), "r"(r2)); +} + +static inline long __syscall4(long n, long a, long b, long c, long d) +{ + register long r7 __ASM____R7__ = n; + register long r0 __asm__("r0") = a; + register long r1 __asm__("r1") = b; + register long r2 __asm__("r2") = c; + register long r3 __asm__("r3") = d; + __asm_syscall(R7_OPERAND, "0"(r0), "r"(r1), "r"(r2), "r"(r3)); +} + +static inline long __syscall5(long n, long a, long b, long c, long d, long e) +{ + register long r7 __ASM____R7__ = n; + register long r0 __asm__("r0") = a; + register long r1 __asm__("r1") = b; + register long r2 __asm__("r2") = c; + register long r3 __asm__("r3") = d; + register long r4 __asm__("r4") = e; + __asm_syscall(R7_OPERAND, "0"(r0), "r"(r1), "r"(r2), "r"(r3), "r"(r4)); +} + +static inline long __syscall6(long n, long a, long b, long c, long d, long e, long f) +{ + register long r7 __ASM____R7__ = n; + register long r0 __asm__("r0") = a; + register long r1 __asm__("r1") = b; + register long r2 __asm__("r2") = c; + register long r3 __asm__("r3") = d; + register long r4 __asm__("r4") = e; + register long r5 __asm__("r5") = f; + __asm_syscall(R7_OPERAND, "0"(r0), "r"(r1), "r"(r2), "r"(r3), "r"(r4), "r"(r5)); +} + +#define SYSCALL_FADVISE_6_ARG + +#define SYSCALL_IPC_BROKEN_MODE diff --git a/Ubiquitous/XiZi/lib/musllib/include/bits/termios.h b/Ubiquitous/XiZi/lib/musllib/include/bits/termios.h new file mode 100644 index 000000000..124f71d20 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/bits/termios.h @@ -0,0 +1,166 @@ +struct termios { + tcflag_t c_iflag; + tcflag_t c_oflag; + tcflag_t c_cflag; + tcflag_t c_lflag; + cc_t c_line; + cc_t c_cc[NCCS]; + speed_t __c_ispeed; + speed_t __c_ospeed; +}; + +#define VINTR 0 +#define VQUIT 1 +#define VERASE 2 +#define VKILL 3 +#define VEOF 4 +#define VTIME 5 +#define VMIN 6 +#define VSWTC 7 +#define VSTART 8 +#define VSTOP 9 +#define VSUSP 10 +#define VEOL 11 +#define VREPRINT 12 +#define VDISCARD 13 +#define VWERASE 14 +#define VLNEXT 15 +#define VEOL2 16 + +#define IGNBRK 0000001 +#define BRKINT 0000002 +#define IGNPAR 0000004 +#define PARMRK 0000010 +#define INPCK 0000020 +#define ISTRIP 0000040 +#define INLCR 0000100 +#define IGNCR 0000200 +#define ICRNL 0000400 +#define IUCLC 0001000 +#define IXON 0002000 +#define IXANY 0004000 +#define IXOFF 0010000 +#define IMAXBEL 0020000 +#define IUTF8 0040000 + +#define OPOST 0000001 +#define OLCUC 0000002 +#define ONLCR 0000004 +#define OCRNL 0000010 +#define ONOCR 0000020 +#define ONLRET 0000040 +#define OFILL 0000100 +#define OFDEL 0000200 +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) || defined(_XOPEN_SOURCE) +#define NLDLY 0000400 +#define NL0 0000000 +#define NL1 0000400 +#define CRDLY 0003000 +#define CR0 0000000 +#define CR1 0001000 +#define CR2 0002000 +#define CR3 0003000 +#define TABDLY 0014000 +#define TAB0 0000000 +#define TAB1 0004000 +#define TAB2 0010000 +#define TAB3 0014000 +#define BSDLY 0020000 +#define BS0 0000000 +#define BS1 0020000 +#define FFDLY 0100000 +#define FF0 0000000 +#define FF1 0100000 +#endif + +#define VTDLY 0040000 +#define VT0 0000000 +#define VT1 0040000 + +#define B0 0000000 +#define B50 0000001 +#define B75 0000002 +#define B110 0000003 +#define B134 0000004 +#define B150 0000005 +#define B200 0000006 +#define B300 0000007 +#define B600 0000010 +#define B1200 0000011 +#define B1800 0000012 +#define B2400 0000013 +#define B4800 0000014 +#define B9600 0000015 +#define B19200 0000016 +#define B38400 0000017 + +#define B57600 0010001 +#define B115200 0010002 +#define B230400 0010003 +#define B460800 0010004 +#define B500000 0010005 +#define B576000 0010006 +#define B921600 0010007 +#define B1000000 0010010 +#define B1152000 0010011 +#define B1500000 0010012 +#define B2000000 0010013 +#define B2500000 0010014 +#define B3000000 0010015 +#define B3500000 0010016 +#define B4000000 0010017 + +#define CSIZE 0000060 +#define CS5 0000000 +#define CS6 0000020 +#define CS7 0000040 +#define CS8 0000060 +#define CSTOPB 0000100 +#define CREAD 0000200 +#define PARENB 0000400 +#define PARODD 0001000 +#define HUPCL 0002000 +#define CLOCAL 0004000 + +#define ISIG 0000001 +#define ICANON 0000002 +#define ECHO 0000010 +#define ECHOE 0000020 +#define ECHOK 0000040 +#define ECHONL 0000100 +#define NOFLSH 0000200 +#define TOSTOP 0000400 +#define IEXTEN 0100000 + +#define TCOOFF 0 +#define TCOON 1 +#define TCIOFF 2 +#define TCION 3 + +#define TCIFLUSH 0 +#define TCOFLUSH 1 +#define TCIOFLUSH 2 + +#define TCSANOW 0 +#define TCSADRAIN 1 +#define TCSAFLUSH 2 + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +#define EXTA 0000016 +#define EXTB 0000017 +#define CBAUD 0010017 +#define CBAUDEX 0010000 +#define CIBAUD 002003600000 +#define CMSPAR 010000000000 +#define CRTSCTS 020000000000 + +#define XCASE 0000004 +#define ECHOCTL 0001000 +#define ECHOPRT 0002000 +#define ECHOKE 0004000 +#define FLUSHO 0010000 +#define PENDIN 0040000 +#define EXTPROC 0200000 + +#define XTABS 0014000 +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/bits/user.h b/Ubiquitous/XiZi/lib/musllib/include/bits/user.h new file mode 100644 index 000000000..3e5a4d21d --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/bits/user.h @@ -0,0 +1,36 @@ +typedef struct user_fpregs { + struct fp_reg { + unsigned sign1:1; + unsigned unused:15; + unsigned sign2:1; + unsigned exponent:14; + unsigned j:1; + unsigned mantissa1:31; + unsigned mantissa0:32; + } fpregs[8]; + unsigned fpsr:32; + unsigned fpcr:32; + unsigned char ftype[8]; + unsigned int init_flag; +} elf_fpregset_t; + +struct user_regs { + unsigned long uregs[18]; +}; +#define ELF_NGREG 18 +typedef unsigned long elf_greg_t, elf_gregset_t[ELF_NGREG]; + +struct user { + struct user_regs regs; + int u_fpvalid; + unsigned long u_tsize, u_dsize, u_ssize; + unsigned long start_code, start_stack; + long signal; + int reserved; + struct user_regs *u_ar0; + unsigned long magic; + char u_comm[32]; + int u_debugreg[8]; + struct user_fpregs u_fp; + struct user_fpregs *u_fp0; +}; diff --git a/Ubiquitous/XiZi/lib/musllib/include/bits/vt.h b/Ubiquitous/XiZi/lib/musllib/include/bits/vt.h new file mode 100644 index 000000000..834abfbc8 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/bits/vt.h @@ -0,0 +1 @@ +#include diff --git a/Ubiquitous/XiZi/lib/musllib/include/byteswap.h b/Ubiquitous/XiZi/lib/musllib/include/byteswap.h new file mode 100644 index 000000000..00b9df3c9 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/byteswap.h @@ -0,0 +1,26 @@ +#ifndef _BYTESWAP_H +#define _BYTESWAP_H + +#include +#include + +static __inline uint16_t __bswap_16(uint16_t __x) +{ + return __x<<8 | __x>>8; +} + +static __inline uint32_t __bswap_32(uint32_t __x) +{ + return __x>>24 | __x>>8&0xff00 | __x<<8&0xff0000 | __x<<24; +} + +static __inline uint64_t __bswap_64(uint64_t __x) +{ + return __bswap_32(__x)+0ULL<<32 | __bswap_32(__x>>32); +} + +#define bswap_16(x) __bswap_16(x) +#define bswap_32(x) __bswap_32(x) +#define bswap_64(x) __bswap_64(x) + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/complex.h b/Ubiquitous/XiZi/lib/musllib/include/complex.h new file mode 100644 index 000000000..788c231d4 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/complex.h @@ -0,0 +1,134 @@ +#ifndef _COMPLEX_H +#define _COMPLEX_H + +#ifdef __cplusplus +extern "C" { +#endif + +#define complex _Complex +#ifdef __GNUC__ +#define _Complex_I (__extension__ (0.0f+1.0fi)) +#else +#define _Complex_I (0.0f+1.0fi) +#endif +#define I _Complex_I + +double complex cacos(double complex); +float complex cacosf(float complex); +long double complex cacosl(long double complex); + +double complex casin(double complex); +float complex casinf(float complex); +long double complex casinl(long double complex); + +double complex catan(double complex); +float complex catanf(float complex); +long double complex catanl(long double complex); + +double complex ccos(double complex); +float complex ccosf(float complex); +long double complex ccosl(long double complex); + +double complex csin(double complex); +float complex csinf(float complex); +long double complex csinl(long double complex); + +double complex ctan(double complex); +float complex ctanf(float complex); +long double complex ctanl(long double complex); + +double complex cacosh(double complex); +float complex cacoshf(float complex); +long double complex cacoshl(long double complex); + +double complex casinh(double complex); +float complex casinhf(float complex); +long double complex casinhl(long double complex); + +double complex catanh(double complex); +float complex catanhf(float complex); +long double complex catanhl(long double complex); + +double complex ccosh(double complex); +float complex ccoshf(float complex); +long double complex ccoshl(long double complex); + +double complex csinh(double complex); +float complex csinhf(float complex); +long double complex csinhl(long double complex); + +double complex ctanh(double complex); +float complex ctanhf(float complex); +long double complex ctanhl(long double complex); + +double complex cexp(double complex); +float complex cexpf(float complex); +long double complex cexpl(long double complex); + +double complex clog(double complex); +float complex clogf(float complex); +long double complex clogl(long double complex); + +double cabs(double complex); +float cabsf(float complex); +long double cabsl(long double complex); + +double complex cpow(double complex, double complex); +float complex cpowf(float complex, float complex); +long double complex cpowl(long double complex, long double complex); + +double complex csqrt(double complex); +float complex csqrtf(float complex); +long double complex csqrtl(long double complex); + +double carg(double complex); +float cargf(float complex); +long double cargl(long double complex); + +double cimag(double complex); +float cimagf(float complex); +long double cimagl(long double complex); + +double complex conj(double complex); +float complex conjf(float complex); +long double complex conjl(long double complex); + +double complex cproj(double complex); +float complex cprojf(float complex); +long double complex cprojl(long double complex); + +double creal(double complex); +float crealf(float complex); +long double creall(long double complex); + +#ifndef __cplusplus +#define __CIMAG(x, t) \ + (+(union { _Complex t __z; t __xy[2]; }){(_Complex t)(x)}.__xy[1]) + +#define creal(x) ((double)(x)) +#define crealf(x) ((float)(x)) +#define creall(x) ((long double)(x)) + +#define cimag(x) __CIMAG(x, double) +#define cimagf(x) __CIMAG(x, float) +#define cimagl(x) __CIMAG(x, long double) +#endif + +#if __STDC_VERSION__ >= 201112L +#if defined(_Imaginary_I) +#define __CMPLX(x, y, t) ((t)(x) + _Imaginary_I*(t)(y)) +#elif defined(__clang__) +#define __CMPLX(x, y, t) (+(_Complex t){ (t)(x), (t)(y) }) +#else +#define __CMPLX(x, y, t) (__builtin_complex((t)(x), (t)(y))) +#endif +#define CMPLX(x, y) __CMPLX(x, y, double) +#define CMPLXF(x, y) __CMPLX(x, y, float) +#define CMPLXL(x, y) __CMPLX(x, y, long double) +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/cpio.h b/Ubiquitous/XiZi/lib/musllib/include/cpio.h new file mode 100644 index 000000000..39a1f8bba --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/cpio.h @@ -0,0 +1,29 @@ +#ifndef _CPIO_H +#define _CPIO_H + +#define MAGIC "070707" + +#define C_IRUSR 000400 +#define C_IWUSR 000200 +#define C_IXUSR 000100 +#define C_IRGRP 000040 +#define C_IWGRP 000020 +#define C_IXGRP 000010 +#define C_IROTH 000004 +#define C_IWOTH 000002 +#define C_IXOTH 000001 + +#define C_ISUID 004000 +#define C_ISGID 002000 +#define C_ISVTX 001000 + +#define C_ISBLK 060000 +#define C_ISCHR 020000 +#define C_ISDIR 040000 +#define C_ISFIFO 010000 +#define C_ISSOCK 0140000 +#define C_ISLNK 0120000 +#define C_ISCTG 0110000 +#define C_ISREG 0100000 + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/crypt.h b/Ubiquitous/XiZi/lib/musllib/include/crypt.h new file mode 100644 index 000000000..07de21698 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/crypt.h @@ -0,0 +1,20 @@ +#ifndef _CRYPT_H +#define _CRYPT_H + +#ifdef __cplusplus +extern "C" { +#endif + +struct crypt_data { + int initialized; + char __buf[256]; +}; + +char *crypt(const char *, const char *); +char *crypt_r(const char *, const char *, struct crypt_data *); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/ctype.h b/Ubiquitous/XiZi/lib/musllib/include/ctype.h new file mode 100644 index 000000000..7936536f5 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/ctype.h @@ -0,0 +1,75 @@ +#ifndef _CTYPE_H +#define _CTYPE_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +int isalnum(int); +int isalpha(int); +int isblank(int); +int iscntrl(int); +int isdigit(int); +int isgraph(int); +int islower(int); +int isprint(int); +int ispunct(int); +int isspace(int); +int isupper(int); +int isxdigit(int); +int tolower(int); +int toupper(int); + +#ifndef __cplusplus +static __inline int __isspace(int _c) +{ + return _c == ' ' || (unsigned)_c-'\t' < 5; +} + +#define isalpha(a) (0 ? isalpha(a) : (((unsigned)(a)|32)-'a') < 26) +#define isdigit(a) (0 ? isdigit(a) : ((unsigned)(a)-'0') < 10) +#define islower(a) (0 ? islower(a) : ((unsigned)(a)-'a') < 26) +#define isupper(a) (0 ? isupper(a) : ((unsigned)(a)-'A') < 26) +#define isprint(a) (0 ? isprint(a) : ((unsigned)(a)-0x20) < 0x5f) +#define isgraph(a) (0 ? isgraph(a) : ((unsigned)(a)-0x21) < 0x5e) +#define isspace(a) __isspace(a) +#endif + + +#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \ + || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \ + || defined(_BSD_SOURCE) + +#define __NEED_locale_t +#include + +int isalnum_l(int, locale_t); +int isalpha_l(int, locale_t); +int isblank_l(int, locale_t); +int iscntrl_l(int, locale_t); +int isdigit_l(int, locale_t); +int isgraph_l(int, locale_t); +int islower_l(int, locale_t); +int isprint_l(int, locale_t); +int ispunct_l(int, locale_t); +int isspace_l(int, locale_t); +int isupper_l(int, locale_t); +int isxdigit_l(int, locale_t); +int tolower_l(int, locale_t); +int toupper_l(int, locale_t); + +int isascii(int); +int toascii(int); +#define _tolower(a) ((a)|0x20) +#define _toupper(a) ((a)&0x5f) +#define isascii(a) (0 ? isascii(a) : (unsigned)(a) < 128) + +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/dirent.h b/Ubiquitous/XiZi/lib/musllib/include/dirent.h new file mode 100644 index 000000000..650ecf646 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/dirent.h @@ -0,0 +1,75 @@ +#ifndef _DIRENT_H +#define _DIRENT_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#define __NEED_ino_t +#define __NEED_off_t +#if defined(_BSD_SOURCE) || defined(_GNU_SOURCE) +#define __NEED_size_t +#endif + +#include + +#include + +typedef struct __dirstream DIR; + +#define d_fileno d_ino + +int closedir(DIR *); +DIR *fdopendir(int); +DIR *opendir(const char *); +struct dirent *readdir(DIR *); +int readdir_r(DIR *__restrict, struct dirent *__restrict, struct dirent **__restrict); +void rewinddir(DIR *); +int dirfd(DIR *); + +int alphasort(const struct dirent **, const struct dirent **); +int scandir(const char *, struct dirent ***, int (*)(const struct dirent *), int (*)(const struct dirent **, const struct dirent **)); + +#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +void seekdir(DIR *, long); +long telldir(DIR *); +#endif + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +#define DT_UNKNOWN 0 +#define DT_FIFO 1 +#define DT_CHR 2 +#define DT_DIR 4 +#define DT_BLK 6 +#define DT_REG 8 +#define DT_LNK 10 +#define DT_SOCK 12 +#define DT_WHT 14 +#define IFTODT(x) ((x)>>12 & 017) +#define DTTOIF(x) ((x)<<12) +int getdents(int, struct dirent *, size_t); +#endif + +#ifdef _GNU_SOURCE +int versionsort(const struct dirent **, const struct dirent **); +#endif + +#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE) +#define dirent64 dirent +#define readdir64 readdir +#define readdir64_r readdir_r +#define scandir64 scandir +#define alphasort64 alphasort +#define versionsort64 versionsort +#define off64_t off_t +#define ino64_t ino_t +#define getdents64 getdents +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/dlfcn.h b/Ubiquitous/XiZi/lib/musllib/include/dlfcn.h new file mode 100644 index 000000000..13ab71dd0 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/dlfcn.h @@ -0,0 +1,46 @@ +#ifndef _DLFCN_H +#define _DLFCN_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#define RTLD_LAZY 1 +#define RTLD_NOW 2 +#define RTLD_NOLOAD 4 +#define RTLD_NODELETE 4096 +#define RTLD_GLOBAL 256 +#define RTLD_LOCAL 0 + +#define RTLD_NEXT ((void *)-1) +#define RTLD_DEFAULT ((void *)0) + +#define RTLD_DI_LINKMAP 2 + +int dlclose(void *); +char *dlerror(void); +void *dlopen(const char *, int); +void *dlsym(void *__restrict, const char *__restrict); + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +typedef struct { + const char *dli_fname; + void *dli_fbase; + const char *dli_sname; + void *dli_saddr; +} Dl_info; +int dladdr(const void *, Dl_info *); +int dlinfo(void *, int, void *); +#endif + +#if _REDIR_TIME64 +__REDIR(dlsym, __dlsym_time64); +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/elf.h b/Ubiquitous/XiZi/lib/musllib/include/elf.h new file mode 100644 index 000000000..549f92c1a --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/elf.h @@ -0,0 +1,3292 @@ +#ifndef _ELF_H +#define _ELF_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +typedef uint16_t Elf32_Half; +typedef uint16_t Elf64_Half; + +typedef uint32_t Elf32_Word; +typedef int32_t Elf32_Sword; +typedef uint32_t Elf64_Word; +typedef int32_t Elf64_Sword; + +typedef uint64_t Elf32_Xword; +typedef int64_t Elf32_Sxword; +typedef uint64_t Elf64_Xword; +typedef int64_t Elf64_Sxword; + +typedef uint32_t Elf32_Addr; +typedef uint64_t Elf64_Addr; + +typedef uint32_t Elf32_Off; +typedef uint64_t Elf64_Off; + +typedef uint16_t Elf32_Section; +typedef uint16_t Elf64_Section; + +typedef Elf32_Half Elf32_Versym; +typedef Elf64_Half Elf64_Versym; + +#define EI_NIDENT (16) + +typedef struct { + unsigned char e_ident[EI_NIDENT]; + Elf32_Half e_type; + Elf32_Half e_machine; + Elf32_Word e_version; + Elf32_Addr e_entry; + Elf32_Off e_phoff; + Elf32_Off e_shoff; + Elf32_Word e_flags; + Elf32_Half e_ehsize; + Elf32_Half e_phentsize; + Elf32_Half e_phnum; + Elf32_Half e_shentsize; + Elf32_Half e_shnum; + Elf32_Half e_shstrndx; +} Elf32_Ehdr; + +typedef struct { + unsigned char e_ident[EI_NIDENT]; + Elf64_Half e_type; + Elf64_Half e_machine; + Elf64_Word e_version; + Elf64_Addr e_entry; + Elf64_Off e_phoff; + Elf64_Off e_shoff; + Elf64_Word e_flags; + Elf64_Half e_ehsize; + Elf64_Half e_phentsize; + Elf64_Half e_phnum; + Elf64_Half e_shentsize; + Elf64_Half e_shnum; + Elf64_Half e_shstrndx; +} Elf64_Ehdr; + +#define EI_MAG0 0 +#define ELFMAG0 0x7f + +#define EI_MAG1 1 +#define ELFMAG1 'E' + +#define EI_MAG2 2 +#define ELFMAG2 'L' + +#define EI_MAG3 3 +#define ELFMAG3 'F' + + +#define ELFMAG "\177ELF" +#define SELFMAG 4 + +#define EI_CLASS 4 +#define ELFCLASSNONE 0 +#define ELFCLASS32 1 +#define ELFCLASS64 2 +#define ELFCLASSNUM 3 + +#define EI_DATA 5 +#define ELFDATANONE 0 +#define ELFDATA2LSB 1 +#define ELFDATA2MSB 2 +#define ELFDATANUM 3 + +#define EI_VERSION 6 + + +#define EI_OSABI 7 +#define ELFOSABI_NONE 0 +#define ELFOSABI_SYSV 0 +#define ELFOSABI_HPUX 1 +#define ELFOSABI_NETBSD 2 +#define ELFOSABI_LINUX 3 +#define ELFOSABI_GNU 3 +#define ELFOSABI_SOLARIS 6 +#define ELFOSABI_AIX 7 +#define ELFOSABI_IRIX 8 +#define ELFOSABI_FREEBSD 9 +#define ELFOSABI_TRU64 10 +#define ELFOSABI_MODESTO 11 +#define ELFOSABI_OPENBSD 12 +#define ELFOSABI_ARM 97 +#define ELFOSABI_STANDALONE 255 + +#define EI_ABIVERSION 8 + +#define EI_PAD 9 + + + +#define ET_NONE 0 +#define ET_REL 1 +#define ET_EXEC 2 +#define ET_DYN 3 +#define ET_CORE 4 +#define ET_NUM 5 +#define ET_LOOS 0xfe00 +#define ET_HIOS 0xfeff +#define ET_LOPROC 0xff00 +#define ET_HIPROC 0xffff + + + +#define EM_NONE 0 +#define EM_M32 1 +#define EM_SPARC 2 +#define EM_386 3 +#define EM_68K 4 +#define EM_88K 5 +#define EM_860 7 +#define EM_MIPS 8 +#define EM_S370 9 +#define EM_MIPS_RS3_LE 10 + +#define EM_PARISC 15 +#define EM_VPP500 17 +#define EM_SPARC32PLUS 18 +#define EM_960 19 +#define EM_PPC 20 +#define EM_PPC64 21 +#define EM_S390 22 + +#define EM_V800 36 +#define EM_FR20 37 +#define EM_RH32 38 +#define EM_RCE 39 +#define EM_ARM 40 +#define EM_FAKE_ALPHA 41 +#define EM_SH 42 +#define EM_SPARCV9 43 +#define EM_TRICORE 44 +#define EM_ARC 45 +#define EM_H8_300 46 +#define EM_H8_300H 47 +#define EM_H8S 48 +#define EM_H8_500 49 +#define EM_IA_64 50 +#define EM_MIPS_X 51 +#define EM_COLDFIRE 52 +#define EM_68HC12 53 +#define EM_MMA 54 +#define EM_PCP 55 +#define EM_NCPU 56 +#define EM_NDR1 57 +#define EM_STARCORE 58 +#define EM_ME16 59 +#define EM_ST100 60 +#define EM_TINYJ 61 +#define EM_X86_64 62 +#define EM_PDSP 63 + +#define EM_FX66 66 +#define EM_ST9PLUS 67 +#define EM_ST7 68 +#define EM_68HC16 69 +#define EM_68HC11 70 +#define EM_68HC08 71 +#define EM_68HC05 72 +#define EM_SVX 73 +#define EM_ST19 74 +#define EM_VAX 75 +#define EM_CRIS 76 +#define EM_JAVELIN 77 +#define EM_FIREPATH 78 +#define EM_ZSP 79 +#define EM_MMIX 80 +#define EM_HUANY 81 +#define EM_PRISM 82 +#define EM_AVR 83 +#define EM_FR30 84 +#define EM_D10V 85 +#define EM_D30V 86 +#define EM_V850 87 +#define EM_M32R 88 +#define EM_MN10300 89 +#define EM_MN10200 90 +#define EM_PJ 91 +#define EM_OR1K 92 +#define EM_OPENRISC 92 +#define EM_ARC_A5 93 +#define EM_ARC_COMPACT 93 +#define EM_XTENSA 94 +#define EM_VIDEOCORE 95 +#define EM_TMM_GPP 96 +#define EM_NS32K 97 +#define EM_TPC 98 +#define EM_SNP1K 99 +#define EM_ST200 100 +#define EM_IP2K 101 +#define EM_MAX 102 +#define EM_CR 103 +#define EM_F2MC16 104 +#define EM_MSP430 105 +#define EM_BLACKFIN 106 +#define EM_SE_C33 107 +#define EM_SEP 108 +#define EM_ARCA 109 +#define EM_UNICORE 110 +#define EM_EXCESS 111 +#define EM_DXP 112 +#define EM_ALTERA_NIOS2 113 +#define EM_CRX 114 +#define EM_XGATE 115 +#define EM_C166 116 +#define EM_M16C 117 +#define EM_DSPIC30F 118 +#define EM_CE 119 +#define EM_M32C 120 +#define EM_TSK3000 131 +#define EM_RS08 132 +#define EM_SHARC 133 +#define EM_ECOG2 134 +#define EM_SCORE7 135 +#define EM_DSP24 136 +#define EM_VIDEOCORE3 137 +#define EM_LATTICEMICO32 138 +#define EM_SE_C17 139 +#define EM_TI_C6000 140 +#define EM_TI_C2000 141 +#define EM_TI_C5500 142 +#define EM_TI_ARP32 143 +#define EM_TI_PRU 144 +#define EM_MMDSP_PLUS 160 +#define EM_CYPRESS_M8C 161 +#define EM_R32C 162 +#define EM_TRIMEDIA 163 +#define EM_QDSP6 164 +#define EM_8051 165 +#define EM_STXP7X 166 +#define EM_NDS32 167 +#define EM_ECOG1X 168 +#define EM_MAXQ30 169 +#define EM_XIMO16 170 +#define EM_MANIK 171 +#define EM_CRAYNV2 172 +#define EM_RX 173 +#define EM_METAG 174 +#define EM_MCST_ELBRUS 175 +#define EM_ECOG16 176 +#define EM_CR16 177 +#define EM_ETPU 178 +#define EM_SLE9X 179 +#define EM_L10M 180 +#define EM_K10M 181 +#define EM_AARCH64 183 +#define EM_AVR32 185 +#define EM_STM8 186 +#define EM_TILE64 187 +#define EM_TILEPRO 188 +#define EM_MICROBLAZE 189 +#define EM_CUDA 190 +#define EM_TILEGX 191 +#define EM_CLOUDSHIELD 192 +#define EM_COREA_1ST 193 +#define EM_COREA_2ND 194 +#define EM_ARC_COMPACT2 195 +#define EM_OPEN8 196 +#define EM_RL78 197 +#define EM_VIDEOCORE5 198 +#define EM_78KOR 199 +#define EM_56800EX 200 +#define EM_BA1 201 +#define EM_BA2 202 +#define EM_XCORE 203 +#define EM_MCHP_PIC 204 +#define EM_KM32 210 +#define EM_KMX32 211 +#define EM_EMX16 212 +#define EM_EMX8 213 +#define EM_KVARC 214 +#define EM_CDP 215 +#define EM_COGE 216 +#define EM_COOL 217 +#define EM_NORC 218 +#define EM_CSR_KALIMBA 219 +#define EM_Z80 220 +#define EM_VISIUM 221 +#define EM_FT32 222 +#define EM_MOXIE 223 +#define EM_AMDGPU 224 +#define EM_RISCV 243 +#define EM_BPF 247 +#define EM_CSKY 252 +#define EM_NUM 253 + +#define EM_ALPHA 0x9026 + +#define EV_NONE 0 +#define EV_CURRENT 1 +#define EV_NUM 2 + +typedef struct { + Elf32_Word sh_name; + Elf32_Word sh_type; + Elf32_Word sh_flags; + Elf32_Addr sh_addr; + Elf32_Off sh_offset; + Elf32_Word sh_size; + Elf32_Word sh_link; + Elf32_Word sh_info; + Elf32_Word sh_addralign; + Elf32_Word sh_entsize; +} Elf32_Shdr; + +typedef struct { + Elf64_Word sh_name; + Elf64_Word sh_type; + Elf64_Xword sh_flags; + Elf64_Addr sh_addr; + Elf64_Off sh_offset; + Elf64_Xword sh_size; + Elf64_Word sh_link; + Elf64_Word sh_info; + Elf64_Xword sh_addralign; + Elf64_Xword sh_entsize; +} Elf64_Shdr; + + + +#define SHN_UNDEF 0 +#define SHN_LORESERVE 0xff00 +#define SHN_LOPROC 0xff00 +#define SHN_BEFORE 0xff00 + +#define SHN_AFTER 0xff01 + +#define SHN_HIPROC 0xff1f +#define SHN_LOOS 0xff20 +#define SHN_HIOS 0xff3f +#define SHN_ABS 0xfff1 +#define SHN_COMMON 0xfff2 +#define SHN_XINDEX 0xffff +#define SHN_HIRESERVE 0xffff + + + +#define SHT_NULL 0 +#define SHT_PROGBITS 1 +#define SHT_SYMTAB 2 +#define SHT_STRTAB 3 +#define SHT_RELA 4 +#define SHT_HASH 5 +#define SHT_DYNAMIC 6 +#define SHT_NOTE 7 +#define SHT_NOBITS 8 +#define SHT_REL 9 +#define SHT_SHLIB 10 +#define SHT_DYNSYM 11 +#define SHT_INIT_ARRAY 14 +#define SHT_FINI_ARRAY 15 +#define SHT_PREINIT_ARRAY 16 +#define SHT_GROUP 17 +#define SHT_SYMTAB_SHNDX 18 +#define SHT_NUM 19 +#define SHT_LOOS 0x60000000 +#define SHT_GNU_ATTRIBUTES 0x6ffffff5 +#define SHT_GNU_HASH 0x6ffffff6 +#define SHT_GNU_LIBLIST 0x6ffffff7 +#define SHT_CHECKSUM 0x6ffffff8 +#define SHT_LOSUNW 0x6ffffffa +#define SHT_SUNW_move 0x6ffffffa +#define SHT_SUNW_COMDAT 0x6ffffffb +#define SHT_SUNW_syminfo 0x6ffffffc +#define SHT_GNU_verdef 0x6ffffffd +#define SHT_GNU_verneed 0x6ffffffe +#define SHT_GNU_versym 0x6fffffff +#define SHT_HISUNW 0x6fffffff +#define SHT_HIOS 0x6fffffff +#define SHT_LOPROC 0x70000000 +#define SHT_HIPROC 0x7fffffff +#define SHT_LOUSER 0x80000000 +#define SHT_HIUSER 0x8fffffff + +#define SHF_WRITE (1 << 0) +#define SHF_ALLOC (1 << 1) +#define SHF_EXECINSTR (1 << 2) +#define SHF_MERGE (1 << 4) +#define SHF_STRINGS (1 << 5) +#define SHF_INFO_LINK (1 << 6) +#define SHF_LINK_ORDER (1 << 7) +#define SHF_OS_NONCONFORMING (1 << 8) + +#define SHF_GROUP (1 << 9) +#define SHF_TLS (1 << 10) +#define SHF_COMPRESSED (1 << 11) +#define SHF_MASKOS 0x0ff00000 +#define SHF_MASKPROC 0xf0000000 +#define SHF_ORDERED (1 << 30) +#define SHF_EXCLUDE (1U << 31) + +typedef struct { + Elf32_Word ch_type; + Elf32_Word ch_size; + Elf32_Word ch_addralign; +} Elf32_Chdr; + +typedef struct { + Elf64_Word ch_type; + Elf64_Word ch_reserved; + Elf64_Xword ch_size; + Elf64_Xword ch_addralign; +} Elf64_Chdr; + +#define ELFCOMPRESS_ZLIB 1 +#define ELFCOMPRESS_LOOS 0x60000000 +#define ELFCOMPRESS_HIOS 0x6fffffff +#define ELFCOMPRESS_LOPROC 0x70000000 +#define ELFCOMPRESS_HIPROC 0x7fffffff + + +#define GRP_COMDAT 0x1 + +typedef struct { + Elf32_Word st_name; + Elf32_Addr st_value; + Elf32_Word st_size; + unsigned char st_info; + unsigned char st_other; + Elf32_Section st_shndx; +} Elf32_Sym; + +typedef struct { + Elf64_Word st_name; + unsigned char st_info; + unsigned char st_other; + Elf64_Section st_shndx; + Elf64_Addr st_value; + Elf64_Xword st_size; +} Elf64_Sym; + +typedef struct { + Elf32_Half si_boundto; + Elf32_Half si_flags; +} Elf32_Syminfo; + +typedef struct { + Elf64_Half si_boundto; + Elf64_Half si_flags; +} Elf64_Syminfo; + +#define SYMINFO_BT_SELF 0xffff +#define SYMINFO_BT_PARENT 0xfffe +#define SYMINFO_BT_LOWRESERVE 0xff00 + +#define SYMINFO_FLG_DIRECT 0x0001 +#define SYMINFO_FLG_PASSTHRU 0x0002 +#define SYMINFO_FLG_COPY 0x0004 +#define SYMINFO_FLG_LAZYLOAD 0x0008 + +#define SYMINFO_NONE 0 +#define SYMINFO_CURRENT 1 +#define SYMINFO_NUM 2 + +#define ELF32_ST_BIND(val) (((unsigned char) (val)) >> 4) +#define ELF32_ST_TYPE(val) ((val) & 0xf) +#define ELF32_ST_INFO(bind, type) (((bind) << 4) + ((type) & 0xf)) + +#define ELF64_ST_BIND(val) ELF32_ST_BIND (val) +#define ELF64_ST_TYPE(val) ELF32_ST_TYPE (val) +#define ELF64_ST_INFO(bind, type) ELF32_ST_INFO ((bind), (type)) + +#define STB_LOCAL 0 +#define STB_GLOBAL 1 +#define STB_WEAK 2 +#define STB_NUM 3 +#define STB_LOOS 10 +#define STB_GNU_UNIQUE 10 +#define STB_HIOS 12 +#define STB_LOPROC 13 +#define STB_HIPROC 15 + +#define STT_NOTYPE 0 +#define STT_OBJECT 1 +#define STT_FUNC 2 +#define STT_SECTION 3 +#define STT_FILE 4 +#define STT_COMMON 5 +#define STT_TLS 6 +#define STT_NUM 7 +#define STT_LOOS 10 +#define STT_GNU_IFUNC 10 +#define STT_HIOS 12 +#define STT_LOPROC 13 +#define STT_HIPROC 15 + +#define STN_UNDEF 0 + +#define ELF32_ST_VISIBILITY(o) ((o) & 0x03) +#define ELF64_ST_VISIBILITY(o) ELF32_ST_VISIBILITY (o) + +#define STV_DEFAULT 0 +#define STV_INTERNAL 1 +#define STV_HIDDEN 2 +#define STV_PROTECTED 3 + + + + +typedef struct { + Elf32_Addr r_offset; + Elf32_Word r_info; +} Elf32_Rel; + +typedef struct { + Elf64_Addr r_offset; + Elf64_Xword r_info; +} Elf64_Rel; + + + +typedef struct { + Elf32_Addr r_offset; + Elf32_Word r_info; + Elf32_Sword r_addend; +} Elf32_Rela; + +typedef struct { + Elf64_Addr r_offset; + Elf64_Xword r_info; + Elf64_Sxword r_addend; +} Elf64_Rela; + + + +#define ELF32_R_SYM(val) ((val) >> 8) +#define ELF32_R_TYPE(val) ((val) & 0xff) +#define ELF32_R_INFO(sym, type) (((sym) << 8) + ((type) & 0xff)) + +#define ELF64_R_SYM(i) ((i) >> 32) +#define ELF64_R_TYPE(i) ((i) & 0xffffffff) +#define ELF64_R_INFO(sym,type) ((((Elf64_Xword) (sym)) << 32) + (type)) + + + +typedef struct { + Elf32_Word p_type; + Elf32_Off p_offset; + Elf32_Addr p_vaddr; + Elf32_Addr p_paddr; + Elf32_Word p_filesz; + Elf32_Word p_memsz; + Elf32_Word p_flags; + Elf32_Word p_align; +} Elf32_Phdr; + +typedef struct { + Elf64_Word p_type; + Elf64_Word p_flags; + Elf64_Off p_offset; + Elf64_Addr p_vaddr; + Elf64_Addr p_paddr; + Elf64_Xword p_filesz; + Elf64_Xword p_memsz; + Elf64_Xword p_align; +} Elf64_Phdr; + + + +#define PT_NULL 0 +#define PT_LOAD 1 +#define PT_DYNAMIC 2 +#define PT_INTERP 3 +#define PT_NOTE 4 +#define PT_SHLIB 5 +#define PT_PHDR 6 +#define PT_TLS 7 +#define PT_NUM 8 +#define PT_LOOS 0x60000000 +#define PT_GNU_EH_FRAME 0x6474e550 +#define PT_GNU_STACK 0x6474e551 +#define PT_GNU_RELRO 0x6474e552 +#define PT_LOSUNW 0x6ffffffa +#define PT_SUNWBSS 0x6ffffffa +#define PT_SUNWSTACK 0x6ffffffb +#define PT_HISUNW 0x6fffffff +#define PT_HIOS 0x6fffffff +#define PT_LOPROC 0x70000000 +#define PT_HIPROC 0x7fffffff + + +#define PN_XNUM 0xffff + + +#define PF_X (1 << 0) +#define PF_W (1 << 1) +#define PF_R (1 << 2) +#define PF_MASKOS 0x0ff00000 +#define PF_MASKPROC 0xf0000000 + + + +#define NT_PRSTATUS 1 +#define NT_PRFPREG 2 +#define NT_FPREGSET 2 +#define NT_PRPSINFO 3 +#define NT_PRXREG 4 +#define NT_TASKSTRUCT 4 +#define NT_PLATFORM 5 +#define NT_AUXV 6 +#define NT_GWINDOWS 7 +#define NT_ASRS 8 +#define NT_PSTATUS 10 +#define NT_PSINFO 13 +#define NT_PRCRED 14 +#define NT_UTSNAME 15 +#define NT_LWPSTATUS 16 +#define NT_LWPSINFO 17 +#define NT_PRFPXREG 20 +#define NT_SIGINFO 0x53494749 +#define NT_FILE 0x46494c45 +#define NT_PRXFPREG 0x46e62b7f +#define NT_PPC_VMX 0x100 +#define NT_PPC_SPE 0x101 +#define NT_PPC_VSX 0x102 +#define NT_PPC_TAR 0x103 +#define NT_PPC_PPR 0x104 +#define NT_PPC_DSCR 0x105 +#define NT_PPC_EBB 0x106 +#define NT_PPC_PMU 0x107 +#define NT_PPC_TM_CGPR 0x108 +#define NT_PPC_TM_CFPR 0x109 +#define NT_PPC_TM_CVMX 0x10a +#define NT_PPC_TM_CVSX 0x10b +#define NT_PPC_TM_SPR 0x10c +#define NT_PPC_TM_CTAR 0x10d +#define NT_PPC_TM_CPPR 0x10e +#define NT_PPC_TM_CDSCR 0x10f +#define NT_386_TLS 0x200 +#define NT_386_IOPERM 0x201 +#define NT_X86_XSTATE 0x202 +#define NT_S390_HIGH_GPRS 0x300 +#define NT_S390_TIMER 0x301 +#define NT_S390_TODCMP 0x302 +#define NT_S390_TODPREG 0x303 +#define NT_S390_CTRS 0x304 +#define NT_S390_PREFIX 0x305 +#define NT_S390_LAST_BREAK 0x306 +#define NT_S390_SYSTEM_CALL 0x307 +#define NT_S390_TDB 0x308 +#define NT_S390_VXRS_LOW 0x309 +#define NT_S390_VXRS_HIGH 0x30a +#define NT_S390_GS_CB 0x30b +#define NT_S390_GS_BC 0x30c +#define NT_S390_RI_CB 0x30d +#define NT_ARM_VFP 0x400 +#define NT_ARM_TLS 0x401 +#define NT_ARM_HW_BREAK 0x402 +#define NT_ARM_HW_WATCH 0x403 +#define NT_ARM_SYSTEM_CALL 0x404 +#define NT_ARM_SVE 0x405 +#define NT_ARM_PAC_MASK 0x406 +#define NT_ARM_PACA_KEYS 0x407 +#define NT_ARM_PACG_KEYS 0x408 +#define NT_METAG_CBUF 0x500 +#define NT_METAG_RPIPE 0x501 +#define NT_METAG_TLS 0x502 +#define NT_ARC_V2 0x600 +#define NT_VMCOREDD 0x700 +#define NT_MIPS_DSP 0x800 +#define NT_MIPS_FP_MODE 0x801 +#define NT_MIPS_MSA 0x802 +#define NT_VERSION 1 + + + + +typedef struct { + Elf32_Sword d_tag; + union { + Elf32_Word d_val; + Elf32_Addr d_ptr; + } d_un; +} Elf32_Dyn; + +typedef struct { + Elf64_Sxword d_tag; + union { + Elf64_Xword d_val; + Elf64_Addr d_ptr; + } d_un; +} Elf64_Dyn; + + + +#define DT_NULL 0 +#define DT_NEEDED 1 +#define DT_PLTRELSZ 2 +#define DT_PLTGOT 3 +#define DT_HASH 4 +#define DT_STRTAB 5 +#define DT_SYMTAB 6 +#define DT_RELA 7 +#define DT_RELASZ 8 +#define DT_RELAENT 9 +#define DT_STRSZ 10 +#define DT_SYMENT 11 +#define DT_INIT 12 +#define DT_FINI 13 +#define DT_SONAME 14 +#define DT_RPATH 15 +#define DT_SYMBOLIC 16 +#define DT_REL 17 +#define DT_RELSZ 18 +#define DT_RELENT 19 +#define DT_PLTREL 20 +#define DT_DEBUG 21 +#define DT_TEXTREL 22 +#define DT_JMPREL 23 +#define DT_BIND_NOW 24 +#define DT_INIT_ARRAY 25 +#define DT_FINI_ARRAY 26 +#define DT_INIT_ARRAYSZ 27 +#define DT_FINI_ARRAYSZ 28 +#define DT_RUNPATH 29 +#define DT_FLAGS 30 +#define DT_ENCODING 32 +#define DT_PREINIT_ARRAY 32 +#define DT_PREINIT_ARRAYSZ 33 +#define DT_SYMTAB_SHNDX 34 +#define DT_NUM 35 +#define DT_LOOS 0x6000000d +#define DT_HIOS 0x6ffff000 +#define DT_LOPROC 0x70000000 +#define DT_HIPROC 0x7fffffff +#define DT_PROCNUM DT_MIPS_NUM + +#define DT_VALRNGLO 0x6ffffd00 +#define DT_GNU_PRELINKED 0x6ffffdf5 +#define DT_GNU_CONFLICTSZ 0x6ffffdf6 +#define DT_GNU_LIBLISTSZ 0x6ffffdf7 +#define DT_CHECKSUM 0x6ffffdf8 +#define DT_PLTPADSZ 0x6ffffdf9 +#define DT_MOVEENT 0x6ffffdfa +#define DT_MOVESZ 0x6ffffdfb +#define DT_FEATURE_1 0x6ffffdfc +#define DT_POSFLAG_1 0x6ffffdfd + +#define DT_SYMINSZ 0x6ffffdfe +#define DT_SYMINENT 0x6ffffdff +#define DT_VALRNGHI 0x6ffffdff +#define DT_VALTAGIDX(tag) (DT_VALRNGHI - (tag)) +#define DT_VALNUM 12 + +#define DT_ADDRRNGLO 0x6ffffe00 +#define DT_GNU_HASH 0x6ffffef5 +#define DT_TLSDESC_PLT 0x6ffffef6 +#define DT_TLSDESC_GOT 0x6ffffef7 +#define DT_GNU_CONFLICT 0x6ffffef8 +#define DT_GNU_LIBLIST 0x6ffffef9 +#define DT_CONFIG 0x6ffffefa +#define DT_DEPAUDIT 0x6ffffefb +#define DT_AUDIT 0x6ffffefc +#define DT_PLTPAD 0x6ffffefd +#define DT_MOVETAB 0x6ffffefe +#define DT_SYMINFO 0x6ffffeff +#define DT_ADDRRNGHI 0x6ffffeff +#define DT_ADDRTAGIDX(tag) (DT_ADDRRNGHI - (tag)) +#define DT_ADDRNUM 11 + + + +#define DT_VERSYM 0x6ffffff0 + +#define DT_RELACOUNT 0x6ffffff9 +#define DT_RELCOUNT 0x6ffffffa + + +#define DT_FLAGS_1 0x6ffffffb +#define DT_VERDEF 0x6ffffffc + +#define DT_VERDEFNUM 0x6ffffffd +#define DT_VERNEED 0x6ffffffe + +#define DT_VERNEEDNUM 0x6fffffff +#define DT_VERSIONTAGIDX(tag) (DT_VERNEEDNUM - (tag)) +#define DT_VERSIONTAGNUM 16 + + + +#define DT_AUXILIARY 0x7ffffffd +#define DT_FILTER 0x7fffffff +#define DT_EXTRATAGIDX(tag) ((Elf32_Word)-((Elf32_Sword) (tag) <<1>>1)-1) +#define DT_EXTRANUM 3 + + +#define DF_ORIGIN 0x00000001 +#define DF_SYMBOLIC 0x00000002 +#define DF_TEXTREL 0x00000004 +#define DF_BIND_NOW 0x00000008 +#define DF_STATIC_TLS 0x00000010 + + + +#define DF_1_NOW 0x00000001 +#define DF_1_GLOBAL 0x00000002 +#define DF_1_GROUP 0x00000004 +#define DF_1_NODELETE 0x00000008 +#define DF_1_LOADFLTR 0x00000010 +#define DF_1_INITFIRST 0x00000020 +#define DF_1_NOOPEN 0x00000040 +#define DF_1_ORIGIN 0x00000080 +#define DF_1_DIRECT 0x00000100 +#define DF_1_TRANS 0x00000200 +#define DF_1_INTERPOSE 0x00000400 +#define DF_1_NODEFLIB 0x00000800 +#define DF_1_NODUMP 0x00001000 +#define DF_1_CONFALT 0x00002000 +#define DF_1_ENDFILTEE 0x00004000 +#define DF_1_DISPRELDNE 0x00008000 +#define DF_1_DISPRELPND 0x00010000 +#define DF_1_NODIRECT 0x00020000 +#define DF_1_IGNMULDEF 0x00040000 +#define DF_1_NOKSYMS 0x00080000 +#define DF_1_NOHDR 0x00100000 +#define DF_1_EDITED 0x00200000 +#define DF_1_NORELOC 0x00400000 +#define DF_1_SYMINTPOSE 0x00800000 +#define DF_1_GLOBAUDIT 0x01000000 +#define DF_1_SINGLETON 0x02000000 +#define DF_1_STUB 0x04000000 +#define DF_1_PIE 0x08000000 + +#define DTF_1_PARINIT 0x00000001 +#define DTF_1_CONFEXP 0x00000002 + + +#define DF_P1_LAZYLOAD 0x00000001 +#define DF_P1_GROUPPERM 0x00000002 + + + + +typedef struct { + Elf32_Half vd_version; + Elf32_Half vd_flags; + Elf32_Half vd_ndx; + Elf32_Half vd_cnt; + Elf32_Word vd_hash; + Elf32_Word vd_aux; + Elf32_Word vd_next; +} Elf32_Verdef; + +typedef struct { + Elf64_Half vd_version; + Elf64_Half vd_flags; + Elf64_Half vd_ndx; + Elf64_Half vd_cnt; + Elf64_Word vd_hash; + Elf64_Word vd_aux; + Elf64_Word vd_next; +} Elf64_Verdef; + + + +#define VER_DEF_NONE 0 +#define VER_DEF_CURRENT 1 +#define VER_DEF_NUM 2 + + +#define VER_FLG_BASE 0x1 +#define VER_FLG_WEAK 0x2 + + +#define VER_NDX_LOCAL 0 +#define VER_NDX_GLOBAL 1 +#define VER_NDX_LORESERVE 0xff00 +#define VER_NDX_ELIMINATE 0xff01 + + + +typedef struct { + Elf32_Word vda_name; + Elf32_Word vda_next; +} Elf32_Verdaux; + +typedef struct { + Elf64_Word vda_name; + Elf64_Word vda_next; +} Elf64_Verdaux; + + + + +typedef struct { + Elf32_Half vn_version; + Elf32_Half vn_cnt; + Elf32_Word vn_file; + Elf32_Word vn_aux; + Elf32_Word vn_next; +} Elf32_Verneed; + +typedef struct { + Elf64_Half vn_version; + Elf64_Half vn_cnt; + Elf64_Word vn_file; + Elf64_Word vn_aux; + Elf64_Word vn_next; +} Elf64_Verneed; + + + +#define VER_NEED_NONE 0 +#define VER_NEED_CURRENT 1 +#define VER_NEED_NUM 2 + + + +typedef struct { + Elf32_Word vna_hash; + Elf32_Half vna_flags; + Elf32_Half vna_other; + Elf32_Word vna_name; + Elf32_Word vna_next; +} Elf32_Vernaux; + +typedef struct { + Elf64_Word vna_hash; + Elf64_Half vna_flags; + Elf64_Half vna_other; + Elf64_Word vna_name; + Elf64_Word vna_next; +} Elf64_Vernaux; + + + +#define VER_FLG_WEAK 0x2 + + + +typedef struct { + uint32_t a_type; + union { + uint32_t a_val; + } a_un; +} Elf32_auxv_t; + +typedef struct { + uint64_t a_type; + union { + uint64_t a_val; + } a_un; +} Elf64_auxv_t; + + + +#define AT_NULL 0 +#define AT_IGNORE 1 +#define AT_EXECFD 2 +#define AT_PHDR 3 +#define AT_PHENT 4 +#define AT_PHNUM 5 +#define AT_PAGESZ 6 +#define AT_BASE 7 +#define AT_FLAGS 8 +#define AT_ENTRY 9 +#define AT_NOTELF 10 +#define AT_UID 11 +#define AT_EUID 12 +#define AT_GID 13 +#define AT_EGID 14 +#define AT_CLKTCK 17 + + +#define AT_PLATFORM 15 +#define AT_HWCAP 16 + + + + +#define AT_FPUCW 18 + + +#define AT_DCACHEBSIZE 19 +#define AT_ICACHEBSIZE 20 +#define AT_UCACHEBSIZE 21 + + + +#define AT_IGNOREPPC 22 + +#define AT_SECURE 23 + +#define AT_BASE_PLATFORM 24 + +#define AT_RANDOM 25 + +#define AT_HWCAP2 26 + +#define AT_EXECFN 31 + + + +#define AT_SYSINFO 32 +#define AT_SYSINFO_EHDR 33 + + + +#define AT_L1I_CACHESHAPE 34 +#define AT_L1D_CACHESHAPE 35 +#define AT_L2_CACHESHAPE 36 +#define AT_L3_CACHESHAPE 37 + +#define AT_L1I_CACHESIZE 40 +#define AT_L1I_CACHEGEOMETRY 41 +#define AT_L1D_CACHESIZE 42 +#define AT_L1D_CACHEGEOMETRY 43 +#define AT_L2_CACHESIZE 44 +#define AT_L2_CACHEGEOMETRY 45 +#define AT_L3_CACHESIZE 46 +#define AT_L3_CACHEGEOMETRY 47 + +#define AT_MINSIGSTKSZ 51 + + +typedef struct { + Elf32_Word n_namesz; + Elf32_Word n_descsz; + Elf32_Word n_type; +} Elf32_Nhdr; + +typedef struct { + Elf64_Word n_namesz; + Elf64_Word n_descsz; + Elf64_Word n_type; +} Elf64_Nhdr; + + + + +#define ELF_NOTE_SOLARIS "SUNW Solaris" + + +#define ELF_NOTE_GNU "GNU" + + + + + +#define ELF_NOTE_PAGESIZE_HINT 1 + + +#define NT_GNU_ABI_TAG 1 +#define ELF_NOTE_ABI NT_GNU_ABI_TAG + + + +#define ELF_NOTE_OS_LINUX 0 +#define ELF_NOTE_OS_GNU 1 +#define ELF_NOTE_OS_SOLARIS2 2 +#define ELF_NOTE_OS_FREEBSD 3 + +#define NT_GNU_BUILD_ID 3 +#define NT_GNU_GOLD_VERSION 4 + + + +typedef struct { + Elf32_Xword m_value; + Elf32_Word m_info; + Elf32_Word m_poffset; + Elf32_Half m_repeat; + Elf32_Half m_stride; +} Elf32_Move; + +typedef struct { + Elf64_Xword m_value; + Elf64_Xword m_info; + Elf64_Xword m_poffset; + Elf64_Half m_repeat; + Elf64_Half m_stride; +} Elf64_Move; + + +#define ELF32_M_SYM(info) ((info) >> 8) +#define ELF32_M_SIZE(info) ((unsigned char) (info)) +#define ELF32_M_INFO(sym, size) (((sym) << 8) + (unsigned char) (size)) + +#define ELF64_M_SYM(info) ELF32_M_SYM (info) +#define ELF64_M_SIZE(info) ELF32_M_SIZE (info) +#define ELF64_M_INFO(sym, size) ELF32_M_INFO (sym, size) + +#define EF_CPU32 0x00810000 + +#define R_68K_NONE 0 +#define R_68K_32 1 +#define R_68K_16 2 +#define R_68K_8 3 +#define R_68K_PC32 4 +#define R_68K_PC16 5 +#define R_68K_PC8 6 +#define R_68K_GOT32 7 +#define R_68K_GOT16 8 +#define R_68K_GOT8 9 +#define R_68K_GOT32O 10 +#define R_68K_GOT16O 11 +#define R_68K_GOT8O 12 +#define R_68K_PLT32 13 +#define R_68K_PLT16 14 +#define R_68K_PLT8 15 +#define R_68K_PLT32O 16 +#define R_68K_PLT16O 17 +#define R_68K_PLT8O 18 +#define R_68K_COPY 19 +#define R_68K_GLOB_DAT 20 +#define R_68K_JMP_SLOT 21 +#define R_68K_RELATIVE 22 +#define R_68K_TLS_GD32 25 +#define R_68K_TLS_GD16 26 +#define R_68K_TLS_GD8 27 +#define R_68K_TLS_LDM32 28 +#define R_68K_TLS_LDM16 29 +#define R_68K_TLS_LDM8 30 +#define R_68K_TLS_LDO32 31 +#define R_68K_TLS_LDO16 32 +#define R_68K_TLS_LDO8 33 +#define R_68K_TLS_IE32 34 +#define R_68K_TLS_IE16 35 +#define R_68K_TLS_IE8 36 +#define R_68K_TLS_LE32 37 +#define R_68K_TLS_LE16 38 +#define R_68K_TLS_LE8 39 +#define R_68K_TLS_DTPMOD32 40 +#define R_68K_TLS_DTPREL32 41 +#define R_68K_TLS_TPREL32 42 +#define R_68K_NUM 43 + +#define R_386_NONE 0 +#define R_386_32 1 +#define R_386_PC32 2 +#define R_386_GOT32 3 +#define R_386_PLT32 4 +#define R_386_COPY 5 +#define R_386_GLOB_DAT 6 +#define R_386_JMP_SLOT 7 +#define R_386_RELATIVE 8 +#define R_386_GOTOFF 9 +#define R_386_GOTPC 10 +#define R_386_32PLT 11 +#define R_386_TLS_TPOFF 14 +#define R_386_TLS_IE 15 +#define R_386_TLS_GOTIE 16 +#define R_386_TLS_LE 17 +#define R_386_TLS_GD 18 +#define R_386_TLS_LDM 19 +#define R_386_16 20 +#define R_386_PC16 21 +#define R_386_8 22 +#define R_386_PC8 23 +#define R_386_TLS_GD_32 24 +#define R_386_TLS_GD_PUSH 25 +#define R_386_TLS_GD_CALL 26 +#define R_386_TLS_GD_POP 27 +#define R_386_TLS_LDM_32 28 +#define R_386_TLS_LDM_PUSH 29 +#define R_386_TLS_LDM_CALL 30 +#define R_386_TLS_LDM_POP 31 +#define R_386_TLS_LDO_32 32 +#define R_386_TLS_IE_32 33 +#define R_386_TLS_LE_32 34 +#define R_386_TLS_DTPMOD32 35 +#define R_386_TLS_DTPOFF32 36 +#define R_386_TLS_TPOFF32 37 +#define R_386_SIZE32 38 +#define R_386_TLS_GOTDESC 39 +#define R_386_TLS_DESC_CALL 40 +#define R_386_TLS_DESC 41 +#define R_386_IRELATIVE 42 +#define R_386_GOT32X 43 +#define R_386_NUM 44 + + + + + +#define STT_SPARC_REGISTER 13 + + + +#define EF_SPARCV9_MM 3 +#define EF_SPARCV9_TSO 0 +#define EF_SPARCV9_PSO 1 +#define EF_SPARCV9_RMO 2 +#define EF_SPARC_LEDATA 0x800000 +#define EF_SPARC_EXT_MASK 0xFFFF00 +#define EF_SPARC_32PLUS 0x000100 +#define EF_SPARC_SUN_US1 0x000200 +#define EF_SPARC_HAL_R1 0x000400 +#define EF_SPARC_SUN_US3 0x000800 + + + +#define R_SPARC_NONE 0 +#define R_SPARC_8 1 +#define R_SPARC_16 2 +#define R_SPARC_32 3 +#define R_SPARC_DISP8 4 +#define R_SPARC_DISP16 5 +#define R_SPARC_DISP32 6 +#define R_SPARC_WDISP30 7 +#define R_SPARC_WDISP22 8 +#define R_SPARC_HI22 9 +#define R_SPARC_22 10 +#define R_SPARC_13 11 +#define R_SPARC_LO10 12 +#define R_SPARC_GOT10 13 +#define R_SPARC_GOT13 14 +#define R_SPARC_GOT22 15 +#define R_SPARC_PC10 16 +#define R_SPARC_PC22 17 +#define R_SPARC_WPLT30 18 +#define R_SPARC_COPY 19 +#define R_SPARC_GLOB_DAT 20 +#define R_SPARC_JMP_SLOT 21 +#define R_SPARC_RELATIVE 22 +#define R_SPARC_UA32 23 + + + +#define R_SPARC_PLT32 24 +#define R_SPARC_HIPLT22 25 +#define R_SPARC_LOPLT10 26 +#define R_SPARC_PCPLT32 27 +#define R_SPARC_PCPLT22 28 +#define R_SPARC_PCPLT10 29 +#define R_SPARC_10 30 +#define R_SPARC_11 31 +#define R_SPARC_64 32 +#define R_SPARC_OLO10 33 +#define R_SPARC_HH22 34 +#define R_SPARC_HM10 35 +#define R_SPARC_LM22 36 +#define R_SPARC_PC_HH22 37 +#define R_SPARC_PC_HM10 38 +#define R_SPARC_PC_LM22 39 +#define R_SPARC_WDISP16 40 +#define R_SPARC_WDISP19 41 +#define R_SPARC_GLOB_JMP 42 +#define R_SPARC_7 43 +#define R_SPARC_5 44 +#define R_SPARC_6 45 +#define R_SPARC_DISP64 46 +#define R_SPARC_PLT64 47 +#define R_SPARC_HIX22 48 +#define R_SPARC_LOX10 49 +#define R_SPARC_H44 50 +#define R_SPARC_M44 51 +#define R_SPARC_L44 52 +#define R_SPARC_REGISTER 53 +#define R_SPARC_UA64 54 +#define R_SPARC_UA16 55 +#define R_SPARC_TLS_GD_HI22 56 +#define R_SPARC_TLS_GD_LO10 57 +#define R_SPARC_TLS_GD_ADD 58 +#define R_SPARC_TLS_GD_CALL 59 +#define R_SPARC_TLS_LDM_HI22 60 +#define R_SPARC_TLS_LDM_LO10 61 +#define R_SPARC_TLS_LDM_ADD 62 +#define R_SPARC_TLS_LDM_CALL 63 +#define R_SPARC_TLS_LDO_HIX22 64 +#define R_SPARC_TLS_LDO_LOX10 65 +#define R_SPARC_TLS_LDO_ADD 66 +#define R_SPARC_TLS_IE_HI22 67 +#define R_SPARC_TLS_IE_LO10 68 +#define R_SPARC_TLS_IE_LD 69 +#define R_SPARC_TLS_IE_LDX 70 +#define R_SPARC_TLS_IE_ADD 71 +#define R_SPARC_TLS_LE_HIX22 72 +#define R_SPARC_TLS_LE_LOX10 73 +#define R_SPARC_TLS_DTPMOD32 74 +#define R_SPARC_TLS_DTPMOD64 75 +#define R_SPARC_TLS_DTPOFF32 76 +#define R_SPARC_TLS_DTPOFF64 77 +#define R_SPARC_TLS_TPOFF32 78 +#define R_SPARC_TLS_TPOFF64 79 +#define R_SPARC_GOTDATA_HIX22 80 +#define R_SPARC_GOTDATA_LOX10 81 +#define R_SPARC_GOTDATA_OP_HIX22 82 +#define R_SPARC_GOTDATA_OP_LOX10 83 +#define R_SPARC_GOTDATA_OP 84 +#define R_SPARC_H34 85 +#define R_SPARC_SIZE32 86 +#define R_SPARC_SIZE64 87 +#define R_SPARC_GNU_VTINHERIT 250 +#define R_SPARC_GNU_VTENTRY 251 +#define R_SPARC_REV32 252 + +#define R_SPARC_NUM 253 + + + +#define DT_SPARC_REGISTER 0x70000001 +#define DT_SPARC_NUM 2 + + +#define EF_MIPS_NOREORDER 1 +#define EF_MIPS_PIC 2 +#define EF_MIPS_CPIC 4 +#define EF_MIPS_XGOT 8 +#define EF_MIPS_64BIT_WHIRL 16 +#define EF_MIPS_ABI2 32 +#define EF_MIPS_ABI_ON32 64 +#define EF_MIPS_FP64 512 +#define EF_MIPS_NAN2008 1024 +#define EF_MIPS_ARCH 0xf0000000 + + + +#define EF_MIPS_ARCH_1 0x00000000 +#define EF_MIPS_ARCH_2 0x10000000 +#define EF_MIPS_ARCH_3 0x20000000 +#define EF_MIPS_ARCH_4 0x30000000 +#define EF_MIPS_ARCH_5 0x40000000 +#define EF_MIPS_ARCH_32 0x50000000 +#define EF_MIPS_ARCH_64 0x60000000 +#define EF_MIPS_ARCH_32R2 0x70000000 +#define EF_MIPS_ARCH_64R2 0x80000000 + + +#define E_MIPS_ARCH_1 0x00000000 +#define E_MIPS_ARCH_2 0x10000000 +#define E_MIPS_ARCH_3 0x20000000 +#define E_MIPS_ARCH_4 0x30000000 +#define E_MIPS_ARCH_5 0x40000000 +#define E_MIPS_ARCH_32 0x50000000 +#define E_MIPS_ARCH_64 0x60000000 + + + +#define SHN_MIPS_ACOMMON 0xff00 +#define SHN_MIPS_TEXT 0xff01 +#define SHN_MIPS_DATA 0xff02 +#define SHN_MIPS_SCOMMON 0xff03 +#define SHN_MIPS_SUNDEFINED 0xff04 + + + +#define SHT_MIPS_LIBLIST 0x70000000 +#define SHT_MIPS_MSYM 0x70000001 +#define SHT_MIPS_CONFLICT 0x70000002 +#define SHT_MIPS_GPTAB 0x70000003 +#define SHT_MIPS_UCODE 0x70000004 +#define SHT_MIPS_DEBUG 0x70000005 +#define SHT_MIPS_REGINFO 0x70000006 +#define SHT_MIPS_PACKAGE 0x70000007 +#define SHT_MIPS_PACKSYM 0x70000008 +#define SHT_MIPS_RELD 0x70000009 +#define SHT_MIPS_IFACE 0x7000000b +#define SHT_MIPS_CONTENT 0x7000000c +#define SHT_MIPS_OPTIONS 0x7000000d +#define SHT_MIPS_SHDR 0x70000010 +#define SHT_MIPS_FDESC 0x70000011 +#define SHT_MIPS_EXTSYM 0x70000012 +#define SHT_MIPS_DENSE 0x70000013 +#define SHT_MIPS_PDESC 0x70000014 +#define SHT_MIPS_LOCSYM 0x70000015 +#define SHT_MIPS_AUXSYM 0x70000016 +#define SHT_MIPS_OPTSYM 0x70000017 +#define SHT_MIPS_LOCSTR 0x70000018 +#define SHT_MIPS_LINE 0x70000019 +#define SHT_MIPS_RFDESC 0x7000001a +#define SHT_MIPS_DELTASYM 0x7000001b +#define SHT_MIPS_DELTAINST 0x7000001c +#define SHT_MIPS_DELTACLASS 0x7000001d +#define SHT_MIPS_DWARF 0x7000001e +#define SHT_MIPS_DELTADECL 0x7000001f +#define SHT_MIPS_SYMBOL_LIB 0x70000020 +#define SHT_MIPS_EVENTS 0x70000021 +#define SHT_MIPS_TRANSLATE 0x70000022 +#define SHT_MIPS_PIXIE 0x70000023 +#define SHT_MIPS_XLATE 0x70000024 +#define SHT_MIPS_XLATE_DEBUG 0x70000025 +#define SHT_MIPS_WHIRL 0x70000026 +#define SHT_MIPS_EH_REGION 0x70000027 +#define SHT_MIPS_XLATE_OLD 0x70000028 +#define SHT_MIPS_PDR_EXCEPTION 0x70000029 + + + +#define SHF_MIPS_GPREL 0x10000000 +#define SHF_MIPS_MERGE 0x20000000 +#define SHF_MIPS_ADDR 0x40000000 +#define SHF_MIPS_STRINGS 0x80000000 +#define SHF_MIPS_NOSTRIP 0x08000000 +#define SHF_MIPS_LOCAL 0x04000000 +#define SHF_MIPS_NAMES 0x02000000 +#define SHF_MIPS_NODUPE 0x01000000 + + + + + +#define STO_MIPS_DEFAULT 0x0 +#define STO_MIPS_INTERNAL 0x1 +#define STO_MIPS_HIDDEN 0x2 +#define STO_MIPS_PROTECTED 0x3 +#define STO_MIPS_PLT 0x8 +#define STO_MIPS_SC_ALIGN_UNUSED 0xff + + +#define STB_MIPS_SPLIT_COMMON 13 + + + +typedef union { + struct { + Elf32_Word gt_current_g_value; + Elf32_Word gt_unused; + } gt_header; + struct { + Elf32_Word gt_g_value; + Elf32_Word gt_bytes; + } gt_entry; +} Elf32_gptab; + + + +typedef struct { + Elf32_Word ri_gprmask; + Elf32_Word ri_cprmask[4]; + Elf32_Sword ri_gp_value; +} Elf32_RegInfo; + + + +typedef struct { + unsigned char kind; + + unsigned char size; + Elf32_Section section; + + Elf32_Word info; +} Elf_Options; + + + +#define ODK_NULL 0 +#define ODK_REGINFO 1 +#define ODK_EXCEPTIONS 2 +#define ODK_PAD 3 +#define ODK_HWPATCH 4 +#define ODK_FILL 5 +#define ODK_TAGS 6 +#define ODK_HWAND 7 +#define ODK_HWOR 8 + + + +#define OEX_FPU_MIN 0x1f +#define OEX_FPU_MAX 0x1f00 +#define OEX_PAGE0 0x10000 +#define OEX_SMM 0x20000 +#define OEX_FPDBUG 0x40000 +#define OEX_PRECISEFP OEX_FPDBUG +#define OEX_DISMISS 0x80000 + +#define OEX_FPU_INVAL 0x10 +#define OEX_FPU_DIV0 0x08 +#define OEX_FPU_OFLO 0x04 +#define OEX_FPU_UFLO 0x02 +#define OEX_FPU_INEX 0x01 + + + +#define OHW_R4KEOP 0x1 +#define OHW_R8KPFETCH 0x2 +#define OHW_R5KEOP 0x4 +#define OHW_R5KCVTL 0x8 + +#define OPAD_PREFIX 0x1 +#define OPAD_POSTFIX 0x2 +#define OPAD_SYMBOL 0x4 + + + +typedef struct { + Elf32_Word hwp_flags1; + Elf32_Word hwp_flags2; +} Elf_Options_Hw; + + + +#define OHWA0_R4KEOP_CHECKED 0x00000001 +#define OHWA1_R4KEOP_CLEAN 0x00000002 + + + +#define R_MIPS_NONE 0 +#define R_MIPS_16 1 +#define R_MIPS_32 2 +#define R_MIPS_REL32 3 +#define R_MIPS_26 4 +#define R_MIPS_HI16 5 +#define R_MIPS_LO16 6 +#define R_MIPS_GPREL16 7 +#define R_MIPS_LITERAL 8 +#define R_MIPS_GOT16 9 +#define R_MIPS_PC16 10 +#define R_MIPS_CALL16 11 +#define R_MIPS_GPREL32 12 + +#define R_MIPS_SHIFT5 16 +#define R_MIPS_SHIFT6 17 +#define R_MIPS_64 18 +#define R_MIPS_GOT_DISP 19 +#define R_MIPS_GOT_PAGE 20 +#define R_MIPS_GOT_OFST 21 +#define R_MIPS_GOT_HI16 22 +#define R_MIPS_GOT_LO16 23 +#define R_MIPS_SUB 24 +#define R_MIPS_INSERT_A 25 +#define R_MIPS_INSERT_B 26 +#define R_MIPS_DELETE 27 +#define R_MIPS_HIGHER 28 +#define R_MIPS_HIGHEST 29 +#define R_MIPS_CALL_HI16 30 +#define R_MIPS_CALL_LO16 31 +#define R_MIPS_SCN_DISP 32 +#define R_MIPS_REL16 33 +#define R_MIPS_ADD_IMMEDIATE 34 +#define R_MIPS_PJUMP 35 +#define R_MIPS_RELGOT 36 +#define R_MIPS_JALR 37 +#define R_MIPS_TLS_DTPMOD32 38 +#define R_MIPS_TLS_DTPREL32 39 +#define R_MIPS_TLS_DTPMOD64 40 +#define R_MIPS_TLS_DTPREL64 41 +#define R_MIPS_TLS_GD 42 +#define R_MIPS_TLS_LDM 43 +#define R_MIPS_TLS_DTPREL_HI16 44 +#define R_MIPS_TLS_DTPREL_LO16 45 +#define R_MIPS_TLS_GOTTPREL 46 +#define R_MIPS_TLS_TPREL32 47 +#define R_MIPS_TLS_TPREL64 48 +#define R_MIPS_TLS_TPREL_HI16 49 +#define R_MIPS_TLS_TPREL_LO16 50 +#define R_MIPS_GLOB_DAT 51 +#define R_MIPS_COPY 126 +#define R_MIPS_JUMP_SLOT 127 + +#define R_MIPS_NUM 128 + + + +#define PT_MIPS_REGINFO 0x70000000 +#define PT_MIPS_RTPROC 0x70000001 +#define PT_MIPS_OPTIONS 0x70000002 +#define PT_MIPS_ABIFLAGS 0x70000003 + + + +#define PF_MIPS_LOCAL 0x10000000 + + + +#define DT_MIPS_RLD_VERSION 0x70000001 +#define DT_MIPS_TIME_STAMP 0x70000002 +#define DT_MIPS_ICHECKSUM 0x70000003 +#define DT_MIPS_IVERSION 0x70000004 +#define DT_MIPS_FLAGS 0x70000005 +#define DT_MIPS_BASE_ADDRESS 0x70000006 +#define DT_MIPS_MSYM 0x70000007 +#define DT_MIPS_CONFLICT 0x70000008 +#define DT_MIPS_LIBLIST 0x70000009 +#define DT_MIPS_LOCAL_GOTNO 0x7000000a +#define DT_MIPS_CONFLICTNO 0x7000000b +#define DT_MIPS_LIBLISTNO 0x70000010 +#define DT_MIPS_SYMTABNO 0x70000011 +#define DT_MIPS_UNREFEXTNO 0x70000012 +#define DT_MIPS_GOTSYM 0x70000013 +#define DT_MIPS_HIPAGENO 0x70000014 +#define DT_MIPS_RLD_MAP 0x70000016 +#define DT_MIPS_DELTA_CLASS 0x70000017 +#define DT_MIPS_DELTA_CLASS_NO 0x70000018 + +#define DT_MIPS_DELTA_INSTANCE 0x70000019 +#define DT_MIPS_DELTA_INSTANCE_NO 0x7000001a + +#define DT_MIPS_DELTA_RELOC 0x7000001b +#define DT_MIPS_DELTA_RELOC_NO 0x7000001c + +#define DT_MIPS_DELTA_SYM 0x7000001d + +#define DT_MIPS_DELTA_SYM_NO 0x7000001e + +#define DT_MIPS_DELTA_CLASSSYM 0x70000020 + +#define DT_MIPS_DELTA_CLASSSYM_NO 0x70000021 + +#define DT_MIPS_CXX_FLAGS 0x70000022 +#define DT_MIPS_PIXIE_INIT 0x70000023 +#define DT_MIPS_SYMBOL_LIB 0x70000024 +#define DT_MIPS_LOCALPAGE_GOTIDX 0x70000025 +#define DT_MIPS_LOCAL_GOTIDX 0x70000026 +#define DT_MIPS_HIDDEN_GOTIDX 0x70000027 +#define DT_MIPS_PROTECTED_GOTIDX 0x70000028 +#define DT_MIPS_OPTIONS 0x70000029 +#define DT_MIPS_INTERFACE 0x7000002a +#define DT_MIPS_DYNSTR_ALIGN 0x7000002b +#define DT_MIPS_INTERFACE_SIZE 0x7000002c +#define DT_MIPS_RLD_TEXT_RESOLVE_ADDR 0x7000002d + +#define DT_MIPS_PERF_SUFFIX 0x7000002e + +#define DT_MIPS_COMPACT_SIZE 0x7000002f +#define DT_MIPS_GP_VALUE 0x70000030 +#define DT_MIPS_AUX_DYNAMIC 0x70000031 + +#define DT_MIPS_PLTGOT 0x70000032 + +#define DT_MIPS_RWPLT 0x70000034 +#define DT_MIPS_RLD_MAP_REL 0x70000035 +#define DT_MIPS_NUM 0x36 + + + +#define RHF_NONE 0 +#define RHF_QUICKSTART (1 << 0) +#define RHF_NOTPOT (1 << 1) +#define RHF_NO_LIBRARY_REPLACEMENT (1 << 2) +#define RHF_NO_MOVE (1 << 3) +#define RHF_SGI_ONLY (1 << 4) +#define RHF_GUARANTEE_INIT (1 << 5) +#define RHF_DELTA_C_PLUS_PLUS (1 << 6) +#define RHF_GUARANTEE_START_INIT (1 << 7) +#define RHF_PIXIE (1 << 8) +#define RHF_DEFAULT_DELAY_LOAD (1 << 9) +#define RHF_REQUICKSTART (1 << 10) +#define RHF_REQUICKSTARTED (1 << 11) +#define RHF_CORD (1 << 12) +#define RHF_NO_UNRES_UNDEF (1 << 13) +#define RHF_RLD_ORDER_SAFE (1 << 14) + + + +typedef struct { + Elf32_Word l_name; + Elf32_Word l_time_stamp; + Elf32_Word l_checksum; + Elf32_Word l_version; + Elf32_Word l_flags; +} Elf32_Lib; + +typedef struct { + Elf64_Word l_name; + Elf64_Word l_time_stamp; + Elf64_Word l_checksum; + Elf64_Word l_version; + Elf64_Word l_flags; +} Elf64_Lib; + + + + +#define LL_NONE 0 +#define LL_EXACT_MATCH (1 << 0) +#define LL_IGNORE_INT_VER (1 << 1) +#define LL_REQUIRE_MINOR (1 << 2) +#define LL_EXPORTS (1 << 3) +#define LL_DELAY_LOAD (1 << 4) +#define LL_DELTA (1 << 5) + + + +typedef Elf32_Addr Elf32_Conflict; + +typedef struct { + Elf32_Half version; + unsigned char isa_level; + unsigned char isa_rev; + unsigned char gpr_size; + unsigned char cpr1_size; + unsigned char cpr2_size; + unsigned char fp_abi; + Elf32_Word isa_ext; + Elf32_Word ases; + Elf32_Word flags1; + Elf32_Word flags2; +} Elf_MIPS_ABIFlags_v0; + +#define MIPS_AFL_REG_NONE 0x00 +#define MIPS_AFL_REG_32 0x01 +#define MIPS_AFL_REG_64 0x02 +#define MIPS_AFL_REG_128 0x03 + +#define MIPS_AFL_ASE_DSP 0x00000001 +#define MIPS_AFL_ASE_DSPR2 0x00000002 +#define MIPS_AFL_ASE_EVA 0x00000004 +#define MIPS_AFL_ASE_MCU 0x00000008 +#define MIPS_AFL_ASE_MDMX 0x00000010 +#define MIPS_AFL_ASE_MIPS3D 0x00000020 +#define MIPS_AFL_ASE_MT 0x00000040 +#define MIPS_AFL_ASE_SMARTMIPS 0x00000080 +#define MIPS_AFL_ASE_VIRT 0x00000100 +#define MIPS_AFL_ASE_MSA 0x00000200 +#define MIPS_AFL_ASE_MIPS16 0x00000400 +#define MIPS_AFL_ASE_MICROMIPS 0x00000800 +#define MIPS_AFL_ASE_XPA 0x00001000 +#define MIPS_AFL_ASE_MASK 0x00001fff + +#define MIPS_AFL_EXT_XLR 1 +#define MIPS_AFL_EXT_OCTEON2 2 +#define MIPS_AFL_EXT_OCTEONP 3 +#define MIPS_AFL_EXT_LOONGSON_3A 4 +#define MIPS_AFL_EXT_OCTEON 5 +#define MIPS_AFL_EXT_5900 6 +#define MIPS_AFL_EXT_4650 7 +#define MIPS_AFL_EXT_4010 8 +#define MIPS_AFL_EXT_4100 9 +#define MIPS_AFL_EXT_3900 10 +#define MIPS_AFL_EXT_10000 11 +#define MIPS_AFL_EXT_SB1 12 +#define MIPS_AFL_EXT_4111 13 +#define MIPS_AFL_EXT_4120 14 +#define MIPS_AFL_EXT_5400 15 +#define MIPS_AFL_EXT_5500 16 +#define MIPS_AFL_EXT_LOONGSON_2E 17 +#define MIPS_AFL_EXT_LOONGSON_2F 18 + +#define MIPS_AFL_FLAGS1_ODDSPREG 1 + +enum +{ + Val_GNU_MIPS_ABI_FP_ANY = 0, + Val_GNU_MIPS_ABI_FP_DOUBLE = 1, + Val_GNU_MIPS_ABI_FP_SINGLE = 2, + Val_GNU_MIPS_ABI_FP_SOFT = 3, + Val_GNU_MIPS_ABI_FP_OLD_64 = 4, + Val_GNU_MIPS_ABI_FP_XX = 5, + Val_GNU_MIPS_ABI_FP_64 = 6, + Val_GNU_MIPS_ABI_FP_64A = 7, + Val_GNU_MIPS_ABI_FP_MAX = 7 +}; + + + + +#define EF_PARISC_TRAPNIL 0x00010000 +#define EF_PARISC_EXT 0x00020000 +#define EF_PARISC_LSB 0x00040000 +#define EF_PARISC_WIDE 0x00080000 +#define EF_PARISC_NO_KABP 0x00100000 + +#define EF_PARISC_LAZYSWAP 0x00400000 +#define EF_PARISC_ARCH 0x0000ffff + + + +#define EFA_PARISC_1_0 0x020b +#define EFA_PARISC_1_1 0x0210 +#define EFA_PARISC_2_0 0x0214 + + + +#define SHN_PARISC_ANSI_COMMON 0xff00 + +#define SHN_PARISC_HUGE_COMMON 0xff01 + + + +#define SHT_PARISC_EXT 0x70000000 +#define SHT_PARISC_UNWIND 0x70000001 +#define SHT_PARISC_DOC 0x70000002 + + + +#define SHF_PARISC_SHORT 0x20000000 +#define SHF_PARISC_HUGE 0x40000000 +#define SHF_PARISC_SBP 0x80000000 + + + +#define STT_PARISC_MILLICODE 13 + +#define STT_HP_OPAQUE (STT_LOOS + 0x1) +#define STT_HP_STUB (STT_LOOS + 0x2) + + + +#define R_PARISC_NONE 0 +#define R_PARISC_DIR32 1 +#define R_PARISC_DIR21L 2 +#define R_PARISC_DIR17R 3 +#define R_PARISC_DIR17F 4 +#define R_PARISC_DIR14R 6 +#define R_PARISC_PCREL32 9 +#define R_PARISC_PCREL21L 10 +#define R_PARISC_PCREL17R 11 +#define R_PARISC_PCREL17F 12 +#define R_PARISC_PCREL14R 14 +#define R_PARISC_DPREL21L 18 +#define R_PARISC_DPREL14R 22 +#define R_PARISC_GPREL21L 26 +#define R_PARISC_GPREL14R 30 +#define R_PARISC_LTOFF21L 34 +#define R_PARISC_LTOFF14R 38 +#define R_PARISC_SECREL32 41 +#define R_PARISC_SEGBASE 48 +#define R_PARISC_SEGREL32 49 +#define R_PARISC_PLTOFF21L 50 +#define R_PARISC_PLTOFF14R 54 +#define R_PARISC_LTOFF_FPTR32 57 +#define R_PARISC_LTOFF_FPTR21L 58 +#define R_PARISC_LTOFF_FPTR14R 62 +#define R_PARISC_FPTR64 64 +#define R_PARISC_PLABEL32 65 +#define R_PARISC_PLABEL21L 66 +#define R_PARISC_PLABEL14R 70 +#define R_PARISC_PCREL64 72 +#define R_PARISC_PCREL22F 74 +#define R_PARISC_PCREL14WR 75 +#define R_PARISC_PCREL14DR 76 +#define R_PARISC_PCREL16F 77 +#define R_PARISC_PCREL16WF 78 +#define R_PARISC_PCREL16DF 79 +#define R_PARISC_DIR64 80 +#define R_PARISC_DIR14WR 83 +#define R_PARISC_DIR14DR 84 +#define R_PARISC_DIR16F 85 +#define R_PARISC_DIR16WF 86 +#define R_PARISC_DIR16DF 87 +#define R_PARISC_GPREL64 88 +#define R_PARISC_GPREL14WR 91 +#define R_PARISC_GPREL14DR 92 +#define R_PARISC_GPREL16F 93 +#define R_PARISC_GPREL16WF 94 +#define R_PARISC_GPREL16DF 95 +#define R_PARISC_LTOFF64 96 +#define R_PARISC_LTOFF14WR 99 +#define R_PARISC_LTOFF14DR 100 +#define R_PARISC_LTOFF16F 101 +#define R_PARISC_LTOFF16WF 102 +#define R_PARISC_LTOFF16DF 103 +#define R_PARISC_SECREL64 104 +#define R_PARISC_SEGREL64 112 +#define R_PARISC_PLTOFF14WR 115 +#define R_PARISC_PLTOFF14DR 116 +#define R_PARISC_PLTOFF16F 117 +#define R_PARISC_PLTOFF16WF 118 +#define R_PARISC_PLTOFF16DF 119 +#define R_PARISC_LTOFF_FPTR64 120 +#define R_PARISC_LTOFF_FPTR14WR 123 +#define R_PARISC_LTOFF_FPTR14DR 124 +#define R_PARISC_LTOFF_FPTR16F 125 +#define R_PARISC_LTOFF_FPTR16WF 126 +#define R_PARISC_LTOFF_FPTR16DF 127 +#define R_PARISC_LORESERVE 128 +#define R_PARISC_COPY 128 +#define R_PARISC_IPLT 129 +#define R_PARISC_EPLT 130 +#define R_PARISC_TPREL32 153 +#define R_PARISC_TPREL21L 154 +#define R_PARISC_TPREL14R 158 +#define R_PARISC_LTOFF_TP21L 162 +#define R_PARISC_LTOFF_TP14R 166 +#define R_PARISC_LTOFF_TP14F 167 +#define R_PARISC_TPREL64 216 +#define R_PARISC_TPREL14WR 219 +#define R_PARISC_TPREL14DR 220 +#define R_PARISC_TPREL16F 221 +#define R_PARISC_TPREL16WF 222 +#define R_PARISC_TPREL16DF 223 +#define R_PARISC_LTOFF_TP64 224 +#define R_PARISC_LTOFF_TP14WR 227 +#define R_PARISC_LTOFF_TP14DR 228 +#define R_PARISC_LTOFF_TP16F 229 +#define R_PARISC_LTOFF_TP16WF 230 +#define R_PARISC_LTOFF_TP16DF 231 +#define R_PARISC_GNU_VTENTRY 232 +#define R_PARISC_GNU_VTINHERIT 233 +#define R_PARISC_TLS_GD21L 234 +#define R_PARISC_TLS_GD14R 235 +#define R_PARISC_TLS_GDCALL 236 +#define R_PARISC_TLS_LDM21L 237 +#define R_PARISC_TLS_LDM14R 238 +#define R_PARISC_TLS_LDMCALL 239 +#define R_PARISC_TLS_LDO21L 240 +#define R_PARISC_TLS_LDO14R 241 +#define R_PARISC_TLS_DTPMOD32 242 +#define R_PARISC_TLS_DTPMOD64 243 +#define R_PARISC_TLS_DTPOFF32 244 +#define R_PARISC_TLS_DTPOFF64 245 +#define R_PARISC_TLS_LE21L R_PARISC_TPREL21L +#define R_PARISC_TLS_LE14R R_PARISC_TPREL14R +#define R_PARISC_TLS_IE21L R_PARISC_LTOFF_TP21L +#define R_PARISC_TLS_IE14R R_PARISC_LTOFF_TP14R +#define R_PARISC_TLS_TPREL32 R_PARISC_TPREL32 +#define R_PARISC_TLS_TPREL64 R_PARISC_TPREL64 +#define R_PARISC_HIRESERVE 255 + + + +#define PT_HP_TLS (PT_LOOS + 0x0) +#define PT_HP_CORE_NONE (PT_LOOS + 0x1) +#define PT_HP_CORE_VERSION (PT_LOOS + 0x2) +#define PT_HP_CORE_KERNEL (PT_LOOS + 0x3) +#define PT_HP_CORE_COMM (PT_LOOS + 0x4) +#define PT_HP_CORE_PROC (PT_LOOS + 0x5) +#define PT_HP_CORE_LOADABLE (PT_LOOS + 0x6) +#define PT_HP_CORE_STACK (PT_LOOS + 0x7) +#define PT_HP_CORE_SHM (PT_LOOS + 0x8) +#define PT_HP_CORE_MMF (PT_LOOS + 0x9) +#define PT_HP_PARALLEL (PT_LOOS + 0x10) +#define PT_HP_FASTBIND (PT_LOOS + 0x11) +#define PT_HP_OPT_ANNOT (PT_LOOS + 0x12) +#define PT_HP_HSL_ANNOT (PT_LOOS + 0x13) +#define PT_HP_STACK (PT_LOOS + 0x14) + +#define PT_PARISC_ARCHEXT 0x70000000 +#define PT_PARISC_UNWIND 0x70000001 + + + +#define PF_PARISC_SBP 0x08000000 + +#define PF_HP_PAGE_SIZE 0x00100000 +#define PF_HP_FAR_SHARED 0x00200000 +#define PF_HP_NEAR_SHARED 0x00400000 +#define PF_HP_CODE 0x01000000 +#define PF_HP_MODIFY 0x02000000 +#define PF_HP_LAZYSWAP 0x04000000 +#define PF_HP_SBP 0x08000000 + + + + + + +#define EF_ALPHA_32BIT 1 +#define EF_ALPHA_CANRELAX 2 + + + + +#define SHT_ALPHA_DEBUG 0x70000001 +#define SHT_ALPHA_REGINFO 0x70000002 + + + +#define SHF_ALPHA_GPREL 0x10000000 + + +#define STO_ALPHA_NOPV 0x80 +#define STO_ALPHA_STD_GPLOAD 0x88 + + + +#define R_ALPHA_NONE 0 +#define R_ALPHA_REFLONG 1 +#define R_ALPHA_REFQUAD 2 +#define R_ALPHA_GPREL32 3 +#define R_ALPHA_LITERAL 4 +#define R_ALPHA_LITUSE 5 +#define R_ALPHA_GPDISP 6 +#define R_ALPHA_BRADDR 7 +#define R_ALPHA_HINT 8 +#define R_ALPHA_SREL16 9 +#define R_ALPHA_SREL32 10 +#define R_ALPHA_SREL64 11 +#define R_ALPHA_GPRELHIGH 17 +#define R_ALPHA_GPRELLOW 18 +#define R_ALPHA_GPREL16 19 +#define R_ALPHA_COPY 24 +#define R_ALPHA_GLOB_DAT 25 +#define R_ALPHA_JMP_SLOT 26 +#define R_ALPHA_RELATIVE 27 +#define R_ALPHA_TLS_GD_HI 28 +#define R_ALPHA_TLSGD 29 +#define R_ALPHA_TLS_LDM 30 +#define R_ALPHA_DTPMOD64 31 +#define R_ALPHA_GOTDTPREL 32 +#define R_ALPHA_DTPREL64 33 +#define R_ALPHA_DTPRELHI 34 +#define R_ALPHA_DTPRELLO 35 +#define R_ALPHA_DTPREL16 36 +#define R_ALPHA_GOTTPREL 37 +#define R_ALPHA_TPREL64 38 +#define R_ALPHA_TPRELHI 39 +#define R_ALPHA_TPRELLO 40 +#define R_ALPHA_TPREL16 41 + +#define R_ALPHA_NUM 46 + + +#define LITUSE_ALPHA_ADDR 0 +#define LITUSE_ALPHA_BASE 1 +#define LITUSE_ALPHA_BYTOFF 2 +#define LITUSE_ALPHA_JSR 3 +#define LITUSE_ALPHA_TLS_GD 4 +#define LITUSE_ALPHA_TLS_LDM 5 + + +#define DT_ALPHA_PLTRO (DT_LOPROC + 0) +#define DT_ALPHA_NUM 1 + + + + +#define EF_PPC_EMB 0x80000000 + + +#define EF_PPC_RELOCATABLE 0x00010000 +#define EF_PPC_RELOCATABLE_LIB 0x00008000 + + + +#define R_PPC_NONE 0 +#define R_PPC_ADDR32 1 +#define R_PPC_ADDR24 2 +#define R_PPC_ADDR16 3 +#define R_PPC_ADDR16_LO 4 +#define R_PPC_ADDR16_HI 5 +#define R_PPC_ADDR16_HA 6 +#define R_PPC_ADDR14 7 +#define R_PPC_ADDR14_BRTAKEN 8 +#define R_PPC_ADDR14_BRNTAKEN 9 +#define R_PPC_REL24 10 +#define R_PPC_REL14 11 +#define R_PPC_REL14_BRTAKEN 12 +#define R_PPC_REL14_BRNTAKEN 13 +#define R_PPC_GOT16 14 +#define R_PPC_GOT16_LO 15 +#define R_PPC_GOT16_HI 16 +#define R_PPC_GOT16_HA 17 +#define R_PPC_PLTREL24 18 +#define R_PPC_COPY 19 +#define R_PPC_GLOB_DAT 20 +#define R_PPC_JMP_SLOT 21 +#define R_PPC_RELATIVE 22 +#define R_PPC_LOCAL24PC 23 +#define R_PPC_UADDR32 24 +#define R_PPC_UADDR16 25 +#define R_PPC_REL32 26 +#define R_PPC_PLT32 27 +#define R_PPC_PLTREL32 28 +#define R_PPC_PLT16_LO 29 +#define R_PPC_PLT16_HI 30 +#define R_PPC_PLT16_HA 31 +#define R_PPC_SDAREL16 32 +#define R_PPC_SECTOFF 33 +#define R_PPC_SECTOFF_LO 34 +#define R_PPC_SECTOFF_HI 35 +#define R_PPC_SECTOFF_HA 36 + + +#define R_PPC_TLS 67 +#define R_PPC_DTPMOD32 68 +#define R_PPC_TPREL16 69 +#define R_PPC_TPREL16_LO 70 +#define R_PPC_TPREL16_HI 71 +#define R_PPC_TPREL16_HA 72 +#define R_PPC_TPREL32 73 +#define R_PPC_DTPREL16 74 +#define R_PPC_DTPREL16_LO 75 +#define R_PPC_DTPREL16_HI 76 +#define R_PPC_DTPREL16_HA 77 +#define R_PPC_DTPREL32 78 +#define R_PPC_GOT_TLSGD16 79 +#define R_PPC_GOT_TLSGD16_LO 80 +#define R_PPC_GOT_TLSGD16_HI 81 +#define R_PPC_GOT_TLSGD16_HA 82 +#define R_PPC_GOT_TLSLD16 83 +#define R_PPC_GOT_TLSLD16_LO 84 +#define R_PPC_GOT_TLSLD16_HI 85 +#define R_PPC_GOT_TLSLD16_HA 86 +#define R_PPC_GOT_TPREL16 87 +#define R_PPC_GOT_TPREL16_LO 88 +#define R_PPC_GOT_TPREL16_HI 89 +#define R_PPC_GOT_TPREL16_HA 90 +#define R_PPC_GOT_DTPREL16 91 +#define R_PPC_GOT_DTPREL16_LO 92 +#define R_PPC_GOT_DTPREL16_HI 93 +#define R_PPC_GOT_DTPREL16_HA 94 +#define R_PPC_TLSGD 95 +#define R_PPC_TLSLD 96 + + +#define R_PPC_EMB_NADDR32 101 +#define R_PPC_EMB_NADDR16 102 +#define R_PPC_EMB_NADDR16_LO 103 +#define R_PPC_EMB_NADDR16_HI 104 +#define R_PPC_EMB_NADDR16_HA 105 +#define R_PPC_EMB_SDAI16 106 +#define R_PPC_EMB_SDA2I16 107 +#define R_PPC_EMB_SDA2REL 108 +#define R_PPC_EMB_SDA21 109 +#define R_PPC_EMB_MRKREF 110 +#define R_PPC_EMB_RELSEC16 111 +#define R_PPC_EMB_RELST_LO 112 +#define R_PPC_EMB_RELST_HI 113 +#define R_PPC_EMB_RELST_HA 114 +#define R_PPC_EMB_BIT_FLD 115 +#define R_PPC_EMB_RELSDA 116 + + +#define R_PPC_DIAB_SDA21_LO 180 +#define R_PPC_DIAB_SDA21_HI 181 +#define R_PPC_DIAB_SDA21_HA 182 +#define R_PPC_DIAB_RELSDA_LO 183 +#define R_PPC_DIAB_RELSDA_HI 184 +#define R_PPC_DIAB_RELSDA_HA 185 + + +#define R_PPC_IRELATIVE 248 + + +#define R_PPC_REL16 249 +#define R_PPC_REL16_LO 250 +#define R_PPC_REL16_HI 251 +#define R_PPC_REL16_HA 252 + + + +#define R_PPC_TOC16 255 + + +#define DT_PPC_GOT (DT_LOPROC + 0) +#define DT_PPC_OPT (DT_LOPROC + 1) +#define DT_PPC_NUM 2 + +#define PPC_OPT_TLS 1 + + +#define R_PPC64_NONE R_PPC_NONE +#define R_PPC64_ADDR32 R_PPC_ADDR32 +#define R_PPC64_ADDR24 R_PPC_ADDR24 +#define R_PPC64_ADDR16 R_PPC_ADDR16 +#define R_PPC64_ADDR16_LO R_PPC_ADDR16_LO +#define R_PPC64_ADDR16_HI R_PPC_ADDR16_HI +#define R_PPC64_ADDR16_HA R_PPC_ADDR16_HA +#define R_PPC64_ADDR14 R_PPC_ADDR14 +#define R_PPC64_ADDR14_BRTAKEN R_PPC_ADDR14_BRTAKEN +#define R_PPC64_ADDR14_BRNTAKEN R_PPC_ADDR14_BRNTAKEN +#define R_PPC64_REL24 R_PPC_REL24 +#define R_PPC64_REL14 R_PPC_REL14 +#define R_PPC64_REL14_BRTAKEN R_PPC_REL14_BRTAKEN +#define R_PPC64_REL14_BRNTAKEN R_PPC_REL14_BRNTAKEN +#define R_PPC64_GOT16 R_PPC_GOT16 +#define R_PPC64_GOT16_LO R_PPC_GOT16_LO +#define R_PPC64_GOT16_HI R_PPC_GOT16_HI +#define R_PPC64_GOT16_HA R_PPC_GOT16_HA + +#define R_PPC64_COPY R_PPC_COPY +#define R_PPC64_GLOB_DAT R_PPC_GLOB_DAT +#define R_PPC64_JMP_SLOT R_PPC_JMP_SLOT +#define R_PPC64_RELATIVE R_PPC_RELATIVE + +#define R_PPC64_UADDR32 R_PPC_UADDR32 +#define R_PPC64_UADDR16 R_PPC_UADDR16 +#define R_PPC64_REL32 R_PPC_REL32 +#define R_PPC64_PLT32 R_PPC_PLT32 +#define R_PPC64_PLTREL32 R_PPC_PLTREL32 +#define R_PPC64_PLT16_LO R_PPC_PLT16_LO +#define R_PPC64_PLT16_HI R_PPC_PLT16_HI +#define R_PPC64_PLT16_HA R_PPC_PLT16_HA + +#define R_PPC64_SECTOFF R_PPC_SECTOFF +#define R_PPC64_SECTOFF_LO R_PPC_SECTOFF_LO +#define R_PPC64_SECTOFF_HI R_PPC_SECTOFF_HI +#define R_PPC64_SECTOFF_HA R_PPC_SECTOFF_HA +#define R_PPC64_ADDR30 37 +#define R_PPC64_ADDR64 38 +#define R_PPC64_ADDR16_HIGHER 39 +#define R_PPC64_ADDR16_HIGHERA 40 +#define R_PPC64_ADDR16_HIGHEST 41 +#define R_PPC64_ADDR16_HIGHESTA 42 +#define R_PPC64_UADDR64 43 +#define R_PPC64_REL64 44 +#define R_PPC64_PLT64 45 +#define R_PPC64_PLTREL64 46 +#define R_PPC64_TOC16 47 +#define R_PPC64_TOC16_LO 48 +#define R_PPC64_TOC16_HI 49 +#define R_PPC64_TOC16_HA 50 +#define R_PPC64_TOC 51 +#define R_PPC64_PLTGOT16 52 +#define R_PPC64_PLTGOT16_LO 53 +#define R_PPC64_PLTGOT16_HI 54 +#define R_PPC64_PLTGOT16_HA 55 + +#define R_PPC64_ADDR16_DS 56 +#define R_PPC64_ADDR16_LO_DS 57 +#define R_PPC64_GOT16_DS 58 +#define R_PPC64_GOT16_LO_DS 59 +#define R_PPC64_PLT16_LO_DS 60 +#define R_PPC64_SECTOFF_DS 61 +#define R_PPC64_SECTOFF_LO_DS 62 +#define R_PPC64_TOC16_DS 63 +#define R_PPC64_TOC16_LO_DS 64 +#define R_PPC64_PLTGOT16_DS 65 +#define R_PPC64_PLTGOT16_LO_DS 66 + + +#define R_PPC64_TLS 67 +#define R_PPC64_DTPMOD64 68 +#define R_PPC64_TPREL16 69 +#define R_PPC64_TPREL16_LO 70 +#define R_PPC64_TPREL16_HI 71 +#define R_PPC64_TPREL16_HA 72 +#define R_PPC64_TPREL64 73 +#define R_PPC64_DTPREL16 74 +#define R_PPC64_DTPREL16_LO 75 +#define R_PPC64_DTPREL16_HI 76 +#define R_PPC64_DTPREL16_HA 77 +#define R_PPC64_DTPREL64 78 +#define R_PPC64_GOT_TLSGD16 79 +#define R_PPC64_GOT_TLSGD16_LO 80 +#define R_PPC64_GOT_TLSGD16_HI 81 +#define R_PPC64_GOT_TLSGD16_HA 82 +#define R_PPC64_GOT_TLSLD16 83 +#define R_PPC64_GOT_TLSLD16_LO 84 +#define R_PPC64_GOT_TLSLD16_HI 85 +#define R_PPC64_GOT_TLSLD16_HA 86 +#define R_PPC64_GOT_TPREL16_DS 87 +#define R_PPC64_GOT_TPREL16_LO_DS 88 +#define R_PPC64_GOT_TPREL16_HI 89 +#define R_PPC64_GOT_TPREL16_HA 90 +#define R_PPC64_GOT_DTPREL16_DS 91 +#define R_PPC64_GOT_DTPREL16_LO_DS 92 +#define R_PPC64_GOT_DTPREL16_HI 93 +#define R_PPC64_GOT_DTPREL16_HA 94 +#define R_PPC64_TPREL16_DS 95 +#define R_PPC64_TPREL16_LO_DS 96 +#define R_PPC64_TPREL16_HIGHER 97 +#define R_PPC64_TPREL16_HIGHERA 98 +#define R_PPC64_TPREL16_HIGHEST 99 +#define R_PPC64_TPREL16_HIGHESTA 100 +#define R_PPC64_DTPREL16_DS 101 +#define R_PPC64_DTPREL16_LO_DS 102 +#define R_PPC64_DTPREL16_HIGHER 103 +#define R_PPC64_DTPREL16_HIGHERA 104 +#define R_PPC64_DTPREL16_HIGHEST 105 +#define R_PPC64_DTPREL16_HIGHESTA 106 +#define R_PPC64_TLSGD 107 +#define R_PPC64_TLSLD 108 +#define R_PPC64_TOCSAVE 109 +#define R_PPC64_ADDR16_HIGH 110 +#define R_PPC64_ADDR16_HIGHA 111 +#define R_PPC64_TPREL16_HIGH 112 +#define R_PPC64_TPREL16_HIGHA 113 +#define R_PPC64_DTPREL16_HIGH 114 +#define R_PPC64_DTPREL16_HIGHA 115 + + +#define R_PPC64_JMP_IREL 247 +#define R_PPC64_IRELATIVE 248 +#define R_PPC64_REL16 249 +#define R_PPC64_REL16_LO 250 +#define R_PPC64_REL16_HI 251 +#define R_PPC64_REL16_HA 252 + +#define EF_PPC64_ABI 3 + +#define DT_PPC64_GLINK (DT_LOPROC + 0) +#define DT_PPC64_OPD (DT_LOPROC + 1) +#define DT_PPC64_OPDSZ (DT_LOPROC + 2) +#define DT_PPC64_OPT (DT_LOPROC + 3) +#define DT_PPC64_NUM 4 + +#define PPC64_OPT_TLS 1 +#define PPC64_OPT_MULTI_TOC 2 +#define PPC64_OPT_LOCALENTRY 4 + +#define STO_PPC64_LOCAL_BIT 5 +#define STO_PPC64_LOCAL_MASK 0xe0 +#define PPC64_LOCAL_ENTRY_OFFSET(x) (1 << (((x)&0xe0)>>5) & 0xfc) + + +#define EF_ARM_RELEXEC 0x01 +#define EF_ARM_HASENTRY 0x02 +#define EF_ARM_INTERWORK 0x04 +#define EF_ARM_APCS_26 0x08 +#define EF_ARM_APCS_FLOAT 0x10 +#define EF_ARM_PIC 0x20 +#define EF_ARM_ALIGN8 0x40 +#define EF_ARM_NEW_ABI 0x80 +#define EF_ARM_OLD_ABI 0x100 +#define EF_ARM_SOFT_FLOAT 0x200 +#define EF_ARM_VFP_FLOAT 0x400 +#define EF_ARM_MAVERICK_FLOAT 0x800 + +#define EF_ARM_ABI_FLOAT_SOFT 0x200 +#define EF_ARM_ABI_FLOAT_HARD 0x400 + + +#define EF_ARM_SYMSARESORTED 0x04 +#define EF_ARM_DYNSYMSUSESEGIDX 0x08 +#define EF_ARM_MAPSYMSFIRST 0x10 +#define EF_ARM_EABIMASK 0XFF000000 + + +#define EF_ARM_BE8 0x00800000 +#define EF_ARM_LE8 0x00400000 + +#define EF_ARM_EABI_VERSION(flags) ((flags) & EF_ARM_EABIMASK) +#define EF_ARM_EABI_UNKNOWN 0x00000000 +#define EF_ARM_EABI_VER1 0x01000000 +#define EF_ARM_EABI_VER2 0x02000000 +#define EF_ARM_EABI_VER3 0x03000000 +#define EF_ARM_EABI_VER4 0x04000000 +#define EF_ARM_EABI_VER5 0x05000000 + + +#define STT_ARM_TFUNC STT_LOPROC +#define STT_ARM_16BIT STT_HIPROC + + +#define SHF_ARM_ENTRYSECT 0x10000000 +#define SHF_ARM_COMDEF 0x80000000 + + + +#define PF_ARM_SB 0x10000000 + +#define PF_ARM_PI 0x20000000 +#define PF_ARM_ABS 0x40000000 + + +#define PT_ARM_EXIDX (PT_LOPROC + 1) + + +#define SHT_ARM_EXIDX (SHT_LOPROC + 1) +#define SHT_ARM_PREEMPTMAP (SHT_LOPROC + 2) +#define SHT_ARM_ATTRIBUTES (SHT_LOPROC + 3) + +#define R_AARCH64_NONE 0 +#define R_AARCH64_P32_ABS32 1 +#define R_AARCH64_P32_COPY 180 +#define R_AARCH64_P32_GLOB_DAT 181 +#define R_AARCH64_P32_JUMP_SLOT 182 +#define R_AARCH64_P32_RELATIVE 183 +#define R_AARCH64_P32_TLS_DTPMOD 184 +#define R_AARCH64_P32_TLS_DTPREL 185 +#define R_AARCH64_P32_TLS_TPREL 186 +#define R_AARCH64_P32_TLSDESC 187 +#define R_AARCH64_P32_IRELATIVE 188 +#define R_AARCH64_ABS64 257 +#define R_AARCH64_ABS32 258 +#define R_AARCH64_ABS16 259 +#define R_AARCH64_PREL64 260 +#define R_AARCH64_PREL32 261 +#define R_AARCH64_PREL16 262 +#define R_AARCH64_MOVW_UABS_G0 263 +#define R_AARCH64_MOVW_UABS_G0_NC 264 +#define R_AARCH64_MOVW_UABS_G1 265 +#define R_AARCH64_MOVW_UABS_G1_NC 266 +#define R_AARCH64_MOVW_UABS_G2 267 +#define R_AARCH64_MOVW_UABS_G2_NC 268 +#define R_AARCH64_MOVW_UABS_G3 269 +#define R_AARCH64_MOVW_SABS_G0 270 +#define R_AARCH64_MOVW_SABS_G1 271 +#define R_AARCH64_MOVW_SABS_G2 272 +#define R_AARCH64_LD_PREL_LO19 273 +#define R_AARCH64_ADR_PREL_LO21 274 +#define R_AARCH64_ADR_PREL_PG_HI21 275 +#define R_AARCH64_ADR_PREL_PG_HI21_NC 276 +#define R_AARCH64_ADD_ABS_LO12_NC 277 +#define R_AARCH64_LDST8_ABS_LO12_NC 278 +#define R_AARCH64_TSTBR14 279 +#define R_AARCH64_CONDBR19 280 +#define R_AARCH64_JUMP26 282 +#define R_AARCH64_CALL26 283 +#define R_AARCH64_LDST16_ABS_LO12_NC 284 +#define R_AARCH64_LDST32_ABS_LO12_NC 285 +#define R_AARCH64_LDST64_ABS_LO12_NC 286 +#define R_AARCH64_MOVW_PREL_G0 287 +#define R_AARCH64_MOVW_PREL_G0_NC 288 +#define R_AARCH64_MOVW_PREL_G1 289 +#define R_AARCH64_MOVW_PREL_G1_NC 290 +#define R_AARCH64_MOVW_PREL_G2 291 +#define R_AARCH64_MOVW_PREL_G2_NC 292 +#define R_AARCH64_MOVW_PREL_G3 293 +#define R_AARCH64_LDST128_ABS_LO12_NC 299 +#define R_AARCH64_MOVW_GOTOFF_G0 300 +#define R_AARCH64_MOVW_GOTOFF_G0_NC 301 +#define R_AARCH64_MOVW_GOTOFF_G1 302 +#define R_AARCH64_MOVW_GOTOFF_G1_NC 303 +#define R_AARCH64_MOVW_GOTOFF_G2 304 +#define R_AARCH64_MOVW_GOTOFF_G2_NC 305 +#define R_AARCH64_MOVW_GOTOFF_G3 306 +#define R_AARCH64_GOTREL64 307 +#define R_AARCH64_GOTREL32 308 +#define R_AARCH64_GOT_LD_PREL19 309 +#define R_AARCH64_LD64_GOTOFF_LO15 310 +#define R_AARCH64_ADR_GOT_PAGE 311 +#define R_AARCH64_LD64_GOT_LO12_NC 312 +#define R_AARCH64_LD64_GOTPAGE_LO15 313 +#define R_AARCH64_TLSGD_ADR_PREL21 512 +#define R_AARCH64_TLSGD_ADR_PAGE21 513 +#define R_AARCH64_TLSGD_ADD_LO12_NC 514 +#define R_AARCH64_TLSGD_MOVW_G1 515 +#define R_AARCH64_TLSGD_MOVW_G0_NC 516 +#define R_AARCH64_TLSLD_ADR_PREL21 517 +#define R_AARCH64_TLSLD_ADR_PAGE21 518 +#define R_AARCH64_TLSLD_ADD_LO12_NC 519 +#define R_AARCH64_TLSLD_MOVW_G1 520 +#define R_AARCH64_TLSLD_MOVW_G0_NC 521 +#define R_AARCH64_TLSLD_LD_PREL19 522 +#define R_AARCH64_TLSLD_MOVW_DTPREL_G2 523 +#define R_AARCH64_TLSLD_MOVW_DTPREL_G1 524 +#define R_AARCH64_TLSLD_MOVW_DTPREL_G1_NC 525 +#define R_AARCH64_TLSLD_MOVW_DTPREL_G0 526 +#define R_AARCH64_TLSLD_MOVW_DTPREL_G0_NC 527 +#define R_AARCH64_TLSLD_ADD_DTPREL_HI12 528 +#define R_AARCH64_TLSLD_ADD_DTPREL_LO12 529 +#define R_AARCH64_TLSLD_ADD_DTPREL_LO12_NC 530 +#define R_AARCH64_TLSLD_LDST8_DTPREL_LO12 531 +#define R_AARCH64_TLSLD_LDST8_DTPREL_LO12_NC 532 +#define R_AARCH64_TLSLD_LDST16_DTPREL_LO12 533 +#define R_AARCH64_TLSLD_LDST16_DTPREL_LO12_NC 534 +#define R_AARCH64_TLSLD_LDST32_DTPREL_LO12 535 +#define R_AARCH64_TLSLD_LDST32_DTPREL_LO12_NC 536 +#define R_AARCH64_TLSLD_LDST64_DTPREL_LO12 537 +#define R_AARCH64_TLSLD_LDST64_DTPREL_LO12_NC 538 +#define R_AARCH64_TLSIE_MOVW_GOTTPREL_G1 539 +#define R_AARCH64_TLSIE_MOVW_GOTTPREL_G0_NC 540 +#define R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21 541 +#define R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC 542 +#define R_AARCH64_TLSIE_LD_GOTTPREL_PREL19 543 +#define R_AARCH64_TLSLE_MOVW_TPREL_G2 544 +#define R_AARCH64_TLSLE_MOVW_TPREL_G1 545 +#define R_AARCH64_TLSLE_MOVW_TPREL_G1_NC 546 +#define R_AARCH64_TLSLE_MOVW_TPREL_G0 547 +#define R_AARCH64_TLSLE_MOVW_TPREL_G0_NC 548 +#define R_AARCH64_TLSLE_ADD_TPREL_HI12 549 +#define R_AARCH64_TLSLE_ADD_TPREL_LO12 550 +#define R_AARCH64_TLSLE_ADD_TPREL_LO12_NC 551 +#define R_AARCH64_TLSLE_LDST8_TPREL_LO12 552 +#define R_AARCH64_TLSLE_LDST8_TPREL_LO12_NC 553 +#define R_AARCH64_TLSLE_LDST16_TPREL_LO12 554 +#define R_AARCH64_TLSLE_LDST16_TPREL_LO12_NC 555 +#define R_AARCH64_TLSLE_LDST32_TPREL_LO12 556 +#define R_AARCH64_TLSLE_LDST32_TPREL_LO12_NC 557 +#define R_AARCH64_TLSLE_LDST64_TPREL_LO12 558 +#define R_AARCH64_TLSLE_LDST64_TPREL_LO12_NC 559 +#define R_AARCH64_TLSDESC_LD_PREL19 560 +#define R_AARCH64_TLSDESC_ADR_PREL21 561 +#define R_AARCH64_TLSDESC_ADR_PAGE21 562 +#define R_AARCH64_TLSDESC_LD64_LO12 563 +#define R_AARCH64_TLSDESC_ADD_LO12 564 +#define R_AARCH64_TLSDESC_OFF_G1 565 +#define R_AARCH64_TLSDESC_OFF_G0_NC 566 +#define R_AARCH64_TLSDESC_LDR 567 +#define R_AARCH64_TLSDESC_ADD 568 +#define R_AARCH64_TLSDESC_CALL 569 +#define R_AARCH64_TLSLE_LDST128_TPREL_LO12 570 +#define R_AARCH64_TLSLE_LDST128_TPREL_LO12_NC 571 +#define R_AARCH64_TLSLD_LDST128_DTPREL_LO12 572 +#define R_AARCH64_TLSLD_LDST128_DTPREL_LO12_NC 573 +#define R_AARCH64_COPY 1024 +#define R_AARCH64_GLOB_DAT 1025 +#define R_AARCH64_JUMP_SLOT 1026 +#define R_AARCH64_RELATIVE 1027 +#define R_AARCH64_TLS_DTPMOD 1028 +#define R_AARCH64_TLS_DTPMOD64 1028 +#define R_AARCH64_TLS_DTPREL 1029 +#define R_AARCH64_TLS_DTPREL64 1029 +#define R_AARCH64_TLS_TPREL 1030 +#define R_AARCH64_TLS_TPREL64 1030 +#define R_AARCH64_TLSDESC 1031 + + +#define R_ARM_NONE 0 +#define R_ARM_PC24 1 +#define R_ARM_ABS32 2 +#define R_ARM_REL32 3 +#define R_ARM_PC13 4 +#define R_ARM_ABS16 5 +#define R_ARM_ABS12 6 +#define R_ARM_THM_ABS5 7 +#define R_ARM_ABS8 8 +#define R_ARM_SBREL32 9 +#define R_ARM_THM_PC22 10 +#define R_ARM_THM_PC8 11 +#define R_ARM_AMP_VCALL9 12 +#define R_ARM_TLS_DESC 13 +#define R_ARM_THM_SWI8 14 +#define R_ARM_XPC25 15 +#define R_ARM_THM_XPC22 16 +#define R_ARM_TLS_DTPMOD32 17 +#define R_ARM_TLS_DTPOFF32 18 +#define R_ARM_TLS_TPOFF32 19 +#define R_ARM_COPY 20 +#define R_ARM_GLOB_DAT 21 +#define R_ARM_JUMP_SLOT 22 +#define R_ARM_RELATIVE 23 +#define R_ARM_GOTOFF 24 +#define R_ARM_GOTPC 25 +#define R_ARM_GOT32 26 +#define R_ARM_PLT32 27 +#define R_ARM_CALL 28 +#define R_ARM_JUMP24 29 +#define R_ARM_THM_JUMP24 30 +#define R_ARM_BASE_ABS 31 +#define R_ARM_ALU_PCREL_7_0 32 +#define R_ARM_ALU_PCREL_15_8 33 +#define R_ARM_ALU_PCREL_23_15 34 +#define R_ARM_LDR_SBREL_11_0 35 +#define R_ARM_ALU_SBREL_19_12 36 +#define R_ARM_ALU_SBREL_27_20 37 +#define R_ARM_TARGET1 38 +#define R_ARM_SBREL31 39 +#define R_ARM_V4BX 40 +#define R_ARM_TARGET2 41 +#define R_ARM_PREL31 42 +#define R_ARM_MOVW_ABS_NC 43 +#define R_ARM_MOVT_ABS 44 +#define R_ARM_MOVW_PREL_NC 45 +#define R_ARM_MOVT_PREL 46 +#define R_ARM_THM_MOVW_ABS_NC 47 +#define R_ARM_THM_MOVT_ABS 48 +#define R_ARM_THM_MOVW_PREL_NC 49 +#define R_ARM_THM_MOVT_PREL 50 +#define R_ARM_THM_JUMP19 51 +#define R_ARM_THM_JUMP6 52 +#define R_ARM_THM_ALU_PREL_11_0 53 +#define R_ARM_THM_PC12 54 +#define R_ARM_ABS32_NOI 55 +#define R_ARM_REL32_NOI 56 +#define R_ARM_ALU_PC_G0_NC 57 +#define R_ARM_ALU_PC_G0 58 +#define R_ARM_ALU_PC_G1_NC 59 +#define R_ARM_ALU_PC_G1 60 +#define R_ARM_ALU_PC_G2 61 +#define R_ARM_LDR_PC_G1 62 +#define R_ARM_LDR_PC_G2 63 +#define R_ARM_LDRS_PC_G0 64 +#define R_ARM_LDRS_PC_G1 65 +#define R_ARM_LDRS_PC_G2 66 +#define R_ARM_LDC_PC_G0 67 +#define R_ARM_LDC_PC_G1 68 +#define R_ARM_LDC_PC_G2 69 +#define R_ARM_ALU_SB_G0_NC 70 +#define R_ARM_ALU_SB_G0 71 +#define R_ARM_ALU_SB_G1_NC 72 +#define R_ARM_ALU_SB_G1 73 +#define R_ARM_ALU_SB_G2 74 +#define R_ARM_LDR_SB_G0 75 +#define R_ARM_LDR_SB_G1 76 +#define R_ARM_LDR_SB_G2 77 +#define R_ARM_LDRS_SB_G0 78 +#define R_ARM_LDRS_SB_G1 79 +#define R_ARM_LDRS_SB_G2 80 +#define R_ARM_LDC_SB_G0 81 +#define R_ARM_LDC_SB_G1 82 +#define R_ARM_LDC_SB_G2 83 +#define R_ARM_MOVW_BREL_NC 84 +#define R_ARM_MOVT_BREL 85 +#define R_ARM_MOVW_BREL 86 +#define R_ARM_THM_MOVW_BREL_NC 87 +#define R_ARM_THM_MOVT_BREL 88 +#define R_ARM_THM_MOVW_BREL 89 +#define R_ARM_TLS_GOTDESC 90 +#define R_ARM_TLS_CALL 91 +#define R_ARM_TLS_DESCSEQ 92 +#define R_ARM_THM_TLS_CALL 93 +#define R_ARM_PLT32_ABS 94 +#define R_ARM_GOT_ABS 95 +#define R_ARM_GOT_PREL 96 +#define R_ARM_GOT_BREL12 97 +#define R_ARM_GOTOFF12 98 +#define R_ARM_GOTRELAX 99 +#define R_ARM_GNU_VTENTRY 100 +#define R_ARM_GNU_VTINHERIT 101 +#define R_ARM_THM_PC11 102 +#define R_ARM_THM_PC9 103 +#define R_ARM_TLS_GD32 104 + +#define R_ARM_TLS_LDM32 105 + +#define R_ARM_TLS_LDO32 106 + +#define R_ARM_TLS_IE32 107 + +#define R_ARM_TLS_LE32 108 +#define R_ARM_TLS_LDO12 109 +#define R_ARM_TLS_LE12 110 +#define R_ARM_TLS_IE12GP 111 +#define R_ARM_ME_TOO 128 +#define R_ARM_THM_TLS_DESCSEQ 129 +#define R_ARM_THM_TLS_DESCSEQ16 129 +#define R_ARM_THM_TLS_DESCSEQ32 130 +#define R_ARM_THM_GOT_BREL12 131 +#define R_ARM_IRELATIVE 160 +#define R_ARM_RXPC25 249 +#define R_ARM_RSBREL32 250 +#define R_ARM_THM_RPC22 251 +#define R_ARM_RREL32 252 +#define R_ARM_RABS22 253 +#define R_ARM_RPC24 254 +#define R_ARM_RBASE 255 + +#define R_ARM_NUM 256 + + +#define R_CKCORE_NONE 0 +#define R_CKCORE_ADDR32 1 +#define R_CKCORE_PCRELIMM8BY4 2 +#define R_CKCORE_PCRELIMM11BY2 3 +#define R_CKCORE_PCREL32 5 +#define R_CKCORE_PCRELJSR_IMM11BY2 6 +#define R_CKCORE_RELATIVE 9 +#define R_CKCORE_COPY 10 +#define R_CKCORE_GLOB_DAT 11 +#define R_CKCORE_JUMP_SLOT 12 +#define R_CKCORE_GOTOFF 13 +#define R_CKCORE_GOTPC 14 +#define R_CKCORE_GOT32 15 +#define R_CKCORE_PLT32 16 +#define R_CKCORE_ADDRGOT 17 +#define R_CKCORE_ADDRPLT 18 +#define R_CKCORE_PCREL_IMM26BY2 19 +#define R_CKCORE_PCREL_IMM16BY2 20 +#define R_CKCORE_PCREL_IMM16BY4 21 +#define R_CKCORE_PCREL_IMM10BY2 22 +#define R_CKCORE_PCREL_IMM10BY4 23 +#define R_CKCORE_ADDR_HI16 24 +#define R_CKCORE_ADDR_LO16 25 +#define R_CKCORE_GOTPC_HI16 26 +#define R_CKCORE_GOTPC_LO16 27 +#define R_CKCORE_GOTOFF_HI16 28 +#define R_CKCORE_GOTOFF_LO16 29 +#define R_CKCORE_GOT12 30 +#define R_CKCORE_GOT_HI16 31 +#define R_CKCORE_GOT_LO16 32 +#define R_CKCORE_PLT12 33 +#define R_CKCORE_PLT_HI16 34 +#define R_CKCORE_PLT_LO16 35 +#define R_CKCORE_ADDRGOT_HI16 36 +#define R_CKCORE_ADDRGOT_LO16 37 +#define R_CKCORE_ADDRPLT_HI16 38 +#define R_CKCORE_ADDRPLT_LO16 39 +#define R_CKCORE_PCREL_JSR_IMM26BY2 40 +#define R_CKCORE_TOFFSET_LO16 41 +#define R_CKCORE_DOFFSET_LO16 42 +#define R_CKCORE_PCREL_IMM18BY2 43 +#define R_CKCORE_DOFFSET_IMM18 44 +#define R_CKCORE_DOFFSET_IMM18BY2 45 +#define R_CKCORE_DOFFSET_IMM18BY4 46 +#define R_CKCORE_GOT_IMM18BY4 48 +#define R_CKCORE_PLT_IMM18BY4 49 +#define R_CKCORE_PCREL_IMM7BY4 50 +#define R_CKCORE_TLS_LE32 51 +#define R_CKCORE_TLS_IE32 52 +#define R_CKCORE_TLS_GD32 53 +#define R_CKCORE_TLS_LDM32 54 +#define R_CKCORE_TLS_LDO32 55 +#define R_CKCORE_TLS_DTPMOD32 56 +#define R_CKCORE_TLS_DTPOFF32 57 +#define R_CKCORE_TLS_TPOFF32 58 + + +#define EF_IA_64_MASKOS 0x0000000f +#define EF_IA_64_ABI64 0x00000010 +#define EF_IA_64_ARCH 0xff000000 + + +#define PT_IA_64_ARCHEXT (PT_LOPROC + 0) +#define PT_IA_64_UNWIND (PT_LOPROC + 1) +#define PT_IA_64_HP_OPT_ANOT (PT_LOOS + 0x12) +#define PT_IA_64_HP_HSL_ANOT (PT_LOOS + 0x13) +#define PT_IA_64_HP_STACK (PT_LOOS + 0x14) + + +#define PF_IA_64_NORECOV 0x80000000 + + +#define SHT_IA_64_EXT (SHT_LOPROC + 0) +#define SHT_IA_64_UNWIND (SHT_LOPROC + 1) + + +#define SHF_IA_64_SHORT 0x10000000 +#define SHF_IA_64_NORECOV 0x20000000 + + +#define DT_IA_64_PLT_RESERVE (DT_LOPROC + 0) +#define DT_IA_64_NUM 1 + + +#define R_IA64_NONE 0x00 +#define R_IA64_IMM14 0x21 +#define R_IA64_IMM22 0x22 +#define R_IA64_IMM64 0x23 +#define R_IA64_DIR32MSB 0x24 +#define R_IA64_DIR32LSB 0x25 +#define R_IA64_DIR64MSB 0x26 +#define R_IA64_DIR64LSB 0x27 +#define R_IA64_GPREL22 0x2a +#define R_IA64_GPREL64I 0x2b +#define R_IA64_GPREL32MSB 0x2c +#define R_IA64_GPREL32LSB 0x2d +#define R_IA64_GPREL64MSB 0x2e +#define R_IA64_GPREL64LSB 0x2f +#define R_IA64_LTOFF22 0x32 +#define R_IA64_LTOFF64I 0x33 +#define R_IA64_PLTOFF22 0x3a +#define R_IA64_PLTOFF64I 0x3b +#define R_IA64_PLTOFF64MSB 0x3e +#define R_IA64_PLTOFF64LSB 0x3f +#define R_IA64_FPTR64I 0x43 +#define R_IA64_FPTR32MSB 0x44 +#define R_IA64_FPTR32LSB 0x45 +#define R_IA64_FPTR64MSB 0x46 +#define R_IA64_FPTR64LSB 0x47 +#define R_IA64_PCREL60B 0x48 +#define R_IA64_PCREL21B 0x49 +#define R_IA64_PCREL21M 0x4a +#define R_IA64_PCREL21F 0x4b +#define R_IA64_PCREL32MSB 0x4c +#define R_IA64_PCREL32LSB 0x4d +#define R_IA64_PCREL64MSB 0x4e +#define R_IA64_PCREL64LSB 0x4f +#define R_IA64_LTOFF_FPTR22 0x52 +#define R_IA64_LTOFF_FPTR64I 0x53 +#define R_IA64_LTOFF_FPTR32MSB 0x54 +#define R_IA64_LTOFF_FPTR32LSB 0x55 +#define R_IA64_LTOFF_FPTR64MSB 0x56 +#define R_IA64_LTOFF_FPTR64LSB 0x57 +#define R_IA64_SEGREL32MSB 0x5c +#define R_IA64_SEGREL32LSB 0x5d +#define R_IA64_SEGREL64MSB 0x5e +#define R_IA64_SEGREL64LSB 0x5f +#define R_IA64_SECREL32MSB 0x64 +#define R_IA64_SECREL32LSB 0x65 +#define R_IA64_SECREL64MSB 0x66 +#define R_IA64_SECREL64LSB 0x67 +#define R_IA64_REL32MSB 0x6c +#define R_IA64_REL32LSB 0x6d +#define R_IA64_REL64MSB 0x6e +#define R_IA64_REL64LSB 0x6f +#define R_IA64_LTV32MSB 0x74 +#define R_IA64_LTV32LSB 0x75 +#define R_IA64_LTV64MSB 0x76 +#define R_IA64_LTV64LSB 0x77 +#define R_IA64_PCREL21BI 0x79 +#define R_IA64_PCREL22 0x7a +#define R_IA64_PCREL64I 0x7b +#define R_IA64_IPLTMSB 0x80 +#define R_IA64_IPLTLSB 0x81 +#define R_IA64_COPY 0x84 +#define R_IA64_SUB 0x85 +#define R_IA64_LTOFF22X 0x86 +#define R_IA64_LDXMOV 0x87 +#define R_IA64_TPREL14 0x91 +#define R_IA64_TPREL22 0x92 +#define R_IA64_TPREL64I 0x93 +#define R_IA64_TPREL64MSB 0x96 +#define R_IA64_TPREL64LSB 0x97 +#define R_IA64_LTOFF_TPREL22 0x9a +#define R_IA64_DTPMOD64MSB 0xa6 +#define R_IA64_DTPMOD64LSB 0xa7 +#define R_IA64_LTOFF_DTPMOD22 0xaa +#define R_IA64_DTPREL14 0xb1 +#define R_IA64_DTPREL22 0xb2 +#define R_IA64_DTPREL64I 0xb3 +#define R_IA64_DTPREL32MSB 0xb4 +#define R_IA64_DTPREL32LSB 0xb5 +#define R_IA64_DTPREL64MSB 0xb6 +#define R_IA64_DTPREL64LSB 0xb7 +#define R_IA64_LTOFF_DTPREL22 0xba + + +#define EF_SH_MACH_MASK 0x1f +#define EF_SH_UNKNOWN 0x0 +#define EF_SH1 0x1 +#define EF_SH2 0x2 +#define EF_SH3 0x3 +#define EF_SH_DSP 0x4 +#define EF_SH3_DSP 0x5 +#define EF_SH4AL_DSP 0x6 +#define EF_SH3E 0x8 +#define EF_SH4 0x9 +#define EF_SH2E 0xb +#define EF_SH4A 0xc +#define EF_SH2A 0xd +#define EF_SH4_NOFPU 0x10 +#define EF_SH4A_NOFPU 0x11 +#define EF_SH4_NOMMU_NOFPU 0x12 +#define EF_SH2A_NOFPU 0x13 +#define EF_SH3_NOMMU 0x14 +#define EF_SH2A_SH4_NOFPU 0x15 +#define EF_SH2A_SH3_NOFPU 0x16 +#define EF_SH2A_SH4 0x17 +#define EF_SH2A_SH3E 0x18 + +#define R_SH_NONE 0 +#define R_SH_DIR32 1 +#define R_SH_REL32 2 +#define R_SH_DIR8WPN 3 +#define R_SH_IND12W 4 +#define R_SH_DIR8WPL 5 +#define R_SH_DIR8WPZ 6 +#define R_SH_DIR8BP 7 +#define R_SH_DIR8W 8 +#define R_SH_DIR8L 9 +#define R_SH_SWITCH16 25 +#define R_SH_SWITCH32 26 +#define R_SH_USES 27 +#define R_SH_COUNT 28 +#define R_SH_ALIGN 29 +#define R_SH_CODE 30 +#define R_SH_DATA 31 +#define R_SH_LABEL 32 +#define R_SH_SWITCH8 33 +#define R_SH_GNU_VTINHERIT 34 +#define R_SH_GNU_VTENTRY 35 +#define R_SH_TLS_GD_32 144 +#define R_SH_TLS_LD_32 145 +#define R_SH_TLS_LDO_32 146 +#define R_SH_TLS_IE_32 147 +#define R_SH_TLS_LE_32 148 +#define R_SH_TLS_DTPMOD32 149 +#define R_SH_TLS_DTPOFF32 150 +#define R_SH_TLS_TPOFF32 151 +#define R_SH_GOT32 160 +#define R_SH_PLT32 161 +#define R_SH_COPY 162 +#define R_SH_GLOB_DAT 163 +#define R_SH_JMP_SLOT 164 +#define R_SH_RELATIVE 165 +#define R_SH_GOTOFF 166 +#define R_SH_GOTPC 167 +#define R_SH_GOT20 201 +#define R_SH_GOTOFF20 202 +#define R_SH_GOTFUNCDESC 203 +#define R_SH_GOTFUNCDEST20 204 +#define R_SH_GOTOFFFUNCDESC 205 +#define R_SH_GOTOFFFUNCDEST20 206 +#define R_SH_FUNCDESC 207 +#define R_SH_FUNCDESC_VALUE 208 + +#define R_SH_NUM 256 + + + +#define R_390_NONE 0 +#define R_390_8 1 +#define R_390_12 2 +#define R_390_16 3 +#define R_390_32 4 +#define R_390_PC32 5 +#define R_390_GOT12 6 +#define R_390_GOT32 7 +#define R_390_PLT32 8 +#define R_390_COPY 9 +#define R_390_GLOB_DAT 10 +#define R_390_JMP_SLOT 11 +#define R_390_RELATIVE 12 +#define R_390_GOTOFF32 13 +#define R_390_GOTPC 14 +#define R_390_GOT16 15 +#define R_390_PC16 16 +#define R_390_PC16DBL 17 +#define R_390_PLT16DBL 18 +#define R_390_PC32DBL 19 +#define R_390_PLT32DBL 20 +#define R_390_GOTPCDBL 21 +#define R_390_64 22 +#define R_390_PC64 23 +#define R_390_GOT64 24 +#define R_390_PLT64 25 +#define R_390_GOTENT 26 +#define R_390_GOTOFF16 27 +#define R_390_GOTOFF64 28 +#define R_390_GOTPLT12 29 +#define R_390_GOTPLT16 30 +#define R_390_GOTPLT32 31 +#define R_390_GOTPLT64 32 +#define R_390_GOTPLTENT 33 +#define R_390_PLTOFF16 34 +#define R_390_PLTOFF32 35 +#define R_390_PLTOFF64 36 +#define R_390_TLS_LOAD 37 +#define R_390_TLS_GDCALL 38 + +#define R_390_TLS_LDCALL 39 + +#define R_390_TLS_GD32 40 + +#define R_390_TLS_GD64 41 + +#define R_390_TLS_GOTIE12 42 + +#define R_390_TLS_GOTIE32 43 + +#define R_390_TLS_GOTIE64 44 + +#define R_390_TLS_LDM32 45 + +#define R_390_TLS_LDM64 46 + +#define R_390_TLS_IE32 47 + +#define R_390_TLS_IE64 48 + +#define R_390_TLS_IEENT 49 + +#define R_390_TLS_LE32 50 + +#define R_390_TLS_LE64 51 + +#define R_390_TLS_LDO32 52 + +#define R_390_TLS_LDO64 53 + +#define R_390_TLS_DTPMOD 54 +#define R_390_TLS_DTPOFF 55 +#define R_390_TLS_TPOFF 56 + +#define R_390_20 57 +#define R_390_GOT20 58 +#define R_390_GOTPLT20 59 +#define R_390_TLS_GOTIE20 60 + + +#define R_390_NUM 61 + + + +#define R_CRIS_NONE 0 +#define R_CRIS_8 1 +#define R_CRIS_16 2 +#define R_CRIS_32 3 +#define R_CRIS_8_PCREL 4 +#define R_CRIS_16_PCREL 5 +#define R_CRIS_32_PCREL 6 +#define R_CRIS_GNU_VTINHERIT 7 +#define R_CRIS_GNU_VTENTRY 8 +#define R_CRIS_COPY 9 +#define R_CRIS_GLOB_DAT 10 +#define R_CRIS_JUMP_SLOT 11 +#define R_CRIS_RELATIVE 12 +#define R_CRIS_16_GOT 13 +#define R_CRIS_32_GOT 14 +#define R_CRIS_16_GOTPLT 15 +#define R_CRIS_32_GOTPLT 16 +#define R_CRIS_32_GOTREL 17 +#define R_CRIS_32_PLT_GOTREL 18 +#define R_CRIS_32_PLT_PCREL 19 + +#define R_CRIS_NUM 20 + + + +#define R_X86_64_NONE 0 +#define R_X86_64_64 1 +#define R_X86_64_PC32 2 +#define R_X86_64_GOT32 3 +#define R_X86_64_PLT32 4 +#define R_X86_64_COPY 5 +#define R_X86_64_GLOB_DAT 6 +#define R_X86_64_JUMP_SLOT 7 +#define R_X86_64_RELATIVE 8 +#define R_X86_64_GOTPCREL 9 + +#define R_X86_64_32 10 +#define R_X86_64_32S 11 +#define R_X86_64_16 12 +#define R_X86_64_PC16 13 +#define R_X86_64_8 14 +#define R_X86_64_PC8 15 +#define R_X86_64_DTPMOD64 16 +#define R_X86_64_DTPOFF64 17 +#define R_X86_64_TPOFF64 18 +#define R_X86_64_TLSGD 19 + +#define R_X86_64_TLSLD 20 + +#define R_X86_64_DTPOFF32 21 +#define R_X86_64_GOTTPOFF 22 + +#define R_X86_64_TPOFF32 23 +#define R_X86_64_PC64 24 +#define R_X86_64_GOTOFF64 25 +#define R_X86_64_GOTPC32 26 +#define R_X86_64_GOT64 27 +#define R_X86_64_GOTPCREL64 28 +#define R_X86_64_GOTPC64 29 +#define R_X86_64_GOTPLT64 30 +#define R_X86_64_PLTOFF64 31 +#define R_X86_64_SIZE32 32 +#define R_X86_64_SIZE64 33 + +#define R_X86_64_GOTPC32_TLSDESC 34 +#define R_X86_64_TLSDESC_CALL 35 + +#define R_X86_64_TLSDESC 36 +#define R_X86_64_IRELATIVE 37 +#define R_X86_64_RELATIVE64 38 +#define R_X86_64_GOTPCRELX 41 +#define R_X86_64_REX_GOTPCRELX 42 +#define R_X86_64_NUM 43 + + + +#define R_MN10300_NONE 0 +#define R_MN10300_32 1 +#define R_MN10300_16 2 +#define R_MN10300_8 3 +#define R_MN10300_PCREL32 4 +#define R_MN10300_PCREL16 5 +#define R_MN10300_PCREL8 6 +#define R_MN10300_GNU_VTINHERIT 7 +#define R_MN10300_GNU_VTENTRY 8 +#define R_MN10300_24 9 +#define R_MN10300_GOTPC32 10 +#define R_MN10300_GOTPC16 11 +#define R_MN10300_GOTOFF32 12 +#define R_MN10300_GOTOFF24 13 +#define R_MN10300_GOTOFF16 14 +#define R_MN10300_PLT32 15 +#define R_MN10300_PLT16 16 +#define R_MN10300_GOT32 17 +#define R_MN10300_GOT24 18 +#define R_MN10300_GOT16 19 +#define R_MN10300_COPY 20 +#define R_MN10300_GLOB_DAT 21 +#define R_MN10300_JMP_SLOT 22 +#define R_MN10300_RELATIVE 23 + +#define R_MN10300_NUM 24 + + + +#define R_M32R_NONE 0 +#define R_M32R_16 1 +#define R_M32R_32 2 +#define R_M32R_24 3 +#define R_M32R_10_PCREL 4 +#define R_M32R_18_PCREL 5 +#define R_M32R_26_PCREL 6 +#define R_M32R_HI16_ULO 7 +#define R_M32R_HI16_SLO 8 +#define R_M32R_LO16 9 +#define R_M32R_SDA16 10 +#define R_M32R_GNU_VTINHERIT 11 +#define R_M32R_GNU_VTENTRY 12 + +#define R_M32R_16_RELA 33 +#define R_M32R_32_RELA 34 +#define R_M32R_24_RELA 35 +#define R_M32R_10_PCREL_RELA 36 +#define R_M32R_18_PCREL_RELA 37 +#define R_M32R_26_PCREL_RELA 38 +#define R_M32R_HI16_ULO_RELA 39 +#define R_M32R_HI16_SLO_RELA 40 +#define R_M32R_LO16_RELA 41 +#define R_M32R_SDA16_RELA 42 +#define R_M32R_RELA_GNU_VTINHERIT 43 +#define R_M32R_RELA_GNU_VTENTRY 44 +#define R_M32R_REL32 45 + +#define R_M32R_GOT24 48 +#define R_M32R_26_PLTREL 49 +#define R_M32R_COPY 50 +#define R_M32R_GLOB_DAT 51 +#define R_M32R_JMP_SLOT 52 +#define R_M32R_RELATIVE 53 +#define R_M32R_GOTOFF 54 +#define R_M32R_GOTPC24 55 +#define R_M32R_GOT16_HI_ULO 56 + +#define R_M32R_GOT16_HI_SLO 57 + +#define R_M32R_GOT16_LO 58 +#define R_M32R_GOTPC_HI_ULO 59 + +#define R_M32R_GOTPC_HI_SLO 60 + +#define R_M32R_GOTPC_LO 61 + +#define R_M32R_GOTOFF_HI_ULO 62 + +#define R_M32R_GOTOFF_HI_SLO 63 + +#define R_M32R_GOTOFF_LO 64 +#define R_M32R_NUM 256 + +#define R_MICROBLAZE_NONE 0 +#define R_MICROBLAZE_32 1 +#define R_MICROBLAZE_32_PCREL 2 +#define R_MICROBLAZE_64_PCREL 3 +#define R_MICROBLAZE_32_PCREL_LO 4 +#define R_MICROBLAZE_64 5 +#define R_MICROBLAZE_32_LO 6 +#define R_MICROBLAZE_SRO32 7 +#define R_MICROBLAZE_SRW32 8 +#define R_MICROBLAZE_64_NONE 9 +#define R_MICROBLAZE_32_SYM_OP_SYM 10 +#define R_MICROBLAZE_GNU_VTINHERIT 11 +#define R_MICROBLAZE_GNU_VTENTRY 12 +#define R_MICROBLAZE_GOTPC_64 13 +#define R_MICROBLAZE_GOT_64 14 +#define R_MICROBLAZE_PLT_64 15 +#define R_MICROBLAZE_REL 16 +#define R_MICROBLAZE_JUMP_SLOT 17 +#define R_MICROBLAZE_GLOB_DAT 18 +#define R_MICROBLAZE_GOTOFF_64 19 +#define R_MICROBLAZE_GOTOFF_32 20 +#define R_MICROBLAZE_COPY 21 +#define R_MICROBLAZE_TLS 22 +#define R_MICROBLAZE_TLSGD 23 +#define R_MICROBLAZE_TLSLD 24 +#define R_MICROBLAZE_TLSDTPMOD32 25 +#define R_MICROBLAZE_TLSDTPREL32 26 +#define R_MICROBLAZE_TLSDTPREL64 27 +#define R_MICROBLAZE_TLSGOTTPREL32 28 +#define R_MICROBLAZE_TLSTPREL32 29 + +#define DT_NIOS2_GP 0x70000002 + +#define R_NIOS2_NONE 0 +#define R_NIOS2_S16 1 +#define R_NIOS2_U16 2 +#define R_NIOS2_PCREL16 3 +#define R_NIOS2_CALL26 4 +#define R_NIOS2_IMM5 5 +#define R_NIOS2_CACHE_OPX 6 +#define R_NIOS2_IMM6 7 +#define R_NIOS2_IMM8 8 +#define R_NIOS2_HI16 9 +#define R_NIOS2_LO16 10 +#define R_NIOS2_HIADJ16 11 +#define R_NIOS2_BFD_RELOC_32 12 +#define R_NIOS2_BFD_RELOC_16 13 +#define R_NIOS2_BFD_RELOC_8 14 +#define R_NIOS2_GPREL 15 +#define R_NIOS2_GNU_VTINHERIT 16 +#define R_NIOS2_GNU_VTENTRY 17 +#define R_NIOS2_UJMP 18 +#define R_NIOS2_CJMP 19 +#define R_NIOS2_CALLR 20 +#define R_NIOS2_ALIGN 21 +#define R_NIOS2_GOT16 22 +#define R_NIOS2_CALL16 23 +#define R_NIOS2_GOTOFF_LO 24 +#define R_NIOS2_GOTOFF_HA 25 +#define R_NIOS2_PCREL_LO 26 +#define R_NIOS2_PCREL_HA 27 +#define R_NIOS2_TLS_GD16 28 +#define R_NIOS2_TLS_LDM16 29 +#define R_NIOS2_TLS_LDO16 30 +#define R_NIOS2_TLS_IE16 31 +#define R_NIOS2_TLS_LE16 32 +#define R_NIOS2_TLS_DTPMOD 33 +#define R_NIOS2_TLS_DTPREL 34 +#define R_NIOS2_TLS_TPREL 35 +#define R_NIOS2_COPY 36 +#define R_NIOS2_GLOB_DAT 37 +#define R_NIOS2_JUMP_SLOT 38 +#define R_NIOS2_RELATIVE 39 +#define R_NIOS2_GOTOFF 40 +#define R_NIOS2_CALL26_NOAT 41 +#define R_NIOS2_GOT_LO 42 +#define R_NIOS2_GOT_HA 43 +#define R_NIOS2_CALL_LO 44 +#define R_NIOS2_CALL_HA 45 + +#define R_OR1K_NONE 0 +#define R_OR1K_32 1 +#define R_OR1K_16 2 +#define R_OR1K_8 3 +#define R_OR1K_LO_16_IN_INSN 4 +#define R_OR1K_HI_16_IN_INSN 5 +#define R_OR1K_INSN_REL_26 6 +#define R_OR1K_GNU_VTENTRY 7 +#define R_OR1K_GNU_VTINHERIT 8 +#define R_OR1K_32_PCREL 9 +#define R_OR1K_16_PCREL 10 +#define R_OR1K_8_PCREL 11 +#define R_OR1K_GOTPC_HI16 12 +#define R_OR1K_GOTPC_LO16 13 +#define R_OR1K_GOT16 14 +#define R_OR1K_PLT26 15 +#define R_OR1K_GOTOFF_HI16 16 +#define R_OR1K_GOTOFF_LO16 17 +#define R_OR1K_COPY 18 +#define R_OR1K_GLOB_DAT 19 +#define R_OR1K_JMP_SLOT 20 +#define R_OR1K_RELATIVE 21 +#define R_OR1K_TLS_GD_HI16 22 +#define R_OR1K_TLS_GD_LO16 23 +#define R_OR1K_TLS_LDM_HI16 24 +#define R_OR1K_TLS_LDM_LO16 25 +#define R_OR1K_TLS_LDO_HI16 26 +#define R_OR1K_TLS_LDO_LO16 27 +#define R_OR1K_TLS_IE_HI16 28 +#define R_OR1K_TLS_IE_LO16 29 +#define R_OR1K_TLS_LE_HI16 30 +#define R_OR1K_TLS_LE_LO16 31 +#define R_OR1K_TLS_TPOFF 32 +#define R_OR1K_TLS_DTPOFF 33 +#define R_OR1K_TLS_DTPMOD 34 + +#define R_BPF_NONE 0 +#define R_BPF_MAP_FD 1 + +#define R_RISCV_NONE 0 +#define R_RISCV_32 1 +#define R_RISCV_64 2 +#define R_RISCV_RELATIVE 3 +#define R_RISCV_COPY 4 +#define R_RISCV_JUMP_SLOT 5 +#define R_RISCV_TLS_DTPMOD32 6 +#define R_RISCV_TLS_DTPMOD64 7 +#define R_RISCV_TLS_DTPREL32 8 +#define R_RISCV_TLS_DTPREL64 9 +#define R_RISCV_TLS_TPREL32 10 +#define R_RISCV_TLS_TPREL64 11 + +#define R_RISCV_BRANCH 16 +#define R_RISCV_JAL 17 +#define R_RISCV_CALL 18 +#define R_RISCV_CALL_PLT 19 +#define R_RISCV_GOT_HI20 20 +#define R_RISCV_TLS_GOT_HI20 21 +#define R_RISCV_TLS_GD_HI20 22 +#define R_RISCV_PCREL_HI20 23 +#define R_RISCV_PCREL_LO12_I 24 +#define R_RISCV_PCREL_LO12_S 25 +#define R_RISCV_HI20 26 +#define R_RISCV_LO12_I 27 +#define R_RISCV_LO12_S 28 +#define R_RISCV_TPREL_HI20 29 +#define R_RISCV_TPREL_LO12_I 30 +#define R_RISCV_TPREL_LO12_S 31 +#define R_RISCV_TPREL_ADD 32 +#define R_RISCV_ADD8 33 +#define R_RISCV_ADD16 34 +#define R_RISCV_ADD32 35 +#define R_RISCV_ADD64 36 +#define R_RISCV_SUB8 37 +#define R_RISCV_SUB16 38 +#define R_RISCV_SUB32 39 +#define R_RISCV_SUB64 40 +#define R_RISCV_GNU_VTINHERIT 41 +#define R_RISCV_GNU_VTENTRY 42 +#define R_RISCV_ALIGN 43 +#define R_RISCV_RVC_BRANCH 44 +#define R_RISCV_RVC_JUMP 45 +#define R_RISCV_RVC_LUI 46 +#define R_RISCV_GPREL_I 47 +#define R_RISCV_GPREL_S 48 +#define R_RISCV_TPREL_I 49 +#define R_RISCV_TPREL_S 50 +#define R_RISCV_RELAX 51 +#define R_RISCV_SUB6 52 +#define R_RISCV_SET6 53 +#define R_RISCV_SET8 54 +#define R_RISCV_SET16 55 +#define R_RISCV_SET32 56 +#define R_RISCV_32_PCREL 57 + +#ifdef __cplusplus +} +#endif + + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/endian.h b/Ubiquitous/XiZi/lib/musllib/include/endian.h new file mode 100644 index 000000000..204b089b0 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/endian.h @@ -0,0 +1,89 @@ +#ifndef _ENDIAN_H +#define _ENDIAN_H + +#include + +#define __NEED_uint16_t +#define __NEED_uint32_t +#define __NEED_uint64_t + +#include + +#define __PDP_ENDIAN 3412 + + +#ifndef BIG_ENDIAN +#define BIG_ENDIAN __BIG_ENDIAN +#endif +#ifndef LITTLE_ENDIAN +#define LITTLE_ENDIAN __LITTLE_ENDIAN +#endif +#ifndef PDP_ENDIAN +#define PDP_ENDIAN __PDP_ENDIAN +#endif +#ifndef BYTE_ORDER +#define BYTE_ORDER __BYTE_ORDER +#endif + +static __inline uint16_t __bswap16(uint16_t __x) +{ + return __x<<8 | __x>>8; +} + +static __inline uint32_t __bswap32(uint32_t __x) +{ + return __x>>24 | __x>>8&0xff00 | __x<<8&0xff0000 | __x<<24; +} + +static __inline uint64_t __bswap64(uint64_t __x) +{ + return __bswap32(__x)+0ULL<<32 | __bswap32(__x>>32); +} + +#if __BYTE_ORDER == __LITTLE_ENDIAN +#define htobe16(x) __bswap16(x) +#define be16toh(x) __bswap16(x) +#define htobe32(x) __bswap32(x) +#define be32toh(x) __bswap32(x) +#define htobe64(x) __bswap64(x) +#define be64toh(x) __bswap64(x) +#define htole16(x) (uint16_t)(x) +#define le16toh(x) (uint16_t)(x) +#define htole32(x) (uint32_t)(x) +#define le32toh(x) (uint32_t)(x) +#define htole64(x) (uint64_t)(x) +#define le64toh(x) (uint64_t)(x) +#else +#define htobe16(x) (uint16_t)(x) +#define be16toh(x) (uint16_t)(x) +#define htobe32(x) (uint32_t)(x) +#define be32toh(x) (uint32_t)(x) +#define htobe64(x) (uint64_t)(x) +#define be64toh(x) (uint64_t)(x) +#define htole16(x) __bswap16(x) +#define le16toh(x) __bswap16(x) +#define htole32(x) __bswap32(x) +#define le32toh(x) __bswap32(x) +#define htole64(x) __bswap64(x) +#define le64toh(x) __bswap64(x) +#endif + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +#if __BYTE_ORDER == __LITTLE_ENDIAN +#define betoh16(x) __bswap16(x) +#define betoh32(x) __bswap32(x) +#define betoh64(x) __bswap64(x) +#define letoh16(x) (uint16_t)(x) +#define letoh32(x) (uint32_t)(x) +#define letoh64(x) (uint64_t)(x) +#else +#define betoh16(x) (uint16_t)(x) +#define betoh32(x) (uint32_t)(x) +#define betoh64(x) (uint64_t)(x) +#define letoh16(x) __bswap16(x) +#define letoh32(x) __bswap32(x) +#define letoh64(x) __bswap64(x) +#endif +#endif + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/err.h b/Ubiquitous/XiZi/lib/musllib/include/err.h new file mode 100644 index 000000000..9f5cb6b9e --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/err.h @@ -0,0 +1,25 @@ +#ifndef _ERR_H +#define _ERR_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +void warn(const char *, ...); +void vwarn(const char *, va_list); +void warnx(const char *, ...); +void vwarnx(const char *, va_list); + +_Noreturn void err(int, const char *, ...); +_Noreturn void verr(int, const char *, va_list); +_Noreturn void errx(int, const char *, ...); +_Noreturn void verrx(int, const char *, va_list); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/errno.h b/Ubiquitous/XiZi/lib/musllib/include/errno.h new file mode 100644 index 000000000..0361b33ad --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/errno.h @@ -0,0 +1,27 @@ +#ifndef _ERRNO_H +#define _ERRNO_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#include + +#ifdef __GNUC__ +__attribute__((const)) +#endif +int *__errno_location(void); +#define errno (*__errno_location()) + +#ifdef _GNU_SOURCE +extern char *program_invocation_short_name, *program_invocation_name; +#endif + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/Ubiquitous/XiZi/lib/musllib/include/fcntl.h b/Ubiquitous/XiZi/lib/musllib/include/fcntl.h new file mode 100644 index 000000000..b664cdc44 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/fcntl.h @@ -0,0 +1,216 @@ +#ifndef _FCNTL_H +#define _FCNTL_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#define __NEED_off_t +#define __NEED_pid_t +#define __NEED_mode_t + +#ifdef _GNU_SOURCE +#define __NEED_size_t +#define __NEED_ssize_t +#define __NEED_struct_iovec +#endif + +#include + +#include + +struct flock { + short l_type; + short l_whence; + off_t l_start; + off_t l_len; + pid_t l_pid; +}; + +int creat(const char *, mode_t); +int fcntl(int, int, ...); +int open(const char *, int, ...); +int openat(int, const char *, int, ...); +int posix_fadvise(int, off_t, off_t, int); +int posix_fallocate(int, off_t, off_t); + +#define O_SEARCH O_PATH +#define O_EXEC O_PATH +#define O_TTY_INIT 0 + +#define O_ACCMODE (03|O_SEARCH) +#define O_RDONLY 00 +#define O_WRONLY 01 +#define O_RDWR 02 + +#define F_OFD_GETLK 36 +#define F_OFD_SETLK 37 +#define F_OFD_SETLKW 38 + +#define F_DUPFD_CLOEXEC 1030 + +#define F_RDLCK 0 +#define F_WRLCK 1 +#define F_UNLCK 2 + +#define FD_CLOEXEC 1 + +#define AT_FDCWD (-100) +#define AT_SYMLINK_NOFOLLOW 0x100 +#define AT_REMOVEDIR 0x200 +#define AT_SYMLINK_FOLLOW 0x400 +#define AT_EACCESS 0x200 + +#define POSIX_FADV_NORMAL 0 +#define POSIX_FADV_RANDOM 1 +#define POSIX_FADV_SEQUENTIAL 2 +#define POSIX_FADV_WILLNEED 3 +#ifndef POSIX_FADV_DONTNEED +#define POSIX_FADV_DONTNEED 4 +#define POSIX_FADV_NOREUSE 5 +#endif + +#undef SEEK_SET +#undef SEEK_CUR +#undef SEEK_END +#define SEEK_SET 0 +#define SEEK_CUR 1 +#define SEEK_END 2 + +#ifndef S_IRUSR +#define S_ISUID 04000 +#define S_ISGID 02000 +#define S_ISVTX 01000 +#define S_IRUSR 0400 +#define S_IWUSR 0200 +#define S_IXUSR 0100 +#define S_IRWXU 0700 +#define S_IRGRP 0040 +#define S_IWGRP 0020 +#define S_IXGRP 0010 +#define S_IRWXG 0070 +#define S_IROTH 0004 +#define S_IWOTH 0002 +#define S_IXOTH 0001 +#define S_IRWXO 0007 +#endif + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +#define AT_NO_AUTOMOUNT 0x800 +#define AT_EMPTY_PATH 0x1000 +#define AT_STATX_SYNC_TYPE 0x6000 +#define AT_STATX_SYNC_AS_STAT 0x0000 +#define AT_STATX_FORCE_SYNC 0x2000 +#define AT_STATX_DONT_SYNC 0x4000 +#define AT_RECURSIVE 0x8000 + +#define FAPPEND O_APPEND +#define FFSYNC O_SYNC +#define FASYNC O_ASYNC +#define FNONBLOCK O_NONBLOCK +#define FNDELAY O_NDELAY + +#define F_OK 0 +#define R_OK 4 +#define W_OK 2 +#define X_OK 1 +#define F_ULOCK 0 +#define F_LOCK 1 +#define F_TLOCK 2 +#define F_TEST 3 + +#define F_SETLEASE 1024 +#define F_GETLEASE 1025 +#define F_NOTIFY 1026 +#define F_CANCELLK 1029 +#define F_SETPIPE_SZ 1031 +#define F_GETPIPE_SZ 1032 +#define F_ADD_SEALS 1033 +#define F_GET_SEALS 1034 + +#define F_SEAL_SEAL 0x0001 +#define F_SEAL_SHRINK 0x0002 +#define F_SEAL_GROW 0x0004 +#define F_SEAL_WRITE 0x0008 +#define F_SEAL_FUTURE_WRITE 0x0010 + +#define F_GET_RW_HINT 1035 +#define F_SET_RW_HINT 1036 +#define F_GET_FILE_RW_HINT 1037 +#define F_SET_FILE_RW_HINT 1038 + +#define RWF_WRITE_LIFE_NOT_SET 0 +#define RWH_WRITE_LIFE_NONE 1 +#define RWH_WRITE_LIFE_SHORT 2 +#define RWH_WRITE_LIFE_MEDIUM 3 +#define RWH_WRITE_LIFE_LONG 4 +#define RWH_WRITE_LIFE_EXTREME 5 + +#define DN_ACCESS 0x00000001 +#define DN_MODIFY 0x00000002 +#define DN_CREATE 0x00000004 +#define DN_DELETE 0x00000008 +#define DN_RENAME 0x00000010 +#define DN_ATTRIB 0x00000020 +#define DN_MULTISHOT 0x80000000 + +int lockf(int, int, off_t); +#endif + +#if defined(_GNU_SOURCE) +#define F_OWNER_TID 0 +#define F_OWNER_PID 1 +#define F_OWNER_PGRP 2 +#define F_OWNER_GID 2 +struct file_handle { + unsigned handle_bytes; + int handle_type; + unsigned char f_handle[]; +}; +struct f_owner_ex { + int type; + pid_t pid; +}; +#define FALLOC_FL_KEEP_SIZE 1 +#define FALLOC_FL_PUNCH_HOLE 2 +#define MAX_HANDLE_SZ 128 +#define SYNC_FILE_RANGE_WAIT_BEFORE 1 +#define SYNC_FILE_RANGE_WRITE 2 +#define SYNC_FILE_RANGE_WAIT_AFTER 4 +#define SPLICE_F_MOVE 1 +#define SPLICE_F_NONBLOCK 2 +#define SPLICE_F_MORE 4 +#define SPLICE_F_GIFT 8 +int fallocate(int, int, off_t, off_t); +#define fallocate64 fallocate +int name_to_handle_at(int, const char *, struct file_handle *, int *, int); +int open_by_handle_at(int, struct file_handle *, int); +ssize_t readahead(int, off_t, size_t); +int sync_file_range(int, off_t, off_t, unsigned); +ssize_t vmsplice(int, const struct iovec *, size_t, unsigned); +ssize_t splice(int, off_t *, int, off_t *, size_t, unsigned); +ssize_t tee(int, int, size_t, unsigned); +#define loff_t off_t +#endif + +#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE) +#define F_GETLK64 F_GETLK +#define F_SETLK64 F_SETLK +#define F_SETLKW64 F_SETLKW +#define flock64 flock +#define open64 open +#define openat64 openat +#define creat64 creat +#define lockf64 lockf +#define posix_fadvise64 posix_fadvise +#define posix_fallocate64 posix_fallocate +#define off64_t off_t +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/features.h b/Ubiquitous/XiZi/lib/musllib/include/features.h new file mode 100644 index 000000000..b5fd3184e --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/features.h @@ -0,0 +1,46 @@ +#ifndef _FEATURES_H +#define _FEATURES_H + +#if defined(_ALL_SOURCE) && !defined(_GNU_SOURCE) +#define _GNU_SOURCE 1 +#endif + +#if defined(_DEFAULT_SOURCE) && !defined(_BSD_SOURCE) +#define _BSD_SOURCE 1 +#endif + +#if !defined(_POSIX_SOURCE) && !defined(_POSIX_C_SOURCE) \ + && !defined(_XOPEN_SOURCE) && !defined(_GNU_SOURCE) \ + && !defined(_BSD_SOURCE) && !defined(__STRICT_ANSI__) +#define _BSD_SOURCE 1 +#define _XOPEN_SOURCE 700 +#endif + +#if __STDC_VERSION__ >= 199901L && !defined(__cplusplus) +#define __restrict restrict +#elif !defined(__GNUC__) +#define __restrict +#endif + +#if __STDC_VERSION__ >= 199901L || defined(__cplusplus) +#define __inline inline +#elif !defined(__GNUC__) +#define __inline +#endif + +#if defined(__cplusplus) +#if __cplusplus >= 201103L +#define _Noreturn [[ noreturn ]] +#else +#define _Noreturn +#endif +#elif __STDC_VERSION__ >= 201112L +#elif defined(__GNUC__) +#define _Noreturn __attribute__((__noreturn__)) +#else +#define _Noreturn +#endif + +#define __REDIR(x,y) __typeof__(x) x __asm__(#y) + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/fenv.h b/Ubiquitous/XiZi/lib/musllib/include/fenv.h new file mode 100644 index 000000000..39bb3aba2 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/fenv.h @@ -0,0 +1,29 @@ +#ifndef _FENV_H +#define _FENV_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +int feclearexcept(int); +int fegetexceptflag(fexcept_t *, int); +int feraiseexcept(int); +int fesetexceptflag(const fexcept_t *, int); +int fetestexcept(int); + +int fegetround(void); +int fesetround(int); + +int fegetenv(fenv_t *); +int feholdexcept(fenv_t *); +int fesetenv(const fenv_t *); +int feupdateenv(const fenv_t *); + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/Ubiquitous/XiZi/lib/musllib/include/float.h b/Ubiquitous/XiZi/lib/musllib/include/float.h new file mode 100644 index 000000000..713aadb90 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/float.h @@ -0,0 +1,52 @@ +#ifndef _FLOAT_H +#define _FLOAT_H + +#ifdef __cplusplus +extern "C" { +#endif + +int __flt_rounds(void); +#define FLT_ROUNDS (__flt_rounds()) + +#define FLT_RADIX 2 + +#define FLT_TRUE_MIN 1.40129846432481707092e-45F +#define FLT_MIN 1.17549435082228750797e-38F +#define FLT_MAX 3.40282346638528859812e+38F +#define FLT_EPSILON 1.1920928955078125e-07F + +#define FLT_MANT_DIG 24 +#define FLT_MIN_EXP (-125) +#define FLT_MAX_EXP 128 +#define FLT_HAS_SUBNORM 1 + +#define FLT_DIG 6 +#define FLT_DECIMAL_DIG 9 +#define FLT_MIN_10_EXP (-37) +#define FLT_MAX_10_EXP 38 + +#define DBL_TRUE_MIN 4.94065645841246544177e-324 +#define DBL_MIN 2.22507385850720138309e-308 +#define DBL_MAX 1.79769313486231570815e+308 +#define DBL_EPSILON 2.22044604925031308085e-16 + +#define DBL_MANT_DIG 53 +#define DBL_MIN_EXP (-1021) +#define DBL_MAX_EXP 1024 +#define DBL_HAS_SUBNORM 1 + +#define DBL_DIG 15 +#define DBL_DECIMAL_DIG 17 +#define DBL_MIN_10_EXP (-307) +#define DBL_MAX_10_EXP 308 + +#define LDBL_HAS_SUBNORM 1 +#define LDBL_DECIMAL_DIG DECIMAL_DIG + +#include + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/fmtmsg.h b/Ubiquitous/XiZi/lib/musllib/include/fmtmsg.h new file mode 100644 index 000000000..d944b06f8 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/fmtmsg.h @@ -0,0 +1,47 @@ +#ifndef _FMTMSG_H +#define _FMTMSG_H + +#ifdef __cplusplus +extern "C" { +#endif + +#define MM_HARD 1 +#define MM_SOFT 2 +#define MM_FIRM 4 + +#define MM_APPL 8 +#define MM_UTIL 16 +#define MM_OPSYS 32 + +#define MM_RECOVER 64 +#define MM_NRECOV 128 + +#define MM_PRINT 256 +#define MM_CONSOLE 512 + +#define MM_NULLMC 0L + +#define MM_HALT 1 +#define MM_ERROR 2 +#define MM_WARNING 3 +#define MM_INFO 4 +#define MM_NOSEV 0 + +#define MM_OK 0 +#define MM_NOTOK (-1) +#define MM_NOMSG 1 +#define MM_NOCON 4 + +#define MM_NULLLBL ((char*)0) +#define MM_NULLTXT ((char*)0) +#define MM_NULLACT ((char*)0) +#define MM_NULLTAG ((char*)0) +#define MM_NULLSEV 0 + +int fmtmsg(long, const char *, int, const char *, const char *, const char *); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/fnmatch.h b/Ubiquitous/XiZi/lib/musllib/include/fnmatch.h new file mode 100644 index 000000000..f9593217f --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/fnmatch.h @@ -0,0 +1,24 @@ +#ifndef _FNMATCH_H +#define _FNMATCH_H + +#ifdef __cplusplus +extern "C" { +#endif + +#define FNM_PATHNAME 0x1 +#define FNM_NOESCAPE 0x2 +#define FNM_PERIOD 0x4 +#define FNM_LEADING_DIR 0x8 +#define FNM_CASEFOLD 0x10 +#define FNM_FILE_NAME FNM_PATHNAME + +#define FNM_NOMATCH 1 +#define FNM_NOSYS (-1) + +int fnmatch(const char *, const char *, int); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/ftw.h b/Ubiquitous/XiZi/lib/musllib/include/ftw.h new file mode 100644 index 000000000..b15c062a8 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/ftw.h @@ -0,0 +1,41 @@ +#ifndef _FTW_H +#define _FTW_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +#define FTW_F 1 +#define FTW_D 2 +#define FTW_DNR 3 +#define FTW_NS 4 +#define FTW_SL 5 +#define FTW_DP 6 +#define FTW_SLN 7 + +#define FTW_PHYS 1 +#define FTW_MOUNT 2 +#define FTW_CHDIR 4 +#define FTW_DEPTH 8 + +struct FTW { + int base; + int level; +}; + +int ftw(const char *, int (*)(const char *, const struct stat *, int), int); +int nftw(const char *, int (*)(const char *, const struct stat *, int, struct FTW *), int, int); + +#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE) +#define ftw64 ftw +#define nftw64 nftw +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/getopt.h b/Ubiquitous/XiZi/lib/musllib/include/getopt.h new file mode 100644 index 000000000..35cbd358b --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/getopt.h @@ -0,0 +1,30 @@ +#ifndef _GETOPT_H +#define _GETOPT_H + +#ifdef __cplusplus +extern "C" { +#endif + +int getopt(int, char * const [], const char *); +extern char *optarg; +extern int optind, opterr, optopt, optreset; + +struct option { + const char *name; + int has_arg; + int *flag; + int val; +}; + +int getopt_long(int, char *const *, const char *, const struct option *, int *); +int getopt_long_only(int, char *const *, const char *, const struct option *, int *); + +#define no_argument 0 +#define required_argument 1 +#define optional_argument 2 + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/glob.h b/Ubiquitous/XiZi/lib/musllib/include/glob.h new file mode 100644 index 000000000..4a562a206 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/glob.h @@ -0,0 +1,52 @@ +#ifndef _GLOB_H +#define _GLOB_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#define __NEED_size_t + +#include + +typedef struct { + size_t gl_pathc; + char **gl_pathv; + size_t gl_offs; + int __dummy1; + void *__dummy2[5]; +} glob_t; + +int glob(const char *__restrict, int, int (*)(const char *, int), glob_t *__restrict); +void globfree(glob_t *); + +#define GLOB_ERR 0x01 +#define GLOB_MARK 0x02 +#define GLOB_NOSORT 0x04 +#define GLOB_DOOFFS 0x08 +#define GLOB_NOCHECK 0x10 +#define GLOB_APPEND 0x20 +#define GLOB_NOESCAPE 0x40 +#define GLOB_PERIOD 0x80 + +#define GLOB_TILDE 0x1000 +#define GLOB_TILDE_CHECK 0x4000 + +#define GLOB_NOSPACE 1 +#define GLOB_ABORTED 2 +#define GLOB_NOMATCH 3 +#define GLOB_NOSYS 4 + +#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE) +#define glob64 glob +#define globfree64 globfree +#define glob64_t glob_t +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/grp.h b/Ubiquitous/XiZi/lib/musllib/include/grp.h new file mode 100644 index 000000000..27e8c5e6c --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/grp.h @@ -0,0 +1,53 @@ +#ifndef _GRP_H +#define _GRP_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#define __NEED_size_t +#define __NEED_gid_t + +#ifdef _GNU_SOURCE +#define __NEED_FILE +#endif + +#include + +struct group { + char *gr_name; + char *gr_passwd; + gid_t gr_gid; + char **gr_mem; +}; + +struct group *getgrgid(gid_t); +struct group *getgrnam(const char *); + +int getgrgid_r(gid_t, struct group *, char *, size_t, struct group **); +int getgrnam_r(const char *, struct group *, char *, size_t, struct group **); + +#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +struct group *getgrent(void); +void endgrent(void); +void setgrent(void); +#endif + +#ifdef _GNU_SOURCE +struct group *fgetgrent(FILE *); +int putgrent(const struct group *, FILE *); +#endif + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +int getgrouplist(const char *, gid_t, gid_t *, int *); +int setgroups(size_t, const gid_t *); +int initgroups(const char *, gid_t); +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/iconv.h b/Ubiquitous/XiZi/lib/musllib/include/iconv.h new file mode 100644 index 000000000..ebe9bfda3 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/iconv.h @@ -0,0 +1,24 @@ +#ifndef _ICONV_H +#define _ICONV_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#define __NEED_size_t + +#include + +typedef void *iconv_t; + +iconv_t iconv_open(const char *, const char *); +size_t iconv(iconv_t, char **__restrict, size_t *__restrict, char **__restrict, size_t *__restrict); +int iconv_close(iconv_t); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/ifaddrs.h b/Ubiquitous/XiZi/lib/musllib/include/ifaddrs.h new file mode 100644 index 000000000..c0328a8ea --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/ifaddrs.h @@ -0,0 +1,35 @@ +#ifndef _IFADDRS_H +#define _IFADDRS_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include + +struct ifaddrs { + struct ifaddrs *ifa_next; + char *ifa_name; + unsigned ifa_flags; + struct sockaddr *ifa_addr; + struct sockaddr *ifa_netmask; + union { + struct sockaddr *ifu_broadaddr; + struct sockaddr *ifu_dstaddr; + } ifa_ifu; + void *ifa_data; +}; +#define ifa_broadaddr ifa_ifu.ifu_broadaddr +#define ifa_dstaddr ifa_ifu.ifu_dstaddr + +void freeifaddrs(struct ifaddrs *); +int getifaddrs(struct ifaddrs **); + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/Ubiquitous/XiZi/lib/musllib/include/inttypes.h b/Ubiquitous/XiZi/lib/musllib/include/inttypes.h new file mode 100644 index 000000000..61dcb7273 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/inttypes.h @@ -0,0 +1,229 @@ +#ifndef _INTTYPES_H +#define _INTTYPES_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +#define __NEED_wchar_t +#include + +typedef struct { intmax_t quot, rem; } imaxdiv_t; + +intmax_t imaxabs(intmax_t); +imaxdiv_t imaxdiv(intmax_t, intmax_t); + +intmax_t strtoimax(const char *__restrict, char **__restrict, int); +uintmax_t strtoumax(const char *__restrict, char **__restrict, int); + +intmax_t wcstoimax(const wchar_t *__restrict, wchar_t **__restrict, int); +uintmax_t wcstoumax(const wchar_t *__restrict, wchar_t **__restrict, int); + +#if UINTPTR_MAX == UINT64_MAX +#define __PRI64 "l" +#define __PRIPTR "l" +#else +#define __PRI64 "ll" +#define __PRIPTR "" +#endif + +#define PRId8 "d" +#define PRId16 "d" +#define PRId32 "d" +#define PRId64 __PRI64 "d" + +#define PRIdLEAST8 "d" +#define PRIdLEAST16 "d" +#define PRIdLEAST32 "d" +#define PRIdLEAST64 __PRI64 "d" + +#define PRIdFAST8 "d" +#define PRIdFAST16 "d" +#define PRIdFAST32 "d" +#define PRIdFAST64 __PRI64 "d" + +#define PRIi8 "i" +#define PRIi16 "i" +#define PRIi32 "i" +#define PRIi64 __PRI64 "i" + +#define PRIiLEAST8 "i" +#define PRIiLEAST16 "i" +#define PRIiLEAST32 "i" +#define PRIiLEAST64 __PRI64 "i" + +#define PRIiFAST8 "i" +#define PRIiFAST16 "i" +#define PRIiFAST32 "i" +#define PRIiFAST64 __PRI64 "i" + +#define PRIo8 "o" +#define PRIo16 "o" +#define PRIo32 "o" +#define PRIo64 __PRI64 "o" + +#define PRIoLEAST8 "o" +#define PRIoLEAST16 "o" +#define PRIoLEAST32 "o" +#define PRIoLEAST64 __PRI64 "o" + +#define PRIoFAST8 "o" +#define PRIoFAST16 "o" +#define PRIoFAST32 "o" +#define PRIoFAST64 __PRI64 "o" + +#define PRIu8 "u" +#define PRIu16 "u" +#define PRIu32 "u" +#define PRIu64 __PRI64 "u" + +#define PRIuLEAST8 "u" +#define PRIuLEAST16 "u" +#define PRIuLEAST32 "u" +#define PRIuLEAST64 __PRI64 "u" + +#define PRIuFAST8 "u" +#define PRIuFAST16 "u" +#define PRIuFAST32 "u" +#define PRIuFAST64 __PRI64 "u" + +#define PRIx8 "x" +#define PRIx16 "x" +#define PRIx32 "x" +#define PRIx64 __PRI64 "x" + +#define PRIxLEAST8 "x" +#define PRIxLEAST16 "x" +#define PRIxLEAST32 "x" +#define PRIxLEAST64 __PRI64 "x" + +#define PRIxFAST8 "x" +#define PRIxFAST16 "x" +#define PRIxFAST32 "x" +#define PRIxFAST64 __PRI64 "x" + +#define PRIX8 "X" +#define PRIX16 "X" +#define PRIX32 "X" +#define PRIX64 __PRI64 "X" + +#define PRIXLEAST8 "X" +#define PRIXLEAST16 "X" +#define PRIXLEAST32 "X" +#define PRIXLEAST64 __PRI64 "X" + +#define PRIXFAST8 "X" +#define PRIXFAST16 "X" +#define PRIXFAST32 "X" +#define PRIXFAST64 __PRI64 "X" + +#define PRIdMAX __PRI64 "d" +#define PRIiMAX __PRI64 "i" +#define PRIoMAX __PRI64 "o" +#define PRIuMAX __PRI64 "u" +#define PRIxMAX __PRI64 "x" +#define PRIXMAX __PRI64 "X" + +#define PRIdPTR __PRIPTR "d" +#define PRIiPTR __PRIPTR "i" +#define PRIoPTR __PRIPTR "o" +#define PRIuPTR __PRIPTR "u" +#define PRIxPTR __PRIPTR "x" +#define PRIXPTR __PRIPTR "X" + +#define SCNd8 "hhd" +#define SCNd16 "hd" +#define SCNd32 "d" +#define SCNd64 __PRI64 "d" + +#define SCNdLEAST8 "hhd" +#define SCNdLEAST16 "hd" +#define SCNdLEAST32 "d" +#define SCNdLEAST64 __PRI64 "d" + +#define SCNdFAST8 "hhd" +#define SCNdFAST16 "d" +#define SCNdFAST32 "d" +#define SCNdFAST64 __PRI64 "d" + +#define SCNi8 "hhi" +#define SCNi16 "hi" +#define SCNi32 "i" +#define SCNi64 __PRI64 "i" + +#define SCNiLEAST8 "hhi" +#define SCNiLEAST16 "hi" +#define SCNiLEAST32 "i" +#define SCNiLEAST64 __PRI64 "i" + +#define SCNiFAST8 "hhi" +#define SCNiFAST16 "i" +#define SCNiFAST32 "i" +#define SCNiFAST64 __PRI64 "i" + +#define SCNu8 "hhu" +#define SCNu16 "hu" +#define SCNu32 "u" +#define SCNu64 __PRI64 "u" + +#define SCNuLEAST8 "hhu" +#define SCNuLEAST16 "hu" +#define SCNuLEAST32 "u" +#define SCNuLEAST64 __PRI64 "u" + +#define SCNuFAST8 "hhu" +#define SCNuFAST16 "u" +#define SCNuFAST32 "u" +#define SCNuFAST64 __PRI64 "u" + +#define SCNo8 "hho" +#define SCNo16 "ho" +#define SCNo32 "o" +#define SCNo64 __PRI64 "o" + +#define SCNoLEAST8 "hho" +#define SCNoLEAST16 "ho" +#define SCNoLEAST32 "o" +#define SCNoLEAST64 __PRI64 "o" + +#define SCNoFAST8 "hho" +#define SCNoFAST16 "o" +#define SCNoFAST32 "o" +#define SCNoFAST64 __PRI64 "o" + +#define SCNx8 "hhx" +#define SCNx16 "hx" +#define SCNx32 "x" +#define SCNx64 __PRI64 "x" + +#define SCNxLEAST8 "hhx" +#define SCNxLEAST16 "hx" +#define SCNxLEAST32 "x" +#define SCNxLEAST64 __PRI64 "x" + +#define SCNxFAST8 "hhx" +#define SCNxFAST16 "x" +#define SCNxFAST32 "x" +#define SCNxFAST64 __PRI64 "x" + +#define SCNdMAX __PRI64 "d" +#define SCNiMAX __PRI64 "i" +#define SCNoMAX __PRI64 "o" +#define SCNuMAX __PRI64 "u" +#define SCNxMAX __PRI64 "x" + +#define SCNdPTR __PRIPTR "d" +#define SCNiPTR __PRIPTR "i" +#define SCNoPTR __PRIPTR "o" +#define SCNuPTR __PRIPTR "u" +#define SCNxPTR __PRIPTR "x" + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/Ubiquitous/XiZi/lib/musllib/include/iso646.h b/Ubiquitous/XiZi/lib/musllib/include/iso646.h new file mode 100644 index 000000000..88ff53d7b --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/iso646.h @@ -0,0 +1,20 @@ +#ifndef _ISO646_H +#define _ISO646_H + +#ifndef __cplusplus + +#define and && +#define and_eq &= +#define bitand & +#define bitor | +#define compl ~ +#define not ! +#define not_eq != +#define or || +#define or_eq |= +#define xor ^ +#define xor_eq ^= + +#endif + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/langinfo.h b/Ubiquitous/XiZi/lib/musllib/include/langinfo.h new file mode 100644 index 000000000..519c06129 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/langinfo.h @@ -0,0 +1,98 @@ +#ifndef _LANGINFO_H +#define _LANGINFO_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +#define __NEED_locale_t + +#include + +#define ABDAY_1 0x20000 +#define ABDAY_2 0x20001 +#define ABDAY_3 0x20002 +#define ABDAY_4 0x20003 +#define ABDAY_5 0x20004 +#define ABDAY_6 0x20005 +#define ABDAY_7 0x20006 + +#define DAY_1 0x20007 +#define DAY_2 0x20008 +#define DAY_3 0x20009 +#define DAY_4 0x2000A +#define DAY_5 0x2000B +#define DAY_6 0x2000C +#define DAY_7 0x2000D + +#define ABMON_1 0x2000E +#define ABMON_2 0x2000F +#define ABMON_3 0x20010 +#define ABMON_4 0x20011 +#define ABMON_5 0x20012 +#define ABMON_6 0x20013 +#define ABMON_7 0x20014 +#define ABMON_8 0x20015 +#define ABMON_9 0x20016 +#define ABMON_10 0x20017 +#define ABMON_11 0x20018 +#define ABMON_12 0x20019 + +#define MON_1 0x2001A +#define MON_2 0x2001B +#define MON_3 0x2001C +#define MON_4 0x2001D +#define MON_5 0x2001E +#define MON_6 0x2001F +#define MON_7 0x20020 +#define MON_8 0x20021 +#define MON_9 0x20022 +#define MON_10 0x20023 +#define MON_11 0x20024 +#define MON_12 0x20025 + +#define AM_STR 0x20026 +#define PM_STR 0x20027 + +#define D_T_FMT 0x20028 +#define D_FMT 0x20029 +#define T_FMT 0x2002A +#define T_FMT_AMPM 0x2002B + +#define ERA 0x2002C +#define ERA_D_FMT 0x2002E +#define ALT_DIGITS 0x2002F +#define ERA_D_T_FMT 0x20030 +#define ERA_T_FMT 0x20031 + +#define CODESET 14 + +#define CRNCYSTR 0x4000F + +#define RADIXCHAR 0x10000 +#define THOUSEP 0x10001 +#define YESEXPR 0x50000 +#define NOEXPR 0x50001 + +#define _NL_LOCALE_NAME(cat) (((cat)<<16) | 0xffff) + +#if defined(_GNU_SOURCE) +#define NL_LOCALE_NAME(cat) _NL_LOCALE_NAME(cat) +#endif + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +#define YESSTR 0x50002 +#define NOSTR 0x50003 +#endif + +char *nl_langinfo(nl_item); +char *nl_langinfo_l(nl_item, locale_t); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/lastlog.h b/Ubiquitous/XiZi/lib/musllib/include/lastlog.h new file mode 100644 index 000000000..5fa45ee47 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/lastlog.h @@ -0,0 +1 @@ +#include diff --git a/Ubiquitous/XiZi/lib/musllib/include/libgen.h b/Ubiquitous/XiZi/lib/musllib/include/libgen.h new file mode 100644 index 000000000..7c7fd9c6d --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/libgen.h @@ -0,0 +1,15 @@ +#ifndef _LIBGEN_H +#define _LIBGEN_H + +#ifdef __cplusplus +extern "C" { +#endif + +char *dirname(char *); +char *basename(char *); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/libintl.h b/Ubiquitous/XiZi/lib/musllib/include/libintl.h new file mode 100644 index 000000000..6a707bf0f --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/libintl.h @@ -0,0 +1,33 @@ +#ifndef _LIBINTL_H +#define _LIBINTL_H + +#ifdef __cplusplus +extern "C" { +#endif + +#define __USE_GNU_GETTEXT 1 +#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 1 : -1) + +#if __GNUC__ >= 3 +#define __fa(n) __attribute__ ((__format_arg__ (n))) +#else +#define __fa(n) +#endif + +char *gettext(const char *) __fa(1); +char *dgettext(const char *, const char *) __fa(2); +char *dcgettext(const char *, const char *, int) __fa(2); +char *ngettext(const char *, const char *, unsigned long) __fa(1) __fa(2); +char *dngettext(const char *, const char *, const char *, unsigned long) __fa(2) __fa(3); +char *dcngettext(const char *, const char *, const char *, unsigned long, int) __fa(2) __fa(3); +char *textdomain(const char *); +char *bindtextdomain (const char *, const char *); +char *bind_textdomain_codeset(const char *, const char *); + +#undef __fa + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/limits.h b/Ubiquitous/XiZi/lib/musllib/include/limits.h new file mode 100644 index 000000000..6c9851ee6 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/limits.h @@ -0,0 +1,168 @@ +#ifndef _LIMITS_H +#define _LIMITS_H + +// #include "xizi.h" + +#include + +#include /* __LONG_MAX */ + +/* Support signed or unsigned plain-char */ + +#if '\xff' > 0 +#define CHAR_MIN 0 +#define CHAR_MAX 255 +#else +#define CHAR_MIN (-128) +#define CHAR_MAX 127 +#endif + +#define CHAR_BIT 8 +#define SCHAR_MIN (-128) +#define SCHAR_MAX 127 +#define UCHAR_MAX 255 +#define SHRT_MIN (-1-0x7fff) +#define SHRT_MAX 0x7fff +#define USHRT_MAX 0xffff +#define INT_MIN (-1-0x7fffffff) +#define INT_MAX 0x7fffffff +#define UINT_MAX 0xffffffffU +#define LONG_MIN (-LONG_MAX-1) +#define LONG_MAX __LONG_MAX +#define ULONG_MAX (2UL*LONG_MAX+1) +#define LLONG_MIN (-LLONG_MAX-1) +#define LLONG_MAX 0x7fffffffffffffffLL +#define ULLONG_MAX (2ULL*LLONG_MAX+1) + +#define MB_LEN_MAX 4 + +#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \ + || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) + +#include + +#define PIPE_BUF 4096 +#define FILESIZEBITS 64 +#ifndef NAME_MAX +#define NAME_MAX 255 +#endif +#define PATH_MAX 256 +#define NGROUPS_MAX 32 +#define ARG_MAX 131072 +#define IOV_MAX 1024 +#define SYMLOOP_MAX 40 +#define WORD_BIT 32 +#define SSIZE_MAX LONG_MAX +#define TZNAME_MAX 6 +#define TTY_NAME_MAX 32 +#define HOST_NAME_MAX 255 + +#if LONG_MAX == 0x7fffffffL +#define LONG_BIT 32 +#else +#define LONG_BIT 64 +#endif + +/* Implementation choices... */ + +#define PTHREAD_KEYS_MAX 128 +#define PTHREAD_STACK_MIN LOSCFG_BASE_CORE_TSK_MIN_STACK_SIZE +#define PTHREAD_DESTRUCTOR_ITERATIONS 4 +#define SEM_VALUE_MAX OS_SEM_COUNTING_MAX_COUNT +#define SEM_NSEMS_MAX LOSCFG_BASE_IPC_SEM_LIMIT +#define DELAYTIMER_MAX 32 +#define MQ_PRIO_MAX 1 +#define LOGIN_NAME_MAX 256 + +/* Arbitrary numbers... */ + +#define BC_BASE_MAX 99 +#define BC_DIM_MAX 2048 +#define BC_SCALE_MAX 99 +#define BC_STRING_MAX 1000 +#define CHARCLASS_NAME_MAX 14 +#define COLL_WEIGHTS_MAX 2 +#define EXPR_NEST_MAX 32 +#define LINE_MAX 4096 +#define RE_DUP_MAX 255 + +#define NL_ARGMAX 9 +#define NL_MSGMAX 32767 +#define NL_SETMAX 255 +#define NL_TEXTMAX 2048 + +#endif + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) || defined(_XOPEN_SOURCE) + +#ifdef PAGESIZE +#define PAGE_SIZE PAGESIZE +#endif +#define NZERO 20 +#define NL_LANGMAX 32 + +#endif + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) \ + || (defined(_XOPEN_SOURCE) && _XOPEN_SOURCE+0 < 700) + +#define NL_NMAX 16 + +#endif + +/* POSIX/SUS requirements follow. These numbers come directly + * from SUS and have nothing to do with the host system. */ + +#define _POSIX_AIO_LISTIO_MAX 2 +#define _POSIX_AIO_MAX 1 +#define _POSIX_ARG_MAX 4096 +#define _POSIX_CHILD_MAX 25 +#define _POSIX_CLOCKRES_MIN 20000000 +#define _POSIX_DELAYTIMER_MAX 32 +#define _POSIX_HOST_NAME_MAX 255 +#define _POSIX_LINK_MAX 8 +#define _POSIX_LOGIN_NAME_MAX 9 +#define _POSIX_MAX_CANON 255 +#define _POSIX_MAX_INPUT 255 +#define _POSIX_MQ_OPEN_MAX 8 +#define _POSIX_MQ_PRIO_MAX 32 +#define _POSIX_NAME_MAX 14 +#define _POSIX_NGROUPS_MAX 8 +#define _POSIX_OPEN_MAX 20 +#define _POSIX_PATH_MAX 256 +#define _POSIX_PIPE_BUF 512 +#define _POSIX_RE_DUP_MAX 255 +#define _POSIX_RTSIG_MAX 8 +#define _POSIX_SEM_NSEMS_MAX 256 +#define _POSIX_SEM_VALUE_MAX 32767 +#define _POSIX_SIGQUEUE_MAX 32 +#define _POSIX_SSIZE_MAX 32767 +#define _POSIX_STREAM_MAX 8 +#define _POSIX_SS_REPL_MAX 4 +#define _POSIX_SYMLINK_MAX 255 +#define _POSIX_SYMLOOP_MAX 8 +#define _POSIX_THREAD_DESTRUCTOR_ITERATIONS 4 +#define _POSIX_THREAD_KEYS_MAX 128 +#define _POSIX_THREAD_THREADS_MAX 64 +#define _POSIX_TIMER_MAX 32 +#define _POSIX_TRACE_EVENT_NAME_MAX 30 +#define _POSIX_TRACE_NAME_MAX 8 +#define _POSIX_TRACE_SYS_MAX 8 +#define _POSIX_TRACE_USER_EVENT_MAX 32 +#define _POSIX_TTY_NAME_MAX 9 +#define _POSIX_TZNAME_MAX 6 +#define _POSIX2_BC_BASE_MAX 99 +#define _POSIX2_BC_DIM_MAX 2048 +#define _POSIX2_BC_SCALE_MAX 99 +#define _POSIX2_BC_STRING_MAX 1000 +#define _POSIX2_CHARCLASS_NAME_MAX 14 +#define _POSIX2_COLL_WEIGHTS_MAX 2 +#define _POSIX2_EXPR_NEST_MAX 32 +#define _POSIX2_LINE_MAX 2048 +#define _POSIX2_RE_DUP_MAX 255 + +#define _XOPEN_IOV_MAX 16 +#define _XOPEN_NAME_MAX 255 +#define _XOPEN_PATH_MAX 1024 + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/link.h b/Ubiquitous/XiZi/lib/musllib/include/link.h new file mode 100644 index 000000000..815018594 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/link.h @@ -0,0 +1,53 @@ +#ifndef _LINK_H +#define _LINK_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#define __NEED_size_t +#define __NEED_uint32_t +#include + +#if UINTPTR_MAX > 0xffffffff +#define ElfW(type) Elf64_ ## type +#else +#define ElfW(type) Elf32_ ## type +#endif + +#include + +struct dl_phdr_info { + ElfW(Addr) dlpi_addr; + const char *dlpi_name; + const ElfW(Phdr) *dlpi_phdr; + ElfW(Half) dlpi_phnum; + unsigned long long int dlpi_adds; + unsigned long long int dlpi_subs; + size_t dlpi_tls_modid; + void *dlpi_tls_data; +}; + +struct link_map { + ElfW(Addr) l_addr; + char *l_name; + ElfW(Dyn) *l_ld; + struct link_map *l_next, *l_prev; +}; + +struct r_debug { + int r_version; + struct link_map *r_map; + ElfW(Addr) r_brk; + enum { RT_CONSISTENT, RT_ADD, RT_DELETE } r_state; + ElfW(Addr) r_ldbase; +}; + +int dl_iterate_phdr(int (*)(struct dl_phdr_info *, size_t, void *), void *); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/locale.h b/Ubiquitous/XiZi/lib/musllib/include/locale.h new file mode 100644 index 000000000..ce384381c --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/locale.h @@ -0,0 +1,86 @@ +#ifndef _LOCALE_H +#define _LOCALE_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#ifdef __cplusplus +#define NULL 0L +#else +#define NULL ((void*)0) +#endif + +#define LC_CTYPE 0 +#define LC_NUMERIC 1 +#define LC_TIME 2 +#define LC_COLLATE 3 +#define LC_MONETARY 4 +#define LC_MESSAGES 5 +#define LC_ALL 6 + +struct lconv { + char *decimal_point; + char *thousands_sep; + char *grouping; + + char *int_curr_symbol; + char *currency_symbol; + char *mon_decimal_point; + char *mon_thousands_sep; + char *mon_grouping; + char *positive_sign; + char *negative_sign; + char int_frac_digits; + char frac_digits; + char p_cs_precedes; + char p_sep_by_space; + char n_cs_precedes; + char n_sep_by_space; + char p_sign_posn; + char n_sign_posn; + char int_p_cs_precedes; + char int_p_sep_by_space; + char int_n_cs_precedes; + char int_n_sep_by_space; + char int_p_sign_posn; + char int_n_sign_posn; +}; + + +char *setlocale (int, const char *); +struct lconv *localeconv(void); + + +#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \ + || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) + +#define __NEED_locale_t + +#include + +#define LC_GLOBAL_LOCALE ((locale_t)-1) + +#define LC_CTYPE_MASK (1< + +void *malloc (size_t); +void *calloc (size_t, size_t); +void *realloc (void *, size_t); +void free (void *); +void *valloc (size_t); +void *memalign(size_t, size_t); + +size_t malloc_usable_size(void *); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/math.h b/Ubiquitous/XiZi/lib/musllib/include/math.h new file mode 100644 index 000000000..14f28ec8c --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/math.h @@ -0,0 +1,442 @@ +#ifndef _MATH_H +#define _MATH_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#define __NEED_float_t +#define __NEED_double_t +#include + +#if 100*__GNUC__+__GNUC_MINOR__ >= 303 +#define NAN __builtin_nanf("") +#define INFINITY __builtin_inff() +#else +#define NAN (0.0f/0.0f) +#define INFINITY 1e5000f +#endif + +#define HUGE_VALF INFINITY +#define HUGE_VAL ((double)INFINITY) +#define HUGE_VALL ((long double)INFINITY) + +#define MATH_ERRNO 1 +#define MATH_ERREXCEPT 2 +#define math_errhandling 2 + +#define FP_ILOGBNAN (-1-0x7fffffff) +#define FP_ILOGB0 FP_ILOGBNAN + +#define FP_NAN 0 +#define FP_INFINITE 1 +#define FP_ZERO 2 +#define FP_SUBNORMAL 3 +#define FP_NORMAL 4 + +#ifdef __FP_FAST_FMA +#define FP_FAST_FMA 1 +#endif + +#ifdef __FP_FAST_FMAF +#define FP_FAST_FMAF 1 +#endif + +#ifdef __FP_FAST_FMAL +#define FP_FAST_FMAL 1 +#endif + +int __fpclassify(double); +int __fpclassifyf(float); +int __fpclassifyl(long double); + +static __inline unsigned __FLOAT_BITS(float __f) +{ + union {float __f; unsigned __i;} __u; + __u.__f = __f; + return __u.__i; +} +static __inline unsigned long long __DOUBLE_BITS(double __f) +{ + union {double __f; unsigned long long __i;} __u; + __u.__f = __f; + return __u.__i; +} + +#define fpclassify(x) ( \ + sizeof(x) == sizeof(float) ? __fpclassifyf(x) : \ + sizeof(x) == sizeof(double) ? __fpclassify(x) : \ + __fpclassifyl(x) ) + +#define isinf(x) ( \ + sizeof(x) == sizeof(float) ? (__FLOAT_BITS(x) & 0x7fffffff) == 0x7f800000 : \ + sizeof(x) == sizeof(double) ? (__DOUBLE_BITS(x) & -1ULL>>1) == 0x7ffULL<<52 : \ + __fpclassifyl(x) == FP_INFINITE) + +#define isnan(x) ( \ + sizeof(x) == sizeof(float) ? (__FLOAT_BITS(x) & 0x7fffffff) > 0x7f800000 : \ + sizeof(x) == sizeof(double) ? (__DOUBLE_BITS(x) & -1ULL>>1) > 0x7ffULL<<52 : \ + __fpclassifyl(x) == FP_NAN) + +#define isnormal(x) ( \ + sizeof(x) == sizeof(float) ? ((__FLOAT_BITS(x)+0x00800000) & 0x7fffffff) >= 0x01000000 : \ + sizeof(x) == sizeof(double) ? ((__DOUBLE_BITS(x)+(1ULL<<52)) & -1ULL>>1) >= 1ULL<<53 : \ + __fpclassifyl(x) == FP_NORMAL) + +#define isfinite(x) ( \ + sizeof(x) == sizeof(float) ? (__FLOAT_BITS(x) & 0x7fffffff) < 0x7f800000 : \ + sizeof(x) == sizeof(double) ? (__DOUBLE_BITS(x) & -1ULL>>1) < 0x7ffULL<<52 : \ + __fpclassifyl(x) > FP_INFINITE) + +int __signbit(double); +int __signbitf(float); +int __signbitl(long double); + +#define signbit(x) ( \ + sizeof(x) == sizeof(float) ? (int)(__FLOAT_BITS(x)>>31) : \ + sizeof(x) == sizeof(double) ? (int)(__DOUBLE_BITS(x)>>63) : \ + __signbitl(x) ) + +#define isunordered(x,y) (isnan((x)) ? ((void)(y),1) : isnan((y))) + +#define __ISREL_DEF(rel, op, type) \ +static __inline int __is##rel(type __x, type __y) \ +{ return !isunordered(__x,__y) && __x op __y; } + +__ISREL_DEF(lessf, <, float_t) +__ISREL_DEF(less, <, double_t) +__ISREL_DEF(lessl, <, long double) +__ISREL_DEF(lessequalf, <=, float_t) +__ISREL_DEF(lessequal, <=, double_t) +__ISREL_DEF(lessequall, <=, long double) +__ISREL_DEF(lessgreaterf, !=, float_t) +__ISREL_DEF(lessgreater, !=, double_t) +__ISREL_DEF(lessgreaterl, !=, long double) +__ISREL_DEF(greaterf, >, float_t) +__ISREL_DEF(greater, >, double_t) +__ISREL_DEF(greaterl, >, long double) +__ISREL_DEF(greaterequalf, >=, float_t) +__ISREL_DEF(greaterequal, >=, double_t) +__ISREL_DEF(greaterequall, >=, long double) + +#define __tg_pred_2(x, y, p) ( \ + sizeof((x)+(y)) == sizeof(float) ? p##f(x, y) : \ + sizeof((x)+(y)) == sizeof(double) ? p(x, y) : \ + p##l(x, y) ) + +#define isless(x, y) __tg_pred_2(x, y, __isless) +#define islessequal(x, y) __tg_pred_2(x, y, __islessequal) +#define islessgreater(x, y) __tg_pred_2(x, y, __islessgreater) +#define isgreater(x, y) __tg_pred_2(x, y, __isgreater) +#define isgreaterequal(x, y) __tg_pred_2(x, y, __isgreaterequal) + +double acos(double); +float acosf(float); +long double acosl(long double); + +double acosh(double); +float acoshf(float); +long double acoshl(long double); + +double asin(double); +float asinf(float); +long double asinl(long double); + +double asinh(double); +float asinhf(float); +long double asinhl(long double); + +double atan(double); +float atanf(float); +long double atanl(long double); + +double atan2(double, double); +float atan2f(float, float); +long double atan2l(long double, long double); + +double atanh(double); +float atanhf(float); +long double atanhl(long double); + +double cbrt(double); +float cbrtf(float); +long double cbrtl(long double); + +double ceil(double); +float ceilf(float); +long double ceill(long double); + +double copysign(double, double); +float copysignf(float, float); +long double copysignl(long double, long double); + +double cos(double); +float cosf(float); +long double cosl(long double); + +double cosh(double); +float coshf(float); +long double coshl(long double); + +double erf(double); +float erff(float); +long double erfl(long double); + +double erfc(double); +float erfcf(float); +long double erfcl(long double); + +double exp(double); +float expf(float); +long double expl(long double); + +double exp2(double); +float exp2f(float); +long double exp2l(long double); + +double expm1(double); +float expm1f(float); +long double expm1l(long double); + +double fabs(double); +float fabsf(float); +long double fabsl(long double); + +double fdim(double, double); +float fdimf(float, float); +long double fdiml(long double, long double); + +double floor(double); +float floorf(float); +long double floorl(long double); + +double fma(double, double, double); +float fmaf(float, float, float); +long double fmal(long double, long double, long double); + +double fmax(double, double); +float fmaxf(float, float); +long double fmaxl(long double, long double); + +double fmin(double, double); +float fminf(float, float); +long double fminl(long double, long double); + +double fmod(double, double); +float fmodf(float, float); +long double fmodl(long double, long double); + +double frexp(double, int *); +float frexpf(float, int *); +long double frexpl(long double, int *); + +double hypot(double, double); +float hypotf(float, float); +long double hypotl(long double, long double); + +int ilogb(double); +int ilogbf(float); +int ilogbl(long double); + +double ldexp(double, int); +float ldexpf(float, int); +long double ldexpl(long double, int); + +double lgamma(double); +float lgammaf(float); +long double lgammal(long double); + +long long llrint(double); +long long llrintf(float); +long long llrintl(long double); + +long long llround(double); +long long llroundf(float); +long long llroundl(long double); + +double log(double); +float logf(float); +long double logl(long double); + +double log10(double); +float log10f(float); +long double log10l(long double); + +double log1p(double); +float log1pf(float); +long double log1pl(long double); + +double log2(double); +float log2f(float); +long double log2l(long double); + +double logb(double); +float logbf(float); +long double logbl(long double); + +long lrint(double); +long lrintf(float); +long lrintl(long double); + +long lround(double); +long lroundf(float); +long lroundl(long double); + +double modf(double, double *); +float modff(float, float *); +long double modfl(long double, long double *); + +double nan(const char *); +float nanf(const char *); +long double nanl(const char *); + +double nearbyint(double); +float nearbyintf(float); +long double nearbyintl(long double); + +double nextafter(double, double); +float nextafterf(float, float); +long double nextafterl(long double, long double); + +double nexttoward(double, long double); +float nexttowardf(float, long double); +long double nexttowardl(long double, long double); + +double pow(double, double); +float powf(float, float); +long double powl(long double, long double); + +double remainder(double, double); +float remainderf(float, float); +long double remainderl(long double, long double); + +double remquo(double, double, int *); +float remquof(float, float, int *); +long double remquol(long double, long double, int *); + +double rint(double); +float rintf(float); +long double rintl(long double); + +double round(double); +float roundf(float); +long double roundl(long double); + +double scalbln(double, long); +float scalblnf(float, long); +long double scalblnl(long double, long); + +double scalbn(double, int); +float scalbnf(float, int); +long double scalbnl(long double, int); + +double sin(double); +float sinf(float); +long double sinl(long double); + +double sinh(double); +float sinhf(float); +long double sinhl(long double); + +double sqrt(double); +float sqrtf(float); +long double sqrtl(long double); + +double tan(double); +float tanf(float); +long double tanl(long double); + +double tanh(double); +float tanhf(float); +long double tanhl(long double); + +double tgamma(double); +float tgammaf(float); +long double tgammal(long double); + +double trunc(double); +float truncf(float); +long double truncl(long double); + + +#if defined(_XOPEN_SOURCE) || defined(_BSD_SOURCE) +#undef MAXFLOAT +#define MAXFLOAT 3.40282346638528859812e+38F +#endif + +#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +#define M_E 2.7182818284590452354 /* e */ +#define M_LOG2E 1.4426950408889634074 /* log_2 e */ +#define M_LOG10E 0.43429448190325182765 /* log_10 e */ +#define M_LN2 0.69314718055994530942 /* log_e 2 */ +#define M_LN10 2.30258509299404568402 /* log_e 10 */ +#define M_PI 3.14159265358979323846 /* pi */ +#define M_PI_2 1.57079632679489661923 /* pi/2 */ +#define M_PI_4 0.78539816339744830962 /* pi/4 */ +#define M_1_PI 0.31830988618379067154 /* 1/pi */ +#define M_2_PI 0.63661977236758134308 /* 2/pi */ +#define M_2_SQRTPI 1.12837916709551257390 /* 2/sqrt(pi) */ +#define M_SQRT2 1.41421356237309504880 /* sqrt(2) */ +#define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */ + +extern int signgam; + +double j0(double); +double j1(double); +double jn(int, double); + +double y0(double); +double y1(double); +double yn(int, double); +#endif + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +#define HUGE 3.40282346638528859812e+38F + +double drem(double, double); +float dremf(float, float); + +int finite(double); +int finitef(float); + +double scalb(double, double); +float scalbf(float, float); + +double significand(double); +float significandf(float); + +double lgamma_r(double, int*); +float lgammaf_r(float, int*); + +float j0f(float); +float j1f(float); +float jnf(int, float); + +float y0f(float); +float y1f(float); +float ynf(int, float); +#endif + +#ifdef _GNU_SOURCE +long double lgammal_r(long double, int*); + +void sincos(double, double*, double*); +void sincosf(float, float*, float*); +void sincosl(long double, long double*, long double*); + +double exp10(double); +float exp10f(float); +long double exp10l(long double); + +double pow10(double); +float pow10f(float); +long double pow10l(long double); +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/memory.h b/Ubiquitous/XiZi/lib/musllib/include/memory.h new file mode 100644 index 000000000..3b2f59002 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/memory.h @@ -0,0 +1 @@ +#include diff --git a/Ubiquitous/XiZi/lib/musllib/include/mntent.h b/Ubiquitous/XiZi/lib/musllib/include/mntent.h new file mode 100644 index 000000000..3492a1d6d --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/mntent.h @@ -0,0 +1,43 @@ +#ifndef _MNTENT_H +#define _MNTENT_H + +#ifdef __cplusplus +extern "C" { +#endif + +#define __NEED_FILE +#include + +#define MOUNTED "/etc/mtab" + +#define MNTTYPE_IGNORE "ignore" +#define MNTTYPE_NFS "nfs" +#define MNTTYPE_SWAP "swap" +#define MNTOPT_DEFAULTS "defaults" +#define MNTOPT_RO "ro" +#define MNTOPT_RW "rw" +#define MNTOPT_SUID "suid" +#define MNTOPT_NOSUID "nosuid" +#define MNTOPT_NOAUTO "noauto" + +struct mntent { + char *mnt_fsname; + char *mnt_dir; + char *mnt_type; + char *mnt_opts; + int mnt_freq; + int mnt_passno; +}; + +FILE *setmntent(const char *, const char *); +int endmntent(FILE *); +struct mntent *getmntent(FILE *); +struct mntent *getmntent_r(FILE *, struct mntent *, char *, int); +int addmntent(FILE *, const struct mntent *); +char *hasmntopt(const struct mntent *, const char *); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/monetary.h b/Ubiquitous/XiZi/lib/musllib/include/monetary.h new file mode 100644 index 000000000..a91fa5655 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/monetary.h @@ -0,0 +1,23 @@ +#ifndef _MONETARY_H +#define _MONETARY_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#define __NEED_ssize_t +#define __NEED_size_t +#define __NEED_locale_t + +#include + +ssize_t strfmon(char *__restrict, size_t, const char *__restrict, ...); +ssize_t strfmon_l(char *__restrict, size_t, locale_t, const char *__restrict, ...); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/mqueue.h b/Ubiquitous/XiZi/lib/musllib/include/mqueue.h new file mode 100644 index 000000000..0c807ea0c --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/mqueue.h @@ -0,0 +1,41 @@ +#ifndef _MQUEUE_H +#define _MQUEUE_H +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#define __NEED_size_t +#define __NEED_ssize_t +#define __NEED_pthread_attr_t +#define __NEED_time_t +#define __NEED_struct_timespec +#include + +typedef int mqd_t; +struct mq_attr { + long mq_flags, mq_maxmsg, mq_msgsize, mq_curmsgs, __unused[4]; +}; +struct sigevent; + +int mq_close(mqd_t); +int mq_getattr(mqd_t, struct mq_attr *); +int mq_notify(mqd_t, const struct sigevent *); +mqd_t mq_open(const char *, int, ...); +ssize_t mq_receive(mqd_t, char *, size_t, unsigned *); +int mq_send(mqd_t, const char *, size_t, unsigned); +int mq_setattr(mqd_t, const struct mq_attr *__restrict, struct mq_attr *__restrict); +ssize_t mq_timedreceive(mqd_t, char *__restrict, size_t, unsigned *__restrict, const struct timespec *__restrict); +int mq_timedsend(mqd_t, const char *, size_t, unsigned, const struct timespec *); +int mq_unlink(const char *); + +#if _REDIR_TIME64 +__REDIR(mq_timedreceive, __mq_timedreceive_time64); +__REDIR(mq_timedsend, __mq_timedsend_time64); +#endif + +#ifdef __cplusplus +} +#endif +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/net/ethernet.h b/Ubiquitous/XiZi/lib/musllib/include/net/ethernet.h new file mode 100644 index 000000000..c8d4177fd --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/net/ethernet.h @@ -0,0 +1,55 @@ +#ifndef _NET_ETHERNET_H +#define _NET_ETHERNET_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include + +struct ether_addr { + uint8_t ether_addr_octet[ETH_ALEN]; +}; + +struct ether_header { + uint8_t ether_dhost[ETH_ALEN]; + uint8_t ether_shost[ETH_ALEN]; + uint16_t ether_type; +}; + +#define ETHERTYPE_PUP 0x0200 +#define ETHERTYPE_SPRITE 0x0500 +#define ETHERTYPE_IP 0x0800 +#define ETHERTYPE_ARP 0x0806 +#define ETHERTYPE_REVARP 0x8035 +#define ETHERTYPE_AT 0x809B +#define ETHERTYPE_AARP 0x80F3 +#define ETHERTYPE_VLAN 0x8100 +#define ETHERTYPE_IPX 0x8137 +#define ETHERTYPE_IPV6 0x86dd +#define ETHERTYPE_LOOPBACK 0x9000 + + +#define ETHER_ADDR_LEN ETH_ALEN +#define ETHER_TYPE_LEN 2 +#define ETHER_CRC_LEN 4 +#define ETHER_HDR_LEN ETH_HLEN +#define ETHER_MIN_LEN (ETH_ZLEN + ETHER_CRC_LEN) +#define ETHER_MAX_LEN (ETH_FRAME_LEN + ETHER_CRC_LEN) + +#define ETHER_IS_VALID_LEN(foo) \ + ((foo) >= ETHER_MIN_LEN && (foo) <= ETHER_MAX_LEN) + +#define ETHERTYPE_TRAIL 0x1000 +#define ETHERTYPE_NTRAILER 16 + +#define ETHERMTU ETH_DATA_LEN +#define ETHERMIN (ETHER_MIN_LEN - ETHER_HDR_LEN - ETHER_CRC_LEN) + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/net/if.h b/Ubiquitous/XiZi/lib/musllib/include/net/if.h new file mode 100644 index 000000000..774cbff0b --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/net/if.h @@ -0,0 +1,141 @@ +#ifndef _NET_IF_H +#define _NET_IF_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#define IF_NAMESIZE 16 + +struct if_nameindex { + unsigned int if_index; + char *if_name; +}; + +unsigned int if_nametoindex (const char *); +char *if_indextoname (unsigned int, char *); +struct if_nameindex *if_nameindex (void); +void if_freenameindex (struct if_nameindex *); + + + + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) + +#include + +#define IFF_UP 0x1 +#define IFF_BROADCAST 0x2 +#define IFF_DEBUG 0x4 +#define IFF_LOOPBACK 0x8 +#define IFF_POINTOPOINT 0x10 +#define IFF_NOTRAILERS 0x20 +#define IFF_RUNNING 0x40 +#define IFF_NOARP 0x80 +#define IFF_PROMISC 0x100 +#define IFF_ALLMULTI 0x200 +#define IFF_MASTER 0x400 +#define IFF_SLAVE 0x800 +#define IFF_MULTICAST 0x1000 +#define IFF_PORTSEL 0x2000 +#define IFF_AUTOMEDIA 0x4000 +#define IFF_DYNAMIC 0x8000 +#define IFF_LOWER_UP 0x10000 +#define IFF_DORMANT 0x20000 +#define IFF_ECHO 0x40000 +#define IFF_VOLATILE (IFF_LOOPBACK|IFF_POINTOPOINT|IFF_BROADCAST| \ + IFF_ECHO|IFF_MASTER|IFF_SLAVE|IFF_RUNNING|IFF_LOWER_UP|IFF_DORMANT) + +struct ifaddr { + struct sockaddr ifa_addr; + union { + struct sockaddr ifu_broadaddr; + struct sockaddr ifu_dstaddr; + } ifa_ifu; + struct iface *ifa_ifp; + struct ifaddr *ifa_next; +}; + +#define ifa_broadaddr ifa_ifu.ifu_broadaddr +#define ifa_dstaddr ifa_ifu.ifu_dstaddr + +struct ifmap { + unsigned long int mem_start; + unsigned long int mem_end; + unsigned short int base_addr; + unsigned char irq; + unsigned char dma; + unsigned char port; +}; + +#define IFHWADDRLEN 6 +#define IFNAMSIZ IF_NAMESIZE + +struct ifreq { + union { + char ifrn_name[IFNAMSIZ]; + } ifr_ifrn; + union { + struct sockaddr ifru_addr; + struct sockaddr ifru_dstaddr; + struct sockaddr ifru_broadaddr; + struct sockaddr ifru_netmask; + struct sockaddr ifru_hwaddr; + short int ifru_flags; + int ifru_ivalue; + int ifru_mtu; + struct ifmap ifru_map; + char ifru_slave[IFNAMSIZ]; + char ifru_newname[IFNAMSIZ]; + char *ifru_data; + } ifr_ifru; +}; + +#define ifr_name ifr_ifrn.ifrn_name +#define ifr_hwaddr ifr_ifru.ifru_hwaddr +#define ifr_addr ifr_ifru.ifru_addr +#define ifr_dstaddr ifr_ifru.ifru_dstaddr +#define ifr_broadaddr ifr_ifru.ifru_broadaddr +#define ifr_netmask ifr_ifru.ifru_netmask +#define ifr_flags ifr_ifru.ifru_flags +#define ifr_metric ifr_ifru.ifru_ivalue +#define ifr_mtu ifr_ifru.ifru_mtu +#define ifr_map ifr_ifru.ifru_map +#define ifr_slave ifr_ifru.ifru_slave +#define ifr_data ifr_ifru.ifru_data +#define ifr_ifindex ifr_ifru.ifru_ivalue +#define ifr_bandwidth ifr_ifru.ifru_ivalue +#define ifr_qlen ifr_ifru.ifru_ivalue +#define ifr_newname ifr_ifru.ifru_newname +#define _IOT_ifreq _IOT(_IOTS(char),IFNAMSIZ,_IOTS(char),16,0,0) +#define _IOT_ifreq_short _IOT(_IOTS(char),IFNAMSIZ,_IOTS(short),1,0,0) +#define _IOT_ifreq_int _IOT(_IOTS(char),IFNAMSIZ,_IOTS(int),1,0,0) + +struct ifconf { + int ifc_len; + union { + char *ifcu_buf; + struct ifreq *ifcu_req; + } ifc_ifcu; +}; + +#define ifc_buf ifc_ifcu.ifcu_buf +#define ifc_req ifc_ifcu.ifcu_req +#define _IOT_ifconf _IOT(_IOTS(struct ifconf),1,0,0,0,0) + +#define __UAPI_DEF_IF_IFCONF 0 +#define __UAPI_DEF_IF_IFMAP 0 +#define __UAPI_DEF_IF_IFNAMSIZ 0 +#define __UAPI_DEF_IF_IFREQ 0 +#define __UAPI_DEF_IF_NET_DEVICE_FLAGS 0 +#define __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO 0 + +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/net/if_arp.h b/Ubiquitous/XiZi/lib/musllib/include/net/if_arp.h new file mode 100644 index 000000000..27becc835 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/net/if_arp.h @@ -0,0 +1,142 @@ +/* Nonstandard header */ +#ifndef _NET_IF_ARP_H +#define _NET_IF_ARP_H +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include + +#define MAX_ADDR_LEN 7 + +#define ARPOP_REQUEST 1 +#define ARPOP_REPLY 2 +#define ARPOP_RREQUEST 3 +#define ARPOP_RREPLY 4 +#define ARPOP_InREQUEST 8 +#define ARPOP_InREPLY 9 +#define ARPOP_NAK 10 + +struct arphdr { + uint16_t ar_hrd; + uint16_t ar_pro; + uint8_t ar_hln; + uint8_t ar_pln; + uint16_t ar_op; +}; + + +#define ARPHRD_NETROM 0 +#define ARPHRD_ETHER 1 +#define ARPHRD_EETHER 2 +#define ARPHRD_AX25 3 +#define ARPHRD_PRONET 4 +#define ARPHRD_CHAOS 5 +#define ARPHRD_IEEE802 6 +#define ARPHRD_ARCNET 7 +#define ARPHRD_APPLETLK 8 +#define ARPHRD_DLCI 15 +#define ARPHRD_ATM 19 +#define ARPHRD_METRICOM 23 +#define ARPHRD_IEEE1394 24 +#define ARPHRD_EUI64 27 +#define ARPHRD_INFINIBAND 32 +#define ARPHRD_SLIP 256 +#define ARPHRD_CSLIP 257 +#define ARPHRD_SLIP6 258 +#define ARPHRD_CSLIP6 259 +#define ARPHRD_RSRVD 260 +#define ARPHRD_ADAPT 264 +#define ARPHRD_ROSE 270 +#define ARPHRD_X25 271 +#define ARPHRD_HWX25 272 +#define ARPHRD_CAN 280 +#define ARPHRD_PPP 512 +#define ARPHRD_CISCO 513 +#define ARPHRD_HDLC ARPHRD_CISCO +#define ARPHRD_LAPB 516 +#define ARPHRD_DDCMP 517 +#define ARPHRD_RAWHDLC 518 +#define ARPHRD_RAWIP 519 + +#define ARPHRD_TUNNEL 768 +#define ARPHRD_TUNNEL6 769 +#define ARPHRD_FRAD 770 +#define ARPHRD_SKIP 771 +#define ARPHRD_LOOPBACK 772 +#define ARPHRD_LOCALTLK 773 +#define ARPHRD_FDDI 774 +#define ARPHRD_BIF 775 +#define ARPHRD_SIT 776 +#define ARPHRD_IPDDP 777 +#define ARPHRD_IPGRE 778 +#define ARPHRD_PIMREG 779 +#define ARPHRD_HIPPI 780 +#define ARPHRD_ASH 781 +#define ARPHRD_ECONET 782 +#define ARPHRD_IRDA 783 +#define ARPHRD_FCPP 784 +#define ARPHRD_FCAL 785 +#define ARPHRD_FCPL 786 +#define ARPHRD_FCFABRIC 787 +#define ARPHRD_IEEE802_TR 800 +#define ARPHRD_IEEE80211 801 +#define ARPHRD_IEEE80211_PRISM 802 +#define ARPHRD_IEEE80211_RADIOTAP 803 +#define ARPHRD_IEEE802154 804 +#define ARPHRD_IEEE802154_MONITOR 805 +#define ARPHRD_PHONET 820 +#define ARPHRD_PHONET_PIPE 821 +#define ARPHRD_CAIF 822 +#define ARPHRD_IP6GRE 823 +#define ARPHRD_NETLINK 824 +#define ARPHRD_6LOWPAN 825 +#define ARPHRD_VSOCKMON 826 + +#define ARPHRD_VOID 0xFFFF +#define ARPHRD_NONE 0xFFFE + +struct arpreq { + struct sockaddr arp_pa; + struct sockaddr arp_ha; + int arp_flags; + struct sockaddr arp_netmask; + char arp_dev[16]; +}; + +struct arpreq_old { + struct sockaddr arp_pa; + struct sockaddr arp_ha; + int arp_flags; + struct sockaddr arp_netmask; +}; + +#define ATF_COM 0x02 +#define ATF_PERM 0x04 +#define ATF_PUBL 0x08 +#define ATF_USETRAILERS 0x10 +#define ATF_NETMASK 0x20 +#define ATF_DONTPUB 0x40 +#define ATF_MAGIC 0x80 + +#define ARPD_UPDATE 0x01 +#define ARPD_LOOKUP 0x02 +#define ARPD_FLUSH 0x03 + +struct arpd_request { + unsigned short req; + uint32_t ip; + unsigned long dev; + unsigned long stamp; + unsigned long updated; + unsigned char ha[MAX_ADDR_LEN]; +}; + + + +#ifdef __cplusplus +} +#endif +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/net/route.h b/Ubiquitous/XiZi/lib/musllib/include/net/route.h new file mode 100644 index 000000000..96ff48e01 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/net/route.h @@ -0,0 +1,124 @@ +#ifndef _NET_ROUTE_H +#define _NET_ROUTE_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include +#include + + +struct rtentry { + unsigned long int rt_pad1; + struct sockaddr rt_dst; + struct sockaddr rt_gateway; + struct sockaddr rt_genmask; + unsigned short int rt_flags; + short int rt_pad2; + unsigned long int rt_pad3; + unsigned char rt_tos; + unsigned char rt_class; + short int rt_pad4[sizeof(long)/2-1]; + short int rt_metric; + char *rt_dev; + unsigned long int rt_mtu; + unsigned long int rt_window; + unsigned short int rt_irtt; +}; + +#define rt_mss rt_mtu + + +struct in6_rtmsg { + struct in6_addr rtmsg_dst; + struct in6_addr rtmsg_src; + struct in6_addr rtmsg_gateway; + uint32_t rtmsg_type; + uint16_t rtmsg_dst_len; + uint16_t rtmsg_src_len; + uint32_t rtmsg_metric; + unsigned long int rtmsg_info; + uint32_t rtmsg_flags; + int rtmsg_ifindex; +}; + + +#define RTF_UP 0x0001 +#define RTF_GATEWAY 0x0002 + +#define RTF_HOST 0x0004 +#define RTF_REINSTATE 0x0008 +#define RTF_DYNAMIC 0x0010 +#define RTF_MODIFIED 0x0020 +#define RTF_MTU 0x0040 +#define RTF_MSS RTF_MTU +#define RTF_WINDOW 0x0080 +#define RTF_IRTT 0x0100 +#define RTF_REJECT 0x0200 +#define RTF_STATIC 0x0400 +#define RTF_XRESOLVE 0x0800 +#define RTF_NOFORWARD 0x1000 +#define RTF_THROW 0x2000 +#define RTF_NOPMTUDISC 0x4000 + +#define RTF_DEFAULT 0x00010000 +#define RTF_ALLONLINK 0x00020000 +#define RTF_ADDRCONF 0x00040000 + +#define RTF_LINKRT 0x00100000 +#define RTF_NONEXTHOP 0x00200000 + +#define RTF_CACHE 0x01000000 +#define RTF_FLOW 0x02000000 +#define RTF_POLICY 0x04000000 + +#define RTCF_VALVE 0x00200000 +#define RTCF_MASQ 0x00400000 +#define RTCF_NAT 0x00800000 +#define RTCF_DOREDIRECT 0x01000000 +#define RTCF_LOG 0x02000000 +#define RTCF_DIRECTSRC 0x04000000 + +#define RTF_LOCAL 0x80000000 +#define RTF_INTERFACE 0x40000000 +#define RTF_MULTICAST 0x20000000 +#define RTF_BROADCAST 0x10000000 +#define RTF_NAT 0x08000000 + +#define RTF_ADDRCLASSMASK 0xF8000000 +#define RT_ADDRCLASS(flags) ((uint32_t) flags >> 23) + +#define RT_TOS(tos) ((tos) & IPTOS_TOS_MASK) + +#define RT_LOCALADDR(flags) ((flags & RTF_ADDRCLASSMASK) \ + == (RTF_LOCAL|RTF_INTERFACE)) + +#define RT_CLASS_UNSPEC 0 +#define RT_CLASS_DEFAULT 253 + +#define RT_CLASS_MAIN 254 +#define RT_CLASS_LOCAL 255 +#define RT_CLASS_MAX 255 + + +#define RTMSG_ACK NLMSG_ACK +#define RTMSG_OVERRUN NLMSG_OVERRUN + +#define RTMSG_NEWDEVICE 0x11 +#define RTMSG_DELDEVICE 0x12 +#define RTMSG_NEWROUTE 0x21 +#define RTMSG_DELROUTE 0x22 +#define RTMSG_NEWRULE 0x31 +#define RTMSG_DELRULE 0x32 +#define RTMSG_CONTROL 0x40 + +#define RTMSG_AR_FAILED 0x51 + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/netdb.h b/Ubiquitous/XiZi/lib/musllib/include/netdb.h new file mode 100644 index 000000000..d096c7818 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/netdb.h @@ -0,0 +1,156 @@ +#ifndef _NETDB_H +#define _NETDB_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +#define __NEED_size_t +#include +#endif + +struct addrinfo { + int ai_flags; + int ai_family; + int ai_socktype; + int ai_protocol; + socklen_t ai_addrlen; + struct sockaddr *ai_addr; + char *ai_canonname; + struct addrinfo *ai_next; +}; + +#define AI_PASSIVE 0x01 +#define AI_CANONNAME 0x02 +#define AI_NUMERICHOST 0x04 +#define AI_V4MAPPED 0x08 +#define AI_ALL 0x10 +#define AI_ADDRCONFIG 0x20 +#define AI_NUMERICSERV 0x400 + + +#define NI_NUMERICHOST 0x01 +#define NI_NUMERICSERV 0x02 +#define NI_NOFQDN 0x04 +#define NI_NAMEREQD 0x08 +#define NI_DGRAM 0x10 +#define NI_NUMERICSCOPE 0x100 + +#define EAI_BADFLAGS -1 +#define EAI_NONAME -2 +#define EAI_AGAIN -3 +#define EAI_FAIL -4 +#define EAI_FAMILY -6 +#define EAI_SOCKTYPE -7 +#define EAI_SERVICE -8 +#define EAI_MEMORY -10 +#define EAI_SYSTEM -11 +#define EAI_OVERFLOW -12 + +int getaddrinfo (const char *__restrict, const char *__restrict, const struct addrinfo *__restrict, struct addrinfo **__restrict); +void freeaddrinfo (struct addrinfo *); +int getnameinfo (const struct sockaddr *__restrict, socklen_t, char *__restrict, socklen_t, char *__restrict, socklen_t, int); +const char *gai_strerror(int); + + +/* Legacy functions follow (marked OBsolete in SUS) */ + +struct netent { + char *n_name; + char **n_aliases; + int n_addrtype; + uint32_t n_net; +}; + +struct hostent { + char *h_name; + char **h_aliases; + int h_addrtype; + int h_length; + char **h_addr_list; +}; +#define h_addr h_addr_list[0] + +struct servent { + char *s_name; + char **s_aliases; + int s_port; + char *s_proto; +}; + +struct protoent { + char *p_name; + char **p_aliases; + int p_proto; +}; + +void sethostent (int); +void endhostent (void); +struct hostent *gethostent (void); + +void setnetent (int); +void endnetent (void); +struct netent *getnetent (void); +struct netent *getnetbyaddr (uint32_t, int); +struct netent *getnetbyname (const char *); + +void setservent (int); +void endservent (void); +struct servent *getservent (void); +struct servent *getservbyname (const char *, const char *); +struct servent *getservbyport (int, const char *); + +void setprotoent (int); +void endprotoent (void); +struct protoent *getprotoent (void); +struct protoent *getprotobyname (const char *); +struct protoent *getprotobynumber (int); + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) || defined(_POSIX_SOURCE) \ + || (defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE+0 < 200809L) \ + || (defined(_XOPEN_SOURCE) && _XOPEN_SOURCE+0 < 700) +struct hostent *gethostbyname (const char *); +struct hostent *gethostbyaddr (const void *, socklen_t, int); +#ifdef __GNUC__ +__attribute__((const)) +#endif +int *__h_errno_location(void); +#define h_errno (*__h_errno_location()) +#define HOST_NOT_FOUND 1 +#define TRY_AGAIN 2 +#define NO_RECOVERY 3 +#define NO_DATA 4 +#define NO_ADDRESS NO_DATA +#endif + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +void herror(const char *); +const char *hstrerror(int); +int gethostbyname_r(const char *, struct hostent *, char *, size_t, struct hostent **, int *); +int gethostbyname2_r(const char *, int, struct hostent *, char *, size_t, struct hostent **, int *); +struct hostent *gethostbyname2(const char *, int); +int gethostbyaddr_r(const void *, socklen_t, int, struct hostent *, char *, size_t, struct hostent **, int *); +int getservbyport_r(int, const char *, struct servent *, char *, size_t, struct servent **); +int getservbyname_r(const char *, const char *, struct servent *, char *, size_t, struct servent **); +#define EAI_NODATA -5 +#define EAI_ADDRFAMILY -9 +#define EAI_INPROGRESS -100 +#define EAI_CANCELED -101 +#define EAI_NOTCANCELED -102 +#define EAI_ALLDONE -103 +#define EAI_INTR -104 +#define EAI_IDN_ENCODE -105 +#define NI_MAXHOST 255 +#define NI_MAXSERV 32 +#endif + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/netinet/ether.h b/Ubiquitous/XiZi/lib/musllib/include/netinet/ether.h new file mode 100644 index 000000000..eec7e53ca --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/netinet/ether.h @@ -0,0 +1,22 @@ +#ifndef _NETINET_ETHER_H +#define _NETINET_ETHER_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +char *ether_ntoa (const struct ether_addr *); +struct ether_addr *ether_aton (const char *); +char *ether_ntoa_r (const struct ether_addr *, char *); +struct ether_addr *ether_aton_r (const char *, struct ether_addr *); +int ether_line(const char *, struct ether_addr *, char *); +int ether_ntohost(char *, const struct ether_addr *); +int ether_hostton(const char *, struct ether_addr *); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/netinet/icmp6.h b/Ubiquitous/XiZi/lib/musllib/include/netinet/icmp6.h new file mode 100644 index 000000000..01269e7d4 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/netinet/icmp6.h @@ -0,0 +1,305 @@ +#ifndef _NETINET_ICMP6_H +#define _NETINET_ICMP6_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include +#include + +#define ICMP6_FILTER 1 + +#define ICMP6_FILTER_BLOCK 1 +#define ICMP6_FILTER_PASS 2 +#define ICMP6_FILTER_BLOCKOTHERS 3 +#define ICMP6_FILTER_PASSONLY 4 + +struct icmp6_filter { + uint32_t icmp6_filt[8]; +}; + +struct icmp6_hdr { + uint8_t icmp6_type; + uint8_t icmp6_code; + uint16_t icmp6_cksum; + union { + uint32_t icmp6_un_data32[1]; + uint16_t icmp6_un_data16[2]; + uint8_t icmp6_un_data8[4]; + } icmp6_dataun; +}; + +#define icmp6_data32 icmp6_dataun.icmp6_un_data32 +#define icmp6_data16 icmp6_dataun.icmp6_un_data16 +#define icmp6_data8 icmp6_dataun.icmp6_un_data8 +#define icmp6_pptr icmp6_data32[0] +#define icmp6_mtu icmp6_data32[0] +#define icmp6_id icmp6_data16[0] +#define icmp6_seq icmp6_data16[1] +#define icmp6_maxdelay icmp6_data16[0] + +#define ICMP6_DST_UNREACH 1 +#define ICMP6_PACKET_TOO_BIG 2 +#define ICMP6_TIME_EXCEEDED 3 +#define ICMP6_PARAM_PROB 4 + +#define ICMP6_INFOMSG_MASK 0x80 + +#define ICMP6_ECHO_REQUEST 128 +#define ICMP6_ECHO_REPLY 129 +#define MLD_LISTENER_QUERY 130 +#define MLD_LISTENER_REPORT 131 +#define MLD_LISTENER_REDUCTION 132 + +#define ICMP6_DST_UNREACH_NOROUTE 0 +#define ICMP6_DST_UNREACH_ADMIN 1 +#define ICMP6_DST_UNREACH_BEYONDSCOPE 2 +#define ICMP6_DST_UNREACH_ADDR 3 +#define ICMP6_DST_UNREACH_NOPORT 4 + +#define ICMP6_TIME_EXCEED_TRANSIT 0 +#define ICMP6_TIME_EXCEED_REASSEMBLY 1 + +#define ICMP6_PARAMPROB_HEADER 0 +#define ICMP6_PARAMPROB_NEXTHEADER 1 +#define ICMP6_PARAMPROB_OPTION 2 + +#define ICMP6_FILTER_WILLPASS(type, filterp) \ + ((((filterp)->icmp6_filt[(type) >> 5]) & (1 << ((type) & 31))) == 0) + +#define ICMP6_FILTER_WILLBLOCK(type, filterp) \ + ((((filterp)->icmp6_filt[(type) >> 5]) & (1 << ((type) & 31))) != 0) + +#define ICMP6_FILTER_SETPASS(type, filterp) \ + ((((filterp)->icmp6_filt[(type) >> 5]) &= ~(1 << ((type) & 31)))) + +#define ICMP6_FILTER_SETBLOCK(type, filterp) \ + ((((filterp)->icmp6_filt[(type) >> 5]) |= (1 << ((type) & 31)))) + +#define ICMP6_FILTER_SETPASSALL(filterp) \ + memset (filterp, 0, sizeof (struct icmp6_filter)); + +#define ICMP6_FILTER_SETBLOCKALL(filterp) \ + memset (filterp, 0xFF, sizeof (struct icmp6_filter)); + +#define ND_ROUTER_SOLICIT 133 +#define ND_ROUTER_ADVERT 134 +#define ND_NEIGHBOR_SOLICIT 135 +#define ND_NEIGHBOR_ADVERT 136 +#define ND_REDIRECT 137 + +struct nd_router_solicit { + struct icmp6_hdr nd_rs_hdr; +}; + +#define nd_rs_type nd_rs_hdr.icmp6_type +#define nd_rs_code nd_rs_hdr.icmp6_code +#define nd_rs_cksum nd_rs_hdr.icmp6_cksum +#define nd_rs_reserved nd_rs_hdr.icmp6_data32[0] + +struct nd_router_advert { + struct icmp6_hdr nd_ra_hdr; + uint32_t nd_ra_reachable; + uint32_t nd_ra_retransmit; +}; + +#define nd_ra_type nd_ra_hdr.icmp6_type +#define nd_ra_code nd_ra_hdr.icmp6_code +#define nd_ra_cksum nd_ra_hdr.icmp6_cksum +#define nd_ra_curhoplimit nd_ra_hdr.icmp6_data8[0] +#define nd_ra_flags_reserved nd_ra_hdr.icmp6_data8[1] +#define ND_RA_FLAG_MANAGED 0x80 +#define ND_RA_FLAG_OTHER 0x40 +#define ND_RA_FLAG_HOME_AGENT 0x20 +#define nd_ra_router_lifetime nd_ra_hdr.icmp6_data16[1] + +struct nd_neighbor_solicit { + struct icmp6_hdr nd_ns_hdr; + struct in6_addr nd_ns_target; +}; + +#define nd_ns_type nd_ns_hdr.icmp6_type +#define nd_ns_code nd_ns_hdr.icmp6_code +#define nd_ns_cksum nd_ns_hdr.icmp6_cksum +#define nd_ns_reserved nd_ns_hdr.icmp6_data32[0] + +struct nd_neighbor_advert { + struct icmp6_hdr nd_na_hdr; + struct in6_addr nd_na_target; +}; + +#define nd_na_type nd_na_hdr.icmp6_type +#define nd_na_code nd_na_hdr.icmp6_code +#define nd_na_cksum nd_na_hdr.icmp6_cksum +#define nd_na_flags_reserved nd_na_hdr.icmp6_data32[0] +#if __BYTE_ORDER == __BIG_ENDIAN +#define ND_NA_FLAG_ROUTER 0x80000000 +#define ND_NA_FLAG_SOLICITED 0x40000000 +#define ND_NA_FLAG_OVERRIDE 0x20000000 +#else +#define ND_NA_FLAG_ROUTER 0x00000080 +#define ND_NA_FLAG_SOLICITED 0x00000040 +#define ND_NA_FLAG_OVERRIDE 0x00000020 +#endif + +struct nd_redirect { + struct icmp6_hdr nd_rd_hdr; + struct in6_addr nd_rd_target; + struct in6_addr nd_rd_dst; +}; + +#define nd_rd_type nd_rd_hdr.icmp6_type +#define nd_rd_code nd_rd_hdr.icmp6_code +#define nd_rd_cksum nd_rd_hdr.icmp6_cksum +#define nd_rd_reserved nd_rd_hdr.icmp6_data32[0] + +struct nd_opt_hdr { + uint8_t nd_opt_type; + uint8_t nd_opt_len; +}; + +#define ND_OPT_SOURCE_LINKADDR 1 +#define ND_OPT_TARGET_LINKADDR 2 +#define ND_OPT_PREFIX_INFORMATION 3 +#define ND_OPT_REDIRECTED_HEADER 4 +#define ND_OPT_MTU 5 +#define ND_OPT_RTR_ADV_INTERVAL 7 +#define ND_OPT_HOME_AGENT_INFO 8 + +struct nd_opt_prefix_info { + uint8_t nd_opt_pi_type; + uint8_t nd_opt_pi_len; + uint8_t nd_opt_pi_prefix_len; + uint8_t nd_opt_pi_flags_reserved; + uint32_t nd_opt_pi_valid_time; + uint32_t nd_opt_pi_preferred_time; + uint32_t nd_opt_pi_reserved2; + struct in6_addr nd_opt_pi_prefix; +}; + +#define ND_OPT_PI_FLAG_ONLINK 0x80 +#define ND_OPT_PI_FLAG_AUTO 0x40 +#define ND_OPT_PI_FLAG_RADDR 0x20 + +struct nd_opt_rd_hdr { + uint8_t nd_opt_rh_type; + uint8_t nd_opt_rh_len; + uint16_t nd_opt_rh_reserved1; + uint32_t nd_opt_rh_reserved2; +}; + +struct nd_opt_mtu { + uint8_t nd_opt_mtu_type; + uint8_t nd_opt_mtu_len; + uint16_t nd_opt_mtu_reserved; + uint32_t nd_opt_mtu_mtu; +}; + +struct mld_hdr { + struct icmp6_hdr mld_icmp6_hdr; + struct in6_addr mld_addr; +}; + +#define mld_type mld_icmp6_hdr.icmp6_type +#define mld_code mld_icmp6_hdr.icmp6_code +#define mld_cksum mld_icmp6_hdr.icmp6_cksum +#define mld_maxdelay mld_icmp6_hdr.icmp6_data16[0] +#define mld_reserved mld_icmp6_hdr.icmp6_data16[1] + +#define ICMP6_ROUTER_RENUMBERING 138 + +struct icmp6_router_renum { + struct icmp6_hdr rr_hdr; + uint8_t rr_segnum; + uint8_t rr_flags; + uint16_t rr_maxdelay; + uint32_t rr_reserved; +}; + +#define rr_type rr_hdr.icmp6_type +#define rr_code rr_hdr.icmp6_code +#define rr_cksum rr_hdr.icmp6_cksum +#define rr_seqnum rr_hdr.icmp6_data32[0] + +#define ICMP6_RR_FLAGS_TEST 0x80 +#define ICMP6_RR_FLAGS_REQRESULT 0x40 +#define ICMP6_RR_FLAGS_FORCEAPPLY 0x20 +#define ICMP6_RR_FLAGS_SPECSITE 0x10 +#define ICMP6_RR_FLAGS_PREVDONE 0x08 + +struct rr_pco_match { + uint8_t rpm_code; + uint8_t rpm_len; + uint8_t rpm_ordinal; + uint8_t rpm_matchlen; + uint8_t rpm_minlen; + uint8_t rpm_maxlen; + uint16_t rpm_reserved; + struct in6_addr rpm_prefix; +}; + +#define RPM_PCO_ADD 1 +#define RPM_PCO_CHANGE 2 +#define RPM_PCO_SETGLOBAL 3 + +struct rr_pco_use { + uint8_t rpu_uselen; + uint8_t rpu_keeplen; + uint8_t rpu_ramask; + uint8_t rpu_raflags; + uint32_t rpu_vltime; + uint32_t rpu_pltime; + uint32_t rpu_flags; + struct in6_addr rpu_prefix; +}; + +#define ICMP6_RR_PCOUSE_RAFLAGS_ONLINK 0x20 +#define ICMP6_RR_PCOUSE_RAFLAGS_AUTO 0x10 + +#if __BYTE_ORDER == __BIG_ENDIAN +#define ICMP6_RR_PCOUSE_FLAGS_DECRVLTIME 0x80000000 +#define ICMP6_RR_PCOUSE_FLAGS_DECRPLTIME 0x40000000 +#else +#define ICMP6_RR_PCOUSE_FLAGS_DECRVLTIME 0x80 +#define ICMP6_RR_PCOUSE_FLAGS_DECRPLTIME 0x40 +#endif + +struct rr_result { + uint16_t rrr_flags; + uint8_t rrr_ordinal; + uint8_t rrr_matchedlen; + uint32_t rrr_ifid; + struct in6_addr rrr_prefix; +}; + +#if __BYTE_ORDER == __BIG_ENDIAN +#define ICMP6_RR_RESULT_FLAGS_OOB 0x0002 +#define ICMP6_RR_RESULT_FLAGS_FORBIDDEN 0x0001 +#else +#define ICMP6_RR_RESULT_FLAGS_OOB 0x0200 +#define ICMP6_RR_RESULT_FLAGS_FORBIDDEN 0x0100 +#endif + +struct nd_opt_adv_interval { + uint8_t nd_opt_adv_interval_type; + uint8_t nd_opt_adv_interval_len; + uint16_t nd_opt_adv_interval_reserved; + uint32_t nd_opt_adv_interval_ival; +}; + +struct nd_opt_home_agent_info { + uint8_t nd_opt_home_agent_info_type; + uint8_t nd_opt_home_agent_info_len; + uint16_t nd_opt_home_agent_info_reserved; + uint16_t nd_opt_home_agent_info_preference; + uint16_t nd_opt_home_agent_info_lifetime; +}; + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/netinet/if_ether.h b/Ubiquitous/XiZi/lib/musllib/include/netinet/if_ether.h new file mode 100644 index 000000000..a08485e7f --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/netinet/if_ether.h @@ -0,0 +1,147 @@ +#ifndef _NETINET_IF_ETHER_H +#define _NETINET_IF_ETHER_H + +#include +#include + +#define ETH_ALEN 6 +#define ETH_TLEN 2 +#define ETH_HLEN 14 +#define ETH_ZLEN 60 +#define ETH_DATA_LEN 1500 +#define ETH_FRAME_LEN 1514 +#define ETH_FCS_LEN 4 +#define ETH_MIN_MTU 68 +#define ETH_MAX_MTU 0xFFFFU + +#define ETH_P_LOOP 0x0060 +#define ETH_P_PUP 0x0200 +#define ETH_P_PUPAT 0x0201 +#define ETH_P_TSN 0x22F0 +#define ETH_P_ERSPAN2 0x22EB +#define ETH_P_IP 0x0800 +#define ETH_P_X25 0x0805 +#define ETH_P_ARP 0x0806 +#define ETH_P_BPQ 0x08FF +#define ETH_P_IEEEPUP 0x0a00 +#define ETH_P_IEEEPUPAT 0x0a01 +#define ETH_P_BATMAN 0x4305 +#define ETH_P_DEC 0x6000 +#define ETH_P_DNA_DL 0x6001 +#define ETH_P_DNA_RC 0x6002 +#define ETH_P_DNA_RT 0x6003 +#define ETH_P_LAT 0x6004 +#define ETH_P_DIAG 0x6005 +#define ETH_P_CUST 0x6006 +#define ETH_P_SCA 0x6007 +#define ETH_P_TEB 0x6558 +#define ETH_P_RARP 0x8035 +#define ETH_P_ATALK 0x809B +#define ETH_P_AARP 0x80F3 +#define ETH_P_8021Q 0x8100 +#define ETH_P_IPX 0x8137 +#define ETH_P_IPV6 0x86DD +#define ETH_P_PAUSE 0x8808 +#define ETH_P_SLOW 0x8809 +#define ETH_P_WCCP 0x883E +#define ETH_P_MPLS_UC 0x8847 +#define ETH_P_MPLS_MC 0x8848 +#define ETH_P_ATMMPOA 0x884c +#define ETH_P_PPP_DISC 0x8863 +#define ETH_P_PPP_SES 0x8864 +#define ETH_P_LINK_CTL 0x886c +#define ETH_P_ATMFATE 0x8884 +#define ETH_P_PAE 0x888E +#define ETH_P_AOE 0x88A2 +#define ETH_P_8021AD 0x88A8 +#define ETH_P_802_EX1 0x88B5 +#define ETH_P_ERSPAN 0x88BE +#define ETH_P_PREAUTH 0x88C7 +#define ETH_P_TIPC 0x88CA +#define ETH_P_LLDP 0x88CC +#define ETH_P_MACSEC 0x88E5 +#define ETH_P_8021AH 0x88E7 +#define ETH_P_MVRP 0x88F5 +#define ETH_P_1588 0x88F7 +#define ETH_P_NCSI 0x88F8 +#define ETH_P_PRP 0x88FB +#define ETH_P_FCOE 0x8906 +#define ETH_P_TDLS 0x890D +#define ETH_P_FIP 0x8914 +#define ETH_P_IBOE 0x8915 +#define ETH_P_80221 0x8917 +#define ETH_P_HSR 0x892F +#define ETH_P_NSH 0x894F +#define ETH_P_LOOPBACK 0x9000 +#define ETH_P_QINQ1 0x9100 +#define ETH_P_QINQ2 0x9200 +#define ETH_P_QINQ3 0x9300 +#define ETH_P_EDSA 0xDADA +#define ETH_P_DSA_8021Q 0xDADB +#define ETH_P_IFE 0xED3E +#define ETH_P_AF_IUCV 0xFBFB + +#define ETH_P_802_3_MIN 0x0600 + +#define ETH_P_802_3 0x0001 +#define ETH_P_AX25 0x0002 +#define ETH_P_ALL 0x0003 +#define ETH_P_802_2 0x0004 +#define ETH_P_SNAP 0x0005 +#define ETH_P_DDCMP 0x0006 +#define ETH_P_WAN_PPP 0x0007 +#define ETH_P_PPP_MP 0x0008 +#define ETH_P_LOCALTALK 0x0009 +#define ETH_P_CAN 0x000C +#define ETH_P_CANFD 0x000D +#define ETH_P_PPPTALK 0x0010 +#define ETH_P_TR_802_2 0x0011 +#define ETH_P_MOBITEX 0x0015 +#define ETH_P_CONTROL 0x0016 +#define ETH_P_IRDA 0x0017 +#define ETH_P_ECONET 0x0018 +#define ETH_P_HDLC 0x0019 +#define ETH_P_ARCNET 0x001A +#define ETH_P_DSA 0x001B +#define ETH_P_TRAILER 0x001C +#define ETH_P_PHONET 0x00F5 +#define ETH_P_IEEE802154 0x00F6 +#define ETH_P_CAIF 0x00F7 +#define ETH_P_XDSA 0x00F8 +#define ETH_P_MAP 0x00F9 + +struct ethhdr { + uint8_t h_dest[ETH_ALEN]; + uint8_t h_source[ETH_ALEN]; + uint16_t h_proto; +}; + +#include +#include + +struct ether_arp { + struct arphdr ea_hdr; + uint8_t arp_sha[ETH_ALEN]; + uint8_t arp_spa[4]; + uint8_t arp_tha[ETH_ALEN]; + uint8_t arp_tpa[4]; +}; +#define arp_hrd ea_hdr.ar_hrd +#define arp_pro ea_hdr.ar_pro +#define arp_hln ea_hdr.ar_hln +#define arp_pln ea_hdr.ar_pln +#define arp_op ea_hdr.ar_op + +#define ETHER_MAP_IP_MULTICAST(ipaddr, enaddr) \ +do { \ + (enaddr)[0] = 0x01; \ + (enaddr)[1] = 0x00; \ + (enaddr)[2] = 0x5e; \ + (enaddr)[3] = ((uint8_t *)ipaddr)[1] & 0x7f; \ + (enaddr)[4] = ((uint8_t *)ipaddr)[2]; \ + (enaddr)[5] = ((uint8_t *)ipaddr)[3]; \ +} while(0) + +#define __UAPI_DEF_ETHHDR 0 + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/netinet/igmp.h b/Ubiquitous/XiZi/lib/musllib/include/netinet/igmp.h new file mode 100644 index 000000000..bbe8206a1 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/netinet/igmp.h @@ -0,0 +1,45 @@ +#ifndef _NETINET_IGMP_H +#define _NETINET_IGMP_H + +#include +#include + +struct igmp { + uint8_t igmp_type; + uint8_t igmp_code; + uint16_t igmp_cksum; + struct in_addr igmp_group; +}; + +#define IGMP_MINLEN 8 + +#define IGMP_MEMBERSHIP_QUERY 0x11 +#define IGMP_V1_MEMBERSHIP_REPORT 0x12 +#define IGMP_V2_MEMBERSHIP_REPORT 0x16 +#define IGMP_V2_LEAVE_GROUP 0x17 + +#define IGMP_DVMRP 0x13 +#define IGMP_PIM 0x14 +#define IGMP_TRACE 0x15 + +#define IGMP_MTRACE_RESP 0x1e +#define IGMP_MTRACE 0x1f + +#define IGMP_MAX_HOST_REPORT_DELAY 10 +#define IGMP_TIMER_SCALE 10 + +#define IGMP_DELAYING_MEMBER 1 +#define IGMP_IDLE_MEMBER 2 +#define IGMP_LAZY_MEMBER 3 +#define IGMP_SLEEPING_MEMBER 4 +#define IGMP_AWAKENING_MEMBER 5 + +#define IGMP_v1_ROUTER 1 +#define IGMP_v2_ROUTER 2 + +#define IGMP_HOST_MEMBERSHIP_QUERY IGMP_MEMBERSHIP_QUERY +#define IGMP_HOST_MEMBERSHIP_REPORT IGMP_V1_MEMBERSHIP_REPORT +#define IGMP_HOST_NEW_MEMBERSHIP_REPORT IGMP_V2_MEMBERSHIP_REPORT +#define IGMP_HOST_LEAVE_MESSAGE IGMP_V2_LEAVE_GROUP + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/netinet/in.h b/Ubiquitous/XiZi/lib/musllib/include/netinet/in.h new file mode 100644 index 000000000..5b8b21e64 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/netinet/in.h @@ -0,0 +1,415 @@ +#ifndef _NETINET_IN_H +#define _NETINET_IN_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include + +typedef uint16_t in_port_t; +typedef uint32_t in_addr_t; +struct in_addr { in_addr_t s_addr; }; + +struct sockaddr_in { + sa_family_t sin_family; + in_port_t sin_port; + struct in_addr sin_addr; + uint8_t sin_zero[8]; +}; + +struct in6_addr { + union { + uint8_t __s6_addr[16]; + uint16_t __s6_addr16[8]; + uint32_t __s6_addr32[4]; + } __in6_union; +}; +#define s6_addr __in6_union.__s6_addr +#define s6_addr16 __in6_union.__s6_addr16 +#define s6_addr32 __in6_union.__s6_addr32 + +struct sockaddr_in6 { + sa_family_t sin6_family; + in_port_t sin6_port; + uint32_t sin6_flowinfo; + struct in6_addr sin6_addr; + uint32_t sin6_scope_id; +}; + +struct ipv6_mreq { + struct in6_addr ipv6mr_multiaddr; + unsigned ipv6mr_interface; +}; + +#define INADDR_ANY ((in_addr_t) 0x00000000) +#define INADDR_BROADCAST ((in_addr_t) 0xffffffff) +#define INADDR_NONE ((in_addr_t) 0xffffffff) +#define INADDR_LOOPBACK ((in_addr_t) 0x7f000001) + +#define INADDR_UNSPEC_GROUP ((in_addr_t) 0xe0000000) +#define INADDR_ALLHOSTS_GROUP ((in_addr_t) 0xe0000001) +#define INADDR_ALLRTRS_GROUP ((in_addr_t) 0xe0000002) +#define INADDR_ALLSNOOPERS_GROUP ((in_addr_t) 0xe000006a) +#define INADDR_MAX_LOCAL_GROUP ((in_addr_t) 0xe00000ff) + +#define IN6ADDR_ANY_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } } +#define IN6ADDR_LOOPBACK_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } } + +extern const struct in6_addr in6addr_any, in6addr_loopback; + +#undef INET_ADDRSTRLEN +#undef INET6_ADDRSTRLEN +#define INET_ADDRSTRLEN 16 +#define INET6_ADDRSTRLEN 46 + +uint32_t htonl(uint32_t); +uint16_t htons(uint16_t); +uint32_t ntohl(uint32_t); +uint16_t ntohs(uint16_t); + +#define IPPORT_RESERVED 1024 + +#define IPPROTO_IP 0 +#define IPPROTO_HOPOPTS 0 +#define IPPROTO_ICMP 1 +#define IPPROTO_IGMP 2 +#define IPPROTO_IPIP 4 +#define IPPROTO_TCP 6 +#define IPPROTO_EGP 8 +#define IPPROTO_PUP 12 +#define IPPROTO_UDP 17 +#define IPPROTO_IDP 22 +#define IPPROTO_TP 29 +#define IPPROTO_DCCP 33 +#define IPPROTO_IPV6 41 +#define IPPROTO_ROUTING 43 +#define IPPROTO_FRAGMENT 44 +#define IPPROTO_RSVP 46 +#define IPPROTO_GRE 47 +#define IPPROTO_ESP 50 +#define IPPROTO_AH 51 +#define IPPROTO_ICMPV6 58 +#define IPPROTO_NONE 59 +#define IPPROTO_DSTOPTS 60 +#define IPPROTO_MTP 92 +#define IPPROTO_BEETPH 94 +#define IPPROTO_ENCAP 98 +#define IPPROTO_PIM 103 +#define IPPROTO_COMP 108 +#define IPPROTO_SCTP 132 +#define IPPROTO_MH 135 +#define IPPROTO_UDPLITE 136 +#define IPPROTO_MPLS 137 +#define IPPROTO_RAW 255 +#define IPPROTO_MAX 256 + +#define IN6_IS_ADDR_UNSPECIFIED(a) \ + (((uint32_t *) (a))[0] == 0 && ((uint32_t *) (a))[1] == 0 && \ + ((uint32_t *) (a))[2] == 0 && ((uint32_t *) (a))[3] == 0) + +#define IN6_IS_ADDR_LOOPBACK(a) \ + (((uint32_t *) (a))[0] == 0 && ((uint32_t *) (a))[1] == 0 && \ + ((uint32_t *) (a))[2] == 0 && \ + ((uint8_t *) (a))[12] == 0 && ((uint8_t *) (a))[13] == 0 && \ + ((uint8_t *) (a))[14] == 0 && ((uint8_t *) (a))[15] == 1 ) + +#define IN6_IS_ADDR_MULTICAST(a) (((uint8_t *) (a))[0] == 0xff) + +#define IN6_IS_ADDR_LINKLOCAL(a) \ + ((((uint8_t *) (a))[0]) == 0xfe && (((uint8_t *) (a))[1] & 0xc0) == 0x80) + +#define IN6_IS_ADDR_SITELOCAL(a) \ + ((((uint8_t *) (a))[0]) == 0xfe && (((uint8_t *) (a))[1] & 0xc0) == 0xc0) + +#define IN6_IS_ADDR_V4MAPPED(a) \ + (((uint32_t *) (a))[0] == 0 && ((uint32_t *) (a))[1] == 0 && \ + ((uint8_t *) (a))[8] == 0 && ((uint8_t *) (a))[9] == 0 && \ + ((uint8_t *) (a))[10] == 0xff && ((uint8_t *) (a))[11] == 0xff) + +#define IN6_IS_ADDR_V4COMPAT(a) \ + (((uint32_t *) (a))[0] == 0 && ((uint32_t *) (a))[1] == 0 && \ + ((uint32_t *) (a))[2] == 0 && ((uint8_t *) (a))[15] > 1) + +#define IN6_IS_ADDR_MC_NODELOCAL(a) \ + (IN6_IS_ADDR_MULTICAST(a) && ((((uint8_t *) (a))[1] & 0xf) == 0x1)) + +#define IN6_IS_ADDR_MC_LINKLOCAL(a) \ + (IN6_IS_ADDR_MULTICAST(a) && ((((uint8_t *) (a))[1] & 0xf) == 0x2)) + +#define IN6_IS_ADDR_MC_SITELOCAL(a) \ + (IN6_IS_ADDR_MULTICAST(a) && ((((uint8_t *) (a))[1] & 0xf) == 0x5)) + +#define IN6_IS_ADDR_MC_ORGLOCAL(a) \ + (IN6_IS_ADDR_MULTICAST(a) && ((((uint8_t *) (a))[1] & 0xf) == 0x8)) + +#define IN6_IS_ADDR_MC_GLOBAL(a) \ + (IN6_IS_ADDR_MULTICAST(a) && ((((uint8_t *) (a))[1] & 0xf) == 0xe)) + +#define __ARE_4_EQUAL(a,b) \ + (!( (0[a]-0[b]) | (1[a]-1[b]) | (2[a]-2[b]) | (3[a]-3[b]) )) +#define IN6_ARE_ADDR_EQUAL(a,b) \ + __ARE_4_EQUAL((const uint32_t *)(a), (const uint32_t *)(b)) + +#define IN_CLASSA(a) ((((in_addr_t)(a)) & 0x80000000) == 0) +#define IN_CLASSA_NET 0xff000000 +#define IN_CLASSA_NSHIFT 24 +#define IN_CLASSA_HOST (0xffffffff & ~IN_CLASSA_NET) +#define IN_CLASSA_MAX 128 +#define IN_CLASSB(a) ((((in_addr_t)(a)) & 0xc0000000) == 0x80000000) +#define IN_CLASSB_NET 0xffff0000 +#define IN_CLASSB_NSHIFT 16 +#define IN_CLASSB_HOST (0xffffffff & ~IN_CLASSB_NET) +#define IN_CLASSB_MAX 65536 +#define IN_CLASSC(a) ((((in_addr_t)(a)) & 0xe0000000) == 0xc0000000) +#define IN_CLASSC_NET 0xffffff00 +#define IN_CLASSC_NSHIFT 8 +#define IN_CLASSC_HOST (0xffffffff & ~IN_CLASSC_NET) +#define IN_CLASSD(a) ((((in_addr_t)(a)) & 0xf0000000) == 0xe0000000) +#define IN_MULTICAST(a) IN_CLASSD(a) +#define IN_EXPERIMENTAL(a) ((((in_addr_t)(a)) & 0xe0000000) == 0xe0000000) +#define IN_BADCLASS(a) ((((in_addr_t)(a)) & 0xf0000000) == 0xf0000000) + +#define IN_LOOPBACKNET 127 + + +#define IP_TOS 1 +#define IP_TTL 2 +#define IP_HDRINCL 3 +#define IP_OPTIONS 4 +#define IP_ROUTER_ALERT 5 +#define IP_RECVOPTS 6 +#define IP_RETOPTS 7 +#define IP_PKTINFO 8 +#define IP_PKTOPTIONS 9 +#define IP_PMTUDISC 10 +#define IP_MTU_DISCOVER 10 +#define IP_RECVERR 11 +#define IP_RECVTTL 12 +#define IP_RECVTOS 13 +#define IP_MTU 14 +#define IP_FREEBIND 15 +#define IP_IPSEC_POLICY 16 +#define IP_XFRM_POLICY 17 +#define IP_PASSSEC 18 +#define IP_TRANSPARENT 19 +#define IP_ORIGDSTADDR 20 +#define IP_RECVORIGDSTADDR IP_ORIGDSTADDR +#define IP_MINTTL 21 +#define IP_NODEFRAG 22 +#define IP_CHECKSUM 23 +#define IP_BIND_ADDRESS_NO_PORT 24 +#define IP_RECVFRAGSIZE 25 +#define IP_MULTICAST_IF 32 +#define IP_MULTICAST_TTL 33 +#define IP_MULTICAST_LOOP 34 +#define IP_ADD_MEMBERSHIP 35 +#define IP_DROP_MEMBERSHIP 36 +#define IP_UNBLOCK_SOURCE 37 +#define IP_BLOCK_SOURCE 38 +#define IP_ADD_SOURCE_MEMBERSHIP 39 +#define IP_DROP_SOURCE_MEMBERSHIP 40 +#define IP_MSFILTER 41 +#define IP_MULTICAST_ALL 49 +#define IP_UNICAST_IF 50 + +#define IP_RECVRETOPTS IP_RETOPTS + +#define IP_PMTUDISC_DONT 0 +#define IP_PMTUDISC_WANT 1 +#define IP_PMTUDISC_DO 2 +#define IP_PMTUDISC_PROBE 3 +#define IP_PMTUDISC_INTERFACE 4 +#define IP_PMTUDISC_OMIT 5 + +#define IP_DEFAULT_MULTICAST_TTL 1 +#define IP_DEFAULT_MULTICAST_LOOP 1 +#define IP_MAX_MEMBERSHIPS 20 + +struct ip_opts { + struct in_addr ip_dst; + char ip_opts[40]; +}; + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) + +#define MCAST_JOIN_GROUP 42 +#define MCAST_BLOCK_SOURCE 43 +#define MCAST_UNBLOCK_SOURCE 44 +#define MCAST_LEAVE_GROUP 45 +#define MCAST_JOIN_SOURCE_GROUP 46 +#define MCAST_LEAVE_SOURCE_GROUP 47 +#define MCAST_MSFILTER 48 + +#define MCAST_EXCLUDE 0 +#define MCAST_INCLUDE 1 + +struct ip_mreq { + struct in_addr imr_multiaddr; + struct in_addr imr_interface; +}; + +struct ip_mreqn { + struct in_addr imr_multiaddr; + struct in_addr imr_address; + int imr_ifindex; +}; + +struct ip_mreq_source { + struct in_addr imr_multiaddr; + struct in_addr imr_interface; + struct in_addr imr_sourceaddr; +}; + +struct ip_msfilter { + struct in_addr imsf_multiaddr; + struct in_addr imsf_interface; + uint32_t imsf_fmode; + uint32_t imsf_numsrc; + struct in_addr imsf_slist[1]; +}; +#define IP_MSFILTER_SIZE(numsrc) \ + (sizeof(struct ip_msfilter) - sizeof(struct in_addr) \ + + (numsrc) * sizeof(struct in_addr)) + +struct group_req { + uint32_t gr_interface; + struct sockaddr_storage gr_group; +}; + +struct group_source_req { + uint32_t gsr_interface; + struct sockaddr_storage gsr_group; + struct sockaddr_storage gsr_source; +}; + +struct group_filter { + uint32_t gf_interface; + struct sockaddr_storage gf_group; + uint32_t gf_fmode; + uint32_t gf_numsrc; + struct sockaddr_storage gf_slist[1]; +}; +#define GROUP_FILTER_SIZE(numsrc) \ + (sizeof(struct group_filter) - sizeof(struct sockaddr_storage) \ + + (numsrc) * sizeof(struct sockaddr_storage)) + +struct in_pktinfo { + int ipi_ifindex; + struct in_addr ipi_spec_dst; + struct in_addr ipi_addr; +}; + +struct in6_pktinfo { + struct in6_addr ipi6_addr; + unsigned ipi6_ifindex; +}; + +struct ip6_mtuinfo { + struct sockaddr_in6 ip6m_addr; + uint32_t ip6m_mtu; +}; +#endif + +#define IPV6_ADDRFORM 1 +#define IPV6_2292PKTINFO 2 +#define IPV6_2292HOPOPTS 3 +#define IPV6_2292DSTOPTS 4 +#define IPV6_2292RTHDR 5 +#define IPV6_2292PKTOPTIONS 6 +#define IPV6_CHECKSUM 7 +#define IPV6_2292HOPLIMIT 8 +#define IPV6_NEXTHOP 9 +#define IPV6_AUTHHDR 10 +#define IPV6_UNICAST_HOPS 16 +#define IPV6_MULTICAST_IF 17 +#define IPV6_MULTICAST_HOPS 18 +#define IPV6_MULTICAST_LOOP 19 +#define IPV6_JOIN_GROUP 20 +#define IPV6_LEAVE_GROUP 21 +#define IPV6_ROUTER_ALERT 22 +#define IPV6_MTU_DISCOVER 23 +#define IPV6_MTU 24 +#define IPV6_RECVERR 25 +#define IPV6_V6ONLY 26 +#define IPV6_JOIN_ANYCAST 27 +#define IPV6_LEAVE_ANYCAST 28 +#define IPV6_MULTICAST_ALL 29 +#define IPV6_ROUTER_ALERT_ISOLATE 30 +#define IPV6_IPSEC_POLICY 34 +#define IPV6_XFRM_POLICY 35 +#define IPV6_HDRINCL 36 + +#define IPV6_RECVPKTINFO 49 +#define IPV6_PKTINFO 50 +#define IPV6_RECVHOPLIMIT 51 +#define IPV6_HOPLIMIT 52 +#define IPV6_RECVHOPOPTS 53 +#define IPV6_HOPOPTS 54 +#define IPV6_RTHDRDSTOPTS 55 +#define IPV6_RECVRTHDR 56 +#define IPV6_RTHDR 57 +#define IPV6_RECVDSTOPTS 58 +#define IPV6_DSTOPTS 59 +#define IPV6_RECVPATHMTU 60 +#define IPV6_PATHMTU 61 +#define IPV6_DONTFRAG 62 +#define IPV6_RECVTCLASS 66 +#define IPV6_TCLASS 67 +#define IPV6_AUTOFLOWLABEL 70 +#define IPV6_ADDR_PREFERENCES 72 +#define IPV6_MINHOPCOUNT 73 +#define IPV6_ORIGDSTADDR 74 +#define IPV6_RECVORIGDSTADDR IPV6_ORIGDSTADDR +#define IPV6_TRANSPARENT 75 +#define IPV6_UNICAST_IF 76 +#define IPV6_RECVFRAGSIZE 77 +#define IPV6_FREEBIND 78 + +#define IPV6_ADD_MEMBERSHIP IPV6_JOIN_GROUP +#define IPV6_DROP_MEMBERSHIP IPV6_LEAVE_GROUP +#define IPV6_RXHOPOPTS IPV6_HOPOPTS +#define IPV6_RXDSTOPTS IPV6_DSTOPTS + +#define IPV6_PMTUDISC_DONT 0 +#define IPV6_PMTUDISC_WANT 1 +#define IPV6_PMTUDISC_DO 2 +#define IPV6_PMTUDISC_PROBE 3 +#define IPV6_PMTUDISC_INTERFACE 4 +#define IPV6_PMTUDISC_OMIT 5 + +#define IPV6_PREFER_SRC_TMP 0x0001 +#define IPV6_PREFER_SRC_PUBLIC 0x0002 +#define IPV6_PREFER_SRC_PUBTMP_DEFAULT 0x0100 +#define IPV6_PREFER_SRC_COA 0x0004 +#define IPV6_PREFER_SRC_HOME 0x0400 +#define IPV6_PREFER_SRC_CGA 0x0008 +#define IPV6_PREFER_SRC_NONCGA 0x0800 + +#define IPV6_RTHDR_LOOSE 0 +#define IPV6_RTHDR_STRICT 1 + +#define IPV6_RTHDR_TYPE_0 0 + +#define __UAPI_DEF_IN_ADDR 0 +#define __UAPI_DEF_IN_IPPROTO 0 +#define __UAPI_DEF_IN_PKTINFO 0 +#define __UAPI_DEF_IP_MREQ 0 +#define __UAPI_DEF_SOCKADDR_IN 0 +#define __UAPI_DEF_IN_CLASS 0 +#define __UAPI_DEF_IN6_ADDR 0 +#define __UAPI_DEF_IN6_ADDR_ALT 0 +#define __UAPI_DEF_SOCKADDR_IN6 0 +#define __UAPI_DEF_IPV6_MREQ 0 +#define __UAPI_DEF_IPPROTO_V6 0 +#define __UAPI_DEF_IPV6_OPTIONS 0 +#define __UAPI_DEF_IN6_PKTINFO 0 +#define __UAPI_DEF_IP6_MTUINFO 0 + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/netinet/in_systm.h b/Ubiquitous/XiZi/lib/musllib/include/netinet/in_systm.h new file mode 100644 index 000000000..a7b417722 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/netinet/in_systm.h @@ -0,0 +1,9 @@ +#ifndef _NETINET_IN_SYSTM_H +#define _NETINET_IN_SYSTM_H + +#include + +typedef uint16_t n_short; +typedef uint32_t n_long, n_time; + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/netinet/ip.h b/Ubiquitous/XiZi/lib/musllib/include/netinet/ip.h new file mode 100644 index 000000000..0ae132a58 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/netinet/ip.h @@ -0,0 +1,199 @@ +#ifndef _NETINET_IP_H +#define _NETINET_IP_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +struct timestamp { + uint8_t len; + uint8_t ptr; +#if __BYTE_ORDER == __LITTLE_ENDIAN + unsigned int flags:4; + unsigned int overflow:4; +#else + unsigned int overflow:4; + unsigned int flags:4; +#endif + uint32_t data[9]; + }; + +struct iphdr { +#if __BYTE_ORDER == __LITTLE_ENDIAN + unsigned int ihl:4; + unsigned int version:4; +#else + unsigned int version:4; + unsigned int ihl:4; +#endif + uint8_t tos; + uint16_t tot_len; + uint16_t id; + uint16_t frag_off; + uint8_t ttl; + uint8_t protocol; + uint16_t check; + uint32_t saddr; + uint32_t daddr; +}; + +struct ip { +#if __BYTE_ORDER == __LITTLE_ENDIAN + unsigned int ip_hl:4; + unsigned int ip_v:4; +#else + unsigned int ip_v:4; + unsigned int ip_hl:4; +#endif + uint8_t ip_tos; + uint16_t ip_len; + uint16_t ip_id; + uint16_t ip_off; + uint8_t ip_ttl; + uint8_t ip_p; + uint16_t ip_sum; + struct in_addr ip_src, ip_dst; +}; + +#define IP_RF 0x8000 +#define IP_DF 0x4000 +#define IP_MF 0x2000 +#define IP_OFFMASK 0x1fff + +struct ip_timestamp { + uint8_t ipt_code; + uint8_t ipt_len; + uint8_t ipt_ptr; +#if __BYTE_ORDER == __LITTLE_ENDIAN + unsigned int ipt_flg:4; + unsigned int ipt_oflw:4; +#else + unsigned int ipt_oflw:4; + unsigned int ipt_flg:4; +#endif + uint32_t data[9]; +}; + +#define IPVERSION 4 +#define IP_MAXPACKET 65535 + +#define IPTOS_ECN_MASK 0x03 +#define IPTOS_ECN(x) ((x) & IPTOS_ECN_MASK) +#define IPTOS_ECN_NOT_ECT 0x00 +#define IPTOS_ECN_ECT1 0x01 +#define IPTOS_ECN_ECT0 0x02 +#define IPTOS_ECN_CE 0x03 + +#define IPTOS_DSCP_MASK 0xfc +#define IPTOS_DSCP(x) ((x) & IPTOS_DSCP_MASK) +#define IPTOS_DSCP_AF11 0x28 +#define IPTOS_DSCP_AF12 0x30 +#define IPTOS_DSCP_AF13 0x38 +#define IPTOS_DSCP_AF21 0x48 +#define IPTOS_DSCP_AF22 0x50 +#define IPTOS_DSCP_AF23 0x58 +#define IPTOS_DSCP_AF31 0x68 +#define IPTOS_DSCP_AF32 0x70 +#define IPTOS_DSCP_AF33 0x78 +#define IPTOS_DSCP_AF41 0x88 +#define IPTOS_DSCP_AF42 0x90 +#define IPTOS_DSCP_AF43 0x98 +#define IPTOS_DSCP_EF 0xb8 + +#define IPTOS_CLASS_MASK 0xe0 +#define IPTOS_CLASS(x) ((x) & IPTOS_CLASS_MASK) +#define IPTOS_CLASS_CS0 0x00 +#define IPTOS_CLASS_CS1 0x20 +#define IPTOS_CLASS_CS2 0x40 +#define IPTOS_CLASS_CS3 0x60 +#define IPTOS_CLASS_CS4 0x80 +#define IPTOS_CLASS_CS5 0xa0 +#define IPTOS_CLASS_CS6 0xc0 +#define IPTOS_CLASS_CS7 0xe0 +#define IPTOS_CLASS_DEFAULT IPTOS_CLASS_CS0 + +#define IPTOS_TOS_MASK 0x1E +#define IPTOS_TOS(tos) ((tos) & IPTOS_TOS_MASK) +#define IPTOS_LOWDELAY 0x10 +#define IPTOS_THROUGHPUT 0x08 +#define IPTOS_RELIABILITY 0x04 +#define IPTOS_LOWCOST 0x02 +#define IPTOS_MINCOST IPTOS_LOWCOST + +#define IPTOS_PREC_MASK 0xe0 +#define IPTOS_PREC(tos) ((tos) & IPTOS_PREC_MASK) +#define IPTOS_PREC_NETCONTROL 0xe0 +#define IPTOS_PREC_INTERNETCONTROL 0xc0 +#define IPTOS_PREC_CRITIC_ECP 0xa0 +#define IPTOS_PREC_FLASHOVERRIDE 0x80 +#define IPTOS_PREC_FLASH 0x60 +#define IPTOS_PREC_IMMEDIATE 0x40 +#define IPTOS_PREC_PRIORITY 0x20 +#define IPTOS_PREC_ROUTINE 0x00 + +#define IPOPT_COPY 0x80 +#define IPOPT_CLASS_MASK 0x60 +#define IPOPT_NUMBER_MASK 0x1f + +#define IPOPT_COPIED(o) ((o) & IPOPT_COPY) +#define IPOPT_CLASS(o) ((o) & IPOPT_CLASS_MASK) +#define IPOPT_NUMBER(o) ((o) & IPOPT_NUMBER_MASK) + +#define IPOPT_CONTROL 0x00 +#define IPOPT_RESERVED1 0x20 +#define IPOPT_DEBMEAS 0x40 +#define IPOPT_MEASUREMENT IPOPT_DEBMEAS +#define IPOPT_RESERVED2 0x60 + +#define IPOPT_EOL 0 +#define IPOPT_END IPOPT_EOL +#define IPOPT_NOP 1 +#define IPOPT_NOOP IPOPT_NOP + +#define IPOPT_RR 7 +#define IPOPT_TS 68 +#define IPOPT_TIMESTAMP IPOPT_TS +#define IPOPT_SECURITY 130 +#define IPOPT_SEC IPOPT_SECURITY +#define IPOPT_LSRR 131 +#define IPOPT_SATID 136 +#define IPOPT_SID IPOPT_SATID +#define IPOPT_SSRR 137 +#define IPOPT_RA 148 + +#define IPOPT_OPTVAL 0 +#define IPOPT_OLEN 1 +#define IPOPT_OFFSET 2 +#define IPOPT_MINOFF 4 + +#define MAX_IPOPTLEN 40 + +#define IPOPT_TS_TSONLY 0 +#define IPOPT_TS_TSANDADDR 1 +#define IPOPT_TS_PRESPEC 3 + +#define IPOPT_SECUR_UNCLASS 0x0000 +#define IPOPT_SECUR_CONFID 0xf135 +#define IPOPT_SECUR_EFTO 0x789a +#define IPOPT_SECUR_MMMM 0xbc4d +#define IPOPT_SECUR_RESTR 0xaf13 +#define IPOPT_SECUR_SECRET 0xd788 +#define IPOPT_SECUR_TOPSECRET 0x6bc5 + +#define MAXTTL 255 +#define IPDEFTTL 64 +#define IPFRAGTTL 60 +#define IPTTLDEC 1 + +#define IP_MSS 576 + +#define __UAPI_DEF_IPHDR 0 + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/netinet/ip6.h b/Ubiquitous/XiZi/lib/musllib/include/netinet/ip6.h new file mode 100644 index 000000000..50c626a69 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/netinet/ip6.h @@ -0,0 +1,141 @@ +#ifndef _NETINET_IP6_H +#define _NETINET_IP6_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +struct ip6_hdr { + union { + struct ip6_hdrctl { + uint32_t ip6_un1_flow; + uint16_t ip6_un1_plen; + uint8_t ip6_un1_nxt; + uint8_t ip6_un1_hlim; + } ip6_un1; + uint8_t ip6_un2_vfc; + } ip6_ctlun; + struct in6_addr ip6_src; + struct in6_addr ip6_dst; +}; + +#define ip6_vfc ip6_ctlun.ip6_un2_vfc +#define ip6_flow ip6_ctlun.ip6_un1.ip6_un1_flow +#define ip6_plen ip6_ctlun.ip6_un1.ip6_un1_plen +#define ip6_nxt ip6_ctlun.ip6_un1.ip6_un1_nxt +#define ip6_hlim ip6_ctlun.ip6_un1.ip6_un1_hlim +#define ip6_hops ip6_ctlun.ip6_un1.ip6_un1_hlim + +struct ip6_ext { + uint8_t ip6e_nxt; + uint8_t ip6e_len; +}; + +struct ip6_hbh { + uint8_t ip6h_nxt; + uint8_t ip6h_len; +}; + +struct ip6_dest { + uint8_t ip6d_nxt; + uint8_t ip6d_len; +}; + +struct ip6_rthdr { + uint8_t ip6r_nxt; + uint8_t ip6r_len; + uint8_t ip6r_type; + uint8_t ip6r_segleft; +}; + +struct ip6_rthdr0 { + uint8_t ip6r0_nxt; + uint8_t ip6r0_len; + uint8_t ip6r0_type; + uint8_t ip6r0_segleft; + uint8_t ip6r0_reserved; + uint8_t ip6r0_slmap[3]; + struct in6_addr ip6r0_addr[]; +}; + +struct ip6_frag { + uint8_t ip6f_nxt; + uint8_t ip6f_reserved; + uint16_t ip6f_offlg; + uint32_t ip6f_ident; +}; + +#if __BYTE_ORDER == __BIG_ENDIAN +#define IP6F_OFF_MASK 0xfff8 +#define IP6F_RESERVED_MASK 0x0006 +#define IP6F_MORE_FRAG 0x0001 +#else +#define IP6F_OFF_MASK 0xf8ff +#define IP6F_RESERVED_MASK 0x0600 +#define IP6F_MORE_FRAG 0x0100 +#endif + +struct ip6_opt { + uint8_t ip6o_type; + uint8_t ip6o_len; +}; + +#define IP6OPT_TYPE(o) ((o) & 0xc0) +#define IP6OPT_TYPE_SKIP 0x00 +#define IP6OPT_TYPE_DISCARD 0x40 +#define IP6OPT_TYPE_FORCEICMP 0x80 +#define IP6OPT_TYPE_ICMP 0xc0 +#define IP6OPT_TYPE_MUTABLE 0x20 + +#define IP6OPT_PAD1 0 +#define IP6OPT_PADN 1 + +#define IP6OPT_JUMBO 0xc2 +#define IP6OPT_NSAP_ADDR 0xc3 +#define IP6OPT_TUNNEL_LIMIT 0x04 +#define IP6OPT_ROUTER_ALERT 0x05 + +struct ip6_opt_jumbo { + uint8_t ip6oj_type; + uint8_t ip6oj_len; + uint8_t ip6oj_jumbo_len[4]; +}; +#define IP6OPT_JUMBO_LEN 6 + +struct ip6_opt_nsap { + uint8_t ip6on_type; + uint8_t ip6on_len; + uint8_t ip6on_src_nsap_len; + uint8_t ip6on_dst_nsap_len; +}; + +struct ip6_opt_tunnel { + uint8_t ip6ot_type; + uint8_t ip6ot_len; + uint8_t ip6ot_encap_limit; +}; + +struct ip6_opt_router { + uint8_t ip6or_type; + uint8_t ip6or_len; + uint8_t ip6or_value[2]; +}; + +#if __BYTE_ORDER == __BIG_ENDIAN +#define IP6_ALERT_MLD 0x0000 +#define IP6_ALERT_RSVP 0x0001 +#define IP6_ALERT_AN 0x0002 +#else +#define IP6_ALERT_MLD 0x0000 +#define IP6_ALERT_RSVP 0x0100 +#define IP6_ALERT_AN 0x0200 +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/netinet/ip_icmp.h b/Ubiquitous/XiZi/lib/musllib/include/netinet/ip_icmp.h new file mode 100644 index 000000000..b9e0df899 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/netinet/ip_icmp.h @@ -0,0 +1,193 @@ +#ifndef _NETINET_IP_ICMP_H +#define _NETINET_IP_ICMP_H + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +struct icmphdr { + uint8_t type; + uint8_t code; + uint16_t checksum; + union { + struct { + uint16_t id; + uint16_t sequence; + } echo; + uint32_t gateway; + struct { + uint16_t __unused; + uint16_t mtu; + } frag; + uint8_t reserved[4]; + } un; +}; + +#define ICMP_ECHOREPLY 0 +#define ICMP_DEST_UNREACH 3 +#define ICMP_SOURCE_QUENCH 4 +#define ICMP_REDIRECT 5 +#define ICMP_ECHO 8 +#define ICMP_TIME_EXCEEDED 11 +#define ICMP_PARAMETERPROB 12 +#define ICMP_TIMESTAMP 13 +#define ICMP_TIMESTAMPREPLY 14 +#define ICMP_INFO_REQUEST 15 +#define ICMP_INFO_REPLY 16 +#define ICMP_ADDRESS 17 +#define ICMP_ADDRESSREPLY 18 +#define NR_ICMP_TYPES 18 + + +#define ICMP_NET_UNREACH 0 +#define ICMP_HOST_UNREACH 1 +#define ICMP_PROT_UNREACH 2 +#define ICMP_PORT_UNREACH 3 +#define ICMP_FRAG_NEEDED 4 +#define ICMP_SR_FAILED 5 +#define ICMP_NET_UNKNOWN 6 +#define ICMP_HOST_UNKNOWN 7 +#define ICMP_HOST_ISOLATED 8 +#define ICMP_NET_ANO 9 +#define ICMP_HOST_ANO 10 +#define ICMP_NET_UNR_TOS 11 +#define ICMP_HOST_UNR_TOS 12 +#define ICMP_PKT_FILTERED 13 +#define ICMP_PREC_VIOLATION 14 +#define ICMP_PREC_CUTOFF 15 +#define NR_ICMP_UNREACH 15 + +#define ICMP_REDIR_NET 0 +#define ICMP_REDIR_HOST 1 +#define ICMP_REDIR_NETTOS 2 +#define ICMP_REDIR_HOSTTOS 3 + +#define ICMP_EXC_TTL 0 +#define ICMP_EXC_FRAGTIME 1 + + +struct icmp_ra_addr { + uint32_t ira_addr; + uint32_t ira_preference; +}; + +struct icmp { + uint8_t icmp_type; + uint8_t icmp_code; + uint16_t icmp_cksum; + union { + uint8_t ih_pptr; + struct in_addr ih_gwaddr; + struct ih_idseq { + uint16_t icd_id; + uint16_t icd_seq; + } ih_idseq; + uint32_t ih_void; + + struct ih_pmtu { + uint16_t ipm_void; + uint16_t ipm_nextmtu; + } ih_pmtu; + + struct ih_rtradv { + uint8_t irt_num_addrs; + uint8_t irt_wpa; + uint16_t irt_lifetime; + } ih_rtradv; + } icmp_hun; + union { + struct { + uint32_t its_otime; + uint32_t its_rtime; + uint32_t its_ttime; + } id_ts; + struct { + struct ip idi_ip; + } id_ip; + struct icmp_ra_addr id_radv; + uint32_t id_mask; + uint8_t id_data[1]; + } icmp_dun; +}; + +#define icmp_pptr icmp_hun.ih_pptr +#define icmp_gwaddr icmp_hun.ih_gwaddr +#define icmp_id icmp_hun.ih_idseq.icd_id +#define icmp_seq icmp_hun.ih_idseq.icd_seq +#define icmp_void icmp_hun.ih_void +#define icmp_pmvoid icmp_hun.ih_pmtu.ipm_void +#define icmp_nextmtu icmp_hun.ih_pmtu.ipm_nextmtu +#define icmp_num_addrs icmp_hun.ih_rtradv.irt_num_addrs +#define icmp_wpa icmp_hun.ih_rtradv.irt_wpa +#define icmp_lifetime icmp_hun.ih_rtradv.irt_lifetime +#define icmp_otime icmp_dun.id_ts.its_otime +#define icmp_rtime icmp_dun.id_ts.its_rtime +#define icmp_ttime icmp_dun.id_ts.its_ttime +#define icmp_ip icmp_dun.id_ip.idi_ip +#define icmp_radv icmp_dun.id_radv +#define icmp_mask icmp_dun.id_mask +#define icmp_data icmp_dun.id_data + +#define ICMP_MINLEN 8 +#define ICMP_TSLEN (8 + 3 * sizeof (n_time)) +#define ICMP_MASKLEN 12 +#define ICMP_ADVLENMIN (8 + sizeof (struct ip) + 8) +#define ICMP_ADVLEN(p) (8 + ((p)->icmp_ip.ip_hl << 2) + 8) + +#define ICMP_UNREACH 3 +#define ICMP_SOURCEQUENCH 4 +#define ICMP_ROUTERADVERT 9 +#define ICMP_ROUTERSOLICIT 10 +#define ICMP_TIMXCEED 11 +#define ICMP_PARAMPROB 12 +#define ICMP_TSTAMP 13 +#define ICMP_TSTAMPREPLY 14 +#define ICMP_IREQ 15 +#define ICMP_IREQREPLY 16 +#define ICMP_MASKREQ 17 +#define ICMP_MASKREPLY 18 +#define ICMP_MAXTYPE 18 + +#define ICMP_UNREACH_NET 0 +#define ICMP_UNREACH_HOST 1 +#define ICMP_UNREACH_PROTOCOL 2 +#define ICMP_UNREACH_PORT 3 +#define ICMP_UNREACH_NEEDFRAG 4 +#define ICMP_UNREACH_SRCFAIL 5 +#define ICMP_UNREACH_NET_UNKNOWN 6 +#define ICMP_UNREACH_HOST_UNKNOWN 7 +#define ICMP_UNREACH_ISOLATED 8 +#define ICMP_UNREACH_NET_PROHIB 9 +#define ICMP_UNREACH_HOST_PROHIB 10 +#define ICMP_UNREACH_TOSNET 11 +#define ICMP_UNREACH_TOSHOST 12 +#define ICMP_UNREACH_FILTER_PROHIB 13 +#define ICMP_UNREACH_HOST_PRECEDENCE 14 +#define ICMP_UNREACH_PRECEDENCE_CUTOFF 15 + +#define ICMP_REDIRECT_NET 0 +#define ICMP_REDIRECT_HOST 1 +#define ICMP_REDIRECT_TOSNET 2 +#define ICMP_REDIRECT_TOSHOST 3 + +#define ICMP_TIMXCEED_INTRANS 0 +#define ICMP_TIMXCEED_REASS 1 + +#define ICMP_PARAMPROB_OPTABSENT 1 + +#define ICMP_INFOTYPE(type) \ + ((type) == ICMP_ECHOREPLY || (type) == ICMP_ECHO || \ + (type) == ICMP_ROUTERADVERT || (type) == ICMP_ROUTERSOLICIT || \ + (type) == ICMP_TSTAMP || (type) == ICMP_TSTAMPREPLY || \ + (type) == ICMP_IREQ || (type) == ICMP_IREQREPLY || \ + (type) == ICMP_MASKREQ || (type) == ICMP_MASKREPLY) + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/netinet/tcp.h b/Ubiquitous/XiZi/lib/musllib/include/netinet/tcp.h new file mode 100644 index 000000000..44a007aaf --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/netinet/tcp.h @@ -0,0 +1,282 @@ +#ifndef _NETINET_TCP_H +#define _NETINET_TCP_H + +#include + +#define TCP_NODELAY 1 +#define TCP_MAXSEG 2 +#define TCP_CORK 3 +#define TCP_KEEPIDLE 4 +#define TCP_KEEPINTVL 5 +#define TCP_KEEPCNT 6 +#define TCP_SYNCNT 7 +#define TCP_LINGER2 8 +#define TCP_DEFER_ACCEPT 9 +#define TCP_WINDOW_CLAMP 10 +#define TCP_INFO 11 +#define TCP_QUICKACK 12 +#define TCP_CONGESTION 13 +#define TCP_MD5SIG 14 +#define TCP_THIN_LINEAR_TIMEOUTS 16 +#define TCP_THIN_DUPACK 17 +#define TCP_USER_TIMEOUT 18 +#define TCP_REPAIR 19 +#define TCP_REPAIR_QUEUE 20 +#define TCP_QUEUE_SEQ 21 +#define TCP_REPAIR_OPTIONS 22 +#define TCP_FASTOPEN 23 +#define TCP_TIMESTAMP 24 +#define TCP_NOTSENT_LOWAT 25 +#define TCP_CC_INFO 26 +#define TCP_SAVE_SYN 27 +#define TCP_SAVED_SYN 28 +#define TCP_REPAIR_WINDOW 29 +#define TCP_FASTOPEN_CONNECT 30 +#define TCP_ULP 31 +#define TCP_MD5SIG_EXT 32 +#define TCP_FASTOPEN_KEY 33 +#define TCP_FASTOPEN_NO_COOKIE 34 +#define TCP_ZEROCOPY_RECEIVE 35 +#define TCP_INQ 36 +#define TCP_TX_DELAY 37 + +#define TCP_CM_INQ TCP_INQ + +#define TCP_ESTABLISHED 1 +#define TCP_SYN_SENT 2 +#define TCP_SYN_RECV 3 +#define TCP_FIN_WAIT1 4 +#define TCP_FIN_WAIT2 5 +#define TCP_TIME_WAIT 6 +#define TCP_CLOSE 7 +#define TCP_CLOSE_WAIT 8 +#define TCP_LAST_ACK 9 +#define TCP_LISTEN 10 +#define TCP_CLOSING 11 + +enum { + TCP_NLA_PAD, + TCP_NLA_BUSY, + TCP_NLA_RWND_LIMITED, + TCP_NLA_SNDBUF_LIMITED, + TCP_NLA_DATA_SEGS_OUT, + TCP_NLA_TOTAL_RETRANS, + TCP_NLA_PACING_RATE, + TCP_NLA_DELIVERY_RATE, + TCP_NLA_SND_CWND, + TCP_NLA_REORDERING, + TCP_NLA_MIN_RTT, + TCP_NLA_RECUR_RETRANS, + TCP_NLA_DELIVERY_RATE_APP_LMT, + TCP_NLA_SNDQ_SIZE, + TCP_NLA_CA_STATE, + TCP_NLA_SND_SSTHRESH, + TCP_NLA_DELIVERED, + TCP_NLA_DELIVERED_CE, + TCP_NLA_BYTES_SENT, + TCP_NLA_BYTES_RETRANS, + TCP_NLA_DSACK_DUPS, + TCP_NLA_REORD_SEEN, + TCP_NLA_SRTT, +}; + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +#define TCPOPT_EOL 0 +#define TCPOPT_NOP 1 +#define TCPOPT_MAXSEG 2 +#define TCPOPT_WINDOW 3 +#define TCPOPT_SACK_PERMITTED 4 +#define TCPOPT_SACK 5 +#define TCPOPT_TIMESTAMP 8 +#define TCPOLEN_SACK_PERMITTED 2 +#define TCPOLEN_WINDOW 3 +#define TCPOLEN_MAXSEG 4 +#define TCPOLEN_TIMESTAMP 10 + +#define SOL_TCP 6 + +#include +#include +#include + +typedef uint32_t tcp_seq; + +#define TH_FIN 0x01 +#define TH_SYN 0x02 +#define TH_RST 0x04 +#define TH_PUSH 0x08 +#define TH_ACK 0x10 +#define TH_URG 0x20 + +struct tcphdr { +#ifdef _GNU_SOURCE +#ifdef __GNUC__ + __extension__ +#endif + union { struct { + + uint16_t source; + uint16_t dest; + uint32_t seq; + uint32_t ack_seq; +#if __BYTE_ORDER == __LITTLE_ENDIAN + uint16_t res1:4; + uint16_t doff:4; + uint16_t fin:1; + uint16_t syn:1; + uint16_t rst:1; + uint16_t psh:1; + uint16_t ack:1; + uint16_t urg:1; + uint16_t res2:2; +#else + uint16_t doff:4; + uint16_t res1:4; + uint16_t res2:2; + uint16_t urg:1; + uint16_t ack:1; + uint16_t psh:1; + uint16_t rst:1; + uint16_t syn:1; + uint16_t fin:1; +#endif + uint16_t window; + uint16_t check; + uint16_t urg_ptr; + + }; struct { +#endif + + uint16_t th_sport; + uint16_t th_dport; + uint32_t th_seq; + uint32_t th_ack; +#if __BYTE_ORDER == __LITTLE_ENDIAN + uint8_t th_x2:4; + uint8_t th_off:4; +#else + uint8_t th_off:4; + uint8_t th_x2:4; +#endif + uint8_t th_flags; + uint16_t th_win; + uint16_t th_sum; + uint16_t th_urp; + +#ifdef _GNU_SOURCE + }; }; +#endif +}; +#endif + +#ifdef _GNU_SOURCE +#define TCPI_OPT_TIMESTAMPS 1 +#define TCPI_OPT_SACK 2 +#define TCPI_OPT_WSCALE 4 +#define TCPI_OPT_ECN 8 + +#define TCP_CA_Open 0 +#define TCP_CA_Disorder 1 +#define TCP_CA_CWR 2 +#define TCP_CA_Recovery 3 +#define TCP_CA_Loss 4 + +struct tcp_info { + uint8_t tcpi_state; + uint8_t tcpi_ca_state; + uint8_t tcpi_retransmits; + uint8_t tcpi_probes; + uint8_t tcpi_backoff; + uint8_t tcpi_options; + uint8_t tcpi_snd_wscale : 4, tcpi_rcv_wscale : 4; + uint8_t tcpi_delivery_rate_app_limited : 1; + uint32_t tcpi_rto; + uint32_t tcpi_ato; + uint32_t tcpi_snd_mss; + uint32_t tcpi_rcv_mss; + uint32_t tcpi_unacked; + uint32_t tcpi_sacked; + uint32_t tcpi_lost; + uint32_t tcpi_retrans; + uint32_t tcpi_fackets; + uint32_t tcpi_last_data_sent; + uint32_t tcpi_last_ack_sent; + uint32_t tcpi_last_data_recv; + uint32_t tcpi_last_ack_recv; + uint32_t tcpi_pmtu; + uint32_t tcpi_rcv_ssthresh; + uint32_t tcpi_rtt; + uint32_t tcpi_rttvar; + uint32_t tcpi_snd_ssthresh; + uint32_t tcpi_snd_cwnd; + uint32_t tcpi_advmss; + uint32_t tcpi_reordering; + uint32_t tcpi_rcv_rtt; + uint32_t tcpi_rcv_space; + uint32_t tcpi_total_retrans; + uint64_t tcpi_pacing_rate; + uint64_t tcpi_max_pacing_rate; + uint64_t tcpi_bytes_acked; + uint64_t tcpi_bytes_received; + uint32_t tcpi_segs_out; + uint32_t tcpi_segs_in; + uint32_t tcpi_notsent_bytes; + uint32_t tcpi_min_rtt; + uint32_t tcpi_data_segs_in; + uint32_t tcpi_data_segs_out; + uint64_t tcpi_delivery_rate; + uint64_t tcpi_busy_time; + uint64_t tcpi_rwnd_limited; + uint64_t tcpi_sndbuf_limited; + uint32_t tcpi_delivered; + uint32_t tcpi_delivered_ce; + uint64_t tcpi_bytes_sent; + uint64_t tcpi_bytes_retrans; + uint32_t tcpi_dsack_dups; + uint32_t tcpi_reord_seen; + uint32_t tcpi_rcv_ooopack; + uint32_t tcpi_snd_wnd; +}; + +#define TCP_MD5SIG_MAXKEYLEN 80 + +#define TCP_MD5SIG_FLAG_PREFIX 1 + +struct tcp_md5sig { + struct sockaddr_storage tcpm_addr; + uint8_t tcpm_flags; + uint8_t tcpm_prefixlen; + uint16_t tcpm_keylen; + uint32_t __tcpm_pad; + uint8_t tcpm_key[TCP_MD5SIG_MAXKEYLEN]; +}; + +struct tcp_diag_md5sig { + uint8_t tcpm_family; + uint8_t tcpm_prefixlen; + uint16_t tcpm_keylen; + uint32_t tcpm_addr[4]; + uint8_t tcpm_key[TCP_MD5SIG_MAXKEYLEN]; +}; + +#define TCP_REPAIR_ON 1 +#define TCP_REPAIR_OFF 0 +#define TCP_REPAIR_OFF_NO_WP -1 + +struct tcp_repair_window { + uint32_t snd_wl1; + uint32_t snd_wnd; + uint32_t max_window; + uint32_t rcv_wnd; + uint32_t rcv_wup; +}; + +struct tcp_zerocopy_receive { + uint64_t address; + uint32_t length; + uint32_t recv_skip_hint; +}; + +#endif + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/netinet/udp.h b/Ubiquitous/XiZi/lib/musllib/include/netinet/udp.h new file mode 100644 index 000000000..ffd890796 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/netinet/udp.h @@ -0,0 +1,45 @@ +#ifndef _NETINET_UDP_H +#define _NETINET_UDP_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +#ifdef _GNU_SOURCE +#define uh_sport source +#define uh_dport dest +#define uh_ulen len +#define uh_sum check +#endif + +struct udphdr { + uint16_t uh_sport; + uint16_t uh_dport; + uint16_t uh_ulen; + uint16_t uh_sum; +}; + +#define UDP_CORK 1 +#define UDP_ENCAP 100 +#define UDP_NO_CHECK6_TX 101 +#define UDP_NO_CHECK6_RX 102 +#define UDP_SEGMENT 103 +#define UDP_GRO 104 + +#define UDP_ENCAP_ESPINUDP_NON_IKE 1 +#define UDP_ENCAP_ESPINUDP 2 +#define UDP_ENCAP_L2TPINUDP 3 +#define UDP_ENCAP_GTP0 4 +#define UDP_ENCAP_GTP1U 5 +#define UDP_ENCAP_RXRPC 6 + +#define SOL_UDP 17 + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/netpacket/packet.h b/Ubiquitous/XiZi/lib/musllib/include/netpacket/packet.h new file mode 100644 index 000000000..b36e092ad --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/netpacket/packet.h @@ -0,0 +1,62 @@ +#ifndef _NETPACKET_PACKET_H +#define _NETPACKET_PACKET_H + +#ifdef __cplusplus +extern "C" { +#endif + +struct sockaddr_ll { + unsigned short sll_family, sll_protocol; + int sll_ifindex; + unsigned short sll_hatype; + unsigned char sll_pkttype, sll_halen; + unsigned char sll_addr[8]; +}; + +struct packet_mreq { + int mr_ifindex; + unsigned short int mr_type, mr_alen; + unsigned char mr_address[8]; +}; + +#define PACKET_HOST 0 +#define PACKET_BROADCAST 1 +#define PACKET_MULTICAST 2 +#define PACKET_OTHERHOST 3 +#define PACKET_OUTGOING 4 +#define PACKET_LOOPBACK 5 +#define PACKET_FASTROUTE 6 + +#define PACKET_ADD_MEMBERSHIP 1 +#define PACKET_DROP_MEMBERSHIP 2 +#define PACKET_RECV_OUTPUT 3 +#define PACKET_RX_RING 5 +#define PACKET_STATISTICS 6 +#define PACKET_COPY_THRESH 7 +#define PACKET_AUXDATA 8 +#define PACKET_ORIGDEV 9 +#define PACKET_VERSION 10 +#define PACKET_HDRLEN 11 +#define PACKET_RESERVE 12 +#define PACKET_TX_RING 13 +#define PACKET_LOSS 14 +#define PACKET_VNET_HDR 15 +#define PACKET_TX_TIMESTAMP 16 +#define PACKET_TIMESTAMP 17 +#define PACKET_FANOUT 18 +#define PACKET_TX_HAS_OFF 19 +#define PACKET_QDISC_BYPASS 20 +#define PACKET_ROLLOVER_STATS 21 +#define PACKET_FANOUT_DATA 22 +#define PACKET_IGNORE_OUTGOING 23 + +#define PACKET_MR_MULTICAST 0 +#define PACKET_MR_PROMISC 1 +#define PACKET_MR_ALLMULTI 2 +#define PACKET_MR_UNICAST 3 + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/nl_types.h b/Ubiquitous/XiZi/lib/musllib/include/nl_types.h new file mode 100644 index 000000000..7c2d48e0f --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/nl_types.h @@ -0,0 +1,22 @@ +#ifndef _NL_TYPES_H +#define _NL_TYPES_H + +#ifdef __cplusplus +extern "C" { +#endif + +#define NL_SETD 1 +#define NL_CAT_LOCALE 1 + +typedef int nl_item; +typedef void *nl_catd; + +nl_catd catopen (const char *, int); +char *catgets (nl_catd, int, int, const char *); +int catclose (nl_catd); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/paths.h b/Ubiquitous/XiZi/lib/musllib/include/paths.h new file mode 100644 index 000000000..67de6b3c3 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/paths.h @@ -0,0 +1,31 @@ +#ifndef _PATHS_H +#define _PATHS_H + +#define _PATH_DEFPATH "/usr/local/bin:/bin:/usr/bin" +#define _PATH_STDPATH "/bin:/usr/bin:/sbin:/usr/sbin" + +#define _PATH_BSHELL "/bin/sh" +#define _PATH_CONSOLE "/dev/console" +#define _PATH_DEVNULL "/dev/null" +#define _PATH_KLOG "/proc/kmsg" +#define _PATH_LASTLOG "/var/log/lastlog" +#define _PATH_MAILDIR "/var/mail" +#define _PATH_MAN "/usr/share/man" +#define _PATH_MNTTAB "/etc/fstab" +#define _PATH_MOUNTED "/etc/mtab" +#define _PATH_NOLOGIN "/etc/nologin" +#define _PATH_SENDMAIL "/usr/sbin/sendmail" +#define _PATH_SHADOW "/etc/shadow" +#define _PATH_SHELLS "/etc/shells" +#define _PATH_TTY "/dev/tty" +#define _PATH_UTMP "/dev/null/utmp" +#define _PATH_VI "/usr/bin/vi" +#define _PATH_WTMP "/dev/null/wtmp" + +#define _PATH_DEV "/dev/" +#define _PATH_TMP "/tmp/" +#define _PATH_VARDB "/var/lib/misc/" +#define _PATH_VARRUN "/var/run/" +#define _PATH_VARTMP "/var/tmp/" + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/poll.h b/Ubiquitous/XiZi/lib/musllib/include/poll.h new file mode 100644 index 000000000..472e4b847 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/poll.h @@ -0,0 +1,57 @@ +#ifndef _POLL_H +#define _POLL_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#include + +#define POLLIN 0x001 +#define POLLPRI 0x002 +#define POLLOUT 0x004 +#define POLLERR 0x008 +#define POLLHUP 0x010 +#define POLLNVAL 0x020 +#define POLLRDNORM 0x040 +#define POLLRDBAND 0x080 +#ifndef POLLWRNORM +#define POLLWRNORM 0x100 +#define POLLWRBAND 0x200 +#endif +#ifndef POLLMSG +#define POLLMSG 0x400 +#define POLLRDHUP 0x2000 +#endif + +typedef unsigned long nfds_t; + +struct pollfd { + int fd; + short events; + short revents; +}; + +int poll (struct pollfd *, nfds_t, int); + +#ifdef _GNU_SOURCE +#define __NEED_time_t +#define __NEED_struct_timespec +#define __NEED_sigset_t +#include +int ppoll(struct pollfd *, nfds_t, const struct timespec *, const sigset_t *); +#endif + +#if _REDIR_TIME64 +#ifdef _GNU_SOURCE +__REDIR(ppoll, __ppoll_time64); +#endif +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/pthread.h b/Ubiquitous/XiZi/lib/musllib/include/pthread.h new file mode 100644 index 000000000..a951f63f6 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/pthread.h @@ -0,0 +1,244 @@ +#ifndef _PTHREAD_H +#define _PTHREAD_H +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#define __NEED_time_t +#define __NEED_clockid_t +#define __NEED_struct_timespec +#define __NEED_sigset_t +#define __NEED_pthread_t +#define __NEED_pthread_attr_t +#define __NEED_pthread_mutexattr_t +#define __NEED_pthread_condattr_t +#define __NEED_pthread_rwlockattr_t +#define __NEED_pthread_barrierattr_t +#define __NEED_pthread_mutex_t +#define __NEED_pthread_cond_t +#define __NEED_pthread_rwlock_t +#define __NEED_pthread_barrier_t +#define __NEED_pthread_spinlock_t +#define __NEED_pthread_key_t +#define __NEED_pthread_once_t +#define __NEED_size_t + +#include +#include +#include + +#define PTHREAD_CREATE_JOINABLE 0 +#define PTHREAD_CREATE_DETACHED 1 + +#define PTHREAD_MUTEX_NORMAL 0 +#define PTHREAD_MUTEX_DEFAULT 0 +#define PTHREAD_MUTEX_RECURSIVE 1 +#define PTHREAD_MUTEX_ERRORCHECK 2 + +#define PTHREAD_MUTEX_STALLED 0 +#define PTHREAD_MUTEX_ROBUST 1 + +#define PTHREAD_PRIO_NONE 0 +#define PTHREAD_PRIO_INHERIT 1 +#define PTHREAD_PRIO_PROTECT 2 + +#define PTHREAD_INHERIT_SCHED 0 +#define PTHREAD_EXPLICIT_SCHED 1 + +#define PTHREAD_SCOPE_SYSTEM 0 +#define PTHREAD_SCOPE_PROCESS 1 + +#define PTHREAD_PROCESS_PRIVATE 0 +#define PTHREAD_PROCESS_SHARED 1 + + +#define _MUX_MAGIC 0xEBCFDEA0 +#define _MUX_INVALID_HANDLE 0xEEEEEEEF + +#define PTHREAD_MUTEXATTR_INITIALIZER { PTHREAD_MUTEX_RECURSIVE } +#define PTHREAD_MUTEX_INITIALIZER { _MUX_MAGIC, _MUX_INVALID_HANDLE, PTHREAD_MUTEXATTR_INITIALIZER } +#ifdef _GNU_SOURCE +#define PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP { _MUX_MAGIC, _MUX_INVALID_HANDLE, PTHREAD_MUTEXATTR_INITIALIZER } +#endif +#define PTHREAD_RWLOCK_INITIALIZER {{{0}}} +#define PTHREAD_COND_INITIALIZER {{{0}}} +#define PTHREAD_ONCE_INIT 0 + + +#define PTHREAD_CANCEL_ENABLE 0 +#define PTHREAD_CANCEL_DISABLE 1 +#define PTHREAD_CANCEL_MASKED 2 + +#define PTHREAD_CANCEL_DEFERRED 0 +#define PTHREAD_CANCEL_ASYNCHRONOUS 1 + +#define PTHREAD_CANCELED ((void *)-1) + + +#define PTHREAD_BARRIER_SERIAL_THREAD (-1) + + +int pthread_create(pthread_t *__restrict, const pthread_attr_t *__restrict, void *(*)(void *), void *__restrict); +int pthread_detach(pthread_t); +void pthread_exit(void *); +int pthread_join(pthread_t, void **); + +#ifdef __GNUC__ +__attribute__((const)) +#endif +pthread_t pthread_self(void); + +int pthread_equal(pthread_t, pthread_t); + +int pthread_setcancelstate(int, int *); +int pthread_setcanceltype(int, int *); +void pthread_testcancel(void); +int pthread_cancel(pthread_t); + +int pthread_getschedparam(pthread_t, int *__restrict, struct sched_param *__restrict); +int pthread_setschedparam(pthread_t, int, const struct sched_param *); +int pthread_setschedprio(pthread_t, int); + +int pthread_once(pthread_once_t *, void (*)(void)); + +int pthread_mutex_init(pthread_mutex_t *__restrict, const pthread_mutexattr_t *__restrict); +int pthread_mutex_lock(pthread_mutex_t *); +int pthread_mutex_unlock(pthread_mutex_t *); +int pthread_mutex_trylock(pthread_mutex_t *); +int pthread_mutex_timedlock(pthread_mutex_t *__restrict, const struct timespec *__restrict); +int pthread_mutex_destroy(pthread_mutex_t *); +int pthread_mutex_consistent(pthread_mutex_t *); + +int pthread_mutex_getprioceiling(const pthread_mutex_t *__restrict, int *__restrict); +int pthread_mutex_setprioceiling(pthread_mutex_t *__restrict, int, int *__restrict); + +int pthread_cond_init(pthread_cond_t *__restrict, const pthread_condattr_t *__restrict); +int pthread_cond_destroy(pthread_cond_t *); +int pthread_cond_wait(pthread_cond_t *__restrict, pthread_mutex_t *__restrict); +int pthread_cond_timedwait(pthread_cond_t *__restrict, pthread_mutex_t *__restrict, const struct timespec *__restrict); +int pthread_cond_broadcast(pthread_cond_t *); +int pthread_cond_signal(pthread_cond_t *); + +int pthread_rwlock_init(pthread_rwlock_t *__restrict, const pthread_rwlockattr_t *__restrict); +int pthread_rwlock_destroy(pthread_rwlock_t *); +int pthread_rwlock_rdlock(pthread_rwlock_t *); +int pthread_rwlock_tryrdlock(pthread_rwlock_t *); +int pthread_rwlock_timedrdlock(pthread_rwlock_t *__restrict, const struct timespec *__restrict); +int pthread_rwlock_wrlock(pthread_rwlock_t *); +int pthread_rwlock_trywrlock(pthread_rwlock_t *); +int pthread_rwlock_timedwrlock(pthread_rwlock_t *__restrict, const struct timespec *__restrict); +int pthread_rwlock_unlock(pthread_rwlock_t *); + +int pthread_spin_init(pthread_spinlock_t *, int); +int pthread_spin_destroy(pthread_spinlock_t *); +int pthread_spin_lock(pthread_spinlock_t *); +int pthread_spin_trylock(pthread_spinlock_t *); +int pthread_spin_unlock(pthread_spinlock_t *); + +int pthread_barrier_init(pthread_barrier_t *__restrict, const pthread_barrierattr_t *__restrict, unsigned); +int pthread_barrier_destroy(pthread_barrier_t *); +int pthread_barrier_wait(pthread_barrier_t *); + +int pthread_key_create(pthread_key_t *, void (*)(void *)); +int pthread_key_delete(pthread_key_t); +void *pthread_getspecific(pthread_key_t); +int pthread_setspecific(pthread_key_t, const void *); + +int pthread_attr_init(pthread_attr_t *); +int pthread_attr_destroy(pthread_attr_t *); + +int pthread_attr_getguardsize(const pthread_attr_t *__restrict, size_t *__restrict); +int pthread_attr_setguardsize(pthread_attr_t *, size_t); +int pthread_attr_getstacksize(const pthread_attr_t *__restrict, size_t *__restrict); +int pthread_attr_setstacksize(pthread_attr_t *, size_t); +int pthread_attr_getdetachstate(const pthread_attr_t *, int *); +int pthread_attr_setdetachstate(pthread_attr_t *, int); +int pthread_attr_getstack(const pthread_attr_t *__restrict, void **__restrict, size_t *__restrict); +int pthread_attr_setstack(pthread_attr_t *, void *, size_t); +int pthread_attr_getscope(const pthread_attr_t *__restrict, int *__restrict); +int pthread_attr_setscope(pthread_attr_t *, int); +int pthread_attr_getschedpolicy(const pthread_attr_t *__restrict, int *__restrict); +int pthread_attr_setschedpolicy(pthread_attr_t *, int); +int pthread_attr_getschedparam(const pthread_attr_t *__restrict, struct sched_param *__restrict); +int pthread_attr_setschedparam(pthread_attr_t *__restrict, const struct sched_param *__restrict); +int pthread_attr_getinheritsched(const pthread_attr_t *__restrict, int *__restrict); +int pthread_attr_setinheritsched(pthread_attr_t *, int); + +int pthread_mutexattr_destroy(pthread_mutexattr_t *); +int pthread_mutexattr_getprioceiling(const pthread_mutexattr_t *__restrict, int *__restrict); +int pthread_mutexattr_getprotocol(const pthread_mutexattr_t *__restrict, int *__restrict); +int pthread_mutexattr_getpshared(const pthread_mutexattr_t *__restrict, int *__restrict); +int pthread_mutexattr_getrobust(const pthread_mutexattr_t *__restrict, int *__restrict); +int pthread_mutexattr_gettype(const pthread_mutexattr_t *__restrict, int *__restrict); +int pthread_mutexattr_init(pthread_mutexattr_t *); +int pthread_mutexattr_setprioceiling(pthread_mutexattr_t *, int); +int pthread_mutexattr_setprotocol(pthread_mutexattr_t *, int); +int pthread_mutexattr_setpshared(pthread_mutexattr_t *, int); +int pthread_mutexattr_setrobust(pthread_mutexattr_t *, int); +int pthread_mutexattr_settype(pthread_mutexattr_t *, int); + +int pthread_condattr_init(pthread_condattr_t *); +int pthread_condattr_destroy(pthread_condattr_t *); +int pthread_condattr_setclock(pthread_condattr_t *, clockid_t); +int pthread_condattr_setpshared(pthread_condattr_t *, int); +int pthread_condattr_getclock(const pthread_condattr_t *__restrict, clockid_t *__restrict); +int pthread_condattr_getpshared(const pthread_condattr_t *__restrict, int *__restrict); + +int pthread_rwlockattr_init(pthread_rwlockattr_t *); +int pthread_rwlockattr_destroy(pthread_rwlockattr_t *); +int pthread_rwlockattr_setpshared(pthread_rwlockattr_t *, int); +int pthread_rwlockattr_getpshared(const pthread_rwlockattr_t *__restrict, int *__restrict); + +int pthread_barrierattr_destroy(pthread_barrierattr_t *); +int pthread_barrierattr_getpshared(const pthread_barrierattr_t *__restrict, int *__restrict); +int pthread_barrierattr_init(pthread_barrierattr_t *); +int pthread_barrierattr_setpshared(pthread_barrierattr_t *, int); + +int pthread_atfork(void (*)(void), void (*)(void), void (*)(void)); + +int pthread_getconcurrency(void); +int pthread_setconcurrency(int); + +int pthread_getcpuclockid(pthread_t, clockid_t *); + +struct __ptcb { + void (*__f)(void *); + void *__x; + struct __ptcb *__next; +}; + +void _pthread_cleanup_push(struct __ptcb *, void (*)(void *), void *); +void _pthread_cleanup_pop(struct __ptcb *, int); + +#define pthread_cleanup_push(f, x) do { struct __ptcb __cb; _pthread_cleanup_push(&__cb, f, x); +#define pthread_cleanup_pop(r) _pthread_cleanup_pop(&__cb, (r)); } while(0) + +#ifdef _GNU_SOURCE +struct cpu_set_t; +int pthread_getaffinity_np(pthread_t, size_t, struct cpu_set_t *); +int pthread_setaffinity_np(pthread_t, size_t, const struct cpu_set_t *); +int pthread_getattr_np(pthread_t, pthread_attr_t *); +int pthread_getname_np(pthread_t, char *, size_t); +int pthread_setname_np(pthread_t, const char *); +int pthread_getattr_default_np(pthread_attr_t *); +int pthread_setattr_default_np(const pthread_attr_t *); +int pthread_tryjoin_np(pthread_t, void **); +int pthread_timedjoin_np(pthread_t, void **, const struct timespec *); +#endif + +#if _REDIR_TIME64 +__REDIR(pthread_mutex_timedlock, __pthread_mutex_timedlock_time64); +__REDIR(pthread_cond_timedwait, __pthread_cond_timedwait_time64); +__REDIR(pthread_rwlock_timedrdlock, __pthread_rwlock_timedrdlock_time64); +__REDIR(pthread_rwlock_timedwrlock, __pthread_rwlock_timedwrlock_time64); +#ifdef _GNU_SOURCE +__REDIR(pthread_timedjoin_np, __pthread_timedjoin_np_time64); +#endif +#endif + +#ifdef __cplusplus +} +#endif +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/pty.h b/Ubiquitous/XiZi/lib/musllib/include/pty.h new file mode 100644 index 000000000..db6385341 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/pty.h @@ -0,0 +1,18 @@ +#ifndef _PTY_H +#define _PTY_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +int openpty(int *, int *, char *, const struct termios *, const struct winsize *); +int forkpty(int *, char *, const struct termios *, const struct winsize *); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/pwd.h b/Ubiquitous/XiZi/lib/musllib/include/pwd.h new file mode 100644 index 000000000..4f470b558 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/pwd.h @@ -0,0 +1,50 @@ +#ifndef _PWD_H +#define _PWD_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#define __NEED_size_t +#define __NEED_uid_t +#define __NEED_gid_t + +#ifdef _GNU_SOURCE +#define __NEED_FILE +#endif + +#include + +struct passwd { + char *pw_name; + char *pw_passwd; + uid_t pw_uid; + gid_t pw_gid; + char *pw_gecos; + char *pw_dir; + char *pw_shell; +}; + +#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +void setpwent (void); +void endpwent (void); +struct passwd *getpwent (void); +#endif + +struct passwd *getpwuid (uid_t); +struct passwd *getpwnam (const char *); +int getpwuid_r (uid_t, struct passwd *, char *, size_t, struct passwd **); +int getpwnam_r (const char *, struct passwd *, char *, size_t, struct passwd **); + +#ifdef _GNU_SOURCE +struct passwd *fgetpwent(FILE *); +int putpwent(const struct passwd *, FILE *); +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/regex.h b/Ubiquitous/XiZi/lib/musllib/include/regex.h new file mode 100644 index 000000000..dce217718 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/regex.h @@ -0,0 +1,62 @@ +#ifndef _REGEX_H +#define _REGEX_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#define __NEED_regoff_t +#define __NEED_size_t + +#include + +typedef struct re_pattern_buffer { + size_t re_nsub; + void *__opaque, *__padding[4]; + size_t __nsub2; + char __padding2; +} regex_t; + +typedef struct { + regoff_t rm_so; + regoff_t rm_eo; +} regmatch_t; + +#define REG_EXTENDED 1 +#define REG_ICASE 2 +#define REG_NEWLINE 4 +#define REG_NOSUB 8 + +#define REG_NOTBOL 1 +#define REG_NOTEOL 2 + +#define REG_OK 0 +#define REG_NOMATCH 1 +#define REG_BADPAT 2 +#define REG_ECOLLATE 3 +#define REG_ECTYPE 4 +#define REG_EESCAPE 5 +#define REG_ESUBREG 6 +#define REG_EBRACK 7 +#define REG_EPAREN 8 +#define REG_EBRACE 9 +#define REG_BADBR 10 +#define REG_ERANGE 11 +#define REG_ESPACE 12 +#define REG_BADRPT 13 + +#define REG_ENOSYS -1 + +int regcomp(regex_t *__restrict, const char *__restrict, int); +int regexec(const regex_t *__restrict, const char *__restrict, size_t, regmatch_t *__restrict, int); +void regfree(regex_t *); + +size_t regerror(int, const regex_t *__restrict, char *__restrict, size_t); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/resolv.h b/Ubiquitous/XiZi/lib/musllib/include/resolv.h new file mode 100644 index 000000000..8b23ad66c --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/resolv.h @@ -0,0 +1,142 @@ +#ifndef _RESOLV_H +#define _RESOLV_H + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define MAXNS 3 +#define MAXDFLSRCH 3 +#define MAXDNSRCH 6 +#define LOCALDOMAINPARTS 2 + +#define RES_TIMEOUT 5 +#define MAXRESOLVSORT 10 +#define RES_MAXNDOTS 15 +#define RES_MAXRETRANS 30 +#define RES_MAXRETRY 5 +#define RES_DFLRETRY 2 +#define RES_MAXTIME 65535 + +/* unused; purely for broken apps */ +typedef struct __res_state { + int retrans; + int retry; + unsigned long options; + int nscount; + struct sockaddr_in nsaddr_list[MAXNS]; +# define nsaddr nsaddr_list[0] + unsigned short id; + char *dnsrch[MAXDNSRCH+1]; + char defdname[256]; + unsigned long pfcode; + unsigned ndots:4; + unsigned nsort:4; + unsigned ipv6_unavail:1; + unsigned unused:23; + struct { + struct in_addr addr; + uint32_t mask; + } sort_list[MAXRESOLVSORT]; + void *qhook; + void *rhook; + int res_h_errno; + int _vcsock; + unsigned _flags; + union { + char pad[52]; + struct { + uint16_t nscount; + uint16_t nsmap[MAXNS]; + int nssocks[MAXNS]; + uint16_t nscount6; + uint16_t nsinit; + struct sockaddr_in6 *nsaddrs[MAXNS]; + unsigned int _initstamp[2]; + } _ext; + } _u; +} *res_state; + +#define __RES 19960801 + +#ifndef _PATH_RESCONF +#define _PATH_RESCONF "/etc/resolv.conf" +#endif + +struct res_sym { + int number; + char *name; + char *humanname; +}; + +#define RES_F_VC 0x00000001 +#define RES_F_CONN 0x00000002 +#define RES_F_EDNS0ERR 0x00000004 + +#define RES_EXHAUSTIVE 0x00000001 + +#define RES_INIT 0x00000001 +#define RES_DEBUG 0x00000002 +#define RES_AAONLY 0x00000004 +#define RES_USEVC 0x00000008 +#define RES_PRIMARY 0x00000010 +#define RES_IGNTC 0x00000020 +#define RES_RECURSE 0x00000040 +#define RES_DEFNAMES 0x00000080 +#define RES_STAYOPEN 0x00000100 +#define RES_DNSRCH 0x00000200 +#define RES_INSECURE1 0x00000400 +#define RES_INSECURE2 0x00000800 +#define RES_NOALIASES 0x00001000 +#define RES_USE_INET6 0x00002000 +#define RES_ROTATE 0x00004000 +#define RES_NOCHECKNAME 0x00008000 +#define RES_KEEPTSIG 0x00010000 +#define RES_BLAST 0x00020000 +#define RES_USEBSTRING 0x00040000 +#define RES_NOIP6DOTINT 0x00080000 +#define RES_USE_EDNS0 0x00100000 +#define RES_SNGLKUP 0x00200000 +#define RES_SNGLKUPREOP 0x00400000 +#define RES_USE_DNSSEC 0x00800000 + +#define RES_DEFAULT (RES_RECURSE|RES_DEFNAMES|RES_DNSRCH|RES_NOIP6DOTINT) + +#define RES_PRF_STATS 0x00000001 +#define RES_PRF_UPDATE 0x00000002 +#define RES_PRF_CLASS 0x00000004 +#define RES_PRF_CMD 0x00000008 +#define RES_PRF_QUES 0x00000010 +#define RES_PRF_ANS 0x00000020 +#define RES_PRF_AUTH 0x00000040 +#define RES_PRF_ADD 0x00000080 +#define RES_PRF_HEAD1 0x00000100 +#define RES_PRF_HEAD2 0x00000200 +#define RES_PRF_TTLID 0x00000400 +#define RES_PRF_HEADX 0x00000800 +#define RES_PRF_QUERY 0x00001000 +#define RES_PRF_REPLY 0x00002000 +#define RES_PRF_INIT 0x00004000 + +struct __res_state *__res_state(void); +#define _res (*__res_state()) + +int res_init(void); +int res_query(const char *, int, int, unsigned char *, int); +int res_querydomain(const char *, const char *, int, int, unsigned char *, int); +int res_search(const char *, int, int, unsigned char *, int); +int res_mkquery(int, const char *, int, int, const unsigned char *, int, const unsigned char*, unsigned char *, int); +int res_send(const unsigned char *, int, unsigned char *, int); +int dn_comp(const char *, unsigned char *, int, unsigned char **, unsigned char **); +int dn_expand(const unsigned char *, const unsigned char *, const unsigned char *, char *, int); +int dn_skipname(const unsigned char *, const unsigned char *); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/sched.h b/Ubiquitous/XiZi/lib/musllib/include/sched.h new file mode 100644 index 000000000..605bf91b5 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/sched.h @@ -0,0 +1,134 @@ +#ifndef _SCHED_H +#define _SCHED_H +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#define __NEED_struct_timespec +#define __NEED_pid_t +#define __NEED_time_t +#define __NEED_sched_param + +#ifdef _GNU_SOURCE +#define __NEED_size_t +#endif + +#include + +int sched_get_priority_max(int); +int sched_get_priority_min(int); +int sched_getparam(pid_t, struct sched_param *); +int sched_getscheduler(pid_t); +int sched_rr_get_interval(pid_t, struct timespec *); +int sched_setparam(pid_t, const struct sched_param *); +int sched_setscheduler(pid_t, int, const struct sched_param *); +int sched_yield(void); + +#define SCHED_OTHER 0 +#define SCHED_FIFO 1 +#define SCHED_RR 2 +#define SCHED_BATCH 3 +#define SCHED_IDLE 5 +#define SCHED_DEADLINE 6 +#define SCHED_RESET_ON_FORK 0x40000000 + +#ifdef _GNU_SOURCE +#define CSIGNAL 0x000000ff +#define CLONE_VM 0x00000100 +#define CLONE_FS 0x00000200 +#define CLONE_FILES 0x00000400 +#define CLONE_SIGHAND 0x00000800 +#define CLONE_PIDFD 0x00001000 +#define CLONE_PTRACE 0x00002000 +#define CLONE_VFORK 0x00004000 +#define CLONE_PARENT 0x00008000 +#define CLONE_THREAD 0x00010000 +#define CLONE_NEWNS 0x00020000 +#define CLONE_SYSVSEM 0x00040000 +#define CLONE_SETTLS 0x00080000 +#define CLONE_PARENT_SETTID 0x00100000 +#define CLONE_CHILD_CLEARTID 0x00200000 +#define CLONE_DETACHED 0x00400000 +#define CLONE_UNTRACED 0x00800000 +#define CLONE_CHILD_SETTID 0x01000000 +#define CLONE_NEWCGROUP 0x02000000 +#define CLONE_NEWUTS 0x04000000 +#define CLONE_NEWIPC 0x08000000 +#define CLONE_NEWUSER 0x10000000 +#define CLONE_NEWPID 0x20000000 +#define CLONE_NEWNET 0x40000000 +#define CLONE_IO 0x80000000 +int clone (int (*)(void *), void *, int, void *, ...); +int unshare(int); +int setns(int, int); + +void *memcpy(void *__restrict, const void *__restrict, size_t); +int memcmp(const void *, const void *, size_t); +void *memset (void *, int, size_t); +void *calloc(size_t, size_t); +void free(void *); + +typedef struct cpu_set_t { unsigned long __bits[128/sizeof(long)]; } cpu_set_t; +int __sched_cpucount(size_t, const cpu_set_t *); +int sched_getcpu(void); +int sched_getaffinity(pid_t, size_t, cpu_set_t *); +int sched_setaffinity(pid_t, size_t, const cpu_set_t *); + +#define __CPU_op_S(i, size, set, op) ( (i)/8U >= (size) ? 0 : \ + (((unsigned long *)(set))[(i)/8/sizeof(long)] op (1UL<<((i)%(8*sizeof(long))))) ) + +#define CPU_SET_S(i, size, set) __CPU_op_S(i, size, set, |=) +#define CPU_CLR_S(i, size, set) __CPU_op_S(i, size, set, &=~) +#define CPU_ISSET_S(i, size, set) __CPU_op_S(i, size, set, &) + +#define __CPU_op_func_S(func, op) \ +static __inline void __CPU_##func##_S(size_t __size, cpu_set_t *__dest, \ + const cpu_set_t *__src1, const cpu_set_t *__src2) \ +{ \ + size_t __i; \ + for (__i=0; __i<__size/sizeof(long); __i++) \ + ((unsigned long *)__dest)[__i] = ((unsigned long *)__src1)[__i] \ + op ((unsigned long *)__src2)[__i] ; \ +} + +__CPU_op_func_S(AND, &) +__CPU_op_func_S(OR, |) +__CPU_op_func_S(XOR, ^) + +#define CPU_AND_S(a,b,c,d) __CPU_AND_S(a,b,c,d) +#define CPU_OR_S(a,b,c,d) __CPU_OR_S(a,b,c,d) +#define CPU_XOR_S(a,b,c,d) __CPU_XOR_S(a,b,c,d) + +#define CPU_COUNT_S(size,set) __sched_cpucount(size,set) +#define CPU_ZERO_S(size,set) memset(set,0,size) +#define CPU_EQUAL_S(size,set1,set2) (!memcmp(set1,set2,size)) + +#define CPU_ALLOC_SIZE(n) (sizeof(long) * ( (n)/(8*sizeof(long)) \ + + ((n)%(8*sizeof(long)) + 8*sizeof(long)-1)/(8*sizeof(long)) ) ) +#define CPU_ALLOC(n) ((cpu_set_t *)calloc(1,CPU_ALLOC_SIZE(n))) +#define CPU_FREE(set) free(set) + +#define CPU_SETSIZE 128 + +#define CPU_SET(i, set) CPU_SET_S(i,sizeof(cpu_set_t),set) +#define CPU_CLR(i, set) CPU_CLR_S(i,sizeof(cpu_set_t),set) +#define CPU_ISSET(i, set) CPU_ISSET_S(i,sizeof(cpu_set_t),set) +#define CPU_AND(d,s1,s2) CPU_AND_S(sizeof(cpu_set_t),d,s1,s2) +#define CPU_OR(d,s1,s2) CPU_OR_S(sizeof(cpu_set_t),d,s1,s2) +#define CPU_XOR(d,s1,s2) CPU_XOR_S(sizeof(cpu_set_t),d,s1,s2) +#define CPU_COUNT(set) CPU_COUNT_S(sizeof(cpu_set_t),set) +#define CPU_ZERO(set) CPU_ZERO_S(sizeof(cpu_set_t),set) +#define CPU_EQUAL(s1,s2) CPU_EQUAL_S(sizeof(cpu_set_t),s1,s2) + +#endif + +#if _REDIR_TIME64 +__REDIR(sched_rr_get_interval, __sched_rr_get_interval_time64); +#endif + +#ifdef __cplusplus +} +#endif +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/scsi/scsi.h b/Ubiquitous/XiZi/lib/musllib/include/scsi/scsi.h new file mode 100644 index 000000000..8837f5875 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/scsi/scsi.h @@ -0,0 +1,150 @@ +#ifndef _SCSI_SCSI_H +#define _SCSI_SCSI_H + +#define TEST_UNIT_READY 0x00 +#define REZERO_UNIT 0x01 +#define REQUEST_SENSE 0x03 +#define FORMAT_UNIT 0x04 +#define READ_BLOCK_LIMITS 0x05 +#define REASSIGN_BLOCKS 0x07 +#define READ_6 0x08 +#define WRITE_6 0x0a +#define SEEK_6 0x0b +#define READ_REVERSE 0x0f +#define WRITE_FILEMARKS 0x10 +#define SPACE 0x11 +#define INQUIRY 0x12 +#define RECOVER_BUFFERED_DATA 0x14 +#define MODE_SELECT 0x15 +#define RESERVE 0x16 +#define RELEASE 0x17 +#define COPY 0x18 +#define ERASE 0x19 +#define MODE_SENSE 0x1a +#define START_STOP 0x1b +#define RECEIVE_DIAGNOSTIC 0x1c +#define SEND_DIAGNOSTIC 0x1d +#define ALLOW_MEDIUM_REMOVAL 0x1e +#define SET_WINDOW 0x24 +#define READ_CAPACITY 0x25 +#define READ_10 0x28 +#define WRITE_10 0x2a +#define SEEK_10 0x2b +#define WRITE_VERIFY 0x2e +#define VERIFY 0x2f +#define SEARCH_HIGH 0x30 +#define SEARCH_EQUAL 0x31 +#define SEARCH_LOW 0x32 +#define SET_LIMITS 0x33 +#define PRE_FETCH 0x34 +#define READ_POSITION 0x34 +#define SYNCHRONIZE_CACHE 0x35 +#define LOCK_UNLOCK_CACHE 0x36 +#define READ_DEFECT_DATA 0x37 +#define MEDIUM_SCAN 0x38 +#define COMPARE 0x39 +#define COPY_VERIFY 0x3a +#define WRITE_BUFFER 0x3b +#define READ_BUFFER 0x3c +#define UPDATE_BLOCK 0x3d +#define READ_LONG 0x3e +#define WRITE_LONG 0x3f +#define CHANGE_DEFINITION 0x40 +#define WRITE_SAME 0x41 +#define READ_TOC 0x43 +#define LOG_SELECT 0x4c +#define LOG_SENSE 0x4d +#define MODE_SELECT_10 0x55 +#define RESERVE_10 0x56 +#define RELEASE_10 0x57 +#define MODE_SENSE_10 0x5a +#define PERSISTENT_RESERVE_IN 0x5e +#define PERSISTENT_RESERVE_OUT 0x5f +#define MOVE_MEDIUM 0xa5 +#define READ_12 0xa8 +#define WRITE_12 0xaa +#define WRITE_VERIFY_12 0xae +#define SEARCH_HIGH_12 0xb0 +#define SEARCH_EQUAL_12 0xb1 +#define SEARCH_LOW_12 0xb2 +#define READ_ELEMENT_STATUS 0xb8 +#define SEND_VOLUME_TAG 0xb6 +#define WRITE_LONG_2 0xea +#define GOOD 0x00 +#define CHECK_CONDITION 0x01 +#define CONDITION_GOOD 0x02 +#define BUSY 0x04 +#define INTERMEDIATE_GOOD 0x08 +#define INTERMEDIATE_C_GOOD 0x0a +#define RESERVATION_CONFLICT 0x0c +#define COMMAND_TERMINATED 0x11 +#define QUEUE_FULL 0x14 +#define STATUS_MASK 0x3e +#define NO_SENSE 0x00 +#define RECOVERED_ERROR 0x01 +#define NOT_READY 0x02 +#define MEDIUM_ERROR 0x03 +#define HARDWARE_ERROR 0x04 +#define ILLEGAL_REQUEST 0x05 +#define UNIT_ATTENTION 0x06 +#define DATA_PROTECT 0x07 +#define BLANK_CHECK 0x08 +#define COPY_ABORTED 0x0a +#define ABORTED_COMMAND 0x0b +#define VOLUME_OVERFLOW 0x0d +#define MISCOMPARE 0x0e +#define TYPE_DISK 0x00 +#define TYPE_TAPE 0x01 +#define TYPE_PROCESSOR 0x03 +#define TYPE_WORM 0x04 +#define TYPE_ROM 0x05 +#define TYPE_SCANNER 0x06 +#define TYPE_MOD 0x07 +#define TYPE_MEDIUM_CHANGER 0x08 +#define TYPE_ENCLOSURE 0x0d +#define TYPE_NO_LUN 0x7f +#define COMMAND_COMPLETE 0x00 +#define EXTENDED_MESSAGE 0x01 +#define EXTENDED_MODIFY_DATA_POINTER 0x00 +#define EXTENDED_SDTR 0x01 +#define EXTENDED_EXTENDED_IDENTIFY 0x02 +#define EXTENDED_WDTR 0x03 +#define SAVE_POINTERS 0x02 +#define RESTORE_POINTERS 0x03 +#define DISCONNECT 0x04 +#define INITIATOR_ERROR 0x05 +#define ABORT 0x06 +#define MESSAGE_REJECT 0x07 +#define NOP 0x08 +#define MSG_PARITY_ERROR 0x09 +#define LINKED_CMD_COMPLETE 0x0a +#define LINKED_FLG_CMD_COMPLETE 0x0b +#define BUS_DEVICE_RESET 0x0c +#define INITIATE_RECOVERY 0x0f +#define RELEASE_RECOVERY 0x10 +#define SIMPLE_QUEUE_TAG 0x20 +#define HEAD_OF_QUEUE_TAG 0x21 +#define ORDERED_QUEUE_TAG 0x22 +#define SCSI_IOCTL_GET_IDLUN 0x5382 +#define SCSI_IOCTL_TAGGED_ENABLE 0x5383 +#define SCSI_IOCTL_TAGGED_DISABLE 0x5384 +#define SCSI_IOCTL_PROBE_HOST 0x5385 +#define SCSI_IOCTL_GET_BUS_NUMBER 0x5386 + +struct ccs_modesel_head { + unsigned char _r1; + unsigned char medium; + unsigned char _r2; + unsigned char block_desc_length; + unsigned char density; + unsigned char number_blocks_hi; + unsigned char number_blocks_med; + unsigned char number_blocks_lo; + unsigned char _r3; + unsigned char block_length_hi; + unsigned char block_length_med; + unsigned char block_length_lo; +}; + +#endif + diff --git a/Ubiquitous/XiZi/lib/musllib/include/scsi/scsi_ioctl.h b/Ubiquitous/XiZi/lib/musllib/include/scsi/scsi_ioctl.h new file mode 100644 index 000000000..22df7feff --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/scsi/scsi_ioctl.h @@ -0,0 +1,11 @@ +#ifndef _SCSI_IOCTL_H +#define _SCSI_IOCTL_H +#define SCSI_IOCTL_SEND_COMMAND 1 +#define SCSI_IOCTL_TEST_UNIT_READY 2 +#define SCSI_IOCTL_BENCHMARK_COMMAND 3 +#define SCSI_IOCTL_SYNC 4 +#define SCSI_IOCTL_START_UNIT 5 +#define SCSI_IOCTL_STOP_UNIT 6 +#define SCSI_IOCTL_DOORLOCK 0x5380 +#define SCSI_IOCTL_DOORUNLOCK 0x5381 +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/scsi/sg.h b/Ubiquitous/XiZi/lib/musllib/include/scsi/sg.h new file mode 100644 index 000000000..a7ac247e3 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/scsi/sg.h @@ -0,0 +1,129 @@ +#ifndef _SCSI_SG_H +#define _SCSI_SG_H + +#define SG_DXFER_NONE -1 +#define SG_DXFER_TO_DEV -2 +#define SG_DXFER_FROM_DEV -3 +#define SG_DXFER_TO_FROM_DEV -4 +#define SG_FLAG_DIRECT_IO 1 +#define SG_FLAG_LUN_INHIBIT 2 +#define SG_FLAG_NO_DXFER 0x10000 +#define SG_INFO_OK_MASK 0x1 +#define SG_INFO_OK 0x0 +#define SG_INFO_CHECK 0x1 +#define SG_INFO_DIRECT_IO_MASK 0x6 +#define SG_INFO_INDIRECT_IO 0x0 +#define SG_INFO_DIRECT_IO 0x2 +#define SG_INFO_MIXED_IO 0x4 +#define SG_EMULATED_HOST 0x2203 +#define SG_SET_TRANSFORM 0x2204 +#define SG_GET_TRANSFORM 0x2205 +#define SG_SET_RESERVED_SIZE 0x2275 +#define SG_GET_RESERVED_SIZE 0x2272 +#define SG_GET_SCSI_ID 0x2276 +#define SG_SET_FORCE_LOW_DMA 0x2279 +#define SG_GET_LOW_DMA 0x227a +#define SG_SET_FORCE_PACK_ID 0x227b +#define SG_GET_PACK_ID 0x227c +#define SG_GET_NUM_WAITING 0x227d +#define SG_GET_SG_TABLESIZE 0x227F +#define SG_GET_VERSION_NUM 0x2282 +#define SG_SCSI_RESET 0x2284 +#define SG_SCSI_RESET_NOTHING 0 +#define SG_SCSI_RESET_DEVICE 1 +#define SG_SCSI_RESET_BUS 2 +#define SG_SCSI_RESET_HOST 3 +#define SG_IO 0x2285 +#define SG_GET_REQUEST_TABLE 0x2286 +#define SG_SET_KEEP_ORPHAN 0x2287 +#define SG_GET_KEEP_ORPHAN 0x2288 +#define SG_SCATTER_SZ (8 * 4096) +#define SG_DEFAULT_RETRIES 1 +#define SG_DEF_FORCE_LOW_DMA 0 +#define SG_DEF_FORCE_PACK_ID 0 +#define SG_DEF_KEEP_ORPHAN 0 +#define SG_DEF_RESERVED_SIZE SG_SCATTER_SZ +#define SG_MAX_QUEUE 16 +#define SG_BIG_BUFF SG_DEF_RESERVED_SIZE +#define SG_MAX_SENSE 16 +#define SG_SET_TIMEOUT 0x2201 +#define SG_GET_TIMEOUT 0x2202 +#define SG_GET_COMMAND_Q 0x2270 +#define SG_SET_COMMAND_Q 0x2271 +#define SG_SET_DEBUG 0x227e +#define SG_NEXT_CMD_LEN 0x2283 +#define SG_DEFAULT_TIMEOUT (60*100) /* 60*HZ */ +#define SG_DEF_COMMAND_Q 0 +#define SG_DEF_UNDERRUN_FLAG 0 + +typedef struct sg_iovec { + void *iov_base; + unsigned long iov_len; +} sg_iovec_t; + +typedef struct sg_io_hdr { + int interface_id; + int dxfer_direction; + unsigned char cmd_len; + unsigned char mx_sb_len; + unsigned short iovec_count; + unsigned dxfer_len; + void *dxferp; + unsigned char *cmdp; + unsigned char *sbp; + unsigned timeout; + unsigned flags; + int pack_id; + void *usr_ptr; + unsigned char status; + unsigned char masked_status; + unsigned char msg_status; + unsigned char sb_len_wr; + unsigned short host_status; + unsigned short driver_status; + int resid; + unsigned int duration; + unsigned int info; +} sg_io_hdr_t; + +struct sg_scsi_id { + int host_no; + int channel; + int scsi_id; + int lun; + int scsi_type; + short h_cmd_per_lun; + short d_queue_depth; + int unused[2]; +}; + +typedef struct sg_req_info { + char req_state; + char orphan; + char sg_io_owned; + char problem; + int pack_id; + void *usr_ptr; + unsigned duration; + int unused; +} sg_req_info_t; + +typedef struct sg_io_hdr Sg_io_hdr; +typedef struct sg_io_vec Sg_io_vec; +typedef struct sg_scsi_id Sg_scsi_id; +typedef struct sg_req_info Sg_req_info; + +struct sg_header { + int pack_len; + int reply_len; + int pack_id; + int result; + unsigned twelve_byte:1; + unsigned target_status:5; + unsigned host_status:8; + unsigned driver_status:8; + unsigned other_flags:10; + unsigned char sense_buffer[SG_MAX_SENSE]; +}; + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/search.h b/Ubiquitous/XiZi/lib/musllib/include/search.h new file mode 100644 index 000000000..02e407e3c --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/search.h @@ -0,0 +1,63 @@ +#ifndef _SEARCH_H +#define _SEARCH_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#define __NEED_size_t +#include + +typedef enum { FIND, ENTER } ACTION; +typedef enum { preorder, postorder, endorder, leaf } VISIT; + +typedef struct entry { + char *key; + void *data; +} ENTRY; + +int hcreate(size_t); +void hdestroy(void); +ENTRY *hsearch(ENTRY, ACTION); + +#ifdef _GNU_SOURCE +struct hsearch_data { + struct __tab *__tab; + unsigned int __unused1; + unsigned int __unused2; +}; + +int hcreate_r(size_t, struct hsearch_data *); +void hdestroy_r(struct hsearch_data *); +int hsearch_r(ENTRY, ACTION, ENTRY **, struct hsearch_data *); +#endif + +void insque(void *, void *); +void remque(void *); + +void *lsearch(const void *, void *, size_t *, size_t, + int (*)(const void *, const void *)); +void *lfind(const void *, const void *, size_t *, size_t, + int (*)(const void *, const void *)); + +void *tdelete(const void *__restrict, void **__restrict, int(*)(const void *, const void *)); +void *tfind(const void *, void *const *, int(*)(const void *, const void *)); +void *tsearch(const void *, void **, int (*)(const void *, const void *)); +void twalk(const void *, void (*)(const void *, VISIT, int)); + +#ifdef _GNU_SOURCE +struct qelem { + struct qelem *q_forw, *q_back; + char q_data[1]; +}; + +void tdestroy(void *, void (*)(void *)); +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/semaphore.h b/Ubiquitous/XiZi/lib/musllib/include/semaphore.h new file mode 100644 index 000000000..3690f4960 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/semaphore.h @@ -0,0 +1,39 @@ +#ifndef _SEMAPHORE_H +#define _SEMAPHORE_H +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#define __NEED_time_t +#define __NEED_struct_timespec +#include + +#include + +#define SEM_FAILED ((sem_t *)0) + +typedef struct { + volatile int __val[4*sizeof(long)/sizeof(int)]; +} sem_t; + +int sem_close(sem_t *); +int sem_destroy(sem_t *); +int sem_getvalue(sem_t *__restrict, int *__restrict); +int sem_init(sem_t *, int, unsigned); +sem_t *sem_open(const char *, int, ...); +int sem_post(sem_t *); +int sem_timedwait(sem_t *__restrict, const struct timespec *__restrict); +int sem_trywait(sem_t *); +int sem_unlink(const char *); +int sem_wait(sem_t *); + +#if _REDIR_TIME64 +__REDIR(sem_timedwait, __sem_timedwait_time64); +#endif + +#ifdef __cplusplus +} +#endif +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/setjmp.h b/Ubiquitous/XiZi/lib/musllib/include/setjmp.h new file mode 100644 index 000000000..2d43abf84 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/setjmp.h @@ -0,0 +1,41 @@ +#ifndef _SETJMP_H +#define _SETJMP_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#include + +typedef struct __jmp_buf_tag { + __jmp_buf __jb; + unsigned long __fl; + unsigned long __ss[128/sizeof(long)]; +} jmp_buf[1]; + +#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \ + || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \ + || defined(_BSD_SOURCE) +typedef jmp_buf sigjmp_buf; +int sigsetjmp (sigjmp_buf, int); +_Noreturn void siglongjmp (sigjmp_buf, int); +#endif + +#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \ + || defined(_BSD_SOURCE) +int _setjmp (jmp_buf); +_Noreturn void _longjmp (jmp_buf, int); +#endif + +int setjmp (jmp_buf); +_Noreturn void longjmp (jmp_buf, int); + +#define setjmp setjmp + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/shadow.h b/Ubiquitous/XiZi/lib/musllib/include/shadow.h new file mode 100644 index 000000000..2b1be413f --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/shadow.h @@ -0,0 +1,44 @@ +#ifndef _SHADOW_H +#define _SHADOW_H + +#ifdef __cplusplus +extern "C" { +#endif + +#define __NEED_FILE +#define __NEED_size_t + +#include + +#define SHADOW "/etc/shadow" + +struct spwd { + char *sp_namp; + char *sp_pwdp; + long sp_lstchg; + long sp_min; + long sp_max; + long sp_warn; + long sp_inact; + long sp_expire; + unsigned long sp_flag; +}; + +void setspent(void); +void endspent(void); +struct spwd *getspent(void); +struct spwd *fgetspent(FILE *); +struct spwd *sgetspent(const char *); +int putspent(const struct spwd *, FILE *); + +struct spwd *getspnam(const char *); +int getspnam_r(const char *, struct spwd *, char *, size_t, struct spwd **); + +int lckpwdf(void); +int ulckpwdf(void); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/signal.h b/Ubiquitous/XiZi/lib/musllib/include/signal.h new file mode 100644 index 000000000..99572f9f4 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/signal.h @@ -0,0 +1,286 @@ +#ifndef _SIGNAL_H +#define _SIGNAL_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \ + || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \ + || defined(_BSD_SOURCE) + +#ifdef _GNU_SOURCE +#define __ucontext ucontext +#endif + +#define __NEED_size_t +#define __NEED_pid_t +#define __NEED_uid_t +#define __NEED_struct_timespec +#define __NEED_pthread_t +#define __NEED_pthread_attr_t +#define __NEED_time_t +#define __NEED_clock_t +#define __NEED_sigset_t + +#include + +#define SIG_BLOCK 0 +#define SIG_UNBLOCK 1 +#define SIG_SETMASK 2 + +#define SI_ASYNCNL (-60) +#define SI_TKILL (-6) +#define SI_SIGIO (-5) +#define SI_ASYNCIO (-4) +#define SI_MESGQ (-3) +#define SI_TIMER (-2) +#define SI_QUEUE (-1) +#define SI_USER 0 +#define SI_KERNEL 128 + +typedef struct sigaltstack stack_t; + +#endif + +#include + +#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \ + || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \ + || defined(_BSD_SOURCE) + +#define SIG_HOLD ((void (*)(int)) 2) + +#define FPE_INTDIV 1 +#define FPE_INTOVF 2 +#define FPE_FLTDIV 3 +#define FPE_FLTOVF 4 +#define FPE_FLTUND 5 +#define FPE_FLTRES 6 +#define FPE_FLTINV 7 +#define FPE_FLTSUB 8 + +#define ILL_ILLOPC 1 +#define ILL_ILLOPN 2 +#define ILL_ILLADR 3 +#define ILL_ILLTRP 4 +#define ILL_PRVOPC 5 +#define ILL_PRVREG 6 +#define ILL_COPROC 7 +#define ILL_BADSTK 8 + +#define SEGV_MAPERR 1 +#define SEGV_ACCERR 2 +#define SEGV_BNDERR 3 +#define SEGV_PKUERR 4 + +#define BUS_ADRALN 1 +#define BUS_ADRERR 2 +#define BUS_OBJERR 3 +#define BUS_MCEERR_AR 4 +#define BUS_MCEERR_AO 5 + +#define CLD_EXITED 1 +#define CLD_KILLED 2 +#define CLD_DUMPED 3 +#define CLD_TRAPPED 4 +#define CLD_STOPPED 5 +#define CLD_CONTINUED 6 + +union sigval { + int sival_int; + void *sival_ptr; +}; + +typedef struct { +#ifdef __SI_SWAP_ERRNO_CODE + int si_signo, si_code, si_errno; +#else + int si_signo, si_errno, si_code; +#endif + union { + char __pad[128 - 2*sizeof(int) - sizeof(long)]; + struct { + union { + struct { + pid_t si_pid; + uid_t si_uid; + } __piduid; + struct { + int si_timerid; + int si_overrun; + } __timer; + } __first; + union { + union sigval si_value; + struct { + int si_status; + clock_t si_utime, si_stime; + } __sigchld; + } __second; + } __si_common; + struct { + void *si_addr; + short si_addr_lsb; + union { + struct { + void *si_lower; + void *si_upper; + } __addr_bnd; + unsigned si_pkey; + } __first; + } __sigfault; + struct { + long si_band; + int si_fd; + } __sigpoll; + struct { + void *si_call_addr; + int si_syscall; + unsigned si_arch; + } __sigsys; + } __si_fields; +} siginfo_t; +#define si_pid __si_fields.__si_common.__first.__piduid.si_pid +#define si_uid __si_fields.__si_common.__first.__piduid.si_uid +#define si_status __si_fields.__si_common.__second.__sigchld.si_status +#define si_utime __si_fields.__si_common.__second.__sigchld.si_utime +#define si_stime __si_fields.__si_common.__second.__sigchld.si_stime +#define si_value __si_fields.__si_common.__second.si_value +#define si_addr __si_fields.__sigfault.si_addr +#define si_addr_lsb __si_fields.__sigfault.si_addr_lsb +#define si_lower __si_fields.__sigfault.__first.__addr_bnd.si_lower +#define si_upper __si_fields.__sigfault.__first.__addr_bnd.si_upper +#define si_pkey __si_fields.__sigfault.__first.si_pkey +#define si_band __si_fields.__sigpoll.si_band +#define si_fd __si_fields.__sigpoll.si_fd +#define si_timerid __si_fields.__si_common.__first.__timer.si_timerid +#define si_overrun __si_fields.__si_common.__first.__timer.si_overrun +#define si_ptr si_value.sival_ptr +#define si_int si_value.sival_int +#define si_call_addr __si_fields.__sigsys.si_call_addr +#define si_syscall __si_fields.__sigsys.si_syscall +#define si_arch __si_fields.__sigsys.si_arch + +struct sigaction { + union { + void (*sa_handler)(int); + void (*sa_sigaction)(int, siginfo_t *, void *); + } __sa_handler; + sigset_t sa_mask; + int sa_flags; + void (*sa_restorer)(void); +}; +#define sa_handler __sa_handler.sa_handler +#define sa_sigaction __sa_handler.sa_sigaction + +struct sigevent { + union sigval sigev_value; + int sigev_signo; + int sigev_notify; + void (*sigev_notify_function)(union sigval); + pthread_attr_t *sigev_notify_attributes; + char __pad[56-3*sizeof(long)]; +}; + +#define SIGEV_SIGNAL 0 +#define SIGEV_NONE 1 +#define SIGEV_THREAD 2 + +int __libc_current_sigrtmin(void); +int __libc_current_sigrtmax(void); + +#define SIGRTMIN (__libc_current_sigrtmin()) +#define SIGRTMAX (__libc_current_sigrtmax()) + +int kill(pid_t, int); + +#define sigaddset(what, sig) (*(what) |= (1U << (sig)), 0) +#define sigdelset(what, sig) (*(what) &= ~(1U << (sig)), 0) +#define sigemptyset(what) (*(what) = 0, 0) +#define sigfillset(what) (*(what) = ~(0), 0) +#define sigismember(what, sig) (((*(what)) & (1U << (sig))) != 0) + +int sigprocmask(int, const sigset_t *__restrict, sigset_t *__restrict); +int sigsuspend(const sigset_t *); +int sigaction(int, const struct sigaction *__restrict, struct sigaction *__restrict); +int sigpending(sigset_t *); +int sigwait(const sigset_t *__restrict, int *__restrict); +int sigwaitinfo(const sigset_t *__restrict, siginfo_t *__restrict); +int sigtimedwait(const sigset_t *__restrict, siginfo_t *__restrict, const struct timespec *__restrict); +int sigqueue(pid_t, int, union sigval); + +int pthread_sigmask(int, const sigset_t *__restrict, sigset_t *__restrict); +int pthread_kill(pthread_t, int); + +void psiginfo(const siginfo_t *, const char *); +void psignal(int, const char *); + +#endif + +#if defined(_XOPEN_SOURCE) || defined(_BSD_SOURCE) || defined(_GNU_SOURCE) +int killpg(pid_t, int); +int sigaltstack(const stack_t *__restrict, stack_t *__restrict); +int sighold(int); +int sigignore(int); +int siginterrupt(int, int); +int sigpause(int); +int sigrelse(int); +void (*sigset(int, void (*)(int)))(int); +#define TRAP_BRKPT 1 +#define TRAP_TRACE 2 +#define TRAP_BRANCH 3 +#define TRAP_HWBKPT 4 +#define TRAP_UNK 5 +#define POLL_IN 1 +#define POLL_OUT 2 +#define POLL_MSG 3 +#define POLL_ERR 4 +#define POLL_PRI 5 +#define POLL_HUP 6 +#define SS_ONSTACK 1 +#define SS_DISABLE 2 +#define SS_AUTODISARM (1U << 31) +#define SS_FLAG_BITS SS_AUTODISARM +#endif + +#if defined(_BSD_SOURCE) || defined(_GNU_SOURCE) +#define NSIG _NSIG +typedef void (*sig_t)(int); +#endif + +#ifdef _GNU_SOURCE +typedef void (*sighandler_t)(int); +void (*bsd_signal(int, void (*)(int)))(int); +int sigisemptyset(const sigset_t *); +int sigorset (sigset_t *, const sigset_t *, const sigset_t *); +int sigandset(sigset_t *, const sigset_t *, const sigset_t *); + +#define SA_NOMASK SA_NODEFER +#define SA_ONESHOT SA_RESETHAND +#endif + +#define SIG_ERR ((void (*)(int))-1) +#define SIG_DFL ((void (*)(int)) 0) +#define SIG_IGN ((void (*)(int)) 1) + +typedef int sig_atomic_t; + +void (*signal(int, void (*)(int)))(int); +int raise(int); + +#if _REDIR_TIME64 +#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \ + || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \ + || defined(_BSD_SOURCE) +__REDIR(sigtimedwait, __sigtimedwait_time64); +#endif +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/spawn.h b/Ubiquitous/XiZi/lib/musllib/include/spawn.h new file mode 100644 index 000000000..8eb73e003 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/spawn.h @@ -0,0 +1,83 @@ +#ifndef _SPAWN_H +#define _SPAWN_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#define __NEED_mode_t +#define __NEED_pid_t +#define __NEED_sigset_t + +#include + +struct sched_param; + +#define POSIX_SPAWN_RESETIDS 1 +#define POSIX_SPAWN_SETPGROUP 2 +#define POSIX_SPAWN_SETSIGDEF 4 +#define POSIX_SPAWN_SETSIGMASK 8 +#define POSIX_SPAWN_SETSCHEDPARAM 16 +#define POSIX_SPAWN_SETSCHEDULER 32 +#define POSIX_SPAWN_USEVFORK 64 +#define POSIX_SPAWN_SETSID 128 + +typedef struct { + int __flags; + pid_t __pgrp; + sigset_t __def, __mask; + int __prio, __pol; + void *__fn; + char __pad[64-sizeof(void *)]; +} posix_spawnattr_t; + +typedef struct { + int __pad0[2]; + void *__actions; + int __pad[16]; +} posix_spawn_file_actions_t; + +int posix_spawn(pid_t *__restrict, const char *__restrict, const posix_spawn_file_actions_t *, + const posix_spawnattr_t *__restrict, char *const *__restrict, char *const *__restrict); +int posix_spawnp(pid_t *__restrict, const char *__restrict, const posix_spawn_file_actions_t *, + const posix_spawnattr_t *__restrict, char *const *__restrict, char *const *__restrict); + +int posix_spawnattr_init(posix_spawnattr_t *); +int posix_spawnattr_destroy(posix_spawnattr_t *); + +int posix_spawnattr_setflags(posix_spawnattr_t *, short); +int posix_spawnattr_getflags(const posix_spawnattr_t *__restrict, short *__restrict); + +int posix_spawnattr_setpgroup(posix_spawnattr_t *, pid_t); +int posix_spawnattr_getpgroup(const posix_spawnattr_t *__restrict, pid_t *__restrict); + +int posix_spawnattr_setsigmask(posix_spawnattr_t *__restrict, const sigset_t *__restrict); +int posix_spawnattr_getsigmask(const posix_spawnattr_t *__restrict, sigset_t *__restrict); + +int posix_spawnattr_setsigdefault(posix_spawnattr_t *__restrict, const sigset_t *__restrict); +int posix_spawnattr_getsigdefault(const posix_spawnattr_t *__restrict, sigset_t *__restrict); + +int posix_spawnattr_setschedparam(posix_spawnattr_t *__restrict, const struct sched_param *__restrict); +int posix_spawnattr_getschedparam(const posix_spawnattr_t *__restrict, struct sched_param *__restrict); +int posix_spawnattr_setschedpolicy(posix_spawnattr_t *, int); +int posix_spawnattr_getschedpolicy(const posix_spawnattr_t *__restrict, int *__restrict); + +int posix_spawn_file_actions_init(posix_spawn_file_actions_t *); +int posix_spawn_file_actions_destroy(posix_spawn_file_actions_t *); + +int posix_spawn_file_actions_addopen(posix_spawn_file_actions_t *__restrict, int, const char *__restrict, int, mode_t); +int posix_spawn_file_actions_addclose(posix_spawn_file_actions_t *, int); +int posix_spawn_file_actions_adddup2(posix_spawn_file_actions_t *, int, int); + +#if defined(_BSD_SOURCE) || defined(_GNU_SOURCE) +int posix_spawn_file_actions_addchdir_np(posix_spawn_file_actions_t *__restrict, const char *__restrict); +int posix_spawn_file_actions_addfchdir_np(posix_spawn_file_actions_t *, int); +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/stdalign.h b/Ubiquitous/XiZi/lib/musllib/include/stdalign.h new file mode 100644 index 000000000..2cc94be3f --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/stdalign.h @@ -0,0 +1,20 @@ +#ifndef _STDALIGN_H +#define _STDALIGN_H + +#ifndef __cplusplus + +/* this whole header only works in C11 or with compiler extensions */ +#if __STDC_VERSION__ < 201112L && defined( __GNUC__) +#define _Alignas(t) __attribute__((__aligned__(t))) +#define _Alignof(t) __alignof__(t) +#endif + +#define alignas _Alignas +#define alignof _Alignof + +#endif + +#define __alignas_is_defined 1 +#define __alignof_is_defined 1 + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/stdarg.h b/Ubiquitous/XiZi/lib/musllib/include/stdarg.h new file mode 100644 index 000000000..3256f8050 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/stdarg.h @@ -0,0 +1,21 @@ +#ifndef _STDARG_H +#define _STDARG_H + +#ifdef __cplusplus +extern "C" { +#endif + +#define __NEED_va_list + +#include + +#define va_start(v,l) __builtin_va_start(v,l) +#define va_end(v) __builtin_va_end(v) +#define va_arg(v,l) __builtin_va_arg(v,l) +#define va_copy(d,s) __builtin_va_copy(d,s) + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/stdbool.h b/Ubiquitous/XiZi/lib/musllib/include/stdbool.h new file mode 100644 index 000000000..a9d7ab787 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/stdbool.h @@ -0,0 +1,14 @@ +#ifndef _STDBOOL_H +#define _STDBOOL_H + +#ifndef __cplusplus + +#define true 1 +#define false 0 +#define bool _Bool + +#endif + +#define __bool_true_false_are_defined 1 + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/stdc-predef.h b/Ubiquitous/XiZi/lib/musllib/include/stdc-predef.h new file mode 100644 index 000000000..f8cd4b891 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/stdc-predef.h @@ -0,0 +1,10 @@ +#ifndef _STDC_PREDEF_H +#define _STDC_PREDEF_H + +#define __STDC_ISO_10646__ 201206L + +#if !defined(__GCC_IEC_559) || __GCC_IEC_559 > 0 +#define __STDC_IEC_559__ 1 +#endif + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/stddef.h b/Ubiquitous/XiZi/lib/musllib/include/stddef.h new file mode 100644 index 000000000..bd7538535 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/stddef.h @@ -0,0 +1,25 @@ +#ifndef _STDDEF_H +#define _STDDEF_H + +#ifdef __cplusplus +#define NULL 0L +#else +#define NULL ((void*)0) +#endif + +#define __NEED_ptrdiff_t +#define __NEED_size_t +#define __NEED_wchar_t +#if __STDC_VERSION__ >= 201112L || __cplusplus >= 201103L +#define __NEED_max_align_t +#endif + +#include + +#if __GNUC__ > 3 +#define offsetof(type, member) __builtin_offsetof(type, member) +#else +#define offsetof(type, member) ((size_t)( (char *)&(((type *)0)->member) - (char *)0 )) +#endif + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/stdint.h b/Ubiquitous/XiZi/lib/musllib/include/stdint.h new file mode 100644 index 000000000..a2968197d --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/stdint.h @@ -0,0 +1,117 @@ +#ifndef _STDINT_H +#define _STDINT_H + +#define __NEED_int8_t +#define __NEED_int16_t +#define __NEED_int32_t +#define __NEED_int64_t + +#define __NEED_uint8_t +#define __NEED_uint16_t +#define __NEED_uint32_t +#define __NEED_uint64_t + +#define __NEED_intptr_t +#define __NEED_uintptr_t + +#define __NEED_intmax_t +#define __NEED_uintmax_t + +#include + +typedef int8_t int_fast8_t; +typedef int64_t int_fast64_t; + +typedef int8_t int_least8_t; +typedef int16_t int_least16_t; +typedef int32_t int_least32_t; +typedef int64_t int_least64_t; + +typedef uint8_t uint_fast8_t; +typedef uint64_t uint_fast64_t; + +typedef uint8_t uint_least8_t; +typedef uint16_t uint_least16_t; +typedef uint32_t uint_least32_t; +typedef uint64_t uint_least64_t; + +#define INT8_MIN (-1-0x7f) +#define INT16_MIN (-1-0x7fff) +#define INT32_MIN (-1-0x7fffffff) +#define INT64_MIN (-1-0x7fffffffffffffff) + +#define INT8_MAX (0x7f) +#define INT16_MAX (0x7fff) +#define INT32_MAX (0x7fffffff) +#define INT64_MAX (0x7fffffffffffffff) + +#define UINT8_MAX (0xff) +#define UINT16_MAX (0xffff) +#define UINT32_MAX (0xffffffffu) +#define UINT64_MAX (0xffffffffffffffffu) + +#define INT_FAST8_MIN INT8_MIN +#define INT_FAST64_MIN INT64_MIN + +#define INT_LEAST8_MIN INT8_MIN +#define INT_LEAST16_MIN INT16_MIN +#define INT_LEAST32_MIN INT32_MIN +#define INT_LEAST64_MIN INT64_MIN + +#define INT_FAST8_MAX INT8_MAX +#define INT_FAST64_MAX INT64_MAX + +#define INT_LEAST8_MAX INT8_MAX +#define INT_LEAST16_MAX INT16_MAX +#define INT_LEAST32_MAX INT32_MAX +#define INT_LEAST64_MAX INT64_MAX + +#define UINT_FAST8_MAX UINT8_MAX +#define UINT_FAST64_MAX UINT64_MAX + +#define UINT_LEAST8_MAX UINT8_MAX +#define UINT_LEAST16_MAX UINT16_MAX +#define UINT_LEAST32_MAX UINT32_MAX +#define UINT_LEAST64_MAX UINT64_MAX + +#define INTMAX_MIN INT64_MIN +#define INTMAX_MAX INT64_MAX +#define UINTMAX_MAX UINT64_MAX + +#define WINT_MIN 0U +#define WINT_MAX UINT32_MAX + +#if L'\0'-1 > 0 +#define WCHAR_MAX (0xffffffffu+L'\0') +#define WCHAR_MIN (0+L'\0') +#else +#define WCHAR_MAX (0x7fffffff+L'\0') +#define WCHAR_MIN (-1-0x7fffffff+L'\0') +#endif + +#define SIG_ATOMIC_MIN INT32_MIN +#define SIG_ATOMIC_MAX INT32_MAX + +#include + +#define INT8_C(c) c +#define INT16_C(c) c +#define INT32_C(c) c + +#define UINT8_C(c) c +#define UINT16_C(c) c +#define UINT32_C(c) c ## U + +#if UINTPTR_MAX == UINT64_MAX +#define INT64_C(c) c ## L +#define UINT64_C(c) c ## UL +#define INTMAX_C(c) c ## L +#define UINTMAX_C(c) c ## UL +#else +#define INT64_C(c) c ## LL +#define UINT64_C(c) c ## ULL +#define INTMAX_C(c) c ## LL +#define UINTMAX_C(c) c ## ULL +#endif + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/stdio.h b/Ubiquitous/XiZi/lib/musllib/include/stdio.h new file mode 100644 index 000000000..3604198c3 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/stdio.h @@ -0,0 +1,222 @@ +#ifndef _STDIO_H +#define _STDIO_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#define __NEED_FILE +#define __NEED___isoc_va_list +#define __NEED_size_t + +#if __STDC_VERSION__ < 201112L +#define __NEED_struct__IO_FILE +#endif + +#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \ + || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \ + || defined(_BSD_SOURCE) +#define __NEED_ssize_t +#define __NEED_off_t +#define __NEED_va_list +#endif + +#include + +#ifdef __cplusplus +#define NULL 0L +#else +#define NULL ((void*)0) +#endif + +#undef EOF +#define EOF (-1) + +#undef SEEK_SET +#undef SEEK_CUR +#undef SEEK_END +#define SEEK_SET 0 +#define SEEK_CUR 1 +#define SEEK_END 2 + +#define _IOFBF 0 +#define _IOLBF 1 +#define _IONBF 2 + +#define BUFSIZ 1024 +#define FILENAME_MAX 4096 +#define FOPEN_MAX 1000 +#define TMP_MAX 10000 +#define L_tmpnam 20 + +typedef union _G_fpos64_t { + char __opaque[16]; + long long __lldata; + double __align; +} fpos_t; + +extern FILE *const stdin; +extern FILE *const stdout; +extern FILE *const stderr; + +#define stdin (stdin) +#define stdout (stdout) +#define stderr (stderr) + +FILE *fopen(const char *__restrict, const char *__restrict); +FILE *freopen(const char *__restrict, const char *__restrict, FILE *__restrict); +int fclose(FILE *); + +int remove(const char *); +int rename(const char *, const char *); + +int feof(FILE *); +int ferror(FILE *); +int fflush(FILE *); +void clearerr(FILE *); + +int fseek(FILE *, long, int); +long ftell(FILE *); +void rewind(FILE *); + +int fgetpos(FILE *__restrict, fpos_t *__restrict); +int fsetpos(FILE *, const fpos_t *); + +size_t fread(void *__restrict, size_t, size_t, FILE *__restrict); +size_t fwrite(const void *__restrict, size_t, size_t, FILE *__restrict); + +int fgetc(FILE *); +int getc(FILE *); +int getchar(void); +int ungetc(int, FILE *); + +int fputc(int, FILE *); +int putc(int, FILE *); +int putchar(int); + +char *fgets(char *__restrict, int, FILE *__restrict); +#if __STDC_VERSION__ < 201112L +char *gets(char *); +#endif + +int fputs(const char *__restrict, FILE *__restrict); +int puts(const char *); + +int printf(const char *__restrict, ...); +int fprintf(FILE *__restrict, const char *__restrict, ...); +int sprintf(char *__restrict, const char *__restrict, ...); +int snprintf(char *__restrict, size_t, const char *__restrict, ...); + +int vprintf(const char *__restrict, __isoc_va_list); +int vfprintf(FILE *__restrict, const char *__restrict, __isoc_va_list); +int vsprintf(char *__restrict, const char *__restrict, __isoc_va_list); +int vsnprintf(char *__restrict, size_t, const char *__restrict, __isoc_va_list); + +int scanf(const char *__restrict, ...); +int fscanf(FILE *__restrict, const char *__restrict, ...); +int sscanf(const char *__restrict, const char *__restrict, ...); +int vscanf(const char *__restrict, __isoc_va_list); +int vfscanf(FILE *__restrict, const char *__restrict, __isoc_va_list); +int vsscanf(const char *__restrict, const char *__restrict, __isoc_va_list); + +void perror(const char *); + +int setvbuf(FILE *__restrict, char *__restrict, int, size_t); +void setbuf(FILE *__restrict, char *__restrict); + +char *tmpnam(char *); +FILE *tmpfile(void); + +#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \ + || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \ + || defined(_BSD_SOURCE) +FILE *fmemopen(void *__restrict, size_t, const char *__restrict); +FILE *open_memstream(char **, size_t *); +FILE *fdopen(int, const char *); +FILE *popen(const char *, const char *); +int pclose(FILE *); +int fileno(FILE *); +int fseeko(FILE *, off_t, int); +off_t ftello(FILE *); +int dprintf(int, const char *__restrict, ...); +int vdprintf(int, const char *__restrict, __isoc_va_list); +void flockfile(FILE *); +int ftrylockfile(FILE *); +void funlockfile(FILE *); +int getc_unlocked(FILE *); +int getchar_unlocked(void); +int putc_unlocked(int, FILE *); +int putchar_unlocked(int); +ssize_t getdelim(char **__restrict, size_t *__restrict, int, FILE *__restrict); +ssize_t getline(char **__restrict, size_t *__restrict, FILE *__restrict); +int renameat(int, const char *, int, const char *); +char *ctermid(char *); +#define L_ctermid 20 +#endif + + +#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \ + || defined(_BSD_SOURCE) +#define P_tmpdir "/tmp" +char *tempnam(const char *, const char *); +#endif + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +#define L_cuserid 20 +char *cuserid(char *); +void setlinebuf(FILE *); +void setbuffer(FILE *, char *, size_t); +int fgetc_unlocked(FILE *); +int fputc_unlocked(int, FILE *); +int fflush_unlocked(FILE *); +size_t fread_unlocked(void *, size_t, size_t, FILE *); +size_t fwrite_unlocked(const void *, size_t, size_t, FILE *); +void clearerr_unlocked(FILE *); +int feof_unlocked(FILE *); +int ferror_unlocked(FILE *); +int fileno_unlocked(FILE *); +int getw(FILE *); +int putw(int, FILE *); +char *fgetln(FILE *, size_t *); +int asprintf(char **, const char *, ...); +int vasprintf(char **, const char *, __isoc_va_list); +#endif + +#ifdef _GNU_SOURCE +char *fgets_unlocked(char *, int, FILE *); +int fputs_unlocked(const char *, FILE *); + +typedef ssize_t (cookie_read_function_t)(void *, char *, size_t); +typedef ssize_t (cookie_write_function_t)(void *, const char *, size_t); +typedef int (cookie_seek_function_t)(void *, off_t *, int); +typedef int (cookie_close_function_t)(void *); + +typedef struct _IO_cookie_io_functions_t { + cookie_read_function_t *read; + cookie_write_function_t *write; + cookie_seek_function_t *seek; + cookie_close_function_t *close; +} cookie_io_functions_t; + +FILE *fopencookie(void *, const char *, cookie_io_functions_t); +#endif + +#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE) +#define tmpfile64 tmpfile +#define fopen64 fopen +#define freopen64 freopen +#define fseeko64 fseeko +#define ftello64 ftello +#define fgetpos64 fgetpos +#define fsetpos64 fsetpos +#define fpos64_t fpos_t +#define off64_t off_t +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/stdio_ext.h b/Ubiquitous/XiZi/lib/musllib/include/stdio_ext.h new file mode 100644 index 000000000..e3ab7fd4f --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/stdio_ext.h @@ -0,0 +1,34 @@ +#ifndef _STDIO_EXT_H +#define _STDIO_EXT_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#define FSETLOCKING_QUERY 0 +#define FSETLOCKING_INTERNAL 1 +#define FSETLOCKING_BYCALLER 2 + +void _flushlbf(void); +int __fsetlocking(FILE *, int); +int __fwriting(FILE *); +int __freading(FILE *); +int __freadable(FILE *); +int __fwritable(FILE *); +int __flbf(FILE *); +size_t __fbufsize(FILE *); +size_t __fpending(FILE *); +int __fpurge(FILE *); + +size_t __freadahead(FILE *); +const char *__freadptr(FILE *, size_t *); +void __freadptrinc(FILE *, size_t); +void __fseterr(FILE *); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/stdlib.h b/Ubiquitous/XiZi/lib/musllib/include/stdlib.h new file mode 100644 index 000000000..0a5143df5 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/stdlib.h @@ -0,0 +1,176 @@ +#ifndef _STDLIB_H +#define _STDLIB_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#ifdef __cplusplus +#define NULL 0L +#else +#define NULL ((void*)0) +#endif + +#define __NEED_size_t +#define __NEED_wchar_t + +#include + +int atoi (const char *); +long atol (const char *); +long long atoll (const char *); +double atof (const char *); + +float strtof (const char *__restrict, char **__restrict); +double strtod (const char *__restrict, char **__restrict); +long double strtold (const char *__restrict, char **__restrict); + +long strtol (const char *__restrict, char **__restrict, int); +unsigned long strtoul (const char *__restrict, char **__restrict, int); +long long strtoll (const char *__restrict, char **__restrict, int); +unsigned long long strtoull (const char *__restrict, char **__restrict, int); + +int rand (void); +void srand (unsigned); + +void *malloc (size_t); +void *calloc (size_t, size_t); +void *realloc (void *, size_t); +void free (void *); +void *aligned_alloc(size_t, size_t); +void *zalloc(size_t size); + +_Noreturn void abort (void); +int atexit (void (*) (void)); +_Noreturn void exit (int); +_Noreturn void _Exit (int); +int at_quick_exit (void (*) (void)); +_Noreturn void quick_exit (int); + +char *getenv (const char *); + +int system (const char *); + +void *bsearch (const void *, const void *, size_t, size_t, int (*)(const void *, const void *)); +void qsort (void *, size_t, size_t, int (*)(const void *, const void *)); + +int abs (int); +long labs (long); +long long llabs (long long); + +typedef struct { int quot, rem; } div_t; +typedef struct { long quot, rem; } ldiv_t; +typedef struct { long long quot, rem; } lldiv_t; + +div_t div (int, int); +ldiv_t ldiv (long, long); +lldiv_t lldiv (long long, long long); + +int mblen (const char *, size_t); +int mbtowc (wchar_t *__restrict, const char *__restrict, size_t); +int wctomb (char *, wchar_t); +size_t mbstowcs (wchar_t *__restrict, const char *__restrict, size_t); +size_t wcstombs (char *__restrict, const wchar_t *__restrict, size_t); + +#define EXIT_FAILURE 1 +#define EXIT_SUCCESS 0 + +size_t __ctype_get_mb_cur_max(void); +#define MB_CUR_MAX (__ctype_get_mb_cur_max()) + +#define RAND_MAX (0x7fffffff) + + +#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \ + || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \ + || defined(_BSD_SOURCE) + +#define WNOHANG 1 +#define WUNTRACED 2 + +#define WEXITSTATUS(s) (((s) & 0xff00) >> 8) +#define WTERMSIG(s) ((s) & 0x7f) +#define WSTOPSIG(s) WEXITSTATUS(s) +#define WIFEXITED(s) (!WTERMSIG(s)) +#define WIFSTOPPED(s) ((short)((((s)&0xffff)*0x10001)>>8) > 0x7f00) +#define WIFSIGNALED(s) (((s)&0xffff)-1U < 0xffu) + +int posix_memalign (void **, size_t, size_t); +int setenv (const char *, const char *, int); +int unsetenv (const char *); +int mkstemp (char *); +int mkostemp (char *, int); +char *mkdtemp (char *); +int getsubopt (char **, char *const *, char **); +int rand_r (unsigned *); + +#endif + + +#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \ + || defined(_BSD_SOURCE) +char *realpath (const char *__restrict, char *__restrict); +long int random (void); +void srandom (unsigned int); +char *initstate (unsigned int, char *, size_t); +char *setstate (char *); +int putenv (char *); +int posix_openpt (int); +int grantpt (int); +int unlockpt (int); +char *ptsname (int); +char *l64a (long); +long a64l (const char *); +void setkey (const char *); +double drand48 (void); +double erand48 (unsigned short [3]); +long int lrand48 (void); +long int nrand48 (unsigned short [3]); +long mrand48 (void); +long jrand48 (unsigned short [3]); +void srand48 (long); +unsigned short *seed48 (unsigned short [3]); +void lcong48 (unsigned short [7]); +#endif + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +#include +char *mktemp (char *); +int mkstemps (char *, int); +int mkostemps (char *, int, int); +void *valloc (size_t); +void *memalign(size_t, size_t); +int getloadavg(double *, int); +int clearenv(void); +#define WCOREDUMP(s) ((s) & 0x80) +#define WIFCONTINUED(s) ((s) == 0xffff) +#endif + +#ifdef _GNU_SOURCE +int ptsname_r(int, char *, size_t); +char *ecvt(double, int, int *, int *); +char *fcvt(double, int, int *, int *); +char *gcvt(double, int, char *); +char *secure_getenv(const char *); +struct __locale_struct; +float strtof_l(const char *__restrict, char **__restrict, struct __locale_struct *); +double strtod_l(const char *__restrict, char **__restrict, struct __locale_struct *); +long double strtold_l(const char *__restrict, char **__restrict, struct __locale_struct *); +#endif + +#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE) +#define mkstemp64 mkstemp +#define mkostemp64 mkostemp +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +#define mkstemps64 mkstemps +#define mkostemps64 mkostemps +#endif +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/stdnoreturn.h b/Ubiquitous/XiZi/lib/musllib/include/stdnoreturn.h new file mode 100644 index 000000000..87b302cae --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/stdnoreturn.h @@ -0,0 +1,9 @@ +#ifndef _STDNORETURN_H +#define _STDNORETURN_H + +#ifndef __cplusplus +#include +#define noreturn _Noreturn +#endif + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/string.h b/Ubiquitous/XiZi/lib/musllib/include/string.h new file mode 100644 index 000000000..d298cb520 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/string.h @@ -0,0 +1,106 @@ +#ifndef _STRING_H +#define _STRING_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#ifdef __cplusplus +#define NULL 0L +#else +#define NULL ((void*)0) +#endif + +#define __NEED_size_t +#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \ + || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \ + || defined(_BSD_SOURCE) +#define __NEED_locale_t +#endif + +#include + +void *memcpy (void *__restrict, const void *__restrict, size_t); +void *memmove (void *, const void *, size_t); +void *memset (void *, int, size_t); +int memcmp (const void *, const void *, size_t); +void *memchr (const void *, int, size_t); + +char *strcpy (char *__restrict, const char *__restrict); +char *strncpy (char *__restrict, const char *__restrict, size_t); + +char *strcat (char *__restrict, const char *__restrict); +char *strncat (char *__restrict, const char *__restrict, size_t); + +int strcmp (const char *, const char *); +int strncmp (const char *, const char *, size_t); + +int strcoll (const char *, const char *); +size_t strxfrm (char *__restrict, const char *__restrict, size_t); + +char *strchr (const char *, int); +char *strrchr (const char *, int); + +size_t strcspn (const char *, const char *); +size_t strspn (const char *, const char *); +char *strpbrk (const char *, const char *); +char *strstr (const char *, const char *); +char *strtok (char *__restrict, const char *__restrict); + +size_t strlen (const char *); + +char *strerror (int); + +#if defined(_BSD_SOURCE) || defined(_GNU_SOURCE) +#include +#endif + +#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \ + || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \ + || defined(_BSD_SOURCE) +char *strtok_r (char *__restrict, const char *__restrict, char **__restrict); +int strerror_r (int, char *, size_t); +char *stpcpy(char *__restrict, const char *__restrict); +char *stpncpy(char *__restrict, const char *__restrict, size_t); +size_t strnlen (const char *, size_t); +char *strdup (const char *); +char *strndup (const char *, size_t); +char *strsignal(int); +char *strerror_l (int, locale_t); +int strcoll_l (const char *, const char *, locale_t); +size_t strxfrm_l (char *__restrict, const char *__restrict, size_t, locale_t); +#endif + +#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \ + || defined(_BSD_SOURCE) +void *memccpy (void *__restrict, const void *__restrict, int, size_t); +#endif + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +char *strsep(char **, const char *); +size_t strlcat (char *, const char *, size_t); +size_t strlcpy (char *, const char *, size_t); +void explicit_bzero (void *, size_t); +#endif + +#ifdef _GNU_SOURCE +#define strdupa(x) strcpy(alloca(strlen(x)+1),x) +int strverscmp (const char *, const char *); +char *strchrnul(const char *, int); +char *strcasestr(const char *, const char *); +void *memmem(const void *, size_t, const void *, size_t); +void *memrchr(const void *, int, size_t); +void *mempcpy(void *, const void *, size_t); +#ifndef __cplusplus +char *basename(void); +#endif +#endif + + +#ifdef __cplusplus +} +#endif + +#endif \ No newline at end of file diff --git a/Ubiquitous/XiZi/lib/musllib/include/strings.h b/Ubiquitous/XiZi/lib/musllib/include/strings.h new file mode 100644 index 000000000..db0960b4e --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/strings.h @@ -0,0 +1,39 @@ +#ifndef _STRINGS_H +#define _STRINGS_H + +#ifdef __cplusplus +extern "C" { +#endif + + +#define __NEED_size_t +#define __NEED_locale_t +#include + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) || defined(_POSIX_SOURCE) \ + || (defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE+0 < 200809L) \ + || (defined(_XOPEN_SOURCE) && _XOPEN_SOURCE+0 < 700) +int bcmp (const void *, const void *, size_t); +void bcopy (const void *, void *, size_t); +void bzero (void *, size_t); +char *index (const char *, int); +char *rindex (const char *, int); +#endif + +#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +int ffs (int); +int ffsl (long); +int ffsll (long long); +#endif + +int strcasecmp (const char *, const char *); +int strncasecmp (const char *, const char *, size_t); + +int strcasecmp_l (const char *, const char *, locale_t); +int strncasecmp_l (const char *, const char *, size_t, locale_t); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/stropts.h b/Ubiquitous/XiZi/lib/musllib/include/stropts.h new file mode 100644 index 000000000..c99c922e3 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/stropts.h @@ -0,0 +1,139 @@ +#ifndef _STROPTS_H +#define _STROPTS_H + +#ifdef __cplusplus +extern "C" { +#endif + +#define __SID ('S' << 8) + +#define I_NREAD (__SID | 1) +#define I_PUSH (__SID | 2) +#define I_POP (__SID | 3) +#define I_LOOK (__SID | 4) +#define I_FLUSH (__SID | 5) +#define I_SRDOPT (__SID | 6) +#define I_GRDOPT (__SID | 7) +#define I_STR (__SID | 8) +#define I_SETSIG (__SID | 9) +#define I_GETSIG (__SID |10) +#define I_FIND (__SID |11) +#define I_LINK (__SID |12) +#define I_UNLINK (__SID |13) +#define I_PEEK (__SID |15) +#define I_FDINSERT (__SID |16) +#define I_SENDFD (__SID |17) +#define I_RECVFD (__SID |14) +#define I_SWROPT (__SID |19) +#define I_GWROPT (__SID |20) +#define I_LIST (__SID |21) +#define I_PLINK (__SID |22) +#define I_PUNLINK (__SID |23) +#define I_FLUSHBAND (__SID |28) +#define I_CKBAND (__SID |29) +#define I_GETBAND (__SID |30) +#define I_ATMARK (__SID |31) +#define I_SETCLTIME (__SID |32) +#define I_GETCLTIME (__SID |33) +#define I_CANPUT (__SID |34) + +#define FMNAMESZ 8 + +#define FLUSHR 0x01 +#define FLUSHW 0x02 +#define FLUSHRW 0x03 +#define FLUSHBAND 0x04 + +#define S_INPUT 0x0001 +#define S_HIPRI 0x0002 +#define S_OUTPUT 0x0004 +#define S_MSG 0x0008 +#define S_ERROR 0x0010 +#define S_HANGUP 0x0020 +#define S_RDNORM 0x0040 +#define S_WRNORM S_OUTPUT +#define S_RDBAND 0x0080 +#define S_WRBAND 0x0100 +#define S_BANDURG 0x0200 + +#define RS_HIPRI 0x01 + +#define RNORM 0x0000 +#define RMSGD 0x0001 +#define RMSGN 0x0002 +#define RPROTDAT 0x0004 +#define RPROTDIS 0x0008 +#define RPROTNORM 0x0010 +#define RPROTMASK 0x001C + +#define SNDZERO 0x001 +#define SNDPIPE 0x002 + +#define ANYMARK 0x01 +#define LASTMARK 0x02 + +#define MUXID_ALL (-1) + +#define MSG_HIPRI 0x01 +#define MSG_ANY 0x02 +#define MSG_BAND 0x04 + +#define MORECTL 1 +#define MOREDATA 2 + +struct bandinfo { + unsigned char bi_pri; + int bi_flag; +}; + +struct strbuf { + int maxlen; + int len; + char *buf; +}; + +struct strpeek { + struct strbuf ctlbuf; + struct strbuf databuf; + unsigned flags; +}; + +struct strfdinsert { + struct strbuf ctlbuf; + struct strbuf databuf; + unsigned flags; + int fildes; + int offset; +}; + +struct strioctl { + int ic_cmd; + int ic_timout; + int ic_len; + char *ic_dp; +}; + +struct strrecvfd { + int fd; + int uid; + int gid; + char __fill[8]; +}; + +struct str_mlist { + char l_name[FMNAMESZ + 1]; +}; + +struct str_list { + int sl_nmods; + struct str_mlist *sl_modlist; +}; + +int isastream(int); +int ioctl(int, int, ...); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/sys/acct.h b/Ubiquitous/XiZi/lib/musllib/include/sys/acct.h new file mode 100644 index 000000000..fae9d0508 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/sys/acct.h @@ -0,0 +1,72 @@ +#ifndef _SYS_ACCT_H +#define _SYS_ACCT_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include + +#define ACCT_COMM 16 + +typedef uint16_t comp_t; + +struct acct { + char ac_flag; + uint16_t ac_uid; + uint16_t ac_gid; + uint16_t ac_tty; + uint32_t ac_btime; + comp_t ac_utime; + comp_t ac_stime; + comp_t ac_etime; + comp_t ac_mem; + comp_t ac_io; + comp_t ac_rw; + comp_t ac_minflt; + comp_t ac_majflt; + comp_t ac_swaps; + uint32_t ac_exitcode; + char ac_comm[ACCT_COMM+1]; + char ac_pad[10]; +}; + + +struct acct_v3 { + char ac_flag; + char ac_version; + uint16_t ac_tty; + uint32_t ac_exitcode; + uint32_t ac_uid; + uint32_t ac_gid; + uint32_t ac_pid; + uint32_t ac_ppid; + uint32_t ac_btime; + float ac_etime; + comp_t ac_utime; + comp_t ac_stime; + comp_t ac_mem; + comp_t ac_io; + comp_t ac_rw; + comp_t ac_minflt; + comp_t ac_majflt; + comp_t ac_swaps; + char ac_comm[ACCT_COMM]; +}; + +#define AFORK 1 +#define ASU 2 +#define ACORE 8 +#define AXSIG 16 +#define ACCT_BYTEORDER (128*(__BYTE_ORDER==__BIG_ENDIAN)) +#define AHZ 100 + +int acct(const char *); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/sys/auxv.h b/Ubiquitous/XiZi/lib/musllib/include/sys/auxv.h new file mode 100644 index 000000000..ddccf57ff --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/sys/auxv.h @@ -0,0 +1,17 @@ +#ifndef _SYS_AUXV_H +#define _SYS_AUXV_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +unsigned long getauxval(unsigned long); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/sys/cachectl.h b/Ubiquitous/XiZi/lib/musllib/include/sys/cachectl.h new file mode 100644 index 000000000..f3b896a8e --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/sys/cachectl.h @@ -0,0 +1,22 @@ +#ifndef _SYS_CACHECTL_H +#define _SYS_CACHECTL_H + +#ifdef __cplusplus +extern "C" { +#endif + +#define ICACHE (1<<0) +#define DCACHE (1<<1) +#define BCACHE (ICACHE|DCACHE) +#define CACHEABLE 0 +#define UNCACHEABLE 1 + +int cachectl(void *, int, int); +int cacheflush(void *, int, int); +int _flush_cache(void *, int, int); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/sys/dir.h b/Ubiquitous/XiZi/lib/musllib/include/sys/dir.h new file mode 100644 index 000000000..9ba1c79e2 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/sys/dir.h @@ -0,0 +1,2 @@ +#include +#define direct dirent diff --git a/Ubiquitous/XiZi/lib/musllib/include/sys/epoll.h b/Ubiquitous/XiZi/lib/musllib/include/sys/epoll.h new file mode 100644 index 000000000..ac81a8418 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/sys/epoll.h @@ -0,0 +1,69 @@ +#ifndef _SYS_EPOLL_H +#define _SYS_EPOLL_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include + +#define __NEED_sigset_t + +#include + +#define EPOLL_CLOEXEC O_CLOEXEC +#define EPOLL_NONBLOCK O_NONBLOCK + +enum EPOLL_EVENTS { __EPOLL_DUMMY }; +#define EPOLLIN 0x001 +#define EPOLLPRI 0x002 +#define EPOLLOUT 0x004 +#define EPOLLRDNORM 0x040 +#define EPOLLNVAL 0x020 +#define EPOLLRDBAND 0x080 +#define EPOLLWRNORM 0x100 +#define EPOLLWRBAND 0x200 +#define EPOLLMSG 0x400 +#define EPOLLERR 0x008 +#define EPOLLHUP 0x010 +#define EPOLLRDHUP 0x2000 +#define EPOLLEXCLUSIVE (1U<<28) +#define EPOLLWAKEUP (1U<<29) +#define EPOLLONESHOT (1U<<30) +#define EPOLLET (1U<<31) + +#define EPOLL_CTL_ADD 1 +#define EPOLL_CTL_DEL 2 +#define EPOLL_CTL_MOD 3 + +typedef union epoll_data { + void *ptr; + int fd; + uint32_t u32; + uint64_t u64; +} epoll_data_t; + +struct epoll_event { + uint32_t events; + epoll_data_t data; +} +#ifdef __x86_64__ +__attribute__ ((__packed__)) +#endif +; + + +int epoll_create(int); +int epoll_create1(int); +int epoll_ctl(int, int, int, struct epoll_event *); +int epoll_wait(int, struct epoll_event *, int, int); +int epoll_pwait(int, struct epoll_event *, int, int, const sigset_t *); + + +#ifdef __cplusplus +} +#endif + +#endif /* sys/epoll.h */ diff --git a/Ubiquitous/XiZi/lib/musllib/include/sys/errno.h b/Ubiquitous/XiZi/lib/musllib/include/sys/errno.h new file mode 100644 index 000000000..35a3e5a2a --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/sys/errno.h @@ -0,0 +1,2 @@ +#warning redirecting incorrect #include to +#include diff --git a/Ubiquitous/XiZi/lib/musllib/include/sys/eventfd.h b/Ubiquitous/XiZi/lib/musllib/include/sys/eventfd.h new file mode 100644 index 000000000..dc5c88f04 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/sys/eventfd.h @@ -0,0 +1,26 @@ +#ifndef _SYS_EVENTFD_H +#define _SYS_EVENTFD_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +typedef uint64_t eventfd_t; + +#define EFD_SEMAPHORE 1 +#define EFD_CLOEXEC O_CLOEXEC +#define EFD_NONBLOCK O_NONBLOCK + +int eventfd(unsigned int, int); +int eventfd_read(int, eventfd_t *); +int eventfd_write(int, eventfd_t); + + +#ifdef __cplusplus +} +#endif + +#endif /* sys/eventfd.h */ diff --git a/Ubiquitous/XiZi/lib/musllib/include/sys/fanotify.h b/Ubiquitous/XiZi/lib/musllib/include/sys/fanotify.h new file mode 100644 index 000000000..b637c8f58 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/sys/fanotify.h @@ -0,0 +1,105 @@ +#ifndef _FANOTIFY_H +#define _FANOTIFY_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +struct fanotify_event_metadata { + unsigned event_len; + unsigned char vers; + unsigned char reserved; + unsigned short metadata_len; + unsigned long long mask +#ifdef __GNUC__ + __attribute__((__aligned__(8))) +#endif + ; + int fd; + int pid; +}; + +struct fanotify_event_info_header { + unsigned char info_type; + unsigned char pad; + unsigned short len; +}; + +struct fanotify_event_info_fid { + struct fanotify_event_info_header hdr; + fsid_t fsid; + unsigned char handle[]; +}; + +struct fanotify_response { + int fd; + unsigned response; +}; + +#define FAN_ACCESS 0x01 +#define FAN_MODIFY 0x02 +#define FAN_ATTRIB 0x04 +#define FAN_CLOSE_WRITE 0x08 +#define FAN_CLOSE_NOWRITE 0x10 +#define FAN_OPEN 0x20 +#define FAN_MOVED_FROM 0x40 +#define FAN_MOVED_TO 0x80 +#define FAN_CREATE 0x100 +#define FAN_DELETE 0x200 +#define FAN_DELETE_SELF 0x400 +#define FAN_MOVE_SELF 0x800 +#define FAN_OPEN_EXEC 0x1000 +#define FAN_Q_OVERFLOW 0x4000 +#define FAN_OPEN_PERM 0x10000 +#define FAN_ACCESS_PERM 0x20000 +#define FAN_OPEN_EXEC_PERM 0x40000 +#define FAN_ONDIR 0x40000000 +#define FAN_EVENT_ON_CHILD 0x08000000 +#define FAN_CLOSE (FAN_CLOSE_WRITE | FAN_CLOSE_NOWRITE) +#define FAN_MOVE (FAN_MOVED_FROM | FAN_MOVED_TO) +#define FAN_CLOEXEC 0x01 +#define FAN_NONBLOCK 0x02 +#define FAN_CLASS_NOTIF 0 +#define FAN_CLASS_CONTENT 0x04 +#define FAN_CLASS_PRE_CONTENT 0x08 +#define FAN_ALL_CLASS_BITS (FAN_CLASS_NOTIF | FAN_CLASS_CONTENT | FAN_CLASS_PRE_CONTENT) +#define FAN_UNLIMITED_QUEUE 0x10 +#define FAN_UNLIMITED_MARKS 0x20 +#define FAN_ENABLE_AUDIT 0x40 +#define FAN_REPORT_TID 0x100 +#define FAN_REPORT_FID 0x200 +#define FAN_ALL_INIT_FLAGS (FAN_CLOEXEC | FAN_NONBLOCK | FAN_ALL_CLASS_BITS | FAN_UNLIMITED_QUEUE | FAN_UNLIMITED_MARKS) +#define FAN_MARK_ADD 0x01 +#define FAN_MARK_REMOVE 0x02 +#define FAN_MARK_DONT_FOLLOW 0x04 +#define FAN_MARK_ONLYDIR 0x08 +#define FAN_MARK_IGNORED_MASK 0x20 +#define FAN_MARK_IGNORED_SURV_MODIFY 0x40 +#define FAN_MARK_FLUSH 0x80 +#define FAN_MARK_INODE 0x00 +#define FAN_MARK_MOUNT 0x10 +#define FAN_MARK_FILESYSTEM 0x100 +#define FAN_MARK_TYPE_MASK (FAN_MARK_INODE | FAN_MARK_MOUNT | FAN_MARK_FILESYSTEM) +#define FAN_ALL_MARK_FLAGS (FAN_MARK_ADD | FAN_MARK_REMOVE | FAN_MARK_DONT_FOLLOW | FAN_MARK_ONLYDIR | FAN_MARK_MOUNT | FAN_MARK_IGNORED_MASK | FAN_MARK_IGNORED_SURV_MODIFY | FAN_MARK_FLUSH) +#define FAN_ALL_EVENTS (FAN_ACCESS | FAN_MODIFY | FAN_CLOSE | FAN_OPEN) +#define FAN_ALL_PERM_EVENTS (FAN_OPEN_PERM | FAN_ACCESS_PERM) +#define FAN_ALL_OUTGOING_EVENTS (FAN_ALL_EVENTS | FAN_ALL_PERM_EVENTS | FAN_Q_OVERFLOW) +#define FANOTIFY_METADATA_VERSION 3 +#define FAN_EVENT_INFO_TYPE_FID 1 +#define FAN_ALLOW 0x01 +#define FAN_DENY 0x02 +#define FAN_AUDIT 0x10 +#define FAN_NOFD -1 +#define FAN_EVENT_METADATA_LEN (sizeof(struct fanotify_event_metadata)) +#define FAN_EVENT_NEXT(meta, len) ((len) -= (meta)->event_len, (struct fanotify_event_metadata*)(((char *)(meta)) + (meta)->event_len)) +#define FAN_EVENT_OK(meta, len) ((long)(len) >= (long)FAN_EVENT_METADATA_LEN && (long)(meta)->event_len >= (long)FAN_EVENT_METADATA_LEN && (long)(meta)->event_len <= (long)(len)) + +int fanotify_init(unsigned, unsigned); +int fanotify_mark(int, unsigned, unsigned long long, int, const char *); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/sys/fcntl.h b/Ubiquitous/XiZi/lib/musllib/include/sys/fcntl.h new file mode 100644 index 000000000..3dd928ef6 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/sys/fcntl.h @@ -0,0 +1,2 @@ +#warning redirecting incorrect #include to +#include diff --git a/Ubiquitous/XiZi/lib/musllib/include/sys/file.h b/Ubiquitous/XiZi/lib/musllib/include/sys/file.h new file mode 100644 index 000000000..4fc83b981 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/sys/file.h @@ -0,0 +1,21 @@ +#ifndef _SYS_FILE_H +#define _SYS_FILE_H +#ifdef __cplusplus +extern "C" { +#endif + +#define LOCK_SH 1 +#define LOCK_EX 2 +#define LOCK_NB 4 +#define LOCK_UN 8 + +#define L_SET 0 +#define L_INCR 1 +#define L_XTND 2 + +int flock(int, int); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/sys/fsuid.h b/Ubiquitous/XiZi/lib/musllib/include/sys/fsuid.h new file mode 100644 index 000000000..c7a9b8faa --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/sys/fsuid.h @@ -0,0 +1,20 @@ +#ifndef _SYS_FSUID_H +#define _SYS_FSUID_H + +#ifdef __cplusplus +extern "C" { +#endif + +#define __NEED_uid_t +#define __NEED_gid_t + +#include + +int setfsuid(uid_t); +int setfsgid(gid_t); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/sys/inotify.h b/Ubiquitous/XiZi/lib/musllib/include/sys/inotify.h new file mode 100644 index 000000000..69b586319 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/sys/inotify.h @@ -0,0 +1,58 @@ +#ifndef _SYS_INOTIFY_H +#define _SYS_INOTIFY_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +struct inotify_event { + int wd; + uint32_t mask, cookie, len; + char name[]; +}; + +#define IN_CLOEXEC O_CLOEXEC +#define IN_NONBLOCK O_NONBLOCK + +#define IN_ACCESS 0x00000001 +#define IN_MODIFY 0x00000002 +#define IN_ATTRIB 0x00000004 +#define IN_CLOSE_WRITE 0x00000008 +#define IN_CLOSE_NOWRITE 0x00000010 +#define IN_CLOSE (IN_CLOSE_WRITE | IN_CLOSE_NOWRITE) +#define IN_OPEN 0x00000020 +#define IN_MOVED_FROM 0x00000040 +#define IN_MOVED_TO 0x00000080 +#define IN_MOVE (IN_MOVED_FROM | IN_MOVED_TO) +#define IN_CREATE 0x00000100 +#define IN_DELETE 0x00000200 +#define IN_DELETE_SELF 0x00000400 +#define IN_MOVE_SELF 0x00000800 +#define IN_ALL_EVENTS 0x00000fff + +#define IN_UNMOUNT 0x00002000 +#define IN_Q_OVERFLOW 0x00004000 +#define IN_IGNORED 0x00008000 + +#define IN_ONLYDIR 0x01000000 +#define IN_DONT_FOLLOW 0x02000000 +#define IN_EXCL_UNLINK 0x04000000 +#define IN_MASK_CREATE 0x10000000 +#define IN_MASK_ADD 0x20000000 + +#define IN_ISDIR 0x40000000 +#define IN_ONESHOT 0x80000000 + +int inotify_init(void); +int inotify_init1(int); +int inotify_add_watch(int, const char *, uint32_t); +int inotify_rm_watch(int, int); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/sys/io.h b/Ubiquitous/XiZi/lib/musllib/include/sys/io.h new file mode 100644 index 000000000..16658ceca --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/sys/io.h @@ -0,0 +1,17 @@ +#ifndef _SYS_IO_H +#define _SYS_IO_H +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#include + +int iopl(int); +int ioperm(unsigned long, unsigned long, int); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/sys/ioctl.h b/Ubiquitous/XiZi/lib/musllib/include/sys/ioctl.h new file mode 100644 index 000000000..c2ce3b484 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/sys/ioctl.h @@ -0,0 +1,125 @@ +#ifndef _SYS_IOCTL_H +#define _SYS_IOCTL_H +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +#define N_TTY 0 +#define N_SLIP 1 +#define N_MOUSE 2 +#define N_PPP 3 +#define N_STRIP 4 +#define N_AX25 5 +#define N_X25 6 +#define N_6PACK 7 +#define N_MASC 8 +#define N_R3964 9 +#define N_PROFIBUS_FDL 10 +#define N_IRDA 11 +#define N_SMSBLOCK 12 +#define N_HDLC 13 +#define N_SYNC_PPP 14 +#define N_HCI 15 +#define N_GIGASET_M101 16 +#define N_SLCAN 17 +#define N_PPS 18 +#define N_V253 19 +#define N_CAIF 20 +#define N_GSM0710 21 +#define N_TI_WL 22 +#define N_TRACESINK 23 +#define N_TRACEROUTER 24 +#define N_NCI 25 +#define N_SPEAKUP 26 +#define N_NULL 27 + +#define TIOCPKT_DATA 0 +#define TIOCPKT_FLUSHREAD 1 +#define TIOCPKT_FLUSHWRITE 2 +#define TIOCPKT_STOP 4 +#define TIOCPKT_START 8 +#define TIOCPKT_NOSTOP 16 +#define TIOCPKT_DOSTOP 32 +#define TIOCPKT_IOCTL 64 + +#define TIOCSER_TEMT 1 + +struct winsize { + unsigned short ws_row; + unsigned short ws_col; + unsigned short ws_xpixel; + unsigned short ws_ypixel; +}; + +#define SIOCADDRT 0x890B +#define SIOCDELRT 0x890C +#define SIOCRTMSG 0x890D + +#define SIOCGIFNAME 0x8910 +#define SIOCSIFLINK 0x8911 +#define SIOCGIFCONF 0x8912 +#define SIOCGIFFLAGS 0x8913 +#define SIOCSIFFLAGS 0x8914 +#define SIOCGIFADDR 0x8915 +#define SIOCSIFADDR 0x8916 +#define SIOCGIFDSTADDR 0x8917 +#define SIOCSIFDSTADDR 0x8918 +#define SIOCGIFBRDADDR 0x8919 +#define SIOCSIFBRDADDR 0x891a +#define SIOCGIFNETMASK 0x891b +#define SIOCSIFNETMASK 0x891c +#define SIOCGIFMETRIC 0x891d +#define SIOCSIFMETRIC 0x891e +#define SIOCGIFMEM 0x891f +#define SIOCSIFMEM 0x8920 +#define SIOCGIFMTU 0x8921 +#define SIOCSIFMTU 0x8922 +#define SIOCSIFNAME 0x8923 +#define SIOCSIFHWADDR 0x8924 +#define SIOCGIFENCAP 0x8925 +#define SIOCSIFENCAP 0x8926 +#define SIOCGIFHWADDR 0x8927 +#define SIOCGIFSLAVE 0x8929 +#define SIOCSIFSLAVE 0x8930 +#define SIOCADDMULTI 0x8931 +#define SIOCDELMULTI 0x8932 +#define SIOCGIFINDEX 0x8933 +#define SIOGIFINDEX SIOCGIFINDEX +#define SIOCSIFPFLAGS 0x8934 +#define SIOCGIFPFLAGS 0x8935 +#define SIOCDIFADDR 0x8936 +#define SIOCSIFHWBROADCAST 0x8937 +#define SIOCGIFCOUNT 0x8938 + +#define SIOCGIFBR 0x8940 +#define SIOCSIFBR 0x8941 + +#define SIOCGIFTXQLEN 0x8942 +#define SIOCSIFTXQLEN 0x8943 + +#define SIOCDARP 0x8953 +#define SIOCGARP 0x8954 +#define SIOCSARP 0x8955 + +#define SIOCDRARP 0x8960 +#define SIOCGRARP 0x8961 +#define SIOCSRARP 0x8962 + +#define SIOCGIFMAP 0x8970 +#define SIOCSIFMAP 0x8971 + +#define SIOCADDDLCI 0x8980 +#define SIOCDELDLCI 0x8981 + +#define SIOCDEVPRIVATE 0x89F0 +#define SIOCPROTOPRIVATE 0x89E0 + +int ioctl (int, int, ...); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/sys/ipc.h b/Ubiquitous/XiZi/lib/musllib/include/sys/ipc.h new file mode 100644 index 000000000..9e366b7be --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/sys/ipc.h @@ -0,0 +1,42 @@ +#ifndef _SYS_IPC_H +#define _SYS_IPC_H +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#define __NEED_uid_t +#define __NEED_gid_t +#define __NEED_mode_t +#define __NEED_key_t + +#include + +#define __ipc_perm_key __key +#define __ipc_perm_seq __seq + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +#define __key key +#define __seq seq +#endif + +#include +#include + +#define IPC_CREAT 01000 +#define IPC_EXCL 02000 +#define IPC_NOWAIT 04000 + +#define IPC_RMID 0 +#define IPC_SET 1 +#define IPC_INFO 3 + +#define IPC_PRIVATE ((key_t) 0) + +key_t ftok (const char *, int); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/sys/kd.h b/Ubiquitous/XiZi/lib/musllib/include/sys/kd.h new file mode 100644 index 000000000..42122b9c3 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/sys/kd.h @@ -0,0 +1 @@ +#include diff --git a/Ubiquitous/XiZi/lib/musllib/include/sys/klog.h b/Ubiquitous/XiZi/lib/musllib/include/sys/klog.h new file mode 100644 index 000000000..aa66684e3 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/sys/klog.h @@ -0,0 +1,14 @@ +#ifndef _SYS_KLOG_H +#define _SYS_KLOG_H + +#ifdef __cplusplus +extern "C" { +#endif + +int klogctl (int, char *, int); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/sys/membarrier.h b/Ubiquitous/XiZi/lib/musllib/include/sys/membarrier.h new file mode 100644 index 000000000..10cb31083 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/sys/membarrier.h @@ -0,0 +1,17 @@ +#ifndef _SYS_MEMBARRIER_H +#define _SYS_MEMBARRIER_H + +#define MEMBARRIER_CMD_QUERY 0 +#define MEMBARRIER_CMD_GLOBAL 1 +#define MEMBARRIER_CMD_GLOBAL_EXPEDITED 2 +#define MEMBARRIER_CMD_REGISTER_GLOBAL_EXPEDITED 4 +#define MEMBARRIER_CMD_PRIVATE_EXPEDITED 8 +#define MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED 16 +#define MEMBARRIER_CMD_PRIVATE_EXPEDITED_SYNC_CORE 32 +#define MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_SYNC_CORE 64 + +#define MEMBARRIER_CMD_SHARED MEMBARRIER_CMD_GLOBAL + +int membarrier(int, int); + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/sys/mman.h b/Ubiquitous/XiZi/lib/musllib/include/sys/mman.h new file mode 100644 index 000000000..3bade7272 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/sys/mman.h @@ -0,0 +1,150 @@ +#ifndef _SYS_MMAN_H +#define _SYS_MMAN_H +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#define __NEED_mode_t +#define __NEED_size_t +#define __NEED_off_t + +#if defined(_GNU_SOURCE) +#define __NEED_ssize_t +#endif + +#include + +#define MAP_FAILED ((void *) -1) + +#define MAP_SHARED 0x01 +#define MAP_PRIVATE 0x02 +#define MAP_SHARED_VALIDATE 0x03 +#define MAP_TYPE 0x0f +#define MAP_FIXED 0x10 +#define MAP_ANON 0x20 +#define MAP_ANONYMOUS MAP_ANON +#define MAP_NORESERVE 0x4000 +#define MAP_GROWSDOWN 0x0100 +#define MAP_DENYWRITE 0x0800 +#define MAP_EXECUTABLE 0x1000 +#define MAP_LOCKED 0x2000 +#define MAP_POPULATE 0x8000 +#define MAP_NONBLOCK 0x10000 +#define MAP_STACK 0x20000 +#define MAP_HUGETLB 0x40000 +#define MAP_SYNC 0x80000 +#define MAP_FIXED_NOREPLACE 0x100000 +#define MAP_FILE 0 + +#define MAP_HUGE_SHIFT 26 +#define MAP_HUGE_MASK 0x3f +#define MAP_HUGE_64KB (16 << 26) +#define MAP_HUGE_512KB (19 << 26) +#define MAP_HUGE_1MB (20 << 26) +#define MAP_HUGE_2MB (21 << 26) +#define MAP_HUGE_8MB (23 << 26) +#define MAP_HUGE_16MB (24 << 26) +#define MAP_HUGE_32MB (25 << 26) +#define MAP_HUGE_256MB (28 << 26) +#define MAP_HUGE_512MB (29 << 26) +#define MAP_HUGE_1GB (30 << 26) +#define MAP_HUGE_2GB (31 << 26) +#define MAP_HUGE_16GB (34U << 26) + +#define PROT_NONE 0 +#define PROT_READ 1 +#define PROT_WRITE 2 +#define PROT_EXEC 4 +#define PROT_GROWSDOWN 0x01000000 +#define PROT_GROWSUP 0x02000000 + +#define MS_ASYNC 1 +#define MS_INVALIDATE 2 +#define MS_SYNC 4 + +#define MCL_CURRENT 1 +#define MCL_FUTURE 2 +#define MCL_ONFAULT 4 + +#define POSIX_MADV_NORMAL 0 +#define POSIX_MADV_RANDOM 1 +#define POSIX_MADV_SEQUENTIAL 2 +#define POSIX_MADV_WILLNEED 3 +#define POSIX_MADV_DONTNEED 4 + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +#define MADV_NORMAL 0 +#define MADV_RANDOM 1 +#define MADV_SEQUENTIAL 2 +#define MADV_WILLNEED 3 +#define MADV_DONTNEED 4 +#define MADV_FREE 8 +#define MADV_REMOVE 9 +#define MADV_DONTFORK 10 +#define MADV_DOFORK 11 +#define MADV_MERGEABLE 12 +#define MADV_UNMERGEABLE 13 +#define MADV_HUGEPAGE 14 +#define MADV_NOHUGEPAGE 15 +#define MADV_DONTDUMP 16 +#define MADV_DODUMP 17 +#define MADV_WIPEONFORK 18 +#define MADV_KEEPONFORK 19 +#define MADV_COLD 20 +#define MADV_PAGEOUT 21 +#define MADV_HWPOISON 100 +#define MADV_SOFT_OFFLINE 101 +#endif + +#ifdef _GNU_SOURCE +#define MREMAP_MAYMOVE 1 +#define MREMAP_FIXED 2 + +#define MLOCK_ONFAULT 0x01 + +#define MFD_CLOEXEC 0x0001U +#define MFD_ALLOW_SEALING 0x0002U +#define MFD_HUGETLB 0x0004U +#endif + +#include + +void *mmap (void *, size_t, int, int, int, off_t); +int munmap (void *, size_t); + +int mprotect (void *, size_t, int); +int msync (void *, size_t, int); + +int posix_madvise (void *, size_t, int); + +int mlock (const void *, size_t); +int munlock (const void *, size_t); +int mlockall (int); +int munlockall (void); + +#ifdef _GNU_SOURCE +void *mremap (void *, size_t, size_t, int, ...); +int remap_file_pages (void *, size_t, int, size_t, int); +int memfd_create (const char *, unsigned); +int mlock2 (const void *, size_t, unsigned); +#endif + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +int madvise (void *, size_t, int); +int mincore (void *, size_t, unsigned char *); +#endif + +int shm_open (const char *, int, mode_t); +int shm_unlink (const char *); + +#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE) +#define mmap64 mmap +#define off64_t off_t +#endif + +#ifdef __cplusplus +} +#endif +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/sys/mount.h b/Ubiquitous/XiZi/lib/musllib/include/sys/mount.h new file mode 100644 index 000000000..57a89c09e --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/sys/mount.h @@ -0,0 +1,74 @@ +#ifndef _SYS_MOUNT_H +#define _SYS_MOUNT_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#define BLKROSET _IO(0x12, 93) +#define BLKROGET _IO(0x12, 94) +#define BLKRRPART _IO(0x12, 95) +#define BLKGETSIZE _IO(0x12, 96) +#define BLKFLSBUF _IO(0x12, 97) +#define BLKRASET _IO(0x12, 98) +#define BLKRAGET _IO(0x12, 99) +#define BLKFRASET _IO(0x12,100) +#define BLKFRAGET _IO(0x12,101) +#define BLKSECTSET _IO(0x12,102) +#define BLKSECTGET _IO(0x12,103) +#define BLKSSZGET _IO(0x12,104) +#define BLKBSZGET _IOR(0x12,112,size_t) +#define BLKBSZSET _IOW(0x12,113,size_t) +#define BLKGETSIZE64 _IOR(0x12,114,size_t) + +#define MS_RDONLY 1 +#define MS_NOSUID 2 +#define MS_NODEV 4 +#define MS_NOEXEC 8 +#define MS_SYNCHRONOUS 16 +#define MS_REMOUNT 32 +#define MS_MANDLOCK 64 +#define MS_DIRSYNC 128 +#define MS_NOATIME 1024 +#define MS_NODIRATIME 2048 +#define MS_BIND 4096 +#define MS_MOVE 8192 +#define MS_REC 16384 +#define MS_SILENT 32768 +#define MS_POSIXACL (1<<16) +#define MS_UNBINDABLE (1<<17) +#define MS_PRIVATE (1<<18) +#define MS_SLAVE (1<<19) +#define MS_SHARED (1<<20) +#define MS_RELATIME (1<<21) +#define MS_KERNMOUNT (1<<22) +#define MS_I_VERSION (1<<23) +#define MS_STRICTATIME (1<<24) +#define MS_LAZYTIME (1<<25) +#define MS_NOREMOTELOCK (1<<27) +#define MS_NOSEC (1<<28) +#define MS_BORN (1<<29) +#define MS_ACTIVE (1<<30) +#define MS_NOUSER (1U<<31) + +#define MS_RMT_MASK (MS_RDONLY|MS_SYNCHRONOUS|MS_MANDLOCK|MS_I_VERSION|MS_LAZYTIME) + +#define MS_MGC_VAL 0xc0ed0000 +#define MS_MGC_MSK 0xffff0000 + +#define MNT_FORCE 1 +#define MNT_DETACH 2 +#define MNT_EXPIRE 4 +#define UMOUNT_NOFOLLOW 8 + +int mount(const char *, const char *, const char *, unsigned long, const void *); +int umount(const char *); +int umount2(const char *, int); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/sys/msg.h b/Ubiquitous/XiZi/lib/musllib/include/sys/msg.h new file mode 100644 index 000000000..db5c62a42 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/sys/msg.h @@ -0,0 +1,53 @@ +#ifndef _SYS_MSG_H +#define _SYS_MSG_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#define __NEED_pid_t +#define __NEED_key_t +#define __NEED_time_t +#define __NEED_size_t +#define __NEED_ssize_t + +#include + +typedef unsigned long msgqnum_t; +typedef unsigned long msglen_t; + +#include + +#define __msg_cbytes msg_cbytes + +#define MSG_NOERROR 010000 +#define MSG_EXCEPT 020000 + +#define MSG_STAT (11 | (IPC_STAT & 0x100)) +#define MSG_INFO 12 +#define MSG_STAT_ANY (13 | (IPC_STAT & 0x100)) + +struct msginfo { + int msgpool, msgmap, msgmax, msgmnb, msgmni, msgssz, msgtql; + unsigned short msgseg; +}; + +int msgctl (int, int, struct msqid_ds *); +int msgget (key_t, int); +ssize_t msgrcv (int, void *, size_t, long, int); +int msgsnd (int, const void *, size_t, int); + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +struct msgbuf { + long mtype; + char mtext[1]; +}; +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/sys/mtio.h b/Ubiquitous/XiZi/lib/musllib/include/sys/mtio.h new file mode 100644 index 000000000..f16a529bb --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/sys/mtio.h @@ -0,0 +1,188 @@ +#ifndef _SYS_MTIO_H +#define _SYS_MTIO_H + +#include +#include + +struct mtop { + short mt_op; + int mt_count; +}; + +#define _IOT_mtop _IOT (_IOTS (short), 1, _IOTS (int), 1, 0, 0) +#define _IOT_mtget _IOT (_IOTS (long), 7, 0, 0, 0, 0) +#define _IOT_mtpos _IOT_SIMPLE (long) +#define _IOT_mtconfiginfo _IOT (_IOTS (long), 2, _IOTS (short), 3, _IOTS (long), 1) + + +#define MTRESET 0 +#define MTFSF 1 +#define MTBSF 2 +#define MTFSR 3 +#define MTBSR 4 +#define MTWEOF 5 +#define MTREW 6 +#define MTOFFL 7 +#define MTNOP 8 +#define MTRETEN 9 +#define MTBSFM 10 +#define MTFSFM 11 +#define MTEOM 12 +#define MTERASE 13 +#define MTRAS1 14 +#define MTRAS2 15 +#define MTRAS3 16 +#define MTSETBLK 20 +#define MTSETDENSITY 21 +#define MTSEEK 22 +#define MTTELL 23 +#define MTSETDRVBUFFER 24 +#define MTFSS 25 +#define MTBSS 26 +#define MTWSM 27 +#define MTLOCK 28 +#define MTUNLOCK 29 +#define MTLOAD 30 +#define MTUNLOAD 31 +#define MTCOMPRESSION 32 +#define MTSETPART 33 +#define MTMKPART 34 + +struct mtget { + long mt_type; + long mt_resid; + long mt_dsreg; + long mt_gstat; + long mt_erreg; + int mt_fileno; + int mt_blkno; +}; + +#define MT_ISUNKNOWN 0x01 +#define MT_ISQIC02 0x02 +#define MT_ISWT5150 0x03 +#define MT_ISARCHIVE_5945L2 0x04 +#define MT_ISCMSJ500 0x05 +#define MT_ISTDC3610 0x06 +#define MT_ISARCHIVE_VP60I 0x07 +#define MT_ISARCHIVE_2150L 0x08 +#define MT_ISARCHIVE_2060L 0x09 +#define MT_ISARCHIVESC499 0x0A +#define MT_ISQIC02_ALL_FEATURES 0x0F +#define MT_ISWT5099EEN24 0x11 +#define MT_ISTEAC_MT2ST 0x12 +#define MT_ISEVEREX_FT40A 0x32 +#define MT_ISDDS1 0x51 +#define MT_ISDDS2 0x52 +#define MT_ISSCSI1 0x71 +#define MT_ISSCSI2 0x72 +#define MT_ISFTAPE_UNKNOWN 0x800000 +#define MT_ISFTAPE_FLAG 0x800000 + +struct mt_tape_info { + long t_type; + char *t_name; +}; + +#define MT_TAPE_INFO \ +{ \ + {MT_ISUNKNOWN, "Unknown type of tape device"}, \ + {MT_ISQIC02, "Generic QIC-02 tape streamer"}, \ + {MT_ISWT5150, "Wangtek 5150, QIC-150"}, \ + {MT_ISARCHIVE_5945L2, "Archive 5945L-2"}, \ + {MT_ISCMSJ500, "CMS Jumbo 500"}, \ + {MT_ISTDC3610, "Tandberg TDC 3610, QIC-24"}, \ + {MT_ISARCHIVE_VP60I, "Archive VP60i, QIC-02"}, \ + {MT_ISARCHIVE_2150L, "Archive Viper 2150L"}, \ + {MT_ISARCHIVE_2060L, "Archive Viper 2060L"}, \ + {MT_ISARCHIVESC499, "Archive SC-499 QIC-36 controller"}, \ + {MT_ISQIC02_ALL_FEATURES, "Generic QIC-02 tape, all features"}, \ + {MT_ISWT5099EEN24, "Wangtek 5099-een24, 60MB"}, \ + {MT_ISTEAC_MT2ST, "Teac MT-2ST 155mb data cassette drive"}, \ + {MT_ISEVEREX_FT40A, "Everex FT40A, QIC-40"}, \ + {MT_ISSCSI1, "Generic SCSI-1 tape"}, \ + {MT_ISSCSI2, "Generic SCSI-2 tape"}, \ + {0, 0} \ +} + +struct mtpos { + long mt_blkno; +}; + +struct mtconfiginfo { + long mt_type; + long ifc_type; + unsigned short irqnr; + unsigned short dmanr; + unsigned short port; + unsigned long debug; + unsigned have_dens:1; + unsigned have_bsf:1; + unsigned have_fsr:1; + unsigned have_bsr:1; + unsigned have_eod:1; + unsigned have_seek:1; + unsigned have_tell:1; + unsigned have_ras1:1; + unsigned have_ras2:1; + unsigned have_ras3:1; + unsigned have_qfa:1; + unsigned pad1:5; + char reserved[10]; +}; + +#define MTIOCTOP _IOW('m', 1, struct mtop) +#define MTIOCGET _IOR('m', 2, struct mtget) +#define MTIOCPOS _IOR('m', 3, struct mtpos) + +#define MTIOCGETCONFIG _IOR('m', 4, struct mtconfiginfo) +#define MTIOCSETCONFIG _IOW('m', 5, struct mtconfiginfo) + +#define GMT_EOF(x) ((x) & 0x80000000) +#define GMT_BOT(x) ((x) & 0x40000000) +#define GMT_EOT(x) ((x) & 0x20000000) +#define GMT_SM(x) ((x) & 0x10000000) +#define GMT_EOD(x) ((x) & 0x08000000) +#define GMT_WR_PROT(x) ((x) & 0x04000000) +#define GMT_ONLINE(x) ((x) & 0x01000000) +#define GMT_D_6250(x) ((x) & 0x00800000) +#define GMT_D_1600(x) ((x) & 0x00400000) +#define GMT_D_800(x) ((x) & 0x00200000) +#define GMT_DR_OPEN(x) ((x) & 0x00040000) +#define GMT_IM_REP_EN(x) ((x) & 0x00010000) + +#define MT_ST_BLKSIZE_SHIFT 0 +#define MT_ST_BLKSIZE_MASK 0xffffff +#define MT_ST_DENSITY_SHIFT 24 +#define MT_ST_DENSITY_MASK 0xff000000 +#define MT_ST_SOFTERR_SHIFT 0 +#define MT_ST_SOFTERR_MASK 0xffff +#define MT_ST_OPTIONS 0xf0000000 +#define MT_ST_BOOLEANS 0x10000000 +#define MT_ST_SETBOOLEANS 0x30000000 +#define MT_ST_CLEARBOOLEANS 0x40000000 +#define MT_ST_WRITE_THRESHOLD 0x20000000 +#define MT_ST_DEF_BLKSIZE 0x50000000 +#define MT_ST_DEF_OPTIONS 0x60000000 +#define MT_ST_BUFFER_WRITES 0x1 +#define MT_ST_ASYNC_WRITES 0x2 +#define MT_ST_READ_AHEAD 0x4 +#define MT_ST_DEBUGGING 0x8 +#define MT_ST_TWO_FM 0x10 +#define MT_ST_FAST_MTEOM 0x20 +#define MT_ST_AUTO_LOCK 0x40 +#define MT_ST_DEF_WRITES 0x80 +#define MT_ST_CAN_BSR 0x100 +#define MT_ST_NO_BLKLIMS 0x200 +#define MT_ST_CAN_PARTITIONS 0x400 +#define MT_ST_SCSI2LOGICAL 0x800 +#define MT_ST_CLEAR_DEFAULT 0xfffff +#define MT_ST_DEF_DENSITY (MT_ST_DEF_OPTIONS | 0x100000) +#define MT_ST_DEF_COMPRESSION (MT_ST_DEF_OPTIONS | 0x200000) +#define MT_ST_DEF_DRVBUFFER (MT_ST_DEF_OPTIONS | 0x300000) +#define MT_ST_HPLOADER_OFFSET 10000 +#ifndef DEFTAPE +# define DEFTAPE "/dev/tape" +#endif + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/sys/param.h b/Ubiquitous/XiZi/lib/musllib/include/sys/param.h new file mode 100644 index 000000000..ce6b80198 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/sys/param.h @@ -0,0 +1,35 @@ +#ifndef _SYS_PARAM_H +#define _SYS_PARAM_H + +#define MAXSYMLINKS 20 +#define MAXHOSTNAMELEN 64 +#define MAXNAMLEN 255 +#define MAXPATHLEN 4096 +#define NBBY 8 +#define NGROUPS 32 +#define CANBSIZ 255 +#define NOFILE 256 +#define NCARGS 131072 +#define DEV_BSIZE 512 +#define NOGROUP (-1) + +#undef MIN +#undef MAX +#define MIN(a,b) (((a)<(b))?(a):(b)) +#define MAX(a,b) (((a)>(b))?(a):(b)) + +#define __bitop(x,i,o) ((x)[(i)/8] o (1<<(i)%8)) +#define setbit(x,i) __bitop(x,i,|=) +#define clrbit(x,i) __bitop(x,i,&=~) +#define isset(x,i) __bitop(x,i,&) +#define isclr(x,i) !isset(x,i) + +#define howmany(n,d) (((n)+((d)-1))/(d)) +#define roundup(n,d) (howmany(n,d)*(d)) +#define powerof2(n) !(((n)-1) & (n)) + +#include +#include +#include + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/sys/personality.h b/Ubiquitous/XiZi/lib/musllib/include/sys/personality.h new file mode 100644 index 000000000..31d43dfe1 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/sys/personality.h @@ -0,0 +1,46 @@ +#ifndef _PERSONALITY_H +#define _PERSONALITY_H + +#ifdef __cplusplus +extern "C" { +#endif + +#define ADDR_NO_RANDOMIZE 0x0040000 +#define MMAP_PAGE_ZERO 0x0100000 +#define ADDR_COMPAT_LAYOUT 0x0200000 +#define READ_IMPLIES_EXEC 0x0400000 +#define ADDR_LIMIT_32BIT 0x0800000 +#define SHORT_INODE 0x1000000 +#define WHOLE_SECONDS 0x2000000 +#define STICKY_TIMEOUTS 0x4000000 +#define ADDR_LIMIT_3GB 0x8000000 + +#define PER_LINUX 0 +#define PER_LINUX_32BIT ADDR_LIMIT_32BIT +#define PER_SVR4 (1 | STICKY_TIMEOUTS | MMAP_PAGE_ZERO) +#define PER_SVR3 (2 | STICKY_TIMEOUTS | SHORT_INODE) +#define PER_SCOSVR3 (3 | STICKY_TIMEOUTS | WHOLE_SECONDS | SHORT_INODE) +#define PER_OSR5 (3 | STICKY_TIMEOUTS | WHOLE_SECONDS) +#define PER_WYSEV386 (4 | STICKY_TIMEOUTS | SHORT_INODE) +#define PER_ISCR4 (5 | STICKY_TIMEOUTS) +#define PER_BSD 6 +#define PER_SUNOS (6 | STICKY_TIMEOUTS) +#define PER_XENIX (7 | STICKY_TIMEOUTS | SHORT_INODE) +#define PER_LINUX32 8 +#define PER_LINUX32_3GB (8 | ADDR_LIMIT_3GB) +#define PER_IRIX32 (9 | STICKY_TIMEOUTS) +#define PER_IRIXN32 (0xa | STICKY_TIMEOUTS) +#define PER_IRIX64 (0x0b | STICKY_TIMEOUTS) +#define PER_RISCOS 0xc +#define PER_SOLARIS (0xd | STICKY_TIMEOUTS) +#define PER_UW7 (0xe | STICKY_TIMEOUTS | MMAP_PAGE_ZERO) +#define PER_OSF4 0xf +#define PER_HPUX 0x10 +#define PER_MASK 0xff + +int personality(unsigned long); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/sys/poll.h b/Ubiquitous/XiZi/lib/musllib/include/sys/poll.h new file mode 100644 index 000000000..99170401d --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/sys/poll.h @@ -0,0 +1,2 @@ +#warning redirecting incorrect #include to +#include diff --git a/Ubiquitous/XiZi/lib/musllib/include/sys/prctl.h b/Ubiquitous/XiZi/lib/musllib/include/sys/prctl.h new file mode 100644 index 000000000..d9c846e9c --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/sys/prctl.h @@ -0,0 +1,167 @@ +#ifndef _SYS_PRCTL_H +#define _SYS_PRCTL_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#define PR_SET_PDEATHSIG 1 +#define PR_GET_PDEATHSIG 2 +#define PR_GET_DUMPABLE 3 +#define PR_SET_DUMPABLE 4 +#define PR_GET_UNALIGN 5 +#define PR_SET_UNALIGN 6 +#define PR_UNALIGN_NOPRINT 1 +#define PR_UNALIGN_SIGBUS 2 +#define PR_GET_KEEPCAPS 7 +#define PR_SET_KEEPCAPS 8 +#define PR_GET_FPEMU 9 +#define PR_SET_FPEMU 10 +#define PR_FPEMU_NOPRINT 1 +#define PR_FPEMU_SIGFPE 2 +#define PR_GET_FPEXC 11 +#define PR_SET_FPEXC 12 +#define PR_FP_EXC_SW_ENABLE 0x80 +#define PR_FP_EXC_DIV 0x010000 +#define PR_FP_EXC_OVF 0x020000 +#define PR_FP_EXC_UND 0x040000 +#define PR_FP_EXC_RES 0x080000 +#define PR_FP_EXC_INV 0x100000 +#define PR_FP_EXC_DISABLED 0 +#define PR_FP_EXC_NONRECOV 1 +#define PR_FP_EXC_ASYNC 2 +#define PR_FP_EXC_PRECISE 3 +#define PR_GET_TIMING 13 +#define PR_SET_TIMING 14 +#define PR_TIMING_STATISTICAL 0 +#define PR_TIMING_TIMESTAMP 1 +#define PR_SET_NAME 15 +#define PR_GET_NAME 16 +#define PR_GET_ENDIAN 19 +#define PR_SET_ENDIAN 20 +#define PR_ENDIAN_BIG 0 +#define PR_ENDIAN_LITTLE 1 +#define PR_ENDIAN_PPC_LITTLE 2 +#define PR_GET_SECCOMP 21 +#define PR_SET_SECCOMP 22 +#define PR_CAPBSET_READ 23 +#define PR_CAPBSET_DROP 24 +#define PR_GET_TSC 25 +#define PR_SET_TSC 26 +#define PR_TSC_ENABLE 1 +#define PR_TSC_SIGSEGV 2 +#define PR_GET_SECUREBITS 27 +#define PR_SET_SECUREBITS 28 +#define PR_SET_TIMERSLACK 29 +#define PR_GET_TIMERSLACK 30 + +#define PR_TASK_PERF_EVENTS_DISABLE 31 +#define PR_TASK_PERF_EVENTS_ENABLE 32 + +#define PR_MCE_KILL 33 +#define PR_MCE_KILL_CLEAR 0 +#define PR_MCE_KILL_SET 1 +#define PR_MCE_KILL_LATE 0 +#define PR_MCE_KILL_EARLY 1 +#define PR_MCE_KILL_DEFAULT 2 +#define PR_MCE_KILL_GET 34 + +#define PR_SET_MM 35 +#define PR_SET_MM_START_CODE 1 +#define PR_SET_MM_END_CODE 2 +#define PR_SET_MM_START_DATA 3 +#define PR_SET_MM_END_DATA 4 +#define PR_SET_MM_START_STACK 5 +#define PR_SET_MM_START_BRK 6 +#define PR_SET_MM_BRK 7 +#define PR_SET_MM_ARG_START 8 +#define PR_SET_MM_ARG_END 9 +#define PR_SET_MM_ENV_START 10 +#define PR_SET_MM_ENV_END 11 +#define PR_SET_MM_AUXV 12 +#define PR_SET_MM_EXE_FILE 13 +#define PR_SET_MM_MAP 14 +#define PR_SET_MM_MAP_SIZE 15 + +struct prctl_mm_map { + uint64_t start_code; + uint64_t end_code; + uint64_t start_data; + uint64_t end_data; + uint64_t start_brk; + uint64_t brk; + uint64_t start_stack; + uint64_t arg_start; + uint64_t arg_end; + uint64_t env_start; + uint64_t env_end; + uint64_t *auxv; + uint32_t auxv_size; + uint32_t exe_fd; +}; + +#define PR_SET_PTRACER 0x59616d61 +#define PR_SET_PTRACER_ANY (-1UL) + +#define PR_SET_CHILD_SUBREAPER 36 +#define PR_GET_CHILD_SUBREAPER 37 + +#define PR_SET_NO_NEW_PRIVS 38 +#define PR_GET_NO_NEW_PRIVS 39 + +#define PR_GET_TID_ADDRESS 40 + +#define PR_SET_THP_DISABLE 41 +#define PR_GET_THP_DISABLE 42 + +#define PR_MPX_ENABLE_MANAGEMENT 43 +#define PR_MPX_DISABLE_MANAGEMENT 44 + +#define PR_SET_FP_MODE 45 +#define PR_GET_FP_MODE 46 +#define PR_FP_MODE_FR (1 << 0) +#define PR_FP_MODE_FRE (1 << 1) + +#define PR_CAP_AMBIENT 47 +#define PR_CAP_AMBIENT_IS_SET 1 +#define PR_CAP_AMBIENT_RAISE 2 +#define PR_CAP_AMBIENT_LOWER 3 +#define PR_CAP_AMBIENT_CLEAR_ALL 4 + +#define PR_SVE_SET_VL 50 +#define PR_SVE_SET_VL_ONEXEC (1 << 18) +#define PR_SVE_GET_VL 51 +#define PR_SVE_VL_LEN_MASK 0xffff +#define PR_SVE_VL_INHERIT (1 << 17) + +#define PR_GET_SPECULATION_CTRL 52 +#define PR_SET_SPECULATION_CTRL 53 +#define PR_SPEC_STORE_BYPASS 0 +#define PR_SPEC_INDIRECT_BRANCH 1 +#define PR_SPEC_NOT_AFFECTED 0 +#define PR_SPEC_PRCTL (1UL << 0) +#define PR_SPEC_ENABLE (1UL << 1) +#define PR_SPEC_DISABLE (1UL << 2) +#define PR_SPEC_FORCE_DISABLE (1UL << 3) +#define PR_SPEC_DISABLE_NOEXEC (1UL << 4) + +#define PR_PAC_RESET_KEYS 54 +#define PR_PAC_APIAKEY (1UL << 0) +#define PR_PAC_APIBKEY (1UL << 1) +#define PR_PAC_APDAKEY (1UL << 2) +#define PR_PAC_APDBKEY (1UL << 3) +#define PR_PAC_APGAKEY (1UL << 4) + +#define PR_SET_TAGGED_ADDR_CTRL 55 +#define PR_GET_TAGGED_ADDR_CTRL 56 +#define PR_TAGGED_ADDR_ENABLE (1UL << 0) + +int prctl (int, ...); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/sys/procfs.h b/Ubiquitous/XiZi/lib/musllib/include/sys/procfs.h new file mode 100644 index 000000000..38e58c168 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/sys/procfs.h @@ -0,0 +1,63 @@ +#ifndef _SYS_PROCFS_H +#define _SYS_PROCFS_H +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include + +struct elf_siginfo { + int si_signo; + int si_code; + int si_errno; +}; + +struct elf_prstatus { + struct elf_siginfo pr_info; + short int pr_cursig; + unsigned long int pr_sigpend; + unsigned long int pr_sighold; + pid_t pr_pid; + pid_t pr_ppid; + pid_t pr_pgrp; + pid_t pr_sid; + struct { + long tv_sec, tv_usec; + } pr_utime, pr_stime, pr_cutime, pr_cstime; + elf_gregset_t pr_reg; + int pr_fpvalid; +}; + +#define ELF_PRARGSZ 80 + +struct elf_prpsinfo { + char pr_state; + char pr_sname; + char pr_zomb; + char pr_nice; + unsigned long int pr_flag; +#if UINTPTR_MAX == 0xffffffff + unsigned short int pr_uid; + unsigned short int pr_gid; +#else + unsigned int pr_uid; + unsigned int pr_gid; +#endif + int pr_pid, pr_ppid, pr_pgrp, pr_sid; + char pr_fname[16]; + char pr_psargs[ELF_PRARGSZ]; +}; + +typedef void *psaddr_t; +typedef elf_gregset_t prgregset_t; +typedef elf_fpregset_t prfpregset_t; +typedef pid_t lwpid_t; +typedef struct elf_prstatus prstatus_t; +typedef struct elf_prpsinfo prpsinfo_t; + +#ifdef __cplusplus +} +#endif +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/sys/ptrace.h b/Ubiquitous/XiZi/lib/musllib/include/sys/ptrace.h new file mode 100644 index 000000000..5d62a9859 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/sys/ptrace.h @@ -0,0 +1,138 @@ +#ifndef _SYS_PTRACE_H +#define _SYS_PTRACE_H +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#define PTRACE_TRACEME 0 +#define PT_TRACE_ME PTRACE_TRACEME + +#define PTRACE_PEEKTEXT 1 +#define PTRACE_PEEKDATA 2 +#define PTRACE_PEEKUSER 3 +#define PTRACE_POKETEXT 4 +#define PTRACE_POKEDATA 5 +#define PTRACE_POKEUSER 6 +#define PTRACE_CONT 7 +#define PTRACE_KILL 8 +#define PTRACE_SINGLESTEP 9 +#define PTRACE_GETREGS 12 +#define PTRACE_SETREGS 13 +#define PTRACE_GETFPREGS 14 +#define PTRACE_SETFPREGS 15 +#define PTRACE_ATTACH 16 +#define PTRACE_DETACH 17 +#define PTRACE_GETFPXREGS 18 +#define PTRACE_SETFPXREGS 19 +#define PTRACE_SYSCALL 24 +#define PTRACE_SETOPTIONS 0x4200 +#define PTRACE_GETEVENTMSG 0x4201 +#define PTRACE_GETSIGINFO 0x4202 +#define PTRACE_SETSIGINFO 0x4203 +#define PTRACE_GETREGSET 0x4204 +#define PTRACE_SETREGSET 0x4205 +#define PTRACE_SEIZE 0x4206 +#define PTRACE_INTERRUPT 0x4207 +#define PTRACE_LISTEN 0x4208 +#define PTRACE_PEEKSIGINFO 0x4209 +#define PTRACE_GETSIGMASK 0x420a +#define PTRACE_SETSIGMASK 0x420b +#define PTRACE_SECCOMP_GET_FILTER 0x420c +#define PTRACE_SECCOMP_GET_METADATA 0x420d +#define PTRACE_GET_SYSCALL_INFO 0x420e + +#define PT_READ_I PTRACE_PEEKTEXT +#define PT_READ_D PTRACE_PEEKDATA +#define PT_READ_U PTRACE_PEEKUSER +#define PT_WRITE_I PTRACE_POKETEXT +#define PT_WRITE_D PTRACE_POKEDATA +#define PT_WRITE_U PTRACE_POKEUSER +#define PT_CONTINUE PTRACE_CONT +#define PT_KILL PTRACE_KILL +#define PT_STEP PTRACE_SINGLESTEP +#define PT_GETREGS PTRACE_GETREGS +#define PT_SETREGS PTRACE_SETREGS +#define PT_GETFPREGS PTRACE_GETFPREGS +#define PT_SETFPREGS PTRACE_SETFPREGS +#define PT_ATTACH PTRACE_ATTACH +#define PT_DETACH PTRACE_DETACH +#define PT_GETFPXREGS PTRACE_GETFPXREGS +#define PT_SETFPXREGS PTRACE_SETFPXREGS +#define PT_SYSCALL PTRACE_SYSCALL +#define PT_SETOPTIONS PTRACE_SETOPTIONS +#define PT_GETEVENTMSG PTRACE_GETEVENTMSG +#define PT_GETSIGINFO PTRACE_GETSIGINFO +#define PT_SETSIGINFO PTRACE_SETSIGINFO + +#define PTRACE_O_TRACESYSGOOD 0x00000001 +#define PTRACE_O_TRACEFORK 0x00000002 +#define PTRACE_O_TRACEVFORK 0x00000004 +#define PTRACE_O_TRACECLONE 0x00000008 +#define PTRACE_O_TRACEEXEC 0x00000010 +#define PTRACE_O_TRACEVFORKDONE 0x00000020 +#define PTRACE_O_TRACEEXIT 0x00000040 +#define PTRACE_O_TRACESECCOMP 0x00000080 +#define PTRACE_O_EXITKILL 0x00100000 +#define PTRACE_O_SUSPEND_SECCOMP 0x00200000 +#define PTRACE_O_MASK 0x003000ff + +#define PTRACE_EVENT_FORK 1 +#define PTRACE_EVENT_VFORK 2 +#define PTRACE_EVENT_CLONE 3 +#define PTRACE_EVENT_EXEC 4 +#define PTRACE_EVENT_VFORK_DONE 5 +#define PTRACE_EVENT_EXIT 6 +#define PTRACE_EVENT_SECCOMP 7 +#define PTRACE_EVENT_STOP 128 + +#define PTRACE_PEEKSIGINFO_SHARED 1 + +#define PTRACE_SYSCALL_INFO_NONE 0 +#define PTRACE_SYSCALL_INFO_ENTRY 1 +#define PTRACE_SYSCALL_INFO_EXIT 2 +#define PTRACE_SYSCALL_INFO_SECCOMP 3 + +#include + +struct __ptrace_peeksiginfo_args { + uint64_t off; + uint32_t flags; + int32_t nr; +}; + +struct __ptrace_seccomp_metadata { + uint64_t filter_off; + uint64_t flags; +}; + +struct __ptrace_syscall_info { + uint8_t op; + uint8_t __pad[3]; + uint32_t arch; + uint64_t instruction_pointer; + uint64_t stack_pointer; + union { + struct { + uint64_t nr; + uint64_t args[6]; + } entry; + struct { + int64_t rval; + uint8_t is_error; + } exit; + struct { + uint64_t nr; + uint64_t args[6]; + uint32_t ret_data; + } seccomp; + }; +}; + +long ptrace(int, ...); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/sys/quota.h b/Ubiquitous/XiZi/lib/musllib/include/sys/quota.h new file mode 100644 index 000000000..3ed73785d --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/sys/quota.h @@ -0,0 +1,102 @@ +#ifndef _SYS_QUOTA_H +#define _SYS_QUOTA_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#define _LINUX_QUOTA_VERSION 2 + +#define dbtob(num) ((num) << 10) +#define btodb(num) ((num) >> 10) +#define fs_to_dq_blocks(num, blksize) (((num) * (blksize)) / 1024) + +#define MAX_IQ_TIME 604800 +#define MAX_DQ_TIME 604800 + +#define MAXQUOTAS 2 +#define USRQUOTA 0 +#define GRPQUOTA 1 + +#define INITQFNAMES { "user", "group", "undefined" }; + +#define QUOTAFILENAME "quota" +#define QUOTAGROUP "staff" + +#define NR_DQHASH 43 +#define NR_DQUOTS 256 + +#define SUBCMDMASK 0x00ff +#define SUBCMDSHIFT 8 +#define QCMD(cmd, type) (((cmd) << SUBCMDSHIFT) | ((type) & SUBCMDMASK)) + +#define Q_SYNC 0x800001 +#define Q_QUOTAON 0x800002 +#define Q_QUOTAOFF 0x800003 +#define Q_GETFMT 0x800004 +#define Q_GETINFO 0x800005 +#define Q_SETINFO 0x800006 +#define Q_GETQUOTA 0x800007 +#define Q_SETQUOTA 0x800008 + +#define QFMT_VFS_OLD 1 +#define QFMT_VFS_V0 2 +#define QFMT_OCFS2 3 +#define QFMT_VFS_V1 4 + +#define QIF_BLIMITS 1 +#define QIF_SPACE 2 +#define QIF_ILIMITS 4 +#define QIF_INODES 8 +#define QIF_BTIME 16 +#define QIF_ITIME 32 +#define QIF_LIMITS (QIF_BLIMITS | QIF_ILIMITS) +#define QIF_USAGE (QIF_SPACE | QIF_INODES) +#define QIF_TIMES (QIF_BTIME | QIF_ITIME) +#define QIF_ALL (QIF_LIMITS | QIF_USAGE | QIF_TIMES) + +struct dqblk { + uint64_t dqb_bhardlimit; + uint64_t dqb_bsoftlimit; + uint64_t dqb_curspace; + uint64_t dqb_ihardlimit; + uint64_t dqb_isoftlimit; + uint64_t dqb_curinodes; + uint64_t dqb_btime; + uint64_t dqb_itime; + uint32_t dqb_valid; +}; + +#define dq_bhardlimit dq_dqb.dqb_bhardlimit +#define dq_bsoftlimit dq_dqb.dqb_bsoftlimit +#define dq_curspace dq_dqb.dqb_curspace +#define dq_valid dq_dqb.dqb_valid +#define dq_ihardlimit dq_dqb.dqb_ihardlimit +#define dq_isoftlimit dq_dqb.dqb_isoftlimit +#define dq_curinodes dq_dqb.dqb_curinodes +#define dq_btime dq_dqb.dqb_btime +#define dq_itime dq_dqb.dqb_itime + +#define dqoff(UID) ((long long)(UID) * sizeof (struct dqblk)) + +#define IIF_BGRACE 1 +#define IIF_IGRACE 2 +#define IIF_FLAGS 4 +#define IIF_ALL (IIF_BGRACE | IIF_IGRACE | IIF_FLAGS) + +struct dqinfo { + uint64_t dqi_bgrace; + uint64_t dqi_igrace; + uint32_t dqi_flags; + uint32_t dqi_valid; +}; + +int quotactl(int, const char *, int, char *); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/sys/random.h b/Ubiquitous/XiZi/lib/musllib/include/sys/random.h new file mode 100644 index 000000000..4ee7bf2cc --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/sys/random.h @@ -0,0 +1,19 @@ +#ifndef _SYS_RANDOM_H +#define _SYS_RANDOM_H +#ifdef __cplusplus +extern "C" { +#endif + +#define __NEED_size_t +#define __NEED_ssize_t +#include + +#define GRND_NONBLOCK 0x0001 +#define GRND_RANDOM 0x0002 + +ssize_t getrandom(void *, size_t, unsigned); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/sys/reboot.h b/Ubiquitous/XiZi/lib/musllib/include/sys/reboot.h new file mode 100644 index 000000000..9702eddba --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/sys/reboot.h @@ -0,0 +1,20 @@ +#ifndef _SYS_REBOOT_H +#define _SYS_REBOOT_H +#ifdef __cplusplus +extern "C" { +#endif + +#define RB_AUTOBOOT 0x01234567 +#define RB_HALT_SYSTEM 0xcdef0123 +#define RB_ENABLE_CAD 0x89abcdef +#define RB_DISABLE_CAD 0 +#define RB_POWER_OFF 0x4321fedc +#define RB_SW_SUSPEND 0xd000fce2 +#define RB_KEXEC 0x45584543 + +int reboot(int); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/sys/reg.h b/Ubiquitous/XiZi/lib/musllib/include/sys/reg.h new file mode 100644 index 000000000..b47452d00 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/sys/reg.h @@ -0,0 +1,9 @@ +#ifndef _SYS_REG_H +#define _SYS_REG_H + +#include +#include + +#include + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/sys/resource.h b/Ubiquitous/XiZi/lib/musllib/include/sys/resource.h new file mode 100644 index 000000000..dc5f52d9e --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/sys/resource.h @@ -0,0 +1,116 @@ +#ifndef _SYS_RESOURCE_H +#define _SYS_RESOURCE_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +#define __NEED_id_t + +#ifdef _GNU_SOURCE +#define __NEED_pid_t +#endif + +#include +#include + +typedef unsigned long long rlim_t; + +struct rlimit { + rlim_t rlim_cur; + rlim_t rlim_max; +}; + +struct rusage { + struct timeval ru_utime; + struct timeval ru_stime; + /* linux extensions, but useful */ + long ru_maxrss; + long ru_ixrss; + long ru_idrss; + long ru_isrss; + long ru_minflt; + long ru_majflt; + long ru_nswap; + long ru_inblock; + long ru_oublock; + long ru_msgsnd; + long ru_msgrcv; + long ru_nsignals; + long ru_nvcsw; + long ru_nivcsw; + /* room for more... */ + long __reserved[16]; +}; + +int getrlimit (int, struct rlimit *); +int setrlimit (int, const struct rlimit *); +int getrusage (int, struct rusage *); + +int getpriority (int, id_t); +int setpriority (int, id_t, int); + +#ifdef _GNU_SOURCE +int prlimit(pid_t, int, const struct rlimit *, struct rlimit *); +#define prlimit64 prlimit +#endif + +#define PRIO_MIN (-20) +#define PRIO_MAX 20 + +#define PRIO_PROCESS 0 +#define PRIO_PGRP 1 +#define PRIO_USER 2 + +#define RUSAGE_SELF 0 +#define RUSAGE_CHILDREN (-1) +#define RUSAGE_THREAD 1 + +#define RLIM_INFINITY (~0ULL) +#define RLIM_SAVED_CUR RLIM_INFINITY +#define RLIM_SAVED_MAX RLIM_INFINITY + +#define RLIMIT_CPU 0 +#define RLIMIT_FSIZE 1 +#define RLIMIT_DATA 2 +#define RLIMIT_STACK 3 +#define RLIMIT_CORE 4 +#ifndef RLIMIT_RSS +#define RLIMIT_RSS 5 +#define RLIMIT_NPROC 6 +#define RLIMIT_NOFILE 7 +#define RLIMIT_MEMLOCK 8 +#define RLIMIT_AS 9 +#endif +#define RLIMIT_LOCKS 10 +#define RLIMIT_SIGPENDING 11 +#define RLIMIT_MSGQUEUE 12 +#define RLIMIT_NICE 13 +#define RLIMIT_RTPRIO 14 +#define RLIMIT_RTTIME 15 +#define RLIMIT_NLIMITS 16 + +#define RLIM_NLIMITS RLIMIT_NLIMITS + +#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE) +#define RLIM64_INFINITY RLIM_INFINITY +#define RLIM64_SAVED_CUR RLIM_SAVED_CUR +#define RLIM64_SAVED_MAX RLIM_SAVED_MAX +#define getrlimit64 getrlimit +#define setrlimit64 setrlimit +#define rlimit64 rlimit +#define rlim64_t rlim_t +#endif + +#if _REDIR_TIME64 +__REDIR(getrusage, __getrusage_time64); +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/sys/select.h b/Ubiquitous/XiZi/lib/musllib/include/sys/select.h new file mode 100644 index 000000000..b3bab1d57 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/sys/select.h @@ -0,0 +1,46 @@ +#ifndef _SYS_SELECT_H +#define _SYS_SELECT_H +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#define __NEED_size_t +#define __NEED_time_t +#define __NEED_suseconds_t +#define __NEED_struct_timeval +#define __NEED_struct_timespec +#define __NEED_sigset_t + +#include + +#define FD_SETSIZE 1024 + +typedef unsigned long fd_mask; + +typedef struct { + unsigned long fds_bits[FD_SETSIZE / 8 / sizeof(long)]; +} fd_set; + +#define FD_ZERO(s) do { int __i; unsigned long *__b=(s)->fds_bits; for(__i=sizeof (fd_set)/sizeof (long); __i; __i--) *__b++=0; } while(0) +#define FD_SET(d, s) ((s)->fds_bits[(d)/(8*sizeof(long))] |= (1UL<<((d)%(8*sizeof(long))))) +#define FD_CLR(d, s) ((s)->fds_bits[(d)/(8*sizeof(long))] &= ~(1UL<<((d)%(8*sizeof(long))))) +#define FD_ISSET(d, s) !!((s)->fds_bits[(d)/(8*sizeof(long))] & (1UL<<((d)%(8*sizeof(long))))) + +int select (int, fd_set *__restrict, fd_set *__restrict, fd_set *__restrict, struct timeval *__restrict); +int pselect (int, fd_set *__restrict, fd_set *__restrict, fd_set *__restrict, const struct timespec *__restrict, const sigset_t *__restrict); + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +#define NFDBITS (8*(int)sizeof(long)) +#endif + +#if _REDIR_TIME64 +__REDIR(select, __select_time64); +__REDIR(pselect, __pselect_time64); +#endif + +#ifdef __cplusplus +} +#endif +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/sys/sem.h b/Ubiquitous/XiZi/lib/musllib/include/sys/sem.h new file mode 100644 index 000000000..a747784ed --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/sys/sem.h @@ -0,0 +1,72 @@ +#ifndef _SYS_SEM_H +#define _SYS_SEM_H +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#define __NEED_size_t +#define __NEED_pid_t +#define __NEED_time_t +#ifdef _GNU_SOURCE +#define __NEED_struct_timespec +#endif +#include + +#include + +#define SEM_UNDO 0x1000 +#define GETPID 11 +#define GETVAL 12 +#define GETALL 13 +#define GETNCNT 14 +#define GETZCNT 15 +#define SETVAL 16 +#define SETALL 17 + +#include + +#define _SEM_SEMUN_UNDEFINED 1 + +#define SEM_STAT (18 | (IPC_STAT & 0x100)) +#define SEM_INFO 19 +#define SEM_STAT_ANY (20 | (IPC_STAT & 0x100)) + +struct seminfo { + int semmap; + int semmni; + int semmns; + int semmnu; + int semmsl; + int semopm; + int semume; + int semusz; + int semvmx; + int semaem; +}; + +struct sembuf { + unsigned short sem_num; + short sem_op; + short sem_flg; +}; + +int semctl(int, int, int, ...); +int semget(key_t, int, int); +int semop(int, struct sembuf *, size_t); + +#ifdef _GNU_SOURCE +int semtimedop(int, struct sembuf *, size_t, const struct timespec *); +#endif + +#if _REDIR_TIME64 +#ifdef _GNU_SOURCE +__REDIR(semtimedop, __semtimedop_time64); +#endif +#endif + +#ifdef __cplusplus +} +#endif +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/sys/sendfile.h b/Ubiquitous/XiZi/lib/musllib/include/sys/sendfile.h new file mode 100644 index 000000000..e7570d8e5 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/sys/sendfile.h @@ -0,0 +1,22 @@ +#ifndef _SYS_SENDFILE_H +#define _SYS_SENDFILE_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +ssize_t sendfile(int, int, off_t *, size_t); + +#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE) +#define sendfile64 sendfile +#define off64_t off_t +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/sys/shm.h b/Ubiquitous/XiZi/lib/musllib/include/sys/shm.h new file mode 100644 index 000000000..fd708cab1 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/sys/shm.h @@ -0,0 +1,70 @@ +#ifndef _SYS_SHM_H +#define _SYS_SHM_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#define __NEED_time_t +#define __NEED_size_t +#define __NEED_pid_t + +#include + +#include + +#ifdef _GNU_SOURCE +#define __used_ids used_ids +#define __swap_attempts swap_attempts +#define __swap_successes swap_successes +#endif + +#include + +#define SHM_R 0400 +#define SHM_W 0200 + +#define SHM_RDONLY 010000 +#define SHM_RND 020000 +#define SHM_REMAP 040000 +#define SHM_EXEC 0100000 + +#define SHM_LOCK 11 +#define SHM_UNLOCK 12 +#define SHM_STAT (13 | (IPC_STAT & 0x100)) +#define SHM_INFO 14 +#define SHM_STAT_ANY (15 | (IPC_STAT & 0x100)) +#define SHM_DEST 01000 +#define SHM_LOCKED 02000 +#define SHM_HUGETLB 04000 +#define SHM_NORESERVE 010000 + +#define SHM_HUGE_SHIFT 26 +#define SHM_HUGE_MASK 0x3f +#define SHM_HUGE_64KB (16 << 26) +#define SHM_HUGE_512KB (19 << 26) +#define SHM_HUGE_1MB (20 << 26) +#define SHM_HUGE_2MB (21 << 26) +#define SHM_HUGE_8MB (23 << 26) +#define SHM_HUGE_16MB (24 << 26) +#define SHM_HUGE_32MB (25 << 26) +#define SHM_HUGE_256MB (28 << 26) +#define SHM_HUGE_512MB (29 << 26) +#define SHM_HUGE_1GB (30 << 26) +#define SHM_HUGE_2GB (31 << 26) +#define SHM_HUGE_16GB (34U << 26) + +typedef unsigned long shmatt_t; + +void *shmat(int, const void *, int); +int shmctl(int, int, struct shmid_ds *); +int shmdt(const void *); +int shmget(key_t, size_t, int); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/sys/signal.h b/Ubiquitous/XiZi/lib/musllib/include/sys/signal.h new file mode 100644 index 000000000..45bdcc648 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/sys/signal.h @@ -0,0 +1,2 @@ +#warning redirecting incorrect #include to +#include diff --git a/Ubiquitous/XiZi/lib/musllib/include/sys/signalfd.h b/Ubiquitous/XiZi/lib/musllib/include/sys/signalfd.h new file mode 100644 index 000000000..e881e2cfd --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/sys/signalfd.h @@ -0,0 +1,49 @@ +#ifndef _SYS_SIGNALFD_H +#define _SYS_SIGNALFD_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +#define __NEED_sigset_t + +#include + +#define SFD_CLOEXEC O_CLOEXEC +#define SFD_NONBLOCK O_NONBLOCK + +int signalfd(int, const sigset_t *, int); + +struct signalfd_siginfo { + uint32_t ssi_signo; + int32_t ssi_errno; + int32_t ssi_code; + uint32_t ssi_pid; + uint32_t ssi_uid; + int32_t ssi_fd; + uint32_t ssi_tid; + uint32_t ssi_band; + uint32_t ssi_overrun; + uint32_t ssi_trapno; + int32_t ssi_status; + int32_t ssi_int; + uint64_t ssi_ptr; + uint64_t ssi_utime; + uint64_t ssi_stime; + uint64_t ssi_addr; + uint16_t ssi_addr_lsb; + uint16_t __pad2; + int32_t ssi_syscall; + uint64_t ssi_call_addr; + uint32_t ssi_arch; + uint8_t __pad[128-14*4-5*8-2*2]; +}; + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/sys/socket.h b/Ubiquitous/XiZi/lib/musllib/include/sys/socket.h new file mode 100644 index 000000000..38f5bb17b --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/sys/socket.h @@ -0,0 +1,413 @@ +#ifndef _SYS_SOCKET_H +#define _SYS_SOCKET_H +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#define __NEED_socklen_t +#define __NEED_sa_family_t +#define __NEED_size_t +#define __NEED_ssize_t +#define __NEED_uid_t +#define __NEED_pid_t +#define __NEED_gid_t +#define __NEED_struct_iovec + +#include + +#include + +struct msghdr { + void *msg_name; + socklen_t msg_namelen; + struct iovec *msg_iov; +#if __LONG_MAX > 0x7fffffff && __BYTE_ORDER == __BIG_ENDIAN + int __pad1; +#endif + int msg_iovlen; +#if __LONG_MAX > 0x7fffffff && __BYTE_ORDER == __LITTLE_ENDIAN + int __pad1; +#endif + void *msg_control; +#if __LONG_MAX > 0x7fffffff && __BYTE_ORDER == __BIG_ENDIAN + int __pad2; +#endif + socklen_t msg_controllen; +#if __LONG_MAX > 0x7fffffff && __BYTE_ORDER == __LITTLE_ENDIAN + int __pad2; +#endif + int msg_flags; +}; + +struct cmsghdr { +#if __LONG_MAX > 0x7fffffff && __BYTE_ORDER == __BIG_ENDIAN + int __pad1; +#endif + socklen_t cmsg_len; +#if __LONG_MAX > 0x7fffffff && __BYTE_ORDER == __LITTLE_ENDIAN + int __pad1; +#endif + int cmsg_level; + int cmsg_type; +}; + +#ifdef _GNU_SOURCE +struct ucred { + pid_t pid; + uid_t uid; + gid_t gid; +}; + +struct mmsghdr { + struct msghdr msg_hdr; + unsigned int msg_len; +}; + +struct timespec; + +int sendmmsg (int, struct mmsghdr *, unsigned int, unsigned int); +int recvmmsg (int, struct mmsghdr *, unsigned int, unsigned int, struct timespec *); +#endif + +struct linger { + int l_onoff; + int l_linger; +}; + +#define SHUT_RD 0 +#define SHUT_WR 1 +#define SHUT_RDWR 2 + +#ifndef SOCK_STREAM +#define SOCK_STREAM 1 +#define SOCK_DGRAM 2 +#endif + +#define SOCK_RAW 3 +#define SOCK_RDM 4 +#define SOCK_SEQPACKET 5 +#define SOCK_DCCP 6 +#define SOCK_PACKET 10 + +#ifndef SOCK_CLOEXEC +#define SOCK_CLOEXEC 02000000 +#define SOCK_NONBLOCK 04000 +#endif + +#define PF_UNSPEC 0 +#define PF_LOCAL 1 +#define PF_UNIX PF_LOCAL +#define PF_FILE PF_LOCAL +#define PF_INET 2 +#define PF_AX25 3 +#define PF_IPX 4 +#define PF_APPLETALK 5 +#define PF_NETROM 6 +#define PF_BRIDGE 7 +#define PF_ATMPVC 8 +#define PF_X25 9 +#define PF_INET6 10 +#define PF_ROSE 11 +#define PF_DECnet 12 +#define PF_NETBEUI 13 +#define PF_SECURITY 14 +#define PF_KEY 15 +#define PF_NETLINK 16 +#define PF_ROUTE PF_NETLINK +#define PF_PACKET 17 +#define PF_ASH 18 +#define PF_ECONET 19 +#define PF_ATMSVC 20 +#define PF_RDS 21 +#define PF_SNA 22 +#define PF_IRDA 23 +#define PF_PPPOX 24 +#define PF_WANPIPE 25 +#define PF_LLC 26 +#define PF_IB 27 +#define PF_MPLS 28 +#define PF_CAN 29 +#define PF_TIPC 30 +#define PF_BLUETOOTH 31 +#define PF_IUCV 32 +#define PF_RXRPC 33 +#define PF_ISDN 34 +#define PF_PHONET 35 +#define PF_IEEE802154 36 +#define PF_CAIF 37 +#define PF_ALG 38 +#define PF_NFC 39 +#define PF_VSOCK 40 +#define PF_KCM 41 +#define PF_QIPCRTR 42 +#define PF_SMC 43 +#define PF_XDP 44 +#define PF_MAX 45 + +#define AF_UNSPEC PF_UNSPEC +#define AF_LOCAL PF_LOCAL +#define AF_UNIX AF_LOCAL +#define AF_FILE AF_LOCAL +#define AF_INET PF_INET +#define AF_AX25 PF_AX25 +#define AF_IPX PF_IPX +#define AF_APPLETALK PF_APPLETALK +#define AF_NETROM PF_NETROM +#define AF_BRIDGE PF_BRIDGE +#define AF_ATMPVC PF_ATMPVC +#define AF_X25 PF_X25 +#define AF_INET6 PF_INET6 +#define AF_ROSE PF_ROSE +#define AF_DECnet PF_DECnet +#define AF_NETBEUI PF_NETBEUI +#define AF_SECURITY PF_SECURITY +#define AF_KEY PF_KEY +#define AF_NETLINK PF_NETLINK +#define AF_ROUTE PF_ROUTE +#define AF_PACKET PF_PACKET +#define AF_ASH PF_ASH +#define AF_ECONET PF_ECONET +#define AF_ATMSVC PF_ATMSVC +#define AF_RDS PF_RDS +#define AF_SNA PF_SNA +#define AF_IRDA PF_IRDA +#define AF_PPPOX PF_PPPOX +#define AF_WANPIPE PF_WANPIPE +#define AF_LLC PF_LLC +#define AF_IB PF_IB +#define AF_MPLS PF_MPLS +#define AF_CAN PF_CAN +#define AF_TIPC PF_TIPC +#define AF_BLUETOOTH PF_BLUETOOTH +#define AF_IUCV PF_IUCV +#define AF_RXRPC PF_RXRPC +#define AF_ISDN PF_ISDN +#define AF_PHONET PF_PHONET +#define AF_IEEE802154 PF_IEEE802154 +#define AF_CAIF PF_CAIF +#define AF_ALG PF_ALG +#define AF_NFC PF_NFC +#define AF_VSOCK PF_VSOCK +#define AF_KCM PF_KCM +#define AF_QIPCRTR PF_QIPCRTR +#define AF_SMC PF_SMC +#define AF_XDP PF_XDP +#define AF_MAX PF_MAX + +#ifndef SO_DEBUG +#define SO_DEBUG 1 +#define SO_REUSEADDR 2 +#define SO_TYPE 3 +#define SO_ERROR 4 +#define SO_DONTROUTE 5 +#define SO_BROADCAST 6 +#define SO_SNDBUF 7 +#define SO_RCVBUF 8 +#define SO_KEEPALIVE 9 +#define SO_OOBINLINE 10 +#define SO_NO_CHECK 11 +#define SO_PRIORITY 12 +#define SO_LINGER 13 +#define SO_BSDCOMPAT 14 +#define SO_REUSEPORT 15 +#define SO_PASSCRED 16 +#define SO_PEERCRED 17 +#define SO_RCVLOWAT 18 +#define SO_SNDLOWAT 19 +#define SO_ACCEPTCONN 30 +#define SO_PEERSEC 31 +#define SO_SNDBUFFORCE 32 +#define SO_RCVBUFFORCE 33 +#define SO_PROTOCOL 38 +#define SO_DOMAIN 39 +#endif + +#ifndef SO_RCVTIMEO +#if __LONG_MAX == 0x7fffffff +#define SO_RCVTIMEO 66 +#define SO_SNDTIMEO 67 +#else +#define SO_RCVTIMEO 20 +#define SO_SNDTIMEO 21 +#endif +#endif + +#ifndef SO_TIMESTAMP +#if __LONG_MAX == 0x7fffffff +#define SO_TIMESTAMP 63 +#define SO_TIMESTAMPNS 64 +#define SO_TIMESTAMPING 65 +#else +#define SO_TIMESTAMP 29 +#define SO_TIMESTAMPNS 35 +#define SO_TIMESTAMPING 37 +#endif +#endif + +#define SO_SECURITY_AUTHENTICATION 22 +#define SO_SECURITY_ENCRYPTION_TRANSPORT 23 +#define SO_SECURITY_ENCRYPTION_NETWORK 24 + +#define SO_BINDTODEVICE 25 + +#define SO_ATTACH_FILTER 26 +#define SO_DETACH_FILTER 27 +#define SO_GET_FILTER SO_ATTACH_FILTER + +#define SO_PEERNAME 28 +#define SCM_TIMESTAMP SO_TIMESTAMP +#define SO_PASSSEC 34 +#define SCM_TIMESTAMPNS SO_TIMESTAMPNS +#define SO_MARK 36 +#define SCM_TIMESTAMPING SO_TIMESTAMPING +#define SO_RXQ_OVFL 40 +#define SO_WIFI_STATUS 41 +#define SCM_WIFI_STATUS SO_WIFI_STATUS +#define SO_PEEK_OFF 42 +#define SO_NOFCS 43 +#define SO_LOCK_FILTER 44 +#define SO_SELECT_ERR_QUEUE 45 +#define SO_BUSY_POLL 46 +#define SO_MAX_PACING_RATE 47 +#define SO_BPF_EXTENSIONS 48 +#define SO_INCOMING_CPU 49 +#define SO_ATTACH_BPF 50 +#define SO_DETACH_BPF SO_DETACH_FILTER +#define SO_ATTACH_REUSEPORT_CBPF 51 +#define SO_ATTACH_REUSEPORT_EBPF 52 +#define SO_CNX_ADVICE 53 +#define SCM_TIMESTAMPING_OPT_STATS 54 +#define SO_MEMINFO 55 +#define SO_INCOMING_NAPI_ID 56 +#define SO_COOKIE 57 +#define SCM_TIMESTAMPING_PKTINFO 58 +#define SO_PEERGROUPS 59 +#define SO_ZEROCOPY 60 +#define SO_TXTIME 61 +#define SCM_TXTIME SO_TXTIME +#define SO_BINDTOIFINDEX 62 +#define SO_DETACH_REUSEPORT_BPF 68 + +#ifndef SOL_SOCKET +#define SOL_SOCKET 1 +#endif + +#define SOL_IP 0 +#define SOL_IPV6 41 +#define SOL_ICMPV6 58 + +#define SOL_RAW 255 +#define SOL_DECNET 261 +#define SOL_X25 262 +#define SOL_PACKET 263 +#define SOL_ATM 264 +#define SOL_AAL 265 +#define SOL_IRDA 266 +#define SOL_NETBEUI 267 +#define SOL_LLC 268 +#define SOL_DCCP 269 +#define SOL_NETLINK 270 +#define SOL_TIPC 271 +#define SOL_RXRPC 272 +#define SOL_PPPOL2TP 273 +#define SOL_BLUETOOTH 274 +#define SOL_PNPIPE 275 +#define SOL_RDS 276 +#define SOL_IUCV 277 +#define SOL_CAIF 278 +#define SOL_ALG 279 +#define SOL_NFC 280 +#define SOL_KCM 281 +#define SOL_TLS 282 +#define SOL_XDP 283 + +#define SOMAXCONN 128 + +#define MSG_OOB 0x0001 +#define MSG_PEEK 0x0002 +#define MSG_DONTROUTE 0x0004 +#define MSG_CTRUNC 0x0008 +#define MSG_PROXY 0x0010 +#define MSG_TRUNC 0x0020 +#define MSG_DONTWAIT 0x0040 +#define MSG_EOR 0x0080 +#define MSG_WAITALL 0x0100 +#define MSG_FIN 0x0200 +#define MSG_SYN 0x0400 +#define MSG_CONFIRM 0x0800 +#define MSG_RST 0x1000 +#define MSG_ERRQUEUE 0x2000 +#define MSG_NOSIGNAL 0x4000 +#define MSG_MORE 0x8000 +#define MSG_WAITFORONE 0x10000 +#define MSG_BATCH 0x40000 +#define MSG_ZEROCOPY 0x4000000 +#define MSG_FASTOPEN 0x20000000 +#define MSG_CMSG_CLOEXEC 0x40000000 + +#define __CMSG_LEN(cmsg) (((cmsg)->cmsg_len + sizeof(long) - 1) & ~(long)(sizeof(long) - 1)) +#define __CMSG_NEXT(cmsg) ((unsigned char *)(cmsg) + __CMSG_LEN(cmsg)) +#define __MHDR_END(mhdr) ((unsigned char *)(mhdr)->msg_control + (mhdr)->msg_controllen) + +#define CMSG_DATA(cmsg) ((unsigned char *) (((struct cmsghdr *)(cmsg)) + 1)) +#define CMSG_NXTHDR(mhdr, cmsg) ((cmsg)->cmsg_len < sizeof (struct cmsghdr) || \ + __CMSG_LEN(cmsg) + sizeof(struct cmsghdr) >= __MHDR_END(mhdr) - (unsigned char *)(cmsg) \ + ? 0 : (struct cmsghdr *)__CMSG_NEXT(cmsg)) +#define CMSG_FIRSTHDR(mhdr) ((size_t) (mhdr)->msg_controllen >= sizeof (struct cmsghdr) ? (struct cmsghdr *) (mhdr)->msg_control : (struct cmsghdr *) 0) + +#define CMSG_ALIGN(len) (((len) + sizeof (size_t) - 1) & (size_t) ~(sizeof (size_t) - 1)) +#define CMSG_SPACE(len) (CMSG_ALIGN (len) + CMSG_ALIGN (sizeof (struct cmsghdr))) +#define CMSG_LEN(len) (CMSG_ALIGN (sizeof (struct cmsghdr)) + (len)) + +#define SCM_RIGHTS 0x01 +#define SCM_CREDENTIALS 0x02 + +struct sockaddr { + sa_family_t sa_family; + char sa_data[14]; +}; + +struct sockaddr_storage { + sa_family_t ss_family; + char __ss_padding[128-sizeof(long)-sizeof(sa_family_t)]; + unsigned long __ss_align; +}; + +int socket (int, int, int); +int socketpair (int, int, int, int [2]); + +int shutdown (int, int); + +int bind (int, const struct sockaddr *, socklen_t); +int connect (int, const struct sockaddr *, socklen_t); +int listen (int, int); +int accept (int, struct sockaddr *__restrict, socklen_t *__restrict); +int accept4(int, struct sockaddr *__restrict, socklen_t *__restrict, int); + +int getsockname (int, struct sockaddr *__restrict, socklen_t *__restrict); +int getpeername (int, struct sockaddr *__restrict, socklen_t *__restrict); + +ssize_t send (int, const void *, size_t, int); +ssize_t recv (int, void *, size_t, int); +ssize_t sendto (int, const void *, size_t, int, const struct sockaddr *, socklen_t); +ssize_t recvfrom (int, void *__restrict, size_t, int, struct sockaddr *__restrict, socklen_t *__restrict); +ssize_t sendmsg (int, const struct msghdr *, int); +ssize_t recvmsg (int, struct msghdr *, int); + +int getsockopt (int, int, int, void *__restrict, socklen_t *__restrict); +int setsockopt (int, int, int, const void *, socklen_t); + +int sockatmark (int); + +#if _REDIR_TIME64 +#ifdef _GNU_SOURCE +__REDIR(recvmmsg, __recvmmsg_time64); +#endif +#endif + +#ifdef __cplusplus +} +#endif +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/sys/soundcard.h b/Ubiquitous/XiZi/lib/musllib/include/sys/soundcard.h new file mode 100644 index 000000000..5ca776461 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/sys/soundcard.h @@ -0,0 +1 @@ +#include diff --git a/Ubiquitous/XiZi/lib/musllib/include/sys/stat.h b/Ubiquitous/XiZi/lib/musllib/include/sys/stat.h new file mode 100644 index 000000000..10d446c46 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/sys/stat.h @@ -0,0 +1,127 @@ +#ifndef _SYS_STAT_H +#define _SYS_STAT_H +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#define __NEED_dev_t +#define __NEED_ino_t +#define __NEED_mode_t +#define __NEED_nlink_t +#define __NEED_uid_t +#define __NEED_gid_t +#define __NEED_off_t +#define __NEED_time_t +#define __NEED_blksize_t +#define __NEED_blkcnt_t +#define __NEED_struct_timespec + +#include + +#include + +#define st_atime st_atim.tv_sec +#define st_mtime st_mtim.tv_sec +#define st_ctime st_ctim.tv_sec + +#define S_IFMT 0170000 + +#define S_IFDIR 0040000 +#define S_IFCHR 0020000 +#define S_IFBLK 0060000 +#define S_IFREG 0100000 +#define S_IFIFO 0010000 +#define S_IFLNK 0120000 +#define S_IFSOCK 0140000 + +#define S_TYPEISMQ(buf) 0 +#define S_TYPEISSEM(buf) 0 +#define S_TYPEISSHM(buf) 0 +#define S_TYPEISTMO(buf) 0 + +#define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR) +#define S_ISCHR(mode) (((mode) & S_IFMT) == S_IFCHR) +#define S_ISBLK(mode) (((mode) & S_IFMT) == S_IFBLK) +#define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG) +#define S_ISFIFO(mode) (((mode) & S_IFMT) == S_IFIFO) +#define S_ISLNK(mode) (((mode) & S_IFMT) == S_IFLNK) +#define S_ISSOCK(mode) (((mode) & S_IFMT) == S_IFSOCK) + +#ifndef S_IRUSR +#define S_ISUID 04000 +#define S_ISGID 02000 +#define S_ISVTX 01000 +#define S_IRUSR 0400 +#define S_IWUSR 0200 +#define S_IXUSR 0100 +#define S_IRWXU 0700 +#define S_IRGRP 0040 +#define S_IWGRP 0020 +#define S_IXGRP 0010 +#define S_IRWXG 0070 +#define S_IROTH 0004 +#define S_IWOTH 0002 +#define S_IXOTH 0001 +#define S_IRWXO 0007 +#endif + +#define UTIME_NOW 0x3fffffff +#define UTIME_OMIT 0x3ffffffe + +int stat(const char *__restrict, struct stat *__restrict); +int fstat(int, struct stat *); +int lstat(const char *__restrict, struct stat *__restrict); +int fstatat(int, const char *__restrict, struct stat *__restrict, int); +int chmod(const char *, mode_t); +int fchmod(int, mode_t); +int fchmodat(int, const char *, mode_t, int); +mode_t umask(mode_t); +int mkdir(const char *, mode_t); +int mkfifo(const char *, mode_t); +int mkdirat(int, const char *, mode_t); +int mkfifoat(int, const char *, mode_t); + +#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +int mknod(const char *, mode_t, dev_t); +int mknodat(int, const char *, mode_t, dev_t); +#endif + +int futimens(int, const struct timespec [2]); +int utimensat(int, const char *, const struct timespec [2], int); + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +int lchmod(const char *, mode_t); +#define S_IREAD S_IRUSR +#define S_IWRITE S_IWUSR +#define S_IEXEC S_IXUSR +#endif + +#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE) +#define stat64 stat +#define fstat64 fstat +#define lstat64 lstat +#define fstatat64 fstatat +#define blkcnt64_t blkcnt_t +#define fsblkcnt64_t fsblkcnt_t +#define fsfilcnt64_t fsfilcnt_t +#define ino64_t ino_t +#define off64_t off_t +#endif + +#if _REDIR_TIME64 +__REDIR(stat, __stat_time64); +__REDIR(fstat, __fstat_time64); +__REDIR(lstat, __lstat_time64); +__REDIR(fstatat, __fstatat_time64); +__REDIR(futimens, __futimens_time64); +__REDIR(utimensat, __utimensat_time64); +#endif + +#ifdef __cplusplus +} +#endif +#endif + + diff --git a/Ubiquitous/XiZi/lib/musllib/include/sys/statfs.h b/Ubiquitous/XiZi/lib/musllib/include/sys/statfs.h new file mode 100644 index 000000000..6f4c6230f --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/sys/statfs.h @@ -0,0 +1,32 @@ +#ifndef _SYS_STATFS_H +#define _SYS_STATFS_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#include + +typedef struct __fsid_t { + int __val[2]; +} fsid_t; + +#include + +int statfs (const char *, struct statfs *); +int fstatfs (int, struct statfs *); + +#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE) +#define statfs64 statfs +#define fstatfs64 fstatfs +#define fsblkcnt64_t fsblkcnt_t +#define fsfilcnt64_t fsfilcnt_t +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/sys/statvfs.h b/Ubiquitous/XiZi/lib/musllib/include/sys/statvfs.h new file mode 100644 index 000000000..793490b6d --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/sys/statvfs.h @@ -0,0 +1,56 @@ +#ifndef _SYS_STATVFS_H +#define _SYS_STATVFS_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#define __NEED_fsblkcnt_t +#define __NEED_fsfilcnt_t +#include + +struct statvfs { + unsigned long f_bsize, f_frsize; + fsblkcnt_t f_blocks, f_bfree, f_bavail; + fsfilcnt_t f_files, f_ffree, f_favail; +#if __BYTE_ORDER == __LITTLE_ENDIAN + unsigned long f_fsid; + unsigned :8*(2*sizeof(int)-sizeof(long)); +#else + unsigned :8*(2*sizeof(int)-sizeof(long)); + unsigned long f_fsid; +#endif + unsigned long f_flag, f_namemax; + int __reserved[6]; +}; + +int statvfs (const char *__restrict, struct statvfs *__restrict); +int fstatvfs (int, struct statvfs *); + +#define ST_RDONLY 1 +#define ST_NOSUID 2 +#define ST_NODEV 4 +#define ST_NOEXEC 8 +#define ST_SYNCHRONOUS 16 +#define ST_MANDLOCK 64 +#define ST_WRITE 128 +#define ST_APPEND 256 +#define ST_IMMUTABLE 512 +#define ST_NOATIME 1024 +#define ST_NODIRATIME 2048 +#define ST_RELATIME 4096 + +#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE) +#define statvfs64 statvfs +#define fstatvfs64 fstatvfs +#define fsblkcnt64_t fsblkcnt_t +#define fsfilcnt64_t fsfilcnt_t +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/sys/stropts.h b/Ubiquitous/XiZi/lib/musllib/include/sys/stropts.h new file mode 100644 index 000000000..5b5bc02f4 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/sys/stropts.h @@ -0,0 +1 @@ +#include diff --git a/Ubiquitous/XiZi/lib/musllib/include/sys/swap.h b/Ubiquitous/XiZi/lib/musllib/include/sys/swap.h new file mode 100644 index 000000000..11c0f9296 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/sys/swap.h @@ -0,0 +1,21 @@ +#ifndef _SYS_SWAP_H +#define _SYS_SWAP_H + +#ifdef __cplusplus +extern "C" { +#endif + + +#define SWAP_FLAG_PREFER 0x8000 +#define SWAP_FLAG_PRIO_MASK 0x7fff +#define SWAP_FLAG_PRIO_SHIFT 0 +#define SWAP_FLAG_DISCARD 0x10000 + +int swapon (const char *, int); +int swapoff (const char *); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/sys/syscall.h b/Ubiquitous/XiZi/lib/musllib/include/sys/syscall.h new file mode 100644 index 000000000..24987ddf2 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/sys/syscall.h @@ -0,0 +1,6 @@ +#ifndef _SYS_SYSCALL_H +#define _SYS_SYSCALL_H + +#include + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/sys/sysinfo.h b/Ubiquitous/XiZi/lib/musllib/include/sys/sysinfo.h new file mode 100644 index 000000000..6a3931e52 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/sys/sysinfo.h @@ -0,0 +1,36 @@ +#ifndef _SYS_SYSINFO_H +#define _SYS_SYSINFO_H + +#ifdef __cplusplus +extern "C" { +#endif + +#define SI_LOAD_SHIFT 16 + +struct sysinfo { + unsigned long uptime; + unsigned long loads[3]; + unsigned long totalram; + unsigned long freeram; + unsigned long sharedram; + unsigned long bufferram; + unsigned long totalswap; + unsigned long freeswap; + unsigned short procs, pad; + unsigned long totalhigh; + unsigned long freehigh; + unsigned mem_unit; + char __reserved[256]; +}; + +int sysinfo (struct sysinfo *); +int get_nprocs_conf (void); +int get_nprocs (void); +long get_phys_pages (void); +long get_avphys_pages (void); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/sys/syslog.h b/Ubiquitous/XiZi/lib/musllib/include/sys/syslog.h new file mode 100644 index 000000000..7761eceeb --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/sys/syslog.h @@ -0,0 +1 @@ +#include diff --git a/Ubiquitous/XiZi/lib/musllib/include/sys/sysmacros.h b/Ubiquitous/XiZi/lib/musllib/include/sys/sysmacros.h new file mode 100644 index 000000000..07a3ef183 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/sys/sysmacros.h @@ -0,0 +1,15 @@ +#ifndef _SYS_SYSMACROS_H +#define _SYS_SYSMACROS_H + +#define major(x) \ + ((unsigned)( (((x)>>31>>1) & 0xfffff000) | (((x)>>8) & 0x00000fff) )) +#define minor(x) \ + ((unsigned)( (((x)>>12) & 0xffffff00) | ((x) & 0x000000ff) )) + +#define makedev(x,y) ( \ + (((x)&0xfffff000ULL) << 32) | \ + (((x)&0x00000fffULL) << 8) | \ + (((y)&0xffffff00ULL) << 12) | \ + (((y)&0x000000ffULL)) ) + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/sys/termios.h b/Ubiquitous/XiZi/lib/musllib/include/sys/termios.h new file mode 100644 index 000000000..f5f751f04 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/sys/termios.h @@ -0,0 +1,2 @@ +#warning redirecting incorrect #include to +#include diff --git a/Ubiquitous/XiZi/lib/musllib/include/sys/time.h b/Ubiquitous/XiZi/lib/musllib/include/sys/time.h new file mode 100644 index 000000000..cdc67ef65 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/sys/time.h @@ -0,0 +1,76 @@ +#ifndef _SYS_TIME_H +#define _SYS_TIME_H +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#include + +int gettimeofday (struct timeval *__restrict, void *__restrict); + +#define ITIMER_REAL 0 +#define ITIMER_VIRTUAL 1 +#define ITIMER_PROF 2 + +struct itimerval { + struct timeval it_interval; + struct timeval it_value; +}; + +int getitimer (int, struct itimerval *); +int setitimer (int, const struct itimerval *__restrict, struct itimerval *__restrict); +int utimes (const char *, const struct timeval [2]); + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +struct timezone { + int tz_minuteswest; + int tz_dsttime; +}; +int futimes(int, const struct timeval [2]); +int futimesat(int, const char *, const struct timeval [2]); +int lutimes(const char *, const struct timeval [2]); +int settimeofday(const struct timeval *, const struct timezone *); +int adjtime (const struct timeval *, struct timeval *); +#define timerisset(t) ((t)->tv_sec || (t)->tv_usec) +#define timerclear(t) ((t)->tv_sec = (t)->tv_usec = 0) +#define timercmp(s,t,op) ((s)->tv_sec == (t)->tv_sec ? \ + (s)->tv_usec op (t)->tv_usec : (s)->tv_sec op (t)->tv_sec) +#define timeradd(s,t,a) (void) ( (a)->tv_sec = (s)->tv_sec + (t)->tv_sec, \ + ((a)->tv_usec = (s)->tv_usec + (t)->tv_usec) >= 1000000 && \ + ((a)->tv_usec -= 1000000, (a)->tv_sec++) ) +#define timersub(s,t,a) (void) ( (a)->tv_sec = (s)->tv_sec - (t)->tv_sec, \ + ((a)->tv_usec = (s)->tv_usec - (t)->tv_usec) < 0 && \ + ((a)->tv_usec += 1000000, (a)->tv_sec--) ) +#endif + +#if defined(_GNU_SOURCE) +#define TIMEVAL_TO_TIMESPEC(tv, ts) ( \ + (ts)->tv_sec = (tv)->tv_sec, \ + (ts)->tv_nsec = (tv)->tv_usec * 1000, \ + (void)0 ) +#define TIMESPEC_TO_TIMEVAL(tv, ts) ( \ + (tv)->tv_sec = (ts)->tv_sec, \ + (tv)->tv_usec = (ts)->tv_nsec / 1000, \ + (void)0 ) +#endif + +#if _REDIR_TIME64 +__REDIR(gettimeofday, __gettimeofday_time64); +__REDIR(getitimer, __getitimer_time64); +__REDIR(setitimer, __setitimer_time64); +__REDIR(utimes, __utimes_time64); +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +__REDIR(futimes, __futimes_time64); +__REDIR(futimesat, __futimesat_time64); +__REDIR(lutimes, __lutimes_time64); +__REDIR(settimeofday, __settimeofday_time64); +__REDIR(adjtime, __adjtime64); +#endif +#endif + +#ifdef __cplusplus +} +#endif +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/sys/timeb.h b/Ubiquitous/XiZi/lib/musllib/include/sys/timeb.h new file mode 100644 index 000000000..628239b7e --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/sys/timeb.h @@ -0,0 +1,28 @@ +#ifndef _SYS_TIMEB_H +#define _SYS_TIMEB_H +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#define __NEED_time_t + +#include + +struct timeb { + time_t time; + unsigned short millitm; + short timezone, dstflag; +}; + +int ftime(struct timeb *); + +#if _REDIR_TIME64 +__REDIR(ftime, __ftime64); +#endif + +#ifdef __cplusplus +} +#endif +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/sys/timerfd.h b/Ubiquitous/XiZi/lib/musllib/include/sys/timerfd.h new file mode 100644 index 000000000..1b832cdd8 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/sys/timerfd.h @@ -0,0 +1,32 @@ +#ifndef _SYS_TIMERFD_H +#define _SYS_TIMERFD_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +#define TFD_NONBLOCK O_NONBLOCK +#define TFD_CLOEXEC O_CLOEXEC + +#define TFD_TIMER_ABSTIME 1 +#define TFD_TIMER_CANCEL_ON_SET (1 << 1) + +struct itimerspec; + +int timerfd_create(int, int); +int timerfd_settime(int, int, const struct itimerspec *, struct itimerspec *); +int timerfd_gettime(int, struct itimerspec *); + +#if _REDIR_TIME64 +__REDIR(timerfd_settime, __timerfd_settime64); +__REDIR(timerfd_gettime, __timerfd_gettime64); +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/sys/times.h b/Ubiquitous/XiZi/lib/musllib/include/sys/times.h new file mode 100644 index 000000000..80a50522d --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/sys/times.h @@ -0,0 +1,25 @@ +#ifndef _SYS_TIMES_H +#define _SYS_TIMES_H + +#ifdef __cplusplus +extern "C" { +#endif + +#define __NEED_clock_t +#include + +struct tms { + clock_t tms_utime; + clock_t tms_stime; + clock_t tms_cutime; + clock_t tms_cstime; +}; + +clock_t times (struct tms *); + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/Ubiquitous/XiZi/lib/musllib/include/sys/timex.h b/Ubiquitous/XiZi/lib/musllib/include/sys/timex.h new file mode 100644 index 000000000..8b417e1be --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/sys/timex.h @@ -0,0 +1,103 @@ +#ifndef _SYS_TIMEX_H +#define _SYS_TIMEX_H + +#ifdef __cplusplus +extern "C" { +#endif + +#define __NEED_clockid_t + +#include + +#include + +struct ntptimeval { + struct timeval time; + long maxerror, esterror; +}; + +struct timex { + unsigned modes; + long offset, freq, maxerror, esterror; + int status; + long constant, precision, tolerance; + struct timeval time; + long tick, ppsfreq, jitter; + int shift; + long stabil, jitcnt, calcnt, errcnt, stbcnt; + int tai; + int __padding[11]; +}; + +#define ADJ_OFFSET 0x0001 +#define ADJ_FREQUENCY 0x0002 +#define ADJ_MAXERROR 0x0004 +#define ADJ_ESTERROR 0x0008 +#define ADJ_STATUS 0x0010 +#define ADJ_TIMECONST 0x0020 +#define ADJ_TAI 0x0080 +#define ADJ_SETOFFSET 0x0100 +#define ADJ_MICRO 0x1000 +#define ADJ_NANO 0x2000 +#define ADJ_TICK 0x4000 +#define ADJ_OFFSET_SINGLESHOT 0x8001 +#define ADJ_OFFSET_SS_READ 0xa001 + +#define MOD_OFFSET ADJ_OFFSET +#define MOD_FREQUENCY ADJ_FREQUENCY +#define MOD_MAXERROR ADJ_MAXERROR +#define MOD_ESTERROR ADJ_ESTERROR +#define MOD_STATUS ADJ_STATUS +#define MOD_TIMECONST ADJ_TIMECONST +#define MOD_CLKB ADJ_TICK +#define MOD_CLKA ADJ_OFFSET_SINGLESHOT +#define MOD_TAI ADJ_TAI +#define MOD_MICRO ADJ_MICRO +#define MOD_NANO ADJ_NANO + +#define STA_PLL 0x0001 +#define STA_PPSFREQ 0x0002 +#define STA_PPSTIME 0x0004 +#define STA_FLL 0x0008 + +#define STA_INS 0x0010 +#define STA_DEL 0x0020 +#define STA_UNSYNC 0x0040 +#define STA_FREQHOLD 0x0080 + +#define STA_PPSSIGNAL 0x0100 +#define STA_PPSJITTER 0x0200 +#define STA_PPSWANDER 0x0400 +#define STA_PPSERROR 0x0800 + +#define STA_CLOCKERR 0x1000 +#define STA_NANO 0x2000 +#define STA_MODE 0x4000 +#define STA_CLK 0x8000 + +#define STA_RONLY (STA_PPSSIGNAL | STA_PPSJITTER | STA_PPSWANDER | \ + STA_PPSERROR | STA_CLOCKERR | STA_NANO | STA_MODE | STA_CLK) + +#define TIME_OK 0 +#define TIME_INS 1 +#define TIME_DEL 2 +#define TIME_OOP 3 +#define TIME_WAIT 4 +#define TIME_ERROR 5 +#define TIME_BAD TIME_ERROR + +#define MAXTC 6 + +int adjtimex(struct timex *); +int clock_adjtime(clockid_t, struct timex *); + +#if _REDIR_TIME64 +__REDIR(adjtimex, __adjtimex_time64); +__REDIR(clock_adjtime, __clock_adjtime64); +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/sys/ttydefaults.h b/Ubiquitous/XiZi/lib/musllib/include/sys/ttydefaults.h new file mode 100644 index 000000000..edb55bc4d --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/sys/ttydefaults.h @@ -0,0 +1,34 @@ +#ifndef _SYS_TTYDEFAULTS_H +#define _SYS_TTYDEFAULTS_H + +#define TTYDEF_IFLAG (BRKINT | ISTRIP | ICRNL | IMAXBEL | IXON | IXANY) +#define TTYDEF_OFLAG (OPOST | ONLCR | XTABS) +#define TTYDEF_LFLAG (ECHO | ICANON | ISIG | IEXTEN | ECHOE|ECHOKE|ECHOCTL) +#define TTYDEF_CFLAG (CREAD | CS7 | PARENB | HUPCL) +#define TTYDEF_SPEED (B9600) +#define CTRL(x) ((x)&037) +#define CEOF CTRL('d') + +#define CEOL '\0' +#define CSTATUS '\0' + +#define CERASE 0177 +#define CINTR CTRL('c') +#define CKILL CTRL('u') +#define CMIN 1 +#define CQUIT 034 +#define CSUSP CTRL('z') +#define CTIME 0 +#define CDSUSP CTRL('y') +#define CSTART CTRL('q') +#define CSTOP CTRL('s') +#define CLNEXT CTRL('v') +#define CDISCARD CTRL('o') +#define CWERASE CTRL('w') +#define CREPRINT CTRL('r') +#define CEOT CEOF +#define CBRK CEOL +#define CRPRNT CREPRINT +#define CFLUSH CDISCARD + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/sys/types.h b/Ubiquitous/XiZi/lib/musllib/include/sys/types.h new file mode 100644 index 000000000..0c35541da --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/sys/types.h @@ -0,0 +1,85 @@ +#ifndef _SYS_TYPES_H +#define _SYS_TYPES_H +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#define __NEED_ino_t +#define __NEED_dev_t +#define __NEED_uid_t +#define __NEED_gid_t +#define __NEED_mode_t +#define __NEED_nlink_t +#define __NEED_off_t +#define __NEED_pid_t +#define __NEED_size_t +#define __NEED_ssize_t +#define __NEED_time_t +#define __NEED_timer_t +#define __NEED_clockid_t + +#define __NEED_blkcnt_t +#define __NEED_fsblkcnt_t +#define __NEED_fsfilcnt_t + +#define __NEED_id_t +#define __NEED_key_t +#define __NEED_clock_t +#define __NEED_suseconds_t +#define __NEED_blksize_t + +#define __NEED_pthread_t +#define __NEED_pthread_attr_t +#define __NEED_pthread_mutexattr_t +#define __NEED_pthread_condattr_t +#define __NEED_pthread_rwlockattr_t +#define __NEED_pthread_barrierattr_t +#define __NEED_pthread_mutex_t +#define __NEED_pthread_cond_t +#define __NEED_pthread_rwlock_t +#define __NEED_pthread_barrier_t +#define __NEED_pthread_spinlock_t +#define __NEED_pthread_key_t +#define __NEED_pthread_once_t +#define __NEED_useconds_t + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +#define __NEED_int8_t +#define __NEED_int16_t +#define __NEED_int32_t +#define __NEED_int64_t +#define __NEED_u_int64_t +#define __NEED_register_t +#endif + +#include + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +typedef unsigned char u_int8_t; +typedef unsigned short u_int16_t; +typedef unsigned u_int32_t; +typedef char *caddr_t; +typedef unsigned char u_char; +typedef unsigned short u_short, ushort; +typedef unsigned u_int, uint; +typedef unsigned long u_long, ulong; +typedef long long quad_t; +typedef unsigned long long u_quad_t; +#include +#include +#endif + +#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE) +#define blkcnt64_t blkcnt_t +#define fsblkcnt64_t fsblkcnt_t +#define fsfilcnt64_t fsfilcnt_t +#define ino64_t ino_t +#define off64_t off_t +#endif + +#ifdef __cplusplus +} +#endif +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/sys/ucontext.h b/Ubiquitous/XiZi/lib/musllib/include/sys/ucontext.h new file mode 100644 index 000000000..5fdbd63db --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/sys/ucontext.h @@ -0,0 +1 @@ +#include diff --git a/Ubiquitous/XiZi/lib/musllib/include/sys/uio.h b/Ubiquitous/XiZi/lib/musllib/include/sys/uio.h new file mode 100644 index 000000000..00f73a2f0 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/sys/uio.h @@ -0,0 +1,48 @@ +#ifndef _SYS_UIO_H +#define _SYS_UIO_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#define __NEED_size_t +#define __NEED_ssize_t +#define __NEED_struct_iovec + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +#define __NEED_off_t +#endif + +#ifdef _GNU_SOURCE +#define __NEED_pid_t +#endif + +#include + +#define UIO_MAXIOV 1024 + +ssize_t readv (int, const struct iovec *, int); +ssize_t writev (int, const struct iovec *, int); + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +ssize_t preadv (int, const struct iovec *, int, off_t); +ssize_t pwritev (int, const struct iovec *, int, off_t); +#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE) +#define preadv64 preadv +#define pwritev64 pwritev +#define off64_t off_t +#endif +#endif + +#ifdef _GNU_SOURCE +ssize_t process_vm_writev(pid_t, const struct iovec *, unsigned long, const struct iovec *, unsigned long, unsigned long); +ssize_t process_vm_readv(pid_t, const struct iovec *, unsigned long, const struct iovec *, unsigned long, unsigned long); +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/sys/un.h b/Ubiquitous/XiZi/lib/musllib/include/sys/un.h new file mode 100644 index 000000000..1a3193ad2 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/sys/un.h @@ -0,0 +1,31 @@ +#ifndef _SYS_UN_H +#define _SYS_UN_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#define __NEED_sa_family_t +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +#define __NEED_size_t +#endif + +#include + +struct sockaddr_un { + sa_family_t sun_family; + char sun_path[108]; +}; + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +size_t strlen(const char *); +#define SUN_LEN(s) (2+strlen((s)->sun_path)) +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/sys/user.h b/Ubiquitous/XiZi/lib/musllib/include/sys/user.h new file mode 100644 index 000000000..96a034009 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/sys/user.h @@ -0,0 +1,16 @@ +#ifndef _SYS_USER_H +#define _SYS_USER_H +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include + +#include + +#ifdef __cplusplus +} +#endif +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/sys/utsname.h b/Ubiquitous/XiZi/lib/musllib/include/sys/utsname.h new file mode 100644 index 000000000..2c80fb5a2 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/sys/utsname.h @@ -0,0 +1,29 @@ +#ifndef _SYS_UTSNAME_H +#define _SYS_UTSNAME_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +struct utsname { + char sysname[65]; + char nodename[65]; + char release[65]; + char version[65]; + char machine[65]; +#ifdef _GNU_SOURCE + char domainname[65]; +#else + char __domainname[65]; +#endif +}; + +int uname (struct utsname *); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/sys/vfs.h b/Ubiquitous/XiZi/lib/musllib/include/sys/vfs.h new file mode 100644 index 000000000..a899db276 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/sys/vfs.h @@ -0,0 +1 @@ +#include diff --git a/Ubiquitous/XiZi/lib/musllib/include/sys/vt.h b/Ubiquitous/XiZi/lib/musllib/include/sys/vt.h new file mode 100644 index 000000000..5000de499 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/sys/vt.h @@ -0,0 +1 @@ +#include diff --git a/Ubiquitous/XiZi/lib/musllib/include/sys/wait.h b/Ubiquitous/XiZi/lib/musllib/include/sys/wait.h new file mode 100644 index 000000000..d4b1f2e18 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/sys/wait.h @@ -0,0 +1,67 @@ +#ifndef _SYS_WAIT_H +#define _SYS_WAIT_H +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#define __NEED_pid_t +#define __NEED_id_t +#include + +typedef enum { + P_ALL = 0, + P_PID = 1, + P_PGID = 2, + P_PIDFD = 3 +} idtype_t; + +pid_t wait (int *); +pid_t waitpid (pid_t, int *, int ); + +#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \ + || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \ + || defined(_BSD_SOURCE) +#include +int waitid (idtype_t, id_t, siginfo_t *, int); +#endif + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +#include +pid_t wait3 (int *, int, struct rusage *); +pid_t wait4 (pid_t, int *, int, struct rusage *); +#endif + +#define WNOHANG 1 +#define WUNTRACED 2 + +#define WSTOPPED 2 +#define WEXITED 4 +#define WCONTINUED 8 +#define WNOWAIT 0x1000000 + +#define __WNOTHREAD 0x20000000 +#define __WALL 0x40000000 +#define __WCLONE 0x80000000 + +#define WEXITSTATUS(s) (((s) & 0xff00) >> 8) +#define WTERMSIG(s) ((s) & 0x7f) +#define WSTOPSIG(s) WEXITSTATUS(s) +#define WCOREDUMP(s) ((s) & 0x80) +#define WIFEXITED(s) (!WTERMSIG(s)) +#define WIFSTOPPED(s) ((short)((((s)&0xffff)*0x10001)>>8) > 0x7f00) +#define WIFSIGNALED(s) (((s)&0xffff)-1U < 0xffu) +#define WIFCONTINUED(s) ((s) == 0xffff) + +#if _REDIR_TIME64 +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +__REDIR(wait3, __wait3_time64); +__REDIR(wait4, __wait4_time64); +#endif +#endif + +#ifdef __cplusplus +} +#endif +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/sys/xattr.h b/Ubiquitous/XiZi/lib/musllib/include/sys/xattr.h new file mode 100644 index 000000000..eeeaafc44 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/sys/xattr.h @@ -0,0 +1,32 @@ +#ifndef _SYS_XATTR_H +#define _SYS_XATTR_H +#ifdef __cplusplus +extern "C" { +#endif + +#define __NEED_ssize_t +#define __NEED_size_t +#include + +#define XATTR_CREATE 1 +#define XATTR_REPLACE 2 + +ssize_t getxattr(const char *, const char *, void *, size_t); +ssize_t lgetxattr(const char *, const char *, void *, size_t); +ssize_t fgetxattr(int, const char *, void *, size_t); +ssize_t listxattr(const char *, char *, size_t); +ssize_t llistxattr(const char *, char *, size_t); +ssize_t flistxattr(int, char *, size_t); +int setxattr(const char *, const char *, const void *, size_t, int); +int lsetxattr(const char *, const char *, const void *, size_t, int); +int fsetxattr(int, const char *, const void *, size_t, int); +int removexattr(const char *, const char *); +int lremovexattr(const char *, const char *); +int fremovexattr(int, const char *); + +#define __UAPI_DEF_XATTR 0 + +#ifdef __cplusplus +} +#endif +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/syscall.h b/Ubiquitous/XiZi/lib/musllib/include/syscall.h new file mode 100644 index 000000000..4c3057844 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/syscall.h @@ -0,0 +1 @@ +#include diff --git a/Ubiquitous/XiZi/lib/musllib/include/sysexits.h b/Ubiquitous/XiZi/lib/musllib/include/sysexits.h new file mode 100644 index 000000000..16eeb4193 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/sysexits.h @@ -0,0 +1,21 @@ +#ifndef _SYSEXITS_H +#define _SYSEXITS_H +#define EX_OK 0 +#define EX__BASE 64 +#define EX_USAGE 64 +#define EX_DATAERR 65 +#define EX_NOINPUT 66 +#define EX_NOUSER 67 +#define EX_NOHOST 68 +#define EX_UNAVAILABLE 69 +#define EX_SOFTWARE 70 +#define EX_OSERR 71 +#define EX_OSFILE 72 +#define EX_CANTCREAT 73 +#define EX_IOERR 74 +#define EX_TEMPFAIL 75 +#define EX_PROTOCOL 76 +#define EX_NOPERM 77 +#define EX_CONFIG 78 +#define EX__MAX 78 +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/syslog.h b/Ubiquitous/XiZi/lib/musllib/include/syslog.h new file mode 100644 index 000000000..5b4d2964e --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/syslog.h @@ -0,0 +1,100 @@ +#ifndef _SYSLOG_H +#define _SYSLOG_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#define LOG_EMERG 0 +#define LOG_ALERT 1 +#define LOG_CRIT 2 +#define LOG_ERR 3 +#define LOG_WARNING 4 +#define LOG_NOTICE 5 +#define LOG_INFO 6 +#define LOG_DEBUG 7 + +#define LOG_PRIMASK 7 +#define LOG_PRI(p) ((p)&LOG_PRIMASK) +#define LOG_MAKEPRI(f, p) (((f)<<3)|(p)) + +#define LOG_MASK(p) (1<<(p)) +#define LOG_UPTO(p) ((1<<((p)+1))-1) + +#define LOG_KERN (0<<3) +#define LOG_USER (1<<3) +#define LOG_MAIL (2<<3) +#define LOG_DAEMON (3<<3) +#define LOG_AUTH (4<<3) +#define LOG_SYSLOG (5<<3) +#define LOG_LPR (6<<3) +#define LOG_NEWS (7<<3) +#define LOG_UUCP (8<<3) +#define LOG_CRON (9<<3) +#define LOG_AUTHPRIV (10<<3) +#define LOG_FTP (11<<3) + +#define LOG_LOCAL0 (16<<3) +#define LOG_LOCAL1 (17<<3) +#define LOG_LOCAL2 (18<<3) +#define LOG_LOCAL3 (19<<3) +#define LOG_LOCAL4 (20<<3) +#define LOG_LOCAL5 (21<<3) +#define LOG_LOCAL6 (22<<3) +#define LOG_LOCAL7 (23<<3) + +#define LOG_NFACILITIES 24 +#define LOG_FACMASK 0x3f8 +#define LOG_FAC(p) (((p)&LOG_FACMASK)>>3) + +#define LOG_PID 0x01 +#define LOG_CONS 0x02 +#define LOG_ODELAY 0x04 +#define LOG_NDELAY 0x08 +#define LOG_NOWAIT 0x10 +#define LOG_PERROR 0x20 + +void closelog (void); +void openlog (const char *, int, int); +int setlogmask (int); +void syslog (int, const char *, ...); + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +#define _PATH_LOG "/dev/log" +#define __NEED_va_list +#include +void vsyslog (int, const char *, va_list); +#if defined(SYSLOG_NAMES) +#define INTERNAL_NOPRI 0x10 +#define INTERNAL_MARK (LOG_NFACILITIES<<3) +typedef struct { + char *c_name; + int c_val; +} CODE; +#define prioritynames ((CODE *)(const CODE []){ \ + { "alert", LOG_ALERT }, { "crit", LOG_CRIT }, { "debug", LOG_DEBUG }, \ + { "emerg", LOG_EMERG }, { "err", LOG_ERR }, { "error", LOG_ERR }, \ + { "info", LOG_INFO }, { "none", INTERNAL_NOPRI }, \ + { "notice", LOG_NOTICE }, { "panic", LOG_EMERG }, \ + { "warn", LOG_WARNING }, { "warning", LOG_WARNING }, { 0, -1 } }) +#define facilitynames ((CODE *)(const CODE []){ \ + { "auth", LOG_AUTH }, { "authpriv", LOG_AUTHPRIV }, \ + { "cron", LOG_CRON }, { "daemon", LOG_DAEMON }, { "ftp", LOG_FTP }, \ + { "kern", LOG_KERN }, { "lpr", LOG_LPR }, { "mail", LOG_MAIL }, \ + { "mark", INTERNAL_MARK }, { "news", LOG_NEWS }, \ + { "security", LOG_AUTH }, { "syslog", LOG_SYSLOG }, \ + { "user", LOG_USER }, { "uucp", LOG_UUCP }, \ + { "local0", LOG_LOCAL0 }, { "local1", LOG_LOCAL1 }, \ + { "local2", LOG_LOCAL2 }, { "local3", LOG_LOCAL3 }, \ + { "local4", LOG_LOCAL4 }, { "local5", LOG_LOCAL5 }, \ + { "local6", LOG_LOCAL6 }, { "local7", LOG_LOCAL7 }, { 0, -1 } }) +#endif +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/tar.h b/Ubiquitous/XiZi/lib/musllib/include/tar.h new file mode 100644 index 000000000..be589842a --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/tar.h @@ -0,0 +1,33 @@ +#ifndef _TAR_H +#define _TAR_H + +#define TSUID 04000 +#define TSGID 02000 +#define TSVTX 01000 +#define TUREAD 00400 +#define TUWRITE 00200 +#define TUEXEC 00100 +#define TGREAD 00040 +#define TGWRITE 00020 +#define TGEXEC 00010 +#define TOREAD 00004 +#define TOWRITE 00002 +#define TOEXEC 00001 + +#define REGTYPE '0' +#define AREGTYPE '\0' +#define LNKTYPE '1' +#define SYMTYPE '2' +#define CHRTYPE '3' +#define BLKTYPE '4' +#define DIRTYPE '5' +#define FIFOTYPE '6' +#define CONTTYPE '7' + +#define TMAGIC "ustar" +#define TMAGLEN 6 + +#define TVERSION "00" +#define TVERSLEN 2 + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/termios.h b/Ubiquitous/XiZi/lib/musllib/include/termios.h new file mode 100644 index 000000000..d73c780d4 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/termios.h @@ -0,0 +1,46 @@ +#ifndef _TERMIOS_H +#define _TERMIOS_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#define __NEED_pid_t + +#include + +typedef unsigned char cc_t; +typedef unsigned int speed_t; +typedef unsigned int tcflag_t; + +#define NCCS 32 + +#include + +speed_t cfgetospeed (const struct termios *); +speed_t cfgetispeed (const struct termios *); +int cfsetospeed (struct termios *, speed_t); +int cfsetispeed (struct termios *, speed_t); + +int tcgetattr (int, struct termios *); +int tcsetattr (int, int, const struct termios *); + +int tcsendbreak (int, int); +int tcdrain (int); +int tcflush (int, int); +int tcflow (int, int); + +pid_t tcgetsid (int); + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +void cfmakeraw(struct termios *); +int cfsetspeed(struct termios *, speed_t); +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/tgmath.h b/Ubiquitous/XiZi/lib/musllib/include/tgmath.h new file mode 100644 index 000000000..e41ccac9e --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/tgmath.h @@ -0,0 +1,270 @@ +#ifndef _TGMATH_H +#define _TGMATH_H + +/* +the return types are only correct with gcc (__GNUC__) +otherwise they are long double or long double complex + +the long double version of a function is never chosen when +sizeof(double) == sizeof(long double) +(but the return type is set correctly with gcc) +*/ + +#include +#include + +#define __IS_FP(x) (sizeof((x)+1ULL) == sizeof((x)+1.0f)) +#define __IS_CX(x) (__IS_FP(x) && sizeof(x) == sizeof((x)+I)) +#define __IS_REAL(x) (__IS_FP(x) && 2*sizeof(x) == sizeof((x)+I)) + +#define __FLT(x) (__IS_REAL(x) && sizeof(x) == sizeof(float)) +#define __LDBL(x) (__IS_REAL(x) && sizeof(x) == sizeof(long double) && sizeof(long double) != sizeof(double)) + +#define __FLTCX(x) (__IS_CX(x) && sizeof(x) == sizeof(float complex)) +#define __DBLCX(x) (__IS_CX(x) && sizeof(x) == sizeof(double complex)) +#define __LDBLCX(x) (__IS_CX(x) && sizeof(x) == sizeof(long double complex) && sizeof(long double) != sizeof(double)) + +/* return type */ + +#ifdef __GNUC__ +/* +the result must be casted to the right type +(otherwise the result type is determined by the conversion +rules applied to all the function return types so it is long +double or long double complex except for integral functions) + +this cannot be done in c99, so the typeof gcc extension is +used and that the type of ?: depends on wether an operand is +a null pointer constant or not +(in c11 _Generic can be used) + +the c arguments below must be integer constant expressions +so they can be in null pointer constants +(__IS_FP above was carefully chosen this way) +*/ +/* if c then t else void */ +#define __type1(c,t) __typeof__(*(0?(t*)0:(void*)!(c))) +/* if c then t1 else t2 */ +#define __type2(c,t1,t2) __typeof__(*(0?(__type1(c,t1)*)0:(__type1(!(c),t2)*)0)) +/* cast to double when x is integral, otherwise use typeof(x) */ +#define __RETCAST(x) ( \ + __type2(__IS_FP(x), __typeof__(x), double)) +/* 2 args case, should work for complex types (cpow) */ +#define __RETCAST_2(x, y) ( \ + __type2(__IS_FP(x) && __IS_FP(y), \ + __typeof__((x)+(y)), \ + __typeof__((x)+(y)+1.0))) +/* 3 args case (fma only) */ +#define __RETCAST_3(x, y, z) ( \ + __type2(__IS_FP(x) && __IS_FP(y) && __IS_FP(z), \ + __typeof__((x)+(y)+(z)), \ + __typeof__((x)+(y)+(z)+1.0))) +/* drop complex from the type of x */ +/* TODO: wrong when sizeof(long double)==sizeof(double) */ +#define __RETCAST_REAL(x) ( \ + __type2(__IS_FP(x) && sizeof((x)+I) == sizeof(float complex), float, \ + __type2(sizeof((x)+1.0+I) == sizeof(double complex), double, \ + long double))) +/* add complex to the type of x */ +#define __RETCAST_CX(x) (__typeof__(__RETCAST(x)0+I)) +#else +#define __RETCAST(x) +#define __RETCAST_2(x, y) +#define __RETCAST_3(x, y, z) +#define __RETCAST_REAL(x) +#define __RETCAST_CX(x) +#endif + +/* function selection */ + +#define __tg_real_nocast(fun, x) ( \ + __FLT(x) ? fun ## f (x) : \ + __LDBL(x) ? fun ## l (x) : \ + fun(x) ) + +#define __tg_real(fun, x) (__RETCAST(x)__tg_real_nocast(fun, x)) + +#define __tg_real_2_1(fun, x, y) (__RETCAST(x)( \ + __FLT(x) ? fun ## f (x, y) : \ + __LDBL(x) ? fun ## l (x, y) : \ + fun(x, y) )) + +#define __tg_real_2(fun, x, y) (__RETCAST_2(x, y)( \ + __FLT(x) && __FLT(y) ? fun ## f (x, y) : \ + __LDBL((x)+(y)) ? fun ## l (x, y) : \ + fun(x, y) )) + +#define __tg_complex(fun, x) (__RETCAST_CX(x)( \ + __FLTCX((x)+I) && __IS_FP(x) ? fun ## f (x) : \ + __LDBLCX((x)+I) ? fun ## l (x) : \ + fun(x) )) + +#define __tg_complex_retreal(fun, x) (__RETCAST_REAL(x)( \ + __FLTCX((x)+I) && __IS_FP(x) ? fun ## f (x) : \ + __LDBLCX((x)+I) ? fun ## l (x) : \ + fun(x) )) + +#define __tg_real_complex(fun, x) (__RETCAST(x)( \ + __FLTCX(x) ? c ## fun ## f (x) : \ + __DBLCX(x) ? c ## fun (x) : \ + __LDBLCX(x) ? c ## fun ## l (x) : \ + __FLT(x) ? fun ## f (x) : \ + __LDBL(x) ? fun ## l (x) : \ + fun(x) )) + +/* special cases */ + +#define __tg_real_remquo(x, y, z) (__RETCAST_2(x, y)( \ + __FLT(x) && __FLT(y) ? remquof(x, y, z) : \ + __LDBL((x)+(y)) ? remquol(x, y, z) : \ + remquo(x, y, z) )) + +#define __tg_real_fma(x, y, z) (__RETCAST_3(x, y, z)( \ + __FLT(x) && __FLT(y) && __FLT(z) ? fmaf(x, y, z) : \ + __LDBL((x)+(y)+(z)) ? fmal(x, y, z) : \ + fma(x, y, z) )) + +#define __tg_real_complex_pow(x, y) (__RETCAST_2(x, y)( \ + __FLTCX((x)+(y)) && __IS_FP(x) && __IS_FP(y) ? cpowf(x, y) : \ + __FLTCX((x)+(y)) ? cpow(x, y) : \ + __DBLCX((x)+(y)) ? cpow(x, y) : \ + __LDBLCX((x)+(y)) ? cpowl(x, y) : \ + __FLT(x) && __FLT(y) ? powf(x, y) : \ + __LDBL((x)+(y)) ? powl(x, y) : \ + pow(x, y) )) + +#define __tg_real_complex_fabs(x) (__RETCAST_REAL(x)( \ + __FLTCX(x) ? cabsf(x) : \ + __DBLCX(x) ? cabs(x) : \ + __LDBLCX(x) ? cabsl(x) : \ + __FLT(x) ? fabsf(x) : \ + __LDBL(x) ? fabsl(x) : \ + fabs(x) )) + +/* suppress any macros in math.h or complex.h */ + +#undef acos +#undef acosh +#undef asin +#undef asinh +#undef atan +#undef atan2 +#undef atanh +#undef carg +#undef cbrt +#undef ceil +#undef cimag +#undef conj +#undef copysign +#undef cos +#undef cosh +#undef cproj +#undef creal +#undef erf +#undef erfc +#undef exp +#undef exp2 +#undef expm1 +#undef fabs +#undef fdim +#undef floor +#undef fma +#undef fmax +#undef fmin +#undef fmod +#undef frexp +#undef hypot +#undef ilogb +#undef ldexp +#undef lgamma +#undef llrint +#undef llround +#undef log +#undef log10 +#undef log1p +#undef log2 +#undef logb +#undef lrint +#undef lround +#undef nearbyint +#undef nextafter +#undef nexttoward +#undef pow +#undef remainder +#undef remquo +#undef rint +#undef round +#undef scalbln +#undef scalbn +#undef sin +#undef sinh +#undef sqrt +#undef tan +#undef tanh +#undef tgamma +#undef trunc + +/* tg functions */ + +#define acos(x) __tg_real_complex(acos, (x)) +#define acosh(x) __tg_real_complex(acosh, (x)) +#define asin(x) __tg_real_complex(asin, (x)) +#define asinh(x) __tg_real_complex(asinh, (x)) +#define atan(x) __tg_real_complex(atan, (x)) +#define atan2(x,y) __tg_real_2(atan2, (x), (y)) +#define atanh(x) __tg_real_complex(atanh, (x)) +#define carg(x) __tg_complex_retreal(carg, (x)) +#define cbrt(x) __tg_real(cbrt, (x)) +#define ceil(x) __tg_real(ceil, (x)) +#define cimag(x) __tg_complex_retreal(cimag, (x)) +#define conj(x) __tg_complex(conj, (x)) +#define copysign(x,y) __tg_real_2(copysign, (x), (y)) +#define cos(x) __tg_real_complex(cos, (x)) +#define cosh(x) __tg_real_complex(cosh, (x)) +#define cproj(x) __tg_complex(cproj, (x)) +#define creal(x) __tg_complex_retreal(creal, (x)) +#define erf(x) __tg_real(erf, (x)) +#define erfc(x) __tg_real(erfc, (x)) +#define exp(x) __tg_real_complex(exp, (x)) +#define exp2(x) __tg_real(exp2, (x)) +#define expm1(x) __tg_real(expm1, (x)) +#define fabs(x) __tg_real_complex_fabs(x) +#define fdim(x,y) __tg_real_2(fdim, (x), (y)) +#define floor(x) __tg_real(floor, (x)) +#define fma(x,y,z) __tg_real_fma((x), (y), (z)) +#define fmax(x,y) __tg_real_2(fmax, (x), (y)) +#define fmin(x,y) __tg_real_2(fmin, (x), (y)) +#define fmod(x,y) __tg_real_2(fmod, (x), (y)) +#define frexp(x,y) __tg_real_2_1(frexp, (x), (y)) +#define hypot(x,y) __tg_real_2(hypot, (x), (y)) +#define ilogb(x) __tg_real_nocast(ilogb, (x)) +#define ldexp(x,y) __tg_real_2_1(ldexp, (x), (y)) +#define lgamma(x) __tg_real(lgamma, (x)) +#define llrint(x) __tg_real_nocast(llrint, (x)) +#define llround(x) __tg_real_nocast(llround, (x)) +#define log(x) __tg_real_complex(log, (x)) +#define log10(x) __tg_real(log10, (x)) +#define log1p(x) __tg_real(log1p, (x)) +#define log2(x) __tg_real(log2, (x)) +#define logb(x) __tg_real(logb, (x)) +#define lrint(x) __tg_real_nocast(lrint, (x)) +#define lround(x) __tg_real_nocast(lround, (x)) +#define nearbyint(x) __tg_real(nearbyint, (x)) +#define nextafter(x,y) __tg_real_2(nextafter, (x), (y)) +#define nexttoward(x,y) __tg_real_2(nexttoward, (x), (y)) +#define pow(x,y) __tg_real_complex_pow((x), (y)) +#define remainder(x,y) __tg_real_2(remainder, (x), (y)) +#define remquo(x,y,z) __tg_real_remquo((x), (y), (z)) +#define rint(x) __tg_real(rint, (x)) +#define round(x) __tg_real(round, (x)) +#define scalbln(x,y) __tg_real_2_1(scalbln, (x), (y)) +#define scalbn(x,y) __tg_real_2_1(scalbn, (x), (y)) +#define sin(x) __tg_real_complex(sin, (x)) +#define sinh(x) __tg_real_complex(sinh, (x)) +#define sqrt(x) __tg_real_complex(sqrt, (x)) +#define tan(x) __tg_real_complex(tan, (x)) +#define tanh(x) __tg_real_complex(tanh, (x)) +#define tgamma(x) __tg_real(tgamma, (x)) +#define trunc(x) __tg_real(trunc, (x)) + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/threads.h b/Ubiquitous/XiZi/lib/musllib/include/threads.h new file mode 100644 index 000000000..52ec3100e --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/threads.h @@ -0,0 +1,93 @@ +#ifndef _THREADS_H +#define _THREADS_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +typedef unsigned long thrd_t; +#else +typedef struct __pthread *thrd_t; +#define thread_local _Thread_local +#endif + +typedef int once_flag; +typedef unsigned tss_t; +typedef int (*thrd_start_t)(void *); +typedef void (*tss_dtor_t)(void *); + +#define __NEED_cnd_t +#define __NEED_mtx_t + +#include + +#define TSS_DTOR_ITERATIONS 4 + +enum { + thrd_success = 0, + thrd_busy = 1, + thrd_error = 2, + thrd_nomem = 3, + thrd_timedout = 4, +}; + +enum { + mtx_plain = 0, + mtx_recursive = 1, + mtx_timed = 2, +}; + +#define ONCE_FLAG_INIT 0 + +int thrd_create(thrd_t *, thrd_start_t, void *); +_Noreturn void thrd_exit(int); + +int thrd_detach(thrd_t); +int thrd_join(thrd_t, int *); + +int thrd_sleep(const struct timespec *, struct timespec *); +void thrd_yield(void); + +thrd_t thrd_current(void); +int thrd_equal(thrd_t, thrd_t); +#ifndef __cplusplus +#define thrd_equal(A, B) ((A) == (B)) +#endif + +void call_once(once_flag *, void (*)(void)); + +int mtx_init(mtx_t *, int); +void mtx_destroy(mtx_t *); + +int mtx_lock(mtx_t *); +int mtx_timedlock(mtx_t *__restrict, const struct timespec *__restrict); +int mtx_trylock(mtx_t *); +int mtx_unlock(mtx_t *); + +int cnd_init(cnd_t *); +void cnd_destroy(cnd_t *); + +int cnd_broadcast(cnd_t *); +int cnd_signal(cnd_t *); + +int cnd_timedwait(cnd_t *__restrict, mtx_t *__restrict, const struct timespec *__restrict); +int cnd_wait(cnd_t *, mtx_t *); + +int tss_create(tss_t *, tss_dtor_t); +void tss_delete(tss_t); + +int tss_set(tss_t, void *); +void *tss_get(tss_t); + +#if _REDIR_TIME64 +__REDIR(thrd_sleep, __thrd_sleep_time64); +__REDIR(mtx_timedlock, __mtx_timedlock_time64); +__REDIR(cnd_timedwait, __cnd_timedwait_time64); +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/time.h b/Ubiquitous/XiZi/lib/musllib/include/time.h new file mode 100644 index 000000000..e30667be5 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/time.h @@ -0,0 +1,166 @@ +#ifndef _TIME_H +#define _TIME_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#ifndef NULL +#ifdef __cplusplus +#define NULL 0L +#else +#define NULL ((void*)0) +#endif +#endif + +#define __NEED_size_t +#define __NEED_time_t +#define __NEED_clock_t +#define __NEED_struct_timespec + +#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \ + || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \ + || defined(_BSD_SOURCE) +#define __NEED_clockid_t +#define __NEED_timer_t +#define __NEED_pid_t +#define __NEED_locale_t +#endif + +#include + +#if defined(_BSD_SOURCE) || defined(_GNU_SOURCE) +#define __tm_gmtoff tm_gmtoff +#define __tm_zone tm_zone +#endif + +struct tm { + int tm_sec; + int tm_min; + int tm_hour; + int tm_mday; + int tm_mon; + int tm_year; + int tm_wday; + int tm_yday; + int tm_isdst; + long __tm_gmtoff; + const char *__tm_zone; +}; + +clock_t clock (void); +time_t time (time_t *); +double difftime (time_t, time_t); +time_t mktime (struct tm *); +size_t strftime (char *__restrict, size_t, const char *__restrict, const struct tm *__restrict); +struct tm *gmtime (const time_t *); +struct tm *localtime (const time_t *); +char *asctime (const struct tm *); +char *ctime (const time_t *); +int timespec_get(struct timespec *, int); + +#define CLOCKS_PER_SEC 1000000L + +#define TIME_UTC 1 + +#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \ + || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \ + || defined(_BSD_SOURCE) + +size_t strftime_l (char * __restrict, size_t, const char * __restrict, const struct tm * __restrict, locale_t); + +struct tm *gmtime_r (const time_t *__restrict, struct tm *__restrict); +struct tm *localtime_r (const time_t *__restrict, struct tm *__restrict); +char *asctime_r (const struct tm *__restrict, char *__restrict); +char *ctime_r (const time_t *, char *); + +void tzset (void); + +struct itimerspec { + struct timespec it_interval; + struct timespec it_value; +}; + +#define CLOCK_REALTIME 0 +#define CLOCK_MONOTONIC 1 +#define CLOCK_PROCESS_CPUTIME_ID 2 +#define CLOCK_THREAD_CPUTIME_ID 3 +#define CLOCK_MONOTONIC_RAW 4 +#define CLOCK_REALTIME_COARSE 5 +#define CLOCK_MONOTONIC_COARSE 6 +#define CLOCK_BOOTTIME 7 +#define CLOCK_REALTIME_ALARM 8 +#define CLOCK_BOOTTIME_ALARM 9 +#define CLOCK_SGI_CYCLE 10 +#define CLOCK_TAI 11 + +#define TIMER_ABSTIME 1 + +int nanosleep (const struct timespec *, struct timespec *); +int clock_getres (clockid_t, struct timespec *); +int clock_gettime (clockid_t, struct timespec *); +int clock_settime (clockid_t, const struct timespec *); +int clock_nanosleep (clockid_t, int, const struct timespec *, struct timespec *); +int clock_getcpuclockid (pid_t, clockid_t *); + +struct sigevent; +int timer_create (clockid_t, struct sigevent *__restrict, timer_t *__restrict); +int timer_delete (timer_t); +int timer_settime (timer_t, int, const struct itimerspec *__restrict, struct itimerspec *__restrict); +int timer_gettime (timer_t, struct itimerspec *); +int timer_getoverrun (timer_t); + +extern char *tzname[2]; + +#endif + + +#if defined(_XOPEN_SOURCE) || defined(_BSD_SOURCE) || defined(_GNU_SOURCE) +char *strptime (const char *__restrict, const char *__restrict, struct tm *__restrict); +extern int daylight; +extern long timezone; +extern int getdate_err; +struct tm *getdate (const char *); +#endif + + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +int stime(const time_t *); +time_t timegm(struct tm *); +#endif + +#if _REDIR_TIME64 +__REDIR(time, __time64); +__REDIR(difftime, __difftime64); +__REDIR(mktime, __mktime64); +__REDIR(gmtime, __gmtime64); +__REDIR(localtime, __localtime64); +__REDIR(ctime, __ctime64); +__REDIR(timespec_get, __timespec_get_time64); +#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \ + || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \ + || defined(_BSD_SOURCE) +__REDIR(gmtime_r, __gmtime64_r); +__REDIR(localtime_r, __localtime64_r); +__REDIR(ctime_r, __ctime64_r); +__REDIR(nanosleep, __nanosleep_time64); +__REDIR(clock_getres, __clock_getres_time64); +__REDIR(clock_gettime, __clock_gettime64); +__REDIR(clock_settime, __clock_settime64); +__REDIR(clock_nanosleep, __clock_nanosleep_time64); +__REDIR(timer_settime, __timer_settime64); +__REDIR(timer_gettime, __timer_gettime64); +#endif +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +__REDIR(stime, __stime64); +__REDIR(timegm, __timegm_time64); +#endif +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/uchar.h b/Ubiquitous/XiZi/lib/musllib/include/uchar.h new file mode 100644 index 000000000..7e5c4d406 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/uchar.h @@ -0,0 +1,29 @@ +#ifndef _UCHAR_H +#define _UCHAR_H + +#ifdef __cplusplus +extern "C" { +#endif + +#if __cplusplus < 201103L +typedef unsigned short char16_t; +typedef unsigned char32_t; +#endif + +#define __NEED_mbstate_t +#define __NEED_size_t + +#include +#include + +size_t c16rtomb(char *__restrict, char16_t, mbstate_t *__restrict); +size_t mbrtoc16(char16_t *__restrict, const char *__restrict, size_t, mbstate_t *__restrict); + +size_t c32rtomb(char *__restrict, char32_t, mbstate_t *__restrict); +size_t mbrtoc32(char32_t *__restrict, const char *__restrict, size_t, mbstate_t *__restrict); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/ucontext.h b/Ubiquitous/XiZi/lib/musllib/include/ucontext.h new file mode 100644 index 000000000..0f7571254 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/ucontext.h @@ -0,0 +1,25 @@ +#ifndef _UCONTEXT_H +#define _UCONTEXT_H +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#include + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +#define NGREG (sizeof(gregset_t)/sizeof(greg_t)) +#endif + +struct __ucontext; + +int getcontext(struct __ucontext *); +void makecontext(struct __ucontext *, void (*)(), int, ...); +int setcontext(const struct __ucontext *); +int swapcontext(struct __ucontext *, const struct __ucontext *); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/ulimit.h b/Ubiquitous/XiZi/lib/musllib/include/ulimit.h new file mode 100644 index 000000000..efdcd311e --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/ulimit.h @@ -0,0 +1,17 @@ +#ifndef _ULIMIT_H +#define _ULIMIT_H + +#ifdef __cplusplus +extern "C" { +#endif + +#define UL_GETFSIZE 1 +#define UL_SETFSIZE 2 + +long ulimit (int, ...); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/unistd.h b/Ubiquitous/XiZi/lib/musllib/include/unistd.h new file mode 100644 index 000000000..4945156ae --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/unistd.h @@ -0,0 +1,465 @@ +#ifndef _UNISTD_H +#define _UNISTD_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#define STDIN_FILENO 0 +#define STDOUT_FILENO 1 +#define STDERR_FILENO 2 + +#define SEEK_SET 0 +#define SEEK_CUR 1 +#define SEEK_END 2 + +#define __NEED_size_t +#define __NEED_ssize_t +#define __NEED_uid_t +#define __NEED_gid_t +#define __NEED_off_t +#define __NEED_pid_t +#define __NEED_intptr_t +#define __NEED_useconds_t + +#include + +int pipe(int [2]); +int pipe2(int [2], int); +int close(int); +int posix_close(int, int); +int dup(int); +int dup2(int, int); +int dup3(int, int, int); +off_t lseek(int, off_t, int); +int fsync(int); +int fdatasync(int); + +ssize_t read(int, void *, size_t); +ssize_t write(int, const void *, size_t); +ssize_t pread(int, void *, size_t, off_t); +ssize_t pwrite(int, const void *, size_t, off_t); + +int chown(const char *, uid_t, gid_t); +int fchown(int, uid_t, gid_t); +int lchown(const char *, uid_t, gid_t); +int fchownat(int, const char *, uid_t, gid_t, int); + +int link(const char *, const char *); +int linkat(int, const char *, int, const char *, int); +int symlink(const char *, const char *); +int symlinkat(const char *, int, const char *); +ssize_t readlink(const char *__restrict, char *__restrict, size_t); +ssize_t readlinkat(int, const char *__restrict, char *__restrict, size_t); +int unlink(const char *); +int unlinkat(int, const char *, int); +int rmdir(const char *); +int truncate(const char *, off_t); +int ftruncate(int, off_t); + +#define F_OK 0 +#define R_OK 4 +#define W_OK 2 +#define X_OK 1 + +int access(const char *, int); +int faccessat(int, const char *, int, int); + +int chdir(const char *); +int fchdir(int); +char *getcwd(char *, size_t); + +unsigned alarm(unsigned); +unsigned sleep(unsigned); +int pause(void); + +pid_t fork(void); +int execve(const char *, char *const [], char *const []); +int execv(const char *, char *const []); +int execle(const char *, const char *, ...); +int execl(const char *, const char *, ...); +int execvp(const char *, char *const []); +int execlp(const char *, const char *, ...); +int fexecve(int, char *const [], char *const []); +_Noreturn void _exit(int); + +pid_t getpid(void); +pid_t getppid(void); +pid_t getpgrp(void); +pid_t getpgid(pid_t); +int setpgid(pid_t, pid_t); +pid_t setsid(void); +pid_t getsid(pid_t); +char *ttyname(int); +int ttyname_r(int, char *, size_t); +int isatty(int); +pid_t tcgetpgrp(int); +int tcsetpgrp(int, pid_t); + +uid_t getuid(void); +uid_t geteuid(void); +gid_t getgid(void); +gid_t getegid(void); +int getgroups(int, gid_t []); +int setuid(uid_t); +int seteuid(uid_t); +int setgid(gid_t); +int setegid(gid_t); + +char *getlogin(void); +int getlogin_r(char *, size_t); +int gethostname(char *, size_t); +char *ctermid(char *); + +int getopt(int, char * const [], const char *); +extern char *optarg; +extern int optind, opterr, optopt; + +long pathconf(const char *, int); +long fpathconf(int, int); +long sysconf(int); +size_t confstr(int, char *, size_t); + +#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +#define F_ULOCK 0 +#define F_LOCK 1 +#define F_TLOCK 2 +#define F_TEST 3 +int setreuid(uid_t, uid_t); +int setregid(gid_t, gid_t); +int lockf(int, int, off_t); +long gethostid(void); +int nice(int); +void sync(void); +pid_t setpgrp(void); +char *crypt(const char *, const char *); +void encrypt(char *, int); +void swab(const void *__restrict, void *__restrict, ssize_t); +#endif + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) \ + || (defined(_XOPEN_SOURCE) && _XOPEN_SOURCE+0 < 700) +int usleep(unsigned); +unsigned ualarm(unsigned, unsigned); +#endif + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +#define L_SET 0 +#define L_INCR 1 +#define L_XTND 2 +int brk(void *); +void *sbrk(intptr_t); +pid_t vfork(void); +int vhangup(void); +int chroot(const char *); +int getpagesize(void); +int getdtablesize(void); +int sethostname(const char *, size_t); +int getdomainname(char *, size_t); +int setdomainname(const char *, size_t); +int setgroups(size_t, const gid_t *); +char *getpass(const char *); +int daemon(int, int); +void setusershell(void); +void endusershell(void); +char *getusershell(void); +int acct(const char *); +long syscall(long, ...); +int execvpe(const char *, char *const [], char *const []); +int issetugid(void); +int getentropy(void *, size_t); +extern int optreset; +#endif + +#ifdef _GNU_SOURCE +extern char **environ; +int setresuid(uid_t, uid_t, uid_t); +int setresgid(gid_t, gid_t, gid_t); +int getresuid(uid_t *, uid_t *, uid_t *); +int getresgid(gid_t *, gid_t *, gid_t *); +char *get_current_dir_name(void); +int syncfs(int); +int euidaccess(const char *, int); +int eaccess(const char *, int); +ssize_t copy_file_range(int, off_t *, int, off_t *, size_t, unsigned); +#endif + +#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE) +#define lseek64 lseek +#define pread64 pread +#define pwrite64 pwrite +#define truncate64 truncate +#define ftruncate64 ftruncate +#define lockf64 lockf +#define off64_t off_t +#endif + +#define POSIX_CLOSE_RESTART 0 + +#define _XOPEN_VERSION 700 +#define _XOPEN_UNIX 1 +#define _XOPEN_ENH_I18N 1 + +#define _POSIX_VERSION 200809L +#define _POSIX2_VERSION _POSIX_VERSION + +#define _POSIX_ADVISORY_INFO _POSIX_VERSION +#define _POSIX_CHOWN_RESTRICTED 1 +#define _POSIX_IPV6 _POSIX_VERSION +#define _POSIX_JOB_CONTROL 1 +#define _POSIX_MAPPED_FILES _POSIX_VERSION +#define _POSIX_MEMLOCK _POSIX_VERSION +#define _POSIX_MEMLOCK_RANGE _POSIX_VERSION +#define _POSIX_MEMORY_PROTECTION _POSIX_VERSION +#define _POSIX_MESSAGE_PASSING _POSIX_VERSION +#define _POSIX_FSYNC _POSIX_VERSION +#define _POSIX_NO_TRUNC 1 +#define _POSIX_RAW_SOCKETS _POSIX_VERSION +#define _POSIX_REALTIME_SIGNALS _POSIX_VERSION +#define _POSIX_REGEXP 1 +#define _POSIX_SAVED_IDS 1 +#define _POSIX_SHELL 1 +#define _POSIX_SPAWN _POSIX_VERSION +#define _POSIX_VDISABLE 0 + +#define _POSIX_THREADS _POSIX_VERSION +#define _POSIX_THREAD_PROCESS_SHARED _POSIX_VERSION +#define _POSIX_THREAD_SAFE_FUNCTIONS _POSIX_VERSION +#define _POSIX_THREAD_ATTR_STACKADDR _POSIX_VERSION +#define _POSIX_THREAD_ATTR_STACKSIZE _POSIX_VERSION +#define _POSIX_THREAD_PRIORITY_SCHEDULING _POSIX_VERSION +#define _POSIX_THREAD_CPUTIME _POSIX_VERSION +#define _POSIX_TIMERS _POSIX_VERSION +#define _POSIX_TIMEOUTS _POSIX_VERSION +#define _POSIX_MONOTONIC_CLOCK _POSIX_VERSION +#define _POSIX_CPUTIME _POSIX_VERSION +#define _POSIX_CLOCK_SELECTION _POSIX_VERSION +#define _POSIX_BARRIERS _POSIX_VERSION +#define _POSIX_SPIN_LOCKS _POSIX_VERSION +#define _POSIX_READER_WRITER_LOCKS _POSIX_VERSION +#define _POSIX_ASYNCHRONOUS_IO _POSIX_VERSION +#define _POSIX_SEMAPHORES _POSIX_VERSION +#define _POSIX_SHARED_MEMORY_OBJECTS _POSIX_VERSION + +#define _POSIX2_C_BIND _POSIX_VERSION + +#include + + + +#define _PC_LINK_MAX 0 +#define _PC_MAX_CANON 1 +#define _PC_MAX_INPUT 2 +#define _PC_NAME_MAX 3 +#define _PC_PATH_MAX 4 +#define _PC_PIPE_BUF 5 +#define _PC_CHOWN_RESTRICTED 6 +#define _PC_NO_TRUNC 7 +#define _PC_VDISABLE 8 +#define _PC_SYNC_IO 9 +#define _PC_ASYNC_IO 10 +#define _PC_PRIO_IO 11 +#define _PC_SOCK_MAXBUF 12 +#define _PC_FILESIZEBITS 13 +#define _PC_REC_INCR_XFER_SIZE 14 +#define _PC_REC_MAX_XFER_SIZE 15 +#define _PC_REC_MIN_XFER_SIZE 16 +#define _PC_REC_XFER_ALIGN 17 +#define _PC_ALLOC_SIZE_MIN 18 +#define _PC_SYMLINK_MAX 19 +#define _PC_2_SYMLINKS 20 + +#define _SC_ARG_MAX 0 +#define _SC_CHILD_MAX 1 +#define _SC_CLK_TCK 2 +#define _SC_NGROUPS_MAX 3 +#define _SC_OPEN_MAX 4 +#define _SC_STREAM_MAX 5 +#define _SC_TZNAME_MAX 6 +#define _SC_JOB_CONTROL 7 +#define _SC_SAVED_IDS 8 +#define _SC_REALTIME_SIGNALS 9 +#define _SC_PRIORITY_SCHEDULING 10 +#define _SC_TIMERS 11 +#define _SC_ASYNCHRONOUS_IO 12 +#define _SC_PRIORITIZED_IO 13 +#define _SC_SYNCHRONIZED_IO 14 +#define _SC_FSYNC 15 +#define _SC_MAPPED_FILES 16 +#define _SC_MEMLOCK 17 +#define _SC_MEMLOCK_RANGE 18 +#define _SC_MEMORY_PROTECTION 19 +#define _SC_MESSAGE_PASSING 20 +#define _SC_SEMAPHORES 21 +#define _SC_SHARED_MEMORY_OBJECTS 22 +#define _SC_AIO_LISTIO_MAX 23 +#define _SC_AIO_MAX 24 +#define _SC_AIO_PRIO_DELTA_MAX 25 +#define _SC_DELAYTIMER_MAX 26 +#define _SC_MQ_OPEN_MAX 27 +#define _SC_MQ_PRIO_MAX 28 +#define _SC_VERSION 29 +#define _SC_PAGE_SIZE 30 +#define _SC_PAGESIZE 30 /* !! */ +#define _SC_RTSIG_MAX 31 +#define _SC_SEM_NSEMS_MAX 32 +#define _SC_SEM_VALUE_MAX 33 +#define _SC_SIGQUEUE_MAX 34 +#define _SC_TIMER_MAX 35 +#define _SC_BC_BASE_MAX 36 +#define _SC_BC_DIM_MAX 37 +#define _SC_BC_SCALE_MAX 38 +#define _SC_BC_STRING_MAX 39 +#define _SC_COLL_WEIGHTS_MAX 40 +#define _SC_EXPR_NEST_MAX 42 +#define _SC_LINE_MAX 43 +#define _SC_RE_DUP_MAX 44 +#define _SC_2_VERSION 46 +#define _SC_2_C_BIND 47 +#define _SC_2_C_DEV 48 +#define _SC_2_FORT_DEV 49 +#define _SC_2_FORT_RUN 50 +#define _SC_2_SW_DEV 51 +#define _SC_2_LOCALEDEF 52 +#define _SC_UIO_MAXIOV 60 /* !! */ +#define _SC_IOV_MAX 60 +#define _SC_THREADS 67 +#define _SC_THREAD_SAFE_FUNCTIONS 68 +#define _SC_GETGR_R_SIZE_MAX 69 +#define _SC_GETPW_R_SIZE_MAX 70 +#define _SC_LOGIN_NAME_MAX 71 +#define _SC_TTY_NAME_MAX 72 +#define _SC_THREAD_DESTRUCTOR_ITERATIONS 73 +#define _SC_THREAD_KEYS_MAX 74 +#define _SC_THREAD_STACK_MIN 75 +#define _SC_THREAD_THREADS_MAX 76 +#define _SC_THREAD_ATTR_STACKADDR 77 +#define _SC_THREAD_ATTR_STACKSIZE 78 +#define _SC_THREAD_PRIORITY_SCHEDULING 79 +#define _SC_THREAD_PRIO_INHERIT 80 +#define _SC_THREAD_PRIO_PROTECT 81 +#define _SC_THREAD_PROCESS_SHARED 82 +#define _SC_NPROCESSORS_CONF 83 +#define _SC_NPROCESSORS_ONLN 84 +#define _SC_PHYS_PAGES 85 +#define _SC_AVPHYS_PAGES 86 +#define _SC_ATEXIT_MAX 87 +#define _SC_PASS_MAX 88 +#define _SC_XOPEN_VERSION 89 +#define _SC_XOPEN_XCU_VERSION 90 +#define _SC_XOPEN_UNIX 91 +#define _SC_XOPEN_CRYPT 92 +#define _SC_XOPEN_ENH_I18N 93 +#define _SC_XOPEN_SHM 94 +#define _SC_2_CHAR_TERM 95 +#define _SC_2_UPE 97 +#define _SC_XOPEN_XPG2 98 +#define _SC_XOPEN_XPG3 99 +#define _SC_XOPEN_XPG4 100 +#define _SC_NZERO 109 +#define _SC_XBS5_ILP32_OFF32 125 +#define _SC_XBS5_ILP32_OFFBIG 126 +#define _SC_XBS5_LP64_OFF64 127 +#define _SC_XBS5_LPBIG_OFFBIG 128 +#define _SC_XOPEN_LEGACY 129 +#define _SC_XOPEN_REALTIME 130 +#define _SC_XOPEN_REALTIME_THREADS 131 +#define _SC_ADVISORY_INFO 132 +#define _SC_BARRIERS 133 +#define _SC_CLOCK_SELECTION 137 +#define _SC_CPUTIME 138 +#define _SC_THREAD_CPUTIME 139 +#define _SC_MONOTONIC_CLOCK 149 +#define _SC_READER_WRITER_LOCKS 153 +#define _SC_SPIN_LOCKS 154 +#define _SC_REGEXP 155 +#define _SC_SHELL 157 +#define _SC_SPAWN 159 +#define _SC_SPORADIC_SERVER 160 +#define _SC_THREAD_SPORADIC_SERVER 161 +#define _SC_TIMEOUTS 164 +#define _SC_TYPED_MEMORY_OBJECTS 165 +#define _SC_2_PBS 168 +#define _SC_2_PBS_ACCOUNTING 169 +#define _SC_2_PBS_LOCATE 170 +#define _SC_2_PBS_MESSAGE 171 +#define _SC_2_PBS_TRACK 172 +#define _SC_SYMLOOP_MAX 173 +#define _SC_STREAMS 174 +#define _SC_2_PBS_CHECKPOINT 175 +#define _SC_V6_ILP32_OFF32 176 +#define _SC_V6_ILP32_OFFBIG 177 +#define _SC_V6_LP64_OFF64 178 +#define _SC_V6_LPBIG_OFFBIG 179 +#define _SC_HOST_NAME_MAX 180 +#define _SC_TRACE 181 +#define _SC_TRACE_EVENT_FILTER 182 +#define _SC_TRACE_INHERIT 183 +#define _SC_TRACE_LOG 184 + +#define _SC_IPV6 235 +#define _SC_RAW_SOCKETS 236 +#define _SC_V7_ILP32_OFF32 237 +#define _SC_V7_ILP32_OFFBIG 238 +#define _SC_V7_LP64_OFF64 239 +#define _SC_V7_LPBIG_OFFBIG 240 +#define _SC_SS_REPL_MAX 241 +#define _SC_TRACE_EVENT_NAME_MAX 242 +#define _SC_TRACE_NAME_MAX 243 +#define _SC_TRACE_SYS_MAX 244 +#define _SC_TRACE_USER_EVENT_MAX 245 +#define _SC_XOPEN_STREAMS 246 +#define _SC_THREAD_ROBUST_PRIO_INHERIT 247 +#define _SC_THREAD_ROBUST_PRIO_PROTECT 248 + +#define _CS_PATH 0 +#define _CS_POSIX_V6_WIDTH_RESTRICTED_ENVS 1 +#define _CS_GNU_LIBC_VERSION 2 +#define _CS_GNU_LIBPTHREAD_VERSION 3 +#define _CS_POSIX_V5_WIDTH_RESTRICTED_ENVS 4 +#define _CS_POSIX_V7_WIDTH_RESTRICTED_ENVS 5 + +#define _CS_POSIX_V6_ILP32_OFF32_CFLAGS 1116 +#define _CS_POSIX_V6_ILP32_OFF32_LDFLAGS 1117 +#define _CS_POSIX_V6_ILP32_OFF32_LIBS 1118 +#define _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS 1119 +#define _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS 1120 +#define _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS 1121 +#define _CS_POSIX_V6_ILP32_OFFBIG_LIBS 1122 +#define _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS 1123 +#define _CS_POSIX_V6_LP64_OFF64_CFLAGS 1124 +#define _CS_POSIX_V6_LP64_OFF64_LDFLAGS 1125 +#define _CS_POSIX_V6_LP64_OFF64_LIBS 1126 +#define _CS_POSIX_V6_LP64_OFF64_LINTFLAGS 1127 +#define _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS 1128 +#define _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS 1129 +#define _CS_POSIX_V6_LPBIG_OFFBIG_LIBS 1130 +#define _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS 1131 +#define _CS_POSIX_V7_ILP32_OFF32_CFLAGS 1132 +#define _CS_POSIX_V7_ILP32_OFF32_LDFLAGS 1133 +#define _CS_POSIX_V7_ILP32_OFF32_LIBS 1134 +#define _CS_POSIX_V7_ILP32_OFF32_LINTFLAGS 1135 +#define _CS_POSIX_V7_ILP32_OFFBIG_CFLAGS 1136 +#define _CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS 1137 +#define _CS_POSIX_V7_ILP32_OFFBIG_LIBS 1138 +#define _CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS 1139 +#define _CS_POSIX_V7_LP64_OFF64_CFLAGS 1140 +#define _CS_POSIX_V7_LP64_OFF64_LDFLAGS 1141 +#define _CS_POSIX_V7_LP64_OFF64_LIBS 1142 +#define _CS_POSIX_V7_LP64_OFF64_LINTFLAGS 1143 +#define _CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS 1144 +#define _CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS 1145 +#define _CS_POSIX_V7_LPBIG_OFFBIG_LIBS 1146 +#define _CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS 1147 +#define _CS_V6_ENV 1148 +#define _CS_V7_ENV 1149 + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/utime.h b/Ubiquitous/XiZi/lib/musllib/include/utime.h new file mode 100644 index 000000000..5755bd53e --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/utime.h @@ -0,0 +1,29 @@ +#ifndef _UTIME_H +#define _UTIME_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#define __NEED_time_t + +#include + +struct utimbuf { + time_t actime; + time_t modtime; +}; + +int utime (const char *, const struct utimbuf *); + +#if _REDIR_TIME64 +__REDIR(utime, __utime64); +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/utmp.h b/Ubiquitous/XiZi/lib/musllib/include/utmp.h new file mode 100644 index 000000000..48a400d84 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/utmp.h @@ -0,0 +1,52 @@ +#ifndef _UTMP_H +#define _UTMP_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#define ACCOUNTING 9 +#define UT_NAMESIZE 32 +#define UT_HOSTSIZE 256 +#define UT_LINESIZE 32 + +struct lastlog { + time_t ll_time; + char ll_line[UT_LINESIZE]; + char ll_host[UT_HOSTSIZE]; +}; + +#define ut_time ut_tv.tv_sec +#define ut_name ut_user +#define ut_addr ut_addr_v6[0] +#define utmp utmpx +#define e_exit __e_exit +#define e_termination __e_termination + +void endutent(void); +struct utmp *getutent(void); +struct utmp *getutid(const struct utmp *); +struct utmp *getutline(const struct utmp *); +struct utmp *pututline(const struct utmp *); +void setutent(void); + +void updwtmp(const char *, const struct utmp *); +int utmpname(const char *); + +int login_tty(int); + +#define _PATH_UTMP "/dev/null/utmp" +#define _PATH_WTMP "/dev/null/wtmp" + +#define UTMP_FILE _PATH_UTMP +#define WTMP_FILE _PATH_WTMP +#define UTMP_FILENAME _PATH_UTMP +#define WTMP_FILENAME _PATH_WTMP + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/utmpx.h b/Ubiquitous/XiZi/lib/musllib/include/utmpx.h new file mode 100644 index 000000000..b293f427e --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/utmpx.h @@ -0,0 +1,67 @@ +#ifndef _UTMPX_H +#define _UTMPX_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#define __NEED_pid_t +#define __NEED_time_t +#define __NEED_suseconds_t +#define __NEED_struct_timeval + +#include + +struct utmpx { + short ut_type; + short __ut_pad1; + pid_t ut_pid; + char ut_line[32]; + char ut_id[4]; + char ut_user[32]; + char ut_host[256]; + struct { + short __e_termination; + short __e_exit; + } ut_exit; +#if __BYTE_ORDER == 1234 + int ut_session, __ut_pad2; +#else + int __ut_pad2, ut_session; +#endif + struct timeval ut_tv; + unsigned ut_addr_v6[4]; + char __unused[20]; +}; + +void endutxent(void); +struct utmpx *getutxent(void); +struct utmpx *getutxid(const struct utmpx *); +struct utmpx *getutxline(const struct utmpx *); +struct utmpx *pututxline(const struct utmpx *); +void setutxent(void); + +#if defined(_BSD_SOURCE) || defined(_GNU_SOURCE) +#define e_exit __e_exit +#define e_termination __e_termination +void updwtmpx(const char *, const struct utmpx *); +int utmpxname(const char *); +#endif + +#define EMPTY 0 +#define RUN_LVL 1 +#define BOOT_TIME 2 +#define NEW_TIME 3 +#define OLD_TIME 4 +#define INIT_PROCESS 5 +#define LOGIN_PROCESS 6 +#define USER_PROCESS 7 +#define DEAD_PROCESS 8 + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/values.h b/Ubiquitous/XiZi/lib/musllib/include/values.h new file mode 100644 index 000000000..fe4949f85 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/values.h @@ -0,0 +1,39 @@ +#ifndef _VALUES_H +#define _VALUES_H + +#include + +#define CHARBITS (sizeof(char) * 8) +#define SHORTBITS (sizeof(short) * 8) +#define INTBITS (sizeof(int) * 8) +#define LONGBITS (sizeof(long) * 8) +#define PTRBITS (sizeof(char *) * 8) +#define DOUBLEBITS (sizeof(double) * 8) +#define FLOATBITS (sizeof(float) * 8) + +#define MINSHORT SHRT_MIN +#define MININT INT_MIN +#define MINLONG LONG_MIN + +#define MAXSHORT SHRT_MAX +#define MAXINT INT_MAX +#define MAXLONG LONG_MAX + +#define HIBITS MINSHORT +#define HIBITL MINLONG + +#include + +#define MAXDOUBLE DBL_MAX +#undef MAXFLOAT +#define MAXFLOAT FLT_MAX +#define MINDOUBLE DBL_MIN +#define MINFLOAT FLT_MIN +#define DMINEXP DBL_MIN_EXP +#define FMINEXP FLT_MIN_EXP +#define DMAXEXP DBL_MAX_EXP +#define FMAXEXP FLT_MAX_EXP + +#define BITSPERBYTE CHAR_BIT + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/wait.h b/Ubiquitous/XiZi/lib/musllib/include/wait.h new file mode 100644 index 000000000..98396e2d2 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/wait.h @@ -0,0 +1,2 @@ +#warning redirecting incorrect #include to +#include diff --git a/Ubiquitous/XiZi/lib/musllib/include/wchar.h b/Ubiquitous/XiZi/lib/musllib/include/wchar.h new file mode 100644 index 000000000..9068c22fd --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/wchar.h @@ -0,0 +1,207 @@ +#ifndef _WCHAR_H +#define _WCHAR_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#define __NEED_FILE +#define __NEED___isoc_va_list +#define __NEED_size_t +#define __NEED_wchar_t +#define __NEED_wint_t +#define __NEED_mbstate_t +#define __NEED_off_t + +#if __STDC_VERSION__ < 201112L +#define __NEED_off_t +#define __NEED_struct__IO_FILE +#endif + +#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \ + || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +#define __NEED_locale_t +#define __NEED_va_list +#endif + +#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +#define __NEED_wctype_t +#endif + +#include + +#if L'\0'-1 > 0 +#define WCHAR_MAX (0xffffffffu+L'\0') +#define WCHAR_MIN (0+L'\0') +#else +#define WCHAR_MAX (0x7fffffff+L'\0') +#define WCHAR_MIN (-1-0x7fffffff+L'\0') +#endif + +#ifdef __cplusplus +#define NULL 0L +#else +#define NULL ((void*)0) +#endif + +#undef WEOF +#define WEOF 0xffffffffU + +wchar_t *wcscpy (wchar_t *__restrict, const wchar_t *__restrict); +wchar_t *wcsncpy (wchar_t *__restrict, const wchar_t *__restrict, size_t); + +wchar_t *wcscat (wchar_t *__restrict, const wchar_t *__restrict); +wchar_t *wcsncat (wchar_t *__restrict, const wchar_t *__restrict, size_t); + +int wcscmp (const wchar_t *, const wchar_t *); +int wcsncmp (const wchar_t *, const wchar_t *, size_t); + +int wcscoll(const wchar_t *, const wchar_t *); +size_t wcsxfrm (wchar_t *__restrict, const wchar_t *__restrict, size_t); + +wchar_t *wcschr (const wchar_t *, wchar_t); +wchar_t *wcsrchr (const wchar_t *, wchar_t); + +size_t wcscspn (const wchar_t *, const wchar_t *); +size_t wcsspn (const wchar_t *, const wchar_t *); +wchar_t *wcspbrk (const wchar_t *, const wchar_t *); + +wchar_t *wcstok (wchar_t *__restrict, const wchar_t *__restrict, wchar_t **__restrict); + +size_t wcslen (const wchar_t *); + +wchar_t *wcsstr (const wchar_t *__restrict, const wchar_t *__restrict); +wchar_t *wcswcs (const wchar_t *, const wchar_t *); + +wchar_t *wmemchr (const wchar_t *, wchar_t, size_t); +int wmemcmp (const wchar_t *, const wchar_t *, size_t); +wchar_t *wmemcpy (wchar_t *__restrict, const wchar_t *__restrict, size_t); +wchar_t *wmemmove (wchar_t *, const wchar_t *, size_t); +wchar_t *wmemset (wchar_t *, wchar_t, size_t); + +wint_t btowc (int); +int wctob (wint_t); + +int mbsinit (const mbstate_t *); +size_t mbrtowc (wchar_t *__restrict, const char *__restrict, size_t, mbstate_t *__restrict); +size_t wcrtomb (char *__restrict, wchar_t, mbstate_t *__restrict); + +size_t mbrlen (const char *__restrict, size_t, mbstate_t *__restrict); + +size_t mbsrtowcs (wchar_t *__restrict, const char **__restrict, size_t, mbstate_t *__restrict); +size_t wcsrtombs (char *__restrict, const wchar_t **__restrict, size_t, mbstate_t *__restrict); + +float wcstof (const wchar_t *__restrict, wchar_t **__restrict); +double wcstod (const wchar_t *__restrict, wchar_t **__restrict); +long double wcstold (const wchar_t *__restrict, wchar_t **__restrict); + +long wcstol (const wchar_t *__restrict, wchar_t **__restrict, int); +unsigned long wcstoul (const wchar_t *__restrict, wchar_t **__restrict, int); + +long long wcstoll (const wchar_t *__restrict, wchar_t **__restrict, int); +unsigned long long wcstoull (const wchar_t *__restrict, wchar_t **__restrict, int); + + + +int fwide (FILE *, int); + + +int wprintf (const wchar_t *__restrict, ...); +int fwprintf (FILE *__restrict, const wchar_t *__restrict, ...); +int swprintf (wchar_t *__restrict, size_t, const wchar_t *__restrict, ...); + +int vwprintf (const wchar_t *__restrict, __isoc_va_list); +int vfwprintf (FILE *__restrict, const wchar_t *__restrict, __isoc_va_list); +int vswprintf (wchar_t *__restrict, size_t, const wchar_t *__restrict, __isoc_va_list); + +int wscanf (const wchar_t *__restrict, ...); +int fwscanf (FILE *__restrict, const wchar_t *__restrict, ...); +int swscanf (const wchar_t *__restrict, const wchar_t *__restrict, ...); + +int vwscanf (const wchar_t *__restrict, __isoc_va_list); +int vfwscanf (FILE *__restrict, const wchar_t *__restrict, __isoc_va_list); +int vswscanf (const wchar_t *__restrict, const wchar_t *__restrict, __isoc_va_list); + +wint_t fgetwc (FILE *); +wint_t getwc (FILE *); +wint_t getwchar (void); + +wint_t fputwc (wchar_t, FILE *); +wint_t putwc (wchar_t, FILE *); +wint_t putwchar (wchar_t); + +wchar_t *fgetws (wchar_t *__restrict, int, FILE *__restrict); +int fputws (const wchar_t *__restrict, FILE *__restrict); + +wint_t ungetwc (wint_t, FILE *); + +struct tm; +size_t wcsftime (wchar_t *__restrict, size_t, const wchar_t *__restrict, const struct tm *__restrict); + +#undef iswdigit + +#if defined(_GNU_SOURCE) +wint_t fgetwc_unlocked (FILE *); +wint_t getwc_unlocked (FILE *); +wint_t getwchar_unlocked (void); +wint_t fputwc_unlocked (wchar_t, FILE *); +wint_t putwc_unlocked (wchar_t, FILE *); +wint_t putwchar_unlocked (wchar_t); +wchar_t *fgetws_unlocked (wchar_t *__restrict, int, FILE *__restrict); +int fputws_unlocked (const wchar_t *__restrict, FILE *__restrict); +#endif + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +size_t wcsftime_l (wchar_t *__restrict, size_t, const wchar_t *__restrict, const struct tm *__restrict, locale_t); +#endif + +#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \ + || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +FILE *open_wmemstream(wchar_t **, size_t *); +size_t mbsnrtowcs(wchar_t *__restrict, const char **__restrict, size_t, size_t, mbstate_t *__restrict); +size_t wcsnrtombs(char *__restrict, const wchar_t **__restrict, size_t, size_t, mbstate_t *__restrict); +wchar_t *wcsdup(const wchar_t *); +size_t wcsnlen (const wchar_t *, size_t); +wchar_t *wcpcpy (wchar_t *__restrict, const wchar_t *__restrict); +wchar_t *wcpncpy (wchar_t *__restrict, const wchar_t *__restrict, size_t); +int wcscasecmp(const wchar_t *, const wchar_t *); +int wcscasecmp_l(const wchar_t *, const wchar_t *, locale_t); +int wcsncasecmp(const wchar_t *, const wchar_t *, size_t); +int wcsncasecmp_l(const wchar_t *, const wchar_t *, size_t, locale_t); +int wcscoll_l(const wchar_t *, const wchar_t *, locale_t); +size_t wcsxfrm_l(wchar_t *__restrict, const wchar_t *__restrict, size_t, locale_t); +#endif + +#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +int wcwidth (wchar_t); +int wcswidth (const wchar_t *, size_t); +int iswalnum(wint_t); +int iswalpha(wint_t); +int iswblank(wint_t); +int iswcntrl(wint_t); +int iswdigit(wint_t); +int iswgraph(wint_t); +int iswlower(wint_t); +int iswprint(wint_t); +int iswpunct(wint_t); +int iswspace(wint_t); +int iswupper(wint_t); +int iswxdigit(wint_t); +int iswctype(wint_t, wctype_t); +wint_t towlower(wint_t); +wint_t towupper(wint_t); +wctype_t wctype(const char *); + +#ifndef __cplusplus +#undef iswdigit +#define iswdigit(a) (0 ? iswdigit(a) : ((unsigned)(a)-'0') < 10) +#endif +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/wctype.h b/Ubiquitous/XiZi/lib/musllib/include/wctype.h new file mode 100644 index 000000000..bc2420d3f --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/wctype.h @@ -0,0 +1,79 @@ +#ifndef _WCTYPE_H +#define _WCTYPE_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#define __NEED_wint_t +#define __NEED_wctype_t + +#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \ + || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +#define __NEED_locale_t +#endif + +#include + +typedef const int * wctrans_t; + +#undef WEOF +#define WEOF 0xffffffffU + +#undef iswdigit + +int iswalnum(wint_t); +int iswalpha(wint_t); +int iswblank(wint_t); +int iswcntrl(wint_t); +int iswdigit(wint_t); +int iswgraph(wint_t); +int iswlower(wint_t); +int iswprint(wint_t); +int iswpunct(wint_t); +int iswspace(wint_t); +int iswupper(wint_t); +int iswxdigit(wint_t); +int iswctype(wint_t, wctype_t); +wint_t towctrans(wint_t, wctrans_t); +wint_t towlower(wint_t); +wint_t towupper(wint_t); +wctrans_t wctrans(const char *); +wctype_t wctype(const char *); + +#ifndef __cplusplus +#undef iswdigit +#define iswdigit(a) (0 ? iswdigit(a) : ((unsigned)(a)-'0') < 10) +#endif + +#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \ + || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) + +int iswalnum_l(wint_t, locale_t); +int iswalpha_l(wint_t, locale_t); +int iswblank_l(wint_t, locale_t); +int iswcntrl_l(wint_t, locale_t); +int iswdigit_l(wint_t, locale_t); +int iswgraph_l(wint_t, locale_t); +int iswlower_l(wint_t, locale_t); +int iswprint_l(wint_t, locale_t); +int iswpunct_l(wint_t, locale_t); +int iswspace_l(wint_t, locale_t); +int iswupper_l(wint_t, locale_t); +int iswxdigit_l(wint_t, locale_t); +int iswctype_l(wint_t, wctype_t, locale_t); +wint_t towlower_l(wint_t, locale_t); +wint_t towupper_l(wint_t, locale_t); +wint_t towctrans_l(wint_t, wctrans_t, locale_t); +wctrans_t wctrans_l(const char *, locale_t); +wctype_t wctype_l(const char *, locale_t); + +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/include/wordexp.h b/Ubiquitous/XiZi/lib/musllib/include/wordexp.h new file mode 100644 index 000000000..5460002de --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/include/wordexp.h @@ -0,0 +1,41 @@ +#ifndef _WORDEXP_H +#define _WORDEXP_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#define __NEED_size_t + +#include + +#define WRDE_DOOFFS 1 +#define WRDE_APPEND 2 +#define WRDE_NOCMD 4 +#define WRDE_REUSE 8 +#define WRDE_SHOWERR 16 +#define WRDE_UNDEF 32 + +typedef struct { + size_t we_wordc; + char **we_wordv; + size_t we_offs; +} wordexp_t; + +#define WRDE_NOSYS -1 +#define WRDE_NOSPACE 1 +#define WRDE_BADCHAR 2 +#define WRDE_BADVAL 3 +#define WRDE_CMDSUB 4 +#define WRDE_SYNTAX 5 + +int wordexp (const char *__restrict, wordexp_t *__restrict, int); +void wordfree (wordexp_t *); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/libmusl.a b/Ubiquitous/XiZi/lib/musllib/libmusl.a new file mode 100644 index 000000000..4778f6554 Binary files /dev/null and b/Ubiquitous/XiZi/lib/musllib/libmusl.a differ diff --git a/Ubiquitous/XiZi/lib/musllib/src/Makefile b/Ubiquitous/XiZi/lib/musllib/src/Makefile new file mode 100644 index 000000000..ee45938d1 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/Makefile @@ -0,0 +1,12 @@ +SRC_DIR := +MUSL_DIR := + +SRC_DIR += ctype env errno exit internal +SRC_DIR += locale malloc math misc multibyte network prng regex +SRC_DIR += stdio stdlib string time + +MUSL_DIR += ctype env errno exit internal +MUSL_DIR += locale malloc math misc multibyte network prng regex +MUSL_DIR += stdio stdlib string time + +include $(KERNEL_ROOT)/compiler.mk \ No newline at end of file diff --git a/Ubiquitous/XiZi/lib/musllib/src/ctype/Makefile b/Ubiquitous/XiZi/lib/musllib/src/ctype/Makefile new file mode 100644 index 000000000..5bed7f2c0 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/ctype/Makefile @@ -0,0 +1,5 @@ +SRC_FILES := __ctype_get_mb_cur_max.c isalnum.c isascii.c isdigit.c islower.c isprint.c isspace.c isupper.c isxdigit.c tolower.c toupper.c + + + +include $(KERNEL_ROOT)/compiler.mk \ No newline at end of file diff --git a/Ubiquitous/XiZi/lib/musllib/src/ctype/__ctype_get_mb_cur_max.c b/Ubiquitous/XiZi/lib/musllib/src/ctype/__ctype_get_mb_cur_max.c new file mode 100644 index 000000000..a9869fe74 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/ctype/__ctype_get_mb_cur_max.c @@ -0,0 +1,7 @@ +#include +#include "../internal/locale_impl.h" + +size_t __ctype_get_mb_cur_max() +{ + return MB_CUR_MAX; +} diff --git a/Ubiquitous/XiZi/lib/musllib/src/ctype/isalnum.c b/Ubiquitous/XiZi/lib/musllib/src/ctype/isalnum.c new file mode 100644 index 000000000..8018a2bc7 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/ctype/isalnum.c @@ -0,0 +1,13 @@ +#include + +int isalnum(int c) +{ + return isalpha(c) || isdigit(c); +} + +int __isalnum_l(int c, locale_t l) +{ + return isalnum(c); +} + +weak_alias(__isalnum_l, isalnum_l); diff --git a/Ubiquitous/XiZi/lib/musllib/src/ctype/isascii.c b/Ubiquitous/XiZi/lib/musllib/src/ctype/isascii.c new file mode 100644 index 000000000..c8a45c294 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/ctype/isascii.c @@ -0,0 +1,7 @@ +#include +#undef isascii + +int isascii(int c) +{ + return !(c&~0x7f); +} \ No newline at end of file diff --git a/Ubiquitous/XiZi/lib/musllib/src/ctype/isdigit.c b/Ubiquitous/XiZi/lib/musllib/src/ctype/isdigit.c new file mode 100644 index 000000000..16beddb4c --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/ctype/isdigit.c @@ -0,0 +1,14 @@ +#include +#undef isdigit + +int isdigit(int c) +{ + return (unsigned)c-'0' < 10; +} + +int __isdigit_l(int c, locale_t l) +{ + return isdigit(c); +} + +weak_alias(__isdigit_l, isdigit_l); diff --git a/Ubiquitous/XiZi/lib/musllib/src/ctype/islower.c b/Ubiquitous/XiZi/lib/musllib/src/ctype/islower.c new file mode 100644 index 000000000..c3fa74c4c --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/ctype/islower.c @@ -0,0 +1,14 @@ +#include +#undef islower + +int islower(int c) +{ + return (unsigned)c-'a' < 26; +} + +int __islower_l(int c, locale_t l) +{ + return islower(c); +} + +weak_alias(__islower_l, islower_l); diff --git a/Ubiquitous/XiZi/lib/musllib/src/ctype/isprint.c b/Ubiquitous/XiZi/lib/musllib/src/ctype/isprint.c new file mode 100644 index 000000000..b950816bc --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/ctype/isprint.c @@ -0,0 +1,14 @@ +#include +#undef isprint + +int isprint(int c) +{ + return (unsigned)c-0x20 < 0x5f; +} + +int __isprint_l(int c, locale_t l) +{ + return isprint(c); +} + +weak_alias(__isprint_l, isprint_l); diff --git a/Ubiquitous/XiZi/lib/musllib/src/ctype/isspace.c b/Ubiquitous/XiZi/lib/musllib/src/ctype/isspace.c new file mode 100644 index 000000000..428813e79 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/ctype/isspace.c @@ -0,0 +1,14 @@ +#include +#undef isspace + +int isspace(int c) +{ + return c == ' ' || (unsigned)c-'\t' < 5; +} + +int __isspace_l(int c, locale_t l) +{ + return isspace(c); +} + +weak_alias(__isspace_l, isspace_l); diff --git a/Ubiquitous/XiZi/lib/musllib/src/ctype/isupper.c b/Ubiquitous/XiZi/lib/musllib/src/ctype/isupper.c new file mode 100644 index 000000000..bfd15acdb --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/ctype/isupper.c @@ -0,0 +1,14 @@ +#include +#undef isupper + +int isupper(int c) +{ + return (unsigned)c-'A' < 26; +} + +int __isupper_l(int c, locale_t l) +{ + return isupper(c); +} + +weak_alias(__isupper_l, isupper_l); diff --git a/Ubiquitous/XiZi/lib/musllib/src/ctype/isxdigit.c b/Ubiquitous/XiZi/lib/musllib/src/ctype/isxdigit.c new file mode 100644 index 000000000..aab1a745b --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/ctype/isxdigit.c @@ -0,0 +1,13 @@ +#include + +int isxdigit(int c) +{ + return isdigit(c) || ((unsigned)c|32)-'a' < 6; +} + +int __isxdigit_l(int c, locale_t l) +{ + return isxdigit(c); +} + +weak_alias(__isxdigit_l, isxdigit_l); diff --git a/Ubiquitous/XiZi/lib/musllib/src/ctype/tolower.c b/Ubiquitous/XiZi/lib/musllib/src/ctype/tolower.c new file mode 100644 index 000000000..f10132ec2 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/ctype/tolower.c @@ -0,0 +1,14 @@ +#include + +int tolower(int c) +{ + if (isupper(c)) return c | 32; + return c; +} + +int __tolower_l(int c, locale_t l) +{ + return tolower(c); +} + +weak_alias(__tolower_l, tolower_l); diff --git a/Ubiquitous/XiZi/lib/musllib/src/ctype/toupper.c b/Ubiquitous/XiZi/lib/musllib/src/ctype/toupper.c new file mode 100644 index 000000000..4e74a55c6 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/ctype/toupper.c @@ -0,0 +1,14 @@ +#include + +int toupper(int c) +{ + if (islower(c)) return c & 0x5f; + return c; +} + +int __toupper_l(int c, locale_t l) +{ + return toupper(c); +} + +weak_alias(__toupper_l, toupper_l); diff --git a/Ubiquitous/XiZi/lib/musllib/src/env/Makefile b/Ubiquitous/XiZi/lib/musllib/src/env/Makefile new file mode 100644 index 000000000..fd2904acb --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/env/Makefile @@ -0,0 +1,3 @@ +SRC_FILES := __stack_chk_fail.c + +include $(KERNEL_ROOT)/compiler.mk \ No newline at end of file diff --git a/Ubiquitous/XiZi/lib/musllib/src/env/__stack_chk_fail.c b/Ubiquitous/XiZi/lib/musllib/src/env/__stack_chk_fail.c new file mode 100644 index 000000000..ebd79ce8d --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/env/__stack_chk_fail.c @@ -0,0 +1,20 @@ +#include +#include +#include "pthread_impl.h" + +uintptr_t __stack_chk_guard; + +void __init_ssp(void *entropy) +{ + if (entropy) memcpy(&__stack_chk_guard, entropy, sizeof(uintptr_t)); + else __stack_chk_guard = (uintptr_t)&__stack_chk_guard * 1103515245; +} + +void __stack_chk_fail(void) +{ + *(volatile char *)0=0; +} + +hidden void __stack_chk_fail_local(void); + +weak_alias(__stack_chk_fail, __stack_chk_fail_local); diff --git a/Ubiquitous/XiZi/lib/musllib/src/errno/Makefile b/Ubiquitous/XiZi/lib/musllib/src/errno/Makefile new file mode 100644 index 000000000..e4f7941d8 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/errno/Makefile @@ -0,0 +1,4 @@ +SRC_FILES := strerror.c __errno_location.c + + +include $(KERNEL_ROOT)/compiler.mk \ No newline at end of file diff --git a/Ubiquitous/XiZi/lib/musllib/src/errno/__errno_location.c b/Ubiquitous/XiZi/lib/musllib/src/errno/__errno_location.c new file mode 100644 index 000000000..01d9b31d5 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/errno/__errno_location.c @@ -0,0 +1,10 @@ +#include +#include "pthread_impl.h" +#include + +int *__errno_location(void) +{ + return KObtainExstatus(); +} + +weak_alias(__errno_location, ___errno_location); diff --git a/Ubiquitous/XiZi/lib/musllib/src/errno/__strerror.h b/Ubiquitous/XiZi/lib/musllib/src/errno/__strerror.h new file mode 100644 index 000000000..9e7841948 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/errno/__strerror.h @@ -0,0 +1,105 @@ +/* This file is sorted such that 'errors' which represent exceptional + * conditions under which a correct program may fail come first, followed + * by messages that indicate an incorrect program or system failure. The + * macro E() along with double-inclusion is used to ensure that ordering + * of the strings remains synchronized. */ + +E(EILSEQ, "Illegal byte sequence") +E(EDOM, "Domain error") +E(ERANGE, "Result not representable") + +E(ENOTTY, "Not a tty") +E(EACCES, "Permission denied") +E(EPERM, "Operation not permitted") +E(ENOENT, "No such file or directory") +E(ESRCH, "No such process") +E(EEXIST, "File exists") + +E(EOVERFLOW, "Value too large for data type") +E(ENOSPC, "No space left on device") +E(ENOMEM, "Out of memory") + +E(EBUSY, "Resource busy") +E(EINTR, "Interrupted system call") +E(EAGAIN, "Resource temporarily unavailable") +E(ESPIPE, "Invalid seek") + +E(EXDEV, "Cross-device link") +E(EROFS, "Read-only file system") +E(ENOTEMPTY, "Directory not empty") + +E(ECONNRESET, "Connection reset by peer") +E(ETIMEDOUT, "Operation timed out") +E(ECONNREFUSED, "Connection refused") +E(EHOSTDOWN, "Host is down") +E(EHOSTUNREACH, "Host is unreachable") +E(EADDRINUSE, "Address in use") + +E(EPIPE, "Broken pipe") +E(EIO, "I/O error") +E(ENXIO, "No such device or address") +E(ENOTBLK, "Block device required") +E(ENODEV, "No such device") +E(ENOTDIR, "Not a directory") +E(EISDIR, "Is a directory") +E(ETXTBSY, "Text file busy") +E(ENOEXEC, "Exec format error") + +E(EINVAL, "Invalid argument") + +E(E2BIG, "Argument list too long") +E(ELOOP, "Symbolic link loop") +E(ENAMETOOLONG, "Filename too long") +E(ENFILE, "Too many open files in system") +E(EMFILE, "No file descriptors available") +E(EBADF, "Bad file descriptor") +E(ECHILD, "No child process") +E(EFAULT, "Bad address") +E(EFBIG, "File too large") +E(EMLINK, "Too many links") +E(ENOLCK, "No locks available") + +E(EDEADLK, "Resource deadlock would occur") +// E(ENOTRECOVERABLE, "State not recoverable") +// E(EOWNERDEAD, "Previous owner died") +// E(ECANCELED, "Operation canceled") +E(ENOSYS, "Function not implemented") +E(ENOMSG, "No message of desired type") +E(EIDRM, "Identifier removed") +E(ENOSTR, "Device not a stream") +E(ENODATA, "No data available") +E(ETIME, "Device timeout") +E(ENOSR, "Out of streams resources") +E(ENOLINK, "Link has been severed") +E(EPROTO, "Protocol error") +E(EBADMSG, "Bad message") +E(EBADFD, "File descriptor in bad state") +E(ENOTSOCK, "Not a socket") +E(EDESTADDRREQ, "Destination address required") +E(EMSGSIZE, "Message too large") +E(EPROTOTYPE, "Protocol wrong type for socket") +E(ENOPROTOOPT, "Protocol not available") +E(EPROTONOSUPPORT,"Protocol not supported") +E(ESOCKTNOSUPPORT,"Socket type not supported") +E(ENOTSUP, "Not supported") +E(EPFNOSUPPORT, "Protocol family not supported") +E(EAFNOSUPPORT, "Address family not supported by protocol") +E(EADDRNOTAVAIL,"Address not available") +E(ENETDOWN, "Network is down") +E(ENETUNREACH, "Network unreachable") +E(ENETRESET, "Connection reset by network") +E(ECONNABORTED, "Connection aborted") +E(ENOBUFS, "No buffer space available") +E(EISCONN, "Socket is connected") +E(ENOTCONN, "Socket not connected") +E(ESHUTDOWN, "Cannot send after socket shutdown") +E(EALREADY, "Operation already in progress") +E(EINPROGRESS, "Operation in progress") +E(ESTALE, "Stale file handle") +E(EREMOTEIO, "Remote I/O error") +E(EDQUOT, "Quota exceeded") +E(ENOMEDIUM, "No medium found") +E(EMEDIUMTYPE, "Wrong medium type") +E(EMULTIHOP, "Multihop attempted") + +E(0, "No error information") diff --git a/Ubiquitous/XiZi/lib/musllib/src/errno/strerror.c b/Ubiquitous/XiZi/lib/musllib/src/errno/strerror.c new file mode 100644 index 000000000..54d8fc8a1 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/errno/strerror.c @@ -0,0 +1,36 @@ +#include +#include +#include "../internal/locale_impl.h" + +#define E(a,b) ((unsigned char)a), +static const unsigned char errid[] = { +#include "__strerror.h" +}; + +#undef E +#define E(a,b) b "\0" +static const char errmsg[] = +#include "__strerror.h" +; + +char *__strerror_l(int e, locale_t loc) +{ + const char *s; + int i; + /* mips has one error code outside of the 8-bit range due to a + * historical typo, so we just remap it. */ + if (EDQUOT==1133) { + if (e==109) e=-1; + else if (e==EDQUOT) e=109; + } + for (i=0; errid[i] && errid[i] != e; i++); + for (s=errmsg; i; s++, i--) for (; *s; s++); + return (char *)s; +} + +char *strerror(int e) +{ + return __strerror_l(e, NULL); +} + +weak_alias(__strerror_l, strerror_l); diff --git a/Ubiquitous/XiZi/lib/musllib/src/exit/Makefile b/Ubiquitous/XiZi/lib/musllib/src/exit/Makefile new file mode 100644 index 000000000..aec2296a7 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/exit/Makefile @@ -0,0 +1,5 @@ +SRC_FILES := abort.c assert.c atexit.c + + + +include $(KERNEL_ROOT)/compiler.mk \ No newline at end of file diff --git a/Ubiquitous/XiZi/lib/musllib/src/exit/abort.c b/Ubiquitous/XiZi/lib/musllib/src/exit/abort.c new file mode 100644 index 000000000..9574dd8f3 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/exit/abort.c @@ -0,0 +1,15 @@ +#include "xizi.h" + +void abort(void) { + KTaskDescriptorType current = GetKTaskDescriptor(); + if (current) + { + KPrintf("Task:%-8.*s will be aborted!\n", NAME_NUM_MAX, current->task_base_info.name); + /* pend current task */ + SuspendKTask(current->id.id); + /* schedule */ + DO_KTASK_ASSIGN; + } + + while (1); +} \ No newline at end of file diff --git a/Ubiquitous/XiZi/lib/musllib/src/exit/assert.c b/Ubiquitous/XiZi/lib/musllib/src/exit/assert.c new file mode 100644 index 000000000..7e6cab156 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/exit/assert.c @@ -0,0 +1,16 @@ +#include "assert.h" +#include "xizi.h" + +void __assert_fail(const char* expr, const char* file, int line, const char* func) { + KPrintf("%s:%d: %s: assertion \"%s\" failed\n", file, line, func, expr); + KTaskDescriptorType current = GetKTaskDescriptor(); + if (current) + { + KPrintf("Task:%-8.*s will be aborted!\n", NAME_NUM_MAX, current->task_base_info.name); + /* pend current task */ + SuspendKTask(current->id.id); + /* schedule */ + DO_KTASK_ASSIGN; + } + while (1); +} diff --git a/Ubiquitous/XiZi/lib/musllib/src/exit/atexit.c b/Ubiquitous/XiZi/lib/musllib/src/exit/atexit.c new file mode 100644 index 000000000..c5707f06c --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/exit/atexit.c @@ -0,0 +1,6 @@ +#include + +int atexit(void (*func)(void)) +{ + return 0; +} \ No newline at end of file diff --git a/Ubiquitous/XiZi/lib/musllib/src/fcntl/Makefile b/Ubiquitous/XiZi/lib/musllib/src/fcntl/Makefile new file mode 100644 index 000000000..b31cd4308 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/fcntl/Makefile @@ -0,0 +1,5 @@ +SRC_FILES := + + + +include $(KERNEL_ROOT)/compiler.mk \ No newline at end of file diff --git a/Ubiquitous/XiZi/lib/musllib/src/fcntl/creat.c b/Ubiquitous/XiZi/lib/musllib/src/fcntl/creat.c new file mode 100644 index 000000000..8f8aab646 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/fcntl/creat.c @@ -0,0 +1,8 @@ +#include + +int creat(const char *filename, mode_t mode) +{ + return open(filename, O_CREAT|O_WRONLY|O_TRUNC, mode); +} + +weak_alias(creat, creat64); diff --git a/Ubiquitous/XiZi/lib/musllib/src/fcntl/fcntl.c b/Ubiquitous/XiZi/lib/musllib/src/fcntl/fcntl.c new file mode 100644 index 000000000..d3bff5c48 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/fcntl/fcntl.c @@ -0,0 +1,48 @@ +#define _GNU_SOURCE +#include +#include +#include +#include "syscall.h" + +int fcntl(int fd, int cmd, ...) +{ + unsigned long arg; + va_list ap; + va_start(ap, cmd); + arg = va_arg(ap, unsigned long); + va_end(ap); + if (cmd == F_SETFL) arg |= O_LARGEFILE; + if (cmd == F_SETLKW) return syscall_cp(SYS_fcntl, fd, cmd, (void *)arg); + if (cmd == F_GETOWN) { + struct f_owner_ex ex; + int ret = __syscall(SYS_fcntl, fd, F_GETOWN_EX, &ex); + if (ret == -EINVAL) return __syscall(SYS_fcntl, fd, cmd, (void *)arg); + if (ret) return __syscall_ret(ret); + return ex.type == F_OWNER_PGRP ? -ex.pid : ex.pid; + } + if (cmd == F_DUPFD_CLOEXEC) { + int ret = __syscall(SYS_fcntl, fd, F_DUPFD_CLOEXEC, arg); + if (ret != -EINVAL) { + if (ret >= 0) + __syscall(SYS_fcntl, ret, F_SETFD, FD_CLOEXEC); + return __syscall_ret(ret); + } + ret = __syscall(SYS_fcntl, fd, F_DUPFD_CLOEXEC, 0); + if (ret != -EINVAL) { + if (ret >= 0) __syscall(SYS_close, ret); + return __syscall_ret(-EINVAL); + } + ret = __syscall(SYS_fcntl, fd, F_DUPFD, arg); + if (ret >= 0) __syscall(SYS_fcntl, ret, F_SETFD, FD_CLOEXEC); + return __syscall_ret(ret); + } + switch (cmd) { + case F_SETLK: + case F_GETLK: + case F_GETOWN_EX: + case F_SETOWN_EX: + return syscall(SYS_fcntl, fd, cmd, (void *)arg); + default: + return syscall(SYS_fcntl, fd, cmd, arg); + } +} diff --git a/Ubiquitous/XiZi/lib/musllib/src/fcntl/open.c b/Ubiquitous/XiZi/lib/musllib/src/fcntl/open.c new file mode 100644 index 000000000..1d817a2d6 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/fcntl/open.c @@ -0,0 +1,23 @@ +#include +#include +#include "syscall.h" + +int open(const char *filename, int flags, ...) +{ + mode_t mode = 0; + + if ((flags & O_CREAT) || (flags & O_TMPFILE) == O_TMPFILE) { + va_list ap; + va_start(ap, flags); + mode = va_arg(ap, mode_t); + va_end(ap); + } + + int fd = __sys_open_cp(filename, flags, mode); + if (fd>=0 && (flags & O_CLOEXEC)) + __syscall(SYS_fcntl, fd, F_SETFD, FD_CLOEXEC); + + return __syscall_ret(fd); +} + +weak_alias(open, open64); diff --git a/Ubiquitous/XiZi/lib/musllib/src/fcntl/openat.c b/Ubiquitous/XiZi/lib/musllib/src/fcntl/openat.c new file mode 100644 index 000000000..ad165ec32 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/fcntl/openat.c @@ -0,0 +1,19 @@ +#include +#include +#include "syscall.h" + +int openat(int fd, const char *filename, int flags, ...) +{ + mode_t mode = 0; + + if ((flags & O_CREAT) || (flags & O_TMPFILE) == O_TMPFILE) { + va_list ap; + va_start(ap, flags); + mode = va_arg(ap, mode_t); + va_end(ap); + } + + return syscall_cp(SYS_openat, fd, filename, flags|O_LARGEFILE, mode); +} + +weak_alias(openat, openat64); diff --git a/Ubiquitous/XiZi/lib/musllib/src/fcntl/posix_fadvise.c b/Ubiquitous/XiZi/lib/musllib/src/fcntl/posix_fadvise.c new file mode 100644 index 000000000..75b8e1aed --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/fcntl/posix_fadvise.c @@ -0,0 +1,18 @@ +#include +#include "syscall.h" + +int posix_fadvise(int fd, off_t base, off_t len, int advice) +{ +#if defined(SYSCALL_FADVISE_6_ARG) + /* Some archs, at least arm and powerpc, have the syscall + * arguments reordered to avoid needing 7 argument registers + * due to 64-bit argument alignment. */ + return -__syscall(SYS_fadvise, fd, advice, + __SYSCALL_LL_E(base), __SYSCALL_LL_E(len)); +#else + return -__syscall(SYS_fadvise, fd, __SYSCALL_LL_O(base), + __SYSCALL_LL_E(len), advice); +#endif +} + +weak_alias(posix_fadvise, posix_fadvise64); diff --git a/Ubiquitous/XiZi/lib/musllib/src/fcntl/posix_fallocate.c b/Ubiquitous/XiZi/lib/musllib/src/fcntl/posix_fallocate.c new file mode 100644 index 000000000..c57a24aef --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/fcntl/posix_fallocate.c @@ -0,0 +1,10 @@ +#include +#include "syscall.h" + +int posix_fallocate(int fd, off_t base, off_t len) +{ + return -__syscall(SYS_fallocate, fd, 0, __SYSCALL_LL_E(base), + __SYSCALL_LL_E(len)); +} + +weak_alias(posix_fallocate, posix_fallocate64); diff --git a/Ubiquitous/XiZi/lib/musllib/src/include/features.h b/Ubiquitous/XiZi/lib/musllib/src/include/features.h new file mode 100644 index 000000000..d97562783 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/include/features.h @@ -0,0 +1,16 @@ +#ifndef FEATURES_H +#define FEATURES_H + +#include "../../include/features.h" + +#define hidden __attribute__((__visibility__("hidden"))) +// #define weak __attribute__((__weak__)) +#ifndef weak_alias +#define weak_alias(old, new) \ + extern __typeof(old) new __attribute__((__weak__, __alias__(#old))) +#endif +#ifndef strong_alias +#define strong_alias(old, new) \ + extern __typeof(old) new __attribute__((__alias__(#old))) +#endif +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/src/include/langinfo.h b/Ubiquitous/XiZi/lib/musllib/src/include/langinfo.h new file mode 100644 index 000000000..ab32b880f --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/include/langinfo.h @@ -0,0 +1,8 @@ +#ifndef LANGINFO_H +#define LANGINFO_H + +#include "../../include/langinfo.h" + +char *__nl_langinfo_l(nl_item, locale_t); + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/src/include/string.h b/Ubiquitous/XiZi/lib/musllib/src/include/string.h new file mode 100644 index 000000000..fe8eac908 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/include/string.h @@ -0,0 +1,12 @@ +#ifndef STRING_H +#define STRING_H + +#include "features.h" +#include "../../include/string.h" + +hidden void *__memrchr(const void *, int, size_t); +hidden char *__stpcpy(char *, const char *); +hidden char *__stpncpy(char *, const char *, size_t); +hidden char *__strchrnul(const char *, int); + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/src/include/time.h b/Ubiquitous/XiZi/lib/musllib/src/include/time.h new file mode 100644 index 000000000..cbabde476 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/include/time.h @@ -0,0 +1,15 @@ +#ifndef TIME_H +#define TIME_H + +#include "../../include/time.h" + +hidden int __clock_gettime(clockid_t, struct timespec *); +hidden int __clock_nanosleep(clockid_t, int, const struct timespec *, struct timespec *); + +hidden char *__asctime_r(const struct tm *, char *); +hidden struct tm *__gmtime_r(const time_t *restrict, struct tm *restrict); +hidden struct tm *__localtime_r(const time_t *restrict, struct tm *restrict); + +hidden size_t __strftime_l(char *restrict, size_t, const char *restrict, const struct tm *restrict, locale_t); + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/src/internal/Makefile b/Ubiquitous/XiZi/lib/musllib/src/internal/Makefile new file mode 100644 index 000000000..c18580d2b --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/internal/Makefile @@ -0,0 +1,5 @@ +SRC_FILES := floatscan.c intscan.c shgetc.c + + + +include $(KERNEL_ROOT)/compiler.mk \ No newline at end of file diff --git a/Ubiquitous/XiZi/lib/musllib/src/internal/atomic.h b/Ubiquitous/XiZi/lib/musllib/src/internal/atomic.h new file mode 100644 index 000000000..f938879b0 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/internal/atomic.h @@ -0,0 +1,318 @@ +#ifndef _ATOMIC_H +#define _ATOMIC_H + +#include + +#include "atomic_arch.h" + +#ifdef a_ll + +#ifndef a_pre_llsc +#define a_pre_llsc() +#endif + +#ifndef a_post_llsc +#define a_post_llsc() +#endif + +#ifndef a_cas +#define a_cas a_cas +static inline int a_cas(volatile int *p, int t, int s) +{ + int old; + a_pre_llsc(); + do old = a_ll(p); + while (old==t && !a_sc(p, s)); + a_post_llsc(); + return old; +} +#endif + +#ifndef a_swap +#define a_swap a_swap +static inline int a_swap(volatile int *p, int v) +{ + int old; + a_pre_llsc(); + do old = a_ll(p); + while (!a_sc(p, v)); + a_post_llsc(); + return old; +} +#endif + +#ifndef a_fetch_add +#define a_fetch_add a_fetch_add +static inline int a_fetch_add(volatile int *p, int v) +{ + int old; + a_pre_llsc(); + do old = a_ll(p); + while (!a_sc(p, (unsigned)old + v)); + a_post_llsc(); + return old; +} +#endif + +#ifndef a_fetch_and +#define a_fetch_and a_fetch_and +static inline int a_fetch_and(volatile int *p, int v) +{ + int old; + a_pre_llsc(); + do old = a_ll(p); + while (!a_sc(p, old & v)); + a_post_llsc(); + return old; +} +#endif + +#ifndef a_fetch_or +#define a_fetch_or a_fetch_or +static inline int a_fetch_or(volatile int *p, int v) +{ + int old; + a_pre_llsc(); + do old = a_ll(p); + while (!a_sc(p, old | v)); + a_post_llsc(); + return old; +} +#endif + +#endif + +#ifdef a_ll_p + +#ifndef a_cas_p +#define a_cas_p a_cas_p +static inline void *a_cas_p(volatile void *p, void *t, void *s) +{ + void *old; + a_pre_llsc(); + do old = a_ll_p(p); + while (old==t && !a_sc_p(p, s)); + a_post_llsc(); + return old; +} +#endif + +#endif + +#ifndef a_cas +#error missing definition of a_cas +#endif + +#ifndef a_swap +#define a_swap a_swap +static inline int a_swap(volatile int *p, int v) +{ + int old; + do old = *p; + while (a_cas(p, old, v) != old); + return old; +} +#endif + +#ifndef a_fetch_add +#define a_fetch_add a_fetch_add +static inline int a_fetch_add(volatile int *p, int v) +{ + int old; + do old = *p; + while (a_cas(p, old, (unsigned)old+v) != old); + return old; +} +#endif + +#ifndef a_fetch_and +#define a_fetch_and a_fetch_and +static inline int a_fetch_and(volatile int *p, int v) +{ + int old; + do old = *p; + while (a_cas(p, old, old&v) != old); + return old; +} +#endif +#ifndef a_fetch_or +#define a_fetch_or a_fetch_or +static inline int a_fetch_or(volatile int *p, int v) +{ + int old; + do old = *p; + while (a_cas(p, old, old|v) != old); + return old; +} +#endif + +#ifndef a_and +#define a_and a_and +static inline void a_and(volatile int *p, int v) +{ + a_fetch_and(p, v); +} +#endif + +#ifndef a_or +#define a_or a_or +static inline void a_or(volatile int *p, int v) +{ + a_fetch_or(p, v); +} +#endif + +#ifndef a_inc +#define a_inc a_inc +static inline void a_inc(volatile int *p) +{ + a_fetch_add(p, 1); +} +#endif + +#ifndef a_dec +#define a_dec a_dec +static inline void a_dec(volatile int *p) +{ + a_fetch_add(p, -1); +} +#endif + +#ifndef a_store +#define a_store a_store +static inline void a_store(volatile int *p, int v) +{ +#ifdef a_barrier + a_barrier(); + *p = v; + a_barrier(); +#else + a_swap(p, v); +#endif +} +#endif + +#ifndef a_barrier +#define a_barrier a_barrier +static void a_barrier() +{ + volatile int tmp = 0; + a_cas(&tmp, 0, 0); +} +#endif + +#ifndef a_spin +#define a_spin a_barrier +#endif + +#ifndef a_and_64 +#define a_and_64 a_and_64 +static inline void a_and_64(volatile uint64_t *p, uint64_t v) +{ + union { uint64_t v; uint32_t r[2]; } u = { v }; + if (u.r[0]+1) a_and((int *)p, u.r[0]); + if (u.r[1]+1) a_and((int *)p+1, u.r[1]); +} +#endif + +#ifndef a_or_64 +#define a_or_64 a_or_64 +static inline void a_or_64(volatile uint64_t *p, uint64_t v) +{ + union { uint64_t v; uint32_t r[2]; } u = { v }; + if (u.r[0]) a_or((int *)p, u.r[0]); + if (u.r[1]) a_or((int *)p+1, u.r[1]); +} +#endif + +#ifndef a_cas_p +typedef char a_cas_p_undefined_but_pointer_not_32bit[-sizeof(char) == 0xffffffff ? 1 : -1]; +#define a_cas_p a_cas_p +static inline void *a_cas_p(volatile void *p, void *t, void *s) +{ + return (void *)a_cas((volatile int *)p, (int)t, (int)s); +} +#endif + +#ifndef a_or_l +#define a_or_l a_or_l +static inline void a_or_l(volatile void *p, long v) +{ + if (sizeof(long) == sizeof(int)) a_or(p, v); + else a_or_64(p, v); +} +#endif + +#ifndef a_crash +#define a_crash a_crash +static inline void a_crash() +{ + *(volatile char *)0=0; +} +#endif + +#ifndef a_ctz_32 +#define a_ctz_32 a_ctz_32 +static inline int a_ctz_32(uint32_t x) +{ +#ifdef a_clz_32 + return 31-a_clz_32(x&-x); +#else + static const char debruijn32[32] = { + 0, 1, 23, 2, 29, 24, 19, 3, 30, 27, 25, 11, 20, 8, 4, 13, + 31, 22, 28, 18, 26, 10, 7, 12, 21, 17, 9, 6, 16, 5, 15, 14 + }; + return debruijn32[(x&-x)*0x076be629 >> 27]; +#endif +} +#endif + +#ifndef a_ctz_64 +#define a_ctz_64 a_ctz_64 +static inline int a_ctz_64(uint64_t x) +{ + static const char debruijn64[64] = { + 0, 1, 2, 53, 3, 7, 54, 27, 4, 38, 41, 8, 34, 55, 48, 28, + 62, 5, 39, 46, 44, 42, 22, 9, 24, 35, 59, 56, 49, 18, 29, 11, + 63, 52, 6, 26, 37, 40, 33, 47, 61, 45, 43, 21, 23, 58, 17, 10, + 51, 25, 36, 32, 60, 20, 57, 16, 50, 31, 19, 15, 30, 14, 13, 12 + }; + if (sizeof(long) < 8) { + uint32_t y = x; + if (!y) { + y = x>>32; + return 32 + a_ctz_32(y); + } + return a_ctz_32(y); + } + return debruijn64[(x&-x)*0x022fdd63cc95386dull >> 58]; +} +#endif + +static inline int a_ctz_l(unsigned long x) +{ + return (sizeof(long) < 8) ? a_ctz_32(x) : a_ctz_64(x); +} + +#ifndef a_clz_64 +#define a_clz_64 a_clz_64 +static inline int a_clz_64(uint64_t x) +{ +#ifdef a_clz_32 + if (x>>32) + return a_clz_32(x>>32); + return a_clz_32(x) + 32; +#else + uint32_t y; + int r; + if (x>>32) y=x>>32, r=0; else y=x, r=32; + if (y>>16) y>>=16; else r |= 16; + if (y>>8) y>>=8; else r |= 8; + if (y>>4) y>>=4; else r |= 4; + if (y>>2) y>>=2; else r |= 2; + return r | !(y>>1); +#endif +} +#endif + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/src/internal/floatscan.c b/Ubiquitous/XiZi/lib/musllib/src/internal/floatscan.c new file mode 100644 index 000000000..48abfa2b2 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/internal/floatscan.c @@ -0,0 +1,507 @@ +#include +#include +#include +#include +#include +#include +#include + +#include "shgetc.h" +#include "floatscan.h" + +#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 + +#define LD_B1B_DIG 2 +#define LD_B1B_MAX 9007199, 254740991 +#define KMAX 128 + +#elif LDBL_MANT_DIG == 64 && LDBL_MAX_EXP == 16384 + +#define LD_B1B_DIG 3 +#define LD_B1B_MAX 18, 446744073, 709551615 +#define KMAX 2048 + +#elif LDBL_MANT_DIG == 113 && LDBL_MAX_EXP == 16384 + +#define LD_B1B_DIG 4 +#define LD_B1B_MAX 10384593, 717069655, 257060992, 658440191 +#define KMAX 2048 + +#else +#error Unsupported long double representation +#endif + +#define MASK (KMAX-1) + +static long long scanexp(FILE *f, int pok) +{ + int c; + int x; + long long y; + int neg = 0; + + c = shgetc(f); + if (c=='+' || c=='-') { + neg = (c=='-'); + c = shgetc(f); + if (c-'0'>=10U && pok) shunget(f); + } + if (c-'0'>=10U) { + shunget(f); + return LLONG_MIN; + } + for (x=0; c-'0'<10U && x=0) { + shunget(f); + } + if (!gotdig) { + errno = EINVAL; + shlim(f, 0); + return 0; + } + + /* Handle zero specially to avoid nasty special cases later */ + if (!x[0]) return sign * 0.0; + + /* Optimize small integers (w/no exponent) and over/under-flow */ + if (lrp==dc && dc<10 && (bits>30 || x[0]>>bits==0)) + return sign * (long double)x[0]; + if (lrp > -emin/2) { + errno = ERANGE; + return sign * LDBL_MAX * LDBL_MAX; + } + if (lrp < emin-2*LDBL_MANT_DIG) { + errno = ERANGE; + return sign * LDBL_MIN * LDBL_MIN; + } + + /* Align incomplete final B1B digit */ + if (j) { + for (; j<9; j++) x[k]*=10; + k++; + j=0; + } + + a = 0; + z = k; + e2 = 0; + rp = lrp; + + /* Optimize small to mid-size integers (even in exp. notation) */ + if (lnz<9 && lnz<=rp && rp < 18) { + if (rp == 9) return sign * (long double)x[0]; + if (rp < 9) return sign * (long double)x[0] / p10s[8-rp]; + int bitlim = bits-3*(int)(rp-9); + if (bitlim>30 || x[0]>>bitlim==0) + return sign * (long double)x[0] * p10s[rp-10]; + } + + /* Drop trailing zeros */ + for (; !x[z-1]; z--); + + /* Align radix point to B1B digit boundary */ + if (rp % 9) { + int rpm9 = rp>=0 ? rp%9 : rp%9+9; + int p10 = p10s[8-rpm9]; + uint32_t carry = 0; + for (k=a; k!=z; k++) { + uint32_t tmp = x[k] % p10; + x[k] = x[k]/p10 + carry; + carry = 1000000000/p10 * tmp; + if (k==a && !x[k]) { + a = ((a+1) & MASK); + rp -= 9; + } + } + if (carry) x[z++] = carry; + rp += 9-rpm9; + } + + /* Upscale until desired number of bits are left of radix point */ + while (rp < 9*LD_B1B_DIG || (rp == 9*LD_B1B_DIG && x[a] 1000000000) { + carry = tmp / 1000000000; + x[k] = tmp % 1000000000; + } else { + carry = 0; + x[k] = tmp; + } + if (k==((z-1) & MASK) && k!=a && !x[k]) z = k; + if (k==a) break; + } + if (carry) { + rp += 9; + a = ((a-1) & MASK); + if (a == z) { + z = ((z-1) & MASK); + x[(z-1) & MASK] |= x[z]; + } + x[a] = carry; + } + } + + /* Downscale until exactly number of bits are left of radix point */ + for (;;) { + uint32_t carry = 0; + int sh = 1; + for (i=0; i th[i]) break; + } + if (i==LD_B1B_DIG && rp==9*LD_B1B_DIG) break; + /* FIXME: find a way to compute optimal sh */ + if (rp > 9+9*LD_B1B_DIG) sh = 9; + e2 += sh; + for (k=a; k!=z; k=((k+1) & MASK)) { + uint32_t tmp = x[k] & ((1<>sh) + carry; + carry = (1000000000>>sh) * tmp; + if (k==a && !x[k]) { + a = ((a+1) & MASK); + i--; + rp -= 9; + } + } + if (carry) { + if (((z+1) & MASK) != a) { + x[z] = carry; + z = ((z+1) & MASK); + } else x[(z-1) & MASK] |= 1; + } + } + + /* Assemble desired bits into floating point variable */ + for (y=i=0; i LDBL_MANT_DIG+e2-emin) { + bits = LDBL_MANT_DIG+e2-emin; + if (bits<0) bits=0; + denormal = 1; + } + + /* Calculate bias term to force rounding, move out lower bits */ + if (bits < LDBL_MANT_DIG) { + bias = copysignl(scalbn(1, 2*LDBL_MANT_DIG-bits-1), y); + frac = fmodl(y, scalbn(1, LDBL_MANT_DIG-bits)); + y -= frac; + y += bias; + } + + /* Process tail of decimal input so it can affect rounding */ + if (((a+i) & MASK) != z) { + uint32_t t = x[(a+i) & MASK]; + if (t < 500000000 && (t || ((a+i+1) & MASK) != z)) + frac += 0.25*sign; + else if (t > 500000000) + frac += 0.75*sign; + else if (t == 500000000) { + if (((a+i+1) & MASK) == z) + frac += 0.5*sign; + else + frac += 0.75*sign; + } + if (LDBL_MANT_DIG-bits >= 2 && !fmodl(frac, 1)) + frac++; + } + + y += frac; + y -= bias; + + if (((e2+LDBL_MANT_DIG) & INT_MAX) > emax-5) { + if (fabsl(y) >= 2/LDBL_EPSILON) { + if (denormal && bits==LDBL_MANT_DIG+e2-emin) + denormal = 0; + y *= 0.5; + e2++; + } + if (e2+LDBL_MANT_DIG>emax || (denormal && frac)) + errno = ERANGE; + } + + return scalbnl(y, e2); +} + +static long double hexfloat(FILE *f, int bits, int emin, int sign, int pok) +{ + uint32_t x = 0; + long double y = 0; + long double scale = 1; + long double bias = 0; + int gottail = 0, gotrad = 0, gotdig = 0; + long long rp = 0; + long long dc = 0; + long long e2 = 0; + int d; + int c; + + c = shgetc(f); + + /* Skip leading zeros */ + for (; c=='0'; c = shgetc(f)) gotdig = 1; + + if (c=='.') { + gotrad = 1; + c = shgetc(f); + /* Count zeros after the radix point before significand */ + for (rp=0; c=='0'; c = shgetc(f), rp--) gotdig = 1; + } + + for (; c-'0'<10U || (c|32)-'a'<6U || c=='.'; c = shgetc(f)) { + if (c=='.') { + if (gotrad) break; + rp = dc; + gotrad = 1; + } else { + gotdig = 1; + if (c > '9') d = (c|32)+10-'a'; + else d = c-'0'; + if (dc<8) { + x = x*16 + d; + } else if (dc < LDBL_MANT_DIG/4+1) { + y += d*(scale/=16); + } else if (d && !gottail) { + y += 0.5*scale; + gottail = 1; + } + dc++; + } + } + if (!gotdig) { + shunget(f); + if (pok) { + shunget(f); + if (gotrad) shunget(f); + } else { + shlim(f, 0); + } + return sign * 0.0; + } + if (!gotrad) rp = dc; + while (dc<8) x *= 16, dc++; + if ((c|32)=='p') { + e2 = scanexp(f, pok); + if (e2 == LLONG_MIN) { + if (pok) { + shunget(f); + } else { + shlim(f, 0); + return 0; + } + e2 = 0; + } + } else { + shunget(f); + } + e2 += 4*rp - 32; + + if (!x) return sign * 0.0; + if (e2 > -emin) { + errno = ERANGE; + return sign * LDBL_MAX * LDBL_MAX; + } + if (e2 < emin-2*LDBL_MANT_DIG) { + errno = ERANGE; + return sign * LDBL_MIN * LDBL_MIN; + } + + while (x < 0x80000000) { + if (y>=0.5) { + x += x + 1; + y += y - 1; + } else { + x += x; + y += y; + } + e2--; + } + + if (bits > 32+e2-emin) { + bits = 32+e2-emin; + if (bits<0) bits=0; + } + + if (bits < LDBL_MANT_DIG) + bias = copysignl(scalbn(1, 32+LDBL_MANT_DIG-bits-1), sign); + + if (bits<32 && y && !(x&1)) x++, y=0; + + y = bias + sign*(long double)x + sign*y; + y -= bias; + + if (!y) errno = ERANGE; + + return scalbnl(y, e2); +} + +long double __floatscan(FILE *f, int prec, int pok) +{ + int sign = 1; + size_t i; + int bits; + int emin; + int c; + + switch (prec) { + case 0: + bits = FLT_MANT_DIG; + emin = FLT_MIN_EXP-bits; + break; + case 1: + bits = DBL_MANT_DIG; + emin = DBL_MIN_EXP-bits; + break; + case 2: + bits = LDBL_MANT_DIG; + emin = LDBL_MIN_EXP-bits; + break; + default: + return 0; + } + + while (isspace((c=shgetc(f)))); + + if (c=='+' || c=='-') { + sign -= 2*(c=='-'); + c = shgetc(f); + } + + for (i=0; i<8 && (c|32)=="infinity"[i]; i++) + if (i<7) c = shgetc(f); + if (i==3 || i==8 || (i>3 && pok)) { + if (i!=8) { + shunget(f); + if (pok) for (; i>3; i--) shunget(f); + } + return sign * INFINITY; + } + if (!i) for (i=0; i<3 && (c|32)=="nan"[i]; i++) + if (i<2) c = shgetc(f); + if (i==3) { + if (shgetc(f) != '(') { + shunget(f); + return NAN; + } + for (i=1; ; i++) { + c = shgetc(f); + if (c-'0'<10U || c-'A'<26U || c-'a'<26U || c=='_') + continue; + if (c==')') return NAN; + shunget(f); + if (!pok) { + errno = EINVAL; + shlim(f, 0); + return 0; + } + while (i--) shunget(f); + return NAN; + } + return NAN; + } + + if (i) { + shunget(f); + errno = EINVAL; + shlim(f, 0); + return 0; + } + + if (c=='0') { + c = shgetc(f); + if ((c|32) == 'x') + return hexfloat(f, bits, emin, sign, pok); + shunget(f); + c = '0'; + } + + return decfloat(f, c, bits, emin, sign, pok); +} \ No newline at end of file diff --git a/Ubiquitous/XiZi/lib/musllib/src/internal/floatscan.h b/Ubiquitous/XiZi/lib/musllib/src/internal/floatscan.h new file mode 100644 index 000000000..ebeed2680 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/internal/floatscan.h @@ -0,0 +1,8 @@ +#ifndef FLOATSCAN_H +#define FLOATSCAN_H + +#include + +hidden long double __floatscan(FILE *, int, int); + +#endif \ No newline at end of file diff --git a/Ubiquitous/XiZi/lib/musllib/src/internal/intscan.c b/Ubiquitous/XiZi/lib/musllib/src/internal/intscan.c new file mode 100644 index 000000000..a4a5ae861 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/internal/intscan.c @@ -0,0 +1,100 @@ +#include +#include +#include +#include "shgetc.h" + +/* Lookup table for digit values. -1==255>=36 -> invalid */ +static const unsigned char table[] = { -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, + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,-1,-1,-1,-1,-1,-1, +-1,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24, +25,26,27,28,29,30,31,32,33,34,35,-1,-1,-1,-1,-1, +-1,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24, +25,26,27,28,29,30,31,32,33,34,35,-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, +}; + +unsigned long long __intscan(FILE *f, unsigned base, int pok, unsigned long long lim) +{ + const unsigned char *val = table+1; + int c, neg=0; + unsigned x; + unsigned long long y; + if (base > 36 || base == 1) { + errno = EINVAL; + return 0; + } + while (isspace((c=shgetc(f)))); + if (c=='+' || c=='-') { + neg = -(c=='-'); + c = shgetc(f); + } + if ((base == 0 || base == 16) && c=='0') { + c = shgetc(f); + if ((c|32)=='x') { + c = shgetc(f); + if (val[c]>=16) { + shunget(f); + if (pok) shunget(f); + else shlim(f, 0); + return 0; + } + base = 16; + } else if (base == 0) { + base = 8; + } + } else { + if (base == 0) base = 10; + if (val[c] >= base) { + shunget(f); + shlim(f, 0); + errno = EINVAL; + return 0; + } + } + if (base == 10) { + for (x=0; c-'0'<10U && x<=UINT_MAX/10-1; c=shgetc(f)) + x = x*10 + (c-'0'); + for (y=x; c-'0'<10U && y<=ULLONG_MAX/10 && 10*y<=ULLONG_MAX-(c-'0'); c=shgetc(f)) + y = y*10 + (c-'0'); + if (c-'0'>=10U) goto done; + } else if (!(base & base-1)) { + int bs = "\0\1\2\4\7\3\6\5"[(0x17*base)>>5&7]; + for (x=0; val[c]>bs; c=shgetc(f)) + y = y<=lim) { + if (!(lim&1) && !neg) { + errno = ERANGE; + return lim-1; + } else if (y>lim) { + errno = ERANGE; + return lim; + } + } + return (y^neg)-neg; +} diff --git a/Ubiquitous/XiZi/lib/musllib/src/internal/intscan.h b/Ubiquitous/XiZi/lib/musllib/src/internal/intscan.h new file mode 100644 index 000000000..fa9561fb9 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/internal/intscan.h @@ -0,0 +1,9 @@ +#ifndef INTSCAN_H +#define INTSCAN_H + +#include +#include "../include/features.h" + +hidden unsigned long long __intscan(FILE *, unsigned, int, unsigned long long); + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/src/internal/libc.h b/Ubiquitous/XiZi/lib/musllib/src/internal/libc.h new file mode 100644 index 000000000..85a102e6a --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/internal/libc.h @@ -0,0 +1,19 @@ +#ifndef LIBC_H +#define LIBC_H + +#include +#include +#include + +struct __locale_map; + +struct __locale_struct { + const struct __locale_map *cat[6]; +}; + +#define __NEED_locale_t +#include + + + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/src/internal/libm.h b/Ubiquitous/XiZi/lib/musllib/src/internal/libm.h new file mode 100644 index 000000000..a0983612e --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/internal/libm.h @@ -0,0 +1,272 @@ +#ifndef _LIBM_H +#define _LIBM_H + +#include +#include +#include +#include +#include "../include/features.h" + + +#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 +#elif LDBL_MANT_DIG == 64 && LDBL_MAX_EXP == 16384 && __BYTE_ORDER == __LITTLE_ENDIAN +union ldshape { + long double f; + struct { + uint64_t m; + uint16_t se; + } i; +}; +#elif LDBL_MANT_DIG == 64 && LDBL_MAX_EXP == 16384 && __BYTE_ORDER == __BIG_ENDIAN +/* This is the m68k variant of 80-bit long double, and this definition only works + * on archs where the alignment requirement of uint64_t is <= 4. */ +union ldshape { + long double f; + struct { + uint16_t se; + uint16_t pad; + uint64_t m; + } i; +}; +#elif LDBL_MANT_DIG == 113 && LDBL_MAX_EXP == 16384 && __BYTE_ORDER == __LITTLE_ENDIAN +union ldshape { + long double f; + struct { + uint64_t lo; + uint32_t mid; + uint16_t top; + uint16_t se; + } i; + struct { + uint64_t lo; + uint64_t hi; + } i2; +}; +#elif LDBL_MANT_DIG == 113 && LDBL_MAX_EXP == 16384 && __BYTE_ORDER == __BIG_ENDIAN +union ldshape { + long double f; + struct { + uint16_t se; + uint16_t top; + uint32_t mid; + uint64_t lo; + } i; + struct { + uint64_t hi; + uint64_t lo; + } i2; +}; +#else +#error Unsupported long double representation +#endif + +/* Support non-nearest rounding mode. */ +#define WANT_ROUNDING 1 +/* Support signaling NaNs. */ +#define WANT_SNAN 0 + +#if WANT_SNAN +#error SNaN is unsupported +#else +#define issignalingf_inline(x) 0 +#define issignaling_inline(x) 0 +#endif + +#ifndef TOINT_INTRINSICS +#define TOINT_INTRINSICS 0 +#endif + +#if TOINT_INTRINSICS +/* Round x to nearest int in all rounding modes, ties have to be rounded + consistently with converttoint so the results match. If the result + would be outside of [-2^31, 2^31-1] then the semantics is unspecified. */ +static double_t roundtoint(double_t); + +/* Convert x to nearest int in all rounding modes, ties have to be rounded + consistently with roundtoint. If the result is not representible in an + int32_t then the semantics is unspecified. */ +static int32_t converttoint(double_t); +#endif + +/* Helps static branch prediction so hot path can be better optimized. */ +#ifdef __GNUC__ +#define predict_true(x) __builtin_expect(!!(x), 1) +#define predict_false(x) __builtin_expect(x, 0) +#else +#define predict_true(x) (x) +#define predict_false(x) (x) +#endif + +/* Evaluate an expression as the specified type. With standard excess + precision handling a type cast or assignment is enough (with + -ffloat-store an assignment is required, in old compilers argument + passing and return statement may not drop excess precision). */ + +static inline float eval_as_float(float x) +{ + float y = x; + return y; +} + +static inline double eval_as_double(double x) +{ + double y = x; + return y; +} + +/* fp_barrier returns its input, but limits code transformations + as if it had a side-effect (e.g. observable io) and returned + an arbitrary value. */ + +#ifndef fp_barrierf +#define fp_barrierf fp_barrierf +static inline float fp_barrierf(float x) +{ + volatile float y = x; + return y; +} +#endif + +#ifndef fp_barrier +#define fp_barrier fp_barrier +static inline double fp_barrier(double x) +{ + volatile double y = x; + return y; +} +#endif + +#ifndef fp_barrierl +#define fp_barrierl fp_barrierl +static inline long double fp_barrierl(long double x) +{ + volatile long double y = x; + return y; +} +#endif + +/* fp_force_eval ensures that the input value is computed when that's + otherwise unused. To prevent the constant folding of the input + expression, an additional fp_barrier may be needed or a compilation + mode that does so (e.g. -frounding-math in gcc). Then it can be + used to evaluate an expression for its fenv side-effects only. */ + +#ifndef fp_force_evalf +#define fp_force_evalf fp_force_evalf +static inline void fp_force_evalf(float x) +{ + volatile float y; + y = x; +} +#endif + +#ifndef fp_force_eval +#define fp_force_eval fp_force_eval +static inline void fp_force_eval(double x) +{ + volatile double y; + y = x; +} +#endif + +#ifndef fp_force_evall +#define fp_force_evall fp_force_evall +static inline void fp_force_evall(long double x) +{ + volatile long double y; + y = x; +} +#endif + +#define FORCE_EVAL(x) do { \ + if (sizeof(x) == sizeof(float)) { \ + fp_force_evalf(x); \ + } else if (sizeof(x) == sizeof(double)) { \ + fp_force_eval(x); \ + } else { \ + fp_force_evall(x); \ + } \ +} while(0) + +#define asuint(f) ((union{float _f; uint32_t _i;}){f})._i +#define asfloat(i) ((union{uint32_t _i; float _f;}){i})._f +#define asuint64(f) ((union{double _f; uint64_t _i;}){f})._i +#define asdouble(i) ((union{uint64_t _i; double _f;}){i})._f + +#define EXTRACT_WORDS(hi,lo,d) \ +do { \ + uint64_t __u = asuint64(d); \ + (hi) = __u >> 32; \ + (lo) = (uint32_t)__u; \ +} while (0) + +#define GET_HIGH_WORD(hi,d) \ +do { \ + (hi) = asuint64(d) >> 32; \ +} while (0) + +#define GET_LOW_WORD(lo,d) \ +do { \ + (lo) = (uint32_t)asuint64(d); \ +} while (0) + +#define INSERT_WORDS(d,hi,lo) \ +do { \ + (d) = asdouble(((uint64_t)(hi)<<32) | (uint32_t)(lo)); \ +} while (0) + +#define SET_HIGH_WORD(d,hi) \ + INSERT_WORDS(d, hi, (uint32_t)asuint64(d)) + +#define SET_LOW_WORD(d,lo) \ + INSERT_WORDS(d, asuint64(d)>>32, lo) + +#define GET_FLOAT_WORD(w,d) \ +do { \ + (w) = asuint(d); \ +} while (0) + +#define SET_FLOAT_WORD(d,w) \ +do { \ + (d) = asfloat(w); \ +} while (0) + +hidden int __rem_pio2_large(double*,double*,int,int,int); + +hidden int __rem_pio2(double,double*); +hidden double __sin(double,double,int); +hidden double __cos(double,double); +hidden double __tan(double,double,int); +hidden double __expo2(double); + +hidden int __rem_pio2f(float,double*); +hidden float __sindf(double); +hidden float __cosdf(double); +hidden float __tandf(double,int); +hidden float __expo2f(float); + +hidden int __rem_pio2l(long double, long double *); +hidden long double __sinl(long double, long double, int); +hidden long double __cosl(long double, long double); +hidden long double __tanl(long double, long double, int); + +hidden long double __polevll(long double, const long double *, int); +hidden long double __p1evll(long double, const long double *, int); + +extern int __signgam; +hidden double __lgamma_r(double, int *); +hidden float __lgammaf_r(float, int *); + +/* error handling functions */ +hidden float __math_xflowf(uint32_t, float); +hidden float __math_uflowf(uint32_t); +hidden float __math_oflowf(uint32_t); +hidden float __math_divzerof(uint32_t); +hidden float __math_invalidf(float); +hidden double __math_xflow(uint32_t, double); +hidden double __math_uflow(uint32_t); +hidden double __math_oflow(uint32_t); +hidden double __math_divzero(uint32_t); +hidden double __math_invalid(double); + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/src/internal/locale_impl.h b/Ubiquitous/XiZi/lib/musllib/src/internal/locale_impl.h new file mode 100644 index 000000000..47b7c9e1f --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/internal/locale_impl.h @@ -0,0 +1,48 @@ +#ifndef _LOCALE_IMPL_H +#define _LOCALE_IMPL_H + +#define __NEED_locale_t + +#include +#include +#include "libc.h" +#include "pthread_impl.h" +#include "../include/features.h" + +#define LOCALE_NAME_MAX 23 + +struct __locale_map { + const void *map; + size_t map_size; + char name[LOCALE_NAME_MAX+1]; + const struct __locale_map *next; +}; + +extern hidden const struct __locale_map __c_dot_utf8; +extern hidden const struct __locale_struct __c_locale; +extern hidden const struct __locale_struct __c_dot_utf8_locale; + +hidden const struct __locale_map *__get_locale(int, const char *); +hidden const char *__mo_lookup(const void *, size_t, const char *); +hidden const char *__lctrans(const char *, const struct __locale_map *); +hidden const char *__lctrans_cur(const char *); +hidden const char *__lctrans_impl(const char *, const struct __locale_map *); +hidden int __loc_is_allocated(locale_t); +hidden char *__gettextdomain(void); + +#define LOC_MAP_FAILED ((const struct __locale_map *)-1) + +#define LCTRANS(msg, lc, loc) __lctrans(msg, (loc)->cat[(lc)]) +#define LCTRANS_CUR(msg) __lctrans_cur(msg) + +#define C_LOCALE ((locale_t)&__c_locale) +#define UTF8_LOCALE ((locale_t)&__c_dot_utf8_locale) + +#define CURRENT_LOCALE ((locale_t)&__c_locale) + +#define CURRENT_UTF8 (!!((locale_t)&__c_dot_utf8_locale)->cat[LC_CTYPE]) + +#undef MB_CUR_MAX +#define MB_CUR_MAX (CURRENT_UTF8 ? 4 : 1) + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/src/internal/lock.h b/Ubiquitous/XiZi/lib/musllib/src/internal/lock.h new file mode 100644 index 000000000..c77db6f7b --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/internal/lock.h @@ -0,0 +1,9 @@ +#ifndef LOCK_H +#define LOCK_H + +hidden void __lock(volatile int *); +hidden void __unlock(volatile int *); +#define LOCK(x) __lock(x) +#define UNLOCK(x) __unlock(x) + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/src/internal/pthread_impl.h b/Ubiquitous/XiZi/lib/musllib/src/internal/pthread_impl.h new file mode 100644 index 000000000..0a1f8b906 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/internal/pthread_impl.h @@ -0,0 +1,137 @@ +#ifndef _PTHREAD_IMPL_H +#define _PTHREAD_IMPL_H + +#include +#include +#include +#include +#include +#include "libc.h" +// #include "atomic.h" +#include "../include/features.h" + +enum { + DT_EXITING = 0, + DT_JOINABLE, + DT_DETACHED, +}; + +struct __timer { + int timerid; + pthread_t thread; +}; + +#define __SU (sizeof(size_t)/sizeof(int)) + +#define _a_stacksize __u.__s[0] +#define _a_guardsize __u.__s[1] +#define _a_stackaddr __u.__s[2] +#define _a_detach __u.__i[3*__SU+0] +#define _a_sched __u.__i[3*__SU+1] +#define _a_policy __u.__i[3*__SU+2] +#define _a_prio __u.__i[3*__SU+3] +#define _m_type __u.__i[0] +#define _m_lock __u.__vi[1] +#define _m_waiters __u.__vi[2] +#define _m_prev __u.__p[3] +#define _m_next __u.__p[4] +#define _m_count __u.__i[5] +#define _c_shared __u.__p[0] +#define _c_seq __u.__vi[2] +#define _c_waiters __u.__vi[3] +#define _c_clock __u.__i[4] +#define _c_lock __u.__vi[8] +#define _c_head __u.__p[1] +#define _c_tail __u.__p[5] +#define _rw_lock __u.__vi[0] +#define _rw_waiters __u.__vi[1] +#define _rw_shared __u.__i[2] +#define _b_lock __u.__vi[0] +#define _b_waiters __u.__vi[1] +#define _b_limit __u.__i[2] +#define _b_count __u.__vi[3] +#define _b_waiters2 __u.__vi[4] +#define _b_inst __u.__p[3] + +#ifndef CANARY +#define CANARY canary +#endif + +#ifndef DTP_OFFSET +#define DTP_OFFSET 0 +#endif + +#ifndef tls_mod_off_t +#define tls_mod_off_t size_t +#endif + +#define SIGTIMER 32 +#define SIGCANCEL 33 +#define SIGSYNCCALL 34 + +#define SIGALL_SET ((sigset_t *)(const unsigned long long [2]){ -1,-1 }) +#define SIGPT_SET \ + ((sigset_t *)(const unsigned long [_NSIG/8/sizeof(long)]){ \ + [sizeof(long)==4] = 3UL<<(32*(sizeof(long)>4)) }) +#define SIGTIMER_SET \ + ((sigset_t *)(const unsigned long [_NSIG/8/sizeof(long)]){ \ + 0x80000000 }) + +void *__tls_get_addr(tls_mod_off_t *); +hidden int __init_tp(void *); +hidden void *__copy_tls(unsigned char *); +hidden void __reset_tls(void); + +hidden void __membarrier_init(void); +hidden void __dl_thread_cleanup(void); +hidden void __testcancel(void); +hidden void __do_cleanup_push(struct __ptcb *); +hidden void __do_cleanup_pop(struct __ptcb *); +hidden void __pthread_tsd_run_dtors(void); + +hidden void __pthread_key_delete_synccall(void (*)(void *), void *); +hidden int __pthread_key_delete_impl(pthread_key_t); + +extern hidden volatile size_t __pthread_tsd_size; +extern hidden void *__pthread_tsd_main[]; +extern hidden volatile int __aio_fut; +extern hidden volatile int __eintr_valid_flag; + +hidden int __clone(int (*)(void *), void *, int, void *, ...); +hidden int __thread_clone(int (*func)(void *), int flags, pthread_t *thread, unsigned char *sp); +hidden int __set_thread_area(void *); +hidden int __libc_sigaction(int, const struct sigaction *, struct sigaction *); +hidden void __unmapself(void *, size_t); + +hidden int __timedwait(volatile int *, int, clockid_t, const struct timespec *, int); +hidden int __timedwait_cp(volatile int *, int, clockid_t, const struct timespec *, int); +hidden void __wait(volatile int *, volatile int *, int, int); + +hidden void __acquire_ptc(void); +hidden void __release_ptc(void); +hidden void __inhibit_ptc(void); + +hidden void __tl_lock(void); +hidden void __tl_unlock(void); +hidden void __tl_sync(pthread_t); + +extern hidden volatile int __thread_list_lock; + +extern hidden unsigned __default_stacksize; +extern hidden unsigned __default_guardsize; + +#define DEFAULT_STACK_SIZE 131072 +#define DEFAULT_GUARD_SIZE 8192 + +#define DEFAULT_STACK_MAX (8<<20) +#define DEFAULT_GUARD_MAX (1<<20) + +#define __ATTRP_C11_THREAD ((void*)(uintptr_t)-1) + +#define MUSL_TYPE_THREAD (-1) +#define MUSL_TYPE_PROCESS (0) + +#define PTHREAD_MUTEX_TYPE_MASK 3 +#define PTHREAD_PRIORITY_LOWEST 31 + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/src/internal/shgetc.c b/Ubiquitous/XiZi/lib/musllib/src/internal/shgetc.c new file mode 100644 index 000000000..a4a9c633d --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/internal/shgetc.c @@ -0,0 +1,37 @@ +#include "shgetc.h" + +/* The shcnt field stores the number of bytes read so far, offset by + * the value of buf-rpos at the last function call (__shlim or __shgetc), + * so that between calls the inline shcnt macro can add rpos-buf to get + * the actual count. */ + +void __shlim(FILE *f, off_t lim) +{ + f->shlim = lim; + f->shcnt = f->buf - f->rpos; + /* If lim is nonzero, rend must be a valid pointer. */ + if (lim && f->rend - f->rpos > lim) + f->shend = f->rpos + lim; + else + f->shend = f->rend; +} + +int __shgetc(FILE *f) +{ + int c; + off_t cnt = shcnt(f); + if (f->shlim && cnt >= f->shlim || (c=__uflow(f)) < 0) { + f->shcnt = f->buf - f->rpos + cnt; + f->shend = f->rpos; + f->shlim = -1; + return EOF; + } + cnt++; + if (f->shlim && f->rend - f->rpos > f->shlim - cnt) + f->shend = f->rpos + (f->shlim - cnt); + else + f->shend = f->rend; + f->shcnt = f->buf - f->rpos + cnt; + if (f->rpos[-1] != c) f->rpos[-1] = c; + return c; +} diff --git a/Ubiquitous/XiZi/lib/musllib/src/internal/shgetc.h b/Ubiquitous/XiZi/lib/musllib/src/internal/shgetc.h new file mode 100644 index 000000000..e5d9b70c1 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/internal/shgetc.h @@ -0,0 +1,33 @@ +#include "stdio_impl.h" +#include "../include/features.h" + +/* Scan helper "stdio" functions for use by scanf-family and strto*-family + * functions. These accept either a valid stdio FILE, or a minimal pseudo + * FILE whose buffer pointers point into a null-terminated string. In the + * latter case, the sh_fromstring macro should be used to setup the FILE; + * the rest of the structure can be left uninitialized. + * + * To begin using these functions, shlim must first be called on the FILE + * to set a field width limit, or 0 for no limit. For string pseudo-FILEs, + * a nonzero limit is not valid and produces undefined behavior. After that, + * shgetc, shunget, and shcnt are valid as long as no other stdio functions + * are called on the stream. + * + * When used with a real FILE object, shunget has only one byte of pushback + * available. Further shunget (up to a limit of the stdio UNGET buffer size) + * will adjust the position but will not restore the data to be read again. + * This functionality is needed for the wcsto*-family functions, where it's + * okay because the FILE will be discarded immediately anyway. When used + * with string pseudo-FILEs, shunget has unlimited pushback, back to the + * beginning of the string. */ + +hidden void __shlim(FILE *, off_t); +hidden int __shgetc(FILE *); + +#define shcnt(f) ((f)->shcnt + ((f)->rpos - (f)->buf)) +#define shlim(f, lim) __shlim((f), (lim)) +#define shgetc(f) (((f)->rpos != (f)->shend) ? *(f)->rpos++ : __shgetc(f)) +#define shunget(f) ((f)->shlim>=0 ? (void)(f)->rpos-- : (void)0) + +#define sh_fromstring(f, s) \ + ((f)->buf = (f)->rpos = (void *)(s), (f)->rend = (void*)-1) diff --git a/Ubiquitous/XiZi/lib/musllib/src/internal/stdio_impl.h b/Ubiquitous/XiZi/lib/musllib/src/internal/stdio_impl.h new file mode 100644 index 000000000..2452799c2 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/internal/stdio_impl.h @@ -0,0 +1,89 @@ +#ifndef _STDIO_IMPL_H +#define _STDIO_IMPL_H + +#define __NEED_struct__IO_FILE + +#include +#include +#include +#include "../include/features.h" + +#define UNGET 8 + +#define FLOCK(f) __lockfile(f) +#define FUNLOCK(f) __unlockfile(f) + +#define F_PERM 1 +#define F_NORD 4 +#define F_NOWR 8 +#define F_EOF 16 +#define F_ERR 32 +#define F_SVB 64 +#define F_APP 128 + +#define PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP PTHREAD_MUTEX_INITIALIZER +extern hidden FILE *volatile __stdin_used; +extern hidden FILE *volatile __stdout_used; +extern hidden FILE *volatile __stderr_used; + +hidden int __lockfile(FILE *); +hidden int __unlockfile(FILE *); + +hidden size_t __stdio_read(FILE *, unsigned char *, size_t); +hidden size_t __stdio_write(FILE *, const unsigned char *, size_t); +hidden size_t __stdout_write(FILE *, const unsigned char *, size_t); +hidden off_t __stdio_seek(FILE *, off_t, int); +hidden int __stdio_close(FILE *); + +hidden size_t __string_read(FILE *, unsigned char *, size_t); + +hidden int __toread(FILE *); +hidden int __towrite(FILE *); + +hidden void __stdio_exit(void); +hidden void __stdio_exit_needed(void); + +#if defined(__PIC__) && (100*__GNUC__+__GNUC_MINOR__ >= 303) +__attribute__((visibility("protected"))) +#endif +int __overflow(FILE *, int), __uflow(FILE *); + +hidden int __fseeko(FILE *, off_t, int); +hidden int __fseeko_unlocked(FILE *, off_t, int); +hidden off_t __ftello(FILE *); +hidden off_t __ftello_unlocked(FILE *); +hidden size_t __fwritex(const unsigned char *, size_t, FILE *); +hidden int __putc_unlocked(int, FILE *); + +hidden FILE *__fdopen(int, const char *); +hidden int __fmodeflags(const char *); + +hidden FILE *__ofl_add(FILE *f); +hidden FILE **__ofl_lock(void); +hidden void __ofl_unlock(void); + +struct __pthread; +hidden void __register_locked_file(FILE *, struct __pthread *); +hidden void __unlist_locked_file(FILE *); +hidden void __do_orphaned_stdio_locks(void); + +#define MAYBE_WAITERS 0x40000000 + +hidden void __getopt_msg(const char *, const char *, const char *, size_t); + +#define feof(f) ((f)->flags & F_EOF) +#define ferror(f) ((f)->flags & F_ERR) + +#define getc_unlocked(f) \ + ( ((f)->rpos != (f)->rend) ? *(f)->rpos++ : __uflow((f)) ) + +#define putc_unlocked(c, f) \ + ( (((unsigned char)(c)!=(f)->lbf && (f)->wpos!=(f)->wend)) \ + ? *(f)->wpos++ = (unsigned char)(c) \ + : __overflow((f),(unsigned char)(c)) ) + +/* Caller-allocated FILE * operations */ +hidden FILE *__fopen_rb_ca(const char *, FILE *, unsigned char *, size_t); +hidden int __fclose_ca(FILE *); + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/src/internal/syscall.h b/Ubiquitous/XiZi/lib/musllib/src/internal/syscall.h new file mode 100644 index 000000000..4f41e1dce --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/internal/syscall.h @@ -0,0 +1,398 @@ +#ifndef _INTERNAL_SYSCALL_H +#define _INTERNAL_SYSCALL_H + +#include +#include +#include +#include "syscall_arch.h" + +#ifndef SYSCALL_RLIM_INFINITY +#define SYSCALL_RLIM_INFINITY (~0ULL) +#endif + +#ifndef SYSCALL_MMAP2_UNIT +#define SYSCALL_MMAP2_UNIT 4096ULL +#endif + +#ifndef __SYSCALL_LL_PRW +#define __SYSCALL_LL_PRW(x) __SYSCALL_LL_O(x) +#endif + +#ifndef __scc +#define __scc(X) ((long) (X)) +typedef long syscall_arg_t; +#endif + +hidden long __syscall_ret(unsigned long), + __syscall_cp(syscall_arg_t, syscall_arg_t, syscall_arg_t, syscall_arg_t, + syscall_arg_t, syscall_arg_t, syscall_arg_t); + +#define __syscall1(n,a) __syscall1(n,__scc(a)) +#define __syscall2(n,a,b) __syscall2(n,__scc(a),__scc(b)) +#define __syscall3(n,a,b,c) __syscall3(n,__scc(a),__scc(b),__scc(c)) +#define __syscall4(n,a,b,c,d) __syscall4(n,__scc(a),__scc(b),__scc(c),__scc(d)) +#define __syscall5(n,a,b,c,d,e) __syscall5(n,__scc(a),__scc(b),__scc(c),__scc(d),__scc(e)) +#define __syscall6(n,a,b,c,d,e,f) __syscall6(n,__scc(a),__scc(b),__scc(c),__scc(d),__scc(e),__scc(f)) +#define __syscall7(n,a,b,c,d,e,f,g) __syscall7(n,__scc(a),__scc(b),__scc(c),__scc(d),__scc(e),__scc(f),__scc(g)) + +#define __SYSCALL_NARGS_X(a,b,c,d,e,f,g,h,n,...) n +#define __SYSCALL_NARGS(...) __SYSCALL_NARGS_X(__VA_ARGS__,7,6,5,4,3,2,1,0,) +#define __SYSCALL_CONCAT_X(a,b) a##b +#define __SYSCALL_CONCAT(a,b) __SYSCALL_CONCAT_X(a,b) +#define __SYSCALL_DISP(b,...) __SYSCALL_CONCAT(b,__SYSCALL_NARGS(__VA_ARGS__))(__VA_ARGS__) + +#define __syscall(...) __SYSCALL_DISP(__syscall,__VA_ARGS__) +#define syscall(...) __syscall_ret(__syscall(__VA_ARGS__)) + +#define socketcall(nm,a,b,c,d,e,f) __syscall_ret(__socketcall(nm,a,b,c,d,e,f)) +#define socketcall_cp(nm,a,b,c,d,e,f) __syscall_ret(__socketcall_cp(nm,a,b,c,d,e,f)) + +#define __syscall_cp0(n) (__syscall_cp)(n,0,0,0,0,0,0) +#define __syscall_cp1(n,a) (__syscall_cp)(n,__scc(a),0,0,0,0,0) +#define __syscall_cp2(n,a,b) (__syscall_cp)(n,__scc(a),__scc(b),0,0,0,0) +#define __syscall_cp3(n,a,b,c) (__syscall_cp)(n,__scc(a),__scc(b),__scc(c),0,0,0) +#define __syscall_cp4(n,a,b,c,d) (__syscall_cp)(n,__scc(a),__scc(b),__scc(c),__scc(d),0,0) +#define __syscall_cp5(n,a,b,c,d,e) (__syscall_cp)(n,__scc(a),__scc(b),__scc(c),__scc(d),__scc(e),0) +#define __syscall_cp6(n,a,b,c,d,e,f) (__syscall_cp)(n,__scc(a),__scc(b),__scc(c),__scc(d),__scc(e),__scc(f)) + +#define __syscall_cp(...) __SYSCALL_DISP(__syscall_cp,__VA_ARGS__) +#define syscall_cp(...) __syscall_ret(__syscall_cp(__VA_ARGS__)) + +static inline long __alt_socketcall(int sys, int sock, int cp, long a, long b, long c, long d, long e, long f) +{ + long r; + if (cp) r = __syscall_cp(sys, a, b, c, d, e, f); + else r = __syscall(sys, a, b, c, d, e, f); + if (r != -ENOSYS) return r; +#ifdef SYS_socketcall + if (cp) r = __syscall_cp(SYS_socketcall, sock, ((long[6]){a, b, c, d, e, f})); + else r = __syscall(SYS_socketcall, sock, ((long[6]){a, b, c, d, e, f})); +#endif + return r; +} +#define __socketcall(nm, a, b, c, d, e, f) __alt_socketcall(SYS_##nm, __SC_##nm, 0, \ + (long)(a), (long)(b), (long)(c), (long)(d), (long)(e), (long)(f)) +#define __socketcall_cp(nm, a, b, c, d, e, f) __alt_socketcall(SYS_##nm, __SC_##nm, 1, \ + (long)(a), (long)(b), (long)(c), (long)(d), (long)(e), (long)(f)) + +/* fixup legacy 16-bit junk */ + +#ifdef SYS_getuid32 +#undef SYS_lchown +#undef SYS_getuid +#undef SYS_getgid +#undef SYS_geteuid +#undef SYS_getegid +#undef SYS_setreuid +#undef SYS_setregid +#undef SYS_getgroups +#undef SYS_setgroups +#undef SYS_fchown +#undef SYS_setresuid +#undef SYS_getresuid +#undef SYS_setresgid +#undef SYS_getresgid +#undef SYS_chown +#undef SYS_setuid +#undef SYS_setgid +#undef SYS_setfsuid +#undef SYS_setfsgid +#define SYS_lchown SYS_lchown32 +#define SYS_getuid SYS_getuid32 +#define SYS_getgid SYS_getgid32 +#define SYS_geteuid SYS_geteuid32 +#define SYS_getegid SYS_getegid32 +#define SYS_setreuid SYS_setreuid32 +#define SYS_setregid SYS_setregid32 +#define SYS_getgroups SYS_getgroups32 +#define SYS_setgroups SYS_setgroups32 +#define SYS_fchown SYS_fchown32 +#define SYS_setresuid SYS_setresuid32 +#define SYS_getresuid SYS_getresuid32 +#define SYS_setresgid SYS_setresgid32 +#define SYS_getresgid SYS_getresgid32 +#define SYS_chown SYS_chown32 +#define SYS_setuid SYS_setuid32 +#define SYS_setgid SYS_setgid32 +#define SYS_setfsuid SYS_setfsuid32 +#define SYS_setfsgid SYS_setfsgid32 +#endif + + +/* fixup legacy 32-bit-vs-lfs64 junk */ + +#ifdef SYS_fcntl64 +#undef SYS_fcntl +#define SYS_fcntl SYS_fcntl64 +#endif + +#ifdef SYS_getdents64 +#undef SYS_getdents +#define SYS_getdents SYS_getdents64 +#endif + +#ifdef SYS_ftruncate64 +#undef SYS_ftruncate +#undef SYS_truncate +#define SYS_ftruncate SYS_ftruncate64 +#define SYS_truncate SYS_truncate64 +#endif + +#ifdef SYS_stat64 +#undef SYS_stat +#define SYS_stat SYS_stat64 +#endif + +#ifdef SYS_fstat64 +#undef SYS_fstat +#define SYS_fstat SYS_fstat64 +#endif + +#ifdef SYS_lstat64 +#undef SYS_lstat +#define SYS_lstat SYS_lstat64 +#endif + +#ifdef SYS_statfs64 +#undef SYS_statfs +#define SYS_statfs SYS_statfs64 +#endif + +#ifdef SYS_fstatfs64 +#undef SYS_fstatfs +#define SYS_fstatfs SYS_fstatfs64 +#endif + +#if defined(SYS_newfstatat) +#undef SYS_fstatat +#define SYS_fstatat SYS_newfstatat +#elif defined(SYS_fstatat64) +#undef SYS_fstatat +#define SYS_fstatat SYS_fstatat64 +#endif + +#ifdef SYS_ugetrlimit +#undef SYS_getrlimit +#define SYS_getrlimit SYS_ugetrlimit +#endif + +#ifdef SYS__newselect +#undef SYS_select +#define SYS_select SYS__newselect +#endif + +#ifdef SYS_pread64 +#undef SYS_pread +#undef SYS_pwrite +#define SYS_pread SYS_pread64 +#define SYS_pwrite SYS_pwrite64 +#endif + +#ifdef SYS_fadvise64_64 +#undef SYS_fadvise +#define SYS_fadvise SYS_fadvise64_64 +#elif defined(SYS_fadvise64) +#undef SYS_fadvise +#define SYS_fadvise SYS_fadvise64 +#endif + +#ifdef SYS_sendfile64 +#undef SYS_sendfile +#define SYS_sendfile SYS_sendfile64 +#endif + +#ifdef SYS_timer_settime32 +#define SYS_timer_settime SYS_timer_settime32 +#endif + +#ifdef SYS_timer_gettime32 +#define SYS_timer_gettime SYS_timer_gettime32 +#endif + +#ifdef SYS_timerfd_settime32 +#define SYS_timerfd_settime SYS_timerfd_settime32 +#endif + +#ifdef SYS_timerfd_gettime32 +#define SYS_timerfd_gettime SYS_timerfd_gettime32 +#endif + +#ifdef SYS_clock_settime32 +#define SYS_clock_settime SYS_clock_settime32 +#endif + +#ifdef SYS_clock_gettime32 +#define SYS_clock_gettime SYS_clock_gettime32 +#endif + +#ifdef SYS_clock_getres_time32 +#define SYS_clock_getres SYS_clock_getres_time32 +#endif + +#ifdef SYS_clock_nanosleep_time32 +#define SYS_clock_nanosleep SYS_clock_nanosleep_time32 +#endif + +#ifdef SYS_gettimeofday_time32 +#define SYS_gettimeofday SYS_gettimeofday_time32 +#endif + +#ifdef SYS_settimeofday_time32 +#define SYS_settimeofday SYS_settimeofday_time32 +#endif + +/* Ensure that the plain syscall names are defined even for "time64-only" + * archs. These facilitate callers passing null time arguments, and make + * tests for establishing which to use/fallback-to more consistent when + * they do need to be called with time arguments. */ + +#ifndef SYS_clock_gettime +#define SYS_clock_gettime SYS_clock_gettime64 +#endif + +#ifndef SYS_clock_settime +#define SYS_clock_settime SYS_clock_settime64 +#endif + +#ifndef SYS_clock_adjtime +#define SYS_clock_adjtime SYS_clock_adjtime64 +#endif + +#ifndef SYS_clock_getres +#define SYS_clock_getres SYS_clock_getres_time64 +#endif + +#ifndef SYS_clock_nanosleep +#define SYS_clock_nanosleep SYS_clock_nanosleep_time64 +#endif + +#ifndef SYS_timer_gettime +#define SYS_timer_gettime SYS_timer_gettime64 +#endif + +#ifndef SYS_timer_settime +#define SYS_timer_settime SYS_timer_settime64 +#endif + +#ifndef SYS_timerfd_gettime +#define SYS_timerfd_gettime SYS_timerfd_gettime64 +#endif + +#ifndef SYS_timerfd_settime +#define SYS_timerfd_settime SYS_timerfd_settime64 +#endif + +#ifndef SYS_utimensat +#define SYS_utimensat SYS_utimensat_time64 +#endif + +#ifndef SYS_pselect6 +#define SYS_pselect6 SYS_pselect6_time64 +#endif + +#ifndef SYS_ppoll +#define SYS_ppoll SYS_ppoll_time64 +#endif + +#ifndef SYS_recvmmsg +#define SYS_recvmmsg SYS_recvmmsg_time64 +#endif + +#ifndef SYS_mq_timedsend +#define SYS_mq_timedsend SYS_mq_timedsend_time64 +#endif + +#ifndef SYS_mq_timedreceive +#define SYS_mq_timedreceive SYS_mq_timedreceive_time64 +#endif + +/* SYS_semtimedop omitted because SYS_ipc may provide it */ + +#ifndef SYS_rt_sigtimedwait +#define SYS_rt_sigtimedwait SYS_rt_sigtimedwait_time64 +#endif + +#ifndef SYS_futex +#define SYS_futex SYS_futex_time64 +#endif + +#ifndef SYS_sched_rr_get_interval +#define SYS_sched_rr_get_interval SYS_sched_rr_get_interval_time64 +#endif + + + + +/* socketcall calls */ + +#define __SC_socket 1 +#define __SC_bind 2 +#define __SC_connect 3 +#define __SC_listen 4 +#define __SC_accept 5 +#define __SC_getsockname 6 +#define __SC_getpeername 7 +#define __SC_socketpair 8 +#define __SC_send 9 +#define __SC_recv 10 +#define __SC_sendto 11 +#define __SC_recvfrom 12 +#define __SC_shutdown 13 +#define __SC_setsockopt 14 +#define __SC_getsockopt 15 +#define __SC_sendmsg 16 +#define __SC_recvmsg 17 +#define __SC_accept4 18 +#define __SC_recvmmsg 19 +#define __SC_sendmmsg 20 + +/* This is valid only because all socket syscalls are made via + * socketcall, which always fills unused argument slots with zeros. */ +#ifndef SYS_accept +#define SYS_accept SYS_accept4 +#endif + +#ifndef SO_RCVTIMEO_OLD +#define SO_RCVTIMEO_OLD 20 +#endif +#ifndef SO_SNDTIMEO_OLD +#define SO_SNDTIMEO_OLD 21 +#endif + +#define SO_TIMESTAMP_OLD 29 +#define SO_TIMESTAMPNS_OLD 35 +#define SO_TIMESTAMPING_OLD 37 +#define SCM_TIMESTAMP_OLD SO_TIMESTAMP_OLD +#define SCM_TIMESTAMPNS_OLD SO_TIMESTAMPNS_OLD +#define SCM_TIMESTAMPING_OLD SO_TIMESTAMPING_OLD + +#ifndef SIOCGSTAMP_OLD +#define SIOCGSTAMP_OLD 0x8906 +#endif +#ifndef SIOCGSTAMPNS_OLD +#define SIOCGSTAMPNS_OLD 0x8907 +#endif + +#ifdef SYS_open +#define __sys_open2(x,pn,fl) __syscall2(SYS_open, pn, (fl)|O_LARGEFILE) +#define __sys_open3(x,pn,fl,mo) __syscall3(SYS_open, pn, (fl)|O_LARGEFILE, mo) +#define __sys_open_cp2(x,pn,fl) __syscall_cp2(SYS_open, pn, (fl)|O_LARGEFILE) +#define __sys_open_cp3(x,pn,fl,mo) __syscall_cp3(SYS_open, pn, (fl)|O_LARGEFILE, mo) +#else +#define __sys_open2(x,pn,fl) __syscall3(SYS_openat, AT_FDCWD, pn, (fl)|O_LARGEFILE) +#define __sys_open3(x,pn,fl,mo) __syscall4(SYS_openat, AT_FDCWD, pn, (fl)|O_LARGEFILE, mo) +#define __sys_open_cp2(x,pn,fl) __syscall_cp3(SYS_openat, AT_FDCWD, pn, (fl)|O_LARGEFILE) +#define __sys_open_cp3(x,pn,fl,mo) __syscall_cp4(SYS_openat, AT_FDCWD, pn, (fl)|O_LARGEFILE, mo) +#endif + +#define __sys_open(...) __SYSCALL_DISP(__sys_open,,__VA_ARGS__) +#define sys_open(...) __syscall_ret(__sys_open(__VA_ARGS__)) + +#define __sys_open_cp(...) __SYSCALL_DISP(__sys_open_cp,,__VA_ARGS__) +#define sys_open_cp(...) __syscall_ret(__sys_open_cp(__VA_ARGS__)) + +hidden void __procfdname(char __buf[static 15+3*sizeof(int)], unsigned); + +hidden void *__vdsosym(const char *, const char *); + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/src/locale/Makefile b/Ubiquitous/XiZi/lib/musllib/src/locale/Makefile new file mode 100644 index 000000000..8ee05a31d --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/locale/Makefile @@ -0,0 +1,5 @@ +SRC_FILES := __lctrans.c c_locale.c iconv.c langinfo.c + + + +include $(KERNEL_ROOT)/compiler.mk \ No newline at end of file diff --git a/Ubiquitous/XiZi/lib/musllib/src/locale/__lctrans.c b/Ubiquitous/XiZi/lib/musllib/src/locale/__lctrans.c new file mode 100644 index 000000000..9fbe762ad --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/locale/__lctrans.c @@ -0,0 +1,19 @@ +#include +#include "locale_impl.h" + +static const char *dummy(const char *msg, const struct __locale_map *lm) +{ + return msg; +} + +weak_alias(dummy, __lctrans_impl); + +const char *__lctrans(const char *msg, const struct __locale_map *lm) +{ + return __lctrans_impl(msg, lm); +} + +const char *__lctrans_cur(const char *msg) +{ + return __lctrans_impl(msg, CURRENT_LOCALE->cat[LC_MESSAGES]); +} diff --git a/Ubiquitous/XiZi/lib/musllib/src/locale/big5.h b/Ubiquitous/XiZi/lib/musllib/src/locale/big5.h new file mode 100644 index 000000000..332ea3bc5 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/locale/big5.h @@ -0,0 +1,1085 @@ +12288,65292,12289,12290,65294,8231,65307,65306,65311,65281,65072,8230,8229, +65104,65105,65106,183,65108,65109,65110,65111,65372,8211,65073,8212,65075, +9588,65076,65103,65288,65289,65077,65078,65371,65373,65079,65080,12308,12309, +65081,65082,12304,12305,65083,65084,12298,12299,65085,65086,12296,12297,65087, +65088,12300,12301,65089,65090,12302,12303,65091,65092,65113,65114,65115,65116, +65117,65118,8216,8217,8220,8221,12317,12318,8245,8242,65283,65286,65290,8251, +167,12291,9675,9679,9651,9650,9678,9734,9733,9671,9670,9633,9632,9661,9660, +12963,8453,175,65507,65343,717,65097,65098,65101,65102,65099,65100,65119, +65120,65121,65291,65293,215,247,177,8730,65308,65310,65309,8806,8807,8800, +8734,8786,8801,65122,65123,65124,65125,65126,65374,8745,8746,8869,8736,8735, +8895,13266,13265,8747,8750,8757,8756,9792,9794,8853,8857,8593,8595,8592,8594, +8598,8599,8601,8600,8741,8739,65295,65340,8725,65128,65284,65509,12306,65504, +65505,65285,65312,8451,8457,65129,65130,65131,13269,13212,13213,13214,13262, +13217,13198,13199,13252,176,20825,20827,20830,20829,20833,20835,21991,29929, +31950,9601,9602,9603,9604,9605,9606,9607,9608,9615,9614,9613,9612,9611,9610, +9609,9532,9524,9516,9508,9500,9620,9472,9474,9621,9484,9488,9492,9496,9581, +9582,9584,9583,9552,9566,9578,9569,9698,9699,9701,9700,9585,9586,9587,65296, +65297,65298,65299,65300,65301,65302,65303,65304,65305,8544,8545,8546,8547, +8548,8549,8550,8551,8552,8553,12321, +12322,12323,12324,12325,12326,12327,12328,12329,21313,21316,21317,65313,65314, +65315,65316,65317,65318,65319,65320,65321,65322,65323,65324,65325,65326,65327, +65328,65329,65330,65331,65332,65333,65334,65335,65336,65337,65338,65345,65346, +65347,65348,65349,65350,65351,65352,65353,65354,65355,65356,65357,65358,65359, +65360,65361,65362,65363,65364,65365,65366,65367,65368,65369,65370,913,914,915, +916,917,918,919,920,921,922,923,924,925,926,927,928,929,931,932,933,934,935, +936,937,945,946,947,948,949,950,951,952,953,954,955,956,957,958,959,960,961, +963,964,965,966,967,968,969,12549,12550,12551,12552,12553,12554,12555,12556, +12557,12558,12559,12560,12561,12562,12563,12564,12565,12566,12567,12568,12569, +12570,12571,12572,12573,12574,12575,12576,12577,12578,12579,12580,12581,12582, +12583,12584,12585,729,713,714,711,715,9216,9217,9218,9219,9220,9221,9222,9223, +9224,9225,9226,9227,9228,9229,9230,9231,9232,9233,9234,9235,9236,9237,9238, +9239,9240,9241,9242,9243,9244,9245,9246,9247,9249,8364,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19968,20057,19969,19971,20035,20061,20102, +20108,20154,20799,20837,20843,20960,20992,20993,21147,21269,21313,21340,21448, +19977,19979,19976,19978,20011,20024,20961,20037,20040,20063,20062,20110,20129, +20800,20995,21242,21315,21449,21475,22303, +22763,22805,22823,22899,23376,23377,23379,23544,23567,23586,23608,23665,24029, +24037,24049,24050,24051,24062,24178,24318,24331,24339,25165,19985,19984,19981, +20013,20016,20025,20043,23609,20104,20113,20117,20114,20116,20130,20161,20160, +20163,20166,20167,20173,20170,20171,20164,20803,20801,20839,20845,20846,20844, +20887,20982,20998,20999,21000,21243,21246,21247,21270,21305,21320,21319,21317, +21342,21380,21451,21450,21453,22764,22825,22827,22826,22829,23380,23569,23588, +23610,23663,24052,24187,24319,24340,24341,24515,25096,25142,25163,25166,25903, +25991,26007,26020,26041,26085,26352,26376,26408,27424,27490,27513,27595,27604, +27611,27663,27700,28779,29226,29238,29243,29255,29273,29275,29356,29579,19993, +19990,19989,19988,19992,20027,20045,20047,20046,20197,20184,20180,20181,20182, +20183,20195,20196,20185,20190,20805,20804,20873,20874,20908,20985,20986,20984, +21002,21152,21151,21253,21254,21271,21277,20191,21322,21321,21345,21344,21359, +21358,21435,21487,21476,21491,21484,21486,21481,21480,21500,21496,21493,21483, +21478,21482,21490,21489,21488,21477,21485,21499,22235,22234,22806,22830,22833, +22900,22902,23381,23427,23612,24040,24039,24038,24066,24067,24179,24188,24321, +24344,24343,24517,25098,25171,25172,25170,25169,26021,26086,26414,26412,26410, +26411,26413,27491,27597,27665,27664,27704,27713,27712,27710,29359,29572,29577, +29916,29926,29976,29983,29992,29993,30000,30001,30002,30003,30091,30333,30382, +30399,30446,30683,30690,30707,31034,31166,31348,31435,19998,19999,20050,20051, +20073,20121,20132,20134,20133,20223,20233,20249,20234, +20245,20237,20240,20241,20239,20210,20214,20219,20208,20211,20221,20225,20235, +20809,20807,20806,20808,20840,20849,20877,20912,21015,21009,21010,21006,21014, +21155,21256,21281,21280,21360,21361,21513,21519,21516,21514,21520,21505,21515, +21508,21521,21517,21512,21507,21518,21510,21522,22240,22238,22237,22323,22320, +22312,22317,22316,22319,22313,22809,22810,22839,22840,22916,22904,22915,22909, +22905,22914,22913,23383,23384,23431,23432,23429,23433,23546,23574,23673,24030, +24070,24182,24180,24335,24347,24537,24534,25102,25100,25101,25104,25187,25179, +25176,25910,26089,26088,26092,26093,26354,26355,26377,26429,26420,26417,26421, +27425,27492,27515,27670,27741,27735,27737,27743,27744,27728,27733,27745,27739, +27725,27726,28784,29279,29277,30334,31481,31859,31992,32566,32650,32701,32769, +32771,32780,32786,32819,32895,32905,32907,32908,33251,33258,33267,33276,33292, +33307,33311,33390,33394,33406,34411,34880,34892,34915,35199,38433,20018,20136, +20301,20303,20295,20311,20318,20276,20315,20309,20272,20304,20305,20285,20282, +20280,20291,20308,20284,20294,20323,20316,20320,20271,20302,20278,20313,20317, +20296,20314,20812,20811,20813,20853,20918,20919,21029,21028,21033,21034,21032, +21163,21161,21162,21164,21283,21363,21365,21533,21549,21534,21566,21542,21582, +21543,21574,21571,21555,21576,21570,21531,21545,21578,21561,21563,21560,21550, +21557,21558,21536,21564,21568,21553,21547,21535,21548,22250,22256,22244,22251, +22346,22353,22336,22349,22343,22350,22334,22352,22351,22331,22767,22846,22941, +22930,22952,22942,22947,22937,22934,22925,22948,22931, +22922,22949,23389,23388,23386,23387,23436,23435,23439,23596,23616,23617,23615, +23614,23696,23697,23700,23692,24043,24076,24207,24199,24202,24311,24324,24351, +24420,24418,24439,24441,24536,24524,24535,24525,24561,24555,24568,24554,25106, +25105,25220,25239,25238,25216,25206,25225,25197,25226,25212,25214,25209,25203, +25234,25199,25240,25198,25237,25235,25233,25222,25913,25915,25912,26097,26356, +26463,26446,26447,26448,26449,26460,26454,26462,26441,26438,26464,26451,26455, +27493,27599,27714,27742,27801,27777,27784,27785,27781,27803,27754,27770,27792, +27760,27788,27752,27798,27794,27773,27779,27762,27774,27764,27782,27766,27789, +27796,27800,27778,28790,28796,28797,28792,29282,29281,29280,29380,29378,29590, +29996,29995,30007,30008,30338,30447,30691,31169,31168,31167,31350,31995,32597, +32918,32915,32925,32920,32923,32922,32946,33391,33426,33419,33421,35211,35282, +35328,35895,35910,35925,35997,36196,36208,36275,36523,36554,36763,36784,36802, +36806,36805,36804,24033,37009,37026,37034,37030,37027,37193,37318,37324,38450, +38446,38449,38442,38444,20006,20054,20083,20107,20123,20126,20139,20140,20335, +20381,20365,20339,20351,20332,20379,20363,20358,20355,20336,20341,20360,20329, +20347,20374,20350,20367,20369,20346,20820,20818,20821,20841,20855,20854,20856, +20925,20989,21051,21048,21047,21050,21040,21038,21046,21057,21182,21179,21330, +21332,21331,21329,21350,21367,21368,21369,21462,21460,21463,21619,21621,21654, +21624,21653,21632,21627,21623,21636,21650,21638,21628,21648,21617,21622,21644, +21658,21602,21608,21643,21629,21646,22266,22403,22391, +22378,22377,22369,22374,22372,22396,22812,22857,22855,22856,22852,22868,22974, +22971,22996,22969,22958,22993,22982,22992,22989,22987,22995,22986,22959,22963, +22994,22981,23391,23396,23395,23447,23450,23448,23452,23449,23451,23578,23624, +23621,23622,23735,23713,23736,23721,23723,23729,23731,24088,24090,24086,24085, +24091,24081,24184,24218,24215,24220,24213,24214,24310,24358,24359,24361,24448, +24449,24447,24444,24541,24544,24573,24565,24575,24591,24596,24623,24629,24598, +24618,24597,24609,24615,24617,24619,24603,25110,25109,25151,25150,25152,25215, +25289,25292,25284,25279,25282,25273,25298,25307,25259,25299,25300,25291,25288, +25256,25277,25276,25296,25305,25287,25293,25269,25306,25265,25304,25302,25303, +25286,25260,25294,25918,26023,26044,26106,26132,26131,26124,26118,26114,26126, +26112,26127,26133,26122,26119,26381,26379,26477,26507,26517,26481,26524,26483, +26487,26503,26525,26519,26479,26480,26495,26505,26494,26512,26485,26522,26515, +26492,26474,26482,27427,27494,27495,27519,27667,27675,27875,27880,27891,27825, +27852,27877,27827,27837,27838,27836,27874,27819,27861,27859,27832,27844,27833, +27841,27822,27863,27845,27889,27839,27835,27873,27867,27850,27820,27887,27868, +27862,27872,28821,28814,28818,28810,28825,29228,29229,29240,29256,29287,29289, +29376,29390,29401,29399,29392,29609,29608,29599,29611,29605,30013,30109,30105, +30106,30340,30402,30450,30452,30693,30717,31038,31040,31041,31177,31176,31354, +31353,31482,31998,32596,32652,32651,32773,32954,32933,32930,32945,32929,32939, +32937,32948,32938,32943,33253,33278,33293,33459,33437, +33433,33453,33469,33439,33465,33457,33452,33445,33455,33464,33443,33456,33470, +33463,34382,34417,21021,34920,36555,36814,36820,36817,37045,37048,37041,37046, +37319,37329,38263,38272,38428,38464,38463,38459,38468,38466,38585,38632,38738, +38750,20127,20141,20142,20449,20405,20399,20415,20448,20433,20431,20445,20419, +20406,20440,20447,20426,20439,20398,20432,20420,20418,20442,20430,20446,20407, +20823,20882,20881,20896,21070,21059,21066,21069,21068,21067,21063,21191,21193, +21187,21185,21261,21335,21371,21402,21467,21676,21696,21672,21710,21705,21688, +21670,21683,21703,21698,21693,21674,21697,21700,21704,21679,21675,21681,21691, +21673,21671,21695,22271,22402,22411,22432,22435,22434,22478,22446,22419,22869, +22865,22863,22862,22864,23004,23000,23039,23011,23016,23043,23013,23018,23002, +23014,23041,23035,23401,23459,23462,23460,23458,23461,23553,23630,23631,23629, +23627,23769,23762,24055,24093,24101,24095,24189,24224,24230,24314,24328,24365, +24421,24456,24453,24458,24459,24455,24460,24457,24594,24605,24608,24613,24590, +24616,24653,24688,24680,24674,24646,24643,24684,24683,24682,24676,25153,25308, +25366,25353,25340,25325,25345,25326,25341,25351,25329,25335,25327,25324,25342, +25332,25361,25346,25919,25925,26027,26045,26082,26149,26157,26144,26151,26159, +26143,26152,26161,26148,26359,26623,26579,26609,26580,26576,26604,26550,26543, +26613,26601,26607,26564,26577,26548,26586,26597,26552,26575,26590,26611,26544, +26585,26594,26589,26578,27498,27523,27526,27573,27602,27607,27679,27849,27915, +27954,27946,27969,27941,27916,27953,27934,27927,27963, +27965,27966,27958,27931,27893,27961,27943,27960,27945,27950,27957,27918,27947, +28843,28858,28851,28844,28847,28845,28856,28846,28836,29232,29298,29295,29300, +29417,29408,29409,29623,29642,29627,29618,29645,29632,29619,29978,29997,30031, +30028,30030,30027,30123,30116,30117,30114,30115,30328,30342,30343,30344,30408, +30406,30403,30405,30465,30457,30456,30473,30475,30462,30460,30471,30684,30722, +30740,30732,30733,31046,31049,31048,31047,31161,31162,31185,31186,31179,31359, +31361,31487,31485,31869,32002,32005,32000,32009,32007,32004,32006,32568,32654, +32703,32772,32784,32781,32785,32822,32982,32997,32986,32963,32964,32972,32993, +32987,32974,32990,32996,32989,33268,33314,33511,33539,33541,33507,33499,33510, +33540,33509,33538,33545,33490,33495,33521,33537,33500,33492,33489,33502,33491, +33503,33519,33542,34384,34425,34427,34426,34893,34923,35201,35284,35336,35330, +35331,35998,36000,36212,36211,36276,36557,36556,36848,36838,36834,36842,36837, +36845,36843,36836,36840,37066,37070,37057,37059,37195,37194,37325,38274,38480, +38475,38476,38477,38754,38761,38859,38893,38899,38913,39080,39131,39135,39318, +39321,20056,20147,20492,20493,20515,20463,20518,20517,20472,20521,20502,20486, +20540,20511,20506,20498,20497,20474,20480,20500,20520,20465,20513,20491,20505, +20504,20467,20462,20525,20522,20478,20523,20489,20860,20900,20901,20898,20941, +20940,20934,20939,21078,21084,21076,21083,21085,21290,21375,21407,21405,21471, +21736,21776,21761,21815,21756,21733,21746,21766,21754,21780,21737,21741,21729, +21769,21742,21738,21734,21799,21767,21757,21775,22275, +22276,22466,22484,22475,22467,22537,22799,22871,22872,22874,23057,23064,23068, +23071,23067,23059,23020,23072,23075,23081,23077,23052,23049,23403,23640,23472, +23475,23478,23476,23470,23477,23481,23480,23556,23633,23637,23632,23789,23805, +23803,23786,23784,23792,23798,23809,23796,24046,24109,24107,24235,24237,24231, +24369,24466,24465,24464,24665,24675,24677,24656,24661,24685,24681,24687,24708, +24735,24730,24717,24724,24716,24709,24726,25159,25331,25352,25343,25422,25406, +25391,25429,25410,25414,25423,25417,25402,25424,25405,25386,25387,25384,25421, +25420,25928,25929,26009,26049,26053,26178,26185,26191,26179,26194,26188,26181, +26177,26360,26388,26389,26391,26657,26680,26696,26694,26707,26681,26690,26708, +26665,26803,26647,26700,26705,26685,26612,26704,26688,26684,26691,26666,26693, +26643,26648,26689,27530,27529,27575,27683,27687,27688,27686,27684,27888,28010, +28053,28040,28039,28006,28024,28023,27993,28051,28012,28041,28014,27994,28020, +28009,28044,28042,28025,28037,28005,28052,28874,28888,28900,28889,28872,28879, +29241,29305,29436,29433,29437,29432,29431,29574,29677,29705,29678,29664,29674, +29662,30036,30045,30044,30042,30041,30142,30149,30151,30130,30131,30141,30140, +30137,30146,30136,30347,30384,30410,30413,30414,30505,30495,30496,30504,30697, +30768,30759,30776,30749,30772,30775,30757,30765,30752,30751,30770,31061,31056, +31072,31071,31062,31070,31069,31063,31066,31204,31203,31207,31199,31206,31209, +31192,31364,31368,31449,31494,31505,31881,32033,32023,32011,32010,32032,32034, +32020,32016,32021,32026,32028,32013,32025,32027,32570, +32607,32660,32709,32705,32774,32792,32789,32793,32791,32829,32831,33009,33026, +33008,33029,33005,33012,33030,33016,33011,33032,33021,33034,33020,33007,33261, +33260,33280,33296,33322,33323,33320,33324,33467,33579,33618,33620,33610,33592, +33616,33609,33589,33588,33615,33586,33593,33590,33559,33600,33585,33576,33603, +34388,34442,34474,34451,34468,34473,34444,34467,34460,34928,34935,34945,34946, +34941,34937,35352,35344,35342,35340,35349,35338,35351,35347,35350,35343,35345, +35912,35962,35961,36001,36002,36215,36524,36562,36564,36559,36785,36865,36870, +36855,36864,36858,36852,36867,36861,36869,36856,37013,37089,37085,37090,37202, +37197,37196,37336,37341,37335,37340,37337,38275,38498,38499,38497,38491,38493, +38500,38488,38494,38587,39138,39340,39592,39640,39717,39730,39740,20094,20602, +20605,20572,20551,20547,20556,20570,20553,20581,20598,20558,20565,20597,20596, +20599,20559,20495,20591,20589,20828,20885,20976,21098,21103,21202,21209,21208, +21205,21264,21263,21273,21311,21312,21310,21443,26364,21830,21866,21862,21828, +21854,21857,21827,21834,21809,21846,21839,21845,21807,21860,21816,21806,21852, +21804,21859,21811,21825,21847,22280,22283,22281,22495,22533,22538,22534,22496, +22500,22522,22530,22581,22519,22521,22816,22882,23094,23105,23113,23142,23146, +23104,23100,23138,23130,23110,23114,23408,23495,23493,23492,23490,23487,23494, +23561,23560,23559,23648,23644,23645,23815,23814,23822,23835,23830,23842,23825, +23849,23828,23833,23844,23847,23831,24034,24120,24118,24115,24119,24247,24248, +24246,24245,24254,24373,24375,24407,24428,24425,24427, +24471,24473,24478,24472,24481,24480,24476,24703,24739,24713,24736,24744,24779, +24756,24806,24765,24773,24763,24757,24796,24764,24792,24789,24774,24799,24760, +24794,24775,25114,25115,25160,25504,25511,25458,25494,25506,25509,25463,25447, +25496,25514,25457,25513,25481,25475,25499,25451,25512,25476,25480,25497,25505, +25516,25490,25487,25472,25467,25449,25448,25466,25949,25942,25937,25945,25943, +21855,25935,25944,25941,25940,26012,26011,26028,26063,26059,26060,26062,26205, +26202,26212,26216,26214,26206,26361,21207,26395,26753,26799,26786,26771,26805, +26751,26742,26801,26791,26775,26800,26755,26820,26797,26758,26757,26772,26781, +26792,26783,26785,26754,27442,27578,27627,27628,27691,28046,28092,28147,28121, +28082,28129,28108,28132,28155,28154,28165,28103,28107,28079,28113,28078,28126, +28153,28088,28151,28149,28101,28114,28186,28085,28122,28139,28120,28138,28145, +28142,28136,28102,28100,28074,28140,28095,28134,28921,28937,28938,28925,28911, +29245,29309,29313,29468,29467,29462,29459,29465,29575,29701,29706,29699,29702, +29694,29709,29920,29942,29943,29980,29986,30053,30054,30050,30064,30095,30164, +30165,30133,30154,30157,30350,30420,30418,30427,30519,30526,30524,30518,30520, +30522,30827,30787,30798,31077,31080,31085,31227,31378,31381,31520,31528,31515, +31532,31526,31513,31518,31534,31890,31895,31893,32070,32067,32113,32046,32057, +32060,32064,32048,32051,32068,32047,32066,32050,32049,32573,32670,32666,32716, +32718,32722,32796,32842,32838,33071,33046,33059,33067,33065,33072,33060,33282, +33333,33335,33334,33337,33678,33694,33688,33656,33698, +33686,33725,33707,33682,33674,33683,33673,33696,33655,33659,33660,33670,33703, +34389,24426,34503,34496,34486,34500,34485,34502,34507,34481,34479,34505,34899, +34974,34952,34987,34962,34966,34957,34955,35219,35215,35370,35357,35363,35365, +35377,35373,35359,35355,35362,35913,35930,36009,36012,36011,36008,36010,36007, +36199,36198,36286,36282,36571,36575,36889,36877,36890,36887,36899,36895,36893, +36880,36885,36894,36896,36879,36898,36886,36891,36884,37096,37101,37117,37207, +37326,37365,37350,37347,37351,37357,37353,38281,38506,38517,38515,38520,38512, +38516,38518,38519,38508,38592,38634,38633,31456,31455,38914,38915,39770,40165, +40565,40575,40613,40635,20642,20621,20613,20633,20625,20608,20630,20632,20634, +26368,20977,21106,21108,21109,21097,21214,21213,21211,21338,21413,21883,21888, +21927,21884,21898,21917,21912,21890,21916,21930,21908,21895,21899,21891,21939, +21934,21919,21822,21938,21914,21947,21932,21937,21886,21897,21931,21913,22285, +22575,22570,22580,22564,22576,22577,22561,22557,22560,22777,22778,22880,23159, +23194,23167,23186,23195,23207,23411,23409,23506,23500,23507,23504,23562,23563, +23601,23884,23888,23860,23879,24061,24133,24125,24128,24131,24190,24266,24257, +24258,24260,24380,24429,24489,24490,24488,24785,24801,24754,24758,24800,24860, +24867,24826,24853,24816,24827,24820,24936,24817,24846,24822,24841,24832,24850, +25119,25161,25507,25484,25551,25536,25577,25545,25542,25549,25554,25571,25552, +25569,25558,25581,25582,25462,25588,25578,25563,25682,25562,25593,25950,25958, +25954,25955,26001,26000,26031,26222,26224,26228,26230, +26223,26257,26234,26238,26231,26366,26367,26399,26397,26874,26837,26848,26840, +26839,26885,26847,26869,26862,26855,26873,26834,26866,26851,26827,26829,26893, +26898,26894,26825,26842,26990,26875,27454,27450,27453,27544,27542,27580,27631, +27694,27695,27692,28207,28216,28244,28193,28210,28263,28234,28192,28197,28195, +28187,28251,28248,28196,28246,28270,28205,28198,28271,28212,28237,28218,28204, +28227,28189,28222,28363,28297,28185,28238,28259,28228,28274,28265,28255,28953, +28954,28966,28976,28961,28982,29038,28956,29260,29316,29312,29494,29477,29492, +29481,29754,29738,29747,29730,29733,29749,29750,29748,29743,29723,29734,29736, +29989,29990,30059,30058,30178,30171,30179,30169,30168,30174,30176,30331,30332, +30358,30355,30388,30428,30543,30701,30813,30828,30831,31245,31240,31243,31237, +31232,31384,31383,31382,31461,31459,31561,31574,31558,31568,31570,31572,31565, +31563,31567,31569,31903,31909,32094,32080,32104,32085,32043,32110,32114,32097, +32102,32098,32112,32115,21892,32724,32725,32779,32850,32901,33109,33108,33099, +33105,33102,33081,33094,33086,33100,33107,33140,33298,33308,33769,33795,33784, +33805,33760,33733,33803,33729,33775,33777,33780,33879,33802,33776,33804,33740, +33789,33778,33738,33848,33806,33796,33756,33799,33748,33759,34395,34527,34521, +34541,34516,34523,34532,34512,34526,34903,35009,35010,34993,35203,35222,35387, +35424,35413,35422,35388,35393,35412,35419,35408,35398,35380,35386,35382,35414, +35937,35970,36015,36028,36019,36029,36033,36027,36032,36020,36023,36022,36031, +36024,36234,36229,36225,36302,36317,36299,36314,36305, +36300,36315,36294,36603,36600,36604,36764,36910,36917,36913,36920,36914,36918, +37122,37109,37129,37118,37219,37221,37327,37396,37397,37411,37385,37406,37389, +37392,37383,37393,38292,38287,38283,38289,38291,38290,38286,38538,38542,38539, +38525,38533,38534,38541,38514,38532,38593,38597,38596,38598,38599,38639,38642, +38860,38917,38918,38920,39143,39146,39151,39145,39154,39149,39342,39341,40643, +40653,40657,20098,20653,20661,20658,20659,20677,20670,20652,20663,20667,20655, +20679,21119,21111,21117,21215,21222,21220,21218,21219,21295,21983,21992,21971, +21990,21966,21980,21959,21969,21987,21988,21999,21978,21985,21957,21958,21989, +21961,22290,22291,22622,22609,22616,22615,22618,22612,22635,22604,22637,22602, +22626,22610,22603,22887,23233,23241,23244,23230,23229,23228,23219,23234,23218, +23913,23919,24140,24185,24265,24264,24338,24409,24492,24494,24858,24847,24904, +24863,24819,24859,24825,24833,24840,24910,24908,24900,24909,24894,24884,24871, +24845,24838,24887,25121,25122,25619,25662,25630,25642,25645,25661,25644,25615, +25628,25620,25613,25654,25622,25623,25606,25964,26015,26032,26263,26249,26247, +26248,26262,26244,26264,26253,26371,27028,26989,26970,26999,26976,26964,26997, +26928,27010,26954,26984,26987,26974,26963,27001,27014,26973,26979,26971,27463, +27506,27584,27583,27603,27645,28322,28335,28371,28342,28354,28304,28317,28359, +28357,28325,28312,28348,28346,28331,28369,28310,28316,28356,28372,28330,28327, +28340,29006,29017,29033,29028,29001,29031,29020,29036,29030,29004,29029,29022, +28998,29032,29014,29242,29266,29495,29509,29503,29502, +29807,29786,29781,29791,29790,29761,29759,29785,29787,29788,30070,30072,30208, +30192,30209,30194,30193,30202,30207,30196,30195,30430,30431,30555,30571,30566, +30558,30563,30585,30570,30572,30556,30565,30568,30562,30702,30862,30896,30871, +30872,30860,30857,30844,30865,30867,30847,31098,31103,31105,33836,31165,31260, +31258,31264,31252,31263,31262,31391,31392,31607,31680,31584,31598,31591,31921, +31923,31925,32147,32121,32145,32129,32143,32091,32622,32617,32618,32626,32681, +32680,32676,32854,32856,32902,32900,33137,33136,33144,33125,33134,33139,33131, +33145,33146,33126,33285,33351,33922,33911,33853,33841,33909,33894,33899,33865, +33900,33883,33852,33845,33889,33891,33897,33901,33862,34398,34396,34399,34553, +34579,34568,34567,34560,34558,34555,34562,34563,34566,34570,34905,35039,35028, +35033,35036,35032,35037,35041,35018,35029,35026,35228,35299,35435,35442,35443, +35430,35433,35440,35463,35452,35427,35488,35441,35461,35437,35426,35438,35436, +35449,35451,35390,35432,35938,35978,35977,36042,36039,36040,36036,36018,36035, +36034,36037,36321,36319,36328,36335,36339,36346,36330,36324,36326,36530,36611, +36617,36606,36618,36767,36786,36939,36938,36947,36930,36948,36924,36949,36944, +36935,36943,36942,36941,36945,36926,36929,37138,37143,37228,37226,37225,37321, +37431,37463,37432,37437,37440,37438,37467,37451,37476,37457,37428,37449,37453, +37445,37433,37439,37466,38296,38552,38548,38549,38605,38603,38601,38602,38647, +38651,38649,38646,38742,38772,38774,38928,38929,38931,38922,38930,38924,39164, +39156,39165,39166,39347,39345,39348,39649,40169,40578, +40718,40723,40736,20711,20718,20709,20694,20717,20698,20693,20687,20689,20721, +20686,20713,20834,20979,21123,21122,21297,21421,22014,22016,22043,22039,22013, +22036,22022,22025,22029,22030,22007,22038,22047,22024,22032,22006,22296,22294, +22645,22654,22659,22675,22666,22649,22661,22653,22781,22821,22818,22820,22890, +22889,23265,23270,23273,23255,23254,23256,23267,23413,23518,23527,23521,23525, +23526,23528,23522,23524,23519,23565,23650,23940,23943,24155,24163,24149,24151, +24148,24275,24278,24330,24390,24432,24505,24903,24895,24907,24951,24930,24931, +24927,24922,24920,24949,25130,25735,25688,25684,25764,25720,25695,25722,25681, +25703,25652,25709,25723,25970,26017,26071,26070,26274,26280,26269,27036,27048, +27029,27073,27054,27091,27083,27035,27063,27067,27051,27060,27088,27085,27053, +27084,27046,27075,27043,27465,27468,27699,28467,28436,28414,28435,28404,28457, +28478,28448,28460,28431,28418,28450,28415,28399,28422,28465,28472,28466,28451, +28437,28459,28463,28552,28458,28396,28417,28402,28364,28407,29076,29081,29053, +29066,29060,29074,29246,29330,29334,29508,29520,29796,29795,29802,29808,29805, +29956,30097,30247,30221,30219,30217,30227,30433,30435,30596,30589,30591,30561, +30913,30879,30887,30899,30889,30883,31118,31119,31117,31278,31281,31402,31401, +31469,31471,31649,31637,31627,31605,31639,31645,31636,31631,31672,31623,31620, +31929,31933,31934,32187,32176,32156,32189,32190,32160,32202,32180,32178,32177, +32186,32162,32191,32181,32184,32173,32210,32199,32172,32624,32736,32737,32735, +32862,32858,32903,33104,33152,33167,33160,33162,33151, +33154,33255,33274,33287,33300,33310,33355,33993,33983,33990,33988,33945,33950, +33970,33948,33995,33976,33984,34003,33936,33980,34001,33994,34623,34588,34619, +34594,34597,34612,34584,34645,34615,34601,35059,35074,35060,35065,35064,35069, +35048,35098,35055,35494,35468,35486,35491,35469,35489,35475,35492,35498,35493, +35496,35480,35473,35482,35495,35946,35981,35980,36051,36049,36050,36203,36249, +36245,36348,36628,36626,36629,36627,36771,36960,36952,36956,36963,36953,36958, +36962,36957,36955,37145,37144,37150,37237,37240,37239,37236,37496,37504,37509, +37528,37526,37499,37523,37532,37544,37500,37521,38305,38312,38313,38307,38309, +38308,38553,38556,38555,38604,38610,38656,38780,38789,38902,38935,38936,39087, +39089,39171,39173,39180,39177,39361,39599,39600,39654,39745,39746,40180,40182, +40179,40636,40763,40778,20740,20736,20731,20725,20729,20738,20744,20745,20741, +20956,21127,21128,21129,21133,21130,21232,21426,22062,22075,22073,22066,22079, +22068,22057,22099,22094,22103,22132,22070,22063,22064,22656,22687,22686,22707, +22684,22702,22697,22694,22893,23305,23291,23307,23285,23308,23304,23534,23532, +23529,23531,23652,23653,23965,23956,24162,24159,24161,24290,24282,24287,24285, +24291,24288,24392,24433,24503,24501,24950,24935,24942,24925,24917,24962,24956, +24944,24939,24958,24999,24976,25003,24974,25004,24986,24996,24980,25006,25134, +25705,25711,25721,25758,25778,25736,25744,25776,25765,25747,25749,25769,25746, +25774,25773,25771,25754,25772,25753,25762,25779,25973,25975,25976,26286,26283, +26292,26289,27171,27167,27112,27137,27166,27161,27133, +27169,27155,27146,27123,27138,27141,27117,27153,27472,27470,27556,27589,27590, +28479,28540,28548,28497,28518,28500,28550,28525,28507,28536,28526,28558,28538, +28528,28516,28567,28504,28373,28527,28512,28511,29087,29100,29105,29096,29270, +29339,29518,29527,29801,29835,29827,29822,29824,30079,30240,30249,30239,30244, +30246,30241,30242,30362,30394,30436,30606,30599,30604,30609,30603,30923,30917, +30906,30922,30910,30933,30908,30928,31295,31292,31296,31293,31287,31291,31407, +31406,31661,31665,31684,31668,31686,31687,31681,31648,31692,31946,32224,32244, +32239,32251,32216,32236,32221,32232,32227,32218,32222,32233,32158,32217,32242, +32249,32629,32631,32687,32745,32806,33179,33180,33181,33184,33178,33176,34071, +34109,34074,34030,34092,34093,34067,34065,34083,34081,34068,34028,34085,34047, +34054,34690,34676,34678,34656,34662,34680,34664,34649,34647,34636,34643,34907, +34909,35088,35079,35090,35091,35093,35082,35516,35538,35527,35524,35477,35531, +35576,35506,35529,35522,35519,35504,35542,35533,35510,35513,35547,35916,35918, +35948,36064,36062,36070,36068,36076,36077,36066,36067,36060,36074,36065,36205, +36255,36259,36395,36368,36381,36386,36367,36393,36383,36385,36382,36538,36637, +36635,36639,36649,36646,36650,36636,36638,36645,36969,36974,36968,36973,36983, +37168,37165,37159,37169,37255,37257,37259,37251,37573,37563,37559,37610,37548, +37604,37569,37555,37564,37586,37575,37616,37554,38317,38321,38660,38662,38663, +38665,38752,38797,38795,38799,38945,38955,38940,39091,39178,39187,39186,39192, +39389,39376,39391,39387,39377,39381,39378,39385,39607, +39662,39663,39719,39749,39748,39799,39791,40198,40201,40195,40617,40638,40654, +22696,40786,20754,20760,20756,20752,20757,20864,20906,20957,21137,21139,21235, +22105,22123,22137,22121,22116,22136,22122,22120,22117,22129,22127,22124,22114, +22134,22721,22718,22727,22725,22894,23325,23348,23416,23536,23566,24394,25010, +24977,25001,24970,25037,25014,25022,25034,25032,25136,25797,25793,25803,25787, +25788,25818,25796,25799,25794,25805,25791,25810,25812,25790,25972,26310,26313, +26297,26308,26311,26296,27197,27192,27194,27225,27243,27224,27193,27204,27234, +27233,27211,27207,27189,27231,27208,27481,27511,27653,28610,28593,28577,28611, +28580,28609,28583,28595,28608,28601,28598,28582,28576,28596,29118,29129,29136, +29138,29128,29141,29113,29134,29145,29148,29123,29124,29544,29852,29859,29848, +29855,29854,29922,29964,29965,30260,30264,30266,30439,30437,30624,30622,30623, +30629,30952,30938,30956,30951,31142,31309,31310,31302,31308,31307,31418,31705, +31761,31689,31716,31707,31713,31721,31718,31957,31958,32266,32273,32264,32283, +32291,32286,32285,32265,32272,32633,32690,32752,32753,32750,32808,33203,33193, +33192,33275,33288,33368,33369,34122,34137,34120,34152,34153,34115,34121,34157, +34154,34142,34691,34719,34718,34722,34701,34913,35114,35122,35109,35115,35105, +35242,35238,35558,35578,35563,35569,35584,35548,35559,35566,35582,35585,35586, +35575,35565,35571,35574,35580,35947,35949,35987,36084,36420,36401,36404,36418, +36409,36405,36667,36655,36664,36659,36776,36774,36981,36980,36984,36978,36988, +36986,37172,37266,37664,37686,37624,37683,37679,37666, +37628,37675,37636,37658,37648,37670,37665,37653,37678,37657,38331,38567,38568, +38570,38613,38670,38673,38678,38669,38675,38671,38747,38748,38758,38808,38960, +38968,38971,38967,38957,38969,38948,39184,39208,39198,39195,39201,39194,39405, +39394,39409,39608,39612,39675,39661,39720,39825,40213,40227,40230,40232,40210, +40219,40664,40660,40845,40860,20778,20767,20769,20786,21237,22158,22144,22160, +22149,22151,22159,22741,22739,22737,22734,23344,23338,23332,23418,23607,23656, +23996,23994,23997,23992,24171,24396,24509,25033,25026,25031,25062,25035,25138, +25140,25806,25802,25816,25824,25840,25830,25836,25841,25826,25837,25986,25987, +26329,26326,27264,27284,27268,27298,27292,27355,27299,27262,27287,27280,27296, +27484,27566,27610,27656,28632,28657,28639,28640,28635,28644,28651,28655,28544, +28652,28641,28649,28629,28654,28656,29159,29151,29166,29158,29157,29165,29164, +29172,29152,29237,29254,29552,29554,29865,29872,29862,29864,30278,30274,30284, +30442,30643,30634,30640,30636,30631,30637,30703,30967,30970,30964,30959,30977, +31143,31146,31319,31423,31751,31757,31742,31735,31756,31712,31968,31964,31966, +31970,31967,31961,31965,32302,32318,32326,32311,32306,32323,32299,32317,32305, +32325,32321,32308,32313,32328,32309,32319,32303,32580,32755,32764,32881,32882, +32880,32879,32883,33222,33219,33210,33218,33216,33215,33213,33225,33214,33256, +33289,33393,34218,34180,34174,34204,34193,34196,34223,34203,34183,34216,34186, +34407,34752,34769,34739,34770,34758,34731,34747,34746,34760,34763,35131,35126, +35140,35128,35133,35244,35598,35607,35609,35611,35594, +35616,35613,35588,35600,35905,35903,35955,36090,36093,36092,36088,36091,36264, +36425,36427,36424,36426,36676,36670,36674,36677,36671,36991,36989,36996,36993, +36994,36992,37177,37283,37278,37276,37709,37762,37672,37749,37706,37733,37707, +37656,37758,37740,37723,37744,37722,37716,38346,38347,38348,38344,38342,38577, +38584,38614,38684,38686,38816,38867,38982,39094,39221,39425,39423,39854,39851, +39850,39853,40251,40255,40587,40655,40670,40668,40669,40667,40766,40779,21474, +22165,22190,22745,22744,23352,24413,25059,25139,25844,25842,25854,25862,25850, +25851,25847,26039,26332,26406,27315,27308,27331,27323,27320,27330,27310,27311, +27487,27512,27567,28681,28683,28670,28678,28666,28689,28687,29179,29180,29182, +29176,29559,29557,29863,29887,29973,30294,30296,30290,30653,30655,30651,30652, +30990,31150,31329,31330,31328,31428,31429,31787,31783,31786,31774,31779,31777, +31975,32340,32341,32350,32346,32353,32338,32345,32584,32761,32763,32887,32886, +33229,33231,33290,34255,34217,34253,34256,34249,34224,34234,34233,34214,34799, +34796,34802,34784,35206,35250,35316,35624,35641,35628,35627,35920,36101,36441, +36451,36454,36452,36447,36437,36544,36681,36685,36999,36995,37000,37291,37292, +37328,37780,37770,37782,37794,37811,37806,37804,37808,37784,37786,37783,38356, +38358,38352,38357,38626,38620,38617,38619,38622,38692,38819,38822,38829,38905, +38989,38991,38988,38990,38995,39098,39230,39231,39229,39214,39333,39438,39617, +39683,39686,39759,39758,39757,39882,39881,39933,39880,39872,40273,40285,40288, +40672,40725,40748,20787,22181,22750,22751,22754,23541, +40848,24300,25074,25079,25078,25077,25856,25871,26336,26333,27365,27357,27354, +27347,28699,28703,28712,28698,28701,28693,28696,29190,29197,29272,29346,29560, +29562,29885,29898,29923,30087,30086,30303,30305,30663,31001,31153,31339,31337, +31806,31807,31800,31805,31799,31808,32363,32365,32377,32361,32362,32645,32371, +32694,32697,32696,33240,34281,34269,34282,34261,34276,34277,34295,34811,34821, +34829,34809,34814,35168,35167,35158,35166,35649,35676,35672,35657,35674,35662, +35663,35654,35673,36104,36106,36476,36466,36487,36470,36460,36474,36468,36692, +36686,36781,37002,37003,37297,37294,37857,37841,37855,37827,37832,37852,37853, +37846,37858,37837,37848,37860,37847,37864,38364,38580,38627,38698,38695,38753, +38876,38907,39006,39000,39003,39100,39237,39241,39446,39449,39693,39912,39911, +39894,39899,40329,40289,40306,40298,40300,40594,40599,40595,40628,21240,22184, +22199,22198,22196,22204,22756,23360,23363,23421,23542,24009,25080,25082,25880, +25876,25881,26342,26407,27372,28734,28720,28722,29200,29563,29903,30306,30309, +31014,31018,31020,31019,31431,31478,31820,31811,31821,31983,31984,36782,32381, +32380,32386,32588,32768,33242,33382,34299,34297,34321,34298,34310,34315,34311, +34314,34836,34837,35172,35258,35320,35696,35692,35686,35695,35679,35691,36111, +36109,36489,36481,36485,36482,37300,37323,37912,37891,37885,38369,38704,39108, +39250,39249,39336,39467,39472,39479,39477,39955,39949,40569,40629,40680,40751, +40799,40803,40801,20791,20792,22209,22208,22210,22804,23660,24013,25084,25086, +25885,25884,26005,26345,27387,27396,27386,27570,28748, +29211,29351,29910,29908,30313,30675,31824,32399,32396,32700,34327,34349,34330, +34851,34850,34849,34847,35178,35180,35261,35700,35703,35709,36115,36490,36493, +36491,36703,36783,37306,37934,37939,37941,37946,37944,37938,37931,38370,38712, +38713,38706,38911,39015,39013,39255,39493,39491,39488,39486,39631,39764,39761, +39981,39973,40367,40372,40386,40376,40605,40687,40729,40796,40806,40807,20796, +20795,22216,22218,22217,23423,24020,24018,24398,25087,25892,27402,27489,28753, +28760,29568,29924,30090,30318,30316,31155,31840,31839,32894,32893,33247,35186, +35183,35324,35712,36118,36119,36497,36499,36705,37192,37956,37969,37970,38717, +38718,38851,38849,39019,39253,39509,39501,39634,39706,40009,39985,39998,39995, +40403,40407,40756,40812,40810,40852,22220,24022,25088,25891,25899,25898,26348, +27408,29914,31434,31844,31843,31845,32403,32406,32404,33250,34360,34367,34865, +35722,37008,37007,37987,37984,37988,38760,39023,39260,39514,39515,39511,39635, +39636,39633,40020,40023,40022,40421,40607,40692,22225,22761,25900,28766,30321, +30322,30679,32592,32648,34870,34873,34914,35731,35730,35734,33399,36123,37312, +37994,38722,38728,38724,38854,39024,39519,39714,39768,40031,40441,40442,40572, +40573,40711,40823,40818,24307,27414,28771,31852,31854,34875,35264,36513,37313, +38002,38000,39025,39262,39638,39715,40652,28772,30682,35738,38007,38857,39522, +39525,32412,35740,36522,37317,38013,38014,38012,40055,40056,40695,35924,38015, +40474,29224,39530,39729,40475,40478,31858,9312,9313,9314,9315,9316,9317,9318, +9319,9320,9321,9332,9333,9334,9335,9336, +9337,9338,9339,9340,9341,8560,8561,8562,8563,8564,8565,8566,8567,8568,8569, +20022,20031,20101,20128,20866,20886,20907,21241,21304,21353,21430,22794,23424, +24027,24186,24191,24308,24400,24417,25908,26080,30098,30326,36789,38582,168, +710,12541,12542,12445,12446,0,0,12293,12294,12295,12540,65339,65341,10045, +12353,12354,12355,12356,12357,12358,12359,12360,12361,12362,12363,12364,12365, +12366,12367,12368,12369,12370,12371,12372,12373,12374,12375,12376,12377,12378, +12379,12380,12381,12382,12383,12384,12385,12386,12387,12388,12389,12390,12391, +12392,12393,12394,12395,12396,12397,12398,12399,12400,12401,12402,12403,12404, +12405,12406,12407,12408,12409,12410,12411,12412,12413,12414,12415,12416,12417, +12418,12419,12420,12421,12422,12423,12424,12425,12426,12427,12428,12429,12430, +12431,12432,12433,12434,12435,12449,12450,12451,12452,12453,12454,12455,12456, +12457,12458,12459,12460,12461,12462,12463,12464,12465,12466,12467,12468,12469, +12470,12471,12472,12473,12474,12475,12476,12477,12478,12479,12480,12481,12482, +12483,12484,12485,12486,12487,12488,12489,12490,12491,12492,12493,12494,12495, +12496,12497,12498,12499,12500,12501,12502,12503,12504,12505,12506,12507,12508, +12509,12510,12511,12512,12513,12514,12515,12516,12517,12518,12519,12520,12521, +12522,12523,12524,12525,12526,12527,12528,12529,12530,12531,12532,12533,12534, +1040,1041,1042,1043,1044,1045,1025,1046,1047,1048,1049,1050,1051,1052,1053, +1054,1055,1056,1057,1058,1059,1060,1061,1062,1063,1064,1065,1066,1067,1068, +1069,1070, +1071,1072,1073,1074,1075,1076,1077,1105,1078,1079,1080,1081,1082,1083,1084, +1085,1086,1087,1088,1089,1090,1091,1092,1093,1094,1095,1096,1097,1098,1099, +1100,1101,1102,1103,8679,8632,8633,12751,204,20058,138,20994,17553,40880, +20872,40881,30215,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,65506,65508,65287,65282,12849,8470,8481,12443,12444,11904, +11908,11910,11911,11912,11914,11916,11917,11925,11932,11933,11941,11943,11946, +11948,11950,11958,11964,11966,11974,11978,11980,11981,11983,11990,11991,11998, +12003,0,0,0,643,592,603,596,629,339,248,331,650,618,20034,20060,20981,21274, +21378,19975,19980,20039,20109,22231,64012,23662,24435,19983,20871,19982,20014, +20115,20162,20169,20168,20888,21244,21356,21433,22304,22787,22828,23568,24063, +26081,27571,27596,27668,29247,20017,20028,20200,20188,20201,20193,20189,20186, +21004,21276,21324,22306,22307,22807,22831,23425,23428,23570,23611,23668,23667, +24068,24192,24194,24521,25097,25168,27669,27702,27715,27711,27707,29358,29360, +29578,31160,32906,38430,20238,20248,20268,20213,20244,20209,20224,20215,20232, +20253,20226,20229,20258,20243,20228,20212,20242,20913,21011,21001,21008,21158, +21282,21279,21325,21386,21511,22241,22239,22318,22314,22324,22844,22912,22908, +22917,22907,22910,22903,22911,23382,23573,23589,23676,23674,23675, +23678,24031,24181,24196,24322,24346,24436,24533,24532,24527,25180,25182,25188, +25185,25190,25186,25177,25184,25178,25189,26095,26094,26430,26425,26424,26427, +26426,26431,26428,26419,27672,27718,27730,27740,27727,27722,27732,27723,27724, +28785,29278,29364,29365,29582,29994,30335,31349,32593,33400,33404,33408,33405, +33407,34381,35198,37017,37015,37016,37019,37012,38434,38436,38432,38435,20310, +20283,20322,20297,20307,20324,20286,20327,20306,20319,20289,20312,20269,20275, +20287,20321,20879,20921,21020,21022,21025,21165,21166,21257,21347,21362,21390, +21391,21552,21559,21546,21588,21573,21529,21532,21541,21528,21565,21583,21569, +21544,21540,21575,22254,22247,22245,22337,22341,22348,22345,22347,22354,22790, +22848,22950,22936,22944,22935,22926,22946,22928,22927,22951,22945,23438,23442, +23592,23594,23693,23695,23688,23691,23689,23698,23690,23686,23699,23701,24032, +24074,24078,24203,24201,24204,24200,24205,24325,24349,24440,24438,24530,24529, +24528,24557,24552,24558,24563,24545,24548,24547,24570,24559,24567,24571,24576, +24564,25146,25219,25228,25230,25231,25236,25223,25201,25211,25210,25200,25217, +25224,25207,25213,25202,25204,25911,26096,26100,26099,26098,26101,26437,26439, +26457,26453,26444,26440,26461,26445,26458,26443,27600,27673,27674,27768,27751, +27755,27780,27787,27791,27761,27759,27753,27802,27757,27783,27797,27804,27750, +27763,27749,27771,27790,28788,28794,29283,29375,29373,29379,29382,29377,29370, +29381,29589,29591,29587,29588,29586,30010,30009,30100,30101,30337,31037,32820, +32917,32921,32912,32914,32924,33424,33423,33413,33422, +33425,33427,33418,33411,33412,35960,36809,36799,37023,37025,37029,37022,37031, +37024,38448,38440,38447,38445,20019,20376,20348,20357,20349,20352,20359,20342, +20340,20361,20356,20343,20300,20375,20330,20378,20345,20353,20344,20368,20380, +20372,20382,20370,20354,20373,20331,20334,20894,20924,20926,21045,21042,21043, +21062,21041,21180,21258,21259,21308,21394,21396,21639,21631,21633,21649,21634, +21640,21611,21626,21630,21605,21612,21620,21606,21645,21615,21601,21600,21656, +21603,21607,21604,22263,22265,22383,22386,22381,22379,22385,22384,22390,22400, +22389,22395,22387,22388,22370,22376,22397,22796,22853,22965,22970,22991,22990, +22962,22988,22977,22966,22972,22979,22998,22961,22973,22976,22984,22964,22983, +23394,23397,23443,23445,23620,23623,23726,23716,23712,23733,23727,23720,23724, +23711,23715,23725,23714,23722,23719,23709,23717,23734,23728,23718,24087,24084, +24089,24360,24354,24355,24356,24404,24450,24446,24445,24542,24549,24621,24614, +24601,24626,24587,24628,24586,24599,24627,24602,24606,24620,24610,24589,24592, +24622,24595,24593,24588,24585,24604,25108,25149,25261,25268,25297,25278,25258, +25270,25290,25262,25267,25263,25275,25257,25264,25272,25917,26024,26043,26121, +26108,26116,26130,26120,26107,26115,26123,26125,26117,26109,26129,26128,26358, +26378,26501,26476,26510,26514,26486,26491,26520,26502,26500,26484,26509,26508, +26490,26527,26513,26521,26499,26493,26497,26488,26489,26516,27429,27520,27518, +27614,27677,27795,27884,27883,27886,27865,27830,27860,27821,27879,27831,27856, +27842,27834,27843,27846,27885,27890,27858,27869,27828, +27786,27805,27776,27870,27840,27952,27853,27847,27824,27897,27855,27881,27857, +28820,28824,28805,28819,28806,28804,28817,28822,28802,28826,28803,29290,29398, +29387,29400,29385,29404,29394,29396,29402,29388,29393,29604,29601,29613,29606, +29602,29600,29612,29597,29917,29928,30015,30016,30014,30092,30104,30383,30451, +30449,30448,30453,30712,30716,30713,30715,30714,30711,31042,31039,31173,31352, +31355,31483,31861,31997,32821,32911,32942,32931,32952,32949,32941,33312,33440, +33472,33451,33434,33432,33435,33461,33447,33454,33468,33438,33466,33460,33448, +33441,33449,33474,33444,33475,33462,33442,34416,34415,34413,34414,35926,36818, +36811,36819,36813,36822,36821,36823,37042,37044,37039,37043,37040,38457,38461, +38460,38458,38467,20429,20421,20435,20402,20425,20427,20417,20436,20444,20441, +20411,20403,20443,20423,20438,20410,20416,20409,20460,21060,21065,21184,21186, +21309,21372,21399,21398,21401,21400,21690,21665,21677,21669,21711,21699,33549, +21687,21678,21718,21686,21701,21702,21664,21616,21692,21666,21694,21618,21726, +21680,22453,22430,22431,22436,22412,22423,22429,22427,22420,22424,22415,22425, +22437,22426,22421,22772,22797,22867,23009,23006,23022,23040,23025,23005,23034, +23037,23036,23030,23012,23026,23031,23003,23017,23027,23029,23008,23038,23028, +23021,23464,23628,23760,23768,23756,23767,23755,23771,23774,23770,23753,23751, +23754,23766,23763,23764,23759,23752,23750,23758,23775,23800,24057,24097,24098, +24099,24096,24100,24240,24228,24226,24219,24227,24229,24327,24366,24406,24454, +24631,24633,24660,24690,24670,24645,24659,24647,24649, +24667,24652,24640,24642,24671,24612,24644,24664,24678,24686,25154,25155,25295, +25357,25355,25333,25358,25347,25323,25337,25359,25356,25336,25334,25344,25363, +25364,25338,25365,25339,25328,25921,25923,26026,26047,26166,26145,26162,26165, +26140,26150,26146,26163,26155,26170,26141,26164,26169,26158,26383,26384,26561, +26610,26568,26554,26588,26555,26616,26584,26560,26551,26565,26603,26596,26591, +26549,26573,26547,26615,26614,26606,26595,26562,26553,26574,26599,26608,26546, +26620,26566,26605,26572,26542,26598,26587,26618,26569,26570,26563,26602,26571, +27432,27522,27524,27574,27606,27608,27616,27680,27681,27944,27956,27949,27935, +27964,27967,27922,27914,27866,27955,27908,27929,27962,27930,27921,27904,27933, +27970,27905,27928,27959,27907,27919,27968,27911,27936,27948,27912,27938,27913, +27920,28855,28831,28862,28849,28848,28833,28852,28853,28841,29249,29257,29258, +29292,29296,29299,29294,29386,29412,29416,29419,29407,29418,29414,29411,29573, +29644,29634,29640,29637,29625,29622,29621,29620,29675,29631,29639,29630,29635, +29638,29624,29643,29932,29934,29998,30023,30024,30119,30122,30329,30404,30472, +30467,30468,30469,30474,30455,30459,30458,30695,30696,30726,30737,30738,30725, +30736,30735,30734,30729,30723,30739,31050,31052,31051,31045,31044,31189,31181, +31183,31190,31182,31360,31358,31441,31488,31489,31866,31864,31865,31871,31872, +31873,32003,32008,32001,32600,32657,32653,32702,32775,32782,32783,32788,32823, +32984,32967,32992,32977,32968,32962,32976,32965,32995,32985,32988,32970,32981, +32969,32975,32983,32998,32973,33279,33313,33428,33497, +33534,33529,33543,33512,33536,33493,33594,33515,33494,33524,33516,33505,33522, +33525,33548,33531,33526,33520,33514,33508,33504,33530,33523,33517,34423,34420, +34428,34419,34881,34894,34919,34922,34921,35283,35332,35335,36210,36835,36833, +36846,36832,37105,37053,37055,37077,37061,37054,37063,37067,37064,37332,37331, +38484,38479,38481,38483,38474,38478,20510,20485,20487,20499,20514,20528,20507, +20469,20468,20531,20535,20524,20470,20471,20503,20508,20512,20519,20533,20527, +20529,20494,20826,20884,20883,20938,20932,20933,20936,20942,21089,21082,21074, +21086,21087,21077,21090,21197,21262,21406,21798,21730,21783,21778,21735,21747, +21732,21786,21759,21764,21768,21739,21777,21765,21745,21770,21755,21751,21752, +21728,21774,21763,21771,22273,22274,22476,22578,22485,22482,22458,22470,22461, +22460,22456,22454,22463,22471,22480,22457,22465,22798,22858,23065,23062,23085, +23086,23061,23055,23063,23050,23070,23091,23404,23463,23469,23468,23555,23638, +23636,23788,23807,23790,23793,23799,23808,23801,24105,24104,24232,24238,24234, +24236,24371,24368,24423,24669,24666,24679,24641,24738,24712,24704,24722,24705, +24733,24707,24725,24731,24727,24711,24732,24718,25113,25158,25330,25360,25430, +25388,25412,25413,25398,25411,25572,25401,25419,25418,25404,25385,25409,25396, +25432,25428,25433,25389,25415,25395,25434,25425,25400,25431,25408,25416,25930, +25926,26054,26051,26052,26050,26186,26207,26183,26193,26386,26387,26655,26650, +26697,26674,26675,26683,26699,26703,26646,26673,26652,26677,26667,26669,26671, +26702,26692,26676,26653,26642,26644,26662,26664,26670, +26701,26682,26661,26656,27436,27439,27437,27441,27444,27501,32898,27528,27622, +27620,27624,27619,27618,27623,27685,28026,28003,28004,28022,27917,28001,28050, +27992,28002,28013,28015,28049,28045,28143,28031,28038,27998,28007,28000,28055, +28016,28028,27999,28034,28056,27951,28008,28043,28030,28032,28036,27926,28035, +28027,28029,28021,28048,28892,28883,28881,28893,28875,32569,28898,28887,28882, +28894,28896,28884,28877,28869,28870,28871,28890,28878,28897,29250,29304,29303, +29302,29440,29434,29428,29438,29430,29427,29435,29441,29651,29657,29669,29654, +29628,29671,29667,29673,29660,29650,29659,29652,29661,29658,29655,29656,29672, +29918,29919,29940,29941,29985,30043,30047,30128,30145,30139,30148,30144,30143, +30134,30138,30346,30409,30493,30491,30480,30483,30482,30499,30481,30485,30489, +30490,30498,30503,30755,30764,30754,30773,30767,30760,30766,30763,30753,30761, +30771,30762,30769,31060,31067,31055,31068,31059,31058,31057,31211,31212,31200, +31214,31213,31210,31196,31198,31197,31366,31369,31365,31371,31372,31370,31367, +31448,31504,31492,31507,31493,31503,31496,31498,31502,31497,31506,31876,31889, +31882,31884,31880,31885,31877,32030,32029,32017,32014,32024,32022,32019,32031, +32018,32015,32012,32604,32609,32606,32608,32605,32603,32662,32658,32707,32706, +32704,32790,32830,32825,33018,33010,33017,33013,33025,33019,33024,33281,33327, +33317,33587,33581,33604,33561,33617,33573,33622,33599,33601,33574,33564,33570, +33602,33614,33563,33578,33544,33596,33613,33558,33572,33568,33591,33583,33577, +33607,33605,33612,33619,33566,33580,33611,33575,33608, +34387,34386,34466,34472,34454,34445,34449,34462,34439,34455,34438,34443,34458, +34437,34469,34457,34465,34471,34453,34456,34446,34461,34448,34452,34883,34884, +34925,34933,34934,34930,34944,34929,34943,34927,34947,34942,34932,34940,35346, +35911,35927,35963,36004,36003,36214,36216,36277,36279,36278,36561,36563,36862, +36853,36866,36863,36859,36868,36860,36854,37078,37088,37081,37082,37091,37087, +37093,37080,37083,37079,37084,37092,37200,37198,37199,37333,37346,37338,38492, +38495,38588,39139,39647,39727,20095,20592,20586,20577,20574,20576,20563,20555, +20573,20594,20552,20557,20545,20571,20554,20578,20501,20549,20575,20585,20587, +20579,20580,20550,20544,20590,20595,20567,20561,20944,21099,21101,21100,21102, +21206,21203,21293,21404,21877,21878,21820,21837,21840,21812,21802,21841,21858, +21814,21813,21808,21842,21829,21772,21810,21861,21838,21817,21832,21805,21819, +21824,21835,22282,22279,22523,22548,22498,22518,22492,22516,22528,22509,22525, +22536,22520,22539,22515,22479,22535,22510,22499,22514,22501,22508,22497,22542, +22524,22544,22503,22529,22540,22513,22505,22512,22541,22532,22876,23136,23128, +23125,23143,23134,23096,23093,23149,23120,23135,23141,23148,23123,23140,23127, +23107,23133,23122,23108,23131,23112,23182,23102,23117,23097,23116,23152,23145, +23111,23121,23126,23106,23132,23410,23406,23489,23488,23641,23838,23819,23837, +23834,23840,23820,23848,23821,23846,23845,23823,23856,23826,23843,23839,23854, +24126,24116,24241,24244,24249,24242,24243,24374,24376,24475,24470,24479,24714, +24720,24710,24766,24752,24762,24787,24788,24783,24804, +24793,24797,24776,24753,24795,24759,24778,24767,24771,24781,24768,25394,25445, +25482,25474,25469,25533,25502,25517,25501,25495,25515,25486,25455,25479,25488, +25454,25519,25461,25500,25453,25518,25468,25508,25403,25503,25464,25477,25473, +25489,25485,25456,25939,26061,26213,26209,26203,26201,26204,26210,26392,26745, +26759,26768,26780,26733,26734,26798,26795,26966,26735,26787,26796,26793,26741, +26740,26802,26767,26743,26770,26748,26731,26738,26794,26752,26737,26750,26779, +26774,26763,26784,26761,26788,26744,26747,26769,26764,26762,26749,27446,27443, +27447,27448,27537,27535,27533,27534,27532,27690,28096,28075,28084,28083,28276, +28076,28137,28130,28087,28150,28116,28160,28104,28128,28127,28118,28094,28133, +28124,28125,28123,28148,28106,28093,28141,28144,28090,28117,28098,28111,28105, +28112,28146,28115,28157,28119,28109,28131,28091,28922,28941,28919,28951,28916, +28940,28912,28932,28915,28944,28924,28927,28934,28947,28928,28920,28918,28939, +28930,28942,29310,29307,29308,29311,29469,29463,29447,29457,29464,29450,29448, +29439,29455,29470,29576,29686,29688,29685,29700,29697,29693,29703,29696,29690, +29692,29695,29708,29707,29684,29704,30052,30051,30158,30162,30159,30155,30156, +30161,30160,30351,30345,30419,30521,30511,30509,30513,30514,30516,30515,30525, +30501,30523,30517,30792,30802,30793,30797,30794,30796,30758,30789,30800,31076, +31079,31081,31082,31075,31083,31073,31163,31226,31224,31222,31223,31375,31380, +31376,31541,31559,31540,31525,31536,31522,31524,31539,31512,31530,31517,31537, +31531,31533,31535,31538,31544,31514,31523,31892,31896, +31894,31907,32053,32061,32056,32054,32058,32069,32044,32041,32065,32071,32062, +32063,32074,32059,32040,32611,32661,32668,32669,32667,32714,32715,32717,32720, +32721,32711,32719,32713,32799,32798,32795,32839,32835,32840,33048,33061,33049, +33051,33069,33055,33068,33054,33057,33045,33063,33053,33058,33297,33336,33331, +33338,33332,33330,33396,33680,33699,33704,33677,33658,33651,33700,33652,33679, +33665,33685,33689,33653,33684,33705,33661,33667,33676,33693,33691,33706,33675, +33662,33701,33711,33672,33687,33712,33663,33702,33671,33710,33654,33690,34393, +34390,34495,34487,34498,34497,34501,34490,34480,34504,34489,34483,34488,34508, +34484,34491,34492,34499,34493,34494,34898,34953,34965,34984,34978,34986,34970, +34961,34977,34975,34968,34983,34969,34971,34967,34980,34988,34956,34963,34958, +35202,35286,35289,35285,35376,35367,35372,35358,35897,35899,35932,35933,35965, +36005,36221,36219,36217,36284,36290,36281,36287,36289,36568,36574,36573,36572, +36567,36576,36577,36900,36875,36881,36892,36876,36897,37103,37098,37104,37108, +37106,37107,37076,37099,37100,37097,37206,37208,37210,37203,37205,37356,37364, +37361,37363,37368,37348,37369,37354,37355,37367,37352,37358,38266,38278,38280, +38524,38509,38507,38513,38511,38591,38762,38916,39141,39319,20635,20629,20628, +20638,20619,20643,20611,20620,20622,20637,20584,20636,20626,20610,20615,20831, +20948,21266,21265,21412,21415,21905,21928,21925,21933,21879,22085,21922,21907, +21896,21903,21941,21889,21923,21906,21924,21885,21900,21926,21887,21909,21921, +21902,22284,22569,22583,22553,22558,22567,22563,22568, +22517,22600,22565,22556,22555,22579,22591,22582,22574,22585,22584,22573,22572, +22587,22881,23215,23188,23199,23162,23202,23198,23160,23206,23164,23205,23212, +23189,23214,23095,23172,23178,23191,23171,23179,23209,23163,23165,23180,23196, +23183,23187,23197,23530,23501,23499,23508,23505,23498,23502,23564,23600,23863, +23875,23915,23873,23883,23871,23861,23889,23886,23893,23859,23866,23890,23869, +23857,23897,23874,23865,23881,23864,23868,23858,23862,23872,23877,24132,24129, +24408,24486,24485,24491,24777,24761,24780,24802,24782,24772,24852,24818,24842, +24854,24837,24821,24851,24824,24828,24830,24769,24835,24856,24861,24848,24831, +24836,24843,25162,25492,25521,25520,25550,25573,25576,25583,25539,25757,25587, +25546,25568,25590,25557,25586,25589,25697,25567,25534,25565,25564,25540,25560, +25555,25538,25543,25548,25547,25544,25584,25559,25561,25906,25959,25962,25956, +25948,25960,25957,25996,26013,26014,26030,26064,26066,26236,26220,26235,26240, +26225,26233,26218,26226,26369,26892,26835,26884,26844,26922,26860,26858,26865, +26895,26838,26871,26859,26852,26870,26899,26896,26867,26849,26887,26828,26888, +26992,26804,26897,26863,26822,26900,26872,26832,26877,26876,26856,26891,26890, +26903,26830,26824,26845,26846,26854,26868,26833,26886,26836,26857,26901,26917, +26823,27449,27451,27455,27452,27540,27543,27545,27541,27581,27632,27634,27635, +27696,28156,28230,28231,28191,28233,28296,28220,28221,28229,28258,28203,28223, +28225,28253,28275,28188,28211,28235,28224,28241,28219,28163,28206,28254,28264, +28252,28257,28209,28200,28256,28273,28267,28217,28194, +28208,28243,28261,28199,28280,28260,28279,28245,28281,28242,28262,28213,28214, +28250,28960,28958,28975,28923,28974,28977,28963,28965,28962,28978,28959,28968, +28986,28955,29259,29274,29320,29321,29318,29317,29323,29458,29451,29488,29474, +29489,29491,29479,29490,29485,29478,29475,29493,29452,29742,29740,29744,29739, +29718,29722,29729,29741,29745,29732,29731,29725,29737,29728,29746,29947,29999, +30063,30060,30183,30170,30177,30182,30173,30175,30180,30167,30357,30354,30426, +30534,30535,30532,30541,30533,30538,30542,30539,30540,30686,30700,30816,30820, +30821,30812,30829,30833,30826,30830,30832,30825,30824,30814,30818,31092,31091, +31090,31088,31234,31242,31235,31244,31236,31385,31462,31460,31562,31547,31556, +31560,31564,31566,31552,31576,31557,31906,31902,31912,31905,32088,32111,32099, +32083,32086,32103,32106,32079,32109,32092,32107,32082,32084,32105,32081,32095, +32078,32574,32575,32613,32614,32674,32672,32673,32727,32849,32847,32848,33022, +32980,33091,33098,33106,33103,33095,33085,33101,33082,33254,33262,33271,33272, +33273,33284,33340,33341,33343,33397,33595,33743,33785,33827,33728,33768,33810, +33767,33764,33788,33782,33808,33734,33736,33771,33763,33727,33793,33757,33765, +33752,33791,33761,33739,33742,33750,33781,33737,33801,33807,33758,33809,33798, +33730,33779,33749,33786,33735,33745,33770,33811,33731,33772,33774,33732,33787, +33751,33762,33819,33755,33790,34520,34530,34534,34515,34531,34522,34538,34525, +34539,34524,34540,34537,34519,34536,34513,34888,34902,34901,35002,35031,35001, +35000,35008,35006,34998,35004,34999,35005,34994,35073, +35017,35221,35224,35223,35293,35290,35291,35406,35405,35385,35417,35392,35415, +35416,35396,35397,35410,35400,35409,35402,35404,35407,35935,35969,35968,36026, +36030,36016,36025,36021,36228,36224,36233,36312,36307,36301,36295,36310,36316, +36303,36309,36313,36296,36311,36293,36591,36599,36602,36601,36582,36590,36581, +36597,36583,36584,36598,36587,36593,36588,36596,36585,36909,36916,36911,37126, +37164,37124,37119,37116,37128,37113,37115,37121,37120,37127,37125,37123,37217, +37220,37215,37218,37216,37377,37386,37413,37379,37402,37414,37391,37388,37376, +37394,37375,37373,37382,37380,37415,37378,37404,37412,37401,37399,37381,37398, +38267,38285,38284,38288,38535,38526,38536,38537,38531,38528,38594,38600,38595, +38641,38640,38764,38768,38766,38919,39081,39147,40166,40697,20099,20100,20150, +20669,20671,20678,20654,20676,20682,20660,20680,20674,20656,20673,20666,20657, +20683,20681,20662,20664,20951,21114,21112,21115,21116,21955,21979,21964,21968, +21963,21962,21981,21952,21972,21956,21993,21951,21970,21901,21967,21973,21986, +21974,21960,22002,21965,21977,21954,22292,22611,22632,22628,22607,22605,22601, +22639,22613,22606,22621,22617,22629,22619,22589,22627,22641,22780,23239,23236, +23243,23226,23224,23217,23221,23216,23231,23240,23227,23238,23223,23232,23242, +23220,23222,23245,23225,23184,23510,23512,23513,23583,23603,23921,23907,23882, +23909,23922,23916,23902,23912,23911,23906,24048,24143,24142,24138,24141,24139, +24261,24268,24262,24267,24263,24384,24495,24493,24823,24905,24906,24875,24901, +24886,24882,24878,24902,24879,24911,24873,24896,25120, +37224,25123,25125,25124,25541,25585,25579,25616,25618,25609,25632,25636,25651, +25667,25631,25621,25624,25657,25655,25634,25635,25612,25638,25648,25640,25665, +25653,25647,25610,25626,25664,25637,25639,25611,25575,25627,25646,25633,25614, +25967,26002,26067,26246,26252,26261,26256,26251,26250,26265,26260,26232,26400, +26982,26975,26936,26958,26978,26993,26943,26949,26986,26937,26946,26967,26969, +27002,26952,26953,26933,26988,26931,26941,26981,26864,27000,26932,26985,26944, +26991,26948,26998,26968,26945,26996,26956,26939,26955,26935,26972,26959,26961, +26930,26962,26927,27003,26940,27462,27461,27459,27458,27464,27457,27547,64013, +27643,27644,27641,27639,27640,28315,28374,28360,28303,28352,28319,28307,28308, +28320,28337,28345,28358,28370,28349,28353,28318,28361,28343,28336,28365,28326, +28367,28338,28350,28355,28380,28376,28313,28306,28302,28301,28324,28321,28351, +28339,28368,28362,28311,28334,28323,28999,29012,29010,29027,29024,28993,29021, +29026,29042,29048,29034,29025,28994,29016,28995,29003,29040,29023,29008,29011, +28996,29005,29018,29263,29325,29324,29329,29328,29326,29500,29506,29499,29498, +29504,29514,29513,29764,29770,29771,29778,29777,29783,29760,29775,29776,29774, +29762,29766,29773,29780,29921,29951,29950,29949,29981,30073,30071,27011,30191, +30223,30211,30199,30206,30204,30201,30200,30224,30203,30198,30189,30197,30205, +30361,30389,30429,30549,30559,30560,30546,30550,30554,30569,30567,30548,30553, +30573,30688,30855,30874,30868,30863,30852,30869,30853,30854,30881,30851,30841, +30873,30848,30870,30843,31100,31106,31101,31097,31249, +31256,31257,31250,31255,31253,31266,31251,31259,31248,31395,31394,31390,31467, +31590,31588,31597,31604,31593,31602,31589,31603,31601,31600,31585,31608,31606, +31587,31922,31924,31919,32136,32134,32128,32141,32127,32133,32122,32142,32123, +32131,32124,32140,32148,32132,32125,32146,32621,32619,32615,32616,32620,32678, +32677,32679,32731,32732,32801,33124,33120,33143,33116,33129,33115,33122,33138, +26401,33118,33142,33127,33135,33092,33121,33309,33353,33348,33344,33346,33349, +34033,33855,33878,33910,33913,33935,33933,33893,33873,33856,33926,33895,33840, +33869,33917,33882,33881,33908,33907,33885,34055,33886,33847,33850,33844,33914, +33859,33912,33842,33861,33833,33753,33867,33839,33858,33837,33887,33904,33849, +33870,33868,33874,33903,33989,33934,33851,33863,33846,33843,33896,33918,33860, +33835,33888,33876,33902,33872,34571,34564,34551,34572,34554,34518,34549,34637, +34552,34574,34569,34561,34550,34573,34565,35030,35019,35021,35022,35038,35035, +35034,35020,35024,35205,35227,35295,35301,35300,35297,35296,35298,35292,35302, +35446,35462,35455,35425,35391,35447,35458,35460,35445,35459,35457,35444,35450, +35900,35915,35914,35941,35940,35942,35974,35972,35973,36044,36200,36201,36241, +36236,36238,36239,36237,36243,36244,36240,36242,36336,36320,36332,36337,36334, +36304,36329,36323,36322,36327,36338,36331,36340,36614,36607,36609,36608,36613, +36615,36616,36610,36619,36946,36927,36932,36937,36925,37136,37133,37135,37137, +37142,37140,37131,37134,37230,37231,37448,37458,37424,37434,37478,37427,37477, +37470,37507,37422,37450,37446,37485,37484,37455,37472, +37479,37487,37430,37473,37488,37425,37460,37475,37456,37490,37454,37459,37452, +37462,37426,38303,38300,38302,38299,38546,38547,38545,38551,38606,38650,38653, +38648,38645,38771,38775,38776,38770,38927,38925,38926,39084,39158,39161,39343, +39346,39344,39349,39597,39595,39771,40170,40173,40167,40576,40701,20710,20692, +20695,20712,20723,20699,20714,20701,20708,20691,20716,20720,20719,20707,20704, +20952,21120,21121,21225,21227,21296,21420,22055,22037,22028,22034,22012,22031, +22044,22017,22035,22018,22010,22045,22020,22015,22009,22665,22652,22672,22680, +22662,22657,22655,22644,22667,22650,22663,22673,22670,22646,22658,22664,22651, +22676,22671,22782,22891,23260,23278,23269,23253,23274,23258,23277,23275,23283, +23266,23264,23259,23276,23262,23261,23257,23272,23263,23415,23520,23523,23651, +23938,23936,23933,23942,23930,23937,23927,23946,23945,23944,23934,23932,23949, +23929,23935,24152,24153,24147,24280,24273,24279,24270,24284,24277,24281,24274, +24276,24388,24387,24431,24502,24876,24872,24897,24926,24945,24947,24914,24915, +24946,24940,24960,24948,24916,24954,24923,24933,24891,24938,24929,24918,25129, +25127,25131,25643,25677,25691,25693,25716,25718,25714,25715,25725,25717,25702, +25766,25678,25730,25694,25692,25675,25683,25696,25680,25727,25663,25708,25707, +25689,25701,25719,25971,26016,26273,26272,26271,26373,26372,26402,27057,27062, +27081,27040,27086,27030,27056,27052,27068,27025,27033,27022,27047,27021,27049, +27070,27055,27071,27076,27069,27044,27092,27065,27082,27034,27087,27059,27027, +27050,27041,27038,27097,27031,27024,27074,27061,27045, +27078,27466,27469,27467,27550,27551,27552,27587,27588,27646,28366,28405,28401, +28419,28453,28408,28471,28411,28462,28425,28494,28441,28442,28455,28440,28475, +28434,28397,28426,28470,28531,28409,28398,28461,28480,28464,28476,28469,28395, +28423,28430,28483,28421,28413,28406,28473,28444,28412,28474,28447,28429,28446, +28424,28449,29063,29072,29065,29056,29061,29058,29071,29051,29062,29057,29079, +29252,29267,29335,29333,29331,29507,29517,29521,29516,29794,29811,29809,29813, +29810,29799,29806,29952,29954,29955,30077,30096,30230,30216,30220,30229,30225, +30218,30228,30392,30593,30588,30597,30594,30574,30592,30575,30590,30595,30898, +30890,30900,30893,30888,30846,30891,30878,30885,30880,30892,30882,30884,31128, +31114,31115,31126,31125,31124,31123,31127,31112,31122,31120,31275,31306,31280, +31279,31272,31270,31400,31403,31404,31470,31624,31644,31626,31633,31632,31638, +31629,31628,31643,31630,31621,31640,21124,31641,31652,31618,31931,31935,31932, +31930,32167,32183,32194,32163,32170,32193,32192,32197,32157,32206,32196,32198, +32203,32204,32175,32185,32150,32188,32159,32166,32174,32169,32161,32201,32627, +32738,32739,32741,32734,32804,32861,32860,33161,33158,33155,33159,33165,33164, +33163,33301,33943,33956,33953,33951,33978,33998,33986,33964,33966,33963,33977, +33972,33985,33997,33962,33946,33969,34000,33949,33959,33979,33954,33940,33991, +33996,33947,33961,33967,33960,34006,33944,33974,33999,33952,34007,34004,34002, +34011,33968,33937,34401,34611,34595,34600,34667,34624,34606,34590,34593,34585, +34587,34627,34604,34625,34622,34630,34592,34610,34602, +34605,34620,34578,34618,34609,34613,34626,34598,34599,34616,34596,34586,34608, +34577,35063,35047,35057,35058,35066,35070,35054,35068,35062,35067,35056,35052, +35051,35229,35233,35231,35230,35305,35307,35304,35499,35481,35467,35474,35471, +35478,35901,35944,35945,36053,36047,36055,36246,36361,36354,36351,36365,36349, +36362,36355,36359,36358,36357,36350,36352,36356,36624,36625,36622,36621,37155, +37148,37152,37154,37151,37149,37146,37156,37153,37147,37242,37234,37241,37235, +37541,37540,37494,37531,37498,37536,37524,37546,37517,37542,37530,37547,37497, +37527,37503,37539,37614,37518,37506,37525,37538,37501,37512,37537,37514,37510, +37516,37529,37543,37502,37511,37545,37533,37515,37421,38558,38561,38655,38744, +38781,38778,38782,38787,38784,38786,38779,38788,38785,38783,38862,38861,38934, +39085,39086,39170,39168,39175,39325,39324,39363,39353,39355,39354,39362,39357, +39367,39601,39651,39655,39742,39743,39776,39777,39775,40177,40178,40181,40615, +20735,20739,20784,20728,20742,20743,20726,20734,20747,20748,20733,20746,21131, +21132,21233,21231,22088,22082,22092,22069,22081,22090,22089,22086,22104,22106, +22080,22067,22077,22060,22078,22072,22058,22074,22298,22699,22685,22705,22688, +22691,22703,22700,22693,22689,22783,23295,23284,23293,23287,23286,23299,23288, +23298,23289,23297,23303,23301,23311,23655,23961,23959,23967,23954,23970,23955, +23957,23968,23964,23969,23962,23966,24169,24157,24160,24156,32243,24283,24286, +24289,24393,24498,24971,24963,24953,25009,25008,24994,24969,24987,24979,25007, +25005,24991,24978,25002,24993,24973,24934,25011,25133, +25710,25712,25750,25760,25733,25751,25756,25743,25739,25738,25740,25763,25759, +25704,25777,25752,25974,25978,25977,25979,26034,26035,26293,26288,26281,26290, +26295,26282,26287,27136,27142,27159,27109,27128,27157,27121,27108,27168,27135, +27116,27106,27163,27165,27134,27175,27122,27118,27156,27127,27111,27200,27144, +27110,27131,27149,27132,27115,27145,27140,27160,27173,27151,27126,27174,27143, +27124,27158,27473,27557,27555,27554,27558,27649,27648,27647,27650,28481,28454, +28542,28551,28614,28562,28557,28553,28556,28514,28495,28549,28506,28566,28534, +28524,28546,28501,28530,28498,28496,28503,28564,28563,28509,28416,28513,28523, +28541,28519,28560,28499,28555,28521,28543,28565,28515,28535,28522,28539,29106, +29103,29083,29104,29088,29082,29097,29109,29085,29093,29086,29092,29089,29098, +29084,29095,29107,29336,29338,29528,29522,29534,29535,29536,29533,29531,29537, +29530,29529,29538,29831,29833,29834,29830,29825,29821,29829,29832,29820,29817, +29960,29959,30078,30245,30238,30233,30237,30236,30243,30234,30248,30235,30364, +30365,30366,30363,30605,30607,30601,30600,30925,30907,30927,30924,30929,30926, +30932,30920,30915,30916,30921,31130,31137,31136,31132,31138,31131,27510,31289, +31410,31412,31411,31671,31691,31678,31660,31694,31663,31673,31690,31669,31941, +31944,31948,31947,32247,32219,32234,32231,32215,32225,32259,32250,32230,32246, +32241,32240,32238,32223,32630,32684,32688,32685,32749,32747,32746,32748,32742, +32744,32868,32871,33187,33183,33182,33173,33186,33177,33175,33302,33359,33363, +33362,33360,33358,33361,34084,34107,34063,34048,34089, +34062,34057,34061,34079,34058,34087,34076,34043,34091,34042,34056,34060,34036, +34090,34034,34069,34039,34027,34035,34044,34066,34026,34025,34070,34046,34088, +34077,34094,34050,34045,34078,34038,34097,34086,34023,34024,34032,34031,34041, +34072,34080,34096,34059,34073,34095,34402,34646,34659,34660,34679,34785,34675, +34648,34644,34651,34642,34657,34650,34641,34654,34669,34666,34640,34638,34655, +34653,34671,34668,34682,34670,34652,34661,34639,34683,34677,34658,34663,34665, +34906,35077,35084,35092,35083,35095,35096,35097,35078,35094,35089,35086,35081, +35234,35236,35235,35309,35312,35308,35535,35526,35512,35539,35537,35540,35541, +35515,35543,35518,35520,35525,35544,35523,35514,35517,35545,35902,35917,35983, +36069,36063,36057,36072,36058,36061,36071,36256,36252,36257,36251,36384,36387, +36389,36388,36398,36373,36379,36374,36369,36377,36390,36391,36372,36370,36376, +36371,36380,36375,36378,36652,36644,36632,36634,36640,36643,36630,36631,36979, +36976,36975,36967,36971,37167,37163,37161,37162,37170,37158,37166,37253,37254, +37258,37249,37250,37252,37248,37584,37571,37572,37568,37593,37558,37583,37617, +37599,37592,37609,37591,37597,37580,37615,37570,37608,37578,37576,37582,37606, +37581,37589,37577,37600,37598,37607,37585,37587,37557,37601,37574,37556,38268, +38316,38315,38318,38320,38564,38562,38611,38661,38664,38658,38746,38794,38798, +38792,38864,38863,38942,38941,38950,38953,38952,38944,38939,38951,39090,39176, +39162,39185,39188,39190,39191,39189,39388,39373,39375,39379,39380,39374,39369, +39382,39384,39371,39383,39372,39603,39660,39659,39667, +39666,39665,39750,39747,39783,39796,39793,39782,39798,39797,39792,39784,39780, +39788,40188,40186,40189,40191,40183,40199,40192,40185,40187,40200,40197,40196, +40579,40659,40719,40720,20764,20755,20759,20762,20753,20958,21300,21473,22128, +22112,22126,22131,22118,22115,22125,22130,22110,22135,22300,22299,22728,22717, +22729,22719,22714,22722,22716,22726,23319,23321,23323,23329,23316,23315,23312, +23318,23336,23322,23328,23326,23535,23980,23985,23977,23975,23989,23984,23982, +23978,23976,23986,23981,23983,23988,24167,24168,24166,24175,24297,24295,24294, +24296,24293,24395,24508,24989,25000,24982,25029,25012,25030,25025,25036,25018, +25023,25016,24972,25815,25814,25808,25807,25801,25789,25737,25795,25819,25843, +25817,25907,25983,25980,26018,26312,26302,26304,26314,26315,26319,26301,26299, +26298,26316,26403,27188,27238,27209,27239,27186,27240,27198,27229,27245,27254, +27227,27217,27176,27226,27195,27199,27201,27242,27236,27216,27215,27220,27247, +27241,27232,27196,27230,27222,27221,27213,27214,27206,27477,27476,27478,27559, +27562,27563,27592,27591,27652,27651,27654,28589,28619,28579,28615,28604,28622, +28616,28510,28612,28605,28574,28618,28584,28676,28581,28590,28602,28588,28586, +28623,28607,28600,28578,28617,28587,28621,28591,28594,28592,29125,29122,29119, +29112,29142,29120,29121,29131,29140,29130,29127,29135,29117,29144,29116,29126, +29146,29147,29341,29342,29545,29542,29543,29548,29541,29547,29546,29823,29850, +29856,29844,29842,29845,29857,29963,30080,30255,30253,30257,30269,30259,30268, +30261,30258,30256,30395,30438,30618,30621,30625,30620, +30619,30626,30627,30613,30617,30615,30941,30953,30949,30954,30942,30947,30939, +30945,30946,30957,30943,30944,31140,31300,31304,31303,31414,31416,31413,31409, +31415,31710,31715,31719,31709,31701,31717,31706,31720,31737,31700,31722,31714, +31708,31723,31704,31711,31954,31956,31959,31952,31953,32274,32289,32279,32268, +32287,32288,32275,32270,32284,32277,32282,32290,32267,32271,32278,32269,32276, +32293,32292,32579,32635,32636,32634,32689,32751,32810,32809,32876,33201,33190, +33198,33209,33205,33195,33200,33196,33204,33202,33207,33191,33266,33365,33366, +33367,34134,34117,34155,34125,34131,34145,34136,34112,34118,34148,34113,34146, +34116,34129,34119,34147,34110,34139,34161,34126,34158,34165,34133,34151,34144, +34188,34150,34141,34132,34149,34156,34403,34405,34404,34715,34703,34711,34707, +34706,34696,34689,34710,34712,34681,34695,34723,34693,34704,34705,34717,34692, +34708,34716,34714,34697,35102,35110,35120,35117,35118,35111,35121,35106,35113, +35107,35119,35116,35103,35313,35552,35554,35570,35572,35573,35549,35604,35556, +35551,35568,35528,35550,35553,35560,35583,35567,35579,35985,35986,35984,36085, +36078,36081,36080,36083,36204,36206,36261,36263,36403,36414,36408,36416,36421, +36406,36412,36413,36417,36400,36415,36541,36662,36654,36661,36658,36665,36663, +36660,36982,36985,36987,36998,37114,37171,37173,37174,37267,37264,37265,37261, +37263,37671,37662,37640,37663,37638,37647,37754,37688,37692,37659,37667,37650, +37633,37702,37677,37646,37645,37579,37661,37626,37669,37651,37625,37623,37684, +37634,37668,37631,37673,37689,37685,37674,37652,37644, +37643,37630,37641,37632,37627,37654,38332,38349,38334,38329,38330,38326,38335, +38325,38333,38569,38612,38667,38674,38672,38809,38807,38804,38896,38904,38965, +38959,38962,39204,39199,39207,39209,39326,39406,39404,39397,39396,39408,39395, +39402,39401,39399,39609,39615,39604,39611,39670,39674,39673,39671,39731,39808, +39813,39815,39804,39806,39803,39810,39827,39826,39824,39802,39829,39805,39816, +40229,40215,40224,40222,40212,40233,40221,40216,40226,40208,40217,40223,40584, +40582,40583,40622,40621,40661,40662,40698,40722,40765,20774,20773,20770,20772, +20768,20777,21236,22163,22156,22157,22150,22148,22147,22142,22146,22143,22145, +22742,22740,22735,22738,23341,23333,23346,23331,23340,23335,23334,23343,23342, +23419,23537,23538,23991,24172,24170,24510,24507,25027,25013,25020,25063,25056, +25061,25060,25064,25054,25839,25833,25827,25835,25828,25832,25985,25984,26038, +26074,26322,27277,27286,27265,27301,27273,27295,27291,27297,27294,27271,27283, +27278,27285,27267,27304,27300,27281,27263,27302,27290,27269,27276,27282,27483, +27565,27657,28620,28585,28660,28628,28643,28636,28653,28647,28646,28638,28658, +28637,28642,28648,29153,29169,29160,29170,29156,29168,29154,29555,29550,29551, +29847,29874,29867,29840,29866,29869,29873,29861,29871,29968,29969,29970,29967, +30084,30275,30280,30281,30279,30372,30441,30645,30635,30642,30647,30646,30644, +30641,30632,30704,30963,30973,30978,30971,30972,30962,30981,30969,30974,30980, +31147,31144,31324,31323,31318,31320,31316,31322,31422,31424,31425,31749,31759, +31730,31744,31743,31739,31758,31732,31755,31731,31746, +31753,31747,31745,31736,31741,31750,31728,31729,31760,31754,31976,32301,32316, +32322,32307,38984,32312,32298,32329,32320,32327,32297,32332,32304,32315,32310, +32324,32314,32581,32639,32638,32637,32756,32754,32812,33211,33220,33228,33226, +33221,33223,33212,33257,33371,33370,33372,34179,34176,34191,34215,34197,34208, +34187,34211,34171,34212,34202,34206,34167,34172,34185,34209,34170,34168,34135, +34190,34198,34182,34189,34201,34205,34177,34210,34178,34184,34181,34169,34166, +34200,34192,34207,34408,34750,34730,34733,34757,34736,34732,34745,34741,34748, +34734,34761,34755,34754,34764,34743,34735,34756,34762,34740,34742,34751,34744, +34749,34782,34738,35125,35123,35132,35134,35137,35154,35127,35138,35245,35247, +35246,35314,35315,35614,35608,35606,35601,35589,35595,35618,35599,35602,35605, +35591,35597,35592,35590,35612,35603,35610,35919,35952,35954,35953,35951,35989, +35988,36089,36207,36430,36429,36435,36432,36428,36423,36675,36672,36997,36990, +37176,37274,37282,37275,37273,37279,37281,37277,37280,37793,37763,37807,37732, +37718,37703,37756,37720,37724,37750,37705,37712,37713,37728,37741,37775,37708, +37738,37753,37719,37717,37714,37711,37745,37751,37755,37729,37726,37731,37735, +37760,37710,37721,38343,38336,38345,38339,38341,38327,38574,38576,38572,38688, +38687,38680,38685,38681,38810,38817,38812,38814,38813,38869,38868,38897,38977, +38980,38986,38985,38981,38979,39205,39211,39212,39210,39219,39218,39215,39213, +39217,39216,39320,39331,39329,39426,39418,39412,39415,39417,39416,39414,39419, +39421,39422,39420,39427,39614,39678,39677,39681,39676, +39752,39834,39848,39838,39835,39846,39841,39845,39844,39814,39842,39840,39855, +40243,40257,40295,40246,40238,40239,40241,40248,40240,40261,40258,40259,40254, +40247,40256,40253,32757,40237,40586,40585,40589,40624,40648,40666,40699,40703, +40740,40739,40738,40788,40864,20785,20781,20782,22168,22172,22167,22170,22173, +22169,22896,23356,23657,23658,24000,24173,24174,25048,25055,25069,25070,25073, +25066,25072,25067,25046,25065,25855,25860,25853,25848,25857,25859,25852,26004, +26075,26330,26331,26328,27333,27321,27325,27361,27334,27322,27318,27319,27335, +27316,27309,27486,27593,27659,28679,28684,28685,28673,28677,28692,28686,28671, +28672,28667,28710,28668,28663,28682,29185,29183,29177,29187,29181,29558,29880, +29888,29877,29889,29886,29878,29883,29890,29972,29971,30300,30308,30297,30288, +30291,30295,30298,30374,30397,30444,30658,30650,30975,30988,30995,30996,30985, +30992,30994,30993,31149,31148,31327,31772,31785,31769,31776,31775,31789,31773, +31782,31784,31778,31781,31792,32348,32336,32342,32355,32344,32354,32351,32337, +32352,32343,32339,32693,32691,32759,32760,32885,33233,33234,33232,33375,33374, +34228,34246,34240,34243,34242,34227,34229,34237,34247,34244,34239,34251,34254, +34248,34245,34225,34230,34258,34340,34232,34231,34238,34409,34791,34790,34786, +34779,34795,34794,34789,34783,34803,34788,34772,34780,34771,34797,34776,34787, +34724,34775,34777,34817,34804,34792,34781,35155,35147,35151,35148,35142,35152, +35153,35145,35626,35623,35619,35635,35632,35637,35655,35631,35644,35646,35633, +35621,35639,35622,35638,35630,35620,35643,35645,35642, +35906,35957,35993,35992,35991,36094,36100,36098,36096,36444,36450,36448,36439, +36438,36446,36453,36455,36443,36442,36449,36445,36457,36436,36678,36679,36680, +36683,37160,37178,37179,37182,37288,37285,37287,37295,37290,37813,37772,37778, +37815,37787,37789,37769,37799,37774,37802,37790,37798,37781,37768,37785,37791, +37773,37809,37777,37810,37796,37800,37812,37795,37797,38354,38355,38353,38579, +38615,38618,24002,38623,38616,38621,38691,38690,38693,38828,38830,38824,38827, +38820,38826,38818,38821,38871,38873,38870,38872,38906,38992,38993,38994,39096, +39233,39228,39226,39439,39435,39433,39437,39428,39441,39434,39429,39431,39430, +39616,39644,39688,39684,39685,39721,39733,39754,39756,39755,39879,39878,39875, +39871,39873,39861,39864,39891,39862,39876,39865,39869,40284,40275,40271,40266, +40283,40267,40281,40278,40268,40279,40274,40276,40287,40280,40282,40590,40588, +40671,40705,40704,40726,40741,40747,40746,40745,40744,40780,40789,20788,20789, +21142,21239,21428,22187,22189,22182,22183,22186,22188,22746,22749,22747,22802, +23357,23358,23359,24003,24176,24511,25083,25863,25872,25869,25865,25868,25870, +25988,26078,26077,26334,27367,27360,27340,27345,27353,27339,27359,27356,27344, +27371,27343,27341,27358,27488,27568,27660,28697,28711,28704,28694,28715,28705, +28706,28707,28713,28695,28708,28700,28714,29196,29194,29191,29186,29189,29349, +29350,29348,29347,29345,29899,29893,29879,29891,29974,30304,30665,30666,30660, +30705,31005,31003,31009,31004,30999,31006,31152,31335,31336,31795,31804,31801, +31788,31803,31980,31978,32374,32373,32376,32368,32375, +32367,32378,32370,32372,32360,32587,32586,32643,32646,32695,32765,32766,32888, +33239,33237,33380,33377,33379,34283,34289,34285,34265,34273,34280,34266,34263, +34284,34290,34296,34264,34271,34275,34268,34257,34288,34278,34287,34270,34274, +34816,34810,34819,34806,34807,34825,34828,34827,34822,34812,34824,34815,34826, +34818,35170,35162,35163,35159,35169,35164,35160,35165,35161,35208,35255,35254, +35318,35664,35656,35658,35648,35667,35670,35668,35659,35669,35665,35650,35666, +35671,35907,35959,35958,35994,36102,36103,36105,36268,36266,36269,36267,36461, +36472,36467,36458,36463,36475,36546,36690,36689,36687,36688,36691,36788,37184, +37183,37296,37293,37854,37831,37839,37826,37850,37840,37881,37868,37836,37849, +37801,37862,37834,37844,37870,37859,37845,37828,37838,37824,37842,37863,38269, +38362,38363,38625,38697,38699,38700,38696,38694,38835,38839,38838,38877,38878, +38879,39004,39001,39005,38999,39103,39101,39099,39102,39240,39239,39235,39334, +39335,39450,39445,39461,39453,39460,39451,39458,39456,39463,39459,39454,39452, +39444,39618,39691,39690,39694,39692,39735,39914,39915,39904,39902,39908,39910, +39906,39920,39892,39895,39916,39900,39897,39909,39893,39905,39898,40311,40321, +40330,40324,40328,40305,40320,40312,40326,40331,40332,40317,40299,40308,40309, +40304,40297,40325,40307,40315,40322,40303,40313,40319,40327,40296,40596,40593, +40640,40700,40749,40768,40769,40781,40790,40791,40792,21303,22194,22197,22195, +22755,23365,24006,24007,24302,24303,24512,24513,25081,25879,25878,25877,25875, +26079,26344,26339,26340,27379,27376,27370,27368,27385, +27377,27374,27375,28732,28725,28719,28727,28724,28721,28738,28728,28735,28730, +28729,28736,28731,28723,28737,29203,29204,29352,29565,29564,29882,30379,30378, +30398,30445,30668,30670,30671,30669,30706,31013,31011,31015,31016,31012,31017, +31154,31342,31340,31341,31479,31817,31816,31818,31815,31813,31982,32379,32382, +32385,32384,32698,32767,32889,33243,33241,33291,33384,33385,34338,34303,34305, +34302,34331,34304,34294,34308,34313,34309,34316,34301,34841,34832,34833,34839, +34835,34838,35171,35174,35257,35319,35680,35690,35677,35688,35683,35685,35687, +35693,36270,36486,36488,36484,36697,36694,36695,36693,36696,36698,37005,37187, +37185,37303,37301,37298,37299,37899,37907,37883,37920,37903,37908,37886,37909, +37904,37928,37913,37901,37877,37888,37879,37895,37902,37910,37906,37882,37897, +37880,37898,37887,37884,37900,37878,37905,37894,38366,38368,38367,38702,38703, +38841,38843,38909,38910,39008,39010,39011,39007,39105,39106,39248,39246,39257, +39244,39243,39251,39474,39476,39473,39468,39466,39478,39465,39470,39480,39469, +39623,39626,39622,39696,39698,39697,39947,39944,39927,39941,39954,39928,40000, +39943,39950,39942,39959,39956,39945,40351,40345,40356,40349,40338,40344,40336, +40347,40352,40340,40348,40362,40343,40353,40346,40354,40360,40350,40355,40383, +40361,40342,40358,40359,40601,40603,40602,40677,40676,40679,40678,40752,40750, +40795,40800,40798,40797,40793,40849,20794,20793,21144,21143,22211,22205,22206, +23368,23367,24011,24015,24305,25085,25883,27394,27388,27395,27384,27392,28739, +28740,28746,28744,28745,28741,28742,29213,29210,29209, +29566,29975,30314,30672,31021,31025,31023,31828,31827,31986,32394,32391,32392, +32395,32390,32397,32589,32699,32816,33245,34328,34346,34342,34335,34339,34332, +34329,34343,34350,34337,34336,34345,34334,34341,34857,34845,34843,34848,34852, +34844,34859,34890,35181,35177,35182,35179,35322,35705,35704,35653,35706,35707, +36112,36116,36271,36494,36492,36702,36699,36701,37190,37188,37189,37305,37951, +37947,37942,37929,37949,37948,37936,37945,37930,37943,37932,37952,37937,38373, +38372,38371,38709,38714,38847,38881,39012,39113,39110,39104,39256,39254,39481, +39485,39494,39492,39490,39489,39482,39487,39629,39701,39703,39704,39702,39738, +39762,39979,39965,39964,39980,39971,39976,39977,39972,39969,40375,40374,40380, +40385,40391,40394,40399,40382,40389,40387,40379,40373,40398,40377,40378,40364, +40392,40369,40365,40396,40371,40397,40370,40570,40604,40683,40686,40685,40731, +40728,40730,40753,40782,40805,40804,40850,20153,22214,22213,22219,22897,23371, +23372,24021,24017,24306,25889,25888,25894,25890,27403,27400,27401,27661,28757, +28758,28759,28754,29214,29215,29353,29567,29912,29909,29913,29911,30317,30381, +31029,31156,31344,31345,31831,31836,31833,31835,31834,31988,31985,32401,32591, +32647,33246,33387,34356,34357,34355,34348,34354,34358,34860,34856,34854,34858, +34853,35185,35263,35262,35323,35710,35716,35714,35718,35717,35711,36117,36501, +36500,36506,36498,36496,36502,36503,36704,36706,37191,37964,37968,37962,37963, +37967,37959,37957,37960,37961,37958,38719,38883,39018,39017,39115,39252,39259, +39502,39507,39508,39500,39503,39496,39498,39497,39506, +39504,39632,39705,39723,39739,39766,39765,40006,40008,39999,40004,39993,39987, +40001,39996,39991,39988,39986,39997,39990,40411,40402,40414,40410,40395,40400, +40412,40401,40415,40425,40409,40408,40406,40437,40405,40413,40630,40688,40757, +40755,40754,40770,40811,40853,40866,20797,21145,22760,22759,22898,23373,24024, +34863,24399,25089,25091,25092,25897,25893,26006,26347,27409,27410,27407,27594, +28763,28762,29218,29570,29569,29571,30320,30676,31847,31846,32405,33388,34362, +34368,34361,34364,34353,34363,34366,34864,34866,34862,34867,35190,35188,35187, +35326,35724,35726,35723,35720,35909,36121,36504,36708,36707,37308,37986,37973, +37981,37975,37982,38852,38853,38912,39510,39513,39710,39711,39712,40018,40024, +40016,40010,40013,40011,40021,40025,40012,40014,40443,40439,40431,40419,40427, +40440,40420,40438,40417,40430,40422,40434,40432,40418,40428,40436,40435,40424, +40429,40642,40656,40690,40691,40710,40732,40760,40759,40758,40771,40783,40817, +40816,40814,40815,22227,22221,23374,23661,25901,26349,26350,27411,28767,28769, +28765,28768,29219,29915,29925,30677,31032,31159,31158,31850,32407,32649,33389, +34371,34872,34871,34869,34891,35732,35733,36510,36511,36512,36509,37310,37309, +37314,37995,37992,37993,38629,38726,38723,38727,38855,38885,39518,39637,39769, +40035,40039,40038,40034,40030,40032,40450,40446,40455,40451,40454,40453,40448, +40449,40457,40447,40445,40452,40608,40734,40774,40820,40821,40822,22228,25902, +26040,27416,27417,27415,27418,28770,29222,29354,30680,30681,31033,31849,31851, +31990,32410,32408,32411,32409,33248,33249,34374,34375, +34376,35193,35194,35196,35195,35327,35736,35737,36517,36516,36515,37998,37997, +37999,38001,38003,38729,39026,39263,40040,40046,40045,40459,40461,40464,40463, +40466,40465,40609,40693,40713,40775,40824,40827,40826,40825,22302,28774,31855, +34876,36274,36518,37315,38004,38008,38006,38005,39520,40052,40051,40049,40053, +40468,40467,40694,40714,40868,28776,28773,31991,34410,34878,34877,34879,35742, +35996,36521,36553,38731,39027,39028,39116,39265,39339,39524,39526,39527,39716, +40469,40471,40776,25095,27422,29223,34380,36520,38018,38016,38017,39529,39528, +39726,40473,29225,34379,35743,38019,40057,40631,30325,39531,40058,40477,28777, +28778,40612,40830,40777,40856,30849,37561,35023,22715,24658,31911,23290,9556, +9574,9559,9568,9580,9571,9562,9577,9565,9554,9572,9557,9566,9578,9569,9560, +9575,9563,9555,9573,9558,9567,9579,9570,9561,9576,9564,9553,9552,9581,9582, +9584,9583,9619, diff --git a/Ubiquitous/XiZi/lib/musllib/src/locale/c_locale.c b/Ubiquitous/XiZi/lib/musllib/src/locale/c_locale.c new file mode 100644 index 000000000..77ccf5873 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/locale/c_locale.c @@ -0,0 +1,15 @@ +#include "locale_impl.h" +#include + +static const uint32_t empty_mo[] = { 0x950412de, 0, -1, -1, -1 }; + +const struct __locale_map __c_dot_utf8 = { + .map = empty_mo, + .map_size = sizeof empty_mo, + .name = "C.UTF-8" +}; + +const struct __locale_struct __c_locale = { 0 }; +const struct __locale_struct __c_dot_utf8_locale = { + .cat[LC_CTYPE] = &__c_dot_utf8 +}; diff --git a/Ubiquitous/XiZi/lib/musllib/src/locale/codepages.h b/Ubiquitous/XiZi/lib/musllib/src/locale/codepages.h new file mode 100644 index 000000000..4e236ef3a --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/locale/codepages.h @@ -0,0 +1,320 @@ +"iso88591\0" +"latin1\0" +"\0\100" + +"iso88592\0" +"\0\50" +"\240\20\364\127\116\244\334\364\324\51\250\124\65\125\126\156\265\42\27\134" +"\260\24\24\230\116\264\340\4\225\137\270\130\105\225\126\157\15\66\127\134" +"\111\5\43\214\100\304\314\144\320\61\14\45\143\321\62\30\65\343\214\103" +"\20\355\364\323\64\324\24\145\315\65\115\215\245\115\131\334\164\163\325\67" +"\112\205\43\316\100\344\320\164\320\71\15\245\163\321\72\31\265\343\316\103" +"\21\361\4\324\74\364\30\145\317\75\116\221\245\217\131\374\364\203\25\140" + +"iso88593\0" +"\0\50" +"\240\220\364\327\50\244\0\40\322\51\250\260\64\25\107\56\265\2\0\134" +"\260\224\44\313\54\264\324\62\322\55\270\264\104\125\107\57\365\2\100\134" +"\300\4\43\14\0\304\50\204\320\61\310\44\243\314\62\314\64\343\314\63" +"\0\104\43\315\64\324\170\144\315\65\32\145\243\315\66\334\204\25\325\67" +"\340\204\43\16\0\344\54\224\320\71\350\244\243\316\72\354\264\343\316\73" +"\0\304\43\317\74\364\174\144\317\75\33\345\243\317\76\374\210\45\25\140" + +"iso88594\0" +"\0\50" +"\240\20\44\323\122\244\230\124\323\51\250\124\45\21\110\133\265\42\327\53" +"\260\24\24\30\123\264\234\144\223\137\270\130\65\121\110\134\5\65\227\120" +"\0\5\43\314\60\304\24\143\214\112\14\45\143\321\62\24\65\343\14\112" +"\20\365\64\24\114\324\124\143\315\65\330\234\245\315\66\334\164\365\325\67" +"\1\205\43\316\70\344\224\143\316\112\15\245\163\321\72\25\265\343\116\112" +"\21\371\104\124\114\364\324\143\317\75\370\240\245\317\76\374\170\5\26\140" + +"iso88595\0" +"\0\50" +"\240\104\47\335\164\324\125\147\335\165\330\145\247\335\166" +"\334\265\322\235\167\337\201\27\236\170\343\221\127\236\171" +"\347\241\227\236\172\353\261\327\236\173\357\301\27\237\174" +"\363\321\127\237\175\367\341\227\237\176\373\361\327\237\177\377\1\30\240\200" +"\3\22\130\240\201\7\42\230\240\202\13\62\330\240\203\17\102\30\241\204" +"\23\122\130\241\205\27\142\230\241\206\33\162\330\241\207\46\177\10\142\210" +"\42\216\110\142\211\46\236\210\142\212\52\236\262\42\213" + +"iso88596\0" +"\0\50" +"\240\0\0\0\0\244\0\0\0\0\0\0\0\0\0\142\266\2\0\0\0\0\0\0\0\0\0\0\0\0" +"\0\0\0\300\230\0\0\0\0\231\0\224\151\346\231\150\246\251\346\232" +"\154\266\351\346\233\160\306\51\347\234\164\326\151\347\235" +"\170\346\251\347\236\174\366\351\47\0\0\0\0\0\0\177\2\32\250\240" +"\203\22\132\250\241\207\42\232\250\242\213\62\332\250\243\217\102\32\51\0" +"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + +"iso88597\0" +"\0\50" +"\240\114\114\361\50\44\227\154\312\51\250\244\222\330\52\254\264\2\100\304" +"\260\304\42\313\54\212\55\306\330\55\215\71\366\330\56\220\365\22\231\144" +"\223\121\126\231\145\227\141\226\231\146\233\161\326\231\147" +"\237\201\26\232\150\243\221\6\100\151\246\235\206\132\152\252\255\306\132\153" +"\256\275\6\133\154\262\315\106\133\155\266\335\206\133\156\272\355\306\133\157" +"\276\375\6\134\160\302\15\107\134\161\306\35\207\134\162\312\55\307\134\163" +"\316\75\7\35\0" + +"iso88598\0" +"\0\50" +"\240\0\40\312\50\244\224\142\312\51\250\244\162\315\52\254\264\342\312\53" +"\260\304\42\313\54\264\324\142\313\55\270\344\162\317\56\274\364\342\13\0" +"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" +"\0\0\0\200\304\102\16\111\144\221\106\36\211\144\222\112\56\311\144\223" +"\116\76\11\145\224\122\116\111\145\225\126\136\211\145\226\132\156\311\45\0" +"\0\64\354\60\0" + +"iso88599\0" +"\0\64" +"\34\105\43\315\64\324\124\143\315\65\330\144\243\315\66\334\260\64\325\67" +"\340\204\43\316\70\344\224\143\316\71\350\244\243\316\72\354\264\343\316\73" +"\35\305\43\317\74\364\324\143\317\75\370\344\243\317\76\374\264\104\325\77" + +"iso885910\0" +"\0\50" +"\240\20\44\21\110\50\231\4\323\51\65\101\124\325\126\162\265\362\125\120" +"\260\24\64\121\110\51\235\24\323\55\66\105\144\25\127\163\105\14\226\120" +"\0\5\43\314\60\304\24\143\214\112\14\45\143\321\62\24\65\343\314\63" +"\320\364\64\324\64\324\124\143\115\127\330\234\245\315\66\334\164\343\315\67" +"\1\205\43\316\70\344\224\143\316\112\15\245\163\321\72\25\265\343\316\73" +"\360\370\104\324\74\364\324\143\217\127\370\240\245\317\76\374\364\343\217\114" + +"iso885911\0" +"tis620\0" +"\0\50" +"\240\170\372\51\250\241\212\72\52\251\245\232\172\52\252\251\252\272\52\253" +"\255\272\372\52\254\261\312\72\53\255\265\332\172\53\256\271\352\272\53\257" +"\275\372\372\53\260\301\12\73\54\261\305\32\173\54\262\311\52\273\54\263" +"\315\72\373\54\264\321\112\73\55\265\325\132\173\55\0\0\0\0\0\266" +"\331\152\273\55\267\335\172\373\55\270\341\212\73\56\271\345\232\173\56\272" +"\351\252\273\56\273\355\272\373\56\274\361\312\73\57\275\0\0\0\0\0" + +"iso885913\0" +"\0\50" +"\240\134\54\312\50\244\140\154\312\51\330\244\262\324\52\254\264\342\212\61" +"\260\304\42\313\54\26\327\142\313\55\370\344\302\324\56\274\364\342\213\71" +"\4\251\4\220\101\304\24\143\221\104\14\45\343\26\105\40\301\204\122\115" +"\125\355\324\323\64\103\125\143\315\65\147\345\364\324\127\334\300\45\327\67" +"\5\255\24\320\101\344\224\163\321\104\15\245\363\126\105\41\305\224\222\115" +"\126\361\344\323\74\104\325\143\317\75\150\351\4\25\130\374\304\65\27\305" + +"iso885914\0" +"\0\50" +"\240\324\153\357\50\12\55\164\357\51\3\247\122\60\276\11\267\342\112\133" +"\371\352\353\321\107\373\362\153\113\277\4\373\153\360\277\12\37\214\60\300" +"\300\4\43\314\60\304\24\143\314\61\310\44\243\314\62\314\64\343\314\63" +"\151\105\43\315\64\324\124\143\115\300\330\144\243\315\66\334\164\263\326\67" +"\340\204\43\316\70\344\224\143\316\71\350\244\243\316\72\354\264\343\316\73" +"\152\305\43\317\74\364\324\143\217\300\370\344\243\317\76\374\364\303\326\77" + +"iso885915\0" +"latin9\0" +"\0\51" +"\44\227\122\325\51\126\245\242\312\52\254\264\342\312\53\260\304\42\313\54" +"\162\325\142\313\55\163\345\242\313\56\107\41\325\326\57\300\4\43\314\60" +"\304\24\143\314\61\310\44\243\314\62\314\64\343\314\63\320\104\43\315\64" +"\324\124\143\315\65\330\144\243\315\66\334\164\343\315\67\340\204\43\316\70" +"\344\224\143\316\71\350\244\243\316\72\354\264\343\316\73\360\304\43\317\74" +"\364\324\143\317\75\370\344\243\317\76\374\364\343\317\77" + +"iso885916\0" +"\0\50" +"\240\20\124\120\116\44\143\134\325\51\126\245\222\327\52\156\265\362\26\134" +"\260\304\302\220\116\162\135\154\313\55\163\65\244\327\56\107\41\325\126\134" +"\300\4\43\214\100\304\30\144\314\61\310\44\243\314\62\314\64\343\314\63" +"\20\355\44\315\64\324\24\145\315\123\145\145\243\315\66\334\130\264\327\67" +"\340\204\43\316\100\344\34\144\316\71\350\244\243\316\72\354\264\343\316\73" +"\21\361\44\317\74\364\30\145\17\124\146\345\243\317\76\374\134\304\327\77" + +"cp1250\0" +"windows1250\0" +"\0\40" +"\44\3\120\61\0\30\163\234\261\306\0\164\134\225\307\117\145\45\227\133" +"\0\114\114\261\305\27\157\374\60\304\0\234\154\325\307\120\151\65\327\133" +"\240\370\365\127\116\244\20\144\312\51\250\244\62\325\52\254\264\342\12\134" +"\260\304\22\230\116\264\324\142\313\55\270\24\104\325\56\67\15\206\123\134" +"\111\5\43\214\100\304\314\144\320\61\14\45\143\321\62\30\65\343\214\103" +"\20\355\364\323\64\324\24\145\315\65\115\215\245\115\131\334\164\163\325\67" +"\112\205\43\316\100\344\320\164\320\71\15\245\163\321\72\31\265\343\316\103" +"\21\361\4\324\74\364\30\145\317\75\116\221\245\217\131\374\364\203\25\140" + +"cp1251\0" +"windows1251\0" +"\0\40" +"\322\115\127\161\210\30\163\234\261\306\44\167\234\235\307\332\161\267\235\167" +"\40\116\114\261\305\27\157\374\60\304\0\234\174\342\307\50\252\230\42\213" +"\240\164\267\42\166\244\264\150\312\51\321\245\102\335\52\254\264\342\312\165" +"\260\304\142\35\211\56\326\142\313\55\37\232\54\342\56\46\126\67\142\211" +"\337\201\27\236\170\343\221\127\236\171\347\241\227\236\172" +"\353\261\327\236\173\357\301\27\237\174\363\321\127\237\175" +"\367\341\227\237\176\373\361\327\237\177\377\1\30\240\200\3\22\130\240\201" +"\7\42\230\240\202\13\62\330\240\203\17\102\30\241\204\23\122\130\241\205" +"\27\142\230\241\206\33\162\330\241\207" + +"cp1252\0" +"windows1252\0" +"\0\40" +"\44\3\120\61\135\30\163\234\261\306\175\165\134\225\307\107\1\40\27\0" +"\0\114\114\261\305\27\157\374\60\304\202\235\154\325\307\110\1\60\127\133" +"\240\204\42\312\50\244\224\142\312\51\250\244\242\312\52\254\264\342\312\53" +"\260\304\42\313\54\264\324\142\313\55\270\344\242\313\56\274\364\342\313\57" +"\300\4\43\314\60\304\24\143\314\61\310\44\243\314\62\314\64\343\314\63" +"\320\104\43\315\64\324\124\143\315\65\330\144\243\315\66\334\164\343\315\67" +"\340\204\43\316\70\344\224\143\316\71\350\244\243\316\72\354\264\343\316\73" +"\360\304\43\317\74\364\324\143\317\75\370\344\243\317\76\374\364\343\317\77" + +"cp1253\0" +"windows1253\0" +"\0\40" +"\44\3\120\61\135\30\163\234\261\306\0\164\14\200\307\0\0\0\0\0" +"\0\114\114\261\305\27\157\374\60\304\0\234\14\300\307\0\0\0\0\0" +"\240\54\306\330\50\244\224\142\312\51\250\244\2\300\52\254\264\342\112\304" +"\260\304\42\313\54\212\325\142\313\55\215\71\366\330\56\220\365\22\231\144" +"\223\121\126\231\145\227\141\226\231\146\233\161\326\231\147" +"\237\201\26\232\150\243\221\6\100\151\246\235\206\132\152\252\255\306\132\153" +"\256\275\6\133\154\262\315\106\133\155\266\335\206\133\156\272\355\306\133\157" +"\276\375\6\134\160\302\15\107\134\161\306\35\207\134\162\312\55\307\134\163" +"\316\75\7\35\0" + +"cp1254\0" +"windows1254\0" +"\0\40" +"\44\3\120\61\135\30\163\234\261\306\175\165\134\225\307\107\1\0\0\0" +"\0\114\114\261\305\27\157\374\60\304\202\235\154\325\307\110\1\0\100\133" +"\240\204\42\312\50\244\224\142\312\51\250\244\242\312\52\254\264\342\312\53" +"\260\304\42\313\54\264\324\142\313\55\270\344\242\313\56\274\364\342\313\57" +"\300\4\43\314\60\304\24\143\314\61\310\44\243\314\62\314\64\343\314\63" +"\34\105\43\315\64\324\124\143\315\65\330\144\243\315\66\334\260\64\325\67" +"\340\204\43\316\70\344\224\143\316\71\350\244\243\316\72\354\264\343\316\73" +"\35\305\43\317\74\364\324\143\317\75\370\344\243\317\76\374\264\104\325\77" + +"cp1255\0" +"windows1255\0" +"\0\40" +"\44\3\120\61\135\30\163\234\261\306\175\165\14\200\307\0\0\0\0\0" +"\0\114\114\261\305\27\157\374\60\304\202\235\14\300\307\0\0\0\0\0" +"\240\204\42\312\50\42\227\142\312\51\250\244\162\315\52\254\264\342\312\53" +"\260\304\42\313\54\264\324\142\313\55\270\344\162\317\56\274\364\342\313\57" +"\57\302\30\243\214\63\322\130\243\215\67\342\10\100\216\72\356\310\143\217" +"\76\376\10\144\220\135\172\371\45\230\141\2\0\0\0\0\0\0\0\0\102\16\111\144\221" +"\106\36\211\144\222\112\56\311\144\223\116\76\11\145\224\122\116\111\145\225" +"\126\136\211\145\226\132\156\311\45\0\0\64\354\60\0" + +"cp1256\0" +"windows1256\0" +"\0\40" +"\44\117\132\61\135\30\163\234\261\306\175\165\54\251\307\107\121\172\151\245" +"\231\116\114\261\305\27\157\374\60\304\230\236\154\351\307\110\55\314\260\246" +"\240\210\51\312\50\244\224\142\312\51\250\244\262\351\52\254\264\342\312\53" +"\260\304\42\313\54\264\324\142\313\55\270\344\62\346\56\274\364\342\13\231" +"\234\226\151\346\231\150\246\251\346\232\154\266\351\346\233" +"\160\306\51\347\234\164\326\151\347\235\170\346\251\347\65\173\362\331\247\237" +"\177\2\32\250\240\340\14\52\16\241\205\32\172\350\71\350\244\243\316\72" +"\210\46\352\316\73\212\56\312\150\243\364\70\372\350\75\220\346\23\351\76" +"\374\64\354\160\247" + +"cp1257\0" +"windows1257\0" +"\0\40" +"\44\3\120\61\0\30\163\234\261\306\0\164\14\200\307\0\240\342\27\56" +"\0\114\114\261\305\27\157\374\60\304\0\234\14\300\307\0\274\22\30\0" +"\240\0\40\312\50\244\0\140\312\51\330\244\262\324\52\254\264\342\212\61" +"\260\304\42\313\54\264\324\142\313\55\370\344\302\324\56\274\364\342\213\71" +"\4\251\4\220\101\304\24\143\221\104\14\45\343\26\105\40\301\204\122\115" +"\125\355\324\323\64\103\125\143\315\65\147\345\364\324\127\334\300\45\327\67" +"\5\255\24\320\101\344\224\163\321\104\15\245\363\126\105\41\305\224\222\115" +"\126\361\344\323\74\104\325\143\317\75\150\351\4\25\130\374\304\65\27\140" + +"cp1258\0" +"windows1258\0" +"\0\40" +"\44\3\120\61\135\30\163\234\261\306\175\165\14\200\307\107\1\0\0\0" +"\0\114\114\261\305\27\157\374\60\304\202\235\14\300\307\110\1\0\100\133" +"\240\204\42\312\50\244\224\142\312\51\250\244\242\312\52\254\264\342\312\53" +"\260\304\42\313\54\264\324\142\313\55\270\344\242\313\56\274\364\342\313\57" +"\300\4\43\214\100\304\24\143\314\61\310\44\243\314\62\204\65\343\314\63" +"\20\105\163\330\64\324\324\145\315\65\330\144\243\315\66\334\334\145\330\67" +"\340\204\43\316\100\344\224\143\316\71\350\244\243\316\72\205\265\343\316\73" +"\21\305\203\330\74\364\330\145\317\75\370\344\243\317\76\374\340\65\362\77" + +"koi8r\0" +"\0\40" +"\63\323\134\263\315\67\343\234\263\316\73\363\334\363\326\134\167\355\365\327" +"\140\207\55\166\314\143\243\234\62\313\56\277\14\212\314\260\310\162\313\75" +"\76\377\14\364\207\101\13\75\64\321\105\33\175\64\322\111\53\275\64\323" +"\115\73\375\164\164\120\107\55\365\324\124\127\155\365\325\130\147\255\165\52" +"\35\376\7\140\205\3\22\70\241\200\24\36\210\140\202\12\56\310\140\203" +"\16\172\370\40\204\21\112\130\140\200\33\152\150\340\205\34\142\150\141\206" +"\375\175\7\136\175\343\221\67\237\170\364\235\207\136\172\352\255\307\136\173" +"\356\371\367\36\174\361\311\127\136\170\373\351\147\336\175" +"\374\341\147\137\176" + +"koi8u\0" +"\0\40" +"\63\323\134\263\315\67\343\234\263\316\73\363\334\363\326\134\167\355\365\327" +"\140\207\55\166\314\143\243\234\62\313\56\277\14\212\314\260\310\162\313\75" +"\76\377\14\364\207\42\12\115\142\211\105\33\175\64\322\111\273\270\64\323" +"\115\73\375\164\164\324\105\155\335\165\124\127\155\365\325\130\267\250\165\52" +"\35\376\7\140\205\3\22\70\241\200\24\36\210\140\202\12\56\310\140\203" +"\16\172\370\40\204\21\112\130\140\200\33\152\150\340\205\34\142\150\141\206" +"\375\175\7\136\175\343\221\67\237\170\364\235\207\136\172\352\255\307\136\173" +"\356\371\367\36\174\361\311\127\136\170\373\351\147\336\175" +"\374\341\147\137\176" + +"cp437\0" +"\0\40" +"\307\360\223\216\70\344\200\123\316\71\352\254\203\316\73\356\260\103\114\61" +"\311\230\143\14\75\366\310\263\117\76\377\130\303\215\50\243\224\22\62\135" +"\341\264\63\217\76\361\104\243\212\56\277\300\314\112\57\274\204\262\312\56" +"\140\207\55\66\315\72\77\15\65\321\103\107\375\163\321\113\53\235\264\315" +"\67\363\274\163\316\63\367\314\164\323\110\13\175\65\325\116\373\254\165\325" +"\126\113\75\365\321\106\3\35\164\326\130\343\134\163\327\134\173\375\365\326" +"\263\175\143\231\160\245\25\127\213\161\250\155\266\232\155\52\43\167\333\312" +"\55\307\362\262\313\61\313\174\17\313\260\240\174\113\312\40\313\62\66\50" + +"cp850\0" +"\0\40" +"\307\360\223\216\70\344\200\123\316\71\352\254\203\316\73\356\260\103\114\61" +"\311\230\143\14\75\366\310\263\117\76\377\130\303\15\76\243\140\163\15\135" +"\341\264\63\217\76\361\104\243\212\56\277\270\302\112\57\274\204\262\312\56" +"\140\207\55\66\315\72\7\43\14\60\251\104\375\163\321\113\213\122\212\315" +"\67\363\274\163\316\63\367\74\316\60\110\13\175\65\325\116\373\254\65\51" +"\360\100\243\314\62\310\264\324\214\63\317\340\134\163\327\134\233\302\314\326" +"\323\174\103\215\64\365\124\123\213\77\336\150\263\115\66\375\164\363\12\55" +"\255\304\42\261\57\266\234\162\17\56\260\240\162\113\56\263\310\62\66\50" + +"cp866\0" +"\0\40" +"\337\201\27\236\170\343\221\127\236\171\347\241\227\236\172" +"\353\261\327\236\173\357\301\27\237\174\363\321\127\237\175" +"\367\341\227\237\176\373\361\327\237\177\377\1\30\240\200\3\22\130\240\201" +"\7\42\230\240\202\13\62\330\240\203\140\207\55\66\315\72\77\15\65\321" +"\103\107\375\163\321\113\53\235\264\315\67\363\274\163\316\63\367\314\164\323" +"\110\13\175\65\325\116\373\254\165\325\126\113\75\365\321\106\3\35\164\326" +"\130\343\134\163\327\134\173\375\365\326\17\102\30\241\204\23\122\130\241\205" +"\27\142\230\241\206\33\162\330\241\207\321\175\110\235\210\327\225\330\335\212" +"\260\240\174\113\312\46\223\62\66\50" + +"ibm1047\0" +"cp1047\0" +"\0\1" +"\234\44\140\310\37\227\64\342\310\2\14\64\340\300\3\20\104\40\301\4" +"\235\24\202\300\41\30\144\40\311\43\34\164\340\301\7\200\4\42\310\40" +"\204\50\160\301\6\210\44\242\310\42\214\24\140\300\1\220\104\142\301\44" +"\224\124\142\11\1\230\144\242\311\46\24\124\340\211\6\40\200\42\16\71" +"\340\204\63\116\71\347\304\43\212\13\74\240\260\2\37\46\244\243\316\72" +"\350\264\343\316\73\354\174\23\2\11\52\244\260\203\27\55\274\40\14\61" +"\300\4\63\114\61\307\104\143\12\13\45\174\341\303\17\370\44\243\314\62" +"\310\64\343\314\63\314\200\241\303\10\100\234\320\203\10\330\204\41\306\30" +"\144\224\141\306\31\150\244\261\312\56\360\364\343\117\54\260\250\261\6\33" +"\155\270\361\6\34\161\310\241\212\56\346\340\142\14\51\265\370\61\7\35" +"\165\330\161\7\36\171\350\21\312\57\320\154\341\215\53\254\214\122\312\55" +"\251\234\142\13\57\275\370\322\15\52\257\164\101\313\65\173\4\41\304\20" +"\104\24\141\304\21\110\44\321\12\75\366\310\63\117\75\175\50\261\4\23" +"\115\70\361\4\24\121\110\221\313\76\374\344\243\317\77\134\334\63\5\25" +"\125\130\161\5\26\131\150\41\13\65\326\110\63\115\65\60\304\40\303\14" +"\64\324\140\303\15\70\344\60\313\66\334\144\243\315\47" + diff --git a/Ubiquitous/XiZi/lib/musllib/src/locale/gb18030.h b/Ubiquitous/XiZi/lib/musllib/src/locale/gb18030.h new file mode 100644 index 000000000..8f300e9b6 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/locale/gb18030.h @@ -0,0 +1,1866 @@ +19970,19972,19973,19974,19983,19986,19991,19999,20000,20001,20003,20006,20009, +20014,20015,20017,20019,20021,20023,20028,20032,20033,20034,20036,20038,20042, +20049,20053,20055,20058,20059,20066,20067,20068,20069,20071,20072,20074,20075, +20076,20077,20078,20079,20082,20084,20085,20086,20087,20088,20089,20090,20091, +20092,20093,20095,20096,20097,20098,20099,20100,20101,20103,20106,20112,20118, +20119,20121,20124,20125,20126,20131,20138,20143,20144,20145,20148,20150,20151, +20152,20153,20156,20157,20158,20168,20172,20175,20176,20178,20186,20187,20188, +20192,20194,20198,20199,20201,20205,20206,20207,20209,20212,20216,20217,20218, +20220,20222,20224,20226,20227,20228,20229,20230,20231,20232,20235,20236,20242, +20243,20244,20245,20246,20252,20253,20257,20259,20264,20265,20268,20269,20270, +20273,20275,20277,20279,20281,20283,20286,20287,20288,20289,20290,20292,20293, +20295,20296,20297,20298,20299,20300,20306,20308,20310,20321,20322,20326,20328, +20330,20331,20333,20334,20337,20338,20341,20343,20344,20345,20346,20349,20352, +20353,20354,20357,20358,20359,20362,20364,20366,20368,20370,20371,20373,20374, +20376,20377,20378,20380,20382,20383,20385,20386,20388,20395,20397,20400,20401, +20402,20403,20404,20406,20407,20408,20409,20410,20411,20412,20413,20414,20416, +20417,20418,20422,20423,20424,20425,20427,20428,20429,20434,20435,20436,20437, +20438,20441,20443,20448,20450,20452,20453,20455,20459,20460,20464,20466,20468, +20469,20470,20471,20473,20475,20476,20477,20479,20480,20481,20482,20483,20484, +20485,20486,20487,20488,20489,20490,20491,20494, +20496,20497,20499,20501,20502,20503,20507,20509,20510,20512,20514,20515,20516, +20519,20523,20527,20528,20529,20530,20531,20532,20533,20534,20535,20536,20537, +20539,20541,20543,20544,20545,20546,20548,20549,20550,20553,20554,20555,20557, +20560,20561,20562,20563,20564,20566,20567,20568,20569,20571,20573,20574,20575, +20576,20577,20578,20579,20580,20582,20583,20584,20585,20586,20587,20589,20590, +20591,20592,20593,20594,20595,20596,20597,20600,20601,20602,20604,20605,20609, +20610,20611,20612,20614,20615,20617,20618,20619,20620,20622,20623,20624,20625, +20626,20627,20628,20629,20630,20631,20632,20633,20634,20635,20636,20637,20638, +20639,20640,20641,20642,20644,20646,20650,20651,20653,20654,20655,20656,20657, +20659,20660,20661,20662,20663,20664,20665,20668,20669,20670,20671,20672,20673, +20674,20675,20676,20677,20678,20679,20680,20681,20682,20683,20684,20685,20686, +20688,20689,20690,20691,20692,20693,20695,20696,20697,20699,20700,20701,20702, +20703,20704,20705,20706,20707,20708,20709,20712,20713,20714,20715,20719,20720, +20721,20722,20724,20726,20727,20728,20729,20730,20732,20733,20734,20735,20736, +20737,20738,20739,20740,20741,20744,20745,20746,20748,20749,20750,20751,20752, +20753,20755,20756,20757,20758,20759,20760,20761,20762,20763,20764,20765,20766, +20767,20768,20770,20771,20772,20773,20774,20775,20776,20777,20778,20779,20780, +20781,20782,20783,20784,20785,20786,20787,20788,20789,20790,20791,20792,20793, +20794,20795,20796,20797,20798,20802,20807,20810,20812,20814,20815,20816,20818, +20819,20823,20824,20825,20827,20829,20830,20831,20832, +20833,20835,20836,20838,20839,20841,20842,20847,20850,20858,20862,20863,20867, +20868,20870,20871,20874,20875,20878,20879,20880,20881,20883,20884,20888,20890, +20893,20894,20895,20897,20899,20902,20903,20904,20905,20906,20909,20910,20916, +20920,20921,20922,20926,20927,20929,20930,20931,20933,20936,20938,20941,20942, +20944,20946,20947,20948,20949,20950,20951,20952,20953,20954,20956,20958,20959, +20962,20963,20965,20966,20967,20968,20969,20970,20972,20974,20977,20978,20980, +20983,20990,20996,20997,21001,21003,21004,21007,21008,21011,21012,21013,21020, +21022,21023,21025,21026,21027,21029,21030,21031,21034,21036,21039,21041,21042, +21044,21045,21052,21054,21060,21061,21062,21063,21064,21065,21067,21070,21071, +21074,21075,21077,21079,21080,21081,21082,21083,21085,21087,21088,21090,21091, +21092,21094,21096,21099,21100,21101,21102,21104,21105,21107,21108,21109,21110, +21111,21112,21113,21114,21115,21116,21118,21120,21123,21124,21125,21126,21127, +21129,21130,21131,21132,21133,21134,21135,21137,21138,21140,21141,21142,21143, +21144,21145,21146,21148,21156,21157,21158,21159,21166,21167,21168,21172,21173, +21174,21175,21176,21177,21178,21179,21180,21181,21184,21185,21186,21188,21189, +21190,21192,21194,21196,21197,21198,21199,21201,21203,21204,21205,21207,21209, +21210,21211,21212,21213,21214,21216,21217,21218,21219,21221,21222,21223,21224, +21225,21226,21227,21228,21229,21230,21231,21233,21234,21235,21236,21237,21238, +21239,21240,21243,21244,21245,21249,21250,21251,21252,21255,21257,21258,21259, +21260,21262,21265,21266,21267,21268,21272,21275,21276, +21278,21279,21282,21284,21285,21287,21288,21289,21291,21292,21293,21295,21296, +21297,21298,21299,21300,21301,21302,21303,21304,21308,21309,21312,21314,21316, +21318,21323,21324,21325,21328,21332,21336,21337,21339,21341,21349,21352,21354, +21356,21357,21362,21366,21369,21371,21372,21373,21374,21376,21377,21379,21383, +21384,21386,21390,21391,21392,21393,21394,21395,21396,21398,21399,21401,21403, +21404,21406,21408,21409,21412,21415,21418,21419,21420,21421,21423,21424,21425, +21426,21427,21428,21429,21431,21432,21433,21434,21436,21437,21438,21440,21443, +21444,21445,21446,21447,21454,21455,21456,21458,21459,21461,21466,21468,21469, +21470,21473,21474,21479,21492,21498,21502,21503,21504,21506,21509,21511,21515, +21524,21528,21529,21530,21532,21538,21540,21541,21546,21552,21555,21558,21559, +21562,21565,21567,21569,21570,21572,21573,21575,21577,21580,21581,21582,21583, +21585,21594,21597,21598,21599,21600,21601,21603,21605,21607,21609,21610,21611, +21612,21613,21614,21615,21616,21620,21625,21626,21630,21631,21633,21635,21637, +21639,21640,21641,21642,21645,21649,21651,21655,21656,21660,21662,21663,21664, +21665,21666,21669,21678,21680,21682,21685,21686,21687,21689,21690,21692,21694, +21699,21701,21706,21707,21718,21720,21723,21728,21729,21730,21731,21732,21739, +21740,21743,21744,21745,21748,21749,21750,21751,21752,21753,21755,21758,21760, +21762,21763,21764,21765,21768,21770,21771,21772,21773,21774,21778,21779,21781, +21782,21783,21784,21785,21786,21788,21789,21790,21791,21793,21797,21798,21800, +21801,21803,21805,21810,21812,21813,21814,21816,21817, +21818,21819,21821,21824,21826,21829,21831,21832,21835,21836,21837,21838,21839, +21841,21842,21843,21844,21847,21848,21849,21850,21851,21853,21854,21855,21856, +21858,21859,21864,21865,21867,21871,21872,21873,21874,21875,21876,21881,21882, +21885,21887,21893,21894,21900,21901,21902,21904,21906,21907,21909,21910,21911, +21914,21915,21918,21920,21921,21922,21923,21924,21925,21926,21928,21929,21930, +21931,21932,21933,21934,21935,21936,21938,21940,21942,21944,21946,21948,21951, +21952,21953,21954,21955,21958,21959,21960,21962,21963,21966,21967,21968,21973, +21975,21976,21977,21978,21979,21982,21984,21986,21991,21993,21997,21998,22000, +22001,22004,22006,22008,22009,22010,22011,22012,22015,22018,22019,22020,22021, +22022,22023,22026,22027,22029,22032,22033,22034,22035,22036,22037,22038,22039, +22041,22042,22044,22045,22048,22049,22050,22053,22054,22056,22057,22058,22059, +22062,22063,22064,22067,22069,22071,22072,22074,22076,22077,22078,22080,22081, +22082,22083,22084,22085,22086,22087,22088,22089,22090,22091,22095,22096,22097, +22098,22099,22101,22102,22106,22107,22109,22110,22111,22112,22113,22115,22117, +22118,22119,22125,22126,22127,22128,22130,22131,22132,22133,22135,22136,22137, +22138,22141,22142,22143,22144,22145,22146,22147,22148,22151,22152,22153,22154, +22155,22156,22157,22160,22161,22162,22164,22165,22166,22167,22168,22169,22170, +22171,22172,22173,22174,22175,22176,22177,22178,22180,22181,22182,22183,22184, +22185,22186,22187,22188,22189,22190,22192,22193,22194,22195,22196,22197,22198, +22200,22201,22202,22203,22205,22206,22207,22208,22209, +22210,22211,22212,22213,22214,22215,22216,22217,22219,22220,22221,22222,22223, +22224,22225,22226,22227,22229,22230,22232,22233,22236,22243,22245,22246,22247, +22248,22249,22250,22252,22254,22255,22258,22259,22262,22263,22264,22267,22268, +22272,22273,22274,22277,22279,22283,22284,22285,22286,22287,22288,22289,22290, +22291,22292,22293,22294,22295,22296,22297,22298,22299,22301,22302,22304,22305, +22306,22308,22309,22310,22311,22315,22321,22322,22324,22325,22326,22327,22328, +22332,22333,22335,22337,22339,22340,22341,22342,22344,22345,22347,22354,22355, +22356,22357,22358,22360,22361,22370,22371,22373,22375,22380,22382,22384,22385, +22386,22388,22389,22392,22393,22394,22397,22398,22399,22400,22401,22407,22408, +22409,22410,22413,22414,22415,22416,22417,22420,22421,22422,22423,22424,22425, +22426,22428,22429,22430,22431,22437,22440,22442,22444,22447,22448,22449,22451, +22453,22454,22455,22457,22458,22459,22460,22461,22462,22463,22464,22465,22468, +22469,22470,22471,22472,22473,22474,22476,22477,22480,22481,22483,22486,22487, +22491,22492,22494,22497,22498,22499,22501,22502,22503,22504,22505,22506,22507, +22508,22510,22512,22513,22514,22515,22517,22518,22519,22523,22524,22526,22527, +22529,22531,22532,22533,22536,22537,22538,22540,22542,22543,22544,22546,22547, +22548,22550,22551,22552,22554,22555,22556,22557,22559,22562,22563,22565,22566, +22567,22568,22569,22571,22572,22573,22574,22575,22577,22578,22579,22580,22582, +22583,22584,22585,22586,22587,22588,22589,22590,22591,22592,22593,22594,22595, +22597,22598,22599,22600,22601,22602,22603,22606,22607, +22608,22610,22611,22613,22614,22615,22617,22618,22619,22620,22621,22623,22624, +22625,22626,22627,22628,22630,22631,22632,22633,22634,22637,22638,22639,22640, +22641,22642,22643,22644,22645,22646,22647,22648,22649,22650,22651,22652,22653, +22655,22658,22660,22662,22663,22664,22666,22667,22668,22669,22670,22671,22672, +22673,22676,22677,22678,22679,22680,22683,22684,22685,22688,22689,22690,22691, +22692,22693,22694,22695,22698,22699,22700,22701,22702,22703,22704,22705,22706, +22707,22708,22709,22710,22711,22712,22713,22714,22715,22717,22718,22719,22720, +22722,22723,22724,22726,22727,22728,22729,22730,22731,22732,22733,22734,22735, +22736,22738,22739,22740,22742,22743,22744,22745,22746,22747,22748,22749,22750, +22751,22752,22753,22754,22755,22757,22758,22759,22760,22761,22762,22765,22767, +22769,22770,22772,22773,22775,22776,22778,22779,22780,22781,22782,22783,22784, +22785,22787,22789,22790,22792,22793,22794,22795,22796,22798,22800,22801,22802, +22803,22807,22808,22811,22813,22814,22816,22817,22818,22819,22822,22824,22828, +22832,22834,22835,22837,22838,22843,22845,22846,22847,22848,22851,22853,22854, +22858,22860,22861,22864,22866,22867,22873,22875,22876,22877,22878,22879,22881, +22883,22884,22886,22887,22888,22889,22890,22891,22892,22893,22894,22895,22896, +22897,22898,22901,22903,22906,22907,22908,22910,22911,22912,22917,22921,22923, +22924,22926,22927,22928,22929,22932,22933,22936,22938,22939,22940,22941,22943, +22944,22945,22946,22950,22951,22956,22957,22960,22961,22963,22964,22965,22966, +22967,22968,22970,22972,22973,22975,22976,22977,22978, +22979,22980,22981,22983,22984,22985,22988,22989,22990,22991,22997,22998,23001, +23003,23006,23007,23008,23009,23010,23012,23014,23015,23017,23018,23019,23021, +23022,23023,23024,23025,23026,23027,23028,23029,23030,23031,23032,23034,23036, +23037,23038,23040,23042,23050,23051,23053,23054,23055,23056,23058,23060,23061, +23062,23063,23065,23066,23067,23069,23070,23073,23074,23076,23078,23079,23080, +23082,23083,23084,23085,23086,23087,23088,23091,23093,23095,23096,23097,23098, +23099,23101,23102,23103,23105,23106,23107,23108,23109,23111,23112,23115,23116, +23117,23118,23119,23120,23121,23122,23123,23124,23126,23127,23128,23129,23131, +23132,23133,23134,23135,23136,23137,23139,23140,23141,23142,23144,23145,23147, +23148,23149,23150,23151,23152,23153,23154,23155,23160,23161,23163,23164,23165, +23166,23168,23169,23170,23171,23172,23173,23174,23175,23176,23177,23178,23179, +23180,23181,23182,23183,23184,23185,23187,23188,23189,23190,23191,23192,23193, +23196,23197,23198,23199,23200,23201,23202,23203,23204,23205,23206,23207,23208, +23209,23211,23212,23213,23214,23215,23216,23217,23220,23222,23223,23225,23226, +23227,23228,23229,23231,23232,23235,23236,23237,23238,23239,23240,23242,23243, +23245,23246,23247,23248,23249,23251,23253,23255,23257,23258,23259,23261,23262, +23263,23266,23268,23269,23271,23272,23274,23276,23277,23278,23279,23280,23282, +23283,23284,23285,23286,23287,23288,23289,23290,23291,23292,23293,23294,23295, +23296,23297,23298,23299,23300,23301,23302,23303,23304,23306,23307,23308,23309, +23310,23311,23312,23313,23314,23315,23316,23317,23320, +23321,23322,23323,23324,23325,23326,23327,23328,23329,23330,23331,23332,23333, +23334,23335,23336,23337,23338,23339,23340,23341,23342,23343,23344,23345,23347, +23349,23350,23352,23353,23354,23355,23356,23357,23358,23359,23361,23362,23363, +23364,23365,23366,23367,23368,23369,23370,23371,23372,23373,23374,23375,23378, +23382,23390,23392,23393,23399,23400,23403,23405,23406,23407,23410,23412,23414, +23415,23416,23417,23419,23420,23422,23423,23426,23430,23434,23437,23438,23440, +23441,23442,23444,23446,23455,23463,23464,23465,23468,23469,23470,23471,23473, +23474,23479,23482,23483,23484,23488,23489,23491,23496,23497,23498,23499,23501, +23502,23503,23505,23508,23509,23510,23511,23512,23513,23514,23515,23516,23520, +23522,23523,23526,23527,23529,23530,23531,23532,23533,23535,23537,23538,23539, +23540,23541,23542,23543,23549,23550,23552,23554,23555,23557,23559,23560,23563, +23564,23565,23566,23568,23570,23571,23575,23577,23579,23582,23583,23584,23585, +23587,23590,23592,23593,23594,23595,23597,23598,23599,23600,23602,23603,23605, +23606,23607,23619,23620,23622,23623,23628,23629,23634,23635,23636,23638,23639, +23640,23642,23643,23644,23645,23647,23650,23652,23655,23656,23657,23658,23659, +23660,23661,23664,23666,23667,23668,23669,23670,23671,23672,23675,23676,23677, +23678,23680,23683,23684,23685,23686,23687,23689,23690,23691,23694,23695,23698, +23699,23701,23709,23710,23711,23712,23713,23716,23717,23718,23719,23720,23722, +23726,23727,23728,23730,23732,23734,23737,23738,23739,23740,23742,23744,23746, +23747,23749,23750,23751,23752,23753,23754,23756,23757, +23758,23759,23760,23761,23763,23764,23765,23766,23767,23768,23770,23771,23772, +23773,23774,23775,23776,23778,23779,23783,23785,23787,23788,23790,23791,23793, +23794,23795,23796,23797,23798,23799,23800,23801,23802,23804,23805,23806,23807, +23808,23809,23812,23813,23816,23817,23818,23819,23820,23821,23823,23824,23825, +23826,23827,23829,23831,23832,23833,23834,23836,23837,23839,23840,23841,23842, +23843,23845,23848,23850,23851,23852,23855,23856,23857,23858,23859,23861,23862, +23863,23864,23865,23866,23867,23868,23871,23872,23873,23874,23875,23876,23877, +23878,23880,23881,23885,23886,23887,23888,23889,23890,23891,23892,23893,23894, +23895,23897,23898,23900,23902,23903,23904,23905,23906,23907,23908,23909,23910, +23911,23912,23914,23917,23918,23920,23921,23922,23923,23925,23926,23927,23928, +23929,23930,23931,23932,23933,23934,23935,23936,23937,23939,23940,23941,23942, +23943,23944,23945,23946,23947,23948,23949,23950,23951,23952,23953,23954,23955, +23956,23957,23958,23959,23960,23962,23963,23964,23966,23967,23968,23969,23970, +23971,23972,23973,23974,23975,23976,23977,23978,23979,23980,23981,23982,23983, +23984,23985,23986,23987,23988,23989,23990,23992,23993,23994,23995,23996,23997, +23998,23999,24000,24001,24002,24003,24004,24006,24007,24008,24009,24010,24011, +24012,24014,24015,24016,24017,24018,24019,24020,24021,24022,24023,24024,24025, +24026,24028,24031,24032,24035,24036,24042,24044,24045,24048,24053,24054,24056, +24057,24058,24059,24060,24063,24064,24068,24071,24073,24074,24075,24077,24078, +24082,24083,24087,24094,24095,24096,24097,24098,24099, +24100,24101,24104,24105,24106,24107,24108,24111,24112,24114,24115,24116,24117, +24118,24121,24122,24126,24127,24128,24129,24131,24134,24135,24136,24137,24138, +24139,24141,24142,24143,24144,24145,24146,24147,24150,24151,24152,24153,24154, +24156,24157,24159,24160,24163,24164,24165,24166,24167,24168,24169,24170,24171, +24172,24173,24174,24175,24176,24177,24181,24183,24185,24190,24193,24194,24195, +24197,24200,24201,24204,24205,24206,24210,24216,24219,24221,24225,24226,24227, +24228,24232,24233,24234,24235,24236,24238,24239,24240,24241,24242,24244,24250, +24251,24252,24253,24255,24256,24257,24258,24259,24260,24261,24262,24263,24264, +24267,24268,24269,24270,24271,24272,24276,24277,24279,24280,24281,24282,24284, +24285,24286,24287,24288,24289,24290,24291,24292,24293,24294,24295,24297,24299, +24300,24301,24302,24303,24304,24305,24306,24307,24309,24312,24313,24315,24316, +24317,24325,24326,24327,24329,24332,24333,24334,24336,24338,24340,24342,24345, +24346,24348,24349,24350,24353,24354,24355,24356,24360,24363,24364,24366,24368, +24370,24371,24372,24373,24374,24375,24376,24379,24381,24382,24383,24385,24386, +24387,24388,24389,24390,24391,24392,24393,24394,24395,24396,24397,24398,24399, +24401,24404,24409,24410,24411,24412,24414,24415,24416,24419,24421,24423,24424, +24427,24430,24431,24434,24436,24437,24438,24440,24442,24445,24446,24447,24451, +24454,24461,24462,24463,24465,24467,24468,24470,24474,24475,24477,24478,24479, +24480,24482,24483,24484,24485,24486,24487,24489,24491,24492,24495,24496,24497, +24498,24499,24500,24502,24504,24505,24506,24507,24510, +24511,24512,24513,24514,24519,24520,24522,24523,24526,24531,24532,24533,24538, +24539,24540,24542,24543,24546,24547,24549,24550,24552,24553,24556,24559,24560, +24562,24563,24564,24566,24567,24569,24570,24572,24583,24584,24585,24587,24588, +24592,24593,24595,24599,24600,24602,24606,24607,24610,24611,24612,24620,24621, +24622,24624,24625,24626,24627,24628,24630,24631,24632,24633,24634,24637,24638, +24640,24644,24645,24646,24647,24648,24649,24650,24652,24654,24655,24657,24659, +24660,24662,24663,24664,24667,24668,24670,24671,24672,24673,24677,24678,24686, +24689,24690,24692,24693,24695,24702,24704,24705,24706,24709,24710,24711,24712, +24714,24715,24718,24719,24720,24721,24723,24725,24727,24728,24729,24732,24734, +24737,24738,24740,24741,24743,24745,24746,24750,24752,24755,24757,24758,24759, +24761,24762,24765,24766,24767,24768,24769,24770,24771,24772,24775,24776,24777, +24780,24781,24782,24783,24784,24786,24787,24788,24790,24791,24793,24795,24798, +24801,24802,24803,24804,24805,24810,24817,24818,24821,24823,24824,24827,24828, +24829,24830,24831,24834,24835,24836,24837,24839,24842,24843,24844,24848,24849, +24850,24851,24852,24854,24855,24856,24857,24859,24860,24861,24862,24865,24866, +24869,24872,24873,24874,24876,24877,24878,24879,24880,24881,24882,24883,24884, +24885,24886,24887,24888,24889,24890,24891,24892,24893,24894,24896,24897,24898, +24899,24900,24901,24902,24903,24905,24907,24909,24911,24912,24914,24915,24916, +24918,24919,24920,24921,24922,24923,24924,24926,24927,24928,24929,24931,24932, +24933,24934,24937,24938,24939,24940,24941,24942,24943, +24945,24946,24947,24948,24950,24952,24953,24954,24955,24956,24957,24958,24959, +24960,24961,24962,24963,24964,24965,24966,24967,24968,24969,24970,24972,24973, +24975,24976,24977,24978,24979,24981,24982,24983,24984,24985,24986,24987,24988, +24990,24991,24992,24993,24994,24995,24996,24997,24998,25002,25003,25005,25006, +25007,25008,25009,25010,25011,25012,25013,25014,25016,25017,25018,25019,25020, +25021,25023,25024,25025,25027,25028,25029,25030,25031,25033,25036,25037,25038, +25039,25040,25043,25045,25046,25047,25048,25049,25050,25051,25052,25053,25054, +25055,25056,25057,25058,25059,25060,25061,25063,25064,25065,25066,25067,25068, +25069,25070,25071,25072,25073,25074,25075,25076,25078,25079,25080,25081,25082, +25083,25084,25085,25086,25088,25089,25090,25091,25092,25093,25095,25097,25107, +25108,25113,25116,25117,25118,25120,25123,25126,25127,25128,25129,25131,25133, +25135,25136,25137,25138,25141,25142,25144,25145,25146,25147,25148,25154,25156, +25157,25158,25162,25167,25168,25173,25174,25175,25177,25178,25180,25181,25182, +25183,25184,25185,25186,25188,25189,25192,25201,25202,25204,25205,25207,25208, +25210,25211,25213,25217,25218,25219,25221,25222,25223,25224,25227,25228,25229, +25230,25231,25232,25236,25241,25244,25245,25246,25251,25254,25255,25257,25258, +25261,25262,25263,25264,25266,25267,25268,25270,25271,25272,25274,25278,25280, +25281,25283,25291,25295,25297,25301,25309,25310,25312,25313,25316,25322,25323, +25328,25330,25333,25336,25337,25338,25339,25344,25347,25348,25349,25350,25354, +25355,25356,25357,25359,25360,25362,25363,25364,25365, +25367,25368,25369,25372,25382,25383,25385,25388,25389,25390,25392,25393,25395, +25396,25397,25398,25399,25400,25403,25404,25406,25407,25408,25409,25412,25415, +25416,25418,25425,25426,25427,25428,25430,25431,25432,25433,25434,25435,25436, +25437,25440,25444,25445,25446,25448,25450,25451,25452,25455,25456,25458,25459, +25460,25461,25464,25465,25468,25469,25470,25471,25473,25475,25476,25477,25478, +25483,25485,25489,25491,25492,25493,25495,25497,25498,25499,25500,25501,25502, +25503,25505,25508,25510,25515,25519,25521,25522,25525,25526,25529,25531,25533, +25535,25536,25537,25538,25539,25541,25543,25544,25546,25547,25548,25553,25555, +25556,25557,25559,25560,25561,25562,25563,25564,25565,25567,25570,25572,25573, +25574,25575,25576,25579,25580,25582,25583,25584,25585,25587,25589,25591,25593, +25594,25595,25596,25598,25603,25604,25606,25607,25608,25609,25610,25613,25614, +25617,25618,25621,25622,25623,25624,25625,25626,25629,25631,25634,25635,25636, +25637,25639,25640,25641,25643,25646,25647,25648,25649,25650,25651,25653,25654, +25655,25656,25657,25659,25660,25662,25664,25666,25667,25673,25675,25676,25677, +25678,25679,25680,25681,25683,25685,25686,25687,25689,25690,25691,25692,25693, +25695,25696,25697,25698,25699,25700,25701,25702,25704,25706,25707,25708,25710, +25711,25712,25713,25714,25715,25716,25717,25718,25719,25723,25724,25725,25726, +25727,25728,25729,25731,25734,25736,25737,25738,25739,25740,25741,25742,25743, +25744,25747,25748,25751,25752,25754,25755,25756,25757,25759,25760,25761,25762, +25763,25765,25766,25767,25768,25770,25771,25775,25777, +25778,25779,25780,25782,25785,25787,25789,25790,25791,25793,25795,25796,25798, +25799,25800,25801,25802,25803,25804,25807,25809,25811,25812,25813,25814,25817, +25818,25819,25820,25821,25823,25824,25825,25827,25829,25831,25832,25833,25834, +25835,25836,25837,25838,25839,25840,25841,25842,25843,25844,25845,25846,25847, +25848,25849,25850,25851,25852,25853,25854,25855,25857,25858,25859,25860,25861, +25862,25863,25864,25866,25867,25868,25869,25870,25871,25872,25873,25875,25876, +25877,25878,25879,25881,25882,25883,25884,25885,25886,25887,25888,25889,25890, +25891,25892,25894,25895,25896,25897,25898,25900,25901,25904,25905,25906,25907, +25911,25914,25916,25917,25920,25921,25922,25923,25924,25926,25927,25930,25931, +25933,25934,25936,25938,25939,25940,25943,25944,25946,25948,25951,25952,25953, +25956,25957,25959,25960,25961,25962,25965,25966,25967,25969,25971,25973,25974, +25976,25977,25978,25979,25980,25981,25982,25983,25984,25985,25986,25987,25988, +25989,25990,25992,25993,25994,25997,25998,25999,26002,26004,26005,26006,26008, +26010,26013,26014,26016,26018,26019,26022,26024,26026,26028,26030,26033,26034, +26035,26036,26037,26038,26039,26040,26042,26043,26046,26047,26048,26050,26055, +26056,26057,26058,26061,26064,26065,26067,26068,26069,26072,26073,26074,26075, +26076,26077,26078,26079,26081,26083,26084,26090,26091,26098,26099,26100,26101, +26104,26105,26107,26108,26109,26110,26111,26113,26116,26117,26119,26120,26121, +26123,26125,26128,26129,26130,26134,26135,26136,26138,26139,26140,26142,26145, +26146,26147,26148,26150,26153,26154,26155,26156,26158, +26160,26162,26163,26167,26168,26169,26170,26171,26173,26175,26176,26178,26180, +26181,26182,26183,26184,26185,26186,26189,26190,26192,26193,26200,26201,26203, +26204,26205,26206,26208,26210,26211,26213,26215,26217,26218,26219,26220,26221, +26225,26226,26227,26229,26232,26233,26235,26236,26237,26239,26240,26241,26243, +26245,26246,26248,26249,26250,26251,26253,26254,26255,26256,26258,26259,26260, +26261,26264,26265,26266,26267,26268,26270,26271,26272,26273,26274,26275,26276, +26277,26278,26281,26282,26283,26284,26285,26287,26288,26289,26290,26291,26293, +26294,26295,26296,26298,26299,26300,26301,26303,26304,26305,26306,26307,26308, +26309,26310,26311,26312,26313,26314,26315,26316,26317,26318,26319,26320,26321, +26322,26323,26324,26325,26326,26327,26328,26330,26334,26335,26336,26337,26338, +26339,26340,26341,26343,26344,26346,26347,26348,26349,26350,26351,26353,26357, +26358,26360,26362,26363,26365,26369,26370,26371,26372,26373,26374,26375,26380, +26382,26383,26385,26386,26387,26390,26392,26393,26394,26396,26398,26400,26401, +26402,26403,26404,26405,26407,26409,26414,26416,26418,26419,26422,26423,26424, +26425,26427,26428,26430,26431,26433,26436,26437,26439,26442,26443,26445,26450, +26452,26453,26455,26456,26457,26458,26459,26461,26466,26467,26468,26470,26471, +26475,26476,26478,26481,26484,26486,26488,26489,26490,26491,26493,26496,26498, +26499,26501,26502,26504,26506,26508,26509,26510,26511,26513,26514,26515,26516, +26518,26521,26523,26527,26528,26529,26532,26534,26537,26540,26542,26545,26546, +26548,26553,26554,26555,26556,26557,26558,26559,26560, +26562,26565,26566,26567,26568,26569,26570,26571,26572,26573,26574,26581,26582, +26583,26587,26591,26593,26595,26596,26598,26599,26600,26602,26603,26605,26606, +26610,26613,26614,26615,26616,26617,26618,26619,26620,26622,26625,26626,26627, +26628,26630,26637,26640,26642,26644,26645,26648,26649,26650,26651,26652,26654, +26655,26656,26658,26659,26660,26661,26662,26663,26664,26667,26668,26669,26670, +26671,26672,26673,26676,26677,26678,26682,26683,26687,26695,26699,26701,26703, +26706,26710,26711,26712,26713,26714,26715,26716,26717,26718,26719,26730,26732, +26733,26734,26735,26736,26737,26738,26739,26741,26744,26745,26746,26747,26748, +26749,26750,26751,26752,26754,26756,26759,26760,26761,26762,26763,26764,26765, +26766,26768,26769,26770,26772,26773,26774,26776,26777,26778,26779,26780,26781, +26782,26783,26784,26785,26787,26788,26789,26793,26794,26795,26796,26798,26801, +26802,26804,26806,26807,26808,26809,26810,26811,26812,26813,26814,26815,26817, +26819,26820,26821,26822,26823,26824,26826,26828,26830,26831,26832,26833,26835, +26836,26838,26839,26841,26843,26844,26845,26846,26847,26849,26850,26852,26853, +26854,26855,26856,26857,26858,26859,26860,26861,26863,26866,26867,26868,26870, +26871,26872,26875,26877,26878,26879,26880,26882,26883,26884,26886,26887,26888, +26889,26890,26892,26895,26897,26899,26900,26901,26902,26903,26904,26905,26906, +26907,26908,26909,26910,26913,26914,26915,26917,26918,26919,26920,26921,26922, +26923,26924,26926,26927,26929,26930,26931,26933,26934,26935,26936,26938,26939, +26940,26942,26944,26945,26947,26948,26949,26950,26951, +26952,26953,26954,26955,26956,26957,26958,26959,26960,26961,26962,26963,26965, +26966,26968,26969,26971,26972,26975,26977,26978,26980,26981,26983,26984,26985, +26986,26988,26989,26991,26992,26994,26995,26996,26997,26998,27002,27003,27005, +27006,27007,27009,27011,27013,27018,27019,27020,27022,27023,27024,27025,27026, +27027,27030,27031,27033,27034,27037,27038,27039,27040,27041,27042,27043,27044, +27045,27046,27049,27050,27052,27054,27055,27056,27058,27059,27061,27062,27064, +27065,27066,27068,27069,27070,27071,27072,27074,27075,27076,27077,27078,27079, +27080,27081,27083,27085,27087,27089,27090,27091,27093,27094,27095,27096,27097, +27098,27100,27101,27102,27105,27106,27107,27108,27109,27110,27111,27112,27113, +27114,27115,27116,27118,27119,27120,27121,27123,27124,27125,27126,27127,27128, +27129,27130,27131,27132,27134,27136,27137,27138,27139,27140,27141,27142,27143, +27144,27145,27147,27148,27149,27150,27151,27152,27153,27154,27155,27156,27157, +27158,27161,27162,27163,27164,27165,27166,27168,27170,27171,27172,27173,27174, +27175,27177,27179,27180,27181,27182,27184,27186,27187,27188,27190,27191,27192, +27193,27194,27195,27196,27199,27200,27201,27202,27203,27205,27206,27208,27209, +27210,27211,27212,27213,27214,27215,27217,27218,27219,27220,27221,27222,27223, +27226,27228,27229,27230,27231,27232,27234,27235,27236,27238,27239,27240,27241, +27242,27243,27244,27245,27246,27247,27248,27250,27251,27252,27253,27254,27255, +27256,27258,27259,27261,27262,27263,27265,27266,27267,27269,27270,27271,27272, +27273,27274,27275,27276,27277,27279,27282,27283,27284, +27285,27286,27288,27289,27290,27291,27292,27293,27294,27295,27297,27298,27299, +27300,27301,27302,27303,27304,27306,27309,27310,27311,27312,27313,27314,27315, +27316,27317,27318,27319,27320,27321,27322,27323,27324,27325,27326,27327,27328, +27329,27330,27331,27332,27333,27334,27335,27336,27337,27338,27339,27340,27341, +27342,27343,27344,27345,27346,27347,27348,27349,27350,27351,27352,27353,27354, +27355,27356,27357,27358,27359,27360,27361,27362,27363,27364,27365,27366,27367, +27368,27369,27370,27371,27372,27373,27374,27375,27376,27377,27378,27379,27380, +27381,27382,27383,27384,27385,27386,27387,27388,27389,27390,27391,27392,27393, +27394,27395,27396,27397,27398,27399,27400,27401,27402,27403,27404,27405,27406, +27407,27408,27409,27410,27411,27412,27413,27414,27415,27416,27417,27418,27419, +27420,27421,27422,27423,27429,27430,27432,27433,27434,27435,27436,27437,27438, +27439,27440,27441,27443,27444,27445,27446,27448,27451,27452,27453,27455,27456, +27457,27458,27460,27461,27464,27466,27467,27469,27470,27471,27472,27473,27474, +27475,27476,27477,27478,27479,27480,27482,27483,27484,27485,27486,27487,27488, +27489,27496,27497,27499,27500,27501,27502,27503,27504,27505,27506,27507,27508, +27509,27510,27511,27512,27514,27517,27518,27519,27520,27525,27528,27532,27534, +27535,27536,27537,27540,27541,27543,27544,27545,27548,27549,27550,27551,27552, +27554,27555,27556,27557,27558,27559,27560,27561,27563,27564,27565,27566,27567, +27568,27569,27570,27574,27576,27577,27578,27579,27580,27581,27582,27584,27587, +27588,27590,27591,27592,27593,27594,27596,27598,27600, +27601,27608,27610,27612,27613,27614,27615,27616,27618,27619,27620,27621,27622, +27623,27624,27625,27628,27629,27630,27632,27633,27634,27636,27638,27639,27640, +27642,27643,27644,27646,27647,27648,27649,27650,27651,27652,27656,27657,27658, +27659,27660,27662,27666,27671,27676,27677,27678,27680,27683,27685,27691,27692, +27693,27697,27699,27702,27703,27705,27706,27707,27708,27710,27711,27715,27716, +27717,27720,27723,27724,27725,27726,27727,27729,27730,27731,27734,27736,27737, +27738,27746,27747,27749,27750,27751,27755,27756,27757,27758,27759,27761,27763, +27765,27767,27768,27770,27771,27772,27775,27776,27780,27783,27786,27787,27789, +27790,27793,27794,27797,27798,27799,27800,27802,27804,27805,27806,27808,27810, +27816,27820,27823,27824,27828,27829,27830,27831,27834,27840,27841,27842,27843, +27846,27847,27848,27851,27853,27854,27855,27857,27858,27864,27865,27866,27868, +27869,27871,27876,27878,27879,27881,27884,27885,27890,27892,27897,27903,27904, +27906,27907,27909,27910,27912,27913,27914,27917,27919,27920,27921,27923,27924, +27925,27926,27928,27932,27933,27935,27936,27937,27938,27939,27940,27942,27944, +27945,27948,27949,27951,27952,27956,27958,27959,27960,27962,27967,27968,27970, +27972,27977,27980,27984,27989,27990,27991,27992,27995,27997,27999,28001,28002, +28004,28005,28007,28008,28011,28012,28013,28016,28017,28018,28019,28021,28022, +28025,28026,28027,28029,28030,28031,28032,28033,28035,28036,28038,28039,28042, +28043,28045,28047,28048,28050,28054,28055,28056,28057,28058,28060,28066,28069, +28076,28077,28080,28081,28083,28084,28086,28087,28089, +28090,28091,28092,28093,28094,28097,28098,28099,28104,28105,28106,28109,28110, +28111,28112,28114,28115,28116,28117,28119,28122,28123,28124,28127,28130,28131, +28133,28135,28136,28137,28138,28141,28143,28144,28146,28148,28149,28150,28152, +28154,28157,28158,28159,28160,28161,28162,28163,28164,28166,28167,28168,28169, +28171,28175,28178,28179,28181,28184,28185,28187,28188,28190,28191,28194,28198, +28199,28200,28202,28204,28206,28208,28209,28211,28213,28214,28215,28217,28219, +28220,28221,28222,28223,28224,28225,28226,28229,28230,28231,28232,28233,28234, +28235,28236,28239,28240,28241,28242,28245,28247,28249,28250,28252,28253,28254, +28256,28257,28258,28259,28260,28261,28262,28263,28264,28265,28266,28268,28269, +28271,28272,28273,28274,28275,28276,28277,28278,28279,28280,28281,28282,28283, +28284,28285,28288,28289,28290,28292,28295,28296,28298,28299,28300,28301,28302, +28305,28306,28307,28308,28309,28310,28311,28313,28314,28315,28317,28318,28320, +28321,28323,28324,28326,28328,28329,28331,28332,28333,28334,28336,28339,28341, +28344,28345,28348,28350,28351,28352,28355,28356,28357,28358,28360,28361,28362, +28364,28365,28366,28368,28370,28374,28376,28377,28379,28380,28381,28387,28391, +28394,28395,28396,28397,28398,28399,28400,28401,28402,28403,28405,28406,28407, +28408,28410,28411,28412,28413,28414,28415,28416,28417,28419,28420,28421,28423, +28424,28426,28427,28428,28429,28430,28432,28433,28434,28438,28439,28440,28441, +28442,28443,28444,28445,28446,28447,28449,28450,28451,28453,28454,28455,28456, +28460,28462,28464,28466,28468,28469,28471,28472,28473, +28474,28475,28476,28477,28479,28480,28481,28482,28483,28484,28485,28488,28489, +28490,28492,28494,28495,28496,28497,28498,28499,28500,28501,28502,28503,28505, +28506,28507,28509,28511,28512,28513,28515,28516,28517,28519,28520,28521,28522, +28523,28524,28527,28528,28529,28531,28533,28534,28535,28537,28539,28541,28542, +28543,28544,28545,28546,28547,28549,28550,28551,28554,28555,28559,28560,28561, +28562,28563,28564,28565,28566,28567,28568,28569,28570,28571,28573,28574,28575, +28576,28578,28579,28580,28581,28582,28584,28585,28586,28587,28588,28589,28590, +28591,28592,28593,28594,28596,28597,28599,28600,28602,28603,28604,28605,28606, +28607,28609,28611,28612,28613,28614,28615,28616,28618,28619,28620,28621,28622, +28623,28624,28627,28628,28629,28630,28631,28632,28633,28634,28635,28636,28637, +28639,28642,28643,28644,28645,28646,28647,28648,28649,28650,28651,28652,28653, +28656,28657,28658,28659,28660,28661,28662,28663,28664,28665,28666,28667,28668, +28669,28670,28671,28672,28673,28674,28675,28676,28677,28678,28679,28680,28681, +28682,28683,28684,28685,28686,28687,28688,28690,28691,28692,28693,28694,28695, +28696,28697,28700,28701,28702,28703,28704,28705,28706,28708,28709,28710,28711, +28712,28713,28714,28715,28716,28717,28718,28719,28720,28721,28722,28723,28724, +28726,28727,28728,28730,28731,28732,28733,28734,28735,28736,28737,28738,28739, +28740,28741,28742,28743,28744,28745,28746,28747,28749,28750,28752,28753,28754, +28755,28756,28757,28758,28759,28760,28761,28762,28763,28764,28765,28767,28768, +28769,28770,28771,28772,28773,28774,28775,28776,28777, +28778,28782,28785,28786,28787,28788,28791,28793,28794,28795,28797,28801,28802, +28803,28804,28806,28807,28808,28811,28812,28813,28815,28816,28817,28819,28823, +28824,28826,28827,28830,28831,28832,28833,28834,28835,28836,28837,28838,28839, +28840,28841,28842,28848,28850,28852,28853,28854,28858,28862,28863,28868,28869, +28870,28871,28873,28875,28876,28877,28878,28879,28880,28881,28882,28883,28884, +28885,28886,28887,28890,28892,28893,28894,28896,28897,28898,28899,28901,28906, +28910,28912,28913,28914,28915,28916,28917,28918,28920,28922,28923,28924,28926, +28927,28928,28929,28930,28931,28932,28933,28934,28935,28936,28939,28940,28941, +28942,28943,28945,28946,28948,28951,28955,28956,28957,28958,28959,28960,28961, +28962,28963,28964,28965,28967,28968,28969,28970,28971,28972,28973,28974,28978, +28979,28980,28981,28983,28984,28985,28986,28987,28988,28989,28990,28991,28992, +28993,28994,28995,28996,28998,28999,29000,29001,29003,29005,29007,29008,29009, +29010,29011,29012,29013,29014,29015,29016,29017,29018,29019,29021,29023,29024, +29025,29026,29027,29029,29033,29034,29035,29036,29037,29039,29040,29041,29044, +29045,29046,29047,29049,29051,29052,29054,29055,29056,29057,29058,29059,29061, +29062,29063,29064,29065,29067,29068,29069,29070,29072,29073,29074,29075,29077, +29078,29079,29082,29083,29084,29085,29086,29089,29090,29091,29092,29093,29094, +29095,29097,29098,29099,29101,29102,29103,29104,29105,29106,29108,29110,29111, +29112,29114,29115,29116,29117,29118,29119,29120,29121,29122,29124,29125,29126, +29127,29128,29129,29130,29131,29132,29133,29135,29136, +29137,29138,29139,29142,29143,29144,29145,29146,29147,29148,29149,29150,29151, +29153,29154,29155,29156,29158,29160,29161,29162,29163,29164,29165,29167,29168, +29169,29170,29171,29172,29173,29174,29175,29176,29178,29179,29180,29181,29182, +29183,29184,29185,29186,29187,29188,29189,29191,29192,29193,29194,29195,29196, +29197,29198,29199,29200,29201,29202,29203,29204,29205,29206,29207,29208,29209, +29210,29211,29212,29214,29215,29216,29217,29218,29219,29220,29221,29222,29223, +29225,29227,29229,29230,29231,29234,29235,29236,29242,29244,29246,29248,29249, +29250,29251,29252,29253,29254,29257,29258,29259,29262,29263,29264,29265,29267, +29268,29269,29271,29272,29274,29276,29278,29280,29283,29284,29285,29288,29290, +29291,29292,29293,29296,29297,29299,29300,29302,29303,29304,29307,29308,29309, +29314,29315,29317,29318,29319,29320,29321,29324,29326,29328,29329,29331,29332, +29333,29334,29335,29336,29337,29338,29339,29340,29341,29342,29344,29345,29346, +29347,29348,29349,29350,29351,29352,29353,29354,29355,29358,29361,29362,29363, +29365,29370,29371,29372,29373,29374,29375,29376,29381,29382,29383,29385,29386, +29387,29388,29391,29393,29395,29396,29397,29398,29400,29402,29403,58566,58567, +58568,58569,58570,58571,58572,58573,58574,58575,58576,58577,58578,58579,58580, +58581,58582,58583,58584,58585,58586,58587,58588,58589,58590,58591,58592,58593, +58594,58595,58596,58597,58598,58599,58600,58601,58602,58603,58604,58605,58606, +58607,58608,58609,58610,58611,58612,58613,58614,58615,58616,58617,58618,58619, +58620,58621,58622,58623,58624,58625,58626,58627,58628, +58629,58630,58631,58632,58633,58634,58635,58636,58637,58638,58639,58640,58641, +58642,58643,58644,58645,58646,58647,58648,58649,58650,58651,58652,58653,58654, +58655,58656,58657,58658,58659,58660,58661,12288,12289,12290,183,713,711,168, +12291,12293,8212,65374,8214,8230,8216,8217,8220,8221,12308,12309,12296,12297, +12298,12299,12300,12301,12302,12303,12310,12311,12304,12305,177,215,247,8758, +8743,8744,8721,8719,8746,8745,8712,8759,8730,8869,8741,8736,8978,8857,8747, +8750,8801,8780,8776,8765,8733,8800,8814,8815,8804,8805,8734,8757,8756,9794, +9792,176,8242,8243,8451,65284,164,65504,65505,8240,167,8470,9734,9733,9675, +9679,9678,9671,9670,9633,9632,9651,9650,8251,8594,8592,8593,8595,12307,58662, +58663,58664,58665,58666,58667,58668,58669,58670,58671,58672,58673,58674,58675, +58676,58677,58678,58679,58680,58681,58682,58683,58684,58685,58686,58687,58688, +58689,58690,58691,58692,58693,58694,58695,58696,58697,58698,58699,58700,58701, +58702,58703,58704,58705,58706,58707,58708,58709,58710,58711,58712,58713,58714, +58715,58716,58717,58718,58719,58720,58721,58722,58723,58724,58725,58726,58727, +58728,58729,58730,58731,58732,58733,58734,58735,58736,58737,58738,58739,58740, +58741,58742,58743,58744,58745,58746,58747,58748,58749,58750,58751,58752,58753, +58754,58755,58756,58757,8560,8561,8562,8563,8564,8565,8566,8567,8568,8569, +59238,59239,59240,59241,59242,59243,9352,9353,9354,9355,9356,9357,9358,9359, +9360,9361,9362,9363,9364,9365,9366,9367,9368, +9369,9370,9371,9332,9333,9334,9335,9336,9337,9338,9339,9340,9341,9342,9343, +9344,9345,9346,9347,9348,9349,9350,9351,9312,9313,9314,9315,9316,9317,9318, +9319,9320,9321,8364,59245,12832,12833,12834,12835,12836,12837,12838,12839, +12840,12841,59246,59247,8544,8545,8546,8547,8548,8549,8550,8551,8552,8553, +8554,8555,59248,59249,58758,58759,58760,58761,58762,58763,58764,58765,58766, +58767,58768,58769,58770,58771,58772,58773,58774,58775,58776,58777,58778,58779, +58780,58781,58782,58783,58784,58785,58786,58787,58788,58789,58790,58791,58792, +58793,58794,58795,58796,58797,58798,58799,58800,58801,58802,58803,58804,58805, +58806,58807,58808,58809,58810,58811,58812,58813,58814,58815,58816,58817,58818, +58819,58820,58821,58822,58823,58824,58825,58826,58827,58828,58829,58830,58831, +58832,58833,58834,58835,58836,58837,58838,58839,58840,58841,58842,58843,58844, +58845,58846,58847,58848,58849,58850,58851,58852,58853,65281,65282,65283,65509, +65285,65286,65287,65288,65289,65290,65291,65292,65293,65294,65295,65296,65297, +65298,65299,65300,65301,65302,65303,65304,65305,65306,65307,65308,65309,65310, +65311,65312,65313,65314,65315,65316,65317,65318,65319,65320,65321,65322,65323, +65324,65325,65326,65327,65328,65329,65330,65331,65332,65333,65334,65335,65336, +65337,65338,65339,65340,65341,65342,65343,65344,65345,65346,65347,65348,65349, +65350,65351,65352,65353,65354,65355,65356,65357,65358,65359,65360,65361,65362, +65363,65364,65365,65366,65367,65368,65369,65370,65371,65372,65373,65507,58854, +58855,58856,58857,58858, +58859,58860,58861,58862,58863,58864,58865,58866,58867,58868,58869,58870,58871, +58872,58873,58874,58875,58876,58877,58878,58879,58880,58881,58882,58883,58884, +58885,58886,58887,58888,58889,58890,58891,58892,58893,58894,58895,58896,58897, +58898,58899,58900,58901,58902,58903,58904,58905,58906,58907,58908,58909,58910, +58911,58912,58913,58914,58915,58916,58917,58918,58919,58920,58921,58922,58923, +58924,58925,58926,58927,58928,58929,58930,58931,58932,58933,58934,58935,58936, +58937,58938,58939,58940,58941,58942,58943,58944,58945,58946,58947,58948,58949, +12353,12354,12355,12356,12357,12358,12359,12360,12361,12362,12363,12364,12365, +12366,12367,12368,12369,12370,12371,12372,12373,12374,12375,12376,12377,12378, +12379,12380,12381,12382,12383,12384,12385,12386,12387,12388,12389,12390,12391, +12392,12393,12394,12395,12396,12397,12398,12399,12400,12401,12402,12403,12404, +12405,12406,12407,12408,12409,12410,12411,12412,12413,12414,12415,12416,12417, +12418,12419,12420,12421,12422,12423,12424,12425,12426,12427,12428,12429,12430, +12431,12432,12433,12434,12435,59250,59251,59252,59253,59254,59255,59256,59257, +59258,59259,59260,58950,58951,58952,58953,58954,58955,58956,58957,58958,58959, +58960,58961,58962,58963,58964,58965,58966,58967,58968,58969,58970,58971,58972, +58973,58974,58975,58976,58977,58978,58979,58980,58981,58982,58983,58984,58985, +58986,58987,58988,58989,58990,58991,58992,58993,58994,58995,58996,58997,58998, +58999,59000,59001,59002,59003,59004,59005,59006,59007,59008,59009,59010,59011, +59012,59013,59014,59015,59016,59017,59018,59019,59020, +59021,59022,59023,59024,59025,59026,59027,59028,59029,59030,59031,59032,59033, +59034,59035,59036,59037,59038,59039,59040,59041,59042,59043,59044,59045,12449, +12450,12451,12452,12453,12454,12455,12456,12457,12458,12459,12460,12461,12462, +12463,12464,12465,12466,12467,12468,12469,12470,12471,12472,12473,12474,12475, +12476,12477,12478,12479,12480,12481,12482,12483,12484,12485,12486,12487,12488, +12489,12490,12491,12492,12493,12494,12495,12496,12497,12498,12499,12500,12501, +12502,12503,12504,12505,12506,12507,12508,12509,12510,12511,12512,12513,12514, +12515,12516,12517,12518,12519,12520,12521,12522,12523,12524,12525,12526,12527, +12528,12529,12530,12531,12532,12533,12534,59261,59262,59263,59264,59265,59266, +59267,59268,59046,59047,59048,59049,59050,59051,59052,59053,59054,59055,59056, +59057,59058,59059,59060,59061,59062,59063,59064,59065,59066,59067,59068,59069, +59070,59071,59072,59073,59074,59075,59076,59077,59078,59079,59080,59081,59082, +59083,59084,59085,59086,59087,59088,59089,59090,59091,59092,59093,59094,59095, +59096,59097,59098,59099,59100,59101,59102,59103,59104,59105,59106,59107,59108, +59109,59110,59111,59112,59113,59114,59115,59116,59117,59118,59119,59120,59121, +59122,59123,59124,59125,59126,59127,59128,59129,59130,59131,59132,59133,59134, +59135,59136,59137,59138,59139,59140,59141,913,914,915,916,917,918,919,920,921, +922,923,924,925,926,927,928,929,931,932,933,934,935,936,937,59269,59270,59271, +59272,59273,59274,59275,59276,945,946,947,948,949,950,951,952,953, +954,955,956,957,958,959,960,961,963,964,965,966,967,968,969,59277,59278,59279, +59280,59281,59282,59283,65077,65078,65081,65082,65087,65088,65085,65086,65089, +65090,65091,65092,59284,59285,65083,65084,65079,65080,65073,59286,65075,65076, +59287,59288,59289,59290,59291,59292,59293,59294,59295,59142,59143,59144,59145, +59146,59147,59148,59149,59150,59151,59152,59153,59154,59155,59156,59157,59158, +59159,59160,59161,59162,59163,59164,59165,59166,59167,59168,59169,59170,59171, +59172,59173,59174,59175,59176,59177,59178,59179,59180,59181,59182,59183,59184, +59185,59186,59187,59188,59189,59190,59191,59192,59193,59194,59195,59196,59197, +59198,59199,59200,59201,59202,59203,59204,59205,59206,59207,59208,59209,59210, +59211,59212,59213,59214,59215,59216,59217,59218,59219,59220,59221,59222,59223, +59224,59225,59226,59227,59228,59229,59230,59231,59232,59233,59234,59235,59236, +59237,1040,1041,1042,1043,1044,1045,1025,1046,1047,1048,1049,1050,1051,1052, +1053,1054,1055,1056,1057,1058,1059,1060,1061,1062,1063,1064,1065,1066,1067, +1068,1069,1070,1071,59296,59297,59298,59299,59300,59301,59302,59303,59304, +59305,59306,59307,59308,59309,59310,1072,1073,1074,1075,1076,1077,1105,1078, +1079,1080,1081,1082,1083,1084,1085,1086,1087,1088,1089,1090,1091,1092,1093, +1094,1095,1096,1097,1098,1099,1100,1101,1102,1103,59311,59312,59313,59314, +59315,59316,59317,59318,59319,59320,59321,59322,59323,714,715,729,8211,8213, +8229,8245,8453,8457,8598,8599,8600,8601, +8725,8735,8739,8786,8806,8807,8895,9552,9553,9554,9555,9556,9557,9558,9559, +9560,9561,9562,9563,9564,9565,9566,9567,9568,9569,9570,9571,9572,9573,9574, +9575,9576,9577,9578,9579,9580,9581,9582,9583,9584,9585,9586,9587,9601,9602, +9603,9604,9605,9606,9607,9608,9609,9610,9611,9612,9613,9614,9615,9619,9620, +9621,9660,9661,9698,9699,9700,9701,9737,8853,12306,12317,12318,59324,59325, +59326,59327,59328,59329,59330,59331,59332,59333,59334,257,225,462,224,275,233, +283,232,299,237,464,236,333,243,466,242,363,250,468,249,470,472,474,476,252, +234,593,59335,324,328,505,609,59337,59338,59339,59340,12549,12550,12551,12552, +12553,12554,12555,12556,12557,12558,12559,12560,12561,12562,12563,12564,12565, +12566,12567,12568,12569,12570,12571,12572,12573,12574,12575,12576,12577,12578, +12579,12580,12581,12582,12583,12584,12585,59341,59342,59343,59344,59345,59346, +59347,59348,59349,59350,59351,59352,59353,59354,59355,59356,59357,59358,59359, +59360,59361,12321,12322,12323,12324,12325,12326,12327,12328,12329,12963,13198, +13199,13212,13213,13214,13217,13252,13262,13265,13266,13269,65072,65506,65508, +59362,8481,12849,59363,8208,59364,59365,59366,12540,12443,12444,12541,12542, +12294,12445,12446,65097,65098,65099,65100,65101,65102,65103,65104,65105,65106, +65108,65109,65110,65111,65113,65114,65115,65116,65117,65118,65119,65120,65121, +65122,65123,65124,65125,65126,65128,65129,65130,65131,12350,12272,12273,12274, +12275,12276,12277, +12278,12279,12280,12281,12282,12283,12295,59380,59381,59382,59383,59384,59385, +59386,59387,59388,59389,59390,59391,59392,9472,9473,9474,9475,9476,9477,9478, +9479,9480,9481,9482,9483,9484,9485,9486,9487,9488,9489,9490,9491,9492,9493, +9494,9495,9496,9497,9498,9499,9500,9501,9502,9503,9504,9505,9506,9507,9508, +9509,9510,9511,9512,9513,9514,9515,9516,9517,9518,9519,9520,9521,9522,9523, +9524,9525,9526,9527,9528,9529,9530,9531,9532,9533,9534,9535,9536,9537,9538, +9539,9540,9541,9542,9543,9544,9545,9546,9547,59393,59394,59395,59396,59397, +59398,59399,59400,59401,59402,59403,59404,59405,59406,59407,29404,29405,29407, +29410,29411,29412,29413,29414,29415,29418,29419,29429,29430,29433,29437,29438, +29439,29440,29442,29444,29445,29446,29447,29448,29449,29451,29452,29453,29455, +29456,29457,29458,29460,29464,29465,29466,29471,29472,29475,29476,29478,29479, +29480,29485,29487,29488,29490,29491,29493,29494,29498,29499,29500,29501,29504, +29505,29506,29507,29508,29509,29510,29511,29512,29513,29514,29515,29516,29518, +29519,29521,29523,29524,29525,29526,29528,29529,29530,29531,29532,29533,29534, +29535,29537,29538,29539,29540,29541,29542,29543,29544,29545,29546,29547,29550, +29552,29553,57344,57345,57346,57347,57348,57349,57350,57351,57352,57353,57354, +57355,57356,57357,57358,57359,57360,57361,57362,57363,57364,57365,57366,57367, +57368,57369,57370,57371,57372,57373,57374,57375,57376,57377,57378,57379,57380, +57381,57382,57383,57384,57385,57386,57387,57388,57389,57390,57391,57392, +57393,57394,57395,57396,57397,57398,57399,57400,57401,57402,57403,57404,57405, +57406,57407,57408,57409,57410,57411,57412,57413,57414,57415,57416,57417,57418, +57419,57420,57421,57422,57423,57424,57425,57426,57427,57428,57429,57430,57431, +57432,57433,57434,57435,57436,57437,29554,29555,29556,29557,29558,29559,29560, +29561,29562,29563,29564,29565,29567,29568,29569,29570,29571,29573,29574,29576, +29578,29580,29581,29583,29584,29586,29587,29588,29589,29591,29592,29593,29594, +29596,29597,29598,29600,29601,29603,29604,29605,29606,29607,29608,29610,29612, +29613,29617,29620,29621,29622,29624,29625,29628,29629,29630,29631,29633,29635, +29636,29637,29638,29639,29643,29644,29646,29650,29651,29652,29653,29654,29655, +29656,29658,29659,29660,29661,29663,29665,29666,29667,29668,29670,29672,29674, +29675,29676,29678,29679,29680,29681,29683,29684,29685,29686,29687,57438,57439, +57440,57441,57442,57443,57444,57445,57446,57447,57448,57449,57450,57451,57452, +57453,57454,57455,57456,57457,57458,57459,57460,57461,57462,57463,57464,57465, +57466,57467,57468,57469,57470,57471,57472,57473,57474,57475,57476,57477,57478, +57479,57480,57481,57482,57483,57484,57485,57486,57487,57488,57489,57490,57491, +57492,57493,57494,57495,57496,57497,57498,57499,57500,57501,57502,57503,57504, +57505,57506,57507,57508,57509,57510,57511,57512,57513,57514,57515,57516,57517, +57518,57519,57520,57521,57522,57523,57524,57525,57526,57527,57528,57529,57530, +57531,29688,29689,29690,29691,29692,29693,29694,29695,29696,29697,29698,29700, +29703,29704,29707,29708,29709,29710,29713,29714,29715, +29716,29717,29718,29719,29720,29721,29724,29725,29726,29727,29728,29729,29731, +29732,29735,29737,29739,29741,29743,29745,29746,29751,29752,29753,29754,29755, +29757,29758,29759,29760,29762,29763,29764,29765,29766,29767,29768,29769,29770, +29771,29772,29773,29774,29775,29776,29777,29778,29779,29780,29782,29784,29789, +29792,29793,29794,29795,29796,29797,29798,29799,29800,29801,29802,29803,29804, +29806,29807,29809,29810,29811,29812,29813,29816,29817,29818,57532,57533,57534, +57535,57536,57537,57538,57539,57540,57541,57542,57543,57544,57545,57546,57547, +57548,57549,57550,57551,57552,57553,57554,57555,57556,57557,57558,57559,57560, +57561,57562,57563,57564,57565,57566,57567,57568,57569,57570,57571,57572,57573, +57574,57575,57576,57577,57578,57579,57580,57581,57582,57583,57584,57585,57586, +57587,57588,57589,57590,57591,57592,57593,57594,57595,57596,57597,57598,57599, +57600,57601,57602,57603,57604,57605,57606,57607,57608,57609,57610,57611,57612, +57613,57614,57615,57616,57617,57618,57619,57620,57621,57622,57623,57624,57625, +29819,29820,29821,29823,29826,29828,29829,29830,29832,29833,29834,29836,29837, +29839,29841,29842,29843,29844,29845,29846,29847,29848,29849,29850,29851,29853, +29855,29856,29857,29858,29859,29860,29861,29862,29866,29867,29868,29869,29870, +29871,29872,29873,29874,29875,29876,29877,29878,29879,29880,29881,29883,29884, +29885,29886,29887,29888,29889,29890,29891,29892,29893,29894,29895,29896,29897, +29898,29899,29900,29901,29902,29903,29904,29905,29907,29908,29909,29910,29911, +29912,29913,29914,29915,29917,29919,29921,29925,29927, +29928,29929,29930,29931,29932,29933,29936,29937,29938,57626,57627,57628,57629, +57630,57631,57632,57633,57634,57635,57636,57637,57638,57639,57640,57641,57642, +57643,57644,57645,57646,57647,57648,57649,57650,57651,57652,57653,57654,57655, +57656,57657,57658,57659,57660,57661,57662,57663,57664,57665,57666,57667,57668, +57669,57670,57671,57672,57673,57674,57675,57676,57677,57678,57679,57680,57681, +57682,57683,57684,57685,57686,57687,57688,57689,57690,57691,57692,57693,57694, +57695,57696,57697,57698,57699,57700,57701,57702,57703,57704,57705,57706,57707, +57708,57709,57710,57711,57712,57713,57714,57715,57716,57717,57718,57719,29939, +29941,29944,29945,29946,29947,29948,29949,29950,29952,29953,29954,29955,29957, +29958,29959,29960,29961,29962,29963,29964,29966,29968,29970,29972,29973,29974, +29975,29979,29981,29982,29984,29985,29986,29987,29988,29990,29991,29994,29998, +30004,30006,30009,30012,30013,30015,30017,30018,30019,30020,30022,30023,30025, +30026,30029,30032,30033,30034,30035,30037,30038,30039,30040,30045,30046,30047, +30048,30049,30050,30051,30052,30055,30056,30057,30059,30060,30061,30062,30063, +30064,30065,30067,30069,30070,30071,30074,30075,30076,30077,30078,30080,30081, +30082,30084,30085,30087,57720,57721,57722,57723,57724,57725,57726,57727,57728, +57729,57730,57731,57732,57733,57734,57735,57736,57737,57738,57739,57740,57741, +57742,57743,57744,57745,57746,57747,57748,57749,57750,57751,57752,57753,57754, +57755,57756,57757,57758,57759,57760,57761,57762,57763,57764,57765,57766,57767, +57768,57769,57770,57771,57772,57773,57774,57775,57776, +57777,57778,57779,57780,57781,57782,57783,57784,57785,57786,57787,57788,57789, +57790,57791,57792,57793,57794,57795,57796,57797,57798,57799,57800,57801,57802, +57803,57804,57805,57806,57807,57808,57809,57810,57811,57812,57813,30088,30089, +30090,30092,30093,30094,30096,30099,30101,30104,30107,30108,30110,30114,30118, +30119,30120,30121,30122,30125,30134,30135,30138,30139,30143,30144,30145,30150, +30155,30156,30158,30159,30160,30161,30163,30167,30169,30170,30172,30173,30175, +30176,30177,30181,30185,30188,30189,30190,30191,30194,30195,30197,30198,30199, +30200,30202,30203,30205,30206,30210,30212,30214,30215,30216,30217,30219,30221, +30222,30223,30225,30226,30227,30228,30230,30234,30236,30237,30238,30241,30243, +30247,30248,30252,30254,30255,30257,30258,30262,30263,30265,30266,30267,30269, +30273,30274,30276,57814,57815,57816,57817,57818,57819,57820,57821,57822,57823, +57824,57825,57826,57827,57828,57829,57830,57831,57832,57833,57834,57835,57836, +57837,57838,57839,57840,57841,57842,57843,57844,57845,57846,57847,57848,57849, +57850,57851,57852,57853,57854,57855,57856,57857,57858,57859,57860,57861,57862, +57863,57864,57865,57866,57867,57868,57869,57870,57871,57872,57873,57874,57875, +57876,57877,57878,57879,57880,57881,57882,57883,57884,57885,57886,57887,57888, +57889,57890,57891,57892,57893,57894,57895,57896,57897,57898,57899,57900,57901, +57902,57903,57904,57905,57906,57907,30277,30278,30279,30280,30281,30282,30283, +30286,30287,30288,30289,30290,30291,30293,30295,30296,30297,30298,30299,30301, +30303,30304,30305,30306,30308,30309,30310,30311,30312, +30313,30314,30316,30317,30318,30320,30321,30322,30323,30324,30325,30326,30327, +30329,30330,30332,30335,30336,30337,30339,30341,30345,30346,30348,30349,30351, +30352,30354,30356,30357,30359,30360,30362,30363,30364,30365,30366,30367,30368, +30369,30370,30371,30373,30374,30375,30376,30377,30378,30379,30380,30381,30383, +30384,30387,30389,30390,30391,30392,30393,30394,30395,30396,30397,30398,30400, +30401,30403,21834,38463,22467,25384,21710,21769,21696,30353,30284,34108,30702, +33406,30861,29233,38552,38797,27688,23433,20474,25353,26263,23736,33018,26696, +32942,26114,30414,20985,25942,29100,32753,34948,20658,22885,25034,28595,33453, +25420,25170,21485,21543,31494,20843,30116,24052,25300,36299,38774,25226,32793, +22365,38712,32610,29240,30333,26575,30334,25670,20336,36133,25308,31255,26001, +29677,25644,25203,33324,39041,26495,29256,25198,25292,20276,29923,21322,21150, +32458,37030,24110,26758,27036,33152,32465,26834,30917,34444,38225,20621,35876, +33502,32990,21253,35090,21093,30404,30407,30409,30411,30412,30419,30421,30425, +30426,30428,30429,30430,30432,30433,30434,30435,30436,30438,30439,30440,30441, +30442,30443,30444,30445,30448,30451,30453,30454,30455,30458,30459,30461,30463, +30464,30466,30467,30469,30470,30474,30476,30478,30479,30480,30481,30482,30483, +30484,30485,30486,30487,30488,30491,30492,30493,30494,30497,30499,30500,30501, +30503,30506,30507,30508,30510,30512,30513,30514,30515,30516,30521,30523,30525, +30526,30527,30530,30532,30533,30534,30536,30537,30538,30539,30540,30541,30542, +30543,30546,30547,30548,30549,30550,30551,30552,30553, +30556,34180,38649,20445,22561,39281,23453,25265,25253,26292,35961,40077,29190, +26479,30865,24754,21329,21271,36744,32972,36125,38049,20493,29384,22791,24811, +28953,34987,22868,33519,26412,31528,23849,32503,29997,27893,36454,36856,36924, +40763,27604,37145,31508,24444,30887,34006,34109,27605,27609,27606,24065,24199, +30201,38381,25949,24330,24517,36767,22721,33218,36991,38491,38829,36793,32534, +36140,25153,20415,21464,21342,36776,36777,36779,36941,26631,24426,33176,34920, +40150,24971,21035,30250,24428,25996,28626,28392,23486,25672,20853,20912,26564, +19993,31177,39292,28851,30557,30558,30559,30560,30564,30567,30569,30570,30573, +30574,30575,30576,30577,30578,30579,30580,30581,30582,30583,30584,30586,30587, +30588,30593,30594,30595,30598,30599,30600,30601,30602,30603,30607,30608,30611, +30612,30613,30614,30615,30616,30617,30618,30619,30620,30621,30622,30625,30627, +30628,30630,30632,30635,30637,30638,30639,30641,30642,30644,30646,30647,30648, +30649,30650,30652,30654,30656,30657,30658,30659,30660,30661,30662,30663,30664, +30665,30666,30667,30668,30670,30671,30672,30673,30674,30675,30676,30677,30678, +30680,30681,30682,30685,30686,30687,30688,30689,30692,30149,24182,29627,33760, +25773,25320,38069,27874,21338,21187,25615,38082,31636,20271,24091,33334,33046, +33162,28196,27850,39539,25429,21340,21754,34917,22496,19981,24067,27493,31807, +37096,24598,25830,29468,35009,26448,25165,36130,30572,36393,37319,24425,33756, +34081,39184,21442,34453,27531,24813,24808,28799,33485,33329,20179,27815,34255, +25805,31961,27133,26361,33609,21397,31574,20391,20876, +27979,23618,36461,25554,21449,33580,33590,26597,30900,25661,23519,23700,24046, +35815,25286,26612,35962,25600,25530,34633,39307,35863,32544,38130,20135,38416, +39076,26124,29462,30694,30696,30698,30703,30704,30705,30706,30708,30709,30711, +30713,30714,30715,30716,30723,30724,30725,30726,30727,30728,30730,30731,30734, +30735,30736,30739,30741,30745,30747,30750,30752,30753,30754,30756,30760,30762, +30763,30766,30767,30769,30770,30771,30773,30774,30781,30783,30785,30786,30787, +30788,30790,30792,30793,30794,30795,30797,30799,30801,30803,30804,30808,30809, +30810,30811,30812,30814,30815,30816,30817,30818,30819,30820,30821,30822,30823, +30824,30825,30831,30832,30833,30834,30835,30836,30837,30838,30840,30841,30842, +30843,30845,30846,30847,30848,30849,30850,30851,22330,23581,24120,38271,20607, +32928,21378,25950,30021,21809,20513,36229,25220,38046,26397,22066,28526,24034, +21557,28818,36710,25199,25764,25507,24443,28552,37108,33251,36784,23576,26216, +24561,27785,38472,36225,34924,25745,31216,22478,27225,25104,21576,20056,31243, +24809,28548,35802,25215,36894,39563,31204,21507,30196,25345,21273,27744,36831, +24347,39536,32827,40831,20360,23610,36196,32709,26021,28861,20805,20914,34411, +23815,23456,25277,37228,30068,36364,31264,24833,31609,20167,32504,30597,19985, +33261,21021,20986,27249,21416,36487,38148,38607,28353,38500,26970,30852,30853, +30854,30856,30858,30859,30863,30864,30866,30868,30869,30870,30873,30877,30878, +30880,30882,30884,30886,30888,30889,30890,30891,30892,30893,30894,30895,30901, +30902,30903,30904,30906,30907,30908,30909,30911,30912, +30914,30915,30916,30918,30919,30920,30924,30925,30926,30927,30929,30930,30931, +30934,30935,30936,30938,30939,30940,30941,30942,30943,30944,30945,30946,30947, +30948,30949,30950,30951,30953,30954,30955,30957,30958,30959,30960,30961,30963, +30965,30966,30968,30969,30971,30972,30973,30974,30975,30976,30978,30979,30980, +30982,30983,30984,30985,30986,30987,30988,30784,20648,30679,25616,35302,22788, +25571,24029,31359,26941,20256,33337,21912,20018,30126,31383,24162,24202,38383, +21019,21561,28810,25462,38180,22402,26149,26943,37255,21767,28147,32431,34850, +25139,32496,30133,33576,30913,38604,36766,24904,29943,35789,27492,21050,36176, +27425,32874,33905,22257,21254,20174,19995,20945,31895,37259,31751,20419,36479, +31713,31388,25703,23828,20652,33030,30209,31929,28140,32736,26449,23384,23544, +30923,25774,25619,25514,25387,38169,25645,36798,31572,30249,25171,22823,21574, +27513,20643,25140,24102,27526,20195,36151,34955,24453,36910,30989,30990,30991, +30992,30993,30994,30996,30997,30998,30999,31000,31001,31002,31003,31004,31005, +31007,31008,31009,31010,31011,31013,31014,31015,31016,31017,31018,31019,31020, +31021,31022,31023,31024,31025,31026,31027,31029,31030,31031,31032,31033,31037, +31039,31042,31043,31044,31045,31047,31050,31051,31052,31053,31054,31055,31056, +31057,31058,31060,31061,31064,31065,31073,31075,31076,31078,31081,31082,31083, +31084,31086,31088,31089,31090,31091,31092,31093,31094,31097,31099,31100,31101, +31102,31103,31106,31107,31110,31111,31112,31113,31115,31116,31117,31118,31120, +31121,31122,24608,32829,25285,20025,21333,37112,25528, +32966,26086,27694,20294,24814,28129,35806,24377,34507,24403,25377,20826,33633, +26723,20992,25443,36424,20498,23707,31095,23548,21040,31291,24764,36947,30423, +24503,24471,30340,36460,28783,30331,31561,30634,20979,37011,22564,20302,28404, +36842,25932,31515,29380,28068,32735,23265,25269,24213,22320,33922,31532,24093, +24351,36882,32532,39072,25474,28359,30872,28857,20856,38747,22443,30005,20291, +30008,24215,24806,22880,28096,27583,30857,21500,38613,20939,20993,25481,21514, +38035,35843,36300,29241,30879,34678,36845,35853,21472,31123,31124,31125,31126, +31127,31128,31129,31131,31132,31133,31134,31135,31136,31137,31138,31139,31140, +31141,31142,31144,31145,31146,31147,31148,31149,31150,31151,31152,31153,31154, +31156,31157,31158,31159,31160,31164,31167,31170,31172,31173,31175,31176,31178, +31180,31182,31183,31184,31187,31188,31190,31191,31193,31194,31195,31196,31197, +31198,31200,31201,31202,31205,31208,31210,31212,31214,31217,31218,31219,31220, +31221,31222,31223,31225,31226,31228,31230,31231,31233,31236,31237,31239,31240, +31241,31242,31244,31247,31248,31249,31250,31251,31253,31254,31256,31257,31259, +31260,19969,30447,21486,38025,39030,40718,38189,23450,35746,20002,19996,20908, +33891,25026,21160,26635,20375,24683,20923,27934,20828,25238,26007,38497,35910, +36887,30168,37117,30563,27602,29322,29420,35835,22581,30585,36172,26460,38208, +32922,24230,28193,22930,31471,30701,38203,27573,26029,32526,22534,20817,38431, +23545,22697,21544,36466,25958,39039,22244,38045,30462,36929,25479,21702,22810, +22842,22427,36530,26421,36346,33333,21057,24816,22549, +34558,23784,40517,20420,39069,35769,23077,24694,21380,25212,36943,37122,39295, +24681,32780,20799,32819,23572,39285,27953,20108,31261,31263,31265,31266,31268, +31269,31270,31271,31272,31273,31274,31275,31276,31277,31278,31279,31280,31281, +31282,31284,31285,31286,31288,31290,31294,31296,31297,31298,31299,31300,31301, +31303,31304,31305,31306,31307,31308,31309,31310,31311,31312,31314,31315,31316, +31317,31318,31320,31321,31322,31323,31324,31325,31326,31327,31328,31329,31330, +31331,31332,31333,31334,31335,31336,31337,31338,31339,31340,31341,31342,31343, +31345,31346,31347,31349,31355,31356,31357,31358,31362,31365,31367,31369,31370, +31371,31372,31374,31375,31376,31379,31380,31385,31386,31387,31390,31393,31394, +36144,21457,32602,31567,20240,20047,38400,27861,29648,34281,24070,30058,32763, +27146,30718,38034,32321,20961,28902,21453,36820,33539,36137,29359,39277,27867, +22346,33459,26041,32938,25151,38450,22952,20223,35775,32442,25918,33778,38750, +21857,39134,32933,21290,35837,21536,32954,24223,27832,36153,33452,37210,21545, +27675,20998,32439,22367,28954,27774,31881,22859,20221,24575,24868,31914,20016, +23553,26539,34562,23792,38155,39118,30127,28925,36898,20911,32541,35773,22857, +20964,20315,21542,22827,25975,32932,23413,25206,25282,36752,24133,27679,31526, +20239,20440,26381,31395,31396,31399,31401,31402,31403,31406,31407,31408,31409, +31410,31412,31413,31414,31415,31416,31417,31418,31419,31420,31421,31422,31424, +31425,31426,31427,31428,31429,31430,31431,31432,31433,31434,31436,31437,31438, +31439,31440,31441,31442,31443,31444,31445,31447,31448, +31450,31451,31452,31453,31457,31458,31460,31463,31464,31465,31466,31467,31468, +31470,31472,31473,31474,31475,31476,31477,31478,31479,31480,31483,31484,31486, +31488,31489,31490,31493,31495,31497,31500,31501,31502,31504,31506,31507,31510, +31511,31512,31514,31516,31517,31519,31521,31522,31523,31527,31529,31533,28014, +28074,31119,34993,24343,29995,25242,36741,20463,37340,26023,33071,33105,24220, +33104,36212,21103,35206,36171,22797,20613,20184,38428,29238,33145,36127,23500, +35747,38468,22919,32538,21648,22134,22030,35813,25913,27010,38041,30422,28297, +24178,29976,26438,26577,31487,32925,36214,24863,31174,25954,36195,20872,21018, +38050,32568,32923,32434,23703,28207,26464,31705,30347,39640,33167,32660,31957, +25630,38224,31295,21578,21733,27468,25601,25096,40509,33011,30105,21106,38761, +33883,26684,34532,38401,38548,38124,20010,21508,32473,26681,36319,32789,26356, +24218,32697,31535,31536,31538,31540,31541,31542,31543,31545,31547,31549,31551, +31552,31553,31554,31555,31556,31558,31560,31562,31565,31566,31571,31573,31575, +31577,31580,31582,31583,31585,31587,31588,31589,31590,31591,31592,31593,31594, +31595,31596,31597,31599,31600,31603,31604,31606,31608,31610,31612,31613,31615, +31617,31618,31619,31620,31622,31623,31624,31625,31626,31627,31628,31630,31631, +31633,31634,31635,31638,31640,31641,31642,31643,31646,31647,31648,31651,31652, +31653,31662,31663,31664,31666,31667,31669,31670,31671,31673,31674,31675,31676, +31677,31678,31679,31680,31682,31683,31684,22466,32831,26775,24037,25915,21151, +24685,40858,20379,36524,20844,23467,24339,24041,27742, +25329,36129,20849,38057,21246,27807,33503,29399,22434,26500,36141,22815,36764, +33735,21653,31629,20272,27837,23396,22993,40723,21476,34506,39592,35895,32929, +25925,39038,22266,38599,21038,29916,21072,23521,25346,35074,20054,25296,24618, +26874,20851,23448,20896,35266,31649,39302,32592,24815,28748,36143,20809,24191, +36891,29808,35268,22317,30789,24402,40863,38394,36712,39740,35809,30328,26690, +26588,36330,36149,21053,36746,28378,26829,38149,37101,22269,26524,35065,36807, +21704,31685,31688,31689,31690,31691,31693,31694,31695,31696,31698,31700,31701, +31702,31703,31704,31707,31708,31710,31711,31712,31714,31715,31716,31719,31720, +31721,31723,31724,31725,31727,31728,31730,31731,31732,31733,31734,31736,31737, +31738,31739,31741,31743,31744,31745,31746,31747,31748,31749,31750,31752,31753, +31754,31757,31758,31760,31761,31762,31763,31764,31765,31767,31768,31769,31770, +31771,31772,31773,31774,31776,31777,31778,31779,31780,31781,31784,31785,31787, +31788,31789,31790,31791,31792,31793,31794,31795,31796,31797,31798,31799,31801, +31802,31803,31804,31805,31806,31810,39608,23401,28023,27686,20133,23475,39559, +37219,25000,37039,38889,21547,28085,23506,20989,21898,32597,32752,25788,25421, +26097,25022,24717,28938,27735,27721,22831,26477,33322,22741,22158,35946,27627, +37085,22909,32791,21495,28009,21621,21917,33655,33743,26680,31166,21644,20309, +21512,30418,35977,38402,27827,28088,36203,35088,40548,36154,22079,40657,30165, +24456,29408,24680,21756,20136,27178,34913,24658,36720,21700,28888,34425,40511, +27946,23439,24344,32418,21897,20399,29492,21564,21402, +20505,21518,21628,20046,24573,29786,22774,33899,32993,34676,29392,31946,28246, +31811,31812,31813,31814,31815,31816,31817,31818,31819,31820,31822,31823,31824, +31825,31826,31827,31828,31829,31830,31831,31832,31833,31834,31835,31836,31837, +31838,31839,31840,31841,31842,31843,31844,31845,31846,31847,31848,31849,31850, +31851,31852,31853,31854,31855,31856,31857,31858,31861,31862,31863,31864,31865, +31866,31870,31871,31872,31873,31874,31875,31876,31877,31878,31879,31880,31882, +31883,31884,31885,31886,31887,31888,31891,31892,31894,31897,31898,31899,31904, +31905,31907,31910,31911,31912,31913,31915,31916,31917,31919,31920,31924,31925, +31926,31927,31928,31930,31931,24359,34382,21804,25252,20114,27818,25143,33457, +21719,21326,29502,28369,30011,21010,21270,35805,27088,24458,24576,28142,22351, +27426,29615,26707,36824,32531,25442,24739,21796,30186,35938,28949,28067,23462, +24187,33618,24908,40644,30970,34647,31783,30343,20976,24822,29004,26179,24140, +24653,35854,28784,25381,36745,24509,24674,34516,22238,27585,24724,24935,21321, +24800,26214,36159,31229,20250,28905,27719,35763,35826,32472,33636,26127,23130, +39746,27985,28151,35905,27963,20249,28779,33719,25110,24785,38669,36135,31096, +20987,22334,22522,26426,30072,31293,31215,31637,31935,31936,31938,31939,31940, +31942,31945,31947,31950,31951,31952,31953,31954,31955,31956,31960,31962,31963, +31965,31966,31969,31970,31971,31972,31973,31974,31975,31977,31978,31979,31980, +31981,31982,31984,31985,31986,31987,31988,31989,31990,31991,31993,31994,31996, +31997,31998,31999,32000,32001,32002,32003,32004,32005, +32006,32007,32008,32009,32011,32012,32013,32014,32015,32016,32017,32018,32019, +32020,32021,32022,32023,32024,32025,32026,32027,32028,32029,32030,32031,32033, +32035,32036,32037,32038,32040,32041,32042,32044,32045,32046,32048,32049,32050, +32051,32052,32053,32054,32908,39269,36857,28608,35749,40481,23020,32489,32521, +21513,26497,26840,36753,31821,38598,21450,24613,30142,27762,21363,23241,32423, +25380,20960,33034,24049,34015,25216,20864,23395,20238,31085,21058,24760,27982, +23492,23490,35745,35760,26082,24524,38469,22931,32487,32426,22025,26551,22841, +20339,23478,21152,33626,39050,36158,30002,38078,20551,31292,20215,26550,39550, +23233,27516,30417,22362,23574,31546,38388,29006,20860,32937,33392,22904,32516, +33575,26816,26604,30897,30839,25315,25441,31616,20461,21098,20943,33616,27099, +37492,36341,36145,35265,38190,31661,20214,32055,32056,32057,32058,32059,32060, +32061,32062,32063,32064,32065,32066,32067,32068,32069,32070,32071,32072,32073, +32074,32075,32076,32077,32078,32079,32080,32081,32082,32083,32084,32085,32086, +32087,32088,32089,32090,32091,32092,32093,32094,32095,32096,32097,32098,32099, +32100,32101,32102,32103,32104,32105,32106,32107,32108,32109,32111,32112,32113, +32114,32115,32116,32117,32118,32120,32121,32122,32123,32124,32125,32126,32127, +32128,32129,32130,32131,32132,32133,32134,32135,32136,32137,32138,32139,32140, +32141,32142,32143,32144,32145,32146,32147,32148,32149,32150,32151,32152,20581, +33328,21073,39279,28176,28293,28071,24314,20725,23004,23558,27974,27743,30086, +33931,26728,22870,35762,21280,37233,38477,34121,26898, +30977,28966,33014,20132,37066,27975,39556,23047,22204,25605,38128,30699,20389, +33050,29409,35282,39290,32564,32478,21119,25945,37237,36735,36739,21483,31382, +25581,25509,30342,31224,34903,38454,25130,21163,33410,26708,26480,25463,30571, +31469,27905,32467,35299,22992,25106,34249,33445,30028,20511,20171,30117,35819, +23626,24062,31563,26020,37329,20170,27941,35167,32039,38182,20165,35880,36827, +38771,26187,31105,36817,28908,28024,32153,32154,32155,32156,32157,32158,32159, +32160,32161,32162,32163,32164,32165,32167,32168,32169,32170,32171,32172,32173, +32175,32176,32177,32178,32179,32180,32181,32182,32183,32184,32185,32186,32187, +32188,32189,32190,32191,32192,32193,32194,32195,32196,32197,32198,32199,32200, +32201,32202,32203,32204,32205,32206,32207,32208,32209,32210,32211,32212,32213, +32214,32215,32216,32217,32218,32219,32220,32221,32222,32223,32224,32225,32226, +32227,32228,32229,32230,32231,32232,32233,32234,32235,32236,32237,32238,32239, +32240,32241,32242,32243,32244,32245,32246,32247,32248,32249,32250,23613,21170, +33606,20834,33550,30555,26230,40120,20140,24778,31934,31923,32463,20117,35686, +26223,39048,38745,22659,25964,38236,24452,30153,38742,31455,31454,20928,28847, +31384,25578,31350,32416,29590,38893,20037,28792,20061,37202,21417,25937,26087, +33276,33285,21646,23601,30106,38816,25304,29401,30141,23621,39545,33738,23616, +21632,30697,20030,27822,32858,25298,25454,24040,20855,36317,36382,38191,20465, +21477,24807,28844,21095,25424,40515,23071,20518,30519,21367,32482,25733,25899, +25225,25496,20500,29237,35273,20915,35776,32477,22343, +33740,38055,20891,21531,23803,32251,32252,32253,32254,32255,32256,32257,32258, +32259,32260,32261,32262,32263,32264,32265,32266,32267,32268,32269,32270,32271, +32272,32273,32274,32275,32276,32277,32278,32279,32280,32281,32282,32283,32284, +32285,32286,32287,32288,32289,32290,32291,32292,32293,32294,32295,32296,32297, +32298,32299,32300,32301,32302,32303,32304,32305,32306,32307,32308,32309,32310, +32311,32312,32313,32314,32316,32317,32318,32319,32320,32322,32323,32324,32325, +32326,32328,32329,32330,32331,32332,32333,32334,32335,32336,32337,32338,32339, +32340,32341,32342,32343,32344,32345,32346,32347,32348,32349,20426,31459,27994, +37089,39567,21888,21654,21345,21679,24320,25577,26999,20975,24936,21002,22570, +21208,22350,30733,30475,24247,24951,31968,25179,25239,20130,28821,32771,25335, +28900,38752,22391,33499,26607,26869,30933,39063,31185,22771,21683,21487,28212, +20811,21051,23458,35838,32943,21827,22438,24691,22353,21549,31354,24656,23380, +25511,25248,21475,25187,23495,26543,21741,31391,33510,37239,24211,35044,22840, +22446,25358,36328,33007,22359,31607,20393,24555,23485,27454,21281,31568,29378, +26694,30719,30518,26103,20917,20111,30420,23743,31397,33909,22862,39745,20608, +32350,32351,32352,32353,32354,32355,32356,32357,32358,32359,32360,32361,32362, +32363,32364,32365,32366,32367,32368,32369,32370,32371,32372,32373,32374,32375, +32376,32377,32378,32379,32380,32381,32382,32383,32384,32385,32387,32388,32389, +32390,32391,32392,32393,32394,32395,32396,32397,32398,32399,32400,32401,32402, +32403,32404,32405,32406,32407,32408,32409,32410,32412, +32413,32414,32430,32436,32443,32444,32470,32484,32492,32505,32522,32528,32542, +32567,32569,32571,32572,32573,32574,32575,32576,32577,32579,32582,32583,32584, +32585,32586,32587,32588,32589,32590,32591,32594,32595,39304,24871,28291,22372, +26118,25414,22256,25324,25193,24275,38420,22403,25289,21895,34593,33098,36771, +21862,33713,26469,36182,34013,23146,26639,25318,31726,38417,20848,28572,35888, +25597,35272,25042,32518,28866,28389,29701,27028,29436,24266,37070,26391,28010, +25438,21171,29282,32769,20332,23013,37226,28889,28061,21202,20048,38647,38253, +34174,30922,32047,20769,22418,25794,32907,31867,27882,26865,26974,20919,21400, +26792,29313,40654,31729,29432,31163,28435,29702,26446,37324,40100,31036,33673, +33620,21519,26647,20029,21385,21169,30782,21382,21033,20616,20363,20432,32598, +32601,32603,32604,32605,32606,32608,32611,32612,32613,32614,32615,32619,32620, +32621,32623,32624,32627,32629,32630,32631,32632,32634,32635,32636,32637,32639, +32640,32642,32643,32644,32645,32646,32647,32648,32649,32651,32653,32655,32656, +32657,32658,32659,32661,32662,32663,32664,32665,32667,32668,32672,32674,32675, +32677,32678,32680,32681,32682,32683,32684,32685,32686,32689,32691,32692,32693, +32694,32695,32698,32699,32702,32704,32706,32707,32708,32710,32711,32712,32713, +32715,32717,32719,32720,32721,32722,32723,32726,32727,32729,32730,32731,32732, +32733,32734,32738,32739,30178,31435,31890,27813,38582,21147,29827,21737,20457, +32852,33714,36830,38256,24265,24604,28063,24088,25947,33080,38142,24651,28860, +32451,31918,20937,26753,31921,33391,20004,36742,37327, +26238,20142,35845,25769,32842,20698,30103,29134,23525,36797,28518,20102,25730, +38243,24278,26009,21015,35010,28872,21155,29454,29747,26519,30967,38678,20020, +37051,40158,28107,20955,36161,21533,25294,29618,33777,38646,40836,38083,20278, +32666,20940,28789,38517,23725,39046,21478,20196,28316,29705,27060,30827,39311, +30041,21016,30244,27969,26611,20845,40857,32843,21657,31548,31423,32740,32743, +32744,32746,32747,32748,32749,32751,32754,32756,32757,32758,32759,32760,32761, +32762,32765,32766,32767,32770,32775,32776,32777,32778,32782,32783,32785,32787, +32794,32795,32797,32798,32799,32801,32803,32804,32811,32812,32813,32814,32815, +32816,32818,32820,32825,32826,32828,32830,32832,32833,32836,32837,32839,32840, +32841,32846,32847,32848,32849,32851,32853,32854,32855,32857,32859,32860,32861, +32862,32863,32864,32865,32866,32867,32868,32869,32870,32871,32872,32875,32876, +32877,32878,32879,32880,32882,32883,32884,32885,32886,32887,32888,32889,32890, +32891,32892,32893,38534,22404,25314,38471,27004,23044,25602,31699,28431,38475, +33446,21346,39045,24208,28809,25523,21348,34383,40065,40595,30860,38706,36335, +36162,40575,28510,31108,24405,38470,25134,39540,21525,38109,20387,26053,23653, +23649,32533,34385,27695,24459,29575,28388,32511,23782,25371,23402,28390,21365, +20081,25504,30053,25249,36718,20262,20177,27814,32438,35770,33821,34746,32599, +36923,38179,31657,39585,35064,33853,27931,39558,32476,22920,40635,29595,30721, +34434,39532,39554,22043,21527,22475,20080,40614,21334,36808,33033,30610,39314, +34542,28385,34067,26364,24930,28459,32894,32897,32898, +32901,32904,32906,32909,32910,32911,32912,32913,32914,32916,32917,32919,32921, +32926,32931,32934,32935,32936,32940,32944,32947,32949,32950,32952,32953,32955, +32965,32967,32968,32969,32970,32971,32975,32976,32977,32978,32979,32980,32981, +32984,32991,32992,32994,32995,32998,33006,33013,33015,33017,33019,33022,33023, +33024,33025,33027,33028,33029,33031,33032,33035,33036,33045,33047,33049,33051, +33052,33053,33055,33056,33057,33058,33059,33060,33061,33062,33063,33064,33065, +33066,33067,33069,33070,33072,33075,33076,33077,33079,33081,33082,33083,33084, +33085,33087,35881,33426,33579,30450,27667,24537,33725,29483,33541,38170,27611, +30683,38086,21359,33538,20882,24125,35980,36152,20040,29611,26522,26757,37238, +38665,29028,27809,30473,23186,38209,27599,32654,26151,23504,22969,23194,38376, +38391,20204,33804,33945,27308,30431,38192,29467,26790,23391,30511,37274,38753, +31964,36855,35868,24357,31859,31192,35269,27852,34588,23494,24130,26825,30496, +32501,20885,20813,21193,23081,32517,38754,33495,25551,30596,34256,31186,28218, +24217,22937,34065,28781,27665,25279,30399,25935,24751,38397,26126,34719,40483, +38125,21517,21629,35884,25720,33088,33089,33090,33091,33092,33093,33095,33097, +33101,33102,33103,33106,33110,33111,33112,33115,33116,33117,33118,33119,33121, +33122,33123,33124,33126,33128,33130,33131,33132,33135,33138,33139,33141,33142, +33143,33144,33153,33155,33156,33157,33158,33159,33161,33163,33164,33165,33166, +33168,33170,33171,33172,33173,33174,33175,33177,33178,33182,33183,33184,33185, +33186,33188,33189,33191,33193,33195,33196,33197,33198, +33199,33200,33201,33202,33204,33205,33206,33207,33208,33209,33212,33213,33214, +33215,33220,33221,33223,33224,33225,33227,33229,33230,33231,33232,33233,33234, +33235,25721,34321,27169,33180,30952,25705,39764,25273,26411,33707,22696,40664, +27819,28448,23518,38476,35851,29279,26576,25287,29281,20137,22982,27597,22675, +26286,24149,21215,24917,26408,30446,30566,29287,31302,25343,21738,21584,38048, +37027,23068,32435,27670,20035,22902,32784,22856,21335,30007,38590,22218,25376, +33041,24700,38393,28118,21602,39297,20869,23273,33021,22958,38675,20522,27877, +23612,25311,20320,21311,33147,36870,28346,34091,25288,24180,30910,25781,25467, +24565,23064,37247,40479,23615,25423,32834,23421,21870,38218,38221,28037,24744, +26592,29406,20957,23425,33236,33237,33238,33239,33240,33241,33242,33243,33244, +33245,33246,33247,33248,33249,33250,33252,33253,33254,33256,33257,33259,33262, +33263,33264,33265,33266,33269,33270,33271,33272,33273,33274,33277,33279,33283, +33287,33288,33289,33290,33291,33294,33295,33297,33299,33301,33302,33303,33304, +33305,33306,33309,33312,33316,33317,33318,33319,33321,33326,33330,33338,33340, +33341,33343,33344,33345,33346,33347,33349,33350,33352,33354,33356,33357,33358, +33360,33361,33362,33363,33364,33365,33366,33367,33369,33371,33372,33373,33374, +33376,33377,33378,33379,33380,33381,33382,33383,33385,25319,27870,29275,25197, +38062,32445,33043,27987,20892,24324,22900,21162,24594,22899,26262,34384,30111, +25386,25062,31983,35834,21734,27431,40485,27572,34261,21589,20598,27812,21866, +36276,29228,24085,24597,29750,25293,25490,29260,24472, +28227,27966,25856,28504,30424,30928,30460,30036,21028,21467,20051,24222,26049, +32810,32982,25243,21638,21032,28846,34957,36305,27873,21624,32986,22521,35060, +36180,38506,37197,20329,27803,21943,30406,30768,25256,28921,28558,24429,34028, +26842,30844,31735,33192,26379,40527,25447,30896,22383,30738,38713,25209,25259, +21128,29749,27607,33386,33387,33388,33389,33393,33397,33398,33399,33400,33403, +33404,33408,33409,33411,33413,33414,33415,33417,33420,33424,33427,33428,33429, +33430,33434,33435,33438,33440,33442,33443,33447,33458,33461,33462,33466,33467, +33468,33471,33472,33474,33475,33477,33478,33481,33488,33494,33497,33498,33501, +33506,33511,33512,33513,33514,33516,33517,33518,33520,33522,33523,33525,33526, +33528,33530,33532,33533,33534,33535,33536,33546,33547,33549,33552,33554,33555, +33558,33560,33561,33565,33566,33567,33568,33569,33570,33571,33572,33573,33574, +33577,33578,33582,33584,33586,33591,33595,33597,21860,33086,30130,30382,21305, +30174,20731,23617,35692,31687,20559,29255,39575,39128,28418,29922,31080,25735, +30629,25340,39057,36139,21697,32856,20050,22378,33529,33805,24179,20973,29942, +35780,23631,22369,27900,39047,23110,30772,39748,36843,31893,21078,25169,38138, +20166,33670,33889,33769,33970,22484,26420,22275,26222,28006,35889,26333,28689, +26399,27450,26646,25114,22971,19971,20932,28422,26578,27791,20854,26827,22855, +27495,30054,23822,33040,40784,26071,31048,31041,39569,36215,23682,20062,20225, +21551,22865,30732,22120,27668,36804,24323,27773,27875,35755,25488,33598,33599, +33601,33602,33604,33605,33608,33610,33611,33612,33613, +33614,33619,33621,33622,33623,33624,33625,33629,33634,33648,33649,33650,33651, +33652,33653,33654,33657,33658,33662,33663,33664,33665,33666,33667,33668,33671, +33672,33674,33675,33676,33677,33679,33680,33681,33684,33685,33686,33687,33689, +33690,33693,33695,33697,33698,33699,33700,33701,33702,33703,33708,33709,33710, +33711,33717,33723,33726,33727,33730,33731,33732,33734,33736,33737,33739,33741, +33742,33744,33745,33746,33747,33749,33751,33753,33754,33755,33758,33762,33763, +33764,33766,33767,33768,33771,33772,33773,24688,27965,29301,25190,38030,38085, +21315,36801,31614,20191,35878,20094,40660,38065,38067,21069,28508,36963,27973, +35892,22545,23884,27424,27465,26538,21595,33108,32652,22681,34103,24378,25250, +27207,38201,25970,24708,26725,30631,20052,20392,24039,38808,25772,32728,23789, +20431,31373,20999,33540,19988,24623,31363,38054,20405,20146,31206,29748,21220, +33465,25810,31165,23517,27777,38738,36731,27682,20542,21375,28165,25806,26228, +27696,24773,39031,35831,24198,29756,31351,31179,19992,37041,29699,27714,22234, +37195,27845,36235,21306,34502,26354,36527,23624,39537,28192,33774,33775,33779, +33780,33781,33782,33783,33786,33787,33788,33790,33791,33792,33794,33797,33799, +33800,33801,33802,33808,33810,33811,33812,33813,33814,33815,33817,33818,33819, +33822,33823,33824,33825,33826,33827,33833,33834,33835,33836,33837,33838,33839, +33840,33842,33843,33844,33845,33846,33847,33849,33850,33851,33854,33855,33856, +33857,33858,33859,33860,33861,33863,33864,33865,33866,33867,33868,33869,33870, +33871,33872,33874,33875,33876,33877,33878,33880,33885, +33886,33887,33888,33890,33892,33893,33894,33895,33896,33898,33902,33903,33904, +33906,33908,33911,33913,33915,33916,21462,23094,40843,36259,21435,22280,39079, +26435,37275,27849,20840,30154,25331,29356,21048,21149,32570,28820,30264,21364, +40522,27063,30830,38592,35033,32676,28982,29123,20873,26579,29924,22756,25880, +22199,35753,39286,25200,32469,24825,28909,22764,20161,20154,24525,38887,20219, +35748,20995,22922,32427,25172,20173,26085,25102,33592,33993,33635,34701,29076, +28342,23481,32466,20887,25545,26580,32905,33593,34837,20754,23418,22914,36785, +20083,27741,20837,35109,36719,38446,34122,29790,38160,38384,28070,33509,24369, +25746,27922,33832,33134,40131,22622,36187,19977,21441,33917,33918,33919,33920, +33921,33923,33924,33925,33926,33930,33933,33935,33936,33937,33938,33939,33940, +33941,33942,33944,33946,33947,33949,33950,33951,33952,33954,33955,33956,33957, +33958,33959,33960,33961,33962,33963,33964,33965,33966,33968,33969,33971,33973, +33974,33975,33979,33980,33982,33984,33986,33987,33989,33990,33991,33992,33995, +33996,33998,33999,34002,34004,34005,34007,34008,34009,34010,34011,34012,34014, +34017,34018,34020,34023,34024,34025,34026,34027,34029,34030,34031,34033,34034, +34035,34036,34037,34038,34039,34040,34041,34042,34043,34045,34046,34048,34049, +34050,20254,25955,26705,21971,20007,25620,39578,25195,23234,29791,33394,28073, +26862,20711,33678,30722,26432,21049,27801,32433,20667,21861,29022,31579,26194, +29642,33515,26441,23665,21024,29053,34923,38378,38485,25797,36193,33203,21892, +27733,25159,32558,22674,20260,21830,36175,26188,19978, +23578,35059,26786,25422,31245,28903,33421,21242,38902,23569,21736,37045,32461, +22882,36170,34503,33292,33293,36198,25668,23556,24913,28041,31038,35774,30775, +30003,21627,20280,36523,28145,23072,32453,31070,27784,23457,23158,29978,32958, +24910,28183,22768,29983,29989,29298,21319,32499,34051,34052,34053,34054,34055, +34056,34057,34058,34059,34061,34062,34063,34064,34066,34068,34069,34070,34072, +34073,34075,34076,34077,34078,34080,34082,34083,34084,34085,34086,34087,34088, +34089,34090,34093,34094,34095,34096,34097,34098,34099,34100,34101,34102,34110, +34111,34112,34113,34114,34116,34117,34118,34119,34123,34124,34125,34126,34127, +34128,34129,34130,34131,34132,34133,34135,34136,34138,34139,34140,34141,34143, +34144,34145,34146,34147,34149,34150,34151,34153,34154,34155,34156,34157,34158, +34159,34160,34161,34163,34165,34166,34167,34168,34172,34173,34175,34176,34177, +30465,30427,21097,32988,22307,24072,22833,29422,26045,28287,35799,23608,34417, +21313,30707,25342,26102,20160,39135,34432,23454,35782,21490,30690,20351,23630, +39542,22987,24335,31034,22763,19990,26623,20107,25325,35475,36893,21183,26159, +21980,22124,36866,20181,20365,37322,39280,27663,24066,24643,23460,35270,35797, +25910,25163,39318,23432,23551,25480,21806,21463,30246,20861,34092,26530,26803, +27530,25234,36755,21460,33298,28113,30095,20070,36174,23408,29087,34223,26257, +26329,32626,34560,40653,40736,23646,26415,36848,26641,26463,25101,31446,22661, +24246,25968,28465,34178,34179,34182,34184,34185,34186,34187,34188,34189,34190, +34192,34193,34194,34195,34196,34197,34198,34199,34200, +34201,34202,34205,34206,34207,34208,34209,34210,34211,34213,34214,34215,34217, +34219,34220,34221,34225,34226,34227,34228,34229,34230,34232,34234,34235,34236, +34237,34238,34239,34240,34242,34243,34244,34245,34246,34247,34248,34250,34251, +34252,34253,34254,34257,34258,34260,34262,34263,34264,34265,34266,34267,34269, +34270,34271,34272,34273,34274,34275,34277,34278,34279,34280,34282,34283,34284, +34285,34286,34287,34288,34289,34290,34291,34292,34293,34294,34295,34296,24661, +21047,32781,25684,34928,29993,24069,26643,25332,38684,21452,29245,35841,27700, +30561,31246,21550,30636,39034,33308,35828,30805,26388,28865,26031,25749,22070, +24605,31169,21496,19997,27515,32902,23546,21987,22235,20282,20284,39282,24051, +26494,32824,24578,39042,36865,23435,35772,35829,25628,33368,25822,22013,33487, +37221,20439,32032,36895,31903,20723,22609,28335,23487,35785,32899,37240,33948, +31639,34429,38539,38543,32485,39635,30862,23681,31319,36930,38567,31071,23385, +25439,31499,34001,26797,21766,32553,29712,32034,38145,25152,22604,20182,23427, +22905,22612,34297,34298,34300,34301,34302,34304,34305,34306,34307,34308,34310, +34311,34312,34313,34314,34315,34316,34317,34318,34319,34320,34322,34323,34324, +34325,34327,34328,34329,34330,34331,34332,34333,34334,34335,34336,34337,34338, +34339,34340,34341,34342,34344,34346,34347,34348,34349,34350,34351,34352,34353, +34354,34355,34356,34357,34358,34359,34361,34362,34363,34365,34366,34367,34368, +34369,34370,34371,34372,34373,34374,34375,34376,34377,34378,34379,34380,34386, +34387,34389,34390,34391,34392,34393,34395,34396,34397, +34399,34400,34401,34403,34404,34405,34406,34407,34408,34409,34410,29549,25374, +36427,36367,32974,33492,25260,21488,27888,37214,22826,24577,27760,22349,25674, +36138,30251,28393,22363,27264,30192,28525,35885,35848,22374,27631,34962,30899, +25506,21497,28845,27748,22616,25642,22530,26848,33179,21776,31958,20504,36538, +28108,36255,28907,25487,28059,28372,32486,33796,26691,36867,28120,38518,35752, +22871,29305,34276,33150,30140,35466,26799,21076,36386,38161,25552,39064,36420, +21884,20307,26367,22159,24789,28053,21059,23625,22825,28155,22635,30000,29980, +24684,33300,33094,25361,26465,36834,30522,36339,36148,38081,24086,21381,21548, +28867,34413,34415,34416,34418,34419,34420,34421,34422,34423,34424,34435,34436, +34437,34438,34439,34440,34441,34446,34447,34448,34449,34450,34452,34454,34455, +34456,34457,34458,34459,34462,34463,34464,34465,34466,34469,34470,34475,34477, +34478,34482,34483,34487,34488,34489,34491,34492,34493,34494,34495,34497,34498, +34499,34501,34504,34508,34509,34514,34515,34517,34518,34519,34522,34524,34525, +34528,34529,34530,34531,34533,34534,34535,34536,34538,34539,34540,34543,34549, +34550,34551,34554,34555,34556,34557,34559,34561,34564,34565,34566,34571,34572, +34574,34575,34576,34577,34580,34582,27712,24311,20572,20141,24237,25402,33351, +36890,26704,37230,30643,21516,38108,24420,31461,26742,25413,31570,32479,30171, +20599,25237,22836,36879,20984,31171,31361,22270,24466,36884,28034,23648,22303, +21520,20820,28237,22242,25512,39059,33151,34581,35114,36864,21534,23663,33216, +25302,25176,33073,40501,38464,39534,39548,26925,22949, +25299,21822,25366,21703,34521,27964,23043,29926,34972,27498,22806,35916,24367, +28286,29609,39037,20024,28919,23436,30871,25405,26202,30358,24779,23451,23113, +19975,33109,27754,29579,20129,26505,32593,24448,26106,26395,24536,22916,23041, +34585,34587,34589,34591,34592,34596,34598,34599,34600,34602,34603,34604,34605, +34607,34608,34610,34611,34613,34614,34616,34617,34618,34620,34621,34624,34625, +34626,34627,34628,34629,34630,34634,34635,34637,34639,34640,34641,34642,34644, +34645,34646,34648,34650,34651,34652,34653,34654,34655,34657,34658,34662,34663, +34664,34665,34666,34667,34668,34669,34671,34673,34674,34675,34677,34679,34680, +34681,34682,34687,34688,34689,34692,34694,34695,34697,34698,34700,34702,34703, +34704,34705,34706,34708,34709,34710,34712,34713,34714,34715,34716,34717,34718, +34720,34721,34722,34723,34724,24013,24494,21361,38886,36829,26693,22260,21807, +24799,20026,28493,32500,33479,33806,22996,20255,20266,23614,32428,26410,34074, +21619,30031,32963,21890,39759,20301,28205,35859,23561,24944,21355,30239,28201, +34442,25991,38395,32441,21563,31283,32010,38382,21985,32705,29934,25373,34583, +28065,31389,25105,26017,21351,25569,27779,24043,21596,38056,20044,27745,35820, +23627,26080,33436,26791,21566,21556,27595,27494,20116,25410,21320,33310,20237, +20398,22366,25098,38654,26212,29289,21247,21153,24735,35823,26132,29081,26512, +35199,30802,30717,26224,22075,21560,38177,29306,34725,34726,34727,34729,34730, +34734,34736,34737,34738,34740,34742,34743,34744,34745,34747,34748,34750,34751, +34753,34754,34755,34756,34757,34759,34760,34761,34764, +34765,34766,34767,34768,34772,34773,34774,34775,34776,34777,34778,34780,34781, +34782,34783,34785,34786,34787,34788,34790,34791,34792,34793,34795,34796,34797, +34799,34800,34801,34802,34803,34804,34805,34806,34807,34808,34810,34811,34812, +34813,34815,34816,34817,34818,34820,34821,34822,34823,34824,34825,34827,34828, +34829,34830,34831,34832,34833,34834,34836,34839,34840,34841,34842,34844,34845, +34846,34847,34848,34851,31232,24687,24076,24713,33181,22805,24796,29060,28911, +28330,27728,29312,27268,34989,24109,20064,23219,21916,38115,27927,31995,38553, +25103,32454,30606,34430,21283,38686,36758,26247,23777,20384,29421,19979,21414, +22799,21523,25472,38184,20808,20185,40092,32420,21688,36132,34900,33335,38386, +28046,24358,23244,26174,38505,29616,29486,21439,33146,39301,32673,23466,38519, +38480,32447,30456,21410,38262,39321,31665,35140,28248,20065,32724,31077,35814, +24819,21709,20139,39033,24055,27233,20687,21521,35937,33831,30813,38660,21066, +21742,22179,38144,28040,23477,28102,26195,34852,34853,34854,34855,34856,34857, +34858,34859,34860,34861,34862,34863,34864,34865,34867,34868,34869,34870,34871, +34872,34874,34875,34877,34878,34879,34881,34882,34883,34886,34887,34888,34889, +34890,34891,34894,34895,34896,34897,34898,34899,34901,34902,34904,34906,34907, +34908,34909,34910,34911,34912,34918,34919,34922,34925,34927,34929,34931,34932, +34933,34934,34936,34937,34938,34939,34940,34944,34947,34950,34951,34953,34954, +34956,34958,34959,34960,34961,34963,34964,34965,34967,34968,34969,34970,34971, +34973,34974,34975,34976,34977,34979,34981,34982,34983, +34984,34985,34986,23567,23389,26657,32918,21880,31505,25928,26964,20123,27463, +34638,38795,21327,25375,25658,37034,26012,32961,35856,20889,26800,21368,34809, +25032,27844,27899,35874,23633,34218,33455,38156,27427,36763,26032,24571,24515, +20449,34885,26143,33125,29481,24826,20852,21009,22411,24418,37026,34892,37266, +24184,26447,24615,22995,20804,20982,33016,21256,27769,38596,29066,20241,20462, +32670,26429,21957,38152,31168,34966,32483,22687,25100,38656,34394,22040,39035, +24464,35768,33988,37207,21465,26093,24207,30044,24676,32110,23167,32490,32493, +36713,21927,23459,24748,26059,29572,34988,34990,34991,34992,34994,34995,34996, +34997,34998,35000,35001,35002,35003,35005,35006,35007,35008,35011,35012,35015, +35016,35018,35019,35020,35021,35023,35024,35025,35027,35030,35031,35034,35035, +35036,35037,35038,35040,35041,35046,35047,35049,35050,35051,35052,35053,35054, +35055,35058,35061,35062,35063,35066,35067,35069,35071,35072,35073,35075,35076, +35077,35078,35079,35080,35081,35083,35084,35085,35086,35087,35089,35092,35093, +35094,35095,35096,35100,35101,35102,35103,35104,35106,35107,35108,35110,35111, +35112,35113,35116,35117,35118,35119,35121,35122,35123,35125,35127,36873,30307, +30505,32474,38772,34203,23398,31348,38634,34880,21195,29071,24490,26092,35810, +23547,39535,24033,27529,27739,35757,35759,36874,36805,21387,25276,40486,40493, +21568,20011,33469,29273,34460,23830,34905,28079,38597,21713,20122,35766,28937, +21693,38409,28895,28153,30416,20005,30740,34578,23721,24310,35328,39068,38414, +28814,27839,22852,25513,30524,34893,28436,33395,22576, +29141,21388,30746,38593,21761,24422,28976,23476,35866,39564,27523,22830,40495, +31207,26472,25196,20335,30113,32650,27915,38451,27687,20208,30162,20859,26679, +28478,36992,33136,22934,29814,35128,35129,35130,35131,35132,35133,35134,35135, +35136,35138,35139,35141,35142,35143,35144,35145,35146,35147,35148,35149,35150, +35151,35152,35153,35154,35155,35156,35157,35158,35159,35160,35161,35162,35163, +35164,35165,35168,35169,35170,35171,35172,35173,35175,35176,35177,35178,35179, +35180,35181,35182,35183,35184,35185,35186,35187,35188,35189,35190,35191,35192, +35193,35194,35196,35197,35198,35200,35202,35204,35205,35207,35208,35209,35210, +35211,35212,35213,35214,35215,35216,35217,35218,35219,35220,35221,35222,35223, +35224,35225,35226,35227,35228,35229,35230,35231,35232,35233,25671,23591,36965, +31377,35875,23002,21676,33280,33647,35201,32768,26928,22094,32822,29239,37326, +20918,20063,39029,25494,19994,21494,26355,33099,22812,28082,19968,22777,21307, +25558,38129,20381,20234,34915,39056,22839,36951,31227,20202,33008,30097,27778, +23452,23016,24413,26885,34433,20506,24050,20057,30691,20197,33402,25233,26131, +37009,23673,20159,24441,33222,36920,32900,30123,20134,35028,24847,27589,24518, +20041,30410,28322,35811,35758,35850,35793,24322,32764,32716,32462,33589,33643, +22240,27575,38899,38452,23035,21535,38134,28139,23493,39278,23609,24341,38544, +35234,35235,35236,35237,35238,35239,35240,35241,35242,35243,35244,35245,35246, +35247,35248,35249,35250,35251,35252,35253,35254,35255,35256,35257,35258,35259, +35260,35261,35262,35263,35264,35267,35277,35283,35284, +35285,35287,35288,35289,35291,35293,35295,35296,35297,35298,35300,35303,35304, +35305,35306,35308,35309,35310,35312,35313,35314,35316,35317,35318,35319,35320, +35321,35322,35323,35324,35325,35326,35327,35329,35330,35331,35332,35333,35334, +35336,35337,35338,35339,35340,35341,35342,35343,35344,35345,35346,35347,35348, +35349,35350,35351,35352,35353,35354,35355,35356,35357,21360,33521,27185,23156, +40560,24212,32552,33721,33828,33829,33639,34631,36814,36194,30408,24433,39062, +30828,26144,21727,25317,20323,33219,30152,24248,38605,36362,34553,21647,27891, +28044,27704,24703,21191,29992,24189,20248,24736,24551,23588,30001,37038,38080, +29369,27833,28216,37193,26377,21451,21491,20305,37321,35825,21448,24188,36802, +28132,20110,30402,27014,34398,24858,33286,20313,20446,36926,40060,24841,28189, +28180,38533,20104,23089,38632,19982,23679,31161,23431,35821,32701,29577,22495, +33419,37057,21505,36935,21947,23786,24481,24840,27442,29425,32946,35465,35358, +35359,35360,35361,35362,35363,35364,35365,35366,35367,35368,35369,35370,35371, +35372,35373,35374,35375,35376,35377,35378,35379,35380,35381,35382,35383,35384, +35385,35386,35387,35388,35389,35391,35392,35393,35394,35395,35396,35397,35398, +35399,35401,35402,35403,35404,35405,35406,35407,35408,35409,35410,35411,35412, +35413,35414,35415,35416,35417,35418,35419,35420,35421,35422,35423,35424,35425, +35426,35427,35428,35429,35430,35431,35432,35433,35434,35435,35436,35437,35438, +35439,35440,35441,35442,35443,35444,35445,35446,35447,35448,35450,35451,35452, +35453,35454,35455,35456,28020,23507,35029,39044,35947, +39533,40499,28170,20900,20803,22435,34945,21407,25588,36757,22253,21592,22278, +29503,28304,32536,36828,33489,24895,24616,38498,26352,32422,36234,36291,38053, +23731,31908,26376,24742,38405,32792,20113,37095,21248,38504,20801,36816,34164, +37213,26197,38901,23381,21277,30776,26434,26685,21705,28798,23472,36733,20877, +22312,21681,25874,26242,36190,36163,33039,33900,36973,31967,20991,34299,26531, +26089,28577,34468,36481,22122,36896,30338,28790,29157,36131,25321,21017,27901, +36156,24590,22686,24974,26366,36192,25166,21939,28195,26413,36711,35457,35458, +35459,35460,35461,35462,35463,35464,35467,35468,35469,35470,35471,35472,35473, +35474,35476,35477,35478,35479,35480,35481,35482,35483,35484,35485,35486,35487, +35488,35489,35490,35491,35492,35493,35494,35495,35496,35497,35498,35499,35500, +35501,35502,35503,35504,35505,35506,35507,35508,35509,35510,35511,35512,35513, +35514,35515,35516,35517,35518,35519,35520,35521,35522,35523,35524,35525,35526, +35527,35528,35529,35530,35531,35532,35533,35534,35535,35536,35537,35538,35539, +35540,35541,35542,35543,35544,35545,35546,35547,35548,35549,35550,35551,35552, +35553,35554,35555,38113,38392,30504,26629,27048,21643,20045,28856,35784,25688, +25995,23429,31364,20538,23528,30651,27617,35449,31896,27838,30415,26025,36759, +23853,23637,34360,26632,21344,25112,31449,28251,32509,27167,31456,24432,28467, +24352,25484,28072,26454,19976,24080,36134,20183,32960,30260,38556,25307,26157, +25214,27836,36213,29031,32617,20806,32903,21484,36974,25240,21746,34544,36761, +32773,38167,34071,36825,27993,29645,26015,30495,29956, +30759,33275,36126,38024,20390,26517,30137,35786,38663,25391,38215,38453,33976, +25379,30529,24449,29424,20105,24596,25972,25327,27491,25919,35556,35557,35558, +35559,35560,35561,35562,35563,35564,35565,35566,35567,35568,35569,35570,35571, +35572,35573,35574,35575,35576,35577,35578,35579,35580,35581,35582,35583,35584, +35585,35586,35587,35588,35589,35590,35592,35593,35594,35595,35596,35597,35598, +35599,35600,35601,35602,35603,35604,35605,35606,35607,35608,35609,35610,35611, +35612,35613,35614,35615,35616,35617,35618,35619,35620,35621,35623,35624,35625, +35626,35627,35628,35629,35630,35631,35632,35633,35634,35635,35636,35637,35638, +35639,35640,35641,35642,35643,35644,35645,35646,35647,35648,35649,35650,35651, +35652,35653,24103,30151,37073,35777,33437,26525,25903,21553,34584,30693,32930, +33026,27713,20043,32455,32844,30452,26893,27542,25191,20540,20356,22336,25351, +27490,36286,21482,26088,32440,24535,25370,25527,33267,33268,32622,24092,23769, +21046,26234,31209,31258,36136,28825,30164,28382,27835,31378,20013,30405,24544, +38047,34935,32456,31181,32959,37325,20210,20247,33311,21608,24030,27954,35788, +31909,36724,32920,24090,21650,30385,23449,26172,39588,29664,26666,34523,26417, +29482,35832,35803,36880,31481,28891,29038,25284,30633,22065,20027,33879,26609, +21161,34496,36142,38136,31569,35654,35655,35656,35657,35658,35659,35660,35661, +35662,35663,35664,35665,35666,35667,35668,35669,35670,35671,35672,35673,35674, +35675,35676,35677,35678,35679,35680,35681,35682,35683,35684,35685,35687,35688, +35689,35690,35691,35693,35694,35695,35696,35697,35698, +35699,35700,35701,35702,35703,35704,35705,35706,35707,35708,35709,35710,35711, +35712,35713,35714,35715,35716,35717,35718,35719,35720,35721,35722,35723,35724, +35725,35726,35727,35728,35729,35730,35731,35732,35733,35734,35735,35736,35737, +35738,35739,35740,35741,35742,35743,35756,35761,35771,35783,35792,35818,35849, +35870,20303,27880,31069,39547,25235,29226,25341,19987,30742,36716,25776,36186, +31686,26729,24196,35013,22918,25758,22766,29366,26894,38181,36861,36184,22368, +32512,35846,20934,25417,25305,21331,26700,29730,33537,37196,21828,30528,28796, +27978,20857,21672,36164,23039,28363,28100,23388,32043,20180,31869,28371,23376, +33258,28173,23383,39683,26837,36394,23447,32508,24635,32437,37049,36208,22863, +25549,31199,36275,21330,26063,31062,35781,38459,32452,38075,32386,22068,37257, +26368,32618,23562,36981,26152,24038,20304,26590,20570,20316,22352,24231,59408, +59409,59410,59411,59412,35896,35897,35898,35899,35900,35901,35902,35903,35904, +35906,35907,35908,35909,35912,35914,35915,35917,35918,35919,35920,35921,35922, +35923,35924,35926,35927,35928,35929,35931,35932,35933,35934,35935,35936,35939, +35940,35941,35942,35943,35944,35945,35948,35949,35950,35951,35952,35953,35954, +35956,35957,35958,35959,35963,35964,35965,35966,35967,35968,35969,35971,35972, +35974,35975,35976,35979,35981,35982,35983,35984,35985,35986,35987,35989,35990, +35991,35993,35994,35995,35996,35997,35998,35999,36000,36001,36002,36003,36004, +36005,36006,36007,36008,36009,36010,36011,36012,36013,20109,19980,20800,19984, +24319,21317,19989,20120,19998,39730,23404,22121,20008, +31162,20031,21269,20039,22829,29243,21358,27664,22239,32996,39319,27603,30590, +40727,20022,20127,40720,20060,20073,20115,33416,23387,21868,22031,20164,21389, +21405,21411,21413,21422,38757,36189,21274,21493,21286,21294,21310,36188,21350, +21347,20994,21000,21006,21037,21043,21055,21056,21068,21086,21089,21084,33967, +21117,21122,21121,21136,21139,20866,32596,20155,20163,20169,20162,20200,20193, +20203,20190,20251,20211,20258,20324,20213,20261,20263,20233,20267,20318,20327, +25912,20314,20317,36014,36015,36016,36017,36018,36019,36020,36021,36022,36023, +36024,36025,36026,36027,36028,36029,36030,36031,36032,36033,36034,36035,36036, +36037,36038,36039,36040,36041,36042,36043,36044,36045,36046,36047,36048,36049, +36050,36051,36052,36053,36054,36055,36056,36057,36058,36059,36060,36061,36062, +36063,36064,36065,36066,36067,36068,36069,36070,36071,36072,36073,36074,36075, +36076,36077,36078,36079,36080,36081,36082,36083,36084,36085,36086,36087,36088, +36089,36090,36091,36092,36093,36094,36095,36096,36097,36098,36099,36100,36101, +36102,36103,36104,36105,36106,36107,36108,36109,20319,20311,20274,20285,20342, +20340,20369,20361,20355,20367,20350,20347,20394,20348,20396,20372,20454,20456, +20458,20421,20442,20451,20444,20433,20447,20472,20521,20556,20467,20524,20495, +20526,20525,20478,20508,20492,20517,20520,20606,20547,20565,20552,20558,20588, +20603,20645,20647,20649,20666,20694,20742,20717,20716,20710,20718,20743,20747, +20189,27709,20312,20325,20430,40864,27718,31860,20846,24061,40649,39320,20865, +22804,21241,21261,35335,21264,20971,22809,20821,20128, +20822,20147,34926,34980,20149,33044,35026,31104,23348,34819,32696,20907,20913, +20925,20924,36110,36111,36112,36113,36114,36115,36116,36117,36118,36119,36120, +36121,36122,36123,36124,36128,36177,36178,36183,36191,36197,36200,36201,36202, +36204,36206,36207,36209,36210,36216,36217,36218,36219,36220,36221,36222,36223, +36224,36226,36227,36230,36231,36232,36233,36236,36237,36238,36239,36240,36242, +36243,36245,36246,36247,36248,36249,36250,36251,36252,36253,36254,36256,36257, +36258,36260,36261,36262,36263,36264,36265,36266,36267,36268,36269,36270,36271, +36272,36274,36278,36279,36281,36283,36285,36288,36289,36290,36293,36295,36296, +36297,36298,36301,36304,36306,36307,36308,20935,20886,20898,20901,35744,35750, +35751,35754,35764,35765,35767,35778,35779,35787,35791,35790,35794,35795,35796, +35798,35800,35801,35804,35807,35808,35812,35816,35817,35822,35824,35827,35830, +35833,35836,35839,35840,35842,35844,35847,35852,35855,35857,35858,35860,35861, +35862,35865,35867,35864,35869,35871,35872,35873,35877,35879,35882,35883,35886, +35887,35890,35891,35893,35894,21353,21370,38429,38434,38433,38449,38442,38461, +38460,38466,38473,38484,38495,38503,38508,38514,38516,38536,38541,38551,38576, +37015,37019,37021,37017,37036,37025,37044,37043,37046,37050,36309,36312,36313, +36316,36320,36321,36322,36325,36326,36327,36329,36333,36334,36336,36337,36338, +36340,36342,36348,36350,36351,36352,36353,36354,36355,36356,36358,36359,36360, +36363,36365,36366,36368,36369,36370,36371,36373,36374,36375,36376,36377,36378, +36379,36380,36384,36385,36388,36389,36390,36391,36392, +36395,36397,36400,36402,36403,36404,36406,36407,36408,36411,36412,36414,36415, +36419,36421,36422,36428,36429,36430,36431,36432,36435,36436,36437,36438,36439, +36440,36442,36443,36444,36445,36446,36447,36448,36449,36450,36451,36452,36453, +36455,36456,36458,36459,36462,36465,37048,37040,37071,37061,37054,37072,37060, +37063,37075,37094,37090,37084,37079,37083,37099,37103,37118,37124,37154,37150, +37155,37169,37167,37177,37187,37190,21005,22850,21154,21164,21165,21182,21759, +21200,21206,21232,21471,29166,30669,24308,20981,20988,39727,21430,24321,30042, +24047,22348,22441,22433,22654,22716,22725,22737,22313,22316,22314,22323,22329, +22318,22319,22364,22331,22338,22377,22405,22379,22406,22396,22395,22376,22381, +22390,22387,22445,22436,22412,22450,22479,22439,22452,22419,22432,22485,22488, +22490,22489,22482,22456,22516,22511,22520,22500,22493,36467,36469,36471,36472, +36473,36474,36475,36477,36478,36480,36482,36483,36484,36486,36488,36489,36490, +36491,36492,36493,36494,36497,36498,36499,36501,36502,36503,36504,36505,36506, +36507,36509,36511,36512,36513,36514,36515,36516,36517,36518,36519,36520,36521, +36522,36525,36526,36528,36529,36531,36532,36533,36534,36535,36536,36537,36539, +36540,36541,36542,36543,36544,36545,36546,36547,36548,36549,36550,36551,36552, +36553,36554,36555,36556,36557,36559,36560,36561,36562,36563,36564,36565,36566, +36567,36568,36569,36570,36571,36572,36573,36574,36575,36576,36577,36578,36579, +36580,22539,22541,22525,22509,22528,22558,22553,22596,22560,22629,22636,22657, +22665,22682,22656,39336,40729,25087,33401,33405,33407, +33423,33418,33448,33412,33422,33425,33431,33433,33451,33464,33470,33456,33480, +33482,33507,33432,33463,33454,33483,33484,33473,33449,33460,33441,33450,33439, +33476,33486,33444,33505,33545,33527,33508,33551,33543,33500,33524,33490,33496, +33548,33531,33491,33553,33562,33542,33556,33557,33504,33493,33564,33617,33627, +33628,33544,33682,33596,33588,33585,33691,33630,33583,33615,33607,33603,33631, +33600,33559,33632,33581,33594,33587,33638,33637,36581,36582,36583,36584,36585, +36586,36587,36588,36589,36590,36591,36592,36593,36594,36595,36596,36597,36598, +36599,36600,36601,36602,36603,36604,36605,36606,36607,36608,36609,36610,36611, +36612,36613,36614,36615,36616,36617,36618,36619,36620,36621,36622,36623,36624, +36625,36626,36627,36628,36629,36630,36631,36632,36633,36634,36635,36636,36637, +36638,36639,36640,36641,36642,36643,36644,36645,36646,36647,36648,36649,36650, +36651,36652,36653,36654,36655,36656,36657,36658,36659,36660,36661,36662,36663, +36664,36665,36666,36667,36668,36669,36670,36671,36672,36673,36674,36675,36676, +33640,33563,33641,33644,33642,33645,33646,33712,33656,33715,33716,33696,33706, +33683,33692,33669,33660,33718,33705,33661,33720,33659,33688,33694,33704,33722, +33724,33729,33793,33765,33752,22535,33816,33803,33757,33789,33750,33820,33848, +33809,33798,33748,33759,33807,33795,33784,33785,33770,33733,33728,33830,33776, +33761,33884,33873,33882,33881,33907,33927,33928,33914,33929,33912,33852,33862, +33897,33910,33932,33934,33841,33901,33985,33997,34000,34022,33981,34003,33994, +33983,33978,34016,33953,33977,33972,33943,34021,34019, +34060,29965,34104,34032,34105,34079,34106,36677,36678,36679,36680,36681,36682, +36683,36684,36685,36686,36687,36688,36689,36690,36691,36692,36693,36694,36695, +36696,36697,36698,36699,36700,36701,36702,36703,36704,36705,36706,36707,36708, +36709,36714,36736,36748,36754,36765,36768,36769,36770,36772,36773,36774,36775, +36778,36780,36781,36782,36783,36786,36787,36788,36789,36791,36792,36794,36795, +36796,36799,36800,36803,36806,36809,36810,36811,36812,36813,36815,36818,36822, +36823,36826,36832,36833,36835,36839,36844,36847,36849,36850,36852,36853,36854, +36858,36859,36860,36862,36863,36871,36872,36876,36878,36883,36885,36888,34134, +34107,34047,34044,34137,34120,34152,34148,34142,34170,30626,34115,34162,34171, +34212,34216,34183,34191,34169,34222,34204,34181,34233,34231,34224,34259,34241, +34268,34303,34343,34309,34345,34326,34364,24318,24328,22844,22849,32823,22869, +22874,22872,21263,23586,23589,23596,23604,25164,25194,25247,25275,25290,25306, +25303,25326,25378,25334,25401,25419,25411,25517,25590,25457,25466,25486,25524, +25453,25516,25482,25449,25518,25532,25586,25592,25568,25599,25540,25566,25550, +25682,25542,25534,25669,25665,25611,25627,25632,25612,25638,25633,25694,25732, +25709,25750,36889,36892,36899,36900,36901,36903,36904,36905,36906,36907,36908, +36912,36913,36914,36915,36916,36919,36921,36922,36925,36927,36928,36931,36933, +36934,36936,36937,36938,36939,36940,36942,36948,36949,36950,36953,36954,36956, +36957,36958,36959,36960,36961,36964,36966,36967,36969,36970,36971,36972,36975, +36976,36977,36978,36979,36982,36983,36984,36985,36986, +36987,36988,36990,36993,36996,36997,36998,36999,37001,37002,37004,37005,37006, +37007,37008,37010,37012,37014,37016,37018,37020,37022,37023,37024,37028,37029, +37031,37032,37033,37035,37037,37042,37047,37052,37053,37055,37056,25722,25783, +25784,25753,25786,25792,25808,25815,25828,25826,25865,25893,25902,24331,24530, +29977,24337,21343,21489,21501,21481,21480,21499,21522,21526,21510,21579,21586, +21587,21588,21590,21571,21537,21591,21593,21539,21554,21634,21652,21623,21617, +21604,21658,21659,21636,21622,21606,21661,21712,21677,21698,21684,21714,21671, +21670,21715,21716,21618,21667,21717,21691,21695,21708,21721,21722,21724,21673, +21674,21668,21725,21711,21726,21787,21735,21792,21757,21780,21747,21794,21795, +21775,21777,21799,21802,21863,21903,21941,21833,21869,21825,21845,21823,21840, +21820,37058,37059,37062,37064,37065,37067,37068,37069,37074,37076,37077,37078, +37080,37081,37082,37086,37087,37088,37091,37092,37093,37097,37098,37100,37102, +37104,37105,37106,37107,37109,37110,37111,37113,37114,37115,37116,37119,37120, +37121,37123,37125,37126,37127,37128,37129,37130,37131,37132,37133,37134,37135, +37136,37137,37138,37139,37140,37141,37142,37143,37144,37146,37147,37148,37149, +37151,37152,37153,37156,37157,37158,37159,37160,37161,37162,37163,37164,37165, +37166,37168,37170,37171,37172,37173,37174,37175,37176,37178,37179,37180,37181, +37182,37183,37184,37185,37186,37188,21815,21846,21877,21878,21879,21811,21808, +21852,21899,21970,21891,21937,21945,21896,21889,21919,21886,21974,21905,21883, +21983,21949,21950,21908,21913,21994,22007,21961,22047, +21969,21995,21996,21972,21990,21981,21956,21999,21989,22002,22003,21964,21965, +21992,22005,21988,36756,22046,22024,22028,22017,22052,22051,22014,22016,22055, +22061,22104,22073,22103,22060,22093,22114,22105,22108,22092,22100,22150,22116, +22129,22123,22139,22140,22149,22163,22191,22228,22231,22237,22241,22261,22251, +22265,22271,22276,22282,22281,22300,24079,24089,24084,24081,24113,24123,24124, +37189,37191,37192,37201,37203,37204,37205,37206,37208,37209,37211,37212,37215, +37216,37222,37223,37224,37227,37229,37235,37242,37243,37244,37248,37249,37250, +37251,37252,37254,37256,37258,37262,37263,37267,37268,37269,37270,37271,37272, +37273,37276,37277,37278,37279,37280,37281,37284,37285,37286,37287,37288,37289, +37291,37292,37296,37297,37298,37299,37302,37303,37304,37305,37307,37308,37309, +37310,37311,37312,37313,37314,37315,37316,37317,37318,37320,37323,37328,37330, +37331,37332,37333,37334,37335,37336,37337,37338,37339,37341,37342,37343,37344, +37345,37346,37347,37348,37349,24119,24132,24148,24155,24158,24161,23692,23674, +23693,23696,23702,23688,23704,23705,23697,23706,23708,23733,23714,23741,23724, +23723,23729,23715,23745,23735,23748,23762,23780,23755,23781,23810,23811,23847, +23846,23854,23844,23838,23814,23835,23896,23870,23860,23869,23916,23899,23919, +23901,23915,23883,23882,23913,23924,23938,23961,23965,35955,23991,24005,24435, +24439,24450,24455,24457,24460,24469,24473,24476,24488,24493,24501,24508,34914, +24417,29357,29360,29364,29367,29368,29379,29377,29390,29389,29394,29416,29423, +29417,29426,29428,29431,29441,29427,29443,29434,37350, +37351,37352,37353,37354,37355,37356,37357,37358,37359,37360,37361,37362,37363, +37364,37365,37366,37367,37368,37369,37370,37371,37372,37373,37374,37375,37376, +37377,37378,37379,37380,37381,37382,37383,37384,37385,37386,37387,37388,37389, +37390,37391,37392,37393,37394,37395,37396,37397,37398,37399,37400,37401,37402, +37403,37404,37405,37406,37407,37408,37409,37410,37411,37412,37413,37414,37415, +37416,37417,37418,37419,37420,37421,37422,37423,37424,37425,37426,37427,37428, +37429,37430,37431,37432,37433,37434,37435,37436,37437,37438,37439,37440,37441, +37442,37443,37444,37445,29435,29463,29459,29473,29450,29470,29469,29461,29474, +29497,29477,29484,29496,29489,29520,29517,29527,29536,29548,29551,29566,33307, +22821,39143,22820,22786,39267,39271,39272,39273,39274,39275,39276,39284,39287, +39293,39296,39300,39303,39306,39309,39312,39313,39315,39316,39317,24192,24209, +24203,24214,24229,24224,24249,24245,24254,24243,36179,24274,24273,24283,24296, +24298,33210,24516,24521,24534,24527,24579,24558,24580,24545,24548,24574,24581, +24582,24554,24557,24568,24601,24629,24614,24603,24591,24589,24617,24619,24586, +24639,24609,24696,24697,24699,24698,24642,37446,37447,37448,37449,37450,37451, +37452,37453,37454,37455,37456,37457,37458,37459,37460,37461,37462,37463,37464, +37465,37466,37467,37468,37469,37470,37471,37472,37473,37474,37475,37476,37477, +37478,37479,37480,37481,37482,37483,37484,37485,37486,37487,37488,37489,37490, +37491,37493,37494,37495,37496,37497,37498,37499,37500,37501,37502,37503,37504, +37505,37506,37507,37508,37509,37510,37511,37512,37513, +37514,37515,37516,37517,37519,37520,37521,37522,37523,37524,37525,37526,37527, +37528,37529,37530,37531,37532,37533,37534,37535,37536,37537,37538,37539,37540, +37541,37542,37543,24682,24701,24726,24730,24749,24733,24707,24722,24716,24731, +24812,24763,24753,24797,24792,24774,24794,24756,24864,24870,24853,24867,24820, +24832,24846,24875,24906,24949,25004,24980,24999,25015,25044,25077,24541,38579, +38377,38379,38385,38387,38389,38390,38396,38398,38403,38404,38406,38408,38410, +38411,38412,38413,38415,38418,38421,38422,38423,38425,38426,20012,29247,25109, +27701,27732,27740,27722,27811,27781,27792,27796,27788,27752,27753,27764,27766, +27782,27817,27856,27860,27821,27895,27896,27889,27863,27826,27872,27862,27898, +27883,27886,27825,27859,27887,27902,37544,37545,37546,37547,37548,37549,37551, +37552,37553,37554,37555,37556,37557,37558,37559,37560,37561,37562,37563,37564, +37565,37566,37567,37568,37569,37570,37571,37572,37573,37574,37575,37577,37578, +37579,37580,37581,37582,37583,37584,37585,37586,37587,37588,37589,37590,37591, +37592,37593,37594,37595,37596,37597,37598,37599,37600,37601,37602,37603,37604, +37605,37606,37607,37608,37609,37610,37611,37612,37613,37614,37615,37616,37617, +37618,37619,37620,37621,37622,37623,37624,37625,37626,37627,37628,37629,37630, +37631,37632,37633,37634,37635,37636,37637,37638,37639,37640,37641,27961,27943, +27916,27971,27976,27911,27908,27929,27918,27947,27981,27950,27957,27930,27983, +27986,27988,27955,28049,28015,28062,28064,27998,28051,28052,27996,28000,28028, +28003,28186,28103,28101,28126,28174,28095,28128,28177, +28134,28125,28121,28182,28075,28172,28078,28203,28270,28238,28267,28338,28255, +28294,28243,28244,28210,28197,28228,28383,28337,28312,28384,28461,28386,28325, +28327,28349,28347,28343,28375,28340,28367,28303,28354,28319,28514,28486,28487, +28452,28437,28409,28463,28470,28491,28532,28458,28425,28457,28553,28557,28556, +28536,28530,28540,28538,28625,37642,37643,37644,37645,37646,37647,37648,37649, +37650,37651,37652,37653,37654,37655,37656,37657,37658,37659,37660,37661,37662, +37663,37664,37665,37666,37667,37668,37669,37670,37671,37672,37673,37674,37675, +37676,37677,37678,37679,37680,37681,37682,37683,37684,37685,37686,37687,37688, +37689,37690,37691,37692,37693,37695,37696,37697,37698,37699,37700,37701,37702, +37703,37704,37705,37706,37707,37708,37709,37710,37711,37712,37713,37714,37715, +37716,37717,37718,37719,37720,37721,37722,37723,37724,37725,37726,37727,37728, +37729,37730,37731,37732,37733,37734,37735,37736,37737,37739,28617,28583,28601, +28598,28610,28641,28654,28638,28640,28655,28698,28707,28699,28729,28725,28751, +28766,23424,23428,23445,23443,23461,23480,29999,39582,25652,23524,23534,35120, +23536,36423,35591,36790,36819,36821,36837,36846,36836,36841,36838,36851,36840, +36869,36868,36875,36902,36881,36877,36886,36897,36917,36918,36909,36911,36932, +36945,36946,36944,36968,36952,36962,36955,26297,36980,36989,36994,37000,36995, +37003,24400,24407,24406,24408,23611,21675,23632,23641,23409,23651,23654,32700, +24362,24361,24365,33396,24380,39739,23662,22913,22915,22925,22953,22954,22947, +37740,37741,37742,37743,37744,37745,37746,37747,37748, +37749,37750,37751,37752,37753,37754,37755,37756,37757,37758,37759,37760,37761, +37762,37763,37764,37765,37766,37767,37768,37769,37770,37771,37772,37773,37774, +37776,37777,37778,37779,37780,37781,37782,37783,37784,37785,37786,37787,37788, +37789,37790,37791,37792,37793,37794,37795,37796,37797,37798,37799,37800,37801, +37802,37803,37804,37805,37806,37807,37808,37809,37810,37811,37812,37813,37814, +37815,37816,37817,37818,37819,37820,37821,37822,37823,37824,37825,37826,37827, +37828,37829,37830,37831,37832,37833,37835,37836,37837,22935,22986,22955,22942, +22948,22994,22962,22959,22999,22974,23045,23046,23005,23048,23011,23000,23033, +23052,23049,23090,23092,23057,23075,23059,23104,23143,23114,23125,23100,23138, +23157,33004,23210,23195,23159,23162,23230,23275,23218,23250,23252,23224,23264, +23267,23281,23254,23270,23256,23260,23305,23319,23318,23346,23351,23360,23573, +23580,23386,23397,23411,23377,23379,23394,39541,39543,39544,39546,39551,39549, +39552,39553,39557,39560,39562,39568,39570,39571,39574,39576,39579,39580,39581, +39583,39584,39586,39587,39589,39591,32415,32417,32419,32421,32424,32425,37838, +37839,37840,37841,37842,37843,37844,37845,37847,37848,37849,37850,37851,37852, +37853,37854,37855,37856,37857,37858,37859,37860,37861,37862,37863,37864,37865, +37866,37867,37868,37869,37870,37871,37872,37873,37874,37875,37876,37877,37878, +37879,37880,37881,37882,37883,37884,37885,37886,37887,37888,37889,37890,37891, +37892,37893,37894,37895,37896,37897,37898,37899,37900,37901,37902,37903,37904, +37905,37906,37907,37908,37909,37910,37911,37912,37913, +37914,37915,37916,37917,37918,37919,37920,37921,37922,37923,37924,37925,37926, +37927,37928,37929,37930,37931,37932,37933,37934,32429,32432,32446,32448,32449, +32450,32457,32459,32460,32464,32468,32471,32475,32480,32481,32488,32491,32494, +32495,32497,32498,32525,32502,32506,32507,32510,32513,32514,32515,32519,32520, +32523,32524,32527,32529,32530,32535,32537,32540,32539,32543,32545,32546,32547, +32548,32549,32550,32551,32554,32555,32556,32557,32559,32560,32561,32562,32563, +32565,24186,30079,24027,30014,37013,29582,29585,29614,29602,29599,29647,29634, +29649,29623,29619,29632,29641,29640,29669,29657,39036,29706,29673,29671,29662, +29626,29682,29711,29738,29787,29734,29733,29736,29744,29742,29740,37935,37936, +37937,37938,37939,37940,37941,37942,37943,37944,37945,37946,37947,37948,37949, +37951,37952,37953,37954,37955,37956,37957,37958,37959,37960,37961,37962,37963, +37964,37965,37966,37967,37968,37969,37970,37971,37972,37973,37974,37975,37976, +37977,37978,37979,37980,37981,37982,37983,37984,37985,37986,37987,37988,37989, +37990,37991,37992,37993,37994,37996,37997,37998,37999,38000,38001,38002,38003, +38004,38005,38006,38007,38008,38009,38010,38011,38012,38013,38014,38015,38016, +38017,38018,38019,38020,38033,38038,38040,38087,38095,38099,38100,38106,38118, +38139,38172,38176,29723,29722,29761,29788,29783,29781,29785,29815,29805,29822, +29852,29838,29824,29825,29831,29835,29854,29864,29865,29840,29863,29906,29882, +38890,38891,38892,26444,26451,26462,26440,26473,26533,26503,26474,26483,26520, +26535,26485,26536,26526,26541,26507,26487,26492,26608, +26633,26584,26634,26601,26544,26636,26585,26549,26586,26547,26589,26624,26563, +26552,26594,26638,26561,26621,26674,26675,26720,26721,26702,26722,26692,26724, +26755,26653,26709,26726,26689,26727,26688,26686,26698,26697,26665,26805,26767, +26740,26743,26771,26731,26818,26990,26876,26911,26912,26873,38183,38195,38205, +38211,38216,38219,38229,38234,38240,38254,38260,38261,38263,38264,38265,38266, +38267,38268,38269,38270,38272,38273,38274,38275,38276,38277,38278,38279,38280, +38281,38282,38283,38284,38285,38286,38287,38288,38289,38290,38291,38292,38293, +38294,38295,38296,38297,38298,38299,38300,38301,38302,38303,38304,38305,38306, +38307,38308,38309,38310,38311,38312,38313,38314,38315,38316,38317,38318,38319, +38320,38321,38322,38323,38324,38325,38326,38327,38328,38329,38330,38331,38332, +38333,38334,38335,38336,38337,38338,38339,38340,38341,38342,38343,38344,38345, +38346,38347,26916,26864,26891,26881,26967,26851,26896,26993,26937,26976,26946, +26973,27012,26987,27008,27032,27000,26932,27084,27015,27016,27086,27017,26982, +26979,27001,27035,27047,27067,27051,27053,27092,27057,27073,27082,27103,27029, +27104,27021,27135,27183,27117,27159,27160,27237,27122,27204,27198,27296,27216, +27227,27189,27278,27257,27197,27176,27224,27260,27281,27280,27305,27287,27307, +29495,29522,27521,27522,27527,27524,27538,27539,27533,27546,27547,27553,27562, +36715,36717,36721,36722,36723,36725,36726,36728,36727,36729,36730,36732,36734, +36737,36738,36740,36743,36747,38348,38349,38350,38351,38352,38353,38354,38355, +38356,38357,38358,38359,38360,38361,38362,38363,38364, +38365,38366,38367,38368,38369,38370,38371,38372,38373,38374,38375,38380,38399, +38407,38419,38424,38427,38430,38432,38435,38436,38437,38438,38439,38440,38441, +38443,38444,38445,38447,38448,38455,38456,38457,38458,38462,38465,38467,38474, +38478,38479,38481,38482,38483,38486,38487,38488,38489,38490,38492,38493,38494, +38496,38499,38501,38502,38507,38509,38510,38511,38512,38513,38515,38520,38521, +38522,38523,38524,38525,38526,38527,38528,38529,38530,38531,38532,38535,38537, +38538,36749,36750,36751,36760,36762,36558,25099,25111,25115,25119,25122,25121, +25125,25124,25132,33255,29935,29940,29951,29967,29969,29971,25908,26094,26095, +26096,26122,26137,26482,26115,26133,26112,28805,26359,26141,26164,26161,26166, +26165,32774,26207,26196,26177,26191,26198,26209,26199,26231,26244,26252,26279, +26269,26302,26331,26332,26342,26345,36146,36147,36150,36155,36157,36160,36165, +36166,36168,36169,36167,36173,36181,36185,35271,35274,35275,35276,35278,35279, +35280,35281,29294,29343,29277,29286,29295,29310,29311,29316,29323,29325,29327, +29330,25352,25394,25520,38540,38542,38545,38546,38547,38549,38550,38554,38555, +38557,38558,38559,38560,38561,38562,38563,38564,38565,38566,38568,38569,38570, +38571,38572,38573,38574,38575,38577,38578,38580,38581,38583,38584,38586,38587, +38591,38594,38595,38600,38602,38603,38608,38609,38611,38612,38614,38615,38616, +38617,38618,38619,38620,38621,38622,38623,38625,38626,38627,38628,38629,38630, +38631,38635,38636,38637,38638,38640,38641,38642,38644,38645,38648,38650,38651, +38652,38653,38655,38658,38659,38661,38666,38667,38668, +38672,38673,38674,38676,38677,38679,38680,38681,38682,38683,38685,38687,38688, +25663,25816,32772,27626,27635,27645,27637,27641,27653,27655,27654,27661,27669, +27672,27673,27674,27681,27689,27684,27690,27698,25909,25941,25963,29261,29266, +29270,29232,34402,21014,32927,32924,32915,32956,26378,32957,32945,32939,32941, +32948,32951,32999,33000,33001,33002,32987,32962,32964,32985,32973,32983,26384, +32989,33003,33009,33012,33005,33037,33038,33010,33020,26389,33042,35930,33078, +33054,33068,33048,33074,33096,33100,33107,33140,33113,33114,33137,33120,33129, +33148,33149,33133,33127,22605,23221,33160,33154,33169,28373,33187,33194,33228, +26406,33226,33211,38689,38690,38691,38692,38693,38694,38695,38696,38697,38699, +38700,38702,38703,38705,38707,38708,38709,38710,38711,38714,38715,38716,38717, +38719,38720,38721,38722,38723,38724,38725,38726,38727,38728,38729,38730,38731, +38732,38733,38734,38735,38736,38737,38740,38741,38743,38744,38746,38748,38749, +38751,38755,38756,38758,38759,38760,38762,38763,38764,38765,38766,38767,38768, +38769,38770,38773,38775,38776,38777,38778,38779,38781,38782,38783,38784,38785, +38786,38787,38788,38790,38791,38792,38793,38794,38796,38798,38799,38800,38803, +38805,38806,38807,38809,38810,38811,38812,38813,33217,33190,27428,27447,27449, +27459,27462,27481,39121,39122,39123,39125,39129,39130,27571,24384,27586,35315, +26000,40785,26003,26044,26054,26052,26051,26060,26062,26066,26070,28800,28828, +28822,28829,28859,28864,28855,28843,28849,28904,28874,28944,28947,28950,28975, +28977,29043,29020,29032,28997,29042,29002,29048,29050, +29080,29107,29109,29096,29088,29152,29140,29159,29177,29213,29224,28780,28952, +29030,29113,25150,25149,25155,25160,25161,31035,31040,31046,31049,31067,31068, +31059,31066,31074,31063,31072,31087,31079,31098,31109,31114,31130,31143,31155, +24529,24528,38814,38815,38817,38818,38820,38821,38822,38823,38824,38825,38826, +38828,38830,38832,38833,38835,38837,38838,38839,38840,38841,38842,38843,38844, +38845,38846,38847,38848,38849,38850,38851,38852,38853,38854,38855,38856,38857, +38858,38859,38860,38861,38862,38863,38864,38865,38866,38867,38868,38869,38870, +38871,38872,38873,38874,38875,38876,38877,38878,38879,38880,38881,38882,38883, +38884,38885,38888,38894,38895,38896,38897,38898,38900,38903,38904,38905,38906, +38907,38908,38909,38910,38911,38912,38913,38914,38915,38916,38917,38918,38919, +38920,38921,38922,38923,38924,38925,38926,24636,24669,24666,24679,24641,24665, +24675,24747,24838,24845,24925,25001,24989,25035,25041,25094,32896,32895,27795, +27894,28156,30710,30712,30720,30729,30743,30744,30737,26027,30765,30748,30749, +30777,30778,30779,30751,30780,30757,30764,30755,30761,30798,30829,30806,30807, +30758,30800,30791,30796,30826,30875,30867,30874,30855,30876,30881,30883,30898, +30905,30885,30932,30937,30921,30956,30962,30981,30964,30995,31012,31006,31028, +40859,40697,40699,40700,30449,30468,30477,30457,30471,30472,30490,30498,30489, +30509,30502,30517,30520,30544,30545,30535,30531,30554,30568,38927,38928,38929, +38930,38931,38932,38933,38934,38935,38936,38937,38938,38939,38940,38941,38942, +38943,38944,38945,38946,38947,38948,38949,38950,38951, +38952,38953,38954,38955,38956,38957,38958,38959,38960,38961,38962,38963,38964, +38965,38966,38967,38968,38969,38970,38971,38972,38973,38974,38975,38976,38977, +38978,38979,38980,38981,38982,38983,38984,38985,38986,38987,38988,38989,38990, +38991,38992,38993,38994,38995,38996,38997,38998,38999,39000,39001,39002,39003, +39004,39005,39006,39007,39008,39009,39010,39011,39012,39013,39014,39015,39016, +39017,39018,39019,39020,39021,39022,30562,30565,30591,30605,30589,30592,30604, +30609,30623,30624,30640,30645,30653,30010,30016,30030,30027,30024,30043,30066, +30073,30083,32600,32609,32607,35400,32616,32628,32625,32633,32641,32638,30413, +30437,34866,38021,38022,38023,38027,38026,38028,38029,38031,38032,38036,38039, +38037,38042,38043,38044,38051,38052,38059,38058,38061,38060,38063,38064,38066, +38068,38070,38071,38072,38073,38074,38076,38077,38079,38084,38088,38089,38090, +38091,38092,38093,38094,38096,38097,38098,38101,38102,38103,38105,38104,38107, +38110,38111,38112,38114,38116,38117,38119,38120,38122,39023,39024,39025,39026, +39027,39028,39051,39054,39058,39061,39065,39075,39080,39081,39082,39083,39084, +39085,39086,39087,39088,39089,39090,39091,39092,39093,39094,39095,39096,39097, +39098,39099,39100,39101,39102,39103,39104,39105,39106,39107,39108,39109,39110, +39111,39112,39113,39114,39115,39116,39117,39119,39120,39124,39126,39127,39131, +39132,39133,39136,39137,39138,39139,39140,39141,39142,39145,39146,39147,39148, +39149,39150,39151,39152,39153,39154,39155,39156,39157,39158,39159,39160,39161, +39162,39163,39164,39165,39166,39167,39168,39169,39170, +39171,39172,39173,39174,39175,38121,38123,38126,38127,38131,38132,38133,38135, +38137,38140,38141,38143,38147,38146,38150,38151,38153,38154,38157,38158,38159, +38162,38163,38164,38165,38166,38168,38171,38173,38174,38175,38178,38186,38187, +38185,38188,38193,38194,38196,38198,38199,38200,38204,38206,38207,38210,38197, +38212,38213,38214,38217,38220,38222,38223,38226,38227,38228,38230,38231,38232, +38233,38235,38238,38239,38237,38241,38242,38244,38245,38246,38247,38248,38249, +38250,38251,38252,38255,38257,38258,38259,38202,30695,30700,38601,31189,31213, +31203,31211,31238,23879,31235,31234,31262,31252,39176,39177,39178,39179,39180, +39182,39183,39185,39186,39187,39188,39189,39190,39191,39192,39193,39194,39195, +39196,39197,39198,39199,39200,39201,39202,39203,39204,39205,39206,39207,39208, +39209,39210,39211,39212,39213,39215,39216,39217,39218,39219,39220,39221,39222, +39223,39224,39225,39226,39227,39228,39229,39230,39231,39232,39233,39234,39235, +39236,39237,39238,39239,39240,39241,39242,39243,39244,39245,39246,39247,39248, +39249,39250,39251,39254,39255,39256,39257,39258,39259,39260,39261,39262,39263, +39264,39265,39266,39268,39270,39283,39288,39289,39291,39294,39298,39299,39305, +31289,31287,31313,40655,39333,31344,30344,30350,30355,30361,30372,29918,29920, +29996,40480,40482,40488,40489,40490,40491,40492,40498,40497,40502,40504,40503, +40505,40506,40510,40513,40514,40516,40518,40519,40520,40521,40523,40524,40526, +40529,40533,40535,40538,40539,40540,40542,40547,40550,40551,40552,40553,40554, +40555,40556,40561,40557,40563,30098,30100,30102,30112, +30109,30124,30115,30131,30132,30136,30148,30129,30128,30147,30146,30166,30157, +30179,30184,30182,30180,30187,30183,30211,30193,30204,30207,30224,30208,30213, +30220,30231,30218,30245,30232,30229,30233,39308,39310,39322,39323,39324,39325, +39326,39327,39328,39329,39330,39331,39332,39334,39335,39337,39338,39339,39340, +39341,39342,39343,39344,39345,39346,39347,39348,39349,39350,39351,39352,39353, +39354,39355,39356,39357,39358,39359,39360,39361,39362,39363,39364,39365,39366, +39367,39368,39369,39370,39371,39372,39373,39374,39375,39376,39377,39378,39379, +39380,39381,39382,39383,39384,39385,39386,39387,39388,39389,39390,39391,39392, +39393,39394,39395,39396,39397,39398,39399,39400,39401,39402,39403,39404,39405, +39406,39407,39408,39409,39410,39411,39412,39413,39414,39415,39416,39417,30235, +30268,30242,30240,30272,30253,30256,30271,30261,30275,30270,30259,30285,30302, +30292,30300,30294,30315,30319,32714,31462,31352,31353,31360,31366,31368,31381, +31398,31392,31404,31400,31405,31411,34916,34921,34930,34941,34943,34946,34978, +35014,34999,35004,35017,35042,35022,35043,35045,35057,35098,35068,35048,35070, +35056,35105,35097,35091,35099,35082,35124,35115,35126,35137,35174,35195,30091, +32997,30386,30388,30684,32786,32788,32790,32796,32800,32802,32805,32806,32807, +32809,32808,32817,32779,32821,32835,32838,32845,32850,32873,32881,35203,39032, +39040,39043,39418,39419,39420,39421,39422,39423,39424,39425,39426,39427,39428, +39429,39430,39431,39432,39433,39434,39435,39436,39437,39438,39439,39440,39441, +39442,39443,39444,39445,39446,39447,39448,39449,39450, +39451,39452,39453,39454,39455,39456,39457,39458,39459,39460,39461,39462,39463, +39464,39465,39466,39467,39468,39469,39470,39471,39472,39473,39474,39475,39476, +39477,39478,39479,39480,39481,39482,39483,39484,39485,39486,39487,39488,39489, +39490,39491,39492,39493,39494,39495,39496,39497,39498,39499,39500,39501,39502, +39503,39504,39505,39506,39507,39508,39509,39510,39511,39512,39513,39049,39052, +39053,39055,39060,39066,39067,39070,39071,39073,39074,39077,39078,34381,34388, +34412,34414,34431,34426,34428,34427,34472,34445,34443,34476,34461,34471,34467, +34474,34451,34473,34486,34500,34485,34510,34480,34490,34481,34479,34505,34511, +34484,34537,34545,34546,34541,34547,34512,34579,34526,34548,34527,34520,34513, +34563,34567,34552,34568,34570,34573,34569,34595,34619,34590,34597,34606,34586, +34622,34632,34612,34609,34601,34615,34623,34690,34594,34685,34686,34683,34656, +34672,34636,34670,34699,34643,34659,34684,34660,34649,34661,34707,34735,34728, +34770,39514,39515,39516,39517,39518,39519,39520,39521,39522,39523,39524,39525, +39526,39527,39528,39529,39530,39531,39538,39555,39561,39565,39566,39572,39573, +39577,39590,39593,39594,39595,39596,39597,39598,39599,39602,39603,39604,39605, +39609,39611,39613,39614,39615,39619,39620,39622,39623,39624,39625,39626,39629, +39630,39631,39632,39634,39636,39637,39638,39639,39641,39642,39643,39644,39645, +39646,39648,39650,39651,39652,39653,39655,39656,39657,39658,39660,39662,39664, +39665,39666,39667,39668,39669,39670,39671,39672,39674,39676,39677,39678,39679, +39680,39681,39682,39684,39685,39686,34758,34696,34693, +34733,34711,34691,34731,34789,34732,34741,34739,34763,34771,34749,34769,34752, +34762,34779,34794,34784,34798,34838,34835,34814,34826,34843,34849,34873,34876, +32566,32578,32580,32581,33296,31482,31485,31496,31491,31492,31509,31498,31531, +31503,31559,31544,31530,31513,31534,31537,31520,31525,31524,31539,31550,31518, +31576,31578,31557,31605,31564,31581,31584,31598,31611,31586,31602,31601,31632, +31654,31655,31672,31660,31645,31656,31621,31658,31644,31650,31659,31668,31697, +31681,31692,31709,31706,31717,31718,31722,31756,31742,31740,31759,31766,31755, +39687,39689,39690,39691,39692,39693,39694,39696,39697,39698,39700,39701,39702, +39703,39704,39705,39706,39707,39708,39709,39710,39712,39713,39714,39716,39717, +39718,39719,39720,39721,39722,39723,39724,39725,39726,39728,39729,39731,39732, +39733,39734,39735,39736,39737,39738,39741,39742,39743,39744,39750,39754,39755, +39756,39758,39760,39762,39763,39765,39766,39767,39768,39769,39770,39771,39772, +39773,39774,39775,39776,39777,39778,39779,39780,39781,39782,39783,39784,39785, +39786,39787,39788,39789,39790,39791,39792,39793,39794,39795,39796,39797,39798, +39799,39800,39801,39802,39803,31775,31786,31782,31800,31809,31808,33278,33281, +33282,33284,33260,34884,33313,33314,33315,33325,33327,33320,33323,33336,33339, +33331,33332,33342,33348,33353,33355,33359,33370,33375,33384,34942,34949,34952, +35032,35039,35166,32669,32671,32679,32687,32688,32690,31868,25929,31889,31901, +31900,31902,31906,31922,31932,31933,31937,31943,31948,31949,31944,31941,31959, +31976,33390,26280,32703,32718,32725,32741,32737,32742, +32745,32750,32755,31992,32119,32166,32174,32327,32411,40632,40628,36211,36228, +36244,36241,36273,36199,36205,35911,35913,37194,37200,37198,37199,37220,39804, +39805,39806,39807,39808,39809,39810,39811,39812,39813,39814,39815,39816,39817, +39818,39819,39820,39821,39822,39823,39824,39825,39826,39827,39828,39829,39830, +39831,39832,39833,39834,39835,39836,39837,39838,39839,39840,39841,39842,39843, +39844,39845,39846,39847,39848,39849,39850,39851,39852,39853,39854,39855,39856, +39857,39858,39859,39860,39861,39862,39863,39864,39865,39866,39867,39868,39869, +39870,39871,39872,39873,39874,39875,39876,39877,39878,39879,39880,39881,39882, +39883,39884,39885,39886,39887,39888,39889,39890,39891,39892,39893,39894,39895, +39896,39897,39898,39899,37218,37217,37232,37225,37231,37245,37246,37234,37236, +37241,37260,37253,37264,37261,37265,37282,37283,37290,37293,37294,37295,37301, +37300,37306,35925,40574,36280,36331,36357,36441,36457,36277,36287,36284,36282, +36292,36310,36311,36314,36318,36302,36303,36315,36294,36332,36343,36344,36323, +36345,36347,36324,36361,36349,36372,36381,36383,36396,36398,36387,36399,36410, +36416,36409,36405,36413,36401,36425,36417,36418,36433,36434,36426,36464,36470, +36476,36463,36468,36485,36495,36500,36496,36508,36510,35960,35970,35978,35973, +35992,35988,26011,35286,35294,35290,35292,39900,39901,39902,39903,39904,39905, +39906,39907,39908,39909,39910,39911,39912,39913,39914,39915,39916,39917,39918, +39919,39920,39921,39922,39923,39924,39925,39926,39927,39928,39929,39930,39931, +39932,39933,39934,39935,39936,39937,39938,39939,39940, +39941,39942,39943,39944,39945,39946,39947,39948,39949,39950,39951,39952,39953, +39954,39955,39956,39957,39958,39959,39960,39961,39962,39963,39964,39965,39966, +39967,39968,39969,39970,39971,39972,39973,39974,39975,39976,39977,39978,39979, +39980,39981,39982,39983,39984,39985,39986,39987,39988,39989,39990,39991,39992, +39993,39994,39995,35301,35307,35311,35390,35622,38739,38633,38643,38639,38662, +38657,38664,38671,38670,38698,38701,38704,38718,40832,40835,40837,40838,40839, +40840,40841,40842,40844,40702,40715,40717,38585,38588,38589,38606,38610,30655, +38624,37518,37550,37576,37694,37738,37834,37775,37950,37995,40063,40066,40069, +40070,40071,40072,31267,40075,40078,40080,40081,40082,40084,40085,40090,40091, +40094,40095,40096,40097,40098,40099,40101,40102,40103,40104,40105,40107,40109, +40110,40112,40113,40114,40115,40116,40117,40118,40119,40122,40123,40124,40125, +40132,40133,40134,40135,40138,40139,39996,39997,39998,39999,40000,40001,40002, +40003,40004,40005,40006,40007,40008,40009,40010,40011,40012,40013,40014,40015, +40016,40017,40018,40019,40020,40021,40022,40023,40024,40025,40026,40027,40028, +40029,40030,40031,40032,40033,40034,40035,40036,40037,40038,40039,40040,40041, +40042,40043,40044,40045,40046,40047,40048,40049,40050,40051,40052,40053,40054, +40055,40056,40057,40058,40059,40061,40062,40064,40067,40068,40073,40074,40076, +40079,40083,40086,40087,40088,40089,40093,40106,40108,40111,40121,40126,40127, +40128,40129,40130,40136,40137,40145,40146,40154,40155,40160,40161,40140,40141, +40142,40143,40144,40147,40148,40149,40151,40152,40153, +40156,40157,40159,40162,38780,38789,38801,38802,38804,38831,38827,38819,38834, +38836,39601,39600,39607,40536,39606,39610,39612,39617,39616,39621,39618,39627, +39628,39633,39749,39747,39751,39753,39752,39757,39761,39144,39181,39214,39253, +39252,39647,39649,39654,39663,39659,39675,39661,39673,39688,39695,39699,39711, +39715,40637,40638,32315,40578,40583,40584,40587,40594,37846,40605,40607,40667, +40668,40669,40672,40671,40674,40681,40679,40677,40682,40687,40738,40748,40751, +40761,40759,40765,40766,40772,40163,40164,40165,40166,40167,40168,40169,40170, +40171,40172,40173,40174,40175,40176,40177,40178,40179,40180,40181,40182,40183, +40184,40185,40186,40187,40188,40189,40190,40191,40192,40193,40194,40195,40196, +40197,40198,40199,40200,40201,40202,40203,40204,40205,40206,40207,40208,40209, +40210,40211,40212,40213,40214,40215,40216,40217,40218,40219,40220,40221,40222, +40223,40224,40225,40226,40227,40228,40229,40230,40231,40232,40233,40234,40235, +40236,40237,40238,40239,40240,40241,40242,40243,40244,40245,40246,40247,40248, +40249,40250,40251,40252,40253,40254,40255,40256,40257,40258,57908,57909,57910, +57911,57912,57913,57914,57915,57916,57917,57918,57919,57920,57921,57922,57923, +57924,57925,57926,57927,57928,57929,57930,57931,57932,57933,57934,57935,57936, +57937,57938,57939,57940,57941,57942,57943,57944,57945,57946,57947,57948,57949, +57950,57951,57952,57953,57954,57955,57956,57957,57958,57959,57960,57961,57962, +57963,57964,57965,57966,57967,57968,57969,57970,57971,57972,57973,57974,57975, +57976,57977,57978,57979,57980,57981,57982,57983,57984, +57985,57986,57987,57988,57989,57990,57991,57992,57993,57994,57995,57996,57997, +57998,57999,58000,58001,40259,40260,40261,40262,40263,40264,40265,40266,40267, +40268,40269,40270,40271,40272,40273,40274,40275,40276,40277,40278,40279,40280, +40281,40282,40283,40284,40285,40286,40287,40288,40289,40290,40291,40292,40293, +40294,40295,40296,40297,40298,40299,40300,40301,40302,40303,40304,40305,40306, +40307,40308,40309,40310,40311,40312,40313,40314,40315,40316,40317,40318,40319, +40320,40321,40322,40323,40324,40325,40326,40327,40328,40329,40330,40331,40332, +40333,40334,40335,40336,40337,40338,40339,40340,40341,40342,40343,40344,40345, +40346,40347,40348,40349,40350,40351,40352,40353,40354,58002,58003,58004,58005, +58006,58007,58008,58009,58010,58011,58012,58013,58014,58015,58016,58017,58018, +58019,58020,58021,58022,58023,58024,58025,58026,58027,58028,58029,58030,58031, +58032,58033,58034,58035,58036,58037,58038,58039,58040,58041,58042,58043,58044, +58045,58046,58047,58048,58049,58050,58051,58052,58053,58054,58055,58056,58057, +58058,58059,58060,58061,58062,58063,58064,58065,58066,58067,58068,58069,58070, +58071,58072,58073,58074,58075,58076,58077,58078,58079,58080,58081,58082,58083, +58084,58085,58086,58087,58088,58089,58090,58091,58092,58093,58094,58095,40355, +40356,40357,40358,40359,40360,40361,40362,40363,40364,40365,40366,40367,40368, +40369,40370,40371,40372,40373,40374,40375,40376,40377,40378,40379,40380,40381, +40382,40383,40384,40385,40386,40387,40388,40389,40390,40391,40392,40393,40394, +40395,40396,40397,40398,40399,40400,40401,40402,40403, +40404,40405,40406,40407,40408,40409,40410,40411,40412,40413,40414,40415,40416, +40417,40418,40419,40420,40421,40422,40423,40424,40425,40426,40427,40428,40429, +40430,40431,40432,40433,40434,40435,40436,40437,40438,40439,40440,40441,40442, +40443,40444,40445,40446,40447,40448,40449,40450,58096,58097,58098,58099,58100, +58101,58102,58103,58104,58105,58106,58107,58108,58109,58110,58111,58112,58113, +58114,58115,58116,58117,58118,58119,58120,58121,58122,58123,58124,58125,58126, +58127,58128,58129,58130,58131,58132,58133,58134,58135,58136,58137,58138,58139, +58140,58141,58142,58143,58144,58145,58146,58147,58148,58149,58150,58151,58152, +58153,58154,58155,58156,58157,58158,58159,58160,58161,58162,58163,58164,58165, +58166,58167,58168,58169,58170,58171,58172,58173,58174,58175,58176,58177,58178, +58179,58180,58181,58182,58183,58184,58185,58186,58187,58188,58189,40451,40452, +40453,40454,40455,40456,40457,40458,40459,40460,40461,40462,40463,40464,40465, +40466,40467,40468,40469,40470,40471,40472,40473,40474,40475,40476,40477,40478, +40484,40487,40494,40496,40500,40507,40508,40512,40525,40528,40530,40531,40532, +40534,40537,40541,40543,40544,40545,40546,40549,40558,40559,40562,40564,40565, +40566,40567,40568,40569,40570,40571,40572,40573,40576,40577,40579,40580,40581, +40582,40585,40586,40588,40589,40590,40591,40592,40593,40596,40597,40598,40599, +40600,40601,40602,40603,40604,40606,40608,40609,40610,40611,40612,40613,40615, +40616,40617,40618,58190,58191,58192,58193,58194,58195,58196,58197,58198,58199, +58200,58201,58202,58203,58204,58205,58206,58207,58208, +58209,58210,58211,58212,58213,58214,58215,58216,58217,58218,58219,58220,58221, +58222,58223,58224,58225,58226,58227,58228,58229,58230,58231,58232,58233,58234, +58235,58236,58237,58238,58239,58240,58241,58242,58243,58244,58245,58246,58247, +58248,58249,58250,58251,58252,58253,58254,58255,58256,58257,58258,58259,58260, +58261,58262,58263,58264,58265,58266,58267,58268,58269,58270,58271,58272,58273, +58274,58275,58276,58277,58278,58279,58280,58281,58282,58283,40619,40620,40621, +40622,40623,40624,40625,40626,40627,40629,40630,40631,40633,40634,40636,40639, +40640,40641,40642,40643,40645,40646,40647,40648,40650,40651,40652,40656,40658, +40659,40661,40662,40663,40665,40666,40670,40673,40675,40676,40678,40680,40683, +40684,40685,40686,40688,40689,40690,40691,40692,40693,40694,40695,40696,40698, +40701,40703,40704,40705,40706,40707,40708,40709,40710,40711,40712,40713,40714, +40716,40719,40721,40722,40724,40725,40726,40728,40730,40731,40732,40733,40734, +40735,40737,40739,40740,40741,40742,40743,40744,40745,40746,40747,40749,40750, +40752,40753,58284,58285,58286,58287,58288,58289,58290,58291,58292,58293,58294, +58295,58296,58297,58298,58299,58300,58301,58302,58303,58304,58305,58306,58307, +58308,58309,58310,58311,58312,58313,58314,58315,58316,58317,58318,58319,58320, +58321,58322,58323,58324,58325,58326,58327,58328,58329,58330,58331,58332,58333, +58334,58335,58336,58337,58338,58339,58340,58341,58342,58343,58344,58345,58346, +58347,58348,58349,58350,58351,58352,58353,58354,58355,58356,58357,58358,58359, +58360,58361,58362,58363,58364,58365,58366,58367,58368, +58369,58370,58371,58372,58373,58374,58375,58376,58377,40754,40755,40756,40757, +40758,40760,40762,40764,40767,40768,40769,40770,40771,40773,40774,40775,40776, +40777,40778,40779,40780,40781,40782,40783,40786,40787,40788,40789,40790,40791, +40792,40793,40794,40795,40796,40797,40798,40799,40800,40801,40802,40803,40804, +40805,40806,40807,40808,40809,40810,40811,40812,40813,40814,40815,40816,40817, +40818,40819,40820,40821,40822,40823,40824,40825,40826,40827,40828,40829,40830, +40833,40834,40845,40846,40847,40848,40849,40850,40851,40852,40853,40854,40855, +40856,40860,40861,40862,40865,40866,40867,40868,40869,63788,63865,63893,63975, +63985,58378,58379,58380,58381,58382,58383,58384,58385,58386,58387,58388,58389, +58390,58391,58392,58393,58394,58395,58396,58397,58398,58399,58400,58401,58402, +58403,58404,58405,58406,58407,58408,58409,58410,58411,58412,58413,58414,58415, +58416,58417,58418,58419,58420,58421,58422,58423,58424,58425,58426,58427,58428, +58429,58430,58431,58432,58433,58434,58435,58436,58437,58438,58439,58440,58441, +58442,58443,58444,58445,58446,58447,58448,58449,58450,58451,58452,58453,58454, +58455,58456,58457,58458,58459,58460,58461,58462,58463,58464,58465,58466,58467, +58468,58469,58470,58471,64012,64013,64014,64015,64017,64019,64020,64024,64031, +64032,64033,64035,64036,64039,64040,64041,11905,59414,59415,59416,11908,13427, +13383,11912,11915,59422,13726,13850,13838,11916,11927,14702,14616,59430,14799, +14815,14963,14800,59435,59436,15182,15470,15584,11943,59441,59442,11946,16470, +16735,11950,17207,11955,11958,11959,59451,17329,17324, +11963,17373,17622,18017,17996,59459,18211,18217,18300,18317,11978,18759,18810, +18813,18818,18819,18821,18822,18847,18843,18871,18870,59476,59477,19619,19615, +19616,19617,19575,19618,19731,19732,19733,19734,19735,19736,19737,19886,59492, +58472,58473,58474,58475,58476,58477,58478,58479,58480,58481,58482,58483,58484, +58485,58486,58487,58488,58489,58490,58491,58492,58493,58494,58495,58496,58497, +58498,58499,58500,58501,58502,58503,58504,58505,58506,58507,58508,58509,58510, +58511,58512,58513,58514,58515,58516,58517,58518,58519,58520,58521,58522,58523, +58524,58525,58526,58527,58528,58529,58530,58531,58532,58533,58534,58535,58536, +58537,58538,58539,58540,58541,58542,58543,58544,58545,58546,58547,58548,58549, +58550,58551,58552,58553,58554,58555,58556,58557,58558,58559,58560,58561,58562, +58563,58564,58565, diff --git a/Ubiquitous/XiZi/lib/musllib/src/locale/hkscs.h b/Ubiquitous/XiZi/lib/musllib/src/locale/hkscs.h new file mode 100644 index 000000000..d3565174d --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/locale/hkscs.h @@ -0,0 +1,390 @@ +17392,19506,17923,17830,17784,29287,19831,17843,31921,19682,31941,15253,18230, +18244,19527,19520,17087,13847,29522,28299,28882,19543,41809,18255,17882,19589, +31852,19719,19108,18081,27427,29221,23124,6755,15878,16225,26189,22267,0, +32149,22813,35769,15860,38708,31727,23515,7518,23204,13861,40624,23249,23479, +23804,26478,34195,39237,29793,29853,14453,7507,13982,24609,16108,22750,15093, +31484,40855,16737,35085,12778,2698,12894,17162,33924,40854,37935,18736,34323, +22678,38730,37400,31184,31282,26208,27177,34973,29772,31685,26498,31276,21071, +36934,13542,29636,23993,29894,40903,22451,18735,21580,16689,13966,22552,31346, +31589,35727,18094,28296,16769,23961,31662,9404,40904,9409,9417,9420,40905, +34052,13755,16564,40906,17633,44543,25281,28782,40907,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12736,12737,12738,12739,12740,268,12741, +209,205,12742,12743,203,8168,12744,202,12745,12746,12747,12748,270,12749, +12750,256,193,461,192,274,201,282,200,332,211,465,210,56320,7870,56324,7872, +202,257,225,462,224,593,275,233,283,232,299,237,464,236,333,243,466,242,363, +250,468,249,470,472,474,476,252,56328,7871,56332,7873,234,609,9178,9179,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,41897,4421,0,25866,0,0,20029,28381, +40270,37343,0,0,30517,25745,20250,20264,20392,20822,20852,20892,20964,21153, +21160,21307,21326,21457,21464,22242,22768,22788,22791,22834,22836,23398,23454, +23455,23706,24198,24635,25993,26622,26628,26725,27982,28860,30005,32420,32428, +32442,32455,32463,32479,32518,32567,33402,33487,33647,35270,35774,35810,36710, +36711,36718,29713,31996,32205,26950,31433,21031,0,0,0,0,37260,30904,37214, +32956,0,36107,33014,2535,0,0,32927,40647,19661,40393,40460,19518,40438,28686, +40458,41267,13761,0,28314,33342,29977,0,18705,39532,39567,40857,31111,33900, +7626,1488,10982,20004,20097,20096,20103,20159,20203,20279,13388,20413,15944, +20483,20616,13437,13459,13477,20870,22789,20955,20988,20997,20105,21113,21136, +21287,13767,21417,13649,21424,13651,21442,21539,13677,13682,13953,21651,21667, +21684,21689,21712,21743,21784,21795,21800,13720,21823,13733,13759,21975,13765, +32132,21797,0,3138,3349,20779,21904,11462,14828,833,36422,19896,38117,16467, +32958,30586,11320,14900,18389,33117,27122,19946,25821,3452,4020,3285,4340, +25741,36478,3734,3083,3940,11433,33366,17619,0,3398,39501,33001,18420, +20135,11458,39602,14951,38388,16365,13574,21191,38868,30920,11588,40302,38933, +0,17369,24741,25780,21731,11596,11210,4215,14843,4207,26330,26390,31136,25834, +20562,3139,36456,8609,35660,1841,0,18443,425,16378,22643,11661,0,17864,1276, +24727,3916,3478,21881,16571,17338,0,19124,10854,4253,33194,39157,3484,25465, +14846,10101,36288,22177,25724,15939,0,42497,3593,10959,11465,0,4296,14786, +14738,14854,33435,13688,24137,8391,22098,3889,11442,38688,13500,27709,20027,0, +0,30068,11915,8712,42587,36045,3706,3124,26652,32659,4303,10243,10553,13819, +20963,3724,3981,3754,16275,3888,3399,4431,3660,0,3755,2985,3400,4288,4413, +16377,9878,25650,4013,13300,30265,11214,3454,3455,11345,11349,14872,3736,4295, +3886,42546,27472,36050,36249,36042,38314,21708,33476,21945,0,40643,39974, +39606,30558,11758,28992,33133,33004,23580,25970,33076,14231,21343,32957,37302, +3834,3599,3703,3835,13789,19947,13833,3286,22191,10165,4297,3600,3704,4216, +4424,33287,5205,3705,20048,11684,23124,4125,4126,4341,4342,22428,3601,30356, +33485,4021,3707,20862,14083,4022,4480,21208,41661,18906,6202,16759,33404, +22681,21096,13850,22333,31666,23400,18432,19244,40743,18919,39967,39821,23412, +12605,22011,13810,22153,20008,22786,7105,63608,38737,134,20059,20155,13630, +23587,24401,24516,14586,25164,25909,27514,27701,27706,28780,29227,20012,29357, +18665,32594,31035,31993,32595,25194,13505,0,25419,32770,32896,26130,26961, +21341,34916,35265,30898,35744,36125,38021,38264,38271,38376, +36367,38886,39029,39118,39134,39267,38928,40060,40479,40644,27503,63751,20023, +135,38429,25143,38050,0,20539,28158,40051,40870,15817,34959,16718,28791,23797, +19232,20941,13657,23856,24866,35378,36775,37366,29073,26393,29626,12929,41223, +15499,6528,19216,30948,29698,20910,34575,16393,27235,41658,16931,34319,2671, +31274,39239,35562,38741,28749,21284,8318,37876,30425,35299,40871,30685,20131, +20464,20668,20015,20247,40872,21556,32139,22674,22736,7606,24210,24217,24514, +10002,25995,13305,26905,27203,15459,27903,0,29184,17669,29580,16091,18963, +23317,29881,35715,23716,22165,31379,31724,31939,32364,33528,34199,40873,34960, +40874,36537,40875,36815,34143,39392,37409,40876,36281,5183,16497,17058,23066, +0,0,0,39016,26475,17014,22333,0,34262,18811,33471,28941,19585,28020,23931, +27413,28606,40877,40878,23446,40879,26343,32347,28247,31178,15752,17603,12886, +10134,17306,17718,0,23765,15130,35577,23672,15634,13649,23928,40882,29015, +17752,16620,7715,19575,14712,13386,420,27713,35532,20404,569,22975,33132, +38998,39162,24379,2975,0,8641,35181,16642,18107,36985,16135,40883,41397,16632, +14294,18167,27718,16764,34482,29695,17773,14548,21658,17761,17691,19849,19579, +19830,17898,16328,19215,13921,17630,17597,16877,23870,23880,23894,15868,14351, +23972,23993,14368,14392,24130,24253,24357,24451,14600,14612,14655,14669,24791, +24893,23781,14729,25015,25017,25039,14776,25132,25232,25317,25368,14840,22193, +14851,25570,25595,25607,25690,14923,25792,23829,22049,40863,14999,25990,15037, +26111,26195,15090,26258,15138, +26390,15170,26532,26624,15192,26698,26756,15218,15217,15227,26889,26947,29276, +26980,27039,27013,15292,27094,15325,27237,27252,27249,27266,15340,27289,15346, +27307,27317,27348,27382,27521,27585,27626,27765,27818,15563,27906,27910,27942, +28033,15599,28068,28081,28181,28184,28201,28294,35264,28347,28386,28378,40831, +28392,28393,28452,28468,15686,16193,28545,28606,15722,15733,29111,23705,15754, +28716,15761,28752,28756,28783,28799,28809,805,17345,13809,3800,16087,22462, +28371,28990,22496,13902,27042,35817,23412,31305,22753,38105,31333,31357,22956, +31419,31408,31426,31427,29137,25741,16842,31450,31453,31466,16879,21682,23553, +31499,31573,31529,21262,23806,31650,31599,33692,23476,27775,31696,33825,31634, +0,23840,15789,23653,33938,31738,0,31797,23745,31812,31875,18562,31910,26237, +17784,31945,31943,31974,31860,31987,31989,0,32359,17693,28228,32093,28374, +29837,32137,32171,28981,32179,0,16471,24617,32228,15635,32245,6137,32229, +33645,0,24865,24922,32366,32402,17195,37996,32295,32576,32577,32583,31030, +25296,39393,32663,25425,32675,5729,104,17756,14182,17667,33594,32762,25737,0, +32776,32797,0,32815,41095,27843,32827,32828,32865,10004,18825,26150,15843, +26344,26405,32935,35400,33031,33050,22704,9974,27775,25752,20408,25831,5258, +33304,6238,27219,19045,19093,17530,33321,2829,27218,15742,20473,5373,34018, +33634,27402,18855,13616,6003,15864,33450,26907,63892,16859,34123,33488,33562, +3606,6068,14017,12669,13658,33403,33506,33560,16011,28067,27397,27543,13774, +15807,33565,21996,33669,17675,28069,33708, +0,33747,13438,28372,27223,34138,13462,28226,12015,33880,23524,33905,15827, +17636,27303,33866,15541,31064,0,27542,28279,28227,34014,0,33681,17568,33939, +34020,23697,16960,23744,17731,34100,23282,28313,17703,34163,17686,26559,34326, +34341,34363,34241,28808,34306,5506,28877,63922,17770,34344,13896,6306,21495, +29594,34430,34673,41208,34798,11303,34737,34778,34831,22113,34412,26710,17935, +34885,34886,30176,15801,30180,34910,34972,18011,34996,34997,25537,35013,30583, +30479,35207,35210,0,0,35239,35260,35365,35303,31012,31421,35484,30611,37374, +35472,31321,31465,31546,16271,18195,31544,29052,35596,35615,21552,21861,35647, +35660,35661,35497,19066,35728,35739,35503,5855,17941,34895,35995,32084,32143, +63956,14117,32083,36054,32152,32189,36114,36099,6416,36059,28764,36113,19657, +16080,0,36265,32770,4116,18826,15228,33212,28940,31463,36525,36534,36547, +37588,36633,36653,33637,33810,36773,37635,41631,2640,36787,18730,35294,34109, +15803,24312,12898,36857,40980,34492,34049,8997,14720,28375,36919,34108,31422, +36961,34156,34315,37032,34579,37060,34534,37038,0,37223,15088,37289,37316, +31916,35123,7817,37390,27807,37441,37474,21945,0,35526,15515,35596,21979,3377, +37676,37739,35553,35819,28815,23235,35554,35557,18789,37444,35820,35897,35839, +37747,37979,36540,38277,38310,37926,38304,28662,17081,9850,34520,4732,15918, +18911,27676,38523,38550,16748,38563,28373,25050,38582,30965,35552,38589,21452, +18849,27832,628,25616,37039,37093,19153,6421,13066,38705,34370,38710,18959, +17725,17797,19177,28789,23361,38683, +0,37333,38743,23370,37355,38751,37925,20688,12471,12476,38793,38815,38833, +38846,38848,38866,38880,21612,38894,29724,37939,0,38901,37917,31098,19153, +38964,38963,38987,39014,15118,29045,15697,1584,16732,22278,39114,39095,39112, +39111,19199,27943,5843,21936,39137,39142,39148,37752,39225,18985,19314,38999, +39173,39413,39436,39483,39440,39512,22309,14020,37041,39893,39648,39650,39685, +39668,19470,39700,39725,34304,20532,39732,27048,14531,12413,39760,39744,40254, +23109,6243,39822,16971,39938,39935,39948,40552,40404,40887,41362,41387,41185, +41251,41439,40318,40323,41268,40462,26760,40388,8539,41363,41504,6459,41523, +40249,41145,41652,40592,40597,40606,40610,19764,40618,40623,17252,40641,15200, +14821,15645,20274,14270,35883,40706,40712,19350,37924,28066,40727,0,40761, +22175,22154,40773,39352,37003,38898,33919,40802,40809,31452,40846,29206,19390, +18805,18875,29047,18936,17224,19025,29598,35802,6394,31135,35198,36406,37737, +37875,35396,37612,37761,37835,35180,17593,29207,16107,30578,31299,28880,17523, +17400,29054,6127,28835,6334,13721,16071,6277,21551,6136,14114,5883,6201,14049, +6004,6353,24395,14115,5824,22363,18981,5118,4776,5062,5302,34051,13990,0, +33877,18836,29029,15921,21852,16123,28754,17652,14062,39325,28454,26617,14131, +15381,15847,22636,6434,26640,16471,14143,16609,16523,16655,27681,21707,22174, +26289,22162,4063,2984,3597,37830,35603,37788,20216,20779,14361,17462,20156, +1125,895,20299,20362,22097,23144,427,971,14745,778,1044,13365,20265,704,36531, +629,35546,524,20120,20685, +20749,20386,20227,18958,16010,20290,20526,20588,20609,20428,20453,20568,20732, +0,0,0,0,28278,13717,15929,16063,28018,6276,16009,20904,20931,1504,17629,1187, +1170,1169,36218,35484,1806,21081,21156,2163,21217,0,18042,29068,17292,3104, +18860,4324,27089,3613,0,16094,29849,29716,29782,29592,19342,19132,16525,21456, +13700,29199,16585,21940,837,21709,3014,22301,37469,38644,37734,22493,22413, +22399,13886,22731,23193,35398,5882,5999,5904,23084,22968,37519,23166,23247, +23058,22854,6643,6241,17045,14069,27909,29763,23073,24195,23169,35799,1043, +37856,29836,4867,28933,18802,37896,35323,37821,14240,23582,23710,24158,24136, +6550,6524,15086,24269,23375,6403,6404,14081,6304,14045,5886,14035,33066,35399, +7610,13426,35240,24332,24334,6439,6059,23147,5947,23364,34324,30205,34912, +24702,10336,9771,24539,16056,9647,9662,37000,28531,25024,62,70,9755,24985, +24984,24693,11419,11527,18132,37197,25713,18021,11114,14889,11042,13392,39146, +11896,25399,42075,25782,25393,25553,18915,11623,25252,11425,25659,25963,26994, +15348,12430,12973,18825,12971,21773,13024,6361,37951,26318,12937,12723,15072, +16784,21892,35618,21903,5884,21851,21541,30958,12547,6186,12852,13412,12815, +12674,17097,26254,27940,26219,19347,26160,30832,7659,26211,13010,13025,26142, +22642,14545,14394,14268,15257,14242,13310,29904,15254,26511,17962,26806,26654, +15300,27326,14435,14293,17543,27187,27218,27337,27397,6418,25873,26776,27212, +15319,27258,27479,16320,15514,37792,37618,35818,35531,37513,32798,35292,37991, +28069,28427, +18924,0,16255,15759,28164,16444,23101,28170,22599,27940,30786,28987,17178, +17014,28913,29264,29319,29332,18319,18213,20857,19108,1515,29818,16120,13919, +19018,18711,24545,16134,16049,19167,35875,16181,24743,16115,29900,29756,37767, +29751,17567,28138,17745,30083,16227,19673,19718,16216,30037,30323,42438,15129, +29800,35532,18859,18830,15099,15821,19022,16127,18885,18675,37370,22322,37698, +35555,6244,20703,21025,20967,30584,12850,30478,30479,30587,18071,14209,14942, +18672,29752,29851,16063,19130,19143,16584,19094,25006,37639,21889,30750,30861, +30856,30930,29648,31065,30529,22243,16654,0,33942,31141,27181,16122,31290, +31220,16750,5862,16690,37429,31217,3404,18828,665,15802,5998,13719,21867, +13680,13994,468,3085,31458,23129,9973,23215,23196,23053,603,30960,23082,23494, +31486,16889,31837,31853,16913,23475,24252,24230,31949,18937,6064,31886,31868, +31918,27314,32220,32263,32211,32590,25185,24924,31560,32151,24194,17002,27509, +2326,26582,78,13775,22468,25618,25592,18786,32733,31527,2092,23273,23875, +31500,24078,39398,34373,39523,27164,13375,14818,18935,26029,39455,26016,33920, +28967,27857,17642,33079,17410,32966,33033,33090,26548,39107,27202,33378,33381, +27217,33875,28071,34320,29211,23174,16767,6208,23339,6305,23268,6360,34464, +63932,15759,34861,29730,23042,34926,20293,34951,35007,35046,35173,35149,22147, +35156,30597,30596,35829,35801,35740,35321,16045,33955,18165,18127,14322,35389, +35356,37960,24397,37419,17028,26068,28969,28868,6213,40301,35999,36073,32220, +22938,30659,23024,17262,14036,36394,36519,19465, +36656,36682,17140,27736,28603,8993,18587,28537,28299,6106,39913,14005,18735, +37051,0,21873,18694,37307,37892,35403,16482,35580,37927,35869,35899,34021, +35371,38297,38311,38295,38294,36148,29765,16066,18687,19010,17386,16103,12837, +38543,36583,36454,36453,16076,18925,19064,16366,29714,29803,16124,38721,37040, +26695,18973,37011,22495,0,37736,35209,35878,35631,25534,37562,23313,35689, +18748,29689,16923,38811,38769,39224,3878,24001,35781,19122,38943,38106,37622, +38359,37349,17600,35664,19047,35684,39132,35397,16128,37418,18725,33812,39227, +39245,31494,15869,39323,19311,39338,39516,35685,22728,27279,39457,23294,39471, +39153,19344,39240,39356,19389,19351,37757,22642,4866,22562,18872,5352,30788, +10015,15800,26821,15741,37976,14631,24912,10113,10603,24839,40015,40019,40059, +39989,39952,39807,39887,40493,39839,41461,41214,40225,19630,16644,40472,19632, +40204,41396,41197,41203,39215,40357,33981,28178,28639,27522,34300,17715,28068, +28292,28144,33824,34286,28160,14295,24676,31202,13724,13888,18733,18910,15714, +37851,37566,37704,703,30905,37495,37965,20452,13376,36964,21853,30781,30804, +30902,30795,5975,12745,18753,13978,20338,28634,28633,0,28702,21524,16821, +22459,22771,22410,40214,22487,28980,13487,16812,29163,27712,20375,0,6069, +35401,24844,23246,23051,17084,17544,14124,19323,35324,37819,37816,6358,3869, +33906,27840,5139,17146,11302,17345,22932,15799,26433,32168,24923,24740,18873, +18827,35322,37605,29666,16105,29876,35683,6303,16097,19123,27352,29683,29691, +16086,19006,19092,6105,19046,935,5156,18917,29768, +18710,28837,18806,37508,29670,37727,1278,37681,35534,35350,37766,35815,21973, +18741,35458,29035,18755,3327,22180,1562,3051,3256,21762,31172,6138,32254,5826, +19024,6226,17710,37889,14090,35520,18861,22960,6335,6275,29828,23201,14050, +15707,14000,37471,23161,35457,6242,37748,15565,2740,19094,14730,20724,15721, +15692,5020,29045,17147,33304,28175,37092,17643,27991,32335,28775,27823,15574, +16365,15917,28162,28428,15727,1013,30033,14012,13512,18048,16090,18545,22980, +37486,18750,36673,35868,27584,22546,22472,14038,5202,28926,17250,19057,12259, +4784,9149,26809,26983,5016,13541,31732,14047,35459,14294,13306,19615,27162, +13997,27831,33854,17631,17614,27942,27985,27778,28638,28439,28937,33597,5946, +33773,27776,28755,6107,22921,23170,6067,23137,23153,6405,16892,14125,23023, +5948,14023,29070,37776,26266,17061,23150,23083,17043,27179,16121,30518,17499, +17098,28957,16985,35297,20400,27944,23746,17614,32333,17341,27148,16982,4868, +28838,28979,17385,15781,27871,63525,19023,32357,23019,23855,15859,24412,19037, +6111,32164,33830,21637,15098,13056,532,22398,2261,1561,16357,8094,41654,28675, +37211,23920,29583,31955,35417,37920,20424,32743,29389,29456,31476,29496,29497, +22262,29505,29512,16041,31512,36972,29173,18674,29665,33270,16074,30476,16081, +27810,22269,29721,29726,29727,16098,16112,16116,16122,29907,16142,16211,30018, +30061,30066,30093,16252,30152,30172,16320,30285,16343,30324,16348,30330,20316, +29064,22051,35200,22633,16413,30531,16441,26465,16453,13787,30616,16490,16495, +23646,30654,30667,22770,30744,28857,30748, +16552,30777,30791,30801,30822,33864,21813,31027,26627,31026,16643,16649,31121, +31129,36795,31238,36796,16743,31377,16818,31420,33401,16836,31439,31451,16847, +20001,31586,31596,31611,31762,31771,16992,17018,31867,31900,17036,31928,17044, +31981,36755,28864,3279,32207,32212,32208,32253,32686,32692,29343,17303,32800, +32805,31545,32814,32817,32852,15820,22452,28832,32951,33001,17389,33036,29482, +33038,33042,30048,33044,17409,15161,33110,33113,33114,17427,22586,33148,33156, +17445,33171,17453,33189,22511,33217,33252,33364,17551,33446,33398,33482,33496, +33535,17584,33623,38505,27018,33797,28917,33892,24803,33928,17668,33982,34017, +34040,34064,34104,34130,17723,34159,34160,34272,17783,34418,34450,34482,34543, +38469,34699,17926,17943,34990,35071,35108,35143,35217,31079,35369,35384,35476, +35508,35921,36052,36082,36124,18328,22623,36291,18413,20206,36410,21976,22356, +36465,22005,36528,18487,36558,36578,36580,36589,36594,36791,36801,36810,36812, +36915,39364,18605,39136,37395,18718,37416,37464,37483,37553,37550,37567,37603, +37611,37619,37620,37629,37699,37764,37805,18757,18769,40639,37911,21249,37917, +37933,37950,18794,37972,38009,38189,38306,18855,38388,38451,18917,26528,18980, +38720,18997,38834,38850,22100,19172,24808,39097,19225,39153,22596,39182,39193, +20916,39196,39223,39234,39261,39266,19312,39365,19357,39484,39695,31363,39785, +39809,39901,39921,39924,19565,39968,14191,7106,40265,39994,40702,22096,40339, +40381,40384,40444,38134,36790,40571,40620,40625,40637,40646,38108,40674,40689, +40696,31432,40772,148,695,928,26906,38083,22956, +1239,22592,38081,14265,1493,1557,1654,5818,22359,29043,2754,2765,3007,21610, +63547,3019,21662,3067,3131,3155,3173,3196,24807,3213,22138,3253,3293,3309, +3439,3506,3528,26965,39983,34725,3588,3598,3799,3984,3885,3699,23584,4028, +24075,4188,4175,4214,26398,4219,4232,4246,13895,4287,4307,4399,4411,21348, +33965,4835,4981,4918,35713,5495,5657,6083,6087,20088,28859,6189,6506,6701, +6725,7210,7280,7340,7880,25283,7893,7957,29080,26709,8261,27113,14024,8828, +9175,9210,10026,10353,10575,33533,10599,10643,10965,35237,10984,36768,11022, +38840,11071,38983,39613,11340,0,11400,11447,23528,11528,11538,11703,11669, +11842,12148,12236,12339,12390,13087,13278,24497,26184,26303,31353,13671,13811, +0,18874,0,13850,14102,0,838,22709,26382,26904,15015,30295,24546,15889,16057, +30206,8346,18640,19128,16665,35482,17134,17165,16443,17204,17302,19013,1482, +20946,1553,22943,7848,15294,15615,17412,17622,22408,18036,14747,18223,34280, +39369,14178,8643,35678,35662,0,18450,18683,18965,29193,19136,3192,22885,20133, +20358,1913,36570,20524,21135,22335,29041,21145,21529,16202,19111,21948,21574, +21614,27474,0,13427,21823,30258,21854,18200,21858,21862,22471,18751,22621, +20582,13563,13260,0,22787,18300,35144,23214,23433,23558,7568,22433,29009,0, +24834,31762,36950,25010,20378,35682,25602,25674,23899,27639,0,25732,6428, +35562,18934,25736,16367,25874,19392,26047,26293,10011,37989,22497,24981,23079, +63693,0,22201,17697,26364,20074,18740,38486,28047,27837,13848,35191, +26521,26734,25617,26718,0,26823,31554,37056,2577,26918,0,26937,31301,0,27130, +39462,27181,13919,25705,33,31107,27188,27483,23852,13593,0,27549,18128,27812, +30011,34917,28078,22710,14108,9613,28747,29133,15444,29312,29317,37505,8570, +29323,37680,29414,18896,27705,38047,29776,3832,34855,35061,10534,33907,6065, +28344,18986,6176,14756,14009,0,0,17727,26294,40109,39076,35139,30668,30808, +22230,16607,5642,14753,14127,33000,5061,29101,33638,31197,37288,0,19639,28847, +35243,31229,31242,31499,32102,16762,31555,31102,32777,28597,41695,27139,33560, +21410,28167,37823,26678,38749,33135,32803,27061,5101,12847,32840,23941,35888, +32899,22293,38947,35145,23979,18824,26046,27093,21458,19109,16257,15377,26422, +32912,33012,33070,8097,33103,33161,33199,33306,33542,33583,33674,13770,33896, +34474,18682,25574,35158,30728,37461,35256,17394,35303,17375,35304,35654,35796, +23032,35849,0,36805,37100,0,37136,37180,15863,37214,19146,36816,29327,22155, +38119,38377,38320,38328,38706,39121,39241,39274,39363,39464,39694,40282,40347, +32415,40696,40739,19620,38215,41619,29090,41727,19857,36882,42443,19868,3228, +36798,21953,36794,9392,36793,19091,17673,32383,28502,27313,20202,13540,35628, +30877,14138,36480,6133,32804,35692,35737,31294,26287,15851,30293,15543,22069, +22870,20122,24193,25176,22207,3693,36366,23405,16008,19614,25566,0,6134,6267, +25904,22061,23626,21530,21265,15814,40344,19581,22050,22046,32585,24280,22901, +15680,34672,19996,4074,3401,14010,33047,40286,36120,30267,40005,30286,30649, +37701,21554, +33096,33527,22053,33074,33816,32957,21994,31074,22083,21526,3741,13774,22021, +22001,26353,33506,13869,30004,22000,21946,21655,21874,3137,3222,24272,20808, +3702,11362,3746,40619,32090,21982,4213,25245,38765,21652,36045,29174,37238, +25596,25529,25598,21865,11075,40050,11955,20890,13535,3495,20903,21581,21790, +21779,30310,36397,26762,30129,32950,34820,34694,35015,33206,33820,4289,17644, +29444,18182,23440,33547,26771,22139,9972,32047,16803,32115,28368,29366,37232, +4569,37384,15612,42665,3756,3833,29286,7330,18254,20418,32761,4075,16634, +40029,25887,11680,18675,18400,40316,4076,3594,0,30115,4077,0,24648,4487,29091, +32398,40272,19994,19972,13687,23309,27826,21351,13996,14812,21373,13989,17944, +22682,19310,33325,21579,22442,23189,2425,0,14930,9317,29556,40620,19721,39917, +15614,40752,19547,20393,38302,40926,33884,15798,29362,26547,14112,25390,32037, +16119,15916,14890,36872,21196,15988,13946,17897,1166,30272,23280,3766,30842, +32558,22695,16575,22140,39819,23924,30292,42036,40581,19681,0,14331,24857, +12506,17394,0,22109,4777,22439,18787,40454,21044,28846,13741,0,40316,31830, +39737,22494,5996,23635,25811,38096,25397,29028,34477,3368,27938,19170,3441,0, +20990,7951,23950,38659,7633,40577,36940,31519,39682,23761,31651,25192,25397, +39679,31695,39722,31870,0,31810,31878,39957,31740,39689,0,39963,18750,40794, +21875,23491,20477,40600,20466,21088,15878,21201,22375,20566,22967,24082,38856, +40363,36700,21609,38836,39232,38842,21292,24880,26924,21466,39946,40194,19515, +38465,27008,20646, +30022,5997,39386,21107,0,37209,38529,37212,0,37201,36503,25471,27939,27338, +22033,37262,30074,25221,1020,29519,31856,23585,15613,0,18713,30422,39837, +20010,3284,33726,34882,0,23626,27072,0,22394,21023,24053,20174,27697,498, +20281,21660,21722,21146,36226,13822,0,13811,0,27474,37244,40869,39831,38958, +39092,39610,40616,40580,29050,31508,0,27642,34840,32632,0,22048,42570,36471, +40787,0,36308,36431,40476,36353,25218,33661,36392,36469,31443,19063,31294, +30936,27882,35431,30215,35418,40742,27854,34774,30147,41650,30803,63552,36108, +29410,29553,35629,29442,29937,36075,19131,34351,24506,34976,17591,0,6203, +28165,0,35454,9499,0,24829,30311,39639,40260,37742,39823,34805,0,0,36087, +29484,38689,39856,13782,29362,19463,31825,39242,24921,24921,19460,40598,24957, +0,22367,24943,25254,25145,0,14940,25058,21418,13301,25444,26626,13778,23895, +35778,36826,36409,0,20697,7494,30982,21298,38456,3899,16485,0,30718,0,31938, +24346,31962,31277,32870,32867,32077,29957,29938,35220,33306,26380,32866,29830, +32859,29936,33027,30500,35209,26572,30035,28369,34729,34766,33224,34700,35401, +36013,35651,30507,29944,34010,13877,27058,36262,0,35241,0,28089,34753,16401, +29927,15835,29046,24740,24988,15569,0,24695,0,32625,35629,0,24809,19326,21024, +15384,15559,24279,30294,21809,6468,4862,39171,28124,28845,23745,25005,35343, +13943,238,26694,20238,17762,23327,25420,40784,40614,25195,1351,37595,1503, +16325,34124,17077,29679,20917,13897,18754,35300,37700,6619, +33518,15560,30780,26436,25311,18739,35242,672,27571,4869,20395,9453,20488, +27945,31364,13824,19121,9491,0,894,24484,896,839,28379,1055,0,20737,13434, +20750,39020,14147,33814,18852,1159,20832,13236,20842,3071,8444,741,9520,1422, +12851,6531,23426,34685,1459,15513,20914,20920,40244,20937,20943,20945,15580, +20947,19110,20915,20962,21314,20973,33741,26942,14125,24443,21003,21030,21052, +21173,21079,21140,21177,21189,31765,34114,21216,34317,27411,0,35550,21833, +28377,16256,2388,16364,21299,0,3042,27851,5926,26651,29653,24650,16042,14540, +5864,29149,17570,21357,21364,34475,21374,0,5526,5651,30694,21395,35483,21408, +21419,21422,29607,22386,16217,29596,21441,21445,27721,20041,22526,21465,15019, +2959,21472,16363,11683,21494,3191,21523,28793,21803,26199,27995,21613,27475, +3444,21853,21647,21668,18342,5901,3805,15796,3405,35260,9880,21831,19693, +21551,29719,21894,21929,0,6359,16442,17746,17461,26291,4276,22071,26317,12938, +26276,26285,22093,22095,30961,22257,38791,21502,22272,22255,22253,35686,13859, +4687,22342,16805,27758,28811,22338,14001,27774,22502,5142,22531,5204,17251, +22566,19445,22620,22698,13665,22752,22748,4668,22779,23551,22339,41296,17016, +37843,13729,22815,26790,14019,28249,5694,23076,21843,5778,34053,22985,3406, +27777,27946,6108,23001,6139,6066,28070,28017,6184,5845,23033,28229,23211, +23139,14054,18857,0,14088,23190,29797,23251,28577,9556,15749,6417,14130,5816, +24195,21200,23414,25992,23420,31246,16388,18525,516,23509,24928,6708,22988, +1445,23539, +23453,19728,23557,6980,23571,29646,23572,7333,27432,23625,18653,23685,23785, +23791,23947,7673,7735,23824,23832,23878,7844,23738,24023,33532,14381,18689, +8265,8563,33415,14390,15298,24110,27274,0,24186,17596,3283,21414,20151,0, +21416,6001,24073,24308,33922,24313,24315,14496,24316,26686,37915,24333,449, +63636,15070,18606,4922,24378,26760,9168,0,9329,24419,38845,28270,24434,37696, +35382,24487,23990,15711,21072,8042,28920,9832,37334,670,35369,24625,26245, +6263,14691,15815,13881,22416,10164,31089,15936,24734,0,24755,18818,18831, +31315,29860,20705,23200,24932,33828,24898,63654,28370,24961,20980,1622,24967, +23466,16311,10335,25043,35741,39261,25040,14642,10624,10433,24611,24924,25886, +25483,280,25285,6000,25301,11789,25452,18911,14871,25656,25592,5006,6140,0, +28554,11830,38932,16524,22301,25825,25829,38011,14950,25658,14935,25933,28438, +18984,18979,25989,25965,25951,12414,26037,18752,19255,26065,16600,6185,26080, +26083,24543,13312,26136,12791,12792,26180,12708,12709,26187,3701,26215,20966, +26227,0,7741,12849,34292,12744,21267,30661,10487,39332,26370,17308,18977, +15147,27130,14274,0,26471,26466,16845,37101,26583,17641,26658,28240,37436, +26625,13286,28064,26717,13423,27105,27147,35551,26995,26819,13773,26881,26880, +15666,14849,13884,15232,26540,26977,35402,17148,26934,27032,15265,969,33635, +20624,27129,13913,8490,27205,14083,27293,15347,26545,27336,37276,15373,27421, +2339,24798,27445,27508,10189,28341,15067,949,6488,14144,21537,15194,27617, +16124,27612,27703,9355,18673,27473, +27738,33318,27769,15804,17605,15805,16804,18700,18688,15561,14053,15595,3378, +39811,12793,9361,32655,26679,27941,28065,28139,28054,27996,28284,28420,18815, +16517,28274,34099,28532,20935,0,0,33838,35617,0,15919,29779,16258,31180,28239, +23185,12363,28664,14093,28573,15920,28410,5271,16445,17749,37872,28484,28508, +15694,28532,37232,15675,28575,16708,28627,16529,16725,16441,16368,16308,16703, +20959,16726,16727,16704,25053,28747,28798,28839,28801,28876,28885,28886,28895, +16644,15848,29108,29078,17015,28971,28997,23176,29002,0,23708,17253,29007, +37730,17089,28972,17498,18983,18978,29114,35816,28861,29198,37954,29205,22801, +37955,29220,37697,22021,29230,29248,18804,26813,29269,29271,15957,12356,26637, +28477,29314,0,29483,18467,34859,18669,34820,29480,29486,29647,29610,3130, +27182,29641,29769,16866,5863,18980,26147,14021,18871,18829,18939,29687,29717, +26883,18982,29753,1475,16087,0,10413,29792,36530,29767,29668,29814,33721, +29804,14128,29812,37873,27180,29826,18771,19084,16735,19065,35727,23366,35843, +6302,29896,6536,29966,0,29982,36569,6731,23511,36524,37765,30029,30026,30055, +30062,20354,16132,19731,30094,29789,30110,30132,30210,30252,30289,30287,30319, +30326,25589,30352,33263,14328,26897,26894,30369,30373,30391,30412,28575,33890, +20637,20861,7708,30494,30502,30528,25775,21024,30552,12972,30639,35172,35176, +5825,30708,0,4982,18962,26826,30895,30919,30931,38565,31022,21984,30935,31028, +30897,30220,36792,34948,35627,24707,9756,31110,35072,26882,31104,22615,31133, +31545,31036,31145,28202,28966, +16040,31174,37133,31188,1312,17503,21007,47234,248,16384,43296,1102,0,0,2868, +1,0,0,0,0,0,0,0,3072,64,0,0,0,1024,88,60,0,0,23680,56493,48115,17353,60910, +4004,49446,30363,61426,64478,63482,12815,44868,61438,65277,24593,176,8448, +33049,4128,43144,8544,9321,17408,50313,0,16387,53,33859,20785,26771,514,0,0,0, +0,0,16384,256,44160,33380,35904,37025,20484,54368,53760,6186,26781,38709, +55375,8440,33476,10268,30082,660,16440,41376,4293,19825,3524,47512,23390, +17153,39327,30723,57888,2079,393,16585,775,39437,21136,20433,892,8450,49184, +4974,46467,62939,30693,20368,39447,5942,12,47726,12041,21600,7680,26744,28706, +40534,62245,46990,2839,59119,6007,7003,4289,36248,6162,53174,12545,6770,11355, +49334,57888,23747,7042,56032,34254,16598,21673,53259,18447,16452,2320,16596, +15278,7780,11076,2071,33414,6198,35232,40167,2139,900,55810,60560,34779,49029, +44450,36509,39069,9504,70,40774,58239,51669,62596,19926,58118,6326,2322,0, +1024,0,32,0,512,0,0,0,0,8192,0,0,0,0,0,0,8,36352,28280,16223,56702,63293, +39932,44796,65490,27535,59377,47807,28334,61207,42972,46654,30645,37577,42455, +19126,39790,33209,26445,21758,39921,65122,21103,14039,49150,17705,63873,26045, +17062,57,16896,36704,37888,16448,45010,53719,219,39072,31666,20998,38944, +51222,2365,0,1,0,2561,2226,128,0,34820,5152,19472,0,4,17569,16,321, +2048,61504,20447,22582,62961,32949,26613,16512,20480,16718,33992,23040,55392, +11009,20481,5793,16580,28402,44049,14624,49348,1800,2316,38552,39876,7184, +27800,10886,422,4422,58733,50379,37568,8464,4630,29341,27124,5902,41514,62593, +123,41992,36875,11280,14796,330,5872,2571,3136,59933,17420,17678,2, diff --git a/Ubiquitous/XiZi/lib/musllib/src/locale/iconv.c b/Ubiquitous/XiZi/lib/musllib/src/locale/iconv.c new file mode 100644 index 000000000..beeb4fe39 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/locale/iconv.c @@ -0,0 +1,686 @@ +#include +#include +#include +#include +#include +#include +#include +#include "locale_impl.h" + +#define UTF_32BE 0300 +#define UTF_16LE 0301 +#define UTF_16BE 0302 +#define UTF_32LE 0303 +#define UCS2BE 0304 +#define UCS2LE 0305 +#define WCHAR_T 0306 +#define US_ASCII 0307 +#define UTF_8 0310 +#define UTF_16 0312 +#define UTF_32 0313 +#define UCS2 0314 +#define EUC_JP 0320 +#define SHIFT_JIS 0321 +#define ISO2022_JP 0322 +#define GB18030 0330 +#define GBK 0331 +#define GB2312 0332 +#define BIG5 0340 +#define EUC_KR 0350 + +/* Definitions of charmaps. Each charmap consists of: + * 1. Empty-string-terminated list of null-terminated aliases. + * 2. Special type code or number of elided quads of entries. + * 3. Character table (size determined by field 2), consisting + * of 5 bytes for every 4 characters, interpreted as 10-bit + * indices into the legacy_chars table. */ + +static const unsigned char charmaps[] = +"utf8\0char\0\0\310" +"wchart\0\0\306" +"ucs2be\0\0\304" +"ucs2le\0\0\305" +"utf16be\0\0\302" +"utf16le\0\0\301" +"ucs4be\0utf32be\0\0\300" +"ucs4le\0utf32le\0\0\303" +"ascii\0usascii\0iso646\0iso646us\0\0\307" +"utf16\0\0\312" +"ucs4\0utf32\0\0\313" +"ucs2\0\0\314" +"eucjp\0\0\320" +"shiftjis\0sjis\0\0\321" +"iso2022jp\0\0\322" +"gb18030\0\0\330" +"gbk\0\0\331" +"gb2312\0\0\332" +"big5\0bigfive\0cp950\0big5hkscs\0\0\340" +"euckr\0ksc5601\0ksx1001\0cp949\0\0\350" +#include "codepages.h" +; + +/* Table of characters that appear in legacy 8-bit codepages, + * limited to 1024 slots (10 bit indices). The first 256 entries + * are elided since those characters are obviously all included. */ +static const unsigned short legacy_chars[] = { +#include "legacychars.h" +}; + +static const unsigned short jis0208[84][94] = { +#include "jis0208.h" +}; + +static const unsigned short gb18030[126][190] = { +#include "gb18030.h" +}; + +static const unsigned short big5[89][157] = { +#include "big5.h" +}; + +static const unsigned short hkscs[] = { +#include "hkscs.h" +}; + +static const unsigned short ksc[93][94] = { +#include "ksc.h" +}; + +static const unsigned short rev_jis[] = { +#include "revjis.h" +}; + +static int fuzzycmp(const unsigned char *a, const unsigned char *b) +{ + for (; *a && *b; a++, b++) { + while (*a && (*a|32U)-'a'>26 && *a-'0'>10U) a++; + if ((*a|32U) != *b) return 1; + } + return *a != *b; +} + +static size_t find_charmap(const void *name) +{ + const unsigned char *s; + if (!*(char *)name) name=charmaps; /* "utf8" */ + for (s=charmaps; *s; ) { + if (!fuzzycmp(name, s)) { + for (; *s; s+=strlen((void *)s)+1); + return s+1-charmaps; + } + s += strlen((void *)s)+1; + if (!*s) { + if (s[1] > 0200) s+=2; + else s+=2+(64U-s[1])*5; + } + } + return -1; +} + +struct stateful_cd { + iconv_t base_cd; + unsigned state; +}; + +static iconv_t combine_to_from(size_t t, size_t f) +{ + return (void *)(f<<16 | t<<1 | 1); +} + +static size_t extract_from(iconv_t cd) +{ + return (size_t)cd >> 16; +} + +static size_t extract_to(iconv_t cd) +{ + return (size_t)cd >> 1 & 0x7fff; +} + +iconv_t iconv_open(const char *to, const char *from) +{ + size_t f, t; + struct stateful_cd *scd; + + if ((t = find_charmap(to))==-1 + || (f = find_charmap(from))==-1 + || (charmaps[t] >= 0330)) { + errno = EINVAL; + return (iconv_t)-1; + } + iconv_t cd = combine_to_from(t, f); + + switch (charmaps[f]) { + case UTF_16: + case UTF_32: + case UCS2: + case ISO2022_JP: + scd = malloc(sizeof *scd); + if (!scd) return (iconv_t)-1; + scd->base_cd = cd; + scd->state = 0; + cd = (iconv_t)scd; + } + + return cd; +} + +static unsigned get_16(const unsigned char *s, int e) +{ + e &= 1; + return s[e]<<8 | s[1-e]; +} + +static void put_16(unsigned char *s, unsigned c, int e) +{ + e &= 1; + s[e] = c>>8; + s[1-e] = c; +} + +static unsigned get_32(const unsigned char *s, int e) +{ + e &= 3; + return s[e]+0U<<24 | s[e^1]<<16 | s[e^2]<<8 | s[e^3]; +} + +static void put_32(unsigned char *s, unsigned c, int e) +{ + e &= 3; + s[e^0] = c>>24; + s[e^1] = c>>16; + s[e^2] = c>>8; + s[e^3] = c; +} + +/* Adapt as needed */ +#define mbrtowc_utf8 mbrtowc +#define wctomb_utf8 wctomb + +static unsigned legacy_map(const unsigned char *map, unsigned c) +{ + if (c < 4*map[-1]) return c; + unsigned x = c - 4*map[-1]; + x = map[x*5/4]>>2*x%8 | map[x*5/4+1]<<8-2*x%8 & 1023; + return x < 256 ? x : legacy_chars[x-256]; +} + +static unsigned uni_to_jis(unsigned c) +{ + unsigned nel = sizeof rev_jis / sizeof *rev_jis; + unsigned d, j, i, b = 0; + for (;;) { + i = nel/2; + j = rev_jis[b+i]; + d = jis0208[j/256][j%256]; + if (d==c) return j + 0x2121; + else if (nel == 1) return 0; + else if (c < d) + nel /= 2; + else { + b += i; + nel -= nel/2; + } + } +} + +size_t iconv(iconv_t cd, char **restrict in, size_t *restrict inb, char **restrict out, size_t *restrict outb) +{ + size_t x=0; + struct stateful_cd *scd=0; + if (!((size_t)cd & 1)) { + scd = (void *)cd; + cd = scd->base_cd; + } + unsigned to = extract_to(cd); + unsigned from = extract_from(cd); + const unsigned char *map = charmaps+from+1; + const unsigned char *tomap = charmaps+to+1; + mbstate_t st = {0}; + wchar_t wc; + unsigned c, d; + size_t k, l; + int err; + unsigned char type = map[-1]; + unsigned char totype = tomap[-1]; + locale_t locale = CURRENT_LOCALE; + locale_t *ploc = &locale, loc = *ploc; + + if (!in || !*in || !*inb) return 0; + + *ploc = UTF8_LOCALE; + + for (; *inb; *in+=l, *inb-=l) { + c = *(unsigned char *)*in; + l = 1; + + switch (type) { + case UTF_8: + if (c < 128) break; + l = mbrtowc_utf8(&wc, *in, *inb, &st); + if (l == (size_t)-1) goto ilseq; + if (l == (size_t)-2) goto starved; + c = wc; + break; + case US_ASCII: + if (c >= 128) goto ilseq; + break; + case WCHAR_T: + l = sizeof(wchar_t); + if (*inb < l) goto starved; + c = *(wchar_t *)*in; + if (0) { + case UTF_32BE: + case UTF_32LE: + l = 4; + if (*inb < 4) goto starved; + c = get_32((void *)*in, type); + } + if (c-0xd800u < 0x800u || c >= 0x110000u) goto ilseq; + break; + case UCS2BE: + case UCS2LE: + case UTF_16BE: + case UTF_16LE: + l = 2; + if (*inb < 2) goto starved; + c = get_16((void *)*in, type); + if ((unsigned)(c-0xdc00) < 0x400) goto ilseq; + if ((unsigned)(c-0xd800) < 0x400) { + if (type-UCS2BE < 2U) goto ilseq; + l = 4; + if (*inb < 4) goto starved; + d = get_16((void *)(*in + 2), type); + if ((unsigned)(d-0xdc00) >= 0x400) goto ilseq; + c = ((c-0xd7c0)<<10) + (d-0xdc00); + } + break; + case UCS2: + case UTF_16: + l = 0; + if (!scd->state) { + if (*inb < 2) goto starved; + c = get_16((void *)*in, 0); + scd->state = type==UCS2 + ? c==0xfffe ? UCS2LE : UCS2BE + : c==0xfffe ? UTF_16LE : UTF_16BE; + if (c == 0xfffe || c == 0xfeff) + l = 2; + } + type = scd->state; + continue; + case UTF_32: + l = 0; + if (!scd->state) { + if (*inb < 4) goto starved; + c = get_32((void *)*in, 0); + scd->state = c==0xfffe0000 ? UTF_32LE : UTF_32BE; + if (c == 0xfffe0000 || c == 0xfeff) + l = 4; + } + type = scd->state; + continue; + case SHIFT_JIS: + if (c < 128) break; + if (c-0xa1 <= 0xdf-0xa1) { + c += 0xff61-0xa1; + break; + } + l = 2; + if (*inb < 2) goto starved; + d = *((unsigned char *)*in + 1); + if (c-129 <= 159-129) c -= 129; + else if (c-224 <= 239-224) c -= 193; + else goto ilseq; + c *= 2; + if (d-64 <= 158-64) { + if (d==127) goto ilseq; + if (d>127) d--; + d -= 64; + } else if (d-159 <= 252-159) { + c++; + d -= 159; + } + c = jis0208[c][d]; + if (!c) goto ilseq; + break; + case EUC_JP: + if (c < 128) break; + l = 2; + if (*inb < 2) goto starved; + d = *((unsigned char *)*in + 1); + if (c==0x8e) { + c = d; + if (c-0xa1 > 0xdf-0xa1) goto ilseq; + c += 0xff61 - 0xa1; + break; + } + c -= 0xa1; + d -= 0xa1; + if (c >= 84 || d >= 94) goto ilseq; + c = jis0208[c][d]; + if (!c) goto ilseq; + break; + case ISO2022_JP: + if (c >= 128) goto ilseq; + if (c == '\033') { + l = 3; + if (*inb < 3) goto starved; + c = *((unsigned char *)*in + 1); + d = *((unsigned char *)*in + 2); + if (c != '(' && c != '$') goto ilseq; + switch (128*(c=='$') + d) { + case 'B': scd->state=0; continue; + case 'J': scd->state=1; continue; + case 'I': scd->state=4; continue; + case 128+'@': scd->state=2; continue; + case 128+'B': scd->state=3; continue; + } + goto ilseq; + } + switch (scd->state) { + case 1: + if (c=='\\') c = 0xa5; + if (c=='~') c = 0x203e; + break; + case 2: + case 3: + l = 2; + if (*inb < 2) goto starved; + d = *((unsigned char *)*in + 1); + c -= 0x21; + d -= 0x21; + if (c >= 84 || d >= 94) goto ilseq; + c = jis0208[c][d]; + if (!c) goto ilseq; + break; + case 4: + if (c-0x60 < 0x1f) goto ilseq; + if (c-0x21 < 0x5e) c += 0xff61-0x21; + break; + } + break; + case GB2312: + if (c < 128) break; + if (c < 0xa1) goto ilseq; + case GBK: + case GB18030: + if (c < 128) break; + c -= 0x81; + if (c >= 126) goto ilseq; + l = 2; + if (*inb < 2) goto starved; + d = *((unsigned char *)*in + 1); + if (d < 0xa1 && type == GB2312) goto ilseq; + if (d-0x40>=191 || d==127) { + if (d-'0'>9 || type != GB18030) + goto ilseq; + l = 4; + if (*inb < 4) goto starved; + c = (10*c + d-'0') * 1260; + d = *((unsigned char *)*in + 2); + if (d-0x81>126) goto ilseq; + c += 10*(d-0x81); + d = *((unsigned char *)*in + 3); + if (d-'0'>9) goto ilseq; + c += d-'0'; + c += 128; + for (d=0; d<=c; ) { + k = 0; + for (int i=0; i<126; i++) + for (int j=0; j<190; j++) + if (gb18030[i][j]-d <= c-d) + k++; + d = c+1; + c += k; + } + break; + } + d -= 0x40; + if (d>63) d--; + c = gb18030[c][d]; + break; + case BIG5: + if (c < 128) break; + l = 2; + if (*inb < 2) goto starved; + d = *((unsigned char *)*in + 1); + if (d-0x40>=0xff-0x40 || d-0x7f<0xa1-0x7f) goto ilseq; + d -= 0x40; + if (d > 0x3e) d -= 0x22; + if (c-0xa1>=0xfa-0xa1) { + if (c-0x87>=0xff-0x87) goto ilseq; + if (c < 0xa1) c -= 0x87; + else c -= 0x87 + (0xfa-0xa1); + c = (hkscs[4867+(c*157+d)/16]>>(c*157+d)%16)%2<<17 + | hkscs[c*157+d]; + /* A few HKSCS characters map to pairs of UCS + * characters. These are mapped to surrogate + * range in the hkscs table then hard-coded + * here. Ugly, yes. */ + if (c/256 == 0xdc) { + union { + char c[8]; + wchar_t wc[2]; + } tmp; + char *ptmp = tmp.c; + size_t tmpx = iconv(combine_to_from(to, find_charmap("utf8")), + &(char *){"\303\212\314\204" + "\303\212\314\214" + "\303\252\314\204" + "\303\252\314\214" + +c%256}, &(size_t){4}, + &ptmp, &(size_t){sizeof tmp}); + size_t tmplen = ptmp - tmp.c; + if (tmplen > *outb) goto toobig; + if (tmpx) x++; + memcpy(*out, &tmp, tmplen); + *out += tmplen; + *outb -= tmplen; + continue; + } + if (!c) goto ilseq; + break; + } + c -= 0xa1; + c = big5[c][d]|(c==0x27&&(d==0x3a||d==0x3c||d==0x42))<<17; + if (!c) goto ilseq; + break; + case EUC_KR: + if (c < 128) break; + l = 2; + if (*inb < 2) goto starved; + d = *((unsigned char *)*in + 1); + c -= 0xa1; + d -= 0xa1; + if (c >= 93 || d >= 94) { + c += (0xa1-0x81); + d += 0xa1; + if (c >= 93 || c>=0xc6-0x81 && d>0x52) + goto ilseq; + if (d-'A'<26) d = d-'A'; + else if (d-'a'<26) d = d-'a'+26; + else if (d-0x81<0xff-0x81) d = d-0x81+52; + else goto ilseq; + if (c < 0x20) c = 178*c + d; + else c = 178*0x20 + 84*(c-0x20) + d; + c += 0xac00; + for (d=0xac00; d<=c; ) { + k = 0; + for (int i=0; i<93; i++) + for (int j=0; j<94; j++) + if (ksc[i][j]-d <= c-d) + k++; + d = c+1; + c += k; + } + break; + } + c = ksc[c][d]; + if (!c) goto ilseq; + break; + default: + if (!c) break; + c = legacy_map(map, c); + if (!c) goto ilseq; + } + + switch (totype) { + case WCHAR_T: + if (*outb < sizeof(wchar_t)) goto toobig; + *(wchar_t *)*out = c; + *out += sizeof(wchar_t); + *outb -= sizeof(wchar_t); + break; + case UTF_8: + if (*outb < 4) { + char tmp[4]; + k = wctomb_utf8(tmp, c); + if (*outb < k) goto toobig; + memcpy(*out, tmp, k); + } else k = wctomb_utf8(*out, c); + *out += k; + *outb -= k; + break; + case US_ASCII: + if (c > 0x7f) subst: x++, c='*'; + default: + if (*outb < 1) goto toobig; + if (c<256 && c==legacy_map(tomap, c)) { + revout: + if (*outb < 1) goto toobig; + *(*out)++ = c; + *outb -= 1; + break; + } + d = c; + for (c=4*totype; c<256; c++) { + if (d == legacy_map(tomap, c)) { + goto revout; + } + } + goto subst; + case SHIFT_JIS: + if (c < 128) goto revout; + if (c == 0xa5) { + x++; + c = '\\'; + goto revout; + } + if (c == 0x203e) { + x++; + c = '~'; + goto revout; + } + if (c-0xff61 <= 0xdf-0xa1) { + c += 0xa1 - 0xff61; + goto revout; + } + c = uni_to_jis(c); + if (!c) goto subst; + if (*outb < 2) goto toobig; + d = c%256; + c = c/256; + *(*out)++ = (c+1)/2 + (c<95 ? 112 : 176); + *(*out)++ = c%2 ? d + 31 + d/96 : d + 126; + *outb -= 2; + break; + case EUC_JP: + if (c < 128) goto revout; + if (c-0xff61 <= 0xdf-0xa1) { + c += 0x0e00 + 0x21 - 0xff61; + } else { + c = uni_to_jis(c); + } + if (!c) goto subst; + if (*outb < 2) goto toobig; + *(*out)++ = c/256 + 0x80; + *(*out)++ = c%256 + 0x80; + *outb -= 2; + break; + case ISO2022_JP: + if (c < 128) goto revout; + if (c-0xff61 <= 0xdf-0xa1 || c==0xa5 || c==0x203e) { + if (*outb < 7) goto toobig; + *(*out)++ = '\033'; + *(*out)++ = '('; + if (c==0xa5) { + *(*out)++ = 'J'; + *(*out)++ = '\\'; + } else if (c==0x203e) { + *(*out)++ = 'J'; + *(*out)++ = '~'; + } else { + *(*out)++ = 'I'; + *(*out)++ = c-0xff61+0x21; + } + *(*out)++ = '\033'; + *(*out)++ = '('; + *(*out)++ = 'B'; + *outb -= 7; + break; + } + c = uni_to_jis(c); + if (!c) goto subst; + if (*outb < 8) goto toobig; + *(*out)++ = '\033'; + *(*out)++ = '$'; + *(*out)++ = 'B'; + *(*out)++ = c/256; + *(*out)++ = c%256; + *(*out)++ = '\033'; + *(*out)++ = '('; + *(*out)++ = 'B'; + *outb -= 8; + break; + case UCS2: + totype = UCS2BE; + case UCS2BE: + case UCS2LE: + case UTF_16: + case UTF_16BE: + case UTF_16LE: + if (c < 0x10000 || totype-UCS2BE < 2U) { + if (c >= 0x10000) c = 0xFFFD; + if (*outb < 2) goto toobig; + put_16((void *)*out, c, totype); + *out += 2; + *outb -= 2; + break; + } + if (*outb < 4) goto toobig; + c -= 0x10000; + put_16((void *)*out, (c>>10)|0xd800, totype); + put_16((void *)(*out + 2), (c&0x3ff)|0xdc00, totype); + *out += 4; + *outb -= 4; + break; + case UTF_32: + totype = UTF_32BE; + case UTF_32BE: + case UTF_32LE: + if (*outb < 4) goto toobig; + put_32((void *)*out, c, totype); + *out += 4; + *outb -= 4; + break; + } + } + *ploc = loc; + return x; +ilseq: + err = EILSEQ; + x = -1; + goto end; +toobig: + err = E2BIG; + x = -1; + goto end; +starved: + err = EINVAL; + x = -1; +end: + errno = err; + *ploc = loc; + return x; +} diff --git a/Ubiquitous/XiZi/lib/musllib/src/locale/jis0208.h b/Ubiquitous/XiZi/lib/musllib/src/locale/jis0208.h new file mode 100644 index 000000000..de9c5f26a --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/locale/jis0208.h @@ -0,0 +1,563 @@ +12288,12289,12290,65292,65294,12539,65306,65307,65311,65281,12443,12444,180, +65344,168,65342,65507,65343,12541,12542,12445,12446,12291,20189,12293,12294, +12295,12540,8213,8208,65295,92,12316,8214,65372,8230,8229,8216,8217,8220,8221, +65288,65289,12308,12309,65339,65341,65371,65373,12296,12297,12298,12299,12300, +12301,12302,12303,12304,12305,65291,8722,177,215,247,65309,8800,65308,65310, +8806,8807,8734,8756,9794,9792,176,8242,8243,8451,65509,65284,162,163,65285, +65283,65286,65290,65312,167,9734,9733,9675,9679,9678,9671,9670,9633,9632,9651, +9650,9661,9660,8251,12306,8594,8592,8593,8595,12307,0,0,0,0,0,0,0,0,0,0,0, +8712,8715,8838,8839,8834,8835,8746,8745,0,0,0,0,0,0,0,0,8743,8744,172,8658, +8660,8704,8707,0,0,0,0,0,0,0,0,0,0,0,8736,8869,8978,8706,8711,8801,8786,8810, +8811,8730,8765,8733,8757,8747,8748,0,0,0,0,0,0,0,8491,8240,9839,9837,9834, +8224,8225,182,0,0,0,0,9711,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,65296,65297,65298, +65299,65300,65301,65302,65303,65304,65305,0,0,0,0,0,0,0,65313,65314,65315, +65316,65317,65318,65319,65320,65321,65322,65323,65324,65325,65326,65327,65328, +65329,65330,65331,65332,65333,65334,65335,65336,65337,65338,0,0,0,0,0,0,65345, +65346,65347, +65348,65349,65350,65351,65352,65353,65354,65355,65356,65357,65358,65359,65360, +65361,65362,65363,65364,65365,65366,65367,65368,65369,65370,0,0,0,0,12353, +12354,12355,12356,12357,12358,12359,12360,12361,12362,12363,12364,12365,12366, +12367,12368,12369,12370,12371,12372,12373,12374,12375,12376,12377,12378,12379, +12380,12381,12382,12383,12384,12385,12386,12387,12388,12389,12390,12391,12392, +12393,12394,12395,12396,12397,12398,12399,12400,12401,12402,12403,12404,12405, +12406,12407,12408,12409,12410,12411,12412,12413,12414,12415,12416,12417,12418, +12419,12420,12421,12422,12423,12424,12425,12426,12427,12428,12429,12430,12431, +12432,12433,12434,12435,0,0,0,0,0,0,0,0,0,0,0,12449,12450,12451,12452,12453, +12454,12455,12456,12457,12458,12459,12460,12461,12462,12463,12464,12465,12466, +12467,12468,12469,12470,12471,12472,12473,12474,12475,12476,12477,12478,12479, +12480,12481,12482,12483,12484,12485,12486,12487,12488,12489,12490,12491,12492, +12493,12494,12495,12496,12497,12498,12499,12500,12501,12502,12503,12504,12505, +12506,12507,12508,12509,12510,12511,12512,12513,12514,12515,12516,12517,12518, +12519,12520,12521,12522,12523,12524,12525,12526,12527,12528,12529,12530,12531, +12532,12533,12534,0,0,0,0,0,0,0,0,913,914,915,916,917,918,919,920,921,922,923, +924,925,926,927,928,929,931,932,933,934,935,936,937,0,0,0,0,0,0,0,0,945,946, +947,948,949,950,951,952,953, +954,955,956,957,958,959,960,961,963,964,965,966,967,968,969,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1040,1041,1042,1043, +1044,1045,1025,1046,1047,1048,1049,1050,1051,1052,1053,1054,1055,1056,1057, +1058,1059,1060,1061,1062,1063,1064,1065,1066,1067,1068,1069,1070,1071,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,1072,1073,1074,1075,1076,1077,1105,1078,1079,1080,1081, +1082,1083,1084,1085,1086,1087,1088,1089,1090,1091,1092,1093,1094,1095,1096, +1097,1098,1099,1100,1101,1102,1103,0,0,0,0,0,0,0,0,0,0,0,0,0,9472,9474,9484, +9488,9496,9492,9500,9516,9508,9524,9532,9473,9475,9487,9491,9499,9495,9507, +9523,9515,9531,9547,9504,9519,9512,9527,9535,9501,9520,9509,9528,9538,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,20124,21782,23043,38463,21696,24859,25384,23030, +36898,33909,33564,31312,24746,25569,28197,26093,33894,33446,39925,26771,22311, +26017,25201,23451,22992,34427,39156,32098,32190,39822,25110,31903,34999,23433, +24245,25353,26263,26696,38343,38797,26447,20197,20234,20301,20381,20553,22258, +22839,22996,23041,23561,24799,24847,24944,26131,26885,28858,30031,30064,31227, +32173,32239,32963,33806,34915,35586,36949,36986,21307,20117,20133,22495,32946, +37057,30959,19968,22769,28322,36920,31282,33576,33419,39983,20801,21360,21693, +21729,22240,23035,24341,39154,28139,32996,34093,38498,38512,38560,38907,21515, +21491,23431,28879,32701,36802,38632,21359,40284,31418,19985,30867,33276,28198, +22040,21764,27421,34074,39995,23013,21417,28006,29916,38287,22082,20113,36939, +38642,33615,39180,21473,21942,23344,24433,26144,26355,26628,27704,27891,27945, +29787,30408,31310,38964,33521,34907,35424,37613,28082,30123,30410,39365,24742, +35585,36234,38322,27022,21421,20870,22290,22576,22852,23476,24310,24616,25513, +25588,27839,28436,28814,28948,29017,29141,29503,32257,33398,33489,34199,36960, +37467,40219,22633,26044,27738,29989,20985,22830,22885,24448,24540,25276,26106, +27178,27431,27572,29579,32705,35158,40236,40206,40644,23713,27798,33659,20740, +23627,25014,33222,26742,29281,20057,20474,21368,24681,28201,31311,38899,19979, +21270,20206,20309,20285,20385,20339,21152,21487,22025,22799,23233,23478,23521, +31185,26247,26524,26550,27468,27827,28779,29634,31117,31166,31292,31623,33457, +33499,33540,33655,33775,33747,34662,35506,22057,36008,36838,36942,38686,34442, +20420,23784,25105,29273,30011,33253,33469,34558,36032,38597,39187,39381,20171, +20250,35299,22238,22602,22730,24315,24555,24618,24724,24674,25040,25106,25296, +25913,39745,26214,26800,28023,28784,30028,30342,32117,33445,34809,38283,38542, +35997,20977,21182,22806,21683,23475,23830,24936,27010,28079,30861,33995,34903, +35442,37799,39608,28012,39336,34521,22435,26623,34510,37390,21123,22151,21508, +24275,25313,25785,26684,26680,27579,29554,30906,31339,35226,35282,36203,36611, +37101,38307,38548,38761,23398,23731,27005,38989,38990,25499,31520,27179,27263, +26806,39949,28511,21106,21917,24688,25324,27963,28167,28369,33883,35088,36676, +19988,39993,21494,26907,27194,38788,26666,20828,31427,33970,37340,37772,22107, +40232,26658,33541,33841,31909,21000,33477,29926,20094, +20355,20896,23506,21002,21208,21223,24059,21914,22570,23014,23436,23448,23515, +24178,24185,24739,24863,24931,25022,25563,25954,26577,26707,26874,27454,27475, +27735,28450,28567,28485,29872,29976,30435,30475,31487,31649,31777,32233,32566, +32752,32925,33382,33694,35251,35532,36011,36996,37969,38291,38289,38306,38501, +38867,39208,33304,20024,21547,23736,24012,29609,30284,30524,23721,32747,36107, +38593,38929,38996,39000,20225,20238,21361,21916,22120,22522,22855,23305,23492, +23696,24076,24190,24524,25582,26426,26071,26082,26399,26827,26820,27231,24112, +27589,27671,27773,30079,31048,23395,31232,32000,24509,35215,35352,36020,36215, +36556,36637,39138,39438,39740,20096,20605,20736,22931,23452,25135,25216,25836, +27450,29344,30097,31047,32681,34811,35516,35696,25516,33738,38816,21513,21507, +21931,26708,27224,35440,30759,26485,40653,21364,23458,33050,34384,36870,19992, +20037,20167,20241,21450,21560,23470,24339,24613,25937,26429,27714,27762,27875, +28792,29699,31350,31406,31496,32026,31998,32102,26087,29275,21435,23621,24040, +25298,25312,25369,28192,34394,35377,36317,37624,28417,31142,39770,20136,20139, +20140,20379,20384,20689,20807,31478,20849,20982,21332,21281,21375,21483,21932, +22659,23777,24375,24394,24623,24656,24685,25375,25945,27211,27841,29378,29421, +30703,33016,33029,33288,34126,37111,37857,38911,39255,39514,20208,20957,23597, +26241,26989,23616,26354,26997,29577,26704,31873,20677,21220,22343,24062,37670, +26020,27427,27453,29748,31105,31165,31563,32202,33465,33740,34943,35167,35641, +36817,37329,21535,37504,20061,20534,21477,21306,29399, +29590,30697,33510,36527,39366,39368,39378,20855,24858,34398,21936,31354,20598, +23507,36935,38533,20018,27355,37351,23633,23624,25496,31391,27795,38772,36705, +31402,29066,38536,31874,26647,32368,26705,37740,21234,21531,34219,35347,32676, +36557,37089,21350,34952,31041,20418,20670,21009,20804,21843,22317,29674,22411, +22865,24418,24452,24693,24950,24935,25001,25522,25658,25964,26223,26690,28179, +30054,31293,31995,32076,32153,32331,32619,33550,33610,34509,35336,35427,35686, +36605,38938,40335,33464,36814,39912,21127,25119,25731,28608,38553,26689,20625, +27424,27770,28500,31348,32080,34880,35363,26376,20214,20537,20518,20581,20860, +21048,21091,21927,22287,22533,23244,24314,25010,25080,25331,25458,26908,27177, +29309,29356,29486,30740,30831,32121,30476,32937,35211,35609,36066,36562,36963, +37749,38522,38997,39443,40568,20803,21407,21427,24187,24358,28187,28304,29572, +29694,32067,33335,35328,35578,38480,20046,20491,21476,21628,22266,22993,23396, +24049,24235,24359,25144,25925,26543,28246,29392,31946,34996,32929,32993,33776, +34382,35463,36328,37431,38599,39015,40723,20116,20114,20237,21320,21577,21566, +23087,24460,24481,24735,26791,27278,29786,30849,35486,35492,35703,37264,20062, +39881,20132,20348,20399,20505,20502,20809,20844,21151,21177,21246,21402,21475, +21521,21518,21897,22353,22434,22909,23380,23389,23439,24037,24039,24055,24184, +24195,24218,24247,24344,24658,24908,25239,25304,25511,25915,26114,26179,26356, +26477,26657,26775,27083,27743,27946,28009,28207,28317,30002,30343,30828,31295, +31968,32005,32024,32094,32177,32789,32771,32943,32945, +33108,33167,33322,33618,34892,34913,35611,36002,36092,37066,37237,37489,30783, +37628,38308,38477,38917,39321,39640,40251,21083,21163,21495,21512,22741,25335, +28640,35946,36703,40633,20811,21051,21578,22269,31296,37239,40288,40658,29508, +28425,33136,29969,24573,24794,39592,29403,36796,27492,38915,20170,22256,22372, +22718,23130,24680,25031,26127,26118,26681,26801,28151,30165,32058,33390,39746, +20123,20304,21449,21766,23919,24038,24046,26619,27801,29811,30722,35408,37782, +35039,22352,24231,25387,20661,20652,20877,26368,21705,22622,22971,23472,24425, +25165,25505,26685,27507,28168,28797,37319,29312,30741,30758,31085,25998,32048, +33756,35009,36617,38555,21092,22312,26448,32618,36001,20916,22338,38442,22586, +27018,32948,21682,23822,22524,30869,40442,20316,21066,21643,25662,26152,26388, +26613,31364,31574,32034,37679,26716,39853,31545,21273,20874,21047,23519,25334, +25774,25830,26413,27578,34217,38609,30352,39894,25420,37638,39851,30399,26194, +19977,20632,21442,23665,24808,25746,25955,26719,29158,29642,29987,31639,32386, +34453,35715,36059,37240,39184,26028,26283,27531,20181,20180,20282,20351,21050, +21496,21490,21987,22235,22763,22987,22985,23039,23376,23629,24066,24107,24535, +24605,25351,25903,23388,26031,26045,26088,26525,27490,27515,27663,29509,31049, +31169,31992,32025,32043,32930,33026,33267,35222,35422,35433,35430,35468,35566, +36039,36060,38604,39164,27503,20107,20284,20365,20816,23383,23546,24904,25345, +26178,27425,28363,27835,29246,29885,30164,30913,31034,32780,32819,33258,33940, +36766,27728,40575,24335,35672,40235,31482,36600,23437, +38635,19971,21489,22519,22833,23241,23460,24713,28287,28422,30142,36074,23455, +34048,31712,20594,26612,33437,23649,34122,32286,33294,20889,23556,25448,36198, +26012,29038,31038,32023,32773,35613,36554,36974,34503,37034,20511,21242,23610, +26451,28796,29237,37196,37320,37675,33509,23490,24369,24825,20027,21462,23432, +25163,26417,27530,29417,29664,31278,33131,36259,37202,39318,20754,21463,21610, +23551,25480,27193,32172,38656,22234,21454,21608,23447,23601,24030,20462,24833, +25342,27954,31168,31179,32066,32333,32722,33261,33311,33936,34886,35186,35728, +36468,36655,36913,37195,37228,38598,37276,20160,20303,20805,21313,24467,25102, +26580,27713,28171,29539,32294,37325,37507,21460,22809,23487,28113,31069,32302, +31899,22654,29087,20986,34899,36848,20426,23803,26149,30636,31459,33308,39423, +20934,24490,26092,26991,27529,28147,28310,28516,30462,32020,24033,36981,37255, +38918,20966,21021,25152,26257,26329,28186,24246,32210,32626,26360,34223,34295, +35576,21161,21465,22899,24207,24464,24661,37604,38500,20663,20767,21213,21280, +21319,21484,21736,21830,21809,22039,22888,22974,23100,23477,23558,23567,23569, +23578,24196,24202,24288,24432,25215,25220,25307,25484,25463,26119,26124,26157, +26230,26494,26786,27167,27189,27836,28040,28169,28248,28988,28966,29031,30151, +30465,30813,30977,31077,31216,31456,31505,31911,32057,32918,33750,33931,34121, +34909,35059,35359,35388,35412,35443,35937,36062,37284,37478,37758,37912,38556, +38808,19978,19976,19998,20055,20887,21104,22478,22580,22732,23330,24120,24773, +25854,26465,26454,27972,29366,30067,31331,33976,35698, +37304,37664,22065,22516,39166,25325,26893,27542,29165,32340,32887,33394,35302, +39135,34645,36785,23611,20280,20449,20405,21767,23072,23517,23529,24515,24910, +25391,26032,26187,26862,27035,28024,28145,30003,30137,30495,31070,31206,32051, +33251,33455,34218,35242,35386,36523,36763,36914,37341,38663,20154,20161,20995, +22645,22764,23563,29978,23613,33102,35338,36805,38499,38765,31525,35535,38920, +37218,22259,21416,36887,21561,22402,24101,25512,27700,28810,30561,31883,32736, +34928,36930,37204,37648,37656,38543,29790,39620,23815,23913,25968,26530,36264, +38619,25454,26441,26905,33733,38935,38592,35070,28548,25722,23544,19990,28716, +30045,26159,20932,21046,21218,22995,24449,24615,25104,25919,25972,26143,26228, +26866,26646,27491,28165,29298,29983,30427,31934,32854,22768,35069,35199,35488, +35475,35531,36893,37266,38738,38745,25993,31246,33030,38587,24109,24796,25114, +26021,26132,26512,30707,31309,31821,32318,33034,36012,36196,36321,36447,30889, +20999,25305,25509,25666,25240,35373,31363,31680,35500,38634,32118,33292,34633, +20185,20808,21315,21344,23459,23554,23574,24029,25126,25159,25776,26643,26676, +27849,27973,27927,26579,28508,29006,29053,26059,31359,31661,32218,32330,32680, +33146,33307,33337,34214,35438,36046,36341,36984,36983,37549,37521,38275,39854, +21069,21892,28472,28982,20840,31109,32341,33203,31950,22092,22609,23720,25514, +26366,26365,26970,29401,30095,30094,30990,31062,31199,31895,32032,32068,34311, +35380,38459,36961,40736,20711,21109,21452,21474,20489,21930,22766,22863,29245, +23435,23652,21277,24803,24819,25436,25475,25407,25531, +25805,26089,26361,24035,27085,27133,28437,29157,20105,30185,30456,31379,31967, +32207,32156,32865,33609,33624,33900,33980,34299,35013,36208,36865,36973,37783, +38684,39442,20687,22679,24974,33235,34101,36104,36896,20419,20596,21063,21363, +24687,25417,26463,28204,36275,36895,20439,23646,36042,26063,32154,21330,34966, +20854,25539,23384,23403,23562,25613,26449,36956,20182,22810,22826,27760,35409, +21822,22549,22949,24816,25171,26561,33333,26965,38464,39364,39464,20307,22534, +23550,32784,23729,24111,24453,24608,24907,25140,26367,27888,28382,32974,33151, +33492,34955,36024,36864,36910,38538,40667,39899,20195,21488,22823,31532,37261, +38988,40441,28381,28711,21331,21828,23429,25176,25246,25299,27810,28655,29730, +35351,37944,28609,35582,33592,20967,34552,21482,21481,20294,36948,36784,22890, +33073,24061,31466,36799,26842,35895,29432,40008,27197,35504,20025,21336,22022, +22374,25285,25506,26086,27470,28129,28251,28845,30701,31471,31658,32187,32829, +32966,34507,35477,37723,22243,22727,24382,26029,26262,27264,27573,30007,35527, +20516,30693,22320,24347,24677,26234,27744,30196,31258,32622,33268,34584,36933, +39347,31689,30044,31481,31569,33988,36880,31209,31378,33590,23265,30528,20013, +20210,23449,24544,25277,26172,26609,27880,34411,34935,35387,37198,37619,39376, +27159,28710,29482,33511,33879,36015,19969,20806,20939,21899,23541,24086,24115, +24193,24340,24373,24427,24500,25074,25361,26274,26397,28526,29266,30010,30522, +32884,33081,33144,34678,35519,35548,36229,36339,37530,38263,38914,40165,21189, +25431,30452,26389,27784,29645,36035,37806,38515,27941, +22684,26894,27084,36861,37786,30171,36890,22618,26626,25524,27131,20291,28460, +26584,36795,34086,32180,37716,26943,28528,22378,22775,23340,32044,29226,21514, +37347,40372,20141,20302,20572,20597,21059,35998,21576,22564,23450,24093,24213, +24237,24311,24351,24716,25269,25402,25552,26799,27712,30855,31118,31243,32224, +33351,35330,35558,36420,36883,37048,37165,37336,40718,27877,25688,25826,25973, +28404,30340,31515,36969,37841,28346,21746,24505,25764,36685,36845,37444,20856, +22635,22825,23637,24215,28155,32399,29980,36028,36578,39003,28857,20253,27583, +28593,30000,38651,20814,21520,22581,22615,22956,23648,24466,26007,26460,28193, +30331,33759,36077,36884,37117,37709,30757,30778,21162,24230,22303,22900,24594, +20498,20826,20908,20941,20992,21776,22612,22616,22871,23445,23798,23947,24764, +25237,25645,26481,26691,26812,26847,30423,28120,28271,28059,28783,29128,24403, +30168,31095,31561,31572,31570,31958,32113,21040,33891,34153,34276,35342,35588, +35910,36367,36867,36879,37913,38518,38957,39472,38360,20685,21205,21516,22530, +23566,24999,25758,27934,30643,31461,33012,33796,36947,37509,23776,40199,21311, +24471,24499,28060,29305,30563,31167,31716,27602,29420,35501,26627,27233,20984, +31361,26932,23626,40182,33515,23493,37193,28702,22136,23663,24775,25958,27788, +35930,36929,38931,21585,26311,37389,22856,37027,20869,20045,20970,34201,35598, +28760,25466,37707,26978,39348,32260,30071,21335,26976,36575,38627,27741,20108, +23612,24336,36841,21250,36049,32905,34425,24319,26085,20083,20837,22914,23615, +38894,20219,22922,24525,35469,28641,31152,31074,23527, +33905,29483,29105,24180,24565,25467,25754,29123,31896,20035,24316,20043,22492, +22178,24745,28611,32013,33021,33075,33215,36786,35223,34468,24052,25226,25773, +35207,26487,27874,27966,29750,30772,23110,32629,33453,39340,20467,24259,25309, +25490,25943,26479,30403,29260,32972,32954,36649,37197,20493,22521,23186,26757, +26995,29028,29437,36023,22770,36064,38506,36889,34687,31204,30695,33833,20271, +21093,21338,25293,26575,27850,30333,31636,31893,33334,34180,36843,26333,28448, +29190,32283,33707,39361,40614,20989,31665,30834,31672,32903,31560,27368,24161, +32908,30033,30048,20843,37474,28300,30330,37271,39658,20240,32624,25244,31567, +38309,40169,22138,22617,34532,38588,20276,21028,21322,21453,21467,24070,25644, +26001,26495,27710,27726,29256,29359,29677,30036,32321,33324,34281,36009,31684, +37318,29033,38930,39151,25405,26217,30058,30436,30928,34115,34542,21290,21329, +21542,22915,24199,24444,24754,25161,25209,25259,26000,27604,27852,30130,30382, +30865,31192,32203,32631,32933,34987,35513,36027,36991,38750,39131,27147,31800, +20633,23614,24494,26503,27608,29749,30473,32654,40763,26570,31255,21305,30091, +39661,24422,33181,33777,32920,24380,24517,30050,31558,36924,26727,23019,23195, +32016,30334,35628,20469,24426,27161,27703,28418,29922,31080,34920,35413,35961, +24287,25551,30149,31186,33495,37672,37618,33948,34541,39981,21697,24428,25996, +27996,28693,36007,36051,38971,25935,29942,19981,20184,22496,22827,23142,23500, +20904,24067,24220,24598,25206,25975,26023,26222,28014,29238,31526,33104,33178, +33433,35676,36000,36070,36212,38428,38468,20398,25771, +27494,33310,33889,34154,37096,23553,26963,39080,33914,34135,20239,21103,24489, +24133,26381,31119,33145,35079,35206,28149,24343,25173,27832,20175,29289,39826, +20998,21563,22132,22707,24996,25198,28954,22894,31881,31966,32027,38640,25991, +32862,19993,20341,20853,22592,24163,24179,24330,26564,20006,34109,38281,38491, +31859,38913,20731,22721,30294,30887,21029,30629,34065,31622,20559,22793,29255, +31687,32232,36794,36820,36941,20415,21193,23081,24321,38829,20445,33303,37610, +22275,25429,27497,29995,35036,36628,31298,21215,22675,24917,25098,26286,27597, +31807,33769,20515,20472,21253,21574,22577,22857,23453,23792,23791,23849,24214, +25265,25447,25918,26041,26379,27861,27873,28921,30770,32299,32990,33459,33804, +34028,34562,35090,35370,35914,37030,37586,39165,40179,40300,20047,20129,20621, +21078,22346,22952,24125,24536,24537,25151,26292,26395,26576,26834,20882,32033, +32938,33192,35584,35980,36031,37502,38450,21536,38956,21271,20693,21340,22696, +25778,26420,29287,30566,31302,37350,21187,27809,27526,22528,24140,22868,26412, +32763,20961,30406,25705,30952,39764,40635,22475,22969,26151,26522,27598,21737, +27097,24149,33180,26517,39850,26622,40018,26717,20134,20451,21448,25273,26411, +27819,36804,20397,32365,40639,19975,24930,28288,28459,34067,21619,26410,39749, +24051,31637,23724,23494,34588,28234,34001,31252,33032,22937,31885,27665,30496, +21209,22818,28961,29279,30683,38695,40289,26891,23167,23064,20901,21517,21629, +26126,30431,36855,37528,40180,23018,29277,28357,20813,26825,32191,32236,38754, +40634,25720,27169,33538,22916,23391,27611,29467,30450, +32178,32791,33945,20786,26408,40665,30446,26466,21247,39173,23588,25147,31870, +36016,21839,24758,32011,38272,21249,20063,20918,22812,29242,32822,37326,24357, +30690,21380,24441,32004,34220,35379,36493,38742,26611,34222,37971,24841,24840, +27833,30290,35565,36664,21807,20305,20778,21191,21451,23461,24189,24736,24962, +25558,26377,26586,28263,28044,29494,29495,30001,31056,35029,35480,36938,37009, +37109,38596,34701,22805,20104,20313,19982,35465,36671,38928,20653,24188,22934, +23481,24248,25562,25594,25793,26332,26954,27096,27915,28342,29076,29992,31407, +32650,32768,33865,33993,35201,35617,36362,36965,38525,39178,24958,25233,27442, +27779,28020,32716,32764,28096,32645,34746,35064,26469,33713,38972,38647,27931, +32097,33853,37226,20081,21365,23888,27396,28651,34253,34349,35239,21033,21519, +23653,26446,26792,29702,29827,30178,35023,35041,37324,38626,38520,24459,29575, +31435,33870,25504,30053,21129,27969,28316,29705,30041,30827,31890,38534,31452, +40845,20406,24942,26053,34396,20102,20142,20698,20001,20940,23534,26009,26753, +28092,29471,30274,30637,31260,31975,33391,35538,36988,37327,38517,38936,21147, +32209,20523,21400,26519,28107,29136,29747,33256,36650,38563,40023,40607,29792, +22593,28057,32047,39006,20196,20278,20363,20919,21169,23994,24604,29618,31036, +33491,37428,38583,38646,38666,40599,40802,26278,27508,21015,21155,28872,35010, +24265,24651,24976,28451,29001,31806,32244,32879,34030,36899,37676,21570,39791, +27347,28809,36034,36335,38706,21172,23105,24266,24324,26391,27004,27028,28010, +28431,29282,29436,31725,32769,32894,34635,37070,20845, +40595,31108,32907,37682,35542,20525,21644,35441,27498,36036,33031,24785,26528, +40434,20121,20120,39952,35435,34241,34152,26880,28286,30871,33109,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +24332,19984,19989,20010,20017,20022,20028,20031,20034,20054,20056,20098,20101, +35947,20106,33298,24333,20110,20126,20127,20128,20130,20144,20147,20150,20174, +20173,20164,20166,20162,20183,20190,20205,20191,20215,20233,20314,20272,20315, +20317,20311,20295,20342,20360,20367,20376,20347,20329,20336,20369,20335,20358, +20374,20760,20436,20447,20430,20440,20443,20433,20442,20432,20452,20453,20506, +20520,20500,20522,20517,20485,20252,20470,20513,20521,20524,20478,20463,20497, +20486,20547,20551,26371,20565,20560,20552,20570,20566,20588,20600,20608,20634, +20613,20660,20658,20681,20682,20659,20674,20694,20702,20709,20717,20707,20718, +20729,20725,20745,20737,20738,20758,20757,20756,20762,20769,20794,20791,20796, +20795,20799,20800,20818,20812,20820,20834,31480,20841,20842,20846,20864,20866, +22232,20876,20873,20879,20881,20883,20885,20886,20900,20902,20898,20905,20906, +20907,20915,20913,20914,20912,20917,20925,20933,20937,20955,20960,34389,20969, +20973,20976,20981,20990,20996,21003,21012,21006,21031,21034,21038,21043,21049, +21071,21060,21067,21068,21086,21076,21098,21108,21097,21107,21119,21117,21133, +21140,21138,21105,21128,21137,36776,36775, +21164,21165,21180,21173,21185,21197,21207,21214,21219,21222,39149,21216,21235, +21237,21240,21241,21254,21256,30008,21261,21264,21263,21269,21274,21283,21295, +21297,21299,21304,21312,21318,21317,19991,21321,21325,20950,21342,21353,21358, +22808,21371,21367,21378,21398,21408,21414,21413,21422,21424,21430,21443,31762, +38617,21471,26364,29166,21486,21480,21485,21498,21505,21565,21568,21548,21549, +21564,21550,21558,21545,21533,21582,21647,21621,21646,21599,21617,21623,21616, +21650,21627,21632,21622,21636,21648,21638,21703,21666,21688,21669,21676,21700, +21704,21672,21675,21698,21668,21694,21692,21720,21733,21734,21775,21780,21757, +21742,21741,21754,21730,21817,21824,21859,21836,21806,21852,21829,21846,21847, +21816,21811,21853,21913,21888,21679,21898,21919,21883,21886,21912,21918,21934, +21884,21891,21929,21895,21928,21978,21957,21983,21956,21980,21988,21972,22036, +22007,22038,22014,22013,22043,22009,22094,22096,29151,22068,22070,22066,22072, +22123,22116,22063,22124,22122,22150,22144,22154,22176,22164,22159,22181,22190, +22198,22196,22210,22204,22209,22211,22208,22216,22222,22225,22227,22231,22254, +22265,22272,22271,22276,22281,22280,22283,22285,22291,22296,22294,21959,22300, +22310,22327,22328,22350,22331,22336,22351,22377,22464,22408,22369,22399,22409, +22419,22432,22451,22436,22442,22448,22467,22470,22484,22482,22483,22538,22486, +22499,22539,22553,22557,22642,22561,22626,22603,22640,27584,22610,22589,22649, +22661,22713,22687,22699,22714,22750,22715,22712,22702,22725,22739,22737,22743, +22745,22744,22757,22748,22756,22751,22767,22778,22777, +22779,22780,22781,22786,22794,22800,22811,26790,22821,22828,22829,22834,22840, +22846,31442,22869,22864,22862,22874,22872,22882,22880,22887,22892,22889,22904, +22913,22941,20318,20395,22947,22962,22982,23016,23004,22925,23001,23002,23077, +23071,23057,23068,23049,23066,23104,23148,23113,23093,23094,23138,23146,23194, +23228,23230,23243,23234,23229,23267,23255,23270,23273,23254,23290,23291,23308, +23307,23318,23346,23248,23338,23350,23358,23363,23365,23360,23377,23381,23386, +23387,23397,23401,23408,23411,23413,23416,25992,23418,23424,23427,23462,23480, +23491,23495,23497,23508,23504,23524,23526,23522,23518,23525,23531,23536,23542, +23539,23557,23559,23560,23565,23571,23584,23586,23592,23608,23609,23617,23622, +23630,23635,23632,23631,23409,23660,23662,20066,23670,23673,23692,23697,23700, +22939,23723,23739,23734,23740,23735,23749,23742,23751,23769,23785,23805,23802, +23789,23948,23786,23819,23829,23831,23900,23839,23835,23825,23828,23842,23834, +23833,23832,23884,23890,23886,23883,23916,23923,23926,23943,23940,23938,23970, +23965,23980,23982,23997,23952,23991,23996,24009,24013,24019,24018,24022,24027, +24043,24050,24053,24075,24090,24089,24081,24091,24118,24119,24132,24131,24128, +24142,24151,24148,24159,24162,24164,24135,24181,24182,24186,40636,24191,24224, +24257,24258,24264,24272,24271,24278,24291,24285,24282,24283,24290,24289,24296, +24297,24300,24305,24307,24304,24308,24312,24318,24323,24329,24413,24412,24331, +24337,24342,24361,24365,24376,24385,24392,24396,24398,24367,24401,24406,24407, +24409,24417,24429,24435,24439,24451,24450,24447,24458, +24456,24465,24455,24478,24473,24472,24480,24488,24493,24508,24534,24571,24548, +24568,24561,24541,24755,24575,24609,24672,24601,24592,24617,24590,24625,24603, +24597,24619,24614,24591,24634,24666,24641,24682,24695,24671,24650,24646,24653, +24675,24643,24676,24642,24684,24683,24665,24705,24717,24807,24707,24730,24708, +24731,24726,24727,24722,24743,24715,24801,24760,24800,24787,24756,24560,24765, +24774,24757,24792,24909,24853,24838,24822,24823,24832,24820,24826,24835,24865, +24827,24817,24845,24846,24903,24894,24872,24871,24906,24895,24892,24876,24884, +24893,24898,24900,24947,24951,24920,24921,24922,24939,24948,24943,24933,24945, +24927,24925,24915,24949,24985,24982,24967,25004,24980,24986,24970,24977,25003, +25006,25036,25034,25033,25079,25032,25027,25030,25018,25035,32633,25037,25062, +25059,25078,25082,25076,25087,25085,25084,25086,25088,25096,25097,25101,25100, +25108,25115,25118,25121,25130,25134,25136,25138,25139,25153,25166,25182,25187, +25179,25184,25192,25212,25218,25225,25214,25234,25235,25238,25300,25219,25236, +25303,25297,25275,25295,25343,25286,25812,25288,25308,25292,25290,25282,25287, +25243,25289,25356,25326,25329,25383,25346,25352,25327,25333,25424,25406,25421, +25628,25423,25494,25486,25472,25515,25462,25507,25487,25481,25503,25525,25451, +25449,25534,25577,25536,25542,25571,25545,25554,25590,25540,25622,25652,25606, +25619,25638,25654,25885,25623,25640,25615,25703,25711,25718,25678,25898,25749, +25747,25765,25769,25736,25788,25818,25810,25797,25799,25787,25816,25794,25841, +25831,33289,25824,25825,25260,25827,25839,25900,25846, +25844,25842,25850,25856,25853,25880,25884,25861,25892,25891,25899,25908,25909, +25911,25910,25912,30027,25928,25942,25941,25933,25944,25950,25949,25970,25976, +25986,25987,35722,26011,26015,26027,26039,26051,26054,26049,26052,26060,26066, +26075,26073,26080,26081,26097,26482,26122,26115,26107,26483,26165,26166,26164, +26140,26191,26180,26185,26177,26206,26205,26212,26215,26216,26207,26210,26224, +26243,26248,26254,26249,26244,26264,26269,26305,26297,26313,26302,26300,26308, +26296,26326,26330,26336,26175,26342,26345,26352,26357,26359,26383,26390,26398, +26406,26407,38712,26414,26431,26422,26433,26424,26423,26438,26462,26464,26457, +26467,26468,26505,26480,26537,26492,26474,26508,26507,26534,26529,26501,26551, +26607,26548,26604,26547,26601,26552,26596,26590,26589,26594,26606,26553,26574, +26566,26599,27292,26654,26694,26665,26688,26701,26674,26702,26803,26667,26713, +26723,26743,26751,26783,26767,26797,26772,26781,26779,26755,27310,26809,26740, +26805,26784,26810,26895,26765,26750,26881,26826,26888,26840,26914,26918,26849, +26892,26829,26836,26855,26837,26934,26898,26884,26839,26851,26917,26873,26848, +26863,26920,26922,26906,26915,26913,26822,27001,26999,26972,27000,26987,26964, +27006,26990,26937,26996,26941,26969,26928,26977,26974,26973,27009,26986,27058, +27054,27088,27071,27073,27091,27070,27086,23528,27082,27101,27067,27075,27047, +27182,27025,27040,27036,27029,27060,27102,27112,27138,27163,27135,27402,27129, +27122,27111,27141,27057,27166,27117,27156,27115,27146,27154,27329,27171,27155, +27204,27148,27250,27190,27256,27207,27234,27225,27238, +27208,27192,27170,27280,27277,27296,27268,27298,27299,27287,34327,27323,27331, +27330,27320,27315,27308,27358,27345,27359,27306,27354,27370,27387,27397,34326, +27386,27410,27414,39729,27423,27448,27447,30428,27449,39150,27463,27459,27465, +27472,27481,27476,27483,27487,27489,27512,27513,27519,27520,27524,27523,27533, +27544,27541,27550,27556,27562,27563,27567,27570,27569,27571,27575,27580,27590, +27595,27603,27615,27628,27627,27635,27631,40638,27656,27667,27668,27675,27684, +27683,27742,27733,27746,27754,27778,27789,27802,27777,27803,27774,27752,27763, +27794,27792,27844,27889,27859,27837,27863,27845,27869,27822,27825,27838,27834, +27867,27887,27865,27882,27935,34893,27958,27947,27965,27960,27929,27957,27955, +27922,27916,28003,28051,28004,27994,28025,27993,28046,28053,28644,28037,28153, +28181,28170,28085,28103,28134,28088,28102,28140,28126,28108,28136,28114,28101, +28154,28121,28132,28117,28138,28142,28205,28270,28206,28185,28274,28255,28222, +28195,28267,28203,28278,28237,28191,28227,28218,28238,28196,28415,28189,28216, +28290,28330,28312,28361,28343,28371,28349,28335,28356,28338,28372,28373,28303, +28325,28354,28319,28481,28433,28748,28396,28408,28414,28479,28402,28465,28399, +28466,28364,28478,28435,28407,28550,28538,28536,28545,28544,28527,28507,28659, +28525,28546,28540,28504,28558,28561,28610,28518,28595,28579,28577,28580,28601, +28614,28586,28639,28629,28652,28628,28632,28657,28654,28635,28681,28683,28666, +28689,28673,28687,28670,28699,28698,28532,28701,28696,28703,28720,28734,28722, +28753,28771,28825,28818,28847,28913,28844,28856,28851, +28846,28895,28875,28893,28889,28937,28925,28956,28953,29029,29013,29064,29030, +29026,29004,29014,29036,29071,29179,29060,29077,29096,29100,29143,29113,29118, +29138,29129,29140,29134,29152,29164,29159,29173,29180,29177,29183,29197,29200, +29211,29224,29229,29228,29232,29234,29243,29244,29247,29248,29254,29259,29272, +29300,29310,29314,29313,29319,29330,29334,29346,29351,29369,29362,29379,29382, +29380,29390,29394,29410,29408,29409,29433,29431,20495,29463,29450,29468,29462, +29469,29492,29487,29481,29477,29502,29518,29519,40664,29527,29546,29544,29552, +29560,29557,29563,29562,29640,29619,29646,29627,29632,29669,29678,29662,29858, +29701,29807,29733,29688,29746,29754,29781,29759,29791,29785,29761,29788,29801, +29808,29795,29802,29814,29822,29835,29854,29863,29898,29903,29908,29681,29920, +29923,29927,29929,29934,29938,29936,29937,29944,29943,29956,29955,29957,29964, +29966,29965,29973,29971,29982,29990,29996,30012,30020,30029,30026,30025,30043, +30022,30042,30057,30052,30055,30059,30061,30072,30070,30086,30087,30068,30090, +30089,30082,30100,30106,30109,30117,30115,30146,30131,30147,30133,30141,30136, +30140,30129,30157,30154,30162,30169,30179,30174,30206,30207,30204,30209,30192, +30202,30194,30195,30219,30221,30217,30239,30247,30240,30241,30242,30244,30260, +30256,30267,30279,30280,30278,30300,30296,30305,30306,30312,30313,30314,30311, +30316,30320,30322,30326,30328,30332,30336,30339,30344,30347,30350,30358,30355, +30361,30362,30384,30388,30392,30393,30394,30402,30413,30422,30418,30430,30433, +30437,30439,30442,34351,30459,30472,30471,30468,30505, +30500,30494,30501,30502,30491,30519,30520,30535,30554,30568,30571,30555,30565, +30591,30590,30585,30606,30603,30609,30624,30622,30640,30646,30649,30655,30652, +30653,30651,30663,30669,30679,30682,30684,30691,30702,30716,30732,30738,31014, +30752,31018,30789,30862,30836,30854,30844,30874,30860,30883,30901,30890,30895, +30929,30918,30923,30932,30910,30908,30917,30922,30956,30951,30938,30973,30964, +30983,30994,30993,31001,31020,31019,31040,31072,31063,31071,31066,31061,31059, +31098,31103,31114,31133,31143,40779,31146,31150,31155,31161,31162,31177,31189, +31207,31212,31201,31203,31240,31245,31256,31257,31264,31263,31104,31281,31291, +31294,31287,31299,31319,31305,31329,31330,31337,40861,31344,31353,31357,31368, +31383,31381,31384,31382,31401,31432,31408,31414,31429,31428,31423,36995,31431, +31434,31437,31439,31445,31443,31449,31450,31453,31457,31458,31462,31469,31472, +31490,31503,31498,31494,31539,31512,31513,31518,31541,31528,31542,31568,31610, +31492,31565,31499,31564,31557,31605,31589,31604,31591,31600,31601,31596,31598, +31645,31640,31647,31629,31644,31642,31627,31634,31631,31581,31641,31691,31681, +31692,31695,31668,31686,31709,31721,31761,31764,31718,31717,31840,31744,31751, +31763,31731,31735,31767,31757,31734,31779,31783,31786,31775,31799,31787,31805, +31820,31811,31828,31823,31808,31824,31832,31839,31844,31830,31845,31852,31861, +31875,31888,31908,31917,31906,31915,31905,31912,31923,31922,31921,31918,31929, +31933,31936,31941,31938,31960,31954,31964,31970,39739,31983,31986,31988,31990, +31994,32006,32002,32028,32021,32010,32069,32075,32046, +32050,32063,32053,32070,32115,32086,32078,32114,32104,32110,32079,32099,32147, +32137,32091,32143,32125,32155,32186,32174,32163,32181,32199,32189,32171,32317, +32162,32175,32220,32184,32159,32176,32216,32221,32228,32222,32251,32242,32225, +32261,32266,32291,32289,32274,32305,32287,32265,32267,32290,32326,32358,32315, +32309,32313,32323,32311,32306,32314,32359,32349,32342,32350,32345,32346,32377, +32362,32361,32380,32379,32387,32213,32381,36782,32383,32392,32393,32396,32402, +32400,32403,32404,32406,32398,32411,32412,32568,32570,32581,32588,32589,32590, +32592,32593,32597,32596,32600,32607,32608,32616,32617,32615,32632,32642,32646, +32643,32648,32647,32652,32660,32670,32669,32666,32675,32687,32690,32697,32686, +32694,32696,35697,32709,32710,32714,32725,32724,32737,32742,32745,32755,32761, +39132,32774,32772,32779,32786,32792,32793,32796,32801,32808,32831,32827,32842, +32838,32850,32856,32858,32863,32866,32872,32883,32882,32880,32886,32889,32893, +32895,32900,32902,32901,32923,32915,32922,32941,20880,32940,32987,32997,32985, +32989,32964,32986,32982,33033,33007,33009,33051,33065,33059,33071,33099,38539, +33094,33086,33107,33105,33020,33137,33134,33125,33126,33140,33155,33160,33162, +33152,33154,33184,33173,33188,33187,33119,33171,33193,33200,33205,33214,33208, +33213,33216,33218,33210,33225,33229,33233,33241,33240,33224,33242,33247,33248, +33255,33274,33275,33278,33281,33282,33285,33287,33290,33293,33296,33302,33321, +33323,33336,33331,33344,33369,33368,33373,33370,33375,33380,33378,33384,33386, +33387,33326,33393,33399,33400,33406,33421,33426,33451, +33439,33467,33452,33505,33507,33503,33490,33524,33523,33530,33683,33539,33531, +33529,33502,33542,33500,33545,33497,33589,33588,33558,33586,33585,33600,33593, +33616,33605,33583,33579,33559,33560,33669,33690,33706,33695,33698,33686,33571, +33678,33671,33674,33660,33717,33651,33653,33696,33673,33704,33780,33811,33771, +33742,33789,33795,33752,33803,33729,33783,33799,33760,33778,33805,33826,33824, +33725,33848,34054,33787,33901,33834,33852,34138,33924,33911,33899,33965,33902, +33922,33897,33862,33836,33903,33913,33845,33994,33890,33977,33983,33951,34009, +33997,33979,34010,34000,33985,33990,34006,33953,34081,34047,34036,34071,34072, +34092,34079,34069,34068,34044,34112,34147,34136,34120,34113,34306,34123,34133, +34176,34212,34184,34193,34186,34216,34157,34196,34203,34282,34183,34204,34167, +34174,34192,34249,34234,34255,34233,34256,34261,34269,34277,34268,34297,34314, +34323,34315,34302,34298,34310,34338,34330,34352,34367,34381,20053,34388,34399, +34407,34417,34451,34467,34473,34474,34443,34444,34486,34479,34500,34502,34480, +34505,34851,34475,34516,34526,34537,34540,34527,34523,34543,34578,34566,34568, +34560,34563,34555,34577,34569,34573,34553,34570,34612,34623,34615,34619,34597, +34601,34586,34656,34655,34680,34636,34638,34676,34647,34664,34670,34649,34643, +34659,34666,34821,34722,34719,34690,34735,34763,34749,34752,34768,38614,34731, +34756,34739,34759,34758,34747,34799,34802,34784,34831,34829,34814,34806,34807, +34830,34770,34833,34838,34837,34850,34849,34865,34870,34873,34855,34875,34884, +34882,34898,34905,34910,34914,34923,34945,34942,34974, +34933,34941,34997,34930,34946,34967,34962,34990,34969,34978,34957,34980,34992, +35007,34993,35011,35012,35028,35032,35033,35037,35065,35074,35068,35060,35048, +35058,35076,35084,35082,35091,35139,35102,35109,35114,35115,35137,35140,35131, +35126,35128,35148,35101,35168,35166,35174,35172,35181,35178,35183,35188,35191, +35198,35203,35208,35210,35219,35224,35233,35241,35238,35244,35247,35250,35258, +35261,35263,35264,35290,35292,35293,35303,35316,35320,35331,35350,35344,35340, +35355,35357,35365,35382,35393,35419,35410,35398,35400,35452,35437,35436,35426, +35461,35458,35460,35496,35489,35473,35493,35494,35482,35491,35524,35533,35522, +35546,35563,35571,35559,35556,35569,35604,35552,35554,35575,35550,35547,35596, +35591,35610,35553,35606,35600,35607,35616,35635,38827,35622,35627,35646,35624, +35649,35660,35663,35662,35657,35670,35675,35674,35691,35679,35692,35695,35700, +35709,35712,35724,35726,35730,35731,35734,35737,35738,35898,35905,35903,35912, +35916,35918,35920,35925,35938,35948,35960,35962,35970,35977,35973,35978,35981, +35982,35988,35964,35992,25117,36013,36010,36029,36018,36019,36014,36022,36040, +36033,36068,36067,36058,36093,36090,36091,36100,36101,36106,36103,36111,36109, +36112,40782,36115,36045,36116,36118,36199,36205,36209,36211,36225,36249,36290, +36286,36282,36303,36314,36310,36300,36315,36299,36330,36331,36319,36323,36348, +36360,36361,36351,36381,36382,36368,36383,36418,36405,36400,36404,36426,36423, +36425,36428,36432,36424,36441,36452,36448,36394,36451,36437,36470,36466,36476, +36481,36487,36485,36484,36491,36490,36499,36497,36500, +36505,36522,36513,36524,36528,36550,36529,36542,36549,36552,36555,36571,36579, +36604,36603,36587,36606,36618,36613,36629,36626,36633,36627,36636,36639,36635, +36620,36646,36659,36667,36665,36677,36674,36670,36684,36681,36678,36686,36695, +36700,36706,36707,36708,36764,36767,36771,36781,36783,36791,36826,36837,36834, +36842,36847,36999,36852,36869,36857,36858,36881,36885,36897,36877,36894,36886, +36875,36903,36918,36917,36921,36856,36943,36944,36945,36946,36878,36937,36926, +36950,36952,36958,36968,36975,36982,38568,36978,36994,36989,36993,36992,37002, +37001,37007,37032,37039,37041,37045,37090,37092,25160,37083,37122,37138,37145, +37170,37168,37194,37206,37208,37219,37221,37225,37235,37234,37259,37257,37250, +37282,37291,37295,37290,37301,37300,37306,37312,37313,37321,37323,37328,37334, +37343,37345,37339,37372,37365,37366,37406,37375,37396,37420,37397,37393,37470, +37463,37445,37449,37476,37448,37525,37439,37451,37456,37532,37526,37523,37531, +37466,37583,37561,37559,37609,37647,37626,37700,37678,37657,37666,37658,37667, +37690,37685,37691,37724,37728,37756,37742,37718,37808,37804,37805,37780,37817, +37846,37847,37864,37861,37848,37827,37853,37840,37832,37860,37914,37908,37907, +37891,37895,37904,37942,37931,37941,37921,37946,37953,37970,37956,37979,37984, +37986,37982,37994,37417,38000,38005,38007,38013,37978,38012,38014,38017,38015, +38274,38279,38282,38292,38294,38296,38297,38304,38312,38311,38317,38332,38331, +38329,38334,38346,28662,38339,38349,38348,38357,38356,38358,38364,38369,38373, +38370,38433,38440,38446,38447,38466,38476,38479,38475, +38519,38492,38494,38493,38495,38502,38514,38508,38541,38552,38549,38551,38570, +38567,38577,38578,38576,38580,38582,38584,38585,38606,38603,38601,38605,35149, +38620,38669,38613,38649,38660,38662,38664,38675,38670,38673,38671,38678,38681, +38692,38698,38704,38713,38717,38718,38724,38726,38728,38722,38729,38748,38752, +38756,38758,38760,21202,38763,38769,38777,38789,38780,38785,38778,38790,38795, +38799,38800,38812,38824,38822,38819,38835,38836,38851,38854,38856,38859,38876, +38893,40783,38898,31455,38902,38901,38927,38924,38968,38948,38945,38967,38973, +38982,38991,38987,39019,39023,39024,39025,39028,39027,39082,39087,39089,39094, +39108,39107,39110,39145,39147,39171,39177,39186,39188,39192,39201,39197,39198, +39204,39200,39212,39214,39229,39230,39234,39241,39237,39248,39243,39249,39250, +39244,39253,39319,39320,39333,39341,39342,39356,39391,39387,39389,39384,39377, +39405,39406,39409,39410,39419,39416,39425,39439,39429,39394,39449,39467,39479, +39493,39490,39488,39491,39486,39509,39501,39515,39511,39519,39522,39525,39524, +39529,39531,39530,39597,39600,39612,39616,39631,39633,39635,39636,39646,39647, +39650,39651,39654,39663,39659,39662,39668,39665,39671,39675,39686,39704,39706, +39711,39714,39715,39717,39719,39720,39721,39722,39726,39727,39730,39748,39747, +39759,39757,39758,39761,39768,39796,39827,39811,39825,39830,39831,39839,39840, +39848,39860,39872,39882,39865,39878,39887,39889,39890,39907,39906,39908,39892, +39905,39994,39922,39921,39920,39957,39956,39945,39955,39948,39942,39944,39954, +39946,39940,39982,39963,39973,39972,39969,39984,40007, +39986,40006,39998,40026,40032,40039,40054,40056,40167,40172,40176,40201,40200, +40171,40195,40198,40234,40230,40367,40227,40223,40260,40213,40210,40257,40255, +40254,40262,40264,40285,40286,40292,40273,40272,40281,40306,40329,40327,40363, +40303,40314,40346,40356,40361,40370,40388,40385,40379,40376,40378,40390,40399, +40386,40409,40403,40440,40422,40429,40431,40445,40474,40475,40478,40565,40569, +40573,40577,40584,40587,40588,40594,40597,40593,40605,40613,40617,40632,40618, +40621,38753,40652,40654,40655,40656,40660,40668,40670,40669,40672,40677,40680, +40687,40692,40694,40695,40697,40699,40700,40701,40711,40712,30391,40725,40737, +40748,40766,40778,40786,40788,40803,40799,40800,40801,40806,40807,40812,40810, +40823,40818,40822,40853,40860,40864,22575,27079,36953,29796,20956,29081,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0, diff --git a/Ubiquitous/XiZi/lib/musllib/src/locale/ksc.h b/Ubiquitous/XiZi/lib/musllib/src/locale/ksc.h new file mode 100644 index 000000000..cf2ec6890 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/locale/ksc.h @@ -0,0 +1,650 @@ +12288,12289,12290,183,8229,8230,168,12291,173,8213,8741,65340,8764,8216,8217, +8220,8221,12308,12309,12296,12297,12298,12299,12300,12301,12302,12303,12304, +12305,177,215,247,8800,8804,8805,8734,8756,176,8242,8243,8451,8491,65504, +65505,65509,9794,9792,8736,8869,8978,8706,8711,8801,8786,167,8251,9734,9733, +9675,9679,9678,9671,9670,9633,9632,9651,9650,9661,9660,8594,8592,8593,8595, +8596,12307,8810,8811,8730,8765,8733,8757,8747,8748,8712,8715,8838,8839,8834, +8835,8746,8745,8743,8744,65506,8658,8660,8704,8707,180,65374,711,728,733,730, +729,184,731,161,191,720,8750,8721,8719,164,8457,8240,9665,9664,9655,9654,9828, +9824,9825,9829,9831,9827,8857,9672,9635,9680,9681,9618,9636,9637,9640,9639, +9638,9641,9832,9743,9742,9756,9758,182,8224,8225,8597,8599,8601,8598,8600, +9837,9833,9834,9836,12927,12828,8470,13255,8482,13250,13272,8481,8364,174,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,65281,65282,65283,65284,65285,65286, +65287,65288,65289,65290,65291,65292,65293,65294,65295,65296,65297,65298,65299, +65300,65301,65302,65303,65304,65305,65306,65307,65308,65309,65310,65311,65312, +65313,65314,65315,65316,65317,65318,65319,65320,65321,65322,65323,65324,65325, +65326,65327,65328,65329,65330,65331,65332,65333,65334,65335,65336,65337,65338, +65339,65510,65341,65342,65343,65344,65345,65346,65347, +65348,65349,65350,65351,65352,65353,65354,65355,65356,65357,65358,65359,65360, +65361,65362,65363,65364,65365,65366,65367,65368,65369,65370,65371,65372,65373, +65507,12593,12594,12595,12596,12597,12598,12599,12600,12601,12602,12603,12604, +12605,12606,12607,12608,12609,12610,12611,12612,12613,12614,12615,12616,12617, +12618,12619,12620,12621,12622,12623,12624,12625,12626,12627,12628,12629,12630, +12631,12632,12633,12634,12635,12636,12637,12638,12639,12640,12641,12642,12643, +12644,12645,12646,12647,12648,12649,12650,12651,12652,12653,12654,12655,12656, +12657,12658,12659,12660,12661,12662,12663,12664,12665,12666,12667,12668,12669, +12670,12671,12672,12673,12674,12675,12676,12677,12678,12679,12680,12681,12682, +12683,12684,12685,12686,8560,8561,8562,8563,8564,8565,8566,8567,8568,8569,0,0, +0,0,0,8544,8545,8546,8547,8548,8549,8550,8551,8552,8553,0,0,0,0,0,0,0,913,914, +915,916,917,918,919,920,921,922,923,924,925,926,927,928,929,931,932,933,934, +935,936,937,0,0,0,0,0,0,0,0,945,946,947,948,949,950,951,952,953,954,955,956, +957,958,959,960,961,963,964,965,966,967,968,969,0,0,0,0,0,0,9472,9474,9484, +9488,9496,9492,9500,9516,9508,9524,9532,9473,9475,9487,9491,9499,9495,9507, +9523,9515,9531,9547,9504,9519,9512,9527,9535,9501,9520,9509,9528,9538,9490, +9489,9498,9497,9494,9493,9486,9485,9502, +9503,9505,9506,9510,9511,9513,9514,9517,9518,9521,9522,9525,9526,9529,9530, +9533,9534,9536,9537,9539,9540,9541,9542,9543,9544,9545,9546,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,13205,13206,13207,8467,13208,13252,13219, +13220,13221,13222,13209,13210,13211,13212,13213,13214,13215,13216,13217,13218, +13258,13197,13198,13199,13263,13192,13193,13256,13223,13224,13232,13233,13234, +13235,13236,13237,13238,13239,13240,13241,13184,13185,13186,13187,13188,13242, +13243,13244,13245,13246,13247,13200,13201,13202,13203,13204,8486,13248,13249, +13194,13195,13196,13270,13253,13229,13230,13231,13275,13225,13226,13227,13228, +13277,13264,13267,13251,13257,13276,13254,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,198, +208,170,294,0,306,0,319,321,216,338,186,222,358,330,0,12896,12897,12898,12899, +12900,12901,12902,12903,12904,12905,12906,12907,12908,12909,12910,12911,12912, +12913,12914,12915,12916,12917,12918,12919,12920,12921,12922,12923,9424,9425, +9426,9427,9428,9429,9430,9431,9432,9433,9434,9435,9436,9437,9438,9439,9440, +9441,9442,9443,9444,9445,9446,9447,9448,9449,9312,9313,9314,9315,9316,9317, +9318,9319,9320,9321,9322,9323,9324,9325,9326,189,8531,8532,188,190,8539,8540, +8541,8542,230,273,240,295,305,307,312,320,322,248,339,223,254,359,331, +329,12800,12801,12802,12803,12804,12805,12806,12807,12808,12809,12810,12811, +12812,12813,12814,12815,12816,12817,12818,12819,12820,12821,12822,12823,12824, +12825,12826,12827,9372,9373,9374,9375,9376,9377,9378,9379,9380,9381,9382,9383, +9384,9385,9386,9387,9388,9389,9390,9391,9392,9393,9394,9395,9396,9397,9332, +9333,9334,9335,9336,9337,9338,9339,9340,9341,9342,9343,9344,9345,9346,185,178, +179,8308,8319,8321,8322,8323,8324,12353,12354,12355,12356,12357,12358,12359, +12360,12361,12362,12363,12364,12365,12366,12367,12368,12369,12370,12371,12372, +12373,12374,12375,12376,12377,12378,12379,12380,12381,12382,12383,12384,12385, +12386,12387,12388,12389,12390,12391,12392,12393,12394,12395,12396,12397,12398, +12399,12400,12401,12402,12403,12404,12405,12406,12407,12408,12409,12410,12411, +12412,12413,12414,12415,12416,12417,12418,12419,12420,12421,12422,12423,12424, +12425,12426,12427,12428,12429,12430,12431,12432,12433,12434,12435,0,0,0,0,0,0, +0,0,0,0,0,12449,12450,12451,12452,12453,12454,12455,12456,12457,12458,12459, +12460,12461,12462,12463,12464,12465,12466,12467,12468,12469,12470,12471,12472, +12473,12474,12475,12476,12477,12478,12479,12480,12481,12482,12483,12484,12485, +12486,12487,12488,12489,12490,12491,12492,12493,12494,12495,12496,12497,12498, +12499,12500,12501,12502,12503,12504,12505,12506,12507,12508,12509,12510,12511, +12512,12513,12514,12515,12516,12517,12518,12519,12520,12521,12522,12523,12524, +12525,12526,12527,12528,12529,12530,12531, +12532,12533,12534,0,0,0,0,0,0,0,0,1040,1041,1042,1043,1044,1045,1025,1046, +1047,1048,1049,1050,1051,1052,1053,1054,1055,1056,1057,1058,1059,1060,1061, +1062,1063,1064,1065,1066,1067,1068,1069,1070,1071,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,1072,1073,1074,1075,1076,1077,1105,1078,1079,1080,1081,1082,1083,1084,1085, +1086,1087,1088,1089,1090,1091,1092,1093,1094,1095,1096,1097,1098,1099,1100, +1101,1102,1103,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,44032,44033,44036,44039,44040,44041,44042,44048, +44049,44050,44051,44052,44053,44054,44055,44057,44058,44059,44060,44061,44064, +44068,44076,44077,44079,44080,44081,44088,44089,44092,44096,44107,44109,44116, +44120,44124,44144,44145,44148,44151,44152,44154,44160,44161,44163,44164,44165, +44166,44169,44170,44171,44172,44176,44180,44188,44189,44191,44192,44193,44200, +44201,44202,44204,44207,44208,44216,44217,44219,44220,44221,44225,44228,44232, +44236,44245,44247,44256,44257,44260,44263,44264,44266,44268,44271,44272,44273, +44275,44277,44278,44284,44285,44288,44292,44294,44300,44301,44303,44305,44312, +44316,44320,44329,44332,44333,44340,44341,44344,44348,44356,44357,44359,44361, +44368,44372,44376,44385,44387,44396,44397,44400,44403,44404,44405,44406,44411, +44412,44413,44415,44417,44418,44424,44425,44428,44432,44444,44445,44452,44471, +44480,44481,44484,44488,44496,44497,44499,44508,44512,44516,44536,44537,44540, +44543,44544,44545,44552,44553,44555,44557,44564,44592,44593,44596,44599,44600, +44602,44608,44609,44611,44613,44614,44618,44620,44621,44622,44624,44628,44630, +44636,44637,44639,44640,44641,44645,44648,44649,44652,44656,44664,44665,44667, +44668,44669,44676,44677,44684,44732,44733,44734,44736,44740,44748,44749,44751, +44752,44753,44760,44761,44764,44776,44779,44781,44788,44792,44796,44807,44808, +44813,44816,44844,44845,44848,44850,44852,44860,44861,44863,44865,44866,44867, +44872,44873,44880,44892,44893,44900,44901,44921,44928,44932,44936,44944,44945, +44949,44956,44984,44985,44988,44992,44999,45000,45001,45003,45005,45006,45012, +45020,45032,45033,45040,45041,45044,45048,45056,45057,45060,45068,45072,45076, +45084,45085,45096,45124,45125,45128,45130,45132,45134,45139,45140,45141,45143, +45145,45149,45180,45181,45184,45188,45196,45197,45199,45201,45208,45209,45210, +45212,45215,45216,45217,45218,45224,45225,45227,45228,45229,45230,45231,45233, +45235,45236,45237,45240,45244,45252,45253,45255,45256,45257,45264,45265,45268, +45272,45280,45285,45320,45321,45323,45324,45328,45330,45331,45336,45337,45339, +45340,45341,45347,45348,45349,45352,45356,45364,45365,45367,45368,45369,45376, +45377,45380,45384,45392,45393,45396,45397,45400,45404,45408,45432,45433,45436, +45440,45442,45448,45449,45451,45453,45458,45459,45460,45464,45468,45480,45516, +45520,45524,45532,45533,45535,45544,45545,45548,45552, +45561,45563,45565,45572,45573,45576,45579,45580,45588,45589,45591,45593,45600, +45620,45628,45656,45660,45664,45672,45673,45684,45685,45692,45700,45701,45705, +45712,45713,45716,45720,45721,45722,45728,45729,45731,45733,45734,45738,45740, +45744,45748,45768,45769,45772,45776,45778,45784,45785,45787,45789,45794,45796, +45797,45798,45800,45803,45804,45805,45806,45807,45811,45812,45813,45815,45816, +45817,45818,45819,45823,45824,45825,45828,45832,45840,45841,45843,45844,45845, +45852,45908,45909,45910,45912,45915,45916,45918,45919,45924,45925,45927,45929, +45931,45934,45936,45937,45940,45944,45952,45953,45955,45956,45957,45964,45968, +45972,45984,45985,45992,45996,46020,46021,46024,46027,46028,46030,46032,46036, +46037,46039,46041,46043,46045,46048,46052,46056,46076,46096,46104,46108,46112, +46120,46121,46123,46132,46160,46161,46164,46168,46176,46177,46179,46181,46188, +46208,46216,46237,46244,46248,46252,46261,46263,46265,46272,46276,46280,46288, +46293,46300,46301,46304,46307,46308,46310,46316,46317,46319,46321,46328,46356, +46357,46360,46363,46364,46372,46373,46375,46376,46377,46378,46384,46385,46388, +46392,46400,46401,46403,46404,46405,46411,46412,46413,46416,46420,46428,46429, +46431,46432,46433,46496,46497,46500,46504,46506,46507,46512,46513,46515,46516, +46517,46523,46524,46525,46528,46532,46540,46541,46543,46544,46545,46552,46572, +46608,46609,46612,46616,46629,46636,46644,46664,46692,46696,46748,46749,46752, +46756,46763,46764,46769,46804,46832,46836,46840,46848,46849,46853,46888,46889, +46892,46895,46896,46904,46905,46907,46916,46920,46924, +46932,46933,46944,46948,46952,46960,46961,46963,46965,46972,46973,46976,46980, +46988,46989,46991,46992,46993,46994,46998,46999,47000,47001,47004,47008,47016, +47017,47019,47020,47021,47028,47029,47032,47047,47049,47084,47085,47088,47092, +47100,47101,47103,47104,47105,47111,47112,47113,47116,47120,47128,47129,47131, +47133,47140,47141,47144,47148,47156,47157,47159,47160,47161,47168,47172,47185, +47187,47196,47197,47200,47204,47212,47213,47215,47217,47224,47228,47245,47272, +47280,47284,47288,47296,47297,47299,47301,47308,47312,47316,47325,47327,47329, +47336,47337,47340,47344,47352,47353,47355,47357,47364,47384,47392,47420,47421, +47424,47428,47436,47439,47441,47448,47449,47452,47456,47464,47465,47467,47469, +47476,47477,47480,47484,47492,47493,47495,47497,47498,47501,47502,47532,47533, +47536,47540,47548,47549,47551,47553,47560,47561,47564,47566,47567,47568,47569, +47570,47576,47577,47579,47581,47582,47585,47587,47588,47589,47592,47596,47604, +47605,47607,47608,47609,47610,47616,47617,47624,47637,47672,47673,47676,47680, +47682,47688,47689,47691,47693,47694,47699,47700,47701,47704,47708,47716,47717, +47719,47720,47721,47728,47729,47732,47736,47747,47748,47749,47751,47756,47784, +47785,47787,47788,47792,47794,47800,47801,47803,47805,47812,47816,47832,47833, +47868,47872,47876,47885,47887,47889,47896,47900,47904,47913,47915,47924,47925, +47926,47928,47931,47932,47933,47934,47940,47941,47943,47945,47949,47951,47952, +47956,47960,47969,47971,47980,48008,48012,48016,48036,48040,48044,48052,48055, +48064,48068,48072,48080,48083,48120,48121,48124,48127, +48128,48130,48136,48137,48139,48140,48141,48143,48145,48148,48149,48150,48151, +48152,48155,48156,48157,48158,48159,48164,48165,48167,48169,48173,48176,48177, +48180,48184,48192,48193,48195,48196,48197,48201,48204,48205,48208,48221,48260, +48261,48264,48267,48268,48270,48276,48277,48279,48281,48282,48288,48289,48292, +48295,48296,48304,48305,48307,48308,48309,48316,48317,48320,48324,48333,48335, +48336,48337,48341,48344,48348,48372,48373,48374,48376,48380,48388,48389,48391, +48393,48400,48404,48420,48428,48448,48456,48457,48460,48464,48472,48473,48484, +48488,48512,48513,48516,48519,48520,48521,48522,48528,48529,48531,48533,48537, +48538,48540,48548,48560,48568,48596,48597,48600,48604,48617,48624,48628,48632, +48640,48643,48645,48652,48653,48656,48660,48668,48669,48671,48708,48709,48712, +48716,48718,48724,48725,48727,48729,48730,48731,48736,48737,48740,48744,48746, +48752,48753,48755,48756,48757,48763,48764,48765,48768,48772,48780,48781,48783, +48784,48785,48792,48793,48808,48848,48849,48852,48855,48856,48864,48867,48868, +48869,48876,48897,48904,48905,48920,48921,48923,48924,48925,48960,48961,48964, +48968,48976,48977,48981,49044,49072,49093,49100,49101,49104,49108,49116,49119, +49121,49212,49233,49240,49244,49248,49256,49257,49296,49297,49300,49304,49312, +49313,49315,49317,49324,49325,49327,49328,49331,49332,49333,49334,49340,49341, +49343,49344,49345,49349,49352,49353,49356,49360,49368,49369,49371,49372,49373, +49380,49381,49384,49388,49396,49397,49399,49401,49408,49412,49416,49424,49429, +49436,49437,49438,49439,49440,49443,49444,49446,49447, +49452,49453,49455,49456,49457,49462,49464,49465,49468,49472,49480,49481,49483, +49484,49485,49492,49493,49496,49500,49508,49509,49511,49512,49513,49520,49524, +49528,49541,49548,49549,49550,49552,49556,49558,49564,49565,49567,49569,49573, +49576,49577,49580,49584,49597,49604,49608,49612,49620,49623,49624,49632,49636, +49640,49648,49649,49651,49660,49661,49664,49668,49676,49677,49679,49681,49688, +49689,49692,49695,49696,49704,49705,49707,49709,49711,49713,49714,49716,49736, +49744,49745,49748,49752,49760,49765,49772,49773,49776,49780,49788,49789,49791, +49793,49800,49801,49808,49816,49819,49821,49828,49829,49832,49836,49837,49844, +49845,49847,49849,49884,49885,49888,49891,49892,49899,49900,49901,49903,49905, +49910,49912,49913,49915,49916,49920,49928,49929,49932,49933,49939,49940,49941, +49944,49948,49956,49957,49960,49961,49989,50024,50025,50028,50032,50034,50040, +50041,50044,50045,50052,50056,50060,50112,50136,50137,50140,50143,50144,50146, +50152,50153,50157,50164,50165,50168,50184,50192,50212,50220,50224,50228,50236, +50237,50248,50276,50277,50280,50284,50292,50293,50297,50304,50324,50332,50360, +50364,50409,50416,50417,50420,50424,50426,50431,50432,50433,50444,50448,50452, +50460,50472,50473,50476,50480,50488,50489,50491,50493,50500,50501,50504,50505, +50506,50508,50509,50510,50515,50516,50517,50519,50520,50521,50525,50526,50528, +50529,50532,50536,50544,50545,50547,50548,50549,50556,50557,50560,50564,50567, +50572,50573,50575,50577,50581,50583,50584,50588,50592,50601,50612,50613,50616, +50617,50619,50620,50621,50622,50628,50629,50630,50631, +50632,50633,50634,50636,50638,50640,50641,50644,50648,50656,50657,50659,50661, +50668,50669,50670,50672,50676,50678,50679,50684,50685,50686,50687,50688,50689, +50693,50694,50695,50696,50700,50704,50712,50713,50715,50716,50724,50725,50728, +50732,50733,50734,50736,50739,50740,50741,50743,50745,50747,50752,50753,50756, +50760,50768,50769,50771,50772,50773,50780,50781,50784,50796,50799,50801,50808, +50809,50812,50816,50824,50825,50827,50829,50836,50837,50840,50844,50852,50853, +50855,50857,50864,50865,50868,50872,50873,50874,50880,50881,50883,50885,50892, +50893,50896,50900,50908,50909,50912,50913,50920,50921,50924,50928,50936,50937, +50941,50948,50949,50952,50956,50964,50965,50967,50969,50976,50977,50980,50984, +50992,50993,50995,50997,50999,51004,51005,51008,51012,51018,51020,51021,51023, +51025,51026,51027,51028,51029,51030,51031,51032,51036,51040,51048,51051,51060, +51061,51064,51068,51069,51070,51075,51076,51077,51079,51080,51081,51082,51086, +51088,51089,51092,51094,51095,51096,51098,51104,51105,51107,51108,51109,51110, +51116,51117,51120,51124,51132,51133,51135,51136,51137,51144,51145,51148,51150, +51152,51160,51165,51172,51176,51180,51200,51201,51204,51208,51210,51216,51217, +51219,51221,51222,51228,51229,51232,51236,51244,51245,51247,51249,51256,51260, +51264,51272,51273,51276,51277,51284,51312,51313,51316,51320,51322,51328,51329, +51331,51333,51334,51335,51339,51340,51341,51348,51357,51359,51361,51368,51388, +51389,51396,51400,51404,51412,51413,51415,51417,51424,51425,51428,51445,51452, +51453,51456,51460,51461,51462,51468,51469,51471,51473, +51480,51500,51508,51536,51537,51540,51544,51552,51553,51555,51564,51568,51572, +51580,51592,51593,51596,51600,51608,51609,51611,51613,51648,51649,51652,51655, +51656,51658,51664,51665,51667,51669,51670,51673,51674,51676,51677,51680,51682, +51684,51687,51692,51693,51695,51696,51697,51704,51705,51708,51712,51720,51721, +51723,51724,51725,51732,51736,51753,51788,51789,51792,51796,51804,51805,51807, +51808,51809,51816,51837,51844,51864,51900,51901,51904,51908,51916,51917,51919, +51921,51923,51928,51929,51936,51948,51956,51976,51984,51988,51992,52000,52001, +52033,52040,52041,52044,52048,52056,52057,52061,52068,52088,52089,52124,52152, +52180,52196,52199,52201,52236,52237,52240,52244,52252,52253,52257,52258,52263, +52264,52265,52268,52270,52272,52280,52281,52283,52284,52285,52286,52292,52293, +52296,52300,52308,52309,52311,52312,52313,52320,52324,52326,52328,52336,52341, +52376,52377,52380,52384,52392,52393,52395,52396,52397,52404,52405,52408,52412, +52420,52421,52423,52425,52432,52436,52452,52460,52464,52481,52488,52489,52492, +52496,52504,52505,52507,52509,52516,52520,52524,52537,52572,52576,52580,52588, +52589,52591,52593,52600,52616,52628,52629,52632,52636,52644,52645,52647,52649, +52656,52676,52684,52688,52712,52716,52720,52728,52729,52731,52733,52740,52744, +52748,52756,52761,52768,52769,52772,52776,52784,52785,52787,52789,52824,52825, +52828,52831,52832,52833,52840,52841,52843,52845,52852,52853,52856,52860,52868, +52869,52871,52873,52880,52881,52884,52888,52896,52897,52899,52900,52901,52908, +52909,52929,52964,52965,52968,52971,52972,52980,52981, +52983,52984,52985,52992,52993,52996,53000,53008,53009,53011,53013,53020,53024, +53028,53036,53037,53039,53040,53041,53048,53076,53077,53080,53084,53092,53093, +53095,53097,53104,53105,53108,53112,53120,53125,53132,53153,53160,53168,53188, +53216,53217,53220,53224,53232,53233,53235,53237,53244,53248,53252,53265,53272, +53293,53300,53301,53304,53308,53316,53317,53319,53321,53328,53332,53336,53344, +53356,53357,53360,53364,53372,53373,53377,53412,53413,53416,53420,53428,53429, +53431,53433,53440,53441,53444,53448,53449,53456,53457,53459,53460,53461,53468, +53469,53472,53476,53484,53485,53487,53488,53489,53496,53517,53552,53553,53556, +53560,53562,53568,53569,53571,53572,53573,53580,53581,53584,53588,53596,53597, +53599,53601,53608,53612,53628,53636,53640,53664,53665,53668,53672,53680,53681, +53683,53685,53690,53692,53696,53720,53748,53752,53767,53769,53776,53804,53805, +53808,53812,53820,53821,53823,53825,53832,53852,53860,53888,53889,53892,53896, +53904,53905,53909,53916,53920,53924,53932,53937,53944,53945,53948,53951,53952, +53954,53960,53961,53963,53972,53976,53980,53988,53989,54000,54001,54004,54008, +54016,54017,54019,54021,54028,54029,54030,54032,54036,54038,54044,54045,54047, +54048,54049,54053,54056,54057,54060,54064,54072,54073,54075,54076,54077,54084, +54085,54140,54141,54144,54148,54156,54157,54159,54160,54161,54168,54169,54172, +54176,54184,54185,54187,54189,54196,54200,54204,54212,54213,54216,54217,54224, +54232,54241,54243,54252,54253,54256,54260,54268,54269,54271,54273,54280,54301, +54336,54340,54364,54368,54372,54381,54383,54392,54393, +54396,54399,54400,54402,54408,54409,54411,54413,54420,54441,54476,54480,54484, +54492,54495,54504,54508,54512,54520,54523,54525,54532,54536,54540,54548,54549, +54551,54588,54589,54592,54596,54604,54605,54607,54609,54616,54617,54620,54624, +54629,54632,54633,54635,54637,54644,54645,54648,54652,54660,54661,54663,54664, +54665,54672,54693,54728,54729,54732,54736,54738,54744,54745,54747,54749,54756, +54757,54760,54764,54772,54773,54775,54777,54784,54785,54788,54792,54800,54801, +54803,54804,54805,54812,54816,54820,54829,54840,54841,54844,54848,54853,54856, +54857,54859,54861,54865,54868,54869,54872,54876,54887,54889,54896,54897,54900, +54915,54917,54924,54925,54928,54932,54941,54943,54945,54952,54956,54960,54969, +54971,54980,54981,54984,54988,54993,54996,54999,55001,55008,55012,55016,55024, +55029,55036,55037,55040,55044,55057,55064,55065,55068,55072,55080,55081,55083, +55085,55092,55093,55096,55100,55108,55111,55113,55120,55121,55124,55126,55127, +55128,55129,55136,55137,55139,55141,55145,55148,55152,55156,55164,55165,55169, +55176,55177,55180,55184,55192,55193,55195,55197,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,20285,20339,20551,20729,21152,21487,21621,21733, +22025,23233,23478,26247,26550,26551,26607,27468,29634,30146,31292,33499,33540, +34903,34952,35382,36040,36303,36603,36838,39381,21051,21364,21508,24682,24932, +27580,29647,33050,35258,35282,38307,20355,21002,22718,22904,23014,24178,24185, +25031,25536,26438,26604,26751,28567,30286,30475,30965,31240,31487,31777,32925, +33390,33393,35563,38291,20075,21917,26359,28212,30883,31469,33883,35088,34638, +38824,21208,22350,22570,23884,24863,25022,25121,25954,26577,27204,28187,29976, +30131,30435,30640,32058,37039,37969,37970,40853,21283,23724,30002,32987,37440, +38296,21083,22536,23004,23713,23831,24247,24378,24394,24951,27743,30074,30086, +31968,32115,32177,32652,33108,33313,34193,35137,35611,37628,38477,40007,20171, +20215,20491,20977,22607,24887,24894,24936,25913,27114,28433,30117,30342,30422, +31623,33445,33995,63744,37799,38283,21888,23458,22353,63745,31923,32697,37301, +20520,21435,23621,24040,25298,25454,25818,25831,28192,28844,31067,36317,36382, +63746,36989,37445,37624,20094,20214,20581,24062,24314,24838,26967,33137,34388, +36423,37749,39467,20062,20625,26480,26688,20745,21133,21138,27298,30652,37392, +40660,21163,24623,36850,20552,25001,25581,25802,26684,27268,28608,33160,35233, +38548,22533,29309,29356,29956,32121,32365,32937,35211,35700,36963,40273,25225, +27770,28500,32080,32570,35363,20860,24906,31645,35609,37463,37772,20140,20435, +20510,20670,20742,21185,21197,21375,22384,22659,24218,24465,24950,25004, +25806,25964,26223,26299,26356,26775,28039,28805,28913,29855,29861,29898,30169, +30828,30956,31455,31478,32069,32147,32789,32831,33051,33686,35686,36629,36885, +37857,38915,38968,39514,39912,20418,21843,22586,22865,23395,23622,24760,25106, +26690,26800,26856,28330,30028,30328,30926,31293,31995,32363,32380,35336,35489, +35903,38542,40388,21476,21481,21578,21617,22266,22993,23396,23611,24235,25335, +25911,25925,25970,26272,26543,27073,27837,30204,30352,30590,31295,32660,32771, +32929,33167,33510,33533,33776,34241,34865,34996,35493,63747,36764,37678,38599, +39015,39640,40723,21741,26011,26354,26767,31296,35895,40288,22256,22372,23825, +26118,26801,26829,28414,29736,34974,39908,27752,63748,39592,20379,20844,20849, +21151,23380,24037,24656,24685,25329,25511,25915,29657,31354,34467,36002,38799, +20018,23521,25096,26524,29916,31185,33747,35463,35506,36328,36942,37707,38982, +24275,27112,34303,37101,63749,20896,23448,23532,24931,26874,27454,28748,29743, +29912,31649,32592,33733,35264,36011,38364,39208,21038,24669,25324,36866,20362, +20809,21281,22745,24291,26336,27960,28826,29378,29654,31568,33009,37979,21350, +25499,32619,20054,20608,22602,22750,24618,24871,25296,27088,39745,23439,32024, +32945,36703,20132,20689,21676,21932,23308,23968,24039,25898,25934,26657,27211, +29409,30350,30703,32094,32761,33184,34126,34527,36611,36686,37066,39171,39509, +39851,19992,20037,20061,20167,20465,20855,21246,21312,21475,21477,21646,22036, +22389,22434,23495,23943,24272,25084,25304,25937,26552,26601,27083,27472,27590, +27628,27714,28317,28792,29399,29590,29699,30655,30697, +31350,32127,32777,33276,33285,33290,33503,34914,35635,36092,36544,36881,37041, +37476,37558,39378,39493,40169,40407,40860,22283,23616,33738,38816,38827,40628, +21531,31384,32676,35033,36557,37089,22528,23624,25496,31391,23470,24339,31353, +31406,33422,36524,20518,21048,21240,21367,22280,25331,25458,27402,28099,30519, +21413,29527,34152,36470,38357,26426,27331,28528,35437,36556,39243,63750,26231, +27512,36020,39740,63751,21483,22317,22862,25542,27131,29674,30789,31418,31429, +31998,33909,35215,36211,36917,38312,21243,22343,30023,31584,33740,37406,63752, +27224,20811,21067,21127,25119,26840,26997,38553,20677,21156,21220,25027,26020, +26681,27135,29822,31563,33465,33771,35250,35641,36817,39241,63753,20170,22935, +25810,26129,27278,29748,31105,31165,33449,34942,34943,35167,63754,37670,20235, +21450,24613,25201,27762,32026,32102,20120,20834,30684,32943,20225,20238,20854, +20864,21980,22120,22331,22522,22524,22804,22855,22931,23492,23696,23822,24049, +24190,24524,25216,26071,26083,26398,26399,26462,26827,26820,27231,27450,27683, +27773,27778,28103,29592,29734,29738,29826,29859,30072,30079,30849,30959,31041, +31047,31048,31098,31637,32000,32186,32648,32774,32813,32908,35352,35663,35912, +36215,37665,37668,39138,39249,39438,39439,39525,40594,32202,20342,21513,25326, +26708,37329,21931,20794,63755,63756,23068,25062,63757,25295,25343,63758,63759, +63760,63761,63762,63763,37027,63764,63765,63766,63767,63768,35582,63769,63770, +63771,63772,26262,63773,29014,63774,63775,38627,63776,25423,25466,21335,63777, +26511,26976,28275,63778,30007,63779,63780,63781,32013, +63782,63783,34930,22218,23064,63784,63785,63786,63787,63788,20035,63789,20839, +22856,26608,32784,63790,22899,24180,25754,31178,24565,24684,25288,25467,23527, +23511,21162,63791,22900,24361,24594,63792,63793,63794,29785,63795,63796,63797, +63798,63799,63800,39377,63801,63802,63803,63804,63805,63806,63807,63808,63809, +63810,63811,28611,63812,63813,33215,36786,24817,63814,63815,33126,63816,63817, +23615,63818,63819,63820,63821,63822,63823,63824,63825,23273,35365,26491,32016, +63826,63827,63828,63829,63830,63831,33021,63832,63833,23612,27877,21311,28346, +22810,33590,20025,20150,20294,21934,22296,22727,24406,26039,26086,27264,27573, +28237,30701,31471,31774,32222,34507,34962,37170,37723,25787,28606,29562,30136, +36948,21846,22349,25018,25812,26311,28129,28251,28525,28601,30192,32835,33213, +34113,35203,35527,35674,37663,27795,30035,31572,36367,36957,21776,22530,22616, +24162,25095,25758,26848,30070,31958,34739,40680,20195,22408,22382,22823,23565, +23729,24118,24453,25140,25825,29619,33274,34955,36024,38538,40667,23429,24503, +24755,20498,20992,21040,22294,22581,22615,23566,23648,23798,23947,24230,24466, +24764,25361,25481,25623,26691,26873,27330,28120,28193,28372,28644,29182,30428, +30585,31153,31291,33796,35241,36077,36339,36424,36867,36884,36947,37117,37709, +38518,38876,27602,28678,29272,29346,29544,30563,31167,31716,32411,35712,22697, +24775,25958,26109,26302,27788,28958,29129,35930,38931,20077,31361,20189,20908, +20941,21205,21516,24999,26481,26704,26847,27934,28540,30140,30643,31461,33012, +33891,37509,20828,26007,26460,26515,30168,31431,33651, +63834,35910,36887,38957,23663,33216,33434,36929,36975,37389,24471,23965,27225, +29128,30331,31561,34276,35588,37159,39472,21895,25078,63835,30313,32645,34367, +34746,35064,37007,63836,27931,28889,29662,32097,33853,63837,37226,39409,63838, +20098,21365,27396,27410,28734,29211,34349,40478,21068,36771,23888,25829,25900, +27414,28651,31811,32412,34253,35172,35261,25289,33240,34847,24266,26391,28010, +29436,29701,29807,34690,37086,20358,23821,24480,33802,20919,25504,30053,20142, +20486,20841,20937,26753,27153,31918,31921,31975,33391,35538,36635,37327,20406, +20791,21237,21570,24300,24942,25150,26053,27354,28670,31018,34268,34851,38317, +39522,39530,40599,40654,21147,26310,27511,28701,31019,36706,38722,24976,25088, +25891,28451,29001,29833,32244,32879,34030,36646,36899,37706,20925,21015,21155, +27916,28872,35010,24265,25986,27566,28610,31806,29557,20196,20278,22265,63839, +23738,23994,24604,29618,31533,32666,32718,32838,36894,37428,38646,38728,38936, +40801,20363,28583,31150,37300,38583,21214,63840,25736,25796,27347,28510,28696, +29200,30439,32769,34310,34396,36335,36613,38706,39791,40442,40565,30860,31103, +32160,33737,37636,40575,40595,35542,22751,24324,26407,28711,29903,31840,32894, +20769,28712,29282,30922,36034,36058,36084,38647,20102,20698,23534,24278,26009, +29134,30274,30637,32842,34044,36988,39719,40845,22744,23105,23650,27155,28122, +28431,30267,32047,32311,34078,35128,37860,38475,21129,26066,26611,27060,27969, +28316,28687,29705,29792,30041,30244,30827,35628,39006,20845,25134,38520,20374, +20523,23833,28138,32184,36650,24459,24900,26647,63841, +38534,21202,32907,20956,20940,26974,31260,32190,33777,38517,20442,21033,21400, +21519,21774,23653,24743,26446,26792,28012,29313,29432,29702,29827,63842,30178, +31852,32633,32696,33673,35023,35041,37324,37328,38626,39881,21533,28542,29136, +29848,34298,36522,38563,40023,40607,26519,28107,29747,33256,38678,30764,31435, +31520,31890,25705,29802,30194,30908,30952,39340,39764,40635,23518,24149,28448, +33180,33707,37000,19975,21325,23081,24018,24398,24930,25405,26217,26364,28415, +28459,28771,30622,33836,34067,34875,36627,39237,39995,21788,25273,26411,27819, +33545,35178,38778,20129,22916,24536,24537,26395,32178,32596,33426,33579,33725, +36638,37017,22475,22969,23186,23504,26151,26522,26757,27599,29028,32629,36023, +36067,36993,39749,33032,35978,38476,39488,40613,23391,27667,29467,30450,30431, +33804,20906,35219,20813,20885,21193,26825,27796,30468,30496,32191,32236,38754, +40629,28357,34065,20901,21517,21629,26126,26269,26919,28319,30399,30609,33559, +33986,34719,37225,37528,40180,34946,20398,20882,21215,22982,24125,24917,25720, +25721,26286,26576,27169,27597,27611,29279,29281,29761,30520,30683,32791,33468, +33541,35584,35624,35980,26408,27792,29287,30446,30566,31302,40361,27519,27794, +22818,26406,33945,21359,22675,22937,24287,25551,26164,26483,28218,29483,31447, +33495,37672,21209,24043,25006,25035,25098,25287,25771,26080,26969,27494,27595, +28961,29687,30045,32326,33310,33538,34154,35491,36031,38695,40289,22696,40664, +20497,21006,21563,21839,25991,27766,32010,32011,32862,34442,38272,38639,21247, +27797,29289,21619,23194,23614,23883,24396,24494,26410, +26806,26979,28220,28228,30473,31859,32654,34183,35598,36855,38753,40692,23735, +24758,24845,25003,25935,26107,26108,27665,27887,29599,29641,32225,38292,23494, +34588,35600,21085,21338,25293,25615,25778,26420,27192,27850,29632,29854,31636, +31893,32283,33162,33334,34180,36843,38649,39361,20276,21322,21453,21467,25292, +25644,25856,26001,27075,27886,28504,29677,30036,30242,30436,30460,30928,30971, +31020,32070,33324,34784,36820,38930,39151,21187,25300,25765,28196,28497,30332, +36299,37297,37474,39662,39747,20515,20621,22346,22952,23592,24135,24439,25151, +25918,26041,26049,26121,26507,27036,28354,30917,32033,32938,33152,33323,33459, +33953,34444,35370,35607,37030,38450,40848,20493,20467,63843,22521,24472,25308, +25490,26479,28227,28953,30403,32972,32986,35060,35061,35097,36064,36649,37197, +38506,20271,20336,24091,26575,26658,30333,30334,39748,24161,27146,29033,29140, +30058,63844,32321,34115,34281,39132,20240,31567,32624,38309,20961,24070,26805, +27710,27726,27867,29359,31684,33539,27861,29754,20731,21128,22721,25816,27287, +29863,30294,30887,34327,38370,38713,63845,21342,24321,35722,36776,36783,37002, +21029,30629,40009,40712,19993,20482,20853,23643,24183,26142,26170,26564,26821, +28851,29953,30149,31177,31453,36647,39200,39432,20445,22561,22577,23542,26222, +27493,27921,28282,28541,29668,29995,33769,35036,35091,35676,36628,20239,20693, +21264,21340,23443,24489,26381,31119,33145,33583,34068,35079,35206,36665,36667, +39333,39954,26412,20086,20472,22857,23553,23791,23792,25447,26834,28925,29090, +29739,32299,34028,34562,36898,37586,40179,19981,20184, +20463,20613,21078,21103,21542,21648,22496,22827,23142,23386,23413,23500,24220, +63846,25206,25975,26023,28014,28325,29238,31526,31807,32566,33104,33105,33178, +33344,33433,33705,35331,36000,36070,36091,36212,36282,37096,37340,38428,38468, +39385,40167,21271,20998,21545,22132,22707,22868,22894,24575,24996,25198,26128, +27774,28954,30406,31881,31966,32027,33452,36033,38640,63847,20315,24343,24447, +25282,23849,26379,26842,30844,32323,40300,19989,20633,21269,21290,21329,22915, +23138,24199,24754,24970,25161,25209,26000,26503,27047,27604,27606,27607,27608, +27832,63848,29749,30202,30738,30865,31189,31192,31875,32203,32737,32933,33086, +33218,33778,34586,35048,35513,35692,36027,37145,38750,39131,40763,22188,23338, +24428,25996,27315,27567,27996,28657,28693,29277,29613,36007,36051,38971,24977, +27703,32856,39425,20045,20107,20123,20181,20282,20284,20351,20447,20735,21490, +21496,21766,21987,22235,22763,22882,23057,23531,23546,23556,24051,24107,24473, +24605,25448,26012,26031,26614,26619,26797,27515,27801,27863,28195,28681,29509, +30722,31038,31040,31072,31169,31721,32023,32114,32902,33293,33678,34001,34503, +35039,35408,35422,35613,36060,36198,36781,37034,39164,39391,40605,21066,63849, +26388,63850,20632,21034,23665,25955,27733,29642,29987,30109,31639,33948,37240, +38704,20087,25746,27578,29022,34217,19977,63851,26441,26862,28183,33439,34072, +34923,25591,28545,37394,39087,19978,20663,20687,20767,21830,21930,22039,23360, +23577,23776,24120,24202,24224,24258,24819,26705,27233,28248,29245,29248,29376, +30456,31077,31665,32724,35059,35316,35443,35937,36062, +38684,22622,29885,36093,21959,63852,31329,32034,33394,29298,29983,29989,63853, +31513,22661,22779,23996,24207,24246,24464,24661,25234,25471,25933,26257,26329, +26360,26646,26866,29312,29790,31598,32110,32214,32626,32997,33298,34223,35199, +35475,36893,37604,40653,40736,22805,22893,24109,24796,26132,26227,26512,27728, +28101,28511,30707,30889,33990,37323,37675,20185,20682,20808,21892,23307,23459, +25159,25982,26059,28210,29053,29697,29764,29831,29887,30316,31146,32218,32341, +32680,33146,33203,33337,34330,34796,35445,36323,36984,37521,37925,39245,39854, +21352,23633,26964,27844,27945,28203,33292,34203,35131,35373,35498,38634,40807, +21089,26297,27570,32406,34814,36109,38275,38493,25885,28041,29166,63854,22478, +22995,23468,24615,24826,25104,26143,26207,29481,29689,30427,30465,31596,32854, +32882,33125,35488,37266,19990,21218,27506,27927,31237,31545,32048,63855,36016, +21484,22063,22609,23477,23567,23569,24034,25152,25475,25620,26157,26803,27836, +28040,28335,28703,28836,29138,29990,30095,30094,30233,31505,31712,31787,32032, +32057,34092,34157,34311,35380,36877,36961,37045,37559,38902,39479,20439,23660, +26463,28049,31903,32396,35606,36118,36895,23403,24061,25613,33984,36956,39137, +29575,23435,24730,26494,28126,35359,35494,36865,38924,21047,63856,28753,30862, +37782,34928,37335,20462,21463,22013,22234,22402,22781,23234,23432,23723,23744, +24101,24833,25101,25163,25480,25628,25910,25976,27193,27530,27700,27929,28465, +29159,29417,29560,29703,29874,30246,30561,31168,31319,31466,31929,32143,32172, +32353,32670,33065,33585,33936,34010,34282,34966,35504, +35728,36664,36930,36995,37228,37526,37561,38539,38567,38568,38614,38656,38920, +39318,39635,39706,21460,22654,22809,23408,23487,28113,28506,29087,29729,29881, +32901,33789,24033,24455,24490,24642,26092,26642,26991,27219,27529,27957,28147, +29667,30462,30636,31565,32020,33059,33308,33600,34036,34147,35426,35524,37255, +37662,38918,39348,25100,34899,36848,37477,23815,23847,23913,29791,33181,34664, +28629,25342,32722,35126,35186,19998,20056,20711,21213,21319,25215,26119,32361, +34821,38494,20365,21273,22070,22987,23204,23608,23630,23629,24066,24337,24643, +26045,26159,26178,26558,26612,29468,30690,31034,32709,33940,33997,35222,35430, +35433,35553,35925,35962,22516,23508,24335,24687,25325,26893,27542,28252,29060, +31698,34645,35672,36606,39135,39166,20280,20353,20449,21627,23072,23480,24892, +26032,26216,29180,30003,31070,32051,33102,33251,33688,34218,34254,34563,35338, +36523,36763,63857,36805,22833,23460,23526,24713,23529,23563,24515,27777,63858, +28145,28683,29978,33455,35574,20160,21313,63859,38617,27663,20126,20420,20818, +21854,23077,23784,25105,29273,33469,33706,34558,34905,35357,38463,38597,39187, +40201,40285,22538,23731,23997,24132,24801,24853,25569,27138,28197,37122,37716, +38990,39952,40823,23433,23736,25353,26191,26696,30524,38593,38797,38996,39839, +26017,35585,36555,38332,21813,23721,24022,24245,26263,30284,33780,38343,22739, +25276,29390,40232,20208,22830,24591,26171,27523,31207,40230,21395,21696,22467, +23830,24859,26326,28079,30861,33406,38552,38724,21380,25212,25494,28082,32266, +33099,38989,27387,32588,40367,40474,20063,20539,20918, +22812,24825,25590,26928,29242,32822,63860,37326,24369,63861,63862,32004,33509, +33903,33979,34277,36493,63863,20335,63864,63865,22756,23363,24665,25562,25880, +25965,26264,63866,26954,27171,27915,28673,29036,30162,30221,31155,31344,63867, +32650,63868,35140,63869,35731,37312,38525,63870,39178,22276,24481,26044,28417, +30208,31142,35486,39341,39770,40812,20740,25014,25233,27277,33222,20547,22576, +24422,28937,35328,35578,23420,34326,20474,20796,22196,22852,25513,28153,23978, +26989,20870,20104,20313,63871,63872,63873,22914,63874,63875,27487,27741,63876, +29877,30998,63877,33287,33349,33593,36671,36701,63878,39192,63879,63880,63881, +20134,63882,22495,24441,26131,63883,63884,30123,32377,35695,63885,36870,39515, +22181,22567,23032,23071,23476,63886,24310,63887,63888,25424,25403,63889,26941, +27783,27839,28046,28051,28149,28436,63890,28895,28982,29017,63891,29123,29141, +63892,30799,30831,63893,31605,32227,63894,32303,63895,34893,36575,63896,63897, +63898,37467,63899,40182,63900,63901,63902,24709,28037,63903,29105,63904,63905, +38321,21421,63906,63907,63908,26579,63909,28814,28976,29744,33398,33490,63910, +38331,39653,40573,26308,63911,29121,33865,63912,63913,22603,63914,63915,23992, +24433,63916,26144,26254,27001,27054,27704,27891,28214,28481,28634,28699,28719, +29008,29151,29552,63917,29787,63918,29908,30408,31310,32403,63919,63920,33521, +35424,36814,63921,37704,63922,38681,63923,63924,20034,20522,63925,21000,21473, +26355,27757,28618,29450,30591,31330,33454,34269,34306,63926,35028,35427,35709, +35947,63927,37555,63928,38675,38928,20116,20237,20425, +20658,21320,21566,21555,21978,22626,22714,22887,23067,23524,24735,63929,25034, +25942,26111,26212,26791,27738,28595,28879,29100,29522,31613,34568,35492,39986, +40711,23627,27779,29508,29577,37434,28331,29797,30239,31337,32277,34314,20800, +22725,25793,29934,29973,30320,32705,37013,38605,39252,28198,29926,31401,31402, +33253,34521,34680,35355,23113,23436,23451,26785,26880,28003,29609,29715,29740, +30871,32233,32747,33048,33109,33694,35916,38446,38929,26352,24448,26106,26505, +27754,29579,20525,23043,27498,30702,22806,23916,24013,29477,30031,63930,63931, +20709,20985,22575,22829,22934,23002,23525,63932,63933,23970,25303,25622,25747, +25854,63934,26332,63935,27208,63936,29183,29796,63937,31368,31407,32327,32350, +32768,33136,63938,34799,35201,35616,36953,63939,36992,39250,24958,27442,28020, +32287,35109,36785,20433,20653,20887,21191,22471,22665,23481,24248,24898,27029, +28044,28263,28342,29076,29794,29992,29996,32883,33592,33993,36362,37780,37854, +63940,20110,20305,20598,20778,21448,21451,21491,23431,23507,23588,24858,24962, +26100,29275,29591,29760,30402,31056,31121,31161,32006,32701,33419,34261,34398, +36802,36935,37109,37354,38533,38632,38633,21206,24423,26093,26161,26671,29020, +31286,37057,38922,20113,63941,27218,27550,28560,29065,32792,33464,34131,36939, +38549,38642,38907,34074,39729,20112,29066,38596,20803,21407,21729,22291,22290, +22435,23195,23236,23491,24616,24895,25588,27781,27961,28274,28304,29232,29503, +29783,33489,34945,36677,36960,63942,38498,39000,40219,26376,36234,37470,20301, +20553,20702,21361,22285,22996,23041,23561,24944,26256, +28205,29234,29771,32239,32963,33806,33894,34111,34655,34907,35096,35586,36949, +38859,39759,20083,20369,20754,20842,63943,21807,21929,23418,23461,24188,24189, +24254,24736,24799,24840,24841,25540,25912,26377,63944,26580,26586,63945,26977, +26978,27833,27943,63946,28216,63947,28641,29494,29495,63948,29788,30001,63949, +30290,63950,63951,32173,33278,33848,35029,35480,35547,35565,36400,36418,36938, +36926,36986,37193,37321,37742,63952,63953,22537,63954,27603,32905,32946,63955, +63956,20801,22891,23609,63957,63958,28516,29607,32996,36103,63959,37399,38287, +63960,63961,63962,63963,32895,25102,28700,32104,34701,63964,22432,24681,24903, +27575,35518,37504,38577,20057,21535,28139,34093,38512,38899,39150,25558,27875, +37009,20957,25033,33210,40441,20381,20506,20736,23452,24847,25087,25836,26885, +27589,30097,30691,32681,33380,34191,34811,34915,35516,35696,37291,20108,20197, +20234,63965,63966,22839,23016,63967,24050,24347,24411,24609,63968,63969,63970, +63971,29246,29669,63972,30064,30157,63973,31227,63974,32780,32819,32900,33505, +33617,63975,63976,36029,36019,36999,63977,63978,39156,39180,63979,63980,28727, +30410,32714,32716,32764,35610,20154,20161,20995,21360,63981,21693,22240,23035, +23493,24341,24525,28270,63982,63983,32106,33589,63984,34451,35469,63985,38765, +38775,63986,63987,19968,20314,20350,22777,26085,28322,36920,37808,39353,20219, +22764,22922,23001,24641,63988,63989,31252,63990,33615,36035,20837,21316,63991, +63992,63993,20173,21097,23381,33471,20180,21050,21672,22985,23039,23376,23383, +23388,24675,24904,28363,28825,29038,29574,29943,30133, +30913,32043,32773,33258,33576,34071,34249,35566,36039,38604,20316,21242,22204, +26027,26152,28796,28856,29237,32189,33421,37196,38592,40306,23409,26855,27544, +28538,30430,23697,26283,28507,31668,31786,34870,38620,19976,20183,21280,22580, +22715,22767,22892,23559,24115,24196,24373,25484,26290,26454,27167,27299,27404, +28479,29254,63994,29520,29835,31456,31911,33144,33247,33255,33674,33900,34083, +34196,34255,35037,36115,37292,38263,38556,20877,21705,22312,23472,25165,26448, +26685,26771,28221,28371,28797,32289,35009,36001,36617,40779,40782,29229,31631, +35533,37658,20295,20302,20786,21632,22992,24213,25269,26485,26990,27159,27822, +28186,29401,29482,30141,31672,32053,33511,33785,33879,34295,35419,36015,36487, +36889,37048,38606,40799,21219,21514,23265,23490,25688,25973,28404,29380,63995, +30340,31309,31515,31821,32318,32735,33659,35627,36042,36196,36321,36447,36842, +36857,36969,37841,20291,20346,20659,20840,20856,21069,21098,22625,22652,22880, +23560,23637,24283,24731,25136,26643,27583,27656,28593,29006,29728,30000,30008, +30033,30322,31564,31627,31661,31686,32399,35438,36670,36681,37439,37523,37666, +37931,38651,39002,39019,39198,20999,25130,25240,27993,30308,31434,31680,32118, +21344,23742,24215,28472,28857,31896,38673,39822,40670,25509,25722,34678,19969, +20117,20141,20572,20597,21576,22979,23450,24128,24237,24311,24449,24773,25402, +25919,25972,26060,26230,26232,26622,26984,27273,27491,27712,28096,28136,28191, +28254,28702,28833,29582,29693,30010,30555,30855,31118,31243,31357,31934,32142, +33351,35330,35562,35998,37165,37194,37336,37478,37580, +37664,38662,38742,38748,38914,40718,21046,21137,21884,22564,24093,24351,24716, +25552,26799,28639,31085,31532,33229,34234,35069,35576,36420,37261,38500,38555, +38717,38988,40778,20430,20806,20939,21161,22066,24340,24427,25514,25805,26089, +26177,26362,26361,26397,26781,26839,27133,28437,28526,29031,29157,29226,29866, +30522,31062,31066,31199,31264,31381,31895,31967,32068,32368,32903,34299,34468, +35412,35519,36249,36481,36896,36973,37347,38459,38613,40165,26063,31751,36275, +37827,23384,23562,21330,25305,29469,20519,23447,24478,24752,24939,26837,28121, +29742,31278,32066,32156,32305,33131,36394,36405,37758,37912,20304,22352,24038, +24231,25387,32618,20027,20303,20367,20570,23005,32964,21610,21608,22014,22863, +23449,24030,24282,26205,26417,26609,26666,27880,27954,28234,28557,28855,29664, +30087,31820,32002,32044,32162,33311,34523,35387,35461,36208,36490,36659,36913, +37198,37202,37956,39376,31481,31909,20426,20737,20934,22472,23535,23803,26201, +27197,27994,28310,28652,28940,30063,31459,34850,36897,36981,38603,39423,33537, +20013,20210,34886,37325,21373,27355,26987,27713,33914,22686,24974,26366,25327, +28893,29969,30151,32338,33976,35657,36104,20043,21482,21675,22320,22336,24535, +25345,25351,25711,25903,26088,26234,26525,26547,27490,27744,27802,28460,30693, +30757,31049,31063,32025,32930,33026,33267,33437,33463,34584,35468,63996,36100, +36286,36978,30452,31257,31287,32340,32887,21767,21972,22645,25391,25634,26185, +26187,26733,27035,27524,27941,28337,29645,29800,29857,30043,30137,30433,30494, +30603,31206,32265,32285,33275,34095,34967,35386,36049, +36587,36784,36914,37805,38499,38515,38663,20356,21489,23018,23241,24089,26702, +29894,30142,31209,31378,33187,34541,36074,36300,36845,26015,26389,63997,22519, +28503,32221,36655,37878,38598,24501,25074,28548,19988,20376,20511,21449,21983, +23919,24046,27425,27492,30923,31642,63998,36425,36554,36974,25417,25662,30528, +31364,37679,38015,40810,25776,28591,29158,29864,29914,31428,31762,32386,31922, +32408,35738,36106,38013,39184,39244,21049,23519,25830,26413,32046,20717,21443, +22649,24920,24921,25082,26028,31449,35730,35734,20489,20513,21109,21809,23100, +24288,24432,24884,25950,26124,26166,26274,27085,28356,28466,29462,30241,31379, +33081,33369,33750,33980,20661,22512,23488,23528,24425,25505,30758,32181,33756, +34081,37319,37365,20874,26613,31574,36012,20932,22971,24765,34389,20508,63999, +21076,23610,24957,25114,25299,25842,26021,28364,30240,33034,36448,38495,38587, +20191,21315,21912,22825,24029,25797,27849,28154,29588,31359,33307,34214,36068, +36368,36983,37351,38369,38433,38854,20984,21746,21894,24505,25764,28552,32180, +36639,36685,37941,20681,23574,27838,28155,29979,30651,31805,31844,35449,35522, +22558,22974,24086,25463,29266,30090,30571,35548,36028,36626,24307,26228,28152, +32893,33729,35531,38737,39894,64000,21059,26367,28053,28399,32224,35558,36910, +36958,39636,21021,21119,21736,24980,25220,25307,26786,26898,26970,27189,28818, +28966,30813,30977,30990,31186,31245,32918,33400,33493,33609,34121,35970,36229, +37218,37259,37294,20419,22225,29165,30679,34560,35320,23544,24534,26449,37032, +21474,22618,23541,24740,24961,25696,32317,32880,34085, +37507,25774,20652,23828,26368,22684,25277,25512,26894,27000,27166,28267,30394, +31179,33467,33833,35535,36264,36861,37138,37195,37276,37648,37656,37786,38619, +39478,39949,19985,30044,31069,31482,31569,31689,32302,33988,36441,36468,36600, +36880,26149,26943,29763,20986,26414,40668,20805,24544,27798,34802,34909,34935, +24756,33205,33795,36101,21462,21561,22068,23094,23601,28810,32736,32858,33030, +33261,36259,37257,39519,40434,20596,20164,21408,24827,28204,23652,20360,20516, +21988,23769,24159,24677,26772,27835,28100,29118,30164,30196,30305,31258,31305, +32199,32251,32622,33268,34473,36636,38601,39347,40786,21063,21189,39149,35242, +19971,26578,28422,20405,23522,26517,27784,28024,29723,30759,37341,37756,34756, +31204,31281,24555,20182,21668,21822,22702,22949,24816,25171,25302,26422,26965, +33333,38464,39345,39389,20524,21331,21828,22396,64001,25176,64002,25826,26219, +26589,28609,28655,29730,29752,35351,37944,21585,22022,22374,24392,24986,27470, +28760,28845,32187,35477,22890,33067,25506,30472,32829,36010,22612,25645,27067, +23445,24081,28271,64003,34153,20812,21488,22826,24608,24907,27526,27760,27888, +31518,32974,33492,36294,37040,39089,64004,25799,28580,25745,25860,20814,21520, +22303,35342,24927,26742,64005,30171,31570,32113,36890,22534,27084,33151,35114, +36864,38969,20600,22871,22956,25237,36879,39722,24925,29305,38358,22369,23110, +24052,25226,25773,25850,26487,27874,27966,29228,29750,30772,32631,33453,36315, +38935,21028,22338,26495,29256,29923,36009,36774,37393,38442,20843,21485,25420, +20329,21764,24726,25943,27803,28031,29260,29437,31255, +35207,35997,24429,28558,28921,33192,24846,20415,20559,25153,29255,31687,32232, +32745,36941,38829,39449,36022,22378,24179,26544,33805,35413,21536,23318,24163, +24290,24330,25987,32954,34109,38281,38491,20296,21253,21261,21263,21638,21754, +22275,24067,24598,25243,25265,25429,64006,27873,28006,30129,30770,32990,33071, +33502,33889,33970,34957,35090,36875,37610,39165,39825,24133,26292,26333,28689, +29190,64007,20469,21117,24426,24915,26451,27161,28418,29922,31080,34920,35961, +39111,39108,39491,21697,31263,26963,35575,35914,39080,39342,24444,25259,30130, +30382,34987,36991,38466,21305,24380,24517,27852,29644,30050,30091,31558,33534, +39325,20047,36924,19979,20309,21414,22799,24264,26160,27827,29781,33655,34662, +36032,36944,38686,39957,22737,23416,34384,35604,40372,23506,24680,24717,26097, +27735,28450,28579,28698,32597,32752,38289,38290,38480,38867,21106,36676,20989, +21547,21688,21859,21898,27323,28085,32216,33382,37532,38519,40569,21512,21704, +30418,34532,38308,38356,38492,20130,20233,23022,23270,24055,24658,25239,26477, +26689,27782,28207,32568,32923,33322,64008,64009,38917,20133,20565,21683,22419, +22874,23401,23475,25032,26999,28023,28707,34809,35299,35442,35559,36994,39405, +39608,21182,26680,20502,24184,26447,33607,34892,20139,21521,22190,29670,37141, +38911,39177,39255,39321,22099,22687,34395,35377,25010,27382,29563,36562,27463, +38570,39511,22869,29184,36203,38761,20436,23796,24358,25080,26203,27883,28843, +29572,29625,29694,30505,30541,32067,32098,32291,33335,34898,64010,36066,37449, +39023,23377,31348,34880,38913,23244,20448,21332,22846, +23805,25406,28025,29433,33029,33031,33698,37583,38960,20136,20804,21009,22411, +24418,27842,28366,28677,28752,28847,29074,29673,29801,33610,34722,34913,36872, +37026,37795,39336,20846,24407,24800,24935,26291,34137,36426,37295,38795,20046, +20114,21628,22741,22778,22909,23733,24359,25142,25160,26122,26215,27627,28009, +28111,28246,28408,28564,28640,28649,28765,29392,29733,29786,29920,30355,31068, +31946,32286,32993,33446,33899,33983,34382,34399,34676,35703,35946,37804,38912, +39013,24785,25110,37239,23130,26127,28151,28222,29759,39746,24573,24794,31503, +21700,24344,27742,27859,27946,28888,32005,34425,35340,40251,21270,21644,23301, +27194,28779,30069,31117,31166,33457,33775,35441,35649,36008,38772,64011,25844, +25899,30906,30907,31339,20024,21914,22864,23462,24187,24739,25563,27489,26213, +26707,28185,29029,29872,32008,36996,39529,39973,27963,28369,29502,35905,38346, +20976,24140,24488,24653,24822,24880,24908,26179,26180,27045,27841,28255,28361, +28514,29004,29852,30343,31681,31783,33618,34647,36945,38541,40643,21295,22238, +24315,24458,24674,24724,25079,26214,26371,27292,28142,28590,28784,29546,32362, +33214,33588,34516,35496,36036,21123,29554,23446,27243,37892,21742,22150,23389, +25928,25989,26313,26783,28045,28102,29243,32948,37237,39501,20399,20505,21402, +21518,21564,21897,21957,24127,24460,26429,29030,29661,36869,21211,21235,22628, +22734,28932,29071,29179,34224,35347,26248,34216,21927,26244,29002,33841,21321, +21913,27585,24409,24509,25582,26249,28999,35569,36637,40638,20241,25658,28875, +30054,34407,24676,35662,40440,20807,20982,21256,27958, +33016,40657,26133,27427,28824,30165,21507,23673,32007,35350,27424,27453,27462, +21560,24688,27965,32725,33288,20694,20958,21916,22123,22221,23020,23305,24076, +24985,24984,25137,26206,26342,29081,29113,29114,29351,31143,31232,32690,35440, diff --git a/Ubiquitous/XiZi/lib/musllib/src/locale/langinfo.c b/Ubiquitous/XiZi/lib/musllib/src/locale/langinfo.c new file mode 100644 index 000000000..f17db6045 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/locale/langinfo.c @@ -0,0 +1,73 @@ +#include +#include +#include "locale_impl.h" + +static const char c_time[] = + "Sun\0" "Mon\0" "Tue\0" "Wed\0" "Thu\0" "Fri\0" "Sat\0" + "Sunday\0" "Monday\0" "Tuesday\0" "Wednesday\0" + "Thursday\0" "Friday\0" "Saturday\0" + "Jan\0" "Feb\0" "Mar\0" "Apr\0" "May\0" "Jun\0" + "Jul\0" "Aug\0" "Sep\0" "Oct\0" "Nov\0" "Dec\0" + "January\0" "February\0" "March\0" "April\0" + "May\0" "June\0" "July\0" "August\0" + "September\0" "October\0" "November\0" "December\0" + "AM\0" "PM\0" + "%a %b %e %T %Y\0" + "%m/%d/%y\0" + "%H:%M:%S\0" + "%I:%M:%S %p\0" + "\0" + "\0" + "%m/%d/%y\0" + "0123456789\0" + "%a %b %e %T %Y\0" + "%H:%M:%S"; + +static const char c_messages[] = "^[yY]\0" "^[nN]\0" "yes\0" "no"; +static const char c_numeric[] = ".\0" ""; + +char *__nl_langinfo_l(nl_item item, locale_t loc) +{ + int cat = item >> 16; + int idx = item & 65535; + const char *str; + + if (item == CODESET) return loc->cat[LC_CTYPE] ? "UTF-8" : "ASCII"; + + /* _NL_LOCALE_NAME extension */ + if (idx == 65535 && cat < LC_ALL) + return loc->cat[cat] ? (char *)loc->cat[cat]->name : "C"; + + switch (cat) { + case LC_NUMERIC: + if (idx > 1) return ""; + str = c_numeric; + break; + case LC_TIME: + if (idx > 0x31) return ""; + str = c_time; + break; + case LC_MONETARY: + if (idx > 0) return ""; + str = ""; + break; + case LC_MESSAGES: + if (idx > 3) return ""; + str = c_messages; + break; + default: + return ""; + } + + for (; idx; idx--, str++) for (; *str; str++); + if (cat != LC_NUMERIC && *str) str = LCTRANS(str, cat, loc); + return (char *)str; +} + +char *__nl_langinfo(nl_item item) +{ + return __nl_langinfo_l(item, CURRENT_LOCALE); +} + +weak_alias(__nl_langinfo_l, nl_langinfo_l); +weak_alias(__nl_langinfo, nl_langinfo); diff --git a/Ubiquitous/XiZi/lib/musllib/src/locale/legacychars.h b/Ubiquitous/XiZi/lib/musllib/src/locale/legacychars.h new file mode 100644 index 000000000..9639b4af9 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/locale/legacychars.h @@ -0,0 +1,40 @@ +256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274, +275,278,279,280,281,282,283,284,285,286,287,288,289,290,291,292,293,294,295, +296,297,298,299,302,303,304,305,308,309,310,311,312,313,314,315,316,317,318, +321,322,323,324,325,326,327,328,330,331,332,333,336,337,338,339,340,341,342, +343,344,345,346,347,348,349,350,351,352,353,354,355,356,357,358,359,360,361, +362,363,364,365,366,367,368,369,370,371,372,373,374,375,376,377,378,379,380, +381,382,402,416,417,431,432,536,537,538,539,710,711,728,729,731,732,733,768, +769,771,777,803,890,900,901,902,904,905,906,908,910,911,912,913,914,915,916, +917,918,919,920,921,922,923,924,925,926,927,928,929,931,932,933,934,935,936, +937,938,939,940,941,942,943,944,945,946,947,948,949,950,951,952,953,954,955, +956,957,958,959,960,961,962,963,964,965,966,967,968,969,970,971,972,973,974, +1025,1026,1027,1028,1029,1030,1031,1032,1033,1034,1035,1036,1038,1039,1040, +1041,1042,1043,1044,1045,1046,1047,1048,1049,1050,1051,1052,1053,1054,1055, +1056,1057,1058,1059,1060,1061,1062,1063,1064,1065,1066,1067,1068,1069,1070, +1071, +1072,1073,1074,1075,1076,1077,1078,1079,1080,1081,1082,1083,1084,1085,1086, +1087,1088,1089,1090,1091,1092,1093,1094,1095,1096,1097,1098,1099,1100,1101, +1102,1103,1105,1106,1107,1108,1109,1110,1111,1112,1113,1114,1115,1116,1118, +1119,1168,1169,1456,1457,1458,1459,1460,1461,1462,1463,1464,1465,1467,1468, +1469,1470,1471,1472,1473,1474,1475,1488,1489,1490,1491,1492,1493,1494,1495, +1496,1497,1498,1499,1500,1501,1502,1503,1504,1505,1506,1507,1508,1509,1510, +1511,1512,1513,1514,1520,1521,1522,1523,1524,1548,1563,1567,1569,1570,1571, +1572,1573,1574,1575,1576,1577,1578,1579,1580,1581,1582,1583,1584,1585,1586, +1587,1588,1589,1590,1591,1592,1593,1594,1600,1601,1602,1603,1604,1605,1606, +1607,1608,1609,1610,1611,1612,1613,1614,1615,1616,1617,1618,1657,1662,1670, +1672,1681,1688,1705,1711,1722,1726,1729,1746,3585,3586,3587,3588,3589,3590, +3591,3592,3593,3594,3595,3596,3597,3598,3599,3600,3601,3602,3603,3604,3605, +3606,3607,3608,3609,3610,3611,3612,3613,3614,3615,3616,3617,3618,3619,3620, +3621,3622,3623,3624,3625,3626,3627,3628,3629,3630,3631,3632,3633,3634,3635, +3636,3637,3638,3639,3640,3641,3642,3647,3648,3649,3650,3651,3652,3653,3654, +3655,3656,3657,3658,3659,3660,3661,3662,3663,3664,3665,3666,3667,3668,3669, +3670,3671,3672,3673,3674,3675,7682,7683,7690,7691,7710,7711,7744,7745,7766, +7767, +7776,7777,7786,7787,7808,7809,7810,7811,7812,7813,7922,7923,8204,8205,8206, +8207,8211,8212,8213,8215,8216,8217,8218,8220,8221,8222,8224,8225,8226,8230, +8240,8249,8250,8319,8359,8362,8363,8364,8367,8470,8482,8729,8730,8734,8745, +8776,8801,8804,8805,8976,8992,8993,9472,9474,9484,9488,9492,9496,9500,9508, +9516,9524,9532,9552,9553,9554,9555,9556,9557,9558,9559,9560,9561,9562,9563, +9564,9565,9566,9567,9568,9569,9570,9571,9572,9573,9574,9575,9576,9577,9578, +9579,9580,9600,9604,9608,9612,9616,9617,9618,9619,9632, diff --git a/Ubiquitous/XiZi/lib/musllib/src/locale/revjis.h b/Ubiquitous/XiZi/lib/musllib/src/locale/revjis.h new file mode 100644 index 000000000..3ab369f6e --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/locale/revjis.h @@ -0,0 +1,515 @@ +31,80,81,87,14,299,74,61,12,344,62,63,1280,1281,1282,1283,1284,1285,1286,1287, +1288,1289,1290,1291,1292,1293,1294,1295,1296,1297,1298,1299,1300,1301,1302, +1303,1312,1313,1314,1315,1316,1317,1318,1319,1320,1321,1322,1323,1324,1325, +1326,1327,1328,1329,1330,1331,1332,1333,1334,1335,1542,1536,1537,1538,1539, +1540,1541,1543,1544,1545,1546,1547,1548,1549,1550,1551,1552,1553,1554,1555, +1556,1557,1558,1559,1560,1561,1562,1563,1564,1565,1566,1567,1568,1584,1585, +1586,1587,1588,1589,1591,1592,1593,1594,1595,1596,1597,1598,1599,1600,1601, +1602,1603,1604,1605,1606,1607,1608,1609,1610,1611,1612,1613,1614,1615,1616, +1590,29,28,33,37,38,39,40,342,343,36,35,338,75,76,263,77,337,266,267,265,268, +300,301,302,318,303,319,281,282,60,324,326,70,315,297,298,288,287,328,329,71, +327,325,321,65,320,68,69,322,323,285,286,283,284,316,317,1792,1803,1793,1804, +1794,1805,1795,1806,1797,1808,1796,1807,1798,1819,1814,1809,1800,1821,1816, +1811,1799,1815,1820,1810,1801,1817,1822,1812,1802,1818,1823,1813,258,257,260, +259,262,261,256,93,90,92,91,349,89,88,73,72,341,340,339,0,1,2,22,24,25,26,49, +50,51,52,53,54,55,56,57,58,264,269,43,44,32, +768,769,770,771,772,773,774,775,776,777,778,779,780,781,782,783,784,785,786, +787,788,789,790,791,792,793,794,795,796,797,798,799,800,801,802,803,804,805, +806,807,808,809,810,811,812,813,814,815,816,817,818,819,820,821,822,823,824, +825,826,827,828,829,830,831,832,833,834,835,836,837,838,839,840,841,842,843, +844,845,846,847,848,849,850,10,11,20,21,1024,1025,1026,1027,1028,1029,1030, +1031,1032,1033,1034,1035,1036,1037,1038,1039,1040,1041,1042,1043,1044,1045, +1046,1047,1048,1049,1050,1051,1052,1053,1054,1055,1056,1057,1058,1059,1060, +1061,1062,1063,1064,1065,1066,1067,1068,1069,1070,1071,1072,1073,1074,1075, +1076,1077,1078,1079,1080,1081,1082,1083,1084,1085,1086,1087,1088,1089,1090, +1091,1092,1093,1094,1095,1096,1097,1098,1099,1100,1101,1102,1103,1104,1105, +1106,1107,1108,1109,5,27,18,19,3915,8793,6934,10843,7493,6671,7492,4379,10291, +11294,12033,4110,4685,12034,7939,12577,5173,10521,7494,11549,10529,12035,8773, +12036,5465,12037,4924,8719,6982,12038,12039,12040,9748,5174,9750,9538,5922, +10770,18472,12041,7495,12042,4372,5444,5967,11080,13573,11343,9564,4868,5140, +12043,12044,11546,11292,8263,12046,6741,9554,12049,4125,5950,5949,3909,11818, +11817,6418,3840,12050,12051,12052,10771,12053,5969,3910,10833,5211,5212,5213, +9025,11547,12054,12055,12056,7724,7193,7725,12061,12059,12060,5175,6402,4431, +12058,12057,10504,6693,6692,8477,12062,10292,8006,23,12063,12065,8516,11584, +3881,12064,4381,5411,8774,5710,12066,9731,4938,12067,3882,5951,4939,10329, +10001,5176,4432,12102,9248,9803,12069,10011,11585,7692,6694,6742,4383,9008, +8705,12073,3883,9026,7194,6419,11267,8493,4382,12072,11293,12068,12070,6477, +12071,13315,12079,12082,12080,4385,10522,12074,12078,5970,6695,4869,12083, +12075,11586,6743,12076,12081,12084,12077,5376,3884,5377,4384,13316,10840, +10317,5971,7694,11542,10551,5655,8452,4419,7218,12088,12093,12091,12086,8462, +12089,12092,12090,10556,12087,7693,10834,12094,12095,7171,12108,9775,10261, +12103,10575,4373,12107,12101,12110,8241,5923,9787,16166,12109,9276,12098,5973, +5972,12096,6969,12104,10574,8748,12100,5712,12097,12105,12099,11568,12106, +11808,5445,5711,12111,12112,12116,3885,10543,12115,12114,12118,12117,9027, +5713,12119,6948,8453,9028,5461,12120,5141,12121,12123,10772,5701,6672,10070, +12122,6436,11298,12125,12290,12124,6435,7260,5656,12291,5422,12288,12289,9486, +8283,5378,10796,12292,11548,12293,12296,12294,8237,12295,12297,12299,12298, +10535,5142,12301,12302,4366,12300,6995,12305,12304,12303,12085,12306,7261, +12307,11268,11064,12309,12308,12311,12310,12312,12313,3923,5908,5658,7195, +8794,5379,8007,5974,6221,12315,11047,9253,6744,12314,12316,9277,4692,12317, +9565,8211,12319,12320,9995,5975,11802,12321,5381,10523,8469,5456, +9236,5714,12322,12323,9537,4158,12326,6492,12325,6437,12327,17741,12328,10784, +12329,12330,12331,7496,6955,4870,12334,12332,11036,12333,10297,12335,12336, +12337,9278,12341,12339,12340,12338,6466,12342,11081,11587,12343,7943,12344, +7225,12345,8795,11550,9279,12580,12346,21252,5412,12347,10813,7239,8539,12349, +9539,12350,12351,4621,12352,5382,9515,4185,7215,9984,12353,9280,7726,12354, +10507,7993,4865,4872,12355,12357,5657,12356,11602,7240,10012,10539,12358, +11351,12359,12360,9309,12361,7944,6493,5715,12362,6696,6222,9029,12364,8454, +6478,12365,12366,8207,12363,12368,10773,6211,12367,5716,6461,9804,12371,12369, +10330,7497,12378,4675,12372,12370,8238,12374,12373,4643,5695,12379,11532, +12375,12380,12377,12376,11566,5976,4386,11603,7252,9271,6212,12545,12546, +11588,11786,12548,5977,12547,4622,12549,10805,8987,11269,10552,12550,20276, +9487,12551,4873,11026,7424,12552,10566,12556,7945,12553,5423,12554,4874,5645, +12557,12558,12559,12560,6970,5978,11069,11079,9558,10576,12561,12562,12564, +12566,12565,12567,4380,10795,6491,12568,8248,7425,5384,12569,10042,12570, +12571,12572,12573,10243,5447,3908,9502,12574,7196,8008,12576,12575,7426,5952, +12578,10013,12579,10043,8467,8525,5383,9549,8720,9805,10797,12581,8009,5652, +12582,12583,4107,3924,4940,8455,5168,11344,12586,4374,12585,5385,12587,11088, +12588,11569,5979,5909,12589,12591,12590,7742,4120,4157,12592,12593,5910,12594, +5197,6673,12595,10835,6420,5177,11270,8239,10014,7004,7206,6983, +6996,7253,10015,12598,4130,8240,5980,5924,5446,12602,8704,8541,5386,7427, +12603,12601,4387,8517,6935,6698,4101,4687,6213,6697,12604,12605,5160,4645, +6214,5159,9022,4100,9488,11037,6144,11352,9254,5981,5646,12614,5442,10793, +10044,12613,4925,12608,12609,12611,12612,5178,7744,10508,12610,12606,5954, +12607,11779,10577,9031,5953,6223,12615,9532,12619,7005,6997,12622,12620,11010, +12617,12626,12621,12624,5925,11038,12625,12627,12629,6479,11809,12618,12616, +12628,12623,12631,12802,12633,12637,12800,12634,12829,6472,4624,12632,12804, +3925,12803,3844,10281,12801,12635,12630,12636,6439,12805,3926,12814,12806, +12807,7428,10824,12812,12811,9230,12813,12810,4115,6421,7695,12808,9281,12809, +3841,12819,11266,7430,12825,12824,12815,8482,12816,8526,12821,7429,12818, +11075,5659,12822,12823,12820,12826,12817,12832,12837,12833,12828,12838,8208, +12840,6145,12830,8796,12834,12827,4876,4941,4676,12835,12831,5717,12841,12839, +8242,5161,5387,12836,5459,4131,12845,12843,13062,12848,12842,12846,12844,6699, +12847,12850,12855,12853,12852,8721,4388,12849,12851,7431,4114,12854,4413, +12865,7515,12861,12859,12860,12862,4124,8216,12856,12857,4697,12864,4942, +12867,12863,12866,10509,9524,10007,12869,12868,4644,12870,12873,12872,12871, +9752,12874,12875,12877,12876,12879,12882,12880,12878,12881,12883,12884,12885, +12886,12887,12324,7003,6700,4434,3927,8739,12888,6403,3886,7741,12889,5926, +6224,12891,12890,10559,12892,13056,12893,13057,13058,5718,4159,13059,13061, +13060, +13063,9273,13064,3860,6462,5660,8750,13065,13066,13068,13069,6467,5424,10774, +13067,13070,6432,6146,13074,6404,8722,13071,9017,13075,7745,13073,13076,5662, +13077,13078,6147,4639,13080,13081,13082,13079,13072,13083,13084,10819,7498, +13086,13087,13085,13089,9751,3911,10293,13090,7516,6936,9788,4943,6474,10808, +9489,5719,8494,13088,13091,8483,13092,13093,13095,9032,4877,21248,4160,10578, +7499,9255,6469,13101,10524,11580,4435,13097,8217,13100,9282,9256,9283,10008, +9004,6440,13096,4181,9237,13098,13094,7727,13102,7213,5388,13103,10567,8284, +8997,13105,10798,13106,13111,10510,13110,13104,13107,13109,6405,10536,13112, +8740,4436,7500,13114,13113,6215,13115,13117,13116,13119,13108,13121,13120, +13118,6701,7728,8243,13122,7963,3916,9795,9018,13124,13123,13125,13126,13127, +13128,10544,13129,4389,13130,11291,4623,12584,7207,8478,13131,11082,11027, +13133,8518,9238,8479,10294,13134,13135,4186,6937,13136,3887,13137,13138,4161, +4944,9535,10579,13142,8244,13141,5663,10810,13140,9284,13144,13143,13146, +13145,4187,13147,7432,13149,8708,13148,10514,7254,9274,13312,6148,13313,9728, +10045,11056,9732,13322,5143,11300,11022,13579,13314,13317,8484,10775,9257, +13318,10820,6441,7433,13319,6703,6702,3864,5927,7946,3888,13323,13324,13321, +4119,4878,13320,11044,10256,3847,3928,6704,3889,3842,13329,13327,11035,13330, +13328,13326,7696,13325,10553,5955,13334,13335,7434,13331,11787,9771,13333, +6406,13336,10295,13337,13332,11034,9789,13338,10257,13339,13343, +13340,4390,13342,6938,13341,5720,13355,13348,13345,8771,13344,13346,13347, +13349,13350,4945,13352,13351,13353,7501,13356,9019,4132,13354,13357,13358, +13361,13359,13360,6705,13362,6149,13363,6745,8471,13364,13365,6713,6150,11057, +5127,5928,13366,4663,13367,8472,13368,13570,13369,13370,13371,13373,13374, +13375,8527,4102,6984,3873,8246,4879,6932,6151,9285,7168,4880,8775,9033,3863, +5144,10580,6945,5169,8010,6939,11271,13376,5179,6442,4625,4162,7435,4391, +13377,11301,7208,6979,13378,4946,9521,11016,13379,13380,10296,13382,4871,5462, +13381,4881,7697,13386,6656,4392,13385,13383,13387,13384,9738,15148,7698,13388, +11551,13389,13391,8797,13390,7938,6746,8495,6998,10324,8011,6956,13392,7436, +13393,13394,3890,8473,7729,13395,9490,7437,7438,13396,8012,7439,13397,13398, +11071,13399,5413,7169,13400,13401,6971,7691,9555,7731,10071,9729,5416,13402, +5198,13403,5469,9518,4367,6706,13404,13569,13568,5468,13405,9239,8463,9258, +6951,8247,11353,13571,13572,9525,6674,13574,13575,13576,4947,13577,13578,4363, +8218,4931,13580,11015,8497,4664,13582,13584,4926,13581,13583,13586,13585, +13587,13588,9500,5389,4420,13589,13594,13592,10582,10581,9286,13591,7219, +13590,7761,13595,6473,13601,13602,13596,4626,13597,13606,13605,13604,13600, +13599,13603,10583,13610,13607,13609,11345,13608,13598,7762,13611,6422,13612, +13613,13616,13615,13614,9287,13593,13622,13618,13617,13619,13620,13623,11589, +13624,13621,13625,4927,13626,13628,13627,13629,13630,8013,7170, +7235,8258,6152,6423,6153,5199,13631,6424,5929,13632,11013,9762,13633,6154, +4875,8710,5425,6707,10298,10016,13634,4948,13637,8960,13636,13635,13638,9034, +7746,6708,7977,8498,5121,8961,13639,13640,7502,10776,13643,13642,13641,10332, +13650,10809,13644,13646,10826,13645,13647,9991,13648,10525,13649,4882,10526, +9742,13651,13652,6155,4883,13653,5911,11299,11272,4949,13655,8962,6156,7440, +10046,7441,7255,9035,10584,9240,6157,10299,13656,9272,6433,5930,9036,3874, +7245,6158,11302,13657,13658,9776,13659,11606,11788,13661,13660,4646,13824, +13827,13828,13826,10271,7442,13830,13829,13825,13831,13832,13833,13836,13834, +13835,13837,4163,9037,13838,5721,4437,9749,13839,9562,10554,13840,11789,13841, +10527,13844,12032,12048,6927,9556,13845,5180,8963,3929,13846,10501,6159,8751, +9038,11086,5912,5931,13847,13848,13854,6980,8964,5390,13849,10250,8741,13850, +13851,5391,13852,13853,13855,9301,13856,13857,13858,13843,13842,13859,5664, +10246,6443,10262,8965,10282,13860,7443,4133,13861,13862,11089,10047,13865, +4188,7947,13864,13863,5665,8499,13869,13867,13866,11526,5956,7256,13868,9259, +7197,9503,13872,13871,13870,13873,5957,13874,10331,7226,13875,10072,9504,8966, +9231,13876,5130,7699,10251,4950,9733,13877,6709,10777,10778,4189,13882,8776, +13879,4438,14092,13881,9743,13880,13878,6233,13884,13890,13896,13888,9275, +13893,10300,13887,13892,11590,6710,8500,13885,5181,13895,7948,4164,13889,4439, +13894,5392,13891,13897,13899,13909,13907,13904,13903,11607, +13905,5393,6160,7257,13912,13898,13902,13886,4441,13906,13908,8752,6407,4375, +13900,13911,13910,5394,8456,4677,5666,13901,13913,13916,14080,6940,14086,9039, +13914,14084,4440,14082,14083,13917,14081,5958,11273,4884,4152,14085,9753,3852, +10048,13883,14091,14095,11076,14088,9288,14093,7503,14094,9526,11814,14090, +14096,6234,7978,3891,14089,14087,8249,13915,6675,8485,14108,8250,14103,14100, +14101,6981,14104,14107,14102,7172,14105,14099,11099,11098,14109,14110,3892, +14098,5457,3845,4885,14106,14114,14113,14118,14119,14117,14120,14112,14116, +14121,14122,14111,6747,14115,8501,6161,14097,7700,14135,10568,14125,14126, +14127,14134,14133,10844,4886,14131,5668,4627,14128,11543,14130,3893,14132, +14123,14129,14136,5667,14124,11324,11274,14139,14143,8285,11608,14144,14141, +14138,14137,14142,10511,9491,5669,14145,14140,14146,5722,4368,14154,4887, +14152,14153,6408,14151,14149,14148,14155,14147,14157,4442,14159,14158,8967, +14162,14160,14150,5723,14161,14165,14164,14166,14163,14167,14168,14169,10569, +14171,14170,7198,7949,4421,4443,14172,3870,7979,14173,19234,14336,5696,14337, +8014,14338,14339,5145,14340,14341,14342,8502,5932,11072,10779,7241,14343,8015, +19740,10049,6985,6444,14344,8486,10502,8528,14347,14345,14348,14346,14349, +10512,3862,10301,10050,14350,14353,7444,5146,14351,14358,7445,14352,9763, +11325,14354,14355,14359,9289,14356,6162,7997,14373,10003,8529,10051,14604, +10585,9040,10836,14362,4352,8777,14371,8723,14365,14372,14367,14374,14370, +14369,9806,14363, +4444,14361,5200,8530,14357,14360,6163,7994,7446,14368,9777,5201,4647,4678, +7680,14376,14381,14377,5724,14382,6657,6216,7173,14364,6748,14379,6711,14380, +3875,14375,8968,5202,5395,14378,3846,6434,7701,9041,10035,14384,8253,8457, +6666,14385,14387,14383,10560,8988,8251,10586,6957,14399,14398,7767,5725,14392, +7448,9543,9744,14390,8252,6999,14395,7447,14389,14394,9778,14388,5632,4668, +14396,11530,6445,8724,14393,7995,6164,7747,4165,8219,14391,5156,5670,9006, +14397,8254,14400,14402,8470,14408,14403,14405,10272,9042,14406,11275,11303, +4888,3853,14404,14401,4951,4166,14407,11304,14411,8474,14418,14412,14409, +14416,14386,14413,14417,10017,9290,14410,14414,5671,6480,7996,14422,9221, +14419,10815,14420,14421,11053,7937,5697,14428,6676,14425,14424,9745,9492,9232, +14426,14427,10318,9764,6658,8016,10799,4648,14596,14429,11305,14598,14594, +14595,8255,14593,14366,14597,14592,14602,14603,9222,14605,6659,14600,5147, +14606,14599,14610,14609,14608,14611,14613,7504,14612,14616,14614,14615,14415, +14618,14617,14423,14619,14607,6712,14620,14621,14623,14622,14624,4445,6165, +10587,7950,5933,14626,14629,10289,5182,14628,14627,9779,14630,5396,14632, +14631,4889,6677,9527,5672,7763,14633,7951,9223,10302,14634,14635,14636,10519, +13372,7973,10283,6455,10052,10018,9260,11552,14638,6959,14639,3861,5427,7980, +10303,14640,6689,8742,6714,7702,14641,10588,4182,6715,14644,14642,14645,11544, +14643,8026,14646,8465,14647,4953,14649,14648,14650,14651,4954,9563, +8725,5195,6716,8256,7227,3855,14652,4353,14656,6166,14655,6410,7449,14654, +7450,11039,6409,3894,7981,14661,7952,4134,7220,10821,6481,7451,7942,14660, +14658,14659,8778,14853,14665,6749,6167,14663,14664,7703,14662,6670,14667, +14666,14671,14672,14668,4609,14669,14670,10036,10304,5673,14673,7953,7452, +8753,5414,14674,14678,4394,14675,14677,14676,7242,8743,3876,14679,14680,8969, +11600,6690,10570,10780,14849,14682,14685,14684,14681,14848,9533,14683,14850, +7243,14851,11306,9815,14852,14854,14855,14856,5417,4135,6168,14857,14858,7248, +8257,12599,8221,8220,8503,6438,12113,5709,11276,10589,10333,14859,6482,8990, +14860,11790,10781,8970,14861,4955,14862,14863,11065,11011,10837,10811,6660, +14865,6986,10800,14867,14870,14869,4952,5183,14866,14868,14871,7768,11354, +3880,6463,8475,6972,7506,14874,9261,14872,8458,14873,7505,11068,14875,14876, +11335,14881,6169,9780,14878,9291,14653,14657,5166,9766,14880,7453,10019,14886, +10073,14877,14883,14882,7982,10828,11570,10822,4395,6717,11815,14885,7764, +14884,14879,5934,14891,14889,4396,14887,14893,14899,8487,10528,14901,10241, +14900,9807,10782,4890,8022,7199,9010,11277,14896,14895,14897,14894,14902, +14892,14890,14898,14888,8779,11095,6949,6483,6425,10830,4640,9005,9513,4136, +8017,7955,5641,14904,6170,4699,14906,4691,14912,14909,8018,4650,6411,4649, +6446,14907,5700,5674,9292,14905,3877,14908,14910,5420,5643,4891,5162,14913, +6488,10832,6678,14914,10255,14926,4370,14915,14932,14916,11553,14923, +9790,14931,14918,3859,14920,6171,14922,14921,14917,14928,7454,13132,5959, +11355,14919,9043,4610,6412,14911,14927,4672,14925,14929,9293,4957,15121,11048, +14934,4956,14941,10783,15104,15106,15110,14936,8713,9294,15114,14939,15111, +15105,7704,15115,7954,15113,4892,11823,14933,15109,3895,14935,11033,14940, +7681,8998,14930,15108,7769,15118,4688,5888,15120,14937,15119,15112,14938, +15116,15117,15134,9517,15107,15130,15132,9015,11307,10325,15127,8489,15133, +8222,15124,15137,15136,9550,15135,9545,15139,15126,5415,15129,7228,9791,15131, +5418,15123,15125,15122,11791,4665,15128,15138,4628,6470,4156,15155,11792, +15158,7705,15157,15156,15153,15141,15170,15140,15159,15151,15146,15143,15144, +15152,21249,15149,6172,8999,8259,15147,15142,15145,11308,10825,15150,15160, +15168,15161,15174,15172,15167,15166,9007,8260,15164,15162,15169,15175,10068, +15181,15176,15179,15173,8787,10263,15163,15171,7455,11054,15191,15178,5889, +4354,4670,15154,7456,15183,15190,7000,4689,8717,15180,15185,15189,5397,5163, +15187,5120,9514,15186,15188,15182,15184,4671,8744,15195,15193,5960,15192, +15360,14903,15194,15196,15197,15371,15367,14924,15366,15365,15362,15177,15364, +15363,15369,11781,15372,5466,15368,15370,9990,15373,15377,15374,11346,15375, +15165,15378,15379,4116,15381,5702,6912,5428,4355,11326,15383,15382,15385,5148, +5429,4893,15388,15387,15389,4397,8726,15390,4894,15392,15391,15393,15394, +15395,6718,7956,6400,10319,10561,11811,6740,6447,11601,15396,15397,6719,15398, +15399,15401,15400,10807, +7229,6987,6691,15402,15404,7682,15403,15405,15406,15407,15408,15409,15411, +15410,15412,4356,8745,15413,6661,4651,15414,9249,13099,5122,15415,15416,10571, +10823,9510,15417,10053,10074,11058,15418,15420,15419,15422,15421,15424,6720, +11024,15425,15426,5123,15427,15429,15428,7748,10264,4137,10020,9044,7200,5184, +10021,6925,15431,4895,4183,9553,15430,6173,8754,15432,15440,15433,8480,5185, +15441,5703,5124,15439,15437,15434,11327,8991,9528,15435,15443,15442,5634,4364, +6426,15436,15438,10806,8531,10838,15451,15452,4398,10503,11100,15616,6914, +7457,15447,15453,4167,5398,15444,15449,8019,9808,10054,15446,10752,15448, +15619,15617,15450,10753,9767,5186,9220,8780,15620,15618,8504,15445,4138,11309, +15631,15630,8021,15627,11339,9493,15621,8996,4139,6174,15624,7174,15629,15628, +15623,15626,4679,15625,9768,11533,7507,8020,15637,15635,10284,15632,15634, +4121,6175,11793,4636,10305,11328,4611,7706,15636,15641,7458,11279,15638,15633, +15639,11581,9298,9505,4629,4148,15645,15648,11554,11331,15655,15649,15646, +11571,15652,7209,15654,15659,9296,15657,15651,8727,15658,15647,15653,15660, +3931,15650,15661,7707,7230,10500,6413,15642,15656,9241,7957,4680,6448,7459, +15644,7201,5675,15643,15665,7244,5913,15680,15674,5203,9262,15669,15678,3854, +4113,4376,15671,8459,15662,15664,6176,15681,15676,15668,15675,11018,15673, +15677,5935,7460,8728,15667,11278,15670,15663,9297,15666,15672,11824,6941, +10845,15682,9997,15694,5914,7231,15684,11534,6177,15697,3917,15695,15683, +15689,15691,11310,15686,9229,15688,15696,15690,11046,15685,6913,15709,4681, +15687,15692,15693,8523,8505,15701,15707,15705,9224,15874,15702,15703,15679, +5208,10265,6942,6230,11794,15699,15873,4168,8261,9816,4896,11609,11008,9009, +15706,15708,8209,15872,15704,15698,4898,5704,15886,15881,8023,4674,7232,15890, +15883,8971,15880,9016,15915,15877,15876,15885,15879,15878,15884,7936,15875, +15887,15888,4897,15893,15892,15894,15897,9250,15891,15895,5698,8536,15889, +9754,15896,15901,15899,15902,15905,15898,6217,9735,15640,11347,15900,15904, +8532,15903,15882,20040,15908,15912,15910,15906,15907,15911,15909,10285,15917, +15914,15913,15916,9523,15918,8788,8524,7940,15919,15921,15920,15700,15922, +9542,15923,4399,9299,4612,5187,6973,6449,11782,7749,4169,15925,15924,15928, +8729,15931,15926,15930,15929,9247,3896,11604,15933,4103,15935,15934,15932, +15927,10754,15937,15936,4170,15939,10513,15938,11028,7462,8210,7461,11610, +15945,8024,15941,15946,4171,15944,9792,15940,15943,7463,10032,15947,6960,8025, +15950,15942,5638,15948,11311,15951,21253,7214,15952,15953,9741,15955,15956, +9746,9300,15958,15960,11572,15957,15959,4172,15954,12858,15961,8262,6679, +15963,15962,7683,12600,15964,16128,15949,15965,16129,9817,16130,16131,16132, +16133,9021,16135,16134,16136,16137,6974,10306,11083,16138,16139,8245,6915, +16140,16141,16142,10545,10022,16143,9782,8972,16144,4422,5196,11045,11029, +4371,11795,10801,10505,7958,16145,9506,5890,16146,6451,16148,16147,16149, +16150,16151,5149,16152,16153, +5891,10023,16155,7508,16154,5399,16156,16158,16157,16159,5936,16160,5448,8223, +6236,16162,16163,16161,6988,9511,5400,16165,8715,16164,11796,9793,16168,16170, +16167,11059,16169,16171,11555,16175,16174,8789,9740,5892,16173,16172,11280, +11281,16176,4173,6229,6721,16177,16178,16180,7202,16182,16181,16183,4652, +16185,16184,16187,16186,5915,11527,5419,4357,5449,4928,11591,16189,16191, +16192,4400,16188,6680,8992,16190,16195,6989,16193,5661,10024,16194,16221, +16200,5916,5188,16197,11356,11535,8533,16199,16201,11573,5430,10075,9769, +16202,16204,16207,16203,16206,5961,4140,16208,7759,16205,11579,16211,21251, +16209,16212,16198,16210,6427,16213,16214,11357,16215,16216,16196,16217,4899, +6916,16218,16219,16220,4122,16384,10266,16385,4867,16386,16387,16388,16390, +16391,16389,10290,16393,16392,16395,16394,16396,16397,16399,16398,6232,16401, +16400,4900,7730,9243,16402,7959,6681,4184,16403,11312,10562,16404,9251,11282, +6178,7708,8746,12563,8973,4423,16405,16406,16411,16409,16408,14625,4613,16407, +3897,9993,10025,11536,16412,16410,8763,7941,9994,10252,16414,11531,5676,16415, +16413,10037,16416,16417,3898,7509,16422,16419,9548,16418,5125,16425,16420, +16421,16424,16423,10244,8225,8224,5150,16426,16427,16428,16430,16429,4149, +16438,10055,16432,16434,16436,7709,16437,16435,6943,16431,16433,10273,7464, +16440,16439,16441,6917,6414,9302,16442,9002,16444,11520,16443,8264,16449, +16451,16452,8755,16450,16447,16445,16446,16448,16455,16453,16454,16456,16458, +16459,16460,16461,16457, +16463,16462,16464,11556,16467,16465,16466,4929,11101,10537,16469,16468,16470, +16471,16475,16472,16473,16474,16476,16477,16640,16641,16642,9998,9263,16643, +9809,10259,16644,16645,9225,4614,6179,16646,16647,16648,6664,16650,16649, +16651,16652,10056,16653,16654,21064,16655,16656,16657,6669,16658,9781,10814, +4141,4150,16659,16661,16660,9295,7960,15384,16662,11040,16663,4901,10038, +16664,16665,16666,11067,11060,8989,8265,16668,7233,7465,16671,16670,16669, +10076,4902,5896,16677,16674,7710,11025,16673,16675,16676,16672,16678,16679, +8974,4930,8772,16680,16681,16684,7750,9507,16685,10802,16682,16683,16688, +16687,16686,16690,16689,16691,16693,16692,10540,7221,11557,16694,9494,16695, +16696,16700,16698,16699,16697,16701,16702,16703,16704,11030,16705,11087,16706, +8749,9801,5450,8730,16707,5401,7983,16708,6428,16709,16710,5893,6452,16712, +9269,6453,5165,10755,9770,9270,6203,16714,7466,11537,6180,5894,9986,16716, +16718,5962,16717,9045,16720,4630,16715,10057,4111,6475,11825,16719,16721, +10538,7992,16723,16724,16722,4653,16730,16729,6918,16731,16726,16732,16727, +10039,16725,16728,16897,16896,10816,16733,3914,16899,16898,7467,16900,8226, +16902,16901,16903,16711,16713,16905,16904,6919,11592,6961,16906,5654,5151, +5126,6722,11283,16912,16911,8227,16908,16910,7210,7711,16909,16907,9737,7468, +10267,6454,9303,16913,16914,16936,5431,11804,8212,16915,4401,9046,10496,16916, +5209,16917,16919,16920,9736,16921,16922,16923,5432,4402,9508,7175,6723,16924, +7176,4393,10274,16925, +10058,8228,16928,16929,9800,7712,16926,8768,16927,7469,3899,5128,16930,9047, +16931,7974,11020,10242,16932,16933,8756,11558,16935,16934,6990,16937,3919, +16940,16938,4403,5677,16939,6181,6225,10565,16941,10803,16943,7984,4142,4377, +3851,16942,16944,16945,7510,16946,4654,16948,5705,5189,16949,5460,16950,8027, +9516,7999,6484,16951,8769,8266,16953,16955,16952,16954,5633,16956,5637,5190, +11313,16958,16959,4109,16962,4693,16961,16960,16964,16957,16965,11528,16966, +16967,13139,16969,16968,16970,16971,11540,16972,20302,7470,16973,16974,7222, +9495,16975,8711,16976,8731,16977,5380,12318,8764,6930,4903,16978,17153,16981, +5191,16980,17155,16979,7471,16983,16984,9226,16985,4669,7737,10307,16987,8519, +16982,16986,16988,6490,17157,10253,9989,9304,5433,17156,17154,10004,16989, +8765,9306,9305,6485,17175,17159,17161,17164,17165,17162,17163,17160,17158, +17152,10542,4404,17172,17169,17174,17173,9810,11014,6682,17167,17176,17171, +17170,17166,17168,4904,8732,8028,9985,17181,9987,8000,17178,10030,17182,10546, +8762,17177,17179,17180,17183,6947,9509,17188,17187,17184,11797,17193,17197, +17194,17190,17191,17196,17185,12596,17192,17186,17195,17201,4905,17198,17199, +17200,17203,17202,10069,17204,11611,10572,17209,17206,17205,7985,17208,17210, +17207,17214,17211,17212,17189,17213,17215,17216,10533,17217,11073,5421,5640, +17218,10515,7751,11023,17219,11538,9811,8229,9747,7212,3871,17224,17222,17220, +4864,7472,17225,17223,17221,17229,17228,17227,17226,17230,17231,7961,17232, +17234, +17233,5937,8215,17236,9307,17235,17237,10516,8267,6182,17238,11559,17240, +17241,17242,17243,6724,17244,5678,5193,5129,17408,11090,6183,17245,17411, +11077,9755,10258,7234,17410,6962,6184,6725,5192,10517,17409,8230,10785,6486, +6726,9020,17414,11582,6456,17415,7713,17417,7473,6415,17416,7177,5917,8231, +17412,17418,17413,5679,17421,17425,5706,17420,17429,6185,11340,3867,17426, +5194,17423,17424,9308,17422,17419,4615,8003,5895,17431,17428,17430,17427,5680, +8466,17432,8269,17445,17441,17435,17439,7001,3900,17434,17442,17446,6186, +11061,9013,17436,17444,17433,8733,17438,3868,11049,17437,5434,10059,8268, +11567,7246,17485,17447,8029,17443,17448,17450,9048,17453,17449,10547,4906, +11050,3901,17452,11612,17451,4174,9547,17454,17461,17455,17462,17458,9818, +6953,17460,17457,17463,17456,7203,10756,7211,17459,17471,17467,17470,17468, +17472,17466,17440,7986,10026,17469,17464,8192,5681,7178,7684,8213,17475,17477, +17478,17474,17476,17465,17473,17481,17480,10841,5642,17479,17483,17482,17486, +17488,6683,17484,17489,17490,17491,17497,9242,17493,17492,17494,17495,17496, +17498,17499,4907,17500,17501,17664,17665,17666,17667,17668,17669,17671,17670, +17672,17673,17674,17677,17675,17676,6464,5682,8757,10002,7247,9772,10060, +17678,14156,17679,17681,11332,17680,17683,17682,11314,17684,10077,17685,17688, +17687,17686,17689,5649,8193,5152,17693,17690,17691,17694,17695,17692,4104, +4358,17697,17698,17699,11329,7179,17701,17700,7752,17702,17703,17704,4932, +4908,17705,17706,10812,11330, +11315,11798,6188,17709,6963,17708,17710,6920,8496,17711,6187,11062,17712, +17713,17714,17715,17716,6921,11084,17718,8734,17717,17720,17719,17721,7962, +17722,17723,10520,17724,8270,17725,17726,11613,17729,17728,17727,8975,17730, +7685,17731,17732,11799,17733,17734,17736,17735,9988,9560,11805,9992,17738, +7474,10249,17739,17737,4909,5939,6727,10061,5897,10786,17742,17740,6189,6190, +3912,6471,9784,3902,17747,8735,9783,8506,17749,17745,17748,17743,17746,10757, +5940,3932,17744,17751,17752,9496,5402,17925,9756,6728,5403,7975,11813,11021, +17750,7987,5170,17753,17755,17754,17756,8709,9757,8976,17922,17921,17757,7732, +10308,17924,17923,6191,11826,17940,17928,17929,6991,17927,6231,17926,17930, +8977,10497,8194,8507,17934,17935,17931,17932,17933,6192,17941,17937,10309, +10827,10247,17936,17939,17938,10787,17942,17943,8214,17944,17946,17950,17947, +17945,9758,17948,17949,4369,17956,17951,17952,17953,8448,17955,17954,17957, +17958,17959,7714,4424,17960,11574,6922,7180,6729,8758,17961,17962,4112,17963, +17964,17965,17966,17967,5404,14601,17968,8004,17969,6954,17970,12047,17971, +10557,4923,8195,7223,10320,7181,17972,6193,17973,10027,17987,17975,8488,9812, +5918,17974,8196,17976,9049,17978,17977,17980,17979,17981,17983,17982,4910, +17984,17985,17986,6416,11560,17988,7686,4175,17989,17990,17991,3921,17992, +17993,10310,6950,17995,4616,3857,17994,17997,9773,7715,4405,10758,5692,5435, +17996,4425,4866,4176,18001,11593,8508,10275,18013,4406,18011,18009,18000, +17998,17999, +6978,5451,8790,9520,4144,18003,18002,18008,18004,18007,11055,18006,4407,4700, +18010,18012,5683,18178,18187,18188,3850,18195,3920,18186,18185,18180,18179, +18177,18176,8770,8538,18182,18181,18184,8271,5684,4128,18183,6194,8272,18201, +18202,4408,4365,18199,18189,18197,18204,18198,18196,18005,18194,18190,4911, +18192,18203,18193,18205,18191,9819,11336,18200,18222,18214,7770,5157,5436, +18209,4410,7475,18212,6457,9264,18217,10573,18208,4409,5941,10248,18218,18206, +18215,18225,18210,18211,9497,18216,18213,10759,18219,3903,18207,18221,18220, +9802,18227,18238,4701,18241,18223,18228,11341,18237,11316,11529,8791,4682, +10321,18243,9472,3856,18236,18232,8273,18226,18234,18239,9739,3849,18231, +18240,10327,18235,18230,7476,7182,6923,11063,10278,18246,18255,18233,4694, +7511,18244,18249,8274,18245,18252,8766,18253,11317,18242,4631,18248,18251, +11019,18254,18247,18250,10760,11776,18258,18265,18257,6946,18224,10541,11009, +18264,18263,18259,18260,4117,18262,18256,9012,18261,3933,8449,10530,18266, +18432,10040,18269,7477,6952,18434,5405,18435,10328,18268,18229,18267,11822, +9473,10322,18442,18448,18449,18436,9813,18446,18438,18440,18450,18439,18443, +4177,9540,18444,18447,18437,8197,18441,6662,7716,5647,11091,11096,7249,18454, +18452,11821,18451,11348,18453,18455,18456,18459,18457,9474,18458,10028,18445, +7250,18460,18465,8275,18464,18433,18466,8232,18461,18463,18462,15376,15361, +18468,18467,11349,16667,18469,18470,18471,5942,5171,18473,12348,5204,11545, +5458,18474,18475,8781,18476, +9561,3865,4418,18481,18482,18477,6684,18478,9761,18479,18480,18490,18484, +18487,18483,18485,18486,6967,18488,8736,5685,4641,18491,4638,18496,18492, +18495,10009,18493,18494,10279,10041,18497,8540,18507,18503,4426,18501,10761, +18502,18499,18500,18505,18508,18506,18504,18498,8759,18515,11017,18513,18514, +18509,18511,18512,18510,8005,11800,18519,18520,18688,7689,18522,18525,18517, +18516,18689,4411,18523,18690,18524,18521,8978,18518,9799,18694,11290,18693, +18692,18701,18695,18703,11333,18706,18697,18698,18702,18705,18704,18696,18699, +18716,18709,18707,18708,18713,18714,4617,5153,18712,18691,18711,18715,18710, +18717,18719,18718,18721,18720,18489,18725,18722,18723,18724,18726,5707,18728, +18727,7183,6195,15622,18729,7216,4632,18730,4145,7478,18731,6196,18732,3904, +10268,18733,7753,18740,18737,8782,18738,18735,5437,18734,18741,5653,8509, +18747,18743,8468,18742,18745,18736,18746,18748,10062,18744,18749,18751,5938, +18739,3872,18750,6458,11605,18752,18753,8276,11521,18754,11284,18755,18756, +10563,18757,6431,11522,18762,18763,7479,18761,11334,18758,18760,7964,7773, +18759,18764,10498,18766,18765,4683,10762,18767,18779,18769,18770,18771,18772, +18776,18777,18775,18773,18768,18774,18778,20246,4359,18781,5438,18780,18945, +18944,18947,18946,18948,7184,18949,18950,18951,7965,11318,18952,10499,9765, +18953,18954,5898,5131,18955,6730,9760,18956,4655,18957,18959,11350,18958,7717, +18960,18961,18962,4912,18963,18964,18965,18966,4656,18967,18968,18969,4433, +7687,18970,18971,18972,5919,9050,18973, +5686,7733,18976,9475,18975,5648,18974,8534,5132,18977,18978,7480,5708,18979, +10763,7998,5205,11092,8233,18980,7718,8783,7481,18981,18984,18985,6429,8481, +18983,7482,10269,18982,6731,4146,18989,5687,6733,6732,11820,18988,18987,8198, +5164,11810,4633,7483,18986,18991,18992,18990,5943,11295,6734,9734,18995,7967, +8737,11285,18998,5963,7966,18994,18999,5964,18996,18997,18993,8001,9512,8718, +4412,10063,5154,8979,19002,19000,8747,7968,4913,19001,7738,11561,11807,19003, +19014,8980,19013,19010,19018,19011,19007,9051,19006,19004,11264,6735,19008, +19005,19012,7251,5920,8537,10788,4153,3905,9476,19016,19015,9541,19020,19009, +19019,19021,5899,19017,6197,6964,19022,11319,19025,19028,19026,10260,19023, +5439,19027,19029,19033,19030,19032,19031,19034,6928,19036,19035,10311,19200, +5688,19037,19201,19202,5155,17696,7512,19203,5965,19204,19205,6685,14637, +19206,19207,7185,19208,19209,19210,19211,19212,8714,19213,19215,19214,9477, +19216,10764,19217,19218,19219,19220,9529,7484,19221,6218,12045,19222,19223, +10270,19224,19232,19225,19227,19226,19228,10789,19229,19230,19231,19233,4620, +9030,10312,6465,6198,10286,4414,10029,19236,4914,7988,19235,19240,8792,11074, +19238,19239,5133,19241,9794,8510,10064,9244,19237,10790,4427,19243,11783,8993, +11812,6736,19242,8464,19259,8199,9559,10287,19246,6686,6737,7485,9796,5900, +19245,19244,10313,6944,9265,19248,19249,6199,19247,19250,19251,19253,8450, +19252,4933,19255,19254,19256,19258,19260,19261,7989,6958,19262,4657, +19263,8277,19264,19265,10314,5134,19266,8981,4154,19267,6992,7765,8460,19270, +19269,19268,19276,19274,19271,19273,19272,19275,5206,19279,7990,19280,5944, +19277,19278,11784,8982,8200,19281,19284,19282,19283,11320,9478,19287,19285, +19286,19288,19464,19291,19292,19290,19289,9052,19456,19460,19457,19293,19458, +19459,19466,19461,7991,19463,19465,19462,19468,7186,19467,19469,19470,19473, +19472,19471,19475,19474,11093,19477,19476,19478,19479,19481,19480,7719,19482, +5452,19483,19485,19486,19487,19484,19488,6965,19489,5135,5650,5901,19490,9551, +9245,19491,19494,6931,19493,19492,5689,19495,4658,19497,6459,19496,19505, +19499,19501,10564,19498,19500,19504,19502,5136,19503,19506,9785,11575,7187, +19507,11265,19509,19508,19512,11296,19511,4684,19510,19515,19514,19513,9233, +19516,19517,19518,6219,5636,19519,19520,19521,7720,19522,6924,19523,19524, +12544,12381,19525,17487,19526,8707,7690,9759,19527,10548,9011,6237,8712,4105, +10839,7734,5693,5440,10549,19528,19530,19529,4415,9557,19531,9814,9234,19532, +7217,19534,11041,19549,19536,19537,9000,8511,8278,9479,19535,5172,19544,19541, +19716,9480,8767,19538,9053,9266,19539,19543,7743,9798,9003,7969,19542,8461, +8451,19540,3848,11777,19545,8512,7188,7721,19547,19546,3918,19548,10254,19718, +9530,7754,8760,5463,19717,11286,4126,10550,4416,19712,19713,19714,19715,9498, +8706,3906,19719,19720,21250,8476,19721,4178,8235,5902,11321,19722,9227,8279, +6966,19723,19726,7236,19724,8202,8201,3907,11562,19728,10065,19730,19729, +19727,16963,4915,19533,19732,19731,19733,11287,9536,10765,19734,6968,19735, +19736,19737,9216,3913,6200,11801,19741,5651,19738,19739,10323,4659,11288,5406, +9267,19742,19743,19744,9217,19746,19745,9522,19747,7189,6975,9786,8784,6993, +7755,19748,19749,7740,19750,19751,19752,11342,7190,19754,19753,6201,6226,6687, +19757,7237,19756,19755,8520,5966,7970,9999,7192,19758,7486,19761,19759,19760, +19763,19762,7513,19764,19765,19766,10031,6450,6976,19767,19768,11523,7204, +11085,11563,19769,5441,19770,9218,19773,4695,7722,19771,19772,9023,10804,5467, +19775,19776,19774,19778,9534,4642,19782,19779,19781,19777,20014,19780,11594, +5945,19790,9235,19785,19788,19786,19791,19792,19784,19797,4179,19783,9996, +19787,7487,6202,10791,5443,7205,9499,8204,19795,19789,19794,11042,8983,19796, +19793,8203,19800,19799,19798,10766,7258,19801,10558,4147,10277,8785,5207, +19803,6204,6667,19802,7756,7757,19968,19970,7514,19969,19971,5426,10276,6977, +11778,19805,6487,11806,19973,19972,19974,19804,9544,9268,9014,19979,8738, +19975,19976,5644,19978,5903,19977,7488,4696,19983,6430,8280,9001,4634,19981, +19982,8994,19980,19984,19990,19993,19992,9228,19985,19986,19989,19991,5407, +19994,19988,19987,19998,19999,20000,19997,19996,7489,9481,19995,20004,20002, +20003,20001,8535,20005,20006,20008,4916,20007,11097,20019,20009,20012,20010, +20011,20013,20015,20016,20017,20020,20018,20021,20023,20022,8984,11078,20024, +8205,20025,10531,20026,4618,4123,4918,4917,20027,20028,20029,20030,20031,4919, +4660,6205,10005,20033,20032,20034,4155,20037,20036,20035,20038,20041,3878, +20039,20043,20042,20045,20044,20046,9485,20047,20048,20050,20049,10315,20051, +20052,6468,20053,20054,10792,8234,3843,8490,20055,10316,20058,20056,6206, +20057,5921,10532,20060,20224,20061,20225,4096,7735,7259,4920,20226,9797,20228, +4097,20227,8995,11564,9482,20059,11525,5904,11322,5464,11539,5639,8513,17920, +20229,4619,7758,4661,20231,20232,20230,5699,6460,7490,4098,11576,20234,19725, +20233,20237,20235,20236,20238,20239,11595,20240,20241,7976,10010,7772,4934, +11289,4428,7191,5946,20244,20243,6738,20245,20242,6663,20249,18700,12597,7766, +20247,11524,9552,4106,8002,6933,10518,4127,11596,11338,20250,9252,7002,20251, +20252,7723,20253,11597,20248,20255,20257,20256,20254,20258,20259,8281,4417, +20260,11031,20261,20262,11785,14864,20263,20264,20265,20269,20266,20267,20268, +20270,7971,11094,7972,20271,10066,20272,21042,11051,20273,20274,20275,4662, +20277,7736,20278,5635,20279,20283,20281,20282,4690,20280,20284,20285,3879, +20286,20287,7491,20288,5158,20291,20290,20289,19024,10555,20292,20293,20294, +20295,20296,20297,4921,20298,20299,9730,20301,4378,20304,20303,4099,5408, +10534,8985,6401,6207,7238,7739,20306,20305,11297,4935,10033,9531,7771,11565, +5690,20309,20308,10794,9483,4143,20310,20307,10288,11337,20311,20312,20314, +8521,4666,4667,20313,4936,5905,4937,9246,11583,5947,20315,20316,20317,20480, +20482,20481,10326,20483,20484,20485,20486,20488,20487,20489,10067,17707,7688, +5137,20490, +20491,12555,15386,10034,3930,3866,6739,10767,7517,20492,11070,20493,11323, +4129,6688,20494,4429,20495,20496,20498,20499,20501,20497,20500,4922,20502, +20503,20504,20505,20506,20508,20507,20510,20513,20509,20511,20512,20514,5409, +6994,20515,20516,6208,20517,4637,9774,20518,20519,8761,9546,20520,9820,8491, +4151,5453,5454,8786,20525,5455,4430,20524,20522,20523,20521,20535,20526,20527, +20528,20529,20531,20530,7224,20532,20534,5138,20533,8282,5906,20536,8492, +20537,9484,20538,20543,20541,20540,20542,20539,20545,20544,20547,5410,20546, +20548,20549,20551,20550,20552,20554,20553,6235,20555,20556,4635,20557,20558, +7760,20559,20560,20561,20562,6209,20563,20564,20565,20566,20567,10000,20569, +10245,20570,20568,20572,20571,20573,20736,20737,20738,20739,20740,20741,20742, +20743,20744,20745,20746,20747,20748,20749,15380,20750,17239,5139,4608,6417, +20752,20751,11012,20754,20755,20753,20756,10817,20757,5210,11780,20758,20760, +3869,20761,10506,20759,20762,20763,20764,20765,20766,10829,6668,6489,8206, +20767,20770,20768,20771,5968,20769,20772,20773,20774,20778,6665,8515,20779, +20776,20775,20777,5694,20783,20782,20781,3858,20793,20789,20790,20786,20792, +20788,4673,11819,20791,20787,20785,20784,20795,20798,20797,20796,10280,20794, +3922,20799,20801,4686,20780,4118,20803,20802,20800,8716,10831,11577,20804, +20805,20806,20807,20808,8986,20809,10006,20814,20810,20811,10768,11043,9519, +20815,20816,9501,20813,20812,4361,20824,20823,4180,20821,20820,20818,4698, +20817,6929,4360,6210,20827,20826,20825, +20822,20828,20829,20996,20995,20997,4108,20992,20993,6227,11032,20994,10769, +21002,20998,21003,21000,20999,5691,21004,21005,21006,21001,20819,21007,9024, +21011,21012,21010,21009,21015,21008,21013,21014,21017,21016,21019,21020,21021, +11816,21018,8522,6476,21022,21023,21024,21025,21026,5907,21027,21028,6926, +21029,21030,21031,21032,21035,21033,11803,21034,11598,21036,11578,21037,9821, +21038,21040,21041,21039,6220,11052,10818,13654,15423,10842,4362,21043,5167, +21044,21045,21046,6228,21047,16179,11066,8514,21048,21050,21049,21051,21052, +21053,21054,21055,21056,21057,21058,21059,21060,21061,21062,21063,9219,5948, +21065,8236,21066,21067,10240,21068,21069,16918,19257,20300,21070,21071,21073, +21074,21075,11599,21072,21076,21077,21079,21078,21081,21082,21080,11541,21083, +21084,16947,21085,9,83,79,82,84,41,42,85,59,3,4,30,527,528,529,530,531,532, +533,534,535,536,6,7,66,64,67,8,86,544,545,546,547,548,549,550,551,552,553,554, +555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,45,46,15,17,13, +576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594, +595,596,597,598,599,600,601,47,34,48,16,78, diff --git a/Ubiquitous/XiZi/lib/musllib/src/malloc/Makefile b/Ubiquitous/XiZi/lib/musllib/src/malloc/Makefile new file mode 100644 index 000000000..9c427dacc --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/malloc/Makefile @@ -0,0 +1,5 @@ +SRC_FILES := malloc.c + + + +include $(KERNEL_ROOT)/compiler.mk \ No newline at end of file diff --git a/Ubiquitous/XiZi/lib/musllib/src/malloc/malloc.c b/Ubiquitous/XiZi/lib/musllib/src/malloc/malloc.c new file mode 100644 index 000000000..2e8493862 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/malloc/malloc.c @@ -0,0 +1,23 @@ +#include +#include +#include "xs_memory.h" + +// implement of malloc for XiUOS +void* malloc(size_t size) { + if (size == 0) { + return NULL; + } + return (void*)x_malloc(size); +} + +void* realloc(void* old, size_t new_len) { + if (new_len == 0) { + return NULL; + } + return x_realloc(old, new_len); +} + +void free(void* ptr) { + x_free(ptr); +} + diff --git a/Ubiquitous/XiZi/lib/musllib/src/math/Makefile b/Ubiquitous/XiZi/lib/musllib/src/math/Makefile new file mode 100644 index 000000000..0fac8ccfd --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/math/Makefile @@ -0,0 +1,8 @@ +SRC_FILES := __fpclassify.c __fpclassifyl.c __math_divzero.c __math_divzerof.c __math_invalid.c __math_invalidf.c __math_oflow.c __math_oflowf.c __math_uflow.c __math_uflowf.c __math_xflow.c __math_xflowf.c +SRC_FILES += __signbit.c __signbitl.c copysign.c copysignl.c +SRC_FILES += exp_data.c fabs.c fabsl.c floor.c fmod.c fmodl.c frexp.c frexpl.c log_data.c log.c +SRC_FILES += pow_data.c pow.c round.c scalbn.c scalbnl.c sqrt.c + +# SRC_DIR := arm + +include $(KERNEL_ROOT)/compiler.mk \ No newline at end of file diff --git a/Ubiquitous/XiZi/lib/musllib/src/math/__fpclassify.c b/Ubiquitous/XiZi/lib/musllib/src/math/__fpclassify.c new file mode 100644 index 000000000..f7c0e2dfa --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/math/__fpclassify.c @@ -0,0 +1,11 @@ +#include +#include + +int __fpclassify(double x) +{ + union {double f; uint64_t i;} u = {x}; + int e = u.i>>52 & 0x7ff; + if (!e) return u.i<<1 ? FP_SUBNORMAL : FP_ZERO; + if (e==0x7ff) return u.i<<12 ? FP_NAN : FP_INFINITE; + return FP_NORMAL; +} diff --git a/Ubiquitous/XiZi/lib/musllib/src/math/__fpclassifyl.c b/Ubiquitous/XiZi/lib/musllib/src/math/__fpclassifyl.c new file mode 100644 index 000000000..e41781b68 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/math/__fpclassifyl.c @@ -0,0 +1,42 @@ +#include "libm.h" + +#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 +int __fpclassifyl(long double x) +{ + return __fpclassify(x); +} +#elif LDBL_MANT_DIG == 64 && LDBL_MAX_EXP == 16384 +int __fpclassifyl(long double x) +{ + union ldshape u = {x}; + int e = u.i.se & 0x7fff; + int msb = u.i.m>>63; + if (!e && !msb) + return u.i.m ? FP_SUBNORMAL : FP_ZERO; + if (e == 0x7fff) { + /* The x86 variant of 80-bit extended precision only admits + * one representation of each infinity, with the mantissa msb + * necessarily set. The version with it clear is invalid/nan. + * The m68k variant, however, allows either, and tooling uses + * the version with it clear. */ + if (__BYTE_ORDER == __LITTLE_ENDIAN && !msb) + return FP_NAN; + return u.i.m << 1 ? FP_NAN : FP_INFINITE; + } + if (!msb) + return FP_NAN; + return FP_NORMAL; +} +#elif LDBL_MANT_DIG == 113 && LDBL_MAX_EXP == 16384 +int __fpclassifyl(long double x) +{ + union ldshape u = {x}; + int e = u.i.se & 0x7fff; + u.i.se = 0; + if (!e) + return u.i2.lo | u.i2.hi ? FP_SUBNORMAL : FP_ZERO; + if (e == 0x7fff) + return u.i2.lo | u.i2.hi ? FP_NAN : FP_INFINITE; + return FP_NORMAL; +} +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/src/math/__math_divzero.c b/Ubiquitous/XiZi/lib/musllib/src/math/__math_divzero.c new file mode 100644 index 000000000..054a30a81 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/math/__math_divzero.c @@ -0,0 +1,11 @@ +#include "libm.h" + +double __math_divzero(uint32_t sign) +{ + return fp_barrier(sign ? -1.0 : 1.0) / 0.0; +} + +int raise(int a) +{ + return 0; +} \ No newline at end of file diff --git a/Ubiquitous/XiZi/lib/musllib/src/math/__math_divzerof.c b/Ubiquitous/XiZi/lib/musllib/src/math/__math_divzerof.c new file mode 100644 index 000000000..ce046f3e3 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/math/__math_divzerof.c @@ -0,0 +1,6 @@ +#include "libm.h" + +float __math_divzerof(uint32_t sign) +{ + return fp_barrierf(sign ? -1.0f : 1.0f) / 0.0f; +} diff --git a/Ubiquitous/XiZi/lib/musllib/src/math/__math_invalid.c b/Ubiquitous/XiZi/lib/musllib/src/math/__math_invalid.c new file mode 100644 index 000000000..177404900 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/math/__math_invalid.c @@ -0,0 +1,6 @@ +#include "libm.h" + +double __math_invalid(double x) +{ + return (x - x) / (x - x); +} diff --git a/Ubiquitous/XiZi/lib/musllib/src/math/__math_invalidf.c b/Ubiquitous/XiZi/lib/musllib/src/math/__math_invalidf.c new file mode 100644 index 000000000..357d4b121 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/math/__math_invalidf.c @@ -0,0 +1,6 @@ +#include "libm.h" + +float __math_invalidf(float x) +{ + return (x - x) / (x - x); +} diff --git a/Ubiquitous/XiZi/lib/musllib/src/math/__math_oflow.c b/Ubiquitous/XiZi/lib/musllib/src/math/__math_oflow.c new file mode 100644 index 000000000..c85dbf982 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/math/__math_oflow.c @@ -0,0 +1,6 @@ +#include "libm.h" + +double __math_oflow(uint32_t sign) +{ + return __math_xflow(sign, 0x1p769); +} diff --git a/Ubiquitous/XiZi/lib/musllib/src/math/__math_oflowf.c b/Ubiquitous/XiZi/lib/musllib/src/math/__math_oflowf.c new file mode 100644 index 000000000..fa7d06208 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/math/__math_oflowf.c @@ -0,0 +1,6 @@ +#include "libm.h" + +float __math_oflowf(uint32_t sign) +{ + return __math_xflowf(sign, 0x1p97f); +} diff --git a/Ubiquitous/XiZi/lib/musllib/src/math/__math_uflow.c b/Ubiquitous/XiZi/lib/musllib/src/math/__math_uflow.c new file mode 100644 index 000000000..b90594aee --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/math/__math_uflow.c @@ -0,0 +1,6 @@ +#include "libm.h" + +double __math_uflow(uint32_t sign) +{ + return __math_xflow(sign, 0x1p-767); +} diff --git a/Ubiquitous/XiZi/lib/musllib/src/math/__math_uflowf.c b/Ubiquitous/XiZi/lib/musllib/src/math/__math_uflowf.c new file mode 100644 index 000000000..94d50f2bf --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/math/__math_uflowf.c @@ -0,0 +1,6 @@ +#include "libm.h" + +float __math_uflowf(uint32_t sign) +{ + return __math_xflowf(sign, 0x1p-95f); +} diff --git a/Ubiquitous/XiZi/lib/musllib/src/math/__math_xflow.c b/Ubiquitous/XiZi/lib/musllib/src/math/__math_xflow.c new file mode 100644 index 000000000..744203c4c --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/math/__math_xflow.c @@ -0,0 +1,6 @@ +#include "libm.h" + +double __math_xflow(uint32_t sign, double y) +{ + return eval_as_double(fp_barrier(sign ? -y : y) * y); +} diff --git a/Ubiquitous/XiZi/lib/musllib/src/math/__math_xflowf.c b/Ubiquitous/XiZi/lib/musllib/src/math/__math_xflowf.c new file mode 100644 index 000000000..f2c84784f --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/math/__math_xflowf.c @@ -0,0 +1,6 @@ +#include "libm.h" + +float __math_xflowf(uint32_t sign, float y) +{ + return eval_as_float(fp_barrierf(sign ? -y : y) * y); +} diff --git a/Ubiquitous/XiZi/lib/musllib/src/math/__signbit.c b/Ubiquitous/XiZi/lib/musllib/src/math/__signbit.c new file mode 100644 index 000000000..e700b6b75 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/math/__signbit.c @@ -0,0 +1,13 @@ +#include "libm.h" + +// FIXME: macro in math.h +int __signbit(double x) +{ + union { + double d; + uint64_t i; + } y = { x }; + return y.i>>63; +} + + diff --git a/Ubiquitous/XiZi/lib/musllib/src/math/__signbitl.c b/Ubiquitous/XiZi/lib/musllib/src/math/__signbitl.c new file mode 100644 index 000000000..63b3dc5a0 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/math/__signbitl.c @@ -0,0 +1,14 @@ +#include "libm.h" + +#if (LDBL_MANT_DIG == 64 || LDBL_MANT_DIG == 113) && LDBL_MAX_EXP == 16384 +int __signbitl(long double x) +{ + union ldshape u = {x}; + return u.i.se >> 15; +} +#elif LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 +int __signbitl(long double x) +{ + return __signbit(x); +} +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/src/math/arm/Makefile b/Ubiquitous/XiZi/lib/musllib/src/math/arm/Makefile new file mode 100644 index 000000000..1f558dc82 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/math/arm/Makefile @@ -0,0 +1,5 @@ +SRC_FILES := fabs.c + + + +include $(KERNEL_ROOT)/compiler.mk \ No newline at end of file diff --git a/Ubiquitous/XiZi/lib/musllib/src/math/arm/fabs.c b/Ubiquitous/XiZi/lib/musllib/src/math/arm/fabs.c new file mode 100644 index 000000000..f890520a5 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/math/arm/fabs.c @@ -0,0 +1,15 @@ +#include + +#if __ARM_PCS_VFP + +double fabs(double x) +{ + __asm__ ("vabs.f64 %P0, %P1" : "=w"(x) : "w"(x)); + return x; +} + +#else + +#include "../fabs.c" + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/src/math/copysign.c b/Ubiquitous/XiZi/lib/musllib/src/math/copysign.c new file mode 100644 index 000000000..b09331b68 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/math/copysign.c @@ -0,0 +1,8 @@ +#include "libm.h" + +double copysign(double x, double y) { + union {double f; uint64_t i;} ux={x}, uy={y}; + ux.i &= -1ULL/2; + ux.i |= uy.i & 1ULL<<63; + return ux.f; +} diff --git a/Ubiquitous/XiZi/lib/musllib/src/math/copysignl.c b/Ubiquitous/XiZi/lib/musllib/src/math/copysignl.c new file mode 100644 index 000000000..9dd933cfa --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/math/copysignl.c @@ -0,0 +1,16 @@ +#include "libm.h" + +#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 +long double copysignl(long double x, long double y) +{ + return copysign(x, y); +} +#elif (LDBL_MANT_DIG == 64 || LDBL_MANT_DIG == 113) && LDBL_MAX_EXP == 16384 +long double copysignl(long double x, long double y) +{ + union ldshape ux = {x}, uy = {y}; + ux.i.se &= 0x7fff; + ux.i.se |= uy.i.se & 0x8000; + return ux.f; +} +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/src/math/exp_data.c b/Ubiquitous/XiZi/lib/musllib/src/math/exp_data.c new file mode 100644 index 000000000..2d7faf9f3 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/math/exp_data.c @@ -0,0 +1,182 @@ +/* + * Shared data between exp, exp2 and pow. + * + * Copyright (c) 2018, Arm Limited. + * SPDX-License-Identifier: MIT + */ + +#include "exp_data.h" + +#define N (1 << EXP_TABLE_BITS) + +const struct exp_data __exp_data1 = { +// N/ln2 +.invln2N = 0x1.71547652b82fep0 * N, +// -ln2/N +.negln2hiN = -0x1.62e42fefa0000p-8, +.negln2loN = -0x1.cf79abc9e3b3ap-47, +// Used for rounding when !TOINT_INTRINSICS +#if EXP_USE_TOINT_NARROW +.shift = 0x1800000000.8p0, +#else +.shift = 0x1.8p52, +#endif +// exp polynomial coefficients. +.poly = { +// abs error: 1.555*2^-66 +// ulp error: 0.509 (0.511 without fma) +// if |x| < ln2/256+eps +// abs error if |x| < ln2/256+0x1p-15: 1.09*2^-65 +// abs error if |x| < ln2/128: 1.7145*2^-56 +0x1.ffffffffffdbdp-2, +0x1.555555555543cp-3, +0x1.55555cf172b91p-5, +0x1.1111167a4d017p-7, +}, +.exp2_shift = 0x1.8p52 / N, +// exp2 polynomial coefficients. +.exp2_poly = { +// abs error: 1.2195*2^-65 +// ulp error: 0.507 (0.511 without fma) +// if |x| < 1/256 +// abs error if |x| < 1/128: 1.9941*2^-56 +0x1.62e42fefa39efp-1, +0x1.ebfbdff82c424p-3, +0x1.c6b08d70cf4b5p-5, +0x1.3b2abd24650ccp-7, +0x1.5d7e09b4e3a84p-10, +}, +// 2^(k/N) ~= H[k]*(1 + T[k]) for int k in [0,N) +// tab[2*k] = asuint64(T[k]) +// tab[2*k+1] = asuint64(H[k]) - (k << 52)/N +.tab = { +0x0, 0x3ff0000000000000, +0x3c9b3b4f1a88bf6e, 0x3feff63da9fb3335, +0xbc7160139cd8dc5d, 0x3fefec9a3e778061, +0xbc905e7a108766d1, 0x3fefe315e86e7f85, +0x3c8cd2523567f613, 0x3fefd9b0d3158574, +0xbc8bce8023f98efa, 0x3fefd06b29ddf6de, +0x3c60f74e61e6c861, 0x3fefc74518759bc8, +0x3c90a3e45b33d399, 0x3fefbe3ecac6f383, +0x3c979aa65d837b6d, 0x3fefb5586cf9890f, +0x3c8eb51a92fdeffc, 0x3fefac922b7247f7, +0x3c3ebe3d702f9cd1, 0x3fefa3ec32d3d1a2, +0xbc6a033489906e0b, 0x3fef9b66affed31b, +0xbc9556522a2fbd0e, 0x3fef9301d0125b51, +0xbc5080ef8c4eea55, 0x3fef8abdc06c31cc, +0xbc91c923b9d5f416, 0x3fef829aaea92de0, +0x3c80d3e3e95c55af, 0x3fef7a98c8a58e51, +0xbc801b15eaa59348, 0x3fef72b83c7d517b, +0xbc8f1ff055de323d, 0x3fef6af9388c8dea, +0x3c8b898c3f1353bf, 0x3fef635beb6fcb75, +0xbc96d99c7611eb26, 0x3fef5be084045cd4, +0x3c9aecf73e3a2f60, 0x3fef54873168b9aa, +0xbc8fe782cb86389d, 0x3fef4d5022fcd91d, +0x3c8a6f4144a6c38d, 0x3fef463b88628cd6, +0x3c807a05b0e4047d, 0x3fef3f49917ddc96, +0x3c968efde3a8a894, 0x3fef387a6e756238, +0x3c875e18f274487d, 0x3fef31ce4fb2a63f, +0x3c80472b981fe7f2, 0x3fef2b4565e27cdd, +0xbc96b87b3f71085e, 0x3fef24dfe1f56381, +0x3c82f7e16d09ab31, 0x3fef1e9df51fdee1, +0xbc3d219b1a6fbffa, 0x3fef187fd0dad990, +0x3c8b3782720c0ab4, 0x3fef1285a6e4030b, +0x3c6e149289cecb8f, 0x3fef0cafa93e2f56, +0x3c834d754db0abb6, 0x3fef06fe0a31b715, +0x3c864201e2ac744c, 0x3fef0170fc4cd831, +0x3c8fdd395dd3f84a, 0x3feefc08b26416ff, +0xbc86a3803b8e5b04, 0x3feef6c55f929ff1, +0xbc924aedcc4b5068, 0x3feef1a7373aa9cb, +0xbc9907f81b512d8e, 0x3feeecae6d05d866, +0xbc71d1e83e9436d2, 0x3feee7db34e59ff7, +0xbc991919b3ce1b15, 0x3feee32dc313a8e5, +0x3c859f48a72a4c6d, 0x3feedea64c123422, +0xbc9312607a28698a, 0x3feeda4504ac801c, +0xbc58a78f4817895b, 0x3feed60a21f72e2a, +0xbc7c2c9b67499a1b, 0x3feed1f5d950a897, +0x3c4363ed60c2ac11, 0x3feece086061892d, +0x3c9666093b0664ef, 0x3feeca41ed1d0057, +0x3c6ecce1daa10379, 0x3feec6a2b5c13cd0, +0x3c93ff8e3f0f1230, 0x3feec32af0d7d3de, +0x3c7690cebb7aafb0, 0x3feebfdad5362a27, +0x3c931dbdeb54e077, 0x3feebcb299fddd0d, +0xbc8f94340071a38e, 0x3feeb9b2769d2ca7, +0xbc87deccdc93a349, 0x3feeb6daa2cf6642, +0xbc78dec6bd0f385f, 0x3feeb42b569d4f82, +0xbc861246ec7b5cf6, 0x3feeb1a4ca5d920f, +0x3c93350518fdd78e, 0x3feeaf4736b527da, +0x3c7b98b72f8a9b05, 0x3feead12d497c7fd, +0x3c9063e1e21c5409, 0x3feeab07dd485429, +0x3c34c7855019c6ea, 0x3feea9268a5946b7, +0x3c9432e62b64c035, 0x3feea76f15ad2148, +0xbc8ce44a6199769f, 0x3feea5e1b976dc09, +0xbc8c33c53bef4da8, 0x3feea47eb03a5585, +0xbc845378892be9ae, 0x3feea34634ccc320, +0xbc93cedd78565858, 0x3feea23882552225, +0x3c5710aa807e1964, 0x3feea155d44ca973, +0xbc93b3efbf5e2228, 0x3feea09e667f3bcd, +0xbc6a12ad8734b982, 0x3feea012750bdabf, +0xbc6367efb86da9ee, 0x3fee9fb23c651a2f, +0xbc80dc3d54e08851, 0x3fee9f7df9519484, +0xbc781f647e5a3ecf, 0x3fee9f75e8ec5f74, +0xbc86ee4ac08b7db0, 0x3fee9f9a48a58174, +0xbc8619321e55e68a, 0x3fee9feb564267c9, +0x3c909ccb5e09d4d3, 0x3feea0694fde5d3f, +0xbc7b32dcb94da51d, 0x3feea11473eb0187, +0x3c94ecfd5467c06b, 0x3feea1ed0130c132, +0x3c65ebe1abd66c55, 0x3feea2f336cf4e62, +0xbc88a1c52fb3cf42, 0x3feea427543e1a12, +0xbc9369b6f13b3734, 0x3feea589994cce13, +0xbc805e843a19ff1e, 0x3feea71a4623c7ad, +0xbc94d450d872576e, 0x3feea8d99b4492ed, +0x3c90ad675b0e8a00, 0x3feeaac7d98a6699, +0x3c8db72fc1f0eab4, 0x3feeace5422aa0db, +0xbc65b6609cc5e7ff, 0x3feeaf3216b5448c, +0x3c7bf68359f35f44, 0x3feeb1ae99157736, +0xbc93091fa71e3d83, 0x3feeb45b0b91ffc6, +0xbc5da9b88b6c1e29, 0x3feeb737b0cdc5e5, +0xbc6c23f97c90b959, 0x3feeba44cbc8520f, +0xbc92434322f4f9aa, 0x3feebd829fde4e50, +0xbc85ca6cd7668e4b, 0x3feec0f170ca07ba, +0x3c71affc2b91ce27, 0x3feec49182a3f090, +0x3c6dd235e10a73bb, 0x3feec86319e32323, +0xbc87c50422622263, 0x3feecc667b5de565, +0x3c8b1c86e3e231d5, 0x3feed09bec4a2d33, +0xbc91bbd1d3bcbb15, 0x3feed503b23e255d, +0x3c90cc319cee31d2, 0x3feed99e1330b358, +0x3c8469846e735ab3, 0x3feede6b5579fdbf, +0xbc82dfcd978e9db4, 0x3feee36bbfd3f37a, +0x3c8c1a7792cb3387, 0x3feee89f995ad3ad, +0xbc907b8f4ad1d9fa, 0x3feeee07298db666, +0xbc55c3d956dcaeba, 0x3feef3a2b84f15fb, +0xbc90a40e3da6f640, 0x3feef9728de5593a, +0xbc68d6f438ad9334, 0x3feeff76f2fb5e47, +0xbc91eee26b588a35, 0x3fef05b030a1064a, +0x3c74ffd70a5fddcd, 0x3fef0c1e904bc1d2, +0xbc91bdfbfa9298ac, 0x3fef12c25bd71e09, +0x3c736eae30af0cb3, 0x3fef199bdd85529c, +0x3c8ee3325c9ffd94, 0x3fef20ab5fffd07a, +0x3c84e08fd10959ac, 0x3fef27f12e57d14b, +0x3c63cdaf384e1a67, 0x3fef2f6d9406e7b5, +0x3c676b2c6c921968, 0x3fef3720dcef9069, +0xbc808a1883ccb5d2, 0x3fef3f0b555dc3fa, +0xbc8fad5d3ffffa6f, 0x3fef472d4a07897c, +0xbc900dae3875a949, 0x3fef4f87080d89f2, +0x3c74a385a63d07a7, 0x3fef5818dcfba487, +0xbc82919e2040220f, 0x3fef60e316c98398, +0x3c8e5a50d5c192ac, 0x3fef69e603db3285, +0x3c843a59ac016b4b, 0x3fef7321f301b460, +0xbc82d52107b43e1f, 0x3fef7c97337b9b5f, +0xbc892ab93b470dc9, 0x3fef864614f5a129, +0x3c74b604603a88d3, 0x3fef902ee78b3ff6, +0x3c83c5ec519d7271, 0x3fef9a51fbc74c83, +0xbc8ff7128fd391f0, 0x3fefa4afa2a490da, +0xbc8dae98e223747d, 0x3fefaf482d8e67f1, +0x3c8ec3bc41aa2008, 0x3fefba1bee615a27, +0x3c842b94c3a9eb32, 0x3fefc52b376bba97, +0x3c8a64a931d185ee, 0x3fefd0765b6e4540, +0xbc8e37bae43be3ed, 0x3fefdbfdad9cbe14, +0x3c77893b4d91cd9d, 0x3fefe7c1819e90d8, +0x3c5305c14160cc89, 0x3feff3c22b8f71f1, +}, +}; diff --git a/Ubiquitous/XiZi/lib/musllib/src/math/exp_data.h b/Ubiquitous/XiZi/lib/musllib/src/math/exp_data.h new file mode 100644 index 000000000..968ad760e --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/math/exp_data.h @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2018, Arm Limited. + * SPDX-License-Identifier: MIT + */ +#ifndef _EXP_DATA_H +#define _EXP_DATA_H + +#include +#include + +#define EXP_TABLE_BITS 7 +#define EXP_POLY_ORDER 5 +#define EXP_USE_TOINT_NARROW 0 +#define EXP2_POLY_ORDER 5 +extern const struct exp_data { + double invln2N; + double shift; + double negln2hiN; + double negln2loN; + double poly[4]; /* Last four coefficients. */ + double exp2_shift; + double exp2_poly[EXP2_POLY_ORDER]; + uint64_t tab[2*(1 << EXP_TABLE_BITS)]; +} __exp_data1; + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/src/math/fabs.c b/Ubiquitous/XiZi/lib/musllib/src/math/fabs.c new file mode 100644 index 000000000..e8258cfdb --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/math/fabs.c @@ -0,0 +1,9 @@ +#include +#include + +double fabs(double x) +{ + union {double f; uint64_t i;} u = {x}; + u.i &= -1ULL/2; + return u.f; +} diff --git a/Ubiquitous/XiZi/lib/musllib/src/math/fabsl.c b/Ubiquitous/XiZi/lib/musllib/src/math/fabsl.c new file mode 100644 index 000000000..c4f36ec28 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/math/fabsl.c @@ -0,0 +1,15 @@ +#include "libm.h" +#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 +long double fabsl(long double x) +{ + return fabs(x); +} +#elif (LDBL_MANT_DIG == 64 || LDBL_MANT_DIG == 113) && LDBL_MAX_EXP == 16384 +long double fabsl(long double x) +{ + union ldshape u = {x}; + + u.i.se &= 0x7fff; + return u.f; +} +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/src/math/floor.c b/Ubiquitous/XiZi/lib/musllib/src/math/floor.c new file mode 100644 index 000000000..14a31cd8c --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/math/floor.c @@ -0,0 +1,31 @@ +#include "libm.h" + +#if FLT_EVAL_METHOD==0 || FLT_EVAL_METHOD==1 +#define EPS DBL_EPSILON +#elif FLT_EVAL_METHOD==2 +#define EPS LDBL_EPSILON +#endif +static const double_t toint = 1/EPS; + +double floor(double x) +{ + union {double f; uint64_t i;} u = {x}; + int e = u.i >> 52 & 0x7ff; + double_t y; + + if (e >= 0x3ff+52 || x == 0) + return x; + /* y = int(x) - x, where int(x) is an integer neighbor of x */ + if (u.i >> 63) + y = x - toint + toint - x; + else + y = x + toint - toint - x; + /* special case because of non-nearest rounding modes */ + if (e <= 0x3ff-1) { + FORCE_EVAL(y); + return u.i >> 63 ? -1 : 0; + } + if (y > 0) + return x + y - 1; + return x + y; +} diff --git a/Ubiquitous/XiZi/lib/musllib/src/math/fmod.c b/Ubiquitous/XiZi/lib/musllib/src/math/fmod.c new file mode 100644 index 000000000..6849722ba --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/math/fmod.c @@ -0,0 +1,68 @@ +#include +#include + +double fmod(double x, double y) +{ + union {double f; uint64_t i;} ux = {x}, uy = {y}; + int ex = ux.i>>52 & 0x7ff; + int ey = uy.i>>52 & 0x7ff; + int sx = ux.i>>63; + uint64_t i; + + /* in the followings uxi should be ux.i, but then gcc wrongly adds */ + /* float load/store to inner loops ruining performance and code size */ + uint64_t uxi = ux.i; + + if (uy.i<<1 == 0 || isnan(y) || ex == 0x7ff) + return (x*y)/(x*y); + if (uxi<<1 <= uy.i<<1) { + if (uxi<<1 == uy.i<<1) + return 0*x; + return x; + } + + /* normalize x and y */ + if (!ex) { + for (i = uxi<<12; i>>63 == 0; ex--, i <<= 1); + uxi <<= -ex + 1; + } else { + uxi &= -1ULL >> 12; + uxi |= 1ULL << 52; + } + if (!ey) { + for (i = uy.i<<12; i>>63 == 0; ey--, i <<= 1); + uy.i <<= -ey + 1; + } else { + uy.i &= -1ULL >> 12; + uy.i |= 1ULL << 52; + } + + /* x mod y */ + for (; ex > ey; ex--) { + i = uxi - uy.i; + if (i >> 63 == 0) { + if (i == 0) + return 0*x; + uxi = i; + } + uxi <<= 1; + } + i = uxi - uy.i; + if (i >> 63 == 0) { + if (i == 0) + return 0*x; + uxi = i; + } + for (; uxi>>52 == 0; uxi <<= 1, ex--); + + /* scale result */ + if (ex > 0) { + uxi -= 1ULL << 52; + uxi |= (uint64_t)ex << 52; + } else { + uxi >>= -ex + 1; + } + uxi |= (uint64_t)sx << 63; + ux.i = uxi; + return ux.f; +} diff --git a/Ubiquitous/XiZi/lib/musllib/src/math/fmodl.c b/Ubiquitous/XiZi/lib/musllib/src/math/fmodl.c new file mode 100644 index 000000000..9f5b87393 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/math/fmodl.c @@ -0,0 +1,105 @@ +#include "libm.h" + +#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 +long double fmodl(long double x, long double y) +{ + return fmod(x, y); +} +#elif (LDBL_MANT_DIG == 64 || LDBL_MANT_DIG == 113) && LDBL_MAX_EXP == 16384 +long double fmodl(long double x, long double y) +{ + union ldshape ux = {x}, uy = {y}; + int ex = ux.i.se & 0x7fff; + int ey = uy.i.se & 0x7fff; + int sx = ux.i.se & 0x8000; + + if (y == 0 || isnan(y) || ex == 0x7fff) + return (x*y)/(x*y); + ux.i.se = ex; + uy.i.se = ey; + if (ux.f <= uy.f) { + if (ux.f == uy.f) + return 0*x; + return x; + } + + /* normalize x and y */ + if (!ex) { + ux.f *= 0x1p120f; + ex = ux.i.se - 120; + } + if (!ey) { + uy.f *= 0x1p120f; + ey = uy.i.se - 120; + } + + /* x mod y */ +#if LDBL_MANT_DIG == 64 + uint64_t i, mx, my; + mx = ux.i.m; + my = uy.i.m; + for (; ex > ey; ex--) { + i = mx - my; + if (mx >= my) { + if (i == 0) + return 0*x; + mx = 2*i; + } else if (2*mx < mx) { + mx = 2*mx - my; + } else { + mx = 2*mx; + } + } + i = mx - my; + if (mx >= my) { + if (i == 0) + return 0*x; + mx = i; + } + for (; mx >> 63 == 0; mx *= 2, ex--); + ux.i.m = mx; +#elif LDBL_MANT_DIG == 113 + uint64_t hi, lo, xhi, xlo, yhi, ylo; + xhi = (ux.i2.hi & -1ULL>>16) | 1ULL<<48; + yhi = (uy.i2.hi & -1ULL>>16) | 1ULL<<48; + xlo = ux.i2.lo; + ylo = uy.i2.lo; + for (; ex > ey; ex--) { + hi = xhi - yhi; + lo = xlo - ylo; + if (xlo < ylo) + hi -= 1; + if (hi >> 63 == 0) { + if ((hi|lo) == 0) + return 0*x; + xhi = 2*hi + (lo>>63); + xlo = 2*lo; + } else { + xhi = 2*xhi + (xlo>>63); + xlo = 2*xlo; + } + } + hi = xhi - yhi; + lo = xlo - ylo; + if (xlo < ylo) + hi -= 1; + if (hi >> 63 == 0) { + if ((hi|lo) == 0) + return 0*x; + xhi = hi; + xlo = lo; + } + for (; xhi >> 48 == 0; xhi = 2*xhi + (xlo>>63), xlo = 2*xlo, ex--); + ux.i2.hi = xhi; + ux.i2.lo = xlo; +#endif + + /* scale result */ + if (ex <= 0) { + ux.i.se = (ex+120)|sx; + ux.f *= 0x1p-120f; + } else + ux.i.se = ex|sx; + return ux.f; +} +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/src/math/frexp.c b/Ubiquitous/XiZi/lib/musllib/src/math/frexp.c new file mode 100644 index 000000000..27b6266ed --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/math/frexp.c @@ -0,0 +1,23 @@ +#include +#include + +double frexp(double x, int *e) +{ + union { double d; uint64_t i; } y = { x }; + int ee = y.i>>52 & 0x7ff; + + if (!ee) { + if (x) { + x = frexp(x*0x1p64, e); + *e -= 64; + } else *e = 0; + return x; + } else if (ee == 0x7ff) { + return x; + } + + *e = ee - 0x3fe; + y.i &= 0x800fffffffffffffull; + y.i |= 0x3fe0000000000000ull; + return y.d; +} diff --git a/Ubiquitous/XiZi/lib/musllib/src/math/frexpl.c b/Ubiquitous/XiZi/lib/musllib/src/math/frexpl.c new file mode 100644 index 000000000..3c1b55374 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/math/frexpl.c @@ -0,0 +1,29 @@ +#include "libm.h" + +#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 +long double frexpl(long double x, int *e) +{ + return frexp(x, e); +} +#elif (LDBL_MANT_DIG == 64 || LDBL_MANT_DIG == 113) && LDBL_MAX_EXP == 16384 +long double frexpl(long double x, int *e) +{ + union ldshape u = {x}; + int ee = u.i.se & 0x7fff; + + if (!ee) { + if (x) { + x = frexpl(x*0x1p120, e); + *e -= 120; + } else *e = 0; + return x; + } else if (ee == 0x7fff) { + return x; + } + + *e = ee - 0x3ffe; + u.i.se &= 0x8000; + u.i.se |= 0x3ffe; + return u.f; +} +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/src/math/log.c b/Ubiquitous/XiZi/lib/musllib/src/math/log.c new file mode 100644 index 000000000..4024f8289 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/math/log.c @@ -0,0 +1,127 @@ +/* + * Double-precision log(x) function. + * + * Copyright (c) 2018, Arm Limited. + * SPDX-License-Identifier: MIT + */ + +#include +#include +#include "libm.h" +#include "log_data.h" + +#define T __log_data.tab +#define T2 __log_data.tab2 +#define B __log_data.poly1 +#define A __log_data.poly +#define Ln2hi __log_data.ln2hi +#define Ln2lo __log_data.ln2lo +#define N (1 << LOG_TABLE_BITS) +#define OFF 0x3fe6000000000000 + +#ifdef NEED_MATH_DIVZERO +/* base math internal func */ +double __math_divzero(uint32_t sign) +{ + return fp_barrier(sign ? -1.0 : 1.0) / 0.0; +} +#endif + +#ifdef NEED_MATH_INVALID +double __math_invalid(double x) +{ + return (x - x) / (x - x); +} +#endif + +/* Top 16 bits of a double. */ +static inline uint32_t top16(double x) +{ + return asuint64(x) >> 48; +} + +double log(double x) +{ + double_t w, z, r, r2, r3, y, invc, logc, kd, hi, lo; + uint64_t ix, iz, tmp; + uint32_t top; + int k, i; + + ix = asuint64(x); + top = top16(x); +#define LO asuint64(1.0 - 0x1p-4) +#define HI asuint64(1.0 + 0x1.09p-4) + if (predict_false(ix - LO < HI - LO)) { + /* Handle close to 1.0 inputs separately. */ + /* Fix sign of zero with downward rounding when x==1. */ + if (WANT_ROUNDING && predict_false(ix == asuint64(1.0))) + return 0; + r = x - 1.0; + r2 = r * r; + r3 = r * r2; + y = r3 * + (B[1] + r * B[2] + r2 * B[3] + + r3 * (B[4] + r * B[5] + r2 * B[6] + + r3 * (B[7] + r * B[8] + r2 * B[9] + r3 * B[10]))); + /* Worst-case error is around 0.507 ULP. */ + w = r * 0x1p27; + double_t rhi = r + w - w; + double_t rlo = r - rhi; + w = rhi * rhi * B[0]; /* B[0] == -0.5. */ + hi = r + w; + lo = r - hi + w; + lo += B[0] * rlo * (rhi + r); + y += lo; + y += hi; + return eval_as_double(y); + } + if (predict_false(top - 0x0010 >= 0x7ff0 - 0x0010)) { + /* x < 0x1p-1022 or inf or nan. */ + if (ix * 2 == 0) + return __math_divzero(1); + if (ix == asuint64(INFINITY)) /* log(inf) == inf. */ + return x; + if ((top & 0x8000) || (top & 0x7ff0) == 0x7ff0) + return __math_invalid(x); + /* x is subnormal, normalize it. */ + ix = asuint64(x * 0x1p52); + ix -= 52ULL << 52; + } + + /* x = 2^k z; where z is in range [OFF,2*OFF) and exact. + The range is split into N subintervals. + The ith subinterval contains z and c is near its center. */ + tmp = ix - OFF; + i = (tmp >> (52 - LOG_TABLE_BITS)) % N; + k = (int64_t)tmp >> 52; /* arithmetic shift */ + iz = ix - (tmp & 0xfffULL << 52); + invc = T[i].invc; + logc = T[i].logc; + z = asdouble(iz); + + /* log(x) = log1p(z/c-1) + log(c) + k*Ln2. */ + /* r ~= z/c - 1, |r| < 1/(2*N). */ +#if __FP_FAST_FMA + /* rounding error: 0x1p-55/N. */ + r = __builtin_fma(z, invc, -1.0); +#else + /* rounding error: 0x1p-55/N + 0x1p-66. */ + r = (z - T2[i].chi - T2[i].clo) * invc; +#endif + kd = (double_t)k; + + /* hi + lo = r + log(c) + k*Ln2. */ + w = kd * Ln2hi + logc; + hi = w + r; + lo = w - hi + r + kd * Ln2lo; + + /* log(x) = lo + (log1p(r) - r) + hi. */ + r2 = r * r; /* rounding error: 0x1p-54/N^2. */ + /* Worst case error if |y| > 0x1p-5: + 0.5 + 4.13/N + abs-poly-error*2^57 ULP (+ 0.002 ULP without fma) + Worst case error if |y| > 0x1p-4: + 0.5 + 2.06/N + abs-poly-error*2^56 ULP (+ 0.001 ULP without fma). */ + y = lo + r2 * A[0] + + r * r2 * (A[1] + r * A[2] + r2 * (A[3] + r * A[4])) + hi; + return eval_as_double(y); +} diff --git a/Ubiquitous/XiZi/lib/musllib/src/math/log_data.c b/Ubiquitous/XiZi/lib/musllib/src/math/log_data.c new file mode 100644 index 000000000..1a6ec712a --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/math/log_data.c @@ -0,0 +1,328 @@ +/* + * Data for log. + * + * Copyright (c) 2018, Arm Limited. + * SPDX-License-Identifier: MIT + */ + +#include "log_data.h" + +#define N (1 << LOG_TABLE_BITS) + +const struct log_data __log_data = { +.ln2hi = 0x1.62e42fefa3800p-1, +.ln2lo = 0x1.ef35793c76730p-45, +.poly1 = { +// relative error: 0x1.c04d76cp-63 +// in -0x1p-4 0x1.09p-4 (|log(1+x)| > 0x1p-4 outside the interval) +-0x1p-1, +0x1.5555555555577p-2, +-0x1.ffffffffffdcbp-3, +0x1.999999995dd0cp-3, +-0x1.55555556745a7p-3, +0x1.24924a344de3p-3, +-0x1.fffffa4423d65p-4, +0x1.c7184282ad6cap-4, +-0x1.999eb43b068ffp-4, +0x1.78182f7afd085p-4, +-0x1.5521375d145cdp-4, +}, +.poly = { +// relative error: 0x1.926199e8p-56 +// abs error: 0x1.882ff33p-65 +// in -0x1.fp-9 0x1.fp-9 +-0x1.0000000000001p-1, +0x1.555555551305bp-2, +-0x1.fffffffeb459p-3, +0x1.999b324f10111p-3, +-0x1.55575e506c89fp-3, +}, +/* Algorithm: + + x = 2^k z + log(x) = k ln2 + log(c) + log(z/c) + log(z/c) = poly(z/c - 1) + +where z is in [1.6p-1; 1.6p0] which is split into N subintervals and z falls +into the ith one, then table entries are computed as + + tab[i].invc = 1/c + tab[i].logc = (double)log(c) + tab2[i].chi = (double)c + tab2[i].clo = (double)(c - (double)c) + +where c is near the center of the subinterval and is chosen by trying +-2^29 +floating point invc candidates around 1/center and selecting one for which + + 1) the rounding error in 0x1.8p9 + logc is 0, + 2) the rounding error in z - chi - clo is < 0x1p-66 and + 3) the rounding error in (double)log(c) is minimized (< 0x1p-66). + +Note: 1) ensures that k*ln2hi + logc can be computed without rounding error, +2) ensures that z/c - 1 can be computed as (z - chi - clo)*invc with close to +a single rounding error when there is no fast fma for z*invc - 1, 3) ensures +that logc + poly(z/c - 1) has small error, however near x == 1 when +|log(x)| < 0x1p-4, this is not enough so that is special cased. */ +.tab = { +{0x1.734f0c3e0de9fp+0, -0x1.7cc7f79e69000p-2}, +{0x1.713786a2ce91fp+0, -0x1.76feec20d0000p-2}, +{0x1.6f26008fab5a0p+0, -0x1.713e31351e000p-2}, +{0x1.6d1a61f138c7dp+0, -0x1.6b85b38287800p-2}, +{0x1.6b1490bc5b4d1p+0, -0x1.65d5590807800p-2}, +{0x1.69147332f0cbap+0, -0x1.602d076180000p-2}, +{0x1.6719f18224223p+0, -0x1.5a8ca86909000p-2}, +{0x1.6524f99a51ed9p+0, -0x1.54f4356035000p-2}, +{0x1.63356aa8f24c4p+0, -0x1.4f637c36b4000p-2}, +{0x1.614b36b9ddc14p+0, -0x1.49da7fda85000p-2}, +{0x1.5f66452c65c4cp+0, -0x1.445923989a800p-2}, +{0x1.5d867b5912c4fp+0, -0x1.3edf439b0b800p-2}, +{0x1.5babccb5b90dep+0, -0x1.396ce448f7000p-2}, +{0x1.59d61f2d91a78p+0, -0x1.3401e17bda000p-2}, +{0x1.5805612465687p+0, -0x1.2e9e2ef468000p-2}, +{0x1.56397cee76bd3p+0, -0x1.2941b3830e000p-2}, +{0x1.54725e2a77f93p+0, -0x1.23ec58cda8800p-2}, +{0x1.52aff42064583p+0, -0x1.1e9e129279000p-2}, +{0x1.50f22dbb2bddfp+0, -0x1.1956d2b48f800p-2}, +{0x1.4f38f4734ded7p+0, -0x1.141679ab9f800p-2}, +{0x1.4d843cfde2840p+0, -0x1.0edd094ef9800p-2}, +{0x1.4bd3ec078a3c8p+0, -0x1.09aa518db1000p-2}, +{0x1.4a27fc3e0258ap+0, -0x1.047e65263b800p-2}, +{0x1.4880524d48434p+0, -0x1.feb224586f000p-3}, +{0x1.46dce1b192d0bp+0, -0x1.f474a7517b000p-3}, +{0x1.453d9d3391854p+0, -0x1.ea4443d103000p-3}, +{0x1.43a2744b4845ap+0, -0x1.e020d44e9b000p-3}, +{0x1.420b54115f8fbp+0, -0x1.d60a22977f000p-3}, +{0x1.40782da3ef4b1p+0, -0x1.cc00104959000p-3}, +{0x1.3ee8f5d57fe8fp+0, -0x1.c202956891000p-3}, +{0x1.3d5d9a00b4ce9p+0, -0x1.b81178d811000p-3}, +{0x1.3bd60c010c12bp+0, -0x1.ae2c9ccd3d000p-3}, +{0x1.3a5242b75dab8p+0, -0x1.a45402e129000p-3}, +{0x1.38d22cd9fd002p+0, -0x1.9a877681df000p-3}, +{0x1.3755bc5847a1cp+0, -0x1.90c6d69483000p-3}, +{0x1.35dce49ad36e2p+0, -0x1.87120a645c000p-3}, +{0x1.34679984dd440p+0, -0x1.7d68fb4143000p-3}, +{0x1.32f5cceffcb24p+0, -0x1.73cb83c627000p-3}, +{0x1.3187775a10d49p+0, -0x1.6a39a9b376000p-3}, +{0x1.301c8373e3990p+0, -0x1.60b3154b7a000p-3}, +{0x1.2eb4ebb95f841p+0, -0x1.5737d76243000p-3}, +{0x1.2d50a0219a9d1p+0, -0x1.4dc7b8fc23000p-3}, +{0x1.2bef9a8b7fd2ap+0, -0x1.4462c51d20000p-3}, +{0x1.2a91c7a0c1babp+0, -0x1.3b08abc830000p-3}, +{0x1.293726014b530p+0, -0x1.31b996b490000p-3}, +{0x1.27dfa5757a1f5p+0, -0x1.2875490a44000p-3}, +{0x1.268b39b1d3bbfp+0, -0x1.1f3b9f879a000p-3}, +{0x1.2539d838ff5bdp+0, -0x1.160c8252ca000p-3}, +{0x1.23eb7aac9083bp+0, -0x1.0ce7f57f72000p-3}, +{0x1.22a012ba940b6p+0, -0x1.03cdc49fea000p-3}, +{0x1.2157996cc4132p+0, -0x1.f57bdbc4b8000p-4}, +{0x1.201201dd2fc9bp+0, -0x1.e370896404000p-4}, +{0x1.1ecf4494d480bp+0, -0x1.d17983ef94000p-4}, +{0x1.1d8f5528f6569p+0, -0x1.bf9674ed8a000p-4}, +{0x1.1c52311577e7cp+0, -0x1.adc79202f6000p-4}, +{0x1.1b17c74cb26e9p+0, -0x1.9c0c3e7288000p-4}, +{0x1.19e010c2c1ab6p+0, -0x1.8a646b372c000p-4}, +{0x1.18ab07bb670bdp+0, -0x1.78d01b3ac0000p-4}, +{0x1.1778a25efbcb6p+0, -0x1.674f145380000p-4}, +{0x1.1648d354c31dap+0, -0x1.55e0e6d878000p-4}, +{0x1.151b990275fddp+0, -0x1.4485cdea1e000p-4}, +{0x1.13f0ea432d24cp+0, -0x1.333d94d6aa000p-4}, +{0x1.12c8b7210f9dap+0, -0x1.22079f8c56000p-4}, +{0x1.11a3028ecb531p+0, -0x1.10e4698622000p-4}, +{0x1.107fbda8434afp+0, -0x1.ffa6c6ad20000p-5}, +{0x1.0f5ee0f4e6bb3p+0, -0x1.dda8d4a774000p-5}, +{0x1.0e4065d2a9fcep+0, -0x1.bbcece4850000p-5}, +{0x1.0d244632ca521p+0, -0x1.9a1894012c000p-5}, +{0x1.0c0a77ce2981ap+0, -0x1.788583302c000p-5}, +{0x1.0af2f83c636d1p+0, -0x1.5715e67d68000p-5}, +{0x1.09ddb98a01339p+0, -0x1.35c8a49658000p-5}, +{0x1.08cabaf52e7dfp+0, -0x1.149e364154000p-5}, +{0x1.07b9f2f4e28fbp+0, -0x1.e72c082eb8000p-6}, +{0x1.06ab58c358f19p+0, -0x1.a55f152528000p-6}, +{0x1.059eea5ecf92cp+0, -0x1.63d62cf818000p-6}, +{0x1.04949cdd12c90p+0, -0x1.228fb8caa0000p-6}, +{0x1.038c6c6f0ada9p+0, -0x1.c317b20f90000p-7}, +{0x1.02865137932a9p+0, -0x1.419355daa0000p-7}, +{0x1.0182427ea7348p+0, -0x1.81203c2ec0000p-8}, +{0x1.008040614b195p+0, -0x1.0040979240000p-9}, +{0x1.fe01ff726fa1ap-1, 0x1.feff384900000p-9}, +{0x1.fa11cc261ea74p-1, 0x1.7dc41353d0000p-7}, +{0x1.f6310b081992ep-1, 0x1.3cea3c4c28000p-6}, +{0x1.f25f63ceeadcdp-1, 0x1.b9fc114890000p-6}, +{0x1.ee9c8039113e7p-1, 0x1.1b0d8ce110000p-5}, +{0x1.eae8078cbb1abp-1, 0x1.58a5bd001c000p-5}, +{0x1.e741aa29d0c9bp-1, 0x1.95c8340d88000p-5}, +{0x1.e3a91830a99b5p-1, 0x1.d276aef578000p-5}, +{0x1.e01e009609a56p-1, 0x1.07598e598c000p-4}, +{0x1.dca01e577bb98p-1, 0x1.253f5e30d2000p-4}, +{0x1.d92f20b7c9103p-1, 0x1.42edd8b380000p-4}, +{0x1.d5cac66fb5ccep-1, 0x1.606598757c000p-4}, +{0x1.d272caa5ede9dp-1, 0x1.7da76356a0000p-4}, +{0x1.cf26e3e6b2ccdp-1, 0x1.9ab434e1c6000p-4}, +{0x1.cbe6da2a77902p-1, 0x1.b78c7bb0d6000p-4}, +{0x1.c8b266d37086dp-1, 0x1.d431332e72000p-4}, +{0x1.c5894bd5d5804p-1, 0x1.f0a3171de6000p-4}, +{0x1.c26b533bb9f8cp-1, 0x1.067152b914000p-3}, +{0x1.bf583eeece73fp-1, 0x1.147858292b000p-3}, +{0x1.bc4fd75db96c1p-1, 0x1.2266ecdca3000p-3}, +{0x1.b951e0c864a28p-1, 0x1.303d7a6c55000p-3}, +{0x1.b65e2c5ef3e2cp-1, 0x1.3dfc33c331000p-3}, +{0x1.b374867c9888bp-1, 0x1.4ba366b7a8000p-3}, +{0x1.b094b211d304ap-1, 0x1.5933928d1f000p-3}, +{0x1.adbe885f2ef7ep-1, 0x1.66acd2418f000p-3}, +{0x1.aaf1d31603da2p-1, 0x1.740f8ec669000p-3}, +{0x1.a82e63fd358a7p-1, 0x1.815c0f51af000p-3}, +{0x1.a5740ef09738bp-1, 0x1.8e92954f68000p-3}, +{0x1.a2c2a90ab4b27p-1, 0x1.9bb3602f84000p-3}, +{0x1.a01a01393f2d1p-1, 0x1.a8bed1c2c0000p-3}, +{0x1.9d79f24db3c1bp-1, 0x1.b5b515c01d000p-3}, +{0x1.9ae2505c7b190p-1, 0x1.c2967ccbcc000p-3}, +{0x1.9852ef297ce2fp-1, 0x1.cf635d5486000p-3}, +{0x1.95cbaeea44b75p-1, 0x1.dc1bd3446c000p-3}, +{0x1.934c69de74838p-1, 0x1.e8c01b8cfe000p-3}, +{0x1.90d4f2f6752e6p-1, 0x1.f5509c0179000p-3}, +{0x1.8e6528effd79dp-1, 0x1.00e6c121fb800p-2}, +{0x1.8bfce9fcc007cp-1, 0x1.071b80e93d000p-2}, +{0x1.899c0dabec30ep-1, 0x1.0d46b9e867000p-2}, +{0x1.87427aa2317fbp-1, 0x1.13687334bd000p-2}, +{0x1.84f00acb39a08p-1, 0x1.1980d67234800p-2}, +{0x1.82a49e8653e55p-1, 0x1.1f8ffe0cc8000p-2}, +{0x1.8060195f40260p-1, 0x1.2595fd7636800p-2}, +{0x1.7e22563e0a329p-1, 0x1.2b9300914a800p-2}, +{0x1.7beb377dcb5adp-1, 0x1.3187210436000p-2}, +{0x1.79baa679725c2p-1, 0x1.377266dec1800p-2}, +{0x1.77907f2170657p-1, 0x1.3d54ffbaf3000p-2}, +{0x1.756cadbd6130cp-1, 0x1.432eee32fe000p-2}, +}, +#if !__FP_FAST_FMA +.tab2 = { +{0x1.61000014fb66bp-1, 0x1.e026c91425b3cp-56}, +{0x1.63000034db495p-1, 0x1.dbfea48005d41p-55}, +{0x1.650000d94d478p-1, 0x1.e7fa786d6a5b7p-55}, +{0x1.67000074e6fadp-1, 0x1.1fcea6b54254cp-57}, +{0x1.68ffffedf0faep-1, -0x1.c7e274c590efdp-56}, +{0x1.6b0000763c5bcp-1, -0x1.ac16848dcda01p-55}, +{0x1.6d0001e5cc1f6p-1, 0x1.33f1c9d499311p-55}, +{0x1.6efffeb05f63ep-1, -0x1.e80041ae22d53p-56}, +{0x1.710000e86978p-1, 0x1.bff6671097952p-56}, +{0x1.72ffffc67e912p-1, 0x1.c00e226bd8724p-55}, +{0x1.74fffdf81116ap-1, -0x1.e02916ef101d2p-57}, +{0x1.770000f679c9p-1, -0x1.7fc71cd549c74p-57}, +{0x1.78ffffa7ec835p-1, 0x1.1bec19ef50483p-55}, +{0x1.7affffe20c2e6p-1, -0x1.07e1729cc6465p-56}, +{0x1.7cfffed3fc9p-1, -0x1.08072087b8b1cp-55}, +{0x1.7efffe9261a76p-1, 0x1.dc0286d9df9aep-55}, +{0x1.81000049ca3e8p-1, 0x1.97fd251e54c33p-55}, +{0x1.8300017932c8fp-1, -0x1.afee9b630f381p-55}, +{0x1.850000633739cp-1, 0x1.9bfbf6b6535bcp-55}, +{0x1.87000204289c6p-1, -0x1.bbf65f3117b75p-55}, +{0x1.88fffebf57904p-1, -0x1.9006ea23dcb57p-55}, +{0x1.8b00022bc04dfp-1, -0x1.d00df38e04b0ap-56}, +{0x1.8cfffe50c1b8ap-1, -0x1.8007146ff9f05p-55}, +{0x1.8effffc918e43p-1, 0x1.3817bd07a7038p-55}, +{0x1.910001efa5fc7p-1, 0x1.93e9176dfb403p-55}, +{0x1.9300013467bb9p-1, 0x1.f804e4b980276p-56}, +{0x1.94fffe6ee076fp-1, -0x1.f7ef0d9ff622ep-55}, +{0x1.96fffde3c12d1p-1, -0x1.082aa962638bap-56}, +{0x1.98ffff4458a0dp-1, -0x1.7801b9164a8efp-55}, +{0x1.9afffdd982e3ep-1, -0x1.740e08a5a9337p-55}, +{0x1.9cfffed49fb66p-1, 0x1.fce08c19bep-60}, +{0x1.9f00020f19c51p-1, -0x1.a3faa27885b0ap-55}, +{0x1.a10001145b006p-1, 0x1.4ff489958da56p-56}, +{0x1.a300007bbf6fap-1, 0x1.cbeab8a2b6d18p-55}, +{0x1.a500010971d79p-1, 0x1.8fecadd78793p-55}, +{0x1.a70001df52e48p-1, -0x1.f41763dd8abdbp-55}, +{0x1.a90001c593352p-1, -0x1.ebf0284c27612p-55}, +{0x1.ab0002a4f3e4bp-1, -0x1.9fd043cff3f5fp-57}, +{0x1.acfffd7ae1ed1p-1, -0x1.23ee7129070b4p-55}, +{0x1.aefffee510478p-1, 0x1.a063ee00edea3p-57}, +{0x1.b0fffdb650d5bp-1, 0x1.a06c8381f0ab9p-58}, +{0x1.b2ffffeaaca57p-1, -0x1.9011e74233c1dp-56}, +{0x1.b4fffd995badcp-1, -0x1.9ff1068862a9fp-56}, +{0x1.b7000249e659cp-1, 0x1.aff45d0864f3ep-55}, +{0x1.b8ffff987164p-1, 0x1.cfe7796c2c3f9p-56}, +{0x1.bafffd204cb4fp-1, -0x1.3ff27eef22bc4p-57}, +{0x1.bcfffd2415c45p-1, -0x1.cffb7ee3bea21p-57}, +{0x1.beffff86309dfp-1, -0x1.14103972e0b5cp-55}, +{0x1.c0fffe1b57653p-1, 0x1.bc16494b76a19p-55}, +{0x1.c2ffff1fa57e3p-1, -0x1.4feef8d30c6edp-57}, +{0x1.c4fffdcbfe424p-1, -0x1.43f68bcec4775p-55}, +{0x1.c6fffed54b9f7p-1, 0x1.47ea3f053e0ecp-55}, +{0x1.c8fffeb998fd5p-1, 0x1.383068df992f1p-56}, +{0x1.cb0002125219ap-1, -0x1.8fd8e64180e04p-57}, +{0x1.ccfffdd94469cp-1, 0x1.e7ebe1cc7ea72p-55}, +{0x1.cefffeafdc476p-1, 0x1.ebe39ad9f88fep-55}, +{0x1.d1000169af82bp-1, 0x1.57d91a8b95a71p-56}, +{0x1.d30000d0ff71dp-1, 0x1.9c1906970c7dap-55}, +{0x1.d4fffea790fc4p-1, -0x1.80e37c558fe0cp-58}, +{0x1.d70002edc87e5p-1, -0x1.f80d64dc10f44p-56}, +{0x1.d900021dc82aap-1, -0x1.47c8f94fd5c5cp-56}, +{0x1.dafffd86b0283p-1, 0x1.c7f1dc521617ep-55}, +{0x1.dd000296c4739p-1, 0x1.8019eb2ffb153p-55}, +{0x1.defffe54490f5p-1, 0x1.e00d2c652cc89p-57}, +{0x1.e0fffcdabf694p-1, -0x1.f8340202d69d2p-56}, +{0x1.e2fffdb52c8ddp-1, 0x1.b00c1ca1b0864p-56}, +{0x1.e4ffff24216efp-1, 0x1.2ffa8b094ab51p-56}, +{0x1.e6fffe88a5e11p-1, -0x1.7f673b1efbe59p-58}, +{0x1.e9000119eff0dp-1, -0x1.4808d5e0bc801p-55}, +{0x1.eafffdfa51744p-1, 0x1.80006d54320b5p-56}, +{0x1.ed0001a127fa1p-1, -0x1.002f860565c92p-58}, +{0x1.ef00007babcc4p-1, -0x1.540445d35e611p-55}, +{0x1.f0ffff57a8d02p-1, -0x1.ffb3139ef9105p-59}, +{0x1.f30001ee58ac7p-1, 0x1.a81acf2731155p-55}, +{0x1.f4ffff5823494p-1, 0x1.a3f41d4d7c743p-55}, +{0x1.f6ffffca94c6bp-1, -0x1.202f41c987875p-57}, +{0x1.f8fffe1f9c441p-1, 0x1.77dd1f477e74bp-56}, +{0x1.fafffd2e0e37ep-1, -0x1.f01199a7ca331p-57}, +{0x1.fd0001c77e49ep-1, 0x1.181ee4bceacb1p-56}, +{0x1.feffff7e0c331p-1, -0x1.e05370170875ap-57}, +{0x1.00ffff465606ep+0, -0x1.a7ead491c0adap-55}, +{0x1.02ffff3867a58p+0, -0x1.77f69c3fcb2ep-54}, +{0x1.04ffffdfc0d17p+0, 0x1.7bffe34cb945bp-54}, +{0x1.0700003cd4d82p+0, 0x1.20083c0e456cbp-55}, +{0x1.08ffff9f2cbe8p+0, -0x1.dffdfbe37751ap-57}, +{0x1.0b000010cda65p+0, -0x1.13f7faee626ebp-54}, +{0x1.0d00001a4d338p+0, 0x1.07dfa79489ff7p-55}, +{0x1.0effffadafdfdp+0, -0x1.7040570d66bcp-56}, +{0x1.110000bbafd96p+0, 0x1.e80d4846d0b62p-55}, +{0x1.12ffffae5f45dp+0, 0x1.dbffa64fd36efp-54}, +{0x1.150000dd59ad9p+0, 0x1.a0077701250aep-54}, +{0x1.170000f21559ap+0, 0x1.dfdf9e2e3deeep-55}, +{0x1.18ffffc275426p+0, 0x1.10030dc3b7273p-54}, +{0x1.1b000123d3c59p+0, 0x1.97f7980030188p-54}, +{0x1.1cffff8299eb7p+0, -0x1.5f932ab9f8c67p-57}, +{0x1.1effff48ad4p+0, 0x1.37fbf9da75bebp-54}, +{0x1.210000c8b86a4p+0, 0x1.f806b91fd5b22p-54}, +{0x1.2300003854303p+0, 0x1.3ffc2eb9fbf33p-54}, +{0x1.24fffffbcf684p+0, 0x1.601e77e2e2e72p-56}, +{0x1.26ffff52921d9p+0, 0x1.ffcbb767f0c61p-56}, +{0x1.2900014933a3cp+0, -0x1.202ca3c02412bp-56}, +{0x1.2b00014556313p+0, -0x1.2808233f21f02p-54}, +{0x1.2cfffebfe523bp+0, -0x1.8ff7e384fdcf2p-55}, +{0x1.2f0000bb8ad96p+0, -0x1.5ff51503041c5p-55}, +{0x1.30ffffb7ae2afp+0, -0x1.10071885e289dp-55}, +{0x1.32ffffeac5f7fp+0, -0x1.1ff5d3fb7b715p-54}, +{0x1.350000ca66756p+0, 0x1.57f82228b82bdp-54}, +{0x1.3700011fbf721p+0, 0x1.000bac40dd5ccp-55}, +{0x1.38ffff9592fb9p+0, -0x1.43f9d2db2a751p-54}, +{0x1.3b00004ddd242p+0, 0x1.57f6b707638e1p-55}, +{0x1.3cffff5b2c957p+0, 0x1.a023a10bf1231p-56}, +{0x1.3efffeab0b418p+0, 0x1.87f6d66b152bp-54}, +{0x1.410001532aff4p+0, 0x1.7f8375f198524p-57}, +{0x1.4300017478b29p+0, 0x1.301e672dc5143p-55}, +{0x1.44fffe795b463p+0, 0x1.9ff69b8b2895ap-55}, +{0x1.46fffe80475ep+0, -0x1.5c0b19bc2f254p-54}, +{0x1.48fffef6fc1e7p+0, 0x1.b4009f23a2a72p-54}, +{0x1.4afffe5bea704p+0, -0x1.4ffb7bf0d7d45p-54}, +{0x1.4d000171027dep+0, -0x1.9c06471dc6a3dp-54}, +{0x1.4f0000ff03ee2p+0, 0x1.77f890b85531cp-54}, +{0x1.5100012dc4bd1p+0, 0x1.004657166a436p-57}, +{0x1.530001605277ap+0, -0x1.6bfcece233209p-54}, +{0x1.54fffecdb704cp+0, -0x1.902720505a1d7p-55}, +{0x1.56fffef5f54a9p+0, 0x1.bbfe60ec96412p-54}, +{0x1.5900017e61012p+0, 0x1.87ec581afef9p-55}, +{0x1.5b00003c93e92p+0, -0x1.f41080abf0ccp-54}, +{0x1.5d0001d4919bcp+0, -0x1.8812afb254729p-54}, +{0x1.5efffe7b87a89p+0, -0x1.47eb780ed6904p-54}, +}, +#endif +}; diff --git a/Ubiquitous/XiZi/lib/musllib/src/math/log_data.h b/Ubiquitous/XiZi/lib/musllib/src/math/log_data.h new file mode 100644 index 000000000..d86752366 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/math/log_data.h @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2018, Arm Limited. + * SPDX-License-Identifier: MIT + */ +#ifndef _LOG_DATA_H +#define _LOG_DATA_H + +#include + +#define LOG_TABLE_BITS 7 +#define LOG_POLY_ORDER 6 +#define LOG_POLY1_ORDER 12 +extern const struct log_data { + double ln2hi; + double ln2lo; + double poly[LOG_POLY_ORDER - 1]; /* First coefficient is 1. */ + double poly1[LOG_POLY1_ORDER - 1]; + struct { + double invc, logc; + } tab[1 << LOG_TABLE_BITS]; +#if !__FP_FAST_FMA + struct { + double chi, clo; + } tab2[1 << LOG_TABLE_BITS]; +#endif +} __log_data; + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/src/math/pow.c b/Ubiquitous/XiZi/lib/musllib/src/math/pow.c new file mode 100644 index 000000000..434aea3a6 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/math/pow.c @@ -0,0 +1,343 @@ +/* + * Double-precision x^y function. + * + * Copyright (c) 2018, Arm Limited. + * SPDX-License-Identifier: MIT + */ + +#include +#include +#include "libm.h" +#include "exp_data.h" +#include "pow_data.h" + +/* +Worst-case error: 0.54 ULP (~= ulperr_exp + 1024*Ln2*relerr_log*2^53) +relerr_log: 1.3 * 2^-68 (Relative error of log, 1.5 * 2^-68 without fma) +ulperr_exp: 0.509 ULP (ULP error of exp, 0.511 ULP without fma) +*/ + +#define T __pow_log_data1.tab +#define A __pow_log_data1.poly +#define Ln2hi __pow_log_data1.ln2hi +#define Ln2lo __pow_log_data1.ln2lo +#define N (1 << POW_LOG_TABLE_BITS) +#define OFF 0x3fe6955500000000 + +/* Top 12 bits of a double (sign and exponent bits). */ +static inline uint32_t top12(double x) +{ + return asuint64(x) >> 52; +} + +/* Compute y+TAIL = log(x) where the rounded result is y and TAIL has about + additional 15 bits precision. IX is the bit representation of x, but + normalized in the subnormal range using the sign bit for the exponent. */ +static inline double_t log_inline(uint64_t ix, double_t *tail) +{ + /* double_t for better performance on targets with FLT_EVAL_METHOD==2. */ + double_t z, r, y, invc, logc, logctail, kd, hi, t1, t2, lo, lo1, lo2, p; + uint64_t iz, tmp; + int k, i; + + /* x = 2^k z; where z is in range [OFF,2*OFF) and exact. + The range is split into N subintervals. + The ith subinterval contains z and c is near its center. */ + tmp = ix - OFF; + i = (tmp >> (52 - POW_LOG_TABLE_BITS)) % N; + k = (int64_t)tmp >> 52; /* arithmetic shift */ + iz = ix - (tmp & 0xfffULL << 52); + z = asdouble(iz); + kd = (double_t)k; + + /* log(x) = k*Ln2 + log(c) + log1p(z/c-1). */ + invc = T[i].invc; + logc = T[i].logc; + logctail = T[i].logctail; + + /* Note: 1/c is j/N or j/N/2 where j is an integer in [N,2N) and + |z/c - 1| < 1/N, so r = z/c - 1 is exactly representible. */ +#if __FP_FAST_FMA + r = __builtin_fma(z, invc, -1.0); +#else + /* Split z such that rhi, rlo and rhi*rhi are exact and |rlo| <= |r|. */ + double_t zhi = asdouble((iz + (1ULL << 31)) & (-1ULL << 32)); + double_t zlo = z - zhi; + double_t rhi = zhi * invc - 1.0; + double_t rlo = zlo * invc; + r = rhi + rlo; +#endif + + /* k*Ln2 + log(c) + r. */ + t1 = kd * Ln2hi + logc; + t2 = t1 + r; + lo1 = kd * Ln2lo + logctail; + lo2 = t1 - t2 + r; + + /* Evaluation is optimized assuming superscalar pipelined execution. */ + double_t ar, ar2, ar3, lo3, lo4; + ar = A[0] * r; /* A[0] = -0.5. */ + ar2 = r * ar; + ar3 = r * ar2; + /* k*Ln2 + log(c) + r + A[0]*r*r. */ +#if __FP_FAST_FMA + hi = t2 + ar2; + lo3 = __builtin_fma(ar, r, -ar2); + lo4 = t2 - hi + ar2; +#else + double_t arhi = A[0] * rhi; + double_t arhi2 = rhi * arhi; + hi = t2 + arhi2; + lo3 = rlo * (ar + arhi); + lo4 = t2 - hi + arhi2; +#endif + /* p = log1p(r) - r - A[0]*r*r. */ + p = (ar3 * (A[1] + r * A[2] + + ar2 * (A[3] + r * A[4] + ar2 * (A[5] + r * A[6])))); + lo = lo1 + lo2 + lo3 + lo4 + p; + y = hi + lo; + *tail = hi - y + lo; + return y; +} + +#undef N +#undef T +#define N (1 << EXP_TABLE_BITS) +#define InvLn2N __exp_data1.invln2N +#define NegLn2hiN __exp_data1.negln2hiN +#define NegLn2loN __exp_data1.negln2loN +#define Shift __exp_data1.shift +#define T __exp_data1.tab +#define C2 __exp_data1.poly[5 - EXP_POLY_ORDER] +#define C3 __exp_data1.poly[6 - EXP_POLY_ORDER] +#define C4 __exp_data1.poly[7 - EXP_POLY_ORDER] +#define C5 __exp_data1.poly[8 - EXP_POLY_ORDER] +#define C6 __exp_data1.poly[9 - EXP_POLY_ORDER] + +/* Handle cases that may overflow or underflow when computing the result that + is scale*(1+TMP) without intermediate rounding. The bit representation of + scale is in SBITS, however it has a computed exponent that may have + overflown into the sign bit so that needs to be adjusted before using it as + a double. (int32_t)KI is the k used in the argument reduction and exponent + adjustment of scale, positive k here means the result may overflow and + negative k means the result may underflow. */ +static inline double specialcase(double_t tmp, uint64_t sbits, uint64_t ki) +{ + double_t scale, y; + + if ((ki & 0x80000000) == 0) { + /* k > 0, the exponent of scale might have overflowed by <= 460. */ + sbits -= 1009ull << 52; + scale = asdouble(sbits); + y = 0x1p1009 * (scale + scale * tmp); + return eval_as_double(y); + } + /* k < 0, need special care in the subnormal range. */ + sbits += 1022ull << 52; + /* Note: sbits is signed scale. */ + scale = asdouble(sbits); + y = scale + scale * tmp; + if (fabs(y) < 1.0) { + /* Round y to the right precision before scaling it into the subnormal + range to avoid double rounding that can cause 0.5+E/2 ulp error where + E is the worst-case ulp error outside the subnormal range. So this + is only useful if the goal is better than 1 ulp worst-case error. */ + double_t hi, lo, one = 1.0; + if (y < 0.0) + one = -1.0; + lo = scale - y + scale * tmp; + hi = one + y; + lo = one - hi + y + lo; + y = eval_as_double(hi + lo) - one; + /* Fix the sign of 0. */ + if (y == 0.0) + y = asdouble(sbits & 0x8000000000000000); + /* The underflow exception needs to be signaled explicitly. */ + fp_force_eval(fp_barrier(0x1p-1022) * 0x1p-1022); + } + y = 0x1p-1022 * y; + return eval_as_double(y); +} + +#define SIGN_BIAS (0x800 << EXP_TABLE_BITS) + +/* Computes sign*exp(x+xtail) where |xtail| < 2^-8/N and |xtail| <= |x|. + The sign_bias argument is SIGN_BIAS or 0 and sets the sign to -1 or 1. */ +static inline double exp_inline(double_t x, double_t xtail, uint32_t sign_bias) +{ + uint32_t abstop; + uint64_t ki, idx, top, sbits; + /* double_t for better performance on targets with FLT_EVAL_METHOD==2. */ + double_t kd, z, r, r2, scale, tail, tmp; + + abstop = top12(x) & 0x7ff; + if (predict_false(abstop - top12(0x1p-54) >= + top12(512.0) - top12(0x1p-54))) { + if (abstop - top12(0x1p-54) >= 0x80000000) { + /* Avoid spurious underflow for tiny x. */ + /* Note: 0 is common input. */ + double_t one = WANT_ROUNDING ? 1.0 + x : 1.0; + return sign_bias ? -one : one; + } + if (abstop >= top12(1024.0)) { + /* Note: inf and nan are already handled. */ + if (asuint64(x) >> 63) + return __math_uflow(sign_bias); + else + return __math_oflow(sign_bias); + } + /* Large x is special cased below. */ + abstop = 0; + } + + /* exp(x) = 2^(k/N) * exp(r), with exp(r) in [2^(-1/2N),2^(1/2N)]. */ + /* x = ln2/N*k + r, with int k and r in [-ln2/2N, ln2/2N]. */ + z = InvLn2N * x; +#if TOINT_INTRINSICS + kd = roundtoint(z); + ki = converttoint(z); +#elif EXP_USE_TOINT_NARROW + /* z - kd is in [-0.5-2^-16, 0.5] in all rounding modes. */ + kd = eval_as_double(z + Shift); + ki = asuint64(kd) >> 16; + kd = (double_t)(int32_t)ki; +#else + /* z - kd is in [-1, 1] in non-nearest rounding modes. */ + kd = eval_as_double(z + Shift); + ki = asuint64(kd); + kd -= Shift; +#endif + r = x + kd * NegLn2hiN + kd * NegLn2loN; + /* The code assumes 2^-200 < |xtail| < 2^-8/N. */ + r += xtail; + /* 2^(k/N) ~= scale * (1 + tail). */ + idx = 2 * (ki % N); + top = (ki + sign_bias) << (52 - EXP_TABLE_BITS); + tail = asdouble(T[idx]); + /* This is only a valid scale when -1023*N < k < 1024*N. */ + sbits = T[idx + 1] + top; + /* exp(x) = 2^(k/N) * exp(r) ~= scale + scale * (tail + exp(r) - 1). */ + /* Evaluation is optimized assuming superscalar pipelined execution. */ + r2 = r * r; + /* Without fma the worst case error is 0.25/N ulp larger. */ + /* Worst case error is less than 0.5+1.11/N+(abs poly error * 2^53) ulp. */ + tmp = tail + r + r2 * (C2 + r * C3) + r2 * r2 * (C4 + r * C5); + if (predict_false(abstop == 0)) + return specialcase(tmp, sbits, ki); + scale = asdouble(sbits); + /* Note: tmp == 0 or |tmp| > 2^-200 and scale > 2^-739, so there + is no spurious underflow here even without fma. */ + return eval_as_double(scale + scale * tmp); +} + +/* Returns 0 if not int, 1 if odd int, 2 if even int. The argument is + the bit representation of a non-zero finite floating-point value. */ +static inline int checkint(uint64_t iy) +{ + int e = iy >> 52 & 0x7ff; + if (e < 0x3ff) + return 0; + if (e > 0x3ff + 52) + return 2; + if (iy & ((1ULL << (0x3ff + 52 - e)) - 1)) + return 0; + if (iy & (1ULL << (0x3ff + 52 - e))) + return 1; + return 2; +} + +/* Returns 1 if input is the bit representation of 0, infinity or nan. */ +static inline int zeroinfnan(uint64_t i) +{ + return 2 * i - 1 >= 2 * asuint64(INFINITY) - 1; +} + +double pow(double x, double y) +{ + uint32_t sign_bias = 0; + uint64_t ix, iy; + uint32_t topx, topy; + + ix = asuint64(x); + iy = asuint64(y); + topx = top12(x); + topy = top12(y); + if (predict_false(topx - 0x001 >= 0x7ff - 0x001 || + (topy & 0x7ff) - 0x3be >= 0x43e - 0x3be)) { + /* Note: if |y| > 1075 * ln2 * 2^53 ~= 0x1.749p62 then pow(x,y) = inf/0 + and if |y| < 2^-54 / 1075 ~= 0x1.e7b6p-65 then pow(x,y) = +-1. */ + /* Special cases: (x < 0x1p-126 or inf or nan) or + (|y| < 0x1p-65 or |y| >= 0x1p63 or nan). */ + if (predict_false(zeroinfnan(iy))) { + if (2 * iy == 0) + return issignaling_inline(x) ? x + y : 1.0; + if (ix == asuint64(1.0)) + return issignaling_inline(y) ? x + y : 1.0; + if (2 * ix > 2 * asuint64(INFINITY) || + 2 * iy > 2 * asuint64(INFINITY)) + return x + y; + if (2 * ix == 2 * asuint64(1.0)) + return 1.0; + if ((2 * ix < 2 * asuint64(1.0)) == !(iy >> 63)) + return 0.0; /* |x|<1 && y==inf or |x|>1 && y==-inf. */ + return y * y; + } + if (predict_false(zeroinfnan(ix))) { + double_t x2 = x * x; + if (ix >> 63 && checkint(iy) == 1) + x2 = -x2; + /* Without the barrier some versions of clang hoist the 1/x2 and + thus division by zero exception can be signaled spuriously. */ + return iy >> 63 ? fp_barrier(1 / x2) : x2; + } + /* Here x and y are non-zero finite. */ + if (ix >> 63) { + /* Finite x < 0. */ + int yint = checkint(iy); + if (yint == 0) + return __math_invalid(x); + if (yint == 1) + sign_bias = SIGN_BIAS; + ix &= 0x7fffffffffffffff; + topx &= 0x7ff; + } + if ((topy & 0x7ff) - 0x3be >= 0x43e - 0x3be) { + /* Note: sign_bias == 0 here because y is not odd. */ + if (ix == asuint64(1.0)) + return 1.0; + if ((topy & 0x7ff) < 0x3be) { + /* |y| < 2^-65, x^y ~= 1 + y*log(x). */ + if (WANT_ROUNDING) + return ix > asuint64(1.0) ? 1.0 + y : + 1.0 - y; + else + return 1.0; + } + return (ix > asuint64(1.0)) == (topy < 0x800) ? + __math_oflow(0) : + __math_uflow(0); + } + if (topx == 0) { + /* Normalize subnormal x so exponent becomes negative. */ + ix = asuint64(x * 0x1p52); + ix &= 0x7fffffffffffffff; + ix -= 52ULL << 52; + } + } + + double_t lo; + double_t hi = log_inline(ix, &lo); + double_t ehi, elo; +#if __FP_FAST_FMA + ehi = y * hi; + elo = y * lo + __builtin_fma(y, hi, -ehi); +#else + double_t yhi = asdouble(iy & -1ULL << 27); + double_t ylo = y - yhi; + double_t lhi = asdouble(asuint64(hi) & -1ULL << 27); + double_t llo = hi - lhi + lo; + ehi = yhi * lhi; + elo = ylo * lhi + y * llo; /* |elo| < |ehi| * 2^-25. */ +#endif + return exp_inline(ehi, elo, sign_bias); +} diff --git a/Ubiquitous/XiZi/lib/musllib/src/math/pow_data.c b/Ubiquitous/XiZi/lib/musllib/src/math/pow_data.c new file mode 100644 index 000000000..0c9d07de4 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/math/pow_data.c @@ -0,0 +1,180 @@ +/* + * Data for the log part of pow. + * + * Copyright (c) 2018, Arm Limited. + * SPDX-License-Identifier: MIT + */ + +#include "pow_data.h" + +#define N (1 << POW_LOG_TABLE_BITS) + +const struct pow_log_data __pow_log_data1 = { +.ln2hi = 0x1.62e42fefa3800p-1, +.ln2lo = 0x1.ef35793c76730p-45, +.poly = { +// relative error: 0x1.11922ap-70 +// in -0x1.6bp-8 0x1.6bp-8 +// Coefficients are scaled to match the scaling during evaluation. +-0x1p-1, +0x1.555555555556p-2 * -2, +-0x1.0000000000006p-2 * -2, +0x1.999999959554ep-3 * 4, +-0x1.555555529a47ap-3 * 4, +0x1.2495b9b4845e9p-3 * -8, +-0x1.0002b8b263fc3p-3 * -8, +}, +/* Algorithm: + + x = 2^k z + log(x) = k ln2 + log(c) + log(z/c) + log(z/c) = poly(z/c - 1) + +where z is in [0x1.69555p-1; 0x1.69555p0] which is split into N subintervals +and z falls into the ith one, then table entries are computed as + + tab[i].invc = 1/c + tab[i].logc = round(0x1p43*log(c))/0x1p43 + tab[i].logctail = (double)(log(c) - logc) + +where c is chosen near the center of the subinterval such that 1/c has only a +few precision bits so z/c - 1 is exactly representible as double: + + 1/c = center < 1 ? round(N/center)/N : round(2*N/center)/N/2 + +Note: |z/c - 1| < 1/N for the chosen c, |log(c) - logc - logctail| < 0x1p-97, +the last few bits of logc are rounded away so k*ln2hi + logc has no rounding +error and the interval for z is selected such that near x == 1, where log(x) +is tiny, large cancellation error is avoided in logc + poly(z/c - 1). */ +.tab = { +#define A(a, b, c) {a, 0, b, c}, +A(0x1.6a00000000000p+0, -0x1.62c82f2b9c800p-2, 0x1.ab42428375680p-48) +A(0x1.6800000000000p+0, -0x1.5d1bdbf580800p-2, -0x1.ca508d8e0f720p-46) +A(0x1.6600000000000p+0, -0x1.5767717455800p-2, -0x1.362a4d5b6506dp-45) +A(0x1.6400000000000p+0, -0x1.51aad872df800p-2, -0x1.684e49eb067d5p-49) +A(0x1.6200000000000p+0, -0x1.4be5f95777800p-2, -0x1.41b6993293ee0p-47) +A(0x1.6000000000000p+0, -0x1.4618bc21c6000p-2, 0x1.3d82f484c84ccp-46) +A(0x1.5e00000000000p+0, -0x1.404308686a800p-2, 0x1.c42f3ed820b3ap-50) +A(0x1.5c00000000000p+0, -0x1.3a64c55694800p-2, 0x1.0b1c686519460p-45) +A(0x1.5a00000000000p+0, -0x1.347dd9a988000p-2, 0x1.5594dd4c58092p-45) +A(0x1.5800000000000p+0, -0x1.2e8e2bae12000p-2, 0x1.67b1e99b72bd8p-45) +A(0x1.5600000000000p+0, -0x1.2895a13de8800p-2, 0x1.5ca14b6cfb03fp-46) +A(0x1.5600000000000p+0, -0x1.2895a13de8800p-2, 0x1.5ca14b6cfb03fp-46) +A(0x1.5400000000000p+0, -0x1.22941fbcf7800p-2, -0x1.65a242853da76p-46) +A(0x1.5200000000000p+0, -0x1.1c898c1699800p-2, -0x1.fafbc68e75404p-46) +A(0x1.5000000000000p+0, -0x1.1675cababa800p-2, 0x1.f1fc63382a8f0p-46) +A(0x1.4e00000000000p+0, -0x1.1058bf9ae4800p-2, -0x1.6a8c4fd055a66p-45) +A(0x1.4c00000000000p+0, -0x1.0a324e2739000p-2, -0x1.c6bee7ef4030ep-47) +A(0x1.4a00000000000p+0, -0x1.0402594b4d000p-2, -0x1.036b89ef42d7fp-48) +A(0x1.4a00000000000p+0, -0x1.0402594b4d000p-2, -0x1.036b89ef42d7fp-48) +A(0x1.4800000000000p+0, -0x1.fb9186d5e4000p-3, 0x1.d572aab993c87p-47) +A(0x1.4600000000000p+0, -0x1.ef0adcbdc6000p-3, 0x1.b26b79c86af24p-45) +A(0x1.4400000000000p+0, -0x1.e27076e2af000p-3, -0x1.72f4f543fff10p-46) +A(0x1.4200000000000p+0, -0x1.d5c216b4fc000p-3, 0x1.1ba91bbca681bp-45) +A(0x1.4000000000000p+0, -0x1.c8ff7c79aa000p-3, 0x1.7794f689f8434p-45) +A(0x1.4000000000000p+0, -0x1.c8ff7c79aa000p-3, 0x1.7794f689f8434p-45) +A(0x1.3e00000000000p+0, -0x1.bc286742d9000p-3, 0x1.94eb0318bb78fp-46) +A(0x1.3c00000000000p+0, -0x1.af3c94e80c000p-3, 0x1.a4e633fcd9066p-52) +A(0x1.3a00000000000p+0, -0x1.a23bc1fe2b000p-3, -0x1.58c64dc46c1eap-45) +A(0x1.3a00000000000p+0, -0x1.a23bc1fe2b000p-3, -0x1.58c64dc46c1eap-45) +A(0x1.3800000000000p+0, -0x1.9525a9cf45000p-3, -0x1.ad1d904c1d4e3p-45) +A(0x1.3600000000000p+0, -0x1.87fa06520d000p-3, 0x1.bbdbf7fdbfa09p-45) +A(0x1.3400000000000p+0, -0x1.7ab890210e000p-3, 0x1.bdb9072534a58p-45) +A(0x1.3400000000000p+0, -0x1.7ab890210e000p-3, 0x1.bdb9072534a58p-45) +A(0x1.3200000000000p+0, -0x1.6d60fe719d000p-3, -0x1.0e46aa3b2e266p-46) +A(0x1.3000000000000p+0, -0x1.5ff3070a79000p-3, -0x1.e9e439f105039p-46) +A(0x1.3000000000000p+0, -0x1.5ff3070a79000p-3, -0x1.e9e439f105039p-46) +A(0x1.2e00000000000p+0, -0x1.526e5e3a1b000p-3, -0x1.0de8b90075b8fp-45) +A(0x1.2c00000000000p+0, -0x1.44d2b6ccb8000p-3, 0x1.70cc16135783cp-46) +A(0x1.2c00000000000p+0, -0x1.44d2b6ccb8000p-3, 0x1.70cc16135783cp-46) +A(0x1.2a00000000000p+0, -0x1.371fc201e9000p-3, 0x1.178864d27543ap-48) +A(0x1.2800000000000p+0, -0x1.29552f81ff000p-3, -0x1.48d301771c408p-45) +A(0x1.2600000000000p+0, -0x1.1b72ad52f6000p-3, -0x1.e80a41811a396p-45) +A(0x1.2600000000000p+0, -0x1.1b72ad52f6000p-3, -0x1.e80a41811a396p-45) +A(0x1.2400000000000p+0, -0x1.0d77e7cd09000p-3, 0x1.a699688e85bf4p-47) +A(0x1.2400000000000p+0, -0x1.0d77e7cd09000p-3, 0x1.a699688e85bf4p-47) +A(0x1.2200000000000p+0, -0x1.fec9131dbe000p-4, -0x1.575545ca333f2p-45) +A(0x1.2000000000000p+0, -0x1.e27076e2b0000p-4, 0x1.a342c2af0003cp-45) +A(0x1.2000000000000p+0, -0x1.e27076e2b0000p-4, 0x1.a342c2af0003cp-45) +A(0x1.1e00000000000p+0, -0x1.c5e548f5bc000p-4, -0x1.d0c57585fbe06p-46) +A(0x1.1c00000000000p+0, -0x1.a926d3a4ae000p-4, 0x1.53935e85baac8p-45) +A(0x1.1c00000000000p+0, -0x1.a926d3a4ae000p-4, 0x1.53935e85baac8p-45) +A(0x1.1a00000000000p+0, -0x1.8c345d631a000p-4, 0x1.37c294d2f5668p-46) +A(0x1.1a00000000000p+0, -0x1.8c345d631a000p-4, 0x1.37c294d2f5668p-46) +A(0x1.1800000000000p+0, -0x1.6f0d28ae56000p-4, -0x1.69737c93373dap-45) +A(0x1.1600000000000p+0, -0x1.51b073f062000p-4, 0x1.f025b61c65e57p-46) +A(0x1.1600000000000p+0, -0x1.51b073f062000p-4, 0x1.f025b61c65e57p-46) +A(0x1.1400000000000p+0, -0x1.341d7961be000p-4, 0x1.c5edaccf913dfp-45) +A(0x1.1400000000000p+0, -0x1.341d7961be000p-4, 0x1.c5edaccf913dfp-45) +A(0x1.1200000000000p+0, -0x1.16536eea38000p-4, 0x1.47c5e768fa309p-46) +A(0x1.1000000000000p+0, -0x1.f0a30c0118000p-5, 0x1.d599e83368e91p-45) +A(0x1.1000000000000p+0, -0x1.f0a30c0118000p-5, 0x1.d599e83368e91p-45) +A(0x1.0e00000000000p+0, -0x1.b42dd71198000p-5, 0x1.c827ae5d6704cp-46) +A(0x1.0e00000000000p+0, -0x1.b42dd71198000p-5, 0x1.c827ae5d6704cp-46) +A(0x1.0c00000000000p+0, -0x1.77458f632c000p-5, -0x1.cfc4634f2a1eep-45) +A(0x1.0c00000000000p+0, -0x1.77458f632c000p-5, -0x1.cfc4634f2a1eep-45) +A(0x1.0a00000000000p+0, -0x1.39e87b9fec000p-5, 0x1.502b7f526feaap-48) +A(0x1.0a00000000000p+0, -0x1.39e87b9fec000p-5, 0x1.502b7f526feaap-48) +A(0x1.0800000000000p+0, -0x1.f829b0e780000p-6, -0x1.980267c7e09e4p-45) +A(0x1.0800000000000p+0, -0x1.f829b0e780000p-6, -0x1.980267c7e09e4p-45) +A(0x1.0600000000000p+0, -0x1.7b91b07d58000p-6, -0x1.88d5493faa639p-45) +A(0x1.0400000000000p+0, -0x1.fc0a8b0fc0000p-7, -0x1.f1e7cf6d3a69cp-50) +A(0x1.0400000000000p+0, -0x1.fc0a8b0fc0000p-7, -0x1.f1e7cf6d3a69cp-50) +A(0x1.0200000000000p+0, -0x1.fe02a6b100000p-8, -0x1.9e23f0dda40e4p-46) +A(0x1.0200000000000p+0, -0x1.fe02a6b100000p-8, -0x1.9e23f0dda40e4p-46) +A(0x1.0000000000000p+0, 0x0.0000000000000p+0, 0x0.0000000000000p+0) +A(0x1.0000000000000p+0, 0x0.0000000000000p+0, 0x0.0000000000000p+0) +A(0x1.fc00000000000p-1, 0x1.0101575890000p-7, -0x1.0c76b999d2be8p-46) +A(0x1.f800000000000p-1, 0x1.0205658938000p-6, -0x1.3dc5b06e2f7d2p-45) +A(0x1.f400000000000p-1, 0x1.8492528c90000p-6, -0x1.aa0ba325a0c34p-45) +A(0x1.f000000000000p-1, 0x1.0415d89e74000p-5, 0x1.111c05cf1d753p-47) +A(0x1.ec00000000000p-1, 0x1.466aed42e0000p-5, -0x1.c167375bdfd28p-45) +A(0x1.e800000000000p-1, 0x1.894aa149fc000p-5, -0x1.97995d05a267dp-46) +A(0x1.e400000000000p-1, 0x1.ccb73cdddc000p-5, -0x1.a68f247d82807p-46) +A(0x1.e200000000000p-1, 0x1.eea31c006c000p-5, -0x1.e113e4fc93b7bp-47) +A(0x1.de00000000000p-1, 0x1.1973bd1466000p-4, -0x1.5325d560d9e9bp-45) +A(0x1.da00000000000p-1, 0x1.3bdf5a7d1e000p-4, 0x1.cc85ea5db4ed7p-45) +A(0x1.d600000000000p-1, 0x1.5e95a4d97a000p-4, -0x1.c69063c5d1d1ep-45) +A(0x1.d400000000000p-1, 0x1.700d30aeac000p-4, 0x1.c1e8da99ded32p-49) +A(0x1.d000000000000p-1, 0x1.9335e5d594000p-4, 0x1.3115c3abd47dap-45) +A(0x1.cc00000000000p-1, 0x1.b6ac88dad6000p-4, -0x1.390802bf768e5p-46) +A(0x1.ca00000000000p-1, 0x1.c885801bc4000p-4, 0x1.646d1c65aacd3p-45) +A(0x1.c600000000000p-1, 0x1.ec739830a2000p-4, -0x1.dc068afe645e0p-45) +A(0x1.c400000000000p-1, 0x1.fe89139dbe000p-4, -0x1.534d64fa10afdp-45) +A(0x1.c000000000000p-1, 0x1.1178e8227e000p-3, 0x1.1ef78ce2d07f2p-45) +A(0x1.be00000000000p-1, 0x1.1aa2b7e23f000p-3, 0x1.ca78e44389934p-45) +A(0x1.ba00000000000p-1, 0x1.2d1610c868000p-3, 0x1.39d6ccb81b4a1p-47) +A(0x1.b800000000000p-1, 0x1.365fcb0159000p-3, 0x1.62fa8234b7289p-51) +A(0x1.b400000000000p-1, 0x1.4913d8333b000p-3, 0x1.5837954fdb678p-45) +A(0x1.b200000000000p-1, 0x1.527e5e4a1b000p-3, 0x1.633e8e5697dc7p-45) +A(0x1.ae00000000000p-1, 0x1.6574ebe8c1000p-3, 0x1.9cf8b2c3c2e78p-46) +A(0x1.ac00000000000p-1, 0x1.6f0128b757000p-3, -0x1.5118de59c21e1p-45) +A(0x1.aa00000000000p-1, 0x1.7898d85445000p-3, -0x1.c661070914305p-46) +A(0x1.a600000000000p-1, 0x1.8beafeb390000p-3, -0x1.73d54aae92cd1p-47) +A(0x1.a400000000000p-1, 0x1.95a5adcf70000p-3, 0x1.7f22858a0ff6fp-47) +A(0x1.a000000000000p-1, 0x1.a93ed3c8ae000p-3, -0x1.8724350562169p-45) +A(0x1.9e00000000000p-1, 0x1.b31d8575bd000p-3, -0x1.c358d4eace1aap-47) +A(0x1.9c00000000000p-1, 0x1.bd087383be000p-3, -0x1.d4bc4595412b6p-45) +A(0x1.9a00000000000p-1, 0x1.c6ffbc6f01000p-3, -0x1.1ec72c5962bd2p-48) +A(0x1.9600000000000p-1, 0x1.db13db0d49000p-3, -0x1.aff2af715b035p-45) +A(0x1.9400000000000p-1, 0x1.e530effe71000p-3, 0x1.212276041f430p-51) +A(0x1.9200000000000p-1, 0x1.ef5ade4dd0000p-3, -0x1.a211565bb8e11p-51) +A(0x1.9000000000000p-1, 0x1.f991c6cb3b000p-3, 0x1.bcbecca0cdf30p-46) +A(0x1.8c00000000000p-1, 0x1.07138604d5800p-2, 0x1.89cdb16ed4e91p-48) +A(0x1.8a00000000000p-1, 0x1.0c42d67616000p-2, 0x1.7188b163ceae9p-45) +A(0x1.8800000000000p-1, 0x1.1178e8227e800p-2, -0x1.c210e63a5f01cp-45) +A(0x1.8600000000000p-1, 0x1.16b5ccbacf800p-2, 0x1.b9acdf7a51681p-45) +A(0x1.8400000000000p-1, 0x1.1bf99635a6800p-2, 0x1.ca6ed5147bdb7p-45) +A(0x1.8200000000000p-1, 0x1.214456d0eb800p-2, 0x1.a87deba46baeap-47) +A(0x1.7e00000000000p-1, 0x1.2bef07cdc9000p-2, 0x1.a9cfa4a5004f4p-45) +A(0x1.7c00000000000p-1, 0x1.314f1e1d36000p-2, -0x1.8e27ad3213cb8p-45) +A(0x1.7a00000000000p-1, 0x1.36b6776be1000p-2, 0x1.16ecdb0f177c8p-46) +A(0x1.7800000000000p-1, 0x1.3c25277333000p-2, 0x1.83b54b606bd5cp-46) +A(0x1.7600000000000p-1, 0x1.419b423d5e800p-2, 0x1.8e436ec90e09dp-47) +A(0x1.7400000000000p-1, 0x1.4718dc271c800p-2, -0x1.f27ce0967d675p-45) +A(0x1.7200000000000p-1, 0x1.4c9e09e173000p-2, -0x1.e20891b0ad8a4p-45) +A(0x1.7000000000000p-1, 0x1.522ae0738a000p-2, 0x1.ebe708164c759p-45) +A(0x1.6e00000000000p-1, 0x1.57bf753c8d000p-2, 0x1.fadedee5d40efp-46) +A(0x1.6c00000000000p-1, 0x1.5d5bddf596000p-2, -0x1.a0b2a08a465dcp-47) +}, +}; diff --git a/Ubiquitous/XiZi/lib/musllib/src/math/pow_data.h b/Ubiquitous/XiZi/lib/musllib/src/math/pow_data.h new file mode 100644 index 000000000..18d2cb2ef --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/math/pow_data.h @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2018, Arm Limited. + * SPDX-License-Identifier: MIT + */ +#ifndef _POW_DATA_H +#define _POW_DATA_H + +#include + +#define POW_LOG_TABLE_BITS 7 +#define POW_LOG_POLY_ORDER 8 +extern const struct pow_log_data { + double ln2hi; + double ln2lo; + double poly[POW_LOG_POLY_ORDER - 1]; /* First coefficient is 1. */ + /* Note: the pad field is unused, but allows slightly faster indexing. */ + struct { + double invc, pad, logc, logctail; + } tab[1 << POW_LOG_TABLE_BITS]; +} __pow_log_data1; + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/src/math/round.c b/Ubiquitous/XiZi/lib/musllib/src/math/round.c new file mode 100644 index 000000000..130d58d25 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/math/round.c @@ -0,0 +1,35 @@ +#include "libm.h" + +#if FLT_EVAL_METHOD==0 || FLT_EVAL_METHOD==1 +#define EPS DBL_EPSILON +#elif FLT_EVAL_METHOD==2 +#define EPS LDBL_EPSILON +#endif +static const double_t toint = 1/EPS; + +double round(double x) +{ + union {double f; uint64_t i;} u = {x}; + int e = u.i >> 52 & 0x7ff; + double_t y; + + if (e >= 0x3ff+52) + return x; + if (u.i >> 63) + x = -x; + if (e < 0x3ff-1) { + /* raise inexact if x!=0 */ + FORCE_EVAL(x + toint); + return 0*u.f; + } + y = x + toint - toint - x; + if (y > 0.5) + y = y + x - 1; + else if (y <= -0.5) + y = y + x + 1; + else + y = y + x; + if (u.i >> 63) + y = -y; + return y; +} diff --git a/Ubiquitous/XiZi/lib/musllib/src/math/scalbn.c b/Ubiquitous/XiZi/lib/musllib/src/math/scalbn.c new file mode 100644 index 000000000..182f56106 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/math/scalbn.c @@ -0,0 +1,33 @@ +#include +#include + +double scalbn(double x, int n) +{ + union {double f; uint64_t i;} u; + double_t y = x; + + if (n > 1023) { + y *= 0x1p1023; + n -= 1023; + if (n > 1023) { + y *= 0x1p1023; + n -= 1023; + if (n > 1023) + n = 1023; + } + } else if (n < -1022) { + /* make sure final n < -53 to avoid double + rounding in the subnormal range */ + y *= 0x1p-1022 * 0x1p53; + n += 1022 - 53; + if (n < -1022) { + y *= 0x1p-1022 * 0x1p53; + n += 1022 - 53; + if (n < -1022) + n = -1022; + } + } + u.i = (uint64_t)(0x3ff+n)<<52; + x = y * u.f; + return x; +} diff --git a/Ubiquitous/XiZi/lib/musllib/src/math/scalbnl.c b/Ubiquitous/XiZi/lib/musllib/src/math/scalbnl.c new file mode 100644 index 000000000..db44dab06 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/math/scalbnl.c @@ -0,0 +1,36 @@ +#include "libm.h" + +#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 +long double scalbnl(long double x, int n) +{ + return scalbn(x, n); +} +#elif (LDBL_MANT_DIG == 64 || LDBL_MANT_DIG == 113) && LDBL_MAX_EXP == 16384 +long double scalbnl(long double x, int n) +{ + union ldshape u; + + if (n > 16383) { + x *= 0x1p16383L; + n -= 16383; + if (n > 16383) { + x *= 0x1p16383L; + n -= 16383; + if (n > 16383) + n = 16383; + } + } else if (n < -16382) { + x *= 0x1p-16382L * 0x1p113L; + n += 16382 - 113; + if (n < -16382) { + x *= 0x1p-16382L * 0x1p113L; + n += 16382 - 113; + if (n < -16382) + n = -16382; + } + } + u.f = 1.0; + u.i.se = 0x3fff + n; + return x * u.f; +} +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/src/math/sqrt.c b/Ubiquitous/XiZi/lib/musllib/src/math/sqrt.c new file mode 100644 index 000000000..f1f6d76c7 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/math/sqrt.c @@ -0,0 +1,184 @@ +/* origin: FreeBSD /usr/src/lib/msun/src/e_sqrt.c */ +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunSoft, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ +/* sqrt(x) + * Return correctly rounded sqrt. + * ------------------------------------------ + * | Use the hardware sqrt if you have one | + * ------------------------------------------ + * Method: + * Bit by bit method using integer arithmetic. (Slow, but portable) + * 1. Normalization + * Scale x to y in [1,4) with even powers of 2: + * find an integer k such that 1 <= (y=x*2^(2k)) < 4, then + * sqrt(x) = 2^k * sqrt(y) + * 2. Bit by bit computation + * Let q = sqrt(y) truncated to i bit after binary point (q = 1), + * i 0 + * i+1 2 + * s = 2*q , and y = 2 * ( y - q ). (1) + * i i i i + * + * To compute q from q , one checks whether + * i+1 i + * + * -(i+1) 2 + * (q + 2 ) <= y. (2) + * i + * -(i+1) + * If (2) is false, then q = q ; otherwise q = q + 2 . + * i+1 i i+1 i + * + * With some algebric manipulation, it is not difficult to see + * that (2) is equivalent to + * -(i+1) + * s + 2 <= y (3) + * i i + * + * The advantage of (3) is that s and y can be computed by + * i i + * the following recurrence formula: + * if (3) is false + * + * s = s , y = y ; (4) + * i+1 i i+1 i + * + * otherwise, + * -i -(i+1) + * s = s + 2 , y = y - s - 2 (5) + * i+1 i i+1 i i + * + * One may easily use induction to prove (4) and (5). + * Note. Since the left hand side of (3) contain only i+2 bits, + * it does not necessary to do a full (53-bit) comparison + * in (3). + * 3. Final rounding + * After generating the 53 bits result, we compute one more bit. + * Together with the remainder, we can decide whether the + * result is exact, bigger than 1/2ulp, or less than 1/2ulp + * (it will never equal to 1/2ulp). + * The rounding mode can be detected by checking whether + * huge + tiny is equal to huge, and whether huge - tiny is + * equal to huge for some floating point number "huge" and "tiny". + * + * Special cases: + * sqrt(+-0) = +-0 ... exact + * sqrt(inf) = inf + * sqrt(-ve) = NaN ... with invalid signal + * sqrt(NaN) = NaN ... with invalid signal for signaling NaN + */ + +#include "libm.h" + +static const double tiny = 1.0e-300; + +double sqrt(double x) +{ + double z; + int32_t sign = (int)0x80000000; + int32_t ix0,s0,q,m,t,i; + uint32_t r,t1,s1,ix1,q1; + + EXTRACT_WORDS(ix0, ix1, x); + + /* take care of Inf and NaN */ + if ((ix0&0x7ff00000) == 0x7ff00000) { + return x*x + x; /* sqrt(NaN)=NaN, sqrt(+inf)=+inf, sqrt(-inf)=sNaN */ + } + /* take care of zero */ + if (ix0 <= 0) { + if (((ix0&~sign)|ix1) == 0) + return x; /* sqrt(+-0) = +-0 */ + if (ix0 < 0) + return (x-x)/(x-x); /* sqrt(-ve) = sNaN */ + } + /* normalize x */ + m = ix0>>20; + if (m == 0) { /* subnormal x */ + while (ix0 == 0) { + m -= 21; + ix0 |= (ix1>>11); + ix1 <<= 21; + } + for (i=0; (ix0&0x00100000) == 0; i++) + ix0<<=1; + m -= i - 1; + ix0 |= ix1>>(32-i); + ix1 <<= i; + } + m -= 1023; /* unbias exponent */ + ix0 = (ix0&0x000fffff)|0x00100000; + if (m & 1) { /* odd m, double x to make it even */ + ix0 += ix0 + ((ix1&sign)>>31); + ix1 += ix1; + } + m >>= 1; /* m = [m/2] */ + + /* generate sqrt(x) bit by bit */ + ix0 += ix0 + ((ix1&sign)>>31); + ix1 += ix1; + q = q1 = s0 = s1 = 0; /* [q,q1] = sqrt(x) */ + r = 0x00200000; /* r = moving bit from right to left */ + + while (r != 0) { + t = s0 + r; + if (t <= ix0) { + s0 = t + r; + ix0 -= t; + q += r; + } + ix0 += ix0 + ((ix1&sign)>>31); + ix1 += ix1; + r >>= 1; + } + + r = sign; + while (r != 0) { + t1 = s1 + r; + t = s0; + if (t < ix0 || (t == ix0 && t1 <= ix1)) { + s1 = t1 + r; + if ((t1&sign) == sign && (s1&sign) == 0) + s0++; + ix0 -= t; + if (ix1 < t1) + ix0--; + ix1 -= t1; + q1 += r; + } + ix0 += ix0 + ((ix1&sign)>>31); + ix1 += ix1; + r >>= 1; + } + + /* use floating add to find out rounding direction */ + if ((ix0|ix1) != 0) { + z = 1.0 - tiny; /* raise inexact flag */ + if (z >= 1.0) { + z = 1.0 + tiny; + if (q1 == (uint32_t)0xffffffff) { + q1 = 0; + q++; + } else if (z > 1.0) { + if (q1 == (uint32_t)0xfffffffe) + q++; + q1 += 2; + } else + q1 += q1 & 1; + } + } + ix0 = (q>>1) + 0x3fe00000; + ix1 = q1>>1; + if (q&1) + ix1 |= sign; + INSERT_WORDS(z, ix0 + ((uint32_t)m << 20), ix1); + return z; +} diff --git a/Ubiquitous/XiZi/lib/musllib/src/misc/Makefile b/Ubiquitous/XiZi/lib/musllib/src/misc/Makefile new file mode 100644 index 000000000..1b9ec028f --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/misc/Makefile @@ -0,0 +1,5 @@ +SRC_FILES := dirname.c + + + +include $(KERNEL_ROOT)/compiler.mk \ No newline at end of file diff --git a/Ubiquitous/XiZi/lib/musllib/src/misc/dirname.c b/Ubiquitous/XiZi/lib/musllib/src/misc/dirname.c new file mode 100644 index 000000000..dd570883d --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/misc/dirname.c @@ -0,0 +1,14 @@ +#include +#include + +char *dirname(char *s) +{ + size_t i; + if (!s || !*s) return "."; + i = strlen(s)-1; + for (; s[i]=='/'; i--) if (!i) return "/"; + for (; s[i]!='/'; i--) if (!i) return "."; + for (; s[i]=='/'; i--) if (!i) return "/"; + s[i+1] = 0; + return s; +} diff --git a/Ubiquitous/XiZi/lib/musllib/src/multibyte/Makefile b/Ubiquitous/XiZi/lib/musllib/src/multibyte/Makefile new file mode 100644 index 000000000..904cc435a --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/multibyte/Makefile @@ -0,0 +1,5 @@ +SRC_FILES := internal.c mbrtowc.c mbsinit.c mbtowc.c wcrtomb.c wctomb.c + + + +include $(KERNEL_ROOT)/compiler.mk \ No newline at end of file diff --git a/Ubiquitous/XiZi/lib/musllib/src/multibyte/internal.c b/Ubiquitous/XiZi/lib/musllib/src/multibyte/internal.c new file mode 100644 index 000000000..2f5aaa914 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/multibyte/internal.c @@ -0,0 +1,26 @@ +#include "internal.h" + +#define C(x) ( x<2 ? -1 : ( R(0x80,0xc0) | x ) ) +#define D(x) C((x+16)) +#define E(x) ( ( x==0 ? R(0xa0,0xc0) : \ + x==0xd ? R(0x80,0xa0) : \ + R(0x80,0xc0) ) \ + | ( R(0x80,0xc0) >> 6 ) \ + | x ) +#define F(x) ( ( x>=5 ? 0 : \ + x==0 ? R(0x90,0xc0) : \ + x==4 ? R(0x80,0x90) : \ + R(0x80,0xc0) ) \ + | ( R(0x80,0xc0) >> 6 ) \ + | ( R(0x80,0xc0) >> 12 ) \ + | x ) + +const uint32_t bittab[] = { + C(0x2),C(0x3),C(0x4),C(0x5),C(0x6),C(0x7), + C(0x8),C(0x9),C(0xa),C(0xb),C(0xc),C(0xd),C(0xe),C(0xf), + D(0x0),D(0x1),D(0x2),D(0x3),D(0x4),D(0x5),D(0x6),D(0x7), + D(0x8),D(0x9),D(0xa),D(0xb),D(0xc),D(0xd),D(0xe),D(0xf), + E(0x0),E(0x1),E(0x2),E(0x3),E(0x4),E(0x5),E(0x6),E(0x7), + E(0x8),E(0x9),E(0xa),E(0xb),E(0xc),E(0xd),E(0xe),E(0xf), + F(0x0),F(0x1),F(0x2),F(0x3),F(0x4) +}; diff --git a/Ubiquitous/XiZi/lib/musllib/src/multibyte/internal.h b/Ubiquitous/XiZi/lib/musllib/src/multibyte/internal.h new file mode 100644 index 000000000..2480d1647 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/multibyte/internal.h @@ -0,0 +1,24 @@ +#define bittab __fsmu8 + +#include +#include + +extern const uint32_t bittab[]; + +/* Upper 6 state bits are a negative integer offset to bound-check next byte */ +/* equivalent to: ( (b-0x80) | (b+offset) ) & ~0x3f */ +#define OOB(c,b) (((((b)>>3)-0x10)|(((b)>>3)+((int32_t)(c)>>26))) & ~7) + +/* Interval [a,b). Either a must be 80 or b must be c0, lower 3 bits clear. */ +#define R(a,b) ((uint32_t)((a==0x80 ? 0x40u-b : 0u-a) << 23)) +#define FAILSTATE R(0x80,0x80) + +#define SA 0xc2u +#define SB 0xf4u + +/* Arbitrary encoding for representing code units instead of characters. */ +#define CODEUNIT(c) (0xdfff & (signed char)(c)) +#define IS_CODEUNIT(c) ((unsigned)(c)-0xdf80 < 0x80) + +/* Get inline definition of MB_CUR_MAX. */ +#include "locale_impl.h" diff --git a/Ubiquitous/XiZi/lib/musllib/src/multibyte/mbrtowc.c b/Ubiquitous/XiZi/lib/musllib/src/multibyte/mbrtowc.c new file mode 100644 index 000000000..c94819e72 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/multibyte/mbrtowc.c @@ -0,0 +1,51 @@ +#include +#include +#include +#include "internal.h" + +size_t mbrtowc(wchar_t *restrict wc, const char *restrict src, size_t n, mbstate_t *restrict st) +{ + static unsigned internal_state; + unsigned c; + const unsigned char *s = (const void *)src; + const unsigned N = n; + wchar_t dummy; + + if (!st) st = (void *)&internal_state; + c = *(unsigned *)st; + + if (!s) { + if (c) goto ilseq; + return 0; + } else if (!wc) wc = &dummy; + + if (!n) return -2; + if (!c) { + if (*s < 0x80) return !!(*wc = *s); + if (MB_CUR_MAX==1) return (*wc = CODEUNIT(*s)), 1; + if (*s-SA > SB-SA) goto ilseq; + c = bittab[*s++-SA]; n--; + } + + if (n) { + if (OOB(c,*s)) goto ilseq; +loop: + c = c<<6 | *s++-0x80; n--; + if (!(c&(1U<<31))) { + *(unsigned *)st = 0; + *wc = c; + return N-n; + } + if (n) { + if (*s-0x80u >= 0x40) goto ilseq; + goto loop; + } + } + + *(unsigned *)st = c; + return -2; +ilseq: + *(unsigned *)st = 0; + errno = EILSEQ; + return -1; +} diff --git a/Ubiquitous/XiZi/lib/musllib/src/multibyte/mbsinit.c b/Ubiquitous/XiZi/lib/musllib/src/multibyte/mbsinit.c new file mode 100644 index 000000000..c608194a0 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/multibyte/mbsinit.c @@ -0,0 +1,6 @@ +#include + +int mbsinit(const mbstate_t *st) +{ + return !st || !*(unsigned *)st; +} diff --git a/Ubiquitous/XiZi/lib/musllib/src/multibyte/mbtowc.c b/Ubiquitous/XiZi/lib/musllib/src/multibyte/mbtowc.c new file mode 100644 index 000000000..87fb5ba3e --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/multibyte/mbtowc.c @@ -0,0 +1,47 @@ +#include +#include +#include +#include "internal.h" + +int mbtowc(wchar_t *restrict wc, const char *restrict src, size_t n) +{ + unsigned c; + const unsigned char *s = (const void *)src; + wchar_t dummy; + + if (!s) return 0; + if (!n) goto ilseq; + if (!wc) wc = &dummy; + + if (*s < 0x80) return !!(*wc = *s); + if (MB_CUR_MAX==1) return (*wc = CODEUNIT(*s)), 1; + if (*s-SA > SB-SA) goto ilseq; + c = bittab[*s++-SA]; + + /* Avoid excessive checks against n: If shifting the state n-1 + * times does not clear the high bit, then the value of n is + * insufficient to read a character */ + if (n<4 && ((c<<(6*n-6)) & (1U<<31))) goto ilseq; + + if (OOB(c,*s)) goto ilseq; + c = (c<<6) | (*s++-0x80); + if (!(c&(1U<<31))) { + *wc = c; + return 2; + } + + if (*s-0x80u >= 0x40) goto ilseq; + c = (c<<6) | (*s++-0x80); + if (!(c&(1U<<31))) { + *wc = c; + return 3; + } + + if (*s-0x80u >= 0x40) goto ilseq; + *wc = (c<<6) | (*s++-0x80); + return 4; + +ilseq: + errno = EILSEQ; + return -1; +} diff --git a/Ubiquitous/XiZi/lib/musllib/src/multibyte/wcrtomb.c b/Ubiquitous/XiZi/lib/musllib/src/multibyte/wcrtomb.c new file mode 100644 index 000000000..8e34926ed --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/multibyte/wcrtomb.c @@ -0,0 +1,37 @@ +#include +#include +#include +#include "internal.h" + +size_t wcrtomb(char *restrict s, wchar_t wc, mbstate_t *restrict st) +{ + if (!s) return 1; + if ((unsigned)wc < 0x80) { + *s = wc; + return 1; + } else if (MB_CUR_MAX == 1) { + if (!IS_CODEUNIT(wc)) { + errno = EILSEQ; + return -1; + } + *s = wc; + return 1; + } else if ((unsigned)wc < 0x800) { + *s++ = 0xc0 | (wc>>6); + *s = 0x80 | (wc&0x3f); + return 2; + } else if ((unsigned)wc < 0xd800 || (unsigned)wc-0xe000 < 0x2000) { + *s++ = 0xe0 | (wc>>12); + *s++ = 0x80 | ((wc>>6)&0x3f); + *s = 0x80 | (wc&0x3f); + return 3; + } else if ((unsigned)wc-0x10000 < 0x100000) { + *s++ = 0xf0 | (wc>>18); + *s++ = 0x80 | ((wc>>12)&0x3f); + *s++ = 0x80 | ((wc>>6)&0x3f); + *s = 0x80 | (wc&0x3f); + return 4; + } + errno = EILSEQ; + return -1; +} diff --git a/Ubiquitous/XiZi/lib/musllib/src/multibyte/wctomb.c b/Ubiquitous/XiZi/lib/musllib/src/multibyte/wctomb.c new file mode 100644 index 000000000..bad41c5ed --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/multibyte/wctomb.c @@ -0,0 +1,8 @@ +#include +#include + +int wctomb(char *s, wchar_t wc) +{ + if (!s) return 0; + return wcrtomb(s, wc, 0); +} diff --git a/Ubiquitous/XiZi/lib/musllib/src/network/Makefile b/Ubiquitous/XiZi/lib/musllib/src/network/Makefile new file mode 100644 index 000000000..bb90f87c6 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/network/Makefile @@ -0,0 +1,5 @@ +SRC_FILES := h_errno.c htonl.c htons.c ntohl.c ntohs.c + + + +include $(KERNEL_ROOT)/compiler.mk \ No newline at end of file diff --git a/Ubiquitous/XiZi/lib/musllib/src/network/h_errno.c b/Ubiquitous/XiZi/lib/musllib/src/network/h_errno.c new file mode 100644 index 000000000..8c7082c2d --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/network/h_errno.c @@ -0,0 +1,9 @@ +#include + +#undef h_errno +int h_errno; + +int *__h_errno_location(void) +{ + return &h_errno; +} diff --git a/Ubiquitous/XiZi/lib/musllib/src/network/htonl.c b/Ubiquitous/XiZi/lib/musllib/src/network/htonl.c new file mode 100644 index 000000000..6622d16cc --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/network/htonl.c @@ -0,0 +1,8 @@ +#include +#include + +uint32_t htonl(uint32_t n) +{ + union { int i; char c; } u = { 1 }; + return u.c ? bswap_32(n) : n; +} diff --git a/Ubiquitous/XiZi/lib/musllib/src/network/htons.c b/Ubiquitous/XiZi/lib/musllib/src/network/htons.c new file mode 100644 index 000000000..03a3a1d59 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/network/htons.c @@ -0,0 +1,8 @@ +#include +#include + +uint16_t htons(uint16_t n) +{ + union { int i; char c; } u = { 1 }; + return u.c ? bswap_16(n) : n; +} diff --git a/Ubiquitous/XiZi/lib/musllib/src/network/ntohl.c b/Ubiquitous/XiZi/lib/musllib/src/network/ntohl.c new file mode 100644 index 000000000..d6fce4590 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/network/ntohl.c @@ -0,0 +1,8 @@ +#include +#include + +uint32_t ntohl(uint32_t n) +{ + union { int i; char c; } u = { 1 }; + return u.c ? bswap_32(n) : n; +} diff --git a/Ubiquitous/XiZi/lib/musllib/src/network/ntohs.c b/Ubiquitous/XiZi/lib/musllib/src/network/ntohs.c new file mode 100644 index 000000000..745cef425 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/network/ntohs.c @@ -0,0 +1,8 @@ +#include +#include + +uint16_t ntohs(uint16_t n) +{ + union { int i; char c; } u = { 1 }; + return u.c ? bswap_16(n) : n; +} diff --git a/Ubiquitous/XiZi/lib/musllib/src/prng/Makefile b/Ubiquitous/XiZi/lib/musllib/src/prng/Makefile new file mode 100644 index 000000000..39ad176e6 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/prng/Makefile @@ -0,0 +1,5 @@ +SRC_FILES := rand.c random.c + + + +include $(KERNEL_ROOT)/compiler.mk \ No newline at end of file diff --git a/Ubiquitous/XiZi/lib/musllib/src/prng/rand.c b/Ubiquitous/XiZi/lib/musllib/src/prng/rand.c new file mode 100644 index 000000000..d7f7d9609 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/prng/rand.c @@ -0,0 +1,12 @@ +#include +#include + +void srand(unsigned s) +{ + return srandom(s); +} + +int rand(void) +{ + return random(); +} \ No newline at end of file diff --git a/Ubiquitous/XiZi/lib/musllib/src/prng/random.c b/Ubiquitous/XiZi/lib/musllib/src/prng/random.c new file mode 100644 index 000000000..a77a1e0b9 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/prng/random.c @@ -0,0 +1,126 @@ +#include +#include +#include "xizi.h" +/* +this code uses the same lagged fibonacci generator as the +original bsd random implementation except for the seeding +which was broken in the original +*/ + +static uint32_t init[] = { +0x00000000,0x5851f42d,0xc0b18ccf,0xcbb5f646, +0xc7033129,0x30705b04,0x20fd5db4,0x9a8b7f78, +0x502959d8,0xab894868,0x6c0356a7,0x88cdb7ff, +0xb477d43f,0x70a3a52b,0xa8e4baf1,0xfd8341fc, +0x8ae16fd9,0x742d2f7a,0x0d1f0796,0x76035e09, +0x40f7702c,0x6fa72ca5,0xaaa84157,0x58a0df74, +0xc74a0364,0xae533cc4,0x04185faf,0x6de3b115, +0x0cab8628,0xf043bfa4,0x398150e9,0x37521657}; + +static int n = 31; +static int i = 3; +static int j = 0; +static uint32_t *x = init+1; + +static uint32_t lcg31(uint32_t x) { + return (1103515245*x + 12345) & 0x7fffffff; +} + +static uint64_t lcg64(uint64_t x) { + return 6364136223846793005ull*x + 1; +} + +static void *savestate(void) { + x[-1] = (n<<16)|(i<<8)|j; + return x-1; +} + +static void loadstate(uint32_t *state) { + x = state+1; + n = x[-1]>>16; + i = (x[-1]>>8)&0xff; + j = x[-1]&0xff; +} + +static void __srandom(unsigned seed) { + int k; + uint64_t s = seed; + + if (n == 0) { + x[0] = s; + return; + } + i = n == 31 || n == 7 ? 3 : 1; + j = 0; + for (k = 0; k < n; k++) { + s = lcg64(s); + x[k] = s>>32; + } + /* make sure x contains at least one odd number */ + x[0] |= 1; +} + +void srandom(unsigned seed) { + unsigned int intSave; + + x_base tmp_int = DISABLE_INTERRUPT(); + __srandom(seed); + ENABLE_INTERRUPT(tmp_int); +} + +char *initstate(unsigned seed, char *state, size_t size) { + void *old; + unsigned int intSave; + + if (size < 8) + return 0; + + x_base tmp_int = DISABLE_INTERRUPT(); + old = savestate(); + if (size < 32) + n = 0; + else if (size < 64) + n = 7; + else if (size < 128) + n = 15; + else if (size < 256) + n = 31; + else + n = 63; + x = (uint32_t*)state + 1; + __srandom(seed); + savestate(); + ENABLE_INTERRUPT(tmp_int); + return old; +} + +char *setstate(char *state) { + void *old; + unsigned int intSave; + + x_base tmp_int = DISABLE_INTERRUPT(); + old = savestate(); + loadstate((uint32_t*)state); + ENABLE_INTERRUPT(tmp_int); + return old; +} + +long random(void) { + long k; + unsigned int intSave; + + x_base tmp_int = DISABLE_INTERRUPT(); + if (n == 0) { + k = x[0] = lcg31(x[0]); + goto end; + } + x[i] += x[j]; + k = x[i]>>1; + if (++i == n) + i = 0; + if (++j == n) + j = 0; +end: + ENABLE_INTERRUPT(tmp_int); + return k; +} diff --git a/Ubiquitous/XiZi/lib/musllib/src/regex/Makefile b/Ubiquitous/XiZi/lib/musllib/src/regex/Makefile new file mode 100644 index 000000000..efa73dafc --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/regex/Makefile @@ -0,0 +1,5 @@ +SRC_FILES := regcomp.c regexec.c tre-mem.c + + + +include $(KERNEL_ROOT)/compiler.mk \ No newline at end of file diff --git a/Ubiquitous/XiZi/lib/musllib/src/regex/regcomp.c b/Ubiquitous/XiZi/lib/musllib/src/regex/regcomp.c new file mode 100644 index 000000000..fb24556eb --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/regex/regcomp.c @@ -0,0 +1,2953 @@ +/* + regcomp.c - TRE POSIX compatible regex compilation functions. + + Copyright (c) 2001-2009 Ville Laurikari + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS + ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 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. + +*/ + +#include +#include +#include +#include +#include +#include + +#include "tre.h" + +#include + +/*********************************************************************** + from tre-compile.h +***********************************************************************/ + +typedef struct { + int position; + int code_min; + int code_max; + int *tags; + int assertions; + tre_ctype_t class; + tre_ctype_t *neg_classes; + int backref; +} tre_pos_and_tags_t; + + +/*********************************************************************** + from tre-ast.c and tre-ast.h +***********************************************************************/ + +/* The different AST node types. */ +typedef enum { + LITERAL, + CATENATION, + ITERATION, + UNION +} tre_ast_type_t; + +/* Special subtypes of TRE_LITERAL. */ +#define EMPTY -1 /* Empty leaf (denotes empty string). */ +#define ASSERTION -2 /* Assertion leaf. */ +#define TAG -3 /* Tag leaf. */ +#define BACKREF -4 /* Back reference leaf. */ + +#define IS_SPECIAL(x) ((x)->code_min < 0) +#define IS_EMPTY(x) ((x)->code_min == EMPTY) +#define IS_ASSERTION(x) ((x)->code_min == ASSERTION) +#define IS_TAG(x) ((x)->code_min == TAG) +#define IS_BACKREF(x) ((x)->code_min == BACKREF) + + +/* A generic AST node. All AST nodes consist of this node on the top + level with `obj' pointing to the actual content. */ +typedef struct { + tre_ast_type_t type; /* Type of the node. */ + void *obj; /* Pointer to actual node. */ + int nullable; + int submatch_id; + int num_submatches; + int num_tags; + tre_pos_and_tags_t *firstpos; + tre_pos_and_tags_t *lastpos; +} tre_ast_node_t; + + +/* A "literal" node. These are created for assertions, back references, + tags, matching parameter settings, and all expressions that match one + character. */ +typedef struct { + long code_min; + long code_max; + int position; + tre_ctype_t class; + tre_ctype_t *neg_classes; +} tre_literal_t; + +/* A "catenation" node. These are created when two regexps are concatenated. + If there are more than one subexpressions in sequence, the `left' part + holds all but the last, and `right' part holds the last subexpression + (catenation is left associative). */ +typedef struct { + tre_ast_node_t *left; + tre_ast_node_t *right; +} tre_catenation_t; + +/* An "iteration" node. These are created for the "*", "+", "?", and "{m,n}" + operators. */ +typedef struct { + /* Subexpression to match. */ + tre_ast_node_t *arg; + /* Minimum number of consecutive matches. */ + int min; + /* Maximum number of consecutive matches. */ + int max; + /* If 0, match as many characters as possible, if 1 match as few as + possible. Note that this does not always mean the same thing as + matching as many/few repetitions as possible. */ + unsigned int minimal:1; +} tre_iteration_t; + +/* An "union" node. These are created for the "|" operator. */ +typedef struct { + tre_ast_node_t *left; + tre_ast_node_t *right; +} tre_union_t; + + +static tre_ast_node_t * +tre_ast_new_node(tre_mem_t mem, int type, void *obj) +{ + tre_ast_node_t *node = tre_mem_calloc(mem, sizeof *node); + if (!node || !obj) + return 0; + node->obj = obj; + node->type = type; + node->nullable = -1; + node->submatch_id = -1; + return node; +} + +static tre_ast_node_t * +tre_ast_new_literal(tre_mem_t mem, int code_min, int code_max, int position) +{ + tre_ast_node_t *node; + tre_literal_t *lit; + + lit = tre_mem_calloc(mem, sizeof *lit); + node = tre_ast_new_node(mem, LITERAL, lit); + if (!node) + return 0; + lit->code_min = code_min; + lit->code_max = code_max; + lit->position = position; + return node; +} + +static tre_ast_node_t * +tre_ast_new_iter(tre_mem_t mem, tre_ast_node_t *arg, int min, int max, int minimal) +{ + tre_ast_node_t *node; + tre_iteration_t *iter; + + iter = tre_mem_calloc(mem, sizeof *iter); + node = tre_ast_new_node(mem, ITERATION, iter); + if (!node) + return 0; + iter->arg = arg; + iter->min = min; + iter->max = max; + iter->minimal = minimal; + node->num_submatches = arg->num_submatches; + return node; +} + +static tre_ast_node_t * +tre_ast_new_union(tre_mem_t mem, tre_ast_node_t *left, tre_ast_node_t *right) +{ + tre_ast_node_t *node; + tre_union_t *un; + + if (!left) + return right; + un = tre_mem_calloc(mem, sizeof *un); + node = tre_ast_new_node(mem, UNION, un); + if (!node || !right) + return 0; + un->left = left; + un->right = right; + node->num_submatches = left->num_submatches + right->num_submatches; + return node; +} + +static tre_ast_node_t * +tre_ast_new_catenation(tre_mem_t mem, tre_ast_node_t *left, tre_ast_node_t *right) +{ + tre_ast_node_t *node; + tre_catenation_t *cat; + + if (!left) + return right; + cat = tre_mem_calloc(mem, sizeof *cat); + node = tre_ast_new_node(mem, CATENATION, cat); + if (!node) + return 0; + cat->left = left; + cat->right = right; + node->num_submatches = left->num_submatches + right->num_submatches; + return node; +} + + +/*********************************************************************** + from tre-stack.c and tre-stack.h +***********************************************************************/ + +typedef struct tre_stack_rec tre_stack_t; + +/* Creates a new stack object. `size' is initial size in bytes, `max_size' + is maximum size, and `increment' specifies how much more space will be + allocated with realloc() if all space gets used up. Returns the stack + object or NULL if out of memory. */ +static tre_stack_t * +tre_stack_new(int size, int max_size, int increment); + +/* Frees the stack object. */ +static void +tre_stack_destroy(tre_stack_t *s); + +/* Returns the current number of objects in the stack. */ +static int +tre_stack_num_objects(tre_stack_t *s); + +/* Each tre_stack_push_*(tre_stack_t *s, value) function pushes + `value' on top of stack `s'. Returns REG_ESPACE if out of memory. + This tries to realloc() more space before failing if maximum size + has not yet been reached. Returns REG_OK if successful. */ +#define declare_pushf(typetag, type) \ + static reg_errcode_t tre_stack_push_ ## typetag(tre_stack_t *s, type value) + +declare_pushf(voidptr, void *); +declare_pushf(int, int); + +/* Each tre_stack_pop_*(tre_stack_t *s) function pops the topmost + element off of stack `s' and returns it. The stack must not be + empty. */ +#define declare_popf(typetag, type) \ + static type tre_stack_pop_ ## typetag(tre_stack_t *s) + +declare_popf(voidptr, void *); +declare_popf(int, int); + +/* Just to save some typing. */ +#define STACK_PUSH(s, typetag, value) \ + do \ + { \ + status = tre_stack_push_ ## typetag(s, value); \ + } \ + while (/*CONSTCOND*/0) + +#define STACK_PUSHX(s, typetag, value) \ + { \ + status = tre_stack_push_ ## typetag(s, value); \ + if (status != REG_OK) \ + break; \ + } + +#define STACK_PUSHR(s, typetag, value) \ + { \ + reg_errcode_t _status; \ + _status = tre_stack_push_ ## typetag(s, value); \ + if (_status != REG_OK) \ + return _status; \ + } + +union tre_stack_item { + void *voidptr_value; + int int_value; +}; + +struct tre_stack_rec { + int size; + int max_size; + int increment; + int ptr; + union tre_stack_item *stack; +}; + + +static tre_stack_t * +tre_stack_new(int size, int max_size, int increment) +{ + tre_stack_t *s; + + s = xmalloc(sizeof(*s)); + if (s != NULL) + { + s->stack = xmalloc(sizeof(*s->stack) * size); + if (s->stack == NULL) + { + xfree(s); + return NULL; + } + s->size = size; + s->max_size = max_size; + s->increment = increment; + s->ptr = 0; + } + return s; +} + +static void +tre_stack_destroy(tre_stack_t *s) +{ + xfree(s->stack); + xfree(s); +} + +static int +tre_stack_num_objects(tre_stack_t *s) +{ + return s->ptr; +} + +static reg_errcode_t +tre_stack_push(tre_stack_t *s, union tre_stack_item value) +{ + if (s->ptr < s->size) + { + s->stack[s->ptr] = value; + s->ptr++; + } + else + { + if (s->size >= s->max_size) + { + return REG_ESPACE; + } + else + { + union tre_stack_item *new_buffer; + int new_size; + new_size = s->size + s->increment; + if (new_size > s->max_size) + new_size = s->max_size; + new_buffer = xrealloc(s->stack, sizeof(*new_buffer) * new_size); + if (new_buffer == NULL) + { + return REG_ESPACE; + } + assert(new_size > s->size); + s->size = new_size; + s->stack = new_buffer; + tre_stack_push(s, value); + } + } + return REG_OK; +} + +#define define_pushf(typetag, type) \ + declare_pushf(typetag, type) { \ + union tre_stack_item item; \ + item.typetag ## _value = value; \ + return tre_stack_push(s, item); \ +} + +define_pushf(int, int) +define_pushf(voidptr, void *) + +#define define_popf(typetag, type) \ + declare_popf(typetag, type) { \ + return s->stack[--s->ptr].typetag ## _value; \ + } + +define_popf(int, int) +define_popf(voidptr, void *) + + +/*********************************************************************** + from tre-parse.c and tre-parse.h +***********************************************************************/ + +/* Parse context. */ +typedef struct { + /* Memory allocator. The AST is allocated using this. */ + tre_mem_t mem; + /* Stack used for keeping track of regexp syntax. */ + tre_stack_t *stack; + /* The parsed node after a parse function returns. */ + tre_ast_node_t *n; + /* Position in the regexp pattern after a parse function returns. */ + const char *s; + /* The first character of the last subexpression parsed. */ + const char *start; + /* Current submatch ID. */ + int submatch_id; + /* Current position (number of literal). */ + int position; + /* The highest back reference or -1 if none seen so far. */ + int max_backref; + /* Compilation flags. */ + int cflags; +} tre_parse_ctx_t; + +/* Some macros for expanding \w, \s, etc. */ +static const struct { + char c; + const char *expansion; +} tre_macros[] = { + {'t', "\t"}, {'n', "\n"}, {'r', "\r"}, + {'f', "\f"}, {'a', "\a"}, {'e', "\033"}, + {'w', "[[:alnum:]_]"}, {'W', "[^[:alnum:]_]"}, {'s', "[[:space:]]"}, + {'S', "[^[:space:]]"}, {'d', "[[:digit:]]"}, {'D', "[^[:digit:]]"}, + { 0, 0 } +}; + +/* Expands a macro delimited by `regex' and `regex_end' to `buf', which + must have at least `len' items. Sets buf[0] to zero if the there + is no match in `tre_macros'. */ +static const char *tre_expand_macro(const char *s) +{ + int i; + for (i = 0; tre_macros[i].c && tre_macros[i].c != *s; i++); + return tre_macros[i].expansion; +} + +static int +tre_compare_lit(const void *a, const void *b) +{ + const tre_literal_t *const *la = a; + const tre_literal_t *const *lb = b; + /* assumes the range of valid code_min is < INT_MAX */ + return la[0]->code_min - lb[0]->code_min; +} + +struct literals { + tre_mem_t mem; + tre_literal_t **a; + int len; + int cap; +}; + +static tre_literal_t *tre_new_lit(struct literals *p) +{ + tre_literal_t **a; + if (p->len >= p->cap) { + if (p->cap >= 1<<15) + return 0; + p->cap *= 2; + a = xrealloc(p->a, p->cap * sizeof *p->a); + if (!a) + return 0; + p->a = a; + } + a = p->a + p->len++; + *a = tre_mem_calloc(p->mem, sizeof **a); + return *a; +} + +static int add_icase_literals(struct literals *ls, int min, int max) +{ + tre_literal_t *lit; + int b, e, c; + for (c=min; c<=max; ) { + /* assumes islower(c) and isupper(c) are exclusive + and toupper(c)!=c if islower(c). + multiple opposite case characters are not supported */ + if (tre_islower(c)) { + b = e = tre_toupper(c); + for (c++, e++; c<=max; c++, e++) + if (tre_toupper(c) != e) break; + } else if (tre_isupper(c)) { + b = e = tre_tolower(c); + for (c++, e++; c<=max; c++, e++) + if (tre_tolower(c) != e) break; + } else { + c++; + continue; + } + lit = tre_new_lit(ls); + if (!lit) + return -1; + lit->code_min = b; + lit->code_max = e-1; + lit->position = -1; + } + return 0; +} + + +/* Maximum number of character classes in a negated bracket expression. */ +#define MAX_NEG_CLASSES 64 + +struct neg { + int negate; + int len; + tre_ctype_t a[MAX_NEG_CLASSES]; +}; + +// TODO: parse bracket into a set of non-overlapping [lo,hi] ranges + +/* +bracket grammar: +Bracket = '[' List ']' | '[^' List ']' +List = Term | List Term +Term = Char | Range | Chclass | Eqclass +Range = Char '-' Char | Char '-' '-' +Char = Coll | coll_single +Meta = ']' | '-' +Coll = '[.' coll_single '.]' | '[.' coll_multi '.]' | '[.' Meta '.]' +Eqclass = '[=' coll_single '=]' | '[=' coll_multi '=]' +Chclass = '[:' class ':]' + +coll_single is a single char collating element but it can be + '-' only at the beginning or end of a List and + ']' only at the beginning of a List and + '^' anywhere except after the openning '[' +*/ + +static reg_errcode_t parse_bracket_terms(tre_parse_ctx_t *ctx, const char *s, struct literals *ls, struct neg *neg) +{ + const char *start = s; + tre_ctype_t class; + int min, max; + wchar_t wc; + int len; + + for (;;) { + class = 0; + len = mbtowc(&wc, s, -1); + if (len <= 0) + return *s ? REG_BADPAT : REG_EBRACK; + if (*s == ']' && s != start) { + ctx->s = s+1; + return REG_OK; + } + if (*s == '-' && s != start && s[1] != ']' && + /* extension: [a-z--@] is accepted as [a-z]|[--@] */ + (s[1] != '-' || s[2] == ']')) + return REG_ERANGE; + if (*s == '[' && (s[1] == '.' || s[1] == '=')) + /* collating symbols and equivalence classes are not supported */ + return REG_ECOLLATE; + if (*s == '[' && s[1] == ':') { + char tmp[CHARCLASS_NAME_MAX+1]; + s += 2; + for (len=0; len < CHARCLASS_NAME_MAX && s[len]; len++) { + if (s[len] == ':') { + memcpy(tmp, s, len); + tmp[len] = 0; + class = tre_ctype(tmp); + break; + } + } + if (!class || s[len+1] != ']') + return REG_ECTYPE; + min = 0; + max = TRE_CHAR_MAX; + s += len+2; + } else { + min = max = wc; + s += len; + if (*s == '-' && s[1] != ']') { + s++; + len = mbtowc(&wc, s, -1); + max = wc; + /* XXX - Should use collation order instead of + encoding values in character ranges. */ + if (len <= 0 || min > max) + return REG_ERANGE; + s += len; + } + } + + if (class && neg->negate) { + if (neg->len >= MAX_NEG_CLASSES) + return REG_ESPACE; + neg->a[neg->len++] = class; + } else { + tre_literal_t *lit = tre_new_lit(ls); + if (!lit) + return REG_ESPACE; + lit->code_min = min; + lit->code_max = max; + lit->class = class; + lit->position = -1; + + /* Add opposite-case codepoints if REG_ICASE is present. + It seems that POSIX requires that bracket negation + should happen before case-folding, but most practical + implementations do it the other way around. Changing + the order would need efficient representation of + case-fold ranges and bracket range sets even with + simple patterns so this is ok for now. */ + if (ctx->cflags & REG_ICASE && !class) + if (add_icase_literals(ls, min, max)) + return REG_ESPACE; + } + } +} + +static reg_errcode_t parse_bracket(tre_parse_ctx_t *ctx, const char *s) +{ + int i, max, min, negmax, negmin; + tre_ast_node_t *node = 0, *n; + tre_ctype_t *nc = 0; + tre_literal_t *lit; + struct literals ls; + struct neg neg; + reg_errcode_t err; + + ls.mem = ctx->mem; + ls.len = 0; + ls.cap = 32; + ls.a = xmalloc(ls.cap * sizeof *ls.a); + if (!ls.a) + return REG_ESPACE; + neg.len = 0; + neg.negate = *s == '^'; + if (neg.negate) + s++; + + err = parse_bracket_terms(ctx, s, &ls, &neg); + if (err != REG_OK) + goto parse_bracket_done; + + if (neg.negate) { + /* + * With REG_NEWLINE, POSIX requires that newlines are not matched by + * any form of a non-matching list. + */ + if (ctx->cflags & REG_NEWLINE) { + lit = tre_new_lit(&ls); + if (!lit) { + err = REG_ESPACE; + goto parse_bracket_done; + } + lit->code_min = '\n'; + lit->code_max = '\n'; + lit->position = -1; + } + /* Sort the array if we need to negate it. */ + qsort(ls.a, ls.len, sizeof *ls.a, tre_compare_lit); + /* extra lit for the last negated range */ + lit = tre_new_lit(&ls); + if (!lit) { + err = REG_ESPACE; + goto parse_bracket_done; + } + lit->code_min = TRE_CHAR_MAX+1; + lit->code_max = TRE_CHAR_MAX+1; + lit->position = -1; + /* negated classes */ + if (neg.len) { + nc = tre_mem_alloc(ctx->mem, (neg.len+1)*sizeof *neg.a); + if (!nc) { + err = REG_ESPACE; + goto parse_bracket_done; + } + memcpy(nc, neg.a, neg.len*sizeof *neg.a); + nc[neg.len] = 0; + } + } + + /* Build a union of the items in the array, negated if necessary. */ + negmax = negmin = 0; + for (i = 0; i < ls.len; i++) { + lit = ls.a[i]; + min = lit->code_min; + max = lit->code_max; + if (neg.negate) { + if (min <= negmin) { + /* Overlap. */ + negmin = MAX(max + 1, negmin); + continue; + } + negmax = min - 1; + lit->code_min = negmin; + lit->code_max = negmax; + negmin = max + 1; + } + lit->position = ctx->position; + lit->neg_classes = nc; + n = tre_ast_new_node(ctx->mem, LITERAL, lit); + node = tre_ast_new_union(ctx->mem, node, n); + if (!node) { + err = REG_ESPACE; + break; + } + } + +parse_bracket_done: + xfree(ls.a); + ctx->position++; + ctx->n = node; + return err; +} + +static const char *parse_dup_count(const char *s, int *n) +{ + *n = -1; + if (!isdigit(*s)) + return s; + *n = 0; + for (;;) { + *n = 10 * *n + (*s - '0'); + s++; + if (!isdigit(*s) || *n > RE_DUP_MAX) + break; + } + return s; +} + +static const char *parse_dup(const char *s, int ere, int *pmin, int *pmax) +{ + int min, max; + + s = parse_dup_count(s, &min); + if (*s == ',') + s = parse_dup_count(s+1, &max); + else + max = min; + + if ( + (max < min && max >= 0) || + max > RE_DUP_MAX || + min > RE_DUP_MAX || + min < 0 || + (!ere && *s++ != '\\') || + *s++ != '}' + ) + return 0; + *pmin = min; + *pmax = max; + return s; +} + +static int hexval(unsigned c) +{ + if (c-'0'<10) return c-'0'; + c |= 32; + if (c-'a'<6) return c-'a'+10; + return -1; +} + +static reg_errcode_t marksub(tre_parse_ctx_t *ctx, tre_ast_node_t *node, int subid) +{ + if (node->submatch_id >= 0) { + tre_ast_node_t *n = tre_ast_new_literal(ctx->mem, EMPTY, -1, -1); + if (!n) + return REG_ESPACE; + n = tre_ast_new_catenation(ctx->mem, n, node); + if (!n) + return REG_ESPACE; + n->num_submatches = node->num_submatches; + node = n; + } + node->submatch_id = subid; + node->num_submatches++; + ctx->n = node; + return REG_OK; +} + +/* +BRE grammar: +Regex = Branch | '^' | '$' | '^$' | '^' Branch | Branch '$' | '^' Branch '$' +Branch = Atom | Branch Atom +Atom = char | quoted_char | '.' | Bracket | Atom Dup | '\(' Branch '\)' | back_ref +Dup = '*' | '\{' Count '\}' | '\{' Count ',\}' | '\{' Count ',' Count '\}' + +(leading ^ and trailing $ in a sub expr may be an anchor or literal as well) + +ERE grammar: +Regex = Branch | Regex '|' Branch +Branch = Atom | Branch Atom +Atom = char | quoted_char | '.' | Bracket | Atom Dup | '(' Regex ')' | '^' | '$' +Dup = '*' | '+' | '?' | '{' Count '}' | '{' Count ',}' | '{' Count ',' Count '}' + +(a*+?, ^*, $+, \X, {, (|a) are unspecified) +*/ + +static reg_errcode_t parse_atom(tre_parse_ctx_t *ctx, const char *s) +{ + int len, ere = ctx->cflags & REG_EXTENDED; + const char *p; + tre_ast_node_t *node; + wchar_t wc; + switch (*s) { + case '[': + return parse_bracket(ctx, s+1); + case '\\': + p = tre_expand_macro(s+1); + if (p) { + /* assume \X expansion is a single atom */ + reg_errcode_t err = parse_atom(ctx, p); + ctx->s = s+2; + return err; + } + /* extensions: \b, \B, \<, \>, \xHH \x{HHHH} */ + switch (*++s) { + case 0: + return REG_EESCAPE; + case 'b': + node = tre_ast_new_literal(ctx->mem, ASSERTION, ASSERT_AT_WB, -1); + break; + case 'B': + node = tre_ast_new_literal(ctx->mem, ASSERTION, ASSERT_AT_WB_NEG, -1); + break; + case '<': + node = tre_ast_new_literal(ctx->mem, ASSERTION, ASSERT_AT_BOW, -1); + break; + case '>': + node = tre_ast_new_literal(ctx->mem, ASSERTION, ASSERT_AT_EOW, -1); + break; + case 'x': + s++; + int i, v = 0, c; + len = 2; + if (*s == '{') { + len = 8; + s++; + } + for (i=0; imem, v, v, ctx->position++); + s--; + break; + case '{': + case '+': + case '?': + /* extension: treat \+, \? as repetitions in BRE */ + /* reject repetitions after empty expression in BRE */ + if (!ere) + return REG_BADRPT; + case '|': + /* extension: treat \| as alternation in BRE */ + if (!ere) { + node = tre_ast_new_literal(ctx->mem, EMPTY, -1, -1); + s--; + goto end; + } + /* fallthrough */ + default: + if (!ere && (unsigned)*s-'1' < 9) { + /* back reference */ + int val = *s - '0'; + node = tre_ast_new_literal(ctx->mem, BACKREF, val, ctx->position++); + ctx->max_backref = MAX(val, ctx->max_backref); + } else { + /* extension: accept unknown escaped char + as a literal */ + goto parse_literal; + } + } + s++; + break; + case '.': + if (ctx->cflags & REG_NEWLINE) { + tre_ast_node_t *tmp1, *tmp2; + tmp1 = tre_ast_new_literal(ctx->mem, 0, '\n'-1, ctx->position++); + tmp2 = tre_ast_new_literal(ctx->mem, '\n'+1, TRE_CHAR_MAX, ctx->position++); + if (tmp1 && tmp2) + node = tre_ast_new_union(ctx->mem, tmp1, tmp2); + else + node = 0; + } else { + node = tre_ast_new_literal(ctx->mem, 0, TRE_CHAR_MAX, ctx->position++); + } + s++; + break; + case '^': + /* '^' has a special meaning everywhere in EREs, and at beginning of BRE. */ + if (!ere && s != ctx->start) + goto parse_literal; + node = tre_ast_new_literal(ctx->mem, ASSERTION, ASSERT_AT_BOL, -1); + s++; + break; + case '$': + /* '$' is special everywhere in EREs, and at the end of a BRE subexpression. */ + if (!ere && s[1] && (s[1]!='\\'|| (s[2]!=')' && s[2]!='|'))) + goto parse_literal; + node = tre_ast_new_literal(ctx->mem, ASSERTION, ASSERT_AT_EOL, -1); + s++; + break; + case '*': + case '{': + case '+': + case '?': + /* reject repetitions after empty expression in ERE */ + if (ere) + return REG_BADRPT; + case '|': + if (!ere) + goto parse_literal; + case 0: + node = tre_ast_new_literal(ctx->mem, EMPTY, -1, -1); + break; + default: +parse_literal: + len = mbtowc(&wc, s, -1); + if (len < 0) + return REG_BADPAT; + if (ctx->cflags & REG_ICASE && (tre_isupper(wc) || tre_islower(wc))) { + tre_ast_node_t *tmp1, *tmp2; + /* multiple opposite case characters are not supported */ + tmp1 = tre_ast_new_literal(ctx->mem, tre_toupper(wc), tre_toupper(wc), ctx->position); + tmp2 = tre_ast_new_literal(ctx->mem, tre_tolower(wc), tre_tolower(wc), ctx->position); + if (tmp1 && tmp2) + node = tre_ast_new_union(ctx->mem, tmp1, tmp2); + else + node = 0; + } else { + node = tre_ast_new_literal(ctx->mem, wc, wc, ctx->position); + } + ctx->position++; + s += len; + break; + } +end: + if (!node) + return REG_ESPACE; + ctx->n = node; + ctx->s = s; + return REG_OK; +} + +#define PUSHPTR(err, s, v) do { \ + if ((err = tre_stack_push_voidptr(s, v)) != REG_OK) \ + return err; \ +} while(0) + +#define PUSHINT(err, s, v) do { \ + if ((err = tre_stack_push_int(s, v)) != REG_OK) \ + return err; \ +} while(0) + +static reg_errcode_t tre_parse(tre_parse_ctx_t *ctx) +{ + tre_ast_node_t *nbranch=0, *nunion=0; + int ere = ctx->cflags & REG_EXTENDED; + const char *s = ctx->start; + int subid = 0; + int depth = 0; + reg_errcode_t err; + tre_stack_t *stack = ctx->stack; + + PUSHINT(err, stack, subid++); + for (;;) { + if ((!ere && *s == '\\' && s[1] == '(') || + (ere && *s == '(')) { + PUSHPTR(err, stack, nunion); + PUSHPTR(err, stack, nbranch); + PUSHINT(err, stack, subid++); + s++; + if (!ere) + s++; + depth++; + nbranch = nunion = 0; + ctx->start = s; + continue; + } + if ((!ere && *s == '\\' && s[1] == ')') || + (ere && *s == ')' && depth)) { + ctx->n = tre_ast_new_literal(ctx->mem, EMPTY, -1, -1); + if (!ctx->n) + return REG_ESPACE; + } else { + err = parse_atom(ctx, s); + if (err != REG_OK) + return err; + s = ctx->s; + } + + parse_iter: + for (;;) { + int min, max; + + if (*s!='\\' && *s!='*') { + if (!ere) + break; + if (*s!='+' && *s!='?' && *s!='{') + break; + } + if (*s=='\\' && ere) + break; + /* extension: treat \+, \? as repetitions in BRE */ + if (*s=='\\' && s[1]!='+' && s[1]!='?' && s[1]!='{') + break; + if (*s=='\\') + s++; + + /* handle ^* at the start of a BRE. */ + if (!ere && s==ctx->start+1 && s[-1]=='^') + break; + + /* extension: multiple consecutive *+?{,} is unspecified, + but (a+)+ has to be supported so accepting a++ makes + sense, note however that the RE_DUP_MAX limit can be + circumvented: (a{255}){255} uses a lot of memory.. */ + if (*s=='{') { + s = parse_dup(s+1, ere, &min, &max); + if (!s) + return REG_BADBR; + } else { + min=0; + max=-1; + if (*s == '+') + min = 1; + if (*s == '?') + max = 1; + s++; + } + if (max == 0) + ctx->n = tre_ast_new_literal(ctx->mem, EMPTY, -1, -1); + else + ctx->n = tre_ast_new_iter(ctx->mem, ctx->n, min, max, 0); + if (!ctx->n) + return REG_ESPACE; + } + + nbranch = tre_ast_new_catenation(ctx->mem, nbranch, ctx->n); + if ((ere && *s == '|') || + (ere && *s == ')' && depth) || + (!ere && *s == '\\' && s[1] == ')') || + /* extension: treat \| as alternation in BRE */ + (!ere && *s == '\\' && s[1] == '|') || + !*s) { + /* extension: empty branch is unspecified (), (|a), (a|) + here they are not rejected but match on empty string */ + int c = *s; + nunion = tre_ast_new_union(ctx->mem, nunion, nbranch); + nbranch = 0; + + if (c == '\\' && s[1] == '|') { + s+=2; + ctx->start = s; + } else if (c == '|') { + s++; + ctx->start = s; + } else { + if (c == '\\') { + if (!depth) return REG_EPAREN; + s+=2; + } else if (c == ')') + s++; + depth--; + err = marksub(ctx, nunion, tre_stack_pop_int(stack)); + if (err != REG_OK) + return err; + if (!c && depth<0) { + ctx->submatch_id = subid; + return REG_OK; + } + if (!c || depth<0) + return REG_EPAREN; + nbranch = tre_stack_pop_voidptr(stack); + nunion = tre_stack_pop_voidptr(stack); + goto parse_iter; + } + } + } +} + + +/*********************************************************************** + from tre-compile.c +***********************************************************************/ + + +/* + TODO: + - Fix tre_ast_to_tnfa() to recurse using a stack instead of recursive + function calls. +*/ + +/* + Algorithms to setup tags so that submatch addressing can be done. +*/ + + +/* Inserts a catenation node to the root of the tree given in `node'. + As the left child a new tag with number `tag_id' to `node' is added, + and the right child is the old root. */ +static reg_errcode_t +tre_add_tag_left(tre_mem_t mem, tre_ast_node_t *node, int tag_id) +{ + tre_catenation_t *c; + + c = tre_mem_alloc(mem, sizeof(*c)); + if (c == NULL) + return REG_ESPACE; + c->left = tre_ast_new_literal(mem, TAG, tag_id, -1); + if (c->left == NULL) + return REG_ESPACE; + c->right = tre_mem_alloc(mem, sizeof(tre_ast_node_t)); + if (c->right == NULL) + return REG_ESPACE; + + c->right->obj = node->obj; + c->right->type = node->type; + c->right->nullable = -1; + c->right->submatch_id = -1; + c->right->firstpos = NULL; + c->right->lastpos = NULL; + c->right->num_tags = 0; + c->right->num_submatches = 0; + node->obj = c; + node->type = CATENATION; + return REG_OK; +} + +/* Inserts a catenation node to the root of the tree given in `node'. + As the right child a new tag with number `tag_id' to `node' is added, + and the left child is the old root. */ +static reg_errcode_t +tre_add_tag_right(tre_mem_t mem, tre_ast_node_t *node, int tag_id) +{ + tre_catenation_t *c; + + c = tre_mem_alloc(mem, sizeof(*c)); + if (c == NULL) + return REG_ESPACE; + c->right = tre_ast_new_literal(mem, TAG, tag_id, -1); + if (c->right == NULL) + return REG_ESPACE; + c->left = tre_mem_alloc(mem, sizeof(tre_ast_node_t)); + if (c->left == NULL) + return REG_ESPACE; + + c->left->obj = node->obj; + c->left->type = node->type; + c->left->nullable = -1; + c->left->submatch_id = -1; + c->left->firstpos = NULL; + c->left->lastpos = NULL; + c->left->num_tags = 0; + c->left->num_submatches = 0; + node->obj = c; + node->type = CATENATION; + return REG_OK; +} + +typedef enum { + ADDTAGS_RECURSE, + ADDTAGS_AFTER_ITERATION, + ADDTAGS_AFTER_UNION_LEFT, + ADDTAGS_AFTER_UNION_RIGHT, + ADDTAGS_AFTER_CAT_LEFT, + ADDTAGS_AFTER_CAT_RIGHT, + ADDTAGS_SET_SUBMATCH_END +} tre_addtags_symbol_t; + + +typedef struct { + int tag; + int next_tag; +} tre_tag_states_t; + + +/* Go through `regset' and set submatch data for submatches that are + using this tag. */ +static void +tre_purge_regset(int *regset, tre_tnfa_t *tnfa, int tag) +{ + int i; + + for (i = 0; regset[i] >= 0; i++) + { + int id = regset[i] / 2; + int start = !(regset[i] % 2); + if (start) + tnfa->submatch_data[id].so_tag = tag; + else + tnfa->submatch_data[id].eo_tag = tag; + } + regset[0] = -1; +} + + +/* Adds tags to appropriate locations in the parse tree in `tree', so that + subexpressions marked for submatch addressing can be traced. */ +static reg_errcode_t +tre_add_tags(tre_mem_t mem, tre_stack_t *stack, tre_ast_node_t *tree, + tre_tnfa_t *tnfa) +{ + reg_errcode_t status = REG_OK; + tre_addtags_symbol_t symbol; + tre_ast_node_t *node = tree; /* Tree node we are currently looking at. */ + int bottom = tre_stack_num_objects(stack); + /* True for first pass (counting number of needed tags) */ + int first_pass = (mem == NULL || tnfa == NULL); + int *regset, *orig_regset; + int num_tags = 0; /* Total number of tags. */ + int num_minimals = 0; /* Number of special minimal tags. */ + int tag = 0; /* The tag that is to be added next. */ + int next_tag = 1; /* Next tag to use after this one. */ + int *parents; /* Stack of submatches the current submatch is + contained in. */ + int minimal_tag = -1; /* Tag that marks the beginning of a minimal match. */ + tre_tag_states_t *saved_states; + + tre_tag_direction_t direction = TRE_TAG_MINIMIZE; + if (!first_pass) + { + tnfa->end_tag = 0; + tnfa->minimal_tags[0] = -1; + } + + regset = xmalloc(sizeof(*regset) * ((tnfa->num_submatches + 1) * 2)); + if (regset == NULL) + return REG_ESPACE; + regset[0] = -1; + orig_regset = regset; + + parents = xmalloc(sizeof(*parents) * (tnfa->num_submatches + 1)); + if (parents == NULL) + { + xfree(regset); + return REG_ESPACE; + } + parents[0] = -1; + + saved_states = xmalloc(sizeof(*saved_states) * (tnfa->num_submatches + 1)); + if (saved_states == NULL) + { + xfree(regset); + xfree(parents); + return REG_ESPACE; + } + else + { + unsigned int i; + for (i = 0; i <= tnfa->num_submatches; i++) + saved_states[i].tag = -1; + } + + STACK_PUSH(stack, voidptr, node); + STACK_PUSH(stack, int, ADDTAGS_RECURSE); + + while (tre_stack_num_objects(stack) > bottom) + { + if (status != REG_OK) + break; + + symbol = (tre_addtags_symbol_t)tre_stack_pop_int(stack); + switch (symbol) + { + + case ADDTAGS_SET_SUBMATCH_END: + { + int id = tre_stack_pop_int(stack); + int i; + + /* Add end of this submatch to regset. */ + for (i = 0; regset[i] >= 0; i++); + regset[i] = id * 2 + 1; + regset[i + 1] = -1; + + /* Pop this submatch from the parents stack. */ + for (i = 0; parents[i] >= 0; i++); + parents[i - 1] = -1; + break; + } + + case ADDTAGS_RECURSE: + node = tre_stack_pop_voidptr(stack); + + if (node->submatch_id >= 0) + { + int id = node->submatch_id; + int i; + + + /* Add start of this submatch to regset. */ + for (i = 0; regset[i] >= 0; i++); + regset[i] = id * 2; + regset[i + 1] = -1; + + if (!first_pass) + { + for (i = 0; parents[i] >= 0; i++); + tnfa->submatch_data[id].parents = NULL; + if (i > 0) + { + int *p = xmalloc(sizeof(*p) * (i + 1)); + if (p == NULL) + { + status = REG_ESPACE; + break; + } + assert(tnfa->submatch_data[id].parents == NULL); + tnfa->submatch_data[id].parents = p; + for (i = 0; parents[i] >= 0; i++) + p[i] = parents[i]; + p[i] = -1; + } + } + + /* Add end of this submatch to regset after processing this + node. */ + STACK_PUSHX(stack, int, node->submatch_id); + STACK_PUSHX(stack, int, ADDTAGS_SET_SUBMATCH_END); + } + + switch (node->type) + { + case LITERAL: + { + tre_literal_t *lit = node->obj; + + if (!IS_SPECIAL(lit) || IS_BACKREF(lit)) + { + int i; + if (regset[0] >= 0) + { + /* Regset is not empty, so add a tag before the + literal or backref. */ + if (!first_pass) + { + status = tre_add_tag_left(mem, node, tag); + tnfa->tag_directions[tag] = direction; + if (minimal_tag >= 0) + { + for (i = 0; tnfa->minimal_tags[i] >= 0; i++); + tnfa->minimal_tags[i] = tag; + tnfa->minimal_tags[i + 1] = minimal_tag; + tnfa->minimal_tags[i + 2] = -1; + minimal_tag = -1; + num_minimals++; + } + tre_purge_regset(regset, tnfa, tag); + } + else + { + node->num_tags = 1; + } + + regset[0] = -1; + tag = next_tag; + num_tags++; + next_tag++; + } + } + else + { + assert(!IS_TAG(lit)); + } + break; + } + case CATENATION: + { + tre_catenation_t *cat = node->obj; + tre_ast_node_t *left = cat->left; + tre_ast_node_t *right = cat->right; + int reserved_tag = -1; + + + /* After processing right child. */ + STACK_PUSHX(stack, voidptr, node); + STACK_PUSHX(stack, int, ADDTAGS_AFTER_CAT_RIGHT); + + /* Process right child. */ + STACK_PUSHX(stack, voidptr, right); + STACK_PUSHX(stack, int, ADDTAGS_RECURSE); + + /* After processing left child. */ + STACK_PUSHX(stack, int, next_tag + left->num_tags); + if (left->num_tags > 0 && right->num_tags > 0) + { + /* Reserve the next tag to the right child. */ + reserved_tag = next_tag; + next_tag++; + } + STACK_PUSHX(stack, int, reserved_tag); + STACK_PUSHX(stack, int, ADDTAGS_AFTER_CAT_LEFT); + + /* Process left child. */ + STACK_PUSHX(stack, voidptr, left); + STACK_PUSHX(stack, int, ADDTAGS_RECURSE); + + } + break; + case ITERATION: + { + tre_iteration_t *iter = node->obj; + + if (first_pass) + { + STACK_PUSHX(stack, int, regset[0] >= 0 || iter->minimal); + } + else + { + STACK_PUSHX(stack, int, tag); + STACK_PUSHX(stack, int, iter->minimal); + } + STACK_PUSHX(stack, voidptr, node); + STACK_PUSHX(stack, int, ADDTAGS_AFTER_ITERATION); + + STACK_PUSHX(stack, voidptr, iter->arg); + STACK_PUSHX(stack, int, ADDTAGS_RECURSE); + + /* Regset is not empty, so add a tag here. */ + if (regset[0] >= 0 || iter->minimal) + { + if (!first_pass) + { + int i; + status = tre_add_tag_left(mem, node, tag); + if (iter->minimal) + tnfa->tag_directions[tag] = TRE_TAG_MAXIMIZE; + else + tnfa->tag_directions[tag] = direction; + if (minimal_tag >= 0) + { + for (i = 0; tnfa->minimal_tags[i] >= 0; i++); + tnfa->minimal_tags[i] = tag; + tnfa->minimal_tags[i + 1] = minimal_tag; + tnfa->minimal_tags[i + 2] = -1; + minimal_tag = -1; + num_minimals++; + } + tre_purge_regset(regset, tnfa, tag); + } + + regset[0] = -1; + tag = next_tag; + num_tags++; + next_tag++; + } + direction = TRE_TAG_MINIMIZE; + } + break; + case UNION: + { + tre_union_t *uni = node->obj; + tre_ast_node_t *left = uni->left; + tre_ast_node_t *right = uni->right; + int left_tag; + int right_tag; + + if (regset[0] >= 0) + { + left_tag = next_tag; + right_tag = next_tag + 1; + } + else + { + left_tag = tag; + right_tag = next_tag; + } + + /* After processing right child. */ + STACK_PUSHX(stack, int, right_tag); + STACK_PUSHX(stack, int, left_tag); + STACK_PUSHX(stack, voidptr, regset); + STACK_PUSHX(stack, int, regset[0] >= 0); + STACK_PUSHX(stack, voidptr, node); + STACK_PUSHX(stack, voidptr, right); + STACK_PUSHX(stack, voidptr, left); + STACK_PUSHX(stack, int, ADDTAGS_AFTER_UNION_RIGHT); + + /* Process right child. */ + STACK_PUSHX(stack, voidptr, right); + STACK_PUSHX(stack, int, ADDTAGS_RECURSE); + + /* After processing left child. */ + STACK_PUSHX(stack, int, ADDTAGS_AFTER_UNION_LEFT); + + /* Process left child. */ + STACK_PUSHX(stack, voidptr, left); + STACK_PUSHX(stack, int, ADDTAGS_RECURSE); + + /* Regset is not empty, so add a tag here. */ + if (regset[0] >= 0) + { + if (!first_pass) + { + int i; + status = tre_add_tag_left(mem, node, tag); + tnfa->tag_directions[tag] = direction; + if (minimal_tag >= 0) + { + for (i = 0; tnfa->minimal_tags[i] >= 0; i++); + tnfa->minimal_tags[i] = tag; + tnfa->minimal_tags[i + 1] = minimal_tag; + tnfa->minimal_tags[i + 2] = -1; + minimal_tag = -1; + num_minimals++; + } + tre_purge_regset(regset, tnfa, tag); + } + + regset[0] = -1; + tag = next_tag; + num_tags++; + next_tag++; + } + + if (node->num_submatches > 0) + { + /* The next two tags are reserved for markers. */ + next_tag++; + tag = next_tag; + next_tag++; + } + + break; + } + } + + if (node->submatch_id >= 0) + { + int i; + /* Push this submatch on the parents stack. */ + for (i = 0; parents[i] >= 0; i++); + parents[i] = node->submatch_id; + parents[i + 1] = -1; + } + + break; /* end case: ADDTAGS_RECURSE */ + + case ADDTAGS_AFTER_ITERATION: + { + int minimal = 0; + int enter_tag; + node = tre_stack_pop_voidptr(stack); + if (first_pass) + { + node->num_tags = ((tre_iteration_t *)node->obj)->arg->num_tags + + tre_stack_pop_int(stack); + minimal_tag = -1; + } + else + { + minimal = tre_stack_pop_int(stack); + enter_tag = tre_stack_pop_int(stack); + if (minimal) + minimal_tag = enter_tag; + } + + if (!first_pass) + { + if (minimal) + direction = TRE_TAG_MINIMIZE; + else + direction = TRE_TAG_MAXIMIZE; + } + break; + } + + case ADDTAGS_AFTER_CAT_LEFT: + { + int new_tag = tre_stack_pop_int(stack); + next_tag = tre_stack_pop_int(stack); + if (new_tag >= 0) + { + tag = new_tag; + } + break; + } + + case ADDTAGS_AFTER_CAT_RIGHT: + node = tre_stack_pop_voidptr(stack); + if (first_pass) + node->num_tags = ((tre_catenation_t *)node->obj)->left->num_tags + + ((tre_catenation_t *)node->obj)->right->num_tags; + break; + + case ADDTAGS_AFTER_UNION_LEFT: + /* Lift the bottom of the `regset' array so that when processing + the right operand the items currently in the array are + invisible. The original bottom was saved at ADDTAGS_UNION and + will be restored at ADDTAGS_AFTER_UNION_RIGHT below. */ + while (*regset >= 0) + regset++; + break; + + case ADDTAGS_AFTER_UNION_RIGHT: + { + int added_tags, tag_left, tag_right; + tre_ast_node_t *left = tre_stack_pop_voidptr(stack); + tre_ast_node_t *right = tre_stack_pop_voidptr(stack); + node = tre_stack_pop_voidptr(stack); + added_tags = tre_stack_pop_int(stack); + if (first_pass) + { + node->num_tags = ((tre_union_t *)node->obj)->left->num_tags + + ((tre_union_t *)node->obj)->right->num_tags + added_tags + + ((node->num_submatches > 0) ? 2 : 0); + } + regset = tre_stack_pop_voidptr(stack); + tag_left = tre_stack_pop_int(stack); + tag_right = tre_stack_pop_int(stack); + + /* Add tags after both children, the left child gets a smaller + tag than the right child. This guarantees that we prefer + the left child over the right child. */ + /* XXX - This is not always necessary (if the children have + tags which must be seen for every match of that child). */ + /* XXX - Check if this is the only place where tre_add_tag_right + is used. If so, use tre_add_tag_left (putting the tag before + the child as opposed after the child) and throw away + tre_add_tag_right. */ + if (node->num_submatches > 0) + { + if (!first_pass) + { + status = tre_add_tag_right(mem, left, tag_left); + tnfa->tag_directions[tag_left] = TRE_TAG_MAXIMIZE; + if (status == REG_OK) + status = tre_add_tag_right(mem, right, tag_right); + tnfa->tag_directions[tag_right] = TRE_TAG_MAXIMIZE; + } + num_tags += 2; + } + direction = TRE_TAG_MAXIMIZE; + break; + } + + default: + assert(0); + break; + + } /* end switch(symbol) */ + } /* end while(tre_stack_num_objects(stack) > bottom) */ + + if (!first_pass) + tre_purge_regset(regset, tnfa, tag); + + if (!first_pass && minimal_tag >= 0) + { + int i; + for (i = 0; tnfa->minimal_tags[i] >= 0; i++); + tnfa->minimal_tags[i] = tag; + tnfa->minimal_tags[i + 1] = minimal_tag; + tnfa->minimal_tags[i + 2] = -1; + minimal_tag = -1; + num_minimals++; + } + + assert(tree->num_tags == num_tags); + tnfa->end_tag = num_tags; + tnfa->num_tags = num_tags; + tnfa->num_minimals = num_minimals; + xfree(orig_regset); + xfree(parents); + xfree(saved_states); + return status; +} + + + +/* + AST to TNFA compilation routines. +*/ + +typedef enum { + COPY_RECURSE, + COPY_SET_RESULT_PTR +} tre_copyast_symbol_t; + +/* Flags for tre_copy_ast(). */ +#define COPY_REMOVE_TAGS 1 +#define COPY_MAXIMIZE_FIRST_TAG 2 + +static reg_errcode_t +tre_copy_ast(tre_mem_t mem, tre_stack_t *stack, tre_ast_node_t *ast, + int flags, int *pos_add, tre_tag_direction_t *tag_directions, + tre_ast_node_t **copy, int *max_pos) +{ + reg_errcode_t status = REG_OK; + int bottom = tre_stack_num_objects(stack); + int num_copied = 0; + int first_tag = 1; + tre_ast_node_t **result = copy; + tre_copyast_symbol_t symbol; + + STACK_PUSH(stack, voidptr, ast); + STACK_PUSH(stack, int, COPY_RECURSE); + + while (status == REG_OK && tre_stack_num_objects(stack) > bottom) + { + tre_ast_node_t *node; + if (status != REG_OK) + break; + + symbol = (tre_copyast_symbol_t)tre_stack_pop_int(stack); + switch (symbol) + { + case COPY_SET_RESULT_PTR: + result = tre_stack_pop_voidptr(stack); + break; + case COPY_RECURSE: + node = tre_stack_pop_voidptr(stack); + switch (node->type) + { + case LITERAL: + { + tre_literal_t *lit = node->obj; + int pos = lit->position; + int min = lit->code_min; + int max = lit->code_max; + if (!IS_SPECIAL(lit) || IS_BACKREF(lit)) + { + /* XXX - e.g. [ab] has only one position but two + nodes, so we are creating holes in the state space + here. Not fatal, just wastes memory. */ + pos += *pos_add; + num_copied++; + } + else if (IS_TAG(lit) && (flags & COPY_REMOVE_TAGS)) + { + /* Change this tag to empty. */ + min = EMPTY; + max = pos = -1; + } + else if (IS_TAG(lit) && (flags & COPY_MAXIMIZE_FIRST_TAG) + && first_tag) + { + /* Maximize the first tag. */ + tag_directions[max] = TRE_TAG_MAXIMIZE; + first_tag = 0; + } + *result = tre_ast_new_literal(mem, min, max, pos); + if (*result == NULL) + status = REG_ESPACE; + else { + tre_literal_t *p = (*result)->obj; + p->class = lit->class; + p->neg_classes = lit->neg_classes; + } + + if (pos > *max_pos) + *max_pos = pos; + break; + } + case UNION: + { + tre_union_t *uni = node->obj; + tre_union_t *tmp; + *result = tre_ast_new_union(mem, uni->left, uni->right); + if (*result == NULL) + { + status = REG_ESPACE; + break; + } + tmp = (*result)->obj; + result = &tmp->left; + STACK_PUSHX(stack, voidptr, uni->right); + STACK_PUSHX(stack, int, COPY_RECURSE); + STACK_PUSHX(stack, voidptr, &tmp->right); + STACK_PUSHX(stack, int, COPY_SET_RESULT_PTR); + STACK_PUSHX(stack, voidptr, uni->left); + STACK_PUSHX(stack, int, COPY_RECURSE); + break; + } + case CATENATION: + { + tre_catenation_t *cat = node->obj; + tre_catenation_t *tmp; + *result = tre_ast_new_catenation(mem, cat->left, cat->right); + if (*result == NULL) + { + status = REG_ESPACE; + break; + } + tmp = (*result)->obj; + tmp->left = NULL; + tmp->right = NULL; + result = &tmp->left; + + STACK_PUSHX(stack, voidptr, cat->right); + STACK_PUSHX(stack, int, COPY_RECURSE); + STACK_PUSHX(stack, voidptr, &tmp->right); + STACK_PUSHX(stack, int, COPY_SET_RESULT_PTR); + STACK_PUSHX(stack, voidptr, cat->left); + STACK_PUSHX(stack, int, COPY_RECURSE); + break; + } + case ITERATION: + { + tre_iteration_t *iter = node->obj; + STACK_PUSHX(stack, voidptr, iter->arg); + STACK_PUSHX(stack, int, COPY_RECURSE); + *result = tre_ast_new_iter(mem, iter->arg, iter->min, + iter->max, iter->minimal); + if (*result == NULL) + { + status = REG_ESPACE; + break; + } + iter = (*result)->obj; + result = &iter->arg; + break; + } + default: + assert(0); + break; + } + break; + } + } + *pos_add += num_copied; + return status; +} + +typedef enum { + EXPAND_RECURSE, + EXPAND_AFTER_ITER +} tre_expand_ast_symbol_t; + +/* Expands each iteration node that has a finite nonzero minimum or maximum + iteration count to a catenated sequence of copies of the node. */ +static reg_errcode_t +tre_expand_ast(tre_mem_t mem, tre_stack_t *stack, tre_ast_node_t *ast, + int *position, tre_tag_direction_t *tag_directions) +{ + reg_errcode_t status = REG_OK; + int bottom = tre_stack_num_objects(stack); + int pos_add = 0; + int pos_add_total = 0; + int max_pos = 0; + int iter_depth = 0; + + STACK_PUSHR(stack, voidptr, ast); + STACK_PUSHR(stack, int, EXPAND_RECURSE); + while (status == REG_OK && tre_stack_num_objects(stack) > bottom) + { + tre_ast_node_t *node; + tre_expand_ast_symbol_t symbol; + + if (status != REG_OK) + break; + + symbol = (tre_expand_ast_symbol_t)tre_stack_pop_int(stack); + node = tre_stack_pop_voidptr(stack); + switch (symbol) + { + case EXPAND_RECURSE: + switch (node->type) + { + case LITERAL: + { + tre_literal_t *lit= node->obj; + if (!IS_SPECIAL(lit) || IS_BACKREF(lit)) + { + lit->position += pos_add; + if (lit->position > max_pos) + max_pos = lit->position; + } + break; + } + case UNION: + { + tre_union_t *uni = node->obj; + STACK_PUSHX(stack, voidptr, uni->right); + STACK_PUSHX(stack, int, EXPAND_RECURSE); + STACK_PUSHX(stack, voidptr, uni->left); + STACK_PUSHX(stack, int, EXPAND_RECURSE); + break; + } + case CATENATION: + { + tre_catenation_t *cat = node->obj; + STACK_PUSHX(stack, voidptr, cat->right); + STACK_PUSHX(stack, int, EXPAND_RECURSE); + STACK_PUSHX(stack, voidptr, cat->left); + STACK_PUSHX(stack, int, EXPAND_RECURSE); + break; + } + case ITERATION: + { + tre_iteration_t *iter = node->obj; + STACK_PUSHX(stack, int, pos_add); + STACK_PUSHX(stack, voidptr, node); + STACK_PUSHX(stack, int, EXPAND_AFTER_ITER); + STACK_PUSHX(stack, voidptr, iter->arg); + STACK_PUSHX(stack, int, EXPAND_RECURSE); + /* If we are going to expand this node at EXPAND_AFTER_ITER + then don't increase the `pos' fields of the nodes now, it + will get done when expanding. */ + if (iter->min > 1 || iter->max > 1) + pos_add = 0; + iter_depth++; + break; + } + default: + assert(0); + break; + } + break; + case EXPAND_AFTER_ITER: + { + tre_iteration_t *iter = node->obj; + int pos_add_last; + pos_add = tre_stack_pop_int(stack); + pos_add_last = pos_add; + if (iter->min > 1 || iter->max > 1) + { + tre_ast_node_t *seq1 = NULL, *seq2 = NULL; + int j; + int pos_add_save = pos_add; + + /* Create a catenated sequence of copies of the node. */ + for (j = 0; j < iter->min; j++) + { + tre_ast_node_t *copy; + /* Remove tags from all but the last copy. */ + int flags = ((j + 1 < iter->min) + ? COPY_REMOVE_TAGS + : COPY_MAXIMIZE_FIRST_TAG); + pos_add_save = pos_add; + status = tre_copy_ast(mem, stack, iter->arg, flags, + &pos_add, tag_directions, ©, + &max_pos); + if (status != REG_OK) + return status; + if (seq1 != NULL) + seq1 = tre_ast_new_catenation(mem, seq1, copy); + else + seq1 = copy; + if (seq1 == NULL) + return REG_ESPACE; + } + + if (iter->max == -1) + { + /* No upper limit. */ + pos_add_save = pos_add; + status = tre_copy_ast(mem, stack, iter->arg, 0, + &pos_add, NULL, &seq2, &max_pos); + if (status != REG_OK) + return status; + seq2 = tre_ast_new_iter(mem, seq2, 0, -1, 0); + if (seq2 == NULL) + return REG_ESPACE; + } + else + { + for (j = iter->min; j < iter->max; j++) + { + tre_ast_node_t *tmp, *copy; + pos_add_save = pos_add; + status = tre_copy_ast(mem, stack, iter->arg, 0, + &pos_add, NULL, ©, &max_pos); + if (status != REG_OK) + return status; + if (seq2 != NULL) + seq2 = tre_ast_new_catenation(mem, copy, seq2); + else + seq2 = copy; + if (seq2 == NULL) + return REG_ESPACE; + tmp = tre_ast_new_literal(mem, EMPTY, -1, -1); + if (tmp == NULL) + return REG_ESPACE; + seq2 = tre_ast_new_union(mem, tmp, seq2); + if (seq2 == NULL) + return REG_ESPACE; + } + } + + pos_add = pos_add_save; + if (seq1 == NULL) + seq1 = seq2; + else if (seq2 != NULL) + seq1 = tre_ast_new_catenation(mem, seq1, seq2); + if (seq1 == NULL) + return REG_ESPACE; + node->obj = seq1->obj; + node->type = seq1->type; + } + + iter_depth--; + pos_add_total += pos_add - pos_add_last; + if (iter_depth == 0) + pos_add = pos_add_total; + + break; + } + default: + assert(0); + break; + } + } + + *position += pos_add_total; + + /* `max_pos' should never be larger than `*position' if the above + code works, but just an extra safeguard let's make sure + `*position' is set large enough so enough memory will be + allocated for the transition table. */ + if (max_pos > *position) + *position = max_pos; + + return status; +} + +static tre_pos_and_tags_t * +tre_set_empty(tre_mem_t mem) +{ + tre_pos_and_tags_t *new_set; + + new_set = tre_mem_calloc(mem, sizeof(*new_set)); + if (new_set == NULL) + return NULL; + + new_set[0].position = -1; + new_set[0].code_min = -1; + new_set[0].code_max = -1; + + return new_set; +} + +static tre_pos_and_tags_t * +tre_set_one(tre_mem_t mem, int position, int code_min, int code_max, + tre_ctype_t class, tre_ctype_t *neg_classes, int backref) +{ + tre_pos_and_tags_t *new_set; + + new_set = tre_mem_calloc(mem, sizeof(*new_set) * 2); + if (new_set == NULL) + return NULL; + + new_set[0].position = position; + new_set[0].code_min = code_min; + new_set[0].code_max = code_max; + new_set[0].class = class; + new_set[0].neg_classes = neg_classes; + new_set[0].backref = backref; + new_set[1].position = -1; + new_set[1].code_min = -1; + new_set[1].code_max = -1; + + return new_set; +} + +static tre_pos_and_tags_t * +tre_set_union(tre_mem_t mem, tre_pos_and_tags_t *set1, tre_pos_and_tags_t *set2, + int *tags, int assertions) +{ + int s1, s2, i, j; + tre_pos_and_tags_t *new_set; + int *new_tags; + int num_tags; + + for (num_tags = 0; tags != NULL && tags[num_tags] >= 0; num_tags++); + for (s1 = 0; set1[s1].position >= 0; s1++); + for (s2 = 0; set2[s2].position >= 0; s2++); + new_set = tre_mem_calloc(mem, sizeof(*new_set) * (s1 + s2 + 1)); + if (!new_set ) + return NULL; + + for (s1 = 0; set1[s1].position >= 0; s1++) + { + new_set[s1].position = set1[s1].position; + new_set[s1].code_min = set1[s1].code_min; + new_set[s1].code_max = set1[s1].code_max; + new_set[s1].assertions = set1[s1].assertions | assertions; + new_set[s1].class = set1[s1].class; + new_set[s1].neg_classes = set1[s1].neg_classes; + new_set[s1].backref = set1[s1].backref; + if (set1[s1].tags == NULL && tags == NULL) + new_set[s1].tags = NULL; + else + { + for (i = 0; set1[s1].tags != NULL && set1[s1].tags[i] >= 0; i++); + new_tags = tre_mem_alloc(mem, (sizeof(*new_tags) + * (i + num_tags + 1))); + if (new_tags == NULL) + return NULL; + for (j = 0; j < i; j++) + new_tags[j] = set1[s1].tags[j]; + for (i = 0; i < num_tags; i++) + new_tags[j + i] = tags[i]; + new_tags[j + i] = -1; + new_set[s1].tags = new_tags; + } + } + + for (s2 = 0; set2[s2].position >= 0; s2++) + { + new_set[s1 + s2].position = set2[s2].position; + new_set[s1 + s2].code_min = set2[s2].code_min; + new_set[s1 + s2].code_max = set2[s2].code_max; + /* XXX - why not | assertions here as well? */ + new_set[s1 + s2].assertions = set2[s2].assertions; + new_set[s1 + s2].class = set2[s2].class; + new_set[s1 + s2].neg_classes = set2[s2].neg_classes; + new_set[s1 + s2].backref = set2[s2].backref; + if (set2[s2].tags == NULL) + new_set[s1 + s2].tags = NULL; + else + { + for (i = 0; set2[s2].tags[i] >= 0; i++); + new_tags = tre_mem_alloc(mem, sizeof(*new_tags) * (i + 1)); + if (new_tags == NULL) + return NULL; + for (j = 0; j < i; j++) + new_tags[j] = set2[s2].tags[j]; + new_tags[j] = -1; + new_set[s1 + s2].tags = new_tags; + } + } + new_set[s1 + s2].position = -1; + return new_set; +} + +/* Finds the empty path through `node' which is the one that should be + taken according to POSIX.2 rules, and adds the tags on that path to + `tags'. `tags' may be NULL. If `num_tags_seen' is not NULL, it is + set to the number of tags seen on the path. */ +static reg_errcode_t +tre_match_empty(tre_stack_t *stack, tre_ast_node_t *node, int *tags, + int *assertions, int *num_tags_seen) +{ + tre_literal_t *lit; + tre_union_t *uni; + tre_catenation_t *cat; + tre_iteration_t *iter; + int i; + int bottom = tre_stack_num_objects(stack); + reg_errcode_t status = REG_OK; + if (num_tags_seen) + *num_tags_seen = 0; + + status = tre_stack_push_voidptr(stack, node); + + /* Walk through the tree recursively. */ + while (status == REG_OK && tre_stack_num_objects(stack) > bottom) + { + node = tre_stack_pop_voidptr(stack); + + switch (node->type) + { + case LITERAL: + lit = (tre_literal_t *)node->obj; + switch (lit->code_min) + { + case TAG: + if (lit->code_max >= 0) + { + if (tags != NULL) + { + /* Add the tag to `tags'. */ + for (i = 0; tags[i] >= 0; i++) + if (tags[i] == lit->code_max) + break; + if (tags[i] < 0) + { + tags[i] = lit->code_max; + tags[i + 1] = -1; + } + } + if (num_tags_seen) + (*num_tags_seen)++; + } + break; + case ASSERTION: + assert(lit->code_max >= 1 + || lit->code_max <= ASSERT_LAST); + if (assertions != NULL) + *assertions |= lit->code_max; + break; + case EMPTY: + break; + default: + assert(0); + break; + } + break; + + case UNION: + /* Subexpressions starting earlier take priority over ones + starting later, so we prefer the left subexpression over the + right subexpression. */ + uni = (tre_union_t *)node->obj; + if (uni->left->nullable) + STACK_PUSHX(stack, voidptr, uni->left) + else if (uni->right->nullable) + STACK_PUSHX(stack, voidptr, uni->right) + else + assert(0); + break; + + case CATENATION: + /* The path must go through both children. */ + cat = (tre_catenation_t *)node->obj; + assert(cat->left->nullable); + assert(cat->right->nullable); + STACK_PUSHX(stack, voidptr, cat->left); + STACK_PUSHX(stack, voidptr, cat->right); + break; + + case ITERATION: + /* A match with an empty string is preferred over no match at + all, so we go through the argument if possible. */ + iter = (tre_iteration_t *)node->obj; + if (iter->arg->nullable) + STACK_PUSHX(stack, voidptr, iter->arg); + break; + + default: + assert(0); + break; + } + } + + return status; +} + + +typedef enum { + NFL_RECURSE, + NFL_POST_UNION, + NFL_POST_CATENATION, + NFL_POST_ITERATION +} tre_nfl_stack_symbol_t; + + +/* Computes and fills in the fields `nullable', `firstpos', and `lastpos' for + the nodes of the AST `tree'. */ +static reg_errcode_t +tre_compute_nfl(tre_mem_t mem, tre_stack_t *stack, tre_ast_node_t *tree) +{ + int bottom = tre_stack_num_objects(stack); + + STACK_PUSHR(stack, voidptr, tree); + STACK_PUSHR(stack, int, NFL_RECURSE); + + while (tre_stack_num_objects(stack) > bottom) + { + tre_nfl_stack_symbol_t symbol; + tre_ast_node_t *node; + + symbol = (tre_nfl_stack_symbol_t)tre_stack_pop_int(stack); + node = tre_stack_pop_voidptr(stack); + switch (symbol) + { + case NFL_RECURSE: + switch (node->type) + { + case LITERAL: + { + tre_literal_t *lit = (tre_literal_t *)node->obj; + if (IS_BACKREF(lit)) + { + /* Back references: nullable = false, firstpos = {i}, + lastpos = {i}. */ + node->nullable = 0; + node->firstpos = tre_set_one(mem, lit->position, 0, + TRE_CHAR_MAX, 0, NULL, -1); + if (!node->firstpos) + return REG_ESPACE; + node->lastpos = tre_set_one(mem, lit->position, 0, + TRE_CHAR_MAX, 0, NULL, + (int)lit->code_max); + if (!node->lastpos) + return REG_ESPACE; + } + else if (lit->code_min < 0) + { + /* Tags, empty strings, params, and zero width assertions: + nullable = true, firstpos = {}, and lastpos = {}. */ + node->nullable = 1; + node->firstpos = tre_set_empty(mem); + if (!node->firstpos) + return REG_ESPACE; + node->lastpos = tre_set_empty(mem); + if (!node->lastpos) + return REG_ESPACE; + } + else + { + /* Literal at position i: nullable = false, firstpos = {i}, + lastpos = {i}. */ + node->nullable = 0; + node->firstpos = + tre_set_one(mem, lit->position, (int)lit->code_min, + (int)lit->code_max, 0, NULL, -1); + if (!node->firstpos) + return REG_ESPACE; + node->lastpos = tre_set_one(mem, lit->position, + (int)lit->code_min, + (int)lit->code_max, + lit->class, lit->neg_classes, + -1); + if (!node->lastpos) + return REG_ESPACE; + } + break; + } + + case UNION: + /* Compute the attributes for the two subtrees, and after that + for this node. */ + STACK_PUSHR(stack, voidptr, node); + STACK_PUSHR(stack, int, NFL_POST_UNION); + STACK_PUSHR(stack, voidptr, ((tre_union_t *)node->obj)->right); + STACK_PUSHR(stack, int, NFL_RECURSE); + STACK_PUSHR(stack, voidptr, ((tre_union_t *)node->obj)->left); + STACK_PUSHR(stack, int, NFL_RECURSE); + break; + + case CATENATION: + /* Compute the attributes for the two subtrees, and after that + for this node. */ + STACK_PUSHR(stack, voidptr, node); + STACK_PUSHR(stack, int, NFL_POST_CATENATION); + STACK_PUSHR(stack, voidptr, ((tre_catenation_t *)node->obj)->right); + STACK_PUSHR(stack, int, NFL_RECURSE); + STACK_PUSHR(stack, voidptr, ((tre_catenation_t *)node->obj)->left); + STACK_PUSHR(stack, int, NFL_RECURSE); + break; + + case ITERATION: + /* Compute the attributes for the subtree, and after that for + this node. */ + STACK_PUSHR(stack, voidptr, node); + STACK_PUSHR(stack, int, NFL_POST_ITERATION); + STACK_PUSHR(stack, voidptr, ((tre_iteration_t *)node->obj)->arg); + STACK_PUSHR(stack, int, NFL_RECURSE); + break; + } + break; /* end case: NFL_RECURSE */ + + case NFL_POST_UNION: + { + tre_union_t *uni = (tre_union_t *)node->obj; + node->nullable = uni->left->nullable || uni->right->nullable; + node->firstpos = tre_set_union(mem, uni->left->firstpos, + uni->right->firstpos, NULL, 0); + if (!node->firstpos) + return REG_ESPACE; + node->lastpos = tre_set_union(mem, uni->left->lastpos, + uni->right->lastpos, NULL, 0); + if (!node->lastpos) + return REG_ESPACE; + break; + } + + case NFL_POST_ITERATION: + { + tre_iteration_t *iter = (tre_iteration_t *)node->obj; + + if (iter->min == 0 || iter->arg->nullable) + node->nullable = 1; + else + node->nullable = 0; + node->firstpos = iter->arg->firstpos; + node->lastpos = iter->arg->lastpos; + break; + } + + case NFL_POST_CATENATION: + { + int num_tags, *tags, assertions; + reg_errcode_t status; + tre_catenation_t *cat = node->obj; + node->nullable = cat->left->nullable && cat->right->nullable; + + /* Compute firstpos. */ + if (cat->left->nullable) + { + /* The left side matches the empty string. Make a first pass + with tre_match_empty() to get the number of tags and + parameters. */ + status = tre_match_empty(stack, cat->left, + NULL, NULL, &num_tags); + if (status != REG_OK) + return status; + /* Allocate arrays for the tags and parameters. */ + tags = xmalloc(sizeof(*tags) * (num_tags + 1)); + if (!tags) + return REG_ESPACE; + tags[0] = -1; + assertions = 0; + /* Second pass with tre_mach_empty() to get the list of + tags and parameters. */ + status = tre_match_empty(stack, cat->left, tags, + &assertions, NULL); + if (status != REG_OK) + { + xfree(tags); + return status; + } + node->firstpos = + tre_set_union(mem, cat->right->firstpos, cat->left->firstpos, + tags, assertions); + xfree(tags); + if (!node->firstpos) + return REG_ESPACE; + } + else + { + node->firstpos = cat->left->firstpos; + } + + /* Compute lastpos. */ + if (cat->right->nullable) + { + /* The right side matches the empty string. Make a first pass + with tre_match_empty() to get the number of tags and + parameters. */ + status = tre_match_empty(stack, cat->right, + NULL, NULL, &num_tags); + if (status != REG_OK) + return status; + /* Allocate arrays for the tags and parameters. */ + tags = xmalloc(sizeof(int) * (num_tags + 1)); + if (!tags) + return REG_ESPACE; + tags[0] = -1; + assertions = 0; + /* Second pass with tre_mach_empty() to get the list of + tags and parameters. */ + status = tre_match_empty(stack, cat->right, tags, + &assertions, NULL); + if (status != REG_OK) + { + xfree(tags); + return status; + } + node->lastpos = + tre_set_union(mem, cat->left->lastpos, cat->right->lastpos, + tags, assertions); + xfree(tags); + if (!node->lastpos) + return REG_ESPACE; + } + else + { + node->lastpos = cat->right->lastpos; + } + break; + } + + default: + assert(0); + break; + } + } + + return REG_OK; +} + + +/* Adds a transition from each position in `p1' to each position in `p2'. */ +static reg_errcode_t +tre_make_trans(tre_pos_and_tags_t *p1, tre_pos_and_tags_t *p2, + tre_tnfa_transition_t *transitions, + int *counts, int *offs) +{ + tre_pos_and_tags_t *orig_p2 = p2; + tre_tnfa_transition_t *trans; + int i, j, k, l, dup, prev_p2_pos; + + if (transitions != NULL) + while (p1->position >= 0) + { + p2 = orig_p2; + prev_p2_pos = -1; + while (p2->position >= 0) + { + /* Optimization: if this position was already handled, skip it. */ + if (p2->position == prev_p2_pos) + { + p2++; + continue; + } + prev_p2_pos = p2->position; + /* Set `trans' to point to the next unused transition from + position `p1->position'. */ + trans = transitions + offs[p1->position]; + while (trans->state != NULL) + { +#if 0 + /* If we find a previous transition from `p1->position' to + `p2->position', it is overwritten. This can happen only + if there are nested loops in the regexp, like in "((a)*)*". + In POSIX.2 repetition using the outer loop is always + preferred over using the inner loop. Therefore the + transition for the inner loop is useless and can be thrown + away. */ + /* XXX - The same position is used for all nodes in a bracket + expression, so this optimization cannot be used (it will + break bracket expressions) unless I figure out a way to + detect it here. */ + if (trans->state_id == p2->position) + { + break; + } +#endif + trans++; + } + + if (trans->state == NULL) + (trans + 1)->state = NULL; + /* Use the character ranges, assertions, etc. from `p1' for + the transition from `p1' to `p2'. */ + trans->code_min = p1->code_min; + trans->code_max = p1->code_max; + trans->state = transitions + offs[p2->position]; + trans->state_id = p2->position; + trans->assertions = p1->assertions | p2->assertions + | (p1->class ? ASSERT_CHAR_CLASS : 0) + | (p1->neg_classes != NULL ? ASSERT_CHAR_CLASS_NEG : 0); + if (p1->backref >= 0) + { + assert((trans->assertions & ASSERT_CHAR_CLASS) == 0); + assert(p2->backref < 0); + trans->u.backref = p1->backref; + trans->assertions |= ASSERT_BACKREF; + } + else + trans->u.class = p1->class; + if (p1->neg_classes != NULL) + { + for (i = 0; p1->neg_classes[i] != (tre_ctype_t)0; i++); + trans->neg_classes = + xmalloc(sizeof(*trans->neg_classes) * (i + 1)); + if (trans->neg_classes == NULL) + return REG_ESPACE; + for (i = 0; p1->neg_classes[i] != (tre_ctype_t)0; i++) + trans->neg_classes[i] = p1->neg_classes[i]; + trans->neg_classes[i] = (tre_ctype_t)0; + } + else + trans->neg_classes = NULL; + + /* Find out how many tags this transition has. */ + i = 0; + if (p1->tags != NULL) + while(p1->tags[i] >= 0) + i++; + j = 0; + if (p2->tags != NULL) + while(p2->tags[j] >= 0) + j++; + + /* If we are overwriting a transition, free the old tag array. */ + if (trans->tags != NULL) + xfree(trans->tags); + trans->tags = NULL; + + /* If there were any tags, allocate an array and fill it. */ + if (i + j > 0) + { + trans->tags = xmalloc(sizeof(*trans->tags) * (i + j + 1)); + if (!trans->tags) + return REG_ESPACE; + i = 0; + if (p1->tags != NULL) + while(p1->tags[i] >= 0) + { + trans->tags[i] = p1->tags[i]; + i++; + } + l = i; + j = 0; + if (p2->tags != NULL) + while (p2->tags[j] >= 0) + { + /* Don't add duplicates. */ + dup = 0; + for (k = 0; k < i; k++) + if (trans->tags[k] == p2->tags[j]) + { + dup = 1; + break; + } + if (!dup) + trans->tags[l++] = p2->tags[j]; + j++; + } + trans->tags[l] = -1; + } + + p2++; + } + p1++; + } + else + /* Compute a maximum limit for the number of transitions leaving + from each state. */ + while (p1->position >= 0) + { + p2 = orig_p2; + while (p2->position >= 0) + { + counts[p1->position]++; + p2++; + } + p1++; + } + return REG_OK; +} + +/* Converts the syntax tree to a TNFA. All the transitions in the TNFA are + labelled with one character range (there are no transitions on empty + strings). The TNFA takes O(n^2) space in the worst case, `n' is size of + the regexp. */ +static reg_errcode_t +tre_ast_to_tnfa(tre_ast_node_t *node, tre_tnfa_transition_t *transitions, + int *counts, int *offs) +{ + tre_union_t *uni; + tre_catenation_t *cat; + tre_iteration_t *iter; + reg_errcode_t errcode = REG_OK; + + /* XXX - recurse using a stack!. */ + switch (node->type) + { + case LITERAL: + break; + case UNION: + uni = (tre_union_t *)node->obj; + errcode = tre_ast_to_tnfa(uni->left, transitions, counts, offs); + if (errcode != REG_OK) + return errcode; + errcode = tre_ast_to_tnfa(uni->right, transitions, counts, offs); + break; + + case CATENATION: + cat = (tre_catenation_t *)node->obj; + /* Add a transition from each position in cat->left->lastpos + to each position in cat->right->firstpos. */ + errcode = tre_make_trans(cat->left->lastpos, cat->right->firstpos, + transitions, counts, offs); + if (errcode != REG_OK) + return errcode; + errcode = tre_ast_to_tnfa(cat->left, transitions, counts, offs); + if (errcode != REG_OK) + return errcode; + errcode = tre_ast_to_tnfa(cat->right, transitions, counts, offs); + break; + + case ITERATION: + iter = (tre_iteration_t *)node->obj; + assert(iter->max == -1 || iter->max == 1); + + if (iter->max == -1) + { + assert(iter->min == 0 || iter->min == 1); + /* Add a transition from each last position in the iterated + expression to each first position. */ + errcode = tre_make_trans(iter->arg->lastpos, iter->arg->firstpos, + transitions, counts, offs); + if (errcode != REG_OK) + return errcode; + } + errcode = tre_ast_to_tnfa(iter->arg, transitions, counts, offs); + break; + } + return errcode; +} + + +#define ERROR_EXIT(err) \ + do \ + { \ + errcode = err; \ + if (/*CONSTCOND*/1) \ + goto error_exit; \ + } \ + while (/*CONSTCOND*/0) + + +int +regcomp(regex_t *restrict preg, const char *restrict regex, int cflags) +{ + tre_stack_t *stack; + tre_ast_node_t *tree, *tmp_ast_l, *tmp_ast_r; + tre_pos_and_tags_t *p; + int *counts = NULL, *offs = NULL; + int i, add = 0; + tre_tnfa_transition_t *transitions, *initial; + tre_tnfa_t *tnfa = NULL; + tre_submatch_data_t *submatch_data; + tre_tag_direction_t *tag_directions = NULL; + reg_errcode_t errcode; + tre_mem_t mem; + + /* Parse context. */ + tre_parse_ctx_t parse_ctx; + + /* Allocate a stack used throughout the compilation process for various + purposes. */ + stack = tre_stack_new(512, 1024000, 128); + if (!stack) + return REG_ESPACE; + /* Allocate a fast memory allocator. */ + mem = tre_mem_new(); + if (!mem) + { + tre_stack_destroy(stack); + return REG_ESPACE; + } + + /* Parse the regexp. */ + memset(&parse_ctx, 0, sizeof(parse_ctx)); + parse_ctx.mem = mem; + parse_ctx.stack = stack; + parse_ctx.start = regex; + parse_ctx.cflags = cflags; + parse_ctx.max_backref = -1; + errcode = tre_parse(&parse_ctx); + if (errcode != REG_OK) + ERROR_EXIT(errcode); + preg->re_nsub = parse_ctx.submatch_id - 1; + tree = parse_ctx.n; + +#ifdef TRE_DEBUG + tre_ast_print(tree); +#endif /* TRE_DEBUG */ + + /* Referring to nonexistent subexpressions is illegal. */ + if (parse_ctx.max_backref > (int)preg->re_nsub) + ERROR_EXIT(REG_ESUBREG); + + /* Allocate the TNFA struct. */ + tnfa = xcalloc(1, sizeof(tre_tnfa_t)); + if (tnfa == NULL) + ERROR_EXIT(REG_ESPACE); + tnfa->have_backrefs = parse_ctx.max_backref >= 0; + tnfa->have_approx = 0; + tnfa->num_submatches = parse_ctx.submatch_id; + + /* Set up tags for submatch addressing. If REG_NOSUB is set and the + regexp does not have back references, this can be skipped. */ + if (tnfa->have_backrefs || !(cflags & REG_NOSUB)) + { + + /* Figure out how many tags we will need. */ + errcode = tre_add_tags(NULL, stack, tree, tnfa); + if (errcode != REG_OK) + ERROR_EXIT(errcode); + + if (tnfa->num_tags > 0) + { + tag_directions = xmalloc(sizeof(*tag_directions) + * (tnfa->num_tags + 1)); + if (tag_directions == NULL) + ERROR_EXIT(REG_ESPACE); + tnfa->tag_directions = tag_directions; + memset(tag_directions, -1, + sizeof(*tag_directions) * (tnfa->num_tags + 1)); + } + tnfa->minimal_tags = xcalloc((unsigned)tnfa->num_tags * 2 + 1, + sizeof(*tnfa->minimal_tags)); + if (tnfa->minimal_tags == NULL) + ERROR_EXIT(REG_ESPACE); + + submatch_data = xcalloc((unsigned)parse_ctx.submatch_id, + sizeof(*submatch_data)); + if (submatch_data == NULL) + ERROR_EXIT(REG_ESPACE); + tnfa->submatch_data = submatch_data; + + errcode = tre_add_tags(mem, stack, tree, tnfa); + if (errcode != REG_OK) + ERROR_EXIT(errcode); + + } + + /* Expand iteration nodes. */ + errcode = tre_expand_ast(mem, stack, tree, &parse_ctx.position, + tag_directions); + if (errcode != REG_OK) + ERROR_EXIT(errcode); + + /* Add a dummy node for the final state. + XXX - For certain patterns this dummy node can be optimized away, + for example "a*" or "ab*". Figure out a simple way to detect + this possibility. */ + tmp_ast_l = tree; + tmp_ast_r = tre_ast_new_literal(mem, 0, 0, parse_ctx.position++); + if (tmp_ast_r == NULL) + ERROR_EXIT(REG_ESPACE); + + tree = tre_ast_new_catenation(mem, tmp_ast_l, tmp_ast_r); + if (tree == NULL) + ERROR_EXIT(REG_ESPACE); + + errcode = tre_compute_nfl(mem, stack, tree); + if (errcode != REG_OK) + ERROR_EXIT(errcode); + + counts = xmalloc(sizeof(int) * parse_ctx.position); + if (counts == NULL) + ERROR_EXIT(REG_ESPACE); + + offs = xmalloc(sizeof(int) * parse_ctx.position); + if (offs == NULL) + ERROR_EXIT(REG_ESPACE); + + for (i = 0; i < parse_ctx.position; i++) + counts[i] = 0; + tre_ast_to_tnfa(tree, NULL, counts, NULL); + + add = 0; + for (i = 0; i < parse_ctx.position; i++) + { + offs[i] = add; + add += counts[i] + 1; + counts[i] = 0; + } + transitions = xcalloc((unsigned)add + 1, sizeof(*transitions)); + if (transitions == NULL) + ERROR_EXIT(REG_ESPACE); + tnfa->transitions = transitions; + tnfa->num_transitions = add; + + errcode = tre_ast_to_tnfa(tree, transitions, counts, offs); + if (errcode != REG_OK) + ERROR_EXIT(errcode); + + tnfa->firstpos_chars = NULL; + + p = tree->firstpos; + i = 0; + while (p->position >= 0) + { + i++; + p++; + } + + initial = xcalloc((unsigned)i + 1, sizeof(tre_tnfa_transition_t)); + if (initial == NULL) + ERROR_EXIT(REG_ESPACE); + tnfa->initial = initial; + + i = 0; + for (p = tree->firstpos; p->position >= 0; p++) + { + initial[i].state = transitions + offs[p->position]; + initial[i].state_id = p->position; + initial[i].tags = NULL; + /* Copy the arrays p->tags, and p->params, they are allocated + from a tre_mem object. */ + if (p->tags) + { + int j; + for (j = 0; p->tags[j] >= 0; j++); + initial[i].tags = xmalloc(sizeof(*p->tags) * (j + 1)); + if (!initial[i].tags) + ERROR_EXIT(REG_ESPACE); + memcpy(initial[i].tags, p->tags, sizeof(*p->tags) * (j + 1)); + } + initial[i].assertions = p->assertions; + i++; + } + initial[i].state = NULL; + + tnfa->num_transitions = add; + tnfa->final = transitions + offs[tree->lastpos[0].position]; + tnfa->num_states = parse_ctx.position; + tnfa->cflags = cflags; + + tre_mem_destroy(mem); + tre_stack_destroy(stack); + xfree(counts); + xfree(offs); + + preg->TRE_REGEX_T_FIELD = (void *)tnfa; + return REG_OK; + + error_exit: + /* Free everything that was allocated and return the error code. */ + tre_mem_destroy(mem); + if (stack != NULL) + tre_stack_destroy(stack); + if (counts != NULL) + xfree(counts); + if (offs != NULL) + xfree(offs); + preg->TRE_REGEX_T_FIELD = (void *)tnfa; + regfree(preg); + return errcode; +} + + + + +void +regfree(regex_t *preg) +{ + tre_tnfa_t *tnfa; + unsigned int i; + tre_tnfa_transition_t *trans; + + tnfa = (void *)preg->TRE_REGEX_T_FIELD; + if (!tnfa) + return; + + for (i = 0; i < tnfa->num_transitions; i++) + if (tnfa->transitions[i].state) + { + if (tnfa->transitions[i].tags) + xfree(tnfa->transitions[i].tags); + if (tnfa->transitions[i].neg_classes) + xfree(tnfa->transitions[i].neg_classes); + } + if (tnfa->transitions) + xfree(tnfa->transitions); + + if (tnfa->initial) + { + for (trans = tnfa->initial; trans->state; trans++) + { + if (trans->tags) + xfree(trans->tags); + } + xfree(tnfa->initial); + } + + if (tnfa->submatch_data) + { + for (i = 0; i < tnfa->num_submatches; i++) + if (tnfa->submatch_data[i].parents) + xfree(tnfa->submatch_data[i].parents); + xfree(tnfa->submatch_data); + } + + if (tnfa->tag_directions) + xfree(tnfa->tag_directions); + if (tnfa->firstpos_chars) + xfree(tnfa->firstpos_chars); + if (tnfa->minimal_tags) + xfree(tnfa->minimal_tags); + xfree(tnfa); +} diff --git a/Ubiquitous/XiZi/lib/musllib/src/regex/regexec.c b/Ubiquitous/XiZi/lib/musllib/src/regex/regexec.c new file mode 100644 index 000000000..253b0e149 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/regex/regexec.c @@ -0,0 +1,1028 @@ +/* + regexec.c - TRE POSIX compatible matching functions (and more). + + Copyright (c) 2001-2009 Ville Laurikari + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS + ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 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. + +*/ + +#include +#include +#include +#include +#include +#include + +#include + +#include "tre.h" + +#include + +static void +tre_fill_pmatch(size_t nmatch, regmatch_t pmatch[], int cflags, + const tre_tnfa_t *tnfa, regoff_t *tags, regoff_t match_eo); + +/*********************************************************************** + from tre-match-utils.h +***********************************************************************/ + +#define GET_NEXT_WCHAR() do { \ + prev_c = next_c; pos += pos_add_next; \ + if ((pos_add_next = mbtowc(&next_c, str_byte, MB_LEN_MAX)) <= 0) { \ + if (pos_add_next < 0) { ret = REG_NOMATCH; goto error_exit; } \ + else pos_add_next++; \ + } \ + str_byte += pos_add_next; \ + } while (0) + +#define IS_WORD_CHAR(c) ((c) == L'_' || tre_isalnum(c)) + +#define CHECK_ASSERTIONS(assertions) \ + (((assertions & ASSERT_AT_BOL) \ + && (pos > 0 || reg_notbol) \ + && (prev_c != L'\n' || !reg_newline)) \ + || ((assertions & ASSERT_AT_EOL) \ + && (next_c != L'\0' || reg_noteol) \ + && (next_c != L'\n' || !reg_newline)) \ + || ((assertions & ASSERT_AT_BOW) \ + && (IS_WORD_CHAR(prev_c) || !IS_WORD_CHAR(next_c))) \ + || ((assertions & ASSERT_AT_EOW) \ + && (!IS_WORD_CHAR(prev_c) || IS_WORD_CHAR(next_c))) \ + || ((assertions & ASSERT_AT_WB) \ + && (pos != 0 && next_c != L'\0' \ + && IS_WORD_CHAR(prev_c) == IS_WORD_CHAR(next_c))) \ + || ((assertions & ASSERT_AT_WB_NEG) \ + && (pos == 0 || next_c == L'\0' \ + || IS_WORD_CHAR(prev_c) != IS_WORD_CHAR(next_c)))) + +#define CHECK_CHAR_CLASSES(trans_i, tnfa, eflags) \ + (((trans_i->assertions & ASSERT_CHAR_CLASS) \ + && !(tnfa->cflags & REG_ICASE) \ + && !tre_isctype((tre_cint_t)prev_c, trans_i->u.class)) \ + || ((trans_i->assertions & ASSERT_CHAR_CLASS) \ + && (tnfa->cflags & REG_ICASE) \ + && !tre_isctype(tre_tolower((tre_cint_t)prev_c),trans_i->u.class) \ + && !tre_isctype(tre_toupper((tre_cint_t)prev_c),trans_i->u.class)) \ + || ((trans_i->assertions & ASSERT_CHAR_CLASS_NEG) \ + && tre_neg_char_classes_match(trans_i->neg_classes,(tre_cint_t)prev_c,\ + tnfa->cflags & REG_ICASE))) + + + + +/* Returns 1 if `t1' wins `t2', 0 otherwise. */ +static int +tre_tag_order(int num_tags, tre_tag_direction_t *tag_directions, + regoff_t *t1, regoff_t *t2) +{ + int i; + for (i = 0; i < num_tags; i++) + { + if (tag_directions[i] == TRE_TAG_MINIMIZE) + { + if (t1[i] < t2[i]) + return 1; + if (t1[i] > t2[i]) + return 0; + } + else + { + if (t1[i] > t2[i]) + return 1; + if (t1[i] < t2[i]) + return 0; + } + } + /* assert(0);*/ + return 0; +} + +static int +tre_neg_char_classes_match(tre_ctype_t *classes, tre_cint_t wc, int icase) +{ + while (*classes != (tre_ctype_t)0) + if ((!icase && tre_isctype(wc, *classes)) + || (icase && (tre_isctype(tre_toupper(wc), *classes) + || tre_isctype(tre_tolower(wc), *classes)))) + return 1; /* Match. */ + else + classes++; + return 0; /* No match. */ +} + + +/*********************************************************************** + from tre-match-parallel.c +***********************************************************************/ + +/* + This algorithm searches for matches basically by reading characters + in the searched string one by one, starting at the beginning. All + matching paths in the TNFA are traversed in parallel. When two or + more paths reach the same state, exactly one is chosen according to + tag ordering rules; if returning submatches is not required it does + not matter which path is chosen. + + The worst case time required for finding the leftmost and longest + match, or determining that there is no match, is always linearly + dependent on the length of the text being searched. + + This algorithm cannot handle TNFAs with back referencing nodes. + See `tre-match-backtrack.c'. +*/ + +typedef struct { + tre_tnfa_transition_t *state; + regoff_t *tags; +} tre_tnfa_reach_t; + +typedef struct { + regoff_t pos; + regoff_t **tags; +} tre_reach_pos_t; + + +static reg_errcode_t +tre_tnfa_run_parallel(const tre_tnfa_t *tnfa, const void *string, + regoff_t *match_tags, int eflags, + regoff_t *match_end_ofs) +{ + /* State variables required by GET_NEXT_WCHAR. */ + tre_char_t prev_c = 0, next_c = 0; + const char *str_byte = string; + regoff_t pos = -1; + regoff_t pos_add_next = 1; +#ifdef TRE_MBSTATE + mbstate_t mbstate; +#endif /* TRE_MBSTATE */ + int reg_notbol = eflags & REG_NOTBOL; + int reg_noteol = eflags & REG_NOTEOL; + int reg_newline = tnfa->cflags & REG_NEWLINE; + reg_errcode_t ret; + + char *buf; + tre_tnfa_transition_t *trans_i; + tre_tnfa_reach_t *reach, *reach_next, *reach_i, *reach_next_i; + tre_reach_pos_t *reach_pos; + int *tag_i; + int num_tags, i; + + regoff_t match_eo = -1; /* end offset of match (-1 if no match found yet) */ + int new_match = 0; + regoff_t *tmp_tags = NULL; + regoff_t *tmp_iptr; + +#ifdef TRE_MBSTATE + memset(&mbstate, '\0', sizeof(mbstate)); +#endif /* TRE_MBSTATE */ + + if (!match_tags) + num_tags = 0; + else + num_tags = tnfa->num_tags; + + /* Allocate memory for temporary data required for matching. This needs to + be done for every matching operation to be thread safe. This allocates + everything in a single large block with calloc(). */ + { + size_t tbytes, rbytes, pbytes, xbytes, total_bytes; + char *tmp_buf; + + /* Ensure that tbytes and xbytes*num_states cannot overflow, and that + * they don't contribute more than 1/8 of SIZE_MAX to total_bytes. */ + if (num_tags > SIZE_MAX/(8 * sizeof(regoff_t) * tnfa->num_states)) + return REG_ESPACE; + + /* Likewise check rbytes. */ + if (tnfa->num_states+1 > SIZE_MAX/(8 * sizeof(*reach_next))) + return REG_ESPACE; + + /* Likewise check pbytes. */ + if (tnfa->num_states > SIZE_MAX/(8 * sizeof(*reach_pos))) + return REG_ESPACE; + + /* Compute the length of the block we need. */ + tbytes = sizeof(*tmp_tags) * num_tags; + rbytes = sizeof(*reach_next) * (tnfa->num_states + 1); + pbytes = sizeof(*reach_pos) * tnfa->num_states; + xbytes = sizeof(regoff_t) * num_tags; + total_bytes = + (sizeof(long) - 1) * 4 /* for alignment paddings */ + + (rbytes + xbytes * tnfa->num_states) * 2 + tbytes + pbytes; + + /* Allocate the memory. */ + buf = calloc(total_bytes, 1); + if (buf == NULL) + return REG_ESPACE; + + /* Get the various pointers within tmp_buf (properly aligned). */ + tmp_tags = (void *)buf; + tmp_buf = buf + tbytes; + tmp_buf += ALIGN(tmp_buf, long); + reach_next = (void *)tmp_buf; + tmp_buf += rbytes; + tmp_buf += ALIGN(tmp_buf, long); + reach = (void *)tmp_buf; + tmp_buf += rbytes; + tmp_buf += ALIGN(tmp_buf, long); + reach_pos = (void *)tmp_buf; + tmp_buf += pbytes; + tmp_buf += ALIGN(tmp_buf, long); + for (i = 0; i < tnfa->num_states; i++) + { + reach[i].tags = (void *)tmp_buf; + tmp_buf += xbytes; + reach_next[i].tags = (void *)tmp_buf; + tmp_buf += xbytes; + } + } + + for (i = 0; i < tnfa->num_states; i++) + reach_pos[i].pos = -1; + + GET_NEXT_WCHAR(); + pos = 0; + + reach_next_i = reach_next; + while (1) + { + /* If no match found yet, add the initial states to `reach_next'. */ + if (match_eo < 0) + { + trans_i = tnfa->initial; + while (trans_i->state != NULL) + { + if (reach_pos[trans_i->state_id].pos < pos) + { + if (trans_i->assertions + && CHECK_ASSERTIONS(trans_i->assertions)) + { + trans_i++; + continue; + } + + reach_next_i->state = trans_i->state; + for (i = 0; i < num_tags; i++) + reach_next_i->tags[i] = -1; + tag_i = trans_i->tags; + if (tag_i) + while (*tag_i >= 0) + { + if (*tag_i < num_tags) + reach_next_i->tags[*tag_i] = pos; + tag_i++; + } + if (reach_next_i->state == tnfa->final) + { + match_eo = pos; + new_match = 1; + for (i = 0; i < num_tags; i++) + match_tags[i] = reach_next_i->tags[i]; + } + reach_pos[trans_i->state_id].pos = pos; + reach_pos[trans_i->state_id].tags = &reach_next_i->tags; + reach_next_i++; + } + trans_i++; + } + reach_next_i->state = NULL; + } + else + { + if (num_tags == 0 || reach_next_i == reach_next) + /* We have found a match. */ + break; + } + + /* Check for end of string. */ + if (!next_c) break; + + GET_NEXT_WCHAR(); + + /* Swap `reach' and `reach_next'. */ + reach_i = reach; + reach = reach_next; + reach_next = reach_i; + + /* For each state in `reach', weed out states that don't fulfill the + minimal matching conditions. */ + if (tnfa->num_minimals && new_match) + { + new_match = 0; + reach_next_i = reach_next; + for (reach_i = reach; reach_i->state; reach_i++) + { + int skip = 0; + for (i = 0; tnfa->minimal_tags[i] >= 0; i += 2) + { + int end = tnfa->minimal_tags[i]; + int start = tnfa->minimal_tags[i + 1]; + if (end >= num_tags) + { + skip = 1; + break; + } + else if (reach_i->tags[start] == match_tags[start] + && reach_i->tags[end] < match_tags[end]) + { + skip = 1; + break; + } + } + if (!skip) + { + reach_next_i->state = reach_i->state; + tmp_iptr = reach_next_i->tags; + reach_next_i->tags = reach_i->tags; + reach_i->tags = tmp_iptr; + reach_next_i++; + } + } + reach_next_i->state = NULL; + + /* Swap `reach' and `reach_next'. */ + reach_i = reach; + reach = reach_next; + reach_next = reach_i; + } + + /* For each state in `reach' see if there is a transition leaving with + the current input symbol to a state not yet in `reach_next', and + add the destination states to `reach_next'. */ + reach_next_i = reach_next; + for (reach_i = reach; reach_i->state; reach_i++) + { + for (trans_i = reach_i->state; trans_i->state; trans_i++) + { + /* Does this transition match the input symbol? */ + if (trans_i->code_min <= (tre_cint_t)prev_c && + trans_i->code_max >= (tre_cint_t)prev_c) + { + if (trans_i->assertions + && (CHECK_ASSERTIONS(trans_i->assertions) + || CHECK_CHAR_CLASSES(trans_i, tnfa, eflags))) + { + continue; + } + + /* Compute the tags after this transition. */ + for (i = 0; i < num_tags; i++) + tmp_tags[i] = reach_i->tags[i]; + tag_i = trans_i->tags; + if (tag_i != NULL) + while (*tag_i >= 0) + { + if (*tag_i < num_tags) + tmp_tags[*tag_i] = pos; + tag_i++; + } + + if (reach_pos[trans_i->state_id].pos < pos) + { + /* Found an unvisited node. */ + reach_next_i->state = trans_i->state; + tmp_iptr = reach_next_i->tags; + reach_next_i->tags = tmp_tags; + tmp_tags = tmp_iptr; + reach_pos[trans_i->state_id].pos = pos; + reach_pos[trans_i->state_id].tags = &reach_next_i->tags; + + if (reach_next_i->state == tnfa->final + && (match_eo == -1 + || (num_tags > 0 + && reach_next_i->tags[0] <= match_tags[0]))) + { + match_eo = pos; + new_match = 1; + for (i = 0; i < num_tags; i++) + match_tags[i] = reach_next_i->tags[i]; + } + reach_next_i++; + + } + else + { + assert(reach_pos[trans_i->state_id].pos == pos); + /* Another path has also reached this state. We choose + the winner by examining the tag values for both + paths. */ + if (tre_tag_order(num_tags, tnfa->tag_directions, + tmp_tags, + *reach_pos[trans_i->state_id].tags)) + { + /* The new path wins. */ + tmp_iptr = *reach_pos[trans_i->state_id].tags; + *reach_pos[trans_i->state_id].tags = tmp_tags; + if (trans_i->state == tnfa->final) + { + match_eo = pos; + new_match = 1; + for (i = 0; i < num_tags; i++) + match_tags[i] = tmp_tags[i]; + } + tmp_tags = tmp_iptr; + } + } + } + } + } + reach_next_i->state = NULL; + } + + *match_end_ofs = match_eo; + ret = match_eo >= 0 ? REG_OK : REG_NOMATCH; +error_exit: + xfree(buf); + return ret; +} + + + +/*********************************************************************** + from tre-match-backtrack.c +***********************************************************************/ + +/* + This matcher is for regexps that use back referencing. Regexp matching + with back referencing is an NP-complete problem on the number of back + references. The easiest way to match them is to use a backtracking + routine which basically goes through all possible paths in the TNFA + and chooses the one which results in the best (leftmost and longest) + match. This can be spectacularly expensive and may run out of stack + space, but there really is no better known generic algorithm. Quoting + Henry Spencer from comp.compilers: + + + POSIX.2 REs require longest match, which is really exciting to + implement since the obsolete ("basic") variant also includes + \. I haven't found a better way of tackling this than doing + a preliminary match using a DFA (or simulation) on a modified RE + that just replicates subREs for \, and then doing a + backtracking match to determine whether the subRE matches were + right. This can be rather slow, but I console myself with the + thought that people who use \ deserve very slow execution. + (Pun unintentional but very appropriate.) + +*/ + +typedef struct { + regoff_t pos; + const char *str_byte; + tre_tnfa_transition_t *state; + int state_id; + int next_c; + regoff_t *tags; +#ifdef TRE_MBSTATE + mbstate_t mbstate; +#endif /* TRE_MBSTATE */ +} tre_backtrack_item_t; + +typedef struct tre_backtrack_struct { + tre_backtrack_item_t item; + struct tre_backtrack_struct *prev; + struct tre_backtrack_struct *next; +} *tre_backtrack_t; + +#ifdef TRE_MBSTATE +#define BT_STACK_MBSTATE_IN stack->item.mbstate = (mbstate) +#define BT_STACK_MBSTATE_OUT (mbstate) = stack->item.mbstate +#else /* !TRE_MBSTATE */ +#define BT_STACK_MBSTATE_IN +#define BT_STACK_MBSTATE_OUT +#endif /* !TRE_MBSTATE */ + +#define tre_bt_mem_new tre_mem_new +#define tre_bt_mem_alloc tre_mem_alloc +#define tre_bt_mem_destroy tre_mem_destroy + + +#define BT_STACK_PUSH(_pos, _str_byte, _str_wide, _state, _state_id, _next_c, _tags, _mbstate) \ + do \ + { \ + int i; \ + if (!stack->next) \ + { \ + tre_backtrack_t s; \ + s = tre_bt_mem_alloc(mem, sizeof(*s)); \ + if (!s) \ + { \ + tre_bt_mem_destroy(mem); \ + if (tags) \ + xfree(tags); \ + if (pmatch) \ + xfree(pmatch); \ + if (states_seen) \ + xfree(states_seen); \ + return REG_ESPACE; \ + } \ + s->prev = stack; \ + s->next = NULL; \ + s->item.tags = tre_bt_mem_alloc(mem, \ + sizeof(*tags) * tnfa->num_tags); \ + if (!s->item.tags) \ + { \ + tre_bt_mem_destroy(mem); \ + if (tags) \ + xfree(tags); \ + if (pmatch) \ + xfree(pmatch); \ + if (states_seen) \ + xfree(states_seen); \ + return REG_ESPACE; \ + } \ + stack->next = s; \ + stack = s; \ + } \ + else \ + stack = stack->next; \ + stack->item.pos = (_pos); \ + stack->item.str_byte = (_str_byte); \ + stack->item.state = (_state); \ + stack->item.state_id = (_state_id); \ + stack->item.next_c = (_next_c); \ + for (i = 0; i < tnfa->num_tags; i++) \ + stack->item.tags[i] = (_tags)[i]; \ + BT_STACK_MBSTATE_IN; \ + } \ + while (0) + +#define BT_STACK_POP() \ + do \ + { \ + int i; \ + assert(stack->prev); \ + pos = stack->item.pos; \ + str_byte = stack->item.str_byte; \ + state = stack->item.state; \ + next_c = stack->item.next_c; \ + for (i = 0; i < tnfa->num_tags; i++) \ + tags[i] = stack->item.tags[i]; \ + BT_STACK_MBSTATE_OUT; \ + stack = stack->prev; \ + } \ + while (0) + +#undef MIN +#define MIN(a, b) ((a) <= (b) ? (a) : (b)) + +static reg_errcode_t +tre_tnfa_run_backtrack(const tre_tnfa_t *tnfa, const void *string, + regoff_t *match_tags, int eflags, regoff_t *match_end_ofs) +{ + /* State variables required by GET_NEXT_WCHAR. */ + tre_char_t prev_c = 0, next_c = 0; + const char *str_byte = string; + regoff_t pos = 0; + regoff_t pos_add_next = 1; +#ifdef TRE_MBSTATE + mbstate_t mbstate; +#endif /* TRE_MBSTATE */ + int reg_notbol = eflags & REG_NOTBOL; + int reg_noteol = eflags & REG_NOTEOL; + int reg_newline = tnfa->cflags & REG_NEWLINE; + + /* These are used to remember the necessary values of the above + variables to return to the position where the current search + started from. */ + int next_c_start; + const char *str_byte_start; + regoff_t pos_start = -1; +#ifdef TRE_MBSTATE + mbstate_t mbstate_start; +#endif /* TRE_MBSTATE */ + + /* End offset of best match so far, or -1 if no match found yet. */ + regoff_t match_eo = -1; + /* Tag arrays. */ + int *next_tags; + regoff_t *tags = NULL; + /* Current TNFA state. */ + tre_tnfa_transition_t *state; + int *states_seen = NULL; + + /* Memory allocator to for allocating the backtracking stack. */ + tre_mem_t mem = tre_bt_mem_new(); + + /* The backtracking stack. */ + tre_backtrack_t stack; + + tre_tnfa_transition_t *trans_i; + regmatch_t *pmatch = NULL; + int ret; + +#ifdef TRE_MBSTATE + memset(&mbstate, '\0', sizeof(mbstate)); +#endif /* TRE_MBSTATE */ + + if (!mem) + return REG_ESPACE; + stack = tre_bt_mem_alloc(mem, sizeof(*stack)); + if (!stack) + { + ret = REG_ESPACE; + goto error_exit; + } + stack->prev = NULL; + stack->next = NULL; + + if (tnfa->num_tags) + { + tags = xmalloc(sizeof(*tags) * tnfa->num_tags); + if (!tags) + { + ret = REG_ESPACE; + goto error_exit; + } + } + if (tnfa->num_submatches) + { + pmatch = xmalloc(sizeof(*pmatch) * tnfa->num_submatches); + if (!pmatch) + { + ret = REG_ESPACE; + goto error_exit; + } + } + if (tnfa->num_states) + { + states_seen = xmalloc(sizeof(*states_seen) * tnfa->num_states); + if (!states_seen) + { + ret = REG_ESPACE; + goto error_exit; + } + } + + retry: + { + int i; + for (i = 0; i < tnfa->num_tags; i++) + { + tags[i] = -1; + if (match_tags) + match_tags[i] = -1; + } + for (i = 0; i < tnfa->num_states; i++) + states_seen[i] = 0; + } + + state = NULL; + pos = pos_start; + GET_NEXT_WCHAR(); + pos_start = pos; + next_c_start = next_c; + str_byte_start = str_byte; +#ifdef TRE_MBSTATE + mbstate_start = mbstate; +#endif /* TRE_MBSTATE */ + + /* Handle initial states. */ + next_tags = NULL; + for (trans_i = tnfa->initial; trans_i->state; trans_i++) + { + if (trans_i->assertions && CHECK_ASSERTIONS(trans_i->assertions)) + { + continue; + } + if (state == NULL) + { + /* Start from this state. */ + state = trans_i->state; + next_tags = trans_i->tags; + } + else + { + /* Backtrack to this state. */ + BT_STACK_PUSH(pos, str_byte, 0, trans_i->state, + trans_i->state_id, next_c, tags, mbstate); + { + int *tmp = trans_i->tags; + if (tmp) + while (*tmp >= 0) + stack->item.tags[*tmp++] = pos; + } + } + } + + if (next_tags) + for (; *next_tags >= 0; next_tags++) + tags[*next_tags] = pos; + + + if (state == NULL) + goto backtrack; + + while (1) + { + tre_tnfa_transition_t *next_state; + int empty_br_match; + + if (state == tnfa->final) + { + if (match_eo < pos + || (match_eo == pos + && match_tags + && tre_tag_order(tnfa->num_tags, tnfa->tag_directions, + tags, match_tags))) + { + int i; + /* This match wins the previous match. */ + match_eo = pos; + if (match_tags) + for (i = 0; i < tnfa->num_tags; i++) + match_tags[i] = tags[i]; + } + /* Our TNFAs never have transitions leaving from the final state, + so we jump right to backtracking. */ + goto backtrack; + } + + /* Go to the next character in the input string. */ + empty_br_match = 0; + trans_i = state; + if (trans_i->state && trans_i->assertions & ASSERT_BACKREF) + { + /* This is a back reference state. All transitions leaving from + this state have the same back reference "assertion". Instead + of reading the next character, we match the back reference. */ + regoff_t so, eo; + int bt = trans_i->u.backref; + regoff_t bt_len; + int result; + + /* Get the substring we need to match against. Remember to + turn off REG_NOSUB temporarily. */ + tre_fill_pmatch(bt + 1, pmatch, tnfa->cflags & ~REG_NOSUB, + tnfa, tags, pos); + so = pmatch[bt].rm_so; + eo = pmatch[bt].rm_eo; + bt_len = eo - so; + + result = strncmp((const char*)string + so, str_byte - 1, + (size_t)bt_len); + + if (result == 0) + { + /* Back reference matched. Check for infinite loop. */ + if (bt_len == 0) + empty_br_match = 1; + if (empty_br_match && states_seen[trans_i->state_id]) + { + goto backtrack; + } + + states_seen[trans_i->state_id] = empty_br_match; + + /* Advance in input string and resync `prev_c', `next_c' + and pos. */ + str_byte += bt_len - 1; + pos += bt_len - 1; + GET_NEXT_WCHAR(); + } + else + { + goto backtrack; + } + } + else + { + /* Check for end of string. */ + if (next_c == L'\0') + goto backtrack; + + /* Read the next character. */ + GET_NEXT_WCHAR(); + } + + next_state = NULL; + for (trans_i = state; trans_i->state; trans_i++) + { + if (trans_i->code_min <= (tre_cint_t)prev_c + && trans_i->code_max >= (tre_cint_t)prev_c) + { + if (trans_i->assertions + && (CHECK_ASSERTIONS(trans_i->assertions) + || CHECK_CHAR_CLASSES(trans_i, tnfa, eflags))) + { + continue; + } + + if (next_state == NULL) + { + /* First matching transition. */ + next_state = trans_i->state; + next_tags = trans_i->tags; + } + else + { + /* Second matching transition. We may need to backtrack here + to take this transition instead of the first one, so we + push this transition in the backtracking stack so we can + jump back here if needed. */ + BT_STACK_PUSH(pos, str_byte, 0, trans_i->state, + trans_i->state_id, next_c, tags, mbstate); + { + int *tmp; + for (tmp = trans_i->tags; tmp && *tmp >= 0; tmp++) + stack->item.tags[*tmp] = pos; + } +#if 0 /* XXX - it's important not to look at all transitions here to keep + the stack small! */ + break; +#endif + } + } + } + + if (next_state != NULL) + { + /* Matching transitions were found. Take the first one. */ + state = next_state; + + /* Update the tag values. */ + if (next_tags) + while (*next_tags >= 0) + tags[*next_tags++] = pos; + } + else + { + backtrack: + /* A matching transition was not found. Try to backtrack. */ + if (stack->prev) + { + if (stack->item.state->assertions & ASSERT_BACKREF) + { + states_seen[stack->item.state_id] = 0; + } + + BT_STACK_POP(); + } + else if (match_eo < 0) + { + /* Try starting from a later position in the input string. */ + /* Check for end of string. */ + if (next_c == L'\0') + { + break; + } + next_c = next_c_start; +#ifdef TRE_MBSTATE + mbstate = mbstate_start; +#endif /* TRE_MBSTATE */ + str_byte = str_byte_start; + goto retry; + } + else + { + break; + } + } + } + + ret = match_eo >= 0 ? REG_OK : REG_NOMATCH; + *match_end_ofs = match_eo; + + error_exit: + tre_bt_mem_destroy(mem); +#ifndef TRE_USE_ALLOCA + if (tags) + xfree(tags); + if (pmatch) + xfree(pmatch); + if (states_seen) + xfree(states_seen); +#endif /* !TRE_USE_ALLOCA */ + + return ret; +} + +/*********************************************************************** + from regexec.c +***********************************************************************/ + +/* Fills the POSIX.2 regmatch_t array according to the TNFA tag and match + endpoint values. */ +static void +tre_fill_pmatch(size_t nmatch, regmatch_t pmatch[], int cflags, + const tre_tnfa_t *tnfa, regoff_t *tags, regoff_t match_eo) +{ + tre_submatch_data_t *submatch_data; + unsigned int i, j; + int *parents; + + i = 0; + if (match_eo >= 0 && !(cflags & REG_NOSUB)) + { + /* Construct submatch offsets from the tags. */ + submatch_data = tnfa->submatch_data; + while (i < tnfa->num_submatches && i < nmatch) + { + if (submatch_data[i].so_tag == tnfa->end_tag) + pmatch[i].rm_so = match_eo; + else + pmatch[i].rm_so = tags[submatch_data[i].so_tag]; + + if (submatch_data[i].eo_tag == tnfa->end_tag) + pmatch[i].rm_eo = match_eo; + else + pmatch[i].rm_eo = tags[submatch_data[i].eo_tag]; + + /* If either of the endpoints were not used, this submatch + was not part of the match. */ + if (pmatch[i].rm_so == -1 || pmatch[i].rm_eo == -1) + pmatch[i].rm_so = pmatch[i].rm_eo = -1; + + i++; + } + /* Reset all submatches that are not within all of their parent + submatches. */ + i = 0; + while (i < tnfa->num_submatches && i < nmatch) + { + if (pmatch[i].rm_eo == -1) + assert(pmatch[i].rm_so == -1); + assert(pmatch[i].rm_so <= pmatch[i].rm_eo); + + parents = submatch_data[i].parents; + if (parents != NULL) + for (j = 0; parents[j] >= 0; j++) + { + if (pmatch[i].rm_so < pmatch[parents[j]].rm_so + || pmatch[i].rm_eo > pmatch[parents[j]].rm_eo) + pmatch[i].rm_so = pmatch[i].rm_eo = -1; + } + i++; + } + } + + while (i < nmatch) + { + pmatch[i].rm_so = -1; + pmatch[i].rm_eo = -1; + i++; + } +} + + +/* + Wrapper functions for POSIX compatible regexp matching. +*/ + +int +regexec(const regex_t *restrict preg, const char *restrict string, + size_t nmatch, regmatch_t pmatch[restrict], int eflags) +{ + tre_tnfa_t *tnfa = (void *)preg->TRE_REGEX_T_FIELD; + reg_errcode_t status; + regoff_t *tags = NULL, eo; + if (tnfa->cflags & REG_NOSUB) nmatch = 0; + if (tnfa->num_tags > 0 && nmatch > 0) + { + tags = xmalloc(sizeof(*tags) * tnfa->num_tags); + if (tags == NULL) + return REG_ESPACE; + } + + /* Dispatch to the appropriate matcher. */ + if (tnfa->have_backrefs) + { + /* The regex has back references, use the backtracking matcher. */ + status = tre_tnfa_run_backtrack(tnfa, string, tags, eflags, &eo); + } + else + { + /* Exact matching, no back references, use the parallel matcher. */ + status = tre_tnfa_run_parallel(tnfa, string, tags, eflags, &eo); + } + + if (status == REG_OK) + /* A match was found, so fill the submatch registers. */ + tre_fill_pmatch(nmatch, pmatch, tnfa->cflags, tnfa, tags, eo); + if (tags) + xfree(tags); + return status; +} diff --git a/Ubiquitous/XiZi/lib/musllib/src/regex/tre-mem.c b/Ubiquitous/XiZi/lib/musllib/src/regex/tre-mem.c new file mode 100644 index 000000000..86f809d45 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/regex/tre-mem.c @@ -0,0 +1,158 @@ +/* + tre-mem.c - TRE memory allocator + + Copyright (c) 2001-2009 Ville Laurikari + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS + ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 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. + +*/ + +/* + This memory allocator is for allocating small memory blocks efficiently + in terms of memory overhead and execution speed. The allocated blocks + cannot be freed individually, only all at once. There can be multiple + allocators, though. +*/ + +#include +#include + +#include "tre.h" + +/* + This memory allocator is for allocating small memory blocks efficiently + in terms of memory overhead and execution speed. The allocated blocks + cannot be freed individually, only all at once. There can be multiple + allocators, though. +*/ + +/* Returns a new memory allocator or NULL if out of memory. */ +tre_mem_t +tre_mem_new_impl(int provided, void *provided_block) +{ + tre_mem_t mem; + if (provided) + { + mem = provided_block; + memset(mem, 0, sizeof(*mem)); + } + else + mem = xcalloc(1, sizeof(*mem)); + if (mem == NULL) + return NULL; + return mem; +} + + +/* Frees the memory allocator and all memory allocated with it. */ +void +tre_mem_destroy(tre_mem_t mem) +{ + tre_list_t *tmp, *l = mem->blocks; + + while (l != NULL) + { + xfree(l->data); + tmp = l->next; + xfree(l); + l = tmp; + } + xfree(mem); +} + + +/* Allocates a block of `size' bytes from `mem'. Returns a pointer to the + allocated block or NULL if an underlying malloc() failed. */ +void * +tre_mem_alloc_impl(tre_mem_t mem, int provided, void *provided_block, + int zero, size_t size) +{ + void *ptr; + + if (mem->failed) + { + return NULL; + } + + if (mem->n < size) + { + /* We need more memory than is available in the current block. + Allocate a new block. */ + tre_list_t *l; + if (provided) + { + if (provided_block == NULL) + { + mem->failed = 1; + return NULL; + } + mem->ptr = provided_block; + mem->n = TRE_MEM_BLOCK_SIZE; + } + else + { + int block_size; + if (size * 8 > TRE_MEM_BLOCK_SIZE) + block_size = size * 8; + else + block_size = TRE_MEM_BLOCK_SIZE; + l = xmalloc(sizeof(*l)); + if (l == NULL) + { + mem->failed = 1; + return NULL; + } + l->data = xmalloc(block_size); + if (l->data == NULL) + { + xfree(l); + mem->failed = 1; + return NULL; + } + l->next = NULL; + if (mem->current != NULL) + mem->current->next = l; + if (mem->blocks == NULL) + mem->blocks = l; + mem->current = l; + mem->ptr = l->data; + mem->n = block_size; + } + } + + /* Make sure the next pointer will be aligned. */ + size += ALIGN(mem->ptr + size, long); + + /* Allocate from current block. */ + ptr = mem->ptr; + mem->ptr += size; + mem->n -= size; + + /* Set to zero if needed. */ + if (zero) + memset(ptr, 0, size); + + return ptr; +} diff --git a/Ubiquitous/XiZi/lib/musllib/src/regex/tre.h b/Ubiquitous/XiZi/lib/musllib/src/regex/tre.h new file mode 100644 index 000000000..6e099375b --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/regex/tre.h @@ -0,0 +1,232 @@ +/* + tre-internal.h - TRE internal definitions + + Copyright (c) 2001-2009 Ville Laurikari + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS + ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 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. + +*/ + +#include +#include +#include +#include "../include/features.h" + +#undef TRE_MBSTATE + +#define NDEBUG + +#define TRE_REGEX_T_FIELD __opaque +typedef int reg_errcode_t; + +typedef wchar_t tre_char_t; + +#define DPRINT(msg) do { } while(0) + +#define elementsof(x) ( sizeof(x) / sizeof(x[0]) ) + +#define tre_mbrtowc(pwc, s, n, ps) (mbtowc((pwc), (s), (n))) + +/* Wide characters. */ +typedef wint_t tre_cint_t; +#define TRE_CHAR_MAX 0x10ffff + +#define tre_isalnum iswalnum +#define tre_isalpha iswalpha +#define tre_isblank iswblank +#define tre_iscntrl iswcntrl +#define tre_isdigit iswdigit +#define tre_isgraph iswgraph +#define tre_islower iswlower +#define tre_isprint iswprint +#define tre_ispunct iswpunct +#define tre_isspace iswspace +#define tre_isupper iswupper +#define tre_isxdigit iswxdigit + +#define tre_tolower towlower +#define tre_toupper towupper +#define tre_strlen wcslen + +/* Use system provided iswctype() and wctype(). */ +typedef wctype_t tre_ctype_t; +#define tre_isctype iswctype +#define tre_ctype wctype + +/* Returns number of bytes to add to (char *)ptr to make it + properly aligned for the type. */ +#define ALIGN(ptr, type) \ + ((((long)ptr) % sizeof(type)) \ + ? (sizeof(type) - (((long)ptr) % sizeof(type))) \ + : 0) + +#undef MAX +#undef MIN +#define MAX(a, b) (((a) >= (b)) ? (a) : (b)) +#define MIN(a, b) (((a) <= (b)) ? (a) : (b)) + +/* TNFA transition type. A TNFA state is an array of transitions, + the terminator is a transition with NULL `state'. */ +typedef struct tnfa_transition tre_tnfa_transition_t; + +struct tnfa_transition { + /* Range of accepted characters. */ + tre_cint_t code_min; + tre_cint_t code_max; + /* Pointer to the destination state. */ + tre_tnfa_transition_t *state; + /* ID number of the destination state. */ + int state_id; + /* -1 terminated array of tags (or NULL). */ + int *tags; + /* Assertion bitmap. */ + int assertions; + /* Assertion parameters. */ + union { + /* Character class assertion. */ + tre_ctype_t class; + /* Back reference assertion. */ + int backref; + } u; + /* Negative character class assertions. */ + tre_ctype_t *neg_classes; +}; + + +/* Assertions. */ +#define ASSERT_AT_BOL 1 /* Beginning of line. */ +#define ASSERT_AT_EOL 2 /* End of line. */ +#define ASSERT_CHAR_CLASS 4 /* Character class in `class'. */ +#define ASSERT_CHAR_CLASS_NEG 8 /* Character classes in `neg_classes'. */ +#define ASSERT_AT_BOW 16 /* Beginning of word. */ +#define ASSERT_AT_EOW 32 /* End of word. */ +#define ASSERT_AT_WB 64 /* Word boundary. */ +#define ASSERT_AT_WB_NEG 128 /* Not a word boundary. */ +#define ASSERT_BACKREF 256 /* A back reference in `backref'. */ +#define ASSERT_LAST 256 + +/* Tag directions. */ +typedef enum { + TRE_TAG_MINIMIZE = 0, + TRE_TAG_MAXIMIZE = 1 +} tre_tag_direction_t; + +/* Instructions to compute submatch register values from tag values + after a successful match. */ +struct tre_submatch_data { + /* Tag that gives the value for rm_so (submatch start offset). */ + int so_tag; + /* Tag that gives the value for rm_eo (submatch end offset). */ + int eo_tag; + /* List of submatches this submatch is contained in. */ + int *parents; +}; + +typedef struct tre_submatch_data tre_submatch_data_t; + + +/* TNFA definition. */ +typedef struct tnfa tre_tnfa_t; + +struct tnfa { + tre_tnfa_transition_t *transitions; + unsigned int num_transitions; + tre_tnfa_transition_t *initial; + tre_tnfa_transition_t *final; + tre_submatch_data_t *submatch_data; + char *firstpos_chars; + int first_char; + unsigned int num_submatches; + tre_tag_direction_t *tag_directions; + int *minimal_tags; + int num_tags; + int num_minimals; + int end_tag; + int num_states; + int cflags; + int have_backrefs; + int have_approx; +}; + +/* from tre-mem.h: */ + +#define TRE_MEM_BLOCK_SIZE 1024 + +typedef struct tre_list { + void *data; + struct tre_list *next; +} tre_list_t; + +typedef struct tre_mem_struct { + tre_list_t *blocks; + tre_list_t *current; + char *ptr; + size_t n; + int failed; + void **provided; +} *tre_mem_t; + +#define tre_mem_new_impl __tre_mem_new_impl +#define tre_mem_alloc_impl __tre_mem_alloc_impl +#define tre_mem_destroy __tre_mem_destroy + +hidden tre_mem_t tre_mem_new_impl(int provided, void *provided_block); +hidden void *tre_mem_alloc_impl(tre_mem_t mem, int provided, void *provided_block, + int zero, size_t size); + +/* Returns a new memory allocator or NULL if out of memory. */ +#define tre_mem_new() tre_mem_new_impl(0, NULL) + +/* Allocates a block of `size' bytes from `mem'. Returns a pointer to the + allocated block or NULL if an underlying malloc() failed. */ +#define tre_mem_alloc(mem, size) tre_mem_alloc_impl(mem, 0, NULL, 0, size) + +/* Allocates a block of `size' bytes from `mem'. Returns a pointer to the + allocated block or NULL if an underlying malloc() failed. The memory + is set to zero. */ +#define tre_mem_calloc(mem, size) tre_mem_alloc_impl(mem, 0, NULL, 1, size) + +#ifdef TRE_USE_ALLOCA +/* alloca() versions. Like above, but memory is allocated with alloca() + instead of malloc(). */ + +#define tre_mem_newa() \ + tre_mem_new_impl(1, alloca(sizeof(struct tre_mem_struct))) + +#define tre_mem_alloca(mem, size) \ + ((mem)->n >= (size) \ + ? tre_mem_alloc_impl((mem), 1, NULL, 0, (size)) \ + : tre_mem_alloc_impl((mem), 1, alloca(TRE_MEM_BLOCK_SIZE), 0, (size))) +#endif /* TRE_USE_ALLOCA */ + + +/* Frees the memory allocator and all memory allocated with it. */ +hidden void tre_mem_destroy(tre_mem_t mem); + +#define xmalloc malloc +#define xcalloc calloc +#define xfree free +#define xrealloc realloc + diff --git a/Ubiquitous/XiZi/lib/musllib/src/stdio/Makefile b/Ubiquitous/XiZi/lib/musllib/src/stdio/Makefile new file mode 100644 index 000000000..f86fcad3b --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/stdio/Makefile @@ -0,0 +1,11 @@ +SRC_FILES := __fdopen.c __fmodeflags.c __lockfile.c __overflow.c +SRC_FILES += __stdio_close.c __stdio_read.c __stdio_seek.c __stdio_write.c +SRC_FILES += __stdout_write.c __string_read.c +SRC_FILES += __toread.c __towrite.c __uflow.c +SRC_FILES += clearerr.c fclose.c feof.c fflush.c fgetc.c fgets.c fileno.c fopen.c fputc.c fputs.c fread.c fseek.c ftell.c fwrite.c +SRC_FILES += ofl_add.c ofl.c perror.c remove.c rewind.c sprintf.c snprintf.c sscanf.c stderr.c stdin.c stdout.c printf.c puts.c putchar.c +SRC_FILES += ungetc.c vfprintf.c vfscanf.c vprintf.c vscanf.c vsnprintf.c vsprintf.c vsscanf.c stdio.c setvbuf.c + + + +include $(KERNEL_ROOT)/compiler.mk \ No newline at end of file diff --git a/Ubiquitous/XiZi/lib/musllib/src/stdio/__fdopen.c b/Ubiquitous/XiZi/lib/musllib/src/stdio/__fdopen.c new file mode 100644 index 000000000..23f87a95d --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/stdio/__fdopen.c @@ -0,0 +1,67 @@ +#include "stdio_impl.h" +#include +#include +#include +#include +#include +#include + +int ioctl(int fd, int req, ...) +{ + return 0; +} + +FILE *__fdopen(int fd, const char *mode) +{ + FILE *f; + struct winsize wsz; + pthread_mutex_t filelockinit = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP; + + /* Check for valid initial mode character */ + if (!strchr("rwa", *mode)) { + errno = EINVAL; + return 0; + } + + /* Allocate FILE+buffer or fail */ + if (!(f=malloc(sizeof *f + UNGET + BUFSIZ + sizeof(pthread_mutex_t)))) return 0; + + /* Zero-fill only the struct, not the buffer */ + memset(f, 0, sizeof *f); + + /* Impose mode restrictions */ + if (!strchr(mode, '+')) f->flags = (*mode == 'r') ? F_NOWR : F_NORD; + + /* Apply close-on-exec flag */ + // if (strchr(mode, 'e')) fcntl(fd, F_SETFD, FD_CLOEXEC); + + /* Set append mode on fd if opened for append */ + // if (*mode == 'a') { + // int flags = fcntl(fd, F_GETFL); + // if (!(flags & O_APPEND)) + // fcntl(fd, F_SETFL, flags | O_APPEND); + // f->flags |= F_APP; + // } + + f->fd = fd; + f->buf = (unsigned char *)f + sizeof *f + UNGET; + f->buf_size = BUFSIZ; + f->lock = (pthread_mutex_t *)((unsigned char *)f + sizeof *f + UNGET + BUFSIZ); + memcpy(f->lock, &filelockinit, sizeof(pthread_mutex_t)); + + /* Activate line buffered mode for terminals */ + f->lbf = EOF; + if (!(f->flags & F_NOWR) && !ioctl(fd, TIOCGWINSZ, &wsz)) + f->lbf = '\n'; + + /* Initialize op ptrs. No problem if some are unneeded. */ + f->read = __stdio_read; + f->write = __stdio_write; + f->seek = __stdio_seek; + f->close = __stdio_close; + + /* Add new FILE to open file list */ + return __ofl_add(f); +} + +weak_alias(__fdopen, fdopen); diff --git a/Ubiquitous/XiZi/lib/musllib/src/stdio/__fmodeflags.c b/Ubiquitous/XiZi/lib/musllib/src/stdio/__fmodeflags.c new file mode 100644 index 000000000..3c2370a5b --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/stdio/__fmodeflags.c @@ -0,0 +1,16 @@ +#include +#include + +int __fmodeflags(const char *mode) +{ + int flags; + if (strchr(mode, '+')) flags = O_RDWR; + else if (*mode == 'r') flags = O_RDONLY; + else flags = O_WRONLY; + if (strchr(mode, 'x')) flags |= O_EXCL; + if (strchr(mode, 'e')) flags |= O_CLOEXEC; + if (*mode != 'r') flags |= O_CREAT; + if (*mode == 'w') flags |= O_TRUNC; + if (*mode == 'a') flags |= O_APPEND; + return flags; +} diff --git a/Ubiquitous/XiZi/lib/musllib/src/stdio/__lockfile.c b/Ubiquitous/XiZi/lib/musllib/src/stdio/__lockfile.c new file mode 100644 index 000000000..a87955d61 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/stdio/__lockfile.c @@ -0,0 +1,12 @@ +#include "stdio_impl.h" +#include "pthread.h" + +int __lockfile(FILE *f) +{ + return pthread_mutex_lock((pthread_mutex_t *)(f->lock)); +} + +int __unlockfile(FILE *f) +{ + return pthread_mutex_unlock((pthread_mutex_t *)(f->lock)); +} diff --git a/Ubiquitous/XiZi/lib/musllib/src/stdio/__overflow.c b/Ubiquitous/XiZi/lib/musllib/src/stdio/__overflow.c new file mode 100644 index 000000000..e65a594dd --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/stdio/__overflow.c @@ -0,0 +1,10 @@ +#include "stdio_impl.h" + +int __overflow(FILE *f, int _c) +{ + unsigned char c = _c; + if (!f->wend && __towrite(f)) return EOF; + if (f->wpos != f->wend && c != f->lbf) return *f->wpos++ = c; + if (f->write(f, &c, 1)!=1) return EOF; + return c; +} diff --git a/Ubiquitous/XiZi/lib/musllib/src/stdio/__stdio_close.c b/Ubiquitous/XiZi/lib/musllib/src/stdio/__stdio_close.c new file mode 100644 index 000000000..c97688b27 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/stdio/__stdio_close.c @@ -0,0 +1,7 @@ +#include "stdio_impl.h" +#include + +int __stdio_close(FILE *f) +{ + return close(f->fd); +} \ No newline at end of file diff --git a/Ubiquitous/XiZi/lib/musllib/src/stdio/__stdio_read.c b/Ubiquitous/XiZi/lib/musllib/src/stdio/__stdio_read.c new file mode 100644 index 000000000..60c9f7098 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/stdio/__stdio_read.c @@ -0,0 +1,25 @@ +#include "stdio_impl.h" +#include +#include + +size_t __stdio_read(FILE *f, unsigned char *buf, size_t len) +{ + struct iovec iov[2] = { + { .iov_base = buf, .iov_len = len - !!f->buf_size }, + { .iov_base = f->buf, .iov_len = f->buf_size } + }; + ssize_t cnt; + + cnt = read(f->fd, iov[0].iov_base, iov[0].iov_len); + if (iov[1].iov_len > iov[0].iov_len) cnt += read(f->fd, iov[1].iov_base, iov[1].iov_len - iov[0].iov_len); + if (cnt <= 0) { + f->flags |= cnt ? F_ERR : F_EOF; + return 0; + } + if (cnt <= iov[0].iov_len) return cnt; + cnt -= iov[0].iov_len; + f->rpos = f->buf; + f->rend = f->buf + cnt; + if (f->buf_size) buf[len-1] = *f->rpos++; + return len; +} diff --git a/Ubiquitous/XiZi/lib/musllib/src/stdio/__stdio_seek.c b/Ubiquitous/XiZi/lib/musllib/src/stdio/__stdio_seek.c new file mode 100644 index 000000000..57060258a --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/stdio/__stdio_seek.c @@ -0,0 +1,53 @@ +#include "stdio_impl.h" +#include + +#if 0 +static off64_t __stdio_lseek64(int fd, int offsetHigh, int offsetLow, off64_t *result, int whence) +{ + off64_t ret; + struct file *filep = NULL; + off64_t offset = ((off64_t)offsetHigh << 32) + (uint)offsetLow; /* 32: offsetHigh is high 32 bits */ + + /* Get the file structure corresponding to the file descriptor. */ + ret = fs_getfilep(fd, &filep); + if (ret < 0) { + /* The errno value has already been set */ + return (off64_t)-get_errno(); + } + + /* libc seekdir function should set the whence to SEEK_SET, so we can discard + * the whence argument here */ + if (filep->f_oflags & O_DIRECTORY) { + /* defensive coding */ + if (filep->f_dir == NULL) { + return (off64_t)-EINVAL; + } + if (offsetLow == 0) { + rewinddir(filep->f_dir); + } else { + seekdir(filep->f_dir, offsetLow); + } + ret = telldir(filep->f_dir); + if (ret < 0) { + return (off64_t)-get_errno(); + } + goto out; + } + + /* Then let file_seek do the real work */ + ret = file_seek64(filep, offset, whence); + if (ret < 0) { + return (off64_t)-get_errno(); + } + +out: + *result = ret; + + return 0; +} +#endif +off_t __stdio_seek(FILE *f, off_t off, int whence) +{ + off_t result = 0; + return lseek(f->fd, (unsigned int)off, whence) ? -1 : result; +} diff --git a/Ubiquitous/XiZi/lib/musllib/src/stdio/__stdio_write.c b/Ubiquitous/XiZi/lib/musllib/src/stdio/__stdio_write.c new file mode 100644 index 000000000..b7cb5105b --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/stdio/__stdio_write.c @@ -0,0 +1,36 @@ +#include "stdio_impl.h" +#include +#include + +size_t __stdio_write(FILE *f, const unsigned char *buf, size_t len) +{ + struct iovec iovs[2] = { + { .iov_base = f->wbase, .iov_len = f->wpos-f->wbase }, + { .iov_base = (void *)buf, .iov_len = len } + }; + struct iovec *iov = iovs; + size_t rem = iov[0].iov_len + iov[1].iov_len; + int iovcnt = 2; + ssize_t cnt; + for (;;) { + cnt = write(f->fd, iov[0].iov_base, iov[0].iov_len); + if (0 != iov[1].iov_len) cnt += write(f->fd, iov[1].iov_base, iov[1].iov_len); + if (cnt == rem) { + f->wend = f->buf + f->buf_size; + f->wpos = f->wbase = f->buf; + return len; + } + if (cnt < 0) { + f->wpos = f->wbase = f->wend = 0; + f->flags |= F_ERR; + return iovcnt == 2 ? 0 : len-iov[0].iov_len; + } + rem -= cnt; + if (cnt > iov[0].iov_len) { + cnt -= iov[0].iov_len; + iov++; iovcnt--; + } + iov[0].iov_base = (char *)iov[0].iov_base + cnt; + iov[0].iov_len -= cnt; + } +} \ No newline at end of file diff --git a/Ubiquitous/XiZi/lib/musllib/src/stdio/__stdout_write.c b/Ubiquitous/XiZi/lib/musllib/src/stdio/__stdout_write.c new file mode 100644 index 000000000..8205b7b7b --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/stdio/__stdout_write.c @@ -0,0 +1,11 @@ +#include "stdio_impl.h" +#include + +size_t __stdout_write(FILE *f, const unsigned char *buf, size_t len) +{ + struct winsize wsz; + if (!(f->flags & F_SVB) && ioctl(f->fd, TIOCGWINSZ, &wsz)) { + f->lbf = EOF; + } + return __stdio_write(f, buf, len); +} diff --git a/Ubiquitous/XiZi/lib/musllib/src/stdio/__string_read.c b/Ubiquitous/XiZi/lib/musllib/src/stdio/__string_read.c new file mode 100644 index 000000000..7b50a7e11 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/stdio/__string_read.c @@ -0,0 +1,16 @@ +#include "stdio_impl.h" +#include + +size_t __string_read(FILE *f, unsigned char *buf, size_t len) +{ + char *src = f->cookie; + size_t k = len+256; + char *end = memchr(src, 0, k); + if (end) k = end-src; + if (k < len) len = k; + memcpy(buf, src, len); + f->rpos = (void *)(src+len); + f->rend = (void *)(src+k); + f->cookie = src+k; + return len; +} diff --git a/Ubiquitous/XiZi/lib/musllib/src/stdio/__toread.c b/Ubiquitous/XiZi/lib/musllib/src/stdio/__toread.c new file mode 100644 index 000000000..d2a377e09 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/stdio/__toread.c @@ -0,0 +1,14 @@ +#include + +int __toread(FILE *f) +{ + f->mode |= f->mode-1; + if (f->wpos != f->wbase) f->write(f, 0, 0); + f->wpos = f->wbase = f->wend = 0; + if (f->flags & F_NORD) { + f->flags |= F_ERR; + return EOF; + } + f->rpos = f->rend = f->buf + f->buf_size; + return (f->flags & F_EOF) ? EOF : 0; +} \ No newline at end of file diff --git a/Ubiquitous/XiZi/lib/musllib/src/stdio/__towrite.c b/Ubiquitous/XiZi/lib/musllib/src/stdio/__towrite.c new file mode 100644 index 000000000..b7cf2c0c2 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/stdio/__towrite.c @@ -0,0 +1,18 @@ +#include "stdio_impl.h" + +int __towrite(FILE *f) +{ + f->mode |= f->mode - 1; + if (f->flags & F_NOWR) { + f->flags |= F_ERR; + return EOF; + } + /* Clear read buffer (easier than summoning nasal demons) */ + f->rpos = f->rend = 0; + + /* Activate write through the buffer. */ + f->wpos = f->wbase = f->buf; + f->wend = f->buf + f->buf_size; + + return 0; +} \ No newline at end of file diff --git a/Ubiquitous/XiZi/lib/musllib/src/stdio/__uflow.c b/Ubiquitous/XiZi/lib/musllib/src/stdio/__uflow.c new file mode 100644 index 000000000..2a88bca6b --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/stdio/__uflow.c @@ -0,0 +1,11 @@ +#include "stdio_impl.h" + +/* This function assumes it will never be called if there is already + * data buffered for reading. */ + +int __uflow(FILE *f) +{ + unsigned char c; + if (!__toread(f) && f->read(f, &c, 1)==1) return c; + return EOF; +} diff --git a/Ubiquitous/XiZi/lib/musllib/src/stdio/clearerr.c b/Ubiquitous/XiZi/lib/musllib/src/stdio/clearerr.c new file mode 100644 index 000000000..3bf94d307 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/stdio/clearerr.c @@ -0,0 +1,10 @@ +#include "stdio_impl.h" + +void clearerr(FILE *f) +{ + FLOCK(f); + f->flags &= ~(F_EOF|F_ERR); + FUNLOCK(f); +} + +weak_alias(clearerr, clearerr_unlocked); diff --git a/Ubiquitous/XiZi/lib/musllib/src/stdio/fclose.c b/Ubiquitous/XiZi/lib/musllib/src/stdio/fclose.c new file mode 100644 index 000000000..9569c8ffe --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/stdio/fclose.c @@ -0,0 +1,45 @@ +#include "stdio_impl.h" +#include + +static void dummy(FILE *f) { } +weak_alias(dummy, __unlist_locked_file); + +int __fclose(FILE *f) +{ + int r; + + FLOCK(f); + r = fflush(f); + r |= f->close(f); + FUNLOCK(f); + + /* Past this point, f is closed and any further explict access + * to it is undefined. However, it still exists as an entry in + * the open file list and possibly in the thread's locked files + * list, if it was closed while explicitly locked. Functions + * which process these lists must tolerate dead FILE objects + * (which necessarily have inactive buffer pointers) without + * producing any side effects. */ + + if (f->flags & F_PERM) return r; + + FILE **head = __ofl_lock(); + if (f->prev) f->prev->next = f->next; + if (f->next) f->next->prev = f->prev; + if (*head == f) *head = f->next; + __ofl_unlock(); + + pthread_mutex_destroy(f->lock); + + free(f->getln_buf); + free(f); + + return r; +} +weak_alias(__fclose, fclose); + +int __wrap_fclose(FILE *f) +{ + return __fclose(f); +} + diff --git a/Ubiquitous/XiZi/lib/musllib/src/stdio/feof.c b/Ubiquitous/XiZi/lib/musllib/src/stdio/feof.c new file mode 100644 index 000000000..56da6b917 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/stdio/feof.c @@ -0,0 +1,14 @@ +#include "stdio_impl.h" + +#undef feof + +int feof(FILE *f) +{ + FLOCK(f); + int ret = !!(f->flags & F_EOF); + FUNLOCK(f); + return ret; +} + +weak_alias(feof, feof_unlocked); +weak_alias(feof, _IO_feof_unlocked); diff --git a/Ubiquitous/XiZi/lib/musllib/src/stdio/fflush.c b/Ubiquitous/XiZi/lib/musllib/src/stdio/fflush.c new file mode 100644 index 000000000..a49a71477 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/stdio/fflush.c @@ -0,0 +1,55 @@ +#include "stdio_impl.h" +#include + +/* stdout.c will override this if linked */ +static FILE *volatile dummy = 0; +weak_alias(dummy, __stdout_used); +weak_alias(dummy, __stderr_used); + +int __fflush(FILE *f) +{ + if (!f) { + int r = 0; + if (__stdout_used) r |= __fflush(__stdout_used); + if (__stderr_used) r |= __fflush(__stderr_used); + + for (f=*__ofl_lock(); f; f=f->next) { + FLOCK(f); + if (f->wpos != f->wbase) r |= __fflush(f); + FUNLOCK(f); + } + __ofl_unlock(); + + return r; + } + + FLOCK(f); + + /* If writing, flush output */ + if (f->wpos != f->wbase) { + f->write(f, 0, 0); + if (!f->wpos) { + FUNLOCK(f); + return EOF; + } + } + + /* If reading, sync position, per POSIX */ + if (f->rpos != f->rend) lseek(f->fd, f->rpos-f->rend, SEEK_CUR); + + /* Clear read and write modes */ + f->wpos = f->wbase = f->wend = 0; + f->rpos = f->rend = 0; + + FUNLOCK(f); + return 0; +} + +weak_alias(fflush, fflush_unlocked); +weak_alias(__fflush, fflush); + +int __wrap_fflush(FILE *f) +{ + return __fflush(f); +} + diff --git a/Ubiquitous/XiZi/lib/musllib/src/stdio/fgetc.c b/Ubiquitous/XiZi/lib/musllib/src/stdio/fgetc.c new file mode 100644 index 000000000..2578afccd --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/stdio/fgetc.c @@ -0,0 +1,7 @@ +#include +#include "getc.h" + +int fgetc(FILE *f) +{ + return do_getc(f); +} diff --git a/Ubiquitous/XiZi/lib/musllib/src/stdio/fgets.c b/Ubiquitous/XiZi/lib/musllib/src/stdio/fgets.c new file mode 100644 index 000000000..d1109e757 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/stdio/fgets.c @@ -0,0 +1,46 @@ +#include "stdio_impl.h" +#include + +#define MIN(a,b) ((a)<(b) ? (a) : (b)) + +char *fgets(char *restrict s, int n, FILE *restrict f) +{ + char *p = s; + unsigned char *z; + size_t k; + int c; + + FLOCK(f); + + if (n--<=1) { + f->mode |= f->mode-1; + FUNLOCK(f); + if (n) return 0; + *s = 0; + return s; + } + + while (n) { + if (f->rpos != f->rend) { + z = memchr(f->rpos, '\n', f->rend - f->rpos); + k = z ? z - f->rpos + 1 : f->rend - f->rpos; + k = MIN(k, (size_t)n); + memcpy(p, f->rpos, k); + f->rpos += k; + p += k; + n -= k; + if (z || !n) break; + } + if ((c = getc_unlocked(f)) < 0) { + if (p==s || !feof(f)) s = 0; + break; + } + n--; + if ((*p++ = c) == '\n') break; + } + if (s) *p = 0; + + FUNLOCK(f); + + return s; +} \ No newline at end of file diff --git a/Ubiquitous/XiZi/lib/musllib/src/stdio/fileno.c b/Ubiquitous/XiZi/lib/musllib/src/stdio/fileno.c new file mode 100644 index 000000000..e6e669081 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/stdio/fileno.c @@ -0,0 +1,14 @@ +#include "stdio_impl.h" +#include + +int fileno(FILE *f) +{ + FLOCK(f); + int fd = f->fd; + FUNLOCK(f); + if (fd < 0) { + errno = EBADF; + return -1; + } + return fd; +} \ No newline at end of file diff --git a/Ubiquitous/XiZi/lib/musllib/src/stdio/fopen.c b/Ubiquitous/XiZi/lib/musllib/src/stdio/fopen.c new file mode 100644 index 000000000..9387a58f6 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/stdio/fopen.c @@ -0,0 +1,42 @@ +#include "stdio_impl.h" +#include +#include +#include +#include +#include + +FILE *fopen(const char *restrict filename, const char *restrict mode) +{ + FILE *f; + int fd; + int flags; + + /* Check for valid initial mode character */ + if ((mode == NULL) || (!strchr("rwa", *mode))) { + errno = EINVAL; + return 0; + } + + /* Compute the flags to pass to open() */ + flags = __fmodeflags(mode); + + fd = open(filename, flags, 0666); + if (fd < 0) return 0; + // if (flags & O_CLOEXEC) + // fcntl(fd, F_SETFD, FD_CLOEXEC); + +#if !defined(__LP64__) + if (fd > SHRT_MAX) { + errno = EMFILE; + return 0; + } +#endif + + f = __fdopen(fd, mode); + if (f) return f; + + close(fd); + return 0; +} + +weak_alias(fopen, fopen64); diff --git a/Ubiquitous/XiZi/lib/musllib/src/stdio/fputc.c b/Ubiquitous/XiZi/lib/musllib/src/stdio/fputc.c new file mode 100644 index 000000000..f364ed38b --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/stdio/fputc.c @@ -0,0 +1,7 @@ +#include +#include "putc.h" + +int fputc(int c, FILE *f) +{ + return do_putc(c, f); +} diff --git a/Ubiquitous/XiZi/lib/musllib/src/stdio/fputs.c b/Ubiquitous/XiZi/lib/musllib/src/stdio/fputs.c new file mode 100644 index 000000000..1cf344f28 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/stdio/fputs.c @@ -0,0 +1,10 @@ +#include "stdio_impl.h" +#include + +int fputs(const char *restrict s, FILE *restrict f) +{ + size_t l = strlen(s); + return (fwrite(s, 1, l, f)==l) - 1; +} + +weak_alias(fputs, fputs_unlocked); diff --git a/Ubiquitous/XiZi/lib/musllib/src/stdio/fread.c b/Ubiquitous/XiZi/lib/musllib/src/stdio/fread.c new file mode 100644 index 000000000..a2116da61 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/stdio/fread.c @@ -0,0 +1,38 @@ +#include "stdio_impl.h" +#include + +#define MIN(a,b) ((a)<(b) ? (a) : (b)) + +size_t fread(void *restrict destv, size_t size, size_t nmemb, FILE *restrict f) +{ + unsigned char *dest = destv; + size_t len = size*nmemb, l = len, k; + if (!size) nmemb = 0; + + FLOCK(f); + + f->mode |= f->mode-1; + + if (f->rpos != f->rend) { + /* First exhaust the buffer. */ + k = MIN(f->rend - f->rpos, l); + memcpy(dest, f->rpos, k); + f->rpos += k; + dest += k; + l -= k; + } + + /* Read the remainder directly */ + for (; l; l-=k, dest+=k) { + k = __toread(f) ? 0 : f->read(f, dest, l); + if (!k) { + FUNLOCK(f); + return (len-l)/size; + } + } + + FUNLOCK(f); + return nmemb; +} + +weak_alias(fread, fread_unlocked); diff --git a/Ubiquitous/XiZi/lib/musllib/src/stdio/fseek.c b/Ubiquitous/XiZi/lib/musllib/src/stdio/fseek.c new file mode 100644 index 000000000..a4793644d --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/stdio/fseek.c @@ -0,0 +1,42 @@ +#include "stdio_impl.h" +#include + +int __fseeko_unlocked(FILE* f, off_t off, int whence) +{ + /* Adjust relative offset for unread data in buffer, if any. */ + if (whence == SEEK_CUR && f->rend) off -= f->rend - f->rpos; + + /* Flush write buffer, and report error on failure. */ + if (f->wpos != f->wbase) { + f->write(f, 0, 0); + if (!f->wpos) return -1; + } + + /* Leave writing mode */ + f->wpos = f->wbase = f->wend = 0; + + /* Perform the underlying seek. */ + if (lseek(f->fd, off, whence) < 0) return -1; + + /* If seek succeeded, file is seekable and we discard read buffer. */ + f->rpos = f->rend = 0; + f->flags &= ~F_EOF; + + return 0; +} + +int __fseeko(FILE *f, off_t off, int whence) +{ + int result; + FLOCK(f); + result = __fseeko_unlocked(f, off, whence); + FUNLOCK(f); + return result; +} + +int fseek(FILE *f, long off, int whence) +{ + return __fseeko(f, off, whence); +} + +weak_alias(__fseeko, fseeko); diff --git a/Ubiquitous/XiZi/lib/musllib/src/stdio/ftell.c b/Ubiquitous/XiZi/lib/musllib/src/stdio/ftell.c new file mode 100644 index 000000000..f94435af5 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/stdio/ftell.c @@ -0,0 +1,40 @@ +#include "stdio_impl.h" +#include +#include +#include + +off_t __ftello_unlocked(FILE *f) +{ + off_t pos = lseek(f->fd, (off_t)0, + (f->flags & F_APP) && f->wpos != f->wbase + ? SEEK_END : SEEK_CUR); + if (pos < 0) return pos; + + /* Adjust for data in buffer. */ + if (f->rend) + pos += f->rpos - f->rend; + else if (f->wbase) + pos += f->wpos - f->wbase; + return pos; +} + +off_t __ftello(FILE *f) +{ + off_t pos; + FLOCK(f); + pos = __ftello_unlocked(f); + FUNLOCK(f); + return pos; +} + +long ftell(FILE *f) +{ + off_t pos = __ftello(f); + if (pos > LONG_MAX) { + errno = EOVERFLOW; + return -1; + } + return pos; +} + +weak_alias(__ftello, ftello); diff --git a/Ubiquitous/XiZi/lib/musllib/src/stdio/fwrite.c b/Ubiquitous/XiZi/lib/musllib/src/stdio/fwrite.c new file mode 100644 index 000000000..274169315 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/stdio/fwrite.c @@ -0,0 +1,37 @@ +#include "stdio_impl.h" +#include + +size_t __fwritex(const unsigned char *restrict s, size_t l, FILE *restrict f) +{ + size_t i = 0; + if (!f->wend && __towrite(f)) return 0; + + if (l > f->wend - f->wpos) return f->write(f, s, l); + + if (f->lbf >= 0) { + /* Match /^(.*\n|)/ */ + for (i=l; i && s[i-1] != '\n'; i--); + if (i) { + size_t n = f->write(f, s, i); + if (n < i) return n; + s += i; + l -= i; + } + } + + memcpy(f->wpos, s, l); + f->wpos += l; + return l+i; +} + +size_t fwrite(const void *restrict src, size_t size, size_t nmemb, FILE *restrict f) +{ + size_t k, l = size*nmemb; + if (!size) nmemb = 0; + FLOCK(f); + k = __fwritex(src, l, f); + FUNLOCK(f); + return k==l ? nmemb : k/size; +} + +weak_alias(fwrite, fwrite_unlocked); diff --git a/Ubiquitous/XiZi/lib/musllib/src/stdio/getc.h b/Ubiquitous/XiZi/lib/musllib/src/stdio/getc.h new file mode 100644 index 000000000..9a40e6588 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/stdio/getc.h @@ -0,0 +1,18 @@ +#include "stdio_impl.h" +#include "pthread_impl.h" + +#ifdef __GNUC__ +__attribute__((__noinline__)) +#endif +static int locking_getc(FILE *f) +{ + FLOCK(f); + int c = getc_unlocked(f); + FUNLOCK(f); + return c; +} + +static inline int do_getc(FILE *f) +{ + return locking_getc(f); +} \ No newline at end of file diff --git a/Ubiquitous/XiZi/lib/musllib/src/stdio/ofl.c b/Ubiquitous/XiZi/lib/musllib/src/stdio/ofl.c new file mode 100644 index 000000000..4dc74ce9e --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/stdio/ofl.c @@ -0,0 +1,28 @@ +#include "stdio_impl.h" +#include + +static FILE *ofl_head; + +static pthread_mutex_t locallock = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP; + +static int LOCK(void) +{ + return pthread_mutex_lock(&locallock); +} + +static void UNLOCK(void) +{ + (void)pthread_mutex_unlock(&locallock); +} + + +FILE **__ofl_lock() +{ + LOCK(); + return &ofl_head; +} + +void __ofl_unlock() +{ + UNLOCK(); +} diff --git a/Ubiquitous/XiZi/lib/musllib/src/stdio/ofl_add.c b/Ubiquitous/XiZi/lib/musllib/src/stdio/ofl_add.c new file mode 100644 index 000000000..d7de9f15a --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/stdio/ofl_add.c @@ -0,0 +1,11 @@ +#include "stdio_impl.h" + +FILE *__ofl_add(FILE *f) +{ + FILE **head = __ofl_lock(); + f->next = *head; + if (*head) (*head)->prev = f; + *head = f; + __ofl_unlock(); + return f; +} diff --git a/Ubiquitous/XiZi/lib/musllib/src/stdio/perror.c b/Ubiquitous/XiZi/lib/musllib/src/stdio/perror.c new file mode 100644 index 000000000..03ffeab8d --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/stdio/perror.c @@ -0,0 +1,30 @@ +#include +#include +#include +#include "stdio_impl.h" + +void perror(const char *msg) +{ + FILE *f = stderr; + char *errstr = strerror(errno); + + FLOCK(f); + + /* Save stderr's orientation and encoding rule, since perror is not + * permitted to change them. */ + void *old_locale = f->locale; + int old_mode = f->mode; + + if (msg && *msg) { + fwrite(msg, strlen(msg), 1, f); + fputc(':', f); + fputc(' ', f); + } + fwrite(errstr, strlen(errstr), 1, f); + fputc('\n', f); + + f->mode = old_mode; + f->locale = old_locale; + + FUNLOCK(f); +} diff --git a/Ubiquitous/XiZi/lib/musllib/src/stdio/printf.c b/Ubiquitous/XiZi/lib/musllib/src/stdio/printf.c new file mode 100644 index 000000000..147950b3b --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/stdio/printf.c @@ -0,0 +1,14 @@ +#include +#include + +#include + +int printf(const char *restrict fmt, ...) +{ + int ret; + va_list ap; + va_start(ap, fmt); + ret = vfprintf(stdout, fmt, ap); + va_end(ap); + return ret; +} diff --git a/Ubiquitous/XiZi/lib/musllib/src/stdio/putc.h b/Ubiquitous/XiZi/lib/musllib/src/stdio/putc.h new file mode 100644 index 000000000..332495a13 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/stdio/putc.h @@ -0,0 +1,18 @@ +#include "stdio_impl.h" +#include "pthread_impl.h" + +#ifdef __GNUC__ +__attribute__((__noinline__)) +#endif +static int locking_putc(int c, FILE *f) +{ + FLOCK(f); + c = putc_unlocked(c, f); + FUNLOCK(f); + return c; +} + +static inline int do_putc(int c, FILE *f) +{ + return locking_putc(c, f); +} diff --git a/Ubiquitous/XiZi/lib/musllib/src/stdio/putchar.c b/Ubiquitous/XiZi/lib/musllib/src/stdio/putchar.c new file mode 100644 index 000000000..f044f1697 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/stdio/putchar.c @@ -0,0 +1,7 @@ +#include +#include "putc.h" + +int putchar(int c) +{ + return do_putc(c, stdout); +} diff --git a/Ubiquitous/XiZi/lib/musllib/src/stdio/puts.c b/Ubiquitous/XiZi/lib/musllib/src/stdio/puts.c new file mode 100644 index 000000000..5a38a49b9 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/stdio/puts.c @@ -0,0 +1,10 @@ +#include "stdio_impl.h" + +int puts(const char *s) +{ + int r; + FLOCK(stdout); + r = -(fputs(s, stdout) < 0 || putc_unlocked('\n', stdout) < 0); + FUNLOCK(stdout); + return r; +} diff --git a/Ubiquitous/XiZi/lib/musllib/src/stdio/remove.c b/Ubiquitous/XiZi/lib/musllib/src/stdio/remove.c new file mode 100644 index 000000000..84549a560 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/stdio/remove.c @@ -0,0 +1,11 @@ +#include +#include +#include +#include + +int remove(const char *path) +{ + int r = unlink(path); + if (r==-EISDIR) r = rmdir(path); + return r; +} diff --git a/Ubiquitous/XiZi/lib/musllib/src/stdio/rewind.c b/Ubiquitous/XiZi/lib/musllib/src/stdio/rewind.c new file mode 100644 index 000000000..6387b9959 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/stdio/rewind.c @@ -0,0 +1,9 @@ +#include "stdio_impl.h" + +void rewind(FILE *f) +{ + FLOCK(f); + __fseeko_unlocked(f, 0, SEEK_SET); + f->flags &= ~F_ERR; + FUNLOCK(f); +} diff --git a/Ubiquitous/XiZi/lib/musllib/src/stdio/setvbuf.c b/Ubiquitous/XiZi/lib/musllib/src/stdio/setvbuf.c new file mode 100644 index 000000000..523dddc8b --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/stdio/setvbuf.c @@ -0,0 +1,29 @@ +#include "stdio_impl.h" + +/* The behavior of this function is undefined except when it is the first + * operation on the stream, so the presence or absence of locking is not + * observable in a program whose behavior is defined. Thus no locking is + * performed here. No allocation of buffers is performed, but a buffer + * provided by the caller is used as long as it is suitably sized. */ + +int setvbuf(FILE *restrict f, char *restrict buf, int type, size_t size) +{ + f->lbf = EOF; + + if (type == _IONBF) { + f->buf_size = 0; + } else if (type == _IOLBF || type == _IOFBF) { + if (buf && size >= UNGET) { + f->buf = (void *)(buf + UNGET); + f->buf_size = size - UNGET; + } + if (type == _IOLBF && f->buf_size) + f->lbf = '\n'; + } else { + return -1; + } + + f->flags |= F_SVB; + + return 0; +} diff --git a/Ubiquitous/XiZi/lib/musllib/src/stdio/snprintf.c b/Ubiquitous/XiZi/lib/musllib/src/stdio/snprintf.c new file mode 100644 index 000000000..771503b28 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/stdio/snprintf.c @@ -0,0 +1,13 @@ +#include +#include + +int snprintf(char *restrict s, size_t n, const char *restrict fmt, ...) +{ + int ret; + va_list ap; + va_start(ap, fmt); + ret = vsnprintf(s, n, fmt, ap); + va_end(ap); + return ret; +} + diff --git a/Ubiquitous/XiZi/lib/musllib/src/stdio/sprintf.c b/Ubiquitous/XiZi/lib/musllib/src/stdio/sprintf.c new file mode 100644 index 000000000..9dff524c0 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/stdio/sprintf.c @@ -0,0 +1,12 @@ +#include +#include + +int sprintf(char *restrict s, const char *restrict fmt, ...) +{ + int ret; + va_list ap; + va_start(ap, fmt); + ret = vsprintf(s, fmt, ap); + va_end(ap); + return ret; +} diff --git a/Ubiquitous/XiZi/lib/musllib/src/stdio/sscanf.c b/Ubiquitous/XiZi/lib/musllib/src/stdio/sscanf.c new file mode 100644 index 000000000..f2ac2f5da --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/stdio/sscanf.c @@ -0,0 +1,14 @@ +#include +#include + +int sscanf(const char *restrict s, const char *restrict fmt, ...) +{ + int ret; + va_list ap; + va_start(ap, fmt); + ret = vsscanf(s, fmt, ap); + va_end(ap); + return ret; +} + +weak_alias(sscanf,__isoc99_sscanf); diff --git a/Ubiquitous/XiZi/lib/musllib/src/stdio/stderr.c b/Ubiquitous/XiZi/lib/musllib/src/stdio/stderr.c new file mode 100644 index 000000000..008ab0105 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/stdio/stderr.c @@ -0,0 +1,20 @@ +#include "stdio_impl.h" +#include + +#undef stderr + +static pthread_mutex_t locallock = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP; +static unsigned char buf[UNGET]; +hidden FILE __stderr_FILE = { + .buf = buf+UNGET, + .buf_size = 0, + .fd = 2, + .flags = F_PERM | F_NORD, + .lbf = -1, + .write = __stdio_write, + .seek = __stdio_seek, + .close = __stdio_close, + .lock = &locallock, +}; +FILE *const stderr = &__stderr_FILE; +FILE *volatile __stderr_used = &__stderr_FILE; diff --git a/Ubiquitous/XiZi/lib/musllib/src/stdio/stdin.c b/Ubiquitous/XiZi/lib/musllib/src/stdio/stdin.c new file mode 100644 index 000000000..de344ff93 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/stdio/stdin.c @@ -0,0 +1,17 @@ +#include "stdio_impl.h" + +#undef stdin + +static unsigned char buf[BUFSIZ+UNGET]; +hidden FILE __stdin_FILE = { + .buf = buf+UNGET, + .buf_size = sizeof buf-UNGET, + .fd = 0, + .flags = F_PERM | F_NOWR, + .read = __stdio_read, + .seek = __stdio_seek, + .close = __stdio_close, + .lock = NULL, +}; +FILE *const stdin = &__stdin_FILE; +FILE *volatile __stdin_used = &__stdin_FILE; diff --git a/Ubiquitous/XiZi/lib/musllib/src/stdio/stdio.c b/Ubiquitous/XiZi/lib/musllib/src/stdio/stdio.c new file mode 100644 index 000000000..c27ba8253 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/stdio/stdio.c @@ -0,0 +1,156 @@ +/* + * Copyright (c) 2006-2018, RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2017/10/15 bernard the first version + */ + +/** +* @file stdio.c +* @brief support newlib stdio +* @version 1.0 +* @author AIIT XUOS Lab +* @date 2020-09-23 +*/ + +/************************************************* +File name: stdio.c +Description: +Others: take RT-Thread v4.0.2/components/libc/compilers/newlib/stdio.c for references + https://github.com/RT-Thread/rt-thread/tree/v4.0.2 +History: +1. Date: 2020-09-23 +Author: AIIT XUOS Lab +Modification: Use set and get console functions +*************************************************/ + +#include +#include +#include +#include + +#define STDIO_DEVICE_NAME_MAX 32 + +static FILE* std_console = NULL; + +/** + * This function will set system console device. + * + * @param device_name the name of device + * @param mode the mode + * + * @return file number on success; or -1 on failure + */ +int LibcStdioSetConsole(const char* device_name, int mode) +{ + FILE *fp; + char name[STDIO_DEVICE_NAME_MAX] = {0}; + char *file_mode; + + snprintf(name, strlen(device_name) + 6, "/dev/%s", device_name); + name[STDIO_DEVICE_NAME_MAX - 1] = '\0'; + + switch (mode) + { + case O_RDWR: + file_mode = "r+"; + break; + + case O_WRONLY: + file_mode = "wb"; + break; + + default: + file_mode = "rb"; + break; + } + + /* try to open file */ + fp = fopen(name, file_mode); + if (fp) + { + /* set the fp buffer */ + setvbuf(fp, NULL, _IONBF, 0); + + if (std_console) + /* try to close console device */ + fclose(std_console); + std_console = fp; + + // if (mode == O_RDWR) + // { + // /* set _stdin as std_console */ + // _GLOBAL_REENT->_stdin = std_console; + // } + // else + // { + // /* set NULL */ + // _GLOBAL_REENT->_stdin = NULL; + // } + + // if (mode == O_RDONLY) + // { + // /* set the _stdout as NULL */ + // _GLOBAL_REENT->_stdout = NULL; + // /* set the _stderr as NULL */ + // _GLOBAL_REENT->_stderr = NULL; + // } + // else + // { + // /* set the _stdout as std_console */ + // _GLOBAL_REENT->_stdout = std_console; + // /* set the _stderr as std_console */ + // _GLOBAL_REENT->_stderr = std_console; + // } + // /* set the __sdidinit as 1 */ + // _GLOBAL_REENT->__sdidinit = 1; + } + + if (std_console) + /* return the file number */ + return fileno(std_console); + /* failure and return -1 */ + return -1; +} + +/** + * This function will get system console device. + * + * @return file number on success; or -1 on failure + */ +int LibcStdioGetConsole(void) { + if (std_console) + /* return the file number */ + return fileno(std_console); + else + /* failure and return -1 */ + return -1; +} + +/** + * This function will initialize the c library system. + * + * @return 0 + */ +int LibcSystemInit(void) +{ +#if defined(KERNEL_CONSOLE) + HardwareDevType console; + /* try to get console device */ + console = ObtainConsole(); + if (console) + { +#if defined(LIB_POSIX) + /* set console device mode */ + LibcStdioSetConsole(console->dev_name, O_RDWR); +#else + /* set console device mode */ + LibcStdioSetConsole(console->dev_name, O_WRONLY); +#endif + } +#endif + return 0; +} diff --git a/Ubiquitous/XiZi/lib/musllib/src/stdio/stdout.c b/Ubiquitous/XiZi/lib/musllib/src/stdio/stdout.c new file mode 100644 index 000000000..226fffceb --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/stdio/stdout.c @@ -0,0 +1,20 @@ +#include "stdio_impl.h" +#include + +#undef stdout + +static pthread_mutex_t locallock = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP; +static unsigned char buf[BUFSIZ+UNGET]; +hidden FILE __stdout_FILE = { + .buf = buf+UNGET, + .buf_size = sizeof buf-UNGET, + .fd = 1, + .flags = F_PERM | F_NORD, + .lbf = '\n', + .write = __stdout_write, + .seek = __stdio_seek, + .close = __stdio_close, + .lock = &locallock, +}; +FILE *const stdout = &__stdout_FILE; +FILE *volatile __stdout_used = &__stdout_FILE; diff --git a/Ubiquitous/XiZi/lib/musllib/src/stdio/ungetc.c b/Ubiquitous/XiZi/lib/musllib/src/stdio/ungetc.c new file mode 100644 index 000000000..180673a47 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/stdio/ungetc.c @@ -0,0 +1,20 @@ +#include "stdio_impl.h" + +int ungetc(int c, FILE *f) +{ + if (c == EOF) return c; + + FLOCK(f); + + if (!f->rpos) __toread(f); + if (!f->rpos || f->rpos <= f->buf - UNGET) { + FUNLOCK(f); + return EOF; + } + + *--f->rpos = c; + f->flags &= ~F_EOF; + + FUNLOCK(f); + return c; +} diff --git a/Ubiquitous/XiZi/lib/musllib/src/stdio/vfprintf.c b/Ubiquitous/XiZi/lib/musllib/src/stdio/vfprintf.c new file mode 100644 index 000000000..69bcfa655 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/stdio/vfprintf.c @@ -0,0 +1,712 @@ +#include "stdio_impl.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* Some useful macros */ + +#define MAX(a,b) ((a)>(b) ? (a) : (b)) +#define MIN(a,b) ((a)<(b) ? (a) : (b)) + +/* Convenient bit representation for modifier flags, which all fall + * within 31 codepoints of the space character. */ + +#define ALT_FORM (1U<<('#'-' ')) +#define ZERO_PAD (1U<<('0'-' ')) +#define LEFT_ADJ (1U<<('-'-' ')) +#define PAD_POS (1U<<(' '-' ')) +#define MARK_POS (1U<<('+'-' ')) +#define GROUPED (1U<<('\''-' ')) + +#define FLAGMASK (ALT_FORM|ZERO_PAD|LEFT_ADJ|PAD_POS|MARK_POS|GROUPED) + +/* introduced in by limit.h to avoid conflicts with the following enum definition. */ +#define CHAR _CHAR + +/* State machine to accept length modifiers + conversion specifiers. + * Result is 0 on failure, or an argument type to pop on success. */ + +enum { + BARE, LPRE, LLPRE, HPRE, HHPRE, BIGLPRE, + ZTPRE, JPRE, + STOP, + PTR, INT, UINT, ULLONG, + LONG, ULONG, + SHORT, USHORT, CHAR, UCHAR, + LLONG, SIZET, IMAX, UMAX, PDIFF, UIPTR, + DBL, LDBL, + NOARG, + MAXSTATE +}; + +#define S(x) [(x)-'A'] + +static const unsigned char states[]['z'-'A'+1] = { + { /* 0: bare types */ + S('d') = INT, S('i') = INT, + S('o') = UINT, S('u') = UINT, S('x') = UINT, S('X') = UINT, + S('e') = DBL, S('f') = DBL, S('g') = DBL, S('a') = DBL, + S('E') = DBL, S('F') = DBL, S('G') = DBL, S('A') = DBL, + S('c') = CHAR, S('C') = INT, + S('s') = PTR, S('S') = PTR, S('p') = UIPTR, S('n') = PTR, + S('m') = NOARG, + S('l') = LPRE, S('h') = HPRE, S('L') = BIGLPRE, + S('z') = ZTPRE, S('j') = JPRE, S('t') = ZTPRE, + }, { /* 1: l-prefixed */ + S('d') = LONG, S('i') = LONG, + S('o') = ULONG, S('u') = ULONG, S('x') = ULONG, S('X') = ULONG, + S('e') = DBL, S('f') = DBL, S('g') = DBL, S('a') = DBL, + S('E') = DBL, S('F') = DBL, S('G') = DBL, S('A') = DBL, + S('c') = INT, S('s') = PTR, S('n') = PTR, + S('l') = LLPRE, + }, { /* 2: ll-prefixed */ + S('d') = LLONG, S('i') = LLONG, + S('o') = ULLONG, S('u') = ULLONG, + S('x') = ULLONG, S('X') = ULLONG, + S('n') = PTR, + }, { /* 3: h-prefixed */ + S('d') = SHORT, S('i') = SHORT, + S('o') = USHORT, S('u') = USHORT, + S('x') = USHORT, S('X') = USHORT, + S('n') = PTR, + S('h') = HHPRE, + }, { /* 4: hh-prefixed */ + S('d') = CHAR, S('i') = CHAR, + S('o') = UCHAR, S('u') = UCHAR, + S('x') = UCHAR, S('X') = UCHAR, + S('n') = PTR, + }, { /* 5: L-prefixed */ + S('e') = LDBL, S('f') = LDBL, S('g') = LDBL, S('a') = LDBL, + S('E') = LDBL, S('F') = LDBL, S('G') = LDBL, S('A') = LDBL, + S('n') = PTR, + }, { /* 6: z- or t-prefixed (assumed to be same size) */ + S('d') = PDIFF, S('i') = PDIFF, + S('o') = SIZET, S('u') = SIZET, + S('x') = SIZET, S('X') = SIZET, + S('n') = PTR, + }, { /* 7: j-prefixed */ + S('d') = IMAX, S('i') = IMAX, + S('o') = UMAX, S('u') = UMAX, + S('x') = UMAX, S('X') = UMAX, + S('n') = PTR, + } +}; + +#define OOB(x) ((unsigned)(x)-'A' > 'z'-'A') + +union arg +{ + uintmax_t i; + long double f; + void *p; +}; + +static void pop_arg(union arg *arg, int type, va_list *ap) +{ + switch (type) { + case PTR: arg->p = va_arg(*ap, void *); + break; case INT: arg->i = va_arg(*ap, int); + break; case UINT: arg->i = va_arg(*ap, unsigned int); + break; case LONG: arg->i = va_arg(*ap, long); + break; case ULONG: arg->i = va_arg(*ap, unsigned long); + break; case ULLONG: arg->i = va_arg(*ap, unsigned long long); + break; case SHORT: arg->i = (short)va_arg(*ap, int); + break; case USHORT: arg->i = (unsigned short)va_arg(*ap, int); + break; case CHAR: arg->i = (signed char)va_arg(*ap, int); + break; case UCHAR: arg->i = (unsigned char)va_arg(*ap, int); + break; case LLONG: arg->i = va_arg(*ap, long long); + break; case SIZET: arg->i = va_arg(*ap, size_t); + break; case IMAX: arg->i = va_arg(*ap, intmax_t); + break; case UMAX: arg->i = va_arg(*ap, uintmax_t); + break; case PDIFF: arg->i = va_arg(*ap, ptrdiff_t); + break; case UIPTR: arg->i = (uintptr_t)va_arg(*ap, void *); + break; case DBL: arg->f = va_arg(*ap, double); + break; case LDBL: arg->f = va_arg(*ap, long double); + } +} + +static void out(FILE *f, const char *s, size_t l) +{ + if (!(f->flags & F_ERR)) __fwritex((void*)s, l, f); +} + +static void pad(FILE *f, char c, int w, int l, int fl) +{ + char pad[256]; + if (fl & (LEFT_ADJ | ZERO_PAD) || l >= w) return; + l = w - l; + memset(pad, c, l>sizeof pad ? sizeof pad : l); + for (; l >= sizeof pad; l -= sizeof pad) + out(f, pad, sizeof pad); + out(f, pad, l); +} + +static const char xdigits[16] = { + "0123456789ABCDEF" +}; + +static char *fmt_x(uintmax_t x, char *s, int lower) +{ + for (; x; x>>=4) *--s = xdigits[(x&15)]|lower; + return s; +} + +static char *fmt_o(uintmax_t x, char *s) +{ + for (; x; x>>=3) *--s = '0' + (x&7); + return s; +} + +static char *fmt_u(uintmax_t x, char *s) +{ + unsigned long y; + for ( ; x>ULONG_MAX; x/=10) *--s = '0' + x%10; + for (y=x; y; y/=10) *--s = '0' + y%10; + return s; +} + +/* Do not override this check. The floating point printing code below + * depends on the float.h constants being right. If they are wrong, it + * may overflow the stack. */ +#if LDBL_MANT_DIG == 53 +// typedef char compiler_defines_long_double_incorrectly[9-(int)sizeof(long double)]; +#endif + +static int fmt_fp(FILE *f, long double y, int w, int p, int fl, int t) +{ + uint32_t big[(LDBL_MANT_DIG+28)/29 + 1 // mantissa expansion + + (LDBL_MAX_EXP+LDBL_MANT_DIG+28+8)/9]; // exponent expansion + uint32_t *a, *d, *r, *z; + int e2=0, e, i, j, l; + char buf[9+LDBL_MANT_DIG/4], *s; + const char *prefix="-0X+0X 0X-0x+0x 0x"; + int pl; + char ebuf0[3*sizeof(int)], *ebuf=&ebuf0[3*sizeof(int)]; + char *estr = NULL; + + pl=1; + if (signbit(y)) { + y=-y; + } else if (fl & MARK_POS) { + prefix+=3; + } else if (fl & PAD_POS) { + prefix+=6; + } else prefix++, pl=0; + + if (!isfinite(y)) { + char *s = (t&32)?"inf":"INF"; + if (y!=y) s=(t&32)?"nan":"NAN"; + pad(f, ' ', w, 3+pl, fl&~ZERO_PAD); + out(f, prefix, pl); + out(f, s, 3); + pad(f, ' ', w, 3+pl, fl^LEFT_ADJ); + return MAX(w, 3+pl); + } + + y = frexpl(y, &e2) * 2; + if (y) e2--; + + if ((t|32)=='a') { + long double round = 8.0; + int re; + + if (t&32) prefix += 9; + pl += 2; + + if (p<0 || p>=LDBL_MANT_DIG/4-1) re=0; + else re=LDBL_MANT_DIG/4-1-p; + + if (re) { + round *= 1<<(LDBL_MANT_DIG%4); + while (re--) round*=16; + if (*prefix=='-') { + y=-y; + y-=round; + y+=round; + y=-y; + } else { + y+=round; + y-=round; + } + } + + estr=fmt_u(e2<0 ? -e2 : e2, ebuf); + if (estr==ebuf) *--estr='0'; + *--estr = (e2<0 ? '-' : '+'); + *--estr = t+('p'-'a'); + + s=buf; + do { + int x=y; + *s++=xdigits[x]|(t&32); + y=16*(y-x); + if (s-buf==1 && (y||p>0||(fl&ALT_FORM))) *s++='.'; + } while (y); + + if (p > INT_MAX-2-(ebuf-estr)-pl) + return -1; + if (p && s-buf-2 < p) + l = (p+2) + (ebuf-estr); + else + l = (s-buf) + (ebuf-estr); + + pad(f, ' ', w, pl+l, fl); + out(f, prefix, pl); + pad(f, '0', w, pl+l, fl^ZERO_PAD); + out(f, buf, s-buf); + pad(f, '0', l-(ebuf-estr)-(s-buf), 0, 0); + out(f, estr, ebuf-estr); + pad(f, ' ', w, pl+l, fl^LEFT_ADJ); + return MAX(w, pl+l); + } + if (p<0) p=6; + + if (y) y *= 0x1p28, e2-=28; + + if (e2<0) a=r=z=big; + else a=r=z=big+sizeof(big)/sizeof(*big) - LDBL_MANT_DIG - 1; + + do { + *z = y; + y = 1000000000*(y-*z++); + } while (y); + + while (e2>0) { + uint32_t carry=0; + int sh=MIN(29,e2); + for (d=z-1; d>=a; d--) { + uint64_t x = ((uint64_t)*d<a && !z[-1]) z--; + e2-=sh; + } + while (e2<0) { + uint32_t carry=0, *b; + int sh=MIN(9,-e2), need=1+(p+LDBL_MANT_DIG/3U+8)/9; + for (d=a; d>sh) + carry; + carry = (1000000000>>sh) * rm; + } + if (!*a) a++; + if (carry) *z++ = carry; + /* Avoid (slow!) computation past requested precision */ + b = (t|32)=='f' ? r : a; + if (z-b > need) z = b+need; + e2+=sh; + } + + if (a=i; i*=10, e++); + else e=0; + + /* Perform rounding: j is precision after the radix (possibly neg) */ + j = p - ((t|32)!='f')*e - ((t|32)=='g' && p); + if (j < 9*(z-r-1)) { + uint32_t x; + /* We avoid C's broken division of negative numbers */ + d = r + 1 + ((j+9*LDBL_MAX_EXP)/9 - LDBL_MAX_EXP); + j += 9*LDBL_MAX_EXP; + j %= 9; + for (i=10, j++; j<9; i*=10, j++); + x = *d % i; + /* Are there any significant digits past j? */ + if (x || d+1!=z) { + long double round = 2/LDBL_EPSILON; + long double small; + if ((*d/i & 1) || (i==1000000000 && d>a && (d[-1]&1))) + round += 2; + if (x 999999999) { + *d--=0; + if (d=i; i*=10, e++); + } + } + if (z>d+1) z=d+1; + } + for (; z>a && !z[-1]; z--); + + if ((t|32)=='g') { + if (!p) p++; + if (p>e && e>=-4) { + t--; + p-=e+1; + } else { + t-=2; + p--; + } + if (!(fl&ALT_FORM)) { + /* Count trailing zeros in last place */ + if (z>a && z[-1]) for (i=10, j=0; z[-1]%i==0; i*=10, j++); + else j=9; + if ((t|32)=='f') + p = MIN(p,MAX(0,9*(z-r-1)-j)); + else + p = MIN(p,MAX(0,9*(z-r-1)+e-j)); + } + } + if (p > INT_MAX-1-(p || (fl&ALT_FORM))) + return -1; + l = 1 + p + (p || (fl&ALT_FORM)); + if ((t|32)=='f') { + if (e > INT_MAX-l) return -1; + if (e>0) l+=e; + } else { + estr=fmt_u(e<0 ? -e : e, ebuf); + while(ebuf-estr<2) *--estr='0'; + *--estr = (e<0 ? '-' : '+'); + *--estr = t; + if (ebuf-estr > INT_MAX-l) return -1; + l += ebuf-estr; + } + + if (l > INT_MAX-pl) return -1; + pad(f, ' ', w, pl+l, fl); + out(f, prefix, pl); + pad(f, '0', w, pl+l, fl^ZERO_PAD); + + if ((t|32)=='f') { + if (a>r) a=r; + for (d=a; d<=r; d++) { + char *s = fmt_u(*d, buf+9); + if (d!=a) while (s>buf) *--s='0'; + else if (s==buf+9) *--s='0'; + out(f, s, buf+9-s); + } + if (p || (fl&ALT_FORM)) out(f, ".", 1); + for (; d0; d++, p-=9) { + char *s = fmt_u(*d, buf+9); + while (s>buf) *--s='0'; + out(f, s, MIN(9,p)); + } + pad(f, '0', p+9, 9, 0); + } else { + if (z<=a) z=a+1; + for (d=a; d=0; d++) { + char *s = fmt_u(*d, buf+9); + if (s==buf+9) *--s='0'; + if (d!=a) while (s>buf) *--s='0'; + else { + out(f, s++, 1); + if (p>0||(fl&ALT_FORM)) out(f, ".", 1); + } + out(f, s, MIN(buf+9-s, p)); + p -= buf+9-s; + } + pad(f, '0', p+18, 18, 0); + out(f, estr, ebuf-estr); + } + + pad(f, ' ', w, pl+l, fl^LEFT_ADJ); + + return MAX(w, pl+l); +} + +static int getint(char** s) { + int i; + for (i=0; isdigit(**s); (*s)++) { + if (i > INT_MAX/10U || **s-'0' > INT_MAX-10*i) i = -1; + else i = 10*i + (**s-'0'); + } + return i; +} + +static int printf_core(FILE *f, const char *fmt, va_list *ap, union arg *nl_arg, int *nl_type) +{ + char* a, * z, * s = (char*)fmt; + unsigned l10n=0, fl; + int w, p, xp; + union arg arg; + int argpos; + unsigned st, ps; + int cnt=0, l=0; + size_t i; + char buf[sizeof(uintmax_t)*3+3+LDBL_MANT_DIG/4]; + const char *prefix; + int t, pl; + wchar_t wc[2], *ws; + char mb[4]; +#ifdef LOSCFG_FS_VFS + struct winsize wsz; + + if (f && (f->write == __stdout_write) && !ioctl(f->fd, TIOCGWINSZ, &wsz)) { + f->lbf = '\n'; + f->write = __stdio_write; + f->wpos = f->wbase = f->buf; + f->wend = f->buf + f->buf_size; + } +#endif + for (;;) { + /* This error is only specified for snprintf, but since it's + * unspecified for other forms, do the same. Stop immediately + * on overflow; otherwise %n could produce wrong results. */ + if (l > INT_MAX - cnt) goto overflow; + + /* Update output count, end loop when fmt is exhausted */ + cnt += l; + if (!*s) break; + + /* Handle literal text and %% format specifiers */ + for (a=s; *s && *s!='%'; s++); + for (z=s; s[0]=='%' && s[1]=='%'; z++, s+=2); + if (z-a > INT_MAX-cnt) goto overflow; + l = z-a; + if (f) out(f, a, l); + if (l) continue; + + if (isdigit(s[1]) && s[2]=='$') { + l10n=1; + argpos = s[1]-'0'; + s+=3; + } else { + argpos = -1; + s++; + } + + /* Read modifier flags */ + for (fl=0; (unsigned)*s-' '<32 && (FLAGMASK&(1U<<(*s-' '))); s++) + fl |= 1U<<(*s-' '); + + /* Read field width */ + if (*s=='*') { + if (isdigit(s[1]) && s[2]=='$') { + l10n=1; + nl_type[s[1]-'0'] = INT; + w = nl_arg[s[1]-'0'].i; + s+=3; + } else if (!l10n) { + w = f ? va_arg(*ap, int) : 0; + s++; + } else goto inval; + if (w<0) fl|=LEFT_ADJ, w=-w; + } else if ((w=getint(&s))<0) goto overflow; + + /* Read precision */ + if (*s=='.' && s[1]=='*') { + if (isdigit(s[2]) && s[3]=='$') { + nl_type[s[2]-'0'] = INT; + p = nl_arg[s[2]-'0'].i; + s+=4; + } else if (!l10n) { + p = f ? va_arg(*ap, int) : 0; + s+=2; + } else goto inval; + xp = (p>=0); + } else if (*s=='.') { + s++; + p = getint(&s); + xp = 1; + } else { + p = -1; + xp = 0; + } + + /* Format specifier state machine */ + st=0; + do { + if (OOB(*s)) goto inval; + ps=st; + st=states[st]S(*s++); + } while (st-1=0) goto inval; + } else { + if (argpos>=0) nl_type[argpos]=st, arg=nl_arg[argpos]; + else if (f) pop_arg(&arg, st, ap); + else return 0; + } + + if (!f) continue; + + z = buf + sizeof(buf); + prefix = "-+ 0X0x"; + pl = 0; + t = s[-1]; + + /* Transform ls,lc -> S,C */ + if (ps && (t&15)==3) t&=~32; + + /* - and 0 flags are mutually exclusive */ + if (fl & LEFT_ADJ) fl &= ~ZERO_PAD; + + switch(t) { + case 'n': + switch(ps) { + case BARE: *(int *)arg.p = cnt; break; + case LPRE: *(long *)arg.p = cnt; break; + case LLPRE: *(long long *)arg.p = cnt; break; + case HPRE: *(unsigned short *)arg.p = cnt; break; + case HHPRE: *(unsigned char *)arg.p = cnt; break; + case ZTPRE: *(size_t *)arg.p = cnt; break; + case JPRE: *(uintmax_t *)arg.p = cnt; break; + } + continue; + case 'p': + p = MAX(p, 2*sizeof(void*)); + t = 'x'; + fl |= ALT_FORM; + case 'x': case 'X': + a = fmt_x(arg.i, z, t&32); + if (arg.i && (fl & ALT_FORM)) prefix+=(t>>4), pl=2; + if (0) { + case 'o': + a = fmt_o(arg.i, z); + if ((fl&ALT_FORM) && pINTMAX_MAX) { + arg.i=-arg.i; + } else if (fl & MARK_POS) { + prefix++; + } else if (fl & PAD_POS) { + prefix+=2; + } else pl=0; + case 'u': + a = fmt_u(arg.i, z); + } + if (xp && p<0) goto overflow; + if (xp) fl &= ~ZERO_PAD; + if (!arg.i && !p) { + a=z; + break; + } + p = MAX(p, z-a + !arg.i); + break; + case 'c': + *(a=z-(p=1))=arg.i; + fl &= ~ZERO_PAD; + break; + case 'm': + if (1) a = strerror(errno); else + case 's': + a = arg.p ? arg.p : "(null)"; + z = a + strnlen(a, p<0 ? INT_MAX : p); + if (p<0 && *z) goto overflow; + p = z-a; + fl &= ~ZERO_PAD; + break; + case 'C': + wc[0] = arg.i; + wc[1] = 0; + arg.p = wc; + p = -1; + case 'S': + ws = arg.p; + for (i=l=0; i

=0 && l<=p-i; i+=l); + if (l<0) return -1; + if (i > INT_MAX) goto overflow; + p = i; + pad(f, ' ', w, p, fl); + ws = arg.p; + for (i=0; i<0U+p && *ws && i+(l=wctomb(mb, *ws++))<=p; i+=l) + out(f, mb, l); + pad(f, ' ', w, p, fl^LEFT_ADJ); + l = w>p ? w : p; + continue; + case 'e': case 'f': case 'g': case 'a': + case 'E': case 'F': case 'G': case 'A': + if (xp && p<0) goto overflow; + l = fmt_fp(f, arg.f, w, p, fl, t); + if (l<0) goto overflow; + continue; + } + + if (p < z-a) p = z-a; + if (p > INT_MAX-pl) goto overflow; + if (w < pl+p) w = pl+p; + if (w > INT_MAX-cnt) goto overflow; + + pad(f, ' ', w, pl+p, fl); + out(f, prefix, pl); + pad(f, '0', w, pl+p, fl^ZERO_PAD); + pad(f, '0', p, z-a, 0); + out(f, a, z-a); + pad(f, ' ', w, pl+p, fl^LEFT_ADJ); + + l = w; + } + + if (f) return cnt; + if (!l10n) return 0; + + for (i=1; i<=NL_ARGMAX && nl_type[i]; i++) + pop_arg(nl_arg+i, nl_type[i], ap); + for (; i<=NL_ARGMAX && !nl_type[i]; i++); + if (i<=NL_ARGMAX) goto inval; + return 1; + +inval: + errno = EINVAL; + return -1; +overflow: + errno = EOVERFLOW; + return -1; +} + +int vfprintf(FILE *restrict f, const char *restrict fmt, va_list ap) +{ + va_list ap2; + int nl_type[NL_ARGMAX+1] = {0}; + union arg nl_arg[NL_ARGMAX+1]; + unsigned char internal_buf[80], *saved_buf = 0; + int olderr; + int ret; + + /* the copy allows passing va_list* even if va_list is an array */ + va_copy(ap2, ap); + if (printf_core(0, fmt, &ap2, nl_arg, nl_type) < 0) { + va_end(ap2); + return -1; + } + + FLOCK(f); + olderr = f->flags & F_ERR; + if (f->mode < 1) f->flags &= ~F_ERR; + if (!f->buf_size) { + saved_buf = f->buf; + f->buf = internal_buf; + f->buf_size = sizeof internal_buf; + f->wpos = f->wbase = f->wend = 0; + } + if (!f->wend && __towrite(f)) ret = -1; + else { + ret = printf_core(f, fmt, &ap2, nl_arg, nl_type); + } + if (saved_buf) { + f->write(f, 0, 0); + if (!f->wpos) ret = -1; + f->buf = saved_buf; + f->buf_size = 0; + f->wpos = f->wbase = f->wend = 0; + } + if (f->flags & F_ERR) ret = -1; + f->flags |= olderr; + FUNLOCK(f); + va_end(ap2); + return ret; +} diff --git a/Ubiquitous/XiZi/lib/musllib/src/stdio/vfscanf.c b/Ubiquitous/XiZi/lib/musllib/src/stdio/vfscanf.c new file mode 100644 index 000000000..9e030fc44 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/stdio/vfscanf.c @@ -0,0 +1,336 @@ +#include +#include +#include +#include +#include +#include +#include +#include + +#include "stdio_impl.h" +#include "shgetc.h" +#include "intscan.h" +#include "floatscan.h" + +#define SIZE_hh -2 +#define SIZE_h -1 +#define SIZE_def 0 +#define SIZE_l 1 +#define SIZE_L 2 +#define SIZE_ll 3 + +static void store_int(void *dest, int size, unsigned long long i) +{ + if (!dest) return; + switch (size) { + case SIZE_hh: + *(char *)dest = i; + break; + case SIZE_h: + *(short *)dest = i; + break; + case SIZE_def: + *(int *)dest = i; + break; + case SIZE_l: + *(long *)dest = i; + break; + case SIZE_ll: + *(long long *)dest = i; + break; + } +} + +static void *arg_n(va_list ap, unsigned int n) +{ + void *p; + unsigned int i; + va_list ap2; + va_copy(ap2, ap); + for (i=n; i>1; i--) va_arg(ap2, void *); + p = va_arg(ap2, void *); + va_end(ap2); + return p; +} + +int vfscanf(FILE *restrict f, const char *restrict fmt, va_list ap) +{ + int width; + int size; + int alloc; + int base; + const unsigned char *p; + int c, t; + char *s; + wchar_t *wcs; + mbstate_t st; + void *dest=NULL; + int invert; + int matches=0; + unsigned long long x; + long double y; + off_t pos = 0; + unsigned char scanset[257]; + size_t i, k; + wchar_t wc; + + FLOCK(f); + + for (p=(const unsigned char *)fmt; *p; p++) { + + alloc = 0; + + if (isspace(*p)) { + while (isspace(p[1])) p++; + shlim(f, 0); + while (isspace(shgetc(f))); + shunget(f); + pos += shcnt(f); + continue; + } + if (*p != '%' || p[1] == '%') { + shlim(f, 0); + if (*p == '%') { + p++; + while (isspace((c=shgetc(f)))); + } else { + c = shgetc(f); + } + if (c!=*p) { + shunget(f); + if (c<0) goto input_fail; + goto match_fail; + } + pos += shcnt(f); + continue; + } + + p++; + if (*p=='*') { + dest = 0; p++; + } else if (isdigit(*p) && p[1]=='$') { + dest = arg_n(ap, *p-'0'); p+=2; + } else { + dest = va_arg(ap, void *); + } + + for (width=0; isdigit(*p); p++) { + width = 10*width + *p - '0'; + } + + if (*p=='m') { + wcs = 0; + s = 0; + alloc = !!dest; + p++; + } else { + alloc = 0; + } + + size = SIZE_def; + switch (*p++) { + case 'h': + if (*p == 'h') p++, size = SIZE_hh; + else size = SIZE_h; + break; + case 'l': + if (*p == 'l') p++, size = SIZE_ll; + else size = SIZE_l; + break; + case 'j': + size = SIZE_ll; + break; + case 'z': + case 't': + size = SIZE_l; + break; + case 'L': + size = SIZE_L; + break; + case 'd': case 'i': case 'o': case 'u': case 'x': + case 'a': case 'e': case 'f': case 'g': + case 'A': case 'E': case 'F': case 'G': case 'X': + case 's': case 'c': case '[': + case 'S': case 'C': + case 'p': case 'n': + p--; + break; + default: + goto fmt_fail; + } + + t = *p; + + /* C or S */ + if ((t&0x2f) == 3) { + t |= 32; + size = SIZE_l; + } + + switch (t) { + case 'c': + if (width < 1) width = 1; + case '[': + break; + case 'n': + store_int(dest, size, pos); + /* do not increment match count, etc! */ + continue; + default: + shlim(f, 0); + while (isspace(shgetc(f))); + shunget(f); + pos += shcnt(f); + } + + shlim(f, width); + if (shgetc(f) < 0) goto input_fail; + shunget(f); + + switch (t) { + case 's': + case 'c': + case '[': + if (t == 'c' || t == 's') { + memset(scanset, -1, sizeof scanset); + scanset[0] = 0; + if (t == 's') { + scanset[1+'\t'] = 0; + scanset[1+'\n'] = 0; + scanset[1+'\v'] = 0; + scanset[1+'\f'] = 0; + scanset[1+'\r'] = 0; + scanset[1+' '] = 0; + } + } else { + if (*++p == '^') p++, invert = 1; + else invert = 0; + memset(scanset, invert, sizeof scanset); + scanset[0] = 0; + if (*p == '-') p++, scanset[1+'-'] = 1-invert; + else if (*p == ']') p++, scanset[1+']'] = 1-invert; + for (; *p != ']'; p++) { + if (!*p) goto fmt_fail; + if (*p=='-' && p[1] && p[1] != ']') + for (c=p++[-1]; c<*p; c++) + scanset[1+c] = 1-invert; + scanset[1+*p] = 1-invert; + } + } + wcs = 0; + s = 0; + i = 0; + k = t=='c' ? width+1U : 31; + if (size == SIZE_l) { + if (alloc) { + wcs = malloc(k*sizeof(wchar_t)); + if (!wcs) goto alloc_fail; + } else { + wcs = dest; + } + st = (mbstate_t){0}; + while (scanset[(c=shgetc(f))+1]) { + switch (mbrtowc(&wc, &(char){c}, 1, &st)) { + case -1: + goto input_fail; + case -2: + continue; + } + if (wcs) wcs[i++] = wc; + if (alloc && i==k) { + k+=k+1; + wchar_t *tmp = realloc(wcs, k*sizeof(wchar_t)); + if (!tmp) goto alloc_fail; + wcs = tmp; + } + } + if (!mbsinit(&st)) goto input_fail; + } else if (alloc) { + s = malloc(k); + if (!s) goto alloc_fail; + while (scanset[(c=shgetc(f))+1]) { + s[i++] = c; + if (i==k) { + k+=k+1; + char *tmp = realloc(s, k); + if (!tmp) goto alloc_fail; + s = tmp; + } + } + } else if ((s = dest)) { + while (scanset[(c=shgetc(f))+1]) + s[i++] = c; + } else { + while (scanset[(c=shgetc(f))+1]); + } + shunget(f); + if (!shcnt(f)) goto match_fail; + if (t == 'c' && shcnt(f) != width) goto match_fail; + if (alloc) { + if (size == SIZE_l) *(wchar_t **)dest = wcs; + else *(char **)dest = s; + } + if (t != 'c') { + if (wcs) wcs[i] = 0; + if (s) s[i] = 0; + } + break; + case 'p': + case 'X': + case 'x': + base = 16; + goto int_common; + case 'o': + base = 8; + goto int_common; + case 'd': + case 'u': + base = 10; + goto int_common; + case 'i': + base = 0; + int_common: + x = __intscan(f, base, 0, ULLONG_MAX); + if (!shcnt(f)) goto match_fail; + if (t=='p' && dest) *(void **)dest = (void *)(uintptr_t)x; + else store_int(dest, size, x); + break; + case 'a': case 'A': + case 'e': case 'E': + case 'f': case 'F': + case 'g': case 'G': + y = __floatscan(f, size, 0); + if (!shcnt(f)) goto match_fail; + if (dest) switch (size) { + case SIZE_def: + *(float *)dest = y; + break; + case SIZE_l: + *(double *)dest = y; + break; + case SIZE_L: + *(long double *)dest = y; + break; + } + break; + } + + pos += shcnt(f); + if (dest) matches++; + } + if (0) { +fmt_fail: +alloc_fail: +input_fail: + if (!matches) matches--; +match_fail: + if (alloc) { + free(s); + free(wcs); + } + } + FUNLOCK(f); + return matches; +} + +weak_alias(vfscanf,__isoc99_vfscanf); diff --git a/Ubiquitous/XiZi/lib/musllib/src/stdio/vprintf.c b/Ubiquitous/XiZi/lib/musllib/src/stdio/vprintf.c new file mode 100644 index 000000000..30d2bffa8 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/stdio/vprintf.c @@ -0,0 +1,6 @@ +#include + +int vprintf(const char *restrict fmt, va_list ap) +{ + return vfprintf(stdout, fmt, ap); +} diff --git a/Ubiquitous/XiZi/lib/musllib/src/stdio/vscanf.c b/Ubiquitous/XiZi/lib/musllib/src/stdio/vscanf.c new file mode 100644 index 000000000..9d46ab09d --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/stdio/vscanf.c @@ -0,0 +1,9 @@ +#include +#include + +int vscanf(const char *restrict fmt, va_list ap) +{ + return vfscanf(stdin, fmt, ap); +} + +weak_alias(vscanf,__isoc99_vscanf); diff --git a/Ubiquitous/XiZi/lib/musllib/src/stdio/vsnprintf.c b/Ubiquitous/XiZi/lib/musllib/src/stdio/vsnprintf.c new file mode 100644 index 000000000..7d81a4c0a --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/stdio/vsnprintf.c @@ -0,0 +1,57 @@ +#include "stdio_impl.h" +#include +#include +#include +#include +#include + +struct cookie { + char *s; + size_t n; +}; + +#define MIN(a, b) ((a) < (b) ? (a) : (b)) + +static size_t sn_write(FILE *f, const unsigned char *s, size_t l) +{ + struct cookie *c = f->cookie; + size_t k = MIN(c->n, f->wpos - f->wbase); + if (k) { + memcpy(c->s, f->wbase, k); + c->s += k; + c->n -= k; + } + k = MIN(c->n, l); + if (k) { + memcpy(c->s, s, k); + c->s += k; + c->n -= k; + } + *c->s = 0; + f->wpos = f->wbase = f->buf; + /* pretend to succeed, even if we discarded extra data */ + return l; +} + +int vsnprintf(char *restrict s, size_t n, const char *restrict fmt, va_list ap) +{ + unsigned char buf[1]; + char dummy[1]; + struct cookie c = { .s = n ? s : dummy, .n = n ? n-1 : 0 }; + pthread_mutex_t locallock = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP; + FILE f = { + .lbf = EOF, + .write = sn_write, + .lock = &locallock, + .buf = buf, + .cookie = &c, + }; + + if (n > INT_MAX) { + errno = EOVERFLOW; + return -1; + } + + *c.s = 0; + return vfprintf(&f, fmt, ap); +} diff --git a/Ubiquitous/XiZi/lib/musllib/src/stdio/vsprintf.c b/Ubiquitous/XiZi/lib/musllib/src/stdio/vsprintf.c new file mode 100644 index 000000000..c57349d4d --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/stdio/vsprintf.c @@ -0,0 +1,7 @@ +#include +#include + +int vsprintf(char *restrict s, const char *restrict fmt, va_list ap) +{ + return vsnprintf(s, INT_MAX, fmt, ap); +} diff --git a/Ubiquitous/XiZi/lib/musllib/src/stdio/vsscanf.c b/Ubiquitous/XiZi/lib/musllib/src/stdio/vsscanf.c new file mode 100644 index 000000000..a912db8bd --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/stdio/vsscanf.c @@ -0,0 +1,17 @@ +#include "stdio_impl.h" + +static size_t do_read(FILE *f, unsigned char *buf, size_t len) +{ + return __string_read(f, buf, len); +} + +int vsscanf(const char *restrict s, const char *restrict fmt, va_list ap) +{ + FILE f = { + .buf = (void *)s, .cookie = (void *)s, + .read = do_read, .lock = NULL + }; + return vfscanf(&f, fmt, ap); +} + +weak_alias(vsscanf,__isoc99_vsscanf); diff --git a/Ubiquitous/XiZi/lib/musllib/src/stdlib/Makefile b/Ubiquitous/XiZi/lib/musllib/src/stdlib/Makefile new file mode 100644 index 000000000..feffb6cc9 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/stdlib/Makefile @@ -0,0 +1,5 @@ +SRC_FILES := abs.c atof.c atoi.c atol.c atoll.c bsearch.c llabs.c strtod.c strtol.c + + + +include $(KERNEL_ROOT)/compiler.mk \ No newline at end of file diff --git a/Ubiquitous/XiZi/lib/musllib/src/stdlib/abs.c b/Ubiquitous/XiZi/lib/musllib/src/stdlib/abs.c new file mode 100644 index 000000000..e721fdc2b --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/stdlib/abs.c @@ -0,0 +1,6 @@ +#include + +int abs(int a) +{ + return a>0 ? a : -a; +} diff --git a/Ubiquitous/XiZi/lib/musllib/src/stdlib/atof.c b/Ubiquitous/XiZi/lib/musllib/src/stdlib/atof.c new file mode 100644 index 000000000..e52eaf4dd --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/stdlib/atof.c @@ -0,0 +1,6 @@ +#include + +double atof(const char *s) +{ + return strtod(s, 0); +} \ No newline at end of file diff --git a/Ubiquitous/XiZi/lib/musllib/src/stdlib/atoi.c b/Ubiquitous/XiZi/lib/musllib/src/stdlib/atoi.c new file mode 100644 index 000000000..9baca7b89 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/stdlib/atoi.c @@ -0,0 +1,16 @@ +#include +#include + +int atoi(const char *s) +{ + int n=0, neg=0; + while (isspace(*s)) s++; + switch (*s) { + case '-': neg=1; + case '+': s++; + } + /* Compute n as a negative number to avoid overflow on INT_MIN */ + while (isdigit(*s)) + n = 10*n - (*s++ - '0'); + return neg ? n : -n; +} diff --git a/Ubiquitous/XiZi/lib/musllib/src/stdlib/atol.c b/Ubiquitous/XiZi/lib/musllib/src/stdlib/atol.c new file mode 100644 index 000000000..140ea3ea3 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/stdlib/atol.c @@ -0,0 +1,17 @@ +#include +#include + +long atol(const char *s) +{ + long n=0; + int neg=0; + while (isspace(*s)) s++; + switch (*s) { + case '-': neg=1; + case '+': s++; + } + /* Compute n as a negative number to avoid overflow on LONG_MIN */ + while (isdigit(*s)) + n = 10*n - (*s++ - '0'); + return neg ? n : -n; +} diff --git a/Ubiquitous/XiZi/lib/musllib/src/stdlib/atoll.c b/Ubiquitous/XiZi/lib/musllib/src/stdlib/atoll.c new file mode 100644 index 000000000..b69304895 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/stdlib/atoll.c @@ -0,0 +1,17 @@ +#include +#include + +long long atoll(const char *s) +{ + long long n=0; + int neg=0; + while (isspace(*s)) s++; + switch (*s) { + case '-': neg=1; + case '+': s++; + } + /* Compute n as a negative number to avoid overflow on LLONG_MIN */ + while (isdigit(*s)) + n = 10*n - (*s++ - '0'); + return neg ? n : -n; +} diff --git a/Ubiquitous/XiZi/lib/musllib/src/stdlib/bsearch.c b/Ubiquitous/XiZi/lib/musllib/src/stdlib/bsearch.c new file mode 100644 index 000000000..e338506cf --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/stdlib/bsearch.c @@ -0,0 +1,20 @@ +#include + +void *bsearch(const void *key, const void *base, size_t nel, size_t width, int (*cmp)(const void *, const void *)) +{ + void *try; + int sign; + while (nel > 0) { + try = (char *)base + width*(nel/2); + sign = cmp(key, try); + if (sign < 0) { + nel /= 2; + } else if (sign > 0) { + base = (char *)try + width; + nel -= nel/2+1; + } else { + return try; + } + } + return NULL; +} \ No newline at end of file diff --git a/Ubiquitous/XiZi/lib/musllib/src/stdlib/llabs.c b/Ubiquitous/XiZi/lib/musllib/src/stdlib/llabs.c new file mode 100644 index 000000000..146acb78b --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/stdlib/llabs.c @@ -0,0 +1,6 @@ +#include + +long long llabs(long long a) +{ + return a>0 ? a : -a; +} \ No newline at end of file diff --git a/Ubiquitous/XiZi/lib/musllib/src/stdlib/strtod.c b/Ubiquitous/XiZi/lib/musllib/src/stdlib/strtod.c new file mode 100644 index 000000000..a5d0118a2 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/stdlib/strtod.c @@ -0,0 +1,37 @@ +#include +#include "shgetc.h" +#include "floatscan.h" +#include "stdio_impl.h" + +static long double strtox(const char *s, char **p, int prec) +{ + FILE f; + sh_fromstring(&f, s); + shlim(&f, 0); + long double y = __floatscan(&f, prec, 1); + off_t cnt = shcnt(&f); + if (p) *p = cnt ? (char *)s + cnt : (char *)s; + return y; +} + +float strtof(const char *restrict s, char **restrict p) +{ + return strtox(s, p, 0); +} + +double strtod(const char *restrict s, char **restrict p) +{ + return strtox(s, p, 1); +} + +long double strtold(const char *restrict s, char **restrict p) +{ + return strtox(s, p, 2); +} + +weak_alias(strtof, strtof_l); +weak_alias(strtod, strtod_l); +weak_alias(strtold, strtold_l); +weak_alias(strtof, __strtof_l); +weak_alias(strtod, __strtod_l); +weak_alias(strtold, __strtold_l); diff --git a/Ubiquitous/XiZi/lib/musllib/src/stdlib/strtol.c b/Ubiquitous/XiZi/lib/musllib/src/stdlib/strtol.c new file mode 100644 index 000000000..ceccfbf03 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/stdlib/strtol.c @@ -0,0 +1,44 @@ +#include "stdio_impl.h" +#include "intscan.h" +#include "shgetc.h" +#include +#include +#include + +static unsigned long long strtox(const char *s, char **p, int base, unsigned long long lim) +{ + FILE f; + sh_fromstring(&f, s); + shlim(&f, 0); + unsigned long long y = __intscan(&f, base, 1, lim); + if (p) { + size_t cnt = shcnt(&f); + *p = (char *)s + cnt; + } + return y; +} + +unsigned long long strtoull(const char *restrict s, char **restrict p, int base) +{ + return strtox(s, p, base, ULLONG_MAX); +} + +long long strtoll(const char *restrict s, char **restrict p, int base) +{ + return strtox(s, p, base, LLONG_MIN); +} + +unsigned long strtoul(const char *restrict s, char **restrict p, int base) +{ + return strtox(s, p, base, ULONG_MAX); +} + +long strtol(const char *restrict s, char **restrict p, int base) +{ + return strtox(s, p, base, 0UL+LONG_MIN); +} + +weak_alias(strtol, __strtol_internal); +weak_alias(strtoll, __strtoll_internal); +weak_alias(strtoul, __strtoul_internal); +weak_alias(strtoull, __strtoull_internal); diff --git a/Ubiquitous/XiZi/lib/musllib/src/string/Makefile b/Ubiquitous/XiZi/lib/musllib/src/string/Makefile new file mode 100644 index 000000000..4dcddaeeb --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/string/Makefile @@ -0,0 +1,8 @@ +SRC_FILES := memchr.c memcmp.c memcpy.c memmove.c memrchr.c memset.c stpcpy.c stpncpy.c +SRC_FILES += strcasecmp.c strcat.c strchr.c strchrnul.c strcmp.c strcpy.c strcspn.c strdup.c strlen.c +SRC_FILES += strncasecmp.c strncat.c strncmp.c strncpy.c strnlen.c strrchr.c strspn.c strstr.c +SRC_FILES += strtok_r.c strtok.c wcschr.c wcslen.c + + + +include $(KERNEL_ROOT)/compiler.mk \ No newline at end of file diff --git a/Ubiquitous/XiZi/lib/musllib/src/string/arch/arm/memcmp_armv8m.S b/Ubiquitous/XiZi/lib/musllib/src/string/arch/arm/memcmp_armv8m.S new file mode 100644 index 000000000..fa50d1518 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/string/arch/arm/memcmp_armv8m.S @@ -0,0 +1,253 @@ +/* + * Copyright (c) 2022-2022 Huawei Device Co., Ltd. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its contributors may be used + * to endorse or promote products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER 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. + */ + +#ifdef __ARM_FEATURE_MVE + + .syntax unified + .globl memcmp @ -- Begin function memcmp + .p2align 2 + .type memcmp,%function +memcmp: + @ r0 = str1 + @ r1 = str2 + @ r2 = count + .fnstart + push {r4, r5, r6, r7, r8, lr} + pld [r0, #0] + pld [r1, #0] + + /** + * if (str1 == str2) || (n == 0) return; + */ + cmp r0, r1 + it ne + cmpne r2, #0 + beq Lreturn_0 + + /** + * Determine whether the first byte is different. + */ + ldrb r3, [r0] @ r3 = *str1 + ldrb r4, [r1] @ r4 = *str2 + pld [r0, #64] + pld [r1, #64] + cmp r3, r4 + itt ne + subne r0, r3, r4 + bne Lreturn + +#ifdef LOSCFG_ARCH_UNALIGNED_EXC + /** + * Check address alignment. + */ + and r5, r0, #3 + and r6, r1, #3 + orrs r5, r6 + bgt Lunaligned_cmp +#endif + +/** + * Comparing 32 bytes each time, using floating-point registers to improve efficiency. + */ +L32_byte_cmp: + cmp r2, #32 + blo L16_byte_cmp + sub r2, r2, #32 + vldmia.32 r0!, {s0 - s7} + vldmia.32 r1!, {s8 - s15} + vsub.i8 q0, q0, q2 @ q0: Difference of the first 16 bytes + vsub.i8 q1, q1, q3 @ q1: Difference of the last 16 bytes + pld [r0, #64] + pld [r1, #64] + + /** + * Swap d1 and d2 so that after bitwise OR, + * d4 represents the result of the first half of the comparison, + * d5 represents the result of the second half of the comparison. + */ + vmov d6, d1 + vmov d1, d2 + vmov d2, d6 + vorr q2, q0, q1 + + /** + * Determine whether q2 is zero. + */ + vmov r3, r4, d4 + orr r5, r3, r4 + vmov r3, r4, d5 + orr r6, r3, r4 + orr r5, r5, r6 + cmp r5, #0 + beq L32_byte_cmp + +L32_byte_diff_pre: + /** + * Restore the swapped d1 and d2. + */ + vmov d6, d1 + vmov d1, d2 + vmov d2, d6 + +/** + * Going to the diff branch shows that a certain byte must be different at this time. + * We use r3 to indicate whether the first half of the multibytes are equal, + * and r4 to indicate whether the second half of the multibytes are equal. + */ +L32_byte_diff: + vmov r3, r4, d4 + orr r3, r3, r4 + /** + * Adjust the two pointers back. + */ + sub r0, #32 + sub r1, #32 + cmp r3, #0 + ittt eq + addeq r0, #16 + addeq r1, #16 + beq L16_byte_diff_back + vmov r3, r4, d0 + vmov r5, r6, d1 + b L16_byte_diff + +L16_byte_diff_back: + vmov r3, r4, d2 + vmov r5, r6, d3 + +L16_byte_diff: + orr r7, r3, r4 + cmp r7, #0 + ittt eq + addeq r0, #8 + addeq r1, #8 + beq L8_byte_diff_back + b L8_byte_diff + +L8_byte_diff_back: + mov r3, r5 + mov r4, r6 + +L8_byte_diff: + cmp r3, #0 + ittt eq + addeq r0, #4 + addeq r1, #4 + beq L4_byte_diff + +Lunaligned_cmp: +L4_byte_diff: + ldrb r5, [r0], #1 + ldrb r6, [r1], #1 + subs r5, r5, r6 + beq L4_byte_diff + mov r0, r5 + b Lreturn + +/** + * The dichotomy handles the case of less than 32 bytes. + */ +L16_byte_cmp: + cmp r2, #16 + blo L8_byte_cmp + sub r2, r2, #16 + vldmia.32 r0!, {s0 - s3} + vldmia.32 r1!, {s8 - s11} + vsub.i8 q0, q0, q2 + pld [r0, #64] + pld [r1, #64] + + vmov r3, r4, d0 + orr r5, r3, r4 + vmov r3, r4, d1 + orr r6, r3, r4 + orr r5, r5, r6 + cmp r5, #0 + beq L8_byte_cmp + + sub r0, #16 + sub r1, #16 + vmov r3, r4, d0 + vmov r5, r6, d1 + b L16_byte_diff + +L8_byte_cmp: + cmp r2, #8 + blo L4_byte_cmp + sub r2, r2, #8 + vldmia.32 r0!, {s0 - s1} + vldmia.32 r1!, {s8 - s9} + vsub.i8 q0, q0, q2 + + vmov r3, r4, d0 + orr r7, r3, r4 + cmp r7, #0 + beq L4_byte_cmp + sub r0, #8 + sub r1, #8 + b L8_byte_diff + +L4_byte_cmp: + cmp r2, #4 + blo Lless_4_byte_cmp + sub r2, r2, #4 + ldr r3, [r0], #4 + ldr r4, [r1], #4 + cmp r3, r4 + beq Lless_4_byte_cmp + sub r0, #4 + sub r1, #4 + b L4_byte_diff + +Lless_4_byte_cmp: + cmp r2, #0 + beq Lreturn_0 + sub r2, r2, #1 + ldrb r3, [r0], #1 + ldrb r4, [r1], #1 + sub r5, r3, r4 + cmp r5, #0 + itt ne + movne r0, r5 + bne Lreturn + b Lless_4_byte_cmp + +Lreturn_0: + mov r0, #0 +Lreturn: + pop {r4, r5, r6, r7, r8, pc} +Lfunc_end: + .size memcmp, Lfunc_end - memcmp + .cantunwind + .fnend @ -- End function + +#else +#error 'MVE is not enabled in compile options' +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/src/string/arch/arm/memcpy_le.S b/Ubiquitous/XiZi/lib/musllib/src/string/arch/arm/memcpy_le.S new file mode 100644 index 000000000..4479e1f2c --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/string/arch/arm/memcpy_le.S @@ -0,0 +1,413 @@ +#if !__ARMEB__ + +/* + * Copyright (C) 2008 The Android Open Source Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 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. + */ + + +/* + * Optimized memcpy() for ARM. + * + * note that memcpy() always returns the destination pointer, + * so we have to preserve R0. + */ + +/* + * This file has been modified from the original for use in musl libc. + * The main changes are: addition of .type memcpy,%function to make the + * code safely callable from thumb mode, adjusting the return + * instructions to be compatible with pre-thumb ARM cpus, removal of + * prefetch code that is not compatible with older cpus and support for + * building as thumb 2. + */ + +.syntax unified + +#define FUNCTION(x) \ +.global x; \ +.type x,%function; \ +x: + +#if defined(LOSCFG_KERNEL_LMS) +FUNCTION(__memcpy) +#else +FUNCTION(memcpy) +#endif + /* The stack must always be 64-bits aligned to be compliant with the + * ARM ABI. Since we have to save R0, we might as well save R4 + * which we can use for better pipelining of the reads below + */ + .fnstart + .save {r0, r4, lr} + stmfd sp!, {r0, r4, lr} + /* Making room for r5-r11 which will be spilled later */ + .pad #28 + sub sp, sp, #28 + + /* it simplifies things to take care of len<4 early */ + cmp r2, #4 + blo copy_last_3_and_return + + /* compute the offset to align the source + * offset = (4-(src&3))&3 = -src & 3 + */ + rsb r3, r1, #0 + ands r3, r3, #3 + beq src_aligned + + /* align source to 32 bits. We need to insert 2 instructions between + * a ldr[b|h] and str[b|h] because byte and half-word instructions + * stall 2 cycles. + */ + movs r12, r3, lsl #31 + sub r2, r2, r3 /* we know that r3 <= r2 because r2 >= 4 */ + itt mi + ldrbmi r3, [r1], #1 + strbmi r3, [r0], #1 + itttt cs + ldrbcs r4, [r1], #1 + ldrbcs r12,[r1], #1 + strbcs r4, [r0], #1 + strbcs r12,[r0], #1 + +src_aligned: + + /* see if src and dst are aligned together (congruent) */ + eor r12, r0, r1 + tst r12, #3 + bne non_congruent + + /* Use post-incriment mode for stm to spill r5-r11 to reserved stack + * frame. Don't update sp. + */ + stmea sp, {r5-r11} + + /* align the destination to a cache-line */ + rsb r3, r0, #0 + ands r3, r3, #0x1C + beq congruent_aligned32 + cmp r3, r2 + it hi + andhi r3, r2, #0x1C + + /* conditionnaly copies 0 to 7 words (length in r3) */ + movs r12, r3, lsl #28 + itt cs + ldmcs r1!, {r4, r5, r6, r7} /* 16 bytes */ + stmcs r0!, {r4, r5, r6, r7} + itt mi + ldmmi r1!, {r8, r9} /* 8 bytes */ + stmmi r0!, {r8, r9} + tst r3, #0x4 + itt ne + ldrne r10,[r1], #4 /* 4 bytes */ + strne r10,[r0], #4 + sub r2, r2, r3 + +congruent_aligned32: + /* + * here source is aligned to 32 bytes. + */ + +cached_aligned32: + subs r2, r2, #32 + blo less_than_32_left + + /* + * We preload a cache-line up to 64 bytes ahead. On the 926, this will + * stall only until the requested world is fetched, but the linefill + * continues in the the background. + * While the linefill is going, we write our previous cache-line + * into the write-buffer (which should have some free space). + * When the linefill is done, the writebuffer will + * start dumping its content into memory + * + * While all this is going, we then load a full cache line into + * 8 registers, this cache line should be in the cache by now + * (or partly in the cache). + * + * This code should work well regardless of the source/dest alignment. + * + */ + + /* Align the preload register to a cache-line because the cpu does + * "critical word first" (the first word requested is loaded first). + */ + @ bic r12, r1, #0x1F + @ add r12, r12, #64 + +1: ldmia r1!, { r4-r11 } + subs r2, r2, #32 + + /* + * NOTE: if r12 is more than 64 ahead of r1, the following ldrhi + * for ARM9 preload will not be safely guarded by the preceding subs. + * When it is safely guarded the only possibility to have SIGSEGV here + * is because the caller overstates the length. + */ + @ ldrhi r3, [r12], #32 /* cheap ARM9 preload */ + stmia r0!, { r4-r11 } + bhs 1b + + add r2, r2, #32 + +less_than_32_left: + /* + * less than 32 bytes left at this point (length in r2) + */ + + /* skip all this if there is nothing to do, which should + * be a common case (if not executed the code below takes + * about 16 cycles) + */ + tst r2, #0x1F + beq 1f + + /* conditionnaly copies 0 to 31 bytes */ + movs r12, r2, lsl #28 + itt cs + ldmcs r1!, {r4, r5, r6, r7} /* 16 bytes */ + stmcs r0!, {r4, r5, r6, r7} + itt mi + ldmmi r1!, {r8, r9} /* 8 bytes */ + stmmi r0!, {r8, r9} + movs r12, r2, lsl #30 + itt cs + ldrcs r3, [r1], #4 /* 4 bytes */ + strcs r3, [r0], #4 + itt mi + ldrhmi r4, [r1], #2 /* 2 bytes */ + strhmi r4, [r0], #2 + tst r2, #0x1 + itt ne + ldrbne r3, [r1] /* last byte */ + strbne r3, [r0] + + /* we're done! restore everything and return */ +1: ldmfd sp!, {r5-r11} + ldmfd sp!, {r0, r4, lr} + bx lr + + /********************************************************************/ + +non_congruent: + /* + * here source is aligned to 4 bytes + * but destination is not. + * + * in the code below r2 is the number of bytes read + * (the number of bytes written is always smaller, because we have + * partial words in the shift queue) + */ + cmp r2, #4 + blo copy_last_3_and_return + + /* Use post-incriment mode for stm to spill r5-r11 to reserved stack + * frame. Don't update sp. + */ + stmea sp, {r5-r11} + + /* compute shifts needed to align src to dest */ + rsb r5, r0, #0 + and r5, r5, #3 /* r5 = # bytes in partial words */ + mov r12, r5, lsl #3 /* r12 = right */ + rsb lr, r12, #32 /* lr = left */ + + /* read the first word */ + ldr r3, [r1], #4 + sub r2, r2, #4 + + /* write a partial word (0 to 3 bytes), such that destination + * becomes aligned to 32 bits (r5 = nb of words to copy for alignment) + */ + movs r5, r5, lsl #31 + itt mi + strbmi r3, [r0], #1 + movmi r3, r3, lsr #8 + itttt cs + strbcs r3, [r0], #1 + movcs r3, r3, lsr #8 + strbcs r3, [r0], #1 + movcs r3, r3, lsr #8 + + cmp r2, #4 + blo partial_word_tail + + /* Align destination to 32 bytes (cache line boundary) */ +1: tst r0, #0x1c + beq 2f + ldr r5, [r1], #4 + sub r2, r2, #4 + mov r4, r5, lsl lr + orr r4, r4, r3 + mov r3, r5, lsr r12 + str r4, [r0], #4 + cmp r2, #4 + bhs 1b + blo partial_word_tail + + /* copy 32 bytes at a time */ +2: subs r2, r2, #32 + blo less_than_thirtytwo + + /* Use immediate mode for the shifts, because there is an extra cycle + * for register shifts, which could account for up to 50% of + * performance hit. + */ + + cmp r12, #24 + beq loop24 + cmp r12, #8 + beq loop8 + +loop16: + ldr r12, [r1], #4 +1: mov r4, r12 + ldmia r1!, { r5,r6,r7, r8,r9,r10,r11} + subs r2, r2, #32 + it hs + ldrhs r12, [r1], #4 + orr r3, r3, r4, lsl #16 + mov r4, r4, lsr #16 + orr r4, r4, r5, lsl #16 + mov r5, r5, lsr #16 + orr r5, r5, r6, lsl #16 + mov r6, r6, lsr #16 + orr r6, r6, r7, lsl #16 + mov r7, r7, lsr #16 + orr r7, r7, r8, lsl #16 + mov r8, r8, lsr #16 + orr r8, r8, r9, lsl #16 + mov r9, r9, lsr #16 + orr r9, r9, r10, lsl #16 + mov r10, r10, lsr #16 + orr r10, r10, r11, lsl #16 + stmia r0!, {r3,r4,r5,r6, r7,r8,r9,r10} + mov r3, r11, lsr #16 + bhs 1b + b less_than_thirtytwo + +loop8: + ldr r12, [r1], #4 +1: mov r4, r12 + ldmia r1!, { r5,r6,r7, r8,r9,r10,r11} + subs r2, r2, #32 + it hs + ldrhs r12, [r1], #4 + orr r3, r3, r4, lsl #24 + mov r4, r4, lsr #8 + orr r4, r4, r5, lsl #24 + mov r5, r5, lsr #8 + orr r5, r5, r6, lsl #24 + mov r6, r6, lsr #8 + orr r6, r6, r7, lsl #24 + mov r7, r7, lsr #8 + orr r7, r7, r8, lsl #24 + mov r8, r8, lsr #8 + orr r8, r8, r9, lsl #24 + mov r9, r9, lsr #8 + orr r9, r9, r10, lsl #24 + mov r10, r10, lsr #8 + orr r10, r10, r11, lsl #24 + stmia r0!, {r3,r4,r5,r6, r7,r8,r9,r10} + mov r3, r11, lsr #8 + bhs 1b + b less_than_thirtytwo + +loop24: + ldr r12, [r1], #4 +1: mov r4, r12 + ldmia r1!, { r5,r6,r7, r8,r9,r10,r11} + subs r2, r2, #32 + it hs + ldrhs r12, [r1], #4 + orr r3, r3, r4, lsl #8 + mov r4, r4, lsr #24 + orr r4, r4, r5, lsl #8 + mov r5, r5, lsr #24 + orr r5, r5, r6, lsl #8 + mov r6, r6, lsr #24 + orr r6, r6, r7, lsl #8 + mov r7, r7, lsr #24 + orr r7, r7, r8, lsl #8 + mov r8, r8, lsr #24 + orr r8, r8, r9, lsl #8 + mov r9, r9, lsr #24 + orr r9, r9, r10, lsl #8 + mov r10, r10, lsr #24 + orr r10, r10, r11, lsl #8 + stmia r0!, {r3,r4,r5,r6, r7,r8,r9,r10} + mov r3, r11, lsr #24 + bhs 1b + +less_than_thirtytwo: + /* copy the last 0 to 31 bytes of the source */ + rsb r12, lr, #32 /* we corrupted r12, recompute it */ + add r2, r2, #32 + cmp r2, #4 + blo partial_word_tail + +1: ldr r5, [r1], #4 + sub r2, r2, #4 + mov r4, r5, lsl lr + orr r4, r4, r3 + mov r3, r5, lsr r12 + str r4, [r0], #4 + cmp r2, #4 + bhs 1b + +partial_word_tail: + /* we have a partial word in the input buffer */ + movs r5, lr, lsl #(31-3) + itt mi + strbmi r3, [r0], #1 + movmi r3, r3, lsr #8 + ittt cs + strbcs r3, [r0], #1 + movcs r3, r3, lsr #8 + strbcs r3, [r0], #1 + + /* Refill spilled registers from the stack. Don't update sp. */ + ldmfd sp, {r5-r11} + +copy_last_3_and_return: + movs r2, r2, lsl #31 /* copy remaining 0, 1, 2 or 3 bytes */ + itt mi + ldrbmi r2, [r1], #1 + strbmi r2, [r0], #1 + itttt cs + ldrbcs r3, [r1], #1 + ldrbcs r12,[r1] + strbcs r3, [r0], #1 + strbcs r12,[r0] + + /* we're done! restore sp and spilled registers and return */ + add sp, sp, #28 + ldmfd sp!, {r0, r4, lr} + bx lr + +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/src/string/arch/arm/memset_armv8m.S b/Ubiquitous/XiZi/lib/musllib/src/string/arch/arm/memset_armv8m.S new file mode 100644 index 000000000..2b60c1f3f --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/string/arch/arm/memset_armv8m.S @@ -0,0 +1,139 @@ +/* + * Copyright (c) 2022-2022 Huawei Device Co., Ltd. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its contributors may be used + * to endorse or promote products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER 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. + */ + +#ifdef __ARM_FEATURE_MVE + +.syntax unified + +#define FUNCTION(x) \ +.globl x; \ +.p2align 2; \ +.type x,%function; \ +x: + +#if defined(LOSCFG_KERNEL_LMS) +FUNCTION(__memset) +#else +FUNCTION(memset) +#endif + @ r0 = address + @ r1 = char + @ r2 = count + @ returns original address in r0 + .fnstart + + push {r4, lr} + cmp r2, #0 + beq Lreturn + vdup.8 q0, r1 + mov r4, r0 @ r4 = r0 = address + +L64_byte_alignment: + ands r3, r0, #7 + beq L64_byte_aligned + rsb r3, r3, #8 @ r3 = unalignedCnt = 8 - (address % 7) + cmp r2, r3 + it lo + movlo r3, r2 + sub r2, r2, r3 + +Lloop1: + strb r1, [r4], #1 + subs r3, r3, #1 + bgt Lloop1 + +/** + * Set 64 bytes each time, and use floating-point registers to improve efficiency. + */ +L64_byte_aligned: + vmov q1, q0 + cmp r2, #64 + blo L32_byte_aligned + vmov q2, q0 + vmov q3, q0 + + lsr lr, r2, #6 + and r2, r2, #63 + wls lr, lr, L32_byte_aligned +Lloop2: + vstmia r4!, {d0 - d7} + le lr, Lloop2 + +L32_byte_aligned: + cmp r2, #0 + beq Lreturn + cmp r2, #32 + blo L16_byte_aligned + sub r2, r2, #32 + vstmia r4!, {d0 - d3} + +L16_byte_aligned: + cmp r2, #0 + beq Lreturn + cmp r2, #16 + blo L8_byte_aligned + sub r2, r2, #16 + vstmia r4!, {d0 - d1} + +L8_byte_aligned: + cmp r2, #0 + beq Lreturn + cmp r2, #8 + blo L4_byte_aligned + sub r2, r2, #8 + vstmia r4!, {d0} + +L4_byte_aligned: + cmp r2, #0 + beq Lreturn + cmp r2, #4 + blo Lless_4_byte + sub r2, r2, #4 + vstr.32 s0, [r4] + add r4, #4 + +Lless_4_byte: + cmp r2, #0 + beq Lreturn + strb r1, [r4], #1 + sub r2, r2, #1 + b Lless_4_byte + +Lreturn: + pop {r4, pc} + +Lfunc_end: + .size memset, Lfunc_end - memset + .cantunwind + .fnend @ -- End function + +#else +#error 'MVE is not enabled in compile options' +#endif diff --git a/Ubiquitous/XiZi/lib/musllib/src/string/memchr.c b/Ubiquitous/XiZi/lib/musllib/src/string/memchr.c new file mode 100644 index 000000000..65f0d789b --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/string/memchr.c @@ -0,0 +1,27 @@ +#include +#include +#include + +#define SS (sizeof(size_t)) +#define ALIGN (sizeof(size_t)-1) +#define ONES ((size_t)-1/UCHAR_MAX) +#define HIGHS (ONES * (UCHAR_MAX/2+1)) +#define HASZERO(x) ((x)-ONES & ~(x) & HIGHS) + +void *memchr(const void *src, int c, size_t n) +{ + const unsigned char *s = src; + c = (unsigned char)c; +#ifdef __GNUC__ + for (; ((uintptr_t)s & ALIGN) && n && *s != c; s++, n--); + if (n && *s != c) { + typedef size_t __attribute__((__may_alias__)) word; + const word *w; + size_t k = ONES * c; + for (w = (const void *)s; n>=SS && !HASZERO(*w^k); w++, n-=SS); + s = (const void *)w; + } +#endif + for (; n && *s != c; s++, n--); + return n ? (void *)s : 0; +} diff --git a/Ubiquitous/XiZi/lib/musllib/src/string/memcmp.c b/Ubiquitous/XiZi/lib/musllib/src/string/memcmp.c new file mode 100644 index 000000000..fb343da6b --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/string/memcmp.c @@ -0,0 +1,79 @@ +/* + * Copyright (c) 2022-2022 Huawei Device Co., Ltd. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its contributors may be used + * to endorse or promote products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER 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. + */ + +#include +#include + +#define SIZE_U64 (sizeof(uint64_t)) +#define SIZE_U32 (sizeof(uint32_t)) + +int memcmp(const void *str1, const void *str2, size_t n) +{ + + const unsigned char *s1 = str1; + const unsigned char *s2 = str2; + size_t num = n; + +#ifdef LOSCFG_ARCH_UNALIGNED_EXC + if (((uintptr_t)s1 % 4 != 0) || ((uintptr_t)s2 % 4 != 0)) { /* 4, address aligned check */ + goto Lunaligned_cmp; + } +#endif + while (num >= SIZE_U64) { + if (*(const uint64_t *)(s1) != *(const uint64_t *)(s2)) { + goto L4_byte_cmp; + } + s1 += SIZE_U64; + s2 += SIZE_U64; + num -= SIZE_U64; + } + if (num == 0) { + return 0; + } + +L4_byte_cmp: + if (num >= SIZE_U32) { + if (*(const uint32_t *)(s1) != *(const uint32_t *)(s2)) { + goto L4_byte_diff; + } + s1 += SIZE_U32; + s2 += SIZE_U32; + num -= SIZE_U32; + } + if (num == 0) { + return 0; + } + +Lunaligned_cmp: +L4_byte_diff: + for (; num && (*s1 == *s2); num--, s1++, s2++) { + } + return num ? *s1 - *s2 : 0; +} diff --git a/Ubiquitous/XiZi/lib/musllib/src/string/memcpy.c b/Ubiquitous/XiZi/lib/musllib/src/string/memcpy.c new file mode 100644 index 000000000..06e88742b --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/string/memcpy.c @@ -0,0 +1,124 @@ +#include +#include +#include + +void *memcpy(void *restrict dest, const void *restrict src, size_t n) +{ + unsigned char *d = dest; + const unsigned char *s = src; + +#ifdef __GNUC__ + +#if __BYTE_ORDER == __LITTLE_ENDIAN +#define LS >> +#define RS << +#else +#define LS << +#define RS >> +#endif + + typedef uint32_t __attribute__((__may_alias__)) u32; + uint32_t w, x; + + for (; (uintptr_t)s % 4 && n; n--) *d++ = *s++; + + if ((uintptr_t)d % 4 == 0) { + for (; n>=16; s+=16, d+=16, n-=16) { + *(u32 *)(d+0) = *(u32 *)(s+0); + *(u32 *)(d+4) = *(u32 *)(s+4); + *(u32 *)(d+8) = *(u32 *)(s+8); + *(u32 *)(d+12) = *(u32 *)(s+12); + } + if (n&8) { + *(u32 *)(d+0) = *(u32 *)(s+0); + *(u32 *)(d+4) = *(u32 *)(s+4); + d += 8; s += 8; + } + if (n&4) { + *(u32 *)(d+0) = *(u32 *)(s+0); + d += 4; s += 4; + } + if (n&2) { + *d++ = *s++; *d++ = *s++; + } + if (n&1) { + *d = *s; + } + return dest; + } + + if (n >= 32) switch ((uintptr_t)d % 4) { + case 1: + w = *(u32 *)s; + *d++ = *s++; + *d++ = *s++; + *d++ = *s++; + n -= 3; + for (; n>=17; s+=16, d+=16, n-=16) { + x = *(u32 *)(s+1); + *(u32 *)(d+0) = (w LS 24) | (x RS 8); + w = *(u32 *)(s+5); + *(u32 *)(d+4) = (x LS 24) | (w RS 8); + x = *(u32 *)(s+9); + *(u32 *)(d+8) = (w LS 24) | (x RS 8); + w = *(u32 *)(s+13); + *(u32 *)(d+12) = (x LS 24) | (w RS 8); + } + break; + case 2: + w = *(u32 *)s; + *d++ = *s++; + *d++ = *s++; + n -= 2; + for (; n>=18; s+=16, d+=16, n-=16) { + x = *(u32 *)(s+2); + *(u32 *)(d+0) = (w LS 16) | (x RS 16); + w = *(u32 *)(s+6); + *(u32 *)(d+4) = (x LS 16) | (w RS 16); + x = *(u32 *)(s+10); + *(u32 *)(d+8) = (w LS 16) | (x RS 16); + w = *(u32 *)(s+14); + *(u32 *)(d+12) = (x LS 16) | (w RS 16); + } + break; + case 3: + w = *(u32 *)s; + *d++ = *s++; + n -= 1; + for (; n>=19; s+=16, d+=16, n-=16) { + x = *(u32 *)(s+3); + *(u32 *)(d+0) = (w LS 8) | (x RS 24); + w = *(u32 *)(s+7); + *(u32 *)(d+4) = (x LS 8) | (w RS 24); + x = *(u32 *)(s+11); + *(u32 *)(d+8) = (w LS 8) | (x RS 24); + w = *(u32 *)(s+15); + *(u32 *)(d+12) = (x LS 8) | (w RS 24); + } + break; + } + if (n&16) { + *d++ = *s++; *d++ = *s++; *d++ = *s++; *d++ = *s++; + *d++ = *s++; *d++ = *s++; *d++ = *s++; *d++ = *s++; + *d++ = *s++; *d++ = *s++; *d++ = *s++; *d++ = *s++; + *d++ = *s++; *d++ = *s++; *d++ = *s++; *d++ = *s++; + } + if (n&8) { + *d++ = *s++; *d++ = *s++; *d++ = *s++; *d++ = *s++; + *d++ = *s++; *d++ = *s++; *d++ = *s++; *d++ = *s++; + } + if (n&4) { + *d++ = *s++; *d++ = *s++; *d++ = *s++; *d++ = *s++; + } + if (n&2) { + *d++ = *s++; *d++ = *s++; + } + if (n&1) { + *d = *s; + } + return dest; +#endif + + for (; n; n--) *d++ = *s++; + return dest; +} diff --git a/Ubiquitous/XiZi/lib/musllib/src/string/memmove.c b/Ubiquitous/XiZi/lib/musllib/src/string/memmove.c new file mode 100644 index 000000000..dcbe1caa6 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/string/memmove.c @@ -0,0 +1,46 @@ +#include +#include + +#ifdef __GNUC__ +typedef __attribute__((__may_alias__)) size_t WT; +#define WS (sizeof(WT)) +#endif + +#ifdef LOSCFG_KERNEL_LMS +__attribute__((no_sanitize_address)) void *__memmove(void *dest, const void *src, size_t n) +#else +void *memmove(void *dest, const void *src, size_t n) +#endif +{ + char *d = dest; + const char *s = src; + + if (d==s) return d; + if ((uintptr_t)s-(uintptr_t)d-n <= -2*n) return memcpy(d, s, n); + + if (d=WS; n-=WS, d+=WS, s+=WS) *(WT *)d = *(WT *)s; + } +#endif + for (; n; n--) *d++ = *s++; + } else { +#ifdef __GNUC__ + if ((uintptr_t)s % WS == (uintptr_t)d % WS) { + while ((uintptr_t)(d+n) % WS) { + if (!n--) return dest; + d[n] = s[n]; + } + while (n>=WS) n-=WS, *(WT *)(d+n) = *(WT *)(s+n); + } +#endif + while (n) n--, d[n] = s[n]; + } + + return dest; +} diff --git a/Ubiquitous/XiZi/lib/musllib/src/string/memrchr.c b/Ubiquitous/XiZi/lib/musllib/src/string/memrchr.c new file mode 100644 index 000000000..d62bb6258 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/string/memrchr.c @@ -0,0 +1,10 @@ +#include + +void *__memrchr(const void *m, int c, size_t n) +{ + const unsigned char *s = m; + c = (unsigned char)c; + while (n--) if (s[n]==c) return (void *)(s+n); + return 0; +} + diff --git a/Ubiquitous/XiZi/lib/musllib/src/string/memset.c b/Ubiquitous/XiZi/lib/musllib/src/string/memset.c new file mode 100644 index 000000000..f083cee82 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/string/memset.c @@ -0,0 +1,94 @@ +#include +#include + +#ifdef LOSCFG_KERNEL_LMS +__attribute__((no_sanitize_address)) void *__memset(void *dest, int c, size_t n) +#else +void *memset(void *dest, int c, size_t n) +#endif +{ + unsigned char *s = dest; + size_t k; + + /* Fill head and tail with minimal branching. Each + * conditional ensures that all the subsequently used + * offsets are well-defined and in the dest region. */ + + if (!n) return dest; + s[0] = c; + s[n-1] = c; + if (n <= 2) return dest; + s[1] = c; + s[2] = c; + s[n-2] = c; + s[n-3] = c; + if (n <= 6) return dest; + s[3] = c; + s[n-4] = c; + if (n <= 8) return dest; + + /* Advance pointer to align it at a 4-byte boundary, + * and truncate n to a multiple of 4. The previous code + * already took care of any head/tail that get cut off + * by the alignment. */ + + k = -(uintptr_t)s & 3; + s += k; + n -= k; + n &= -4; + +#ifdef __GNUC__ + typedef uint32_t __attribute__((__may_alias__)) u32; + typedef uint64_t __attribute__((__may_alias__)) u64; + + u32 c32 = ((u32)-1)/255 * (unsigned char)c; + + /* In preparation to copy 32 bytes at a time, aligned on + * an 8-byte bounary, fill head/tail up to 28 bytes each. + * As in the initial byte-based head/tail fill, each + * conditional below ensures that the subsequent offsets + * are valid (e.g. !(n<=24) implies n>=28). */ + + *(u32 *)(s+0) = c32; + *(u32 *)(s+n-4) = c32; + if (n <= 8) return dest; + *(u32 *)(s+4) = c32; + *(u32 *)(s+8) = c32; + *(u32 *)(s+n-12) = c32; + *(u32 *)(s+n-8) = c32; + if (n <= 24) return dest; + *(u32 *)(s+12) = c32; + *(u32 *)(s+16) = c32; + *(u32 *)(s+20) = c32; + *(u32 *)(s+24) = c32; + *(u32 *)(s+n-28) = c32; + *(u32 *)(s+n-24) = c32; + *(u32 *)(s+n-20) = c32; + *(u32 *)(s+n-16) = c32; + + /* Align to a multiple of 8 so we can fill 64 bits at a time, + * and avoid writing the same bytes twice as much as is + * practical without introducing additional branching. */ + + k = 24 + ((uintptr_t)s & 4); + s += k; + n -= k; + + /* If this loop is reached, 28 tail bytes have already been + * filled, so any remainder when n drops below 32 can be + * safely ignored. */ + + u64 c64 = c32 | ((u64)c32 << 32); + for (; n >= 32; n-=32, s+=32) { + *(u64 *)(s+0) = c64; + *(u64 *)(s+8) = c64; + *(u64 *)(s+16) = c64; + *(u64 *)(s+24) = c64; + } +#else + /* Pure C fallback with no aliasing violations. */ + for (; n; n--, s++) *s = c; +#endif + + return dest; +} diff --git a/Ubiquitous/XiZi/lib/musllib/src/string/stpcpy.c b/Ubiquitous/XiZi/lib/musllib/src/string/stpcpy.c new file mode 100644 index 000000000..aab59b429 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/string/stpcpy.c @@ -0,0 +1,29 @@ +#include +#include +#include + +#define ALIGN (sizeof(size_t)) +#define ONES ((size_t)-1/UCHAR_MAX) +#define HIGHS (ONES * (UCHAR_MAX/2+1)) +#define HASZERO(x) (((x)-ONES) & ~(x) & HIGHS) + +char *__stpcpy(char *restrict d, const char *restrict s) +{ +#ifdef __GNUC__ + typedef size_t __attribute__((__may_alias__)) word; + word *wd; + const word *ws; + if ((uintptr_t)s % ALIGN == (uintptr_t)d % ALIGN) { + for (; (uintptr_t)s % ALIGN; s++, d++) + if (!(*d=*s)) return d; + wd=(void *)d; ws=(const void *)s; + for (; !HASZERO(*ws); *wd++ = *ws++); + d=(void *)wd; s=(const void *)ws; + } +#endif + for (; (*d=*s); s++, d++); + + return d; +} + +weak_alias(__stpcpy, stpcpy); \ No newline at end of file diff --git a/Ubiquitous/XiZi/lib/musllib/src/string/stpncpy.c b/Ubiquitous/XiZi/lib/musllib/src/string/stpncpy.c new file mode 100644 index 000000000..f57fa6b71 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/string/stpncpy.c @@ -0,0 +1,32 @@ +#include +#include +#include + +#define ALIGN (sizeof(size_t)-1) +#define ONES ((size_t)-1/UCHAR_MAX) +#define HIGHS (ONES * (UCHAR_MAX/2+1)) +#define HASZERO(x) ((x)-ONES & ~(x) & HIGHS) + +char *__stpncpy(char *restrict d, const char *restrict s, size_t n) +{ +#ifdef __GNUC__ + typedef size_t __attribute__((__may_alias__)) word; + word *wd; + const word *ws; + if (((uintptr_t)s & ALIGN) == ((uintptr_t)d & ALIGN)) { + for (; ((uintptr_t)s & ALIGN) && n && (*d=*s); n--, s++, d++); + if (!n || !*s) goto tail; + wd=(void *)d; ws=(const void *)s; + for (; n>=sizeof(size_t) && !HASZERO(*ws); + n-=sizeof(size_t), ws++, wd++) *wd = *ws; + d=(void *)wd; s=(const void *)ws; + } +#endif + for (; n && (*d=*s); n--, s++, d++); +tail: + memset(d, 0, n); + return d; +} + +weak_alias(__stpncpy, stpncpy); + diff --git a/Ubiquitous/XiZi/lib/musllib/src/string/strcasecmp.c b/Ubiquitous/XiZi/lib/musllib/src/string/strcasecmp.c new file mode 100644 index 000000000..fe34ad5cc --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/string/strcasecmp.c @@ -0,0 +1,16 @@ +#include +#include + +int strcasecmp(const char *_l, const char *_r) +{ + const unsigned char *l=(void *)_l, *r=(void *)_r; + for (; *l && *r && (*l == *r || tolower(*l) == tolower(*r)); l++, r++); + return tolower(*l) - tolower(*r); +} + +int __strcasecmp_l(const char *l, const char *r, locale_t loc) +{ + return strcasecmp(l, r); +} + +weak_alias(__strcasecmp_l, strcasecmp_l); \ No newline at end of file diff --git a/Ubiquitous/XiZi/lib/musllib/src/string/strcat.c b/Ubiquitous/XiZi/lib/musllib/src/string/strcat.c new file mode 100644 index 000000000..481ba07b9 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/string/strcat.c @@ -0,0 +1,11 @@ +#include + +#ifdef LOSCFG_KERNEL_LMS +__attribute__((no_sanitize_address)) char *__strcat(char *restrict dest, const char *restrict src) +#else +char *strcat(char *restrict dest, const char *restrict src) +#endif +{ + strcpy(dest + strlen(dest), src); + return dest; +} \ No newline at end of file diff --git a/Ubiquitous/XiZi/lib/musllib/src/string/strchr.c b/Ubiquitous/XiZi/lib/musllib/src/string/strchr.c new file mode 100644 index 000000000..3cbc828be --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/string/strchr.c @@ -0,0 +1,7 @@ +#include + +char *strchr(const char *s, int c) +{ + char *r = __strchrnul(s, c); + return *(unsigned char *)r == (unsigned char)c ? r : 0; +} diff --git a/Ubiquitous/XiZi/lib/musllib/src/string/strchrnul.c b/Ubiquitous/XiZi/lib/musllib/src/string/strchrnul.c new file mode 100644 index 000000000..39e2635b3 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/string/strchrnul.c @@ -0,0 +1,28 @@ +#include +#include +#include + +#define ALIGN (sizeof(size_t)) +#define ONES ((size_t)-1/UCHAR_MAX) +#define HIGHS (ONES * (UCHAR_MAX/2+1)) +#define HASZERO(x) ((x)-ONES & ~(x) & HIGHS) + +char *__strchrnul(const char *s, int c) +{ + c = (unsigned char)c; + if (!c) return (char *)s + strlen(s); + +#ifdef __GNUC__ + typedef size_t __attribute__((__may_alias__)) word; + const word *w; + for (; (uintptr_t)s % ALIGN; s++) + if (!*s || *(unsigned char *)s == c) return (char *)s; + size_t k = ONES * c; + for (w = (void *)s; !HASZERO(*w) && !HASZERO(*w^k); w++); + s = (void *)w; +#endif + for (; *s && *(unsigned char *)s != c; s++); + return (char *)s; +} + +weak_alias(__strchrnul, strchrnul); diff --git a/Ubiquitous/XiZi/lib/musllib/src/string/strcmp.c b/Ubiquitous/XiZi/lib/musllib/src/string/strcmp.c new file mode 100644 index 000000000..808bd8370 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/string/strcmp.c @@ -0,0 +1,7 @@ +#include + +int strcmp(const char *l, const char *r) +{ + for (; *l==*r && *l; l++, r++); + return *(unsigned char *)l - *(unsigned char *)r; +} diff --git a/Ubiquitous/XiZi/lib/musllib/src/string/strcpy.c b/Ubiquitous/XiZi/lib/musllib/src/string/strcpy.c new file mode 100644 index 000000000..30fe31e54 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/string/strcpy.c @@ -0,0 +1,7 @@ +#include + +char *strcpy(char *restrict dest, const char *restrict src) +{ + __stpcpy(dest, src); + return dest; +} \ No newline at end of file diff --git a/Ubiquitous/XiZi/lib/musllib/src/string/strcspn.c b/Ubiquitous/XiZi/lib/musllib/src/string/strcspn.c new file mode 100644 index 000000000..75e262b25 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/string/strcspn.c @@ -0,0 +1,17 @@ +#include "../include/string.h" + +#define BITOP(a,b,op) \ + ((a)[(size_t)(b)/(8*sizeof *(a))] op (size_t)1<<((size_t)(b)%(8*sizeof *(a)))) + +size_t strcspn(const char *s, const char *c) +{ + const char *a = s; + size_t byteset[32/sizeof(size_t)]; + + if (!c[0] || !c[1]) return __strchrnul(s, *c)-a; + + memset(byteset, 0, sizeof byteset); + for (; *c && BITOP(byteset, *(unsigned char *)c, |=); c++); + for (; *s && !BITOP(byteset, *(unsigned char *)s, &); s++); + return s-a; +} diff --git a/Ubiquitous/XiZi/lib/musllib/src/string/strdup.c b/Ubiquitous/XiZi/lib/musllib/src/string/strdup.c new file mode 100644 index 000000000..d4c274494 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/string/strdup.c @@ -0,0 +1,10 @@ +#include +#include + +char *strdup(const char *s) +{ + size_t l = strlen(s); + char *d = malloc(l+1); + if (!d) return NULL; + return memcpy(d, s, l+1); +} diff --git a/Ubiquitous/XiZi/lib/musllib/src/string/strlen.c b/Ubiquitous/XiZi/lib/musllib/src/string/strlen.c new file mode 100644 index 000000000..309990f02 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/string/strlen.c @@ -0,0 +1,22 @@ +#include +#include +#include + +#define ALIGN (sizeof(size_t)) +#define ONES ((size_t)-1/UCHAR_MAX) +#define HIGHS (ONES * (UCHAR_MAX/2+1)) +#define HASZERO(x) ((x)-ONES & ~(x) & HIGHS) + +size_t strlen(const char *s) +{ + const char *a = s; +#ifdef __GNUC__ + typedef size_t __attribute__((__may_alias__)) word; + const word *w; + for (; (uintptr_t)s % ALIGN; s++) if (!*s) return s-a; + for (w = (const void *)s; !HASZERO(*w); w++); + s = (const void *)w; +#endif + for (; *s; s++); + return s-a; +} diff --git a/Ubiquitous/XiZi/lib/musllib/src/string/strncasecmp.c b/Ubiquitous/XiZi/lib/musllib/src/string/strncasecmp.c new file mode 100644 index 000000000..24659721d --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/string/strncasecmp.c @@ -0,0 +1,10 @@ +#include +#include + +int strncasecmp(const char *_l, const char *_r, size_t n) +{ + const unsigned char *l=(void *)_l, *r=(void *)_r; + if (!n--) return 0; + for (; *l && *r && n && (*l == *r || tolower(*l) == tolower(*r)); l++, r++, n--); + return tolower(*l) - tolower(*r); +} diff --git a/Ubiquitous/XiZi/lib/musllib/src/string/strncat.c b/Ubiquitous/XiZi/lib/musllib/src/string/strncat.c new file mode 100644 index 000000000..ee79ebab7 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/string/strncat.c @@ -0,0 +1,13 @@ +#include +#ifdef LOSCFG_KERNEL_LMS +__attribute__((no_sanitize_address)) char *__strncat(char *restrict d, const char *restrict s, size_t n) +#else +char *strncat(char *restrict d, const char *restrict s, size_t n) +#endif +{ + char *a = d; + d += strlen(d); + while (n && *s) n--, *d++ = *s++; + *d++ = 0; + return a; +} diff --git a/Ubiquitous/XiZi/lib/musllib/src/string/strncmp.c b/Ubiquitous/XiZi/lib/musllib/src/string/strncmp.c new file mode 100644 index 000000000..e228843f0 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/string/strncmp.c @@ -0,0 +1,9 @@ +#include + +int strncmp(const char *_l, const char *_r, size_t n) +{ + const unsigned char *l=(void *)_l, *r=(void *)_r; + if (!n--) return 0; + for (; *l && *r && n && *l == *r ; l++, r++, n--); + return *l - *r; +} diff --git a/Ubiquitous/XiZi/lib/musllib/src/string/strncpy.c b/Ubiquitous/XiZi/lib/musllib/src/string/strncpy.c new file mode 100644 index 000000000..10ae710a5 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/string/strncpy.c @@ -0,0 +1,11 @@ +#include + +#ifdef LOSCFG_KERNEL_LMS +__attribute__((no_sanitize_address)) char *__strncpy(char *restrict d, const char *restrict s, size_t n) +#else +char *strncpy(char *restrict d, const char *restrict s, size_t n) +#endif +{ + __stpncpy(d, s, n); + return d; +} \ No newline at end of file diff --git a/Ubiquitous/XiZi/lib/musllib/src/string/strnlen.c b/Ubiquitous/XiZi/lib/musllib/src/string/strnlen.c new file mode 100644 index 000000000..6442eb793 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/string/strnlen.c @@ -0,0 +1,7 @@ +#include + +size_t strnlen(const char *s, size_t n) +{ + const char *p = memchr(s, 0, n); + return p ? p-s : n; +} diff --git a/Ubiquitous/XiZi/lib/musllib/src/string/strrchr.c b/Ubiquitous/XiZi/lib/musllib/src/string/strrchr.c new file mode 100644 index 000000000..98ad1b045 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/string/strrchr.c @@ -0,0 +1,6 @@ +#include + +char *strrchr(const char *s, int c) +{ + return __memrchr(s, c, strlen(s) + 1); +} diff --git a/Ubiquitous/XiZi/lib/musllib/src/string/strspn.c b/Ubiquitous/XiZi/lib/musllib/src/string/strspn.c new file mode 100644 index 000000000..9543dad09 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/string/strspn.c @@ -0,0 +1,20 @@ +#include + +#define BITOP(a,b,op) \ + ((a)[(size_t)(b)/(8*sizeof *(a))] op (size_t)1<<((size_t)(b)%(8*sizeof *(a)))) + +size_t strspn(const char *s, const char *c) +{ + const char *a = s; + size_t byteset[32/sizeof(size_t)] = { 0 }; + + if (!c[0]) return 0; + if (!c[1]) { + for (; *s == *c; s++); + return s-a; + } + + for (; *c && BITOP(byteset, *(unsigned char *)c, |=); c++); + for (; *s && BITOP(byteset, *(unsigned char *)s, &); s++); + return s-a; +} diff --git a/Ubiquitous/XiZi/lib/musllib/src/string/strstr.c b/Ubiquitous/XiZi/lib/musllib/src/string/strstr.c new file mode 100644 index 000000000..55ba1c7b4 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/string/strstr.c @@ -0,0 +1,154 @@ +#include +#include + +static char *twobyte_strstr(const unsigned char *h, const unsigned char *n) +{ + uint16_t nw = n[0]<<8 | n[1], hw = h[0]<<8 | h[1]; + for (h++; *h && hw != nw; hw = hw<<8 | *++h); + return *h ? (char *)h-1 : 0; +} + +static char *threebyte_strstr(const unsigned char *h, const unsigned char *n) +{ + uint32_t nw = n[0]<<24 | n[1]<<16 | n[2]<<8; + uint32_t hw = h[0]<<24 | h[1]<<16 | h[2]<<8; + for (h+=2; *h && hw != nw; hw = (hw|*++h)<<8); + return *h ? (char *)h-2 : 0; +} + +static char *fourbyte_strstr(const unsigned char *h, const unsigned char *n) +{ + uint32_t nw = n[0]<<24 | n[1]<<16 | n[2]<<8 | n[3]; + uint32_t hw = h[0]<<24 | h[1]<<16 | h[2]<<8 | h[3]; + for (h+=3; *h && hw != nw; hw = hw<<8 | *++h); + return *h ? (char *)h-3 : 0; +} + +#define MAX(a,b) ((a)>(b)?(a):(b)) +#define MIN(a,b) ((a)<(b)?(a):(b)) + +#define BITOP(a,b,op) \ + ((a)[(size_t)(b)/(8*sizeof *(a))] op (size_t)1<<((size_t)(b)%(8*sizeof *(a)))) + +static char *twoway_strstr(const unsigned char *h, const unsigned char *n) +{ + const unsigned char *z; + size_t l, ip, jp, k, p, ms, p0, mem, mem0; + size_t byteset[32 / sizeof(size_t)] = { 0 }; + size_t shift[256]; + + /* Computing length of needle and fill shift table */ + for (l=0; n[l] && h[l]; l++) + BITOP(byteset, n[l], |=), shift[n[l]] = l+1; + if (n[l]) return 0; /* hit the end of h */ + + /* Compute maximal suffix */ + ip = -1; jp = 0; k = p = 1; + while (jp+k n[jp+k]) { + jp += k; + k = 1; + p = jp - ip; + } else { + ip = jp++; + k = p = 1; + } + } + ms = ip; + p0 = p; + + /* And with the opposite comparison */ + ip = -1; jp = 0; k = p = 1; + while (jp+k ms+1) ms = ip; + else p = p0; + + /* Periodic needle? */ + if (memcmp(n, n+p, ms+1)) { + mem0 = 0; + p = MAX(ms, l-ms-1) + 1; + } else mem0 = l-p; + mem = 0; + + /* Initialize incremental end-of-haystack pointer */ + z = h; + + /* Search loop */ + for (;;) { + /* Update incremental end-of-haystack pointer */ + if (z-h < l) { + /* Fast estimate for MIN(l,63) */ + size_t grow = l | 63; + const unsigned char *z2 = memchr(z, 0, grow); + if (z2) { + z = z2; + if (z-h < l) return 0; + } else z += grow; + } + + /* Check last byte first; advance by shift on mismatch */ + if (BITOP(byteset, h[l-1], &)) { + k = l-shift[h[l-1]]; + if (k) { + if (k < mem) k = mem; + h += k; + mem = 0; + continue; + } + } else { + h += l; + mem = 0; + continue; + } + + /* Compare right half */ + for (k=MAX(ms+1,mem); n[k] && n[k] == h[k]; k++); + if (n[k]) { + h += k-ms; + mem = 0; + continue; + } + /* Compare left half */ + for (k=ms+1; k>mem && n[k-1] == h[k-1]; k--); + if (k <= mem) return (char *)h; + h += p; + mem = mem0; + } +} + +char *strstr(const char *h, const char *n) +{ + /* Return immediately on empty needle */ + if (!n[0]) return (char *)h; + + /* Use faster algorithms for short needles */ + h = strchr(h, *n); + if (!h || !n[1]) return (char *)h; + if (!h[1]) return 0; + if (!n[2]) return twobyte_strstr((void *)h, (void *)n); + if (!h[2]) return 0; + if (!n[3]) return threebyte_strstr((void *)h, (void *)n); + if (!h[3]) return 0; + if (!n[4]) return fourbyte_strstr((void *)h, (void *)n); + + return twoway_strstr((void *)h, (void *)n); +} diff --git a/Ubiquitous/XiZi/lib/musllib/src/string/strtok.c b/Ubiquitous/XiZi/lib/musllib/src/string/strtok.c new file mode 100644 index 000000000..ee05fc8e0 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/string/strtok.c @@ -0,0 +1,13 @@ +#include + +char *strtok(char *restrict s, const char *restrict sep) +{ + static char *p; + if (!s && !(s = p)) return NULL; + s += strspn(s, sep); + if (!*s) return p = 0; + p = s + strcspn(s, sep); + if (*p) *p++ = 0; + else p = 0; + return s; +} \ No newline at end of file diff --git a/Ubiquitous/XiZi/lib/musllib/src/string/strtok_r.c b/Ubiquitous/XiZi/lib/musllib/src/string/strtok_r.c new file mode 100644 index 000000000..862d4fe48 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/string/strtok_r.c @@ -0,0 +1,12 @@ +#include + +char *strtok_r(char *restrict s, const char *restrict sep, char **restrict p) +{ + if (!s && !(s = *p)) return NULL; + s += strspn(s, sep); + if (!*s) return *p = 0; + *p = s + strcspn(s, sep); + if (**p) *(*p)++ = 0; + else *p = 0; + return s; +} diff --git a/Ubiquitous/XiZi/lib/musllib/src/string/wcschr.c b/Ubiquitous/XiZi/lib/musllib/src/string/wcschr.c new file mode 100644 index 000000000..8dfc2f318 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/string/wcschr.c @@ -0,0 +1,8 @@ +#include + +wchar_t *wcschr(const wchar_t *s, wchar_t c) +{ + if (!c) return (wchar_t *)s + wcslen(s); + for (; *s && *s != c; s++); + return *s ? (wchar_t *)s : 0; +} diff --git a/Ubiquitous/XiZi/lib/musllib/src/string/wcslen.c b/Ubiquitous/XiZi/lib/musllib/src/string/wcslen.c new file mode 100644 index 000000000..1b7b66550 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/string/wcslen.c @@ -0,0 +1,8 @@ +#include + +size_t wcslen(const wchar_t *s) +{ + const wchar_t *a; + for (a=s; *s; s++); + return s-a; +} diff --git a/Ubiquitous/XiZi/lib/musllib/src/time/Makefile b/Ubiquitous/XiZi/lib/musllib/src/time/Makefile new file mode 100644 index 000000000..1e3cdc446 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/time/Makefile @@ -0,0 +1,6 @@ +SRC_FILES := __month_to_secs.c __secs_to_tm.c __tm_to_secs.c __tz.c __year_to_secs.c +SRC_FILES += asctime_r.c asctime.c ctime.c strftime.c strptime.c + + + +include $(KERNEL_ROOT)/compiler.mk \ No newline at end of file diff --git a/Ubiquitous/XiZi/lib/musllib/src/time/__month_to_secs.c b/Ubiquitous/XiZi/lib/musllib/src/time/__month_to_secs.c new file mode 100644 index 000000000..43248fb3c --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/time/__month_to_secs.c @@ -0,0 +1,10 @@ +int __month_to_secs(int month, int is_leap) +{ + static const int secs_through_month[] = { + 0, 31*86400, 59*86400, 90*86400, + 120*86400, 151*86400, 181*86400, 212*86400, + 243*86400, 273*86400, 304*86400, 334*86400 }; + int t = secs_through_month[month]; + if (is_leap && month >= 2) t+=86400; + return t; +} diff --git a/Ubiquitous/XiZi/lib/musllib/src/time/__secs_to_tm.c b/Ubiquitous/XiZi/lib/musllib/src/time/__secs_to_tm.c new file mode 100644 index 000000000..093d9021a --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/time/__secs_to_tm.c @@ -0,0 +1,82 @@ +#include "time_impl.h" +#include + +/* 2000-03-01 (mod 400 year, immediately after feb29 */ +#define LEAPOCH (946684800LL + 86400*(31+29)) + +#define DAYS_PER_400Y (365*400 + 97) +#define DAYS_PER_100Y (365*100 + 24) +#define DAYS_PER_4Y (365*4 + 1) + +int __secs_to_tm(long long t, struct tm *tm) +{ + long long days, secs, years; + int remdays, remsecs, remyears; + int qc_cycles, c_cycles, q_cycles; + int months; + int wday, yday, leap; + static const char days_in_month[] = {31,30,31,30,31,31,30,31,30,31,31,29}; + + /* Reject time_t values whose year would overflow int */ + if (t < INT_MIN * 31622400LL || t > INT_MAX * 31622400LL) + return -1; + + secs = t - LEAPOCH; + days = secs / 86400; + remsecs = secs % 86400; + if (remsecs < 0) { + remsecs += 86400; + days--; + } + + wday = (3+days)%7; + if (wday < 0) wday += 7; + + qc_cycles = days / DAYS_PER_400Y; + remdays = days % DAYS_PER_400Y; + if (remdays < 0) { + remdays += DAYS_PER_400Y; + qc_cycles--; + } + + c_cycles = remdays / DAYS_PER_100Y; + if (c_cycles == 4) c_cycles--; + remdays -= c_cycles * DAYS_PER_100Y; + + q_cycles = remdays / DAYS_PER_4Y; + if (q_cycles == 25) q_cycles--; + remdays -= q_cycles * DAYS_PER_4Y; + + remyears = remdays / 365; + if (remyears == 4) remyears--; + remdays -= remyears * 365; + + leap = !remyears && (q_cycles || !c_cycles); + yday = remdays + 31 + 28 + leap; + if (yday >= 365+leap) yday -= 365+leap; + + years = remyears + 4*q_cycles + 100*c_cycles + 400LL*qc_cycles; + + for (months=0; days_in_month[months] <= remdays; months++) + remdays -= days_in_month[months]; + + if (months >= 10) { + months -= 12; + years++; + } + + if (years+100 > INT_MAX || years+100 < INT_MIN) + return -1; + + tm->tm_year = years + 100; + tm->tm_mon = months + 2; + tm->tm_mday = remdays + 1; + tm->tm_wday = wday; + tm->tm_yday = yday; + + tm->tm_hour = remsecs / 3600; + tm->tm_min = remsecs / 60 % 60; + tm->tm_sec = remsecs % 60; + + return 0; +} diff --git a/Ubiquitous/XiZi/lib/musllib/src/time/__tm_to_secs.c b/Ubiquitous/XiZi/lib/musllib/src/time/__tm_to_secs.c new file mode 100644 index 000000000..c29fa985a --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/time/__tm_to_secs.c @@ -0,0 +1,24 @@ +#include "time_impl.h" + +long long __tm_to_secs(const struct tm *tm) +{ + int is_leap; + long long year = tm->tm_year; + int month = tm->tm_mon; + if (month >= 12 || month < 0) { + int adj = month / 12; + month %= 12; + if (month < 0) { + adj--; + month += 12; + } + year += adj; + } + long long t = __year_to_secs(year, &is_leap); + t += __month_to_secs(month, is_leap); + t += 86400LL * (tm->tm_mday-1); + t += 3600LL * tm->tm_hour; + t += 60LL * tm->tm_min; + t += tm->tm_sec; + return t; +} diff --git a/Ubiquitous/XiZi/lib/musllib/src/time/__tz.c b/Ubiquitous/XiZi/lib/musllib/src/time/__tz.c new file mode 100644 index 000000000..49c2f4bf8 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/time/__tz.c @@ -0,0 +1,234 @@ +#include "time_impl.h" +#include +#include +#include +#include +#include +#include "libc.h" +#include + +long __timezone = 0; +int __daylight = 0; +char *__tzname[2] = { 0, 0 }; + +weak_alias(__timezone, timezone); +weak_alias(__daylight, daylight); +weak_alias(__tzname, tzname); + +#ifndef PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP +#define PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP PTHREAD_MUTEX_INITIALIZER +#endif + +static pthread_mutex_t locallock = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP; + +static int LOCK(void) +{ + return pthread_mutex_lock(&locallock); +} + +static void UNLOCK(void) +{ + (void)pthread_mutex_unlock(&locallock); +} + + +const char __utc[] = "UTC"; + +static int dst_off; +static int r0[5], r1[5]; + +static const unsigned char *zi, *trans, *index_local, *types, *abbrevs, *abbrevs_end; + +#define VEC(...) ((const unsigned char[]){__VA_ARGS__}) + +static uint32_t zi_read32(const unsigned char *z) +{ + return (unsigned)z[0]<<24 | z[1]<<16 | z[2]<<8 | z[3]; +} + +static void do_tzset(void) +{ +} + +/* Search zoneinfo rules to find the one that applies to the given time, + * and determine alternate opposite-DST-status rule that may be needed. */ + +static size_t scan_trans(long long t, int local, size_t *alt) +{ + int scale = 3 - (trans == zi+44); + uint64_t x; + int off = 0; + + size_t a = 0, n = (index_local-trans)>>scale, m; + + if (!n) { + if (alt) *alt = 0; + return 0; + } + + /* Binary search for 'most-recent rule before t'. */ + while (n > 1) { + m = a + n/2; + x = zi_read32(trans + (m<>scale; + if (a == n-1) return -1; + if (a == 0) { + x = zi_read32(trans + (a<>(m-1))&1); +} + +/* Convert a POSIX DST rule plus year to seconds since epoch. */ + +static long long rule_to_secs(const int *rule, int year) +{ + int is_leap; + long long t = __year_to_secs(year, &is_leap); + int x, m, n, d; + if (rule[0]!='M') { + x = rule[1]; + if (rule[0]=='J' && (x < 60 || !is_leap)) x--; + t += 86400 * x; + } else { + m = rule[1]; + n = rule[2]; + d = rule[3]; + t += __month_to_secs(m-1, is_leap); + int wday = (int)((t + 4*86400) % (7*86400)) / 86400; + int days = d - wday; + if (days < 0) days += 7; + if (n == 5 && days+28 >= days_in_month(m, is_leap)) n = 4; + t += 86400 * (days + 7*(n-1)); + } + t += rule[4]; + return t; +} + +/* Determine the time zone in effect for a given time in seconds since the + * epoch. It can be given in local or universal time. The results will + * indicate whether DST is in effect at the queried time, and will give both + * the GMT offset for the active zone/DST rule and the opposite DST. This + * enables a caller to efficiently adjust for the case where an explicit + * DST specification mismatches what would be in effect at the time. */ + +void __secs_to_zone(long long t, int local, int *isdst, long *offset, long *oppoff, const char **zonename) +{ + LOCK(); + + do_tzset(); + + if (zi) { + size_t alt, i = scan_trans(t, local, &alt); + if (i != -1) { + *isdst = types[6*i+4]; + *offset = (int32_t)zi_read32(types+6*i); + *zonename = (const char *)abbrevs + types[6*i+5]; + if (oppoff) *oppoff = (int32_t)zi_read32(types+6*alt); + UNLOCK(); + return; + } + } + + if (!__daylight) goto std; + + /* FIXME: may be broken if DST changes right at year boundary? + * Also, this could be more efficient.*/ + long long y = t / 31556952 + 70; + while (__year_to_secs(y, 0) > t) y--; + while (__year_to_secs(y+1, 0) < t) y++; + + long long t0 = rule_to_secs(r0, y); + long long t1 = rule_to_secs(r1, y); + + if (!local) { + t0 += __timezone; + t1 += dst_off; + } + if (t0 < t1) { + if (t >= t0 && t < t1) goto dst; + goto std; + } else { + if (t >= t1 && t < t0) goto std; + goto dst; + } +std: + *isdst = 0; + *offset = -__timezone; + if (oppoff) *oppoff = -dst_off; + *zonename = __tzname[0]; + UNLOCK(); + return; +dst: + *isdst = 1; + *offset = -dst_off; + if (oppoff) *oppoff = -__timezone; + *zonename = __tzname[1]; + UNLOCK(); +} + +static void __tzset(void) +{ + LOCK(); + do_tzset(); + UNLOCK(); +} + +weak_alias(__tzset, tzset); + +const char *__tm_to_tzname(const struct tm *tm) +{ + const void *p = tm->__tm_zone; + LOCK(); + do_tzset(); + if (p != __utc && p != __tzname[0] && p != __tzname[1] && + (!zi || (uintptr_t)p-(uintptr_t)abbrevs >= abbrevs_end - abbrevs)) + p = ""; + UNLOCK(); + return p; +} diff --git a/Ubiquitous/XiZi/lib/musllib/src/time/__year_to_secs.c b/Ubiquitous/XiZi/lib/musllib/src/time/__year_to_secs.c new file mode 100644 index 000000000..2824ec6dc --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/time/__year_to_secs.c @@ -0,0 +1,47 @@ +long long __year_to_secs(long long year, int *is_leap) +{ + if (year-2ULL <= 136) { + int y = year; + int leaps = (y-68)>>2; + if (!((y-68)&3)) { + leaps--; + if (is_leap) *is_leap = 1; + } else if (is_leap) *is_leap = 0; + return 31536000*(y-70) + 86400*leaps; + } + + int cycles, centuries, leaps, rem; + + if (!is_leap) is_leap = &(int){0}; + cycles = (year-100) / 400; + rem = (year-100) % 400; + if (rem < 0) { + cycles--; + rem += 400; + } + if (!rem) { + *is_leap = 1; + centuries = 0; + leaps = 0; + } else { + if (rem >= 200) { + if (rem >= 300) centuries = 3, rem -= 300; + else centuries = 2, rem -= 200; + } else { + if (rem >= 100) centuries = 1, rem -= 100; + else centuries = 0; + } + if (!rem) { + *is_leap = 0; + leaps = 0; + } else { + leaps = rem / 4U; + rem %= 4U; + *is_leap = !rem; + } + } + + leaps += 97*cycles + 24*centuries - *is_leap; + + return (year-100) * 31536000LL + leaps * 86400LL + 946684800 + 86400; +} diff --git a/Ubiquitous/XiZi/lib/musllib/src/time/asctime.c b/Ubiquitous/XiZi/lib/musllib/src/time/asctime.c new file mode 100644 index 000000000..1febe5440 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/time/asctime.c @@ -0,0 +1,7 @@ +#include + +char *asctime(const struct tm *tm) +{ + static char buf[26]; + return __asctime_r(tm, buf); +} diff --git a/Ubiquitous/XiZi/lib/musllib/src/time/asctime_r.c b/Ubiquitous/XiZi/lib/musllib/src/time/asctime_r.c new file mode 100644 index 000000000..fce9a819c --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/time/asctime_r.c @@ -0,0 +1,28 @@ +#include +#include +#include +#include "locale_impl.h" +//#include "atomic.h" + +char *__asctime_r(const struct tm *restrict tm, char *restrict buf) +{ + if (snprintf(buf, 26, "%.3s %.3s%3d %.2d:%.2d:%.2d %d\n", + __nl_langinfo_l(ABDAY_1+tm->tm_wday, C_LOCALE), + __nl_langinfo_l(ABMON_1+tm->tm_mon, C_LOCALE), + tm->tm_mday, tm->tm_hour, + tm->tm_min, tm->tm_sec, + 1900 + tm->tm_year) >= 26) + { + /* ISO C requires us to use the above format string, + * even if it will not fit in the buffer. Thus asctime_r + * is _supposed_ to crash if the fields in tm are too large. + * We follow this behavior and crash "gracefully" to warn + * application developers that they may not be so lucky + * on other implementations (e.g. stack smashing..). + */ + //a_crash(); + } + return buf; +} + +weak_alias(__asctime_r, asctime_r); diff --git a/Ubiquitous/XiZi/lib/musllib/src/time/ctime.c b/Ubiquitous/XiZi/lib/musllib/src/time/ctime.c new file mode 100644 index 000000000..360293151 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/time/ctime.c @@ -0,0 +1,8 @@ +#include + +char *ctime(const time_t *t) +{ + struct tm *tm = localtime(t); + if (!tm) return 0; + return asctime(tm); +} diff --git a/Ubiquitous/XiZi/lib/musllib/src/time/strftime.c b/Ubiquitous/XiZi/lib/musllib/src/time/strftime.c new file mode 100644 index 000000000..cc53d5369 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/time/strftime.c @@ -0,0 +1,281 @@ +#include +#include +#include +#include +#include +#include +#include +#include "locale_impl.h" +#include "time_impl.h" + +static int is_leap(int y) +{ + /* Avoid overflow */ + if (y>INT_MAX-1900) y -= 2000; + y += 1900; + return !(y%4) && ((y%100) || !(y%400)); +} + +static int week_num(const struct tm *tm) +{ + int val = (tm->tm_yday + 7U - (tm->tm_wday+6U)%7) / 7; + /* If 1 Jan is just 1-3 days past Monday, + * the previous week is also in this year. */ + if ((tm->tm_wday + 371U - tm->tm_yday - 2) % 7 <= 2) + val++; + if (!val) { + val = 52; + /* If 31 December of prev year a Thursday, + * or Friday of a leap year, then the + * prev year has 53 weeks. */ + int dec31 = (tm->tm_wday + 7U - tm->tm_yday - 1) % 7; + if (dec31 == 4 || (dec31 == 5 && is_leap(tm->tm_year%400-1))) + val++; + } else if (val == 53) { + /* If 1 January is not a Thursday, and not + * a Wednesday of a leap year, then this + * year has only 52 weeks. */ + int jan1 = (tm->tm_wday + 371U - tm->tm_yday) % 7; + if (jan1 != 4 && (jan1 != 3 || !is_leap(tm->tm_year))) + val = 1; + } + return val; +} + +const char *__strftime_fmt_1(char (*s)[100], size_t *l, int f, const struct tm *tm, locale_t loc, int pad) +{ + nl_item item; + long long val; + const char *fmt = "-"; + int width = 2, def_pad = '0'; + + switch (f) { + case 'a': + if (tm->tm_wday > 6U) goto string; + item = ABDAY_1 + tm->tm_wday; + goto nl_strcat; + case 'A': + if (tm->tm_wday > 6U) goto string; + item = DAY_1 + tm->tm_wday; + goto nl_strcat; + case 'h': + case 'b': + if (tm->tm_mon > 11U) goto string; + item = ABMON_1 + tm->tm_mon; + goto nl_strcat; + case 'B': + if (tm->tm_mon > 11U) goto string; + item = MON_1 + tm->tm_mon; + goto nl_strcat; + case 'c': + item = D_T_FMT; + goto nl_strftime; + case 'C': + val = (1900LL+tm->tm_year) / 100; + goto number; + case 'e': + def_pad = '_'; + case 'd': + val = tm->tm_mday; + goto number; + case 'D': + fmt = "%m/%d/%y"; + goto recu_strftime; + case 'F': + fmt = "%Y-%m-%d"; + goto recu_strftime; + case 'g': + case 'G': + val = tm->tm_year + 1900LL; + if (tm->tm_yday < 3 && week_num(tm) != 1) val--; + else if (tm->tm_yday > 360 && week_num(tm) == 1) val++; + if (f=='g') val %= 100; + else width = 4; + goto number; + case 'H': + val = tm->tm_hour; + goto number; + case 'I': + val = tm->tm_hour; + if (!val) val = 12; + else if (val > 12) val -= 12; + goto number; + case 'j': + val = tm->tm_yday+1; + width = 3; + goto number; + case 'm': + val = tm->tm_mon+1; + goto number; + case 'M': + val = tm->tm_min; + goto number; + case 'n': + *l = 1; + return "\n"; + case 'p': + item = tm->tm_hour >= 12 ? PM_STR : AM_STR; + goto nl_strcat; + case 'r': + item = T_FMT_AMPM; + goto nl_strftime; + case 'R': + fmt = "%H:%M"; + goto recu_strftime; + case 's': + val = __tm_to_secs(tm) - tm->__tm_gmtoff; + width = 1; + goto number; + case 'S': + val = tm->tm_sec; + goto number; + case 't': + *l = 1; + return "\t"; + case 'T': + fmt = "%H:%M:%S"; + goto recu_strftime; + case 'u': + val = tm->tm_wday ? tm->tm_wday : 7; + width = 1; + goto number; + case 'U': + val = (tm->tm_yday + 7U - tm->tm_wday) / 7; + goto number; + case 'W': + val = (tm->tm_yday + 7U - (tm->tm_wday+6U)%7) / 7; + goto number; + case 'V': + val = week_num(tm); + goto number; + case 'w': + val = tm->tm_wday; + width = 1; + goto number; + case 'x': + item = D_FMT; + goto nl_strftime; + case 'X': + item = T_FMT; + goto nl_strftime; + case 'y': + val = (tm->tm_year + 1900LL) % 100; + if (val < 0) val = -val; + goto number; + case 'Y': + val = tm->tm_year + 1900LL; + if (val >= 10000) { + *l = snprintf(*s, sizeof *s, "+%lld", val); + return *s; + } + width = 4; + goto number; + case 'z': + if (tm->tm_isdst < 0) { + *l = 0; + return ""; + } + *l = snprintf(*s, sizeof *s, "%+.4ld", + tm->__tm_gmtoff/3600*100 + tm->__tm_gmtoff%3600/60); + return *s; + case 'Z': + if (tm->tm_isdst < 0) { + *l = 0; + return ""; + } + fmt = __tm_to_tzname(tm); + goto string; + case '%': + *l = 1; + return "%"; + default: + return 0; + } +number: + switch (pad ? pad : def_pad) { + case '-': *l = snprintf(*s, sizeof *s, "%lld", val); break; + case '_': *l = snprintf(*s, sizeof *s, "%*lld", width, val); break; + case '0': + default: *l = snprintf(*s, sizeof *s, "%0*lld", width, val); break; + } + return *s; +nl_strcat: + fmt = __nl_langinfo_l(item, loc); +string: + *l = strlen(fmt); + return fmt; +nl_strftime: + fmt = __nl_langinfo_l(item, loc); +recu_strftime: + *l = __strftime_l(*s, sizeof *s, fmt, tm, loc); + if (!*l) return 0; + return *s; +} + +size_t __strftime_l(char *restrict s, size_t n, const char *restrict f, const struct tm *restrict tm, locale_t loc) +{ + size_t l, k; + char buf[100]; + char *p; + const char *t; + int pad, plus; + unsigned long width; + for (l=0; ltm_year < -1900) { + s[l++] = '-'; + width--; + } else if (plus && d+(width-k) >= (*p=='C'?3:5)) { + s[l++] = '+'; + width--; + } + for (; width > k && l < n; width--) + s[l++] = '0'; + } + if (k > n-l) k = n-l; + memcpy(s+l, t, k); + l += k; + } + if (n) { + if (l==n) l=n-1; + s[l] = 0; + } + return 0; +} + +size_t strftime(char *restrict s, size_t n, const char *restrict f, const struct tm *restrict tm) +{ + return __strftime_l(s, n, f, tm, CURRENT_LOCALE); +} + +weak_alias(__strftime_l, strftime_l); diff --git a/Ubiquitous/XiZi/lib/musllib/src/time/strptime.c b/Ubiquitous/XiZi/lib/musllib/src/time/strptime.c new file mode 100644 index 000000000..d4b8f2534 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/time/strptime.c @@ -0,0 +1,206 @@ +#include +#include +#include +#include +#include +#include +#include + +char *strptime(const char *restrict s, const char *restrict f, struct tm *restrict tm) +{ + int i, w, neg, adj, min, range, *dest, dummy; + const char *ex; + size_t len; + int want_century = 0, century = 0, relyear = 0; + while (*f) { + if (*f != '%') { + if (isspace(*f)) for (; *s && isspace(*s); s++); + else if (*s != *f) return 0; + else s++; + f++; + continue; + } + f++; + if (*f == '+') f++; + if (isdigit(*f)) { + char *new_f; + w=strtoul(f, &new_f, 10); + f = new_f; + } else { + w=-1; + } + adj=0; + switch (*f++) { + case 'a': case 'A': + dest = &tm->tm_wday; + min = ABDAY_1; + range = 7; + goto symbolic_range; + case 'b': case 'B': case 'h': + dest = &tm->tm_mon; + min = ABMON_1; + range = 12; + goto symbolic_range; + case 'c': + s = strptime(s, nl_langinfo(D_T_FMT), tm); + if (!s) return 0; + break; + case 'C': + dest = ¢ury; + if (w<0) w=2; + want_century |= 2; + goto numeric_digits; + case 'd': case 'e': + dest = &tm->tm_mday; + min = 1; + range = 31; + goto numeric_range; + case 'D': + s = strptime(s, "%m/%d/%y", tm); + if (!s) return 0; + break; + case 'H': + dest = &tm->tm_hour; + min = 0; + range = 24; + goto numeric_range; + case 'I': + dest = &tm->tm_hour; + min = 1; + range = 12; + goto numeric_range; + case 'j': + dest = &tm->tm_yday; + min = 1; + range = 366; + adj = 1; + goto numeric_range; + case 'm': + dest = &tm->tm_mon; + min = 1; + range = 12; + adj = 1; + goto numeric_range; + case 'M': + dest = &tm->tm_min; + min = 0; + range = 60; + goto numeric_range; + case 'n': case 't': + for (; *s && isspace(*s); s++); + break; + case 'p': + ex = nl_langinfo(AM_STR); + len = strlen(ex); + if (!strncasecmp(s, ex, len)) { + tm->tm_hour %= 12; + s += len; + break; + } + ex = nl_langinfo(PM_STR); + len = strlen(ex); + if (!strncasecmp(s, ex, len)) { + tm->tm_hour %= 12; + tm->tm_hour += 12; + s += len; + break; + } + return 0; + case 'r': + s = strptime(s, nl_langinfo(T_FMT_AMPM), tm); + if (!s) return 0; + break; + case 'R': + s = strptime(s, "%H:%M", tm); + if (!s) return 0; + break; + case 'S': + dest = &tm->tm_sec; + min = 0; + range = 61; + goto numeric_range; + case 'T': + s = strptime(s, "%H:%M:%S", tm); + if (!s) return 0; + break; + case 'U': + case 'W': + /* Throw away result, for now. (FIXME?) */ + dest = &dummy; + min = 0; + range = 54; + goto numeric_range; + case 'w': + dest = &tm->tm_wday; + min = 0; + range = 7; + goto numeric_range; + case 'x': + s = strptime(s, nl_langinfo(D_FMT), tm); + if (!s) return 0; + break; + case 'X': + s = strptime(s, nl_langinfo(T_FMT), tm); + if (!s) return 0; + break; + case 'y': + dest = &relyear; + w = 2; + want_century |= 1; + goto numeric_digits; + case 'Y': + dest = &tm->tm_year; + if (w<0) w=4; + adj = 1900; + want_century = 0; + goto numeric_digits; + case '%': + if (*s++ != '%') return 0; + break; + default: + return 0; + numeric_range: + if (!isdigit(*s)) return 0; + *dest = 0; + for (i=1; i<=min+range && isdigit(*s); i*=10) + *dest = *dest * 10 + *s++ - '0'; + if (*dest - min >= (int)range) return 0; + *dest -= adj; + switch((char *)dest - (char *)tm) { + case offsetof(struct tm, tm_yday): + ; + } + goto update; + numeric_digits: + neg = 0; + if (*s == '+') s++; + else if (*s == '-') neg=1, s++; + if (!isdigit(*s)) return 0; + for (*dest=i=0; i=0; i--) { + ex = nl_langinfo(min+i); + len = strlen(ex); + if (strncasecmp(s, ex, len)) continue; + s += len; + *dest = i % range; + break; + } + if (i<0) return 0; + goto update; + update: + //FIXME + ; + } + } + if (want_century) { + tm->tm_year = relyear; + if (want_century & 2) tm->tm_year += century * 100 - 1900; + else if (tm->tm_year <= 68) tm->tm_year += 100; + } + return (char *)s; +} diff --git a/Ubiquitous/XiZi/lib/musllib/src/time/time_impl.h b/Ubiquitous/XiZi/lib/musllib/src/time/time_impl.h new file mode 100644 index 000000000..cd9454330 --- /dev/null +++ b/Ubiquitous/XiZi/lib/musllib/src/time/time_impl.h @@ -0,0 +1,14 @@ +#include +#include "../include/features.h" + +hidden int __days_in_month(int, int); +hidden int __month_to_secs(int, int); +hidden long long __year_to_secs(long long, int *); +hidden long long __tm_to_secs(const struct tm *); +hidden const char *__tm_to_tzname(const struct tm *); +hidden int __secs_to_tm(long long, struct tm *); +hidden void __secs_to_zone(long long, int, int *, long *, long *, const char **); +hidden const char *__strftime_fmt_1(char (*)[100], size_t *, int, const struct tm *, locale_t, int); +extern hidden const char __utc[]; + +hidden size_t __strftime_l(char *restrict, size_t, const char *restrict, const struct tm *restrict, locale_t); diff --git a/Ubiquitous/XiZi/lib/newlib/Kconfig b/Ubiquitous/XiZi/lib/newlib/Kconfig index b04bc193a..c587e3962 100644 --- a/Ubiquitous/XiZi/lib/newlib/Kconfig +++ b/Ubiquitous/XiZi/lib/newlib/Kconfig @@ -1,5 +1,6 @@ -menuconfig LIB_NEWLIB -bool "Enable Newlib " -default y +menu LIB_NEWLIB + bool "Enable Newlib " + default y +endmenu diff --git a/Ubiquitous/XiZi/link.mk b/Ubiquitous/XiZi/link.mk index 19d534dea..f0486397d 100644 --- a/Ubiquitous/XiZi/link.mk +++ b/Ubiquitous/XiZi/link.mk @@ -3,8 +3,7 @@ OBJS := $(shell cat make.obj) $(TARGET): $(OBJS) @echo ------------------------------------------------ @echo link $(TARGET) - @$(CROSS_COMPILE)g++ -o $@ $($(LINK_FLAGS)) $(OBJS) -lc -lm + @$(CROSS_COMPILE)g++ -o $@ $($(LINK_FLAGS)) $(OBJS) $(LINK_MUSLLIB) $(LINK_LWIP) $(LIBCC) @echo ------------------------------------------------ @$(CROSS_COMPILE)objcopy -O binary $@ XiZi-$(BOARD)$(COMPILE_TYPE).bin - @$(CROSS_COMPILE)size $@ - + @$(CROSS_COMPILE)size $@ \ No newline at end of file diff --git a/Ubiquitous/XiZi/link_libc.mk b/Ubiquitous/XiZi/link_libc.mk new file mode 100644 index 000000000..568c910b0 --- /dev/null +++ b/Ubiquitous/XiZi/link_libc.mk @@ -0,0 +1,9 @@ +OBJS := $(shell cat make.obj) + +$(TARGET): $(OBJS) + @echo ------------------------------------------------ + @echo link $(TARGET) + @$(CROSS_COMPILE)ar -r $@ $(OBJS) + @echo ------------------------------------------------ + @$(CROSS_COMPILE)objcopy $@ $(TARGET) + @$(CROSS_COMPILE)size $@ \ No newline at end of file diff --git a/Ubiquitous/XiZi/link_lwip.mk b/Ubiquitous/XiZi/link_lwip.mk new file mode 100644 index 000000000..568c910b0 --- /dev/null +++ b/Ubiquitous/XiZi/link_lwip.mk @@ -0,0 +1,9 @@ +OBJS := $(shell cat make.obj) + +$(TARGET): $(OBJS) + @echo ------------------------------------------------ + @echo link $(TARGET) + @$(CROSS_COMPILE)ar -r $@ $(OBJS) + @echo ------------------------------------------------ + @$(CROSS_COMPILE)objcopy $@ $(TARGET) + @$(CROSS_COMPILE)size $@ \ No newline at end of file diff --git a/Ubiquitous/XiZi/path_app.mk b/Ubiquitous/XiZi/path_app.mk index 3c69c9794..3a895152f 100644 --- a/Ubiquitous/XiZi/path_app.mk +++ b/Ubiquitous/XiZi/path_app.mk @@ -32,13 +32,13 @@ ifeq ($(CONFIG_CRYPTO), y) APPPATHS += -I$(KERNEL_ROOT)/../../APP_Framework/Framework/security/crypto/include # endif -COMPILE_APP: - @$(eval CPPPATHS=$(APPPATHS)) - @echo $(SRC_APP_DIR) - @for dir in $(SRC_APP_DIR);do \ - $(MAKE) -C $$dir; \ - done - @cp link.mk build/Makefile - @$(MAKE) -C build COMPILE_TYPE="_app" TARGET=XiZi-$(BOARD)_app.elf LINK_FLAGS=APPLFLAGS - @rm build/Makefile build/make.obj +# COMPILE_APP: +# @$(eval CPPPATHS=$(APPPATHS)) +# @echo $(SRC_APP_DIR) +# @for dir in $(SRC_APP_DIR);do \ +# $(MAKE) -C $$dir; \ +# done +# @cp link.mk build/Makefile +# @$(MAKE) -C build COMPILE_TYPE="_app" TARGET=XiZi-$(BOARD)_app.elf LINK_FLAGS=APPLFLAGS USE_APP_INCLUDEPATH=y +# @rm build/Makefile build/make.obj diff --git a/Ubiquitous/XiZi/path_kernel.mk b/Ubiquitous/XiZi/path_kernel.mk index 32cb654c9..e010e3a13 100755 --- a/Ubiquitous/XiZi/path_kernel.mk +++ b/Ubiquitous/XiZi/path_kernel.mk @@ -18,7 +18,13 @@ KERNELPATHS :=-I$(BSP_ROOT) \ -I$(BSP_ROOT)/third_party_driver/MIMXRT1052 \ -I$(BSP_ROOT)/third_party_driver/MIMXRT1052/drivers \ -I$(BSP_ROOT)/third_party_driver/CMSIS/Include \ + -I$(BSP_ROOT)/include \ + -I$(BSP_ROOT)/xip \ -I$(KERNEL_ROOT)/include \ + -I$(KERNEL_ROOT)/resources/include + +ifeq ($(CONFIG_RESOURCES_LWIP),y) +KERNELPATHS +=-I$(BSP_ROOT) \ -I$(KERNEL_ROOT)/resources/ethernet/LwIP \ -I$(KERNEL_ROOT)/resources/ethernet/LwIP/include \ -I$(KERNEL_ROOT)/resources/ethernet/LwIP/include/compat \ @@ -27,10 +33,8 @@ KERNELPATHS :=-I$(BSP_ROOT) \ -I$(KERNEL_ROOT)/resources/ethernet/LwIP/include/lwip/apps \ -I$(KERNEL_ROOT)/resources/ethernet/LwIP/include/lwip/priv \ -I$(KERNEL_ROOT)/resources/ethernet/LwIP/include/lwip/prot \ - -I$(KERNEL_ROOT)/resources/ethernet/LwIP/arch \ - -I$(KERNEL_ROOT)/resources/include \ - -I$(BSP_ROOT)/include \ - -I$(BSP_ROOT)/xip # + -I$(KERNEL_ROOT)/resources/ethernet/LwIP/arch +endif endif ifeq ($(BSP_ROOT),$(KERNEL_ROOT)/board/xidatong-riscv64) @@ -75,6 +79,9 @@ KERNELPATHS :=-I$(BSP_ROOT) \ -I$(BSP_ROOT)/third_party_driver/include \ -I$(BSP_ROOT)/third_party_driver/usb/STM32_USB_OTG_Driver/inc \ -I$(KERNEL_ROOT)/include \ + +ifeq ($(CONFIG_RESOURCES_LWIP),y) +KERNELPATHS :=-I$(BSP_ROOT) \ -I$(KERNEL_ROOT)/resources/ethernet/LwIP \ -I$(KERNEL_ROOT)/resources/ethernet/LwIP/include \ -I$(KERNEL_ROOT)/resources/ethernet/LwIP/include/compat \ @@ -83,8 +90,8 @@ KERNELPATHS :=-I$(BSP_ROOT) \ -I$(KERNEL_ROOT)/resources/ethernet/LwIP/include/lwip/apps \ -I$(KERNEL_ROOT)/resources/ethernet/LwIP/include/lwip/priv \ -I$(KERNEL_ROOT)/resources/ethernet/LwIP/include/lwip/prot \ - -I$(KERNEL_ROOT)/resources/ethernet/LwIP/arch \ - -I$(BSP_ROOT)/include # + -I$(KERNEL_ROOT)/resources/ethernet/LwIP/arch +endif endif ifeq ($(BSP_ROOT),$(KERNEL_ROOT)/board/aiit-arm32-board) @@ -237,7 +244,13 @@ KERNELPATHS :=-I$(BSP_ROOT) \ -I$(BSP_ROOT)/third_party_driver/MIMXRT1052 \ -I$(BSP_ROOT)/third_party_driver/MIMXRT1052/drivers \ -I$(BSP_ROOT)/third_party_driver/CMSIS/Include \ + -I$(BSP_ROOT)/include \ + -I$(BSP_ROOT)/xip \ -I$(KERNEL_ROOT)/include \ + -I$(KERNEL_ROOT)/resources/include + +ifeq ($(CONFIG_RESOURCES_LWIP),y) +KERNELPATHS +=-I$(BSP_ROOT) \ -I$(KERNEL_ROOT)/resources/ethernet/LwIP \ -I$(KERNEL_ROOT)/resources/ethernet/LwIP/include \ -I$(KERNEL_ROOT)/resources/ethernet/LwIP/include/compat \ @@ -246,10 +259,8 @@ KERNELPATHS :=-I$(BSP_ROOT) \ -I$(KERNEL_ROOT)/resources/ethernet/LwIP/include/lwip/apps \ -I$(KERNEL_ROOT)/resources/ethernet/LwIP/include/lwip/priv \ -I$(KERNEL_ROOT)/resources/ethernet/LwIP/include/lwip/prot \ - -I$(KERNEL_ROOT)/resources/ethernet/LwIP/arch \ - -I$(KERNEL_ROOT)/resources/include \ - -I$(BSP_ROOT)/include \ - -I$(BSP_ROOT)/xip # + -I$(KERNEL_ROOT)/resources/ethernet/LwIP/arch +endif endif ifeq ($(BSP_ROOT),$(KERNEL_ROOT)/board/stm32f103-nano) @@ -290,7 +301,9 @@ endif ifeq ($(CONFIG_TRANSFORM_LAYER_ATTRIUBUTE), y) ifeq ($(CONFIG_ADD_XIZI_FETURES), y) +ifeq ($(CONFIG_LIB_MUSLLIB), ) KERNELPATHS += -I$(KERNEL_ROOT)/../../APP_Framework/Framework/transform_layer/xizi/user_api/posix_support/include # +endif KERNELPATHS += -I$(KERNEL_ROOT)/../../APP_Framework/Framework/transform_layer/xizi # endif @@ -365,6 +378,12 @@ ifeq ($(CONFIG_LIB_NEWLIB),y) KERNELPATHS += -I$(KERNEL_ROOT)/lib/newlib/include # endif +ifeq ($(CONFIG_LIB_MUSLLIB), y) +KERNELPATHS += -I$(KERNEL_ROOT)/lib/musllib/src/include # +KERNELPATHS += -I$(KERNEL_ROOT)/lib/musllib/include # +KERNELPATHS += -I$(KERNEL_ROOT)/lib/musllib/src/internal # +endif + ifeq ($(CONFIG_FS_LWEXT4),y) KERNELPATHS += -I$(KERNEL_ROOT)/fs/lwext4/lwext4_submodule/blockdev/xiuos # KERNELPATHS += -I$(KERNEL_ROOT)/fs/lwext4/lwext4_submodule/include # @@ -398,12 +417,12 @@ endif KERNELPATHS += -I$(KERNEL_ROOT)/kernel/include # -COMPILE_KERNEL: - @$(eval CPPPATHS=$(KERNELPATHS)) - @for dir in $(SRC_KERNEL_DIR);do \ - $(MAKE) -C $$dir; \ - done - @cp link.mk build/Makefile - @$(MAKE) -C build COMPILE_TYPE="_kernel" TARGET=XiZi-$(BOARD)_kernel.elf LINK_FLAGS=LFLAGS - @rm build/Makefile build/make.obj +# COMPILE_KERNEL: +# @$(eval CPPPATHS=$(KERNELPATHS)) +# @for dir in $(SRC_KERNEL_DIR);do \ +# $(MAKE) -C $$dir; \ +# done +# @cp link.mk build/Makefile +# @$(MAKE) -C build COMPILE_TYPE="_kernel" TARGET=XiZi-$(BOARD)_kernel.elf LINK_FLAGS=LFLAGS +# @rm build/Makefile build/make.obj diff --git a/Ubiquitous/XiZi/resources/Makefile b/Ubiquitous/XiZi/resources/Makefile index 3c10a79f9..2c029db7a 100644 --- a/Ubiquitous/XiZi/resources/Makefile +++ b/Ubiquitous/XiZi/resources/Makefile @@ -50,7 +50,7 @@ ifeq ($(CONFIG_RESOURCES_USB),y) endif ifeq ($(CONFIG_RESOURCES_LWIP),y) - SRC_DIR += ethernet + # SRC_DIR += ethernet endif ifeq ($(CONFIG_RESOURCES_WDT),y) diff --git a/Ubiquitous/XiZi/resources/ethernet/LwIP/Makefile b/Ubiquitous/XiZi/resources/ethernet/LwIP/Makefile index a5d3576a8..1c0cdf531 100644 --- a/Ubiquitous/XiZi/resources/ethernet/LwIP/Makefile +++ b/Ubiquitous/XiZi/resources/ethernet/LwIP/Makefile @@ -3,4 +3,9 @@ SRC_DIR += arch SRC_DIR += core SRC_DIR += netif +LWIP_DIR += api +LWIP_DIR += arch +LWIP_DIR += core +LWIP_DIR += netif + include $(KERNEL_ROOT)/compiler.mk diff --git a/Ubiquitous/XiZi/resources/ethernet/LwIP/api/sockets.c b/Ubiquitous/XiZi/resources/ethernet/LwIP/api/sockets.c index 2660f73e5..3ddd778f5 100644 --- a/Ubiquitous/XiZi/resources/ethernet/LwIP/api/sockets.c +++ b/Ubiquitous/XiZi/resources/ethernet/LwIP/api/sockets.c @@ -54,6 +54,7 @@ #include "lwip/netif.h" #include "lwip/priv/tcpip_priv.h" #include "lwip/mld6.h" +#include "lwip/errno.h" #if LWIP_CHECKSUM_ON_COPY #include "lwip/inet_chksum.h" #endif diff --git a/Ubiquitous/XiZi/resources/ethernet/LwIP/core/Makefile b/Ubiquitous/XiZi/resources/ethernet/LwIP/core/Makefile index 148361508..dda9ed9f7 100644 --- a/Ubiquitous/XiZi/resources/ethernet/LwIP/core/Makefile +++ b/Ubiquitous/XiZi/resources/ethernet/LwIP/core/Makefile @@ -20,5 +20,6 @@ SRC_FILES += altcp_alloc.c \ udp.c SRC_DIR += ipv4 +LWIP_DIR += ipv4 include $(KERNEL_ROOT)/compiler.mk diff --git a/Ubiquitous/XiZi/resources/ethernet/LwIP/include/lwip/errno.h b/Ubiquitous/XiZi/resources/ethernet/LwIP/include/lwip/errno.h index a62bfe5ee..2628f08fa 100644 --- a/Ubiquitous/XiZi/resources/ethernet/LwIP/include/lwip/errno.h +++ b/Ubiquitous/XiZi/resources/ethernet/LwIP/include/lwip/errno.h @@ -178,12 +178,12 @@ extern "C" { #define EMEDIUMTYPE 124 /* Wrong medium type */ #ifndef errno -extern int errno; + extern int errno; #endif #else /* LWIP_PROVIDE_ERRNO */ -/* Define LWIP_ERRNO_STDINCLUDE if you want to include here */ + /* Define LWIP_ERRNO_STDINCLUDE if you want to include here */ #ifdef LWIP_ERRNO_STDINCLUDE #include #else /* LWIP_ERRNO_STDINCLUDE */ @@ -194,7 +194,7 @@ extern int errno; #endif /* LWIP_ERRNO_STDINCLUDE */ #endif /* LWIP_PROVIDE_ERRNO */ - + #ifdef __cplusplus } #endif diff --git a/Ubiquitous/XiZi/resources/ethernet/LwIP/include/lwip/priv/sockets_priv.h b/Ubiquitous/XiZi/resources/ethernet/LwIP/include/lwip/priv/sockets_priv.h index d8f9904dc..8b5fba005 100644 --- a/Ubiquitous/XiZi/resources/ethernet/LwIP/include/lwip/priv/sockets_priv.h +++ b/Ubiquitous/XiZi/resources/ethernet/LwIP/include/lwip/priv/sockets_priv.h @@ -42,6 +42,7 @@ #if LWIP_SOCKET /* don't build if not configured for use in lwipopts.h */ #include "lwip/err.h" +// #include "lwip/errno.h" #include "lwip/sockets.h" #include "lwip/sys.h" diff --git a/Ubiquitous/XiZi/resources/ethernet/LwIP/include/lwip/sockets.h b/Ubiquitous/XiZi/resources/ethernet/LwIP/include/lwip/sockets.h index 9492e78ef..676fe3093 100644 --- a/Ubiquitous/XiZi/resources/ethernet/LwIP/include/lwip/sockets.h +++ b/Ubiquitous/XiZi/resources/ethernet/LwIP/include/lwip/sockets.h @@ -520,11 +520,11 @@ struct pollfd #define LWIP_TIMEVAL_PRIVATE 1 #endif -#if LWIP_TIMEVAL_PRIVATE -// struct timeval { -// long tv_sec; /* seconds */ -// long tv_usec; /* and microseconds */ -// }; +#if defined(LWIP_TIMEVAL_PRIVATE) && defined(LIB_MUSLLIB) +struct timeval { + long tv_sec; /* seconds */ + long tv_usec; /* and microseconds */ +}; #endif /* LWIP_TIMEVAL_PRIVATE */ #define lwip_socket_init() /* Compatibility define, no init needed. */ diff --git a/Ubiquitous/XiZi/resources/ethernet/LwIP/liblwip.a b/Ubiquitous/XiZi/resources/ethernet/LwIP/liblwip.a new file mode 100644 index 000000000..d188d3c11 Binary files /dev/null and b/Ubiquitous/XiZi/resources/ethernet/LwIP/liblwip.a differ diff --git a/Ubiquitous/XiZi/resources/ethernet/Makefile b/Ubiquitous/XiZi/resources/ethernet/Makefile index 7173fa1c9..6dfd87380 100644 --- a/Ubiquitous/XiZi/resources/ethernet/Makefile +++ b/Ubiquitous/XiZi/resources/ethernet/Makefile @@ -1,3 +1,4 @@ SRC_DIR += LwIP cmd_lwip +LWIP_DIR := LwIP include $(KERNEL_ROOT)/compiler.mk diff --git a/Ubiquitous/XiZi/resources/ethernet/cmd_lwip/Makefile b/Ubiquitous/XiZi/resources/ethernet/cmd_lwip/Makefile index 20a73337b..9426c8faf 100755 --- a/Ubiquitous/XiZi/resources/ethernet/cmd_lwip/Makefile +++ b/Ubiquitous/XiZi/resources/ethernet/cmd_lwip/Makefile @@ -1,3 +1,3 @@ -SRC_FILES := ping.c lwip_ping_demo.c lwip_udp_demo.c lwip_tcp_demo.c tcpecho_raw.c lwip_config_demo.c lwip_dhcp_demo.c +SRC_FILES := ping.c lwip_ping_demo.c lwip_tcp_demo.c lwip_udp_demo.c tcpecho_raw.c lwip_config_demo.c lwip_dhcp_demo.c include $(KERNEL_ROOT)/compiler.mk diff --git a/Ubiquitous/XiZi/resources/ethernet/cmd_lwip/lwip_config_demo.c b/Ubiquitous/XiZi/resources/ethernet/cmd_lwip/lwip_config_demo.c index 7e94dc272..f213e6c47 100755 --- a/Ubiquitous/XiZi/resources/ethernet/cmd_lwip/lwip_config_demo.c +++ b/Ubiquitous/XiZi/resources/ethernet/cmd_lwip/lwip_config_demo.c @@ -20,6 +20,8 @@ #include "board.h" #include "sys_arch.h" +#include +#include /******************************************************************************/ diff --git a/Ubiquitous/XiZi/resources/ethernet/cmd_lwip/lwip_dhcp_demo.c b/Ubiquitous/XiZi/resources/ethernet/cmd_lwip/lwip_dhcp_demo.c index 87443523e..eb19af7b0 100755 --- a/Ubiquitous/XiZi/resources/ethernet/cmd_lwip/lwip_dhcp_demo.c +++ b/Ubiquitous/XiZi/resources/ethernet/cmd_lwip/lwip_dhcp_demo.c @@ -31,6 +31,7 @@ #include "netif/ethernet.h" #include "enet_ethernetif.h" +#include #include "board.h" #include "pin_mux.h" diff --git a/Ubiquitous/XiZi/resources/ethernet/cmd_lwip/lwip_ping_demo.c b/Ubiquitous/XiZi/resources/ethernet/cmd_lwip/lwip_ping_demo.c index 4eb01d0ba..dfb6c9980 100755 --- a/Ubiquitous/XiZi/resources/ethernet/cmd_lwip/lwip_ping_demo.c +++ b/Ubiquitous/XiZi/resources/ethernet/cmd_lwip/lwip_ping_demo.c @@ -27,7 +27,7 @@ #include "lwip/timeouts.h" #include "lwip/init.h" #include "netif/ethernet.h" - +#include #include "board.h" #include "pin_mux.h" #include "clock_config.h" diff --git a/Ubiquitous/XiZi/resources/ethernet/cmd_lwip/lwip_tcp_demo.c b/Ubiquitous/XiZi/resources/ethernet/cmd_lwip/lwip_tcp_demo.c index f57f80b4f..7db24051d 100755 --- a/Ubiquitous/XiZi/resources/ethernet/cmd_lwip/lwip_tcp_demo.c +++ b/Ubiquitous/XiZi/resources/ethernet/cmd_lwip/lwip_tcp_demo.c @@ -23,8 +23,9 @@ #include "sys_arch.h" #include "lwip/sockets.h" #include "tcpecho_raw.h" - -char tcp_demo_msg[LWIP_TEST_MSG_SIZE] = {0}; +#include +#include +char tcp_demo_msg[LWIP_TEST_MSG_SIZE] = { 0 }; char tcp_demo_ip[] = {192, 168, 250, 252}; u16_t tcp_demo_port = LWIP_TARGET_PORT; diff --git a/Ubiquitous/XiZi/resources/ethernet/cmd_lwip/lwip_udp_demo.c b/Ubiquitous/XiZi/resources/ethernet/cmd_lwip/lwip_udp_demo.c index bb3f48be1..c84ae90f3 100755 --- a/Ubiquitous/XiZi/resources/ethernet/cmd_lwip/lwip_udp_demo.c +++ b/Ubiquitous/XiZi/resources/ethernet/cmd_lwip/lwip_udp_demo.c @@ -21,6 +21,8 @@ #include "sys_arch.h" #include "lwip/udp.h" #include "lwip/sockets.h" +#include +#include #define PBUF_SIZE 27