| 1 | /* @(#) pf_clib.h 96/12/18 1.10 */ |
| 2 | #ifndef _pf_clib_h |
| 3 | #define _pf_clib_h |
| 4 | |
| 5 | /*************************************************************** |
| 6 | ** Include file for PForth tools |
| 7 | ** |
| 8 | ** Author: Phil Burk |
| 9 | ** Copyright 1994 3DO, Phil Burk, Larry Polansky, David Rosenboom |
| 10 | ** |
| 11 | ** Permission to use, copy, modify, and/or distribute this |
| 12 | ** software for any purpose with or without fee is hereby granted. |
| 13 | ** |
| 14 | ** THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 15 | ** WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 16 | ** WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL |
| 17 | ** THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR |
| 18 | ** CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING |
| 19 | ** FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF |
| 20 | ** CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 21 | ** OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 22 | ** |
| 23 | ***************************************************************/ |
| 24 | |
| 25 | #ifdef PF_NO_CLIB |
| 26 | |
| 27 | #ifdef __cplusplus |
| 28 | extern "C" { |
| 29 | #endif |
| 30 | |
| 31 | cell_t pfCStringLength( const char *s ); |
| 32 | void *pfSetMemory( void *s, cell_t c, cell_t n ); |
| 33 | void *pfCopyMemory( void *s1, const void *s2, cell_t n); |
| 34 | #define EXIT(n) {while(1);} |
| 35 | |
| 36 | #ifdef __cplusplus |
| 37 | } |
| 38 | #endif |
| 39 | |
| 40 | #else /* PF_NO_CLIB */ |
| 41 | |
| 42 | #ifdef PF_USER_CLIB |
| 43 | #include PF_USER_CLIB |
| 44 | #else |
| 45 | /* Use stdlib functions if available because they are probably faster. */ |
| 46 | #define pfCStringLength strlen |
| 47 | #define pfSetMemory memset |
| 48 | #define pfCopyMemory memcpy |
| 49 | #define EXIT(n) exit(n) |
| 50 | #endif /* PF_USER_CLIB */ |
| 51 | |
| 52 | #endif /* !PF_NO_CLIB */ |
| 53 | |
| 54 | #ifdef __cplusplus |
| 55 | extern "C" { |
| 56 | #endif |
| 57 | |
| 58 | /* Always use my own functions to avoid macro expansion problems with tolower(*s++) */ |
| 59 | char pfCharToUpper( char c ); |
| 60 | char pfCharToLower( char c ); |
| 61 | |
| 62 | #ifdef __cplusplus |
| 63 | } |
| 64 | #endif |
| 65 | |
| 66 | #endif /* _pf_clib_h */ |