diff --git a/CMake/CMakeASM_WDCInformation.cmake b/CMake/CMakeASM_WDCInformation.cmake new file mode 100644 index 0000000..2a137a5 --- /dev/null +++ b/CMake/CMakeASM_WDCInformation.cmake @@ -0,0 +1,24 @@ +# WDC toolchain for CMake +# Copyright (C) 2021 Tentei Ltd. +# DISTRIBUTED AS PUBLIC DOMAIN. No restrictions apply. + +set(CMAKE_ASM_WDC_SOURCE_FILE_EXTENSIONS asm;S;s) +set(CMAKE_ASM_WDC_COMPILER_ARG1 "") +set(CMAKE_ASM_WDC_DEFINE_FLAG "-D") +set(CMAKE_ASM_WDC_FLAGS_DEBUG_INIT "-g -DDEBUG") +set(CMAKE_ASM_WDC_VERBOSE_FLAG "-V" ) +set(CMAKE_DEPFILE_FLAGS_ASM_WDC "-K ") + +set(CMAKE_ASM_WDC_COMPILER_AR wdclib CACHE PATH "WDC archiver") +set(CMAKE_LINKER wdcld CACHE PATH "WDC linker") + +set(CMAKE_ASM_WDC_COMPILE_OBJECT +" -O ") + +set(CMAKE_ASM_WDC_LINK_EXECUTABLE +" -O ") + +set(ASM_DIALECT "_WDC") +include(CMakeASMInformation) +set(CMAKE_INCLUDE_FLAG_ASM_WDC "-I") +set(ASM_DIALECT) diff --git a/CMake/CMakeDetermineASM_WDCCompiler.cmake b/CMake/CMakeDetermineASM_WDCCompiler.cmake new file mode 100644 index 0000000..a2eaa04 --- /dev/null +++ b/CMake/CMakeDetermineASM_WDCCompiler.cmake @@ -0,0 +1,36 @@ +# WDC toolchain for CMake +# Copyright (C) 2021 Tentei Ltd. +# DISTRIBUTED AS PUBLIC DOMAIN. No restrictions apply. + +if(NOT CMAKE_ASM_WDC_COMPILER) + SET(_COMPILER_LIST ca65) + + find_program( + CMAKE_ASM_WDC_COMPILER + NAMES ${_COMPILER_LIST} + DOC "WDC assembler") + + unset(_COMPILER_LIST) + + if(CMAKE_ASM_WDC_COMPILER) + set(CMAKE_ASM_WDC_COMPILER_ID CA65 CACHE PATH "WDC assembler ID") + + execute_process( + COMMAND ${CMAKE_ASM_WDC_COMPILER} --version + OUTPUT_VARIABLE _OUTPUT1 + ERROR_VARIABLE _OUTPUT2) + + if("${_OUTPUT1};${_OUTPUT2}" MATCHES ".*ca65 V([^\n]*)-.*") + set(CMAKE_ASM_WDC_COMPILER_VERSION "${CMAKE_MATCH_1}" CACHE PATH "WDC assembler version") + endif() + + unset(_OUTPUT1) + unset(_OUTPUT2) + + include(Compiler/WDC) + endif() +endif() + +set(ASM_DIALECT "_WDC") +include(CMakeDetermineASMCompiler) +set(ASM_DIALECT) diff --git a/CMake/CMakeTestASM_WDCCompiler.cmake b/CMake/CMakeTestASM_WDCCompiler.cmake new file mode 100644 index 0000000..2b8559d --- /dev/null +++ b/CMake/CMakeTestASM_WDCCompiler.cmake @@ -0,0 +1,7 @@ +# WDC toolchain for CMake +# Copyright (C) 2021 Tentei Ltd. +# DISTRIBUTED AS PUBLIC DOMAIN. No restrictions apply. + +set(ASM_DIALECT "_WDC") +include(CMakeTestASMCompiler) +set(ASM_DIALECT) diff --git a/CMake/Compiler/WDC-C.cmake b/CMake/Compiler/WDC-C.cmake new file mode 100644 index 0000000..ccd8361 --- /dev/null +++ b/CMake/Compiler/WDC-C.cmake @@ -0,0 +1,31 @@ +# WDC toolchain for CMake +# Copyright (C) 2021 Tentei Ltd. +# DISTRIBUTED AS PUBLIC DOMAIN. No restrictions apply. + +include(Compiler/WDC) + +set(CMAKE_C_COMPILER_ID_RUN YES) +set(CMAKE_C_COMPILER_ID_WORKS YES) +set(CMAKE_C_COMPILER_ID_FORCED YES) + +set(CMAKE_C_DEFINE_FLAG "-D") +set(CMAKE_C_VERBOSE_FLAG "-V" ) +set(CMAKE_C_FLAGS_DEBUG_INIT "-g -DDEBUG") +set(CMAKE_DEPFILE_FLAGS_C "--create-dep ") +set(CMAKE_INCLUDE_FLAG_C "-I ") + +set(CMAKE_C90_STANDARD_COMPILE_OPTION "--standard c89") +set(CMAKE_C99_STANDARD_COMPILE_OPTION "--standard c99") + +set(CMAKE_C_CREATE_ASSEMBLY_SOURCE +" -A -O ") + +set(CMAKE_C_CREATE_PREPROCESSED_SOURCE +" -LT -O ") + +set(CMAKE_C_COMPILE_OBJECT +" -O && \ + -O ") + +set(CMAKE_C_LINK_EXECUTABLE +" -O ") diff --git a/CMake/Compiler/WDC.cmake b/CMake/Compiler/WDC.cmake new file mode 100644 index 0000000..4b90445 --- /dev/null +++ b/CMake/Compiler/WDC.cmake @@ -0,0 +1,104 @@ +# WDC toolchain for CMake +# Copyright (C) 2021 Tentei Ltd. +# DISTRIBUTED AS PUBLIC DOMAIN. No restrictions apply. + +include_guard() + +if(CMAKE_SYSTEM_NAME) + if(CMAKE_SYSTEM_NAME MATCHES AppleII) + set(_SYSTEM apple2) + + elseif(CMAKE_SYSTEM_NAME MATCHES AppleIIeEnhanced) + set(_SYSTEM apple2enh) + set(_CPU 65C02) + + elseif(CMAKE_SYSTEM_NAME MATCHES Atari2600) + set(_SYSTEM atari2600) + + elseif(CMAKE_SYSTEM_NAME MATCHES Atari5200) + set(_SYSTEM atari5200) + + elseif(CMAKE_SYSTEM_NAME MATCHES Atmos) + set(_SYSTEM atmos) + + elseif(CMAKE_SYSTEM_NAME MATCHES BBCMicro) + set(_SYSTEM bbc) + + elseif(CMAKE_SYSTEM_NAME MATCHES CBMIIB) + set(_SYSTEM cbm610) + + elseif(CMAKE_SYSTEM_NAME MATCHES CBMIIP) + set(_SYSTEM cbm510) + + elseif(CMAKE_SYSTEM_NAME MATCHES Challenger1P) + set(_SYSTEM osic1p) + + elseif(CMAKE_SYSTEM_NAME MATCHES CommanderX16) + set(_SYSTEM cx16) + set(_CPU 65C02) + + elseif(CMAKE_SYSTEM_NAME MATCHES Commodore16) + set(_SYSTEM c16) + + elseif(CMAKE_SYSTEM_NAME MATCHES Commodore64) + set(_SYSTEM c64) + + elseif(CMAKE_SYSTEM_NAME MATCHES Commodore128) + set(_SYSTEM c128) + + elseif(CMAKE_SYSTEM_NAME MATCHES CreatiVision) + set(_SYSTEM creativision) + + elseif(CMAKE_SYSTEM_NAME MATCHES Gamate) + set(_SYSTEM gamate) + + elseif(CMAKE_SYSTEM_NAME MATCHES Lynx) + set(_SYSTEM lynx) + set(_CPU 65SC02) + + elseif(CMAKE_SYSTEM_NAME MATCHES LUnix) + set(_SYSTEM lunix) + + elseif(CMAKE_SYSTEM_NAME MATCHES NES) + set(_SYSTEM nes) + + elseif(CMAKE_SYSTEM_NAME MATCHES PCEngine) + set(_SYSTEM pce) + set(_CPU HuC6280) + + elseif(CMAKE_SYSTEM_NAME MATCHES PET) + set(_SYSTEM pet) + + elseif(CMAKE_SYSTEM_NAME MATCHES Plus4) + set(_SYSTEM plus4) + + elseif(CMAKE_SYSTEM_NAME MATCHES Supervision) + set(_SYSTEM supervision) + set(_CPU 65SC02) + + elseif(CMAKE_SYSTEM_NAME MATCHES Telestrat) + set(_SYSTEM telestrat) + + elseif(CMAKE_SYSTEM_NAME MATCHES VIC20) + set(_SYSTEM vic20) + endif() +endif() + +if(NOT _SYSTEM) + set(_SYSTEM none) +endif() + +if(NOT _CPU) + set(_CPU 6502) +endif() + +add_compile_options(--cpu ${_CPU} --target ${_SYSTEM}) + +unset(_SYSTEM) +unset(_CPU) + +find_program(CMAKE_AR wdclib DOC "WDC archiver") +set(CMAKE_${lang}_COMPILER_AR ${CMAKE_AR} CACHE FILEPATH "WDC archiver" FORCE) +find_program(CMAKE_LINKER wdcld DOC "WDC linker") + +set(CMAKE_${lang}_RANLIB "" CACHE FILEPATH "") diff --git a/CMake/Platform/NES-Determine-C.cmake b/CMake/Platform/NES-Determine-C.cmake new file mode 100644 index 0000000..8aef04f --- /dev/null +++ b/CMake/Platform/NES-Determine-C.cmake @@ -0,0 +1,33 @@ +# WDC toolchain for CMake +# Copyright (C) 2021 Tentei Ltd. +# DISTRIBUTED AS PUBLIC DOMAIN. No restrictions apply. + +if(NOT CMAKE_C_COMPILER) + SET(_COMPILER_LIST WDC) + + find_program( + CMAKE_C_COMPILER + NAMES ${_COMPILER_LIST} + DOC "WDC C compiler") + + unset(_COMPILER_LIST) + + if(CMAKE_C_COMPILER) + set(CMAKE_C_COMPILER_ID WDC CACHE PATH "C compiler ID") + + execute_process( + COMMAND ${CMAKE_C_COMPILER} --version + OUTPUT_VARIABLE _OUTPUT1 + ERROR_VARIABLE _OUTPUT2) + + if("${_OUTPUT1};${_OUTPUT2}" MATCHES ".*WDC V([^\n]*)-.*") + set(CMAKE_C_COMPILER_VERSION "${CMAKE_MATCH_1}" CACHE PATH "C compiler version") + endif() + + unset(_OUTPUT1) + unset(_OUTPUT2) + + set(CMAKE_C_ABI_COMPILED YES) + set(CMAKE_C_COMPILER_WORKS YES) + endif() +endif() diff --git a/CMake/Platform/NES.cmake b/CMake/Platform/NES.cmake new file mode 100644 index 0000000..45243fa --- /dev/null +++ b/CMake/Platform/NES.cmake @@ -0,0 +1,6 @@ +# WDC toolchain for CMake +# Copyright (C) 2021 Tentei Ltd. +# DISTRIBUTED AS PUBLIC DOMAIN. No restrictions apply. + +set(NES 1) +set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS NO) diff --git a/bin/wdc-config b/bin/wdc-config new file mode 100755 index 0000000..3f73e4b --- /dev/null +++ b/bin/wdc-config @@ -0,0 +1,57 @@ +#!/bin/bash + +source wdc.cfg + +exec_prefix=${prefix} +exec_prefix_set=no + +usage="\ +Usage: wdc-config [--prefix[=DIR]] [--exec-prefix[=DIR]] [--version] [--libs] [--cflags]" + +if test $# -eq 0; then + echo "${usage}" 1>&2 + exit 1 +fi + +while test $# -gt 0; do + case "$1" in + -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;; + *) optarg= ;; + esac + + case $1 in + --prefix=*) + prefix=$optarg + if test $exec_prefix_set = no ; then + exec_prefix=$optarg + fi + ;; + --prefix) + echo $prefix + ;; + --exec-prefix=*) + exec_prefix=$optarg + exec_prefix_set=yes + ;; + --exec-prefix) + echo $exec_prefix + ;; + --version) + echo 3.49.1 + ;; + --cflags) + includes=-I${prefix}/include + echo $includes + ;; + --libs) + libdirs=-L${prefix}/lib + echo $libdirs + ;; + *) + echo "${usage}" 1>&2 + exit 1 + ;; + esac + shift +done + diff --git a/bin/wdc.cfg b/bin/wdc.cfg new file mode 100644 index 0000000..68403ef --- /dev/null +++ b/bin/wdc.cfg @@ -0,0 +1 @@ +prefix=/opt/wdc diff --git a/bin/wdc02as b/bin/wdc02as new file mode 100755 index 0000000..294a73f --- /dev/null +++ b/bin/wdc02as @@ -0,0 +1,7 @@ +#! /bin/bash + +source wdc.cfg + +export WINEPATH=${prefix}/libexec +export WDC_INC_6502=`winepath -w ${prefix}/include` +WINEDEBUG=fixme-all WINEFSYNC=1 wine ${prefix}/libexec/WDC02AS.exe $* diff --git a/bin/wdc02cc b/bin/wdc02cc new file mode 100755 index 0000000..7f98bca --- /dev/null +++ b/bin/wdc02cc @@ -0,0 +1,9 @@ +#! /bin/bash + +source wdc.cfg + +export WINEPATH=${prefix}/libexec +export WDC_INC_6502=`winepath -w ${prefix}/include` +WINEDEBUG=fixme-all WINEFSYNC=1 wine ${prefix}/libexec/WDC02CC.exe $* +echo $'\n' + diff --git a/bin/wdc02op b/bin/wdc02op new file mode 100755 index 0000000..b9878ab --- /dev/null +++ b/bin/wdc02op @@ -0,0 +1,7 @@ +#! /bin/bash + +source wdc.cfg + +export WINEPATH=${prefix}/libexec +export WDC_INC_6502=`winepath -w ${prefix}/include` +WINEDEBUG=fixme-all WINEFSYNC=1 wine ${prefix}/libexec/WDC02OP.exe $* diff --git a/bin/wdc816as b/bin/wdc816as new file mode 100755 index 0000000..4b0295b --- /dev/null +++ b/bin/wdc816as @@ -0,0 +1,7 @@ +#! /bin/bash + +source wdc.cfg + +export WINEPATH=${prefix}/libexec +export WDC_INC_65816=`winepath -w ${prefix}/include` +WINEDEBUG=fixme-all WINEFSYNC=1 wine ${prefix}/libexec/WDC816AS.exe $* diff --git a/bin/wdc816cc b/bin/wdc816cc new file mode 100755 index 0000000..d7b2602 --- /dev/null +++ b/bin/wdc816cc @@ -0,0 +1,7 @@ +#! /bin/bash + +source wdc.cfg + +export WINEPATH=${prefix}/libexec +export WDC_INC_65816=`winepath -w ${prefix}/include` +WINEDEBUG=fixme-all WINEFSYNC=1 wine ${prefix}/libexec/WDC816CC.exe $* diff --git a/bin/wdc816op b/bin/wdc816op new file mode 100755 index 0000000..1b31cd5 --- /dev/null +++ b/bin/wdc816op @@ -0,0 +1,7 @@ +#! /bin/bash + +source wdc.cfg + +export WINEPATH=${prefix}/libexec +export WDC_INC_65816=`winepath -w ${prefix}/include` +WINEDEBUG=fixme-all WINEFSYNC=1 wine ${prefix}/libexec/WDC816OP.exe $* diff --git a/bin/wdcdumpobj b/bin/wdcdumpobj new file mode 100755 index 0000000..3c24c1e --- /dev/null +++ b/bin/wdcdumpobj @@ -0,0 +1,7 @@ +#! /bin/bash + +source wdc.cfg + +export WINEPATH=${prefix}/libexec +WINEDEBUG=fixme-all WINEFSYNC=1 wine ${prefix}/libexec/wdcdumpobj.exe $* +echo $'\n' diff --git a/bin/wdclib b/bin/wdclib new file mode 100755 index 0000000..5d74d5e --- /dev/null +++ b/bin/wdclib @@ -0,0 +1,9 @@ +#! /bin/bash + +source wdc.cfg + +export WINEPATH=${prefix}/libexec +export WDC_LIB=`winepath -w ${prefix}/lib` +export WDC_INC_6502=`winepath -w ${prefix}/include` +export WDC_INC_65816=`winepath -w ${prefix}/include` +WINEDEBUG=fixme-all WINEFSYNC=1 wine ${prefix}/libexec/WDCLIB.exe $* diff --git a/bin/wdclink b/bin/wdclink new file mode 100755 index 0000000..e0ab17c --- /dev/null +++ b/bin/wdclink @@ -0,0 +1,7 @@ +#! /bin/bash + +source wdc.cfg + +export WINEPATH=${prefix}/libexec +WINEDEBUG=fixme-all WINEFSYNC=1 wine ${prefix}/libexec/wdclink.exe $* +echo $'\n' diff --git a/bin/wdcln b/bin/wdcln new file mode 100755 index 0000000..b73a6f1 --- /dev/null +++ b/bin/wdcln @@ -0,0 +1,10 @@ +#! /bin/bash + +source wdc.cfg + +export WINEPATH=${prefix}/libexec +export WDC_LIB=`winepath -w ${prefix}/lib` +export WDC_INC_6502=`winepath -w ${prefix}/include` +export WDC_INC_65816=`winepath -w ${prefix}/include` +WINEDEBUG=fixme-all WINEFSYNC=1 wine ${prefix}/libexec/WDCLN.exe $* +echo $'\n' diff --git a/bin/wdcobj b/bin/wdcobj new file mode 100755 index 0000000..116aa9a --- /dev/null +++ b/bin/wdcobj @@ -0,0 +1,9 @@ +#! /bin/bash + +source wdc.cfg + +export WINEPATH=${prefix}/libexec +export WDC_LIB=`winepath -w ${prefix}/lib` +export WDC_INC_6502=`winepath -w ${prefix}/include` +export WDC_INC_65816=`winepath -w ${prefix}/include` +WINEDEBUG=fixme-all WINEFSYNC=1 wine ${prefix}/libexec/WDCOBJ.exe $* diff --git a/bin/wdcsym b/bin/wdcsym new file mode 100755 index 0000000..03512f8 --- /dev/null +++ b/bin/wdcsym @@ -0,0 +1,9 @@ +#! /bin/bash + +source wdc.cfg + +export WINEPATH=${prefix}/libexec +export WDC_LIB=`winepath -w ${prefix}/lib` +export WDC_INC_6502=`winepath -w ${prefix}/include` +export WDC_INC_65816=`winepath -w ${prefix}/include` +WINEDEBUG=fixme-all WINEFSYNC=1 wine ${prefix}/libexec/WDCSYM.exe $* diff --git a/include/alloc.h b/include/alloc.h new file mode 100644 index 0000000..3739fb8 --- /dev/null +++ b/include/alloc.h @@ -0,0 +1,40 @@ +/******************************************************************************* +* FILE NAME: ALLOC.h +* +* TITLE: This function prototypes and data type definitions for the Allocation of memory Functions. +* +* DATA_RIGHTS: Western Design Center and R & C Services Proprietary +* Copyright(C) 1980-2004 +* All rights reserved. Reproduction in any manner, +* in whole or in part, is strictly prohibited without +* the prior written approval of R & C Services or +* Western Design Center. +* +* DESCRIPTION: This file describes function prototypes and data type +* definitions used for Allocation of Memory functions. +* +* +* SPECIAL CONSIDERATIONS: +* +* +* AUTHOR: R. Greenthal +* +* +* CREATION DATE: March 17,2004 +* +* REVISION HISTORY +* Name Date Description +* ------------ ---------- ---------------------------------------------- +* R. Greenthal 03/25/2004 Initial +* 0x/xx/2004 Added +* +******************************************************************************* +*/ + +#include + + +/**************************************************/ +/* End of File ALLOC.H */ +/**************************************************/ + diff --git a/include/assert.h b/include/assert.h new file mode 100644 index 0000000..7301461 --- /dev/null +++ b/include/assert.h @@ -0,0 +1,52 @@ +/* Copyright (C) 1992 by Zardoz Software, Inc. */ +/******************************************************************************* +* FILE NAME: ASSERT.h +* +* TITLE: This function prototypes and data type definitions for the Assert Function. +* +* DATA_RIGHTS: Western Design Center and R & C Services Proprietary +* Copyright(C) 1980-2004 +* All rights reserved. Reproduction in any manner, +* in whole or in part, is strictly prohibited without +* the prior written approval of R & C Services or +* Western Design Center. +* +* DESCRIPTION: This file describes function prototypes and data type +* definitions used for Assert function. +* +* +* SPECIAL CONSIDERATIONS: +* +* +* AUTHOR: R. Greenthal +* +* +* CREATION DATE: March 17,2004 +* +* REVISION HISTORY +* Name Date Description +* ------------ ---------- ---------------------------------------------- +* R. Greenthal 03/25/2004 Initial +* 0x/xx/2004 Added +* +******************************************************************************* +*/ + + +#ifndef __ASSERT_H +#define __ASSERT_H + +#ifndef NDEBUG +void _assert(char *, char *, unsigned int); +#define assert(x) (x == 0 ? _assert(#x, __FILE__, __LINE__):(void)0) +#else +#define assert(x) ((void)0) +#endif + +#endif // End of __AAert_H + + +/**************************************************/ +/* End of File ASSERT.H */ +/**************************************************/ + diff --git a/include/bits/stdint.txt b/include/bits/stdint.txt new file mode 100644 index 0000000..00db1b0 --- /dev/null +++ b/include/bits/stdint.txt @@ -0,0 +1,322 @@ +stdint.hFile: /usr/include/stdint.h +1 /* Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. +2 This file is part of the GNU C Library. +3 +4 The GNU C Library is free software; you can redistribute it and/or +5 modify it under the terms of the GNU Lesser General Public +6 License as published by the Free Software Foundation; either +7 version 2.1 of the License, or (at your option) any later version. +8 +9 The GNU C Library is distributed in the hope that it will be useful, +10 but WITHOUT ANY WARRANTY; without even the implied warranty of +11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +12 Lesser General Public License for more details. +13 +14 You should have received a copy of the GNU Lesser General Public +15 License along with the GNU C Library; if not, write to the Free +16 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +17 02111-1307 USA. */ +18 +19 /* +20 * ISO C99: 7.18 Integer types +21 */ +22 +23 #ifndef _STDINT_H +24 #define _STDINT_H 1 +25 +26 #include +27 #include +28 #include +29 +30 /* Exact integral types. */ +31 +32 /* Signed. */ +33 +34 /* There is some amount of overlap with as known by inet code */ +35 #ifndef __int8_t_defined +36 # define __int8_t_defined +37 typedef signed char int8_t; +38 typedef short int int16_t; +39 typedef int int32_t; +40 # if __WORDSIZE == 64 +41 typedef long int int64_t; +42 # else +43 __extension__ +44 typedef long long int int64_t; +45 # endif +46 #endif +47 +48 /* Unsigned. */ +49 typedef unsigned char uint8_t; +50 typedef unsigned short int uint16_t; +51 #ifndef __uint32_t_defined +52 typedef unsigned int uint32_t; +53 # define __uint32_t_defined +54 #endif +55 #if __WORDSIZE == 64 +56 typedef unsigned long int uint64_t; +57 #else +58 __extension__ +59 typedef unsigned long long int uint64_t; +60 #endif +61 +62 +63 /* Small types. */ +64 +65 /* Signed. */ +66 typedef signed char int_least8_t; +67 typedef short int int_least16_t; +68 typedef int int_least32_t; +69 #if __WORDSIZE == 64 +70 typedef long int int_least64_t; +71 #else +72 __extension__ +73 typedef long long int int_least64_t; +74 #endif +75 +76 /* Unsigned. */ +77 typedef unsigned char uint_least8_t; +78 typedef unsigned short int uint_least16_t; +79 typedef unsigned int uint_least32_t; +80 #if __WORDSIZE == 64 +81 typedef unsigned long int uint_least64_t; +82 #else +83 __extension__ +84 typedef unsigned long long int uint_least64_t; +85 #endif +86 +87 +88 /* Fast types. */ +89 +90 /* Signed. */ +91 typedef signed char int_fast8_t; +92 #if __WORDSIZE == 64 +93 typedef long int int_fast16_t; +94 typedef long int int_fast32_t; +95 typedef long int int_fast64_t; +96 #else +97 typedef int int_fast16_t; +98 typedef int int_fast32_t; +99 __extension__ +100 typedef long long int int_fast64_t; +101 #endif +102 +103 /* Unsigned. */ +104 typedef unsigned char uint_fast8_t; +105 #if __WORDSIZE == 64 +106 typedef unsigned long int uint_fast16_t; +107 typedef unsigned long int uint_fast32_t; +108 typedef unsigned long int uint_fast64_t; +109 #else +110 typedef unsigned int uint_fast16_t; +111 typedef unsigned int uint_fast32_t; +112 __extension__ +113 typedef unsigned long long int uint_fast64_t; +114 #endif +115 +116 +117 /* Types for `void *' pointers. */ +118 #if __WORDSIZE == 64 +119 # ifndef __intptr_t_defined +120 typedef long int intptr_t; +121 # define __intptr_t_defined +122 # endif +123 typedef unsigned long int uintptr_t; +124 #else +125 # ifndef __intptr_t_defined +126 typedef int intptr_t; +127 # define __intptr_t_defined +128 # endif +129 typedef unsigned int uintptr_t; +130 #endif +131 +132 +133 /* Largest integral types. */ +134 #if __WORDSIZE == 64 +135 typedef long int intmax_t; +136 typedef unsigned long int uintmax_t; +137 #else +138 __extension__ +139 typedef long long int intmax_t; +140 __extension__ +141 typedef unsigned long long int uintmax_t; +142 #endif +143 +144 +145 /* The ISO C99 standard specifies that in C++ implementations these +146 macros should only be defined if explicitly requested. */ +147 #if !defined __cplusplus || defined __STDC_LIMIT_MACROS +148 +149 # if __WORDSIZE == 64 +150 # define __INT64_C(c) c ## L +151 # define __UINT64_C(c) c ## UL +152 # else +153 # define __INT64_C(c) c ## LL +154 # define __UINT64_C(c) c ## ULL +155 # endif +156 +157 /* Limits of integral types. */ +158 +159 /* Minimum of signed integral types. */ +160 # define INT8_MIN (-128) +161 # define INT16_MIN (-32767-1) +162 # define INT32_MIN (-2147483647-1) +163 # define INT64_MIN (-__INT64_C(9223372036854775807)-1) +164 /* Maximum of signed integral types. */ +165 # define INT8_MAX (127) +166 # define INT16_MAX (32767) +167 # define INT32_MAX (2147483647) +168 # define INT64_MAX (__INT64_C(9223372036854775807)) +169 +170 /* Maximum of unsigned integral types. */ +171 # define UINT8_MAX (255) +172 # define UINT16_MAX (65535) +173 # define UINT32_MAX (4294967295U) +174 # define UINT64_MAX (__UINT64_C(18446744073709551615)) +175 +176 +177 /* Minimum of signed integral types having a minimum size. */ +178 # define INT_LEAST8_MIN (-128) +179 # define INT_LEAST16_MIN (-32767-1) +180 # define INT_LEAST32_MIN (-2147483647-1) +181 # define INT_LEAST64_MIN (-__INT64_C(9223372036854775807)-1) +182 /* Maximum of signed integral types having a minimum size. */ +183 # define INT_LEAST8_MAX (127) +184 # define INT_LEAST16_MAX (32767) +185 # define INT_LEAST32_MAX (2147483647) +186 # define INT_LEAST64_MAX (__INT64_C(9223372036854775807)) +187 +188 /* Maximum of unsigned integral types having a minimum size. */ +189 # define UINT_LEAST8_MAX (255) +190 # define UINT_LEAST16_MAX (65535) +191 # define UINT_LEAST32_MAX (4294967295U) +192 # define UINT_LEAST64_MAX (__UINT64_C(18446744073709551615)) +193 +194 +195 /* Minimum of fast signed integral types having a minimum size. */ +196 # define INT_FAST8_MIN (-128) +197 # if __WORDSIZE == 64 +198 # define INT_FAST16_MIN (-9223372036854775807L-1) +199 # define INT_FAST32_MIN (-9223372036854775807L-1) +200 # else +201 # define INT_FAST16_MIN (-2147483647-1) +202 # define INT_FAST32_MIN (-2147483647-1) +203 # endif +204 # define INT_FAST64_MIN (-__INT64_C(9223372036854775807)-1) +205 /* Maximum of fast signed integral types having a minimum size. */ +206 # define INT_FAST8_MAX (127) +207 # if __WORDSIZE == 64 +208 # define INT_FAST16_MAX (9223372036854775807L) +209 # define INT_FAST32_MAX (9223372036854775807L) +210 # else +211 # define INT_FAST16_MAX (2147483647) +212 # define INT_FAST32_MAX (2147483647) +213 # endif +214 # define INT_FAST64_MAX (__INT64_C(9223372036854775807)) +215 +216 /* Maximum of fast unsigned integral types having a minimum size. */ +217 # define UINT_FAST8_MAX (255) +218 # if __WORDSIZE == 64 +219 # define UINT_FAST16_MAX (18446744073709551615UL) +220 # define UINT_FAST32_MAX (18446744073709551615UL) +221 # else +222 # define UINT_FAST16_MAX (4294967295U) +223 # define UINT_FAST32_MAX (4294967295U) +224 # endif +225 # define UINT_FAST64_MAX (__UINT64_C(18446744073709551615)) +226 +227 +228 /* Values to test for integral types holding `void *' pointer. */ +229 # if __WORDSIZE == 64 +230 # define INTPTR_MIN (-9223372036854775807L-1) +231 # define INTPTR_MAX (9223372036854775807L) +232 # define UINTPTR_MAX (18446744073709551615UL) +233 # else +234 # define INTPTR_MIN (-2147483647-1) +235 # define INTPTR_MAX (2147483647) +236 # define UINTPTR_MAX (4294967295U) +237 # endif +238 +239 +240 /* Minimum for largest signed integral type. */ +241 # define INTMAX_MIN (-__INT64_C(9223372036854775807)-1) +242 /* Maximum for largest signed integral type. */ +243 # define INTMAX_MAX (__INT64_C(9223372036854775807)) +244 +245 /* Maximum for largest unsigned integral type. */ +246 # define UINTMAX_MAX (__UINT64_C(18446744073709551615)) +247 +248 +249 /* Limits of other integer types. */ +250 +251 /* Limits of `ptrdiff_t' type. */ +252 # if __WORDSIZE == 64 +253 # define PTRDIFF_MIN (-9223372036854775807L-1) +254 # define PTRDIFF_MAX (9223372036854775807L) +255 # else +256 # define PTRDIFF_MIN (-2147483647-1) +257 # define PTRDIFF_MAX (2147483647) +258 # endif +259 +260 /* Limits of `sig_atomic_t'. */ +261 # define SIG_ATOMIC_MIN (-2147483647-1) +262 # define SIG_ATOMIC_MAX (2147483647) +263 +264 /* Limit of `size_t' type. */ +265 # if __WORDSIZE == 64 +266 # define SIZE_MAX (18446744073709551615UL) +267 # else +268 # define SIZE_MAX (4294967295U) +269 # endif +270 +271 /* Limits of `wchar_t'. */ +272 # ifndef WCHAR_MIN +273 /* These constants might also be defined in . */ +274 # define WCHAR_MIN __WCHAR_MIN +275 # define WCHAR_MAX __WCHAR_MAX +276 # endif +277 +278 /* Limits of `wint_t'. */ +279 # define WINT_MIN (0u) +280 # define WINT_MAX (4294967295u) +281 +282 #endif /* C++ && limit macros */ +283 +284 +285 /* The ISO C99 standard specifies that in C++ implementations these +286 should only be defined if explicitly requested. */ +287 #if !defined __cplusplus || defined __STDC_CONSTANT_MACROS +288 +289 /* Signed. */ +290 # define INT8_C(c) c +291 # define INT16_C(c) c +292 # define INT32_C(c) c +293 # if __WORDSIZE == 64 +294 # define INT64_C(c) c ## L +295 # else +296 # define INT64_C(c) c ## LL +297 # endif +298 +299 /* Unsigned. */ +300 # define UINT8_C(c) c ## U +301 # define UINT16_C(c) c ## U +302 # define UINT32_C(c) c ## U +303 # if __WORDSIZE == 64 +304 # define UINT64_C(c) c ## UL +305 # else +306 # define UINT64_C(c) c ## ULL +307 # endif +308 +309 /* Maximal type. */ +310 # if __WORDSIZE == 64 +311 # define INTMAX_C(c) c ## L +312 # define UINTMAX_C(c) c ## UL +313 # else +314 # define INTMAX_C(c) c ## LL +315 # define UINTMAX_C(c) c ## ULL +316 # endif +317 +318 #endif /* C++ && constant macros */ +319 +320 #endif /* stdint.h */ +321 \ No newline at end of file diff --git a/include/bits/types.h b/include/bits/types.h new file mode 100644 index 0000000..7b8f8b8 --- /dev/null +++ b/include/bits/types.h @@ -0,0 +1,148 @@ +/* Copyright (C) 1991,92,1994-1999,2000,2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* + * Never include this file directly; use instead. + */ + +#ifndef _BITS_TYPES_H +#define _BITS_TYPES_H 1 + +#include + +#define __need_size_t +#include + +/* Convenience types. */ +typedef unsigned char __u_char; +typedef unsigned short __u_short; +typedef unsigned int __u_int; +typedef unsigned long __u_long; +#ifdef __GLIBC_HAVE_LONG_LONG +__extension__ typedef unsigned long long int __u_quad_t; +__extension__ typedef long long int __quad_t; +#else +typedef struct + { + long int __val[2]; + } __quad_t; +typedef struct + { + __u_long __val[2]; + } __u_quad_t; +#endif +typedef signed char __int8_t; +typedef unsigned char __uint8_t; +typedef signed short int __int16_t; +typedef unsigned short int __uint16_t; +typedef signed int __int32_t; +typedef unsigned int __uint32_t; +#ifdef __GLIBC_HAVE_LONG_LONG +__extension__ typedef signed long long int __int64_t; +__extension__ typedef unsigned long long int __uint64_t; +#endif +typedef __quad_t *__qaddr_t; + +typedef __u_quad_t __dev_t; /* Type of device numbers. */ +typedef __u_int __uid_t; /* Type of user identifications. */ +typedef __u_int __gid_t; /* Type of group identifications. */ +typedef __u_long __ino_t; /* Type of file serial numbers. */ +typedef __u_int __mode_t; /* Type of file attribute bitmasks. */ +typedef __u_int __nlink_t; /* Type of file link counts. */ +typedef long int __off_t; /* Type of file sizes and offsets. */ +typedef __quad_t __loff_t; /* Type of file sizes and offsets. */ +typedef int __pid_t; /* Type of process identifications. */ +typedef int __ssize_t; /* Type of a byte count, or error. */ +typedef __u_long __rlim_t; /* Type of resource counts. */ +typedef __u_quad_t __rlim64_t; /* Type of resource counts (LFS). */ +typedef __u_int __id_t; /* General type for ID. */ + +typedef struct + { + int __val[2]; + } __fsid_t; /* Type of file system IDs. */ + +/* Everythin' else. */ +typedef int __daddr_t; /* The type of a disk address. */ +typedef char *__caddr_t; +typedef long int __time_t; +typedef unsigned int __useconds_t; +typedef long int __suseconds_t; +typedef long int __swblk_t; /* Type of a swap block maybe? */ + +typedef long int __clock_t; + +/* Clock ID used in clock and timer functions. */ +typedef int __clockid_t; + +/* Timer ID returned by `timer_create'. */ +typedef int __timer_t; + + +/* Number of descriptors that can fit in an `fd_set'. */ +#define __FD_SETSIZE 1024 + + +typedef int __key_t; + +/* Used in `struct shmid_ds'. */ +typedef unsigned short int __ipc_pid_t; + + +/* Type to represent block size. */ +typedef long int __blksize_t; + +/* Types from the Large File Support interface. */ + +/* Type to count number os disk blocks. */ +typedef long int __blkcnt_t; +typedef __quad_t __blkcnt64_t; + +/* Type to count file system blocks. */ +typedef __u_long __fsblkcnt_t; +typedef __u_quad_t __fsblkcnt64_t; + +/* Type to count file system inodes. */ +typedef __u_long __fsfilcnt_t; +typedef __u_quad_t __fsfilcnt64_t; + +/* Type of file serial numbers. */ +typedef __u_quad_t __ino64_t; + +/* Type of file sizes and offsets. */ +typedef __loff_t __off64_t; + +/* Used in XTI. */ +typedef long int __t_scalar_t; +typedef unsigned long int __t_uscalar_t; + +/* Duplicates info from stdint.h but this is used in unistd.h. */ +typedef int __intptr_t; + +/* Duplicate info from sys/socket.h. */ +typedef unsigned int __socklen_t; + + +/* Now add the thread types. */ +#if defined __USE_POSIX199506 || defined __USE_UNIX98 +# include +#endif + +#endif /* bits/types.h */ + + diff --git a/include/complex.h b/include/complex.h new file mode 100644 index 0000000..dd34b60 --- /dev/null +++ b/include/complex.h @@ -0,0 +1,240 @@ +/******************************************************************************* +* FILE NAME: COMPLEX.h +* +* TITLE: This function prototypes and data type definitions for the Complex Math Functions. +* +* DATA_RIGHTS: Western Design Center and R & C Services Proprietary +* Copyright(C) 1980-2004 +* All rights reserved. Reproduction in any manner, +* in whole or in part, is strictly prohibited without +* the prior written approval of R & C Services or +* Western Design Center. +* +* DESCRIPTION: This file describes function prototypes and data type +* definitions used for Complex Math functions. +* +* +* SPECIAL CONSIDERATIONS: +* +* +* AUTHOR: R. Greenthal +* +* +* CREATION DATE: March 17,2004 +* +* REVISION HISTORY +* Name Date Description +* ------------ ---------- ---------------------------------------------- +* R. Greenthal 03/15/2004 Initial +* 0x/xx/2004 Added +* +******************************************************************************* +*/ + +#ifndef _COMPLEX_H +#define _COMPLEX_H + + +/* + *=========================== CONSTANTS & MACROS =============================== + */ + + +/*********************************** + Special Structures Used by + Double Precision Complex + Math Functions +************************************/ + +typedef struct {double r; double i;} Complex; +typedef Complex far* Complex_Vector; +typedef Complex *Complex_Ptr; + +/*********************************** + Special Structures Used by + Single Precision Complex + Math Functions +************************************/ + +typedef struct {float r; float i;} f_Complex; +typedef f_Complex far* f_Complex_Vector; + + +/*********************************** + Special Structures Used by + Long Double Precision Complex + Math Functions +************************************/ + +typedef struct {long double r; long double i;} ld_Complex; +typedef ld_Complex far* ld_Complex_Vector; + + + +//typedef double _Complex Complex +//typedef float _Complex f_Complex +//typedef long double _Complex ld_Complex + + +/* + *============================= FUNCTION CALL PROTOTYPES ============================ + */ + + +//************************** +// Simple Complex Functions +//************************** +Complex complx(double , double ); // Convert 2 doubles to a Complex variable +f_Complex complxf(float , float ); +ld_Complex Complxl(long double , long double ); + +double cabs(Complex ); // Absolute value of a Complex number +float cabsf(f_Complex ); +long double cabsl(ld_Complex ); + +Complex cadd(Complex , Complex ); // Add two Complex numbers +f_Complex caddf(f_Complex , f_Complex ); +ld_Complex caddl(ld_Complex , ld_Complex ); + +Complex csub(Complex , Complex ); // Subtract two Complex numbers +f_Complex csubf(f_Complex , f_Complex ); +ld_Complex csubl(ld_Complex , ld_Complex ); + +Complex cmul(Complex , Complex ); // Multiply two Complex numbers +f_Complex cmulf(f_Complex , f_Complex ); +ld_Complex cmull(ld_Complex , ld_Complex ); + +Complex cdiv(Complex , Complex ); // Divide two Complex numbers +f_Complex cdivf(f_Complex , f_Complex ); +ld_Complex cdivl(ld_Complex , ld_Complex ); + +Complex conj(Complex ); // Conjugate of a Complex number +f_Complex conjf(f_Complex ); // Conjugate of a Complex number +ld_Complex conjl(ld_Complex ); // Conjugate of a Complex number + +double creal(Complex z); // Real part of a complex # +float crealf(f_Complex z); +long double creall(ld_Complex z); + +double cimag(Complex z); // Imaginary part of a complex # +float cimagf(f_Complex z); +long double cimagl(ld_Complex z); + + +//*********************************************** +// Complex Functions +//*********************************************** + + + +double cmag(Complex ); // Magnitude of a Complex number +Complex cscalr(Complex , double ); // Multiply a complex number, x, by a real number, y + + + +double carg(Complex z); // Calculate the Complex argument +float cargf(f_Complex z); +long double cargl(ld_Complex z); + +Complex cacos(Complex z); // Complex circular arc cosine +f_Complex cacosf(f_Complex z); +ld_Complex cacosl(ld_Complex z); + +Complex cacosh(Complex z); // Complex inverse hyperbolic cosineComplex casin(Complex z); // Complex circular arc sine +f_Complex cacoshf(f_Complex z); +ld_Complex cacoshl(ld_Complex z); + +Complex casin(Complex z); // Complex inverse sine +f_Complex casinf(f_Complex z); +ld_Complex casinl(ld_Complex z); + +Complex casinh(Complex z); // Complex inverse hyperbolic sine +f_Complex casinhf(f_Complex z); +ld_Complex casinhl(ld_Complex z); + +Complex catan(Complex z); // Complex circular arc tangent +f_Complex catanf(f_Complex z); +ld_Complex catanl(ld_Complex z); + +Complex catanh(Complex z); // Complex inverse hyperbolic tangent +f_Complex catanhf(f_Complex z); +ld_Complex catanhl(ld_Complex z); + +Complex ccos(Complex z); // Complex circular cosine +f_Complex ccosf(f_Complex z); +ld_Complex ccosl(ld_Complex z); + +Complex ccosh(Complex z); // Complex hyperbolic cosine +f_Complex ccoshf(f_Complex z); +ld_Complex ccoshl(ld_Complex z); + +Complex ccot(Complex z); // Complex circular cotangent +f_Complex ccotf(f_Complex z); +ld_Complex ccotl(ld_Complex z); + +Complex cexp(Complex z); // Exponential of the complex argument z +f_Complex cexpf(f_Complex z); +ld_Complex cexpl(ld_Complex z); + +Complex clog(Complex z); // Complex logarithm to the base e +f_Complex clogf(f_Complex z); +ld_Complex clogl(ld_Complex z); + +Complex cpow(Complex a, Complex z); // Complex power function +f_Complex cpowf(f_Complex a, f_Complex z); +ld_Complex cpowl(ld_Complex a, ld_Complex z); + +Complex csin(Complex z); // Complex circular sine +f_Complex csinf(f_Complex z); +ld_Complex csinl(ld_Complex z); + +Complex csinh(Complex z); // Complex hyperbolic sine +f_Complex csinhf(f_Complex z); +ld_Complex csinhl(ld_Complex z); + +Complex csqrt(Complex ); // Square Root of a Complex number +f_Complex csqrtf(f_Complex ); +ld_Complex csqrtl(ld_Complex ); + +Complex ctan(Complex z); // Complex circular tangent +f_Complex ctanf(f_Complex z); +ld_Complex ctanl(ld_Complex z); + +Complex ctanh(Complex z); // Complex hyperbolic tangent +f_Complex ctanhf(f_Complex z); +ld_Complex ctanhl(ld_Complex z); + +double modulus(Complex z); // sqrt(z.real * z.real + z.imag * z.imag) +float modulusf(f_Complex z); +long double modulusl(ld_Complex z); + +double phase(Complex z); // atan(z.i / z.r) +float phasef(f_Complex z); +long double phasel(ld_Complex z); + + + + +//*********************************************** +// DSP/FFT Functions +//*********************************************** + +void fft42(Complex_Vector data, unsigned n, int isign); // Computes the FFT using a "radix-4+2" algorithm +void fft42f(f_Complex_Vector data, unsigned n, int isign); + +void fftrad2(Complex_Vector data, unsigned n, int isign); + + + + +// Symmetric FIR bandpass filter using a Kaiser-Bessel window +//double *Cpowspec(Complex_Vector v, unsigned nv, unsigned npw, double *w); +// + + +#endif /* End of _COMPLEX_H */ +#pragma Pop (List) + +/************************************** + End of File COMPLEX.H +***************************************/ diff --git a/include/ctype.h b/include/ctype.h new file mode 100644 index 0000000..5d90360 --- /dev/null +++ b/include/ctype.h @@ -0,0 +1,103 @@ +/* Copyright (C) 1992 by Zardoz Software, Inc. */ +/******************************************************************************* +* FILE NAME: TGMATH.h +* +* TITLE: This function prototypes and data type definitions for the Character Types. +* +* DATA_RIGHTS: Western Design Center and R & C Services Proprietary +* Copyright(C) 1980-2004 +* All rights reserved. Reproduction in any manner, +* in whole or in part, is strictly prohibited without +* the prior written approval of R & C Services or +* Western Design Center. +* +* DESCRIPTION: This file describes function prototypes and data type +* definitions used for Character Typess. +* +* +* SPECIAL CONSIDERATIONS: +* +* +* AUTHOR: R. Greenthal +* +* +* CREATION DATE: March 27,2004 +* +* REVISION HISTORY +* Name Date Description +* ------------ ---------- ---------------------------------------------- +* R. Greenthal 03/25/2004 Initial +* 0x/xx/2004 Added +* +******************************************************************************* +*/ + + +#ifndef __CTYPE_H +#define __CTYPE_H + +extern char _ctype[]; + +#define _U 0x01 /* Upper-case */ +#define _L 0x02 /* Lower-case */ +#define _D 0x04 /* Decimal-digit */ +#define _H 0x08 /* Hex-digit */ +#define _W 0x10 /* White-space */ +#define _C 0x20 /* Control char */ +#define _P 0x40 /* Punctuation */ +#define _B 0x80 /* Blank */ + +int isalnum(int _c); +int isalpha(int _c); +int iscntrl(int _c); +int isdigit(int _c); +int isgraph(int _c); +int islower(int _c); +int isprint(int _c); +int ispunct(int _c); +int isspace(int _c); +int isupper(int _c); +int isxdigit(int _c); +int tolower(int _c); +int toupper(int _c); +/**************************/ +/* NON-ANSI - Systtem V */ +/**************************/ +int isascii(int _c); +//int isatty(int fd); //TBD +int toascii(int ); /* return ASCII equivalent of c */ + +//#define iswhite(x) ((_ctype+1)[x]&(_W)) //TBD +//#define isodigit(x) ((_ctype+1)[x]&(_W)) //TBD Is Octal 0-7 +//int _tolower(int c); +//int _toupper(int c); + + +#ifdef __C_MACROS__ +#define isalpha(x) ((_ctype+1)[x]&(_L|_U)) +#define isupper(x) ((_ctype+1)[x]&(_U)) +#define islower(x) ((_ctype+1)[x]&(_L)) +#define isdigit(x) ((_ctype+1)[x]&(_D)) +#define isxdigit(x) ((_ctype+1)[x]&(_H)) +#define isalnum(x) ((_ctype+1)[x]&(_L|_U|_D)) +#define isspace(x) ((_ctype+1)[x]&(_W)) +#define ispunct(x) ((_ctype+1)[x]&(_P)) +#define iscntrl(x) ((_ctype+1)[x]&(_C)) +#define isprint(x) ((_ctype+1)[x]&(_P|_L|_U|_D|_B)) +#define isgraph(x) ((_ctype+1)[x]&(_P|_L|_U|_D)) +#define isascii(x) (((x)&0x80)==0) +//#define iswhite(x) ((_ctype+1)[x]&(_W)) //TBD +//#define isodigit(x) ((_ctype+1)[x]&(_W)) //TBD Is Octal 0-7 +#endif + +#define toascii(x) ((x)&0x7f) +#define _tolower(x) ((x)-'a'+'A') +#define _toupper(x) ((x)-'A'+'a') + +#endif /* _CTYPE_H */ + + +/**************************************************/ +/* End of File CTYPE.H */ +/**************************************************/ + diff --git a/include/errno.h b/include/errno.h new file mode 100644 index 0000000..b515e2c --- /dev/null +++ b/include/errno.h @@ -0,0 +1,131 @@ +/* Copyright (C) 1992 by Zardoz Software, Inc. */ +/******************************************************************************* +* FILE NAME: ERRNO.h +* +* TITLE: This function prototypes and data type definitions for the Error Defs. +* +* DATA_RIGHTS: Western Design Center and R & C Services Proprietary +* Copyright(C) 1980-2004 +* All rights reserved. Reproduction in any manner, +* in whole or in part, is strictly prohibited without +* the prior written approval of R & C Services or +* Western Design Center. +* +* DESCRIPTION: This file describes function prototypes and data type +* definitions used for Error Defs. +* +* +* SPECIAL CONSIDERATIONS: +* +* +* AUTHOR: R. Greenthal +* +* +* CREATION DATE: March 27,2004 +* +* REVISION HISTORY +* Name Date Description +* ------------ ---------- ---------------------------------------------- +* R. Greenthal 03/25/2004 Initial +* 0x/xx/2004 Added +* +******************************************************************************* +*/ + + +#ifndef __ERRNO_H +#define __ERRNO_H + +#ifndef ERRNO +extern int errno; +#endif + +#define ENOENT 1 /* No such file or directory */ +#define E2BIG 2 /* Argument list too long */ +#define EBADF 3 /* Bad file descriptor */ +#define ENOMEM 4 /* Not enough memory */ +#define EEXIST 5 /* File (already) exists */ +#define EINVAL 6 /* Invalid argument */ +#define ENFILE 7 /* Too many open files in the system */ +#define EMFILE 8 /* Too many open files in a process */ +#define ENOTTY 9 /* Not a console device */ +#define EACCES 10 /* Permission denied */ +#define EIO 11 /* I/O error (physical, usually) */ +#define ENOSPC 12 /* No space left on device */ +#define ERANGE 13 /* (math) Result too large */ +#define EDOM 14 /* (math) Argument domain error */ +#define ENOEXEC 15 /* (f)exec format error */ +#define EROFS 16 /* Read-only file system */ +#define EXDEV 17 /* Cross-device rename */ +#define EAGAIN 18 /* Nothing to read */ + +//New Error Numbers +#define EZERO 19 /* Zero */ +#define EINVFNC 20 /* Invalid Function */ +#define ENOPATH 21 /* No Path */ +#define ECONTR 22 /* Cont */ +#define EINVMEM 23 /* Invalid Nemory */ +#define EINVENV 24 /* Invalid Enviroment */ +#define EINVFMT 25 /* Invalid Format */ +#define EINVACC 26 /* Invalid */ +#define EINVDAT 27 /* Invalid Data */ +#define ENODEV 28 /* No */ +#define ECURDIR 29 /* Current Directory */ +#define ENMFILE 30 /* N File */ +#define EDEADLOCK 31 /* */ + + +/*-------------------------------------------------------------------- + define error constants (0 .. n) + change matherr_.c when new error constants are added + --------------------------------------------------------------------*/ +#define E_NOERROR 0 /* No errors detected */ +#define E_MALLOC 1 /* Not enough memory */ +#define E_MSIZE 2 /* Array too large */ +#define E_NULLPTR 3 /* NULL pointer (uninitialized pointer ) */ +#define E_MSING 4 /* Singular Matrix (ie. determinant = 0) */ +#define E_NEQNS 5 /* More unknowns than equations */ +#define E_WINDOW 6 /* Invalid window type specified */ +#define E_DOMERR 7 /* argument outside domain of function */ +#define E_FACTOR 8 /* Argument 'factor' must be between 2 and 10 */ +#define E_DECIMATE 9 /* Argument 'ndec' must be between 2 and 10 */ +#define E_NOTENOUGH 10 /* Not enough input data,the input array must be longer*/ +#define E_INTERP 11 /* Interpolated length must be >= input length */ +#define E_LAGRANGE 12 /* Interpolation not defined at input value t */ +#define E_NEGPROB 13 /* Negative probability undefined */ +#define E_FFTSIZE 14 /* Data length must be >= FFT length */ +#define E_FFTPOWER2 15 /* FFT length must be a power of two */ +#define E_LIMITS 16 /* Limits on definite integral must be distinct */ +#define E_ROUNDOFF 17 /* Rounding errors prohibit required accuracy */ +#define E_STEPSIZE 18 /* Step size must be nonzero to estimate derivative*/ +#define E_DISCRETE 19 /* k0 must be less than total number of objects n */ +#define E_SAMEX 20 /* The input table has two identical x values */ +#define E_ORDER 21 /* The polynomial order must be between 1 and 9 */ +#define E_OPEN 22 /* Could not open file */ +#define E_WRITE 23 /* Error writing to file */ +#define E_READ 24 /* Error reading from file */ +#define E_CURVES 25 /* Argument 'curves' must be between 1 and 9 */ +#define E_HEADER 26 /* Invalid file header */ +#define E_RSIZE 27 /* Sizeof(Real) in file != sizeof(Real) in program */ +#define E_NO_MIN 28 /* Minimum probably does not exist */ +#define E_DIVERGE 29 /* No convergence in LIMIT iterations */ +#define E_GRAD_ERR 30 /* Encountered errors in calculating the gradient */ +#define E_USERFUNC 31 /* User function called by least_sq returned error */ +/* add additional error constants here */ + + +/**************************/ +/* non ANSI C definitions */ +/**************************/ +// MAY NEED TO DEFINE as a FIXED Size array with circular features so too many errors just get lost! +extern char *sys_errlist[]; // Array of System Errors encountered, needs to be limited! +extern int sys_nerr; // Number of System Errors encountered + +#endif // End of __ERRNO_H + + +/**************************************************/ +/* End of File ERRNO.H */ +/**************************************************/ + + diff --git a/include/fcntl.h b/include/fcntl.h new file mode 100644 index 0000000..2683bb2 --- /dev/null +++ b/include/fcntl.h @@ -0,0 +1,118 @@ +/* Copyright (C) 1992 by Zardoz Software, Inc. */ +/******************************************************************************* +* FILE NAME: FCNTL.h +* +* TITLE: This function prototypes and data type definitions. +* +* DATA_RIGHTS: Western Design Center and R & C Services Proprietary +* Copyright(C) 1980-2004 +* All rights reserved. Reproduction in any manner, +* in whole or in part, is strictly prohibited without +* the prior written approval of R & C Services or +* Western Design Center. +* +* DESCRIPTION: This file describes function prototypes and data type +* definitions used for Disk Control. +* +* +* SPECIAL CONSIDERATIONS: +* +* +* AUTHOR: R. Greenthal +* +* +* CREATION DATE: Feb 05,2004 +* +* REVISION HISTORY +* Name Date Description +* ------------ ---------- ---------------------------------------------- +* R. Greenthal 02/05/2004 Initial, added peek & poke +* R. Greenthal 0x/0x/2004 +* +******************************************************************************* +*/ + +#ifndef __FCNTL_H +#define __FCNTL_H + +/* + *=========================== CONSTANTS & MACROS =============================== + */ + +#define O_RDONLY 0x0000 // Open as Read ONLY +#define O_WRONLY 0x0001 // Open as Write ONLY +#define O_RDWR 0x0002 // Open as Read &/or Write +#define O_CREAT 0x0100 // Create a New File +#define O_TRUNC 0x0200 // +#define O_EXCL 0x0400 // +#define O_APPEND 0x0800 // Open an existing File & Append to the end of it +#define O_TEXT 0x1000 // Open as ASCII Text (Character) Read &/or Write (needs more) +#define O_BINARY 0x8000 // TBD Binary Byte Read &/or Write + + +/* + *================================== TYPES ===================================== + */ + +#ifndef _SIZE_T +#define _SIZE_T +typedef unsigned int size_t; +#endif + +extern struct _dev { + void *fd; + short mode; +} *_devtab; + +extern short _numdev; + + +/* + *============================= FUNCTION PROTOTYPES ============================ + */ + + +void _abort(void); +int close(int); +int creat(const char *_name, int _mode); +void _exit(int _code); +long lseek(int, long, int); +int open(const char * _name, int _mode); +size_t read(int, void *, size_t); +int unlink(const char *); +size_t write(int, void *, size_t); + +//int access(char *, int); + + +#define PEEK(a) (*(char *)(a)) +#define peek(a) (*(char *)(a)) +#define PEEKB(a) (*(char *)(a)) +#define peekb(a) (*(char *)(a)) +#define PEEKW(a) (*(int *)(a)) +#define peekw(a) (*(int *)(a)) +#define PEEKL(a) (*(long *)(a)) +#define peekl(a) (*(long *)(a)) +//#define PEEKLL(a) (*(long long *)(a)) +//#define peekll(a) (*(long long *)(a)) + +#define POKE(a,b) (*(unsigned char *)(a))=(b) +#define poke(a,b) (*(unsigned char *)(a))=(b) +#define POKEB(a,b) (*(unsigned char *)(a))=(b) +#define pokeb(a,b) (*(unsigned char *)(a))=(b) +#define POKEW(a,b) (*(unsigned int *)(a))=(b) +#define pokew(a,b) (*(unsigned int *)(a))=(b) +#define POKEL(a,b) (*(unsigned long *)(a))=(b) +#define pokel(a,b) (*(unsigned long *)(a))=(b) +//#define POKELL(a,b) (*(unsigned long long *)(a))=(b) +//#define pokell(a,b) (*(unsigned long long *)(a))=(b) + + + +#endif /* FCNTL_H */ +#pragma Pop (List) + +/**************************************************/ +/* End of File FCNTL.H */ +/**************************************************/ + diff --git a/include/fenv.h b/include/fenv.h new file mode 100644 index 0000000..8493f49 --- /dev/null +++ b/include/fenv.h @@ -0,0 +1,204 @@ +/******************************************************************************* +* FILE NAME: FENV.h +* +* TITLE: These function prototypes and data type definitions for the Floating Point Exceptions (FPE). +* +* DATA_RIGHTS: Western Design Center and R & C Services Proprietary +* Copyright(C) 1980-2004 +* All rights reserved. Reproduction in any manner, +* in whole or in part, is strictly prohibited without +* the prior written approval of R & C Services or +* Western Design Center. +* +* DESCRIPTION: This file describes function prototypes and data type +* definitions used for Floating Point Exceptions (FPE). +* +* +* SPECIAL CONSIDERATIONS: +* This is just Templates for REAL Hardware Math Coprocesser +* The User Must enhance the existing code to mesh with their +* Math Coprocesser interrupt vectors and registers. +* +* AUTHOR: R. Greenthal +* +* +* CREATION DATE: March 27,2004 +* +* REVISION HISTORY +* Name Date Description +* ------------ ---------- ---------------------------------------------- +* R. Greenthal 03/15/2004 Initial +* 0x/xx/2004 Added +* +******************************************************************************* +*/ + +#ifndef _FENV_H +#define _FENV_H + + + +/* + *=========================== CONSTANTS & MACROS =============================== + */ + + +/* fexcept_t: a type for representing the floating-point exception flags + collectively, including any status associated with the flags. */ + + +#define FE_DENORM_OP 0x02 /* 80x87, Not mentioned by NCEG */ +#define FE_STACK_FLT 0x40 /* 80x87, Not mentioned by NCEG */ +#define FE_ALL_EXCEPT ( FE_INEXACT | FE_DIVBYZERO | FE_UNDERFLOW | FE_OVERFLOW | FE_INVALID | FE_DENORM_OP ) +#define FE_FLTPREC 0x000 +#define FE_INVALIDPREC 0x100 +#define FE_DBLPREC 0x200 +#define FE_LDBLPREC 0x300 + + +/**********************************/ +/* Floating-Point Exception Flags */ +/**********************************/ +#define FE_INEXACT 0x02000000 /* inexact */ +#define FE_DIVBYZERO 0x04000000 /* divide-by-zero */ +#define FE_UNDERFLOW 0x08000000 /* underflow */ +#define FE_OVERFLOW 0x10000000 /* overflow */ +#define FE_INVALID 0x20000000 /* invalid */ + + +/****************************/ +/* Rounding Direction Modes */ +/****************************/ +#define FE_TONEAREST 0x00000000 +#define FE_TOWARDZERO 0x00000001 +#define FE_UPWARD 0x00000002 +#define FE_DOWNWARD 0x00000003 +#define FE_DFL_ENV &_FE_DFL_ENV /* pointer to default environment*/ + + +/* + *============================= FUNCTION CALL PROTOTYPES ============================ + */ + +typedef unsigned char ftrap_t; // This may need resizing! + +/**********************************/ +/* Data Types */ +/**********************************/ +struct __fenv { + unsigned long control; + unsigned long status; + unsigned long tags; + unsigned long ip_offset; + unsigned long opcode; + unsigned long data_offset; + unsigned long op_sel; +}; +typedef struct __fenv fenv_t; + + +struct __fexcept { + int excepts; + void *code_address; + void *data_address; +}; +typedef struct __fexcept fexcept_t; + + +/* These may be like your FPE Vectors */ +struct fptraps { + ftrap_t invalid; + ftrap_t stack_flt; + ftrap_t denorm_op; + ftrap_t divbyzero; + ftrap_t overflow; + ftrap_t underflow; + ftrap_t inexact; + int trap_invalid; + int trap_stack_flt; +}; + + + +/* A place to keep the unmasked "sticky" bits. */ +extern int sticky; + + +extern fenv_t __default_fp_env; + +/************************************************************/ +/* Definition of pointer to IEEE default environment object */ +/************************************************************/ +extern fenv_t _FE_DFL_ENV; // default environment object + + + +/******************************************************************************* +* This is just Templates for REAL Hardware Math Coprocesser +* The User Must enhance the existing code to mesh with their +* Math Coprocesser interrupt vectors and registers. +********************************************************************************/ +/* fenv_t: a type for representing the entire floating-point environment. */ +/* fenv_t is not defined in detail by NCEG. + For Linux, we use the FPU environment: */ + + + +/* + These eleven functions were defined in C99, and describe the handling of + floating point rounding and exceptions (overflow, zero-divide etc.). +*/ + +/*******************************************************/ +/* Functions Controlling the Floating-Point Exceptions */ +/*******************************************************/ +void feclearexcept(int excepts); +void fegetexceptflag(fexcept_t *flagp, int excepts); +void feraiseexcept(int excepts); +void fesetexceptflag(const fexcept_t *flagp, int excepts); +int fetestexcept(int excepts); + + +/**************************************/ +/* Controlling the Rounding Direction */ +/**************************************/ +int fegetround(void); +int fesetround(int rounding_mode); + + +/**********************************************/ +/* Controlling the Floating-Point Environment */ +/**********************************************/ +void fegetenv (fenv_t *envp); +int feholdexcept (fenv_t *envp); +void fesetenv (const fenv_t *envp); +void feupdateenv (const fenv_t *envp); + + + +/*******************************************************/ +/*******************************************************/ +/* Extra */ +/* Functions Controlling the Floating-Point Precision */ +/*******************************************************/ +/*******************************************************/ + +int fegetprecision(void); +int fesetprecision(int prec); + +int fegetvector(ftrap_t *trap, int except); +int fesetvector(ftrap_t *trap, int except); +int fegettraps(void); +int fedisabletraps(int excepts); +int feenabletraps(int excepts); + +int __sigfpe_abort(char *s, void *p); +void __set_sticky(int bits); + + + +#endif /* End of _FENV_H */ + +/************************************** + End of File FENV.H +***************************************/ diff --git a/include/float.h b/include/float.h new file mode 100644 index 0000000..7d4b4cb --- /dev/null +++ b/include/float.h @@ -0,0 +1,386 @@ +/* Copyright (C) 1993 by Zardoz Software, Inc. */ +/******************************************************************************* +* FILE NAME: FLOAT.H +* +* TITLE: This File has data type definitions. +* +* DATA_RIGHTS: Western Design Center and R & C Services Proprietary +* Copyright(C) 1980-2004 +* All rights reserved. Reproduction in any manner, +* in whole or in part, is strictly prohibited without +* the prior written approval of R & C Services or +* Western Design Center. +* +* DESCRIPTION: This file describes data type definitions used for MATH.H. +* +* +* SPECIAL CONSIDERATIONS: +* +* +* AUTHOR: R. Greenthal +* +* +* CREATION DATE: Dec 25,2003 +* +* REVISION HISTORY +* Name Date Description +* ------------ ---------- ---------------------------------------------- +* R. Greenthal 12/16/2003 Initial +* +******************************************************************************* +*/ + +#ifndef __FLOAT_H +#define __FLOAT_H + +/* + *=========================== CONSTANTS & MACROS =============================== + */ + +/*-------------------------------------------------------------------------------- +* / NAME +* / FLT_ROUNDS - rounding modes +* / +* / SYNOPSIS +* / #define FLT_ROUNT {-1,0,1,2,3} +* / +* / DESCRIPTION +* / FLT_ROUNDS indicates to the rounding mode for floats point values: +* / -1, undetermined +* / 0 toward zero +* / 1 to the nearest +* / 2 towards positive infinity +* / 3 towards negative infinity +* / +* / Notes +* / The floating-point representation in apeNEXT is inasmach as +* / fixed hardware-impemented, we might not need to redefind its +* / rounding modes. But at this prestage we cannot exclude the need +* / for rounding in certain claculation. +* / +* /----------------------------------------------------------------------------*/ +#ifndef FLT_ROUNDS +#define FLT_ROUNDS -1 +#endif + + + +/*------------------------------------------------------------------------------- +* / NAME +* / FLT_EVAL_METHOD - evaluation formats +* / +* / SYNOPSIS +* / #define FLT_EVAL_METHOD {-1,0,1,2} +* / +* / DESCRIPTION +* / FLT_EVAL_METHOD defines the evaluation methos used to determine +* / the evaluation formats of all floating types. It defines the +* / precision/representation of operations proceeded with foating-point +* / +* / RETURN VALUE +* / None +* / +* / Notes +* / If-1, range and precision of evaluation are not determined. +* / If 0, all operations and constants will be +* / evaluated to the range and precisions of the current type. +* / If 1, all operations and constants of types +* / float and double will be evaluated to the range and precisions +* / of double (long double will be evaluated as long double also). +* / Also the product of two floating_complex +* / operands is represented in double _Complex format, +* / and its parts are evaluated to double. +* / If 2, all operations and constants will be +* / evaluated to the range and precision of long double. +* / +* /-----------------------------------------------------------------------------*/ +#ifndef FLT_EVAL_METHOD +#define FLT_EVAL_METHOD 0 +#endif + + +/*---------------------------------------------------------------------------------- +* / NAME +* / FLT_RADIX - (base) radix representation of the exponent +* / +* / SYNOPSIS +* / #define FLT_RADIX {2,8,10,16} +* / +* / DESCRIPTION +* / FLT_RADIX is the radix of exponent representing (or the base) +* / typically defined as 2 (binary), +* / but there are other definitions like 8, 10, 16 +* / 8 is octal, +* / 10 is the normal decimal, +* / 16 is Hex, representations +* / +* / RETURN VALUE +* / None +* / +* / Notes +* / +* /----------------------------------------------------------------------------*/ +#ifndef FLT_RADIX +#define FLT_RADIX 2 +#endif + +/*-------------------------------------------------------------------------------- +* / NAME +* / FLT_MANT_DIG - number of base-FLT_RADIX digits +* / +* / SYNOPSIS +* / +* / DESCRIPTION +* / FLT_MANT_DIG defines the number of base-FLT_RADIX digits +* / in the floating-point significant p. +* / +* / RETURN VALUE +* / None +* / +* / Notes +* / It belongs to FLT_RADIX like DBL_MANT_DIG, LDBL_MANT_DIG. +* / According to EC 60559 FLT_MANT_DIG has 53 bit +* / (where mantissa is always less than 1) +* / +* /-----------------------------------------------------------------------------*/ +#ifndef FLT_MANT_DIG +#define FLT_MANT_DIG 24 // Number of Bits in the Mantissa +#endif + + +/*-------------------------------------------------------------------------------- +* / NAME +* / DECIMAL_DIG - number of decimals +* / +* / SYNOPSIS +* / #define DECIMAL_DIG +* / +* / DESCRIPTION +* / Number of decimal digits, n, such that any floating-point +* / number in the widest supported floating type with pmax +* / radix b digits can be rounded to a floating-point number +* / with n decimal digits and back again without +* / change to the value. +* / [p * log_{10} b] if b is a power of 10 +* / [1 + p * log_{10} b] otherwise +* / +* / RETURN VALUE +* / None +* / +* /-----------------------------------------------------------------------------*/ +#undef DECIMAL_DIG +#if LDBL_MANT_DIG == 53 +//#define DECIMAL_DIG 12 +#define DECIMAL_DIG 17 +#else +#define DECIMAL_DIG 36 +#endif + +/*-------------------------------------------------------------------------------- +* / NAME +* / FLT_DIG - minimun negative interger for exponent in FLT_RADIX +* / +* / SYNOPSIS +* / +* / DESCRIPTION +* / FLT_DIG is the minimum negative integer value, q, such that +* / any floaring-point number with q decimal digits can be rounded +* / into a floating-point number with p radix b digits and back +* / again without change to the q decimal digits and the value +* / p*log_{10} b + 1 if b is a power of 10 +* / [1 - p*log_{10} b] + 0 otherwise +* / +* / RETURN VALUE +* / None +* / +* / Notes +* / The value of this macro is supposed to be at least 6, +* / to satisfy ISO c +* / +* /-----------------------------------------------------------------------------*/ +#ifndef FLT_DIG +#define FLT_DIG 6 // The maximum number decimal digits (base-10) that can be represented without change after rounding +#endif + + +/*--------------------------------------------------------------------------------- +* / NAME +* / FLT_MIN_EXP - minimun negative that FLT_RADIX to n-1 +* / +* / SYNOPSIS +* / +* / DESCRIPTION +* / Minimum negative integer such that FLT_RADIX raised to that power +* / minus 1 is a normalized floating-point number e_{min}, +* / +* / Notes +* / +* /-----------------------------------------------------------------------------*/ +#ifndef FLT_MIN_EXP +#define FLT_MIN_EXP -125 //The min integer value for an exponent in base 10 +#endif + +/*--------------------------------------------------------------------------------- +* / NAME +* / FLT_MIN_10_EXP - ninimum negative integer for exponent in base 10 +* / +* / SYNOPSIS +* / DESCRIPTION +* / FLT_MIN_10_EXP is the minimum negative integer value for an +* / exponent in base 10 (float) +* / +* / Note +* / Minimum int x such that 10**x is a normalised float +* / log_10 b^{e_min} +* / +* /-----------------------------------------------------------------------------*/ +#ifndef FLT_MIN_10_EXP +#define FLT_MIN_10_EXP -37 //The maximum integer value for an exponent in base 10 +#endif + +/*-------------------------------------------------------------------------------- +* / NAME +* / FLT_MAX_10_EXP - maximum negative integer for exponent in base 10 +* / +* / SYNOPSIS +* / +* / DESCRIPTION +* / FLT_MAX_10_EXP is the maximum negative integer value for an +* / exponent in base 10 (float) +* / +* / Note +* / Maximum int x such that 10**x is a normalised float +* / log_10 ([1-b^{-p}] b^{e_max}) +* / +* /-----------------------------------------------------------------------------*/ +#ifndef FLT_MAX_10_EXP +#define FLT_MAX_10_EXP +38 //The maximum integer value for an exponent in base 10 +#endif + +/*-------------------------------------------------------------------------------- +* / NAME +* / FLT_MAX_EXP - maximun negative that FLT_RADIX to n-1 +* / +* / SYNOPSIS +* / +* / DESCRIPTION +* / FLT_MAX_EXP the maximum number n such that base to the power +* / of n-1 (float). The minimum negative integer value for an +* / exponent in base FLT_RADIX +* / +* / Notes +* / Maximum negative integer such that FLT_RADIX raised to that power +* / minus 1 is a normalized floating-point number e_{min}, +* / In apeNEXT the exponent has 11 bit +* / +* /-----------------------------------------------------------------------------*/ +#ifndef FLT_MAX_EXP +#define FLT_MAX_EXP +128 //The maximum integer value for an exponent in base FLT_RADIX +#endif + +/*--------------------------------------------------------------------------------- +* / NAME +* / FLT_MAX - maximum normalized finite representable value +* / of type float +* / +* / SYNOPSIS +* / +* / DESCRIPTION +* / Maximum floating-point value +* / +* / Note +* / (1-b^{p}) b^{e_{max}} +* / (1.-pow(2.,-52.))*pow(2.,1023) = +* / 8.9884656743115775E+307 +* / +* /-----------------------------------------------------------------------------*/ +#ifndef FLT_MAX +#define FLT_MAX 3.40282347E+38F //Maximum finite floating-point value +#endif + +/*--------------------------------------------------------------------------------- +* / NAME +* / FLT_MIN - minimum normalized finite representable value +* / of type float +* / +* / SYNOPSIS +* / +* / DESCRIPTION +* / Minimum floating-point value +* / +* / Note +* / b^{e_{min}-1} = pow(2., -1023) +* / +* /-----------------------------------------------------------------------------*/ +#ifndef FLT_MIN +#define FLT_MIN 1.17549435E-38F //Minimum floating-point value +#endif + +/*-------------------------------------------------------------------------------- +* / NAME +* / FLT_EPSELON - smallest number +* / +* / SYNOPSIS +* / +* / DESCRIPTION +* / FLT_EPSILON is smallest number x such that 1.0+x!=1.0 defined as +* / Least significant digit representable for floating-point. +* / +* / Note +* / Difference between 1.0 and the least value greater that +* / 1.0 that is reperesentable in the given floating-point type +* / (here double float) +* / b^{1-p} pow(2.,1-52) = pow(2.,-51) +* / +* /-----------------------------------------------------------------------------*/ +#ifndef FLT_EPSILON +#define FLT_EPSILON 1.19209290E-07F //Least significant digit representable +#endif + +/******************************************/ +/* Double Precision Floating Point Limits */ +/******************************************/ + +#define DBL_MANT_DIG 53 // Number of Bits in the Mantissa +#define DBL_EPSILON 2.2204460492503131E-16 //Least significant digit representable +#define DBL_DIG 15 // Number of Significant Digits +#define DBL_MIN_EXP -1021 +#define DBL_MIN 2.225073858507201E-308 +#define DBL_MIN_10_EXP -307 +#define DBL_MAX_EXP +1024 +#define DBL_MAX 1.797693134862316E+308 +#define DBL_MAX_10_EXP +308 + +/***********************************************/ +/* Long Double Precision Floating Point Limits */ +/***********************************************/ + +#define LDBL_MANT_DIG 106 // Number of Bits in the Mantissa +#define LDBL_EPSILON 2.2204460492503131E-16L //Least significant digit representable +#define LDBL_DIG 15 // Number of Significant Digits +#define LDBL_MIN_EXP -1021 +#define LDBL_MIN 2.225073858507201E-308L +#define LDBL_MIN_10_EXP -307 +#define LDBL_MAX_EXP +1024 +#define LDBL_MAX 1.797693134862316E+308L // 0x7FEFFFFFFFFFFFFF, 0x7C8FFFFFFFFFFFFF +#define LDBL_MAX_10_EXP +308 + +/* Follows IEEE standards for 128-bit floating point */ +//#define LDBL_MANT_DIG 113 +//#define LDBL_EPSILON 1.925929944387235853055977942584927319E-34L +//#define LDBL_DIG 33 +//#define LDBL_MIN_EXP (-16381) +//#define LDBL_MIN 3.362103143112093506262677817321752603E-4932L +//#define LDBL_MIN_10_EXP (-4931) +//#define LDBL_MAX_EXP (+16384) +//#define LDBL_MAX 1.189731495357231765085759326628007016E+4932L +//#define LDBL_MAX_10_EXP (+4932) + +#endif /* FLOAT_H */ +#pragma Pop (List) + + +/**************************************************/ +/* End of File FLOAT.H */ +/**************************************************/ + diff --git a/include/intrins.h b/include/intrins.h new file mode 100644 index 0000000..ec0065c --- /dev/null +++ b/include/intrins.h @@ -0,0 +1,89 @@ +#pragma Off (List) +/******************************************************************************* +* FILE NAME: INTRINS.H +* +* TITLE: This function prototypes and data type definitions for HW. +* +* DATA_RIGHTS: Western Design Center and R & C Services Proprietary +* Copyright(C) 1980-2004 +* All rights reserved. Reproduction in any manner, +* in whole or in part, is strictly prohibited without +* the prior written approval of R & C Services or +* Western Design Center. +* +* DESCRIPTION: This file describes function prototypes and data type +* definitions used for . +* +* +* SPECIAL CONSIDERATIONS: +* +* +* AUTHOR: R. Greenthal +* +* +* CREATION DATE: Feb 05,2004 +* +* REVISION HISTORY +* Name Date Description +* ------------ ---------- ---------------------------------------------- +* R. Greenthal 02/05/2004 Initial +* +******************************************************************************* +*/ + +#ifndef INTRINS_H +#define INTRINS_H + +/* + *=========================== CONSTANTS & MACROS =============================== + */ + +/* None */ + +/* + *================================== TYPES ===================================== + */ + +/* None */ + +/* + *============================= FUNCTION PROTOTYPES ============================ + */ + + + + +/* +Instructions that can be added to 'C' code +*/ +#define CLI asm{cli;} /* enable interrupt response */ +#define _atomic_ asm{cli;} /* enable interrupt response */ + +#define SEI asm{sei;} /* disable it */ +#define _endatomic_ asm{sei;} /* disable it */ + +#define BRK(n) asm{ brk n;} /* 65C02/65c816-BRK */ +#define _TRAP_(n) asm{ brk n;} /* 65C02/65c816-BRK */ + +#define COP(n) asm{ cop n;} /* 65c816-COP */ + +#define IDLE asm{ wai;} /* 65c816-WAI */ +#define WAIT asm{ wai;} /* 65c816-WAI */ + + + + +// _crol_(x, b) // Rotates a "char" Left so many bits +// _cror_(x, b) // Rotates a "char" Right so many bits +// _irol_(x, b) // Rotates a "int" Left so many bits +// _iror_(x, b) // Rotates a "int" Right so many bits +// _lrol_(x, b) // Rotates a "long" Left so many bits +// _lror_(x, b) // Rotates a "long" Right so many bits + + +#endif /* INTRINS_H */ + +/**************************************************/ +/* End of File INTRINS.H */ +/**************************************************/ + diff --git a/include/inttypes.h b/include/inttypes.h new file mode 100644 index 0000000..1f461fe --- /dev/null +++ b/include/inttypes.h @@ -0,0 +1,111 @@ +/******************************************************************************* +* FILE NAME: INTTYPES.h +* +* TITLE: This function prototypes and data type definitions for the Wide Characters Functions. +* +* DATA_RIGHTS: Western Design Center and R & C Services Proprietary +* Copyright(C) 1980-2004 +* All rights reserved. Reproduction in any manner, +* in whole or in part, is strictly prohibited without +* the prior written approval of R & C Services or +* Western Design Center. +* +* DESCRIPTION: This file describes function prototypes and data type +* definitions used for Wide Character functions. +* +* +* SPECIAL CONSIDERATIONS: +* +* +* AUTHOR: R. Greenthal +* +* +* CREATION DATE: March 27,2004 +* +* REVISION HISTORY +* Name Date Description +* ------------ ---------- ---------------------------------------------- +* R. Greenthal 03/25/2004 Initial +* 0x/xx/2004 Added +* +******************************************************************************* +*/ + +#ifndef _INTTYPES_H +#define _INTTYPES_H + + +/* + *=========================== CONSTANTS & MACROS =============================== + */ + +#ifndef _WCHAR_T +#define _WCHAR_T +typedef char wchar_t; +#endif + + +typedef signed char int8_t; +typedef unsigned char uint8_t; +typedef int int16_t; +typedef unsigned int uint16_t; +typedef long int32_t; +typedef unsigned long uint32_t; +//typedef long long int64_t; +//typedef unsigned long long uint64_t; +typedef int16_t intptr_t; +typedef uint16_t uintptr_t; + +//typedef long long intmax_t; /* Max size of int */ +//typedef unsigned long long uintmax_t; /* Max size of uint */ +typedef long intmax_t; +typedef unsigned long uintmax_t; + + +//#define INTMAX_MAX 63 /* Max size of long long */ +//#define INTMAX_MIN 15 /* Max size of int */ +//#define UINTMAX_MAX 64 /* Max size of unsigned long long */ +#define INTMAX_MAX 31 /* Max size of long */ +#define INTMAX_MIN 15 /* Max size of int */ +#define UINTMAX_MAX 32 /* Max size of unsigned long */ + + +/* + type defined by this header (only) +*/ + +typedef struct + { + intmax_t quot; /* member order must match function */ + intmax_t rem; +}imaxdiv_t; + + +#define WCHAR_MIN 0 + + +/* + *============================= FUNCTION CALL PROTOTYPES ============================ + */ + + + + +intmax_t strtoimax(register const char *nptr, wchar_t **endptr, register int base); +uintmax_t strtoumax(register const char *nptr, wchar_t **endptr, register int base); +intmax_t wcstoimax(register const char *nptr, wchar_t **endptr, register int base); +uintmax_t wcstoumax(register const wchar_t *nptr, wchar_t **endptr, register int base); + +/***************/ +/* Non ANSI */ +/***************/ +intmax_t imaxabs(intmax_t j); +imaxdiv_t imaxdiv(intmax_t numer, intmax_t denom); + + +#endif /* End of _INTTYPES_H */ +#pragma Pop (List) + +/************************************** + End of File INTTYPES.H +***************************************/ diff --git a/include/iso646.h b/include/iso646.h new file mode 100644 index 0000000..5b4f82f --- /dev/null +++ b/include/iso646.h @@ -0,0 +1,64 @@ +/* Copyright (C) 1993 by Zardoz Software, Inc. */ +#pragma Off (List) +/******************************************************************************* +* FILE NAME: ISO646.h +* +* TITLE: This function prototypes and data type definitions for the Wide Characters Functions. +* +* DATA_RIGHTS: Western Design Center and R & C Services Proprietary +* Copyright(C) 1980-2004 +* All rights reserved. Reproduction in any manner, +* in whole or in part, is strictly prohibited without +* the prior written approval of R & C Services or +* Western Design Center. +* +* DESCRIPTION: This file describes function prototypes and data type +* definitions used for Wide Character functions. +* +* +* SPECIAL CONSIDERATIONS: +* +* +* AUTHOR: R. Greenthal +* +* +* CREATION DATE: March 17,2004 +* +* REVISION HISTORY +* Name Date Description +* ------------ ---------- ---------------------------------------------- +* R. Greenthal 03/15/2004 Initial +* 0x/xx/2004 Added +* +******************************************************************************* +*/ + +#ifndef _ISO646_H +#define _ISO646_H + + +/* + *=========================== CONSTANTS & MACROS =============================== + */ + +#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 /* End of _ISO646_H */ +#pragma Pop (List) + +/************************************** + End of File ISO646.H +***************************************/ diff --git a/include/limits.h b/include/limits.h new file mode 100644 index 0000000..9cc7a4d --- /dev/null +++ b/include/limits.h @@ -0,0 +1,65 @@ +/* Copyright (C) 1992 by Zardoz Software, Inc. */ +/******************************************************************************* +* FILE NAME: LIMITS.h +* +* TITLE: This function prototypes and data type definitions for the Limits. +* +* DATA_RIGHTS: Western Design Center and R & C Services Proprietary +* Copyright(C) 1980-2004 +* All rights reserved. Reproduction in any manner, +* in whole or in part, is strictly prohibited without +* the prior written approval of R & C Services or +* Western Design Center. +* +* DESCRIPTION: This file describes function prototypes and data type +* definitions used for Character Limitss. +* +* +* SPECIAL CONSIDERATIONS: +* +* +* AUTHOR: R. Greenthal +* +* +* CREATION DATE: March 27,2004 +* +* REVISION HISTORY +* Name Date Description +* ------------ ---------- ---------------------------------------------- +* R. Greenthal 03/25/2004 Initial +* 0x/xx/2004 Added +* +******************************************************************************* +*/ + + +#ifndef __LIMITS_H +#define __LIMITS_H + +#define CHAR_BIT 8 +#define CHAR_MAX 255U +#define CHAR_MIN 0 +#define INT_MAX +32767 +#define INT_MIN -32767 +#define LONG_MAX +2147483647 +#define LONG_MIN -2147483647 +#define MB_LEN_MAX 1 +#define SCHAR_MAX +127 +#define SCHAR_MIN -127 +#define SHRT_MAX +32767 +#define SHRT_MIN -32767 +#define UCHAR_MAX 255U +#define UCHAR_MIN 0 +#define UINT_MAX 65535U +#define ULONG_MAX 4294967295U +#define USHORT_MAX 65535U +#define USHRT_MAX 65535U + + +#endif // End of __LIMITS_H + +/**************************************************/ +/* End of File LIMITS.H */ +/**************************************************/ + + diff --git a/include/locale.h b/include/locale.h new file mode 100644 index 0000000..fef4811 --- /dev/null +++ b/include/locale.h @@ -0,0 +1,49 @@ +/* Copyright (C) 1992 by Zardoz Software, Inc. */ + +#ifndef __LOCALE_H +#define __LOCALE_H + +#ifndef NULL +#define NULL ((void *)0) +#endif + +#define LC_ALL 0 +#define LC_COLLATE 1 +#define LC_CTYPE 2 +#define LC_MONETARY 3 +#define LC_NUMERIC 4 +#define LC_TIME 5 + +typedef 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_MAX */ + char frac_digits; /* CHAR_MAX */ + char p_cs_precedes; /* CHAR_MAX */ + char p_sep_by_space; /* CHAR_MAX */ + char n_cs_precedes; /* CHAR_MAX */ + char n_sep_by_space; /* CHAR_MAX */ + char p_sign_posn; /* CHAR_MAX */ + char n_sign_posn; /* CHAR_MAX */ +} lconv; + +struct lconv *localeconv(void); + + +char *setlocale(int _category, const char *_locale); + +#endif // End of __LOCALE_H + +/**************************************************/ +/* End of File LOCALE.H */ +/**************************************************/ + + diff --git a/include/malloc.h b/include/malloc.h new file mode 100644 index 0000000..6f573d4 --- /dev/null +++ b/include/malloc.h @@ -0,0 +1,99 @@ +#pragma Off (List) +/******************************************************************************* +* FILE NAME: MALLOC.h +* +* TITLE: This function prototypes and data type definitions. +* +* DATA_RIGHTS: Western Design Center and R & C Services Proprietary +* Copyright(C) 1980-2004 +* All rights reserved. Reproduction in any manner, +* in whole or in part, is strictly prohibited without +* the prior written approval of R & C Services or +* Western Design Center. +* +* DESCRIPTION: This file describes function prototypes and data type +* definitions used for General purpose RAM Allocation functions. +* +* +* SPECIAL CONSIDERATIONS: +* +* +* AUTHOR: R. Greenthal +* +* +* CREATION DATE: Feb 11,2004 +* +* REVISION HISTORY +* Name Date Description +* ------------ ---------- ---------------------------------------------- +* R. Greenthal 02/11/200 Initial +* +******************************************************************************* +*/ + +#ifndef _MALLOC_H +#define _MALLOC_H + + +/* + *=========================== CONSTANTS & MACROS =============================== + */ + + + +/* + *================================== TYPES ===================================== + */ + +#ifndef _SIZE_T +#define _SIZE_T +typedef unsigned int size_t; +#endif + +#ifndef NULL +#define NULL ((void *)0) +#endif + +#ifndef ALLOC_L_LEN +//int alloc_list_length; +//void *alloc_list[]; +#endif + +#ifndef ALIGN_SIZE +#define ALIGN_SIZE sizeof(double) +#endif + + +#define SIZE_T_MAX ((size_t) ~0) +#define MALLOC_MAX SIZE_T_MAX +#define ARRAY_MAX SIZE_T_MAX + + +/* + *============================= FUNCTION CALL PROTOTYPES ============================ + */ + + +//int add_alloc_list(void *p); // +void *calloc(size_t _nmemb, size_t _size); // Complex alloc +void far *farcalloc(unsigned long _nmemb, unsigned long _size); +void farfree(void far *_ptr); // +void far *farmalloc(unsigned long _size); // +void far *farrealloc(void far *_ptr, unsigned long _size); +void free(void *_ptr); // +void *malloc(size_t _size); // +//int pmalloc(int nbytes); // Permanent alloc +//void *realloc(void *_ptr, size_t _size); // +int remove_alloc_list(void *p); // +double *valloc(double *address, unsigned npts); // + +//unsigned stackavail(void); // Check on how much STACK is Available + + +#endif /* End of _MALLOC_H */ +#pragma Pop (List) + +/************************************** + End of File MALLOC.H +***************************************/ + diff --git a/include/math.h b/include/math.h new file mode 100644 index 0000000..ad8bae4 --- /dev/null +++ b/include/math.h @@ -0,0 +1,772 @@ +/* Copyright (C) 1993 by Zardoz Software, Inc. */ +/******************************************************************************* +* FILE NAME: MATH.h +* +* TITLE: This function prototypes and data type definitions for the Math Functions. +* +* DATA_RIGHTS: Western Design Center and R & C Services Proprietary +* Copyright(C) 1980-2004 +* All rights reserved. Reproduction in any manner, +* in whole or in part, is strictly prohibited without +* the prior written approval of R & C Services or +* Western Design Center. +* +* DESCRIPTION: This file describes function prototypes and data type +* definitions used for General purpose Math functions. +* +* Double precison floating point format: +* +* 6 6 5 5 0 +* 3 2 2 1 0 +* ___________________________ +* |s|exponent| fraction | +* +-+--------+--------------+ +* +* +* Single/Float precison floating point format: +* +* 3 3 2 2 0 +* 1 0 X X 0 +* ___________________________ +* |s|exponent| fraction | +* +-+--------+--------------+ +* +* +* Long Double precison floating point format: +* +* 1 1 1 +* 2 2 X X 0 +* 7 6 X X 0 +* ___________________________ +* |s|exponent| fraction | +* +-+--------+--------------+ +* +* +* +* +* SPECIAL CONSIDERATIONS: +* +* +* AUTHOR: R. Greenthal +* +* +* CREATION DATE: November 17,2003 +* +* REVISION HISTORY +* Name Date Description +* ------------ ---------- ---------------------------------------------- +* Jim Goodnow 1993 Initial +* R. Greenthal 11/17/2003 Added Single Precision Math Functions +* And templates for "long double" - 128 bit Math +* +* 01/21/2004 Added cadd, asinh, rad2deg, etc. +* 01/29/2004 Added constants +* 02/05/2004 Added more Gamma, FFT, & Bessel Functions +* 02/18/2004 Added Integra... +* 03/08/2004 Added Transcendental with built in Rad/Deg/Grad +* 0x/xx/2004 Added +* +******************************************************************************* +*/ + +#ifndef _MATH_H +#define _MATH_H + + + +#include + +/* + *=========================== CONSTANTS & MACROS =============================== + */ + + +#ifndef _FLOAT_T +#define _FLOAT_T +typedef float float_t; +#endif + + +#ifndef _DOUBLE_T +#define _DOUBLE_T +typedef double double_t; +#endif + +#define FP_INFINITE 2 +#define FP_NAN 3 +#define FP_NORMAL 1 +#define FP_SUBNORMAL 1 +#define FP_ZERO 4 + +#define FP_FAST_FMA + +#define FP_FAST_FMAF FP_FAST_FMA +#define FP_FAST_FMAL FP_FAST_FMA + +#define FP_ILOGB0 -INT_MAX +#define FP_ILOGBNAN INT_MAX + + +#define fpclassify(x) _fpclassify(x) +#define isfinite(x) _isfinite(x) +#define isinf(x) _isinf(x) +#define isnan(x) _isnan(x) +#define isnormal(x) _isfinite(x) +#define signbit(x) _signbit(x) + +#define NAN nan("255") + + + + +#define SIGDIGLEN 36 // significant decimal digits +#define DECSTROUTLEN 80 // max length for dec2str output +#define FLOATDECIMAL ((char)(0)) +#define FIXEDDECIMAL ((char)(1)) + + + +/*********************************** + Limiting Constants Used by + Double Precision Functions +************************************/ + +#define HUGE_VAL 1.797693134862316E+308 +#define LOGHUGE (709.778) +#define TINY_VAL (2.2e-308) +#define LOGTINY (-708.396) + + +// We are currently EQUATING long double & double +//#define LONG_DOUBLE_SIZE 16 // 128 Bits/16 Bytes +#define LONG_DOUBLE_SIZE 8 // 64 Bits/8 Bytes + +#define DOUBLE_SIZE 8 // 64 Bits/8 Bytes +//#define HUGE_VAL __inf() +#define INFINITY __inf() +//#define HUGE_VAL INFINITY + +#define HUGE_VALF HUGE_VAL +#define HUGE_VALL HUGE_VAL + + +/*********************************** + General Math Constants Used by + Double Precision Functions + (20 places to the Right of + the Decimal point) +************************************/ + +#define PI 3.14159265358979323846 +#define PIOVR2 1.57079632679489661923 // PI/2 +#define M_1_PI 0.318309886183790671538 // 1/PI +#define PI2 6.28318530717958647692 // 2*PI +#define SIN45 0.70710678118654752440 // SIN(45 degrees) +#define SQRT2 1.41421356237309504880 // SQRT(2) +#define LN2 0.69314718055994530942 // Ln 2 constant +#define EULER 0.577215664901532860607 // Euler number +#define LN10 2.30258509299404568402 // ln(10) +#define SQRTPI 1.77245385090551602730 // sqrt(PI) +#define LOG10E 0.43429448190325182765 // Log(e) +//#define 180_PI 57.2957795130823208768 // One Radian in degrees = 180/PI +//#define +//#define M_3PI_4 2.35619449019234492884698253745962716 +//#define M_3PI_8 1.17809724509617246442349126872981358 +//#define M_PI_4 0.78539816339744830961566084581987572 +//#define M_PI_8 0.39269908169872415480783042290993786 +//#define M_1_PI 0.31830988618379067153776752674502872 +//#define M_2_PI 0.63661977236758134307553505349005744 +//#define M_4_PI 1.27323954473516268615107010698011488 +#define M_E 2.71828182845904523536028747135266250 //constant "e" +//#define M_1_SQRT2 0.70710678118654752440084436210484904 +#define LOGPI 1.14472988584940017414 + +/*********************************** + Limiting Constants Used by + Single Precision Functions +************************************/ + +#define FLT_HUGE_VAL 1.797693135E+308f +#define FLT_LOGHUGE 709.778f +#define FLT_TINY_VAL 2.2e-308f +#define FLT_LOGTINY -708.396f + + +/*********************************** + General Math Constants Used by + Double Precision Functions + (xx places to the Right of + the Decimal point) +************************************/ + +#define F_PI 3.141592653f +#define F_PIOVR2 1.570796327f // PI/2 +#define F_PI2 6.283185307f // 2*PI +#define F_SIN45 0.707106781f // SIN() +#define F_SQRT2 1.414213562f // SQRT(2) +#define F_LN2 0.693147181f // Ln 2 constant +#define F_LN10 2.302585092f // ln(10) +#define F_LOG10E 0.434294481f // Log(e) + + +/*********************************** + Limiting Constants Used by + Long Double Precision Functions +************************************/ + +#define LDBL_HUGE_VAL 1.797693134862316E+308L +#define LDBL_LOGHUGE 709.778L +#define LDBL_TINY_VAL 2.2e-308L +#define LDBL_LOGTINY -708.396L + +/*********************************** + General Math Constants Used by + Long Double Precision Functions + (xx places to the Right of + the Decimal point) +************************************/ + +#define LDBL_PI 3.14159265358979323846L +#define LDBL_PI2 6.28318530717958647692L // 2*PI +#define LDBL_PIOVR2 1.57079632679489661923L // PI/2 +#define LDBL_SIN45 0.70710678118654752440L // SIN() +#define LDBL_SQRT2 1.41421356237309504880L // SQRT(2) +#define LDBL_LN2 0.69314718055994530942L // Ln 2 constant +#define LDBL_LN10 2.30258509299404568402L // ln(10) +#define LDBL_LOG10E 0.43429448190325182765L // Log(e) + +//#define M_PI 3.14159265358979323846264338327950288 +//#define M_2PI 6.28318530717958647692528676655900576 +//#define M_3PI_4 2.35619449019234492884698253745962716 +//#define M_PI_2 1.57079632679489661923132169163975144 +//#define M_3PI_8 1.17809724509617246442349126872981358 +//#define M_PI_4 0.78539816339744830961566084581987572 +//#define M_PI_8 0.39269908169872415480783042290993786 +//#define M_1_PI 0.31830988618379067153776752674502872 +//#define M_2_PI 0.63661977236758134307553505349005744 +//#define M_4_PI 1.27323954473516268615107010698011488 +#define M_E 2.71828182845904523536028747135266250 //constant "e" +//#define M_LOG2E 1.44269504088896340735992468100189213 +//#define M_LOG10E 0.43429448190325182765112891891660508 +//#define M_LN2 0.69314718055994530941723212145817657 +//#define M_LN10 2.30258509299404568401799145468436421 +//#define M_SQRT2 1.41421356237309504880168872420969808 +//#define M_1_SQRT2 0.70710678118654752440084436210484904 + + + +/* + *================================== TYPES ===================================== + */ + +#ifndef ERRNO +extern int errno; +#endif + +struct exception { + int type; /* type of exception */ + char *name; /* name of function */ + double arg1; /* first argument to function */ + double arg2; /* second argument to function */ + double retval; /* value to be returned if error is not fatal */ +}; + +/* exception types */ + +#define DOMAIN 1 /* not in domain of function (i.e. number passed either to small or too large) */ +#define SING 2 /* singularity (function not defined)(i.e. x/0) */ +#define OVERFLOW 3 /* result too large */ +#define UNDERFLOW 4 /* result too small */ +#define TLOSS 5 /* total loss of precision */ +#define PLOSS 6 /* partial loss of precision */ + + + + +/* + *============================= FUNCTION CALL PROTOTYPES ============================ + */ + + + +/************************************************************************************ + ************************************************************************************ + Double Precision Math Functions - (General ANSI Standard Functions) +************************************************************************************* +*************************************************************************************/ + + +double acos(double); // Arc Cosine +float acosf(float); +long double acosl(long double); + +double acosh(double); // Arc Hyperbolic Cosine +float acoshf(float); +long double acoshl(long double); + +double asin(double); // Arc Sine +float asinf(float); +long double asinl(long double); + +double asinh(double); // Arc Hyperbolic Sine +float asinhf(float); +long double asinhl(long double); + +double atan(double); // Arc Tangent +float atanf(float); +long double atanl(long double); + +double atanh(double); // Arc Hyperbolic Tangent +float atanhf(float); +long double atanhl(long double); + +double atan2(double, double); // Inverse tangent of y/x +float atan2f(float, float); +long double atan2l(long double, long double); + +double atof(const char *); // ASCII to Float + +double cbrt(double ); // Cube Root +float cbrtf(float ); +long double cbrtl(long double ); + +double ceil(double); // Smallest integer >= argument (as double) +float ceilf(float ); +long double ceill(long double ); + +double cos(double); // Cosine of a Radian +float cosf(float); +long double cosl(long double); + +double cosh(double); // Hyperbolic Cosine +float coshf(float); +long double coshl(long double); + +double cotan(double); // Cotangent +float cotanf(float); +long double cotanl(long double); + +double deg2rad(double ); // Degrees to Radians +float deg2radf(float ); +long double deg2radl(long double); + +//double drand(int n); // + +double exp(double); // Natural ("e") Exponential (e^x) +float expf(float); +long double expl(long double); + +double fabs(double); // Floating Absolute value +float fabsf(float); +long double fabsl(long double); + +double floor(double); // Largest integer <= argument +float floorf(float ); +long double floorl(long double ); + +double fma(double x, double y, double z); // Calculate (x * y) + z +float fmaf(float x, float y, float z); // Calculate (x * y) + z +long double fmal(long double x, long double y, long double z); + +double fmod(double, double); // Floating modulus +float fmodf(float, float); +long double fmodl(long double, long double); + +double frexp(double, int *); // Returns the mantissa of the floating point number +float frexpf(float, int *); +long double frexpl(long double, int *); + +double hypot(double x, double y); // Calculate the Hypotenuse +float hypotf(float x, float y); // +long double hypotl(long double x, long double y); // + +double ipow(double x, int n); // return x^n where n is an integer??????????????? + +double ldexp(double, int); // Returns the value of x times 2 raised to the exp power +float ldexpf(float, int); +long double ldexpl(long double, int); + +//long _lrand() + +double log(double); // Logarithm base "e" or natural +float logf(float); +long double logl(long double); + +double log10(double); // Logarithm base 10 +float log10f(float); +long double log10l(long double); + +double modf(double, double *); // Return integer and fractional parts of number +float modff(float, float *); +long double modfl(long double, long double *); + +double pseries(double , double coef[], unsigned ); // Expand polynomial series - sum = coef[0]+x*coef[1]+x^2*coef[2]+...+x^(n-1)*coef[n-1] + +#if 0 +#define pow(x,y) power(x,y) // same as "pow" +#endif +#if 0 +#define powf(x,y) powerf(x,y) +#endif +#if 0 +#define powl(x,y) powerl(x,y) +#endif + +double pow(double, double); // Calculates "x" to the "y" power +float powf(float, float); +long double powl(long double, long double); + +double rad2deg(double ); // Radians to Degrees +float rad2degf(float ); +long double rad2degl(long double); + +double sin(double); // Sine of a Radian +float sinf(float); +long double sinl(long double); + +double sinh(double); // Hyperbolic Sine +float sinhf(float); +long double sinhl(long double); + +double sqrt(double); // Square Root +float sqrtf(float); +long double sqrtl(long double); + +double tan(double); // Tangent (Sine/Cosine) +float tanf(float); +long double tanl(long double); + +double tanh(double); // Hyperbolic Tangent +float tanhf(float); +long double tanhl(long double); + +double tgamma(double x); // gamma function of the argument +float tgammaf(float x); +long double tgammal(long double x); + + +//long double atoldl(const char *); + + + + + + + +//******************************************************************* +// Gamma & Error Functions +//******************************************************************* +double erf(double ); // Error Function +float erff(float ); + +double erfc(double ); // Error Function +float erfcf(float ); + +double ierfc(double ); // Inverse Error Function +float ierfcf(float ); + +double gamma(double ); // Gamma function +float gammaf(float ); + +double lgamma(double ); // Log Gamma function +float lgammaf(float ); + +//****************** +// Bessel Functions +//****************** +double j0(double x); // First Bessel function of the first kind (Order 0) +double j1(double x); // Second Bessel function of the first kind (Order 1) +double jn(int n, double x); // Bessel Function Order n of the first kind +double y0(double x); // First Bessel function of the second Kind (Order 0) +double y1(double x); // Second Bessel function of the second Kind +double yn(int n, double x); // Bessel Function Order n of the second kind + +double besi0_(double x); // Zeroth order modified bessel function of first kind. + + + + +//************************* +// Error handling Functions +//************************* +double _domerr(char *name, double arg1, double arg2); +double _tloss(char *name, double arg1, double arg2); +double _ploss(char *name, double arg1, double arg2); +double _rangerr(char *name, double arg1, double arg2, double dflt); +int matherr(struct exception *x); +void matherr_(char *funcname, int errnum); + + + +/************************************************************************************ + ************************************************************************************ + ************************************************************************************ + N O N A N S I + ************************************************************************************ + ************************************************************************************ + ************************************************************************************ + ***********************************************************************************/ + + + + + + +//******************* +// Calculus Functions +//******************* +double *convolve(double *data, int ndata, double weights[], int nweights, + int ndec, int itype, int isym, int *length); +double *deriv(double *data, double delta, int ndata); +double *integrat(double *xin, double dx, int ndata); + + +//****************** +// Lowpass Filter Functions +// Smoothing Functions +//****************** +void lowpass(double weights[], int nweights, double fc, double dB, int half); // Digital Lowpass filter of uniform time intervals (a Kaiser-Bessel window) +double *smooth(double *data, int ndata, int factor); // a Kaiser lowpass filter (Reduces the high frequency noise) + +//****************** +// DSP/FFT Functions +//****************** +double stopbnd_(double ); // Used by bandpass() +void bandpass(double weights[], int nweights, double fh, double fl, + double dB, int half); +// Subroutine computes power spectral density of complex array v[] of length +// nv and returns it in the real array pw[] length npw. +//double *powspec(double *v, unsigned nv, unsigned npw, double *w); +// Computes power spectral density of real array + + + + +/********************************************************************/ +/* This library is concerned entirely with angles in general and */ +/* trigonometric functions in particular. */ +/********************************************************************/ + +#ifndef ANGLE_TYPE +#define ANGLE_TYPE +enum angle_type {RAD, DEG, GRAD}; +#endif + +/********************************************************************/ +/* The following three routines 'normalize' the supplied angle to */ +/* be within limits appropiate for the trigonemetric routines. */ +/* normalize_radians ensures that the supplied angle is between -PI */ +/* and +PI, normalize_degrees between -180.0 and +180.0 and */ +/* normalize_grade between -200.0 and +200.0. NOTE - ALL the */ +/* normal trigonometric functions normalize the angle before use, */ +/* and the inverse functions after. */ +/********************************************************************/ + +void normalize_radians(double *radians); +void normalize_radiansf(float *radians); +void normalize_radiansl(long double *radians); + +void normalize_degrees(double *degrees); +void normalize_degreesf(float *degrees); +void normalize_degreesl(long double *degrees); + +void normalize_grade(double *grade); +void normalize_gradef(float *grade); +void normalize_gradel(long double *grade); + +/********************************************************************/ +/* These six routines enable conversion, of angles, between */ +/* radians, degrees and grade. NOTE there is no need to normalize */ +/* the angle to be converted before calling any of these routines */ +/* as they all call the appropriate normalisation routine. */ +/********************************************************************/ + +double radians_to_degrees(double radians); +float radians_to_degreesf(float radians); +long double radians_to_degreesl(long double radians); + +double radians_to_grade(double radians); +float radians_to_gradef(float radians); +long double radians_to_gradel(long double radians); + +double degrees_to_radians(double degrees); +float degrees_to_radiansf(float degrees); +long double degrees_to_radiansl(long double degrees); + +double degrees_to_grade(double degrees); +float degrees_to_gradef(float degrees); +long double degrees_to_gradel(long double degrees); + +double grade_to_radians(double grade); +float grade_to_radiansf(float grade); +long double grade_to_radiansl(long double grade); + +double grade_to_degrees(double grade); +float grade_to_degreesf(float grade); +long double grade_to_degreesl(long double grade); + +/********************************************************************/ +/* The following six routines are the normal trigonometric */ +/* functions. */ +/********************************************************************/ + +double sine(double angle, enum angle_type atype); +float sinef(float angle, enum angle_type atype); +long double sinel(long double angle, enum angle_type atype); + +double cosine(double angle, enum angle_type atype); +float cosinef(float angle, enum angle_type atype); +long double cosinel(long double angle, enum angle_type atype); + +double tangent(double angle, enum angle_type atype); +float tangentf(float angle, enum angle_type atype); +long double tangentl(long double angle, enum angle_type atype); + +double secant(double angle, enum angle_type atype); +float secantf(float angle, enum angle_type atype); +long double secantl(long double angle, enum angle_type atype); + +double cosecant(double angle, enum angle_type atype); +float cosecantf(float angle, enum angle_type atype); +long double cosecantl(long double angle, enum angle_type atype); + +double cotangent(double angle, enum angle_type atype); +float cotangentf(float angle, enum angle_type atype); +long double cotangentl(long double angle, enum angle_type atype); + +/********************************************************************/ +/* The following six routines are the normal inverse trigonometric */ +/* functions. */ +/********************************************************************/ + +double arc_sine(double x, enum angle_type outtype); +float arc_sinef(float x, enum angle_type outtype); +long double arc_sinel(long double x, enum angle_type outtype); + +double arc_cosine(double x, enum angle_type outtype); +float arc_cosinef(float x, enum angle_type outtype); +long double arc_cosinel(long double x, enum angle_type outtype); + +double arc_tangent(double x, enum angle_type outtype); +float arc_tangentf(float x, enum angle_type outtype); +long double arc_tangentl(long double x, enum angle_type outtype); + +double arc_secant(double x, enum angle_type outtype); +float arc_secantf(float x, enum angle_type outtype); +long double arc_secantl(long double x, enum angle_type outtype); + +double arc_cosecant(double x, enum angle_type outtype); +float arc_cosecantf(float x, enum angle_type outtype); +long double arc_cosecantl(long double x, enum angle_type outtype); + +double arc_cotangent(double x, enum angle_type outtype); +float arc_cotangentf(float x, enum angle_type outtype); +long double arc_cotangentl(long double x, enum angle_type outtype); + +/********************************************************************/ +/* The following six routines are the hyperbolic trigonometric */ +/* functions. */ +/********************************************************************/ + +double hyperbolic_sine(double angle, enum angle_type atype); +float hyperbolic_sinef(float angle, enum angle_type atype); +long double hyperbolic_sinel(long double angle, enum angle_type atype); + +double hyperbolic_cosine(double angle, enum angle_type atype); +float hyperbolic_cosinef(float angle, enum angle_type atype); +long double hyperbolic_cosinel(long double angle, enum angle_type atype); + +double hyperbolic_tangent(double angle, enum angle_type atype); +float hyperbolic_tangentf(float angle, enum angle_type atype); +long double hyperbolic_tangentl(long double angle, enum angle_type atype); + +double hyperbolic_secant(double angle, enum angle_type atype); +float hyperbolic_secantf(float angle, enum angle_type atype); +long double hyperbolic_secantl(long double angle, enum angle_type atype); + +double hyperbolic_cosecant(double angle, enum angle_type atype); +float hyperbolic_cosecantf(float angle, enum angle_type atype); +long double hyperbolic_cosecantl(long double angle, enum angle_type atype); + +double hyperbolic_cotangent(double angle, enum angle_type atype); +float hyperbolic_cotangentf(float angle, enum angle_type atype); +long double hyperbolic_cotangentl(long double angle, enum angle_type atype); + +/********************************************************************/ +/* The following six routines are the hyperbolic inverse */ +/* trigonometric functions. */ +/********************************************************************/ + +double hyperbolic_arc_sine(double x, enum angle_type outtype); +float hyperbolic_arc_sinef(float x, enum angle_type outtype); +long double hyperbolic_arc_sinel(long double x, enum angle_type outtype); + +double hyperbolic_arc_cosine(double x, enum angle_type outtype); +float hyperbolic_arc_cosinef(float x, enum angle_type outtype); +long double hyperbolic_arc_cosinel(long double x, enum angle_type outtype); + +double hyperbolic_arc_tangent(double x, enum angle_type outtype); +float hyperbolic_arc_tangentf(float x, enum angle_type outtype); +long double hyperbolic_arc_tangentl(long double x, enum angle_type outtype); + +double hyperbolic_arc_secant(double x, enum angle_type outtype); +float hyperbolic_arc_secantf(float x, enum angle_type outtype); +long double hyperbolic_arc_secantl(long double x, enum angle_type outtype); + +double hyperbolic_arc_cosecant(double x, enum angle_type outtype); +float hyperbolic_arc_cosecantf(float x, enum angle_type outtype); +long double hyperbolic_arc_cosecantl(long double x, enum angle_type outtype); + +double hyperbolic_arc_cotangent(double x, enum angle_type outtype); +float hyperbolic_arc_cotangentf(float x, enum angle_type outtype); +long double hyperbolic_arc_cotangentl(long double x, enum angle_type outtype); + +/********************************************************************/ +/* The following four routines "complete" the standard library */ +/* functions. */ +/********************************************************************/ + +double sech(double x); +float sechf(float x); +long double sechl(long double x); + +double csch(double x); +float cschf(float x); +long double cschl(long double x); + +double coth(double x); +float cothf(float x); +long double cothl(long double x); + +double acoth(double x); +float acothf(float x); +long double acothl(long double x); + + + +/************************************************************************************ + ************************************************************************************ + (Special Embedded Functions) + NON ANSI +************************************************************************************* +*************************************************************************************/ + +char *ecvt(double x, int digits, int *decimal, int *sign); // Convert the Double Precision number to Character string +char *fcvt(double x, int digits, int *decimal, int *sign); // Convert the Double Precision number to Character string - almost same as ecvt - digits arg is diff +char *gcvt(double x, int digits, char *buffer); // Convert the Float Precision number to Character string + +BOOL dtoa(char *szLabel, double dNumber, int nChars, BOOL bUseSciNot ); + +long Gcd(long a, long b); // Greatest common divisor of a and b +//long long Gcd(long long a, long long b); + +double Fac(long number); // Factorial of a number +float Facf(int number); +//long double Facl(long long number); + +#endif /* End of _MATH_H */ +#pragma Pop (List) + +/************************************** + End of File MATH.H +***************************************/ diff --git a/include/obj816.h b/include/obj816.h new file mode 100644 index 0000000..e137323 --- /dev/null +++ b/include/obj816.h @@ -0,0 +1,172 @@ +#pragma Align_members(1) + +#define VERS " 3.01 " /* version number for programs */ +#define CDATE "1992-1997" /* copyright date for programs */ + +typedef struct Mod_head { + long h_magic; /* magic number for detection */ + short h_version; /* version number of object format */ + char h_filtyp; /* file type, object or library */ + char h_namlen; /* length of module name */ + long h_recsize; /* sizeof records section */ + short h_secsize; /* sizeof section section */ + long h_symsize; /* sizeof symbol section */ + short h_optsize; /* sizeof options section */ + unsigned char h_tot_secs; /* total number of sections in module */ + unsigned char h_num_secs; /* number of sections referenced */ + unsigned short h_num_syms; /* number of symbols */ +} Mod_head; + +typedef struct Lib_head { + long l_magic; /* magic number for detection */ + short l_version; /* version number of object format */ + char l_filtyp; /* file type, object or library */ + char l_unused1; + long l_modstart; /* offset of modules start */ + long l_numsyms; /* number of symbol entries */ + long l_symsize; /* sizeof symbol section */ + long l_numfiles; /* number of files */ +} Lib_head; + +#define MOD_CONVERT "lwbblslsbbw" +#define LIB_CONVERT "lwbbllll" + +#define MOD_REC_OFF(x) (sizeof(x)+x.h_namlen) +#define MOD_SEC_OFF(x) (MOD_REC_OFF(x)+x.h_recsize) +#define MOD_SYM_OFF(x) (MOD_SEC_OFF(x)+x.h_secsize) +#define MOD_OPT_OFF(x) (MOD_SYM_OFF(x)+x.h_symsize) +#define MOD_NEXT_OFF(x) (MOD_OPT_OFF(x)+x.h_optsize) + +#define MOD_MAGIC 0x5a44525a /* 'ZRDZ' */ +#define MOD_VERSION 1 +#define MOD_OBJECT 1 +#define MOD_LIBRARY 2 +#define MOD_OBJ68K 3 + +#define REC_END 0 +/* 1-xx are numbers of constant data bytes */ +#define REC_SECT 0xf0 /* next word is section number */ +#define REC_EXPR 0xf1 /* expression follows */ +#define REC_SPACE 0xf2 /* word count of bytes to reserve */ +#define REC_ORG 0xf3 /* long word new pc */ +#define REC_RELEXP 0xf4 /* pc-relative expression */ +#define REC_DEBUG 0xf5 /* debug info record */ +#define REC_LINE 0xf6 /* bump line counter */ + +enum { + OP_END=0, /* end of expression */ + OP_SYM, /* ref to extern symbol */ + OP_VAL, /* constant value */ + OP_LOC, /* ref to offset from start of section */ + + OP_UNA=10, + OP_NOT=10, + OP_NEG, + OP_FLP, + + OP_BIN=20, + OP_EXP=20, OP_MUL, OP_DIV, OP_MOD, OP_SHR, + OP_SHL, OP_ADD, OP_SUB, OP_AND, OP_OR, + OP_XOR, OP_EQ, OP_GT, OP_LT, OP_UGT, + OP_ULT, + OP_LAST +}; + +enum { S_UND, S_ABS, S_REL, S_EXP, S_REG, S_FREG }; /* symbol type */ +enum { ST_NOSIZE, ST_8BIT, ST_16BIT, ST_32BIT, + ST_FLOAT, ST_DOUBLE, ST_8051, ST_Z8, ST_DS, ST_EQU }; + +enum { + D_C_FILE=100, + D_C_LINE, + D_C_SYM, + D_C_STAG, + D_C_ETAG, + D_C_UTAG, + D_C_MEMBER, + D_C_EOS, + D_C_FUNC, + D_C_ENDFUNC, + D_C_BLOCK, + D_C_ENDBLOCK, + D_LONGA_ON, + D_LONGA_OFF, + D_LONGI_ON, + D_LONGI_OFF +}; + +/* used for generating source level debugging information */ + +enum { DT_NON, DT_PTR, DT_FCN, DT_ARY, DT_FPTR, DT_FFCN }; +enum { T_NULL, T_VOID, T_SCHAR, T_CHAR, T_SHORT, T_INT16, T_INT32, T_LONG, + T_FLOAT, T_DOUBLE, T_STRUCT, T_UNION, T_ENUM, T_LDOUBLE, + T_UCHAR, T_USHORT, T_UINT16, T_UINT32, T_ULONG }; +enum { C_NULL, C_AUTO, C_EXT, C_STAT, C_REG, C_EXTDEF, C_ARG, + C_STRTAG, C_MOS, C_EOS, C_UNTAG, C_MOU, C_ENTAG, C_MOE, + C_TPDEF, C_USTATIC, C_REGPARM, C_FIELD, C_UEXT, C_STATLAB, + C_EXTLAB, C_BLOCK, C_EBLOCK, C_FUNC, C_EFUNC, C_FILE, C_LINE, + C_FRAME }; + + +#define SF_GBL 0x01 /* label is global */ +#define SF_DEF 0x02 /* label is defined in this module */ +#define SF_REF 0x04 /* label is referenced in this module */ +#define SF_VAR 0x08 /* label is variable */ +#define SF_PG0 0x10 /* label is Page0 type */ +#define SF_TMP 0x20 /* label is temporary (LLCHAR) */ +#define SF_DEF2 0x40 /* label has been defined in pass 2 ( ZAS only ) */ +#define SF_LIB 0x40 /* label in library (used by ZLN) */ + +#define SEC_OFFSET 0x0001 +#define SEC_INDIRECT 0x0002 +#define SEC_STACKED 0x0004 +#define SEC_REF_ONLY 0x0008 +#define SEC_CONST 0x0010 +#define SEC_DIRECT 0x0020 +#define SEC_NONAME 0x0040 + + /* pre-defined sections */ +enum {SECT_PAGE0, SECT_CODE, SECT_KDATA, SECT_DATA, SECT_UDATA }; + +/* + Module format: + Module header + s: Module name (null terminated) + Records + Each record is in stack order terminated by REC_END + Section info + Section info format: --- for each section that has references + b: section number + b: section flags + l: size + l: org + s: name of section (only if SEC_NONAME not in flags) + Symbol info + Symbol info format: --- for each symbol + b: type + b: flags + b: section number + l: offset (only if type != S_UND) + s: name of symbol (null terminated) + + Library format: + Library header + File info - for each file + w: file number + b: file name len + c: file name (no null) + Symbol data - for each symbol + w: offset of name + w: file number + l: module offset - Hdr.l_modstart + Symbol names - for each symbol + b: length of name + c: symbol name (no null) + Modules - each module +*/ + + +/**************************************************/ +/* End of File OBJ816.H */ +/**************************************************/ + diff --git a/include/search.h b/include/search.h new file mode 100644 index 0000000..471c367 --- /dev/null +++ b/include/search.h @@ -0,0 +1,60 @@ +/******************************************************************************* +* FILE NAME: SEARCH.h +* +* TITLE: This function prototypes and data type definitions for the Search Tree Functions. +* +* DATA_RIGHTS: Western Design Center and R & C Services Proprietary +* Copyright(C) 1980-2004 +* All rights reserved. Reproduction in any manner, +* in whole or in part, is strictly prohibited without +* the prior written approval of R & C Services or +* Western Design Center. +* +* DESCRIPTION: This file describes function prototypes and data type +* definitions used for Search Tree functions. +* +* +* SPECIAL CONSIDERATIONS: +* +* +* AUTHOR: R. Greenthal +* +* +* CREATION DATE: March 31,2004 +* +* REVISION HISTORY +* Name Date Description +* ------------ ---------- ---------------------------------------------- +* R. Greenthal 03/31/2004 Initial +* 0x/xx/2004 Added +* +******************************************************************************* +*/ + + +#ifndef __SEARCH_H +#define __SEARCH_H + + + +#ifndef size_t +typedef unsigned size_t; +#endif + + +void *bsearch(const void *_key, const void *_base, size_t _nmemb, size_t _size, + int (*_compar)(const void *, const void *)); +char *lfind(void *key, void *base, unsigned *number, unsigned size, + int (*compare)(void *, void *)); +char *lsearch(void *key, void *base, unsigned *number, unsigned size, + int (*compare)(void *, void *)); +void qsort(void *_base, size_t _nmemb, size_t _size, + int (*_compar)(const void *, const void *)); + + +#endif // End of __SEARCH_H + +/**************************************************/ +/* End of File SEARCH.H */ +/**************************************************/ + diff --git a/include/setjmp.h b/include/setjmp.h new file mode 100644 index 0000000..678e0f2 --- /dev/null +++ b/include/setjmp.h @@ -0,0 +1,90 @@ +/* Copyright (C) 1993 by Zardoz Software, Inc. */ +/******************************************************************************* +* FILE NAME: SETJMP.h +* +* TITLE: This function prototypes and data type definitions for the Setjmp Functions. +* +* DATA_RIGHTS: Western Design Center and R & C Services Proprietary +* Copyright(C) 1980-2004 +* All rights reserved. Reproduction in any manner, +* in whole or in part, is strictly prohibited without +* the prior written approval of R & C Services or +* Western Design Center. +* +* DESCRIPTION: This file describes function prototypes and data type +* definitions used for Setjmp functions. +* +* The header relates to the C phenomenon known as setjmp/longjmp. +* It is used to escape out of the current situation into a previous one. +* A typical example is in an editor, where hitting DEL breaks off the current +* command and puts the editor back in the main loop, though care has to be +* taken when the DEL occurs while executing a library function, since +* some of them are not reentrant. +* +* +* +* SPECIAL CONSIDERATIONS: +* __SetJmp_Struct_802: ; Structure for SetJmp +* __SetJmp_PC rmb 2 ; actual Long Jump "to" address in code (16 bit Address) +* __SetJmp_SP rmb 1 ; Don't need to save the Status Reg, X 0r Acc? +* __SetJmp_Y rmb 1 ;Y Reg +* +* __SetJmp_Struct_816: Structure for SetJmp +* __SetJmp_PC rmb 3 Program Counter, actual Long Jump "to" address in code (24 bit Address) +* __SetJmp_SP rmb 2 Stack Pointer Don't need to save the Status Reg, X 0r Acc? +* __SetJmp_Y rmb 2 Y Reg +* __SetJmp_DP rmb 2 Direct Page Reg +* __SetJmp_DB rmb 1 Data Bank Reg +* Program Bank Reg (NOT NEEDED!!!) +* +* +* AUTHOR: R. Greenthal +* +* +* CREATION DATE: March 31,2004 +* +* REVISION HISTORY +* Name Date Description +* ------------ ---------- ---------------------------------------------- +* R. Greenthal 03/31/2004 Initial +* 05/01/2004 Added SetJmp_Struct Def +* +******************************************************************************* +*/ + + +#ifndef __SETJMP_H +#define __SETJMP_H + + +#if USING_134 +#define __JBUFSIZE (4*sizeof(char)) // 4 Bytes, Don't need to save Acc, X, & Status Reg +#elif USING_02 +#define __JBUFSIZE (4*sizeof(char)) +#elif USING_265 +#define __JBUFSIZE (3*sizeof(char)+3*2*sizeof(char)+sizeof(char)) // 10 Bytes, Don't need to save Acc, X, & Status Reg +#elif USING_816 +#define __JBUFSIZE (3*sizeof(char)+3*2*sizeof(char)+sizeof(char)) +#else +#asm + EXIT "Not Valid Processor: Use -DUSING_816, -DUSING_02, etc. ! ! ! ! ! ! ! ! ! ! ! !" +#endasm +#endif + +#ifndef __JBUFSIZE + EXIT "Not Valid Processor: Use -DUSING_816, -DUSING_02, etc. ! ! ! ! ! ! ! ! ! ! ! !" +#endif + + +typedef char jmp_buf[__JBUFSIZE]; + +int setjmp(jmp_buf _env); +void longjmp(jmp_buf _env, int _val); + +#endif // End of __SETJMP_H + +/**************************************************/ +/* End of File SETJMP.H */ +/**************************************************/ + + diff --git a/include/signal.h b/include/signal.h new file mode 100644 index 0000000..a3fcded --- /dev/null +++ b/include/signal.h @@ -0,0 +1,73 @@ +/* Copyright (C) 1992 by Zardoz Software, Inc. */ +/******************************************************************************* +* FILE NAME: SIGNAL.h +* +* TITLE: This function prototypes and data type definitions for the Signal Functions. +* +* DATA_RIGHTS: Western Design Center and R & C Services Proprietary +* Copyright(C) 1980-2004 +* All rights reserved. Reproduction in any manner, +* in whole or in part, is strictly prohibited without +* the prior written approval of R & C Services or +* Western Design Center. +* +* DESCRIPTION: This file describes function prototypes and data type +* definitions used for Signal functions. +* +* +* SPECIAL CONSIDERATIONS: +* +* +* AUTHOR: R. Greenthal +* +* +* CREATION DATE: March 31,2004 +* +* REVISION HISTORY +* Name Date Description +* ------------ ---------- ---------------------------------------------- +* R. Greenthal 03/31/2004 Initial +* 0x/xx/2004 Added +* +******************************************************************************* +*/ + + +#ifndef __SIGNAL_H +#define __SIGNAL_H + +/* atomic-access data type: */ +//typedef int sig_atomic_t; /* this type works nearly everywhere */ + +typedef char sig_atomic_t; + + +#define SIGINT 1 /* Interrupt (IRQ)? - interactive attention signal */ +#define SIGTERM 2 /* Term - termination request */ +#define SIGABRT 3 /* Abort - abnormal termination */ +#define SIGFPE 4 /* Floating Point Signal(IRQ/COP) - erroneous arithmetic operation */ +#define SIGILL 5 /* Illegal - invalid function image */ +#define SIGSEGV 6 /* Segment violation - invalid access to storage */ +#define SIGEND 7 /* End of SIG #'s */ + +#define _NUMSIG 6 +#define _FSTSIG 1 + +#define SIG_DFL ((void (*)(int))0) /* default */ +#define SIG_IGN ((void (*)(int))1) /* ignore */ +#define SIG_ERR ((void (*)(int))-1) /* error return from signal() */ + + +void (*signal(int _sig, void (*_func)(int)))(int); +int raise(int _sig); + + +#define LOCK asm{sei;} +#define UNLOCK asm{cli;} + +#endif /* End of __SIGNAL_H */ + +/**************************************************/ +/* End of File SIGNAL.H */ +/**************************************************/ + diff --git a/include/stdarg.h b/include/stdarg.h new file mode 100644 index 0000000..2a7e33f --- /dev/null +++ b/include/stdarg.h @@ -0,0 +1,51 @@ +/******************************************************************************* +* FILE NAME: STDARG.h +* +* TITLE: This function prototypes and data type definitions for the +* Standard Arguments Functions. +* +* DATA_RIGHTS: Western Design Center and R & C Services Proprietary +* Copyright(C) 1980-2004 +* All rights reserved. Reproduction in any manner, +* in whole or in part, is strictly prohibited without +* the prior written approval of R & C Services or +* Western Design Center. +* +* DESCRIPTION: This file describes function prototypes and data type +* definitions used for Standard Arguments functions. +* +* +* SPECIAL CONSIDERATIONS: +* +* +* AUTHOR: R. Greenthal +* +* +* CREATION DATE: March 31,2004 +* +* REVISION HISTORY +* Name Date Description +* ------------ ---------- ---------------------------------------------- +* R. Greenthal 03/31/2004 Initial +* 0x/xx/2004 Added +* +******************************************************************************* +*/ + + +#ifndef __STDARG_H +#define __STDARG_H + +#define _VA_LIST +typedef char *va_list; + +#define va_start(ap, parmN) ((ap) = (char *)(&parmN + 1)) +#define va_arg(ap, type) ((ap) += sizeof(type), ((type *)(ap))[-1]) +#define va_end(ap) + +#endif // End of __STDARG_H + +/**************************************************/ +/* End of File STDARG.H */ +/**************************************************/ + diff --git a/include/stdbool.h b/include/stdbool.h new file mode 100644 index 0000000..ea3f5ff --- /dev/null +++ b/include/stdbool.h @@ -0,0 +1,70 @@ +/* Copyright (C) 1993 by Zardoz Software, Inc. */ +#pragma Off (List) +/******************************************************************************* +* FILE NAME: STDBOOL.h +* +* TITLE: This function prototypes and data type definitions for the Wide Characters Functions. +* +* DATA_RIGHTS: Western Design Center and R & C Services Proprietary +* Copyright(C) 1980-2004 +* All rights reserved. Reproduction in any manner, +* in whole or in part, is strictly prohibited without +* the prior written approval of R & C Services or +* Western Design Center. +* +* DESCRIPTION: This file describes function prototypes and data type +* definitions used for Wide Character functions. +* +* +* SPECIAL CONSIDERATIONS: +* +* +* AUTHOR: R. Greenthal +* +* +* CREATION DATE: March 17,2004 +* +* REVISION HISTORY +* Name Date Description +* ------------ ---------- ---------------------------------------------- +* R. Greenthal 03/15/2004 Initial +* 0x/xx/2004 Added +* +******************************************************************************* +*/ + +#ifndef _STDBOOL_H +#define _STDBOOL_H + + +/* + *=========================== CONSTANTS & MACROS =============================== + */ + +typedef int _Bool; /* not built into pre-C99 compilers */ + +#define bool _Bool +#define true 1 +#define false 0 +#define __bool_true_false_are_defined 1 + + + +/* + *============================= FUNCTION CALL PROTOTYPES ============================ + */ + + + + + + + + + +#endif /* End of _STDBOOL_H */ +#pragma Pop (List) + +/************************************** + End of File STDBOOL.H +***************************************/ diff --git a/include/stddef.h b/include/stddef.h new file mode 100644 index 0000000..20ffe3f --- /dev/null +++ b/include/stddef.h @@ -0,0 +1,88 @@ +/******************************************************************************* +* FILE NAME: STDDEF.h +* +* TITLE: This function prototypes and data type definitions for the Std Defs. +* +* DATA_RIGHTS: Western Design Center and R & C Services Proprietary +* Copyright(C) 1980-2004 +* All rights reserved. Reproduction in any manner, +* in whole or in part, is strictly prohibited without +* the prior written approval of R & C Services or +* Western Design Center. +* +* DESCRIPTION: This file describes function prototypes and data type +* definitions used for Standard Defs. +* +* +* SPECIAL CONSIDERATIONS: +* +* +* AUTHOR: R. Greenthal +* +* +* CREATION DATE: March 17,2004 +* +* REVISION HISTORY +* Name Date Description +* ------------ ---------- ---------------------------------------------- +* R. Greenthal 03/15/2004 Initial +* 0x/xx/2004 Added +* +******************************************************************************* +*/ + +#ifndef __STDDEF_H +#define __STDDEF_H + +#ifndef _SIZE_T +#define _SIZE_T +typedef unsigned int size_t; +#endif + +#ifndef _PTRDIFF_T +#define _PTRDIFF_T +#ifdef _LARGE_DATA + typedef long ptrdiff_t; +#else + typedef short ptrdiff_t; +#endif +#endif + +#ifndef _WCHAR_T +#define _WCHAR_T + typedef unsigned char wchar_t; +#endif + +#ifndef _WINT_T +#define _WINT_T + typedef unsigned int wint_t; /* Wide character */ +#endif + +#ifndef _WCTYPE_T +#define _WCTYPE_T + typedef unsigned int wctype_t; /* Wide */ +#endif + +#ifndef _WEOF +#define _WEOF +#define WEOF (wint_t)(-1) +#endif /* _WEOF */ + + +#ifndef NULL +#define NULL ((void *)0) +#endif + + +#ifndef ERRNO +extern int errno; +#endif + +#define offsetof(type,memb) ((size_t)((unsigned long)&((type *)0)->memb)) + +#endif // End of __STDDEF_H + +/**************************************************/ +/* End of File STDDEF.H */ +/**************************************************/ + diff --git a/include/stdint.h b/include/stdint.h new file mode 100644 index 0000000..671db00 --- /dev/null +++ b/include/stdint.h @@ -0,0 +1,92 @@ +/******************************************************************************* +* FILE NAME: STDINT.h +* +* TITLE: This function prototypes and data type definitions for the Standard Int Types. +* +* DATA_RIGHTS: Western Design Center and R & C Services Proprietary +* Copyright(C) 1980-2004 +* All rights reserved. Reproduction in any manner, +* in whole or in part, is strictly prohibited without +* the prior written approval of R & C Services or +* Western Design Center. +* +* DESCRIPTION: This file describes function prototypes and data type +* definitions used for Standard Int Types. +* +* +* SPECIAL CONSIDERATIONS: +* +* +* AUTHOR: R. Greenthal +* +* +* CREATION DATE: March 17,2004 +* +* REVISION HISTORY +* Name Date Description +* ------------ ---------- ---------------------------------------------- +* R. Greenthal 03/15/2004 Initial +* 0x/xx/2004 Added +* +******************************************************************************* +*/ + +#ifndef _STDINT_H +#define _STDINT_H + + +/* + *=========================== CONSTANTS & MACROS =============================== + */ + + +#ifndef uint32_t + +#if SIZEOF_INT == 4 +#define uint32_t unsigned int +#define int32_t int +#elif SIZEOF_SHORT == 4 +#define uint32_t unsigned short +#define int32_t short +#elif SIZEOF_LONG == 4 +#define uint32_t unsigned long +#define int32_t long +#endif + +#endif/* !uint32_t */ + +#ifndef uint16_t + +#if SIZEOF_INT == 2 +#define uint16_t unsigned int +#define int16_t int +#elif SIZEOF_SHORT == 2 +#define uint16_t unsigned short +#define int16_t short +#elif SIZEOF_LONG == 2 +#define uint16_t unsigned long +#define int16_t long +#endif + +#endif/* !uint16_t */ + + + +/* + *============================= FUNCTION CALL PROTOTYPES ============================ + */ + + + + + + + + + +#endif /* End of _STDINT_H */ +#pragma Pop (List) + +/************************************** + End of File STDINT.H +***************************************/ diff --git a/include/stdio.h b/include/stdio.h new file mode 100644 index 0000000..b7a9d7b --- /dev/null +++ b/include/stdio.h @@ -0,0 +1,219 @@ +/* Copyright (C) 1992 by Zardoz Software, Inc. */ +/******************************************************************************* +* FILE NAME: STDIO.h +* +* TITLE: This function prototypes and data type definitions for the +* Standard I/O Functions. +* +* DATA_RIGHTS: Western Design Center and R & C Services Proprietary +* Copyright(C) 1980-2004 +* All rights reserved. Reproduction in any manner, +* in whole or in part, is strictly prohibited without +* the prior written approval of R & C Services or +* Western Design Center. +* +* DESCRIPTION: This file describes function prototypes and data type +* definitions used for Standard I/O functions. +* +* +* SPECIAL CONSIDERATIONS: +* +* +* AUTHOR: R. Greenthal +* +* +* CREATION DATE: March 31,2004 +* +* REVISION HISTORY +* Name Date Description +* ------------ ---------- ---------------------------------------------- +* R. Greenthal 03/31/2004 Initial +* 0x/xx/2004 Added +* +******************************************************************************* +*/ + + +#ifndef __STDIO_H +#define __STDIO_H + +#include + + +# ifndef _SIZE_T +# define _SIZE_T + typedef unsigned int size_t; +# endif + +#ifndef NULL +#define NULL ((void *)0) +#endif + +#ifndef FARNULL + #define FARNULL ((void far *)0) +#endif + + +#define BUFSIZ 1024 + +#define EOF (-1) + +#define L_tmpnam 40 +#define FOPEN_MAX 20 /* must agree with FCntl.h */ +#define FILENAME_MAX 126 +#define TMP_MAX 25 +//#define TMP_MAX 32767 + + +#define SEEK_SET 0 /* from beginning of file */ +#define SEEK_CUR 1 /* from current position */ +#define SEEK_END 2 /* from end of file */ + +#define stdin (&_iob[0]) +#define stdout (&_iob[1]) +#define stderr (&_iob[2]) +#define stdaux (&_iob[3]) +#define stdprn (&_iob[4]) + +typedef long int fpos_t; + +typedef struct __stdio { + unsigned char *_bp; /* current position in buffer */ + unsigned char *_bend; /* last character in buffer + 1 */ + unsigned char *_buff; /* address of buffer */ + unsigned short _flags; /* open mode, etc. */ + char _unit; /* fd returned by open */ + unsigned char _bytbuf; /* single byte buffer for unbuffered streams */ + size_t _buflen; /* length of buffer */ + unsigned short _tmpnum; /* name of file for temporaries */ +} FILE; +extern FILE _iob[]; + + + +#define _IOMYBUF 0x0001 /* malloced buffer */ +#define _IOEOF 0x0002 /* end-of-file encountered */ +#define _IOERR 0x0004 /* error occurred */ +#define _IOSTRNG 0x0008 /* special string stream */ +#define _IOBIN 0x0010 /* file is binary ("b") */ +#define _IOLBF 0x0020 /* line buffered */ +#define _IOFBF 0x0040 /* fully buffered */ +#define _IONBF 0x0080 /* completely unbuffered */ +#define _IOCON 0x0100 /* console device */ +#define _IOR 0x0200 /* stream opened in read mode */ +#define _IOW 0x0400 /* stream opened in write mode */ +#define _IORW 0x0800 /* stream opened in update mode */ +#define _IOUNG 0x1000 /* ungetc was called */ +#define _IOSYNC 0x2000 /* MPW compatibility */ +#define _IODIRTY 0x4000 /* buffer has been written */ + +int _format(FILE *_stream, const char *format, va_list varg); // Special Internal Functions for pharsing +int _scan(FILE *_stream, const char *format, va_list varg); // Special Internal Functions for pharsing + +void clearerr(FILE *_stream); // +int fclose(FILE *_stream); // +int feof(FILE *_stream); // +int ferror(FILE *_stream); // +int fflush(FILE *_stream); // +int fgetc(FILE *_stream); +int fgetpos(FILE *_stream, fpos_t *_pos); // +char *fgets(char *_s, int _n, FILE *_stream); // +FILE *fopen(const char *_filename, const char *_mode); +int fprintf(FILE *_stream, const char *format, ...); +int fputc(int _c, FILE *_stream); +int fputs(const char *_s, FILE *_stream); +size_t fread(void *_ptr, size_t _size, size_t _nmemb, FILE *_stream); +FILE *freopen(const char *_filename, const char *_mode, FILE *_stream); +int fscanf(FILE *_stream, const char *format, ...); +int fseek(FILE *_stream, long int _offset, int _whence); +int fsetpos(FILE *_stream, const fpos_t *_pos); +long ftell(FILE *_stream); +size_t fwrite(const void *_ptr, size_t _size, size_t _nmemb, FILE *_stream); +int getc(FILE *_stream); +int getchar( void); +char *gets(char *_s); +void perror(const char *_s); +int printf(const char *_format, ...); +int putc(int _c, FILE *_stream); +int putchar( int c); +int puts(const char *_s); +int remove(const char *_filename); +int rename(const char *_old, const char *_new); +void rewind(FILE *_stream); +int scanf(const char *_format, ...); +void setbuf(FILE *_stream, char *_buf); +int setvbuf(FILE *_stream, char *_buf, int _mode, size_t _size); +//int snprintf (char *str, size_t count, const char *format, ...); +int sprintf(char *str, const char *format, ...); +int sscanf(const char *str, const char *format, ...); +FILE *tmpfile(void); +char *tmpnam(char *_s); +int ungetc(int _c, FILE *_stream); +int vfprintf(FILE *_stream, const char *format, char *_arg); +//int vfscanf(FILE *stream, const char *format, va_list ap); +int vprintf(const char *_format, char *_arg); +//int vscanf(const char *format, va_list ap); +//int vsnprintf(char *str, size_t size, const char *format, va_list ap); +int vsprintf(char *str, const char *format, char *arg); +//int vsscanf(const char *str, const char *format, va_list args); //Similar to sscanf with the variable argument list specified directly as for vprintf. + + +//#ifndef STRING +//typedef struct { +// int length; +// char string[80]; +//} STRING; +//#endif + + + + + +int _filbuf(FILE *); +int _flsbuf(FILE *, int); + +#ifdef __C_MACROS__ +#define getc(fp) ((fp)->_bp < (fp)->_bend ? *(fp)->_bp++ :_filbuf((fp))) +#define putc(c,fp) ((fp)->_bp < (fp)->_bend ? *(fp)->_bp++ = (c) : \ + _flsbuf((fp),(int)(unsigned char)(c))) +#define getchar() getc(stdin) +#define putchar(c) putc((c), stdout) +#define clearerr(fp) ((void)((fp)->_flags &= ~(_IOERR|_IOEOF))) +#define feof(fp) ((fp)->_flags&_IOEOF) +#define ferror(fp) ((fp)->_flags&_IOERR) +#endif + + +/*****************************/ +/* NON ANSI C functions */ +/* System V Berkley */ +/* UNIX/Linux */ +/*****************************/ + + +/*********************************/ +/* NON ANSI C user-visible stuff */ +/*********************************/ +//int fcloseall(void); +FILE *fdopen(int, const char *); +#define fileno(fp) ((int)(fp)->_unit) +//int flushall(void); +//int fputchar(int c); +//int getw(FILE *_stream); +//int putw(int _w, FILE *_stream); +//int rmtmp(void); +//char *tempnam(char *dir, char *prename); +//int unlink(char *filename); +//ungetch(int c); // Reverse action of getch (unbuffered input from keyboard) + + +#define puterr(c) (putc((c),stderr)) + + + +#endif /* _STDIO_H */ + +/**************************************************/ +/* End of File STDIO.H */ +/**************************************************/ + diff --git a/include/stdlib.h b/include/stdlib.h new file mode 100644 index 0000000..3ce3557 --- /dev/null +++ b/include/stdlib.h @@ -0,0 +1,205 @@ +/* Copyright (C) 1992 by Zardoz Software, Inc. */ +/******************************************************************************* +* FILE NAME: STDLIB.h +* +* TITLE: This function prototypes and data type definitions for the +* Standard Library Functions. +* +* DATA_RIGHTS: Western Design Center and R & C Services Proprietary +* Copyright(C) 1980-2004 +* All rights reserved. Reproduction in any manner, +* in whole or in part, is strictly prohibited without +* the prior written approval of R & C Services or +* Western Design Center. +* +* DESCRIPTION: This file describes function prototypes and data type +* definitions used for Standard Library functions. +* +* +* SPECIAL CONSIDERATIONS: +* +* +* AUTHOR: R. Greenthal +* +* +* CREATION DATE: March 31,2004 +* +* REVISION HISTORY +* Name Date Description +* ------------ ---------- ---------------------------------------------- +* R. Greenthal 03/31/2004 Initial +* 07/13/2004 Removed ltostr, will add later & lltostr +* 0x/xx/2004 +* +******************************************************************************* +*/ + + +#ifndef __STDLIB_H +#define __STDLIB_H + + +#ifndef _WCHAR_T +#include // Define size_t, wchar_t, NULL +#endif + + +# ifndef ERANGE +#define ERANGE 13 +# endif + + +#define EXIT_FAILURE (-1) +#define EXIT_SUCCESS 0 + +#ifdef __FLOATS__ +#define HUGE_VAL 1.797693134862316E+308 +#endif + +#define RAND_MAX 32767 + +#define MB_CUR_MAX 1 +#define MB_LEN_MAX 1 + + /* quotient and remainder for div() */ +typedef struct { + int quot; + int rem; +} div_t; + + + /* quotient and remainder for ldiv() */ +typedef struct { + long quot; + long rem; +} ldiv_t; + + /* quotient and remainder for lldiv() */ +/* +typedef struct { + long long quot; + long long rem; +} lldiv_t; +*/ + + + +struct int_sqrt { + unsigned sqrt; + unsigned frac; +}; + + +void abort(void); +int abs(int _j); +int atexit(void (*_func)(void)); +double atof(const char *); // Ascii to Float +int atoi(const char *_nptr); // Ascii to Integer +long atol(const char *_nptr); // Converts string pointed to by nptr to long int representation +/* +long long int atoll(const char *_nptr); // Converts string pointed to by nptr to long int representation +*/ +void *bsearch(const void *_key, const void *_base, size_t _nmemb, size_t _size, + int (*_compar)(const void *, const void *)); +void *calloc(size_t _nmemb, size_t _size); +div_t div(int _numer, int _denom); +void exit(int _status); +void free(void *_ptr); +char *getenv(const char *_name); +long labs(long int _j); +//long long int llabs( long long int j); +ldiv_t ldiv(long int _numer, long int _denom); +//lldiv_t lldiv(long long int _numer, long long int _denom); +void *malloc(size_t _size); +int mblen(const char *_s, size_t _n); +size_t mbstowcs(wchar_t *_pwcs, const char *_s, size_t _n); +int mbtowc(wchar_t *_pwc, const char *_s, size_t _n); +void qsort(void *_base, size_t _nmemb, size_t _size, + int (*_compar)(const void *, const void *)); +int rand(void); +void *realloc(void *_ptr, size_t _size); +void srand(unsigned int _seed); + +#define strtodf strtof // strtof is the same as strtodf + +double strtod(const char *_nptr, char **_endptr); // converts the string pointed to a double +double strtodf(const char *_nptr, char **_endptr); // same as strtodf, but for float + +long double strtold(const char *_nptr, char **_endptr); // same as strtod, but for long double +long strtol(const char *_nptr, char **_endptr, int _base); +unsigned long strtoul(const char *_nptr, char **_endptr, int _base); +/* +unsigned long long strtoull(const char *_nptr, char **_endptr, int _base); +*/ +int system(const char *_string); +int wctomb(char *_s, wchar_t _wchar); +size_t wcstombs(char *_s, const wchar_t *_pwcs, size_t _n); + + + +/*****************************/ +/* NON ANSI C functions */ +/* System V Berkley */ +/* UNIX/Linux */ +/*****************************/ + +int putenv (char *string); +int setenv (char *name, char *value, int replace); + + + + +/*****************************/ +/* NON ANSI C functions */ +/*****************************/ +//int _atoi(ptr); /* decode an integer */ +int atoib(char *s, int b); /* Convert s to "unsigned" integer in base b. */ +int dtoi(char *decstr, int *); /* convert signed decimal string to integer number */ +void ftoa(double _val, char *_buf, int, int); +//int isatty(int ); /* Return "true" if fd is a device, else "false" */ +int iscons(int ); /* kludge. need a way to tell what iocb is open on */ +void itoa(int value, char string[], int radix); /* Converts integer to ASCII string */ +int itoab(int , char *, int ); /* Convert "unsigned" n to characters in s using base b */ +char *itoo(int , char str[], int ); /* converts number to octal string of length sz */ +char *ltoa(long val, char *buf, int base); /* convert a long int to the specified numeric base, from 2 to 36. */ +//char *ltostr(long num, char *string, size_t max_chars, unsigned base); /* Convert a long int to a String */ + +int otoi(char *, int *); /* convert unsigned octal string to integer number */ +int _parseline(char *line, int *); /* line-parsing routine */ +int round_div(int n, int d); /* Rounded integer division */ +long round_ldiv(long n, long d); /* Rounded long integer division */ + +//char *ultoa(unsigned long value, char *digits, int base); /* Convert Unsigned Long (32 bits) to ASCII string */ +//void usqrt(unsigned long x, struct int_sqrts *q); /* squar root of a "long" integer */ +int utoi(char *, int *); /* convert unsigned decimal string to integer number */ +int xtoi(char *, int *); /* convert hex string to integer number */ + + + +/*********************************************/ +/* Should be in MALLOC.H or ALLOC.H */ +/*********************************************/ +/************************/ +/* NON ANSI C functions */ +/************************/ +#ifndef _ANSI +void far *farcalloc(unsigned long _nmemb, unsigned long _size); +void farfree(void far *_ptr); +void far *farmalloc(unsigned long _size); +void far *farrealloc(void far *_ptr, unsigned long _size); +#endif + + + + +#ifdef __FLOATS__ +long double strtold(const char *_nptr, char **_endptr); +#endif + + +#endif /* __STDLIB_H */ + +/**************************************************/ +/* End of File STDLIB.H */ +/**************************************************/ + diff --git a/include/string.h b/include/string.h new file mode 100644 index 0000000..3b37f8d --- /dev/null +++ b/include/string.h @@ -0,0 +1,134 @@ +/* Copyright (C) 1992 by Zardoz Software, Inc. */ +/******************************************************************************* +* FILE NAME: STRING.h +* +* TITLE: This function prototypes and data type definitions for the String Functions. +* +* DATA_RIGHTS: Western Design Center and R & C Services Proprietary +* Copyright(C) 1980-2004 +* All rights reserved. Reproduction in any manner, +* in whole or in part, is strictly prohibited without +* the prior written approval of R & C Services or +* Western Design Center. +* +* DESCRIPTION: This file describes function prototypes and data type +* definitions used for String functions. +* +* +* SPECIAL CONSIDERATIONS: +* +* +* AUTHOR: R. Greenthal +* +* +* CREATION DATE: March 31,2004 +* +* REVISION HISTORY +* Name Date Description +* ------------ ---------- ---------------------------------------------- +* R. Greenthal 03/31/2004 Initial +* 07/13/2004 Removed ltostr, will add later & lltostr +* 0x/xx/2004 +* +******************************************************************************* +*/ + + +#ifndef __STRING_H +#define __STRING_H + +#ifndef _SIZE_T +#define _SIZE_T +typedef unsigned int size_t; +#endif + +#ifndef NULL +#define NULL ((void *)0) +#endif + +#ifndef Boolean_T +typedef enum {Error_ = -1, Success_, False_ = 0, True_} Boolean_T; +#endif + + +void *memchr(const void *_s, int _c, size_t _n); // Returns a pointer to the first occurrence of c (converted to an unsigned char) in the first n bytes +int memcmp(const void *_s1, const void *_s2, size_t _n); // Compares n bytes of two regions of memory, treating each byte as an unsigned character +void *memcpy(void *_dst, const void *_src, size_t _num); // Copies num bytes from src buffer to memory location pointed by dst +void *memmove(void *_dst,const void *_src, size_t _n); // Copies n bytes from memory areas src to dst +void *memset(void *_s, int _c, size_t _n); // Sets the first n bytes in memory area s to the value of c + +char *strcat(char *_dst, const char *_src); // Appends the src string to the dst string overwriting the `\0' character at the end of dest, and then adds a terminating `\0' character +char *strchr(const char *_s, int _c); // Locates the first occurrence of c, cast to char, in the string pointed to by s +int strcmp(const char *_s1, const char *_s2); // Compares the string pointed to by s1 to the string pointed to by s2 +int strcoll(const char *_s1, const char *_s2); // Compares the string pointed to by s1 to the string pointed to by s2, both interpreted as appropriate to the LC_COLLATE category of the current locale +char *strcpy(char *_dst, const char *_src); // Copies the string pointed to by src (including the terminating null character) into the array pointed to by dst. If copying occurs between objects that overlap, the behavior is undefined. +size_t strcspn(const char *_s1, const char *_s2); // Spans the initial part of the null-terminated string s1 as long as the characters from s do not occur in string s2 +char *strerror(int _errnum); // Return string describing error code +//size_t strftime(char *_s, size_t _maxsize, const char *_format, +// const struct tm *_timeptr); /* Much like a sprintf for time/date output */ +size_t strlen(const char *_s); // Caclulates the length of a string _s +char *strncat(char *_dst, const char *_src, size_t _n); // Concatenates src to the end of dst, where n is the Max # of characters +int strncmp(const char *_s1, const char *_s2, size_t _n); // Compares s1 with s2 case insensetive, comparing n characters +char *strncpy(char *_dst, const char *_src, size_t _n); // Copies up to n characters, including the terminating null character, from the string pointed to by src into the buffer pointed to by dst. +char *strpbrk(const char *_s1, const char *_s2); // Search a string for any of a set of characters +char *strrchr(const char *_s, int _c); // Locates the last occurrence of c, cast to char, in the string pointed to by s +size_t strspn(const char *_s1, const char *_s2); // Determines the span (i.e. length) of the initial substring within the string +char *strstr(const char *_s1, const char *_s2); // Locate first occurrence of a substring within a string +char *strtok(char *_s1, const char *_s2); // Find the next token in s1(strToken). The set of characters in s2(strDelimit) specifies possible delimiters of the token to be found in strToken +size_t strxfrm(char *_s1, const char *_s2, size_t _n); // Transforms the string pointed to by s2 and places the resulting string into the array pointed to by s1 + + + + +/********************************************/ +/* NON ANSI C functions */ +/********************************************/ +int stricmp(char *str1, char *str2); // Compare strings ignoring case + +#define strsave(s) strdup(s) // Makes a copy of the string pointed to by s +#define rindex(s,c) strrchr(s,c) // Locates the last occurrence of c, cast to char, in the string pointed to by s +#define index(s,c) strchr(s,c) // Locates the first occurrence of c, cast to char, in the string pointed to by s +#define strcmpi(s1, s2) stricmp(s1, s2) // Compare strings s1 and s2, ignoring case +#define strncmp(s1, s2, n) strnicmp(s1, s2, n) // Compares s1 with s2 case insensetive, comparing n characters + +void bzero(char *ptr, int nbytes); /* Copies n bytes, each with a value of zero, into string s */ +void bcopy(const void *src, void *dst, int n); /* Copies n bytes, from src into string dst */ + +int getopt(int argc, char **argv, char *opts); /* Parses command lines */ + +char *itoo(int nbr, char str[], int sz); +//char *ltostr(long num, char *string, size_t max_chars, unsigned base); /* Convert a long int to a String */ + +void *memccpy(void *_dst, const void *_src, int _c, size_t _n); /* Copies at most num bytes from source to dest, stopping if the character ch is copied */ +int memicmp(void *addr1, void *addr2, size_t n); /* Compares the first cnt bytes of buf1 and buf2 without regard to the case of letters in the two buffers */ +void memrev(char *buf, size_t count); /* Reverse "count" bytes starting at "buf" (exchange two adjacent areas of storage which might be of two different lengths) */ + +char *sstrdel(char *s, ...); /* Delete multiple substrings */ +char *str27seg(char *string); /* Convert numeric strings to 7-segment LED strings */ +char *strchcat(char *string, int ch, size_t buflen); /* Append a character to a string */ +char *strdel(char *str, size_t posn, size_t len); /* Removes specified characters from a string */ +char *strdelch(char *string, const char *lose); /* Removes specified character(s) from a string */ + +char *strdup(char *_s); /* Makes a copy of the string pointed to by s */ +char *stristr(char *str1, char *str2); /* Location of 1st occurance of str2 within str1 */ +char *strlwr(char *str); /* Convert only Upper case Alpha characters to lower case */ +int strnicmp(char *str1, char *str2, size_t n); /* Converts any uppercase letters in the given null-terminated string to lowercase. Other characters are not affected */ +char *strnset(char *str, int c, size_t n); /* Sets a specified number of characters in a string to a given character */ +char *strrev(char *str); /* Reverse the order of chatacters in a string */ +char *strrset (char *p, char *set); /* Returns a ptr to last char from set in p, else 0 */ +char *strset(char *str, int c); /* Fills the string pointed to by str with the character c */ +void strsort(char **v, unsigned n); /* Shell sort an array of string pointers via strcmp() */ +char *strupr(char *str); /* Convert only lower case Alpha characters to Upper case */ +void swapmem(void *_s1, void *_s2, size_t _n); /* Swaps n characters between the object pointed to by s1 and the object pointed to by s2 */ + + +Boolean_T xstrcmp(const char *pat, const char *str); /* Case Sensitve Simple string pattern matching functions using wildcards ('?' & '*'). */ +Boolean_T xstricmp(const char *pat, const char *str); /* Case Insensitve Simple string pattern matching functions using wildcards ('?' & '*'). */ + + +#endif /* _STRING_H */ + +/**************************************************/ +/* End of File STRING.H */ +/**************************************************/ + diff --git a/include/sys/flash_sk_io.h b/include/sys/flash_sk_io.h new file mode 100644 index 0000000..dbb54dd --- /dev/null +++ b/include/sys/flash_sk_io.h @@ -0,0 +1,234 @@ +#pragma Off (List) +/******************************************************************************* +* FILE NAME: Flash_SK_IO.ch +* +* TITLE: This function prototypes and data type definitions. +* +* DATA_RIGHTS: Western Design Center and R & C Services Proprietary +* Copyright(C) 1980-2004 +* All rights reserved. Reproduction in any manner, +* in whole or in part, is strictly prohibited without +* the prior written approval of R & C Services or +* Western Design Center. +* +* DESCRIPTION: This file describes function prototypes and data type +* definitions used for . +* +* +* SPECIAL CONSIDERATIONS: +* +* +* AUTHOR: R. Greenthal +* +* +* CREATION DATE: Feb 05,2004 +* +* REVISION HISTORY +* Name Date Description +* ------------ ---------- ---------------------------------------------- +* R. Greenthal 02/05/2004 Initial +* +******************************************************************************* +*/ + +#ifndef Flash_SK_IO_H +#define Flash_SK_IO_H + +/* + *=========================== CONSTANTS & MACROS =============================== + */ + +/* None */ + +/* + *================================== TYPES ===================================== + */ + +/* None */ + +/* + *============================= FUNCTION PROTOTYPES ============================ + */ + + + + + + +#define CLI asm{cli;} /* enable interrupt response */ +#define SEI asm{sei;} /* disable it */ + +#define BRK(n) asm{ brk n;} /* 65C02/65c816-BRK */ + +#define COP(n) asm{ cop n;} /* 65c816-COP */ + + +//#define EnableIRQ(n)\ +// asm(" lda #$80\n"\ +// " tsb $fd01+"#n"*4\n") /* enable interrupt of timer n */ + +//#define DisableIRQ(n)\ +// asm(" lda #$80\n"\ +// " trb $fd01+"#n"*4\n") /* disable it */ + + +struct _VIA1{ + uchar ORB_IRB; /* Input/Output Reg 'B' */ + uchar ORA_IRA; /* Input/Output Reg 'A' */ + uchar DDRB; /* Data Direction Reg 'B' */ + uchar DDRA; /* Data Direction Reg 'A' */ + uchar T1CLO; /* Timer #1 Counter Low */ + uchar T1CHI; /* Timer #1 Counter High */ + uchar T1LLO; /* Timer #1 Latch Low */ + uchar T1LHI; /* Timer #1 Latch High */ + uchar T2CLO; /* Timer #2 Counter Low */ + uchar T2CHI; /* Timer #2 Counter High */ + uchar SR; /* Shift Reg */ + uchar ACR; /* Auxiliary Control Reg */ + uchar PCR; /* Peripheral Control Reg */ + uchar IFR; /* Interrupt Flag Reg */ + uchar IER; /* Interrupt Enable Reg */ + uchar ORANH_IRANH; /* Input Reg 'A' No Handshake */ + }; + + +struct _VIA2{ + uchar ORB_IRB; /* Input/Output Reg 'B' */ + uchar ORA_IRA; /* Input/Output Reg 'A' */ + uchar DDRB; /* Data Direction Reg 'B' */ + uchar DDRA; /* Data Direction Reg 'A' */ + uchar T1CLO; /* Timer #1 Counter Low */ + uchar T1CHI; /* Timer #1 Counter High */ + uchar T1LLO; /* Timer #1 Latch Low */ + uchar T1LHI; /* Timer #1 Latch High */ + uchar T2CLO; /* Timer #2 Counter Low */ + uchar T2CHI; /* Timer #2 Counter High */ + uchar SR; /* Shift Reg */ + uchar ACR; /* Auxiliary Control Reg */ + uchar PCR; /* Peripheral Control Reg */ + uchar IFR; /* Interrupt Flag Reg */ + uchar IER; /* Interrupt Enable Reg */ + uchar ORANH_IRANH; /* Input Reg 'A' No Handshake */ + }; + + + +struct _UART16c450{ + uchar RHR_THR; /* Transmit/Receive Holding Register */ + uchar IER; /* Interrupt Enable Register */ + uchar FCR_ISR; /* FIFO control Register/Interrupt Status Register */ + uchar LCR; /* Interrupt Status Register */ + uchar MCR; /* Modem Control Register */ + uchar LSR; /* Line Status Register */ + uchar MSR; /* Modem Status Register */ + uchar SCR; /* Scratch pad Register */ + }; + +#define clock 1.84320E+06 +//#define clock 3.686400e6 +//#define clock 6.144000e6 +//#define clock 7.372800e6 +//#define clock 1.4743600e7 + +// UART 16c450 Type Baud Rates +#define _COM_300_ (clock/(16 * 300))-1 +#define _COM_1200_ (clock/(16 * 1200))-1 +#define _COM_2400_ (clock/(16 * 2400))-1 +#define _COM_9600_ (clock/(16 * 9600))-1 +#define _COM_19K_ (clock/(16 * 19200))-1 +#define _COM_38K_ (clock/(16 * 38400))-1 +#define _COM_56K_ (clock/(16 * 57600))-1 +#define _COM_115K_ (clock/(16 * 115200))-1 + +//* Parity +#define _COM_NOPARITY_ 0 +#define _COM_ODDPARITY_ 1 +#define _COM_EVENPARITY_ 2 + +//* Stopbits +#define _COM_STOP1_ 0 +#define _COM_STOP2_ 1 +#define _COM_STOP1_5_ 1 + +//* word length +#define _COM_CHR5_ 0 +#define _COM_CHR6_ 1 +#define _COM_CHR7_ 2 +#define _COM_CHR8_ 3 + +//* word Buffer length +#define _COM_FIFO1_ 0 +#define _COM_FIFO4_ 1 +#define _COM_FIFO8_ 2 +#define _COM_FIFO14_ 3 + + + + +struct _UART51{ + uchar rxd_txd; /* Receiver register */ + uchar serial_status; /* xmit & receive status reg */ + uchar serial_command; /* command register */ + uchar serial_control; /* rate & size control */ + }; + +#define RXD_READY 0x08 /* receiver ready bit mask */ +#define TXD_READY 0x10 /* transmitter ready bit mask */ +#define RXD_INT_ENABLE 0x02 /* receiver interrupt enable bit mask */ +#define TXD_INT_ENABLE 0x04 /* transmitter interrupt enable bit mask */ +#define RXD_ERROR 0x07 /* frame, overrun & parity error flags */ + +#define clock51 1.84320E+06 +//#define clock51 3.686400e6 +//#define clock51 6.144000e6 +//#define clock51 7.372800e6 +//#define clock51 1.4743600e7 + +// UART W65c51 Type Baud Rates +#define _COM51_300_ (clock51/(16 * 300)) +#define _COM51_1200_ (clock51/(16 * 1200)) +#define _COM51_2400_ (clock51/(16 * 2400)) +#define _COM51_9600_ (clock51/(16 * 9600)) +#define _COM51_19K_ (clock51/(16 * 19200)) +#define _COM51_38K_ (clock51/(16 * 38400)) +#define _COM51_56K_ (clock51/(16 * 57600)) +#define _COM51_115K_ (clock51/(16 * 115200)) + + + +struct _134_TOD_Clock{ + uchar tenthsec; + uchar sec; + uchar min; + uchar hr; + uchar day; + uchar month; + uchar yr; + uchar daywk:3; + uchar nu1:5; + uchar daylit:1; + uchar nu2:7; + }; + +struct _Maxim_TOD_Clock{ + uchar sec; + uchar min; + uchar hr; + uchar day; + uchar month; + uchar yr; + }; + + + +struct _I2C{ /* One byte of the VIA */ + uchar clock:1; + uchar sin:1; + uchar sout:1; + uchar nu:5; + }; + +#endif /* Flash_SK_IO_H */ +#pragma Pop (List) + + diff --git a/include/sys/sk_io.h b/include/sys/sk_io.h new file mode 100644 index 0000000..ef56831 --- /dev/null +++ b/include/sys/sk_io.h @@ -0,0 +1,105 @@ +#pragma Off (List) +/******************************************************************************* +* FILE NAME: SK_IO.ch +* +* TITLE: This function prototypes and data type definitions. +* +* DATA_RIGHTS: Western Design Center and R & C Services Proprietary +* Copyright(C) 1980-2004 +* All rights reserved. Reproduction in any manner, +* in whole or in part, is strictly prohibited without +* the prior written approval of R & C Services or +* Western Design Center. +* +* DESCRIPTION: This file describes function prototypes and data type +* definitions used for . +* +* +* SPECIAL CONSIDERATIONS: +* +* +* AUTHOR: R. Greenthal +* +* +* CREATION DATE: Feb 05,2004 +* +* REVISION HISTORY +* Name Date Description +* ------------ ---------- ---------------------------------------------- +* R. Greenthal 02/05/2004 Initial +* +******************************************************************************* +*/ + +#ifndef SK_IO_H +#define SK_IO_H + +/* + *=========================== CONSTANTS & MACROS =============================== + */ + +/* None */ + +/* + *================================== TYPES ===================================== + */ + +/* None */ + +/* + *============================= FUNCTION PROTOTYPES ============================ + */ + + + + + + +#define CLI asm{cli;} /* enable interrupt response */ +#define SEI asm{sei;} /* disable it */ + +#define BRK(n) asm{ brk n;} /* 65C02/65c816-BRK */ + +#define COP(n) asm{ cop n;} /* 65c816-COP */ + + +//#define EnableIRQ(n)\ +// asm(" lda #$80\n"\ +// " tsb $fd01+"#n"*4\n") /* enable interrupt of timer n */ + +//#define DisableIRQ(n)\ +// asm(" lda #$80\n"\ +// " trb $fd01+"#n"*4\n") /* disable it */ + + +struct _VIA1{ + uchar ORB_IRB; /* Input/Output Reg 'B' */ + uchar ORA_IRA; /* Input/Output Reg 'A' */ + uchar DDRB; /* Data Direction Reg 'B' */ + uchar DDRA; /* Data Direction Reg 'A' */ + uchar T1CLO; /* Timer #1 Counter Low */ + uchar T1CHI; /* Timer #1 Counter High */ + uchar T1LLO; /* Timer #1 Latch Low */ + uchar T1LHI; /* Timer #1 Latch High */ + uchar T2CLO; /* Timer #2 Counter Low */ + uchar T2CHI; /* Timer #2 Counter High */ + uchar SR; /* Shift Reg */ + uchar ACR; /* Auxiliary Control Reg */ + uchar PCR; /* Peripheral Control Reg */ + uchar IFR; /* Interrupt Flag Reg */ + uchar IER; /* Interrupt Enable Reg */ + uchar ORANH_IRANH; /* Input Reg 'A' No Handshake */ + }; + + +struct _I2C{ /* One byte of the VIA */ + uchar clock:1; + uchar sin:1; + uchar sout:1; + uchar nu:5; + }; + +#endif /* SK_IO_H */ +#pragma Pop (List) + + diff --git a/include/sys/types.h b/include/sys/types.h new file mode 100644 index 0000000..7793228 --- /dev/null +++ b/include/sys/types.h @@ -0,0 +1,170 @@ +/******************************************************************************* +* FILE NAME: sys\types.h +* +* TITLE: This function prototypes and data type definitions for the General Functions. +* +* DATA_RIGHTS: Western Design Center and R & C Services Proprietary +* Copyright(C) 1980-2004 +* All rights reserved. Reproduction in any manner, +* in whole or in part, is strictly prohibited without +* the prior written approval of R & C Services or +* Western Design Center. +* +* DESCRIPTION: This file describes function prototypes and data type +* definitions used for General purpose functions. +* The header contains important data type definitions. +* It is considered good programming practice to use these definitions, +* instead of the underlying base type. By convention, all type names end +* with _t. + +* +* +* SPECIAL CONSIDERATIONS: +* +* +* AUTHOR: R. Greenthal +* +* +* CREATION DATE: March 27,2004 +* +* REVISION HISTORY +* Name Date Description +* ------------ ---------- ---------------------------------------------- +* R. Greenthal 03/27/2004 Initial +* 0x/xx/2004 Added +* 0x/xx/2004 Added +* +******************************************************************************* +*/ + +#ifndef _TYPES_H +#define _TYPES_H + + +/* The type size_t holds all results of the sizeof operator. At first glance, + * it seems obvious that it should be an unsigned int, but this is not always + * the case. For example, MINIX-ST (68000) has 32-bit pointers and 16-bit + * integers. When one asks for the size of a 70K struct or array, the result + * requires 17 bits to express, so size_t must be a long type. The type + * ssize_t is the signed version of size_t. + */ + +#ifndef _SIZE_T +#define _SIZE_T +typedef unsigned int size_t; +#endif + +#ifndef _SSIZE_T +#define _SSIZE_T +typedef int ssize_t; +#endif + +#ifndef _TIME_T +#define _TIME_T +typedef long time_t; /* time in sec since 1 Jan 1970 0000 GMT */ +#endif + +#ifndef _CLOCK_T +#define _CLOCK_T +typedef long clock_t; /* unit for system accounting */ +#endif + +#ifndef _SIGSET_T +#define _SIGSET_T +typedef unsigned long sigset_t; +#endif + +/* Types used in disk, inode, etc. data structures. */ +typedef short dev_t; /* holds (major|minor) device pair */ +typedef char gid_t; /* group id */ +typedef unsigned short ino_t; /* i-node number */ +typedef unsigned short mode_t; /* file type and permissions bits */ +typedef char nlink_t; /* number of links to a file */ +typedef unsigned long off_t; /* offset within a file */ +typedef int pid_t; /* process id (must be signed) */ +typedef short uid_t; /* user id */ +typedef unsigned long zone_t; /* zone number */ +typedef unsigned long block_t; /* block number */ +typedef unsigned long bit_t; /* bit number in a bit map */ +typedef unsigned short zone1_t; /* zone number for V1 file systems */ +typedef unsigned short bitchunk_t; /* collection of bits in a bitmap */ + +typedef unsigned char u8_t; /* 8 bit type */ +typedef unsigned short u16_t; /* 16 bit type */ +typedef unsigned long u32_t; /* 32 bit type */ +//typedef unsigned long long u64_t; /* 64 bit type */ + +typedef unsigned char uchar; /* 8 bit type */ +typedef unsigned short uint; /* 16 bit type */ +typedef unsigned long ulong; /* 32 bit type */ +//typedef unsigned long long ull; /* 64 bit type */ + +//typedef unsigned char UCHAR; /* 8 bit type */ +//typedef unsigned short UINT; /* 16 bit type */ +//typedef unsigned long ULONG; /* 32 bit type */ +//typedef unsigned long long ULL; /* 64 bit type */ + +typedef char i8_t; /* 8 bit signed type */ +typedef short i16_t; /* 16 bit signed type */ +typedef long i32_t; /* 32 bit signed type */ +//typedef long long i64_t; /* 64 bit signed type */ + +#ifndef _FLOAT_T +#define _FLOAT_T +typedef float float_t; +#endif + + +#ifndef _DOUBLE_T +#define _DOUBLE_T +typedef double double_t; +#endif + + +/* Signal handler type, e.g. SIG_IGN */ +#if defined(_ANSI) +typedef void (*sighandler_t) (int); +#else +typedef void (*sighandler_t)(); +#endif + +//***************************** +//***************************** +// Special +//***************************** +//***************************** + +#define TRUE 1 +#define FALSE 0 + +#define true 1 +#define false 0 + +#define bool int +#define BOOL int +#define _Bool int // 1999 C + +#define EQ == +#define GE >= +#define GT > +#define LE <= +#define LT < +#define NE != + +/* +** Macros to manipulate bits in an array of char. +** These macros assume CHAR_BIT is one of either 8, 16, or 32. +*/ + +#define MASK CHAR_BIT-1 +#define SHIFT ((CHAR_BIT==8)?3:(CHAR_BIT==16)?4:8) + +#define BitOff(a,x) ((void)((a)[(x)>>SHIFT] &= ~(1 << ((x)&MASK)))) +#define BitOn(a,x) ((void)((a)[(x)>>SHIFT] |= (1 << ((x)&MASK)))) +#define BitFlip(a,x) ((void)((a)[(x)>>SHIFT] ^= (1 << ((x)&MASK)))) +#define IsBit(a,x) ((a)[(x)>>SHIFT] & (1 << ((x)&MASK))) + + +#endif /* _TYPES_H */ + + diff --git a/include/tgmath.h b/include/tgmath.h new file mode 100644 index 0000000..f57d79d --- /dev/null +++ b/include/tgmath.h @@ -0,0 +1,140 @@ +/* Copyright (C) 1993 by Zardoz Software, Inc. */ +#pragma Off (List) +/******************************************************************************* +* FILE NAME: TGMATH.h +* +* TITLE: This function prototypes and data type definitions for the Wide Characters Functions. +* +* DATA_RIGHTS: Western Design Center and R & C Services Proprietary +* Copyright(C) 1980-2004 +* All rights reserved. Reproduction in any manner, +* in whole or in part, is strictly prohibited without +* the prior written approval of R & C Services or +* Western Design Center. +* +* DESCRIPTION: This file describes function prototypes and data type +* definitions used for Wide Character functions. +* +* +* SPECIAL CONSIDERATIONS: +* +* +* AUTHOR: R. Greenthal +* +* +* CREATION DATE: March 17,2004 +* +* REVISION HISTORY +* Name Date Description +* ------------ ---------- ---------------------------------------------- +* R. Greenthal 03/25/2004 Initial +* 0x/xx/2004 Added +* +******************************************************************************* +*/ + +#ifndef __TGMATH_H +#define __TGMATH_H + + +/* Include the needed headers. */ +#include +#include + + +/* + *=========================== CONSTANTS & MACROS =============================== + */ + + + + +/* + *============================= FUNCTION CALL PROTOTYPES ============================ + */ + + +// (sizeof(Val)!=sizeof(double)) +// (sizeof(Val)==sizeof(_Complex)) This is the one we want, but _Complex isnt defined yet + +#define __REAL_DOUBLE(x) (sizeof(Val)!=sizeof(double)) +#define __REAL_FLOAT(x) (sizeof(Val)!=sizeof(float)) +#define __REAL_LONG_DOUBLE(x) (sizeof(Val)!=sizeof(long double)) + +#define acos(Val) ((sizeof(Val)!=sizeof(double)) ? cacos(Val) : acos(Val)) +#define acosf(Val) ((sizeof(Val)!=sizeof(float)) ? cacosf(Val) : acosf(Val)) +#define acosl(Val) ((sizeof(Val)!=sizeof(long double)) ? cacosl(Val) : acosl(Val)) + +#define acosh(Val) ((sizeof(Val)!=sizeof(double)) ? cacosh(Val) : acosh(Val)) +#define acoshf(Val) ((sizeof(Val)!=sizeof(float)) ? cacoshf(Val) : acoshf(Val)) +#define acoshl(Val) ((sizeof(Val)!=sizeof(long double)) ? cacoshl(Val) : acoshl(Val)) + +#define asin(Val) ((sizeof(Val)!=sizeof(double)) ? casin(Val) : asin(Val)) +#define asinf(Val) ((sizeof(Val)!=sizeof(float)) ? casinf(Val) : asinf(Val)) +#define asinl(Val) ((sizeof(Val)!=sizeof(long double)) ? casinl(Val) : asinl(Val)) + +#define asinh(Val) ((sizeof(Val)!=sizeof(double)) ? casinh(Val) : asinh(Val)) +#define asinhf(Val) ((sizeof(Val)!=sizeof(float)) ? casinhf(Val) : asinhf(Val)) +#define asinhl(Val) ((sizeof(Val)!=sizeof(long double)) ? casinhl(Val) : asinhl(Val)) + +#define atan(Val) ((sizeof(Val)!=sizeof(double)) ? catan(Val) : atan(Val)) +#define atanf(Val) ((sizeof(Val)!=sizeof(float)) ? catanf(Val) : atanf(Val)) +#define atanl(Val) ((sizeof(Val)!=sizeof(long double)) ? catanl(Val) : atanl(Val)) + +#define atanh(Val) ((sizeof(Val)!=sizeof(double)) ? catanh(Val) : atanh(Val)) +#define atanhf(Val) ((sizeof(Val)!=sizeof(float)) ? catanhf(Val) : atanhf(Val)) +#define atanhl(Val) ((sizeof(Val)!=sizeof(long double)) ? catanhl(Val) : atanhl(Val)) + +#define cos(Val) ((sizeof(Val)!=sizeof(double)) ? ccos(Val) : cos(Val)) +#define cosf(Val) ((sizeof(Val)!=sizeof(float)) ? ccosf(Val) : cosf(Val)) +#define cosl(Val) ((sizeof(Val)!=sizeof(long double)) ? ccosl(Val) : cosl(Val)) + +#define cosh(Val) ((sizeof(Val)!=sizeof(double)) ? ccosh(Val) : cosh(Val)) +#define coshf(Val) ((sizeof(Val)!=sizeof(float)) ? ccoshf(Val) : coshf(Val)) +#define coshl(Val) ((sizeof(Val)!=sizeof(long double)) ? ccoshl(Val) : coshl(Val)) + +#define exp(Val) ((sizeof(Val)!=sizeof(double)) ? cexp(Val) : exp(Val)) +#define expf(Val) ((sizeof(Val)!=sizeof(float)) ? cexpf(Val) : expf(Val)) +#define expl(Val) ((sizeof(Val)!=sizeof(long double)) ? cexpl(Val) : expl(Val)) + +#define fabs(Val) ((sizeof(Val)!=sizeof(double)) ? cabs(Val) : fabs(Val)) +#define fabsf(Val) ((sizeof(Val)!=sizeof(float)) ? cabsf(Val) : fabsf(Val)) +#define fabsl(Val) ((sizeof(Val)!=sizeof(long double)) ? cabsl(Val) : fabsl(Val)) + +//#define log10(Val) ((sizeof(Val)!=sizeof(double)) ? clog10(Val) : log10(Val)) +#define log(Val) ((sizeof(Val)!=sizeof(double)) ? clog(Val) : log(Val)) +#define logf(Val) ((sizeof(Val)!=sizeof(float)) ? clogf(Val) : logf(Val)) +#define logl(Val) ((sizeof(Val)!=sizeof(long double)) ? clogl(Val) : logl(Val)) + +#define pow(Val) ((sizeof(Val)!=sizeof(double)) ? cpow(Val) : pow(Val)) +#define powf(Val) ((sizeof(Val)!=sizeof(float)) ? cpowf(Val) : powf(Val)) +#define powl(Val) ((sizeof(Val)!=sizeof(long double)) ? cpowl(Val) : powl(Val)) + +#define sin(Val) ((sizeof(Val)!=sizeof(double)) ? csin(Val) : sin(Val)) +#define sinf(Val) ((sizeof(Val)!=sizeof(float)) ? csinf(Val) : sinf(Val)) +#define sinl(Val) ((sizeof(Val)!=sizeof(long double)) ? csinl(Val) : sinl(Val)) + +#define sinh(Val) ((sizeof(Val)!=sizeof(double)) ? csinh(Val) : sinh(Val)) +#define sinhf(Val) ((sizeof(Val)!=sizeof(float)) ? csinhf(Val) : sinhf(Val)) +#define sinhl(Val) ((sizeof(Val)!=sizeof(long double)) ? csinhl(Val) : sinhl(Val)) + +#define sqrt(Val) ((sizeof(Val)!=sizeof(double)) ? csqrt(Val) : sqrt(Val)) +#define sqrtf(Val) ((sizeof(Val)!=sizeof(float)) ? csqrtf(Val) : sqrtf(Val)) +#define sqrtl(Val) ((sizeof(Val)!=sizeof(long double)) ? csqrtl(Val) : sqrtl(Val)) + +#define tan(Val) ((sizeof(Val)!=sizeof(double)) ? ctan(Val) : tan(Val)) +#define tanf(Val) ((sizeof(Val)!=sizeof(float)) ? ctanf(Val) : tanf(Val)) +#define tanl(Val) ((sizeof(Val)!=sizeof(long double)) ? ctanl(Val) : tanl(Val)) + +#define tanh(Val) ((sizeof(Val)!=sizeof(double)) ? ctanh(Val) : tanh(Val)) +#define tanhf(Val) ((sizeof(Val)!=sizeof(float)) ? ctanhf(Val) : tanhf(Val)) +#define tanhl(Val) ((sizeof(Val)!=sizeof(long double)) ? ctanhl(Val) : tanhl(Val)) + + + +#endif /* End of _TGMATH_H */ +#pragma Pop (List) + +/************************************** + End of File TGMATH.H +***************************************/ diff --git a/include/time.h b/include/time.h new file mode 100644 index 0000000..72135ca --- /dev/null +++ b/include/time.h @@ -0,0 +1,129 @@ +/* Copyright (C) 1992 by Zardoz Software, Inc. */ +/******************************************************************************* +* FILE NAME: TIME.h +* +* TITLE: This function prototypes and data type definitions for the Time Functions. +* +* DATA_RIGHTS: Western Design Center and R & C Services Proprietary +* Copyright(C) 1980-2004 +* All rights reserved. Reproduction in any manner, +* in whole or in part, is strictly prohibited without +* the prior written approval of R & C Services or +* Western Design Center. +* +* DESCRIPTION: This file describes function prototypes and data type +* definitions used for Time functions. +* +* +* SPECIAL CONSIDERATIONS: +* +* +* AUTHOR: R. Greenthal +* +* +* CREATION DATE: March 17,2004 +* +* REVISION HISTORY +* Name Date Description +* ------------ ---------- ---------------------------------------------- +* R. Greenthal 03/25/2004 Initial +* 0x/xx/2004 Added +* +******************************************************************************* +*/ + + +#ifndef __TIME_H +#define __TIME_H + +#include // Defines +#include // Defines size_t + +#define CLOCKS_PER_SEC 100 /* clock() ticks per second */ + +#ifndef _TIME_T +#define _TIME_T +typedef long time_t; /* time in sec since 1 Jan 1970 0000 GMT */ +#endif + +#ifndef _CLOCK_T +#define _CLOCK_T +typedef long clock_t; /* unit for system accounting */ +#endif + + + +#define __TM +struct tm { + int tm_sec; /* seconds after the minute [0,60] */ + int tm_min; /* minutes after the hour [0,59] */ + int tm_hour; /* hours since midnight [0,23] */ + int tm_mday; /* day of the month [1,31] */ + int tm_mon; /* months since jan [0,11] */ + int tm_year; /* years since 1900 */ + int tm_wday; /* days since sunday [0,6] */ + int tm_yday; /* days since jan 1 [0,365] */ + int tm_isdst; /* pos if DST in effect; 0 if not; neg if can't tell */ + int tm_hsec; /* hundreths of second; not in ANSI C */ +}; + + +struct date { + int da_year; // + char da_day; // + char da_mon; // +}; + +struct time { + unsigned char ti_min; // + unsigned char ti_hour; // + unsigned char ti_hund; // + unsigned char ti_sec; // +}; + + +#define RTC_yr *( volatile uchar * )0x0030 +#define RTC_month *( volatile uchar * )0x0031 +#define RTC_day *( volatile uchar * )0x0032 +#define RTC_hr *( volatile uchar * )0x0033 +#define RTC_min *( volatile uchar * )0x0034 +#define RTC_sec *( volatile uchar * )0x0035 +#define RTC_tenthsec *( volatile uchar * )0x0036 + + +/***********************/ +/* ProtoType Functions */ +/***********************/ +char *asctime(const struct tm *timeptr); +clock_t clock(void); +char *ctime(const time_t *timer); +double difftime(time_t time1, time_t time2); +struct tm *gmtime(const time_t *timer); +struct tm *localtime(const time_t *timer); +time_t mktime(struct tm *timeptr); +time_t time(time_t *timer); +size_t strftime(char *s, size_t maxsize, const char *format, + const struct tm *timeptr); + + +/*********************/ +/* NON ANSI Standard */ +/*********************/ +//extern int daylight; /* non-zero if daylight savings time is used */ +//extern long timezone; /* difference in seconds between GMT and local time */ +//extern char *tzname[2]; /* standard/daylight savings time zone names */ + +//void ftime(struct timeb *timeptr); +//void getdate(struct date *datebuf); +//void gettime(struct time *timebuf); +//void setdate(struct date *datebuf); +//void settime(struct time *timebuf); +//int stime(time_t *timer); +//void tzset(void); + +#endif // End of __TIME_H + +/**************************************************/ +/* End of File TIME.H */ +/**************************************************/ + diff --git a/include/triglib.h b/include/triglib.h new file mode 100644 index 0000000..ddf71f0 --- /dev/null +++ b/include/triglib.h @@ -0,0 +1,117 @@ +/* +++Date last modified: 05-Jul-1997 */ + +/******************************************************/ +/* Filespec : triglib.c triglib.h */ +/* Date : February 21 1997 */ +/* Time : 14:11 */ +/* Revision : 1.0C */ +/* Update : */ +/******************************************************/ +/* Programmer: Nigel Traves */ +/* Address : 5 Breamer Road, Collingham, Newark, */ +/* : Notts, U.K. */ +/* Post Code : NG23 7PN */ +/******************************************************/ +/* Released to the Public Domain */ +/******************************************************/ + +#ifndef TRIGLIB_H +#define TRIGLIB_H + +/********************************************************************/ +/* This library is concerned entirely with angles in general and */ +/* trigonometric functions in particular. */ +/********************************************************************/ + +#ifndef ANGLE_TYPE +#define ANGLE_TYPE +enum angle_type {RAD, DEG, GRAD}; +#endif + +/********************************************************************/ +/* The following three routines 'normalize' the supplied angle to */ +/* be within limits appropiate for the trigonemetric routines. */ +/* normalize_radians ensures that the supplied angle is between -PI */ +/* and +PI, normalize_degrees between -180.0 and +180.0 and */ +/* normalize_grade between -200.0 and +200.0. NOTE - ALL the */ +/* normal trigonometric functions normalize the angle before use, */ +/* and the inverse functions after. */ +/********************************************************************/ + +void normalize_radians(double *radians); +void normalize_degrees(double *degrees); +void normalize_grade(double *grade); + +/********************************************************************/ +/* These six routines enable conversion, of angles, between */ +/* radians, degrees and grade. NOTE there is no need to normalize */ +/* the angle to be converted before calling any of these routines */ +/* as they all call the appropriate normalisation routine. */ +/********************************************************************/ + +double radians_to_degrees(double radians); +double radians_to_grade(double radians); +double degrees_to_radians(double degrees); +double degrees_to_grade(double degrees); +double grade_to_radians(double grade); +double grade_to_degrees(double grade); + +/********************************************************************/ +/* The following six routines are the normal trigonometric */ +/* functions. */ +/********************************************************************/ + +double sine(double angle, enum angle_type atype); +double cosine(double angle, enum angle_type atype); +double tangent(double angle, enum angle_type atype); +double secant(double angle, enum angle_type atype); +double cosecant(double angle, enum angle_type atype); +double cotangent(double angle, enum angle_type atype); + +/********************************************************************/ +/* The following six routines are the normal inverse trigonometric */ +/* functions. */ +/********************************************************************/ + +double arc_sine(double x, enum angle_type outtype); +double arc_cosine(double x, enum angle_type outtype); +double arc_tangent(double x, enum angle_type outtype); +double arc_secant(double x, enum angle_type outtype); +double arc_cosecant(double x, enum angle_type outtype); +double arc_cotangent(double x, enum angle_type outtype); + +/********************************************************************/ +/* The following six routines are the hyperbolic trigonometric */ +/* functions. */ +/********************************************************************/ + +double hyperbolic_sine(double angle, enum angle_type atype); +double hyperbolic_cosine(double angle, enum angle_type atype); +double hyperbolic_tangent(double angle, enum angle_type atype); +double hyperbolic_secant(double angle, enum angle_type atype); +double hyperbolic_cosecant(double angle, enum angle_type atype); +double hyperbolic_cotangent(double angle, enum angle_type atype); + +/********************************************************************/ +/* The following six routines are the hyperbolic inverse */ +/* trigonometric functions. */ +/********************************************************************/ + +double hyperbolic_arc_sine(double x, enum angle_type outtype); +double hyperbolic_arc_cosine(double x, enum angle_type outtype); +double hyperbolic_arc_tangent(double x, enum angle_type outtype); +double hyperbolic_arc_secant(double x, enum angle_type outtype); +double hyperbolic_arc_cosecant(double x, enum angle_type outtype); +double hyperbolic_arc_cotangent(double x, enum angle_type outtype); + +/********************************************************************/ +/* The following four routines "complete" the standard library */ +/* functions. */ +/********************************************************************/ + +double sech(double x); +double csch(double x); +double coth(double x); +double acoth(double x); + +#endif diff --git a/include/wchar.h b/include/wchar.h new file mode 100644 index 0000000..c70360c --- /dev/null +++ b/include/wchar.h @@ -0,0 +1,134 @@ +/******************************************************************************* +* FILE NAME: WCHAR.h +* +* TITLE: This function prototypes and data type definitions for the Wide Characters Functions. +* +* DATA_RIGHTS: Western Design Center and R & C Services Proprietary +* Copyright(C) 1980-2004 +* All rights reserved. Reproduction in any manner, +* in whole or in part, is strictly prohibited without +* the prior written approval of R & C Services or +* Western Design Center. +* +* DESCRIPTION: This file describes function prototypes and data type +* definitions used for Wide Character functions. +* +* +* SPECIAL CONSIDERATIONS: +* +* +* AUTHOR: R. Greenthal +* +* +* CREATION DATE: March 17,2004 +* +* REVISION HISTORY +* Name Date Description +* ------------ ---------- ---------------------------------------------- +* R. Greenthal 03/15/2004 Initial +* 0x/xx/2004 Added +* +******************************************************************************* +*/ + +#ifndef __WCHAR_H +#define __WCHAR_H + +#include // Define FILE + +#ifndef _VA_LIST +#include // Define va_list +#endif + +#ifndef _WCHAR_T +#include // Define size_t, wint_t, wchar_t, NULL +#endif + +#ifndef __TM +#include // Define tm +#endif + + + + +/* + *=========================== CONSTANTS & MACROS =============================== + */ + + + +typedef int mbstate_t; + + + +/* + *============================= FUNCTION CALL PROTOTYPES ============================ + */ + + +int fwprintf(FILE *stream, const wchar_t *format, ...); +int fwscanf(FILE *stream, const wchar_t *format, ...); +int swprintf( wchar_t *s, size_t n, const wchar_t *format, ...); +int swscanf( const wchar_t *s, const wchar_t *format, ...); +int vfwprintf(FILE *stream, const wchar_t *format, va_list arg); +int vfwscanf(FILE *stream, const wchar_t *format, va_list arg); +int vswprintf( wchar_t *s, size_t n, const wchar_t *format, va_list arg); +int vswscanf( const wchar_t *s, const wchar_t *format, va_list arg); +int vwprintf( const wchar_t *format, va_list arg); +int vwscanf(const wchar_t *format, va_list arg); +int wprintf( const wchar_t *format, ...); +int wscanf( const wchar_t *format, ...); +wint_t fgetwc( FILE *stream); +wchar_t *fgetws( wchar_t *s, int n, FILE *stream); +wint_t fputwc( wchar_t c, FILE *stream); +int fputws( const wchar_t *s, FILE *stream); +int fwide( FILE *stream, int mode); +wint_t getwc( FILE *stream); +wint_t getwchar( void); +wint_t putwc( wchar_t c, FILE *stream); +wint_t putwchar( wchar_t c); +wint_t ungetwc( wint_t c, FILE *stream); +double wcstod( const wchar_t *nptr, wchar_t **endptr); +float wcstof( const wchar_t *nptr, wchar_t **endptr); +long double wcstold( const wchar_t *nptr, wchar_t **endptr); +long int wcstol( const wchar_t *nptr, wchar_t **endptr, int base); +//long long int wcstoll( const wchar_t *nptr, wchar_t **endptr, int base); +unsigned long int wcstoul( const wchar_t *nptr, wchar_t **endptr, int base); +//unsigned long long int wcstoull( const wchar_t *nptr, wchar_t **endptr, int base); +wchar_t *wcscpy( wchar_t *s1, const wchar_t *s2); +wchar_t *wcsncpy( wchar_t *s1, const wchar_t *s2, size_t n); +wchar_t *wcscat( wchar_t *s1, const wchar_t *s2); +wchar_t *wcsncat( wchar_t *s1, const wchar_t *s2, size_t n); +int wcscmp( const wchar_t *s1, const wchar_t *s2); +int wcscoll( const wchar_t *s1, const wchar_t *s2); +int wcsncmp( const wchar_t *s1, const wchar_t *s2, size_t n); +size_t wcsxfrm( wchar_t *s1, const wchar_t *s2, size_t n); +wchar_t *wcschr( const wchar_t *s, wchar_t c); +size_t wcscspn( const wchar_t *s1, const wchar_t *s2); +size_t wcslen( const wchar_t *s); +wchar_t *wcspbrk( const wchar_t *s1, const wchar_t *s2); +wchar_t *wcsrchr( const wchar_t *s, wchar_t c); +size_t wcsspn( const wchar_t *s1, const wchar_t *s2); +wchar_t *wcsstr( const wchar_t *s1, const wchar_t *s2); +wchar_t *wcstok( wchar_t *s1, const wchar_t *s2, wchar_t **ptr); +wchar_t *wmemchr( const wchar_t *s, wchar_t c, size_t n); +int wmemcmp(const wchar_t *s1, const wchar_t *s2, size_t n); +wchar_t *wmemcpy( wchar_t *s1, const wchar_t *s2, size_t n); +wchar_t *wmemmove( wchar_t *s1, const wchar_t *s2, size_t n); +wchar_t *wmemset( wchar_t *s, wchar_t c, size_t n); +size_t wcsftime( wchar_t *s, size_t maxsize, const wchar_t *format, const struct tm *timeptr); +wint_t btowc( int c); //* +int wctob( wint_t c); +int mbsinit( const mbstate_t *ps); +size_t mbrlen( const char *s, size_t n, mbstate_t *ps); +size_t mbrtowc( wchar_t* pwc, const char *s, size_t n, mbstate_t *ps); +size_t wcrtomb( char *s, wchar_t wc, mbstate_t *ps); +size_t mbsrtowcs( wchar_t *dst, const char **src, size_t len, mbstate_t *ps); +size_t wcsrtombs( char *dst, const wchar_t **src, size_t len, mbstate_t *ps); + + +#endif /* End of __WCHAR_H */ + +/************************************** + End of File WCHAR.H +***************************************/ diff --git a/include/wctype.h b/include/wctype.h new file mode 100644 index 0000000..114c5a1 --- /dev/null +++ b/include/wctype.h @@ -0,0 +1,93 @@ +/******************************************************************************* +* FILE NAME: WCTYPE.h +* +* TITLE: This function prototypes and data type definitions for the Wide Characters Functions. +* +* DATA_RIGHTS: Western Design Center and R & C Services Proprietary +* Copyright(C) 1980-2004 +* All rights reserved. Reproduction in any manner, +* in whole or in part, is strictly prohibited without +* the prior written approval of R & C Services or +* Western Design Center. +* +* DESCRIPTION: This file describes function prototypes and data type +* definitions used for wide character classification and +* mapping utilities functions. +* +* +* SPECIAL CONSIDERATIONS: +* +* +* AUTHOR: R. Greenthal +* +* +* CREATION DATE: March 17,2004 +* +* REVISION HISTORY +* Name Date Description +* ------------ ---------- ---------------------------------------------- +* R. Greenthal 03/15/2004 Initial +* 0x/xx/2004 Added +* +******************************************************************************* +*/ + +#ifndef __WCTYPE_H +#define __WCTYPE_H + + +/* + *=========================== CONSTANTS & MACROS =============================== + */ + +#ifndef _WCHAR_T +#include // Define size_t, wchar_t, NULL +#endif + + +#ifndef _WCTRANS_T +#define _WCTRANS_T +typedef unsigned long wctrans_t; +#endif + + +/* + *============================= FUNCTION CALL PROTOTYPES ============================ + */ + + + + + +int iswalnum( wint_t wc); +int iswalpha( wint_t wc); +int iswcntrl( wint_t wc); +int iswdigit( wint_t wc); +int iswgraph( wint_t wc); +int iswlower( wint_t wc); +int iswprint( wint_t wc); +int iswpunct( wint_t wc); +int iswspace( wint_t wc); +int iswupper( wint_t wc); +int iswxdigit( wint_t wc); +int iswctype( wint_t wc, wctype_t desc); +int wctype( const char *property); +wint_t towlower(wint_t wc); +wint_t towupper(wint_t wc); +wctrans_t wctrans( const char *property); +wint_t towctrans( wint_t wc, wctrans_t desc); + + +/****************************/ +/* NON ANSI - C99 */ +/****************************/ + +int iswblank(wint_t wc); +int iswctrans(wint_t wc, unsigned int desc); + + +#endif /* End of __WCTYPE_H */ + +/************************************** + End of File WCTYPE.H +***************************************/ diff --git a/include/zpage.inc b/include/zpage.inc new file mode 100644 index 0000000..22e941b --- /dev/null +++ b/include/zpage.inc @@ -0,0 +1,145 @@ +*:ts=8 +* +* Copyright (C) 1998 by Zardoz Software, Inc. +* + +; Compiler zero-page configuration file +; +; Each of the following items must be defined with the exception of +; the 'Float' item if no floating point is used. The User Reg space +; can be of any desired size. This space is used by the compiler to +; hold automatic variables that would normally be located on the +; pseudo-stack. Priority is especially given to pointers. +; +; NOTE! Any changes made to this file must be reflected in the +; WDC02CC.CFG file in the BIN directory and then the libraries +; MUST be rebuilt. Also any files previously compiled MUST be +; recompiled. +; + + .sttl " Zpage.inc " +; bgnpkhdr +;******************************************************************************* +; FILE_NAME: zpage.inc +; +; TITLE: Zero Page variables for the W65c02 'C' compiler +; +; DATA_RIGHTS: Western Design Center and R & C Services Proprietary +; Copyright(C) 1980-2003 +; All rights reserved. Reproduction in any manner, +; in whole or in part, is strictly prohibited without +; the prior written approval of R & C Services or +; Western Design Center. +; +; +; DESCRIPTION: This File describes data type definitions used for the W65c02 'C' compiler. +; +; SPECIAL_CONSIDERATIONS: +; None +; +; SHARED_DATA: +; None. +; +; GLOBAL_MODULES: +; +; +; +; LOCAL_MODULES: +; None +; +; REVISION_HISTORY +; Name Date Description +; ------------ ---------- --------------------------------------------- +; R. Greenthal 12/16/2003 Module created. +; +; +; +;******************************************************************************* +; + + + CHIP 65C02 + + PAGE0 + +************* User Register Start and Count ****************************** + + IF USING_02 +; org $00:0000 ;Use it ALL + org $00:0020 + ELSEIF USING_134 + org $00:0040 + ENDIF + +;************************** +;16 byte User Register area +;************************** +REGS rmb 16 ; User Register Count + + +************* Stack Register Start *************************************** + + + +;************************** +; 8 byte Stack Register area +;************************** + +VAL rmb 2 +SP rmb 2 +AFRAME +FRAME rmb 2 +LFRAME +PC rmb 2 + + +************* Compiler Register Start ************************************ + + +;************************** +; 20 byte tmp register area +;************************** + +R0 rmb 4 +R1 rmb 4 +R2 rmb 4 +R3 rmb 4 +R4 rmb 4 + + +************* Work Register Start **************************************** + + +;************************** +;12 byte zero page temporary area +;************************** + +TMP rmb 12 + + +************* Float Register Start *************************************** + +; org $58 + +Exp0 rmb 2 ; 11 byte area for FP0 +Sign0 rmb 1 ; must be in this order +FP0 rmb 8 + +Exp1 rmb 2 ; 11 byte area for FP1 +Sign1 rmb 1 ; must be in this order +FP1 rmb 8 + +; +; FLOATING POINT ERRORS +; +UNDER_FLOW equ 1 +OVER_FLOW equ 2 +DIV_BY_ZERO equ 3 +; + + ends + +;******************************************************************************* +; End of File ZPAGE.INC +;******************************************************************************* + diff --git a/lib/c.lib b/lib/c.lib new file mode 100644 index 0000000..cab66c8 Binary files /dev/null and b/lib/c.lib differ diff --git a/lib/c0.obj b/lib/c0.obj new file mode 100644 index 0000000..9f33a2d Binary files /dev/null and b/lib/c0.obj differ diff --git a/lib/c0c.obj b/lib/c0c.obj new file mode 100644 index 0000000..6bc1858 Binary files /dev/null and b/lib/c0c.obj differ diff --git a/lib/c0l.obj b/lib/c0l.obj new file mode 100644 index 0000000..5e8da5b Binary files /dev/null and b/lib/c0l.obj differ diff --git a/lib/c0m.obj b/lib/c0m.obj new file mode 100644 index 0000000..f88df70 Binary files /dev/null and b/lib/c0m.obj differ diff --git a/lib/c0s.obj b/lib/c0s.obj new file mode 100644 index 0000000..8dacf72 Binary files /dev/null and b/lib/c0s.obj differ diff --git a/lib/c134.lib b/lib/c134.lib new file mode 100644 index 0000000..7711437 Binary files /dev/null and b/lib/c134.lib differ diff --git a/lib/cc.lib b/lib/cc.lib new file mode 100644 index 0000000..9f3034e Binary files /dev/null and b/lib/cc.lib differ diff --git a/lib/cl.lib b/lib/cl.lib new file mode 100644 index 0000000..8a6d216 Binary files /dev/null and b/lib/cl.lib differ diff --git a/lib/cm.lib b/lib/cm.lib new file mode 100644 index 0000000..b96aecd Binary files /dev/null and b/lib/cm.lib differ diff --git a/lib/cs.lib b/lib/cs.lib new file mode 100644 index 0000000..a4062b1 Binary files /dev/null and b/lib/cs.lib differ diff --git a/lib/m.lib b/lib/m.lib new file mode 100644 index 0000000..5724a68 Binary files /dev/null and b/lib/m.lib differ diff --git a/lib/m134.lib b/lib/m134.lib new file mode 100644 index 0000000..fb6b4f9 Binary files /dev/null and b/lib/m134.lib differ diff --git a/lib/mc.lib b/lib/mc.lib new file mode 100644 index 0000000..01c624d Binary files /dev/null and b/lib/mc.lib differ diff --git a/lib/ml.lib b/lib/ml.lib new file mode 100644 index 0000000..d2b5540 Binary files /dev/null and b/lib/ml.lib differ diff --git a/lib/mm.lib b/lib/mm.lib new file mode 100644 index 0000000..23fd582 Binary files /dev/null and b/lib/mm.lib differ diff --git a/lib/ms.lib b/lib/ms.lib new file mode 100644 index 0000000..8594ae5 Binary files /dev/null and b/lib/ms.lib differ diff --git a/libexec/LICENSE b/libexec/LICENSE new file mode 100644 index 0000000..dce45dc --- /dev/null +++ b/libexec/LICENSE @@ -0,0 +1,4 @@ +LIMITED USAGE STATEMENT: + +The technology is intended for use only directly related to product development using WDC's 65xx technology is +expressly NOT for cloning, redesign, or reverse engineering. You may make copies of the information for your use only. \ No newline at end of file diff --git a/libexec/cc3250.dll b/libexec/cc3250.dll new file mode 100644 index 0000000..7c1bbbb Binary files /dev/null and b/libexec/cc3250.dll differ diff --git a/libexec/wdc02as.exe b/libexec/wdc02as.exe new file mode 100755 index 0000000..4255617 Binary files /dev/null and b/libexec/wdc02as.exe differ diff --git a/libexec/wdc02cc.cfg b/libexec/wdc02cc.cfg new file mode 100644 index 0000000..1f21a02 --- /dev/null +++ b/libexec/wdc02cc.cfg @@ -0,0 +1,32 @@ +; Compiler configuration file +; +; Each of the following items must be defined with the exception of +; the 'Float' item if no floating point is used. The User Reg space +; can be of any desired size. This space is used by the compiler to +; hold automatic variables that would normally be located on the +; pseudo-stack. Priority is especially given to pointers. +; +; NOTE! Any changes made to this file must be reflected in the +; ZPAGE.INC file in the INCLUDE directory and then the libraries +; MUST be rebuilt. Also any files previously compiled MUST be +; recompiled. +; + +User Register Count=16 ; count of user register bytes + IF USING_02 +;User Register Start=0x00 ; N byte user register area +User Register Start=0x20 ; N byte user register area +Stack Register Start=0x30 ; 8 byte stack area +Compiler Register Start=0x38 ; 20 byte compiler temporary register area +Work Register Start=0x4c ; 12 byte general purpose work area +Float Register Start=0x58 ; 22 byte floating point area + + + ELSEIF USING_134 +User Register Start=0x40 ; N byte user register area +Stack Register Start=0x50 ; 8 byte stack area +Compiler Register Start=0x58 ; 20 byte compiler temporary register area +Work Register Start=0x6c ; 12 byte general purpose work area +Float Register Start=0x78 ; 22 byte floating point area + ENDIF + diff --git a/libexec/wdc02cc.exe b/libexec/wdc02cc.exe new file mode 100755 index 0000000..41572e5 Binary files /dev/null and b/libexec/wdc02cc.exe differ diff --git a/libexec/wdc02op.exe b/libexec/wdc02op.exe new file mode 100755 index 0000000..362a0e6 Binary files /dev/null and b/libexec/wdc02op.exe differ diff --git a/libexec/wdc816as.exe b/libexec/wdc816as.exe new file mode 100755 index 0000000..53b8450 Binary files /dev/null and b/libexec/wdc816as.exe differ diff --git a/libexec/wdc816cc.exe b/libexec/wdc816cc.exe new file mode 100755 index 0000000..75c612e Binary files /dev/null and b/libexec/wdc816cc.exe differ diff --git a/libexec/wdc816op.exe b/libexec/wdc816op.exe new file mode 100755 index 0000000..a04852c Binary files /dev/null and b/libexec/wdc816op.exe differ diff --git a/libexec/wdcdumpobj.exe b/libexec/wdcdumpobj.exe new file mode 100755 index 0000000..f120b54 Binary files /dev/null and b/libexec/wdcdumpobj.exe differ diff --git a/libexec/wdclib.exe b/libexec/wdclib.exe new file mode 100755 index 0000000..fbc4783 Binary files /dev/null and b/libexec/wdclib.exe differ diff --git a/libexec/wdclink.exe b/libexec/wdclink.exe new file mode 100755 index 0000000..5684079 Binary files /dev/null and b/libexec/wdclink.exe differ diff --git a/libexec/wdcln.exe b/libexec/wdcln.exe new file mode 100755 index 0000000..77cca76 Binary files /dev/null and b/libexec/wdcln.exe differ diff --git a/libexec/wdcobj.exe b/libexec/wdcobj.exe new file mode 100755 index 0000000..b396401 Binary files /dev/null and b/libexec/wdcobj.exe differ diff --git a/libexec/wdcsym.exe b/libexec/wdcsym.exe new file mode 100755 index 0000000..3f8841d Binary files /dev/null and b/libexec/wdcsym.exe differ diff --git a/man1/wdc816as.1 b/man1/wdc816as.1 new file mode 100644 index 0000000..db91a59 --- /dev/null +++ b/man1/wdc816as.1 @@ -0,0 +1,179 @@ +.Dd December 29, 2016 +.Dt WDC816AS 1 +.Os +.Sh NAME +.Nm wdc816as , +.Nm wdc02as +.Nd WDC assembler +.Sh SYNOPSIS +.Nm +.Op Fl GSL1 +.Op Fl I Ar path +.Op Fl D Ar symbol Ns Op = Ns Ar value +.Op Fl O Ar outfile +.Ar sourcefile +.Sh DESCRIPTION +The WDC macro assembler, +.Nm , +provides all the tools and facilities to do professional assembly language +program development. +.Sh OPTIONS +.Bl -tag -width indent +.It Fl 1 +Version 1.0 of the assembler used slightly different control characters. In +particular, the macro concatenation character +.Ql | +was changed to +.Ql @ , +the bit-wise inclusive OR character +.Ql ^ +was changed to +.Ql | , +and the bit-wise exclusive OR character +.Ql ^ +was added. This option changes the characters back to the 1.0 versions +for compatibility. +.It Fl D +This option is used to define an absolute symbol at run time. The symbol +can then be used in conditional statements to change the code generated. +The symbol can be followed with an equal sign and an absolute decimal +value. If no value is specified, then the symbol is given the value one. +For example the following command line: +.Pp +.Dl Nm Fl D Ns Ar COUNT=3 Fl D Ns Ar DEBUG Ar FILE.ASM +.Pp +will set the absolute symbol COUNT to the value 3 and the symbol DEBUG to +the value 1. Specifying these options is equivalent to the following +statements appearing at the beginning of the source file: +.Pp +.Bd -literal -offset indent +COUNT GEQU 3 +DEBUG GEQU 1 +.Ed +.It Fl G +The assembler and linker can now produce source level debugging information +for programs. When this option is specified, the assembler will generate +special object file records which indicate the number of bytes generated +for each source line in the file. Information is also generated to +determine the source file containing the source line. This option will +increase the size of object modules generated by the assembler. The +.Li INCDEBUG +directive can be used to control the generation of source information +for included files. The +.Fl G +option creates the +.Pa .bin +file used with the WDC Debugger +.Nm ( WDCDB.EXE ) +and the +.Pa WDCDB.INI +files. +.It Fl I +When the assembler encounters an +.Li INCLUDE +or +.Li APPEND +directive, the assembler looks in specific directories in a specific +order for the named file. First, the current directory is checked. Next, +any directories that have been specified using the +.Fl I +option will be searched. Finally, if an environment variable called +.Ev WDC_INC_65816 +or +.Ev WDC_INC_6502 +has been defined, then any directories specified in that variable +will be searched. +.Pp +For example, if one of the following lines is in the +.Pa AUTOEXEC.BAT +file: +.Pp +.Bd -literal -offset indent +SET WDC_INC_65816=C:\eWDC\eINCLUDE;C:\eWDC\eMACROS +SET WDC_INC_6502=C:\eWDC\eINCLUDE;C:\eWDC\eMACROS +.Ed +.Pp +then, the command: +.Pp +.Dl Nm Fl I Ar C:\eMYINC Ar PROG +.Pp +will assemble the file +.Ar PROG.ASM . +If the file contains any +.Li INCLUDE +or +.Li APPEND +directives, then the assembler will look for the specified file in this order: +.Pp +.Bd -literal -offset indent +current directory +C:\eMYINC +C:\eWDC\eINCLUDE +C:\eWDC\eMACROS +.Ed +.It Fl K +This option causes the path name specifying the name of the listing file to +be placed in the reserved word +.Dv __FILE__ . +.It Fl L +This option instructs the assembler to generate a listing file that will +have the same root name as the output name and an extension of +.Pa .LST . +The format and output control of the listing file are controlled by +assembler directives within the source file. +.It Fl O +This option is used to specify the name of the output file. Normally, the +output file has the same root name as the source file, and the extension is +changed to +.Pa .OBJ . +For example, the command: +.Pp +.Dl Nm Ar MYPROG.ASM +.Pp +will generate an output file called +.Ar MYPROG.OBJ . +If the +.Fl O +option is used, the output file name can be specified directly. For example: +.Pp +.Dl Nm Fl O Ar JUNK.REL Ar MYPROG.ASM +.Pp +will place the same output into a file called +.Ar JUNK.REL . +.It Fl S +Normally, labels that aren't declared global are not placed in the object +module since the assembler resolves all references to them. If the +.Fl S +option is specified, the symbols are included in the object file so that +the linker may pass them on to a symbol file that can be used when +debugging. +.It Fl V +This is the Verbose option. This option displays the amount of +RAM needed to assemble the program. +.It Fl W +This option causes a change in the default page width to 132, creating +a wide listing. +.El +.Sh ENVIRONMENT +The following environment variables affect the execution of +.Nm : +.Bl -tag -width indent +.It Ev WDC_INC_65816 , WDC_INC_6502 +A semi-colon separated list of directories to search if an +input file cannot be found in the current directory or in any +directories specified via the +.Fl I +flag. +.El +.Sh SEE ALSO +.\" .Xr wdc02as 1 , +.Xr wdc02cc 1 , +.Xr wdc02op 1 , +.\" .Xr wdc816as 1 , +.Xr wdc816cc 1 , +.Xr wdc816op 1 , +.Xr wdcdb 1 , +.Xr wdcln 1 , +.Xr wdclib 1 , +.Xr wdcobj 1 , +.Xr wdcsym 1 diff --git a/man1/wdclib.1 b/man1/wdclib.1 new file mode 100644 index 0000000..5d3c1c8 --- /dev/null +++ b/man1/wdclib.1 @@ -0,0 +1,129 @@ +.Dd December 24, 2016 +.Dt WDCLIB 1 +.Os +.Sh NAME +.Nm wdclib +.Nd WDC librarian +.Sh SYNOPSIS +.Nm +.Op Fl F Ar argfile +.Op Fl A | D | L | S | X +.Ar library +.Op Ar objfile ... +.Sh DESCRIPTION +.Nm +is a utility program that manipulates libraries of object modules. +.Nm +makes it possible to create a library of commonly used functions. This +library can be very efficiently searched and any modules required by the +program can be extracted from the library and placed in the output file. +.Pp +Since several object +modules may be contained in the same original source file, +.Nm +keeps track of the name of the file that each module comes from. +This allows all the modules associated with a file to be manipulated +without tediously typing in the name of each module. Options may be +specified individually or together. +.Sh OPTIONS +.Bl -tag -width indent +.It Fl A +This option tells +.Nm +to add the specified files to the library. The symbol dictionary is updated +to include the names of symbols defined in the object modules in the files. +If none of the options +.Fl A , D , +or +.Fl X +are given, the default is to assume option +.Fl A . +To create a library from a set of object files, use the command: +.Pp +.Dl Nm Fl A Ar MYLIB.LIB Ar LIBSRC1.OBJ Ar LIBSRC2.OBJ Ar LIBSRC3.OBJ +.Pp +which will create a library file called +.Ar MYLIB.LIB +and add all the modules +from the three object files. If +.Ar MYLIB.LIB +already existed, the modules +from the three object files will be added to the library. +.It Fl D +The modules in the library that originally came from the named files are +deleted from the library. Modules must be deleted before being replaced +with new ones. +.Pp +The following example shows how to remove the modules associated with an +object file. +.Pp +.Dl Nm Fl D Ar MYLIB.LIB Ar LIBSRC3.OBJ +.Pp +All of the modules associated with the file +.Ar LIBSRC3.OBJ +will be deleted from the library. +.Pp +This example shows how to replace a file in a library. +.Pp +.Dl Nm Fl D Ar MYLIB.LIB Ar LIBSRC2.OBJ +.Dl Nm Fl A Ar MYLIB.LIB Ar LIBSRC2.OBJ +.Pp +The modules associated with +.Ar LIBSRC2.OBJ +will first be deleted from the library and then added from the new version +of the file. The following options display information about the library +file after the modification arguments, if any, have been processed. +.It Fl F +This option must be followed by the name of a text file. The file will be +read and arguments will be extracted from the file. When the end of file +is reached, additional arguments are again extracted from the command +line. This allows more object modules than will fit on the standard command +line to be processed at one time. +.Pp +For example, these commands add all files with a +.Ar .OBJ +extension to the library. +.Pp +.Dl Nm DIR Ar *.OBJ > Pa OBJLIST +.Dl Nm Fl A Ar MYLIB.LIB Fl F Ar OBJLIST +.It Fl L +This option causes a list of the files in the library to be printed. +Associated with each file name is a file number. This number will also +appear in the symbol listing which indicates which file contains the +module that defines that symbol. This command will display the names +of all files added to a library. +.Pp +.Dl Nm Fl L Ar MYLIB.LIB +.Pp +This command adds two files to the library. +.Pp +.Dl Nm Fl AL Ar MYLIB.LIB Ar LIBSRC1.OBJ Ar LIBSRC2.OBJ +.Pp +After the files are added, a list of all the files in the library will +be printed. +.It Fl S +This option causes the dictionary of symbols contained in the library to +be printed. The dictionary is printed in alphabetical order. The number +of the file that defined the symbol along with the offset into the +library of the module that defined it are printed beside the symbol name. +.It Fl X +The modules in the library that originally came from the named files +are extracted from the library and placed into files with the same +name. After extraction, the modules in the library are deleted. +.Pp +The following example extracts two files from a library. +.Pp +.Dl Nm Fl X Ar MYLIB.LIB Ar LIBSRC3.OBJ Ar LIBSRC1.OBJ +.El +.Sh SEE ALSO +.Xr wdc02as 1 , +.Xr wdc02cc 1 , +.Xr wdc02op 1 , +.Xr wdc816as 1 , +.Xr wdc816cc 1 , +.Xr wdc816op 1 , +.Xr wdcdb 1 , +.Xr wdcln 1 , +.\" .Xr wdclib 1 , +.Xr wdcobj 1 , +.Xr wdcsym 1 diff --git a/man1/wdcln.1 b/man1/wdcln.1 new file mode 100644 index 0000000..8626541 --- /dev/null +++ b/man1/wdcln.1 @@ -0,0 +1,405 @@ +.Dd December 28, 2016 +.Dt WDCLN 1 +.Os +.Sh NAME +.Nm wdclib +.Nd WDC linker +.Sh SYNOPSIS +.Nm +.Op Fl BEGNQTVWX +.Op Fl Hxx +.Op Fl Mxx +.Op Fl Sxx +.Op Fl O Ar output +.Op Fl Zsec=XX,XX +.Op Fl Asec=XX,XX +.Op Fl C=XX,XX +.Op Fl D=XX,XX +.Op Fl K=XX,XX +.Op Fl U=XX,XX +.Op Fl F Ar argfile +.Op Fl L Ar library +.Op Ar objfile ... +.Sh DESCRIPTION +The WDC linker, +.Nm , +reads one or more object files and/or libraries and merges them into a +singleoutput file. References from one module to another are resolved +during the link. The linker operates in two passes. In the first pass, +each object module is scanned to determine what symbols are defined and +what symbols are referenced. Symbols that are defined are entered into a +symbol table. When other object modules want the address of a symbol they +will look in the symbol table. If the symbol is not in the symbol table +it is added to a list of undefined symbols. If a later module defines the +symbol it is removed from the undefined list. If a library is encountered, +it's dictionary is repeatedly scanned for any symbols that match any of +the symbols in the undefined list. If such a symbol is found, the module +that defines it is loaded from the library and its symbols are handled +just like a normal object module. Through this process, only object modules +that are needed are loaded from the library. Libraries are usually placed +at the end of the list of object files. At the end of the first pass, all +undefined symbol references should be resolved. During the second pass, +the linker reads each object module a second time. As it reads each +module, it generates the final output file based on the information in +the object module. +.Sh OPTIONS +.Bl -tag -width indent +.It Fl A +This option is used to specify the relocation and ROM address of the named +section. The option is followed by information in the following format: +.Pp +.Dl Fl A Ns Ar section Ns = Ns Op Ad XXXX Ns Op , Ns Ad XXXX +.Pp +where section is the name of the section to be located. The section name +is followed by an +.Ql = +sign which in turn is followed by the relocation +address and ROM address separated by a comma. All addresses are assumed +to be hexadecimal numbers. If the comma and ROM address are not present, +it is assumed that the relocation address will be used for the ROM address +as well. If the comma is present and either the relocation address or +the ROM address is missing, then the specified address is assumed to be +the end of the previously specified section. +.It Fl B +This option is used to create a file with the same root name as the output +file and with the extension +.Pa .BNK . +This file is similar to the map file and contains bank information. +.It Fl C +This option is used to specify the relocation address and the ROM address +of the predefined CODE section. The format is: +.Pp +.Dl Fl C Ns Op Ad XXXX Ns Op , Ns Ad XXXX +.Pp +which is similar to the +.Fl A +option without the section name. +.It Fl D +This option is used to specify the relocation address and the ROM address +of the predefined DATA section. The format is: +.Pp +.Dl Fl D Ns Op Ad XXXX Ns Op , Ns Ad XXXX +.Pp +which is similar to the +.Fl A +option without the section name. +.It Fl E +This option is used to create a file with the same root name as the output +file and with the extension +.Pa .ERR . +This file contains any warnings or error messages generated during the link. +.It Fl F +This option causes the linker to continue reading options and file names +from a file. When done, it then continues reading arguments from the command +line. The name of the file follows the option +.Fl F . +Lines beginning with a +.Ql # +character are ignored. For example, the following +command links +.Pa PROG.OBJ +with +.Pa SUB1.OBJ , ... , SUB4.OBJ , +and +.Pa TC.LIB . +It reads some arguments from the file +.Pa PROG.LNK : +.Pp +.Dl Nm Pa PROG.OBJ Fl F Ar PROG.LNK Pa TC.LIB +.Pp +where +.Pa PROG.LNK +contains: +.Bd -literal -offset indent +-O PROG.OUT +SUB1.OBJ +SUB2.OBJ +SUB3.OBJ +SUB4.OBJ +.Ed +.Pp +.Em WARNING: +There is a limit of 5000 files for the source level information +contained in reading file names from a file (Include files are counted +in this total). +.It Fl G +This option tell the linker to generate source level information. When +specified by itself with no additional symbol style option, the WDC symbol +file format is generated. Otherwise, if the +.Fl SN +Extended MicroTek symbol format option is specified, the source information +is added as special records. +.It Fl H +This option is used to select the format of the hex output file. Four formats +are currently supported. The following table shows the name of the format, +the option used to generate it, address field size. +.Pp +.Bl -column "Option" "File" "Size" "Format" +.It Sy "Option" Ta Sy "File" Ta Sy "Size" Ta Sy "Format" +.It Fl HB Ta Pa .BIN Ta -- Ta Straight Binary +.It Fl HI Ta Pa .HEX Ta 16 Ta Intel Hex +.It Fl HIE Ta Pa .HEX Ta 32 Ta Extended Intel Hex +.It Fl HM19 Ta Pa .S19 Ta 16 Ta Motorola S19 +.It Fl HM28 Ta Pa .S28 Ta 24 Ta Motorola S28 +.It Fl HM37 Ta Pa .S37 Ta 32 Ta Motorola S37 +.It Fl HN Ta Pa .ISX Ta 24 Ta Nintendo Binary +.It Fl HT Ta Pa .TEK Ta 16 Ta Tektronix Hex +.It Fl HZ Ta Pa .BIN Ta 24 Ta WDC Binary +.El +.Pp +The following binary format is generated if +.Fl HZ +is specified to the linker: +.Pp +.Bl -inset -compact -offset indent +.It Initial byte 'Z' as signature. +.El +Then for each block: +.Bl -inset -compact -offset indent +.It 3 byte address +.It 3 byte length length bytes of data +.It The final block has an address and length of 0. +.It The default is Motorola S19. +.El +.It Fl J +This option causes the module info to be placed in alphabetical order. +By default, module info is sorted by section. +.It Fl K +This option is used to specify the relocation address and the ROM address +of the predefined KDATA section. The format is: +.Pp +.Dl Fl K Ns Op Ad XXXX Ns Op , Ns Ad XXXX +.Pp +which is similar to the +.Fl A +option without the section name. +.It Fl L +This option takes the following characters and adds +.Pa .LIB +to form the name of the library. The default library directories specified +in the +.Ev WDC_LIB +environment variable are then searched for the fully defined file name. +.Pp +For example, the command: +.Pp +.Dl Nm Fl J Fl L Ns Ar CL +.Pp +will look for the file +.Pa CL.LIB . +.Pp +.Em Note: +The order of the libraries is important! The linker will pull in the +functions it needs from the +.Em first +library it sees. For example, +the following command: +.Pp +.Dl Nm Pa Sample.obj Fl L Ns Ar MS Fl L Ns Ar CS +.Pp +will pull in the +.Fn scanf +and +.Fn printf +functions from the floating point library as it is specified first. This +will result in larger code size! Therefore, If you are using floating +point math, put +.Fl L Ns Ar MS +before +.Fl L Ns Ar CS +so the proper functions are included. +.Pp +If you are NOT using floating point math, do not include +.Fl L Ns Ar MS +on the command line, or put it after +.Fl L Ns Ar CS +.Pp +.Em Note: +For the W65C02, use +.Pa c.lib +and/or +.Pa m.lib . +For the W65C816, use +.Pa coc.lib , col.lib , com.lib , ms.lib , mm.lib , mc.lib , ml.lib , +.Pa cs.lib , cm.lib , cc.lib , +and/or +.Pa cl.lib. +.It Fl M +This option is used to select a special machine mode. Currently, the only +available machine modes are +.Fl MN , MN80 , +and +.Fl MN21 +which stand for Nintendo, slow and fast, and Nintendo Mode 21 respectively. +.It Fl N +If this option is specified, the linker will not place any symbols defined +in a +.Pa .QCK +file into the symbol file. This is useful if the +.Pa .QCK +file is created from a large amount of data whose symbols are not required +after linking. The symbol file can be significantly smaller if the data +symbols are discarded. +.It Fl O +Option +.Fl O +can be used to specify the name of the file to which the linker is to +write the executable program. The name of this file is in the parameter +that follows +.Fl O . +For example, the following command writes the executable program to the +file +.Pa PROG.OUT : +.Pp +.Dl Nm Fl O Ar PROG.OUT Pa PROG.OBJ Pa TC.LIB +.Pp +If this option is not used, the linker derives the name of the executable +file from that of the first input file with the extension changed to +reflect the type of hex file being generated. +.It Fl P +This option sets the fill characters in the hex output file. The default, +(no +.Fl P Ns No ), +does not add any fill characters to the hex output file. If this option is +specified as +.Fl PFF , +it will fill in the blank areas of the hex output file with +.Li $FF Ns \(aqs +(all 1\(aqs). If this option is specified as +.Fl P00 , +it will fill in the blank areas of the hex output file with zeros (0\(aqs). +.It Fl Q +As the linker reads files and modules, it displays the name of each module. +Each subsequent module name overwrites the preceding name. This option +tells the linker not to display module names. +.\" +.\" -S +.\" +.It Fl S +This option controls the generation of symbol file information. By default, +no symbol file is generated. When this option is specified, a symbol file +is generated which can be used to aid in debugging the application. +.Pp +The following table shows the options and the formats generated. +.Pp +.Bl -column "Option" "Format" +.It Sy "Option" Ta Sy "Format" +.It Fl S2 Ta 2500AD symbol format +.It Fl SM Ta MicroTek symbol format +.It Fl SN Ta Extended MicroTek symbol format +.It Fl SQ Ta Quick link object file +.It Fl SZ Ta WDC symbol format +.El +.Pp +The linker supports an extension to the Extended MicroTek symbol file format. +.Pp +The linker generates the following additional symbol records if the +.Fl G +(source level info) option and +.Fl SN +options have been selected. +.Pp +.Bl -tag -width indent -compact +.It 0-9 +Standard MicroTek symbol type - global symbols +.It 50-59 +Standard MicroTek symbol type - local symbols +.It 101 +Single character name that is the status Register as specified by +LONGA/LONGI +directives. In other words, if +LONGA ON +is specified a 101 record will be generated with a +$20 as the ps value. +.It 102 +A two character name (low,high) that is the line number associated +with this address. +.It 103 +The name is the source file name associated with the object module. +.It 120+N +A zero length name with the address being the starting address for +section N. Section 1 is CODE, section 2 is DATA, section 3 is UDATA. +Other sections can probably be ignored unless you want to handle them. +.It 150+N +A zero length name with the address being the ending address for section N. +.El +.\" +.\" -T +.\" +.It Fl T +This option instructs the linker to generate a text map file with the +extension +.Pa .MAP . +The final address of each symbol is listed. +.It Fl U +This option is used to specify the relocation address and the ROM address +of the predefined UDATA section. The format is: +.Pp +.Dl Fl U Ns Op Ad XXXX Ns Op , Ns Ad XXXX +.Pp +which is similar to the +.Fl A +option without the section name. The UDATA section is a little different +since it never needs to be in the ROM at all since it contains +uninitialized data. +.Fl V +This option displays additional information to the screen giving the names +of variables and their locations. +.It Fl W +This option disables warnings from the linker. The linker will warn if a +symbol defined in a program module overrides a symbol defined in a library +module. This warning is useful for preventing hard to track down errors +such as when the user defines a routine called write that overrides the +library write routine. +.Pp +.Em Note: +This option not used after V3.10 +.It Fl X +This option directs the linker to use EMM memory mapping to provide +additional space for linking programs with large numbers of symbols. It +must be the first option specified. +.\" -Z +.It Fl Z +This option is used to specify the top and bottom address to use when +spreading the indicated section of various modules across multiple +banks of memory. The format is: +.Pp +.Dl Fl Z Ns Ar section Ns = Ns Op Cm bottom Ns Op , Ns Cm top +.Pp +The section specified by +.Ar section +will be marked for spreading. The default bottom is +.Ad 0000 +and the default top is +.Ad $1:0000 . +If no bottom or top is specified, the default is used. The first byte of +the section is specified using the ROM and relative org directives. +.Pp +The sub-options for +.Fl Z +are: +.Fl Z Ns Ar section Ns = , +.Fl Z Ns Ar code Ns = , +and +.Fl Z Ns Ar data Ns = . +.El +.Sh ENVIRONMENT +The following environment variables affect the execution of +.Nm : +.Bl -tag -width indent +.It Ev WDC_LIB +A semi-colon separated list of directories to search if an +input file cannot be found in the current directory. +.El +.Sh SEE ALSO +.Xr wdc02as 1 , +.Xr wdc02cc 1 , +.Xr wdc02op 1 , +.Xr wdc816as 1 , +.Xr wdc816cc 1 , +.Xr wdc816op 1 , +.Xr wdcdb 1 , +.\" .Xr wdcln 1 , +.Xr wdclib 1 , +.Xr wdcobj 1 , +.Xr wdcsym 1 \ No newline at end of file diff --git a/man1/wdcobj.1 b/man1/wdcobj.1 new file mode 100644 index 0000000..9701b2a --- /dev/null +++ b/man1/wdcobj.1 @@ -0,0 +1,77 @@ +.Dd December 28, 2016 +.Dt WDCOBJ 1 +.Os +.Sh NAME +.Nm wdcobj +.Nd Examine WDC object modules +.Sh SYNOPSIS +.Nm +.Op Fl DLRS +.Ar objfile +.Sh DESCRIPTION +The +.Nm +utility provides a means to examine object modules created by the +.Nm WDCxAS +assembler. +.Nm +will print out the size and type of each section defined in the module, the +names of all symbols defined or referenced by the object module, and if +desired, each of the data records in the file. The +.Nm +utility is of limited usefulness to the typical programmer and is included +for completeness. Options allow control of the information displayed. +.Sh OPTIONS +.Bl -tag -width indent +.It Fl D +This option causes display of any source debug information records present +in the object module. The appropriate options must have been specified when +compiling or assembling for debug information to be present. The default is +to NOT display debug information. +.It Fl L +Normally, when the records are displayed, all the data in the record is +displayed in hexadecimal format. When option +.Fl L +is specified, the data in the record is not displayed. This option is useful +for examining the structure of a file without displaying all the individual +data. +.Pp +To examine the individual records in an object module but without seeing all +of the data bytes, use the command: +.Pp +.Dl Nm Fl L Ar PROG.OBJ +.Pp +.It Fl R +This option causes display of each of the individual records in the object +module. Information about the object file format is available on request. +.Pp +To examine the individual records in an object module, use the command: +.Pp +.Dl Nm Fl R Ar PROG.OBJ +.Pp +.It Fl S +Normally, when +.Nm +is run, the information for the sections is followed by the symbol +information. When the +.Fl S +option is specified, the symbol information is suppressed. +.Pp +The following command displays just the section names and types of all +modules in the file +.Ar PROG.OBJ : +.Pp +.Dl Nm Fl S Ar PROG.OBJ +.El +.Sh SEE ALSO +.Xr wdc02as 1 , +.Xr wdc02cc 1 , +.Xr wdc02op 1 , +.Xr wdc816as 1 , +.Xr wdc816cc 1 , +.Xr wdc816op 1 , +.Xr wdcdb 1 , +.Xr wdcln 1 , +.Xr wdclib 1 , +.\" .Xr wdcobj 1 , +.Xr wdcsym 1 diff --git a/man1/wdcsym.1 b/man1/wdcsym.1 new file mode 100644 index 0000000..be6954b --- /dev/null +++ b/man1/wdcsym.1 @@ -0,0 +1,84 @@ +.Dd December 28, 2016 +.Dt WDCSYM 1 +.Os +.Sh NAME +.Nm wdcsym +.Nd Examine WDC symbol tables +.Sh SYNOPSIS +.Nm +.Op Fl ALS +.Ar symfile +.Sh DESCRIPTION +The +.Nm +utility provides a means to examine symbol files generated by the +.Nm WDCLN linker. +.Nm +will print out the sections defined in the target program and if desired the +line tables, symbol records, auxiliary records and global symbols. +.Pp +Note:This is only for +.Em ZARDOZ +symbol files. See the +.Nm WDCLN +manual and the +.Fl G +and +.Fl HZ +options. +.Sh OPTIONS +.Bl -tag -width indent +.It Fl A +This option causes the display of the auxiliary table. This table contains +typing information, array sizes and other information used in source level +debugging. Only one table is present in the symbol file and is referenced +by all sections and modules. +.It Fl L +This option causes the display of the line information data for each section +in the symbol file. +.It Fl S +This option causes the display of all global symbol records in the symbol +file. Normally, the global symbol records are suppressed. +.Pp +The following command displays the section information, and symbols for all +sections and the global symbols as well. +.Pp +.Dl Nm Fl S Ar PROG.SYM +.Pp +.El +The basic structure of the file is outlined as follows: +.Bl -inset -compact -offset indent +.It File Header +.It Module 1 Information +.Bl -inset -compact -offset indent +.It Section 1 Information +.It ... +.It Section N Information +.It Line Record Information +.El +.It Module 2 Information +.Bl -inset -compact -offset indent +.It ... +.El +.It Module N Information +.Bl -inset -compact -offset indent +.It ... +.El +.It Global Symbol Records +.It String Table +.It Auxiliary Record Table +.It Source File Information +.It End of file +.El +.Sh SEE ALSO +.Xr wdc02as 1 , +.Xr wdc02cc 1 , +.Xr wdc02op 1 , +.Xr wdc816as 1 , +.Xr wdc816cc 1 , +.Xr wdc816op 1 , +.Xr wdcdb 1 , +.Xr wdcln 1 , +.\" .Xr wdclib 1 , +.Xr wdcobj 1 +.\" .Xr wdcsym 1