├── .gitignore ├── .gitmodules ├── ASDictionary ├── ASDictionary.h ├── ASDictionary.m ├── ASDictionaryClass.m ├── ASDictionaryObject.h ├── ASDictionaryObject.m ├── ASDictionaryStream.h ├── ASDictionaryStream.m ├── ASDictionarySuite.m └── ASDictionaryVerb.m ├── Export ├── SdefTemplate.h ├── SdefTemplate.m ├── SdtplGenerator.h ├── SdtplGenerator.m ├── SdtplWindow.h └── SdtplWindow.m ├── Import ├── AeteClass.m ├── AeteEnumeration.m ├── AeteImporter.h ├── AeteImporter.m ├── AeteObject.h ├── AeteObject.m ├── AeteSuite.m ├── AeteVerb.m ├── CocoaClass.m ├── CocoaEnumeration.m ├── CocoaObject.h ├── CocoaObject.m ├── CocoaSuite.m ├── CocoaSuiteImporter.h ├── CocoaSuiteImporter.m ├── CocoaVerb.m ├── OSASdefImporter.h ├── OSASdefImporter.m ├── SdefImporter.h └── SdefImporter.m ├── Interface ├── Headers │ ├── ImportApplicationAete.h │ ├── ImporterWarning.h │ ├── Preferences.h │ ├── SdefClassView.h │ ├── SdefDictionaryView.h │ ├── SdefEnumerationView.h │ ├── SdefExporterController.h │ ├── SdefSuiteView.h │ ├── SdefSymbolBrowser.h │ ├── SdefTypesEditor.h │ ├── SdefVerbView.h │ ├── SdefViewController.h │ └── SdefWindowController.h ├── ImportApplicationAete.m ├── ImporterWarning.m ├── Preferences.m ├── SdefClassView.m ├── SdefDictionaryView.m ├── SdefEnumerationView.m ├── SdefExporterController.m ├── SdefLogWindow.xib ├── SdefLogWindowController.h ├── SdefLogWindowController.m ├── SdefSuiteView.m ├── SdefSymbolBrowser.m ├── SdefToolbar.m ├── SdefTypesEditor.m ├── SdefVerbView.m ├── SdefViewController.m ├── SdefWindowController.m ├── SdefXIncludeView.h └── SdefXIncludeView.m ├── Misc ├── ReadMe.html ├── Sdef Editor Help │ ├── Sdef Editor Help.helpindex │ ├── SdefEditor.html │ ├── images │ │ ├── Class-Extension.png │ │ ├── Class.png │ │ ├── Contents.png │ │ ├── Dictionary.png │ │ ├── Element.png │ │ ├── Enum.png │ │ ├── Export.png │ │ ├── Field.png │ │ ├── Function.png │ │ ├── Icon_16.png │ │ ├── Icon_32.png │ │ ├── Inspector.png │ │ ├── Member.png │ │ ├── Misc.png │ │ ├── Param.png │ │ ├── Result.png │ │ ├── SdefEditor.png │ │ ├── Struct.png │ │ ├── Suite.png │ │ ├── Type.png │ │ ├── Variable.png │ │ ├── browser-window.png │ │ ├── dot.png │ │ ├── editor-window.png │ │ ├── validator.png │ │ ├── version.png │ │ ├── versioning.png │ │ ├── vertline2.gif │ │ └── warning.png │ ├── pages │ │ ├── browser.html │ │ ├── edition.html │ │ ├── export.html │ │ ├── history.html │ │ ├── import.html │ │ ├── index.html │ │ ├── sdef-editor.html │ │ ├── validation.html │ │ └── version.html │ ├── sdef-format.html │ └── styles │ │ ├── custom_style.css │ │ ├── home.css │ │ └── task_style.css ├── SdefEditor.psd ├── SdefFile.psd └── sdp.html ├── README.md ├── Resources ├── AppleScriptKit.sdef ├── CocoaStandard.sdef ├── Compatibility.sdef ├── English.lproj │ ├── InfoPlist.strings │ ├── Localizable.strings │ └── SdefLibrary.strings ├── Images │ ├── AddMini.tiff │ ├── AddMini_Pressed.tiff │ ├── AddType.tiff │ ├── Bookmarks.tiff │ ├── Box.tiff │ ├── Check.tiff │ ├── Class-Extension.tiff │ ├── Class.tiff │ ├── Content.tiff │ ├── Dictionary.tiff │ ├── EditSymbol.tiff │ ├── EditType.tiff │ ├── Element.tiff │ ├── Enum.tiff │ ├── Field.tiff │ ├── Folder.tiff │ ├── Function.tiff │ ├── Member.tiff │ ├── MiniPlus.tiff │ ├── Misc.tiff │ ├── Param.tiff │ ├── Property.tiff │ ├── Record.tiff │ ├── RemoveMini.tiff │ ├── RemoveMini_Pressed.tiff │ ├── Suite.tiff │ ├── Type.tiff │ ├── Value.tiff │ ├── Variable.tiff │ ├── XInclude.tiff │ ├── valid-error.tiff │ ├── valid-note.tiff │ ├── valid-warning.tiff │ └── warning.tiff ├── Info.plist ├── NSCoreSuite.sdef ├── NSTextSuite.sdef ├── ScriptSuiteIcon.icns ├── Sdef Editor.entitlements ├── Sdef Editor.xcassets │ ├── AppIcon.appiconset │ │ ├── Contents.json │ │ ├── icon_128x128.png │ │ ├── icon_16x16.png │ │ └── icon_32x32.png │ └── Contents.json ├── SdefDictionary.icns ├── SdefFile.icns ├── SdefModel.xcdatamodeld │ └── SdefModel.xcdatamodel │ │ └── contents ├── SdtplBundle.icns ├── Skeleton.sdef ├── Templates │ ├── AppleDictionary.sdtpl │ │ ├── Definition.plist │ │ ├── Info.plist │ │ ├── asdictionary.css │ │ ├── asgreen.css │ │ ├── dictionary.tpl │ │ └── toc.tpl │ ├── AppleRTFDictionary.sdtpl │ │ ├── Definition.plist │ │ ├── Info.plist │ │ └── dictionary.rtf │ ├── Frame Dictionary.sdtpl │ │ ├── Definition.plist │ │ ├── Info.plist │ │ ├── Info.rtf │ │ ├── asdictionary.css │ │ ├── asgreen.css │ │ ├── dictionary.tpl │ │ ├── index.tpl │ │ └── toc.tpl │ └── Sample.sdef └── en.lproj │ ├── ImportApplicationAete.xib │ ├── ImportApplicationSdef.xib │ ├── MainMenu.xib │ ├── Preferences.xib │ ├── SdefClass.xib │ ├── SdefDictionary.xib │ ├── SdefDocument.xib │ ├── SdefEnumeration.xib │ ├── SdefExport.xib │ ├── SdefImporterWarning.xib │ ├── SdefInspector.xib │ ├── SdefRecord.xib │ ├── SdefSuite.xib │ ├── SdefSymbolBrowser.xib │ ├── SdefTypesEditor.xib │ ├── SdefValidator.xib │ ├── SdefVerb.xib │ └── SdtplExport.xib ├── Sdef Editor.xcodeproj ├── project.pbxproj └── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ ├── IDEWorkspaceChecks.plist │ └── Sdef Editor.xccheckout ├── SdefDocument.h ├── SdefDocument.m ├── SdefEditor.h ├── SdefEditor.m ├── SdefLibrary ├── Headers │ ├── SdefAccessGroup.h │ ├── SdefArguments.h │ ├── SdefBase.h │ ├── SdefClass.h │ ├── SdefClassManager.h │ ├── SdefComment.h │ ├── SdefContents.h │ ├── SdefDictionary.h │ ├── SdefDocumentation.h │ ├── SdefImplementation.h │ ├── SdefLeaf.h │ ├── SdefObjects.h │ ├── SdefSuite.h │ ├── SdefSynonym.h │ ├── SdefType.h │ ├── SdefTypedef.h │ ├── SdefVerb.h │ ├── SdefXInclude.h │ └── SdefXRef.h ├── SdefAccessGroup.m ├── SdefArguments.m ├── SdefBase.m ├── SdefClass.m ├── SdefClassManager.m ├── SdefComment.m ├── SdefContents.m ├── SdefDictionary.m ├── SdefDocumentation.m ├── SdefImplementation.m ├── SdefLeaf.m ├── SdefObjects.m ├── SdefSuite.m ├── SdefSynonym.m ├── SdefType.m ├── SdefTypedef.m ├── SdefVerb.m ├── SdefXInclude.m ├── SdefXRef.m ├── Validator │ ├── SdefClassValidator.m │ ├── SdefLeavesValidator.m │ ├── SdefObjectValidator.m │ ├── SdefTypeValidator.m │ ├── SdefValidator.h │ ├── SdefValidator.m │ ├── SdefValidatorBase.h │ └── SdefVerbValidator.m └── XML │ ├── Parser │ ├── Headers │ │ ├── SdefDocumentationParser.h │ │ ├── SdefParser.h │ │ └── SdefXMLValidator.h │ ├── SdefDocumentationParser.m │ ├── SdefParser.m │ ├── SdefParserInternal.h │ ├── SdefParserInternal.m │ └── SdefXMLValidator.m │ ├── SdefXMLAccessGroup.m │ ├── SdefXMLBase.h │ ├── SdefXMLBase.m │ ├── SdefXMLClass.m │ ├── SdefXMLDictionary.m │ ├── SdefXMLLeaves.m │ ├── SdefXMLObjects.m │ ├── SdefXMLSuite.m │ ├── SdefXMLTypes.m │ ├── SdefXMLVerb.m │ └── Writer │ ├── SdefXMLGenerator.h │ ├── SdefXMLGenerator.m │ ├── SdefXMLNode.h │ └── SdefXMLNode.m ├── SdefObjectInspector.h ├── SdefObjectInspector.m ├── SdefProcessor.h ├── SdefProcessor.m ├── SdtplChecker ├── Info.plist ├── Resources │ ├── Block.tiff │ ├── Definitions │ │ ├── Class.plist │ │ ├── Dictionary.plist │ │ ├── Toc.plist │ │ └── Verb.plist │ ├── Disable.tif │ ├── Enabled.png │ ├── English.lproj │ │ └── InfoPlist.strings │ ├── ErrorIcon.tiff │ ├── MainMenu.nib │ │ ├── classes.nib │ │ ├── info.nib │ │ └── keyedobjects.nib │ ├── SdtplBundle.icns │ ├── SdtplChecker.icns │ ├── Template.tiff │ ├── Variable.tiff │ └── WarningIcon.tiff ├── SKTemplateChecker.m ├── SdefTemplateCheck.h ├── SdefTemplateCheck.m ├── SdtplChecker.h ├── SdtplChecker.m └── SdtplChecker.xcodeproj │ └── project.pbxproj ├── sdef.rtf └── xcconfigs ├── debug.xcconfig ├── project.xcconfig ├── release.xcconfig ├── target └── team.xcconfig /.gitignore: -------------------------------------------------------------------------------- 1 | DerivedData 2 | xcuserdata 3 | Misc -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "hadron"] 2 | path = hadron 3 | url = git@github.com:Jean-Daniel/hadron.git 4 | branch = master 5 | [submodule "WonderBox"] 6 | path = WonderBox 7 | url = git@github.com:Jean-Daniel/WonderBox.git 8 | branch = master 9 | -------------------------------------------------------------------------------- /ASDictionary/ASDictionary.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ASDictionary.h 3 | * Sdef Editor 4 | * 5 | * Created by Rainbow Team. 6 | * Copyright © 2006 - 2007 Shadow Lab. All rights reserved. 7 | */ 8 | 9 | #import 10 | 11 | #if !__LP64__ 12 | @class SdefDictionary; 13 | SPX_PRIVATE 14 | NSDictionary *AppleScriptDictionaryFromSdefDictionary(SdefDictionary *sdef); 15 | #endif 16 | -------------------------------------------------------------------------------- /ASDictionary/ASDictionary.m: -------------------------------------------------------------------------------- 1 | /* 2 | * ASDictionary.m 3 | * Sdef Editor 4 | * 5 | * Created by Rainbow Team. 6 | * Copyright © 2006 - 2007 Shadow Lab. All rights reserved. 7 | */ 8 | 9 | #import "ASDictionary.h" 10 | 11 | #import "SdefDictionary.h" 12 | #import "ASDictionaryObject.h" 13 | #import "ASDictionaryStream.h" 14 | 15 | #if !__LP64__ 16 | 17 | #pragma mark - 18 | NSDictionary *AppleScriptDictionaryFromSdefDictionary(SdefDictionary *sdef) { 19 | NSMutableArray *suites = [[NSMutableArray alloc] init]; 20 | NSDictionary *asdict = [[NSDictionary alloc] initWithObjectsAndKeys: 21 | [sdef name], @"dictionary name", 22 | suites, @"script dictionary", 23 | nil]; 24 | [suites release]; 25 | /* Load AppleScript User Preferences */ 26 | [ASDictionaryStream loadStandardsAppleScriptStyles]; 27 | 28 | SdefObject *suite; 29 | NSEnumerator *enume = [sdef childEnumerator]; 30 | while (suite = [enume nextObject]) { 31 | id asSuite = [suite asdictionary]; 32 | if (asSuite) 33 | [suites addObject:asSuite]; 34 | } 35 | return [asdict autorelease]; 36 | } 37 | 38 | #endif /* LP64 */ 39 | -------------------------------------------------------------------------------- /ASDictionary/ASDictionaryObject.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ASDictionaryObject.h 3 | * Sdef Editor 4 | * 5 | * Created by Rainbow Team. 6 | * Copyright © 2006 - 2007 Shadow Lab. All rights reserved. 7 | */ 8 | 9 | #import "SdefBase.h" 10 | 11 | @interface SdefObject (ASDictionary) 12 | 13 | #if !__LP64__ 14 | 15 | - (NSDictionary *)asdictionary; 16 | - (NSDictionary *)asdictionaryString; 17 | 18 | #endif /* LP64 */ 19 | 20 | - (NSString *)asDictionaryTypeForType:(NSString *)type isList:(BOOL *)list; 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /ASDictionary/ASDictionaryObject.m: -------------------------------------------------------------------------------- 1 | /* 2 | * ASDictionaryObject.m 3 | * Sdef Editor 4 | * 5 | * Created by Rainbow Team. 6 | * Copyright © 2006 - 2007 Shadow Lab. All rights reserved. 7 | */ 8 | 9 | #import "ASDictionaryObject.h" 10 | #import "SdefClassManager.h" 11 | #import "SdefDocument.h" 12 | 13 | @implementation SdefObject (ASDictionary) 14 | 15 | #if !__LP64__ 16 | 17 | - (NSDictionary *)asdictionary { 18 | [NSException raise:NSInternalInconsistencyException format:@"Method %@ must be implemented by sublass %@", 19 | NSStringFromSelector(_cmd), NSStringFromClass([self class])]; 20 | return nil; 21 | } 22 | 23 | - (NSDictionary *)asdictionaryString { 24 | [NSException raise:NSInternalInconsistencyException format:@"Method %@ must be implemented by sublass %@", 25 | NSStringFromSelector(_cmd), NSStringFromClass([self class])]; 26 | return nil; 27 | } 28 | 29 | #endif /* LP64 */ 30 | 31 | - (NSString *)asDictionaryTypeForType:(NSString *)type isList:(BOOL *)list { 32 | if (!type) return @""; 33 | if (list) 34 | *list = NO; 35 | 36 | if ([type hasPrefix:@"list of "]) { 37 | if (list) 38 | *list = YES; 39 | type = [type substringFromIndex:8]; 40 | } 41 | 42 | SEL equalSel = @selector(isEqualToString:); 43 | BOOL (*equal)(id, SEL, id) = (BOOL(*)(id, SEL, id))[type methodForSelector:equalSel]; 44 | 45 | if (equal(type, equalSel, @"string")) 46 | return @"Unicode text"; 47 | if (equal(type, equalSel, @"real")) 48 | return @"small real"; 49 | if (equal(type, equalSel, @"type")) 50 | return @"type class"; 51 | if (equal(type, equalSel, @"file")) 52 | return @"alias"; 53 | if (equal(type, equalSel, @"object")) 54 | return @"reference"; 55 | if (equal(type, equalSel, @"location")) 56 | return @"location reference"; 57 | if (equal(type, equalSel, @"any")) 58 | return @"anything"; 59 | if (equal(type, equalSel, @"rectangle")) 60 | return @"bounding rectangle"; 61 | id manager = [self classManager]; 62 | if (manager) { 63 | id enume = [manager enumerationWithName:type]; 64 | if (enume && [enume hasChildren]) { 65 | id str = [NSMutableString string]; 66 | id values = [enume childEnumerator]; 67 | id value = [values nextObject]; 68 | while (value) { 69 | [str appendString:[value name]]; 70 | value = [values nextObject]; 71 | if (value) 72 | [str appendString:@"/"]; 73 | } 74 | return str; 75 | } 76 | } 77 | return type; 78 | } 79 | 80 | @end 81 | 82 | -------------------------------------------------------------------------------- /ASDictionary/ASDictionaryStream.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ASDictionaryStream.h 3 | * Sdef Editor 4 | * 5 | * Created by Rainbow Team. 6 | * Copyright © 2006 - 2007 Shadow Lab. All rights reserved. 7 | */ 8 | 9 | #import 10 | 11 | #if !__LP64__ 12 | 13 | #pragma mark Types Definition 14 | struct ASDictionaryStyle { 15 | UInt32 position; 16 | SInt16 fontWidth; 17 | SInt16 fontAscent; 18 | SInt16 fontFamily; 19 | Style fontStyle; 20 | Byte b1; 21 | UInt16 fontSize; 22 | UInt16 red; 23 | UInt16 green; 24 | UInt16 blue; 25 | }; 26 | typedef struct ASDictionaryStyle ASDictionaryStyle; 27 | 28 | typedef enum { 29 | kASStyleComment = 0, 30 | kASStyleStandard = 1, 31 | kASStyleLanguageKeyword = 2, 32 | kASStyleApplicationKeyword = 3, 33 | } ASDictionaryStyleType; 34 | 35 | #pragma mark - 36 | extern NSDictionary *ASDictionaryStringForAttributedString(NSAttributedString *aString); 37 | extern NSAttributedString *AttributedStringForASDictionaryString(NSDictionary *content); 38 | 39 | #pragma mark - 40 | @interface ASDictionaryStream : NSObject { 41 | @private 42 | NSMutableData *as_styles; 43 | NSMutableString *as_string; 44 | ASDictionaryStyle as_style; 45 | } 46 | 47 | + (void)loadStandardsAppleScriptStyles; 48 | + (void)getStyle:(ASDictionaryStyle *)style forApplescriptStyle:(ASDictionaryStyleType)aStyle; 49 | 50 | - (id)initWithString:(NSString *)aString; 51 | - (id)initWithAttributedString:(NSAttributedString *)aString; 52 | 53 | - (id)initWithASDictionaryString:(NSDictionary *)aDictionary; 54 | 55 | - (NSString *)string; 56 | - (NSDictionary *)asDictionaryString; 57 | - (NSAttributedString *)attributedString; 58 | 59 | - (void)appendString:(NSString *)aString; 60 | - (void)appendFormat:(NSString *)format, ...; 61 | 62 | - (void)setASDictionaryStyle:(ASDictionaryStyleType)aStyle; 63 | 64 | - (void)setFont:(NSFont *)aFont; 65 | 66 | - (void)setSize:(FMFontSize)aSize; 67 | - (void)setStyle:(FMFontStyle)aStyle; 68 | - (void)setFontFamily:(NSString *)name; 69 | - (void)setFontFamily:(NSString *)fontName style:(FMFontStyle)aStyle size:(FMFontSize)aSize; 70 | 71 | - (void)setBold:(BOOL)flag; 72 | - (void)setItalic:(BOOL)flag; 73 | - (void)setUnderline:(BOOL)flag; 74 | 75 | - (void)setColor:(NSColor *)aColor; 76 | 77 | /*! 78 | @method setRed:green:blue: 79 | @abstract Set current style color. Value are 16 bit unsigned integer (0 - 65535) 80 | @param red Red component 81 | @param green Green component 82 | @param blue Blue component 83 | */ 84 | - (void)setRed:(UInt16)red green:(UInt16)green blue:(UInt16)blue; 85 | 86 | - (void)closeStyle; 87 | 88 | @end 89 | 90 | #endif /* LP64 */ 91 | -------------------------------------------------------------------------------- /ASDictionary/ASDictionarySuite.m: -------------------------------------------------------------------------------- 1 | /* 2 | * ASDictionarySuite.m 3 | * Sdef Editor 4 | * 5 | * Created by Rainbow Team. 6 | * Copyright © 2006 - 2007 Shadow Lab. All rights reserved. 7 | */ 8 | 9 | #include 10 | 11 | #import "ASDictionaryObject.h" 12 | #import "ASDictionaryStream.h" 13 | #import "SdefSuite.h" 14 | 15 | #if !__LP64__ 16 | 17 | @implementation SdefSuite (ASDictionary) 18 | 19 | - (NSDictionary *)asdictionary { 20 | if (SdefOSTypeFromString([self code]) == kASTypeNamesSuite) /* Hidden terms */ 21 | return nil; 22 | 23 | id dict = [NSMutableDictionary dictionary]; 24 | NSString *name = [self name]; 25 | [dict setObject:(name) ? name : @"" forKey:@"name"]; 26 | [dict setObject:[self asdictionaryString] forKey:@"suite description"]; 27 | 28 | id classes = [NSMutableArray array]; 29 | id objects = [[self classes] childEnumerator]; 30 | SdefObject *object; 31 | while (object = [objects nextObject]) { 32 | @try { 33 | [classes addObject:[object asdictionary]]; 34 | } @catch (id exception) { 35 | spx_log_exception(exception); 36 | } 37 | } 38 | if ([classes count]) 39 | [dict setObject:classes forKey:@"classes"]; 40 | 41 | /* Commands */ 42 | id events = [NSMutableArray array]; 43 | objects = [[self commands] childEnumerator]; 44 | while (object = [objects nextObject]) { 45 | @try { 46 | [events addObject:[object asdictionary]]; 47 | } @catch (id exception) { 48 | spx_log_exception(exception); 49 | } 50 | } 51 | /* Events */ 52 | objects = [[self events] childEnumerator]; 53 | while (object = [objects nextObject]) { 54 | @try { 55 | [events addObject:[object asdictionary]]; 56 | } @catch (id exception) { 57 | spx_log_exception(exception); 58 | } 59 | } 60 | if ([events count]) 61 | [dict setObject:events forKey:@"events"]; 62 | 63 | return dict; 64 | } 65 | 66 | - (NSDictionary *)asdictionaryString { 67 | ASDictionaryStream *stream = [[ASDictionaryStream alloc] init]; 68 | [stream setFontFamily:@"Times" style:bold size:18]; 69 | NSString *name = [self name]; 70 | [stream appendString:(name) ? : @""]; 71 | [stream appendString:@": "]; 72 | [stream closeStyle]; 73 | 74 | [stream setStyle:bold | italic]; 75 | [stream appendString:[self desc] ? : @""]; 76 | [stream appendString:@"\n\r"]; 77 | [stream closeStyle]; 78 | 79 | id dict = [stream asDictionaryString]; 80 | [stream release]; 81 | return dict; 82 | } 83 | 84 | @end 85 | 86 | #endif /* LP64 */ 87 | -------------------------------------------------------------------------------- /Export/SdefTemplate.h: -------------------------------------------------------------------------------- 1 | /* 2 | * SdefTemplate.h 3 | * Sdef Editor 4 | * 5 | * Created by Rainbow Team. 6 | * Copyright © 2006 - 2007 Shadow Lab. All rights reserved. 7 | */ 8 | 9 | #import 10 | 11 | enum { 12 | kSdefTemplateTOCNone = 0, 13 | kSdefTemplateTOCIndex = 1 << 0, 14 | kSdefTemplateTOCDictionary = 1 << 1, 15 | kSdefTemplateTOCExternal = 1 << 2, 16 | kSdefTemplateTOCRequired = 1 << 3 17 | }; 18 | 19 | enum { 20 | kSdefTemplateCSSNone = 0, 21 | kSdefTemplateCSSInline = 1 << 0, 22 | kSdefTemplateCSSExternal = 1 << 1 23 | }; 24 | 25 | /* Definition */ 26 | extern NSString * const SdtplDefinitionTocKey; 27 | extern NSString * const SdtplDefinitionIndexKey; 28 | extern NSString * const SdtplDefinitionDictionaryKey; 29 | extern NSString * const SdtplDefinitionSuitesKey; 30 | extern NSString * const SdtplDefinitionClassesKey; 31 | extern NSString * const SdtplDefinitionCommandsKey; 32 | extern NSString * const SdtplDefinitionEventsKey; 33 | 34 | /* Definition Options */ 35 | extern NSString * const SdtplDefinitionFileKey; 36 | extern NSString * const SdtplDefinitionFileEncoding; 37 | extern NSString * const SdtplDefinitionSingleFileKey; 38 | extern NSString * const SdtplDefinitionRemoveBlockLine; 39 | 40 | /* Variables */ 41 | extern NSString * const StdplVariableLinks; 42 | extern NSString * const StdplVariableStyleLink; 43 | extern NSString * const StdplVariableAnchorFormat; 44 | 45 | /* Misc */ 46 | extern NSString * const SdefInvalidTemplateException; 47 | 48 | @class WBTemplate; 49 | @interface SdefTemplate : NSObject { 50 | NSString *sd_path; 51 | NSString *sd_name; 52 | struct _sd_tpFlags { 53 | unsigned int css:4; 54 | unsigned int toc:4; 55 | unsigned int html:1; 56 | unsigned int :7; 57 | } sd_tpFlags; 58 | NSArray *sd_styles; 59 | NSString *sd_information; 60 | NSDictionary *sd_selectedStyle; /* Weak */ 61 | NSMutableDictionary *sd_infos, *sd_tpls, *sd_def; 62 | } 63 | 64 | + (NSDictionary *)findAllTemplates; 65 | 66 | - (id)initWithPath:(NSString *)aPath; 67 | 68 | - (NSString *)path; 69 | - (void)setPath:(NSString *)path; 70 | 71 | - (NSString *)information; 72 | - (NSString *)displayName; 73 | - (NSString *)extension; 74 | - (NSString *)menuName; 75 | 76 | - (NSDictionary *)formats; 77 | - (NSDictionary *)templates; 78 | - (NSDictionary *)definition; 79 | 80 | - (NSArray *)styles; 81 | - (NSDictionary *)selectedStyle; 82 | - (void)setSelectedStyle:(NSDictionary *)style; 83 | 84 | - (BOOL)isHtml; 85 | 86 | - (BOOL)indexToc; 87 | - (BOOL)dictionaryToc; 88 | - (BOOL)externalToc; 89 | - (BOOL)requiredToc; 90 | 91 | - (unsigned)toc; 92 | - (void)setToc:(unsigned)toc; 93 | 94 | - (unsigned)css; 95 | - (void)setCss:(unsigned)css; 96 | 97 | @end 98 | -------------------------------------------------------------------------------- /Export/SdtplGenerator.h: -------------------------------------------------------------------------------- 1 | /* 2 | * SdtplGenerator.h 3 | * Sdef Editor 4 | * 5 | * Created by Rainbow Team. 6 | * Copyright © 2006 - 2007 Shadow Lab. All rights reserved. 7 | */ 8 | 9 | #import "SdefBase.h" 10 | 11 | enum { 12 | kSdtplInline = 0, 13 | kSdtplSingleFile = 1, 14 | kSdtplMultiFiles = 2, 15 | }; 16 | 17 | enum { 18 | kSdefTemplateDefaultFormat, 19 | kSdefTemplateXMLFormat, 20 | }; 21 | 22 | SPX_PRIVATE 23 | NSString * const SdtplBlockTableOfContent; 24 | 25 | @class SdefObject, SdefDictionary; 26 | @class SdefTemplate, SdefClassManager; 27 | @interface SdtplGenerator : NSObject { 28 | struct _sd_gnFlags { 29 | unsigned int toc:4; /* OK */ 30 | unsigned int css:4; /* OK */ 31 | unsigned int index:1; 32 | unsigned int suites:2; 33 | unsigned int classes:2; 34 | unsigned int events:2; 35 | unsigned int commands:2; 36 | /* User preferences */ 37 | unsigned int sortSuites:1; /* OK */ 38 | unsigned int sortOthers:1; /* OK */ 39 | unsigned int subclasses:1; /* OK */ 40 | unsigned int groupEvents:1; /* OK */ 41 | unsigned int ignoreEvents:1; /* OK */ 42 | unsigned int ignoreRespondsTo:1; /* OK */ 43 | /* HTML Preferences */ 44 | unsigned int links:1; /* OK */ 45 | unsigned int format:2; /* OK */ 46 | /* Internal use */ 47 | unsigned int cancel:1; 48 | unsigned int existingFile:2; 49 | unsigned int useBlockFormat:1; 50 | unsigned int:2; 51 | } sd_gnFlags; 52 | NSString *sd_path; 53 | NSString *sd_base; 54 | /* Template Bundle */ 55 | SdefTemplate *sd_tpl; 56 | /* Caches */ 57 | NSString *sd_link; /* Weak */ 58 | NSString *sd_tocFile; 59 | NSString *sd_cssFile; 60 | NSMutableSet *sd_cancel; 61 | SdefClassManager *sd_manager; /* Weak */ 62 | NSMutableDictionary *sd_formats; 63 | NSMapTable *sd_links, *sd_files, *sd_anchors; 64 | } 65 | 66 | #pragma mark Accessors 67 | 68 | - (BOOL)indexToc; 69 | - (BOOL)externalToc; 70 | - (BOOL)dictionaryToc; 71 | 72 | - (NSUInteger)toc; 73 | - (void)setToc:(NSUInteger)toc; 74 | 75 | - (BOOL)externalCss; 76 | - (NSUInteger)css; 77 | - (void)setCss:(NSUInteger)css; 78 | 79 | - (NSString *)tocFile; 80 | - (void)setTocFile:(NSString *)aFile; 81 | 82 | - (NSString *)cssFile; 83 | - (void)setCssFile:(NSString *)aFile; 84 | 85 | - (BOOL)sortSuites; 86 | - (void)setSortSuites:(BOOL)sort; 87 | 88 | - (BOOL)sortOthers; 89 | - (void)setSortOthers:(BOOL)sort; 90 | 91 | - (BOOL)subclasses; 92 | - (void)setSubclasses:(BOOL)flag; 93 | 94 | - (BOOL)ignoreEvents; 95 | - (void)setIgnoreEvents:(BOOL)flag; 96 | 97 | - (BOOL)groupEventsAndCommands; 98 | - (void)setGroupEventsAndCommands:(BOOL)flag; 99 | 100 | - (BOOL)ignoreRespondsTo; 101 | - (void)setIgnoreRespondsTo:(BOOL)flag; 102 | 103 | #pragma mark HTML 104 | - (BOOL)links; 105 | - (void)setLinks:(BOOL)links; 106 | 107 | - (SdefTemplate *)template; 108 | - (void)setTemplate:(SdefTemplate *)aTemplate; 109 | 110 | #pragma mark Generate Files 111 | - (BOOL)writeDictionary:(SdefDictionary *)aDico toFile:(NSString *)aFile; 112 | 113 | @end 114 | -------------------------------------------------------------------------------- /Export/SdtplWindow.h: -------------------------------------------------------------------------------- 1 | /* 2 | * SdtplWindow.h 3 | * Sdef Editor 4 | * 5 | * Created by Rainbow Team. 6 | * Copyright © 2006 - 2007 Shadow Lab. All rights reserved. 7 | */ 8 | 9 | #import "SdefBase.h" 10 | 11 | #import 12 | 13 | @class WBCollapseView; 14 | @class SdefDocument, SdefTemplate, SdtplGenerator; 15 | @interface SdtplWindow : WBWindowController { 16 | IBOutlet NSPopUpButton *templates; 17 | IBOutlet SdtplGenerator *generator; 18 | IBOutlet WBCollapseView *collapseView; 19 | IBOutlet NSView *generalView, *tocView, *htmlView, *infoView; 20 | @private 21 | SdefDocument *sd_document; 22 | SdefTemplate *sd_template; 23 | } 24 | 25 | - (id)initWithDocument:(SdefDocument *)aDoc; 26 | 27 | - (IBAction)export:(id)sender; 28 | - (IBAction)changeTemplate:(id)sender; 29 | 30 | - (BOOL)importTemplate; 31 | - (SdefTemplate *)selectedTemplate; 32 | - (void)setSelectedTemplate:(SdefTemplate *)aTemplate; 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /Import/AeteEnumeration.m: -------------------------------------------------------------------------------- 1 | /* 2 | * AeteEnumeration.m 3 | * Sdef Editor 4 | * 5 | * Created by Rainbow Team. 6 | * Copyright © 2006 - 2007 Shadow Lab. All rights reserved. 7 | */ 8 | 9 | #import "AeteObject.h" 10 | #import "SdefTypedef.h" 11 | 12 | #import 13 | 14 | @implementation SdefEnumeration (AeteResource) 15 | 16 | - (NSUInteger)parseData:(Byte *)data { 17 | BytePtr bytes = data; 18 | 19 | /* Identifier */ 20 | OSType *identifier = (OSType *)bytes; 21 | [self setCode:WBStringForOSType(*identifier)]; 22 | [self setName:[self code]]; 23 | bytes += 4; 24 | 25 | /* Enumerators */ 26 | UInt16 *val = (UInt16 *)bytes; 27 | bytes += 2; 28 | if (*val > 0) { 29 | for (NSUInteger idx = 0; idx < *val; idx++) { 30 | SdefEnumerator *enumerator = [[SdefEnumerator alloc] init]; 31 | bytes += [enumerator parseData:bytes]; 32 | [self appendChild:enumerator]; 33 | } 34 | } 35 | 36 | NSUInteger total = (NSUInteger)bytes; 37 | total -= (NSUInteger)data; 38 | return total; 39 | } 40 | 41 | @end 42 | 43 | @implementation SdefEnumerator (AeteResource) 44 | 45 | - (NSUInteger)parseData:(Byte *)data { 46 | NSUInteger length; 47 | BytePtr bytes = data; 48 | 49 | StringPtr pStr = (StringPtr)bytes; 50 | length = StrLength(pStr); 51 | CFStringRef str = (length) ? CFStringCreateWithPascalString(kCFAllocatorDefault, pStr, kCFStringEncodingMacRoman) : nil; 52 | [self setName:SPXCFToNSString(str)]; 53 | bytes += length + 1; 54 | if (str) CFRelease(str); 55 | 56 | /* Alignement */ 57 | bytes += (intptr_t)bytes % 2; 58 | 59 | /* Identifier */ 60 | OSType *identifier = (OSType *)bytes; 61 | [self setCode:WBStringForOSType(*identifier)]; 62 | bytes += 4; 63 | 64 | /* Description */ 65 | pStr = (StringPtr)bytes; 66 | length = StrLength(pStr); 67 | str = (length) ? CFStringCreateWithPascalString(kCFAllocatorDefault, pStr, kCFStringEncodingMacRoman) : nil; 68 | [self setDesc:SPXCFToNSString(str)]; 69 | bytes += length + 1; 70 | if (str) CFRelease(str); 71 | 72 | /* Alignement */ 73 | bytes += (intptr_t)bytes % 2; 74 | 75 | NSUInteger total = (NSUInteger)bytes; 76 | total -= (NSUInteger)data; 77 | return total; 78 | } 79 | 80 | @end 81 | -------------------------------------------------------------------------------- /Import/AeteImporter.h: -------------------------------------------------------------------------------- 1 | /* 2 | * AeteImporter.h 3 | * Sdef Editor 4 | * 5 | * Created by Rainbow Team. 6 | * Copyright © 2006 - 2007 Shadow Lab. All rights reserved. 7 | */ 8 | 9 | #import "SdefImporter.h" 10 | 11 | @interface AeteImporter : SdefImporter { 12 | NSMutableArray *sd_aetes; 13 | SdefDictionary *sd_dictionary; 14 | } 15 | 16 | - (id)initWithSystemSuites; 17 | - (id)initWithFSRef:(FSRef *)aRef; 18 | - (id)initWithContentsOfFile:(NSString *)aFile; 19 | - (id)initWithApplicationBundleIdentifier:(NSString *)identifier; 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /Import/AeteObject.h: -------------------------------------------------------------------------------- 1 | /* 2 | * AeteObject.h 3 | * Sdef Editor 4 | * 5 | * Created by Rainbow Team. 6 | * Copyright © 2006 - 2007 Shadow Lab. All rights reserved. 7 | */ 8 | 9 | #import "SdefBase.h" 10 | 11 | @interface SdefObject (AeteResource) 12 | 13 | - (NSUInteger)parseData:(Byte *)bytes; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /Import/AeteObject.m: -------------------------------------------------------------------------------- 1 | /* 2 | * AeteObject.m 3 | * Sdef Editor 4 | * 5 | * Created by Rainbow Team. 6 | * Copyright © 2006 - 2007 Shadow Lab. All rights reserved. 7 | */ 8 | 9 | #import "AeteObject.h" 10 | 11 | @implementation SdefObject (AeteResource) 12 | 13 | - (NSUInteger)parseData:(Byte *)bytes { 14 | SPXAbstractMethodException(); 15 | } 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /Import/AeteSuite.m: -------------------------------------------------------------------------------- 1 | /* 2 | * AeteSuite.m 3 | * Sdef Editor 4 | * 5 | * Created by Rainbow Team. 6 | * Copyright © 2006 - 2007 Shadow Lab. All rights reserved. 7 | */ 8 | 9 | #import "SdefSuite.h" 10 | #import "SdefVerb.h" 11 | #import "SdefClass.h" 12 | #import "SdefTypedef.h" 13 | 14 | #import "AeteObject.h" 15 | 16 | #import 17 | 18 | @implementation SdefSuite (AeteResource) 19 | 20 | - (NSUInteger)parseData:(Byte *)data { 21 | NSUInteger length; 22 | BytePtr bytes = data; 23 | StringPtr pStr = (StringPtr)bytes; 24 | length = StrLength(pStr); 25 | CFStringRef str = CFStringCreateWithPascalString(kCFAllocatorDefault, pStr, kCFStringEncodingMacRoman); 26 | [self setName:SPXCFToNSString(str)]; 27 | bytes += length + 1; 28 | CFRelease(str); 29 | 30 | pStr = (StringPtr)bytes; 31 | length = StrLength(pStr); 32 | str = CFStringCreateWithPascalString(kCFAllocatorDefault, pStr, kCFStringEncodingMacRoman); 33 | [self setDesc:SPXCFToNSString(str)]; 34 | bytes += length + 1; 35 | CFRelease(str); 36 | 37 | /* Alignement */ 38 | bytes += (intptr_t)bytes % 2; 39 | 40 | OSType *identifier = (UInt32 *)bytes; 41 | [self setCode:WBStringForOSType(*identifier)]; 42 | bytes += 4; 43 | 44 | /* skip level and version */ 45 | bytes += 4; 46 | 47 | UInt16 *val = (UInt16 *)bytes; 48 | bytes += 2; 49 | if (*val > 0) { 50 | for (NSUInteger idx = 0; idx < *val; idx++) { 51 | SdefVerb *verb = [[SdefVerb alloc] init]; 52 | bytes += [verb parseData:bytes]; 53 | [[self commands] appendChild:verb]; 54 | } 55 | } 56 | 57 | val = (UInt16 *)bytes; 58 | bytes += 2; 59 | if (*val > 0) { 60 | for (NSUInteger idx = 0; idx < *val; idx++) { 61 | SdefClass *class = [[SdefClass alloc] init]; 62 | bytes += [class parseData:bytes]; 63 | [[self classes] appendChild:class]; 64 | } 65 | } 66 | 67 | /* Comparaison operators: ignore */ 68 | val = (UInt16 *)bytes; 69 | bytes += 2; 70 | if (*val > 0) { 71 | for (NSUInteger idx = 0; idx < *val; idx++) { 72 | /* Name */ 73 | pStr = (StringPtr)bytes; 74 | length = StrLength(pStr); 75 | bytes += length + 1; 76 | 77 | /* Alignement */ 78 | bytes += (intptr_t)bytes % 2; 79 | 80 | /* ID */ 81 | bytes += 4; 82 | 83 | /* Description */ 84 | pStr = (StringPtr)bytes; 85 | length = StrLength(pStr); 86 | bytes += length + 1; 87 | 88 | /* Alignement */ 89 | bytes += (intptr_t)bytes % 2; 90 | } 91 | } 92 | 93 | /* Enumerations */ 94 | val = (UInt16 *)bytes; 95 | bytes += 2; 96 | if (*val > 0) { 97 | for (NSUInteger idx = 0; idx < *val; idx++) { 98 | SdefEnumeration *enumeration = [[SdefEnumeration alloc] init]; 99 | bytes += [enumeration parseData:bytes]; 100 | [[self types] appendChild:enumeration]; 101 | } 102 | } 103 | 104 | NSUInteger total = (NSUInteger)bytes; 105 | total -= (NSUInteger)data; 106 | return total; 107 | } 108 | 109 | @end 110 | -------------------------------------------------------------------------------- /Import/CocoaEnumeration.m: -------------------------------------------------------------------------------- 1 | /* 2 | * CocoaEnumeration.m 3 | * Sdef Editor 4 | * 5 | * Created by Rainbow Team. 6 | * Copyright © 2006 - 2007 Shadow Lab. All rights reserved. 7 | */ 8 | 9 | #import "SdefTypedef.h" 10 | #import "CocoaObject.h" 11 | #import "SdefImplementation.h" 12 | 13 | @implementation SdefEnumeration (CocoaTerminology) 14 | 15 | - (id)initWithName:(NSString *)name suite:(NSDictionary *)suite andTerminology:(NSDictionary *)terminology { 16 | NSString *sdefName = SdefNameFromCocoaName(name); 17 | if (self = [super initWithName:sdefName]) { 18 | [[self impl] setName:name]; 19 | [self setCode:[suite objectForKey:@"AppleEventCode"]]; 20 | id codes = [suite objectForKey:@"Enumerators"]; 21 | id keys = [terminology keyEnumerator]; 22 | id key; 23 | while (key = [keys nextObject]) { 24 | SdefEnumerator *enumerator = [[SdefEnumerator alloc] initWithName:key 25 | suite:codes 26 | andTerminology:[terminology objectForKey:key]]; 27 | [self appendChild:enumerator]; 28 | } 29 | } 30 | return self; 31 | } 32 | 33 | @end 34 | 35 | @implementation SdefEnumerator (CocoaTerminology) 36 | 37 | - (id)initWithName:(NSString *)name suite:(NSDictionary *)suite andTerminology:(NSDictionary *)terminology { 38 | if (self = [super initWithName:[terminology objectForKey:@"Name"]]) { 39 | [self setDesc:[terminology objectForKey:@"Description"]]; 40 | [self setCode:[suite objectForKey:name]]; 41 | [[self impl] setName:name]; 42 | } 43 | return self; 44 | } 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /Import/CocoaObject.h: -------------------------------------------------------------------------------- 1 | /* 2 | * CocoaObject.h 3 | * Sdef Editor 4 | * 5 | * Created by Rainbow Team. 6 | * Copyright © 2006 - 2007 Shadow Lab. All rights reserved. 7 | */ 8 | 9 | #import "SdefBase.h" 10 | 11 | @interface SdefObject (CocoaTerminology) 12 | - (id)initWithName:(NSString *)name suite:(NSDictionary *)suite andTerminology:(NSDictionary *)terminology; 13 | @end 14 | -------------------------------------------------------------------------------- /Import/CocoaObject.m: -------------------------------------------------------------------------------- 1 | /* 2 | * CocoaObject.m 3 | * Sdef Editor 4 | * 5 | * Created by Rainbow Team. 6 | * Copyright © 2006 - 2007 Shadow Lab. All rights reserved. 7 | */ 8 | 9 | #import "CocoaObject.h" 10 | 11 | @implementation SdefObject (CocoaTerminology) 12 | 13 | - (id)initWithName:(NSString *)name suite:(NSDictionary *)suite andTerminology:(NSDictionary *)terminology { 14 | [NSException raise:NSInternalInconsistencyException format:@"Method -%@ must be implemented by subclass %@", 15 | NSStringFromSelector(_cmd), NSStringFromClass([self class])]; 16 | return nil; 17 | } 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /Import/CocoaSuite.m: -------------------------------------------------------------------------------- 1 | /* 2 | * CocoaSuite.m 3 | * Sdef Editor 4 | * 5 | * Created by Rainbow Team. 6 | * Copyright © 2006 - 2007 Shadow Lab. All rights reserved. 7 | */ 8 | 9 | #import "SdefSuite.h" 10 | #import "SdefVerb.h" 11 | #import "SdefClass.h" 12 | #import "SdefTypedef.h" 13 | #import "CocoaObject.h" 14 | #import "SdefImplementation.h" 15 | 16 | @implementation SdefSuite (CocoaTerminology) 17 | 18 | - (id)initWithName:(NSString *)name suite:(NSDictionary *)suite andTerminology:(NSDictionary *)terminology { 19 | if (self = [super initWithName:[terminology objectForKey:@"Name"]]) { 20 | [self setDesc:[terminology objectForKey:@"Description"]]; 21 | [self setCode:[suite objectForKey:@"AppleEventCode"]]; 22 | [[self impl] setName:[suite objectForKey:@"Name"]]; 23 | 24 | /* Enumerations */ 25 | id termItems = [terminology objectForKey:@"Enumerations"]; 26 | id suiteItems = [suite objectForKey:@"Enumerations"]; 27 | 28 | id keys = [suiteItems keyEnumerator]; 29 | id key; 30 | while (key = [keys nextObject]) { 31 | SdefEnumeration *child = [[SdefEnumeration alloc] initWithName:key 32 | suite:[suiteItems objectForKey:key] 33 | andTerminology:[termItems objectForKey:key]]; 34 | if (child) 35 | [[self types] appendChild:child]; 36 | } 37 | 38 | /* Commands */ 39 | termItems = [terminology objectForKey:@"Commands"]; 40 | suiteItems = [suite objectForKey:@"Commands"]; 41 | 42 | keys = [suiteItems keyEnumerator]; 43 | while (key = [keys nextObject]) { 44 | SdefVerb *child = [[SdefVerb alloc] initWithName:key 45 | suite:[suiteItems objectForKey:key] 46 | andTerminology:[termItems objectForKey:key]]; 47 | if (child) 48 | [[self commands] appendChild:child]; 49 | } 50 | 51 | /* Classes */ 52 | termItems = [terminology objectForKey:@"Classes"]; 53 | suiteItems = [suite objectForKey:@"Classes"]; 54 | 55 | keys = [suiteItems keyEnumerator]; 56 | while (key = [keys nextObject]) { 57 | SdefClass *child = [[SdefClass alloc] initWithName:key 58 | suite:[suiteItems objectForKey:key] 59 | andTerminology:[termItems objectForKey:key]]; 60 | if (child) 61 | [[self classes] appendChild:child]; 62 | } 63 | } 64 | return self; 65 | } 66 | 67 | @end 68 | -------------------------------------------------------------------------------- /Import/CocoaSuiteImporter.h: -------------------------------------------------------------------------------- 1 | /* 2 | * CocoaSuiteImporter.h 3 | * Sdef Editor 4 | * 5 | * Created by Rainbow Team. 6 | * Copyright © 2006 - 2007 Shadow Lab. All rights reserved. 7 | */ 8 | 9 | #import "SdefImporter.h" 10 | 11 | @class SdefSuite ; 12 | @interface CocoaSuiteImporter : SdefImporter { 13 | @private 14 | NSMutableArray *sd_roots; 15 | NSMutableArray *sd_suites; 16 | NSMutableArray *sd_terminologies; 17 | 18 | NSMutableSet *sd_cache; 19 | 20 | BOOL sd_std, sd_scpt; 21 | } 22 | 23 | - (id)initWithContentsOfFile:(NSString *)file; 24 | 25 | - (void)addSuite:(NSDictionary *)suite terminology:(NSDictionary *)terminology; 26 | 27 | - (SdefSuite *)sdefSuite; 28 | 29 | - (BOOL)preload; 30 | 31 | /* private */ 32 | - (void)preloadSuite:(NSDictionary *)dictionary; 33 | 34 | @end 35 | 36 | -------------------------------------------------------------------------------- /Import/CocoaVerb.m: -------------------------------------------------------------------------------- 1 | /* 2 | * CocoaVerb.m 3 | * Sdef Editor 4 | * 5 | * Created by Rainbow Team. 6 | * Copyright © 2006 - 2007 Shadow Lab. All rights reserved. 7 | */ 8 | 9 | #import "SdefVerb.h" 10 | #import "CocoaObject.h" 11 | #import "SdefArguments.h" 12 | #import "SdefImplementation.h" 13 | 14 | @implementation SdefVerb (CocoaTerminology) 15 | 16 | - (id)initWithName:(NSString *)name suite:(NSDictionary *)suite andTerminology:(NSDictionary *)terminology { 17 | if (self = [super init]) { 18 | NSString *tname = [terminology objectForKey:@"Name"]; 19 | if (!tname) { 20 | tname = SdefNameFromCocoaName(name); 21 | [self setHidden:YES]; 22 | } 23 | [self setName:tname]; 24 | [self setDesc:[terminology objectForKey:@"Description"]]; 25 | [self setCode:[NSString stringWithFormat:@"%@%@", [suite objectForKey:@"AppleEventClassCode"], [suite objectForKey:@"AppleEventCode"]]]; 26 | 27 | NSString *sdefName = SdefNameFromCocoaName(name); 28 | if (![sdefName isEqualToString:[self name]]) 29 | [[self impl] setName:name]; 30 | [self impl].className = [suite objectForKey:@"CommandClass"]; 31 | 32 | /* Result */ 33 | if ([(NSString *)[suite objectForKey:@"Type"] length]) 34 | [[self result] setType:[suite objectForKey:@"Type"]]; 35 | 36 | /* Direct Parameter */ 37 | id direct = [suite objectForKey:@"UnnamedArgument"]; 38 | if (direct) { 39 | [[self directParameter] setOptional:[[direct objectForKey:@"Optional"] isEqualToString:@"YES"]]; 40 | [[self directParameter] setDesc:[[terminology objectForKey:@"UnnamedArgument"] objectForKey:@"Description"]]; 41 | [[self directParameter] setType:[direct objectForKey:@"Type"]]; 42 | } 43 | 44 | id args = [suite objectForKey:@"Arguments"]; 45 | id argsTerm = [terminology objectForKey:@"Arguments"]; 46 | 47 | id keys = [argsTerm keyEnumerator]; 48 | id key; 49 | while (key = [keys nextObject]) { 50 | id param = [[SdefParameter alloc] initWithName:key 51 | suite:[args objectForKey:key] 52 | andTerminology:[argsTerm objectForKey:key]]; 53 | if (param) 54 | [self appendChild:param]; 55 | } 56 | } 57 | return self; 58 | } 59 | 60 | @end 61 | 62 | @implementation SdefParameter (CocoaTerminology) 63 | 64 | - (id)initWithName:(NSString *)name suite:(NSDictionary *)suite andTerminology:(NSDictionary *)terminology { 65 | if (self = [super initWithName:[terminology objectForKey:@"Name"]]) { 66 | [self setDesc:[terminology objectForKey:@"Description"]]; 67 | [self setType:[suite objectForKey:@"Type"]]; 68 | [self setCode:[suite objectForKey:@"AppleEventCode"]]; 69 | [self setOptional:[[suite objectForKey:@"Optional"] isEqualToString:@"YES"]]; 70 | [[self impl] setKey:name]; 71 | } 72 | return self; 73 | } 74 | 75 | @end 76 | -------------------------------------------------------------------------------- /Import/OSASdefImporter.h: -------------------------------------------------------------------------------- 1 | /* 2 | * OSASdefImporter.h 3 | * Sdef Editor 4 | * 5 | * Created by Rainbow Team. 6 | * Copyright © 2006 - 2007 Shadow Lab. All rights reserved. 7 | */ 8 | 9 | #import "SdefImporter.h" 10 | 11 | @interface OSASdefImporter : SdefImporter { 12 | NSURL *sd_url; 13 | SdefDictionary *sd_dico; 14 | } 15 | 16 | - (id)initWithURL:(NSURL *)url; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /Import/SdefImporter.h: -------------------------------------------------------------------------------- 1 | /* 2 | * SdefImporter.h 3 | * Sdef Editor 4 | * 5 | * Created by Rainbow Team. 6 | * Copyright © 2006 - 2007 Shadow Lab. All rights reserved. 7 | */ 8 | 9 | #import 10 | 11 | @class SdefDictionary; 12 | @class SdefClassManager, SdefObject, SdefEnumeration; 13 | @class SdefVerb, SdefDirectParameter, SdefParameter, SdefResult; 14 | @class SdefClass, SdefContents, SdefElement, SdefProperty, SdefRespondsTo; 15 | @interface SdefImporter : NSObject { 16 | @protected 17 | NSMutableArray *suites; 18 | SdefClassManager *manager; 19 | @private 20 | NSMutableArray *sd_warnings; 21 | } 22 | 23 | /*! 24 | @method import 25 | @abstract Import a script terminology. 26 | @result YES if file imported. 27 | */ 28 | - (BOOL)import; 29 | - (NSArray *)warnings; 30 | - (NSUInteger)suiteCount; 31 | - (NSArray *)sdefSuites; 32 | - (SdefDictionary *)sdefDictionary; 33 | 34 | #pragma mark - 35 | - (void)addWarning:(NSString *)warning forValue:(NSString *)value node:(SdefObject *)node; 36 | 37 | #pragma mark - 38 | - (void)postProcess; 39 | - (BOOL)resolveObjectType:(SdefObject *)obj; 40 | 41 | #pragma mark Class 42 | /* two passes post-process (for aete) */ 43 | - (void)postProcessCleanupClass:(SdefClass *)aClass; 44 | 45 | - (void)postProcessClass:(SdefClass *)aClass; 46 | - (void)postProcessContents:(SdefContents *)aContents forClass:aClass; 47 | - (void)postProcessElement:(SdefElement *)anElement inClass:(SdefClass *)aClass; 48 | - (void)postProcessProperty:(SdefProperty *)aProperty inClass:(SdefClass *)aClass; 49 | - (void)postProcessRespondsTo:(SdefRespondsTo *)aCmd inClass:(SdefClass *)aClass; 50 | 51 | #pragma mark Verb 52 | - (void)postProcessCommand:(SdefVerb *)aCommand; 53 | - (void)postProcessDirectParameter:(SdefDirectParameter *)aParameter inCommand:(SdefVerb *)aCmd; 54 | - (void)postProcessParameter:(SdefParameter *)aParameter inCommand:(SdefVerb *)aCmd; 55 | - (void)postProcessResult:(SdefResult *)aResult inCommand:(SdefVerb *)aCmd; 56 | 57 | #pragma mark Enumeration 58 | - (void)postProcessEnumeration:(SdefEnumeration *)anEnumeration; 59 | 60 | 61 | 62 | @end 63 | -------------------------------------------------------------------------------- /Interface/Headers/ImportApplicationAete.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ImportApplicationAete.h 3 | * Sdef Editor 4 | * 5 | * Created by Rainbow Team. 6 | * Copyright © 2006 - 2007 Shadow Lab. All rights reserved. 7 | */ 8 | 9 | #import "SdefBase.h" 10 | 11 | #import 12 | 13 | @class WBApplication; 14 | @interface ImportApplicationAete : WBWindowController { 15 | IBOutlet NSPopUpButton *popup; 16 | WBApplication *selection; 17 | } 18 | 19 | - (WBApplication *)selection; 20 | 21 | - (IBAction)import:(id)sender; 22 | - (IBAction)choose:(id)sender; 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /Interface/Headers/ImporterWarning.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ImporterWarning.h 3 | * Sdef Editor 4 | * 5 | * Created by Rainbow Team. 6 | * Copyright © 2006 - 2007 Shadow Lab. All rights reserved. 7 | */ 8 | 9 | #import "SdefBase.h" 10 | 11 | #import 12 | 13 | @class SdefDocument; 14 | @interface ImporterWarning : WBWindowController { 15 | IBOutlet NSTableView *warningsTable; 16 | NSArray *sd_warnings; 17 | SdefDocument *sd_document; 18 | } 19 | 20 | - (void)setDocument:(SdefDocument *)aDocument; 21 | - (void)setWarnings:(NSArray *)warnings; 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /Interface/Headers/Preferences.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Preferences.h 3 | * Sdef Editor 4 | * 5 | * Created by Rainbow Team. 6 | * Copyright © 2006 - 2007 Shadow Lab. All rights reserved. 7 | */ 8 | 9 | #import "SdefBase.h" 10 | 11 | #import 12 | 13 | @interface Preferences : WBWindowController { 14 | @private 15 | NSString *_sdp; 16 | NSString *_rez; 17 | } 18 | 19 | @property(nonatomic, copy) NSString *sdp; 20 | @property(nonatomic, copy) NSString *rez; 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /Interface/Headers/SdefClassView.h: -------------------------------------------------------------------------------- 1 | /* 2 | * SdefClassView.h 3 | * Sdef Editor 4 | * 5 | * Created by Rainbow Team. 6 | * Copyright © 2006 - 2007 Shadow Lab. All rights reserved. 7 | */ 8 | 9 | #import "SdefViewController.h" 10 | 11 | @interface SdefClassView : SdefViewController { 12 | IBOutlet NSTabView *tab; 13 | IBOutlet NSArrayController *properties; 14 | IBOutlet NSArrayController *elements; 15 | IBOutlet NSArrayController *commands; 16 | IBOutlet NSArrayController *events; 17 | 18 | IBOutlet id commandTable; 19 | IBOutlet id eventTable; 20 | @private 21 | int sd_idx; 22 | } 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /Interface/Headers/SdefDictionaryView.h: -------------------------------------------------------------------------------- 1 | /* 2 | * SdefDictionaryView.h 3 | * Sdef Editor 4 | * 5 | * Created by Rainbow Team. 6 | * Copyright © 2006 - 2007 Shadow Lab. All rights reserved. 7 | */ 8 | 9 | #import "SdefViewController.h" 10 | 11 | @interface SdefDictionaryView : SdefViewController { 12 | IBOutlet id suitesTable; 13 | } 14 | 15 | - (IBAction)addSuite:(id)sender; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /Interface/Headers/SdefEnumerationView.h: -------------------------------------------------------------------------------- 1 | /* 2 | * SdefEnumerationView.h 3 | * Sdef Editor 4 | * 5 | * Created by Rainbow Team. 6 | * Copyright © 2006 - 2007 Shadow Lab. All rights reserved. 7 | */ 8 | 9 | #import "SdefViewController.h" 10 | 11 | @interface SdefEnumerationView : SdefViewController { 12 | IBOutlet NSTabView *uiTab; 13 | IBOutlet NSArrayController *ibEnumerators; 14 | } 15 | 16 | @end 17 | 18 | @interface SdefRecordView : SdefViewController { 19 | IBOutlet NSTabView *uiTab; 20 | IBOutlet NSArrayController *ibProperties; 21 | } 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /Interface/Headers/SdefExporterController.h: -------------------------------------------------------------------------------- 1 | /* 2 | * SdefExporterController.h 3 | * Sdef Editor 4 | * 5 | * Created by Rainbow Team. 6 | * Copyright © 2006 - 2007 Shadow Lab. All rights reserved. 7 | */ 8 | 9 | #import "SdefBase.h" 10 | 11 | @class SdefDocument; 12 | @interface SdefExporterController : NSWindowController { 13 | IBOutlet NSArrayController *includes; 14 | IBOutlet NSObjectController *controller; 15 | SdefDocument *sd_document; 16 | 17 | NSString *sd_version; 18 | BOOL includeCore, includeText; 19 | BOOL sbhFormat, sbmFormat; // Scripting Bridge Header and Implementation files. 20 | BOOL resourceFormat, cocoaFormat, rsrcFormat; 21 | } 22 | 23 | - (void)compileResourceFile:(NSString *)folder; 24 | 25 | - (NSString *)version; 26 | - (void)setVersion:(NSString *)version; 27 | 28 | - (SdefDocument *)sdefDocument; 29 | - (void)setSdefDocument:(SdefDocument *)adocument; 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /Interface/Headers/SdefSuiteView.h: -------------------------------------------------------------------------------- 1 | /* 2 | * SdefSuiteView.h 3 | * Sdef Editor 4 | * 5 | * Created by Rainbow Team. 6 | * Copyright © 2006 - 2007 Shadow Lab. All rights reserved. 7 | */ 8 | 9 | #import "SdefViewController.h" 10 | 11 | @interface SdefSuiteView : SdefViewController { 12 | IBOutlet NSTabView *tab; 13 | IBOutlet id typeTable; 14 | IBOutlet id classTable; 15 | IBOutlet id commandTable; 16 | IBOutlet id eventTable; 17 | IBOutlet NSArrayController *types; 18 | IBOutlet NSArrayController *classes; 19 | @private 20 | NSUInteger sd_idx; 21 | NSMenu *sd_typeMenu; 22 | } 23 | 24 | - (IBAction)addType:(id)sender; 25 | - (IBAction)newType:(id)sender; 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /Interface/Headers/SdefSymbolBrowser.h: -------------------------------------------------------------------------------- 1 | /* 2 | * SdefSymbolBrowser.h 3 | * Sdef Editor 4 | * 5 | * Created by Rainbow Team. 6 | * Copyright © 2006 - 2007 Shadow Lab. All rights reserved. 7 | */ 8 | 9 | #import 10 | 11 | typedef enum { 12 | kSdefSearchAll, 13 | kSdefSearchCode, 14 | kSdefSearchType, 15 | kSdefSearchSuite, 16 | kSdefSearchSymbol, 17 | kSdefSearchSymbolType 18 | } SdefSearchField; 19 | 20 | @class SdefSuite; 21 | @class WBTableDataSource; 22 | @interface SdefSymbolBrowser : NSWindowController { 23 | SdefSearchField sd_filter; 24 | NSSearchField *searchField; 25 | IBOutlet id symbolTable; 26 | IBOutlet NSDrawer *editDrawer; 27 | IBOutlet WBTableDataSource *symbols; 28 | } 29 | 30 | - (void)createToolbar; 31 | - (IBAction)limitSearch:(id)sender; 32 | 33 | - (void)loadSymbols; 34 | - (void)addSuite:(SdefSuite *)aSuite; 35 | - (void)removeSuite:(SdefSuite *)aSuite; 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /Interface/Headers/SdefTypesEditor.h: -------------------------------------------------------------------------------- 1 | /* 2 | * SdefTypeWindow.h 3 | * Sdef Editor 4 | * 5 | * Created by Rainbow Team. 6 | * Copyright © 2006 - 2007 Shadow Lab. All rights reserved. 7 | */ 8 | 9 | #import "SdefBase.h" 10 | 11 | #import 12 | 13 | @class SdefTypedObject; 14 | @interface SdefTypesEditor : WBWindowController { 15 | NSView *sd_field; 16 | NSArray *sd_types; 17 | SdefTypedObject *sd_object; 18 | } 19 | 20 | - (NSView *)field; 21 | - (void)setField:(NSView *)field; 22 | - (SdefTypedObject *)object; 23 | - (void)setObject:(SdefTypedObject *)object; 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /Interface/Headers/SdefVerbView.h: -------------------------------------------------------------------------------- 1 | /* 2 | * SdefVerbView.h 3 | * Sdef Editor 4 | * 5 | * Created by Rainbow Team. 6 | * Copyright © 2006 - 2007 Shadow Lab. All rights reserved. 7 | */ 8 | 9 | #import "SdefViewController.h" 10 | 11 | @interface SdefVerbView : SdefViewController { 12 | IBOutlet id tab; 13 | IBOutlet id parameters; 14 | } 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /Interface/Headers/SdefViewController.h: -------------------------------------------------------------------------------- 1 | /* 2 | * SdefViewController.h 3 | * Sdef Editor 4 | * 5 | * Created by Rainbow Team. 6 | * Copyright © 2006 - 2007 Shadow Lab. All rights reserved. 7 | */ 8 | 9 | #import "SdefBase.h" 10 | 11 | @class SdefObject, SdefDocument, SdefClassManager; 12 | @interface SdefViewController : NSObject { 13 | IBOutlet NSView *sdefView; 14 | IBOutlet NSObjectController *ownerController; 15 | IBOutlet NSObjectController *objectController; 16 | @private 17 | NSArray *sd_types; 18 | SdefObject *sd_object; 19 | NSArray *sd_nibTopLevelObjects; 20 | } 21 | 22 | - (id)initWithNibName:(NSString *)name; 23 | 24 | - (NSView *)sdefView; 25 | 26 | - (IBAction)editType:(id)sender; 27 | - (IBAction)revealInTree:(id)sender; 28 | 29 | - (id)object; 30 | - (id)editedObject:(id)sender; 31 | - (void)setObject:(SdefObject *)newObject; 32 | 33 | - (void)selectObject:(SdefObject*)object; 34 | 35 | - (void)revealObjectInTree:(SdefObject *)anObject; 36 | 37 | - (SdefDocument *)document; 38 | - (SdefClassManager *)classManager; 39 | 40 | - (void)documentWillClose:(SdefDocument *)aDocument; 41 | 42 | @end 43 | 44 | @interface SdefTypeButton : NSButton { 45 | IBOutlet NSTextField *typeField; 46 | } 47 | - (NSView *)typeField; 48 | @end 49 | 50 | @interface SdefTypeColorTransformer : NSValueTransformer { 51 | } 52 | + (id)transformer; 53 | @end 54 | 55 | @interface SdefAccessTransformer : NSValueTransformer { 56 | } 57 | + (id)transformer; 58 | @end 59 | 60 | @interface SdefObjectNameTransformer : NSValueTransformer { 61 | } 62 | + (id)transformer; 63 | @end 64 | -------------------------------------------------------------------------------- /Interface/Headers/SdefWindowController.h: -------------------------------------------------------------------------------- 1 | /* 2 | * SdefWindowController.h 3 | * Sdef Editor 4 | * 5 | * Created by Rainbow Team. 6 | * Copyright © 2006 - 2007 Shadow Lab. All rights reserved. 7 | */ 8 | 9 | #import 10 | 11 | extern NSString * const SdefTreePboardType; 12 | extern NSString * const SdefInfoPboardType; 13 | 14 | extern NSString * const SdefDictionarySelectionDidChangeNotification; 15 | 16 | @class WBSplitView; 17 | @class SdefObject; 18 | @class SdefDictionary, WBOutlineViewController; 19 | @interface SdefWindowController : NSWindowController { 20 | IBOutlet NSOutlineView *outline; 21 | IBOutlet NSTabView *inspector; 22 | IBOutlet WBSplitView *uiSplitview; 23 | 24 | @private 25 | BOOL sd_remove; 26 | WBOutlineViewController *sd_tree; 27 | NSMutableDictionary *sd_viewControllers; 28 | } 29 | 30 | - (id)init; 31 | - (void)setDictionary:(SdefDictionary *)dictionary; 32 | 33 | - (void)displayObject:(SdefObject *)anObject; 34 | 35 | - (SdefObject *)selection; 36 | - (void)setSelection:(SdefObject *)anObject; 37 | 38 | @end 39 | -------------------------------------------------------------------------------- /Interface/ImportApplicationAete.m: -------------------------------------------------------------------------------- 1 | /* 2 | * ImportApplicationAete.m 3 | * Sdef Editor 4 | * 5 | * Created by Rainbow Team. 6 | * Copyright © 2006 - 2007 Shadow Lab. All rights reserved. 7 | */ 8 | 9 | #import "ImportApplicationAete.h" 10 | #import 11 | 12 | #import "AeteImporter.h" 13 | #import "SdefEditor.h" 14 | 15 | @implementation ImportApplicationAete 16 | 17 | + (NSString *)frameAutoSaveName { 18 | return nil; 19 | } 20 | 21 | - (void)awakeFromNib { 22 | NSMenu *menu = [popup menu]; 23 | 24 | for (NSRunningApplication *app in NSWorkspace.sharedWorkspace.runningApplications) { 25 | if ([app.bundleIdentifier isEqualToString:NSBundle.mainBundle.bundleIdentifier]) 26 | continue; 27 | 28 | if (app.activationPolicy != NSApplicationActivationPolicyRegular) 29 | continue; 30 | 31 | WBApplication *appli = [[WBApplication alloc] initWithProcessIdentifier:app.processIdentifier]; 32 | NSMenuItem *menuItem = [[NSMenuItem alloc] initWithTitle:[appli name] action:nil keyEquivalent:@""]; 33 | NSImage *icon = app.icon; 34 | [icon setScalesWhenResized:YES]; 35 | [icon setSize:NSMakeSize(16, 16)]; 36 | [menuItem setImage:icon]; 37 | [menuItem setRepresentedObject:appli]; 38 | [menu insertItem:menuItem atIndex:0]; 39 | } 40 | [popup selectItemAtIndex:0]; 41 | } 42 | 43 | - (void)windowDidLoad { 44 | [super windowDidLoad]; 45 | [[self window] center]; 46 | } 47 | 48 | - (WBApplication *)selection { 49 | return selection; 50 | } 51 | 52 | - (IBAction)import:(id)sender { 53 | selection = [[popup selectedItem] representedObject]; 54 | [self close:sender]; 55 | } 56 | 57 | - (IBAction)choose:(id)sender { 58 | NSOpenPanel *openPanel = [NSOpenPanel openPanel]; 59 | [openPanel setPrompt:NSLocalizedString(@"Choose", @"Choose App default button.")]; 60 | [openPanel setCanChooseFiles:YES]; 61 | [openPanel setCanCreateDirectories:NO]; 62 | [openPanel setCanChooseDirectories:NO]; 63 | [openPanel setAllowsMultipleSelection:NO]; 64 | [openPanel setTreatsFilePackagesAsDirectories:NO]; 65 | [openPanel setAllowedFileTypes:@[@"app", SPXCFToNSString(kUTTypeApplication)]]; 66 | switch ([openPanel runModal]) { 67 | case NSModalResponseCancel: 68 | return; 69 | } 70 | if ([[openPanel URLs] count] == 0) 71 | return; 72 | NSURL *file = [openPanel URL]; 73 | WBApplication *appli = [WBApplication applicationWithURL:file]; 74 | NSMenuItem *item = [popup itemWithTitle:[appli name]]; 75 | if (!item) { 76 | item = [[NSMenuItem alloc] initWithTitle:[appli name] action:nil keyEquivalent:@""]; 77 | NSImage *icon = [appli icon]; 78 | [icon setScalesWhenResized:YES]; 79 | [icon setSize:NSMakeSize(16, 16)]; 80 | [item setImage:icon]; 81 | [item setRepresentedObject:appli]; 82 | [[popup menu] insertItem:item atIndex:0]; 83 | } 84 | [popup selectItem:item]; 85 | } 86 | 87 | @end 88 | -------------------------------------------------------------------------------- /Interface/ImporterWarning.m: -------------------------------------------------------------------------------- 1 | /* 2 | * ImporterWarning.m 3 | * Sdef Editor 4 | * 5 | * Created by Rainbow Team. 6 | * Copyright © 2006 - 2007 Shadow Lab. All rights reserved. 7 | */ 8 | 9 | #import "ImporterWarning.h" 10 | 11 | #import "SdefBase.h" 12 | #import "SdefDocument.h" 13 | #import "SdefWindowController.h" 14 | 15 | @implementation ImporterWarning 16 | 17 | + (NSString *)nibName { 18 | return @"SdefImporterWarning"; 19 | } 20 | 21 | + (NSString *)frameAutoSaveName { 22 | return @"SdefWarningReport"; 23 | } 24 | 25 | - (void)awakeFromNib { 26 | [warningsTable setTarget:self]; 27 | [warningsTable setDoubleAction:@selector(reveal:)]; 28 | } 29 | 30 | - (void)dealloc { 31 | [warningsTable setDelegate:nil]; 32 | [warningsTable setDataSource:nil]; 33 | } 34 | 35 | #pragma mark - 36 | - (IBAction)reveal:(id)sender { 37 | NSInteger row = [sender clickedRow]; 38 | if (row >= 0) { 39 | NSDictionary *item = [sd_warnings objectAtIndex:row]; 40 | SdefObject *node = [item objectForKey:@"node"]; 41 | if (node) { 42 | [[sd_document documentWindow] setSelection:[node container]]; 43 | } 44 | } 45 | } 46 | 47 | - (void)setWarnings:(NSArray *)warnings { 48 | if (sd_warnings != warnings) { 49 | sd_warnings = warnings; 50 | [warningsTable reloadData]; 51 | } 52 | } 53 | 54 | - (void)setDocument:(SdefDocument *)aDocument { 55 | sd_document = aDocument; 56 | } 57 | 58 | #pragma mark - 59 | - (NSInteger)numberOfRowsInTableView:(NSTableView *)aTableView { 60 | return [sd_warnings count]; 61 | } 62 | 63 | - (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex { 64 | return [[sd_warnings objectAtIndex:rowIndex] valueForKey:[aTableColumn identifier]]; 65 | } 66 | 67 | @end 68 | -------------------------------------------------------------------------------- /Interface/Preferences.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Preferences.m 3 | * Sdef Editor 4 | * 5 | * Created by Rainbow Team. 6 | * Copyright © 2006 - 2007 Shadow Lab. All rights reserved. 7 | */ 8 | 9 | #import "Preferences.h" 10 | 11 | @implementation Preferences 12 | 13 | @synthesize sdp = _sdp; 14 | @synthesize rez = _rez; 15 | 16 | - (id)init { 17 | if (self = [super init]) { 18 | [self setSdp:[[NSUserDefaults standardUserDefaults] stringForKey:@"SdefSdpToolPath"]]; 19 | [self setRez:[[NSUserDefaults standardUserDefaults] stringForKey:@"SdefRezToolPath"]]; 20 | } 21 | return self; 22 | } 23 | 24 | #pragma mark - 25 | - (BOOL)windowShouldClose:(id)sender { 26 | BOOL isDir; 27 | if (![[NSFileManager defaultManager] fileExistsAtPath:[self sdp] isDirectory:&isDir] || isDir) { 28 | if (NSModalResponseOK != NSRunAlertPanel(@"The sdp Tool path could not be setted because it is not valid!", 29 | @"The path you set for sdp tool is not valid. Choose a valid path or use build-in tool.", 30 | @"Ignore", @"Change", nil)) 31 | return NO; 32 | } 33 | 34 | if (![[NSFileManager defaultManager] fileExistsAtPath:[self rez] isDirectory:&isDir] || isDir) { 35 | if (NSModalResponseOK != NSRunAlertPanel(@"The Rez Tool path could not be setted because it is not valid!", 36 | @"The path you set for Rez tool is not valid. Choose a valid path or use build-in tool.", 37 | @"Ignore", @"Change", nil)) 38 | return NO; 39 | } 40 | 41 | [[NSUserDefaults standardUserDefaults] setObject:[self sdp] forKey:@"SdefSdpToolPath"]; 42 | [[NSUserDefaults standardUserDefaults] setObject:[self rez] forKey:@"SdefRezToolPath"]; 43 | [[NSUserDefaults standardUserDefaults] synchronize]; 44 | return YES; 45 | } 46 | 47 | @end 48 | -------------------------------------------------------------------------------- /Interface/SdefDictionaryView.m: -------------------------------------------------------------------------------- 1 | /* 2 | * SdefDictionaryView.m 3 | * Sdef Editor 4 | * 5 | * Created by Rainbow Team. 6 | * Copyright © 2006 - 2007 Shadow Lab. All rights reserved. 7 | */ 8 | 9 | #import "SdefDictionaryView.h" 10 | #import "SdefDictionary.h" 11 | #import "SdefSuite.h" 12 | 13 | @implementation SdefDictionaryView 14 | 15 | - (void)awakeFromNib { 16 | [suitesTable setTarget:self]; 17 | [suitesTable setDoubleAction:@selector(revealInTree:)]; 18 | } 19 | 20 | - (IBAction)addSuite:(id)sender { 21 | SdefSuite *suite = [[SdefSuite alloc] init]; 22 | [[self object] appendChild:suite]; 23 | } 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /Interface/SdefEnumerationView.m: -------------------------------------------------------------------------------- 1 | /* 2 | * SdefEnumerationView.m 3 | * Sdef Editor 4 | * 5 | * Created by Rainbow Team. 6 | * Copyright © 2006 - 2007 Shadow Lab. All rights reserved. 7 | */ 8 | 9 | #import "SdefEnumerationView.h" 10 | #import "SdefTypedef.h" 11 | 12 | #import 13 | 14 | @interface SdefEnumerationInlineTransformer : NSValueTransformer { 15 | } 16 | 17 | + (id)transformer; 18 | 19 | @end 20 | 21 | 22 | @implementation SdefEnumerationView 23 | 24 | + (void)initialize { 25 | if ([SdefEnumerationView class] == self) { 26 | [NSValueTransformer setValueTransformer:[SdefEnumerationInlineTransformer transformer] forName:@"SdefEnumerationInline"]; 27 | } 28 | } 29 | 30 | - (void)selectObject:(SdefObject*)anObject { 31 | NSInteger idx = -1; 32 | SdefEnumeration *content = [self object]; 33 | if (anObject == content) idx = 0; 34 | else if ([anObject parent] == content) { 35 | idx = 1; 36 | [ibEnumerators setSelectedObject:anObject]; 37 | } 38 | if (idx >= 0) 39 | [uiTab selectTabViewItemAtIndex:idx]; 40 | } 41 | 42 | //- (void)tableViewSelectionDidChange:(NSNotification *)aNotification { 43 | // WBTrace(); 44 | // id table = [aNotification object]; 45 | // NSInteger row = [table selectedRow]; 46 | // if (row >= 0 && row < [[self object] count]) { 47 | // [self revealObjectInTree:[[self object] childAtIndex:row]]; 48 | // } 49 | //} 50 | 51 | @end 52 | 53 | @implementation SdefRecordView 54 | 55 | - (void)selectObject:(SdefObject*)anObject { 56 | NSInteger idx = -1; 57 | SdefRecord *content = [self object]; 58 | if (anObject == content) idx = 0; 59 | else if ([anObject parent] == content) { 60 | idx = 1; 61 | [ibProperties setSelectedObject:anObject]; 62 | } 63 | if (idx >= 0) 64 | [uiTab selectTabViewItemAtIndex:idx]; 65 | } 66 | 67 | - (id)editedObject:(id)sender { 68 | return [ibProperties selectedObject]; 69 | } 70 | 71 | @end 72 | 73 | @implementation SdefEnumerationInlineTransformer 74 | 75 | + (id)transformer { 76 | return [[self alloc] init]; 77 | } 78 | 79 | // information that can be used to analyze available transformer instances (especially used inside Interface Builder) 80 | // class of the "output" objects, as returned by transformedValue: 81 | + (Class)transformedValueClass { 82 | return [NSNumber class]; 83 | } 84 | 85 | // flag indicating whether transformation is read-only or not 86 | + (BOOL)allowsReverseTransformation { 87 | return YES; 88 | } 89 | 90 | /* Transform */ 91 | - (id)transformedValue:(id)value { 92 | NSInteger inlin = [value integerValue]; 93 | return (kSdefInlineAll == inlin) ? nil : value; 94 | } 95 | 96 | /* Returns access value */ 97 | - (id)reverseTransformedValue:(id)value { 98 | return (value) ? value : @(kSdefInlineAll); 99 | } 100 | 101 | @end 102 | -------------------------------------------------------------------------------- /Interface/SdefLogWindowController.h: -------------------------------------------------------------------------------- 1 | // 2 | // SdefLogWindowController.h 3 | // Sdef Editor 4 | // 5 | // Created by Jean-Daniel Dupas on 18/07/13. 6 | // 7 | // 8 | 9 | #import 10 | 11 | @interface SdefLogWindowController : NSWindowController 12 | 13 | @property(nonatomic, assign) IBOutlet NSTextView *logView; 14 | 15 | - (void)setText:(NSString *)message; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /Interface/SdefLogWindowController.m: -------------------------------------------------------------------------------- 1 | // 2 | // SdefLogWindowController.m 3 | // Sdef Editor 4 | // 5 | // Created by Jean-Daniel Dupas on 18/07/13. 6 | // 7 | // 8 | 9 | #import "SdefLogWindowController.h" 10 | 11 | @interface SdefLogWindowController () 12 | 13 | @end 14 | 15 | @implementation SdefLogWindowController 16 | 17 | @synthesize logView = _logView; 18 | 19 | - (id)init { 20 | return [super initWithWindowNibName:@"SdefLogWindow" owner:self]; 21 | } 22 | 23 | - (id)initWithWindow:(NSWindow *)window { 24 | if (self = [super initWithWindow:window]) { 25 | // Initialization code here. 26 | } 27 | return self; 28 | } 29 | 30 | - (void)windowDidLoad { 31 | [super windowDidLoad]; 32 | [_logView setFont:[NSFont userFixedPitchFontOfSize:0]]; 33 | } 34 | 35 | - (void)setText:(NSString *)message { 36 | [self window]; // force load 37 | [_logView setString:message]; 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /Interface/SdefToolbar.m: -------------------------------------------------------------------------------- 1 | /* 2 | * SdefToolbar.m 3 | * Sdef Editor 4 | * 5 | * Created by Grayfox on 22/04/07. 6 | * Copyright 2007 Shadow Lab. All rights reserved. 7 | */ 8 | 9 | #import "SdefWindowController.h" 10 | 11 | @implementation SdefWindowController (SdefToolbarDelegate) 12 | 13 | NSString *SdefSaveDocToolbarItemIdentifier = @"org.shadowlab.sdef.toolbar.save"; 14 | NSString *SdefOpenReferenceToolbarItemIdentifier = @"org.shadowlab.sdef.toolbar.reference"; 15 | 16 | - (NSArray *)toolbarAllowedItemIdentifiers: (NSToolbar *) toolbar { 17 | return @[SdefSaveDocToolbarItemIdentifier, 18 | SdefOpenReferenceToolbarItemIdentifier, 19 | //NSToolbarPrintItemIdentifier, 20 | //NSToolbarShowColorsItemIdentifier, 21 | //NSToolbarShowFontsItemIdentifier, 22 | NSToolbarCustomizeToolbarItemIdentifier, 23 | NSToolbarFlexibleSpaceItemIdentifier, 24 | NSToolbarSpaceItemIdentifier, 25 | NSToolbarSeparatorItemIdentifier]; 26 | } 27 | 28 | - (NSArray *)toolbarDefaultItemIdentifiers: (NSToolbar *) toolbar { 29 | return @[SdefSaveDocToolbarItemIdentifier, 30 | NSToolbarSeparatorItemIdentifier, 31 | SdefOpenReferenceToolbarItemIdentifier, 32 | NSToolbarFlexibleSpaceItemIdentifier, 33 | NSToolbarSpaceItemIdentifier]; 34 | } 35 | 36 | - (NSToolbarItem *)toolbar:(NSToolbar *)toolbar 37 | itemForItemIdentifier:(NSString *)itemIdentifier 38 | willBeInsertedIntoToolbar:(BOOL)flag { 39 | NSToolbarItem *toolbarItem = [[[NSToolbarItem alloc] initWithItemIdentifier:itemIdentifier] autorelease]; 40 | 41 | if ([itemIdentifier isEqual:SdefSaveDocToolbarItemIdentifier]) { 42 | // Set the text label to be displayed in the 43 | // toolbar and customization palette 44 | [toolbarItem setLabel:@"Save"]; 45 | [toolbarItem setPaletteLabel:@"Save"]; 46 | 47 | // Set up a reasonable tooltip, and image 48 | // you will likely want to localize many of the item's properties 49 | [toolbarItem setToolTip:@"Save Your Document"]; 50 | [toolbarItem setImage:[NSImage imageNamed:@"SaveDocumentItemImage"]]; 51 | 52 | // Tell the item what message to send when it is clicked 53 | //[toolbarItem setTarget:self]; 54 | [toolbarItem setAction:@selector(saveDocument:)]; 55 | } else if ([itemIdentifier isEqualToString:SdefOpenReferenceToolbarItemIdentifier]) { 56 | [toolbarItem setLabel:@"Sdef Reference"]; 57 | [toolbarItem setPaletteLabel:@"Sdef Reference"]; 58 | 59 | [toolbarItem setToolTip:@"Open Sdef format Reference"]; 60 | [toolbarItem setImage:[NSImage imageNamed:@"SdefReference"]]; 61 | 62 | [toolbarItem setAction:@selector(openSdefReference:)]; 63 | } else { 64 | // itemIdentifier referred to a toolbar item that is not 65 | // provided or supported by us or Cocoa 66 | // Returning nil will inform the toolbar 67 | // that this kind of item is not supported 68 | toolbarItem = nil; 69 | } 70 | return toolbarItem; 71 | } 72 | 73 | @end 74 | -------------------------------------------------------------------------------- /Interface/SdefTypesEditor.m: -------------------------------------------------------------------------------- 1 | /* 2 | * SdefTypeWindow.m 3 | * Sdef Editor 4 | * 5 | * Created by Rainbow Team. 6 | * Copyright © 2006 - 2007 Shadow Lab. All rights reserved. 7 | */ 8 | 9 | #import "SdefTypesEditor.h" 10 | #import "SdefObjects.h" 11 | #import "SdefClassManager.h" 12 | 13 | @implementation SdefTypesEditor 14 | 15 | #pragma mark - 16 | - (IBAction)close:(id)sender { 17 | [sd_object willChangeValueForKey:@"type"]; 18 | [sd_object didChangeValueForKey:@"type"]; 19 | [super close:sender]; 20 | } 21 | 22 | - (NSView *)field { 23 | return sd_field; 24 | } 25 | - (void)setField:(NSView *)field { 26 | sd_field = field; 27 | } 28 | 29 | - (SdefTypedObject *)object { 30 | return sd_object; 31 | } 32 | - (void)setObject:(SdefTypedObject *)object { 33 | sd_object = object; 34 | } 35 | 36 | - (NSArray *)types { 37 | if (!sd_types) { 38 | sd_types = [[sd_object classManager] types]; 39 | } 40 | return sd_types; 41 | } 42 | 43 | @end 44 | -------------------------------------------------------------------------------- /Interface/SdefVerbView.m: -------------------------------------------------------------------------------- 1 | /* 2 | * SdefVerbView.m 3 | * Sdef Editor 4 | * 5 | * Created by Rainbow Team. 6 | * Copyright © 2006 - 2007 Shadow Lab. All rights reserved. 7 | */ 8 | 9 | #import "SdefVerbView.h" 10 | #import "SdefVerb.h" 11 | #import "SdefArguments.h" 12 | 13 | #import 14 | 15 | @implementation SdefVerbView 16 | 17 | + (NSSet *)keyPathsForValuesAffectingVerbLabel { 18 | return [NSSet setWithObject:@"object"]; 19 | } 20 | 21 | - (NSString *)verbLabel { 22 | if (![self object]) 23 | return @"Verb"; 24 | return [[self object] isCommand] ? NSLocalizedString(@"Command", @"Verb Tab Label") : NSLocalizedString(@"Event", @"Verb Tab Label"); 25 | } 26 | 27 | - (void)selectObject:(SdefObject*)anObject { 28 | int idx = -1; 29 | SdefVerb *content = [self object]; 30 | if (anObject == content) idx = 0; 31 | else if ([anObject parent] == content) { 32 | idx = 1; 33 | [parameters setSelectedObjects:[NSArray arrayWithObject:anObject]]; 34 | } 35 | if (idx >= 0) 36 | [tab selectTabViewItemAtIndex:idx]; 37 | } 38 | 39 | - (id)editedObject:(id)sender { 40 | switch ([sender tag]) { 41 | case 0: 42 | return [parameters selectedObject]; 43 | case 1: 44 | return [[self object] directParameter]; 45 | case 2: 46 | return [[self object] result]; 47 | } 48 | return nil; 49 | } 50 | 51 | //- (void)tableViewSelectionDidChange:(NSNotification *)aNotification { 52 | // id table = [aNotification object]; 53 | // int row = [table selectedRow]; 54 | // if (row >= 0 && row < [[self object] count]) { 55 | // [self revealObjectInTree:[[self object] childAtIndex:row]]; 56 | // } 57 | //} 58 | 59 | @end 60 | -------------------------------------------------------------------------------- /Interface/SdefXIncludeView.h: -------------------------------------------------------------------------------- 1 | // 2 | // SdefXIncludeView.h 3 | // Sdef Editor 4 | // 5 | // Created by Jean-Daniel Dupas on 29/10/07. 6 | // Copyright 2007 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import "SdefViewController.h" 10 | 11 | @interface SdefXIncludeView : SdefViewController { 12 | @private 13 | } 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /Interface/SdefXIncludeView.m: -------------------------------------------------------------------------------- 1 | // 2 | // SdefXIncludeView.m 3 | // Sdef Editor 4 | // 5 | // Created by Jean-Daniel Dupas on 29/10/07. 6 | // Copyright 2007 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import "SdefXIncludeView.h" 10 | 11 | @implementation SdefXIncludeView 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Misc/ReadMe.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Sdef Editor 8 | 23 | 24 | 25 |

