Author: stepan Date: Mon Apr 26 15:06:48 2010 New Revision: 753 URL: http://tracker.coreboot.org/trac/openbios/changeset/753
Log: This is toke / detok update from Matthias Kapffer:
- display-status is obsolete - fix the three broken examples under toke/examples - drop calls to non-existent distclean
Modified: trunk/fcode-utils-devel/Makefile trunk/fcode-utils-devel/detok/Makefile trunk/fcode-utils-devel/detok/dictionary.c trunk/fcode-utils-devel/toke/Makefile trunk/fcode-utils-devel/toke/dictionary.c trunk/fcode-utils-devel/toke/examples/date.fs trunk/fcode-utils-devel/toke/examples/scsi-sample/overall.fs trunk/fcode-utils-devel/toke/examples/scsi-sample/scsitape.fs
Modified: trunk/fcode-utils-devel/Makefile ============================================================================== --- trunk/fcode-utils-devel/Makefile Sun Apr 25 14:53:39 2010 (r752) +++ trunk/fcode-utils-devel/Makefile Mon Apr 26 15:06:48 2010 (r753) @@ -40,9 +40,6 @@ $(MAKE) -C testsuite clean
distclean: clean - $(MAKE) -C toke distclean - $(MAKE) -C detok distclean - $(MAKE) -C romheaders distclean $(MAKE) -C testsuite distclean find . -name "*.gcda" -exec rm -f {} ; find . -name "*.gcno" -exec rm -f {} ;
Modified: trunk/fcode-utils-devel/detok/Makefile ============================================================================== --- trunk/fcode-utils-devel/detok/Makefile Sun Apr 25 14:53:39 2010 (r752) +++ trunk/fcode-utils-devel/detok/Makefile Mon Apr 26 15:06:48 2010 (r753) @@ -52,11 +52,11 @@ clean: rm -f $(OBJS) *~ rm -f $(PROGRAM) .dependencies - + .dependencies: *.c @$(CC) $(CFLAGS) $(INCLUDES) -MM *.c > .dependencies
-.PHONY: all clean distclean +.PHONY: all clean
-include .dependencies
Modified: trunk/fcode-utils-devel/detok/dictionary.c ============================================================================== --- trunk/fcode-utils-devel/detok/dictionary.c Sun Apr 25 14:53:39 2010 (r752) +++ trunk/fcode-utils-devel/detok/dictionary.c Mon Apr 26 15:06:48 2010 (r753) @@ -361,7 +361,7 @@ TOKEN_ENTRY(0x0da, "get-token"), TOKEN_ENTRY(0x0db, "set-token"), TOKEN_ENTRY(0x0dc, "state"), - TOKEN_ENTRY(0x0dd, "compile"), + TOKEN_ENTRY(0x0dd, "compile,"), TOKEN_ENTRY(0x0de, "behavior"), TOKEN_ENTRY(0x0f0, "start0"), TOKEN_ENTRY(0x0f1, "start1"),
Modified: trunk/fcode-utils-devel/toke/Makefile ============================================================================== --- trunk/fcode-utils-devel/toke/Makefile Sun Apr 25 14:53:39 2010 (r752) +++ trunk/fcode-utils-devel/toke/Makefile Mon Apr 26 15:06:48 2010 (r753) @@ -60,7 +60,7 @@ documentation:: *.c *.h toke.doxygen @doxygen toke.doxygen
-.PHONY: all clean distclean +.PHONY: all clean
-include .dependencies
Modified: trunk/fcode-utils-devel/toke/dictionary.c ============================================================================== --- trunk/fcode-utils-devel/toke/dictionary.c Sun Apr 25 14:53:39 2010 (r752) +++ trunk/fcode-utils-devel/toke/dictionary.c Mon Apr 26 15:06:48 2010 (r753) @@ -1119,7 +1119,7 @@ BUILTIN_FCODE( 0x0da, "get-token" ) , BUILTIN_FCODE( 0x0db, "set-token" ) , BI_FCODE_VRBLE( 0x0dc, "state" ) , - BUILTIN_FCODE( 0x0dd, "compile" ) , + BUILTIN_FCODE( 0x0dd, "compile," ) , BUILTIN_FCODE( 0x0de, "behavior" ) , BUILTIN_FCODE( 0x0f0, "start0" ) , BUILTIN_FCODE( 0x0f1, "start1" ) , @@ -1160,7 +1160,7 @@ BUILTIN_FCODE( 0x11e, "is-selftest" ) , BUILTIN_FCODE( 0x11f, "new-device" ) , BUILTIN_FCODE( 0x120, "diagnostic-mode?" ) , - BUILTIN_FCODE( 0x121, "display-status" ) , + OBSOLETE_FCODE( 0x121, "display-status" ) , BUILTIN_FCODE( 0x122, "memory-test-issue" ) , OBSOLETE_FCODE( 0x123, "group-code" ) , BI_FCODE_VRBLE( 0x124, "mask" ) ,
Modified: trunk/fcode-utils-devel/toke/examples/date.fs ============================================================================== --- trunk/fcode-utils-devel/toke/examples/date.fs Sun Apr 25 14:53:39 2010 (r752) +++ trunk/fcode-utils-devel/toke/examples/date.fs Mon Apr 26 15:06:48 2010 (r753) @@ -2,8 +2,8 @@
fcode-version2 ." This program was tokenized on " - fcode-date type + [fcode-date] type ." at " - fcode-time type + [fcode-time] type fcode-end
Modified: trunk/fcode-utils-devel/toke/examples/scsi-sample/overall.fs ============================================================================== --- trunk/fcode-utils-devel/toke/examples/scsi-sample/overall.fs Sun Apr 25 14:53:39 2010 (r752) +++ trunk/fcode-utils-devel/toke/examples/scsi-sample/overall.fs Mon Apr 26 15:06:48 2010 (r753) @@ -1,5 +1,6 @@ \ FCode driver for hypothetical SCSI host adapter
+fcode-version2 hex " XYZI,scsi" name \ Name of device node " XYZI,12346-01" model \ Manufacturer's model number
Modified: trunk/fcode-utils-devel/toke/examples/scsi-sample/scsitape.fs ============================================================================== --- trunk/fcode-utils-devel/toke/examples/scsi-sample/scsitape.fs Sun Apr 25 14:53:39 2010 (r752) +++ trunk/fcode-utils-devel/toke/examples/scsi-sample/scsitape.fs Mon Apr 26 15:06:48 2010 (r753) @@ -111,9 +111,9 @@ 0 false ( 0 false ) else \ Decode status buffer ( xstatbuf ) >r #requested ( #requested ) ( r: xstatbuf ) - r@ ili? r@ eof? or if ( #requested ) ( r: xstatbuf - r@ residue - ( #xfered ) ( r: xstatbuf - then ( #xfered ) ( r: xstatbuf + r@ ili? r@ eof? or if ( #requested ) ( r: xstatbuf ) + r@ residue - ( #xfered ) ( r: xstatbuf ) + then ( #xfered ) ( r: xstatbuf ) r> eof? ( #xfered flag ) then else \ no error, #request = #xfered ( )
repository service wrote:
Author: stepan Date: Mon Apr 26 15:06:48 2010 New Revision: 753 URL: http://tracker.coreboot.org/trac/openbios/changeset/753
Log: This is toke / detok update from Matthias Kapffer:
- display-status is obsolete
- fix the three broken examples under toke/examples
- drop calls to non-existent distclean
Oh that's interesting - I didn't realise people were still working on this. In that case, here's another quick bug report I noticed whilst playing with the Fcode test cases last year:
1) Create a file test.fth containing the following: 12a u.
2) Confirm it works with openbios-unix openbios-unix < test.fth
Welcome to OpenBIOS v1.0 built on Apr 26 2010 14:09 Type 'help' for detailed information
[unix] Booting default not supported.
0 > 12a u. 12a ok
3) Now try and run it through toke
./toke/toke test.fth Welcome to toke - OpenBIOS tokenizer v1.0.2 (C) Copyright 2001-2006 Stefan Reinauer. (C) Copyright 2006 coresystems GmbH info@coresystems.de (C) Copyright 2005 IBM Corporation. All Rights Reserved. This program is free software; you may redistribute it under the terms of the GNU General Public License v2. This program has absolutely no warranty.
Tokenizing test.fth Binary output to test.fc Error: File test.fth, Line 1. Word 12a is not in dictionary. Tokenization Completed. 1 Error. Suppressing binary output.
4) Hmmm. Alter test.fth so it reads the following: 129 u.
5) Run it through toke again:
./toke/toke test.fth Welcome to toke - OpenBIOS tokenizer v1.0.2 (C) Copyright 2001-2006 Stefan Reinauer. (C) Copyright 2006 coresystems GmbH info@coresystems.de (C) Copyright 2005 IBM Corporation. All Rights Reserved. This program is free software; you may redistribute it under the terms of the GNU General Public License v2. This program has absolutely no warranty.
Tokenizing test.fth Binary output to test.fc Tokenization Completed. toke: wrote 6 bytes to bytecode file 'test.fc'
6) It works! And now run the output back through detok:
./detok/detok test.fc
\ Invalid FCode Start Byte. Ignoring FCode header. b(lit) 0x81 u. \ FCode-ender not found \ Detokenization finished normally after 6 bytes. Unexpected end of file.
So it seems that while openbios-unix reads/writes numbers in hex, toke/detok will only read/write numbers in decimal.
ATB,
Mark.
On 4/26/10 5:00 PM, Mark Cave-Ayland wrote:
This is toke / detok update from Matthias Kapffer:
- display-status is obsolete
- fix the three broken examples under toke/examples
- drop calls to non-existent distclean
Oh that's interesting - I didn't realise people were still working on this. In that case, here's another quick bug report I noticed whilst playing with the Fcode test cases last year:
It's quite actively developed actually, the last patch was sent only in February. ;-)
So it seems that while openbios-unix reads/writes numbers in hex, toke/detok will only read/write numbers in decimal.
toke merely defaults to decimal whereas openbios defaults to hex.
You can get one or the other by using the word "hex" or "decimal" in your code before using any numbers. This is strongly recommended in order to keep code portable.
Now, the question is: should we change the default to "hex" in toke?
Stefan
Stefan Reinauer wrote:
toke merely defaults to decimal whereas openbios defaults to hex.
You can get one or the other by using the word "hex" or "decimal" in your code before using any numbers. This is strongly recommended in order to keep code portable.
Now, the question is: should we change the default to "hex" in toke?
I think the default should match what is in the OF spec, whether that be decimal or hex, and all of openbios/tok/detok should agree. I know was bitten in my Fcode work several times when copy/pasting examples between an openbios-unix session and a test file I was attempting to run through toke.
ATB,
Mark.