select-dev and unselect-dev are pre Open Firmware, and not the same
as open-dev/device-end. Make them Sun OBP compatible by pulling the
functionality for select-dev/unselect-dev out of (and simplifying)
begin-package/end-package.
Signed-off-by: Bob Breuer <breuerr(a)mc.net>
---
forth/admin/devices.fs | 4 ----
forth/debugging/fcode.fs | 22 +++++++++++++++++-----
forth/device/pathres.fs | 4 ----
3 files changed, 17 insertions(+), 13 deletions(-)
Index: forth/device/pathres.fs
===================================================================
--- forth/device/pathres.fs (revision 1045)
+++ forth/device/pathres.fs (working copy)
@@ -471,10 +471,6 @@
( ihandle )
;
-: select-dev ( dev-str dev-len -- ihandle | 0 )
- open-dev
-;
-
: execute-device-method
( ... dev-str dev-len met-str met-len -- ... false | ?? true )
2swap
Index: forth/admin/devices.fs
===================================================================
--- forth/admin/devices.fs (revision 1045)
+++ forth/admin/devices.fs (working copy)
@@ -46,10 +46,6 @@
0 active-package!
;
-: unselect-dev ( -- )
- device-end
-;
-
: ?active-package ( -- phandle )
active-package dup 0= abort" no active device"
;
Index: forth/debugging/fcode.fs
===================================================================
--- forth/debugging/fcode.fs (revision 1045)
+++ forth/debugging/fcode.fs (working copy)
@@ -10,21 +10,33 @@
: headers ( -- )
;
-: begin-package ( arg-str arg-len reg-str reg-len dev-str dev-len -- )
+\ Open specified device node and make it the current instance.
+\ pre Open Firmware, but Sun OBP compatible
+: select-dev ( dev-str dev-len -- )
open-dev dup 0= abort" failed opening parent."
dup to my-self
ihandle>phandle active-package!
+;
+
+: begin-package ( arg-str arg-len reg-str reg-len dev-str dev-len -- )
+ select-dev
new-device
set-args
;
-: end-package ( -- )
- my-parent >r
- finish-device
+\ Close current node, deselect active package and current instance,
+\ leaving no instance selected
+\ pre Open Firmware, but Sun OBP compatible
+: unselect-dev ( -- )
+ my-self close-dev
0 active-package!
0 to my-self
- r> close-dev
;
+: end-package ( -- )
+ finish-device
+ unselect-dev
+;
+
: apply ( ... "method-name< >device-specifier< >" -- ??? )
;