Sdef Editor
v1.5.4

26 |
27 |
Introduction:
28 |
29 |

Sdef Editor is a simple utility that allows to create, edit and export Scripting definition files (xml .sdef files).

30 |

Sdef Editor supports all elements and attributes proposed by the sdef format. You can export generated files in Cocoa .scriptSuite, .scriptTerminology files, or as 'aete' text or compiled resource.

31 |
32 |

Please, to know more about sdef format, and how Sdef Editor represents sdef files, read "Scripting File Reference" (included in Sdef Editor Help).

33 |
34 |
How To:
35 |
36 | Sdef Editor now includes on-line Help, with sdef reference, release notes, and more. (Launch Sdef Editor, and use Help Menu). 37 |
38 |
History:
39 |
40 | Release notes are included in Sdef Editor Help. Launch the Application and open the Help Menu. 41 |
42 |
43 |

44 | If you have a question or suggestions, or if you encounter some bugs or problems, please send me an email. 45 |

46 |
47 | Jean-Daniel Dupas
48 | support@shadowlab.org
49 | Copyright © Shadow Lab. 2005 - 2008.
50 |
51 |
52 | donate 53 |
54 | -------------------------------------------------------------------------------- /Misc/Sdef Editor Help/Sdef Editor Help.helpindex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jean-Daniel/Sdef-Editor/e95c5f6c43e96f398d35be981e1c0403e651112a/Misc/Sdef Editor Help/Sdef Editor Help.helpindex -------------------------------------------------------------------------------- /Misc/Sdef Editor Help/SdefEditor.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Sdef Editor Help 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 23 | 31 | 32 |
19 | Sdef Editor 20 |

