4Misc_Start(#4Platform@9VersionCheck xHH@Rg(HHdh xHH@Rg(HHdh x HH@Rg(HHdh ^Graph*WDashSettings#  !4 4 4 4 4 4 homeUUd[Macintosh HD:Users:jim:Desktop:BBEdit Language Module:Igor_Help_FilesdMacintosh HD:Users:jim:Documents:Igor Installers:SVNBuildWorkingCopy:root:Igor 9 only Files:Common Files:Igor Help Files:RecentWindowsAdvanced Topics.ihfIgor Reference.ihfInteracting with the User.ihfProgramming Techniques.ihfProgramming.ihfUser-Defined Menus.ihf 4Misc_End(#XOPState_Start(#Abeles64XMLutils64SANSAnalysis64SQL64XTest3-64XTestStructs644XOPState_End(#V_Flag!*!// Platform=Macintosh, IGORVersion=9.000, architecture=Intel, systemTextEncoding="MacRoman", historyTextEncoding="UTF-8", procwinTextEncoding="UTF-8", recreationTextEncoding="UTF-8", build=37012 #pragma TextEncoding = "UTF-8" Silent 101 // use | as bitwise or -- not comment. NewPath/Z Igor_Help_Files ":::Documents:Igor Installers:SVNBuildWorkingCopy:root:Igor 9 only Files:Common Files:Igor Help Files:" DefaultFont "Arial" MoveWindow/C 1399,882,2428,1439 MoveWindow/P 396,45,1558,1010 KillStrings/Z root:gWMSetNextTextFilesTextEncoding *#pragma TextEncoding = "UTF-8" #pragma rtGlobals=3 // Use modern global access method and strict wave access #pragma DefaultTab={3,20,4} // Set default tab width in Igor Pro 9 and later // Supporting routines for generating IgorCodelessLanguageModule.plist, // which is stored in ~/Library/Application Support/BBEdit/Language Models // // https://www.barebones.com/support/develop/clm.html // Note: the .plist I downloaded from Igor Exchange uses the old keywords that are replaced: // // https://www.barebones.com/support/technotes/language-module-changes.html // Note that BBLMKeywords supersedes the four old keys, // which are still supported but should no longer be used: // // BBLMKeywordList // BBLMKeywordFileName // BBLMPredefinedNameList // BBLMPredefinedNameFileName // The code below uses the old keys, but they provide no way to separately color operations vs functions. // // We probably need to code a plug-in to get the correct colors for functions versus operations. Macro SaveBBEditCodelessLanguageModule() String message = "Save a .plist file" String fileFilters = "Property List Files (*.plist):.plist;" fileFilters += "All Files:.*;" Variable refNum Open /D /F=fileFilters /M=message refNum String outputPath = S_fileName if( strlen(outputPath) ) Open/Z=2 refNum as outputPath String list = MakeBBEditCodelessLanguageModule() FBinWrite refNum, list Close refNum endif End Macro CopyBBEditCodelessLanguageModule() String list = MakeBBEditCodelessLanguageModule() PutScrapText list End Proc CopyBBLMPredefinedNameList() String list = MakeBBLMPredefinedNameList("\t") PutScrapText list End Proc CopyBBLMKeywordList() String list = MakeBBLMKeywordList("\t") PutScrapText list End Function/S MakeBBEditCodelessLanguageModule() String list = "\r" list += "\r" list += "\r" String prefix="\t" prefix="" // keep plist and dict at the same indent. list += prefix+"\r" String indent = prefix + "\t" list += MakeBBLMFrontMatter(indent) list += MakeBBLMPredefinedNameList(indent) list += MakeBBLMKeywordList(indent) list += MakeBBLMLanguageFeatures(indent) list += prefix+"\r" list += "\r" return list End Function/S MakeBBLMFrontMatter(String prefix) String list = prefix+"BBEditDocumentType\r" list += prefix+"CodelessLanguageModule\r" list += prefix+"BBLMLanguageDisplayName\r" list += prefix+"Igor Pro\r" list += prefix+"BBLMLanguageCode\r" list += prefix+"Igor\r" list += prefix+"BBLMColorsSyntax\r" list += prefix+"\r" list += prefix+"BBLMScansFunctions\r" list += prefix+"\r" list += prefix+"BBLMIsCaseSensitive\r" list += prefix+"\r" list += prefix+"BBLMSupportsTextCompletion\r" list += prefix+"\r" list += prefix+"BBLMSuffixMap\r" list += prefix+"\r" String indent = prefix+"\t" list += indent+"\r" String indent2 = indent+"\t" list += indent2+"BBLMLanguageSuffix\r" list += indent2+".ipf\r" list += indent+"\r" list += prefix+"\r" return list End Function/S MakeBBLMPredefinedNameList(String prefix) String list = prefix+"BBLMPredefinedNameList\r" list += prefix+"\r" String indent = prefix+"\t" // things that aren't in FunctionList or OperationList: Igor colors these medium magenta list += indent+"define\r" list += indent+"include\r" list += indent+"pragma\r" list += indent+"undef\r" // flow control: Igor colors these blue String flow = "AbortOnRTE;AbortOnValue;catch;continue;do;while;try;endtry;for;endfor;" flow += "if;elseif;else;endif;strswitch;case;break;default;endswitch;return;" // Structure (and Object Reference Keywords): Igor colors these blue String str="End;EndMacro;Structure;EndStructure;Picture;Menu;Submenu;Constant;StrConstant;Static;Override;" str += "String;Variable;WAVE;FUNCREF;DFREF;NVAR;SVAR;STRUCT;" // Subtypes String sub="" // (No: Igor doesn't color these) // sub += "ButtonControl;CameraWindow;CDFFunc;CheckboxControl;CursorStyle;DrawUserShape;FitFunc;" // sub += "GizmoPlot;Graph;GraphStyle;GridStyle;Layout;LayoutStyle;" // sub += "ListBoxControl;Panel;PopupMenuControl;SetVariableControl;SliderControl;TabControl;Table;TableStyle;" // the IgorExchange file I downloaded listed fixed-name hook functions like AfterFileOpenHook, etc. // Until one of these are compiled, they're colored black; after compilation they're purple. String hooks="AfterCompiledHook;AfterMDIFrameSizedHook;AfterWindowCreatedHook;BeforeDebuggerOpensHook;" hooks += "BeforeExperimentSaveHook;BeforeFileOpenHook;BeforeUncompiledHook;IgorBeforeNewHook;" hooks += "IgorBeforeQuitHook;IgorMenuHook;IgorQuitHook;IgorStartOrNewHook;" String funcs= FunctionList("*", ";", "KIND:1" ) // built in only: Igor colors these medium brown String ops = OperationList("*", ";", "internal") // Igor colors these medium green // Sort the flow, structure, hook, subtype, function, and operation names together String all = SortList(flow+str+hooks+sub+funcs+ops, ";", 4) Variable nitems= ItemsInList(all) // a simplistic way would iterate all and append to the list. // We'll use replaceString for speed String sorted = indent+"" + ReplaceString(";", all, "\r"+prefix+"\t") // remove last unmatched String cleaned = RemoveListItem(nitems, sorted, "\r") // Finish Array list += cleaned + prefix+"\r" return list End Function/S MakeBBLMKeywordList(String prefix) String list=prefix+"BBLMKeywordList\r" list+=prefix+"\r" String indent = prefix+"\t" list += indent+"End\r" // also in BBLMPredefinedNameList! list += indent+"EndMacro\r" list += indent+"Function\r" list += indent+"Macro\r" list += indent+"Proc\r" // this was missing list += indent+"Window\r" // the IgorExchange .plist had these in the BBLMPredefinedNameList! list += indent+"if\r" list += indent+"else\r" list += indent+"endif\r" list += indent+"elseif\r" list += indent+"for\r" list += indent+"endfor\r" // Finish Array list += prefix+"\r" return list End #if 0 // Igor function/proc matching syntax created using RegexBuddy on PC (recommended) Function Pattern (?: ^[ \t]* # start of entire function/proc etc capture, allow optional leading spaces (?: # function or macro or proc or window group (?: # function group (?: (?: Static | Override) [ \t]+ ){0,1} # function preamble function [ \t]* # "function" literal with optional spaces after (?: # optional [Wave w] or /S follows (?: \[ [^\]]*? \] ) | (?: (?: \/ \w+ [ \t] ) ) ){0,1}? ) | macro [ \t] | proc [ \t] | window [ \t] # require one space after Macro, Proc, or Window ) [ \t]* # allow additional space(s) (?P \w+ ) [ \t]* \( .*? \) # capture function name, optional space, opening paren, params, closing paren ) (?s:.+?) # matches end of function/macro line and following code lines [\n]*? [ \t]* (?: endmacro \b | end \b) # last line of function/Macro ) ) ]]> #endif Function/S MakeBBLMLanguageFeatures(String prefix) String list = prefix+"Language Features\r" list += prefix+"\r" String indent = prefix+"\t" list += indent+"Identifier and Keyword Characters\r" list += indent+"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz.\r" // . char to support struct.field syntax? list += indent+"Comment Pattern\r" list += indent+"(?>//.*$)\r" list += MakeBBLMFunctionPattern(indent) list += MakeBBLMSkipPattern(indent) list += MakeBBLMStringPattern(indent) list += prefix+"\r" return list End Function/S MakeBBLMFunctionPattern(String prefix) String list = prefix+"Function Pattern\r" list += prefix+"(?: ^[ \\t]* # start of entire function/proc etc capture, allow optional leading spaces\r" list += indent+" (?: # function or macro or proc or window group\r" list += indent+" (?: # function group\r" list += indent+" (?: (?: Static | Override) [ \\t]+ ){0,1} # function preamble\r" list += indent+" function [ \\t]* # \"function\" literal with optional spaces after\r" list += indent+" (?: # optional [Wave w] or /S follows\r" list += indent+" (?: \\[ [^\\]]*? \\] ) | (?: (?: \\/ \\w+ [ \\t] ) )\r" list += indent+" ){0,1}?\r" list += indent+" )\r" list += indent+" | macro [ \\t] | proc [ \\t] | window [ \\t] # require one space after Macro, Proc, or Window\r" list += indent+" )\r" list += indent+" [ \\t]* # allow additional space(s)\r" list += indent+" (?P \\w+ ) [ \\t]* \\( .*? \\) # capture function name, optional space, opening paren, params, closing paren\r" list += indent+" )\r" list += indent+" (?s:.+?) # matches end of function/macro line and following code lines\r" list += indent+" [\\n]*? [ \\t]* (?: endmacro \\b | end \\b) # last line of function/Macro\r" list += indent+" )\r" list += indent+")\r" list += prefix+"]]>\r" return list End Function/S MakeBBLMSkipPattern(String prefix) String list = prefix+"Skip Pattern\r" list += prefix+"(?x:\r" String indent = prefix+"\t" list += indent+"(?> (?P>comment) | (?P>string) )\r" list += prefix+")\r" return list End Function/S MakeBBLMStringPattern(String prefix) String list = prefix+"String Pattern\r" list += prefix+"(?x:\r" String indent = prefix+"\t" list += indent+"(?> " (?s: \\\\. | [^"] )*? (?: " | $) ) | \r" list += indent+"(?> ' (?s: \\\\. | [^'] )*? (?: ' | $) )\r" list += prefix+")\r" return list End