Last change
on this file since b28ce93 was b28ce93, checked in by Michael Brooks <mlbrooks@…>, 3 months ago |
Add POC illustrating generating headers from compile units
|
-
Property mode
set to
100644
|
File size:
585 bytes
|
Rev | Line | |
---|
[b28ce93] | 1 | #import auto & egg
|
---|
| 2 |
|
---|
| 3 |
|
---|
| 4 | //# @
|
---|
| 5 | struct chicken {
|
---|
| 6 | struct egg * hatchedFrom;
|
---|
| 7 | };
|
---|
| 8 |
|
---|
| 9 | //# $f
|
---|
| 10 | void ctor_chicken( struct chicken * this, struct egg * hatchedFrom ) { // probably autogen
|
---|
| 11 | this->hatchedFrom = hatchedFrom; // ctor_pointer$
|
---|
| 12 | }
|
---|
| 13 |
|
---|
| 14 | //# $f
|
---|
| 15 | void live( struct chicken * this ) {
|
---|
| 16 | int printf( const char *, ... ); // scaffold
|
---|
| 17 | void exit( int );
|
---|
| 18 |
|
---|
| 19 | // scaffold
|
---|
| 20 | static int calls = 0;
|
---|
| 21 | if ((calls += 1) > 10) exit(0);
|
---|
| 22 |
|
---|
| 23 | printf( "chicken %p hatched from egg %p\n", this, this->hatchedFrom );
|
---|
| 24 | struct egg laid; // not a pointer
|
---|
| 25 | ctor_egg( & laid, this );
|
---|
| 26 | hatch( & laid );
|
---|
| 27 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.