|
Revision 1, 0.6 kB
(checked in by krobillard, 3 years ago)
|
|
Import orca & thune.
|
| Line | |
|---|
| 1 | REBOL [ |
|---|
| 2 | Purpose: {Creates C include for boot script.} |
|---|
| 3 | ] |
|---|
| 4 | |
|---|
| 5 | |
|---|
| 6 | do %boot.r |
|---|
| 7 | |
|---|
| 8 | if exists? %func.r [ append boot load %func.r ] |
|---|
| 9 | |
|---|
| 10 | block_to_c: func [blk cvar /local str] [ |
|---|
| 11 | str: mold blk |
|---|
| 12 | remove back tail str |
|---|
| 13 | str: trim/auto skip str 2 |
|---|
| 14 | |
|---|
| 15 | append out rejoin [{static char } cvar {[] =^/}] |
|---|
| 16 | |
|---|
| 17 | blk: parse/all str "^/" |
|---|
| 18 | forall blk [ |
|---|
| 19 | str: blk/1 |
|---|
| 20 | replace/all str {\} {\\} |
|---|
| 21 | replace/all str {"} {\"} |
|---|
| 22 | append out rejoin [{ "} str {\n"^/}] |
|---|
| 23 | ] |
|---|
| 24 | |
|---|
| 25 | append out ";^/^/" |
|---|
| 26 | ] |
|---|
| 27 | |
|---|
| 28 | |
|---|
| 29 | out: {// Automatically created by boot.r^/^/} |
|---|
| 30 | |
|---|
| 31 | block_to_c natives "_natives" |
|---|
| 32 | block_to_c boot "_boot" |
|---|
| 33 | |
|---|
| 34 | write %boot.c out |
|---|
| 35 | |
|---|
| 36 | |
|---|
| 37 | ;eof |
|---|