Sdef Editor Help

21 |

www.shadowlab.org/Software/

22 |
24 | 30 |
33 | 34 | -------------------------------------------------------------------------------- /Misc/Sdef Editor Help/images/Class-Extension.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jean-Daniel/Sdef-Editor/e95c5f6c43e96f398d35be981e1c0403e651112a/Misc/Sdef Editor Help/images/Class-Extension.png -------------------------------------------------------------------------------- /Misc/Sdef Editor Help/images/Class.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jean-Daniel/Sdef-Editor/e95c5f6c43e96f398d35be981e1c0403e651112a/Misc/Sdef Editor Help/images/Class.png -------------------------------------------------------------------------------- /Misc/Sdef Editor Help/images/Contents.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jean-Daniel/Sdef-Editor/e95c5f6c43e96f398d35be981e1c0403e651112a/Misc/Sdef Editor Help/images/Contents.png -------------------------------------------------------------------------------- /Misc/Sdef Editor Help/images/Dictionary.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jean-Daniel/Sdef-Editor/e95c5f6c43e96f398d35be981e1c0403e651112a/Misc/Sdef Editor Help/images/Dictionary.png -------------------------------------------------------------------------------- /Misc/Sdef Editor Help/images/Element.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jean-Daniel/Sdef-Editor/e95c5f6c43e96f398d35be981e1c0403e651112a/Misc/Sdef Editor Help/images/Element.png -------------------------------------------------------------------------------- /Misc/Sdef Editor Help/images/Enum.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jean-Daniel/Sdef-Editor/e95c5f6c43e96f398d35be981e1c0403e651112a/Misc/Sdef Editor Help/images/Enum.png -------------------------------------------------------------------------------- /Misc/Sdef Editor Help/images/Export.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jean-Daniel/Sdef-Editor/e95c5f6c43e96f398d35be981e1c0403e651112a/Misc/Sdef Editor Help/images/Export.png -------------------------------------------------------------------------------- /Misc/Sdef Editor Help/images/Field.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jean-Daniel/Sdef-Editor/e95c5f6c43e96f398d35be981e1c0403e651112a/Misc/Sdef Editor Help/images/Field.png -------------------------------------------------------------------------------- /Misc/Sdef Editor Help/images/Function.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jean-Daniel/Sdef-Editor/e95c5f6c43e96f398d35be981e1c0403e651112a/Misc/Sdef Editor Help/images/Function.png -------------------------------------------------------------------------------- /Misc/Sdef Editor Help/images/Icon_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jean-Daniel/Sdef-Editor/e95c5f6c43e96f398d35be981e1c0403e651112a/Misc/Sdef Editor Help/images/Icon_16.png -------------------------------------------------------------------------------- /Misc/Sdef Editor Help/images/Icon_32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jean-Daniel/Sdef-Editor/e95c5f6c43e96f398d35be981e1c0403e651112a/Misc/Sdef Editor Help/images/Icon_32.png -------------------------------------------------------------------------------- /Misc/Sdef Editor Help/images/Inspector.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jean-Daniel/Sdef-Editor/e95c5f6c43e96f398d35be981e1c0403e651112a/Misc/Sdef Editor Help/images/Inspector.png -------------------------------------------------------------------------------- /Misc/Sdef Editor Help/images/Member.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jean-Daniel/Sdef-Editor/e95c5f6c43e96f398d35be981e1c0403e651112a/Misc/Sdef Editor Help/images/Member.png -------------------------------------------------------------------------------- /Misc/Sdef Editor Help/images/Misc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jean-Daniel/Sdef-Editor/e95c5f6c43e96f398d35be981e1c0403e651112a/Misc/Sdef Editor Help/images/Misc.png -------------------------------------------------------------------------------- /Misc/Sdef Editor Help/images/Param.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jean-Daniel/Sdef-Editor/e95c5f6c43e96f398d35be981e1c0403e651112a/Misc/Sdef Editor Help/images/Param.png -------------------------------------------------------------------------------- /Misc/Sdef Editor Help/images/Result.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jean-Daniel/Sdef-Editor/e95c5f6c43e96f398d35be981e1c0403e651112a/Misc/Sdef Editor Help/images/Result.png -------------------------------------------------------------------------------- /Misc/Sdef Editor Help/images/SdefEditor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jean-Daniel/Sdef-Editor/e95c5f6c43e96f398d35be981e1c0403e651112a/Misc/Sdef Editor Help/images/SdefEditor.png -------------------------------------------------------------------------------- /Misc/Sdef Editor Help/images/Struct.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jean-Daniel/Sdef-Editor/e95c5f6c43e96f398d35be981e1c0403e651112a/Misc/Sdef Editor Help/images/Struct.png -------------------------------------------------------------------------------- /Misc/Sdef Editor Help/images/Suite.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jean-Daniel/Sdef-Editor/e95c5f6c43e96f398d35be981e1c0403e651112a/Misc/Sdef Editor Help/images/Suite.png -------------------------------------------------------------------------------- /Misc/Sdef Editor Help/images/Type.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jean-Daniel/Sdef-Editor/e95c5f6c43e96f398d35be981e1c0403e651112a/Misc/Sdef Editor Help/images/Type.png -------------------------------------------------------------------------------- /Misc/Sdef Editor Help/images/Variable.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jean-Daniel/Sdef-Editor/e95c5f6c43e96f398d35be981e1c0403e651112a/Misc/Sdef Editor Help/images/Variable.png -------------------------------------------------------------------------------- /Misc/Sdef Editor Help/images/browser-window.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jean-Daniel/Sdef-Editor/e95c5f6c43e96f398d35be981e1c0403e651112a/Misc/Sdef Editor Help/images/browser-window.png -------------------------------------------------------------------------------- /Misc/Sdef Editor Help/images/dot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jean-Daniel/Sdef-Editor/e95c5f6c43e96f398d35be981e1c0403e651112a/Misc/Sdef Editor Help/images/dot.png -------------------------------------------------------------------------------- /Misc/Sdef Editor Help/images/editor-window.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jean-Daniel/Sdef-Editor/e95c5f6c43e96f398d35be981e1c0403e651112a/Misc/Sdef Editor Help/images/editor-window.png -------------------------------------------------------------------------------- /Misc/Sdef Editor Help/images/validator.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jean-Daniel/Sdef-Editor/e95c5f6c43e96f398d35be981e1c0403e651112a/Misc/Sdef Editor Help/images/validator.png -------------------------------------------------------------------------------- /Misc/Sdef Editor Help/images/version.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jean-Daniel/Sdef-Editor/e95c5f6c43e96f398d35be981e1c0403e651112a/Misc/Sdef Editor Help/images/version.png -------------------------------------------------------------------------------- /Misc/Sdef Editor Help/images/versioning.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jean-Daniel/Sdef-Editor/e95c5f6c43e96f398d35be981e1c0403e651112a/Misc/Sdef Editor Help/images/versioning.png -------------------------------------------------------------------------------- /Misc/Sdef Editor Help/images/vertline2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jean-Daniel/Sdef-Editor/e95c5f6c43e96f398d35be981e1c0403e651112a/Misc/Sdef Editor Help/images/vertline2.gif -------------------------------------------------------------------------------- /Misc/Sdef Editor Help/images/warning.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jean-Daniel/Sdef-Editor/e95c5f6c43e96f398d35be981e1c0403e651112a/Misc/Sdef Editor Help/images/warning.png -------------------------------------------------------------------------------- /Misc/Sdef Editor Help/pages/browser.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Symbols Browser 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

