//////////////////////////////////////////////////////////////////////////////////////////////////////// // // Name: ctypelocal.c // Created: January 2019 // Author(s): Philip Smart // Description: Utilities for C compilation when stdlib is not included in the linker list. // This is the ctype for string testing normally included in the libc. // Eventually this module should be replaced by a micro libc compatible with the ZPU // and K64F. // // Credits: // Copyright: modifications (c) 2019 Philip Smart // // History: January 2020 - Initial file created from various sources. // ///////////////////////////////////////////////////////////////////////////////////////////////////////// // This source file is free software: you can redistribute it and#or modify // it under the terms of the GNU General Public License as published // by the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This source file is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program. If not, see . ///////////////////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus extern "C" { #endif #if defined(__K64F__) //#include #define uint32_t __uint32_t #define uint16_t __uint16_t #define uint8_t __uint8_t #define int32_t __int32_t #define int16_t __int16_t #define int8_t __int8_t #elif defined(__ZPU__) #include #include #include #else #error "Target CPU not defined, use __ZPU__ or __K64F__" #endif #include #include "ctypelocal.h" #define _CTYPE_DATA_0_127 \ _C, _C, _C, _C, _C, _C, _C, _C, \ _C, _C|_S, _C|_S, _C|_S, _C|_S, _C|_S, _C, _C, \ _C, _C, _C, _C, _C, _C, _C, _C, \ _C, _C, _C, _C, _C, _C, _C, _C, \ _S|_B, _P, _P, _P, _P, _P, _P, _P, \ _P, _P, _P, _P, _P, _P, _P, _P, \ _N, _N, _N, _N, _N, _N, _N, _N, \ _N, _N, _P, _P, _P, _P, _P, _P, \ _P, _U|_X, _U|_X, _U|_X, _U|_X, _U|_X, _U|_X, _U, \ _U, _U, _U, _U, _U, _U, _U, _U, \ _U, _U, _U, _U, _U, _U, _U, _U, \ _U, _U, _U, _P, _P, _P, _P, _P, \ _P, _L|_X, _L|_X, _L|_X, _L|_X, _L|_X, _L|_X, _L, \ _L, _L, _L, _L, _L, _L, _L, _L, \ _L, _L, _L, _L, _L, _L, _L, _L, \ _L, _L, _L, _P, _P, _P, _P, _C #define _CTYPE_DATA_128_255 \ 0, 0, 0, 0, 0, 0, 0, 0, \ 0, 0, 0, 0, 0, 0, 0, 0, \ 0, 0, 0, 0, 0, 0, 0, 0, \ 0, 0, 0, 0, 0, 0, 0, 0, \ 0, 0, 0, 0, 0, 0, 0, 0, \ 0, 0, 0, 0, 0, 0, 0, 0, \ 0, 0, 0, 0, 0, 0, 0, 0, \ 0, 0, 0, 0, 0, 0, 0, 0, \ 0, 0, 0, 0, 0, 0, 0, 0, \ 0, 0, 0, 0, 0, 0, 0, 0, \ 0, 0, 0, 0, 0, 0, 0, 0, \ 0, 0, 0, 0, 0, 0, 0, 0, \ 0, 0, 0, 0, 0, 0, 0, 0, \ 0, 0, 0, 0, 0, 0, 0, 0, \ 0, 0, 0, 0, 0, 0, 0, 0, \ 0, 0, 0, 0, 0, 0, 0, 0 _CONST char _ctype_[1 + 256] = { 0, _CTYPE_DATA_0_127, _CTYPE_DATA_128_255 }; _CONST char *__ctype_ptr = (char *) _ctype_ + 1; _CONST char *__locale_ctype_ptr = (char *) _ctype_ + 1; _CONST char *__ctype_ptr__ = (char *) _ctype_; #ifdef __cplusplus } #endif