#!/usr/bin/env python3
import sys, os, subprocess, re, getpass, datetime
# Data
library = False
iossupport_system = False
framework = False
private_framework = False
# Constants
library_prefix = "/usr/lib/"
iossupport_system_prefix = "/System/iOSSupport"
framework_prefix = "/System/Library/Frameworks/"
private_framework_prefix = "/System/Library/PrivateFrameworks/"
#######################################################
##### SET THIS TO WHERE YOUR class-dump BINARY IS #####
#######################################################
username = getpass.getuser()
class_dump = "/Users/" + username + "/bin/class-dump"
copyright_template = """/*
This file is part of Darling.
Copyright (C) {} Darling Developers
Darling is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Darling is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Darling. If not, see .
*/
"""
copyright = copyright_template.format(datetime.datetime.now(datetime.timezone.utc).year)
c_func_impl_stub = """
void* %s(void)
{
if (verbose) puts("STUB: %s called");
return NULL;
}
"""
msg_handling = """- (NSMethodSignature *)methodSignatureForSelector:(SEL)aSelector
{
return [NSMethodSignature signatureWithObjCTypes: \"v@:\"];
}
- (void)forwardInvocation:(NSInvocation *)anInvocation
{
NSLog(@\"Stub called: %@ in %@\", NSStringFromSelector([anInvocation selector]), [self class]);
}
"""
# Utility functions
def usage():
print("Usage: " + sys.argv[0] + "