Symbols Browser

14 |

If you want to search a symbol or just see all your defined terminology symbols in one window, the “symbols browser” is for you.

15 |
Browser
16 | Figure 1: The symbols browser window.
17 |
18 |

To Open the Browser window, use the Windows Menu (⌘1).

19 |
20 | 21 | -------------------------------------------------------------------------------- /Misc/Sdef Editor Help/pages/edition.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Terminology Edition 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

Terminology Edition

14 |

In Sdef Editor, each document contains one Dictionary, 15 | which can contain one or more Suites. A Suite contains Types, 16 | Classes, Commands and Events. 17 | Classes contains Properties, 18 | Elements, Commands and Events. 19 | This object hierarchy is represented in a Tree.

20 |

To edit content of an object, you have to select it in the tree view, and an editor panel will display (in the right part) details about the selected item (Figure 1).

21 |
Edition
22 | Figure 1: Right part represents the selected Suite.
23 |
24 |
    25 | 26 |
  • You can delete an object by selecting it in the tree and pressing delete key (⌫).
  • 27 |
  • You can reorganise Objects in the Tree with Drag & Drop.
  • 28 |
  • Commands & Events are in fact the same kind of objects. 29 | So you can drag & drop a Command in Events Folder and an Event in Commands Folder.
  • 30 |
31 |
32 |

Some elements supports Synonyms and Documentation. To edit those fieds, you can use the Inspector panel (Figure 2).

33 |

warning : Synonyms and Documentation Elements are defined in the Sdef specification, 34 | but they are not always properly handled by the "Scripting Definition Processor" (sdp) that transforms sdef files into Cocoa or aete terminology.

35 |
Inspector
Figure 2: Inspector Panel.
36 |

Inspector panel allows to add comments on every Objects. Comments will be render as standards XML comments in sdef files.

37 |
38 |

To Open Inspector panel you can either double clic on an Object in the Tree View, or use Windows Menu (⌘I).

39 |
40 | 41 | -------------------------------------------------------------------------------- /Misc/Sdef Editor Help/pages/export.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Terminology Exportation 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

Terminology Exportation (usefull only if you target Mac OS X.3)

14 |

The Export command in the File menu allows you to transform a sdef file into Cocoa Scripting Definition and/or into 'aete' resources. 15 | If you want to know more about exportation, please read "sdp manual".

16 |

Export Panel (Figure 1) allow you to choose exportation format and options.
17 |

Export

18 | Figure 1: Export Panel.
19 |

Target Version specify the minimum system version to be compatible with. This flag is only meaningful for Cocoa Scripting.

20 |

include NSCoreSuite: When you export your suite as Cocoa Terminology, all classes inherits properties of item class of NSCoreSuite. 21 | To avoid warning or error, you must include NSCoreSuite (or include a cutom suite that also define item class).

22 |

Compiled Resources: To generate compiled resources, Sdef Editor uses sdp to obtains .r file and then it uses Rez to compile this file.

23 |
24 |

If you dont want to use build-in Tools (sdp and Rez), you can change Tool Path in Sdef Editor Preferences.

25 |
26 | 27 | -------------------------------------------------------------------------------- /Misc/Sdef Editor Help/pages/import.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | Terminology Importation 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |

Terminology Importation

15 |

Cocoa Script Suite Importation

16 |

Cocoa Terminology files (.scriptSuite & .scriptTerminology) handle less features than sdef files. 17 | Here is a list of possible problems.

18 |
    19 |
  • All Elements: Hidden property is not defined in Cocoa Terminology.
  • 20 |
  • Suite: OK.
  • 21 |
  • Enumeration: Name can be unaccurate & Description is not defined.
  • 22 |
  • Enumerator: OK.
  • 23 |
  • Events: Events are interpreted as Commands.
  • 24 |
  • Commands: "Direct Parameter" isn't defined if type is 'object'. Result "Description" is not defined.
  • 25 |
  • Classes: OK.
  • 26 |
  • Parameters/Contents: "Not In Properties" and "Write Only" are not defined.
  • 27 |
  • Responds To Events: Interpreted as "Responds To Commands".
  • 28 |
  • Elements: Description is not defined. Accessors are not defined.
  • 29 |
30 |

.scriptSuite & .scriptTerminology should be in the same folder. If it is not the case, Sdef Editor will ask you where .scriptTerminology file is.

31 |
32 |

'aete' Resources Importation

33 |

Like "Cocoa Suite", 'aete' resources do not contains all informations needed to fully restore a sdef file.

34 |
    35 |
  • 'aete' resources does not define Cocoa class, name, method and keys.
  • 36 |
  • 'aete' resources does not define "Responds To" in classes. (Classes commands and events will be empty).
  • 37 |
  • Some types defined into 'aete' Resources have no equivalent in sdef format.
  • 38 |
39 |
40 |

Application 'aete' Importation

41 |

Each Scripting Application need be able to responds to GetAETE AppleEvent, by sending its 'aete' resource. 42 | Sdef Editor use this ability to import a running Application 'aete' resource.

43 | 44 | -------------------------------------------------------------------------------- /Misc/Sdef Editor Help/pages/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Sdef Editor Help 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |

Sdef Editor Help

16 | 27 | 28 | -------------------------------------------------------------------------------- /Misc/Sdef Editor Help/pages/sdef-editor.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | What is Sdef Editor? 6 | 7 | 8 | 9 | 10 | 11 |

What is Sdef Editor?

12 |

Scripting definition files (sdefs) are XML files that describe everything 13 | about an application's scriptability: terminology, implementation information, 14 | and complete documentation.
15 | Every scriptable application must provide a definition of its scriptability information—the terminology available for use in scripts that target the application, 16 | as well as the implementation information used to support that terminology. 17 | (see Apple documentation and Sdef Format Reference to learn more about Scripting Definition Files).

18 | 19 |

20 | Sdef Editor allows to simply create, and edit sdefs files. With Sdef editor, you don't have to bother with unreadable XML files.
21 | Sdef Editor provide an easy to use interface to edit and browse an scripting definition.

22 | 23 |
24 |

Help Index

25 | 26 | -------------------------------------------------------------------------------- /Misc/Sdef Editor Help/pages/validation.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Sdef File Validation 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

Sdef File Validation

14 |

Even if Sdef Editor take care of you file syntax, an Sdef File can be invalid, if it does not contains enough informations.

15 |

To be sure that your Sdef File is valid, Sdef Editor provide a validator that check your file for common errors.

16 |
Browser
17 | Figure 1: File validator.
18 |
19 |

To Open the Validator window, use the Windows Menu (⌘2).

20 |

You can double-clic on an element to reveal it in the editor window.

21 |
22 | 23 | -------------------------------------------------------------------------------- /Misc/Sdef Editor Help/pages/version.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Sdef File Version 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

Sdef File Version

14 |

One of the most important feature of Sdef Editor is it's capacity to seamlessly generate file for different Mac OS X versions.

15 |

Sdef files are used only by Mac OS X.4 and Mac OS X.5, but Mac OS X.5 bring some new attributes and features that are not backward compatible.
16 | With Sdef Editor, you can safely save your file for any system version, and reopen it without losing informations, even if you use incompatible features. 17 |

18 |
Browser
19 | Figure 1: The target version menu.
20 | 21 |

If you use incompatible elements, Sdef Editor will properly tranform those elements and generate extra comments, and it will reparse thoses comments to restaure informations.

22 |

For example, if you use a class-extension element, and you target Tiger, Sdef Editor will save it as a properly configured class element, and will generate extra-comments to specify that it is a class-extension, so it will reopen it as a class-extension, and not as a class. 23 |
An other example is if you use xref attributes. Sdef Editor will change "xref" attributes so they will appear as comments into Tiger definitions, but those comment will be interpreted as "xref" attributes by Sdef Editor. 24 |

