comsat: move uid/gid setting earlier
[freebsd/src.git] / stand / ficl / powerpc / sysdep.c
blob87bed142d684c124712563431618e23e0eabacfe
1 /*******************************************************************
2 ** s y s d e p . c
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...
7 **
8 *******************************************************************/
11 #ifdef TESTMAIN
12 #include <stdio.h>
13 #include <stdlib.h>
14 #else
15 #include <stand.h>
16 #endif
17 #include "ficl.h"
20 ******************* FreeBSD P O R T B E G I N S H E R E ******************** Michael Smith
23 #if PORTABLE_LONGMULDIV == 0
24 DPUNS ficlLongMul(FICL_UNS x, FICL_UNS y)
26 DPUNS q;
27 uint64_t qx;
29 qx = (uint64_t)x * (uint64_t) y;
31 q.hi = (uint32_t)( qx >> 32 );
32 q.lo = (uint32_t)( qx & 0xFFFFFFFFL);
34 return q;
37 UNSQR ficlLongDiv(DPUNS q, FICL_UNS y)
39 UNSQR result;
40 uint64_t qx, qh;
42 qh = q.hi;
43 qx = (qh << 32) | q.lo;
45 result.quot = qx / y;
46 result.rem = qx % y;
48 return result;
50 #endif
52 void ficlTextOut(FICL_VM *pVM, char *msg, int fNewline)
54 IGNORE(pVM);
56 while(*msg != 0)
57 putchar(*(msg++));
58 if (fNewline)
59 putchar('\n');
61 return;
64 void *ficlMalloc (size_t size)
66 return malloc(size);
69 void *ficlRealloc (void *p, size_t size)
71 return realloc(p, size);
74 void ficlFree (void *p)
76 free(p);
81 ** Stub function for dictionary access control - does nothing
82 ** by default, user can redefine to guarantee exclusive dict
83 ** access to a single thread for updates. All dict update code
84 ** is guaranteed to be bracketed as follows:
85 ** ficlLockDictionary(TRUE);
86 ** <code that updates dictionary>
87 ** ficlLockDictionary(FALSE);
89 ** Returns zero if successful, nonzero if unable to acquire lock
90 ** befor timeout (optional - could also block forever)
92 #if FICL_MULTITHREAD
93 int ficlLockDictionary(short fLock)
95 IGNORE(fLock);
96 return 0;
98 #endif /* FICL_MULTITHREAD */