Deleted Added
full compact
support.4th (87636) support.4th (97201)
1\ Copyright (c) 1999 Daniel C. Sobral <dcs@freebsd.org>
2\ All rights reserved.
3\
4\ Redistribution and use in source and binary forms, with or without
5\ modification, are permitted provided that the following conditions
6\ are met:
7\ 1. Redistributions of source code must retain the above copyright
8\ notice, this list of conditions and the following disclaimer.

--- 8 unchanged lines hidden (view full) ---

17\ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18\ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19\ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20\ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21\ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22\ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23\ SUCH DAMAGE.
24\
1\ Copyright (c) 1999 Daniel C. Sobral <dcs@freebsd.org>
2\ All rights reserved.
3\
4\ Redistribution and use in source and binary forms, with or without
5\ modification, are permitted provided that the following conditions
6\ are met:
7\ 1. Redistributions of source code must retain the above copyright
8\ notice, this list of conditions and the following disclaimer.

--- 8 unchanged lines hidden (view full) ---

17\ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18\ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19\ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20\ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21\ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22\ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23\ SUCH DAMAGE.
24\
25\ $FreeBSD: head/sys/boot/forth/support.4th 87636 2001-12-11 00:49:34Z jhb $
25\ $FreeBSD: head/sys/boot/forth/support.4th 97201 2002-05-24 02:28:58Z gordon $
26
27\ Loader.rc support functions:
28\
29\ initialize_support ( -- ) initialize global variables
30\ initialize ( addr len -- ) as above, plus load_conf_files
31\ load_conf ( addr len -- ) load conf file given
32\ include_conf_files ( -- ) load all conf files in load_conf_files
33\ print_syntax_error ( -- ) print line and marker of where a syntax

--- 169 unchanged lines hidden (view full) ---

203 ptr pnpi.handler \ pnphandler
204 sizeof STAILQ_HEAD member: pnpi.ident \ pnpident
205 sizeof STAILQ_ENTRY member: pnpi.link \ pnpinfo
206;structure
207
208\ Global variables
209
210string conf_files
26
27\ Loader.rc support functions:
28\
29\ initialize_support ( -- ) initialize global variables
30\ initialize ( addr len -- ) as above, plus load_conf_files
31\ load_conf ( addr len -- ) load conf file given
32\ include_conf_files ( -- ) load all conf files in load_conf_files
33\ print_syntax_error ( -- ) print line and marker of where a syntax

--- 169 unchanged lines hidden (view full) ---

