-
Notifications
You must be signed in to change notification settings - Fork 133
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add callback_on_instantiate chugins API
- Loading branch information
Showing
12 changed files
with
239 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// test nested sporking, and accessing file-scope vars from | ||
// nested sporked member function | ||
|
||
// accessing this var | ||
5 => int a; | ||
|
||
// a (non-public) class | ||
// (public classes wouldn't be able to access file-scope vars) | ||
class Foo | ||
{ | ||
// a member function | ||
fun void update( float dt ) | ||
{ | ||
while( true ) | ||
{ | ||
// access global-scope var a | ||
a++; | ||
<<< a, dt >>>; | ||
// advance time | ||
200::ms => now; | ||
} | ||
} | ||
|
||
fun void go() | ||
{ | ||
// spork | ||
spork ~ this.update(2); | ||
// wait a long time (until the parent shred is done) | ||
eon => now; | ||
} | ||
} | ||
|
||
// instantiate a Foo | ||
Foo foo; | ||
// call go | ||
spork ~ foo.go(); | ||
// let time pass | ||
2.1::second => now; | ||
// (should remove child and grandchild shreds as this shred exits) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
6 2.000000 | ||
7 2.000000 | ||
8 2.000000 | ||
9 2.000000 | ||
10 2.000000 | ||
11 2.000000 | ||
12 2.000000 | ||
13 2.000000 | ||
14 2.000000 | ||
15 2.000000 | ||
16 2.000000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// test basic numerical type literals | ||
|
||
// int | ||
<<< 1 >>>; | ||
// float | ||
<<< 2.0 >>>; | ||
// complex | ||
<<< #(3,4) >>>; | ||
// polar | ||
<<< %(1,pi/2) >>>; | ||
// vec3 | ||
<<< @(5,6,7) >>>; | ||
// vec4 | ||
<<< @(5,6,7,8) >>>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
1 :(int) | ||
2.000000 :(float) | ||
#(3.0000,4.0000) :(complex) | ||
%(1.0000,0.5000*pi) :(polar) | ||
@(5.0000,6.0000,7.0000) :(vec3) | ||
@(5.0000,6.0000,7.0000,8.0000) :(vec4) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// error case using a global-scope var before declaration | ||
|
||
// the use | ||
<<< a >>>; | ||
|
||
// the decl | ||
int a; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
error-depend-var2.ck:4:5: error: variable/member 'a' is used before declaration | ||
[4] <<< a >>>; | ||
^ |