Loader forth changes for customization

Alfred Perlstein alfred at freebsd.org
Thu Nov 14 17:31:09 UTC 2013


On 11/13/13, 11:54 PM, Teske, Devin wrote:
> On Nov 13, 2013, at 6:57 AM, Alfred Perlstein wrote:
>
>> On 11/13/13, 12:18 AM, Teske, Devin wrote:
>>> On Nov 12, 2013, at 10:45 PM, Alfred Perlstein wrote:
>>>
>>>> I added some hooks for menu.rc as well, you can see it via the github urls below.
>>>>
>>>> I've attached a sample menu.rc.local that provides additional menus.
>>>>
>>>> -Alfred
>>>>
>>>> On 11/12/13, 6:35 PM, Alfred Perlstein wrote:
>>>>> Hey folks,
>>>>>
>>>>> I added some forth using Devin's help to make it easier to customize the FreeBSD boot loader graphics.
>>>>>
>>>>> Diffs are here:
>>>>> https://github.com/alfredperlstein/freebsd/compare/loader_custom_rc
>>>>> -or-
>>>>> https://github.com/alfredperlstein/freebsd/compare/loader_custom_rc.diff
>>>>>
>>>>>
>>>>> Diff attached.
>>>>>
>>>>> Also attached is a custom loader.rc file and loader.conf file that shows how to set the brand/logo.
>>>>>
>>>>> Please review.
>>>>>
>>> I signed up for a github account (thanks), and I started commenting on some lines.
>> yay! :)
>>>>> -Alfred
>>>> <menu.rc.local>
>>> Hmmm, I hadn't realized that you could say:
>>>
>>> set foo=bar
>>>
>>> Along-side setting functions in the same file.
>>>
>>> I don't think you can set functions in an *.rc file, only in a *.4th file?
>>>
>>> No? Maybe it's a false misconception of mine. I've been keeping them
>>> separate for years. (but probably rightfully so, to keep *.rc files clean).
>> It seems to work although I will talk to the team about making separate files for the set commands.
>>
>> I've responded to your review comments here:
>>
>> https://github.com/alfredperlstein/freebsd/commit/0ca72dccd78b880b3e3ef4c2bb9ce025950a370b#commitcomment-4584862
>>
>> The changes I made are now in the branch
>> https://github.com/alfredperlstein/freebsd/tree/loader_custom_rc and you likely should see them in the updated pull request I sent you.
>>
> I improved on a few things...
>
> https://github.com/devinteske/freebsd/compare/freebsd:master...master
> -or-
> https://github.com/devinteske/freebsd/compare/freebsd:master...master.diff
> -or-
> Attached SVN patch.txt
Hey this is really awesome.  I'll try to spin it up today and hopefully 
get it into FreeNAS/TrueOS today!

I really like the level of comments here!  Having both the micro and 
macro explanation of what is going on is very helpful.

+: try-include ( -- ) \ see loader.4th(8)
+  ['] include ( -- xt ) \ get the execution token of `include'
+  catch ( xt -- exception# | 0 ) if \ failed
+    LF parse ( c -- s-addr/u ) 2drop \ advance >in to EOL (drop data)
+    \ ... prevents words unused by `include' from being interpreted
+  then
+; immediate \ interpret immediately for access to `source' (aka tib)
+


So a few questions here:
If so when why are we clearing to EOL?  Is "include" supposed to be 
alone on a line by itself?  You can't do this:
   include file_that_exists.rc   5 6 + .
and likewise you can't do:
   try-include file_that_exists.rc   5 6 + .
   try-include file_that_does_NOT_exists.rc   5 6 + .

It's not that important, just interesting.  I'm wondering though, with 
the exception of actually including the file or not, will both of these:
   try-include file_that_exists.rc   5 6 + .
   try-include file_that_does_NOT_exists.rc   5 6 + .
print '11'?  Or not?

Also, are there certain errors we want to report like "EISDIR" ? I'm not 
concerned for my application, but it's an just academic question I have.

Finally thank you so much for the tutoring in forth, it's very cool and 
thanks for putting up with my obvious frustration at learning a new lang!


-Alfred









More information about the freebsd-hackers mailing list