1 /*******************************************************************
3 ** Forth Inspired Command Language
4 ** Author: John Sadler (john_sadler@alum.mit.edu)
5 ** Created: 16 Oct 1997
6 ** Implementations of FICL external interface functions...
8 *******************************************************************/
18 #include <machine/cpufunc.h>
24 ******************* FreeBSD P O R T B E G I N S H E R E ******************** Michael Smith
27 #if PORTABLE_LONGMULDIV == 0
28 DPUNS ficlLongMul(FICL_UNS x, FICL_UNS y)
33 qx = (u_int64_t)x * (u_int64_t) y;
35 q.hi = (u_int32_t)( qx >> 32 );
36 q.lo = (u_int32_t)( qx & 0xFFFFFFFFL);
41 UNSQR ficlLongDiv(DPUNS q, FICL_UNS y)
47 qx = (qh << 32) | q.lo;
56 void ficlTextOut(FICL_VM *pVM, char *msg, int fNewline)
68 void *ficlMalloc (size_t size)
73 void *ficlRealloc (void *p, size_t size)
75 return realloc(p, size);
78 void ficlFree (void *p)
87 * Store a byte to I/O port number port#
90 ficlOutb(FICL_VM *pVM)
95 port=stackPopUNS(pVM->pStack);
96 c=(u_char)stackPopINT(pVM->pStack);
102 * Fetch a byte from I/O port number port#
105 ficlInb(FICL_VM *pVM)
110 port=stackPopUNS(pVM->pStack);
112 stackPushINT(pVM->pStack,c);
118 ** Stub function for dictionary access control - does nothing
119 ** by default, user can redefine to guarantee exclusive dict
120 ** access to a single thread for updates. All dict update code
121 ** is guaranteed to be bracketed as follows:
122 ** ficlLockDictionary(TRUE);
123 ** <code that updates dictionary>
124 ** ficlLockDictionary(FALSE);
126 ** Returns zero if successful, nonzero if unable to acquire lock
127 ** befor timeout (optional - could also block forever)
130 int ficlLockDictionary(short fLock)
135 #endif /* FICL_MULTITHREAD */