aboutsummaryrefslogtreecommitdiff
path: root/amforth-6.5/common/lib/forth2012/search
diff options
context:
space:
mode:
Diffstat (limited to 'amforth-6.5/common/lib/forth2012/search')
-rw-r--r--amforth-6.5/common/lib/forth2012/search/also.frt8
-rw-r--r--amforth-6.5/common/lib/forth2012/search/definitions.frt8
-rw-r--r--amforth-6.5/common/lib/forth2012/search/forth.frt10
-rw-r--r--amforth-6.5/common/lib/forth2012/search/get-order.frt5
-rw-r--r--amforth-6.5/common/lib/forth2012/search/only.frt7
-rw-r--r--amforth-6.5/common/lib/forth2012/search/order.frt9
-rw-r--r--amforth-6.5/common/lib/forth2012/search/previous.frt8
-rw-r--r--amforth-6.5/common/lib/forth2012/search/set-order.frt13
8 files changed, 68 insertions, 0 deletions
diff --git a/amforth-6.5/common/lib/forth2012/search/also.frt b/amforth-6.5/common/lib/forth2012/search/also.frt
new file mode 100644
index 0000000..8934ce4
--- /dev/null
+++ b/amforth-6.5/common/lib/forth2012/search/also.frt
@@ -0,0 +1,8 @@
+\ duplicate first wordlist entry
+
+\ #require get-order.frt
+\ #require set-order.frt
+
+: also ( -- )
+ get-order over swap 1+ set-order
+;
diff --git a/amforth-6.5/common/lib/forth2012/search/definitions.frt b/amforth-6.5/common/lib/forth2012/search/definitions.frt
new file mode 100644
index 0000000..7ab89f0
--- /dev/null
+++ b/amforth-6.5/common/lib/forth2012/search/definitions.frt
@@ -0,0 +1,8 @@
+\ Make the compilation word list the same as the current first word list in the search order.
+
+\ #require get-order.frt
+
+: definitions ( -- )
+ get-order over set-current
+ 0 ?do drop loop \ clean up
+;
diff --git a/amforth-6.5/common/lib/forth2012/search/forth.frt b/amforth-6.5/common/lib/forth2012/search/forth.frt
new file mode 100644
index 0000000..77d6e6f
--- /dev/null
+++ b/amforth-6.5/common/lib/forth2012/search/forth.frt
@@ -0,0 +1,10 @@
+\ replace the first search order entry
+\ with forth-wordlist
+
+\ #require get-order.frt
+\ #require set-order.frt
+
+: forth
+ get-order nip
+ forth-wordlist swap set-order
+;
diff --git a/amforth-6.5/common/lib/forth2012/search/get-order.frt b/amforth-6.5/common/lib/forth2012/search/get-order.frt
new file mode 100644
index 0000000..958df7a
--- /dev/null
+++ b/amforth-6.5/common/lib/forth2012/search/get-order.frt
@@ -0,0 +1,5 @@
+\ get the ORDER stack
+
+: get-order
+ cfg-order get-stack
+; \ No newline at end of file
diff --git a/amforth-6.5/common/lib/forth2012/search/only.frt b/amforth-6.5/common/lib/forth2012/search/only.frt
new file mode 100644
index 0000000..11d1a22
--- /dev/null
+++ b/amforth-6.5/common/lib/forth2012/search/only.frt
@@ -0,0 +1,7 @@
+\ sets the system specific forth wordlist
+
+\ #require set-order.frt
+
+: only
+ forth-wordlist 1 set-order
+;
diff --git a/amforth-6.5/common/lib/forth2012/search/order.frt b/amforth-6.5/common/lib/forth2012/search/order.frt
new file mode 100644
index 0000000..b0c4057
--- /dev/null
+++ b/amforth-6.5/common/lib/forth2012/search/order.frt
@@ -0,0 +1,9 @@
+\ print the wids of the current word list and the search order
+
+\ #require get-order.frt
+
+: order ( -- )
+ get-current u. cr
+ get-order dup u.
+ 0 ?do u. space loop
+;
diff --git a/amforth-6.5/common/lib/forth2012/search/previous.frt b/amforth-6.5/common/lib/forth2012/search/previous.frt
new file mode 100644
index 0000000..8d78394
--- /dev/null
+++ b/amforth-6.5/common/lib/forth2012/search/previous.frt
@@ -0,0 +1,8 @@
+\ remove the first entry in the search order list
+
+\ #require get-order.frt
+\ #require set-order.frt
+
+: previous
+ get-order nip 1- set-order
+;
diff --git a/amforth-6.5/common/lib/forth2012/search/set-order.frt b/amforth-6.5/common/lib/forth2012/search/set-order.frt
new file mode 100644
index 0000000..5969ea3
--- /dev/null
+++ b/amforth-6.5/common/lib/forth2012/search/set-order.frt
@@ -0,0 +1,13 @@
+\ set a new ORDER stack
+
+: set-order
+ dup 0= if -50 throw then \ no empty search order stack
+ cfg-order set-stack
+;
+
+\ A better check would be
+\ : set-order
+\ dup 0 [ s" wordlists" environment search-wordlist drop execute ] literal
+\ within if cfg-order set-stack else -50 throw then
+\ ;
+\ \ No newline at end of file