25 | 26 | -------------------------------------------------------------------------------- /Misc/Sdef Editor Help/styles/custom_style.css: -------------------------------------------------------------------------------- 1 | /* IP CSS Custom Style 1.1 */ /* */ body { background-color: white; margin-right: 18px; margin-left: 18px } p, div { color: black; font-weight: normal; font-size: 9pt; line-height: 12pt; font-family: "Lucida Grande", Helvetica, Arial; text-decoration: none; } p.indent { text-indent: 12px; } h1 { color: black; font-size: 12pt; font-family: "Lucida Grande", Helvetica, Arial; margin-top: 53px; padding-bottom: 4px } h2 { color: black; font-size: 9pt; font-family: "Lucida Grande", Helvetica, Arial; margin-bottom: -6px } 2 | h4 { font-weight: 200; font-size: 9pt; line-height: 12pt; font-family: "Lucida Grande", Helvetica, Arial; margin-bottom: -8px } a { color: #146590; font-size: 9pt; line-height: 11pt; font-family: "Lucida Grande", Helvetica, Arial; text-decoration: none } ol { list-style-type: decimal; list-style-position: inside; padding-left: 24px } 3 | .middle { 4 | vertical-align: middle; 5 | } 6 | ul, dl { list-style-type: square; list-style-position: inside; padding-left: 24px } ul p, dd { margin-top: 6px; margin-bottom: 6px } dt, dd { font-size: 9pt; line-height: 11pt; font-family: "Lucida Grande", Helvetica, Arial; } dt { font-weight: bold; margin-top: 12px; } dd { margin-left: 12px; } li { font-size: 9pt; line-height: 11pt; font-family: "Lucida Grande", Helvetica, Arial; list-style-position: outside; margin-top: 6px; margin-left: -8px; } a:hover { text-decoration: underline } .alpha { list-style-type: upper-alpha } .xhead { background-color: #d3d3d3; border: solid 1px gray } span.chapter { font-size: 16px; text-decoration: underline; } div.chapter { margin-top: 20px; } .rule { border-bottom: 1px solid gray } .orange { color: #ff4500 } .icon { margin-top: 10px } #caticon { background-color: #fff; float: left; padding-top: 30px; padding-bottom: -8px } #pagetitle { background-color: #fff; margin-left: 44px; padding-top: 34px; padding-bottom: -8px; width: 88% } -------------------------------------------------------------------------------- /Misc/Sdef Editor Help/styles/home.css: -------------------------------------------------------------------------------- 1 | a { color: gray; text-decoration: none; font-family: "Lucida Grande", Helvetica, Arial; } h1 { color: gray; font-size: 20pt; padding-top: 20px; letter-spacing: -1pt; font-family: "Lucida Grande", Helvetica, Arial; } h2 { color: gray; font-size: 12pt; padding-top: 8px; padding-bottom: 38px; font-family: "Lucida Grande", Helvetica, Arial; } h3 { color: gray; font-size: 8pt; font-weight: 300; padding-left: 6px; margin-bottom: -12px; font-family: "Lucida Grande", Helvetica, Arial; } h4 { color: gray; font-size: 8pt; margin-top: -4px; font-weight: 300; font-family: "Lucida Grande", Helvetica, Arial; } ul { margin-left: -8px; padding-top: 24px; padding-bottom: 12px; border-left: 1px solid gray } a:hover { text-decoration: underline } #contents { width: 550px; margin-left: auto; margin-right: auto; text-align: center; } #content-left { width: 220px; margin-top: 76px; text-align: center; } #content-right { width: 220px; margin-top: 14px; } p,h1,pre { margin: 0px 10px 10px 10px; } -------------------------------------------------------------------------------- /Misc/Sdef Editor Help/styles/task_style.css: -------------------------------------------------------------------------------- 1 | /* IP CSS Task Style 1.0 */ 2 | /* */ 3 | 4 | #mainbox { 5 | background-color: #fff; 6 | margin-top: 28px; 7 | margin-right: 26px; 8 | margin-left: 18px; 9 | position: absolute; 10 | top: 10px 11 | } 12 | 13 | .taskbox { 14 | background-color: #eee; 15 | list-style-type: decimal; 16 | list-style-position: outside; 17 | margin-top: 12px; 18 | margin-bottom: 12px; 19 | padding: 2px 12px; 20 | border: solid 1px #444; 21 | margin-left: auto; 22 | margin-right: auto; 23 | width: 90%; 24 | } 25 | 26 | .taskbox ul, .taskbox th, .taskbox td { 27 | font-size: 9pt; 28 | font-family: "Lucida Grande", Helvetica, Arial; 29 | list-style-type: square; 30 | list-style-position: outside; 31 | margin-top: 12px; 32 | } 33 | 34 | table.taskbox { padding: 0px; } 35 | 36 | #leftlink { 37 | background-color: #fff; 38 | float: left; 39 | margin-top: 10px; 40 | margin-bottom: 20px; 41 | width: 64% 42 | } 43 | 44 | #rightlink { 45 | background-color: #fff; 46 | text-align: right; 47 | float: right; 48 | margin-top: 10px; 49 | margin-bottom: 20px; 50 | width: 34% 51 | } 52 | .alternate td { 53 | border-width: 1px 0px 0px 0px; 54 | border-color: #999999; 55 | border-style: solid; 56 | } 57 | -------------------------------------------------------------------------------- /Misc/SdefEditor.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jean-Daniel/Sdef-Editor/e95c5f6c43e96f398d35be981e1c0403e651112a/Misc/SdefEditor.psd -------------------------------------------------------------------------------- /Misc/SdefFile.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jean-Daniel/Sdef-Editor/e95c5f6c43e96f398d35be981e1c0403e651112a/Misc/SdefFile.psd -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Sdef-Editor 2 | =========== 3 | 4 | Scripting Definition Dictionary Editor 5 | 6 | 7 | This project includes submodules that must be checked out before building. To do so, run these commands in the Terminal, in the root directory of the repository: 8 | 9 | ``` 10 | git submodule update --init 11 | ``` 12 | 13 | Additionally, you will need to set the Team setting in the `xcconfigs/team.xcconfig` file. 14 | -------------------------------------------------------------------------------- /Resources/English.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jean-Daniel/Sdef-Editor/e95c5f6c43e96f398d35be981e1c0403e651112a/Resources/English.lproj/InfoPlist.strings -------------------------------------------------------------------------------- /Resources/English.lproj/Localizable.strings: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jean-Daniel/Sdef-Editor/e95c5f6c43e96f398d35be981e1c0403e651112a/Resources/English.lproj/Localizable.strings -------------------------------------------------------------------------------- /Resources/English.lproj/SdefLibrary.strings: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jean-Daniel/Sdef-Editor/e95c5f6c43e96f398d35be981e1c0403e651112a/Resources/English.lproj/SdefLibrary.strings -------------------------------------------------------------------------------- /Resources/Images/AddMini.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jean-Daniel/Sdef-Editor/e95c5f6c43e96f398d35be981e1c0403e651112a/Resources/Images/AddMini.tiff -------------------------------------------------------------------------------- /Resources/Images/AddMini_Pressed.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jean-Daniel/Sdef-Editor/e95c5f6c43e96f398d35be981e1c0403e651112a/Resources/Images/AddMini_Pressed.tiff -------------------------------------------------------------------------------- /Resources/Images/AddType.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jean-Daniel/Sdef-Editor/e95c5f6c43e96f398d35be981e1c0403e651112a/Resources/Images/AddType.tiff -------------------------------------------------------------------------------- /Resources/Images/Bookmarks.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jean-Daniel/Sdef-Editor/e95c5f6c43e96f398d35be981e1c0403e651112a/Resources/Images/Bookmarks.tiff -------------------------------------------------------------------------------- /Resources/Images/Box.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jean-Daniel/Sdef-Editor/e95c5f6c43e96f398d35be981e1c0403e651112a/Resources/Images/Box.tiff -------------------------------------------------------------------------------- /Resources/Images/Check.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jean-Daniel/Sdef-Editor/e95c5f6c43e96f398d35be981e1c0403e651112a/Resources/Images/Check.tiff -------------------------------------------------------------------------------- /Resources/Images/Class-Extension.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jean-Daniel/Sdef-Editor/e95c5f6c43e96f398d35be981e1c0403e651112a/Resources/Images/Class-Extension.tiff -------------------------------------------------------------------------------- /Resources/Images/Class.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jean-Daniel/Sdef-Editor/e95c5f6c43e96f398d35be981e1c0403e651112a/Resources/Images/Class.tiff -------------------------------------------------------------------------------- /Resources/Images/Content.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jean-Daniel/Sdef-Editor/e95c5f6c43e96f398d35be981e1c0403e651112a/Resources/Images/Content.tiff -------------------------------------------------------------------------------- /Resources/Images/Dictionary.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jean-Daniel/Sdef-Editor/e95c5f6c43e96f398d35be981e1c0403e651112a/Resources/Images/Dictionary.tiff -------------------------------------------------------------------------------- /Resources/Images/EditSymbol.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jean-Daniel/Sdef-Editor/e95c5f6c43e96f398d35be981e1c0403e651112a/Resources/Images/EditSymbol.tiff -------------------------------------------------------------------------------- /Resources/Images/EditType.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jean-Daniel/Sdef-Editor/e95c5f6c43e96f398d35be981e1c0403e651112a/Resources/Images/EditType.tiff -------------------------------------------------------------------------------- /Resources/Images/Element.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jean-Daniel/Sdef-Editor/e95c5f6c43e96f398d35be981e1c0403e651112a/Resources/Images/Element.tiff -------------------------------------------------------------------------------- /Resources/Images/Enum.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jean-Daniel/Sdef-Editor/e95c5f6c43e96f398d35be981e1c0403e651112a/Resources/Images/Enum.tiff -------------------------------------------------------------------------------- /Resources/Images/Field.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jean-Daniel/Sdef-Editor/e95c5f6c43e96f398d35be981e1c0403e651112a/Resources/Images/Field.tiff -------------------------------------------------------------------------------- /Resources/Images/Folder.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jean-Daniel/Sdef-Editor/e95c5f6c43e96f398d35be981e1c0403e651112a/Resources/Images/Folder.tiff -------------------------------------------------------------------------------- /Resources/Images/Function.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jean-Daniel/Sdef-Editor/e95c5f6c43e96f398d35be981e1c0403e651112a/Resources/Images/Function.tiff -------------------------------------------------------------------------------- /Resources/Images/Member.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jean-Daniel/Sdef-Editor/e95c5f6c43e96f398d35be981e1c0403e651112a/Resources/Images/Member.tiff -------------------------------------------------------------------------------- /Resources/Images/MiniPlus.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jean-Daniel/Sdef-Editor/e95c5f6c43e96f398d35be981e1c0403e651112a/Resources/Images/MiniPlus.tiff -------------------------------------------------------------------------------- /Resources/Images/Misc.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jean-Daniel/Sdef-Editor/e95c5f6c43e96f398d35be981e1c0403e651112a/Resources/Images/Misc.tiff -------------------------------------------------------------------------------- /Resources/Images/Param.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jean-Daniel/Sdef-Editor/e95c5f6c43e96f398d35be981e1c0403e651112a/Resources/Images/Param.tiff -------------------------------------------------------------------------------- /Resources/Images/Property.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jean-Daniel/Sdef-Editor/e95c5f6c43e96f398d35be981e1c0403e651112a/Resources/Images/Property.tiff -------------------------------------------------------------------------------- /Resources/Images/Record.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jean-Daniel/Sdef-Editor/e95c5f6c43e96f398d35be981e1c0403e651112a/Resources/Images/Record.tiff -------------------------------------------------------------------------------- /Resources/Images/RemoveMini.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jean-Daniel/Sdef-Editor/e95c5f6c43e96f398d35be981e1c0403e651112a/Resources/Images/RemoveMini.tiff -------------------------------------------------------------------------------- /Resources/Images/RemoveMini_Pressed.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jean-Daniel/Sdef-Editor/e95c5f6c43e96f398d35be981e1c0403e651112a/Resources/Images/RemoveMini_Pressed.tiff -------------------------------------------------------------------------------- /Resources/Images/Suite.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jean-Daniel/Sdef-Editor/e95c5f6c43e96f398d35be981e1c0403e651112a/Resources/Images/Suite.tiff -------------------------------------------------------------------------------- /Resources/Images/Type.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jean-Daniel/Sdef-Editor/e95c5f6c43e96f398d35be981e1c0403e651112a/Resources/Images/Type.tiff -------------------------------------------------------------------------------- /Resources/Images/Value.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jean-Daniel/Sdef-Editor/e95c5f6c43e96f398d35be981e1c0403e651112a/Resources/Images/Value.tiff -------------------------------------------------------------------------------- /Resources/Images/Variable.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jean-Daniel/Sdef-Editor/e95c5f6c43e96f398d35be981e1c0403e651112a/Resources/Images/Variable.tiff -------------------------------------------------------------------------------- /Resources/Images/XInclude.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jean-Daniel/Sdef-Editor/e95c5f6c43e96f398d35be981e1c0403e651112a/Resources/Images/XInclude.tiff -------------------------------------------------------------------------------- /Resources/Images/valid-error.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jean-Daniel/Sdef-Editor/e95c5f6c43e96f398d35be981e1c0403e651112a/Resources/Images/valid-error.tiff -------------------------------------------------------------------------------- /Resources/Images/valid-note.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jean-Daniel/Sdef-Editor/e95c5f6c43e96f398d35be981e1c0403e651112a/Resources/Images/valid-note.tiff -------------------------------------------------------------------------------- /Resources/Images/valid-warning.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jean-Daniel/Sdef-Editor/e95c5f6c43e96f398d35be981e1c0403e651112a/Resources/Images/valid-warning.tiff -------------------------------------------------------------------------------- /Resources/Images/warning.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jean-Daniel/Sdef-Editor/e95c5f6c43e96f398d35be981e1c0403e651112a/Resources/Images/warning.tiff -------------------------------------------------------------------------------- /Resources/NSTextSuite.sdef: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /Resources/ScriptSuiteIcon.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jean-Daniel/Sdef-Editor/e95c5f6c43e96f398d35be981e1c0403e651112a/Resources/ScriptSuiteIcon.icns -------------------------------------------------------------------------------- /Resources/Sdef Editor.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.automation.apple-events 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Resources/Sdef Editor.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "16x16", 5 | "idiom" : "mac", 6 | "filename" : "icon_16x16.png", 7 | "scale" : "1x" 8 | }, 9 | { 10 | "idiom" : "mac", 11 | "size" : "16x16", 12 | "scale" : "2x" 13 | }, 14 | { 15 | "size" : "32x32", 16 | "idiom" : "mac", 17 | "filename" : "icon_32x32.png", 18 | "scale" : "1x" 19 | }, 20 | { 21 | "idiom" : "mac", 22 | "size" : "32x32", 23 | "scale" : "2x" 24 | }, 25 | { 26 | "size" : "128x128", 27 | "idiom" : "mac", 28 | "filename" : "icon_128x128.png", 29 | "scale" : "1x" 30 | }, 31 | { 32 | "idiom" : "mac", 33 | "size" : "128x128", 34 | "scale" : "2x" 35 | }, 36 | { 37 | "idiom" : "mac", 38 | "size" : "256x256", 39 | "scale" : "1x" 40 | }, 41 | { 42 | "idiom" : "mac", 43 | "size" : "256x256", 44 | "scale" : "2x" 45 | }, 46 | { 47 | "idiom" : "mac", 48 | "size" : "512x512", 49 | "scale" : "1x" 50 | }, 51 | { 52 | "idiom" : "mac", 53 | "size" : "512x512", 54 | "scale" : "2x" 55 | } 56 | ], 57 | "info" : { 58 | "version" : 1, 59 | "author" : "xcode" 60 | } 61 | } -------------------------------------------------------------------------------- /Resources/Sdef Editor.xcassets/AppIcon.appiconset/icon_128x128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jean-Daniel/Sdef-Editor/e95c5f6c43e96f398d35be981e1c0403e651112a/Resources/Sdef Editor.xcassets/AppIcon.appiconset/icon_128x128.png -------------------------------------------------------------------------------- /Resources/Sdef Editor.xcassets/AppIcon.appiconset/icon_16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jean-Daniel/Sdef-Editor/e95c5f6c43e96f398d35be981e1c0403e651112a/Resources/Sdef Editor.xcassets/AppIcon.appiconset/icon_16x16.png -------------------------------------------------------------------------------- /Resources/Sdef Editor.xcassets/AppIcon.appiconset/icon_32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jean-Daniel/Sdef-Editor/e95c5f6c43e96f398d35be981e1c0403e651112a/Resources/Sdef Editor.xcassets/AppIcon.appiconset/icon_32x32.png -------------------------------------------------------------------------------- /Resources/Sdef Editor.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /Resources/SdefDictionary.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jean-Daniel/Sdef-Editor/e95c5f6c43e96f398d35be981e1c0403e651112a/Resources/SdefDictionary.icns -------------------------------------------------------------------------------- /Resources/SdefFile.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jean-Daniel/Sdef-Editor/e95c5f6c43e96f398d35be981e1c0403e651112a/Resources/SdefFile.icns -------------------------------------------------------------------------------- /Resources/SdefModel.xcdatamodeld/SdefModel.xcdatamodel/contents: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /Resources/SdtplBundle.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jean-Daniel/Sdef-Editor/e95c5f6c43e96f398d35be981e1c0403e651112a/Resources/SdtplBundle.icns -------------------------------------------------------------------------------- /Resources/Templates/AppleDictionary.sdtpl/Definition.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Dictionary 6 | 7 | File 8 | dictionary.tpl 9 | 10 | Toc 11 | 12 | File 13 | toc.tpl 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /Resources/Templates/AppleDictionary.sdtpl/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | DisplayName 6 | Apple Dictionary 7 | HTMLStyleSheets 8 | 9 | Green 10 | asgreen.css 11 | Standard 12 | asdictionary.css 13 | 14 | RequireFileType 15 | html 16 | TemplateFormat 17 | HTML 18 | TemplateStrings 19 | 20 | Direct-Parameter.Description 21 | -- %@ 22 | Links 23 | <a href="%@#%@" class="links">%@</a> 24 | Parameter.Description 25 | -- %@ 26 | Property.Description 27 | -- %@ 28 | Result.Description 29 | -- %@ 30 | Toc-Links 31 | <a href="%@#%@" class="toc_links">%@</a> 32 | 33 | Version 34 | 1 35 | 36 | 37 | -------------------------------------------------------------------------------- /Resources/Templates/AppleDictionary.sdtpl/asdictionary.css: -------------------------------------------------------------------------------- 1 | 2 | h1 { font-family: "Times", Serif; text-align: center; font-size: 24pt; } 3 | 4 | * { font-size: 12px; font-family: "Times", Serif; } 5 | .suite_name { font-size: 18px; font-weight: bold} 6 | .suite_description { font-size: 18px; font-style: italic; font-weight: bold} 7 | 8 | .class_block, .command_block { margin-top: 12px; } 9 | .class_title , .command_title, 10 | .class_title *, .command_title * { text-decoration: underline; font-size: 14px; } 11 | 12 | dd { margin-bottom: 1em; } 13 | .class_block dd { margin-left: 0px; } 14 | .command_block dd { margin-left: 2em; } 15 | 16 | .subclasses, .elements, .properties, .parameters {list-style: none; margin: 0px; padding-left: 2em; } 17 | 18 | .app_word { font-family: "Verdana", sans; color: blue; font-weight: bold; font-size: 12px; } 19 | .lang_word {font-family: "Verdana", sans; color: blue; font-size: 12px; } 20 | .description {font-family: "Verdana", sans; color: #555555; font-style: italic; font-size: 12px; } 21 | 22 | .links { font-family: "Verdana", sans; color: blue; } 23 | 24 | .result { } 25 | -------------------------------------------------------------------------------- /Resources/Templates/AppleDictionary.sdtpl/asgreen.css: -------------------------------------------------------------------------------- 1 | 2 | h1 { font-family: "Times", Serif; text-align: center; font-size: 24pt; } 3 | 4 | * { font-size: 12px; font-family: "Times", Serif; } 5 | .suite_name { font-size: 18px; font-weight: bold} 6 | .suite_description { font-size: 18px; font-style: italic; font-weight: bold} 7 | 8 | .class_block, .command_block { margin-top: 12px; } 9 | .class_title , .command_title, 10 | .class_title *, .command_title * { text-decoration: underline; font-size: 14px; } 11 | 12 | dd { margin-bottom: 1em; } 13 | .class_block dd { margin-left: 0px; } 14 | .command_block dd { margin-left: 2em; } 15 | 16 | .subclasses, .elements, .properties, .parameters {list-style: none; margin: 0px; padding-left: 2em; } 17 | 18 | .app_word { font-family: "Verdana", sans; color: green; font-weight: bold; font-size: 12px; } 19 | .lang_word {font-family: "Verdana", sans; color: green; font-size: 12px; } 20 | .description {font-family: "Verdana", sans; color: #555555; font-style: italic; font-size: 12px; } 21 | 22 | .links { font-family: "Verdana", sans; color: green; } 23 | 24 | .result { } 25 | -------------------------------------------------------------------------------- /Resources/Templates/AppleDictionary.sdtpl/toc.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | @Name! 7 | @Style-Link! 8 | 9 | 12 | 13 | 14 | 15 | @Dictionary-Link!
16 | 17 | @Name!: @Description!
18 | 19 | Classes 20 |
    21 | 22 |
  • @Name!: @Description!
  • 23 | 24 |
25 | 26 | 27 | Commands 28 |
    29 | 30 |
  • @Name!: @Description!
  • 31 | 32 |
33 | 34 | 35 | Events 36 |
    37 | 38 |
  • @Name!: @Description!
  • 39 | 40 |
41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /Resources/Templates/AppleRTFDictionary.sdtpl/Definition.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Dictionary 6 | 7 | File 8 | dictionary.rtf 9 | RemoveBlockLines 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /Resources/Templates/AppleRTFDictionary.sdtpl/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | DisplayName 6 | Apple Dictionary RTF 7 | RequireFileType 8 | rtf 9 | TemplateStrings 10 | 11 | Direct-Parameter.Description 12 | -- %@ 13 | Parameter.Description 14 | -- %@ 15 | Property.Description 16 | -- %@ 17 | Result.Description 18 | -- %@ 19 | 20 | Version 21 | 1 22 | 23 | 24 | -------------------------------------------------------------------------------- /Resources/Templates/Frame Dictionary.sdtpl/Definition.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Dictionary 6 | 7 | File 8 | dictionary.tpl 9 | RemoveBlockLines 10 | 11 | SingleFile 12 | 13 | 14 | Index 15 | 16 | File 17 | index.tpl 18 | 19 | Toc 20 | 21 | File 22 | toc.tpl 23 | Required 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /Resources/Templates/Frame Dictionary.sdtpl/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Description 6 | Info.rtf 7 | DisplayName 8 | AS Dictionary with frame 9 | HTMLStyleSheets 10 | 11 | Green 12 | asgreen.css 13 | Standard 14 | asdictionary.css 15 | 16 | RequireFileType 17 | html 18 | TemplateFormat 19 | HTML 20 | TemplateStrings 21 | 22 | Direct-Parameter.Description 23 | -- %@ 24 | Links 25 | <a href="%@#%@" class="links">%@</a> 26 | Parameter.Description 27 | -- %@ 28 | Property.Description 29 | -- %@ 30 | Result.Description 31 | -- %@ 32 | Toc-Links 33 | <a href="%@#%@" class="toc_link" target="content">%@</a> 34 | 35 | Version 36 | 1 37 | 38 | 39 | -------------------------------------------------------------------------------- /Resources/Templates/Frame Dictionary.sdtpl/Info.rtf: -------------------------------------------------------------------------------- 1 | {\rtf1\mac\ansicpg10000\cocoartf102 2 | {\fonttbl\f0\froman\fcharset77 Palatino-Roman;} 3 | {\colortbl;\red255\green255\blue255;} 4 | \paperw11900\paperh16840\margl1440\margr1440\vieww9300\viewh9000\viewkind0 5 | \pard\tx565\tx1133\tx1700\tx2266\tx2833\tx3401\tx3967\tx4535\tx5102\tx5669\tx6235\tx6802\ql\qnatural 6 | 7 | \f0\fs24 \cf0 A standards Apple Script Dictionary with Toc in the Left frame and content in the Right frame.} -------------------------------------------------------------------------------- /Resources/Templates/Frame Dictionary.sdtpl/asdictionary.css: -------------------------------------------------------------------------------- 1 | 2 | h1 { font-family: "Times", Serif; text-align: center; font-size: 24pt; } 3 | 4 | * { font-size: 12px; font-family: "Times", Serif; } 5 | .suite_name { font-size: 18px; font-weight: bold} 6 | .suite_description { font-size: 18px; font-style: italic; font-weight: bold} 7 | 8 | .class_block, .command_block { margin-top: 12px; } 9 | .class_title , .command_title, 10 | .class_title *, .command_title * { text-decoration: underline; font-size: 14px; } 11 | 12 | dd { margin-bottom: 1em; } 13 | .class_block dd { margin-left: 0px; } 14 | .command_block dd { margin-left: 2em; } 15 | 16 | .subclasses, .elements, .properties, .parameters {list-style: none; margin: 0px; padding-left: 2em; } 17 | 18 | .app_word { font-family: "Verdana", sans; color: blue; font-weight: bold; font-size: 12px; } 19 | .lang_word {font-family: "Verdana", sans; color: blue; font-size: 12px; } 20 | .description {font-family: "Verdana", sans; color: #555555; font-style: italic; font-size: 12px; } 21 | 22 | .links { font-family: "Verdana", sans; color: blue; } 23 | 24 | .result { } 25 | -------------------------------------------------------------------------------- /Resources/Templates/Frame Dictionary.sdtpl/asgreen.css: -------------------------------------------------------------------------------- 1 | 2 | h1 { font-family: "Times", Serif; text-align: center; font-size: 24pt; } 3 | 4 | * { font-size: 12px; font-family: "Times", Serif; } 5 | .suite_name { font-size: 18px; font-weight: bold} 6 | .suite_description { font-size: 18px; font-style: italic; font-weight: bold} 7 | 8 | .class_block, .command_block { margin-top: 12px; } 9 | .class_title , .command_title, 10 | .class_title *, .command_title * { text-decoration: underline; font-size: 14px; } 11 | 12 | dd { margin-bottom: 1em; } 13 | .class_block dd { margin-left: 0px; } 14 | .command_block dd { margin-left: 2em; } 15 | 16 | .subclasses, .elements, .properties, .parameters {list-style: none; margin: 0px; padding-left: 2em; } 17 | 18 | .app_word { font-family: "Verdana", sans; color: green; font-weight: bold; font-size: 12px; } 19 | .lang_word {font-family: "Verdana", sans; color: green; font-size: 12px; } 20 | .description {font-family: "Verdana", sans; color: #555555; font-style: italic; font-size: 12px; } 21 | 22 | .links, .toc_link { font-family: "Verdana", sans; color: green; } 23 | 24 | .result { } 25 | -------------------------------------------------------------------------------- /Resources/Templates/Frame Dictionary.sdtpl/index.tpl: -------------------------------------------------------------------------------- 1 | @Dictionary-Name! -------------------------------------------------------------------------------- /Resources/Templates/Frame Dictionary.sdtpl/toc.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | @Name! 7 | @Style-Link! 8 | 9 | 12 | 13 | 14 | 15 | @Name!
16 | 17 | @Name!
18 | 19 | Classes 20 |
    21 | 22 |
  • @Name!
  • 23 | 24 |
25 | 26 | 27 | Commands 28 |
    29 | 30 |
  • @Name!
  • 31 | 32 |
33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /Sdef Editor.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Sdef Editor.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Sdef Editor.xcodeproj/project.xcworkspace/xcshareddata/Sdef Editor.xccheckout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDESourceControlProjectFavoriteDictionaryKey 6 | 7 | IDESourceControlProjectIdentifier 8 | 622BA7B2-0400-4C7D-A247-93B4F1BE5D34 9 | IDESourceControlProjectName 10 | Sdef Editor 11 | IDESourceControlProjectOriginsDictionary 12 | 13 | 774AFAB791880CE4E105D7CED223786E045A1D08 14 | github.com:Jean-Daniel/Sdef-Editor.git 15 | 7A36A968102EC3079874D51F5F23039BCF93C104 16 | github.com:Jean-Daniel/WonderBox.git 17 | 18 | IDESourceControlProjectPath 19 | Sdef Editor.xcodeproj 20 | IDESourceControlProjectRelativeInstallPathDictionary 21 | 22 | 774AFAB791880CE4E105D7CED223786E045A1D08 23 | ../.. 24 | 7A36A968102EC3079874D51F5F23039BCF93C104 25 | ../..WonderBox 26 | 27 | IDESourceControlProjectURL 28 | github.com:Jean-Daniel/Sdef-Editor.git 29 | IDESourceControlProjectVersion 30 | 111 31 | IDESourceControlProjectWCCIdentifier 32 | 774AFAB791880CE4E105D7CED223786E045A1D08 33 | IDESourceControlProjectWCConfigurations 34 | 35 | 36 | IDESourceControlRepositoryExtensionIdentifierKey 37 | public.vcs.git 38 | IDESourceControlWCCIdentifierKey 39 | 774AFAB791880CE4E105D7CED223786E045A1D08 40 | IDESourceControlWCCName 41 | Sdef%20Editor 42 | 43 | 44 | IDESourceControlRepositoryExtensionIdentifierKey 45 | public.vcs.git 46 | IDESourceControlWCCIdentifierKey 47 | 7A36A968102EC3079874D51F5F23039BCF93C104 48 | IDESourceControlWCCName 49 | Sdef%20EditorWonderBox 50 | 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /SdefDocument.h: -------------------------------------------------------------------------------- 1 | /* 2 | * SdefDocument.h 3 | * Sdef Editor 4 | * 5 | * Created by Rainbow Team. 6 | * Copyright © 2006 - 2007 Shadow Lab. All rights reserved. 7 | */ 8 | 9 | #import "SdefBase.h" 10 | 11 | @protocol SdefParserDelegate; 12 | @class SdefObject, SdefDictionary, SdefClassManager; 13 | @class SdefWindowController, SdefSymbolBrowser, SdefValidator; 14 | 15 | SPX_PRIVATE 16 | SdefDictionary *SdefLoadDictionary(NSURL *file, NSInteger *version, id delegate, NSError **error); 17 | SPX_PRIVATE 18 | SdefDictionary *SdefLoadDictionaryData(NSData *data, NSURL *base, NSInteger *version, id delegate, NSError **error); 19 | 20 | @interface SdefDocument : NSDocument { 21 | @private 22 | SdefDictionary *sd_dictionary; 23 | SdefClassManager *sd_manager; 24 | NSNotificationCenter *sd_center; 25 | } 26 | 27 | - (SdefObject *)selection; 28 | - (SdefValidator *)validator; 29 | - (SdefSymbolBrowser *)symbolBrowser; 30 | - (SdefWindowController *)documentWindow; 31 | 32 | - (SdefDictionary *)dictionary; 33 | - (void)setDictionary:(SdefDictionary *)dictionary; 34 | 35 | - (IBAction)exportTerminology:(id)sender; 36 | 37 | - (SdefClassManager *)classManager; 38 | - (NSNotificationCenter *)notificationCenter; 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /SdefEditor.h: -------------------------------------------------------------------------------- 1 | /* 2 | * SdefEditor.h 3 | * Sdef Editor 4 | * 5 | * Created by Rainbow Team. 6 | * Copyright © 2006 - 2007 Shadow Lab. All rights reserved. 7 | */ 8 | 9 | #import "SdefBase.h" 10 | 11 | SPX_PRIVATE 12 | NSString * const ScriptingDefinitionFileType; 13 | SPX_PRIVATE 14 | NSString * const ScriptingDefinitionFileUTI; 15 | 16 | SPX_PRIVATE 17 | const OSType kScriptingDefinitionHFSType; 18 | 19 | SPX_PRIVATE 20 | NSString * const CocoaSuiteDefinitionFileType; 21 | SPX_PRIVATE 22 | const OSType kCocoaSuiteDefinitionHFSType; 23 | 24 | @class SdefImporter; 25 | @interface SdefEditor : NSObject { 26 | 27 | } 28 | 29 | - (IBAction)openInspector:(id)sender; 30 | - (void)importWithImporter:(SdefImporter *)importer; 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /SdefLibrary/Headers/SdefAccessGroup.h: -------------------------------------------------------------------------------- 1 | /* 2 | * SdefAccessGroup.h 3 | * Sdef Editor 4 | * 5 | * Created by Rainbow Team. 6 | * Copyright © 2006 - 2007 Shadow Lab. All rights reserved. 7 | */ 8 | 9 | #import "SdefLeaf.h" 10 | 11 | /* 12 | 13 | 14 | 18 | */ 19 | @interface SdefAccessGroup : SdefLeaf { 20 | @private 21 | uint32_t _access; 22 | } 23 | 24 | @property(nonatomic, copy) NSString *identifier; 25 | @property(nonatomic) uint32_t access; 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /SdefLibrary/Headers/SdefArguments.h: -------------------------------------------------------------------------------- 1 | /* 2 | * SdefArguments.h 3 | * Sdef Editor 4 | * 5 | * Created by Rainbow Team. 6 | * Copyright © 2006 - 2007 Shadow Lab. All rights reserved. 7 | */ 8 | 9 | #import "SdefObjects.h" 10 | 11 | @interface SdefParameter : SdefTypedObject { 12 | @private 13 | uint32_t _requiresAccess; 14 | } 15 | 16 | @property(nonatomic) uint32_t requiresAccess; 17 | @property(nonatomic, getter = isOptional) BOOL optional; 18 | 19 | @end 20 | 21 | #pragma mark - 22 | @interface SdefDirectParameter : SdefTypedOrphanObject { 23 | @private 24 | uint32_t _requiresAccess; 25 | } 26 | 27 | @property(nonatomic) uint32_t requiresAccess; 28 | @property(nonatomic, getter = isOptional) BOOL optional; 29 | 30 | @end 31 | 32 | #pragma mark - 33 | @interface SdefResult : SdefTypedOrphanObject { 34 | 35 | } 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /SdefLibrary/Headers/SdefClassManager.h: -------------------------------------------------------------------------------- 1 | /* 2 | * SdefClassManager.h 3 | * Sdef Editor 4 | * 5 | * Created by Rainbow Team. 6 | * Copyright © 2006 - 2007 Shadow Lab. All rights reserved. 7 | */ 8 | 9 | #import 10 | 11 | @class SdefValue, SdefRecord, SdefEnumeration; 12 | @class SdefSuite, SdefObject, SdefClass, SdefVerb, SdefDocument, SdefDictionary; 13 | @interface SdefClassManager : NSObject { 14 | @private 15 | NSHashTable *sd_dicts; 16 | SdefDocument *sd_document; 17 | struct _sd_cmFlags { 18 | unsigned int sortType:1; 19 | unsigned int sortClass:1; 20 | unsigned int sortEvent:1; 21 | unsigned int sortCommand:1; 22 | unsigned int reserved:28; 23 | } sd_cmFlags; 24 | NSMutableArray *sd_classes, *sd_commands, *sd_events, *sd_types; 25 | } 26 | 27 | + (BOOL)isBaseType:(NSString *)type; 28 | 29 | - (instancetype)initWithDocument:(SdefDocument *)aDocument; 30 | 31 | - (void)setDocument:(SdefDocument *)aDoc; 32 | 33 | - (void)addDictionary:(SdefDictionary *)aDico; 34 | - (void)removeDictionary:(SdefDictionary *)aDico; 35 | 36 | - (void)addSuite:(SdefSuite *)aSuite; 37 | - (void)removeSuite:(SdefSuite *)aSuite; 38 | 39 | - (void)addClass:(SdefClass *)aClass; 40 | - (void)removeClass:(SdefClass *)aClass; 41 | 42 | /*! 43 | @method types 44 | @result Returns all types name including base types. 45 | */ 46 | - (NSArray *)types; 47 | /*! 48 | @method sdefTypes 49 | @abstract Returns all types whitout base types (ie. classes and enumeration). 50 | */ 51 | - (NSArray *)sdefTypes; 52 | - (NSArray *)classes; 53 | 54 | - (NSArray *)commands; 55 | - (NSArray *)events; 56 | 57 | - (id)typeWithName:(NSString *)name; 58 | - (SdefClass *)classWithName:(NSString *)name; 59 | - (SdefVerb *)verbWithIdentifier:(NSString *)identifier; 60 | - (SdefVerb *)eventWithIdentifier:(NSString *)identifier; 61 | - (SdefVerb *)commandWithIdentifier:(NSString *)identifier; 62 | - (SdefValue *)valueWithName:(NSString *)name; 63 | - (SdefRecord *)recordWithName:(NSString *)name; 64 | - (SdefEnumeration *)enumerationWithName:(NSString *)name; 65 | 66 | - (NSArray *)subclassesOfClass:(SdefClass *)aClass; 67 | - (SdefClass *)superClassOfClass:(SdefClass *)aClass; 68 | 69 | #pragma mark - 70 | #pragma mark Cocoa Additions 71 | - (NSString *)sdefTypeForCocoaType:(NSString *)cocoaType; 72 | - (SdefVerb *)verbWithCocoaName:(NSString *)cocoaName inSuite:(NSString *)suite; 73 | - (SdefClass *)sdefClassWithCocoaClass:(NSString *)cocoaClass inSuite:(NSString *)suite; 74 | - (SdefObject *)sdefTypeWithCocoaType:(NSString *)cocoaType inSuite:(NSString *)suite; 75 | 76 | #pragma mark - 77 | #pragma mark 'aete' Additions 78 | - (NSString *)sdefTypeForAeteType:(NSString *)aType; 79 | - (SdefVerb *)verbWithCode:(NSString *)aCode inSuite:(NSString *)suiteCode; 80 | - (SdefClass *)sdefClassWithCode:(NSString *)aCode inSuite:(NSString *)suiteCode; 81 | - (SdefObject *)sdefTypeWithCode:(NSString *)aCode inSuite:(NSString *)suiteCode; 82 | 83 | @end 84 | 85 | -------------------------------------------------------------------------------- /SdefLibrary/Headers/SdefComment.h: -------------------------------------------------------------------------------- 1 | /* 2 | * SdefComment.h 3 | * Sdef Editor 4 | * 5 | * Created by Rainbow Team. 6 | * Copyright © 2006 - 2007 Shadow Lab. All rights reserved. 7 | */ 8 | 9 | #import "SdefLeaf.h" 10 | 11 | @interface SdefComment : SdefLeaf { 12 | NSString *_value; 13 | } 14 | 15 | + (id)commentWithString:(NSString *)aString; 16 | - (id)initWithString:(NSString *)aString; 17 | 18 | @property(nonatomic, copy) NSString *value; 19 | 20 | @end 21 | 22 | -------------------------------------------------------------------------------- /SdefLibrary/Headers/SdefContents.h: -------------------------------------------------------------------------------- 1 | /* 2 | * SdefContents.h 3 | * Sdef Editor 4 | * 5 | * Created by Rainbow Team. 6 | * Copyright © 2006 - 2007 Shadow Lab. All rights reserved. 7 | */ 8 | 9 | #import "SdefObjects.h" 10 | 11 | /* 12 | 13 | 14 | 23 | */ 24 | 25 | @interface SdefContents : SdefTypedOrphanObject { 26 | uint32_t _access; 27 | } 28 | 29 | @property(nonatomic) uint32_t access; 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /SdefLibrary/Headers/SdefDictionary.h: -------------------------------------------------------------------------------- 1 | /* 2 | * SdefDictionary.h 3 | * Sdef Editor 4 | * 5 | * Created by Rainbow Team. 6 | * Copyright © 2006 - 2007 Shadow Lab. All rights reserved. 7 | */ 8 | 9 | #import "SdefObjects.h" 10 | 11 | /* 12 | 13 | 14 | 18 | */ 19 | 20 | @class SdefDocument, SdefClassManager; 21 | @interface SdefDictionary : SdefDocumentedObject 22 | 23 | @property(nonatomic, assign) SdefDocument *document; // TODO: remove layer violation 24 | 25 | @property(nonatomic) SdefVersion version; 26 | 27 | - (SdefClassManager *)classManager; 28 | 29 | // Sdef properties 30 | @property(nonatomic, copy) NSString *title; 31 | 32 | - (NSArray *)suites; 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /SdefLibrary/Headers/SdefDocumentation.h: -------------------------------------------------------------------------------- 1 | /* 2 | * SdefDocumentation.h 3 | * Sdef Editor 4 | * 5 | * Created by Rainbow Team. 6 | * Copyright © 2006 - 2007 Shadow Lab. All rights reserved. 7 | */ 8 | 9 | #import "SdefLeaf.h" 10 | 11 | /* 12 | 13 | 14 | 15 | */ 16 | @interface SdefDocumentation : SdefLeaf { 17 | NSString *_content; 18 | } 19 | 20 | @property(nonatomic, copy) NSString *content; 21 | 22 | @property(nonatomic, getter=isHtml) BOOL html; 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /SdefLibrary/Headers/SdefImplementation.h: -------------------------------------------------------------------------------- 1 | /* 2 | * SdefImplementation.h 3 | * Sdef Editor 4 | * 5 | * Created by Rainbow Team. 6 | * Copyright © 2006 - 2007 Shadow Lab. All rights reserved. 7 | */ 8 | 9 | #import "SdefLeaf.h" 10 | 11 | /* 12 | 13 | 14 | 25 | */ 26 | 27 | enum { 28 | kSdefValueTypeNone = 0, 29 | kSdefValueTypeString = 1, 30 | kSdefValueTypeInteger = 2, 31 | kSdefValueTypeBoolean = 3, 32 | }; 33 | 34 | @class SdefDocument; 35 | @interface SdefImplementation : SdefLeaf { 36 | @private 37 | id _value; 38 | UInt8 _vtype; /* value type */ 39 | 40 | NSString *_key; 41 | NSString *_class; 42 | NSString *_method; 43 | } 44 | 45 | @property(nonatomic, copy) NSString *className; 46 | 47 | @property(nonatomic, copy) NSString *key; 48 | 49 | @property(nonatomic, copy) NSString *method; 50 | 51 | @property(nonatomic) BOOL insertAtBeginning; 52 | 53 | /* value support */ 54 | @property(nonatomic) uint8_t valueType; 55 | 56 | @property(nonatomic) BOOL booleanValue; 57 | @property(nonatomic) NSInteger integerValue; 58 | @property(nonatomic, copy) NSString *textValue; 59 | 60 | @end 61 | -------------------------------------------------------------------------------- /SdefLibrary/Headers/SdefLeaf.h: -------------------------------------------------------------------------------- 1 | /* 2 | * SdefLeaf.h 3 | * Sdef Editor 4 | * 5 | * Created by Rainbow Team. 6 | * Copyright © 2006 - 2007 Shadow Lab. All rights reserved. 7 | */ 8 | 9 | #import "SdefBase.h" 10 | 11 | @interface SdefLeaf : NSObject { 12 | @private 13 | NSString *_name; 14 | @protected 15 | struct _sd_slFlags { 16 | unsigned int list:1; 17 | unsigned int html:1; 18 | unsigned int hidden:1; 19 | unsigned int xinclude:1; 20 | unsigned int editable:1; 21 | unsigned int beginning:1; // for cocoa elements 22 | unsigned int reserved:2; 23 | } _slFlags; 24 | } 25 | 26 | - (id)init; 27 | - (id)initWithName:(NSString *)name; 28 | 29 | - (NSUndoManager *)undoManager; 30 | 31 | - (NSString *)objectTypeName; 32 | 33 | - (NSImage *)icon; 34 | 35 | @property(nonatomic, copy) NSString *name; 36 | 37 | @property(nonatomic, getter=isHidden) BOOL hidden; 38 | 39 | @property(nonatomic, assign) NSObject *owner; 40 | 41 | - (SdefDictionary *)dictionary; 42 | - (id)firstParentOfType:(SdefObjectType)aType; 43 | 44 | @end 45 | -------------------------------------------------------------------------------- /SdefLibrary/Headers/SdefSuite.h: -------------------------------------------------------------------------------- 1 | /* 2 | * SdefSuite.h 3 | * Sdef Editor 4 | * 5 | * Created by Rainbow Team. 6 | * Copyright © 2006 - 2007 Shadow Lab. All rights reserved. 7 | */ 8 | 9 | #import "SdefObjects.h" 10 | 11 | /* 12 | 13 | 14 | 21 | */ 22 | 23 | @interface SdefTypeCollection : SdefCollection { 24 | } 25 | 26 | @end 27 | 28 | @interface SdefSuite : SdefTerminologyObject { 29 | } 30 | 31 | - (SdefCollection *)classes; 32 | - (SdefCollection *)commands; 33 | - (SdefCollection *)events; 34 | - (SdefTypeCollection *)types; 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /SdefLibrary/Headers/SdefSynonym.h: -------------------------------------------------------------------------------- 1 | /* 2 | * SdefSynonym.h 3 | * Sdef Editor 4 | * 5 | * Created by Rainbow Team. 6 | * Copyright © 2006 - 2007 Shadow Lab. All rights reserved. 7 | */ 8 | 9 | #import "SdefLeaf.h" 10 | 11 | /* 12 | 13 | 14 | 20 | 21 | */ 22 | 23 | @class SdefImplementation; 24 | @interface SdefSynonym : SdefLeaf { 25 | @private 26 | SdefImplementation *_impl; 27 | } 28 | 29 | @property(nonatomic, copy) NSString *code; 30 | @property(nonatomic, retain) SdefImplementation *impl; 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /SdefLibrary/Headers/SdefType.h: -------------------------------------------------------------------------------- 1 | /* 2 | * SdefType.h 3 | * Sdef Editor 4 | * 5 | * Created by Rainbow Team. 6 | * Copyright © 2006 - 2007 Shadow Lab. All rights reserved. 7 | */ 8 | 9 | #import "SdefLeaf.h" 10 | 11 | /* 12 | 13 | 14 | 20 | */ 21 | 22 | @interface SdefType : SdefLeaf { 23 | 24 | } 25 | 26 | @property(nonatomic, getter = isList) BOOL list; 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /SdefLibrary/Headers/SdefTypedef.h: -------------------------------------------------------------------------------- 1 | /* 2 | * SdefEnumeration.h 3 | * Sdef Editor 4 | * 5 | * Created by Rainbow Team. 6 | * Copyright © 2006 - 2007 Shadow Lab. All rights reserved. 7 | */ 8 | 9 | #import "SdefObjects.h" 10 | 11 | /* 12 | 13 | 14 | 15 | 16 | 25 | 26 | 27 | 28 | 29 | 38 | 39 | 40 | 41 | 42 | 51 | 52 | 53 | 60 | 61 | */ 62 | 63 | enum { 64 | kSdefInlineAll = -1 65 | }; 66 | 67 | @interface SdefEnumeration : SdefTerminologyObject { 68 | @private 69 | int32_t _inline; 70 | } 71 | 72 | @property(nonatomic) int32_t inlineValue; 73 | 74 | @end 75 | 76 | @interface SdefEnumerator : SdefTerminologyObject { 77 | } 78 | 79 | @end 80 | 81 | @interface SdefValue : SdefTerminologyObject { 82 | } 83 | 84 | @end 85 | 86 | @interface SdefRecord : SdefTerminologyObject { 87 | } 88 | 89 | @end 90 | 91 | -------------------------------------------------------------------------------- /SdefLibrary/Headers/SdefVerb.h: -------------------------------------------------------------------------------- 1 | /* 2 | * SdefVerb.h 3 | * Sdef Editor 4 | * 5 | * Created by Rainbow Team. 6 | * Copyright © 2006 - 2007 Shadow Lab. All rights reserved. 7 | */ 8 | 9 | #import "SdefObjects.h" 10 | 11 | /* 12 | 13 | 14 | 22 | 23 | 24 | 32 | 33 | 34 | 41 | 42 | 43 | 48 | 49 | 50 | 60 | */ 61 | 62 | @class SdefDocumentation, SdefDirectParameter, SdefResult; 63 | @interface SdefVerb : SdefTerminologyObject { 64 | @private 65 | SdefResult *_result; 66 | SdefDirectParameter *_direct; 67 | // Code into verb are split into class & ID that are two concat four char codes (i.e. eavtquit). 68 | } 69 | 70 | /* -isCommand may returns something different that what was set by setComment: */ 71 | @property(nonatomic, getter = isCommand) BOOL command; 72 | 73 | - (BOOL)hasResult; 74 | @property(nonatomic, retain) SdefResult *result; 75 | 76 | - (BOOL)hasDirectParameter; 77 | @property(nonatomic, retain) SdefDirectParameter *directParameter; 78 | 79 | @end 80 | -------------------------------------------------------------------------------- /SdefLibrary/Headers/SdefXInclude.h: -------------------------------------------------------------------------------- 1 | /* 2 | * SdefXInclude.h 3 | * Sdef Editor 4 | * 5 | * Created by Rainbow Team. 6 | * Copyright © 2006 - 2007 Shadow Lab. All rights reserved. 7 | */ 8 | 9 | #import "SdefLeaf.h" 10 | 11 | @interface SdefXInclude : SdefLeaf { 12 | @private 13 | NSMutableArray *_nodes; 14 | } 15 | 16 | @property(nonatomic, copy) NSString *href; 17 | @property(nonatomic, copy) NSString *pointer; 18 | 19 | @end 20 | 21 | -------------------------------------------------------------------------------- /SdefLibrary/Headers/SdefXRef.h: -------------------------------------------------------------------------------- 1 | /* 2 | * SdefXRef.h 3 | * Sdef Editor 4 | * 5 | * Created by Rainbow Team. 6 | * Copyright © 2006 - 2007 Shadow Lab. All rights reserved. 7 | */ 8 | 9 | #import "SdefLeaf.h" 10 | 11 | /* 12 | 13 | 18 | */ 19 | 20 | @interface SdefXRef : SdefLeaf { 21 | @private 22 | NSString *_target; 23 | } 24 | 25 | @property(nonatomic, copy) NSString *target; 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /SdefLibrary/SdefAccessGroup.m: -------------------------------------------------------------------------------- 1 | /* 2 | * SdefAccessGroup.m 3 | * Sdef Editor 4 | * 5 | * Created by Rainbow Team. 6 | * Copyright © 2006 - 2007 Shadow Lab. All rights reserved. 7 | */ 8 | 9 | #import "SdefAccessGroup.h" 10 | 11 | @implementation SdefAccessGroup 12 | 13 | @synthesize access = _access; 14 | 15 | - (id)copyWithZone:(NSZone *)aZone { 16 | SdefAccessGroup *copy = [super copyWithZone:aZone]; 17 | copy->_access = _access; 18 | return copy; 19 | } 20 | 21 | - (void)encodeWithCoder:(NSCoder *)aCoder { 22 | [super encodeWithCoder:aCoder]; 23 | [aCoder encodeInt32:_access forKey:@"SAGAccess"]; 24 | } 25 | 26 | - (id)initWithCoder:(NSCoder *)aCoder { 27 | if (self = [super initWithCoder:aCoder]) { 28 | _access = [aCoder decodeInt32ForKey:@"SAGAccess"]; 29 | } 30 | return self; 31 | } 32 | 33 | #pragma mark - 34 | + (SdefObjectType)objectType { 35 | return kSdefType_AccessGroup; 36 | } 37 | 38 | #pragma mark - 39 | - (NSString *)identifier { return self.name; } 40 | - (void)setIdentifier:(NSString *)identifier { self.name = identifier; } 41 | 42 | - (void)setAccess:(uint32_t)access { 43 | if (access != _access) { 44 | [[[self undoManager] prepareWithInvocationTarget:self] setAccess:_access]; 45 | _access = access; 46 | } 47 | } 48 | 49 | @end 50 | -------------------------------------------------------------------------------- /SdefLibrary/SdefComment.m: -------------------------------------------------------------------------------- 1 | /* 2 | * SdefComment.m 3 | * Sdef Editor 4 | * 5 | * Created by Rainbow Team. 6 | * Copyright © 2006 - 2007 Shadow Lab. All rights reserved. 7 | */ 8 | 9 | #import "SdefComment.h" 10 | 11 | 12 | @implementation SdefComment 13 | 14 | @synthesize value = _value; 15 | 16 | #pragma mark Protocols Implementations 17 | - (id)copyWithZone:(NSZone *)aZone { 18 | SdefComment *copy = [super copyWithZone:aZone]; 19 | copy->_value = [_value copyWithZone:aZone]; 20 | return copy; 21 | } 22 | 23 | - (void)encodeWithCoder:(NSCoder *)aCoder { 24 | [super encodeWithCoder:aCoder]; 25 | [aCoder encodeObject:_value forKey:@"SCValue"]; 26 | } 27 | 28 | - (id)initWithCoder:(NSCoder *)aCoder { 29 | if (self = [super initWithCoder:aCoder]) { 30 | _value = [aCoder decodeObjectForKey:@"SCValue"]; 31 | } 32 | return self; 33 | } 34 | 35 | #pragma mark - 36 | + (SdefObjectType)objectType { 37 | return kSdefType_Comment; 38 | } 39 | 40 | + (id)commentWithString:(NSString *)aString { 41 | return [[self alloc] initWithString:aString]; 42 | } 43 | 44 | - (id)init { 45 | return [self initWithString:NSLocalizedStringFromTable(@" comment ", @"SdefLibrary", @"Default comment")]; 46 | } 47 | 48 | - (id)initWithString:(NSString *)aString { 49 | if (self = [super init]) { 50 | [self setValue:aString]; 51 | } 52 | return self; 53 | } 54 | 55 | #pragma mark - 56 | - (NSString *)name { 57 | return NSLocalizedStringFromTable(@"comment", @"SdefLibrary", @"Comment item name"); 58 | } 59 | 60 | //- (void)setValue:(NSString *)value { 61 | // if (_value != value) { 62 | // //[[self undoManager] registerUndoWithTarget:self selector:_cmd object:sd_value]; 63 | // [_value release]; 64 | // _value = [value copy]; 65 | // } 66 | //} 67 | 68 | @end 69 | -------------------------------------------------------------------------------- /SdefLibrary/SdefContents.m: -------------------------------------------------------------------------------- 1 | /* 2 | * SdefContents.m 3 | * Sdef Editor 4 | * 5 | * Created by Rainbow Team. 6 | * Copyright © 2006 - 2007 Shadow Lab. All rights reserved. 7 | */ 8 | 9 | #import "SdefContents.h" 10 | #import "SdefClass.h" 11 | #import "SdefDocument.h" 12 | 13 | @implementation SdefContents 14 | 15 | @synthesize access = _access; 16 | 17 | #pragma mark Protocols Implementations 18 | - (id)copyWithZone:(NSZone *)aZone { 19 | SdefContents *copy = [super copyWithZone:aZone]; 20 | copy->_access = _access; 21 | return copy; 22 | } 23 | 24 | - (void)encodeWithCoder:(NSCoder *)aCoder { 25 | [super encodeWithCoder:aCoder]; 26 | [aCoder encodeInt32:_access forKey:@"SCAccess"]; 27 | } 28 | 29 | - (id)initWithCoder:(NSCoder *)aCoder { 30 | if (self = [super initWithCoder:aCoder]) { 31 | _access = [aCoder decodeInt32ForKey:@"SCAccess"]; 32 | } 33 | return self; 34 | } 35 | 36 | #pragma mark - 37 | + (SdefObjectType)objectType { 38 | return kSdefType_Contents; 39 | } 40 | 41 | + (NSString *)defaultIconName { 42 | return @"Content"; 43 | } 44 | 45 | #pragma mark - 46 | - (void)sdefInit { 47 | [super sdefInit]; 48 | [self setIsLeaf:YES]; 49 | [self setRemovable:NO]; 50 | } 51 | 52 | - (void)setAccess:(uint32_t)newAccess { 53 | [[[self undoManager] prepareWithInvocationTarget:self] setAccess:_access]; 54 | _access = newAccess; 55 | } 56 | 57 | @end 58 | -------------------------------------------------------------------------------- /SdefLibrary/SdefDictionary.m: -------------------------------------------------------------------------------- 1 | /* 2 | * SdefDictionary.m 3 | * Sdef Editor 4 | * 5 | * Created by Rainbow Team. 6 | * Copyright © 2006 - 2007 Shadow Lab. All rights reserved. 7 | */ 8 | 9 | #import "SdefDictionary.h" 10 | 11 | #import "SdefSuite.h" 12 | #import "SdefDocument.h" 13 | #import "SdefClassManager.h" 14 | #import "SdefDocumentation.h" 15 | 16 | @implementation SdefDictionary 17 | 18 | @synthesize version = _version; 19 | @synthesize document = _document; 20 | 21 | #pragma mark Protocols Implementations 22 | - (id)copyWithZone:(NSZone *)aZone { 23 | SdefDictionary *copy = [super copyWithZone:aZone]; 24 | copy->_document = nil; 25 | return copy; 26 | } 27 | 28 | - (void)encodeWithCoder:(NSCoder *)aCoder { 29 | [super encodeWithCoder:aCoder]; 30 | [aCoder encodeInteger:_version forKey:@"SDVersion"]; 31 | //[aCoder encodeObject:sd_xincludes forKey:@"SDXIncludes"]; 32 | [aCoder encodeConditionalObject:_document forKey:@"SDDocument"]; 33 | } 34 | 35 | - (id)initWithCoder:(NSCoder *)aCoder { 36 | if (self = [super initWithCoder:aCoder]) { 37 | _version = [aCoder decodeIntegerForKey:@"SDVersion"]; 38 | _document = [aCoder decodeObjectForKey:@"SDDocument"]; 39 | } 40 | return self; 41 | } 42 | 43 | #pragma mark - 44 | 45 | - (void)sdefInit { 46 | [super sdefInit]; 47 | _version = kSdefMountainLionVersion; 48 | } 49 | 50 | #pragma mark - 51 | + (SdefObjectType)objectType { 52 | return kSdefType_Dictionary; 53 | } 54 | 55 | + (NSString *)defaultName { 56 | return NSLocalizedStringFromTable(@"Dictionary", @"SdefLibrary", @"Object Type Name."); 57 | } 58 | 59 | + (NSString *)defaultIconName { 60 | return @"Dictionary"; 61 | } 62 | 63 | #pragma mark - 64 | + (NSSet *)keyPathsForValuesAffectingTitle { 65 | return [NSSet setWithObject:@"name"]; 66 | } 67 | 68 | - (NSString *)title { 69 | return [self name]; 70 | } 71 | - (void)setTitle:(NSString *)newTitle { 72 | [self setName:newTitle]; 73 | } 74 | 75 | - (SdefClassManager *)classManager { 76 | return [_document classManager]; 77 | } 78 | 79 | - (NSNotificationCenter *)notificationCenter { 80 | return [_document notificationCenter]; 81 | } 82 | 83 | - (NSArray *)suites { 84 | return [self children]; 85 | } 86 | 87 | @end 88 | -------------------------------------------------------------------------------- /SdefLibrary/SdefDocumentation.m: -------------------------------------------------------------------------------- 1 | /* 2 | * SdefDocumentation.m 3 | * Sdef Editor 4 | * 5 | * Created by Rainbow Team. 6 | * Copyright © 2006 - 2007 Shadow Lab. All rights reserved. 7 | */ 8 | 9 | #import "SdefDocumentation.h" 10 | 11 | #import "SdefDocument.h" 12 | 13 | @implementation SdefDocumentation 14 | 15 | @synthesize content = _content; 16 | 17 | #pragma mark Protocols Implementations 18 | - (id)copyWithZone:(NSZone *)aZone { 19 | SdefDocumentation *copy = [super copyWithZone:aZone]; 20 | copy->_content = [_content copyWithZone:aZone]; 21 | return copy; 22 | } 23 | 24 | - (void)encodeWithCoder:(NSCoder *)aCoder { 25 | [super encodeWithCoder:aCoder]; 26 | [aCoder encodeObject:_content forKey:@"SDContent"]; 27 | } 28 | 29 | - (id)initWithCoder:(NSCoder *)aCoder { 30 | if (self = [super initWithCoder:aCoder]) { 31 | _content = [aCoder decodeObjectForKey:@"SDContent"]; 32 | } 33 | return self; 34 | } 35 | 36 | #pragma mark - 37 | + (SdefObjectType)objectType { 38 | return kSdefType_Documentation; 39 | } 40 | 41 | + (NSString *)defaultName { 42 | return NSLocalizedStringFromTable(@"documentation", @"SdefLibrary", @"Documentation default name"); 43 | } 44 | 45 | + (NSString *)defaultIconName { 46 | return @"Bookmarks"; 47 | } 48 | 49 | - (id)initWithAttributes:(NSDictionary *)attrs { 50 | if (self = [super init]) { 51 | } 52 | return self; 53 | } 54 | 55 | #pragma mark - 56 | - (BOOL)isHtml { 57 | return _slFlags.html; 58 | } 59 | - (void)setHtml:(BOOL)flag { 60 | flag = flag ? 1 : 0; 61 | if (flag != _slFlags.html) { 62 | [[[self undoManager] prepareWithInvocationTarget:self] setHtml:_slFlags.html]; 63 | /* Undo */ 64 | _slFlags.html = flag; 65 | } 66 | } 67 | 68 | - (void)setContent:(NSString *)newContent { 69 | if (_content != newContent) { 70 | [[self undoManager] registerUndoWithTarget:self selector:_cmd object:_content]; 71 | _content = [newContent copy]; 72 | } 73 | } 74 | 75 | @end 76 | -------------------------------------------------------------------------------- /SdefLibrary/SdefSynonym.m: -------------------------------------------------------------------------------- 1 | /* 2 | * SdefSynonym.m 3 | * Sdef Editor 4 | * 5 | * Created by Rainbow Team. 6 | * Copyright © 2006 - 2007 Shadow Lab. All rights reserved. 7 | */ 8 | 9 | #import "SdefSynonym.h" 10 | #import "SdefBase.h" 11 | #import "SdefImplementation.h" 12 | 13 | @implementation SdefSynonym 14 | 15 | @synthesize code = _code; 16 | @synthesize impl = _impl; 17 | 18 | #pragma mark Protocols Implementations 19 | - (id)copyWithZone:(NSZone *)aZone { 20 | SdefSynonym *copy = [super copyWithZone:aZone]; 21 | copy->_code = [_code copy]; 22 | copy->_impl = [_impl copy]; 23 | return copy; 24 | } 25 | 26 | - (void)encodeWithCoder:(NSCoder *)aCoder { 27 | [super encodeWithCoder:aCoder]; 28 | [aCoder encodeObject:_code forKey:@"SYCode"]; 29 | [aCoder encodeObject:_impl forKey:@"SYImpl"]; 30 | } 31 | 32 | - (id)initWithCoder:(NSCoder *)aCoder { 33 | if (self = [super initWithCoder:aCoder]) { 34 | _code = [aCoder decodeObjectForKey:@"SYCode"]; 35 | _impl = [aCoder decodeObjectForKey:@"SYImpl"]; 36 | } 37 | return self; 38 | } 39 | 40 | #pragma mark - 41 | + (SdefObjectType)objectType { 42 | return kSdefType_Synonym; 43 | } 44 | 45 | - (NSString *)description { 46 | return [NSString stringWithFormat:@"<%@ %p> {name=%@ code=%@ hidden=%@}", 47 | NSStringFromClass([self class]), self, 48 | [self name], _code, _slFlags.hidden ? @"YES" : @"NO"]; 49 | } 50 | 51 | #pragma mark - 52 | - (SdefImplementation *)impl { 53 | if (!_impl) { 54 | SdefImplementation *impl = [[SdefImplementation alloc] init]; 55 | [self setImpl:impl]; 56 | } 57 | return _impl; 58 | } 59 | - (void)setImpl:(SdefImplementation *)newImpl { 60 | if (_impl != newImpl) { 61 | [_impl setOwner:nil]; 62 | _impl = newImpl; 63 | [_impl setOwner:self]; 64 | } 65 | } 66 | 67 | - (void)setCode:(NSString *)code { 68 | if (code != _code) { 69 | NSUndoManager *undo = [self undoManager]; 70 | if (undo) { 71 | [undo registerUndoWithTarget:self selector:_cmd object:_code]; 72 | [undo setActionName:NSLocalizedStringFromTable(@"Change Synonym", @"SdefLibrary", @"Undo Action: Change synonym.")]; 73 | } 74 | SPXSetterCopy(_code, code); 75 | } 76 | } 77 | 78 | @end 79 | -------------------------------------------------------------------------------- /SdefLibrary/SdefType.m: -------------------------------------------------------------------------------- 1 | /* 2 | * SdefType.m 3 | * Sdef Editor 4 | * 5 | * Created by Rainbow Team. 6 | * Copyright © 2006 - 2007 Shadow Lab. All rights reserved. 7 | */ 8 | 9 | #import "SdefType.h" 10 | #import "SdefObjects.h" 11 | 12 | @implementation SdefType 13 | #pragma mark Protocols Implementations 14 | - (id)copyWithZone:(NSZone *)aZone { 15 | SdefType *copy = [super copyWithZone:aZone]; 16 | return copy; 17 | } 18 | 19 | - (void)encodeWithCoder:(NSCoder *)aCoder { 20 | [super encodeWithCoder:aCoder]; 21 | } 22 | 23 | - (id)initWithCoder:(NSCoder *)aCoder { 24 | if (self = [super initWithCoder:aCoder]) { 25 | } 26 | return self; 27 | } 28 | 29 | #pragma mark - 30 | + (SdefObjectType)objectType { 31 | return kSdefType_Type; 32 | } 33 | 34 | - (NSString *)description { 35 | return [NSString stringWithFormat:@"<%@ %p> {name=%@ list=%@}", 36 | NSStringFromClass([self class]), self, 37 | [self name], _slFlags.list ? @"YES" : @"NO"]; 38 | } 39 | 40 | #pragma mark - 41 | - (NSImage *)icon { 42 | return [NSImage imageNamed:@"Type"]; 43 | } 44 | 45 | - (void)setName:(NSString *)aName { 46 | [[self owner] willChangeValueForKey:@"type"]; 47 | [super setName:aName]; 48 | [[self owner] didChangeValueForKey:@"type"]; 49 | } 50 | 51 | - (BOOL)isList { 52 | return _slFlags.list; 53 | } 54 | 55 | - (void)setList:(BOOL)list { 56 | list = list ? 1 : 0; 57 | if (list != _slFlags.list) { 58 | [[self owner] willChangeValueForKey:@"type"]; 59 | NSUndoManager *undo = [self undoManager]; 60 | if (undo) { 61 | [[undo prepareWithInvocationTarget:self] setList:_slFlags.list]; 62 | [undo setActionName:NSLocalizedStringFromTable(@"Check/Uncheck List", @"SdefLibrary", @"Undo Action: Check/Uncheck List.")]; 63 | } 64 | _slFlags.list = list; 65 | [[self owner] didChangeValueForKey:@"type"]; 66 | } 67 | } 68 | 69 | @end 70 | -------------------------------------------------------------------------------- /SdefLibrary/SdefXInclude.m: -------------------------------------------------------------------------------- 1 | /* 2 | * SdefXInclude.m 3 | * Sdef Editor 4 | * 5 | * Created by Rainbow Team. 6 | * Copyright © 2006 - 2007 Shadow Lab. All rights reserved. 7 | */ 8 | 9 | #import "SdefXInclude.h" 10 | 11 | #import "SdefParser.h" 12 | #import "SdefDocument.h" 13 | #import "SdefDictionary.h" 14 | 15 | @implementation SdefXInclude 16 | 17 | @synthesize href = _href; 18 | @synthesize pointer = _pointer; 19 | 20 | #pragma mark Protocols Implementations 21 | - (id)copyWithZone:(NSZone *)aZone { 22 | SdefXInclude *copy = [super copyWithZone:aZone]; 23 | copy->_href = [_href copyWithZone:aZone]; 24 | copy->_pointer = [_pointer copyWithZone:aZone]; 25 | return copy; 26 | } 27 | 28 | - (void)encodeWithCoder:(NSCoder *)aCoder { 29 | [super encodeWithCoder:aCoder]; 30 | [aCoder encodeObject:_href forKey:@"SXIncludeHRef"]; 31 | [aCoder encodeObject:_pointer forKey:@"SXIncludePointer"]; 32 | } 33 | 34 | - (id)initWithCoder:(NSCoder *)aCoder { 35 | if (self = [super initWithCoder:aCoder]) { 36 | _href = [aCoder decodeObjectForKey:@"SXIncludeHRef"]; 37 | _pointer = [aCoder decodeObjectForKey:@"SXIncludePointer"]; 38 | } 39 | return self; 40 | } 41 | 42 | #pragma mark - 43 | + (SdefObjectType)objectType { 44 | return kSdefType_XInclude; 45 | } 46 | 47 | + (NSString *)defaultIconName { 48 | return @"XInclude"; 49 | } 50 | 51 | #pragma mark - 52 | - (BOOL)sdefParser:(SdefParser *)parser shouldIgnoreValidationError:(NSError *)error isFatal:(BOOL)fatal { 53 | [[[self dictionary] document] presentError:error]; 54 | return NO; 55 | } 56 | 57 | @end 58 | 59 | -------------------------------------------------------------------------------- /SdefLibrary/SdefXRef.m: -------------------------------------------------------------------------------- 1 | /* 2 | * SdefXRef.m 3 | * Sdef Editor 4 | * 5 | * Created by Rainbow Team. 6 | * Copyright © 2006 - 2007 Shadow Lab. All rights reserved. 7 | */ 8 | 9 | #import "SdefXRef.h" 10 | 11 | @implementation SdefXRef 12 | 13 | @synthesize target = _target; 14 | 15 | - (id)copyWithZone:(NSZone *)aZone { 16 | SdefXRef *copy = [super copyWithZone:aZone]; 17 | copy->_target = [_target copyWithZone:aZone]; 18 | return copy; 19 | } 20 | 21 | - (void)encodeWithCoder:(NSCoder *)aCoder { 22 | [super encodeWithCoder:aCoder]; 23 | [aCoder encodeObject:_target forKey:@"SXTarget"]; 24 | } 25 | 26 | - (id)initWithCoder:(NSCoder *)aCoder { 27 | if (self = [super initWithCoder:aCoder]) { 28 | _target = [aCoder decodeObjectForKey:@"SXTarget"]; 29 | } 30 | return self; 31 | } 32 | 33 | #pragma mark - 34 | + (SdefObjectType)objectType { 35 | return kSdefType_XRef; 36 | } 37 | 38 | #pragma mark - 39 | - (void)setTarget:(NSString *)target { 40 | if (target != _target) { 41 | [[self undoManager] registerUndoWithTarget:self selector:_cmd object:_target]; 42 | SPXSetterCopy(_target, target); 43 | } 44 | } 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /SdefLibrary/Validator/SdefLeavesValidator.m: -------------------------------------------------------------------------------- 1 | /* 2 | * SdefLeavesValidator.m 3 | * Sdef Editor 4 | * 5 | * Created by Rainbow Team. 6 | * Copyright © 2006 - 2007 Shadow Lab. All rights reserved. 7 | */ 8 | 9 | #import "SdefXRef.h" 10 | #import "SdefType.h" 11 | #import "SdefComment.h" 12 | #import "SdefSynonym.h" 13 | #import "SdefImplementation.h" 14 | 15 | #import "SdefValidatorBase.h" 16 | 17 | @implementation SdefXRef (SdefValidator) 18 | 19 | - (void)validate:(NSMutableArray *)messages forVersion:(SdefVersion)vers { 20 | if (!_target) { 21 | [messages addObject:[self invalidValue:nil forAttribute:@"target"]]; 22 | } 23 | [super validate:messages forVersion:vers]; 24 | } 25 | 26 | @end 27 | 28 | 29 | @implementation SdefType (SdefValidator) 30 | 31 | - (void)validate:(NSMutableArray *)messages forVersion:(SdefVersion)vers { 32 | if (![self name]) { 33 | [messages addObject:[self invalidValue:nil forAttribute:@"name"]]; 34 | } 35 | if (self.hidden && vers < kSdefLeopardVersion) 36 | [messages addObject:[self versionRequired:kSdefLeopardVersion forAttribute:@"hidden"]]; 37 | 38 | [super validate:messages forVersion:vers]; 39 | } 40 | 41 | @end 42 | 43 | @implementation SdefComment (SdefValidator) 44 | 45 | - (void)validate:(NSMutableArray *)messages forVersion:(SdefVersion)vers { 46 | if (_value && [_value rangeOfString:@"--"].location != NSNotFound) { 47 | [messages addObject:[SdefValidatorItem errorItemWithNode:self 48 | message:@"Invalid character sequence '--' found in comment"]]; 49 | } 50 | [super validate:messages forVersion:vers]; 51 | } 52 | 53 | @end 54 | 55 | @implementation SdefSynonym (SdefValidator) 56 | 57 | - (void)validate:(NSMutableArray *)messages forVersion:(SdefVersion)vers { 58 | if (![self name] && ![self code]) { 59 | [messages addObject:[SdefValidatorItem errorItemWithNode:self 60 | message:@"at least one of 'name' and 'code' is required"]]; 61 | } 62 | if ([self code] && !SdefValidatorCheckCode([self code])) { 63 | [messages addObject:[self invalidValue:[self code] forAttribute:@"code"]]; 64 | } 65 | [super validate:messages forVersion:vers]; 66 | } 67 | 68 | @end 69 | 70 | @implementation SdefImplementation (SdefValidator) 71 | 72 | - (void)validate:(NSMutableArray *)messages forVersion:(SdefVersion)vers { 73 | if (vers < kSdefLeopardVersion) { 74 | if ([self valueType] != kSdefValueTypeNone) 75 | [messages addObject:[self versionRequired:kSdefLeopardVersion forAttribute:@"*-value"]]; 76 | if ([self insertAtBeginning]) 77 | [messages addObject:[self versionRequired:kSdefLeopardVersion forAttribute:@"insert-at-beginning"]]; 78 | } else { 79 | switch ([self valueType]) { 80 | case kSdefValueTypeString: 81 | if (![self textValue]) 82 | [messages addObject:[self invalidValue:nil forAttribute:@"*-value"]]; 83 | break; 84 | } 85 | } 86 | [super validate:messages forVersion:vers]; 87 | } 88 | 89 | @end 90 | 91 | -------------------------------------------------------------------------------- /SdefLibrary/Validator/SdefTypeValidator.m: -------------------------------------------------------------------------------- 1 | /* 2 | * SdefTypeValidator.m 3 | * Sdef Editor 4 | * 5 | * Created by Rainbow Team. 6 | * Copyright © 2006 - 2007 Shadow Lab. All rights reserved. 7 | */ 8 | 9 | #import "SdefValidatorBase.h" 10 | 11 | #import "SdefTypedef.h" 12 | 13 | 14 | @implementation SdefEnumeration (SdefValidator) 15 | 16 | - (BOOL)validateCode { return YES; } 17 | 18 | - (void)validate:(NSMutableArray *)messages forVersion:(SdefVersion)vers { 19 | if (![self hasChildren]) { 20 | [messages addObject:[SdefValidatorItem errorItemWithNode:self 21 | message:@"enumeration must contains at least one enumerator."]]; 22 | } 23 | [super validate:messages forVersion:vers]; 24 | } 25 | 26 | @end 27 | 28 | @implementation SdefEnumerator (SdefValidator) 29 | 30 | - (BOOL)validateCode { return YES; } 31 | 32 | @end 33 | 34 | @implementation SdefValue (SdefValidator) 35 | 36 | - (BOOL)validateCode { return YES; } 37 | 38 | @end 39 | 40 | @implementation SdefRecord (SdefValidator) 41 | 42 | - (BOOL)validateCode { return YES; } 43 | 44 | - (void)validate:(NSMutableArray *)messages forVersion:(SdefVersion)vers { 45 | if (![self hasChildren]) { 46 | [messages addObject:[SdefValidatorItem errorItemWithNode:self 47 | message:@"record must contains at least one property."]]; 48 | } 49 | [super validate:messages forVersion:vers]; 50 | } 51 | 52 | @end 53 | -------------------------------------------------------------------------------- /SdefLibrary/Validator/SdefValidator.h: -------------------------------------------------------------------------------- 1 | /* 2 | * SdefValidator.h 3 | * Sdef Editor 4 | * 5 | * Created by Rainbow Team. 6 | * Copyright © 2006 - 2007 Shadow Lab. All rights reserved. 7 | */ 8 | 9 | #import "SdefBase.h" 10 | 11 | #import 12 | 13 | @interface SdefValidator : WBWindowController { 14 | @private 15 | NSUInteger sd_version; 16 | IBOutlet NSTableView *uiTable; 17 | IBOutlet NSPopUpButton *uiVersion; 18 | IBOutlet NSArrayController *ibMessages; 19 | } 20 | 21 | - (IBAction)refresh:(id)sender; 22 | - (IBAction)changeVersion:(id)sender; 23 | 24 | - (NSUInteger)version; 25 | - (void)setVersion:(NSUInteger)version; 26 | 27 | @end 28 | 29 | -------------------------------------------------------------------------------- /SdefLibrary/Validator/SdefValidatorBase.h: -------------------------------------------------------------------------------- 1 | /* 2 | * SdefValidatorBase.h 3 | * Sdef Editor 4 | * 5 | * Created by Rainbow Team. 6 | * Copyright © 2006 - 2007 Shadow Lab. All rights reserved. 7 | */ 8 | 9 | #import "SdefBase.h" 10 | #import "SdefLeaf.h" 11 | 12 | @interface SdefValidatorItem : NSObject { 13 | @private 14 | UInt8 sd_level; 15 | NSString *sd_message; 16 | NSObject *sd_object; 17 | } 18 | 19 | + (id)noteItemWithNode:(NSObject *)aNode message:(NSString *)msg, ...; 20 | + (id)errorItemWithNode:(NSObject *)aNode message:(NSString *)msg, ...; 21 | + (id)warningItemWithNode:(NSObject *)aNode message:(NSString *)msg, ...; 22 | 23 | - (NSObject *)object; 24 | 25 | @end 26 | 27 | WB_PRIVATE 28 | BOOL SdefValidatorIsKeyword(NSString *str); 29 | 30 | WB_PRIVATE 31 | BOOL SdefValidatorCheckCode(NSString *code); 32 | 33 | WB_PRIVATE 34 | NSString *SdefValidatorCodeForName(NSString *name); 35 | 36 | @interface SdefObject (SdefValidator) 37 | 38 | /* fill the message array with warnign and errors */ 39 | - (void)validate:(NSMutableArray *)messages forVersion:(SdefVersion)vers; 40 | 41 | @end 42 | 43 | @interface SdefLeaf (SdefValidator) 44 | 45 | /* fill the message array with warnign and errors */ 46 | - (void)validate:(NSMutableArray *)messages forVersion:(SdefVersion)vers; 47 | 48 | @end 49 | 50 | /* Private */ 51 | @interface NSObject (SdefValidatorInternal) 52 | /* Internal functions */ 53 | /* if attr is nil => missing required value */ 54 | - (SdefValidatorItem *)invalidValue:(NSString *)attr forAttribute:(NSString *)attr; 55 | 56 | - (SdefValidatorItem *)versionRequired:(SdefVersion)vers forAttribute:(NSString *)attr; 57 | - (SdefValidatorItem *)versionRequired:(SdefVersion)vers forElement:(NSString *)element; 58 | 59 | @end 60 | -------------------------------------------------------------------------------- /SdefLibrary/Validator/SdefVerbValidator.m: -------------------------------------------------------------------------------- 1 | /* 2 | * SdefVerbValidator.m 3 | * Sdef Editor 4 | * 5 | * Created by Rainbow Team. 6 | * Copyright © 2006 - 2007 Shadow Lab. All rights reserved. 7 | */ 8 | 9 | #import "SdefValidatorBase.h" 10 | 11 | #import "SdefVerb.h" 12 | #import "SdefArguments.h" 13 | 14 | @implementation SdefVerb (SdefValidator) 15 | 16 | - (void)validate:(NSMutableArray *)messages forVersion:(SdefVersion)vers { 17 | if (![self name]) 18 | [messages addObject:[self invalidValue:nil forAttribute:@"name"]]; 19 | 20 | NSString *code = [self code]; 21 | if (!code) { 22 | [messages addObject:[self invalidValue:nil forAttribute:@"code"]]; 23 | } else { 24 | BOOL invalid = YES; 25 | if ([code length] == 10) { 26 | if ([code hasPrefix:@"'"] && [code hasSuffix:@"'"]) 27 | invalid = NO; 28 | } else if ([code length] == 8) { 29 | invalid = NO; 30 | } else if ([code length] == 18) { 31 | const char *str = [code UTF8String]; 32 | if (str) 33 | invalid = (0 == strtol(str, NULL, 16)); 34 | } 35 | if (invalid) 36 | [messages addObject:[self invalidValue:code forAttribute:@"code"]]; 37 | } 38 | 39 | [_direct validate:messages forVersion:vers]; 40 | [_result validate:messages forVersion:vers]; 41 | 42 | [super validate:messages forVersion:vers]; 43 | } 44 | 45 | @end 46 | 47 | @implementation SdefParameter (SdefValidator) 48 | 49 | - (BOOL)validateType { return YES; } 50 | - (BOOL)validateCode { return YES; } 51 | 52 | /* bugs: cocoa->key required */ 53 | 54 | @end 55 | 56 | #pragma mark - 57 | @implementation SdefDirectParameter (SdefValidator) 58 | 59 | /* type optional but must be valid if exists */ 60 | - (BOOL)validateType { return [self type] != nil; } 61 | 62 | @end 63 | 64 | #pragma mark - 65 | @implementation SdefResult (SdefValidator) 66 | 67 | /* type optional but must be valid if exists */ 68 | - (BOOL)validateType { return [self type] != nil; } 69 | 70 | @end 71 | -------------------------------------------------------------------------------- /SdefLibrary/XML/Parser/Headers/SdefDocumentationParser.h: -------------------------------------------------------------------------------- 1 | /* 2 | * SdefDocumentationParser.h 3 | * Sdef Editor 4 | * 5 | * Created by Rainbow Team. 6 | * Copyright © 2006 - 2007 Shadow Lab. All rights reserved. 7 | */ 8 | 9 | #import "SdefParser.h" 10 | #import "SdefParserInternal.h" 11 | 12 | @class SdefParser, SdefDocumentation; 13 | @interface SdefDocumentationParser : NSObject { 14 | @private 15 | NSInteger sd_html; 16 | SdefDocumentation *sd_doc; 17 | NSMutableString *sd_content; 18 | } 19 | 20 | - (id)initWithDocumentation:(SdefDocumentation *)doc; 21 | 22 | - (void)close; 23 | 24 | - (SdefXMLStructure)parser:(SdefDOMParser *)parser createStructureForNode:(xmlNodePtr)node; 25 | - (void)parser:(SdefDOMParser *)parser addChild:(SdefXMLStructure)child toStructure:(SdefXMLStructure)parent; 26 | - (void)parser:(SdefDOMParser *)parser endStructure:(SdefXMLStructure)structure; 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /SdefLibrary/XML/Parser/Headers/SdefParser.h: -------------------------------------------------------------------------------- 1 | /* 2 | * SdefParser.h 3 | * Sdef Editor 4 | * 5 | * Created by Rainbow Team. 6 | * Copyright © 2006 - 2007 Shadow Lab. All rights reserved. 7 | */ 8 | 9 | 10 | #import "SdefBase.h" 11 | 12 | @protocol SdefParserDelegate; 13 | @class SdefXMLValidator, SdefDocumentationParser; 14 | @interface SdefParser : NSObject { 15 | __unsafe_unretained id sd_delegate; 16 | 17 | SdefVersion sd_version; 18 | NSMutableArray *sd_comments; 19 | NSMutableArray *sd_xincludes; 20 | NSMutableDictionary *sd_metas; 21 | 22 | /* root element */ 23 | NSMutableArray *sd_roots; 24 | 25 | SdefXMLValidator *sd_validator; 26 | /* html documentation parser */ 27 | SdefDocumentationParser *sd_docParser; 28 | } 29 | 30 | @property(nonatomic, assign) id delegate; 31 | 32 | - (NSArray *)objects; 33 | - (SdefVersion)sdefVersion; 34 | - (SdefDictionary *)dictionary; 35 | 36 | - (BOOL)parseContentsOfURL:(NSURL *)anURL error:(NSError **)outError; 37 | - (BOOL)parseData:(NSData *)sdefData base:(NSURL *)anURL error:(NSError **)outError; 38 | 39 | @end 40 | 41 | @protocol SdefParserDelegate 42 | - (BOOL)sdefParser:(SdefParser *)parser shouldIgnoreValidationError:(NSError *)error isFatal:(BOOL)fatal; 43 | @end 44 | 45 | -------------------------------------------------------------------------------- /SdefLibrary/XML/Parser/Headers/SdefXMLValidator.h: -------------------------------------------------------------------------------- 1 | /* 2 | * SdefXMLValidator.h 3 | * Sdef Editor 4 | * 5 | * Created by Rainbow Team. 6 | * Copyright © 2006 - 2007 Shadow Lab. All rights reserved. 7 | */ 8 | 9 | #import "SdefBase.h" 10 | 11 | enum { 12 | kSdefParserVersionUnknown = 0, 13 | kSdefParserVersionPanther = 1 << 0, 14 | kSdefParserVersionTiger = 1 << 1, 15 | kSdefParserVersionLeopard = 1 << 2, 16 | kSdefParserVersionMountainLion = 1 << 3, 17 | 18 | kSdefParserVersionAll = kSdefParserVersionPanther | kSdefParserVersionTiger | kSdefParserVersionLeopard | kSdefParserVersionMountainLion, 19 | kSdefParserVersionTigerAndLater = kSdefParserVersionTiger | kSdefParserVersionLeopard | kSdefParserVersionMountainLion, 20 | kSdefParserVersionLeopardAndLater = kSdefParserVersionLeopard | kSdefParserVersionMountainLion, 21 | kSdefParserVersionMountainLionAndLater = kSdefParserVersionMountainLion, 22 | 23 | kSdefValidatorVersionMask = 0x00ff, 24 | 25 | kSdefValidatorElementError = 1 << 8, 26 | kSdefValidatorAttributeError = 2 << 8, 27 | kSdefValidatorErrorMask = 0xff00, 28 | }; 29 | typedef NSUInteger SdefValidatorResult; 30 | typedef NSUInteger SdefValidatorVersion; 31 | 32 | @interface SdefXMLValidator : NSObject { 33 | @private 34 | NSMutableArray *sd_stack; 35 | SdefValidatorVersion sd_version; 36 | } 37 | 38 | - (SdefValidatorVersion)version; 39 | 40 | - (NSString *)element; 41 | - (void)startElement:(NSString *)element; 42 | - (void)endElement:(NSString *)element; 43 | 44 | - (SdefValidatorResult)validateElement:(NSString *)element attributes:(NSDictionary *)attributes error:(NSString **)error; 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /SdefLibrary/XML/Parser/SdefParserInternal.h: -------------------------------------------------------------------------------- 1 | /* 2 | * SdefParserInternal.h 3 | * Sdef Editor 4 | * 5 | * Created by Jean-Daniel Dupas on 30/10/07. 6 | * Copyright 2007 __MyCompanyName__. All rights reserved. 7 | * 8 | */ 9 | 10 | #import "SdefBase.h" 11 | 12 | #include 13 | 14 | @interface SdefDOMParser : NSObject { 15 | bool sd_abort; 16 | id sd_delegate; 17 | xmlNodePtr sd_current; 18 | } 19 | 20 | - (id)initWithDelegate:(id)aDelegate; 21 | - (BOOL)parse:(xmlNodePtr)root; 22 | 23 | - (NSInteger)line; 24 | - (NSInteger)location; 25 | 26 | - (void)abortWithError:(NSInteger)code reason:(NSString *)msg; 27 | 28 | - (NSStringEncoding)encoding; 29 | 30 | @end 31 | 32 | typedef id SdefXMLStructure; 33 | @interface NSObject (SdefDOMParserDelegate) 34 | 35 | - (SdefXMLStructure)parser:(SdefDOMParser *)parser createStructureForNode:(xmlNodePtr)node; 36 | - (void)parser:(SdefDOMParser *)parser addChild:(SdefXMLStructure)aChild toStructure:(SdefXMLStructure)aStruct; 37 | - (void)parser:(SdefDOMParser *)parser endStructure:(SdefXMLStructure)structure; 38 | 39 | @end 40 | 41 | SPX_PRIVATE 42 | NSUInteger _SdefXMLAttributeCount(xmlNodePtr node); 43 | 44 | SPX_PRIVATE 45 | xmlAttr *_SdefXMLAttributeAtIndex(xmlNodePtr node, NSUInteger idx); 46 | 47 | SPX_PRIVATE 48 | const xmlChar *_SdefXMLAttributeGetValue(xmlAttr *attr); 49 | 50 | SPX_PRIVATE 51 | NSDictionary *_SdefXMLCreateDictionaryWithAttributes(xmlAttr *attr, NSStringEncoding encoding); 52 | 53 | -------------------------------------------------------------------------------- /SdefLibrary/XML/SdefXMLAccessGroup.m: -------------------------------------------------------------------------------- 1 | // 2 | // SdefXMLAccessGroup.m 3 | // Sdef Editor 4 | // 5 | // Created by Jean-Daniel Dupas on 18/07/13. 6 | // 7 | // 8 | 9 | #import "SdefXMLNode.h" 10 | #import "SdefXMLBase.h" 11 | 12 | #import "SdefAccessGroup.h" 13 | 14 | @implementation SdefAccessGroup (SdefXMLManager) 15 | 16 | #pragma mark XML Generation 17 | - (NSString *)xmlElementName { 18 | return @"access-group"; 19 | } 20 | - (SdefXMLNode *)xmlNodeForVersion:(SdefVersion)version { 21 | if (version >= kSdefMountainLionVersion) { 22 | SdefXMLNode *node = [SdefXMLNode nodeWithElementName:[self xmlElementName]]; 23 | if (node) { 24 | if (_access) 25 | [node setAttribute:SdefXMLAccessStringFromFlag(_access) forKey:@"access"]; 26 | 27 | if (self.identifier) 28 | [node setAttribute:self.identifier forKey:@"identifier"]; 29 | } 30 | [node setEmpty:YES]; 31 | return node; 32 | } else { 33 | // TODO: write meta required to restore this accesss group if needed 34 | 35 | return nil; 36 | } 37 | } 38 | 39 | #pragma mark Parsing 40 | - (void)addXMLChild:(id)node { 41 | [NSException raise:NSInvalidArgumentException format:@"%@ does not support children", self]; 42 | } 43 | - (void)addXMLComment:(NSString *)comment { 44 | spx_trace(); 45 | } 46 | 47 | - (void)setXMLMetas:(NSDictionary *)metas { 48 | //DLog(@"Metas: %@, %@", self, metas); 49 | } 50 | - (void)setXMLAttributes:(NSDictionary *)attrs { 51 | self.identifier = [attrs objectForKey:@"identifier"]; 52 | _access = SdefXMLAccessFlagFromString([attrs objectForKey:@"access"]); 53 | } 54 | 55 | @end 56 | -------------------------------------------------------------------------------- /SdefLibrary/XML/SdefXMLBase.h: -------------------------------------------------------------------------------- 1 | /* 2 | * SdefXMLObject.h 3 | * Sdef Editor 4 | * 5 | * Created by Rainbow Team. 6 | * Copyright © 2006 - 2007 Shadow Lab. All rights reserved. 7 | */ 8 | 9 | #import "SdefType.h" 10 | #import "SdefXRef.h" 11 | #import "SdefClass.h" 12 | #import "SdefSynonym.h" 13 | 14 | #import 15 | 16 | @class SdefXMLNode; 17 | 18 | @protocol SdefXMLObject 19 | 20 | #pragma mark Parser 21 | - (void)addXMLChild:(id)node; 22 | - (void)addXMLComment:(NSString *)comment; 23 | 24 | - (void)setXMLMetas:(NSDictionary *)metas; 25 | - (void)setXMLAttributes:(NSDictionary *)attrs; 26 | 27 | #pragma mark Generator 28 | - (NSString *)xmlElementName; 29 | - (SdefXMLNode *)xmlNodeForVersion:(SdefVersion)version; 30 | 31 | @end 32 | 33 | @interface SdefObject (SdefXMLObject) 34 | #pragma mark Parser 35 | - (void)addXMLChild:(id)node; 36 | - (void)addXMLComment:(NSString *)comment; 37 | 38 | - (void)setXMLMetas:(NSDictionary *)metas; 39 | - (void)setXMLAttributes:(NSDictionary *)attrs; 40 | 41 | #pragma mark Generator 42 | - (NSString *)xmlElementName; 43 | - (SdefXMLNode *)xmlNodeForVersion:(SdefVersion)version; 44 | 45 | @end 46 | 47 | @interface SdefLeaf (SdefXMLObject) 48 | #pragma mark Parsing 49 | - (void)addXMLComment:(NSString *)comment; 50 | 51 | - (void)setXMLMetas:(NSDictionary *)metas; 52 | - (void)setXMLAttributes:(NSDictionary *)attrs; 53 | 54 | #pragma mark XML Generation 55 | - (NSString *)xmlElementName; 56 | - (SdefXMLNode *)xmlNodeForVersion:(SdefVersion)version; 57 | @end 58 | 59 | #pragma mark - 60 | @interface SdefElement (SdefXMLManager) 61 | - (void)addXMLAccessor:(NSString *)style; 62 | @end 63 | 64 | static inline 65 | NSString *SdefXMLAccessStringFromFlag(NSUInteger flag) { 66 | id str = nil; 67 | if (flag == (kSdefAccessRead | kSdefAccessWrite)) str = @"rw"; 68 | else if (flag == kSdefAccessRead) str = @"r"; 69 | else if (flag == kSdefAccessWrite) str = @"w"; 70 | return str; 71 | } 72 | 73 | static inline 74 | uint32_t SdefXMLAccessFlagFromString(NSString *str) { 75 | uint32_t flag = 0; 76 | if (str && [str rangeOfString:@"r"].location != NSNotFound) { 77 | flag |= kSdefAccessRead; 78 | } 79 | if (str && [str rangeOfString:@"w"].location != NSNotFound) { 80 | flag |= kSdefAccessWrite; 81 | } 82 | return flag; 83 | } 84 | 85 | -------------------------------------------------------------------------------- /SdefLibrary/XML/SdefXMLDictionary.m: -------------------------------------------------------------------------------- 1 | /* 2 | * SdefXMLDictionary.m 3 | * Sdef Editor 4 | * 5 | * Created by Rainbow Team. 6 | * Copyright © 2006 - 2007 Shadow Lab. All rights reserved. 7 | */ 8 | 9 | #import "SdefDictionary.h" 10 | #import "SdefSuite.h" 11 | #import "SdefXMLNode.h" 12 | #import "SdefXMLBase.h" 13 | 14 | @implementation SdefDictionary (SdefXMLManager) 15 | #pragma mark XML Generation 16 | - (BOOL)sd_usesXInclude { 17 | if ([self containsXInclude]) 18 | return YES; 19 | 20 | SdefObject *child; 21 | NSEnumerator *children = [self deepChildEnumerator]; 22 | while (child = [children nextObject]) { 23 | if ([child containsXInclude]) 24 | return YES; 25 | } 26 | return NO; 27 | } 28 | 29 | - (SdefXMLNode *)xmlNodeForVersion:(SdefVersion)version { 30 | SdefXMLNode *node = [super xmlNodeForVersion:version]; 31 | if (node) { 32 | if ([self name]) [node setAttribute:[[self name] stringByEscapingEntities:nil] forKey:@"title"]; 33 | if (version > kSdefLeopardVersion) { 34 | //[node setMeta:@"10.5" forKey:@"version"]; 35 | if ([self sd_usesXInclude]) 36 | [node setAttribute:@"http://www.w3.org/2003/XInclude" forKey:@"xmlns:xi"]; 37 | } else if (version == kSdefTigerVersion) { 38 | [node setMeta:@"10.4" forKey:@"version"]; 39 | } 40 | } 41 | return node; 42 | } 43 | 44 | - (NSString *)xmlElementName { 45 | return @"dictionary"; 46 | } 47 | 48 | #pragma mark Parsing 49 | - (void)setXMLMetas:(NSDictionary *)metas { 50 | NSString *version = [metas objectForKey:@"version"]; 51 | if (version) { 52 | if ([version isEqualToString:@"10.4"]) 53 | [self setVersion:kSdefTigerVersion]; 54 | } 55 | [super setXMLMetas:metas]; 56 | } 57 | 58 | - (void)setXMLAttributes:(NSDictionary *)attrs { 59 | [super setXMLAttributes:attrs]; 60 | NSString *attr = [attrs objectForKey:@"title"]; 61 | if (attr) 62 | [self setName:[attr stringByUnescapingEntities:nil]]; 63 | } 64 | 65 | - (void)addXMLChild:(id)child { 66 | switch ([child objectType]) { 67 | case kSdefType_Suite: 68 | [self appendChild:(SdefSuite *)child]; 69 | break; 70 | default: 71 | [super addXMLChild:child]; 72 | break; 73 | } 74 | } 75 | 76 | @end 77 | -------------------------------------------------------------------------------- /SdefLibrary/XML/SdefXMLSuite.m: -------------------------------------------------------------------------------- 1 | /* 2 | * SdefXMLSuite.m 3 | * Sdef Editor 4 | * 5 | * Created by Rainbow Team. 6 | * Copyright © 2006 - 2007 Shadow Lab. All rights reserved. 7 | */ 8 | 9 | #import "SdefSuite.h" 10 | #import "SdefVerb.h" 11 | 12 | #import "SdefXMLBase.h" 13 | 14 | @implementation SdefSuite (SdefXMLManager) 15 | #pragma mark XML Generation 16 | - (NSString *)xmlElementName { 17 | return @"suite"; 18 | } 19 | #pragma mark XML Parser 20 | - (void)addXMLChild:(id)child { 21 | switch ([child objectType]) { 22 | case kSdefType_ValueType: 23 | case kSdefType_RecordType: 24 | case kSdefType_Enumeration: 25 | [[self types] appendChild:(id)child]; 26 | break; 27 | case kSdefType_Class: 28 | [[self classes] appendChild:(id)child]; 29 | break; 30 | case kSdefType_Command: { 31 | SdefVerb *verb = (SdefVerb *)child; 32 | if ([verb isCommand]) { 33 | [[self commands] appendChild:verb]; 34 | } else { 35 | [[self events] appendChild:verb]; 36 | } 37 | } 38 | break; 39 | default: 40 | [super addXMLChild:child]; 41 | break; 42 | } 43 | } 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /SdefLibrary/XML/Writer/SdefXMLGenerator.h: -------------------------------------------------------------------------------- 1 | /* 2 | * SdefXMLGenerator.h 3 | * Sdef Editor 4 | * 5 | * Created by Rainbow Team. 6 | * Copyright © 2006 - 2007 Shadow Lab. All rights reserved. 7 | */ 8 | 9 | #import "SdefBase.h" 10 | 11 | @class SdefObject; 12 | @interface SdefXMLGenerator : NSObject { 13 | CFXMLTreeRef sd_doc; 14 | CFXMLTreeRef sd_node; 15 | NSUInteger sd_indent; 16 | 17 | BOOL sd_metas; 18 | SdefObject *sd_root; 19 | NSString *sd_comment; 20 | } 21 | 22 | - (id)initWithRoot:(SdefObject *)dictionary; 23 | - (NSData *)xmlDataForVersion:(SdefVersion)version; 24 | 25 | - (SdefObject *)root; 26 | - (void)setRoot:(SdefObject *)anObject; 27 | 28 | - (void)setIgnoreMetas:(BOOL)flag; 29 | - (void)setHeaderComment:(NSString *)comment; 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /SdefLibrary/XML/Writer/SdefXMLNode.h: -------------------------------------------------------------------------------- 1 | /* 2 | * SdefXMLNode.h 3 | * Sdef Editor 4 | * 5 | * Created by Rainbow Team. 6 | * Copyright © 2006 - 2007 Shadow Lab. All rights reserved. 7 | */ 8 | 9 | #import 10 | 11 | @interface SdefXMLNode : WBTreeNode { 12 | BOOL _list; 13 | BOOL _cddata; 14 | NSString *_name; 15 | NSMutableArray *sd_attrKeys, *sd_attrValues; 16 | 17 | NSString *_content; 18 | NSMutableArray *sd_comments; 19 | NSMutableDictionary *sd_metas; 20 | NSMutableDictionary *sd_postmetas; 21 | } 22 | 23 | + (id)nodeWithElementName:(NSString *)aName; 24 | - (id)initWithElementName:(NSString *)name; 25 | 26 | @property(nonatomic, copy) NSString *elementName; 27 | @property(nonatomic, copy) NSString *content; 28 | 29 | @property(nonatomic, getter = isList) BOOL list; 30 | @property(nonatomic, getter = isEmpty) BOOL empty; 31 | @property(nonatomic, getter = isCDData) BOOL CDData; 32 | 33 | - (NSUInteger)attributeCount; 34 | 35 | - (NSArray *)attrKeys; 36 | - (NSArray *)attrValues; 37 | 38 | - (NSString *)attributForKey:(NSString *)key; 39 | - (void)setAttribute:(NSString *)value forKey:(NSString *)key; 40 | - (void)addAttributesFromDictionary:(NSDictionary *)dict; 41 | - (void)removeAttributeForKey:(NSString *)key; 42 | - (void)removeAllAttributes; 43 | 44 | - (NSArray *)comments; 45 | - (void)setComments:(NSArray *)comments; 46 | - (void)addComment:(NSString *)comment; 47 | - (void)removeCommentAtIndex:(NSUInteger)index; 48 | 49 | /* set nil value to remove a meta */ 50 | - (NSDictionary *)metas; 51 | - (NSDictionary *)postmetas; 52 | - (void)setMeta:(NSString *)value forKey:(NSString *)key; 53 | - (void)setPostMeta:(NSString *)value forKey:(NSString *)key; 54 | 55 | @end 56 | -------------------------------------------------------------------------------- /SdefObjectInspector.h: -------------------------------------------------------------------------------- 1 | /* 2 | * SdefObjectInspector.h 3 | * Sdef Editor 4 | * 5 | * Created by Rainbow Team. 6 | * Copyright © 2006 - 2007 Shadow Lab. All rights reserved. 7 | */ 8 | 9 | #import 10 | 11 | @class SdefObject, SdefDocument; 12 | @interface SdefObjectInspector : NSWindowController { 13 | SdefDocument *sd_doc; 14 | BOOL needsUpdate; 15 | } 16 | 17 | + (id)sharedInspector; 18 | 19 | - (SdefObject *)content; 20 | 21 | - (SdefDocument *)displayedDocument; 22 | - (void)setDisplayedDocument:(SdefDocument *)aDocument; 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /SdefObjectInspector.m: -------------------------------------------------------------------------------- 1 | /* 2 | * SdefObjectInspector.m 3 | * Sdef Editor 4 | * 5 | * Created by Rainbow Team. 6 | * Copyright © 2006 - 2007 Shadow Lab. All rights reserved. 7 | */ 8 | 9 | #import "SdefObjectInspector.h" 10 | 11 | 12 | #import "SdefObjects.h" 13 | #import "SdefDocument.h" 14 | #import "SdefWindowController.h" 15 | 16 | @implementation SdefObjectInspector 17 | 18 | + (id)sharedInspector { 19 | static id inspector = nil; 20 | if (!inspector) { 21 | inspector = [[self alloc] init]; 22 | } 23 | return inspector; 24 | } 25 | 26 | - (id)init { 27 | if (self = [super initWithWindowNibName:@"SdefInspector"]) { 28 | [self setWindowFrameAutosaveName:@"SdefObjectInspector"]; 29 | needsUpdate = NO; 30 | } 31 | return self; 32 | } 33 | 34 | - (void)dealloc { 35 | [[NSNotificationCenter defaultCenter] removeObserver:self]; 36 | } 37 | 38 | #pragma mark - 39 | - (void)windowDidUpdate:(NSNotification *)notification { 40 | if (needsUpdate && [NSApp isActive]) { 41 | [self willChangeValueForKey:@"content"]; 42 | [self didChangeValueForKey:@"content"]; 43 | needsUpdate = NO; 44 | } 45 | } 46 | 47 | - (SdefObject *)content { 48 | return [sd_doc selection]; 49 | } 50 | 51 | - (SdefDocument *)displayedDocument { 52 | return sd_doc; 53 | } 54 | 55 | - (void)setDisplayedDocument:(SdefDocument *)aDocument { 56 | if (sd_doc != aDocument) { 57 | sd_doc = aDocument; 58 | needsUpdate = YES; 59 | } 60 | } 61 | 62 | - (void)setMainWindow:(NSWindow *)mainWindow { 63 | if ([NSApp isActive]) { 64 | NSWindowController *controller = [mainWindow windowController]; 65 | if (controller && [controller isKindOfClass:[SdefWindowController class]]) { 66 | [self setDisplayedDocument:[controller document]]; 67 | } else { 68 | [self setDisplayedDocument:nil]; 69 | } 70 | } 71 | } 72 | 73 | - (void)windowDidLoad { 74 | [super windowDidLoad]; 75 | [self setMainWindow:[NSApp mainWindow]]; 76 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(mainWindowChanged:) name:NSWindowDidBecomeMainNotification object:nil]; 77 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(mainWindowResigned:) name:NSWindowDidResignMainNotification object:nil]; 78 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(selectionChanged:) name:SdefDictionarySelectionDidChangeNotification object:nil]; 79 | } 80 | 81 | - (void)mainWindowChanged:(NSNotification *)aNotification { 82 | [self setMainWindow:[aNotification object]]; 83 | } 84 | 85 | - (void)mainWindowResigned:(NSNotification *)aNotification { 86 | [self setMainWindow:nil]; 87 | } 88 | 89 | - (void)selectionChanged:(NSNotification *)aNotification { 90 | if ([aNotification object] == sd_doc) { 91 | needsUpdate = YES; 92 | } 93 | } 94 | 95 | @end 96 | -------------------------------------------------------------------------------- /SdefProcessor.h: -------------------------------------------------------------------------------- 1 | /* 2 | * SdefProcessor.h 3 | * Sdef Editor 4 | * 5 | * Created by Rainbow Team. 6 | * Copyright © 2006 - 2007 Shadow Lab. All rights reserved. 7 | */ 8 | 9 | #import "SdefBase.h" 10 | 11 | enum { 12 | kSdefUndefinedFormat = 0, 13 | kSdefResourceFormat = 1 << 0, 14 | kSdefScriptSuiteFormat = 1 << 1, 15 | kSdefScriptTerminologyFormat = 1 << 2, 16 | kSdefScriptBridgeHeaderFormat = 1 << 3, 17 | kSdefScriptBridgeImplementationFormat = 1 << 4, 18 | }; 19 | typedef NSUInteger SdefProcessorFormat; 20 | 21 | @class SdefDocument; 22 | @interface SdefProcessor : NSObject { 23 | id sd_input; 24 | NSString *sd_output; 25 | NSArray *sd_includes; 26 | NSString *sd_version; 27 | NSMutableString *sd_msg; 28 | SdefProcessorFormat sd_format; 29 | } 30 | 31 | - (id)initWithFile:(NSString *)aSdefFile; 32 | - (id)initWithSdefDocument:(SdefDocument *)aDocument; 33 | 34 | - (NSString *)process; 35 | 36 | - (id)input; 37 | - (void)setInput:(id)input; 38 | 39 | - (NSString *)output; 40 | - (void)setOutput:(NSString *)output; 41 | 42 | - (NSString *)version; 43 | - (void)setVersion:(NSString *)aVersion; 44 | 45 | - (NSArray *)includes; 46 | - (void)setIncludes:(NSArray *)includes; 47 | 48 | - (SdefProcessorFormat)format; 49 | - (void)setFormat:(SdefProcessorFormat)aFormat; 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /SdtplChecker/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleDocumentTypes 8 | 9 | 10 | CFBundleTypeExtensions 11 | 12 | sdtpl 13 | 14 | CFBundleTypeIconFile 15 | SdtplBundle 16 | CFBundleTypeName 17 | SdefTemplateFile 18 | CFBundleTypeRole 19 | Viewer 20 | LSTypeIsPackage 21 | 22 | 23 | 24 | CFBundleExecutable 25 | ${EXECUTABLE_NAME} 26 | CFBundleIconFile 27 | SdtplChecker 28 | CFBundleIdentifier 29 | org.shadowlab.SdtplChecker 30 | CFBundleInfoDictionaryVersion 31 | 6.0 32 | CFBundlePackageType 33 | APPL 34 | CFBundleShortVersionString 35 | 1.0.1 36 | CFBundleSignature 37 | Sdtc 38 | CFBundleVersion 39 | ${CURRENT_PROJECT_VERSION} 40 | NSMainNibFile 41 | MainMenu 42 | NSPrincipalClass 43 | NSApplication 44 | 45 | 46 | -------------------------------------------------------------------------------- /SdtplChecker/Resources/Block.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jean-Daniel/Sdef-Editor/e95c5f6c43e96f398d35be981e1c0403e651112a/SdtplChecker/Resources/Block.tiff -------------------------------------------------------------------------------- /SdtplChecker/Resources/Definitions/Class.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Class 6 | 7 | Name 8 | Anchor 9 | Description 10 | 11 | Plural 12 | Superclass 13 | Subclasses 14 | Elements 15 | Properties 16 | Responds-To-Commands 17 | Responds-To-Events 18 | 19 | 20 | Element 21 | 22 | Type 23 | Accessors 24 | 25 | Elements 26 | 27 | 28 | Element 29 | 30 | 31 | Plural 32 | 33 | Name 34 | Description 35 | 36 | Properties 37 | 38 | 39 | Superclass 40 | Property 41 | 42 | 43 | Property 44 | 45 | Type 46 | Name 47 | Read-Only 48 | Description 49 | 50 | Responds-To-Command 51 | 52 | Name 53 | Description 54 | 55 | Responds-To-Commands 56 | 57 | 58 | Responds-To-Command 59 | 60 | 61 | Responds-To-Event 62 | 63 | Name 64 | Description 65 | 66 | Responds-To-Events 67 | 68 | 69 | Responds-To-Event 70 | 71 | 72 | Subclass 73 | 74 | Name 75 | Description 76 | 77 | Subclasses 78 | 79 | 80 | Subclass 81 | 82 | 83 | Superclass 84 | 85 | Name 86 | Description 87 | 88 | 89 | 90 | -------------------------------------------------------------------------------- /SdtplChecker/Resources/Definitions/Dictionary.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Classes 6 | 7 | 8 | Class 9 | 10 | 11 | Commands 12 | 13 | 14 | Command 15 | 16 | 17 | Dictionary 18 | 19 | Name 20 | Anchor 21 | 22 | Suite 23 | Toc 24 | 25 | 26 | Events 27 | 28 | 29 | Event 30 | 31 | 32 | Index 33 | 34 | Root 35 | 36 | Dictionary-File 37 | Dictionary-Anchor 38 | Dictionary-Link 39 | Dictionary-Name 40 | Suite-File 41 | Suite-Anchor 42 | Suite-Link 43 | Suite-Name 44 | Index-File 45 | Toc-File 46 | Style-File 47 | Style-Link 48 | 49 | Style 50 | 51 | 52 | Style 53 | 54 | Style-Sheet 55 | 56 | Suite 57 | 58 | Name 59 | Anchor 60 | Description 61 | 62 | Classes 63 | Commands 64 | Events 65 | 66 | 67 | Suites 68 | 69 | 70 | Suite 71 | 72 | 73 | 74 | 75 | -------------------------------------------------------------------------------- /SdtplChecker/Resources/Definitions/Toc.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Toc 6 | 7 | Name 8 | 9 | Toc-Suite 10 | 11 | 12 | Toc-Class 13 | 14 | Name 15 | Description 16 | 17 | Toc-Classes 18 | 19 | 20 | Toc-Class 21 | 22 | 23 | Toc-Command 24 | 25 | Name 26 | Description 27 | 28 | Toc-Commands 29 | 30 | 31 | Toc-Command 32 | 33 | 34 | Toc-Event 35 | 36 | Name 37 | Description 38 | 39 | Toc-Events 40 | 41 | 42 | Toc-Event 43 | 44 | 45 | Toc-Suite 46 | 47 | Name 48 | Description 49 | 50 | Toc-Classes 51 | Toc-Commands 52 | Toc-Events 53 | 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /SdtplChecker/Resources/Definitions/Verb.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Direct-Parameter 6 | 7 | Type-List 8 | Type 9 | Description 10 | 11 | Parameter 12 | 13 | Type-List 14 | Type 15 | Name 16 | Description 17 | 18 | Parameters 19 | 20 | 21 | Required-Parameter 22 | Optional-Parameter 23 | 24 | 25 | Result 26 | 27 | Type-List 28 | Type 29 | Description 30 | 31 | Verb 32 | 33 | Name 34 | Anchor 35 | Description 36 | 37 | Parameters 38 | Direct-Parameter 39 | Result 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /SdtplChecker/Resources/Disable.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jean-Daniel/Sdef-Editor/e95c5f6c43e96f398d35be981e1c0403e651112a/SdtplChecker/Resources/Disable.tif -------------------------------------------------------------------------------- /SdtplChecker/Resources/Enabled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jean-Daniel/Sdef-Editor/e95c5f6c43e96f398d35be981e1c0403e651112a/SdtplChecker/Resources/Enabled.png -------------------------------------------------------------------------------- /SdtplChecker/Resources/English.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jean-Daniel/Sdef-Editor/e95c5f6c43e96f398d35be981e1c0403e651112a/SdtplChecker/Resources/English.lproj/InfoPlist.strings -------------------------------------------------------------------------------- /SdtplChecker/Resources/ErrorIcon.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jean-Daniel/Sdef-Editor/e95c5f6c43e96f398d35be981e1c0403e651112a/SdtplChecker/Resources/ErrorIcon.tiff -------------------------------------------------------------------------------- /SdtplChecker/Resources/MainMenu.nib/classes.nib: -------------------------------------------------------------------------------- 1 | { 2 | IBClasses = ( 3 | {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, 4 | {CLASS = SKImageAndTextCell; LANGUAGE = ObjC; SUPERCLASS = NSTextFieldCell; }, 5 | { 6 | ACTIONS = {open = id; }; 7 | CLASS = SdtplChecker; 8 | LANGUAGE = ObjC; 9 | OUTLETS = { 10 | errors = NSArrayController; 11 | templatesTree = NSOutlineView; 12 | warnings = NSWindow; 13 | }; 14 | SUPERCLASS = NSObject; 15 | } 16 | ); 17 | IBVersion = 1; 18 | } -------------------------------------------------------------------------------- /SdtplChecker/Resources/MainMenu.nib/info.nib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IBDocumentLocation 6 | 15 0 359 271 0 0 1024 746 7 | IBEditorPositions 8 | 9 | 29 10 | 48 601 325 44 0 0 1680 1028 11 | 12 | IBFramework Version 13 | 446.1 14 | IBOpenObjects 15 | 16 | 29 17 | 21 18 | 19 | IBSystem Version 20 | 8L2127 21 | 22 | 23 | -------------------------------------------------------------------------------- /SdtplChecker/Resources/MainMenu.nib/keyedobjects.nib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jean-Daniel/Sdef-Editor/e95c5f6c43e96f398d35be981e1c0403e651112a/SdtplChecker/Resources/MainMenu.nib/keyedobjects.nib -------------------------------------------------------------------------------- /SdtplChecker/Resources/SdtplBundle.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jean-Daniel/Sdef-Editor/e95c5f6c43e96f398d35be981e1c0403e651112a/SdtplChecker/Resources/SdtplBundle.icns -------------------------------------------------------------------------------- /SdtplChecker/Resources/SdtplChecker.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jean-Daniel/Sdef-Editor/e95c5f6c43e96f398d35be981e1c0403e651112a/SdtplChecker/Resources/SdtplChecker.icns -------------------------------------------------------------------------------- /SdtplChecker/Resources/Template.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jean-Daniel/Sdef-Editor/e95c5f6c43e96f398d35be981e1c0403e651112a/SdtplChecker/Resources/Template.tiff -------------------------------------------------------------------------------- /SdtplChecker/Resources/Variable.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jean-Daniel/Sdef-Editor/e95c5f6c43e96f398d35be981e1c0403e651112a/SdtplChecker/Resources/Variable.tiff -------------------------------------------------------------------------------- /SdtplChecker/Resources/WarningIcon.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jean-Daniel/Sdef-Editor/e95c5f6c43e96f398d35be981e1c0403e651112a/SdtplChecker/Resources/WarningIcon.tiff -------------------------------------------------------------------------------- /SdtplChecker/SKTemplateChecker.m: -------------------------------------------------------------------------------- 1 | #import 2 | #import "SKTemplateParser.h" 3 | #import "SKXMLTemplate.h" 4 | #import "ShadowMacros.h" 5 | 6 | #include 7 | 8 | static void usage() { 9 | printf("usage: %s [-xw] template1 ...\n", getprogname()); 10 | } 11 | 12 | int main (int argc, char * const argv[]) { 13 | NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; 14 | extern char *optarg; 15 | extern int optind; 16 | int ch; 17 | 18 | Class cls = [SKTemplate class]; 19 | 20 | /* options descriptor */ 21 | static struct option longopts[] = { 22 | {"xml", no_argument, nil, 'x'}, 23 | {"warning", no_argument, nil, 'w' }, 24 | {nil, 0, nil, 0} }; 25 | 26 | if (argc < 2) { 27 | usage(); 28 | goto exit; 29 | } 30 | 31 | SKTemplateLogMessage = YES; 32 | SKTemplateLogWarning = YES; 33 | 34 | while ((ch = getopt_long(argc, argv, "xw", longopts, NULL)) != -1) { 35 | switch(ch) { 36 | case 'w': 37 | SKTemplateLogWarning = NO; 38 | break; 39 | case 'x': 40 | cls = [SKXMLTemplate class]; 41 | break; 42 | case '?': 43 | default: 44 | usage(); 45 | goto exit; 46 | } 47 | } 48 | 49 | NSArray *arguments = [[NSProcessInfo processInfo] arguments]; 50 | if ([arguments count] == optind) { 51 | usage(); 52 | goto exit; 53 | } 54 | 55 | unsigned idx = 0; 56 | for (idx = optind; idx<[arguments count]; idx++) { 57 | NSString *tplFile = [[arguments objectAtIndex:idx] stringByStandardizingPath]; 58 | if (![[NSFileManager defaultManager] fileExistsAtPath:tplFile]) { 59 | fprintf(stdout, "File %s not found\n", [tplFile cString]); 60 | } else { 61 | SKTemplate *tpl = [[cls alloc] initWithContentsOfFile:tplFile]; 62 | [tpl load]; 63 | fprintf(stdout, "\n"); 64 | [tpl release]; 65 | } 66 | } 67 | 68 | exit: 69 | [pool release]; 70 | return 0; 71 | } 72 | -------------------------------------------------------------------------------- /SdtplChecker/SdefTemplateCheck.h: -------------------------------------------------------------------------------- 1 | // 2 | // SdefTemplateCheck.h 3 | // SdefTemplateChecker 4 | // 5 | // Created by Grayfox on 09/04/05. 6 | // Copyright 2005 Shadow Lab. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class SdefTemplate; 12 | @interface SdefTemplateCheck : NSObject { 13 | NSString *sd_path; 14 | SdefTemplate *sd_tpl; 15 | NSMutableDictionary *sd_errors; 16 | NSMutableDictionary *sd_definitions; 17 | } 18 | 19 | - (id)initWithFile:(NSString *)path; 20 | 21 | - (NSString *)path; 22 | - (void)setPath:(NSString *)path; 23 | 24 | - (SdefTemplate *)template; 25 | - (NSMutableDictionary *)errors; 26 | 27 | - (BOOL)checkTemplate; 28 | - (BOOL)checkTemplateContent; 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /SdtplChecker/SdtplChecker.h: -------------------------------------------------------------------------------- 1 | // 2 | // SdtplChecker.h 3 | // SdefTemplateChecker 4 | // 5 | // Created by Grayfox on 10/04/05. 6 | // Copyright 2005 Shadow Lab. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class SdefTemplateCheck; 12 | @interface SdtplChecker : NSObject { 13 | IBOutlet id errors; 14 | IBOutlet id warnings; 15 | IBOutlet id templatesTree; 16 | NSMutableArray *templates; 17 | SdefTemplateCheck *checker; 18 | } 19 | 20 | @end 21 | 22 | @interface SdefBooleanTransformer : NSValueTransformer { 23 | } 24 | 25 | + (id)transformer; 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /xcconfigs/debug.xcconfig: -------------------------------------------------------------------------------- 1 | 2 | #include "project.xcconfig" 3 | 4 | #include "../hadron/xcconfigs/config/debug.xcconfig" 5 | -------------------------------------------------------------------------------- /xcconfigs/project.xcconfig: -------------------------------------------------------------------------------- 1 | 2 | #include "../hadron/xcconfigs/os/catalina.xcconfig" 3 | 4 | // team.xcconfig contains a single DEVELOPMENT_TEAM entry 5 | #include "team.xcconfig" 6 | 7 | HADRON_PATH = hadron 8 | 9 | WARNING_CFLAGS = $(inherited) -Wno-old-style-cast 10 | 11 | //:configuration = Debug 12 | // MARKETING_VERSION = 1.0.6 13 | // CURRENT_PROJECT_VERSION = 10006 14 | 15 | // automatic code sign 16 | CODE_SIGN_STYLE = Automatic 17 | PROVISIONING_PROFILE_SPECIFIER = 18 | 19 | 20 | LOCALIZED_STRING_MACRO_NAMES = LocalizedString NSLocalizedString CFBundleCopyLocalizedString 21 | 22 | // Multi platform target support 23 | 24 | EXCLUDED_SOURCE_FILE_NAMES = macOS/* iOS/* 25 | INCLUDED_SOURCE_FILE_NAMES[sdk=macosx*] = macOS/* 26 | INCLUDED_SOURCE_FILE_NAMES[sdk=iphoneos*] = iOS/* 27 | -------------------------------------------------------------------------------- /xcconfigs/release.xcconfig: -------------------------------------------------------------------------------- 1 | 2 | #include "project.xcconfig" 3 | 4 | #include "../hadron/xcconfigs/config/release.xcconfig" 5 | -------------------------------------------------------------------------------- /xcconfigs/target: -------------------------------------------------------------------------------- 1 | ../hadron/xcconfigs/target -------------------------------------------------------------------------------- /xcconfigs/team.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // team.xcconfig 3 | // 4 | // Created by Jean-Daniel. 5 | // Copyright © 2018 Xenonium. All rights reserved. 6 | // 7 | 8 | // Configuration settings file format documentation can be found at: 9 | // https://help.apple.com/xcode/#/dev745c5c974 10 | 11 | DEVELOPMENT_TEAM = 3DT6DNJE39 12 | --------------------------------------------------------------------------------