File: primitives.c

package info (click to toggle)
openbios-sparc 1.0%2Bsvn640-1
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 4,412 kB
  • ctags: 12,091
  • sloc: ansic: 57,249; asm: 2,680; xml: 1,335; cpp: 414; makefile: 224; sh: 190
file content (148 lines) | stat: -rw-r--r-- 3,431 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
/* tag: the main file which includes all the prim code headers
 *
 * Copyright (C) 2003 Patrick Mauritz, Stefan Reinauer
 *
 * see the file "COPYING" for further information about
 * the copyright and warranty status of this work.
 */

#include "openbios/config.h"
#include "openbios/sysinclude.h"
#include "openbios/stack.h"
#include "openbios/kernel.h"
#include "dict.h"

/*
 * cross platform abstraction
 */

#include "cross.h"

/*
 * Code Field Address (CFA) definitions (DOCOL and the like)
 */

#include "internal.c"

/* include forth primitives needed to set up
 * all the words described in IEEE1275-1994.
 */

#include "forth.c"

/* words[] is a function array of all native code functions in used by
 * the dictionary, i.e. CFAs and primitives.
 * Any change here needs a matching change in the primitive word's
 * name list that is kept for bootstrapping in arch/unix/unix.c
 *
 * NOTE: THIS LIST SHALL NOT CHANGE (EXCEPT MANDATORY ADDITIONS AT
 * THE END). ANY OTHER CHANGE WILL BREAK COMPATIBILITY TO OLDER
 * BINARY DICTIONARIES.
 */
static forth_word * const words[] = {
	/*
	 * CFAs and special words
	 */
	semis,
	docol,
	lit,
	docon,
	dovar,
	dodefer,
	dodoes,
	dodo,
	doisdo,
	doloop,
	doplusloop,
	doival,
	doivar,
	doidefer,

	/*
	 * primitives
	 */
	fdup,			/* dup     */
	twodup,			/* 2dup    */
	isdup,			/* ?dup    */
	over,			/* over    */
	twoover,		/* 2over   */
	pick,			/* pick    */
	drop,			/* drop    */
	twodrop,		/* 2drop   */
	nip,			/* nip     */
	roll,			/* roll    */
	rot,			/* rot     */
	minusrot,		/* -rot    */
	swap,			/* swap    */
	twoswap,		/* 2swap   */
	tor,			/* >r      */
	rto,			/* r>      */
	rfetch,			/* r@      */
	depth,			/* depth   */
	depthwrite,		/* depth!  */
	rdepth,			/* rdepth  */
	rdepthwrite,		/* rdepth! */
	plus,			/* +       */
	minus,			/* -       */
	mult,			/* *       */
	umult,			/* u*      */
	mudivmod,		/* mu/mod  */
	forthabs,		/* abs     */
	negate,			/* negate  */
	max,			/* max     */
	min,			/* min     */
	lshift,			/* lshift  */
	rshift,			/* rshift  */
	rshifta,		/* >>a     */
	and,			/* and     */
	or,			/* or      */
	xor,			/* xor     */
	invert,			/* invert  */
	dplus,			/* d+      */
	dminus,			/* d-      */
	mmult,			/* m*      */
	ummult,			/* um*     */
	fetch,			/* @       */
	cfetch,			/* c@      */
	wfetch,			/* w@      */
	lfetch,			/* l@      */
	store,			/* !       */
	plusstore,		/* +!      */
	cstore,			/* c!      */
	wstore,			/* w!      */
	lstore,			/* l!      */
	equals,			/* =       */
	greater,		/* >       */
	less,			/* <       */
	ugreater,		/* u>      */
	uless,			/* u<      */
	spfetch,		/* sp@     */
	fmove,			/* move    */
	ffill,			/* fill    */
	emit,			/* emit    */
	iskey,			/* key?    */
	key,			/* key     */
	execute,		/* execute */
	here,			/* here    */
	herewrite,		/* here!   */
	dobranch,		/* dobranch     */
	docbranch,		/* do?branch    */
	unalignedwordread,	/* unaligned-w@ */
	unalignedwordwrite,	/* unaligned-w! */
	unalignedlongread,	/* unaligned-l@ */
	unalignedlongwrite,	/* unaligned-l! */
	iocfetch,		/* ioc@    */
	iowfetch,		/* iow@    */
	iolfetch,		/* iol@    */
	iocstore,		/* ioc!    */
	iowstore,		/* iow!    */
	iolstore,		/* iol!    */
	loop_i,			/* i       */
	loop_j,			/* j       */
	call,			/* call    */
	sysdebug,		/* sys-debug */
	do_include,		/* $include */
	do_encode_file,		/* $encode-file */
	do_debug_xt,		/* (debug  */
	do_debug_off,		/* (debug-off) */
};