View CreatorExample.swift
fileprivate func displayOptionsViewController() { | |
guard let optionsViewController = OptionsViewController.create(completionBlock: optionsCompletionHandler) else { | |
NSLog("Failed to create OptionsViewController, whoops") | |
return | |
} | |
self.show(optionsViewController, sender: nil) | |
self.optionsViewController = optionsViewController as? OptionsViewController | |
} |
View CreatorExtensionSample.swift
extension OptionsViewController { | |
class func create(completionBlock: @escaping OptionsCompletionHandler) -> UIViewController? { | |
let storyboard = UIStoryboard(name: "Options", bundle: nil) | |
guard let vc = | |
storyboard.instantiateViewController(withIdentifier:"OptionsViewController") as? OptionsViewController else { | |
return nil | |
} | |
vc.completionBlock = completionBlock | |
return vc | |
} |
View CCswiftTest.swift
func testCreateDeleteMaleCalculate() { | |
guard let cc = PKMCreatinineClearance(40, height: 75, weight: 70, scr: 1.0, gender: PKMMale) else { | |
XCTFail("Create Creatinine Clearance Male Instance failed") | |
return | |
} | |
let clcr = cc.calculate() | |
XCTAssertEqualWithAccuracy(clcr, 97.2, accuracy: 0.2, "Male clcr should be around 97.2, range allowed to be +/- 0.2") | |
} |
View CCbridgeCode.mm
#import "PKMCreatinineClearance.h" | |
#import "PKMConvert.h" | |
#import "CreatinineClearance.h" | |
@interface PKMCreatinineClearance () | |
@property (nonatomic, assign) PKMath::CreatinineClearance* ccInstance; | |
@end | |
@implementation PKMCreatinineClearance |
View ACLMessageDispatch.cpp
LRESULT ACLWinBase::DispatchMessage | |
( | |
IN UINT uMsg, | |
IN WPARAM wParam, | |
IN LPARAM lParam | |
) | |
{ | |
LRESULT lResult(1); | |
UINT uSubMsg(WM_NULL); // By default this really isn't looked at. | |
View BaseClassWindowProc.cpp
EXTERNC ACLWINCB(LRESULT) ACLWindowDispatchProc | |
( | |
IN HWND hWnd, | |
IN UINT uMsg, | |
IN WPARAM wParam, | |
IN LPARAM lParam | |
) | |
{ | |
UNALIGNED ACLWinBase* pWindow = NULL; | |
PWINMSGHNDLR pHandler = NULL; |
View NewSchoolWindowProc.cpp
static ACLWinMessageMap stcMsgMap[] = | |
// message sub msg/ctl id message handler method. | |
// | |
{ { WM_CREATE, WM_NULL, (PWINMSGHNDLR)&SampleWindow::OnCreate } | |
, { WM_DESTROY, WM_NULL, (PWINMSGHNDLR)&SampleWindow::OnDestroy } | |
, { WM_COMMAND, IDM_ABOUT, (PWINMSGHNDLR)&SampleWindow::OnAbout } | |
, { WM_COMMAND, IDM_EXIT, (PWINMSGHNDLR)&SampleWindow::OnExit } | |
, { WM_SIZE, WM_NULL, (PWINMSGHNDLR)&SampleWindow::OnResize } | |
}; // stcMsgMap |
View OldSchoolWindowProc.c
LRESULT CALLBACK WindowProc | |
( | |
HWND hwnd, | |
UINT message, | |
WPARAM wParam, | |
LPARAM lParam | |
) | |
{ | |
switch (message) | |
{ |
View gist:14650fd5a65a21798570
static void FizzBuzz() | |
{ | |
static int kBufferMax = 256; | |
char outputBuffer[kBufferMax]; | |
for (int x = 1; x <= 100; x++) | |
{ | |
memset(&outputBuffer, 0, kBufferMax); | |
if (0 == (x % 3)) |