Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
dev:scripting:start [2008/07/18 09:07] stefanha |
dev:scripting:start [2009/05/22 13:32] (current) stefanha |
||
|---|---|---|---|
| Line 16: | Line 16: | ||
| </code> | </code> | ||
| - | We need variable expansion: | + | Variable expansion is already available in mainline gPXE: |
| <code> | <code> | ||
| dhcp ${my_iface} | dhcp ${my_iface} | ||
| Line 32: | Line 32: | ||
| Standard arithmetic operators should work for integral types: | Standard arithmetic operators should work for integral types: | ||
| <code> | <code> | ||
| - | set i ${i + 1} | + | set i ${(i / 2 + 1) * 2} |
| - | # same for -, *, / | + | |
| </code> | </code> | ||
| - | Bitwise operators ''|'', ''&'', ''^'', and ''~'' may be needed? | + | The operators are: ''+'', ''-'', ''*'', ''/'', ''%'', ''('', and '')''. |
| === String manipulation === | === String manipulation === | ||
| - | TODO | + | The format string built-in function allows string concatentation and formatting: |
| + | <code> | ||
| + | set net0/ip ${fmt("%d.%d.%d.%d", 192, 168, 0, 10 + host_num)} | ||
| + | </code> | ||
| === Comparison and logic === | === Comparison and logic === | ||
| Line 68: | Line 70: | ||
| === Needs discussion === | === Needs discussion === | ||
| * We probably need an exit code built-in variable like ''$?'' in POSIX shell. | * We probably need an exit code built-in variable like ''$?'' in POSIX shell. | ||
| + | * Bitwise operators ''|'', ''&'', ''^'', ''~'', ''<<'', and ''>>'' may be needed. | ||
| + | * Focus needs to be on what we can leave out rather than what to add. | ||
| * More use cases so we know what users need. | * More use cases so we know what users need. | ||
| === Links === | === Links === | ||
| + | * [[http://bellard.org/otcc/|Obfuscated Tiny C Compiler]] | ||
| * [[http://www.nicholson.com/rhn/files/dds_basic.c|TINY obfuscated C BASIC interpreter]] | * [[http://www.nicholson.com/rhn/files/dds_basic.c|TINY obfuscated C BASIC interpreter]] | ||
| + | * [[http://www.ittybittycomputers.com/IttyBitty/TinyBasic/TinyBasic.c|TinyBasic]] | ||
| + | * [[http://www.personal.leeds.ac.uk/~bgy1mm/Minibasic/basic.c|Mini BASIC]] | ||