olpc.fth question

Sameer Verma sverma at sfsu.edu
Sun Jun 17 14:57:07 EDT 2012


On Wed, Jun 13, 2012 at 4:23 AM, Kevin Gordon <kgordon420 at gmail.com> wrote:
>
> Jerry, James and Martin:
>
> Adam and I thank you all ... a lot  We are now 100% operational using 1 USB
> stick to update all versions of XO.  We will add some more exception
> handling and 1.75 specifics to the procedures once we return to Canada, but
> the combination of OOB 4.1 and the olpc.fth boot are making the frequent
> process of updating/enhancing things while here in Kenya just fly!!!
>
> Cheers,
>
> KG

Can you post it some place when done?

Sameer

>
> On Tue, Jun 12, 2012 at 8:00 PM, James Cameron <quozl at laptop.org> wrote:
>>
>> On Tue, Jun 12, 2012 at 11:08:29AM -0400, Kevin Gordon wrote:
>> > Disclaimer:  Newbie Forth question ....:-)
>>
>> Always welcome.
>>
>> > We are trying to create a consolidated unsecured update stick.
>>
>> I worked on a secured update drive last week, so the techniques are on
>> my mind.
>>
>> > [...]
>> > So for those coming from a non-Forth background, we have hit a road
>> > block. Is there perhaps a way to store a 'possible' command into a
>> > variable then execute that 'variable' as a command, thereby perhaps
>> > bypassing any of the apparent syntax error checking?  Unexpected
>> > end-of-line is the most common result from attempting to call within
>> > an if statement.  Or, we get copy-nand? on the 1.5 or fs-update? on
>> > the 1.0 when the command exists in the source - whether it will
>> > actually get 'called' or not ,based on the variable containing the
>> > machine type..
>>
>> evaluate or eval is a word that expects a string descriptor on the
>> stack, and then executes the string as if it were typed.
>>
>> : eval  ( adr len -- )  ...  ;
>>
>> For example:
>>
>>        ok " 8 ." eval
>>        8
>>        ok
>>
>> or
>>
>>        : install-xo-1  " copy-nand u:\fs.img"  eval  ;
>>
>> The string can be assembled from pieces rather than from literals.
>> You may find an example of that in the power log collector on the
>> wiki, which assembles filenames.
>>
>> If there is a possibility that the evaluated command may fail, you
>> should catch the exception and handle it.  Use catch for that.
>>
>> Good reference for catch and throw:
>> http://www.complang.tuwien.ac.at/anton/euroforth/ef98/milendorf98.pdf
>>
>> For example:
>>
>> : install-xo-1
>>   " copy-nand u:\fs.img"      ( adr len )
>>   ['] eval                    ( adr len 'eval )
>>   catch                       ( ??? ??? exception# | 0 )
>>   if                          ( ??? ??? )
>>      2drop                    ( )
>>      ." copy-nand failed, press any key" key drop
>>   then                        ( )
>> ;
>>
>> You might also place the exception handler higher up.
>>
>> We also have $fs-update in later XO-1.5 and XO-1.75 versions, so that
>> eval is not needed.  There is no $copy-nand .
>>
>> --
>> James Cameron
>> http://quozl.linux.org.au/
>
>
>
> _______________________________________________
> Devel mailing list
> Devel at lists.laptop.org
> http://lists.laptop.org/listinfo/devel
>



More information about the Devel mailing list