support.4th (187143) | support.4th (222417) |
---|---|
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 187143 2009-01-13 12:28:14Z luigi $ | 25\ $FreeBSD: head/sys/boot/forth/support.4th 222417 2011-05-28 08:50:38Z julian $ |
26 27\ Loader.rc support functions: 28\ 29\ initialize ( addr len -- ) as above, plus load_conf_files 30\ load_conf ( addr len -- ) load conf file given 31\ include_conf_files ( -- ) load all conf files in load_conf_files 32\ print_syntax_error ( -- ) print line and marker of where a syntax 33\ error was detected --- 15 unchanged lines hidden (view full) --- 49\ string module.beforeload command to be executed before load 50\ string module.afterload command to be executed after load 51\ string module.loaderror command to be executed if load fails 52\ cell module.next list chain 53\ 54\ Exported global variables; 55\ 56\ string conf_files configuration files to be loaded | 26 27\ Loader.rc support functions: 28\ 29\ initialize ( addr len -- ) as above, plus load_conf_files 30\ load_conf ( addr len -- ) load conf file given 31\ include_conf_files ( -- ) load all conf files in load_conf_files 32\ print_syntax_error ( -- ) print line and marker of where a syntax 33\ error was detected --- 15 unchanged lines hidden (view full) --- 49\ string module.beforeload command to be executed before load 50\ string module.afterload command to be executed after load 51\ string module.loaderror command to be executed if load fails 52\ cell module.next list chain 53\ 54\ Exported global variables; 55\ 56\ string conf_files configuration files to be loaded |
57\ string password password | |
58\ cell modules_options pointer to first module information 59\ value verbose? indicates if user wants a verbose loading 60\ value any_conf_read? indicates if a conf file was succesfully read 61\ 62\ Other exported words: 63\ note, strlen is internal 64\ strdup ( addr len -- addr' len) similar to strdup(3) 65\ strcat ( addr len addr' len' -- addr len+len' ) similar to strcat(3) --- 93 unchanged lines hidden (view full) --- 159;structure 160 161\ end of structures 162 163\ Global variables 164 165string conf_files 166string nextboot_conf_file | 57\ cell modules_options pointer to first module information 58\ value verbose? indicates if user wants a verbose loading 59\ value any_conf_read? indicates if a conf file was succesfully read 60\ 61\ Other exported words: 62\ note, strlen is internal 63\ strdup ( addr len -- addr' len) similar to strdup(3) 64\ strcat ( addr len addr' len' -- addr len+len' ) similar to strcat(3) --- 93 unchanged lines hidden (view full) --- 158;structure 159 160\ end of structures 161 162\ Global variables 163 164string conf_files 165string nextboot_conf_file |
167string password | |
168create module_options sizeof module.next allot 0 module_options ! 169create last_module_option sizeof module.next allot 0 last_module_option ! 1700 value verbose? 1710 value nextboot? 172 173\ Support string functions 174: strdup { addr len -- addr' len' } 175 len allocate if ENOMEM throw then --- 429 unchanged lines hidden (view full) --- 605: nextboot_flag? s" nextboot_enable" assignment_type? ; 606 607: nextboot_conf? s" nextboot_conf" assignment_type? ; 608 609: verbose_flag? s" verbose_loading" assignment_type? ; 610 611: execute? s" exec" assignment_type? ; 612 | 166create module_options sizeof module.next allot 0 module_options ! 167create last_module_option sizeof module.next allot 0 last_module_option ! 1680 value verbose? 1690 value nextboot? 170 171\ Support string functions 172: strdup { addr len -- addr' len' } 173 len allocate if ENOMEM throw then --- 429 unchanged lines hidden (view full) --- 603: nextboot_flag? s" nextboot_enable" assignment_type? ; 604 605: nextboot_conf? s" nextboot_conf" assignment_type? ; 606 607: verbose_flag? s" verbose_loading" assignment_type? ; 608 609: execute? s" exec" assignment_type? ; 610 |
613: password? s" password" assignment_type? ; 614 | |
615: module_load? load_module_suffix suffix_type? ; 616 617: module_loadname? module_loadname_suffix suffix_type? ; 618 619: module_type? module_type_suffix suffix_type? ; 620 621: module_args? module_args_suffix suffix_type? ; 622 --- 124 unchanged lines hidden (view full) --- 747 yes_value? to verbose? 748; 749 750: execute_command 751 value_buffer strget unquote 752 ['] evaluate catch if EEXEC throw then 753; 754 | 611: module_load? load_module_suffix suffix_type? ; 612 613: module_loadname? module_loadname_suffix suffix_type? ; 614 615: module_type? module_type_suffix suffix_type? ; 616 617: module_args? module_args_suffix suffix_type? ; 618 --- 124 unchanged lines hidden (view full) --- 743 yes_value? to verbose? 744; 745 746: execute_command 747 value_buffer strget unquote 748 ['] evaluate catch if EEXEC throw then 749; 750 |
755: set_password 756 value_buffer strget unquote password string= 757; 758 | |
759: process_assignment 760 name_buffer .len @ 0= if exit then 761 loader_conf_files? if set_conf_files exit then 762 nextboot_flag? if set_nextboot_flag exit then 763 nextboot_conf? if set_nextboot_conf exit then 764 verbose_flag? if set_verbose exit then 765 execute? if execute_command exit then | 751: process_assignment 752 name_buffer .len @ 0= if exit then 753 loader_conf_files? if set_conf_files exit then 754 nextboot_flag? if set_nextboot_flag exit then 755 nextboot_conf? if set_nextboot_conf exit then 756 verbose_flag? if set_verbose exit then 757 execute? if execute_command exit then |
766 password? if set_password exit then | |
767 module_load? if set_module_flag exit then 768 module_loadname? if set_module_loadname exit then 769 module_type? if set_module_type exit then 770 module_args? if set_module_args exit then 771 module_beforeload? if set_module_beforeload exit then 772 module_afterload? if set_module_afterload exit then 773 module_loaderror? if set_module_loaderror exit then 774 set_environment_variable --- 752 unchanged lines hidden (view full) --- 1527 r> if ( a path was passed ) 1528 load_directory_or_file 1529 else 1530 standard_kernel_search 1531 then 1532 ?dup 0= if ['] load_modules catch then 1533; 1534 | 758 module_load? if set_module_flag exit then 759 module_loadname? if set_module_loadname exit then 760 module_type? if set_module_type exit then 761 module_args? if set_module_args exit then 762 module_beforeload? if set_module_beforeload exit then 763 module_afterload? if set_module_afterload exit then 764 module_loaderror? if set_module_loaderror exit then 765 set_environment_variable --- 752 unchanged lines hidden (view full) --- 1518 r> if ( a path was passed ) 1519 load_directory_or_file 1520 else 1521 standard_kernel_search 1522 then 1523 ?dup 0= if ['] load_modules catch then 1524; 1525 |
1535\ read and store only as many bytes as we need, drop the extra 1536: read-password { size | buf len -- } 1537 size allocate if ENOMEM throw then 1538 to buf 1539 0 to len 1540 begin 1541 key 1542 dup backspace = if 1543 drop 1544 len if 1545 backspace emit bl emit backspace emit 1546 len 1 - to len 1547 else 1548 bell emit 1549 then 1550 else 1551 dup <cr> = if cr drop buf len exit then 1552 [char] * emit 1553 len size < if buf len chars + c! else drop then 1554 len 1+ to len 1555 then 1556 again 1557; 1558 | |
1559\ Go back to straight forth vocabulary 1560 1561only forth also definitions 1562 | 1526\ Go back to straight forth vocabulary 1527 1528only forth also definitions 1529 |