1*7c3d14c8STreehugger Robot // 2*7c3d14c8STreehugger Robot // The LLVM Compiler Infrastructure 3*7c3d14c8STreehugger Robot // 4*7c3d14c8STreehugger Robot // This file is distributed under the University of Illinois Open Source 5*7c3d14c8STreehugger Robot // License. See LICENSE.TXT for details. 6*7c3d14c8STreehugger Robot 7*7c3d14c8STreehugger Robot // 8*7c3d14c8STreehugger Robot // nestedimport.m 9*7c3d14c8STreehugger Robot // testObjects 10*7c3d14c8STreehugger Robot // 11*7c3d14c8STreehugger Robot // Created by Blaine Garst on 6/24/08. 12*7c3d14c8STreehugger Robot // 13*7c3d14c8STreehugger Robot // pure C nothing more needed 14*7c3d14c8STreehugger Robot // CONFIG 15*7c3d14c8STreehugger Robot 16*7c3d14c8STreehugger Robot 17*7c3d14c8STreehugger Robot #include <stdio.h> 18*7c3d14c8STreehugger Robot #include <stdlib.h> 19*7c3d14c8STreehugger Robot 20*7c3d14c8STreehugger Robot 21*7c3d14c8STreehugger Robot int Global = 0; 22*7c3d14c8STreehugger Robot 23*7c3d14c8STreehugger Robot void callVoidVoid(void (^closure)(void)) { 24*7c3d14c8STreehugger Robot closure(); 25*7c3d14c8STreehugger Robot } 26*7c3d14c8STreehugger Robot main(int argc,char * argv[])27*7c3d14c8STreehugger Robotint main(int argc, char *argv[]) { 28*7c3d14c8STreehugger Robot int i = 1; 29*7c3d14c8STreehugger Robot 30*7c3d14c8STreehugger Robot void (^vv)(void) = ^{ 31*7c3d14c8STreehugger Robot if (argc > 0) { 32*7c3d14c8STreehugger Robot callVoidVoid(^{ Global = i; }); 33*7c3d14c8STreehugger Robot } 34*7c3d14c8STreehugger Robot }; 35*7c3d14c8STreehugger Robot 36*7c3d14c8STreehugger Robot i = 2; 37*7c3d14c8STreehugger Robot vv(); 38*7c3d14c8STreehugger Robot if (Global != 1) { 39*7c3d14c8STreehugger Robot printf("%s: error, Global not set to captured value\n", argv[0]); 40*7c3d14c8STreehugger Robot exit(1); 41*7c3d14c8STreehugger Robot } 42*7c3d14c8STreehugger Robot printf("%s: success\n", argv[0]); 43*7c3d14c8STreehugger Robot return 0; 44*7c3d14c8STreehugger Robot } 45