Add the DragonFly cvs id and perform general cleanups on cvs/rcs/sccs ids. Most
[dragonfly.git] / sys / boot / ficl / alpha / sysdep.c
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 *******************************************************************/
9
10 /* $FreeBSD: src/sys/boot/ficl/alpha/sysdep.c,v 1.7.2.1 2000/07/06 23:51:46 obrien Exp $ */
11 /* $DragonFly: src/sys/boot/ficl/alpha/Attic/sysdep.c,v 1.2 2003/06/17 04:28:18 dillon Exp $ */
12
13 #ifdef TESTMAIN
14 #include <stdio.h>
15 #include <stdlib.h>
16 #else
17 #include <stand.h>
18 #endif
19 #include "ficl.h"
20
21 /*
22 *******************  FreeBSD  P O R T   B E G I N S   H E R E ******************** Michael Smith
23 */
24
25 #if PORTABLE_LONGMULDIV == 0
26 DPUNS ficlLongMul(FICL_UNS x, FICL_UNS y)
27 {
28     DPUNS q;
29     u_int64_t qx;
30
31     qx = (u_int64_t)x * (u_int64_t) y;
32
33     q.hi = (u_int32_t)( qx >> 32 );
34     q.lo = (u_int32_t)( qx & 0xFFFFFFFFL);
35
36     return q;
37 }
38
39 UNSQR ficlLongDiv(DPUNS q, FICL_UNS y)
40 {
41     UNSQR result;
42     u_int64_t qx, qh;
43
44     qh = q.hi;
45     qx = (qh << 32) | q.lo;
46
47     result.quot = qx / y;
48     result.rem  = qx % y;
49
50     return result;
51 }
52 #endif
53
54 void  ficlTextOut(FICL_VM *pVM, char *msg, int fNewline)
55 {
56     IGNORE(pVM);
57
58     while(*msg != 0)
59         putchar(*(msg++));
60     if (fNewline)
61         putchar('\n');
62
63    return;
64 }
65
66 void *ficlMalloc (size_t size)
67 {
68     return malloc(size);
69 }
70
71 void *ficlRealloc (void *p, size_t size)
72 {
73     return realloc(p, size);
74 }
75
76 void  ficlFree   (void *p)
77 {
78     free(p);
79 }
80
81
82 /*
83 ** Stub function for dictionary access control - does nothing
84 ** by default, user can redefine to guarantee exclusive dict
85 ** access to a single thread for updates. All dict update code
86 ** is guaranteed to be bracketed as follows:
87 ** ficlLockDictionary(TRUE);
88 ** <code that updates dictionary>
89 ** ficlLockDictionary(FALSE);
90 **
91 ** Returns zero if successful, nonzero if unable to acquire lock
92 ** befor timeout (optional - could also block forever)
93 */
94 #if FICL_MULTITHREAD
95 int ficlLockDictionary(short fLock)
96 {
97         IGNORE(fLock);
98         return 0;
99 }
100 #endif /* FICL_MULTITHREAD */
101
102