]>
Commit | Line | Data |
---|---|---|
1a4d82fc JJ |
1 | // |
2 | // The LLVM Compiler Infrastructure | |
3 | // | |
4 | // This file is distributed under the University of Illinois Open Source | |
5 | // License. See LICENSE.TXT for details. | |
6 | ||
7 | /* | |
8 | * blockimport.c | |
9 | * testObjects | |
10 | * | |
11 | * Created by Blaine Garst on 10/13/08. | |
12 | * | |
13 | */ | |
14 | ||
15 | ||
16 | // | |
17 | // pure C nothing more needed | |
18 | // CONFIG rdar://6289344 | |
19 | ||
20 | #include <stdio.h> | |
21 | #include <Block.h> | |
22 | #include <Block_private.h> | |
23 | ||
24 | ||
25 | ||
26 | ||
27 | int main(int argc, char *argv[]) { | |
28 | int i = 1; | |
29 | int (^intblock)(void) = ^{ return i*10; }; | |
30 | ||
31 | void (^vv)(void) = ^{ | |
32 | if (argc > 0) { | |
33 | printf("intblock returns %d\n", intblock()); | |
34 | } | |
35 | }; | |
36 | ||
37 | #if 0 | |
38 | //printf("Block dump %s\n", _Block_dump(vv)); | |
39 | { | |
40 | struct Block_layout *layout = (struct Block_layout *)(void *)vv; | |
41 | printf("isa %p\n", layout->isa); | |
42 | printf("flags %x\n", layout->flags); | |
43 | printf("descriptor %p\n", layout->descriptor); | |
44 | printf("descriptor->size %d\n", layout->descriptor->size); | |
45 | } | |
46 | #endif | |
47 | void (^vvcopy)(void) = Block_copy(vv); | |
48 | Block_release(vvcopy); | |
49 | printf("%s: success\n", argv[0]); | |
50 | return 0; | |
51 | } |