Browse files

Added ability to resolve functions lazily

  • Loading branch information...
1 parent bfd75c2 commit b132b37491cfc1ae4fbb34d0c706ec18e434b5e4 @davedelong committed Feb 22, 2012
Showing with 214 additions and 415 deletions.
  1. +41 −35 Command line demo/main.m
  2. +5 −0 DDMathParser/DDMathEvaluator.h
  3. +8 −1 DDMathParser/DDMathEvaluator.m
  4. +114 −374 Demo/Demo.xib
  5. +46 −5 Demo/DemoController.m
View
76 Command line demo/main.m
@@ -36,47 +36,53 @@ int main (int argc, const char * argv[]) {
#if DD_HAS_ARC
@autoreleasepool {
#else
- NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
+ NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
#endif
-
- printf("Math Evaluator!\n");
- printf("\ttype a mathematical expression to evaluate it.\n");
- printf("\nStandard operators available: + - * / %% ! & | ~ ^ << >>\n");
- printf("\nType \"list\" to show available functions\n");
- printf("Type \"exit\" to quit\n");
-
- [DDParser setDefaultPowerAssociativity:DDOperatorAssociativityRight];
-
- NSString * line = nil;
- do {
- printf("> ");
- line = readLine();
- if ([line isEqual:@"exit"]) { break; }
- if ([line isEqual:@"list"]) { listFunctions(); continue; }
-
- NSError *error = nil;
- DDMathStringTokenizer *tokenizer = [[DDMathStringTokenizer alloc] initWithString:line error:&error];
- DDParser *parser = [DDParser parserWithTokenizer:tokenizer error:&error];
- DDExpression *expression = [parser parsedExpressionWithError:&error];
- DDExpression *rewritten = [[DDMathEvaluator sharedMathEvaluator] expressionByRewritingExpression:expression];
+ printf("Math Evaluator!\n");
+ printf("\ttype a mathematical expression to evaluate it.\n");
+ printf("\nStandard operators available: + - * / %% ! & | ~ ^ << >>\n");
+ printf("\nType \"list\" to show available functions\n");
+ printf("Type \"exit\" to quit\n");
- NSNumber *value = [rewritten evaluateWithSubstitutions:nil evaluator:nil error:&error];
- DD_RELEASE(tokenizer);
+ [DDParser setDefaultPowerAssociativity:DDOperatorAssociativityRight];
+ DDMathEvaluator *evaluator = [[DDMathEvaluator alloc] init];
+ [evaluator setFunctionResolver:^DDMathFunction (NSString *name) {
+ return DD_AUTORELEASE([^DDExpression* (NSArray *args, NSDictionary *substitutions, DDMathEvaluator *eval, NSError **error) {
+ return [DDExpression numberExpressionWithNumber:[NSNumber numberWithInt:42]];
+ } copy]);
+ }];
- if (value == nil) {
- printf("\tERROR: %s\n", [[error description] UTF8String]);
- } else {
- if (rewritten != expression) {
- printf("\t%s REWRITTEN AS %s\n", [[expression description] UTF8String], [[rewritten description] UTF8String]);
+ NSString * line = nil;
+ do {
+ printf("> ");
+ line = readLine();
+ if ([line isEqual:@"exit"]) { break; }
+ if ([line isEqual:@"list"]) { listFunctions(); continue; }
+
+ NSError *error = nil;
+
+ DDMathStringTokenizer *tokenizer = [[DDMathStringTokenizer alloc] initWithString:line error:&error];
+ DDParser *parser = [DDParser parserWithTokenizer:tokenizer error:&error];
+
+ DDExpression *expression = [parser parsedExpressionWithError:&error];
+ DDExpression *rewritten = [evaluator expressionByRewritingExpression:expression];
+
+ NSNumber *value = [rewritten evaluateWithSubstitutions:nil evaluator:evaluator error:&error];
+ DD_RELEASE(tokenizer);
+
+ if (value == nil) {
+ printf("\tERROR: %s\n", [[error description] UTF8String]);
+ } else {
+ if (rewritten != expression) {
+ printf("\t%s REWRITTEN AS %s\n", [[expression description] UTF8String], [[rewritten description] UTF8String]);
+ }
+ printf("\t%s = %s\n", [[rewritten description] UTF8String], [[value description] UTF8String]);
}
- printf("\t%s = %s\n", [[rewritten description] UTF8String], [[value description] UTF8String]);
- }
+
+
+ } while (1);
-
- } while (1);
-
- // insert code here...
printf("Goodbye!\n");
#if DD_HAS_ARC
View
5 DDMathParser/DDMathEvaluator.h
@@ -12,12 +12,17 @@
@class DDMathEvaluator;
@class DDExpression;
+typedef DDMathFunction (^DDFunctionResolver)(NSString *);
+
@interface DDMathEvaluator : NSObject {
NSMutableArray *functions;
NSMutableDictionary * functionMap;
NSMutableArray *rewriteRules;
+ DDFunctionResolver functionResolver;
}
+@property (nonatomic, copy) DDFunctionResolver functionResolver;
+
+ (id) sharedMathEvaluator;
- (BOOL) registerFunction:(DDMathFunction)function forName:(NSString *)functionName;
View
9 DDMathParser/DDMathEvaluator.m
@@ -30,6 +30,8 @@ - (_DDFunctionContainer *)functionContainerWithName:(NSString *)functionName;
@implementation DDMathEvaluator
+@synthesize functionResolver=functionResolver;
+
static DDMathEvaluator * _sharedEvaluator = nil;
+ (id) sharedMathEvaluator {
@@ -59,6 +61,7 @@ - (void) dealloc {
[functions release];
[functionMap release];
[rewriteRules release];
+ [functionResolver release];
[super dealloc];
#endif
}
@@ -99,7 +102,11 @@ - (_DDFunctionContainer *)functionContainerWithName:(NSString *)functionName {
- (DDMathFunction) functionWithName:(NSString *)functionName {
_DDFunctionContainer *container = [self functionContainerWithName:functionName];
- return [container function];
+ DDMathFunction function = [container function];
+ if (function == nil && functionResolver != nil) {
+ function = functionResolver(functionName);
+ }
+ return function;
}
- (NSArray *) registeredFunctions {
View
488 Demo/Demo.xib
@@ -1,19 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.10">
<data>
- <int key="IBDocument.SystemTarget">1060</int>
- <string key="IBDocument.SystemVersion">10H574</string>
- <string key="IBDocument.InterfaceBuilderVersion">823</string>
- <string key="IBDocument.AppKitVersion">1038.35</string>
- <string key="IBDocument.HIToolboxVersion">461.00</string>
+ <int key="IBDocument.SystemTarget">1070</int>
+ <string key="IBDocument.SystemVersion">11C74</string>
+ <string key="IBDocument.InterfaceBuilderVersion">1938</string>
+ <string key="IBDocument.AppKitVersion">1138.23</string>
+ <string key="IBDocument.HIToolboxVersion">567.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string key="NS.object.0">823</string>
+ <string key="NS.object.0">1938</string>
</object>
- <object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
+ <object class="NSArray" key="IBDocument.IntegratedClassDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
- <integer value="29"/>
- <integer value="854"/>
+ <string>NSScroller</string>
+ <string>NSTableHeaderView</string>
+ <string>NSMenuItem</string>
+ <string>NSMenu</string>
+ <string>NSTextFieldCell</string>
+ <string>NSScrollView</string>
+ <string>NSNumberFormatter</string>
+ <string>NSBox</string>
+ <string>NSTableView</string>
+ <string>NSCustomObject</string>
+ <string>NSView</string>
+ <string>NSWindowTemplate</string>
+ <string>NSTextField</string>
+ <string>NSTableColumn</string>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -1293,6 +1305,7 @@
<string key="NSWindowTitle">Window</string>
<string key="NSWindowClass">NSWindow</string>
<nil key="NSViewClass"/>
+ <nil key="NSUserInterfaceItemIdentifier"/>
<string key="NSWindowContentMaxSize">{480, 241}</string>
<string key="NSWindowContentMinSize">{480, 241}</string>
<object class="NSView" key="NSWindowView" id="185020864">
@@ -1305,6 +1318,8 @@
<int key="NSvFlags">266</int>
<string key="NSFrame">{{20, 199}, {440, 22}}</string>
<reference key="NSSuperview" ref="185020864"/>
+ <reference key="NSWindow"/>
+ <reference key="NSNextKeyView" ref="999118806"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="252506095">
<int key="NSCellFlags">-1804468671</int>
@@ -1345,7 +1360,7 @@
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSView" id="512400001">
<reference key="NSNextResponder" ref="999118806"/>
- <int key="NSvFlags">256</int>
+ <int key="NSvFlags">274</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSScrollView" id="604863116">
@@ -1363,19 +1378,22 @@
<int key="NSvFlags">256</int>
<string key="NSFrameSize">{238, 117}</string>
<reference key="NSSuperview" ref="850809551"/>
+ <reference key="NSWindow"/>
+ <reference key="NSNextKeyView" ref="548490644"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTableHeaderView" key="NSHeaderView" id="867272407">
<reference key="NSNextResponder" ref="844821803"/>
<int key="NSvFlags">256</int>
<string key="NSFrameSize">{238, 17}</string>
<reference key="NSSuperview" ref="844821803"/>
+ <reference key="NSWindow"/>
+ <reference key="NSNextKeyView" ref="850809551"/>
<reference key="NSTableView" ref="688613936"/>
</object>
- <object class="_NSCornerView" key="NSCornerView" id="172272802">
- <reference key="NSNextResponder" ref="604863116"/>
+ <object class="_NSCornerView" key="NSCornerView">
+ <nil key="NSNextResponder"/>
<int key="NSvFlags">-2147483392</int>
<string key="NSFrame">{{224, 0}, {16, 17}}</string>
- <reference key="NSSuperview" ref="604863116"/>
</object>
<object class="NSMutableArray" key="NSTableColumns">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -1387,7 +1405,7 @@
<object class="NSTableHeaderCell" key="NSHeaderCell">
<int key="NSCellFlags">75628096</int>
<int key="NSCellFlags2">2048</int>
- <string key="NSContents">Variable</string>
+ <string key="NSContents">Name</string>
<object class="NSFont" key="NSSupport" id="26">
<string key="NSName">LucidaGrande</string>
<double key="NSSize">11</double>
@@ -1490,9 +1508,7 @@
<object class="NSArray" key="dict.sortedKeys" id="0">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- </object>
+ <reference key="dict.values" ref="0"/>
</object>
</object>
<object class="NSDecimalNumberPlaceholder" key="NS.min" id="236061822">
@@ -1547,10 +1563,12 @@
<int key="NSDraggingSourceMaskForNonLocal">0</int>
<bool key="NSAllowsTypeSelect">YES</bool>
<int key="NSTableViewDraggingDestinationStyle">0</int>
+ <int key="NSTableViewGroupRowStyle">1</int>
</object>
</object>
<string key="NSFrame">{{1, 17}, {238, 117}}</string>
<reference key="NSSuperview" ref="604863116"/>
+ <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="688613936"/>
<reference key="NSDocView" ref="688613936"/>
<reference key="NSBGColor" ref="953287885"/>
@@ -1561,6 +1579,8 @@
<int key="NSvFlags">-2147483392</int>
<string key="NSFrame">{{224, 17}, {15, 102}}</string>
<reference key="NSSuperview" ref="604863116"/>
+ <reference key="NSWindow"/>
+ <reference key="NSNextKeyView" ref="829256759"/>
<reference key="NSTarget" ref="604863116"/>
<string key="NSAction">_doScroller:</string>
<double key="NSCurValue">37</double>
@@ -1571,6 +1591,8 @@
<int key="NSvFlags">-2147483392</int>
<string key="NSFrame">{{1, 119}, {223, 15}}</string>
<reference key="NSSuperview" ref="604863116"/>
+ <reference key="NSWindow"/>
+ <reference key="NSNextKeyView" ref="932631122"/>
<int key="NSsFlags">1</int>
<reference key="NSTarget" ref="604863116"/>
<string key="NSAction">_doScroller:</string>
@@ -1585,36 +1607,40 @@
</object>
<string key="NSFrame">{{1, 0}, {238, 17}}</string>
<reference key="NSSuperview" ref="604863116"/>
+ <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="867272407"/>
<reference key="NSDocView" ref="867272407"/>
<reference key="NSBGColor" ref="953287885"/>
<int key="NScvFlags">4</int>
</object>
- <reference ref="172272802"/>
</object>
<string key="NSFrame">{{18, 14}, {240, 135}}</string>
<reference key="NSSuperview" ref="512400001"/>
- <reference key="NSNextKeyView" ref="850809551"/>
- <int key="NSsFlags">562</int>
+ <reference key="NSWindow"/>
+ <reference key="NSNextKeyView" ref="844821803"/>
+ <int key="NSsFlags">133682</int>
<reference key="NSVScroller" ref="548490644"/>
<reference key="NSHScroller" ref="829256759"/>
<reference key="NSContentView" ref="850809551"/>
<reference key="NSHeaderClipView" ref="844821803"/>
- <reference key="NSCornerView" ref="172272802"/>
<bytes key="NSScrollAmts">QSAAAEEgAABBmAAAQZgAAA</bytes>
</object>
</object>
<string key="NSFrame">{{1, 1}, {276, 159}}</string>
<reference key="NSSuperview" ref="999118806"/>
+ <reference key="NSWindow"/>
+ <reference key="NSNextKeyView" ref="604863116"/>
</object>
</object>
<string key="NSFrame">{{17, 16}, {278, 175}}</string>
<reference key="NSSuperview" ref="185020864"/>
+ <reference key="NSWindow"/>
+ <reference key="NSNextKeyView" ref="512400001"/>
<string key="NSOffsets">{0, 0}</string>
<object class="NSTextFieldCell" key="NSTitleCell">
<int key="NSCellFlags">67239424</int>
<int key="NSCellFlags2">0</int>
- <string key="NSContents">Variables</string>
+ <string key="NSContents">Variables &amp; Unknown Functions</string>
<reference key="NSSupport" ref="26"/>
<reference key="NSBackgroundColor" ref="5740514"/>
<object class="NSColor" key="NSTextColor">
@@ -1633,6 +1659,8 @@
<int key="NSvFlags">266</int>
<string key="NSFrame">{{297, 174}, {166, 17}}</string>
<reference key="NSSuperview" ref="185020864"/>
+ <reference key="NSWindow"/>
+ <reference key="NSNextKeyView" ref="391889770"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="1028689629">
<int key="NSCellFlags">68288064</int>
@@ -1658,6 +1686,8 @@
<int key="NSvFlags">268</int>
<string key="NSFrame">{{297, 20}, {166, 146}}</string>
<reference key="NSSuperview" ref="185020864"/>
+ <reference key="NSWindow"/>
+ <reference key="NSNextKeyView"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="660768770">
<int key="NSCellFlags">67239424</int>
@@ -1676,10 +1706,13 @@
</object>
<string key="NSFrameSize">{480, 241}</string>
<reference key="NSSuperview"/>
+ <reference key="NSWindow"/>
+ <reference key="NSNextKeyView" ref="86551534"/>
</object>
<string key="NSScreenRect">{{0, 0}, {1440, 878}}</string>
<string key="NSMinSize">{480, 263}</string>
<string key="NSMaxSize">{480, 263}</string>
+ <bool key="NSWindowIsRestorable">YES</bool>
</object>
<object class="NSCustomObject" id="192271925">
<string key="NSClassName">DemoController</string>
@@ -1690,6 +1723,14 @@
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
+ <string key="label">orderFrontStandardAboutPanel:</string>
+ <reference key="source" ref="1021"/>
+ <reference key="destination" ref="238522557"/>
+ </object>
+ <int key="connectionID">142</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
<string key="label">performMiniaturize:</string>
<reference key="source" ref="1014"/>
<reference key="destination" ref="1011231497"/>
@@ -1730,14 +1771,6 @@
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
- <string key="label">orderFrontStandardAboutPanel:</string>
- <reference key="source" ref="1021"/>
- <reference key="destination" ref="238522557"/>
- </object>
- <int key="connectionID">142</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
<string key="label">performClose:</string>
<reference key="source" ref="1014"/>
<reference key="destination" ref="776162233"/>
@@ -1834,46 +1867,6 @@
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
- <string key="label">addFontTrait:</string>
- <reference key="source" ref="979998279"/>
- <reference key="destination" ref="159693274"/>
- </object>
- <int key="connectionID">418</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">addFontTrait:</string>
- <reference key="source" ref="979998279"/>
- <reference key="destination" ref="444973322"/>
- </object>
- <int key="connectionID">419</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">modifyFont:</string>
- <reference key="source" ref="979998279"/>
- <reference key="destination" ref="858413151"/>
- </object>
- <int key="connectionID">420</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">orderFrontFontPanel:</string>
- <reference key="source" ref="979998279"/>
- <reference key="destination" ref="476494771"/>
- </object>
- <int key="connectionID">421</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">modifyFont:</string>
- <reference key="source" ref="979998279"/>
- <reference key="destination" ref="128783481"/>
- </object>
- <int key="connectionID">422</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
<string key="label">raiseBaseline:</string>
<reference key="source" ref="1014"/>
<reference key="destination" ref="166867594"/>
@@ -2345,6 +2338,46 @@
<int key="connectionID">807</int>
</object>
<object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">addFontTrait:</string>
+ <reference key="source" ref="979998279"/>
+ <reference key="destination" ref="159693274"/>
+ </object>
+ <int key="connectionID">418</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">addFontTrait:</string>
+ <reference key="source" ref="979998279"/>
+ <reference key="destination" ref="444973322"/>
+ </object>
+ <int key="connectionID">419</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">modifyFont:</string>
+ <reference key="source" ref="979998279"/>
+ <reference key="destination" ref="858413151"/>
+ </object>
+ <int key="connectionID">420</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">orderFrontFontPanel:</string>
+ <reference key="source" ref="979998279"/>
+ <reference key="destination" ref="476494771"/>
+ </object>
+ <int key="connectionID">421</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">modifyFont:</string>
+ <reference key="source" ref="979998279"/>
+ <reference key="destination" ref="128783481"/>
+ </object>
+ <int key="connectionID">422</int>
+ </object>
+ <object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">answerField</string>
<reference key="source" ref="192271925"/>
@@ -3569,71 +3602,38 @@
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
+ <string>-1.IBPluginDependency</string>
+ <string>-2.IBPluginDependency</string>
<string>-3.IBPluginDependency</string>
<string>103.IBPluginDependency</string>
- <string>103.ImportedFromIB2</string>
- <string>106.IBEditorWindowLastContentRect</string>
<string>106.IBPluginDependency</string>
- <string>106.ImportedFromIB2</string>
- <string>106.editorWindowContentRectSynchronizationRect</string>
<string>111.IBPluginDependency</string>
- <string>111.ImportedFromIB2</string>
<string>112.IBPluginDependency</string>
- <string>112.ImportedFromIB2</string>
<string>124.IBPluginDependency</string>
- <string>124.ImportedFromIB2</string>
- <string>125.IBEditorWindowLastContentRect</string>
<string>125.IBPluginDependency</string>
- <string>125.ImportedFromIB2</string>
- <string>125.editorWindowContentRectSynchronizationRect</string>
<string>126.IBPluginDependency</string>
- <string>126.ImportedFromIB2</string>
<string>129.IBPluginDependency</string>
- <string>129.ImportedFromIB2</string>
<string>130.IBPluginDependency</string>
- <string>130.ImportedFromIB2</string>
- <string>130.editorWindowContentRectSynchronizationRect</string>
<string>131.IBPluginDependency</string>
- <string>131.ImportedFromIB2</string>
<string>134.IBPluginDependency</string>
- <string>134.ImportedFromIB2</string>
<string>136.IBPluginDependency</string>
- <string>136.ImportedFromIB2</string>
<string>143.IBPluginDependency</string>
- <string>143.ImportedFromIB2</string>
<string>144.IBPluginDependency</string>
- <string>144.ImportedFromIB2</string>
<string>145.IBPluginDependency</string>
- <string>145.ImportedFromIB2</string>
<string>149.IBPluginDependency</string>
- <string>149.ImportedFromIB2</string>
<string>150.IBPluginDependency</string>
- <string>150.ImportedFromIB2</string>
<string>19.IBPluginDependency</string>
- <string>19.ImportedFromIB2</string>
<string>23.IBPluginDependency</string>
- <string>23.ImportedFromIB2</string>
<string>236.IBPluginDependency</string>
- <string>236.ImportedFromIB2</string>
<string>239.IBPluginDependency</string>
- <string>239.ImportedFromIB2</string>
- <string>24.IBEditorWindowLastContentRect</string>
<string>24.IBPluginDependency</string>
- <string>24.ImportedFromIB2</string>
- <string>24.editorWindowContentRectSynchronizationRect</string>
- <string>29.IBEditorWindowLastContentRect</string>
<string>29.IBPluginDependency</string>
- <string>29.ImportedFromIB2</string>
- <string>29.WindowOrigin</string>
- <string>29.editorWindowContentRectSynchronizationRect</string>
<string>295.IBPluginDependency</string>
- <string>296.IBEditorWindowLastContentRect</string>
<string>296.IBPluginDependency</string>
- <string>296.editorWindowContentRectSynchronizationRect</string>
<string>297.IBPluginDependency</string>
<string>298.IBPluginDependency</string>
+ <string>371.IBPluginDependency</string>
<string>373.IBPluginDependency</string>
- <string>374.IBEditorWindowLastContentRect</string>
<string>374.IBPluginDependency</string>
<string>375.IBPluginDependency</string>
<string>386.IBPluginDependency</string>
@@ -3669,17 +3669,10 @@
<string>416.IBPluginDependency</string>
<string>417.IBPluginDependency</string>
<string>5.IBPluginDependency</string>
- <string>5.ImportedFromIB2</string>
<string>56.IBPluginDependency</string>
- <string>56.ImportedFromIB2</string>
- <string>57.IBEditorWindowLastContentRect</string>
<string>57.IBPluginDependency</string>
- <string>57.ImportedFromIB2</string>
- <string>57.editorWindowContentRectSynchronizationRect</string>
<string>58.IBPluginDependency</string>
- <string>58.ImportedFromIB2</string>
<string>681.IBPluginDependency</string>
- <string>682.IBEditorWindowLastContentRect</string>
<string>682.IBPluginDependency</string>
<string>683.IBPluginDependency</string>
<string>684.IBPluginDependency</string>
@@ -3703,27 +3696,23 @@
<string>712.IBPluginDependency</string>
<string>713.IBPluginDependency</string>
<string>714.IBPluginDependency</string>
- <string>715.IBEditorWindowLastContentRect</string>
<string>715.IBPluginDependency</string>
<string>716.IBPluginDependency</string>
<string>717.IBPluginDependency</string>
<string>718.IBPluginDependency</string>
<string>719.IBPluginDependency</string>
<string>72.IBPluginDependency</string>
- <string>72.ImportedFromIB2</string>
<string>720.IBPluginDependency</string>
<string>721.IBPluginDependency</string>
<string>722.IBPluginDependency</string>
<string>723.IBPluginDependency</string>
- <string>724.IBEditorWindowLastContentRect</string>
<string>724.IBPluginDependency</string>
<string>725.IBPluginDependency</string>
<string>726.IBPluginDependency</string>
<string>727.IBPluginDependency</string>
<string>728.IBPluginDependency</string>
<string>729.IBPluginDependency</string>
<string>73.IBPluginDependency</string>
- <string>73.ImportedFromIB2</string>
<string>730.IBPluginDependency</string>
<string>731.IBPluginDependency</string>
<string>732.IBPluginDependency</string>
@@ -3732,63 +3721,44 @@
<string>735.IBPluginDependency</string>
<string>736.IBPluginDependency</string>
<string>74.IBPluginDependency</string>
- <string>74.ImportedFromIB2</string>
<string>75.IBPluginDependency</string>
- <string>75.ImportedFromIB2</string>
<string>77.IBPluginDependency</string>
- <string>77.ImportedFromIB2</string>
<string>773.IBPluginDependency</string>
- <string>774.IBEditorWindowLastContentRect</string>
<string>774.IBPluginDependency</string>
<string>775.IBPluginDependency</string>
<string>776.IBPluginDependency</string>
<string>777.IBPluginDependency</string>
<string>778.IBPluginDependency</string>
<string>779.IBPluginDependency</string>
<string>78.IBPluginDependency</string>
- <string>78.ImportedFromIB2</string>
<string>780.IBPluginDependency</string>
<string>781.IBPluginDependency</string>
<string>782.IBPluginDependency</string>
<string>783.IBPluginDependency</string>
<string>784.IBPluginDependency</string>
- <string>785.IBEditorWindowLastContentRect</string>
<string>785.IBPluginDependency</string>
<string>786.IBPluginDependency</string>
<string>787.IBPluginDependency</string>
<string>788.IBPluginDependency</string>
<string>789.IBPluginDependency</string>
<string>79.IBPluginDependency</string>
- <string>79.ImportedFromIB2</string>
<string>790.IBPluginDependency</string>
<string>791.IBPluginDependency</string>
<string>792.IBPluginDependency</string>
<string>793.IBPluginDependency</string>
<string>794.IBPluginDependency</string>
<string>80.IBPluginDependency</string>
- <string>80.ImportedFromIB2</string>
- <string>81.IBEditorWindowLastContentRect</string>
<string>81.IBPluginDependency</string>
- <string>81.ImportedFromIB2</string>
- <string>81.editorWindowContentRectSynchronizationRect</string>
<string>82.IBPluginDependency</string>
- <string>82.ImportedFromIB2</string>
<string>83.IBPluginDependency</string>
- <string>83.ImportedFromIB2</string>
- <string>843.IBEditorWindowLastContentRect</string>
<string>843.IBPluginDependency</string>
<string>843.IBWindowTemplateEditedContentRect</string>
<string>843.NSWindowTemplate.visibleAtLaunch</string>
- <string>843.windowTemplate.hasMaxSize</string>
- <string>843.windowTemplate.hasMinSize</string>
- <string>843.windowTemplate.maxSize</string>
- <string>843.windowTemplate.minSize</string>
<string>844.IBPluginDependency</string>
<string>845.IBPluginDependency</string>
<string>846.IBPluginDependency</string>
<string>847.IBPluginDependency</string>
<string>848.IBPluginDependency</string>
- <string>848.IBViewBoundsToFrameTransform</string>
<string>849.IBPluginDependency</string>
<string>850.IBPluginDependency</string>
<string>851.IBPluginDependency</string>
@@ -3797,7 +3767,7 @@
<string>854.IBPluginDependency</string>
<string>855.IBPluginDependency</string>
<string>856.IBPluginDependency</string>
- <string>857.IBViewBoundsToFrameTransform</string>
+ <string>857.IBPluginDependency</string>
<string>858.IBNumberFormatterBehaviorMetadataKey</string>
<string>858.IBNumberFormatterLocalizesFormatMetadataKey</string>
<string>858.IBPluginDependency</string>
@@ -3806,75 +3776,38 @@
<string>861.IBPluginDependency</string>
<string>862.IBPluginDependency</string>
<string>92.IBPluginDependency</string>
- <string>92.ImportedFromIB2</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1"/>
- <string>{{743, 524}, {217, 23}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1"/>
- <string>{{596, 852}, {216, 23}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1"/>
- <string>{{479, 484}, {132, 23}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1"/>
- <string>{{522, 812}, {146, 23}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1"/>
- <string>{{436, 809}, {64, 6}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1"/>
- <string>{{672, 474}, {194, 73}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1"/>
- <string>{{525, 802}, {197, 73}}</string>
- <string>{{958, 836}, {482, 20}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1"/>
- <string>{74, 862}</string>
- <string>{{11, 977}, {478, 20}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{622, 504}, {231, 43}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{475, 832}, {234, 43}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{739, 778}, {83, 43}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
@@ -3910,17 +3843,10 @@
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1"/>
- <string>{{517, 638}, {246, 183}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1"/>
- <string>{{23, 794}, {245, 183}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{695, 538}, {254, 283}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
@@ -3944,27 +3870,23 @@
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{766, 174}, {182, 153}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{766, 234}, {275, 113}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
@@ -3973,65 +3895,47 @@
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{822, 618}, {204, 183}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{1026, 538}, {164, 173}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1"/>
- <string>{{653, 618}, {196, 203}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1"/>
- <string>{{323, 672}, {199, 203}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1"/>
- <string>{{470, 326}, {480, 241}}</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>{{470, 326}, {480, 241}}</string>
<boolean value="YES"/>
- <boolean value="YES"/>
- <boolean value="YES"/>
- <string>{480, 241}</string>
- <string>{480, 241}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <object class="NSAffineTransform">
- <bytes key="NSTransformStruct">P4AAAL+AAABBoAAAw1oAAA</bytes>
- </object>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
@@ -4040,9 +3944,7 @@
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <object class="NSAffineTransform">
- <bytes key="NSTransformStruct">AT+AAABAoAAAA</bytes>
- </object>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1041"/>
<boolean value="YES"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
@@ -4051,23 +3953,18 @@
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1"/>
</object>
</object>
<object class="NSMutableDictionary" key="unlocalizedProperties">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference key="dict.sortedKeys" ref="0"/>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- </object>
+ <reference key="dict.values" ref="0"/>
</object>
<nil key="activeLocalization"/>
<object class="NSMutableDictionary" key="localizations">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference key="dict.sortedKeys" ref="0"/>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- </object>
+ <reference key="dict.values" ref="0"/>
</object>
<nil key="sourceID"/>
<int key="maxID">867</int>
@@ -4119,175 +4016,18 @@
</object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
- <string key="minorKey">DemoController.h</string>
- </object>
- </object>
- </object>
- <object class="NSMutableArray" key="referencedPartialClassDescriptionsV3.2+">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="IBPartialClassDescription">
- <string key="className">NSFormatter</string>
- <string key="superclassName">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">Foundation.framework/Headers/NSFormatter.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSNumberFormatter</string>
- <string key="superclassName">NSFormatter</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">Foundation.framework/Headers/NSNumberFormatter.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">Foundation.framework/Headers/NSArchiver.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">Foundation.framework/Headers/NSClassDescription.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">Foundation.framework/Headers/NSError.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">Foundation.framework/Headers/NSFileManager.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">Foundation.framework/Headers/NSKeyValueCoding.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">Foundation.framework/Headers/NSKeyValueObserving.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">Foundation.framework/Headers/NSKeyedArchiver.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">Foundation.framework/Headers/NSObject.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">Foundation.framework/Headers/NSObjectScripting.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">Foundation.framework/Headers/NSPortCoder.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">Foundation.framework/Headers/NSRunLoop.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">Foundation.framework/Headers/NSScriptClassDescription.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">Foundation.framework/Headers/NSScriptKeyValueCoding.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">Foundation.framework/Headers/NSScriptObjectSpecifiers.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">Foundation.framework/Headers/NSScriptWhoseTests.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">Foundation.framework/Headers/NSThread.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">Foundation.framework/Headers/NSURL.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">Foundation.framework/Headers/NSURLConnection.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">Foundation.framework/Headers/NSURLDownload.h</string>
+ <string key="minorKey">./Classes/DemoController.h</string>
</object>
</object>
</object>
</object>
<int key="IBDocument.localizationMode">0</int>
<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaFramework</string>
- <object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencyDefaults">
- <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.macosx</string>
- <integer value="1060" key="NS.object.0"/>
- </object>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3</string>
<integer value="3000" key="NS.object.0"/>
</object>
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
- <string key="IBDocument.LastKnownRelativeProjectPath">DDMathParser.xcodeproj</string>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
<object class="NSMutableDictionary" key="IBDocument.LastKnownImageSizes">
<bool key="EncodedWithXMLCoder">YES</bool>
View
51 Demo/DemoController.m
@@ -29,6 +29,7 @@ - (void) dealloc {
[orderedVariables release];
[variables release];
+ [evaluator release];
[super dealloc];
}
#endif
@@ -39,20 +40,58 @@ - (void) awakeFromNib {
variables = [[NSMutableDictionary alloc] init];
}
-- (NSArray *) variablesInExpression:(DDExpression *)e {
+- (DDMathEvaluator *)evaluator {
+ if (evaluator == nil) {
+ NSDictionary *parameters = nil;
+ __block DemoController *blockSelf = self;
+
+ DDMathEvaluator *evaluator = [[DDMathEvaluator alloc] init];
+ [evaluator setFunctionResolver:^(NSString *name) {
+ NSLog(@"resolving function: %@", name);
+
+ DDMathFunction resolved = ^DDExpression* (NSArray *args, NSDictionary *substitutions, DDMathEvaluator *evaluator, NSError **error) {
+ if ([args count] > 0) {
+ if (error) {
+ *error = [NSError errorWithDomain:@"com.davedelong.ddmathparser.demo" code:-1 userInfo:nil];
+ }
+ return nil;
+ }
+ NSDictionary *vars = blockSelf->variables;
+ NSNumber *n = [vars objectForKey:name];
+ return [DDExpression numberExpressionWithNumber:n];
+ };
+
+ return DD_AUTORELEASE([resolved copy]);
+ }];
+ }
+
+ return evaluator;
+}
+
+- (NSArray *) variablesAndFunctionsInExpression:(DDExpression *)e {
NSMutableArray * v = [NSMutableArray array];
+ BOOL shouldRecurse = NO;
if ([e expressionType] == DDExpressionTypeVariable) {
[v addObject:[e variable]];
- } else if ([e expressionType] == DDExpressionTypeFunction) {
+ } else if ([e expressionType] == DDExpressionTypeFunction) {
+ DDMathEvaluator *eval = [self evaluator];
+ if ([[eval registeredFunctions] containsObject:[e function]]) {
+ shouldRecurse = YES;
+ } else {
+ [v addObject:[e function]];
+ }
+ }
+
+ if (shouldRecurse) {
for (DDExpression * se in [e arguments]) {
- [v addObjectsFromArray:[self variablesInExpression:se]];
+ [v addObjectsFromArray:[self variablesAndFunctionsInExpression:se]];
}
}
return v;
}
- (void) updateVariablesWithExpression:(DDExpression *)e {
- NSArray * v = [self variablesInExpression:e];
+ NSArray * v = [self variablesAndFunctionsInExpression:e];
NSMutableSet * keysThatShouldBeRemoved = [NSMutableSet setWithArray:[variables allKeys]];
[keysThatShouldBeRemoved minusSet:[NSSet setWithArray:v]];
@@ -69,14 +108,16 @@ - (void) updateVariablesWithExpression:(DDExpression *)e {
}
- (void) evaluate {
+ DDMathEvaluator *eval = [self evaluator];
+
NSString * string = [inputField stringValue];
NSError *error = nil;
if ([string length] > 0) {
DDExpression * expression = [DDExpression expressionFromString:string error:&error];
if (error == nil) {
NSLog(@"parsed: %@", expression);
[self updateVariablesWithExpression:expression];
- NSNumber * result = [expression evaluateWithSubstitutions:variables evaluator:nil error:&error];
+ NSNumber * result = [expression evaluateWithSubstitutions:variables evaluator:eval error:&error];
if (error == nil) {
[answerField setTextColor:[NSColor blackColor]];
[answerField setStringValue:[result description]];

0 comments on commit b132b37

Please sign in to comment.