summaryrefslogtreecommitdiffstats
path: root/sys/boot/forth
diff options
context:
space:
mode:
Diffstat (limited to 'sys/boot/forth')
-rw-r--r--sys/boot/forth/loader.4th8
-rw-r--r--sys/boot/forth/pnp.4th2
-rw-r--r--sys/boot/forth/support.4th23
3 files changed, 16 insertions, 17 deletions
diff --git a/sys/boot/forth/loader.4th b/sys/boot/forth/loader.4th
index f4d7666..3349c1f 100644
--- a/sys/boot/forth/loader.4th
+++ b/sys/boot/forth/loader.4th
@@ -26,8 +26,8 @@
s" arch-alpha" environment? [if] [if]
s" loader_version" environment? [if]
- 11 < [if]
- .( Loader version 1.1+ required) cr
+ 12 < [if]
+ .( Loader version 1.2+ required) cr
abort
[then]
[else]
@@ -38,8 +38,8 @@ s" arch-alpha" environment? [if] [if]
s" arch-i386" environment? [if] [if]
s" loader_version" environment? [if]
- 10 < [if]
- .( Loader version 1.0+ required) cr
+ 11 < [if]
+ .( Loader version 1.1+ required) cr
abort
[then]
[else]
diff --git a/sys/boot/forth/pnp.4th b/sys/boot/forth/pnp.4th
index a9f2899..395164d 100644
--- a/sys/boot/forth/pnp.4th
+++ b/sys/boot/forth/pnp.4th
@@ -158,7 +158,7 @@ only forth also support-functions
: load-pnp
0 to end_of_file?
reset_line_reading
- s" /boot/pnpid.conf" fopen fd !
+ s" /boot/pnpid.conf" O_RDONLY fopen fd !
fd @ -1 <> if
begin
end_of_file? 0=
diff --git a/sys/boot/forth/support.4th b/sys/boot/forth/support.4th
index 7988012..d711094 100644
--- a/sys/boot/forth/support.4th
+++ b/sys/boot/forth/support.4th
@@ -80,6 +80,16 @@
8 constant before_load_error
9 constant after_load_error
+\ I/O constants
+
+0 constant SEEK_SET
+1 constant SEEK_CUR
+2 constant SEEK_END
+
+0 constant O_RDONLY
+1 constant O_WRONLY
+2 constant O_RDWR
+
\ Crude structure support
: structure:
@@ -931,23 +941,12 @@ support-functions definitions
only forth also support-functions definitions
-: create_null_terminated_string { addr len -- addr' len }
- len char+ allocate if out_of_memory throw then
- >r
- addr r@ len move
- 0 r@ len + c!
- r> len
-;
-
\ Interface to loading conf files
: load_conf ( addr len -- )
0 to end_of_file?
reset_line_reading
- create_null_terminated_string
- over >r
- fopen fd !
- r> free-memory
+ O_RDONLY fopen fd !
fd @ -1 = if open_error throw then
['] process_conf catch
fd @ fclose
OpenPOWER on IntegriCloud