Skip to content

Commit

Permalink
generate: be a bit more specific about types and functions to skip
Browse files Browse the repository at this point in the history
  • Loading branch information
tmc committed Sep 4, 2023
1 parent a6681de commit 0e28ecd
Show file tree
Hide file tree
Showing 7 changed files with 11,676 additions and 144 deletions.
16 changes: 12 additions & 4 deletions generate/function.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,17 @@ var unhandledStructTypes = map[string]bool{
"CFBinaryHeapCallBacks": true,
"CFBinaryHeapCompareContext": true,
"CFCalendarIdentifier": true,
"CFDateFormatterKey": true,
"CFDictionaryKeyCallBacks": true,
"CFDictionaryValueCallBacks": true,
"CFErrorDomain": true,
"CFFileDescriptorContext": true,
"CFLocaleIdentifier": true,
"CFLocaleKey": true,
"CFMachPortContext": true,
"CFMachPortRef": true,
"CFMessagePortContext": true,
"CFMessagePortInvalidationCallBack": true,
"CFPropertyListRef": true,
"CFNumberFormatterKey": true,
"CFRange": true,
"CFRunLoopMode": true,
"CFRunLoopObserverContext": true,
Expand All @@ -37,12 +37,11 @@ var unhandledStructTypes = map[string]bool{
"CFSetCallBacks": true,
"CFSocketContext": true,
"CFSocketSignature": true,
"CFStreamPropertyKey": true,
"CFStringInlineBuffer": true,
"CFStringRef": true,
"CFSwappedFloat32": true,
"CFSwappedFloat64": true,
"CFTreeContext": true,
"CFTypeRef": true,
"CFUUIDBytes": true,
"dispatch_queue_t": true, // for return values, not parameters
"va_list": true,
Expand All @@ -53,10 +52,19 @@ func (db *Generator) ToFunction(fw string, sym Symbol) *codegen.Function {
knownIssues := map[string]bool{

"CFCharacterSetIsLongCharacterMember": true, // "UTF32Char theChar"
"CFStringGetCharactersPtr": true, // return handling
"CFStringCreateWithFormat": true, // format param
"CFStringAppendFormat": true, // format param
"CFFileSecurityCopyAccessControlList": true, // "acl_t accessControlList"
"CFFileSecuritySetAccessControlList": true, // "acl_t accessControlList"
"CFMachPortGetInvalidationCallBack": true, // converting return value to function pointer
"CFMachPortGetPort": true, // handling return of mach_port_t
"CFStringAppendPascalString": true, // "ConstStr255Param pStr"
"CFStringCreateWithPascalString": true, // StringPtr
"CFStringCreateWithPascalStringNoCopy": true, // StringPtr
"CFStringGetLongCharacterForSurrogatePair": true, // "UTF16Char surrogateHigh, UTF16Char surrogateLow"
"CFStringGetPascalString": true, // StringPtr
"CFStringGetPascalStringPtr": true, // StringPtr
"CFStringGetSurrogatePairForLongCharacter": true, // "UTF32Char character"
"CGColorSpaceCreateIndexed": true, // "const unsigned char *"
"CGPDFArrayGetName": true, // "const char * _Nullable *"
Expand Down
60 changes: 60 additions & 0 deletions macos/corefoundation/aliastypes.gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -310,3 +310,63 @@ type AllocatorCopyDescriptionCallBack = func(info unsafe.Pointer) StringRef
//
// [Full Topic]: https://developer.apple.com/documentation/corefoundation/cfxmlparserresolveexternalentitycallback?language=objc
type XMLParserResolveExternalEntityCallBack = func(parser unsafe.Pointer, extID *XMLExternalID, info unsafe.Pointer) DataRef

// A reference to a mutable character set object. [Full Topic]
//
// [Full Topic]: https://developer.apple.com/documentation/corefoundation/cfmutablecharactersetref?language=objc
type MutableCharacterSetRef = unsafe.Pointer

// A reference to a CFMutableAttributedString object. [Full Topic]
//
// [Full Topic]: https://developer.apple.com/documentation/corefoundation/cfmutableattributedstringref?language=objc
type MutableAttributedStringRef = unsafe.Pointer

// A reference to a mutable set object. [Full Topic]
//
// [Full Topic]: https://developer.apple.com/documentation/corefoundation/cfmutablesetref?language=objc
type MutableSetRef = unsafe.Pointer

// A reference to an XML parser object. [Full Topic]
//
// [Full Topic]: https://developer.apple.com/documentation/corefoundation/cfxmlparserref?language=objc
type XMLParserRef = unsafe.Pointer

// A reference to a mutable dictionary object. [Full Topic]
//
// [Full Topic]: https://developer.apple.com/documentation/corefoundation/cfmutabledictionaryref?language=objc
type MutableDictionaryRef = unsafe.Pointer

// A reference to a CFPlugin object. [Full Topic]
//
// [Full Topic]: https://developer.apple.com/documentation/corefoundation/cfpluginref?language=objc
type PlugInRef = unsafe.Pointer

// A reference to a CFXMLNode object. [Full Topic]
//
// [Full Topic]: https://developer.apple.com/documentation/corefoundation/cfxmlnoderef?language=objc
type XMLNodeRef = unsafe.Pointer

// A reference to a mutable bit vector object. [Full Topic]
//
// [Full Topic]: https://developer.apple.com/documentation/corefoundation/cfmutablebitvectorref?language=objc
type MutableBitVectorRef = unsafe.Pointer

// A reference to a CFMutableString object. [Full Topic]
//
// [Full Topic]: https://developer.apple.com/documentation/corefoundation/cfmutablestringref?language=objc
type MutableStringRef = unsafe.Pointer

// A reference to a mutable array object. [Full Topic]
//
// [Full Topic]: https://developer.apple.com/documentation/corefoundation/cfmutablearrayref?language=objc
type MutableArrayRef = unsafe.Pointer

// A reference to a CFMutableData object. [Full Topic]
//
// [Full Topic]: https://developer.apple.com/documentation/corefoundation/cfmutabledataref?language=objc
type MutableDataRef = unsafe.Pointer

// A reference to a mutable bag object. [Full Topic]
//
// [Full Topic]: https://developer.apple.com/documentation/corefoundation/cfmutablebagref?language=objc
type MutableBagRef = unsafe.Pointer
21 changes: 0 additions & 21 deletions macos/corefoundation/corefoundation_structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,7 @@ import (
"unsafe"
)

type AllocatorRef = unsafe.Pointer
type ArrayRef = unsafe.Pointer
type DataRef = unsafe.Pointer
type DateRef = unsafe.Pointer
type DictionaryRef = unsafe.Pointer
type FileDescriptorRef = unsafe.Pointer
type MachPortRef = unsafe.Pointer
type MessagePortRef = unsafe.Pointer
type NotificationCenterRef = unsafe.Pointer
type NotificationName = unsafe.Pointer
type PlugInInstanceRef = unsafe.Pointer
type PropertyListRef = unsafe.Pointer
type ReadStreamRef = unsafe.Pointer
type RunLoopObserverRef = unsafe.Pointer
type RunLoopRef = unsafe.Pointer
type RunLoopSourceRef = unsafe.Pointer
type RunLoopTimerRef = unsafe.Pointer
type SocketRef = unsafe.Pointer
type StringRef = unsafe.Pointer
type TypeRef = unsafe.Pointer
type URLRef = unsafe.Pointer
type UUIDRef = unsafe.Pointer
type UserNotificationRef = unsafe.Pointer
type WriteStreamRef = unsafe.Pointer
type XMLExternalID = unsafe.Pointer
Loading

0 comments on commit 0e28ecd

Please sign in to comment.