This is how BridgeSupport generates XML descriptions of a framework : it collects the framework's structures, methods, enums and generates C files to get their Type Encodings, parses the output, and stores the result in a .bridgesupport
file. This renders C functions, enums and structures usable in any language once you add some bridging code. This is how RubyCocoa can access the system's frameworks.
Below is a log of BridgeSupport describing QuartzCore
, called with :
gen_bridge_metadata.rb -f /System/Library/Frameworks/QuartzCore.framework -c '-framework QuartzCore -F/System/Library/Frameworks/QuartzCore.framework'
.
(Some logging code added in gen_bridge_metadata.rb
's compile_and_execute_code
to display generated code and its output).
**************** Generated Code **************** int main (void) { printf("%s -> %s\n", "CFTimeInterval", @encode(CFTimeInterval)); printf("%s -> %s\n", "_Bool", @encode(_Bool)); printf("%s -> %s\n", "CATransform3D", @encode(CATransform3D)); printf("%s -> %s\n", "CGFloat", @encode(CGFloat)); printf("%s -> %s\n", "CGAffineTransform", @encode(CGAffineTransform)); printf("%s -> %s\n", "CVBufferRef", @encode(CVBufferRef)); printf("%s -> %s\n", "void", @encode(void)); printf("%s -> %s\n", "CFStringRef", @encode(CFStringRef)); printf("%s -> %s\n", "CFTypeRef", @encode(CFTypeRef)); printf("%s -> %s\n", "CVAttachmentMode", @encode(CVAttachmentMode)); printf("%s -> %s\n", "CVAttachmentMode *", @encode(CVAttachmentMode *)); printf("%s -> %s\n", "CFDictionaryRef", @encode(CFDictionaryRef)); printf("%s -> %s\n", "CFTypeID", @encode(CFTypeID)); printf("%s -> %s\n", "CVReturn", @encode(CVReturn)); printf("%s -> %s\n", "CGDirectDisplayID *", @encode(CGDirectDisplayID *)); printf("%s -> %s\n", "CFIndex", @encode(CFIndex)); printf("%s -> %s\n", "CVDisplayLinkRef *", @encode(CVDisplayLinkRef *)); printf("%s -> %s\n", "CGOpenGLDisplayMask", @encode(CGOpenGLDisplayMask)); printf("%s -> %s\n", "CGDirectDisplayID", @encode(CGDirectDisplayID)); printf("%s -> %s\n", "CVDisplayLinkRef", @encode(CVDisplayLinkRef)); printf("%s -> %s\n", "CGLContextObj", @encode(CGLContextObj)); printf("%s -> %s\n", "CGLPixelFormatObj", @encode(CGLPixelFormatObj)); printf("%s -> %s\n", "CVDisplayLinkOutputCallback", @encode(CVDisplayLinkOutputCallback)); printf("%s -> %s\n", "void *", @encode(void *)); printf("%s -> %s\n", "CVTime", @encode(CVTime)); printf("%s -> %s\n", "double", @encode(double)); printf("%s -> %s\n", "Boolean", @encode(Boolean)); printf("%s -> %s\n", "CVTimeStamp *", @encode(CVTimeStamp *)); printf("%s -> %s\n", "uint64_t", @encode(uint64_t)); printf("%s -> %s\n", "uint32_t", @encode(uint32_t)); printf("%s -> %s\n", "CGSize", @encode(CGSize)); printf("%s -> %s\n", "CVImageBufferRef", @encode(CVImageBufferRef)); printf("%s -> %s\n", "CGRect", @encode(CGRect)); printf("%s -> %s\n", "CGColorSpaceRef", @encode(CGColorSpaceRef)); printf("%s -> %s\n", "CVOpenGLBufferRef", @encode(CVOpenGLBufferRef)); printf("%s -> %s\n", "CFAllocatorRef", @encode(CFAllocatorRef)); printf("%s -> %s\n", "size_t", @encode(size_t)); printf("%s -> %s\n", "CVOpenGLBufferRef *", @encode(CVOpenGLBufferRef *)); printf("%s -> %s\n", "GLenum", @encode(GLenum)); printf("%s -> %s\n", "GLint", @encode(GLint)); printf("%s -> %s\n", "CVOpenGLBufferPoolRef", @encode(CVOpenGLBufferPoolRef)); printf("%s -> %s\n", "CVOpenGLBufferPoolRef *", @encode(CVOpenGLBufferPoolRef *)); printf("%s -> %s\n", "CVOpenGLTextureRef", @encode(CVOpenGLTextureRef)); printf("%s -> %s\n", "GLuint", @encode(GLuint)); printf("%s -> %s\n", "GLfloat*", @encode(GLfloat*)); printf("%s -> %s\n", "CVOpenGLTextureCacheRef", @encode(CVOpenGLTextureCacheRef)); printf("%s -> %s\n", "CVOpenGLTextureCacheRef *", @encode(CVOpenGLTextureCacheRef *)); printf("%s -> %s\n", "CVOpenGLTextureRef *", @encode(CVOpenGLTextureRef *)); printf("%s -> %s\n", "CVOptionFlags", @encode(CVOptionFlags)); printf("%s -> %s\n", "CVPixelBufferRef", @encode(CVPixelBufferRef)); printf("%s -> %s\n", "CFArrayRef", @encode(CFArrayRef)); printf("%s -> %s\n", "CFDictionaryRef *", @encode(CFDictionaryRef *)); printf("%s -> %s\n", "OSType", @encode(OSType)); printf("%s -> %s\n", "CVPixelBufferRef *", @encode(CVPixelBufferRef *)); printf("%s -> %s\n", "CVPixelBufferReleaseBytesCallback", @encode(CVPixelBufferReleaseBytesCallback)); printf("%s -> %s\n", "void **", @encode(void **)); printf("%s -> %s\n", "size_t*", @encode(size_t*)); printf("%s -> %s\n", "CVPixelBufferReleasePlanarBytesCallback", @encode(CVPixelBufferReleasePlanarBytesCallback)); printf("%s -> %s\n", "size_t *", @encode(size_t *)); printf("%s -> %s\n", "CVPixelBufferPoolRef", @encode(CVPixelBufferPoolRef)); printf("%s -> %s\n", "CVPixelBufferPoolRef *", @encode(CVPixelBufferPoolRef *)); printf("%s -> %s\n", "NSString *", @encode(NSString *)); printf("%s -> %s\n", "CIFormat", @encode(CIFormat)); printf("%s -> %s\n", "CIColor *", @encode(CIColor *)); printf("%s -> %s\n", "CGColorRef", @encode(CGColorRef)); printf("%s -> %s\n", "id", @encode(id)); printf("%s -> %s\n", "CGFloat *", @encode(CGFloat *)); printf("%s -> %s\n", "CARenderer *", @encode(CARenderer *)); printf("%s -> %s\n", "NSDictionary *", @encode(NSDictionary *)); printf("%s -> %s\n", "float", @encode(float)); printf("%s -> %s\n", "float*", @encode(float*)); printf("%s -> %s\n", "CAConstraint *", @encode(CAConstraint *)); printf("%s -> %s\n", "BOOL", @encode(BOOL)); printf("%s -> %s\n", "CGPoint", @encode(CGPoint)); printf("%s -> %s\n", "CALayer *", @encode(CALayer *)); printf("%s -> %s\n", "unsigned", @encode(unsigned)); printf("%s -> %s\n", "CGContextRef", @encode(CGContextRef)); printf("%s -> %s\n", "unsigned int", @encode(unsigned int)); printf("%s -> %s\n", "CAAnimation *", @encode(CAAnimation *)); printf("%s -> %s\n", "NSArray *", @encode(NSArray *)); printf("%s -> %s\n", "CIImage *", @encode(CIImage *)); printf("%s -> %s\n", "CIKernel *", @encode(CIKernel *)); printf("%s -> %s\n", "CIFilter *", @encode(CIFilter *)); printf("%s -> %s\n", "NSURL *", @encode(NSURL *)); printf("%s -> %s\n", "NSData *", @encode(NSData *)); printf("%s -> %s\n", "CISampler *", @encode(CISampler *)); printf("%s -> %s\n", "CIFilterShape *", @encode(CIFilterShape *)); printf("%s -> %s\n", "CIContext *", @encode(CIContext *)); printf("%s -> %s\n", "CGImageRef", @encode(CGImageRef)); printf("%s -> %s\n", "CGLayerRef", @encode(CGLayerRef)); printf("%s -> %s\n", "ptrdiff_t", @encode(ptrdiff_t)); printf("%s -> %s\n", "int", @encode(int)); printf("%s -> %s\n", "CIFilterGenerator*", @encode(CIFilterGenerator*)); printf("%s -> %s\n", "NSURL*", @encode(NSURL*)); printf("%s -> %s\n", "NSString*", @encode(NSString*)); printf("%s -> %s\n", "NSDictionary*", @encode(NSDictionary*)); printf("%s -> %s\n", "CIFilter*", @encode(CIFilter*)); printf("%s -> %s\n", "void*", @encode(void*)); printf("%s -> %s\n", "CIImageAccumulator *", @encode(CIImageAccumulator *)); printf("%s -> %s\n", "CGPathRef", @encode(CGPathRef)); printf("%s -> %s\n", "SEL", @encode(SEL)); printf("%s -> %s\n", "CIVector *", @encode(CIVector *)); printf("%s -> %s\n", "CAConstraintAttribute", @encode(CAConstraintAttribute)); printf("%s -> %s\n", "CVOptionFlags *", @encode(CVOptionFlags *)); return 0; } ================ Executed Code ================ CFTimeInterval -> d _Bool -> B CATransform3D -> {CATransform3D=ffffffffffffffff} CGFloat -> f CGAffineTransform -> {CGAffineTransform=ffffff} CVBufferRef -> ^{__CVBuffer=} void -> v CFStringRef -> ^{__CFString=} CFTypeRef -> ^v CVAttachmentMode -> I CVAttachmentMode * -> ^I CFDictionaryRef -> ^{__CFDictionary=} CFTypeID -> L CVReturn -> i CGDirectDisplayID * -> ^I CFIndex -> l CVDisplayLinkRef * -> ^^{__CVDisplayLink} CGOpenGLDisplayMask -> I CGDirectDisplayID -> I CVDisplayLinkRef -> ^{__CVDisplayLink=} CGLContextObj -> ^{_CGLContextObject=} CGLPixelFormatObj -> ^{_CGLPixelFormatObject=} CVDisplayLinkOutputCallback -> ^? void * -> ^v CVTime -> {?=qii} double -> d Boolean -> C CVTimeStamp * -> ^{?=IiqQdq{CVSMPTETime=ssIIIssss}QQ} uint64_t -> Q uint32_t -> I CGSize -> {CGSize=ff} CVImageBufferRef -> ^{__CVBuffer=} CGRect -> {CGRect={CGPoint=ff}{CGSize=ff}} CGColorSpaceRef -> ^{CGColorSpace=} CVOpenGLBufferRef -> ^{__CVBuffer=} CFAllocatorRef -> ^{__CFAllocator=} size_t -> L CVOpenGLBufferRef * -> ^^{__CVBuffer} GLenum -> I GLint -> i CVOpenGLBufferPoolRef -> ^{__CVOpenGLBufferPool=} CVOpenGLBufferPoolRef * -> ^^{__CVOpenGLBufferPool} CVOpenGLTextureRef -> ^{__CVBuffer=} GLuint -> I GLfloat* -> ^f CVOpenGLTextureCacheRef -> ^{__CVOpenGLTextureCache=} CVOpenGLTextureCacheRef * -> ^^{__CVOpenGLTextureCache} CVOpenGLTextureRef * -> ^^{__CVBuffer} CVOptionFlags -> Q CVPixelBufferRef -> ^{__CVBuffer=} CFArrayRef -> ^{__CFArray=} CFDictionaryRef * -> r^^{__CFDictionary} OSType -> L CVPixelBufferRef * -> ^^{__CVBuffer} CVPixelBufferReleaseBytesCallback -> ^? void ** -> ^^v size_t* -> ^I CVPixelBufferReleasePlanarBytesCallback -> ^? size_t * -> ^I CVPixelBufferPoolRef -> ^{__CVPixelBufferPool=} CVPixelBufferPoolRef * -> ^^{__CVPixelBufferPool} NSString * -> @ CIFormat -> i CIColor * -> @ CGColorRef -> ^{CGColor=} id -> @ CGFloat * -> ^f CARenderer * -> @ NSDictionary * -> @ float -> f float* -> ^f CAConstraint * -> @ BOOL -> c CGPoint -> {CGPoint=ff} CALayer * -> @ unsigned -> I CGContextRef -> ^{CGContext=} unsigned int -> I CAAnimation * -> @ NSArray * -> @ CIImage * -> @ CIKernel * -> @ CIFilter * -> @ NSURL * -> @ NSData * -> @ CISampler * -> @ CIFilterShape * -> @ CIContext * -> @ CGImageRef -> ^{CGImage=} CGLayerRef -> ^{CGLayer=} ptrdiff_t -> i int -> i CIFilterGenerator* -> @ NSURL* -> @ NSString* -> @ NSDictionary* -> @ CIFilter* -> @ void* -> ^v CIImageAccumulator * -> @ CGPathRef -> ^{CGPath=} SEL -> : CIVector * -> @ CAConstraintAttribute -> i CVOptionFlags * -> ^Q **************** Generated Code **************** int main (void) { char *fmt; printf(((int)kCVReturnError) < 0 ? "%s: %d\n" : "%s: %u\n", "kCVReturnError", kCVReturnError); printf(((int)kCVPixelFormatType_2IndexedGray_WhiteIsZero) < 0 ? "%s: %d\n" : "%s: %u\n", "kCVPixelFormatType_2IndexedGray_WhiteIsZero", kCVPixelFormatType_2IndexedGray_WhiteIsZero); printf(((int)kCVPixelFormatType_444YpCbCr10) < 0 ? "%s: %d\n" : "%s: %u\n", "kCVPixelFormatType_444YpCbCr10", kCVPixelFormatType_444YpCbCr10); printf(((int)kCVPixelFormatType_24BGR) < 0 ? "%s: %d\n" : "%s: %u\n", "kCVPixelFormatType_24BGR", kCVPixelFormatType_24BGR); printf(((int)kCVPixelFormatType_24RGB) < 0 ? "%s: %d\n" : "%s: %u\n", "kCVPixelFormatType_24RGB", kCVPixelFormatType_24RGB); printf(((int)kCALayerWidthSizable) < 0 ? "%s: %d\n" : "%s: %u\n", "kCALayerWidthSizable", kCALayerWidthSizable); printf(((int)kCVReturnAllocationFailed) < 0 ? "%s: %d\n" : "%s: %u\n", "kCVReturnAllocationFailed", kCVReturnAllocationFailed); printf(((int)kCVPixelFormatType_32ABGR) < 0 ? "%s: %d\n" : "%s: %u\n", "kCVPixelFormatType_32ABGR", kCVPixelFormatType_32ABGR); printf(((int)kCVPixelFormatType_32ARGB) < 0 ? "%s: %d\n" : "%s: %u\n", "kCVPixelFormatType_32ARGB", kCVPixelFormatType_32ARGB); printf(((int)kCVPixelFormatType_64ARGB) < 0 ? "%s: %d\n" : "%s: %u\n", "kCVPixelFormatType_64ARGB", kCVPixelFormatType_64ARGB); printf(((int)kCVReturnSuccess) < 0 ? "%s: %d\n" : "%s: %u\n", "kCVReturnSuccess", kCVReturnSuccess); printf(((int)kCVReturnPoolAllocationFailed) < 0 ? "%s: %d\n" : "%s: %u\n", "kCVReturnPoolAllocationFailed", kCVReturnPoolAllocationFailed); printf(((int)kCVReturnInvalidPixelFormat) < 0 ? "%s: %d\n" : "%s: %u\n", "kCVReturnInvalidPixelFormat", kCVReturnInvalidPixelFormat); printf(((int)kCALayerMaxXMargin) < 0 ? "%s: %d\n" : "%s: %u\n", "kCALayerMaxXMargin", kCALayerMaxXMargin); printf(((int)kCVTimeStampTopField) < 0 ? "%s: %d\n" : "%s: %u\n", "kCVTimeStampTopField", kCVTimeStampTopField); printf(((int)kCVTimeStampHostTimeValid) < 0 ? "%s: %d\n" : "%s: %u\n", "kCVTimeStampHostTimeValid", kCVTimeStampHostTimeValid); printf(((int)kCVReturnInvalidDisplay) < 0 ? "%s: %d\n" : "%s: %u\n", "kCVReturnInvalidDisplay", kCVReturnInvalidDisplay); printf(((int)kCALayerBottomEdge) < 0 ? "%s: %d\n" : "%s: %u\n", "kCALayerBottomEdge", kCALayerBottomEdge); printf(((int)kCVPixelFormatType_16LE555) < 0 ? "%s: %d\n" : "%s: %u\n", "kCVPixelFormatType_16LE555", kCVPixelFormatType_16LE555); printf(((int)kCVPixelFormatType_4IndexedGray_WhiteIsZero) < 0 ? "%s: %d\n" : "%s: %u\n", "kCVPixelFormatType_4IndexedGray_WhiteIsZero", kCVPixelFormatType_4IndexedGray_WhiteIsZero); printf(((int)kCALayerLeftEdge) < 0 ? "%s: %d\n" : "%s: %u\n", "kCALayerLeftEdge", kCALayerLeftEdge); printf(((int)kCVSMPTETimeType2997Drop) < 0 ? "%s: %d\n" : "%s: %u\n", "kCVSMPTETimeType2997Drop", kCVSMPTETimeType2997Drop); printf(((int)kCALayerNotSizable) < 0 ? "%s: %d\n" : "%s: %u\n", "kCALayerNotSizable", kCALayerNotSizable); printf(((int)kCVSMPTETimeType60) < 0 ? "%s: %d\n" : "%s: %u\n", "kCVSMPTETimeType60", kCVSMPTETimeType60); printf(((int)kCALayerMinXMargin) < 0 ? "%s: %d\n" : "%s: %u\n", "kCALayerMinXMargin", kCALayerMinXMargin); printf(((int)kCVPixelFormatType_422YpCbCr8) < 0 ? "%s: %d\n" : "%s: %u\n", "kCVPixelFormatType_422YpCbCr8", kCVPixelFormatType_422YpCbCr8); printf(((int)kCVTimeStampIsInterlaced) < 0 ? "%s: %d\n" : "%s: %u\n", "kCVTimeStampIsInterlaced", kCVTimeStampIsInterlaced); printf(((int)kCVReturnInvalidPixelBufferAttributes) < 0 ? "%s: %d\n" : "%s: %u\n", "kCVReturnInvalidPixelBufferAttributes", kCVReturnInvalidPixelBufferAttributes); printf(((int)kCVSMPTETimeType30Drop) < 0 ? "%s: %d\n" : "%s: %u\n", "kCVSMPTETimeType30Drop", kCVSMPTETimeType30Drop); printf(((int)kCVAttachmentMode_ShouldNotPropagate) < 0 ? "%s: %d\n" : "%s: %u\n", "kCVAttachmentMode_ShouldNotPropagate", kCVAttachmentMode_ShouldNotPropagate); printf(((int)kCVPixelFormatType_16BE565) < 0 ? "%s: %d\n" : "%s: %u\n", "kCVPixelFormatType_16BE565", kCVPixelFormatType_16BE565); printf(((int)kCVPixelFormatType_16Gray) < 0 ? "%s: %d\n" : "%s: %u\n", "kCVPixelFormatType_16Gray", kCVPixelFormatType_16Gray); printf(((int)kCVReturnInvalidSize) < 0 ? "%s: %d\n" : "%s: %u\n", "kCVReturnInvalidSize", kCVReturnInvalidSize); printf(((int)kCVPixelFormatType_8Indexed) < 0 ? "%s: %d\n" : "%s: %u\n", "kCVPixelFormatType_8Indexed", kCVPixelFormatType_8Indexed); printf(((int)kCVPixelFormatType_422YpCbCr10) < 0 ? "%s: %d\n" : "%s: %u\n", "kCVPixelFormatType_422YpCbCr10", kCVPixelFormatType_422YpCbCr10); printf(((int)kCALayerRightEdge) < 0 ? "%s: %d\n" : "%s: %u\n", "kCALayerRightEdge", kCALayerRightEdge); printf(((int)kCVTimeStampVideoRefreshPeriodValid) < 0 ? "%s: %d\n" : "%s: %u\n", "kCVTimeStampVideoRefreshPeriodValid", kCVTimeStampVideoRefreshPeriodValid); printf(((int)kCVSMPTETimeType2997) < 0 ? "%s: %d\n" : "%s: %u\n", "kCVSMPTETimeType2997", kCVSMPTETimeType2997); printf(((int)kCVPixelFormatType_48RGB) < 0 ? "%s: %d\n" : "%s: %u\n", "kCVPixelFormatType_48RGB", kCVPixelFormatType_48RGB); printf(((int)kCVReturnDisplayLinkNotRunning) < 0 ? "%s: %d\n" : "%s: %u\n", "kCVReturnDisplayLinkNotRunning", kCVReturnDisplayLinkNotRunning); printf(((int)kCALayerMinYMargin) < 0 ? "%s: %d\n" : "%s: %u\n", "kCALayerMinYMargin", kCALayerMinYMargin); printf(((int)kCVPixelFormatType_2Indexed) < 0 ? "%s: %d\n" : "%s: %u\n", "kCVPixelFormatType_2Indexed", kCVPixelFormatType_2Indexed); printf(((int)kCVPixelFormatType_4444YpCbCrA8) < 0 ? "%s: %d\n" : "%s: %u\n", "kCVPixelFormatType_4444YpCbCrA8", kCVPixelFormatType_4444YpCbCrA8); printf(((int)kCVSMPTETimeType24) < 0 ? "%s: %d\n" : "%s: %u\n", "kCVSMPTETimeType24", kCVSMPTETimeType24); printf(((int)kCVPixelFormatType_420YpCbCr8Planar) < 0 ? "%s: %d\n" : "%s: %u\n", "kCVPixelFormatType_420YpCbCr8Planar", kCVPixelFormatType_420YpCbCr8Planar); printf(((int)kCALayerHeightSizable) < 0 ? "%s: %d\n" : "%s: %u\n", "kCALayerHeightSizable", kCALayerHeightSizable); printf(((int)kCVPixelFormatType_16LE5551) < 0 ? "%s: %d\n" : "%s: %u\n", "kCVPixelFormatType_16LE5551", kCVPixelFormatType_16LE5551); printf(((int)kCVTimeStampVideoTimeValid) < 0 ? "%s: %d\n" : "%s: %u\n", "kCVTimeStampVideoTimeValid", kCVTimeStampVideoTimeValid); printf(((int)kCVPixelFormatType_1Monochrome) < 0 ? "%s: %d\n" : "%s: %u\n", "kCVPixelFormatType_1Monochrome", kCVPixelFormatType_1Monochrome); printf(((int)kCALayerTopEdge) < 0 ? "%s: %d\n" : "%s: %u\n", "kCALayerTopEdge", kCALayerTopEdge); printf(((int)kCVSMPTETimeType25) < 0 ? "%s: %d\n" : "%s: %u\n", "kCVSMPTETimeType25", kCVSMPTETimeType25); printf(((int)kCAConstraintMinX) < 0 ? "%s: %d\n" : "%s: %u\n", "kCAConstraintMinX", kCAConstraintMinX); printf(((int)kCVTimeStampVideoHostTimeValid) < 0 ? "%s: %d\n" : "%s: %u\n", "kCVTimeStampVideoHostTimeValid", kCVTimeStampVideoHostTimeValid); printf(((int)kCVTimeStampSMPTETimeValid) < 0 ? "%s: %d\n" : "%s: %u\n", "kCVTimeStampSMPTETimeValid", kCVTimeStampSMPTETimeValid); printf(((int)kCVPixelFormatType_32RGBA) < 0 ? "%s: %d\n" : "%s: %u\n", "kCVPixelFormatType_32RGBA", kCVPixelFormatType_32RGBA); printf(((int)kCVTimeStampBottomField) < 0 ? "%s: %d\n" : "%s: %u\n", "kCVTimeStampBottomField", kCVTimeStampBottomField); printf(((int)kCVReturnDisplayLinkAlreadyRunning) < 0 ? "%s: %d\n" : "%s: %u\n", "kCVReturnDisplayLinkAlreadyRunning", kCVReturnDisplayLinkAlreadyRunning); printf(((int)kCVSMPTETimeRunning) < 0 ? "%s: %d\n" : "%s: %u\n", "kCVSMPTETimeRunning", kCVSMPTETimeRunning); printf(((int)kCAConstraintMinY) < 0 ? "%s: %d\n" : "%s: %u\n", "kCAConstraintMinY", kCAConstraintMinY); printf(((int)kCVAttachmentMode_ShouldPropagate) < 0 ? "%s: %d\n" : "%s: %u\n", "kCVAttachmentMode_ShouldPropagate", kCVAttachmentMode_ShouldPropagate); printf(((int)kCVPixelFormatType_16LE565) < 0 ? "%s: %d\n" : "%s: %u\n", "kCVPixelFormatType_16LE565", kCVPixelFormatType_16LE565); printf(((int)kCVReturnFirst) < 0 ? "%s: %d\n" : "%s: %u\n", "kCVReturnFirst", kCVReturnFirst); printf(((int)kCVReturnLast) < 0 ? "%s: %d\n" : "%s: %u\n", "kCVReturnLast", kCVReturnLast); printf(((int)kCVPixelFormatType_32AlphaGray) < 0 ? "%s: %d\n" : "%s: %u\n", "kCVPixelFormatType_32AlphaGray", kCVPixelFormatType_32AlphaGray); printf(((int)kCALayerMaxYMargin) < 0 ? "%s: %d\n" : "%s: %u\n", "kCALayerMaxYMargin", kCALayerMaxYMargin); printf(((int)kCAConstraintHeight) < 0 ? "%s: %d\n" : "%s: %u\n", "kCAConstraintHeight", kCAConstraintHeight); printf(((int)kCVPixelFormatType_8IndexedGray_WhiteIsZero) < 0 ? "%s: %d\n" : "%s: %u\n", "kCVPixelFormatType_8IndexedGray_WhiteIsZero", kCVPixelFormatType_8IndexedGray_WhiteIsZero); printf(((int)kCVPixelFormatType_444YpCbCr8) < 0 ? "%s: %d\n" : "%s: %u\n", "kCVPixelFormatType_444YpCbCr8", kCVPixelFormatType_444YpCbCr8); printf(((int)kCVPixelFormatType_4444YpCbCrA8R) < 0 ? "%s: %d\n" : "%s: %u\n", "kCVPixelFormatType_4444YpCbCrA8R", kCVPixelFormatType_4444YpCbCrA8R); printf(((int)kCVPixelFormatType_422YpCbCr16) < 0 ? "%s: %d\n" : "%s: %u\n", "kCVPixelFormatType_422YpCbCr16", kCVPixelFormatType_422YpCbCr16); printf(((int)kCVReturnInvalidPoolAttributes) < 0 ? "%s: %d\n" : "%s: %u\n", "kCVReturnInvalidPoolAttributes", kCVReturnInvalidPoolAttributes); printf(((int)kCVReturnDisplayLinkCallbacksNotSet) < 0 ? "%s: %d\n" : "%s: %u\n", "kCVReturnDisplayLinkCallbacksNotSet", kCVReturnDisplayLinkCallbacksNotSet); printf(((int)kCVPixelFormatType_1IndexedGray_WhiteIsZero) < 0 ? "%s: %d\n" : "%s: %u\n", "kCVPixelFormatType_1IndexedGray_WhiteIsZero", kCVPixelFormatType_1IndexedGray_WhiteIsZero); printf(((int)kCVTimeIsIndefinite) < 0 ? "%s: %d\n" : "%s: %u\n", "kCVTimeIsIndefinite", kCVTimeIsIndefinite); printf(((int)kCVSMPTETimeValid) < 0 ? "%s: %d\n" : "%s: %u\n", "kCVSMPTETimeValid", kCVSMPTETimeValid); printf(((int)kCVTimeStampRateScalarValid) < 0 ? "%s: %d\n" : "%s: %u\n", "kCVTimeStampRateScalarValid", kCVTimeStampRateScalarValid); printf(((int)kCVSMPTETimeType30) < 0 ? "%s: %d\n" : "%s: %u\n", "kCVSMPTETimeType30", kCVSMPTETimeType30); printf(((int)kCVReturnInvalidArgument) < 0 ? "%s: %d\n" : "%s: %u\n", "kCVReturnInvalidArgument", kCVReturnInvalidArgument); printf(((int)kCVReturnPixelBufferNotOpenGLCompatible) < 0 ? "%s: %d\n" : "%s: %u\n", "kCVReturnPixelBufferNotOpenGLCompatible", kCVReturnPixelBufferNotOpenGLCompatible); printf(((int)kCVPixelFormatType_16BE555) < 0 ? "%s: %d\n" : "%s: %u\n", "kCVPixelFormatType_16BE555", kCVPixelFormatType_16BE555); printf(((int)kCAConstraintMaxX) < 0 ? "%s: %d\n" : "%s: %u\n", "kCAConstraintMaxX", kCAConstraintMaxX); printf(((int)kCAConstraintWidth) < 0 ? "%s: %d\n" : "%s: %u\n", "kCAConstraintWidth", kCAConstraintWidth); printf(((int)kCAConstraintMidX) < 0 ? "%s: %d\n" : "%s: %u\n", "kCAConstraintMidX", kCAConstraintMidX); printf(((int)kCAConstraintMaxY) < 0 ? "%s: %d\n" : "%s: %u\n", "kCAConstraintMaxY", kCAConstraintMaxY); printf(((int)kCAConstraintMidY) < 0 ? "%s: %d\n" : "%s: %u\n", "kCAConstraintMidY", kCAConstraintMidY); printf(((int)kCVSMPTETimeType5994) < 0 ? "%s: %d\n" : "%s: %u\n", "kCVSMPTETimeType5994", kCVSMPTETimeType5994); printf(((int)kCVPixelFormatType_32BGRA) < 0 ? "%s: %d\n" : "%s: %u\n", "kCVPixelFormatType_32BGRA", kCVPixelFormatType_32BGRA); printf(((int)kCVPixelFormatType_4Indexed) < 0 ? "%s: %d\n" : "%s: %u\n", "kCVPixelFormatType_4Indexed", kCVPixelFormatType_4Indexed); return 0; } ================ Executed Code ================ kCVReturnError: -6660 kCVPixelFormatType_2IndexedGray_WhiteIsZero: 34 kCVPixelFormatType_444YpCbCr10: 1983131952 kCVPixelFormatType_24BGR: 842285639 kCVPixelFormatType_24RGB: 24 kCALayerWidthSizable: 2 kCVReturnAllocationFailed: -6662 kCVPixelFormatType_32ABGR: 1094862674 kCVPixelFormatType_32ARGB: 32 kCVPixelFormatType_64ARGB: 1647719521 kCVReturnSuccess: 0 kCVReturnPoolAllocationFailed: -6690 kCVReturnInvalidPixelFormat: -6680 kCALayerMaxXMargin: 4 kCVTimeStampTopField: 65536 kCVTimeStampHostTimeValid: 2 kCVReturnInvalidDisplay: -6670 kCALayerBottomEdge: 4 kCVPixelFormatType_16LE555: 1278555445 kCVPixelFormatType_4IndexedGray_WhiteIsZero: 36 kCALayerLeftEdge: 1 kCVSMPTETimeType2997Drop: 5 kCALayerNotSizable: 0 kCVSMPTETimeType60: 6 kCALayerMinXMargin: 1 kCVPixelFormatType_422YpCbCr8: 846624121 kCVTimeStampIsInterlaced: 196608 kCVReturnInvalidPixelBufferAttributes: -6682 kCVSMPTETimeType30Drop: 2 kCVAttachmentMode_ShouldNotPropagate: 0 kCVPixelFormatType_16BE565: 1110783541 kCVPixelFormatType_16Gray: 1647392359 kCVReturnInvalidSize: -6681 kCVPixelFormatType_8Indexed: 8 kCVPixelFormatType_422YpCbCr10: 1983000880 kCALayerRightEdge: 2 kCVTimeStampVideoRefreshPeriodValid: 8 kCVSMPTETimeType2997: 4 kCVPixelFormatType_48RGB: 1647589490 kCVReturnDisplayLinkNotRunning: -6672 kCALayerMinYMargin: 8 kCVPixelFormatType_2Indexed: 2 kCVPixelFormatType_4444YpCbCrA8: 1983131704 kCVSMPTETimeType24: 0 kCVPixelFormatType_420YpCbCr8Planar: 2033463856 kCALayerHeightSizable: 16 kCVPixelFormatType_16LE5551: 892679473 kCVTimeStampVideoTimeValid: 1 kCVPixelFormatType_1Monochrome: 1 kCALayerTopEdge: 8 kCVSMPTETimeType25: 1 kCAConstraintMinX: 0 kCVTimeStampVideoHostTimeValid: 3 kCVTimeStampSMPTETimeValid: 4 kCVPixelFormatType_32RGBA: 1380401729 kCVTimeStampBottomField: 131072 kCVReturnDisplayLinkAlreadyRunning: -6671 kCVSMPTETimeRunning: 2 kCAConstraintMinY: 4 kCVAttachmentMode_ShouldPropagate: 1 kCVPixelFormatType_16LE565: 1278555701 kCVReturnFirst: -6660 kCVReturnLast: -6699 kCVPixelFormatType_32AlphaGray: 1647522401 kCALayerMaxYMargin: 32 kCAConstraintHeight: 7 kCVPixelFormatType_8IndexedGray_WhiteIsZero: 40 kCVPixelFormatType_444YpCbCr8: 1983066168 kCVPixelFormatType_4444YpCbCrA8R: 1916022840 kCVPixelFormatType_422YpCbCr16: 1983000886 kCVReturnInvalidPoolAttributes: -6691 kCVReturnDisplayLinkCallbacksNotSet: -6673 kCVPixelFormatType_1IndexedGray_WhiteIsZero: 33 kCVTimeIsIndefinite: 1 kCVSMPTETimeValid: 1 kCVTimeStampRateScalarValid: 16 kCVSMPTETimeType30: 3 kCVReturnInvalidArgument: -6661 kCVReturnPixelBufferNotOpenGLCompatible: -6683 kCVPixelFormatType_16BE555: 16 kCAConstraintMaxX: 2 kCAConstraintWidth: 3 kCAConstraintMidX: 1 kCAConstraintMaxY: 6 kCAConstraintMidY: 5 kCVSMPTETimeType5994: 7 kCVPixelFormatType_32BGRA: 1111970369 kCVPixelFormatType_4Indexed: 4 **************** Generated Code **************** #import <objc/objc-class.h> /* Tiger compat */ #ifndef _C_ULNG_LNG #define _C_ULNG_LNG 'Q' #endif #ifndef _C_LNG_LNG #define _C_LNG_LNG 'q' #endif static const char * printf_format (const char *str) { if (str == NULL || strlen(str) != 1) return NULL; switch (*str) { case _C_SHT: return "%s: %hd\n"; case _C_USHT: return "%s: %hu\n"; case _C_INT: return "%s: %d\n"; case _C_UINT: return "%s: %u\n"; case _C_LNG: return "%s: %ld\n"; case _C_ULNG: return "%s: %lu\n"; case _C_LNG_LNG: return "%s: %lld\n"; case _C_ULNG_LNG: return "%s: %llu\n"; case _C_FLT: return "%s: %#.17g\n"; case _C_DBL: return "%s: %#.17g\n"; } return NULL; } int main (void) { const char *fmt; #if defined(AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER) if ((fmt = printf_format(@encode(__typeof__(AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER)))) != NULL) printf(fmt, "AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER", AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER); #endif return 0; } **************** Generated Code **************** #import <objc/objc-class.h> CFTypeRef _CFRuntimeCreateInstance(CFAllocatorRef allocator, CFTypeID typeID, CFIndex extraBytes, unsigned char *category); int main (void) { CFTypeRef ref; return 0; } ================ Executed Code ================ **************** Generated Code **************** #import <objc/objc-class.h> @interface __MyClass : NSObject { } @end @implementation __MyClass @end int main (void) { Class klass = objc_getClass("__MyClass"); return 0; } ================ Executed Code ================ **************** Generated Code **************** #import <objc/objc-class.h> @interface __MyClass : NSObject @end @implementation __MyClass - (void)animationDidStart:(CAAnimation *)anim; {} - (void)animationDidStop:(CAAnimation *)anim finished:(BOOL)flag; {} - (void)displayLayer:(CALayer *)layer; {} - (void)drawLayer:(CALayer *)layer inContext:(CGContextRef)ctx; {} - (id<CAAction>)actionForLayer:(CALayer *)layer forKey:(NSString *)event; {} - (CGSize)preferredSizeOfLayer:(CALayer *)layer; {} - (void)invalidateLayoutOfLayer:(CALayer *)layer; {} - (void)layoutSublayersOfLayer:(CALayer *)layer; {} - (void)provideImageData:(void *)data bytesPerRow:(size_t)rowbytes origin:(size_t)x:(size_t)y size:(size_t)width:(size_t)height userInfo:(id)info; {} @end int main (void) { Class klass = objc_getClass("__MyClass"); printf("%s -> %s\n", "animationDidStart:", method_getDescription(class_getInstanceMethod(klass, @selector(animationDidStart:)))->types); printf("%s -> %s\n", "animationDidStop:finished:", method_getDescription(class_getInstanceMethod(klass, @selector(animationDidStop:finished:)))->types); printf("%s -> %s\n", "displayLayer:", method_getDescription(class_getInstanceMethod(klass, @selector(displayLayer:)))->types); printf("%s -> %s\n", "drawLayer:inContext:", method_getDescription(class_getInstanceMethod(klass, @selector(drawLayer:inContext:)))->types); printf("%s -> %s\n", "actionForLayer:forKey:", method_getDescription(class_getInstanceMethod(klass, @selector(actionForLayer:forKey:)))->types); printf("%s -> %s\n", "preferredSizeOfLayer:", method_getDescription(class_getInstanceMethod(klass, @selector(preferredSizeOfLayer:)))->types); printf("%s -> %s\n", "invalidateLayoutOfLayer:", method_getDescription(class_getInstanceMethod(klass, @selector(invalidateLayoutOfLayer:)))->types); printf("%s -> %s\n", "layoutSublayersOfLayer:", method_getDescription(class_getInstanceMethod(klass, @selector(layoutSublayersOfLayer:)))->types); printf("%s -> %s\n", "provideImageData:bytesPerRow:origin::size::userInfo:", method_getDescription(class_getInstanceMethod(klass, @selector(provideImageData:bytesPerRow:origin::size::userInfo:)))->types); return 0; } ================ Executed Code ================ animationDidStart: -> v12@0:4@8 animationDidStop:finished: -> v16@0:4@8c12 displayLayer: -> v12@0:4@8 drawLayer:inContext: -> v16@0:4@8^{CGContext=}12 actionForLayer:forKey: -> @16@0:4@8@12 preferredSizeOfLayer: -> {CGSize=ff}12@0:4@8 invalidateLayoutOfLayer: -> v12@0:4@8 layoutSublayersOfLayer: -> v12@0:4@8 provideImageData:bytesPerRow:origin::size::userInfo: -> v36@0:4^v8L12L16L20L24L28@32.