|
Revision 1, 0.6 kB
(checked in by krobillard, 3 years ago)
|
|
Import orca & thune.
|
| Line | |
|---|
| 1 | ; Purpose: {Creates C include for boot script.} |
|---|
| 2 | |
|---|
| 3 | |
|---|
| 4 | do %boot.r |
|---|
| 5 | |
|---|
| 6 | if exists? %func.r [ append boot load %func.r ] |
|---|
| 7 | |
|---|
| 8 | block_to_c: func [blk cvar /local str] [ |
|---|
| 9 | blk: to-binary blk |
|---|
| 10 | ;probe blk |
|---|
| 11 | str: make string! 1024 |
|---|
| 12 | |
|---|
| 13 | append out rejoin ["static unsigned char " cvar "[] =^/{"] |
|---|
| 14 | forall blk [ |
|---|
| 15 | if (15 and index? blk) = 1 [ |
|---|
| 16 | append out "^/ " |
|---|
| 17 | ] |
|---|
| 18 | append out rejoin [{ } blk/1 {,}] |
|---|
| 19 | ] |
|---|
| 20 | remove back tail out |
|---|
| 21 | append out "^/};^/^/" |
|---|
| 22 | ] |
|---|
| 23 | |
|---|
| 24 | |
|---|
| 25 | out: {// Automatically created by boot_bin.r^/^/#define BOOT_BYTECODE 1^/^/} |
|---|
| 26 | |
|---|
| 27 | block_to_c natives "_natives" |
|---|
| 28 | block_to_c boot "_boot" |
|---|
| 29 | |
|---|
| 30 | write %boot.c out |
|---|
| 31 | |
|---|
| 32 | |
|---|
| 33 | ;eof |
|---|