source:
CIVL/examples/languageFeatures/bundleStructComponent.cvl@
38b7d06
| Last change on this file since 38b7d06 was b95df30, checked in by , 13 years ago | |
|---|---|
|
|
| File size: 332 bytes | |
| Line | |
|---|---|
| 1 | #include <civlc.h> |
| 2 | |
| 3 | typedef struct foo { |
| 4 | int a[5]; |
| 5 | int b; |
| 6 | } foo; |
| 7 | |
| 8 | void main() { |
| 9 | int c[6]; |
| 10 | foo s; |
| 11 | $bundle bun; |
| 12 | |
| 13 | for (int i = 0; i < 5; i++) { |
| 14 | s.a[i] = i*i; |
| 15 | } |
| 16 | s.b = 25; |
| 17 | bun = $bundle_pack(&(s.a), 6*sizeof(int)); // There may be padding, so this should fail. |
| 18 | $bundle_unpack(bun, &c); |
| 19 | $assert c[5] == 25; |
| 20 | } |
Note:
See TracBrowser
for help on using the repository browser.
