Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Amos Wenger
committed
Jun 20, 2012
1 parent
2ff576c
commit 74bffc1
Showing
6 changed files
with
105 additions
and
20 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
|
||
// primitive type | ||
answer := identity(42) | ||
|
||
// object type | ||
identity("foobar") println() |
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 @@ | ||
typedef uint8_t *Any; | ||
|
||
void identity(Class *T, Any value, Any ret) { | ||
if (ret) { | ||
memcpy(ret, value, T->size) | ||
} | ||
} |
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,4 @@ | ||
/* what is the generic version of this? */ | ||
int identity(int value) { | ||
return value; | ||
} |
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 |
---|---|---|
@@ -1,13 +1,13 @@ | ||
Logger: class { | ||
Logger: class extends Formatter { | ||
level: Level | ||
out: Stream | ||
|
||
init: func (=out) { | ||
level = Level INFO | ||
} | ||
|
||
log: func (msg, level = Level INFO) { | ||
log: func (msg: String, level: Level) { | ||
if (level <= this level) | ||
format(msg) | ||
out print(format(msg)) | ||
} | ||
} |
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
void somefunc(uint8_t value) { | ||
void somefunc(uint8_t *value) { | ||
int i = *((int*) value); | ||
// do something with i | ||
} |
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