Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Merge branch 'nom' into newio
- Loading branch information
Showing
10 changed files
with
247 additions
and
67 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -539,4 +539,4 @@ the rest of the tests are skipped. | |
| =end pod | ||
|
|
||
| # vim: ft=perl6 | ||
| # vim: expandtab shiftwidth=4 ft=perl6 | ||
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,62 @@ | ||
| #ifdef WIN32 | ||
| #define DLLEXPORT __declspec(dllexport) | ||
| #else | ||
| #define DLLEXPORT extern | ||
| #endif | ||
|
|
||
| typedef struct { | ||
| char foo1; | ||
| int foo2; | ||
| short foo3; | ||
| short foo4; | ||
| } Foo; | ||
|
|
||
| typedef struct { | ||
| char bar1; | ||
| short bar2; | ||
| char bar3; | ||
| int bar4; | ||
| short bar5; | ||
| } Bar; | ||
|
|
||
| typedef struct { | ||
| char bar1; | ||
| short bar2; | ||
| char bar3; | ||
| int bar4; | ||
| short bar5; | ||
| long baz6; | ||
| int bar7; | ||
| } Baz; | ||
|
|
||
| typedef struct { | ||
| char buz1; | ||
| } Buz; | ||
|
|
||
| DLLEXPORT int SizeofFoo() { | ||
| return sizeof(Foo); | ||
| } | ||
|
|
||
| DLLEXPORT int SizeofBar() { | ||
| return sizeof(Bar); | ||
| } | ||
|
|
||
| DLLEXPORT int SizeofBaz() { | ||
| return sizeof(Baz); | ||
| } | ||
|
|
||
| DLLEXPORT int SizeofBuz() { | ||
| return sizeof(Buz); | ||
| } | ||
|
|
||
| DLLEXPORT int SizeofInt() { | ||
| return sizeof(int); | ||
| } | ||
|
|
||
| DLLEXPORT int SizeofLng() { | ||
| return sizeof(long); | ||
| } | ||
|
|
||
| DLLEXPORT int SizeofPtr() { | ||
| return sizeof(void *); | ||
| } |
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,54 @@ | ||
| use lib 't/04-nativecall'; | ||
| use CompileTestLib; | ||
| use lib 'lib'; | ||
| use NativeCall; | ||
| use Test; | ||
|
|
||
| plan 7; | ||
|
|
||
| compile_test_lib('12-sizeof'); | ||
|
|
||
| class Foo is repr<CStruct> { | ||
| has int8 $.foo1; | ||
| has int32 $.foo2; | ||
| has int16 $.foo3; | ||
| has int16 $.foo4; | ||
| } | ||
|
|
||
| class Bar is repr<CStruct> { | ||
| has int8 $.bar1; | ||
| has int16 $.bar2; | ||
| has int8 $.bar3; | ||
| has int32 $.bar4; | ||
| has int16 $.bar5; | ||
| } | ||
|
|
||
| class Baz is repr<CStruct> { | ||
| has int8 $.bar1; | ||
| has int16 $.bar2; | ||
| has int8 $.bar3; | ||
| has int32 $.bar4; | ||
| has int16 $.bar5; | ||
| has long $.bar6; | ||
| has int32 $.bar7; | ||
| } | ||
|
|
||
| class Buz is repr<CStruct> { | ||
| has int8 $.bar1; | ||
| } | ||
|
|
||
| sub SizeofFoo() returns int32 is native('./12-sizeof') { * } | ||
| sub SizeofBar() returns int32 is native('./12-sizeof') { * } | ||
| sub SizeofBaz() returns int32 is native('./12-sizeof') { * } | ||
| sub SizeofBuz() returns int32 is native('./12-sizeof') { * } | ||
| sub SizeofInt() returns int32 is native('./12-sizeof') { * } | ||
| sub SizeofLng() returns int32 is native('./12-sizeof') { * } | ||
| sub SizeofPtr() returns int32 is native('./12-sizeof') { * } | ||
|
|
||
| is nativesizeof(Foo), SizeofFoo(), 'sizeof(Foo)'; | ||
| is nativesizeof(Bar), SizeofBar(), 'sizeof(Bar)'; | ||
| is nativesizeof(Baz), SizeofBaz(), 'sizeof(Baz)'; | ||
| is nativesizeof(Buz), SizeofBuz(), 'sizeof(Buz)'; | ||
| is nativesizeof(int32), SizeofInt(), 'sizeof(int)'; | ||
| is nativesizeof(long), SizeofLng(), 'sizeof(long)'; | ||
| is nativesizeof(OpaquePointer), SizeofPtr(), 'sizeof(void *)'; |
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 +1 @@ | ||
| 2015.02 | ||
| 2015.02-9-g0e62590 |