sysdep.h (53634) | sysdep.h (76116) |
---|---|
1/******************************************************************* 2 s y s d e p . h 3** Forth Inspired Command Language 4** Author: John Sadler (john_sadler@alum.mit.edu) 5** Created: 16 Oct 1997 6** Ficl system dependent types and prototypes... 7** 8** Note: Ficl also depends on the use of "assert" when 9** FICL_ROBUST is enabled. This may require some consideration 10** in firmware systems since assert often 11** assumes stderr/stdout. | 1/******************************************************************* 2 s y s d e p . h 3** Forth Inspired Command Language 4** Author: John Sadler (john_sadler@alum.mit.edu) 5** Created: 16 Oct 1997 6** Ficl system dependent types and prototypes... 7** 8** Note: Ficl also depends on the use of "assert" when 9** FICL_ROBUST is enabled. This may require some consideration 10** in firmware systems since assert often 11** assumes stderr/stdout. |
12** | 12** $Id: sysdep.h,v 1.6 2001-04-26 21:41:55-07 jsadler Exp jsadler $ |
13*******************************************************************/ 14/* | 13*******************************************************************/ 14/* |
15** N O T I C E -- DISCLAIMER OF WARRANTY | 15** Copyright (c) 1997-2001 John Sadler (john_sadler@alum.mit.edu) 16** All rights reserved. 17** 18** Get the latest Ficl release at http://ficl.sourceforge.net 19** 20** L I C E N S E and D I S C L A I M E R |
16** | 21** |
17** Ficl is freeware. Use it in any way that you like, with 18** the understanding that the code is not supported. 19** 20** Any third party may reproduce, distribute, or modify the ficl 21** software code or any derivative works thereof without any 22** compensation or license, provided that the author information 23** and this disclaimer text are retained in the source code files. 24** The ficl software code is provided on an "as is" basis without 25** warranty of any kind, including, without limitation, the implied 26** warranties of merchantability and fitness for a particular purpose 27** and their equivalents under the laws of any jurisdiction. 28** | 22** Redistribution and use in source and binary forms, with or without 23** modification, are permitted provided that the following conditions 24** are met: 25** 1. Redistributions of source code must retain the above copyright 26** notice, this list of conditions and the following disclaimer. 27** 2. Redistributions in binary form must reproduce the above copyright 28** notice, this list of conditions and the following disclaimer in the 29** documentation and/or other materials provided with the distribution. 30** 31** THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 32** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 33** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 34** ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 35** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 36** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 37** OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 38** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 39** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 40** OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 41** SUCH DAMAGE. 42** |
29** I am interested in hearing from anyone who uses ficl. If you have 30** a problem, a success story, a defect, an enhancement request, or | 43** I am interested in hearing from anyone who uses ficl. If you have 44** a problem, a success story, a defect, an enhancement request, or |
31** if you would like to contribute to the ficl release (yay!), please 32** send me email at the address above. | 45** if you would like to contribute to the ficl release, please send 46** contact me by email at the address above. 47** 48** $Id: sysdep.h,v 1.6 2001-04-26 21:41:55-07 jsadler Exp jsadler $ |
33*/ 34 | 49*/ 50 |
35/* $FreeBSD: head/sys/boot/ficl/i386/sysdep.h 53634 1999-11-23 15:24:30Z dcs $ */ | 51/* $FreeBSD: head/sys/boot/ficl/i386/sysdep.h 76116 2001-04-29 02:36:36Z dcs $ */ |
36 37#if !defined (__SYSDEP_H__) 38#define __SYSDEP_H__ 39 40#include <sys/types.h> 41 42#include <stddef.h> /* size_t, NULL */ 43#include <setjmp.h> | 52 53#if !defined (__SYSDEP_H__) 54#define __SYSDEP_H__ 55 56#include <sys/types.h> 57 58#include <stddef.h> /* size_t, NULL */ 59#include <setjmp.h> |
44 | |
45#include <assert.h> 46 47#if !defined IGNORE /* Macro to silence unused param warnings */ 48#define IGNORE(x) &x 49#endif 50 | 60#include <assert.h> 61 62#if !defined IGNORE /* Macro to silence unused param warnings */ 63#define IGNORE(x) &x 64#endif 65 |
51 | |
52/* 53** TRUE and FALSE for C boolean operations, and 54** portable 32 bit types for CELLs 55** 56*/ 57#if !defined TRUE 58#define TRUE 1 59#endif --- 24 unchanged lines hidden (view full) --- 84#if !defined NULL 85#define NULL ((void *)0) 86#endif 87 88/* 89** FICL_UNS and FICL_INT must have the same size as a void* on 90** the target system. A CELL is a union of void*, FICL_UNS, and 91** FICL_INT. | 66/* 67** TRUE and FALSE for C boolean operations, and 68** portable 32 bit types for CELLs 69** 70*/ 71#if !defined TRUE 72#define TRUE 1 73#endif --- 24 unchanged lines hidden (view full) --- 98#if !defined NULL 99#define NULL ((void *)0) 100#endif 101 102/* 103** FICL_UNS and FICL_INT must have the same size as a void* on 104** the target system. A CELL is a union of void*, FICL_UNS, and 105** FICL_INT. |
106** (11/2000: same for FICL_FLOAT) |
|
92*/ 93#if !defined FICL_INT 94#define FICL_INT INT32 95#endif 96 97#if !defined FICL_UNS 98#define FICL_UNS UNS32 99#endif 100 | 107*/ 108#if !defined FICL_INT 109#define FICL_INT INT32 110#endif 111 112#if !defined FICL_UNS 113#define FICL_UNS UNS32 114#endif 115 |
116#if !defined FICL_FLOAT 117#define FICL_FLOAT float 118#endif 119 |
|
101/* 102** Ficl presently supports values of 32 and 64 for BITS_PER_CELL 103*/ 104#if !defined BITS_PER_CELL 105#define BITS_PER_CELL 32 106#endif 107 108#if ((BITS_PER_CELL != 32) && (BITS_PER_CELL != 64)) --- 21 unchanged lines hidden (view full) --- 130typedef struct 131{ 132 FICL_INT quot; 133 FICL_INT rem; 134} INTQR; 135 136 137/* | 120/* 121** Ficl presently supports values of 32 and 64 for BITS_PER_CELL 122*/ 123#if !defined BITS_PER_CELL 124#define BITS_PER_CELL 32 125#endif 126 127#if ((BITS_PER_CELL != 32) && (BITS_PER_CELL != 64)) --- 21 unchanged lines hidden (view full) --- 149typedef struct 150{ 151 FICL_INT quot; 152 FICL_INT rem; 153} INTQR; 154 155 156/* |
138** Build controls | 157** B U I L D C O N T R O L S 158*/ 159 160#if !defined (FICL_MINIMAL) 161#define FICL_MINIMAL 0 162#endif 163#if (FICL_MINIMAL) 164#define FICL_WANT_SOFTWORDS 0 165#define FICL_WANT_FLOAT 0 166#define FICL_WANT_USER 0 167#define FICL_WANT_LOCALS 0 168#define FICL_WANT_DEBUGGER 0 169#define FICL_WANT_OOP 0 170#define FICL_PLATFORM_EXTEND 0 171#define FICL_MULTITHREAD 0 172#define FICL_ROBUST 0 173#define FICL_EXTENDED_PREFIX 0 174#endif 175 176/* 177** FICL_PLATFORM_EXTEND 178** Includes words defined in ficlCompilePlatform 179*/ 180#if !defined (FICL_PLATFORM_EXTEND) 181#define FICL_PLATFORM_EXTEND 1 182#endif 183 184/* 185** FICL_WANT_FLOAT 186** Includes a floating point stack for the VM, and words to do float operations. 187** Contributed by Guy Carver 188*/ 189#if !defined (FICL_WANT_FLOAT) 190#define FICL_WANT_FLOAT 0 191#endif 192 193/* 194** FICL_WANT_DEBUGGER 195** Inludes a simple source level debugger 196*/ 197#if !defined (FICL_WANT_DEBUGGER) 198#define FICL_WANT_DEBUGGER 1 199#endif 200 201/* 202** User variables: per-instance variables bound to the VM. 203** Kinda like thread-local storage. Could be implemented in a 204** VM private dictionary, but I've chosen the lower overhead 205** approach of an array of CELLs instead. 206*/ 207#if !defined FICL_WANT_USER 208#define FICL_WANT_USER 1 209#endif 210 211#if !defined FICL_USER_CELLS 212#define FICL_USER_CELLS 16 213#endif 214 215/* 216** FICL_WANT_LOCALS controls the creation of the LOCALS wordset and 217** a private dictionary for local variable compilation. 218*/ 219#if !defined FICL_WANT_LOCALS 220#define FICL_WANT_LOCALS 1 221#endif 222 223/* Max number of local variables per definition */ 224#if !defined FICL_MAX_LOCALS 225#define FICL_MAX_LOCALS 16 226#endif 227 228/* 229** FICL_WANT_OOP 230** Inludes object oriented programming support (in softwords) 231** OOP support requires locals and user variables! 232*/ 233#if !(FICL_WANT_LOCALS) || !(FICL_WANT_USER) 234#if !defined (FICL_WANT_OOP) 235#define FICL_WANT_OOP 0 236#endif 237#endif 238 239#if !defined (FICL_WANT_OOP) 240#define FICL_WANT_OOP 1 241#endif 242 243/* 244** FICL_WANT_SOFTWORDS 245** Controls inclusion of all softwords in softcore.c 246*/ 247#if !defined (FICL_WANT_SOFTWORDS) 248#define FICL_WANT_SOFTWORDS 1 249#endif 250 251/* |
139** FICL_MULTITHREAD enables dictionary mutual exclusion 140** wia the ficlLockDictionary system dependent function. | 252** FICL_MULTITHREAD enables dictionary mutual exclusion 253** wia the ficlLockDictionary system dependent function. |
254** Note: this implementation is experimental and poorly 255** tested. Further, it's unnecessary unless you really 256** intend to have multiple SESSIONS (poor choice of name 257** on my part) - that is, threads that modify the dictionary 258** at the same time. |
|
141*/ 142#if !defined FICL_MULTITHREAD 143#define FICL_MULTITHREAD 0 144#endif 145 146/* 147** PORTABLE_LONGMULDIV causes ficlLongMul and ficlLongDiv to be 148** defined in C in sysdep.c. Use this if you cannot easily 149** generate an inline asm definition 150*/ 151#if !defined (PORTABLE_LONGMULDIV) 152#define PORTABLE_LONGMULDIV 0 153#endif 154 | 259*/ 260#if !defined FICL_MULTITHREAD 261#define FICL_MULTITHREAD 0 262#endif 263 264/* 265** PORTABLE_LONGMULDIV causes ficlLongMul and ficlLongDiv to be 266** defined in C in sysdep.c. Use this if you cannot easily 267** generate an inline asm definition 268*/ 269#if !defined (PORTABLE_LONGMULDIV) 270#define PORTABLE_LONGMULDIV 0 271#endif 272 |
155 | |
156/* 157** INLINE_INNER_LOOP causes the inner interpreter to be inline code 158** instead of a function call. This is mainly because MS VC++ 5 159** chokes with an internal compiler error on the function version. 160** in release mode. Sheesh. 161*/ 162#if !defined INLINE_INNER_LOOP 163#if defined _DEBUG --- 45 unchanged lines hidden (view full) --- 209** the dictionary search order. See Forth DPANS sec 16.3.3 210** (file://dpans16.htm#16.3.3) 211*/ 212#if !defined FICL_DEFAULT_VOCS 213#define FICL_DEFAULT_VOCS 16 214#endif 215 216/* | 273/* 274** INLINE_INNER_LOOP causes the inner interpreter to be inline code 275** instead of a function call. This is mainly because MS VC++ 5 276** chokes with an internal compiler error on the function version. 277** in release mode. Sheesh. 278*/ 279#if !defined INLINE_INNER_LOOP 280#if defined _DEBUG --- 45 unchanged lines hidden (view full) --- 326** the dictionary search order. See Forth DPANS sec 16.3.3 327** (file://dpans16.htm#16.3.3) 328*/ 329#if !defined FICL_DEFAULT_VOCS 330#define FICL_DEFAULT_VOCS 16 331#endif 332 333/* |
217** User variables: per-instance variables bound to the VM. 218** Kinda like thread-local storage. Could be implemented in a 219** VM private dictionary, but I've chosen the lower overhead 220** approach of an array of CELLs instead. | 334** FICL_MAX_PARSE_STEPS controls the size of an array in the FICL_SYSTEM structure 335** that stores pointers to parser extension functions. I would never expect to have 336** more than 8 of these, so that's the default limit. Too many of these functions 337** will probably exact a nasty performance penalty. |
221*/ | 338*/ |
222#if !defined FICL_WANT_USER 223#define FICL_WANT_USER 1 | 339#if !defined FICL_MAX_PARSE_STEPS 340#define FICL_MAX_PARSE_STEPS 8 |
224#endif 225 | 341#endif 342 |
226#if !defined FICL_USER_CELLS 227#define FICL_USER_CELLS 16 228#endif 229 230/* 231** FICL_WANT_LOCALS controls the creation of the LOCALS wordset and 232** a private dictionary for local variable compilation. | 343/* 344** FICL_EXTENDED_PREFIX enables a bunch of extra prefixes in prefix.c and prefix.fr (if 345** included as part of softcore.c) |
233*/ | 346*/ |
234#if !defined FICL_WANT_LOCALS 235#define FICL_WANT_LOCALS 1 | 347#if !defined FICL_EXTENDED_PREFIX 348#define FICL_EXTENDED_PREFIX 0 |
236#endif 237 | 349#endif 350 |
238/* Max number of local variables per definition */ 239#if !defined FICL_MAX_LOCALS 240#define FICL_MAX_LOCALS 16 241#endif 242 | |
243/* 244** FICL_ALIGN is the power of two to which the dictionary 245** pointer address must be aligned. This value is usually 246** either 1 or 2, depending on the memory architecture 247** of the target system; 2 is safe on any 16 or 32 bit 248** machine. 3 would be appropriate for a 64 bit machine. 249*/ 250#if !defined FICL_ALIGN --- 54 unchanged lines hidden --- | 351/* 352** FICL_ALIGN is the power of two to which the dictionary 353** pointer address must be aligned. This value is usually 354** either 1 or 2, depending on the memory architecture 355** of the target system; 2 is safe on any 16 or 32 bit 356** machine. 3 would be appropriate for a 64 bit machine. 357*/ 358#if !defined FICL_ALIGN --- 54 unchanged lines hidden --- |