203 ptr pnpi.handler \ pnphandler
204 sizeof STAILQ_HEAD member: pnpi.ident \ pnpident
205 sizeof STAILQ_ENTRY member: pnpi.link \ pnpinfo
206;structure
207
208\ Global variables
209
210string conf_files
211string nextboot_conf_file
211string password
212create module_options sizeof module.next allot 0 module_options !
213create last_module_option sizeof module.next allot 0 last_module_option !
2140 value verbose?
212string password
213create module_options sizeof module.next allot 0 module_options !
214create last_module_option sizeof module.next allot 0 last_module_option !
2150 value verbose?
2160 value nextboot?
215
216\ Support string functions
217
218: strdup ( addr len -- addr' len )
219 >r r@ allocate if out_of_memory throw then
220 tuck r@ move
221 r>
222;

--- 432 unchanged lines hidden (view full) ---

655 name_buffer .len @ over - name_buffer .addr @ +
656 over compare 0=
657;
658
659: loader_conf_files?
660 s" loader_conf_files" assignment_type?
661;
662
217
218\ Support string functions
219
220: strdup ( addr len -- addr' len )
221 >r r@ allocate if out_of_memory throw then
222 tuck r@ move
223 r>
224;

--- 432 unchanged lines hidden (view full) ---

657 name_buffer .len @ over - name_buffer .addr @ +
658 over compare 0=
659;
660
661: loader_conf_files?
662 s" loader_conf_files" assignment_type?
663;
664
665: nextboot_flag?
666 s" nextboot_enable" assignment_type?
667;
668
669: nextboot_conf?
670 s" nextboot_conf" assignment_type?
671;
672
663: verbose_flag?
664 s" verbose_loading" assignment_type?
665;
666
667: execute?
668 s" exec" assignment_type?
669;
670

--- 37 unchanged lines hidden (view full) ---

708 value_buffer .addr @ char+ value_buffer .len @ 2 chars -
709 else
710 value_buffer .addr @ value_buffer .len @
711 then
712 strdup
713 conf_files .len ! conf_files .addr !
714;
715
673: verbose_flag?
674 s" verbose_loading" assignment_type?
675;
676
677: execute?
678 s" exec" assignment_type?
679;
680

--- 37 unchanged lines hidden (view full) ---

718 value_buffer .addr @ char+ value_buffer .len @ 2 chars -
719 else
720 value_buffer .addr @ value_buffer .len @
721 then
722 strdup
723 conf_files .len ! conf_files .addr !
724;
725
726: set_nextboot_conf
727 nextboot_conf_file .addr @ ?dup if
728 free-memory
729 then
730 value_buffer .addr @ c@ [char] " = if
731 value_buffer .addr @ char+ value_buffer .len @ 2 chars -
732 else
733 value_buffer .addr @ value_buffer .len @
734 then
735 strdup
736 nextboot_conf_file .len ! nextboot_conf_file .addr !
737;
738
716: append_to_module_options_list ( addr -- )
717 module_options @ 0= if
718 dup module_options !
719 last_module_option !
720 else
721 dup last_module_option @ module.next !
722 last_module_option !
723 then

--- 134 unchanged lines hidden (view full) ---

858 ['] evaluate catch if
859 2drop free drop
860 set_error throw
861 else
862 free-memory
863 then
864;
865
739: append_to_module_options_list ( addr -- )
740 module_options @ 0= if
741 dup module_options !
742 last_module_option !
743 else
744 dup last_module_option @ module.next !
745 last_module_option !
746 then

--- 134 unchanged lines hidden (view full) ---

881 ['] evaluate catch if
882 2drop free drop
883 set_error throw
884 else
885 free-memory
886 then
887;
888
889: set_nextboot_flag
890 yes_value? to nextboot?
891;
892
866: set_verbose
867 yes_value? to verbose?
868;
869
870: execute_command
871 value_buffer .addr @ value_buffer .len @
872 over c@ [char] " = if
873 2 - swap char+ swap

--- 11 unchanged lines hidden (view full) ---

885 then
886 password .len ! password .addr !
887 0 value_buffer .addr !
888;
889
890: process_assignment
891 name_buffer .len @ 0= if exit then
892 loader_conf_files? if set_conf_files exit then
893: set_verbose
894 yes_value? to verbose?
895;
896
897: execute_command
898 value_buffer .addr @ value_buffer .len @
899 over c@ [char] " = if
900 2 - swap char+ swap

--- 11 unchanged lines hidden (view full) ---

912 then
913 password .len ! password .addr !
914 0 value_buffer .addr !
915;
916
917: process_assignment
918 name_buffer .len @ 0= if exit then
919 loader_conf_files? if set_conf_files exit then
920 nextboot_flag? if set_nextboot_flag exit then
921 nextboot_conf? if set_nextboot_conf exit then
893 verbose_flag? if set_verbose exit then
894 execute? if execute_command exit then
895 password? if set_password exit then
896 module_load? if set_module_flag exit then
897 module_loadname? if set_module_loadname exit then
898 module_type? if set_module_type exit then
899 module_args? if set_module_args exit then
900 module_beforeload? if set_module_beforeload exit then

--- 33 unchanged lines hidden (view full) ---

934 read_line
935 get_assignment
936 ['] process_assignment catch
937 ['] free_buffers catch
938 swap throw throw
939 repeat
940;
941
922 verbose_flag? if set_verbose exit then
923 execute? if execute_command exit then
924 password? if set_password exit then
925 module_load? if set_module_flag exit then
926 module_loadname? if set_module_loadname exit then
927 module_type? if set_module_type exit then
928 module_args? if set_module_args exit then
929 module_beforeload? if set_module_beforeload exit then

--- 33 unchanged lines hidden (view full) ---

963 read_line
964 get_assignment
965 ['] process_assignment catch
966 ['] free_buffers catch
967 swap throw throw
968 repeat
969;
970
971: peek_file
972 0 to end_of_file?
973 reset_line_reading
974 O_RDONLY fopen fd !
975 fd @ -1 = if open_error throw then
976 reset_assignment_buffers
977 read_line
978 get_assignment
979 ['] process_assignment catch
980 ['] free_buffers catch
981 fd @ fclose
982;
983
942only forth also support-functions definitions
943
944\ Interface to loading conf files
945
946: load_conf ( addr len -- )
947 0 to end_of_file?
948 reset_line_reading
949 O_RDONLY fopen fd !

--- 146 unchanged lines hidden (view full) ---

1096 while
1097 set_current_file_name
1098 ['] load_conf catch
1099 process_conf_errors
1100 recurse_on_conf_files? if recurse then
1101 repeat
1102;
1103
984only forth also support-functions definitions
985
986\ Interface to loading conf files
987
988: load_conf ( addr len -- )
989 0 to end_of_file?
990 reset_line_reading
991 O_RDONLY fopen fd !

--- 146 unchanged lines hidden (view full) ---

1138 while
1139 set_current_file_name
1140 ['] load_conf catch
1141 process_conf_errors
1142 recurse_on_conf_files? if recurse then
1143 repeat
1144;
1145
1146: get_nextboot_conf_file ( -- addr len )
1147 nextboot_conf_file .addr @ nextboot_conf_file .len @ strdup
1148;
1149
1150: rewrite_nextboot_file ( -- )
1151 get_nextboot_conf_file
1152 O_WRONLY fopen fd !
1153 fd @ -1 = if open_error throw then
1154 fd @ s' nextboot_enable="NO" ' fwrite
1155 fd @ fclose
1156;
1157
1158: include_nextboot_file
1159 get_nextboot_conf_file
1160 ['] peek_file catch
1161 nextboot? if
1162 get_nextboot_conf_file
1163 ['] load_conf catch
1164 process_conf_errors
1165 ['] rewrite_nextboot_file catch
1166 then
1167;
1168
1104\ Module loading functions
1105
1106: load_module?
1107 module.flag @
1108;
1109
1110: load_parameters ( addr -- addr addrN lenN ... addr1 len1 N )
1111 dup >r

--- 537 unchanged lines hidden ---
1169\ Module loading functions
1170
1171: load_module?
1172 module.flag @
1173;
1174
1175: load_parameters ( addr -- addr addrN lenN ... addr1 len1 N )
1176 dup >r

--- 537 unchanged lines hidden ---