From 49a23d52cc07290b6ecc807880e8701cd0dd6929 Mon Sep 17 00:00:00 2001 From: "Boris D." Date: Sun, 13 Oct 2024 10:16:25 -0700 Subject: [PATCH] Add more type exceptions. --- generate/dune | 2 +- lib/lib.ml | 14 +++++++++----- lib/util.ml | 6 ++++-- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/generate/dune b/generate/dune index d51f322..952ee8f 100644 --- a/generate/dune +++ b/generate/dune @@ -1,5 +1,5 @@ (executable (name main) (public_name generate-ml) -; (flags :standard -ccopt "-framework UIKit") + (flags :standard -ccopt "-framework Cocoa") (libraries camlkit-base.runtime lib)) diff --git a/lib/lib.ml b/lib/lib.ml index 37e0a99..eb5c755 100644 --- a/lib/lib.ml +++ b/lib/lib.ml @@ -141,12 +141,16 @@ let method_binding m = if is_private sel then Option.none else - let name, args = split_selector sel in - if unsupported_method name then + try + let name, args = split_selector sel in + if unsupported_method name then + Option.none + else + Option.some + {name; args = disambiguate_args args; sel; typ = method_type m} + with ex -> + Printf.eprintf "Non-fatal exn: %s\n%!" (Printexc.to_string ex); Option.none - else - Option.some - {name; args = disambiguate_args args; sel; typ = method_type m} ;; let eq_name mb {name; _} = String.equal mb.name name diff --git a/lib/util.ml b/lib/util.ml index 218d88c..00309e6 100644 --- a/lib/util.ml +++ b/lib/util.ml @@ -43,7 +43,8 @@ let apply_type_exceptions ?(allow_underscore = true) = function | "OpaqueEventRef" | "OpaqueMenuRef" | "TISInputSource" | "WorkspaceKVOData_t" | "OpaqueHIPresentationInstanceRef" | "OpaqueATSUStyle" | "AXUIElement" | "SLMPopUpMenuContext_t" | "RXRecognizer" | "GSEvent" | "GSKeyboard" -| "IOHIDEvent" | "UIWebTouchEvent" +| "IOHIDEvent" | "UIWebTouchEvent" | "OpaqueCFHTTPCookie" | "CNPluginCommand" +| "CFNetService" | "SecIdentity" | "SecAccess" | "CFHSTSPolicy" | "sqlite3" | "sqlite3_stmt" | "sqlite3_value" -> "void" | "va_list_tag" -> @@ -57,7 +58,8 @@ let apply_type_exceptions ?(allow_underscore = true) = function | "ITColor" | "mach_right_send" | "PUSimpleIndexPath" | "PXSimpleIndexPath" | "PHDisplayVelocity" | "PXAssetMediaTypeCount" | "PXAssetBadgeInfo" | "PUGridCoordinates" | "PUDisplayVelocity" | "CTGlyphStorage" -| "MIORange" | "IMFileSize" | "AKQuadrilateral" as ty -> +| "MIORange" | "IMFileSize" | "AKQuadrilateral"| "InternalInit" +| "HTTPConnectionCacheLimits" as ty -> raise (Unsupported_type ty) | ty -> if not allow_underscore && String.contains ty '_' then