Merge jv
authorJan Vrany <jan.vrany@fit.cvut.cz>
Wed, 13 Apr 2016 09:20:33 +0100
branchjv
changeset 16285 7009be618265
parent 16284 c2ddee4e07fa (current diff)
parent 16283 a0933d5dc2c1 (diff)
child 16286 845a3d624cb7
Merge
Tools__NewSystemBrowser.st
Tools__TagList.st
Tools__TagsBrowser.st
extensions.st
--- a/Tools__NewSystemBrowser.st	Sat Apr 09 08:55:09 2016 +0100
+++ b/Tools__NewSystemBrowser.st	Wed Apr 13 09:20:33 2016 +0100
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
 "
  COPYRIGHT (c) 2000 by eXept Software AG
               All Rights Reserved
@@ -45745,7 +45747,7 @@
                 ChangeSet current includesChangeForClass:m mclass selector:m selector
             ]
         ) ifTrue:[
-            (self confirm:'Versions are identical.\\Remove entries from changeSet ?' withCRs)
+            (self confirm:'Versions are identical.\\Remove entries from changeSet?' withCRs)
             ifTrue:[
                 methods do:[:m |
                     ChangeSet current condenseChangesForClass:m mclass selector:m selector.
@@ -51241,7 +51243,7 @@
             label:[:chg | 
                 |lbl|
                 "/ lbl := chg printString
-                lbl := (chg className ? '???') , '  ' , (chg selector  ? '???') allBold.
+                lbl := (chg className ? '???') , ' ยป ' , (chg selector  ? '???') allBold.
                 (chg isMethodChange and:[chg changeMethod isNil]) ifTrue:[
                     lbl := lbl asText allStrikedOut,' ','(removed)' allItalic.
                 ].    
@@ -58485,7 +58487,6 @@
     "Created: / 04-12-2011 / 22:22:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
-
 !NewSystemBrowser methodsFor:'private-semantic checks'!
 
 checkAcceptedMethod:aMethod inClass:aClass
--- a/Tools__TagList.st	Sat Apr 09 08:55:09 2016 +0100
+++ b/Tools__TagList.st	Wed Apr 13 09:20:33 2016 +0100
@@ -65,6 +65,7 @@
     TagsSuffixes at:#'text/asm'                 put:#( 's' 'asm' ).
     TagsSuffixes at:#'text/c'                   put:#( 'c' 'h' 'ci' 'hi' 'sc' 'sth').
     TagsSuffixes at:#'text/cpp'                 put:#( 'cc' 'cpp' 'cxx' 'c++' 'hxx' 'hpp' 'h++').
+    TagsSuffixes at:#'text/x-objcsrc'           put:#( 'm').
     TagsSuffixes at:#'text/eiffel'              put:#( 'e' 'eif' ).
     TagsSuffixes at:#'text/fortran'             put:#( 'f' 'for' 'ftn' 'f77' 'f90' ).
     TagsSuffixes at:#'text/html'                put:#( 'htm' 'html').
@@ -203,6 +204,12 @@
     ^ self tagsSuffixes at:#'text/make'
 !
 
+objcSuffixes
+    "returns a list of supported c-suffixes"
+
+    ^ self tagsSuffixes at:#'text/x-objcsrc'
+!
+
 ozSuffixes
     "returns a list of supported oz-suffixes
     "
@@ -361,6 +368,10 @@
     ^ false
 !
 
+isObjcSuffix:suffix
+    ^ self isSuffix:suffix in:self objcSuffixes
+!
+
 isOzSuffix:suffix
     ^ self isSuffix:suffix in:self ozSuffixes
 !
@@ -1103,6 +1114,22 @@
     "Created: / 21-08-2012 / 21:01:38 / cg"
 !
 
+hideObjcClasses
+    ^ self flagNamed:#hideObjcClasses 
+!
+
+hideObjcClasses:aBoolean
+    self flagNamed:#hideObjcClasses put:aBoolean.
+!
+
+hideObjcMethods
+    ^ self flagNamed:#hideObjcMethods 
+!
+
+hideObjcMethods:aBoolean
+    self flagNamed:#hideObjcMethods put:aBoolean.
+!
+
 hideOzClasses
     ^ self flagNamed:#hideOzClasses 
 !
@@ -1708,7 +1735,8 @@
      When first called, looks for ctags (both a private and the system-supplied),
      and tries to see what version that is. I prefer exuberant ctags version"
 
-    |lcSuffix shellCommand isCSuffix isCPlusPlusSuffix isJavaSuffix isEiffelSuffix isFortranSuffix
+    |lcSuffix shellCommand isCSuffix isCPlusPlusSuffix isObjcSuffix
+     isJavaSuffix isEiffelSuffix isFortranSuffix
      isTCLSuffix isRubySuffix isPythonSuffix isPhpSuffix isJavaScriptSuffix
      showOnly response suff fn langValue langOption moreOptions|
 
@@ -1799,6 +1827,7 @@
         ].
     ].
     isCPlusPlusSuffix := self class isCPlusPlusSuffix:lcSuffix.
+    isObjcSuffix := self class isObjcSuffix:lcSuffix.
 
     (shellCommand notNil and:[(ctagsIsExCtags ? false)]) ifTrue:[
         isJavaSuffix := self class isJavaSuffix:lcSuffix.
@@ -1806,7 +1835,8 @@
         isFortranSuffix := self class isFortranSuffix:lcSuffix.
 
         "/ ex_ctags supports c, c++, java, fortran and a few others
-        (isCSuffix or:[isCPlusPlusSuffix or:[isJavaSuffix or:[isEiffelSuffix or:[isFortranSuffix]]]]) ifFalse:[
+        (isCSuffix or:[isCPlusPlusSuffix or:[isObjcSuffix
+        or:[isJavaSuffix or:[isEiffelSuffix or:[isFortranSuffix]]]]]) ifFalse:[
             (ctagsIsExCtags5x ? false) ifFalse:[
                 ^ nil
             ].
@@ -1830,7 +1860,7 @@
 "/            shellCommand := shellCommand, ' -f - --file-scope=yes'.
         shellCommand := shellCommand, ' -f - --file-scope=yes --excmd=number'.
 
-        (isCSuffix or:[isCPlusPlusSuffix]) ifTrue:[
+        (isCSuffix or:[isCPlusPlusSuffix or:[isObjcSuffix]]) ifTrue:[
             isCPlusPlusSuffix 
                 ifTrue:[ langValue := 'c++']
                 ifFalse:[ langValue := 'c'].
@@ -2238,7 +2268,19 @@
         shellCmd notNil ifTrue:[
             tagTypesPresent := false.     "/ will be set again, when ctags command provides types
             list := ((self getTagListFromFile:aFile usingCommand:shellCmd mode:nil in:aTempDirectory) ? #()) asOrderedCollection.
-            list addAll:(self getAdditionalCTagsInFile:aFile withList:list)
+            "/ kludge: I am better in getting cases/switches/labels
+            list addAll:(self getAdditionalCTagsInFile:aFile withList:list).
+            "/ another kludge - add in my own scanned objc tags
+            (self class isObjcSuffix:aFile suffix) ifTrue:[
+                |objcTags|
+                
+                objcTags := self objcTagsInFile:aFile.
+                list 
+                    removeAllSuchThat:[:ctag | 
+                        objcTags contains:[:objctag | objctag lineNumber = ctag lineNumber]
+                    ].
+                list addAll:objcTags.    
+            ].    
         ].
     ].
 
@@ -3063,6 +3105,11 @@
         "/ lisp tags - simulated
         ^ self lispTagsInFile:pathName
     ].
+    ((self class isObjcSuffix:suffix)
+    or:[(mime ? '') includesString:'objcsrc']) ifTrue:[
+        "/ objc tags - simulated
+        ^ self objcTagsInFile:pathName
+    ].
     ((self class isOzSuffix:suffix)
     or:[(mime ? '') includesString:'oz']) ifTrue:[
         "/ oz tags - simulated
@@ -3634,6 +3681,71 @@
               ]
 !
 
+objcTagFromLine:line lineNr:lineNr
+    "objc tags:
+     naive, q&d scan for lines starting with some common patterns"
+
+    |l nm lineStream kwLen type hideHolder skipType|
+
+    l := line withoutSeparators.
+    skipType := false.
+    
+    (l startsWith:'@interface') ifTrue:[
+        kwLen := '@interface' size.
+        type := Tag::TInterface.
+        hideHolder := self hideObjcClasses.
+    ].
+    (l startsWith:'@implementation') ifTrue:[
+        kwLen := '@implementation' size.
+        type := Tag::TClass.
+        hideHolder := self hideObjcClasses.
+    ].
+    (l startsWith:'@property') ifTrue:[
+        kwLen := '@property' size.
+        type := Tag::TMacro.
+    ].
+    (l startsWithAnyOf:'+-') ifTrue:[
+        kwLen := 1.
+        type := Tag::TMethod.
+        hideHolder := self hideObjcMethods.
+        skipType := true.
+    ].
+    hideHolder value ~~ true ifTrue:[
+        kwLen notNil ifTrue:[
+            lineStream := l readStream.
+            lineStream skip:kwLen; skipSeparators.
+            skipType ifTrue:[
+                lineStream peek == $( ifTrue:[
+                    lineStream next. lineStream skipThrough:$).
+                    lineStream skipSeparators.
+                ].    
+            ].
+            
+            nm := lineStream upToElementForWhich:[:ch | (ch isLetterOrDigit or:['_' includes:ch]) not].
+            (nm notEmpty and:[nm first isLetterOrUnderline]) ifTrue:[    
+                ^ type 
+                                label:nm 
+                                pattern:nil
+                                type:nil
+                                lineNumber:lineNr.
+            ]
+        ].
+    ].
+    
+    ^ nil
+!
+
+objcTagsInFile:aFilePath
+    "objc tags:
+     naive, q&d scan for lines starting with some wellknown patterns"
+
+    ^ self
+        linewiseNaiveTagsInFile:aFilePath 
+        using:[:line :lineNr |
+                self objcTagFromLine:line lineNr:lineNr
+              ]
+!
+
 ozTagFromLine:line lineNr:lineNr
     "oz tags:
      naive, q&d scan for lines starting with:
--- a/Tools__TagsBrowser.st	Sat Apr 09 08:55:09 2016 +0100
+++ b/Tools__TagsBrowser.st	Wed Apr 13 09:20:33 2016 +0100
@@ -1037,6 +1037,12 @@
             isMenuSlice: true
           )
          (MenuItem
+            label: 'ObjC Menu Slice'
+            translateLabel: true
+            submenuChannel: objcMenuSlice
+            isMenuSlice: true
+          )
+         (MenuItem
             label: 'OZ Menu Slice'
             translateLabel: true
             submenuChannel: ozMenuSlice
@@ -1070,6 +1076,49 @@
     "Modified: / 21-08-2012 / 21:00:35 / cg"
 !
 
+objcMenuSlice
+    "This resource specification was automatically generated
+     by the MenuEditor of ST/X."
+
+    "Do not manually edit this!! If it is corrupted,
+     the MenuEditor may not be able to read the specification."
+
+    "
+     MenuEditor new openOnClass:Tools::TagsBrowser andSelector:#objcMenuSlice
+     (Menu new fromLiteralArrayEncoding:(Tools::TagsBrowser objcMenuSlice)) startUp
+    "
+
+    <resource: #menu>
+
+    ^
+     #(Menu
+        (
+         (MenuItem
+            label: '-'
+            isVisible: editedFileHasObjcSuffix
+          )
+         (MenuItem
+            enabled: tagTypesPresentHolder
+            label: 'Hide Classes'
+            translateLabel: true
+            isVisible: editedFileHasObjcSuffix
+            hideMenuOnActivated: false
+            indication: hideObjcClasses:
+          )
+         (MenuItem
+            enabled: tagTypesPresentHolder
+            label: 'Hide Methods'
+            translateLabel: true
+            isVisible: editedFileHasObjcSuffix
+            hideMenuOnActivated: false
+            indication: hideObjcMethods:
+          )
+         )
+        nil
+        nil
+      )
+!
+
 ozMenuSlice
     "This resource specification was automatically generated
      by the MenuEditor of ST/X."
@@ -1205,38 +1254,38 @@
      the MenuEditor may not be able to read the specification."
 
     "
-     MenuEditor new openOnClass:Tools::TagsBrowser andSelector:#ozMenuSlice
-     (Menu new fromLiteralArrayEncoding:(Tools::TagsBrowser ozMenuSlice)) startUp
+     MenuEditor new openOnClass:Tools::TagsBrowser andSelector:#smalltalkMenuSlice
+     (Menu new fromLiteralArrayEncoding:(Tools::TagsBrowser smalltalkMenuSlice)) startUp
     "
 
     <resource: #menu>
 
     ^
      #(Menu
-	(
-	 (MenuItem
-	    label: '-'
-	    isVisible: editedFileHasSmalltalkSuffix
-	  )
-	 (MenuItem
-	    enabled: tagTypesPresentHolder
-	    label: 'Hide Classes'
-	    translateLabel: true
-	    isVisible: editedFileHasSmalltalkSuffix
-	    hideMenuOnActivated: false
-	    indication: hideClasses:
-	  )
-	 (MenuItem
-	    enabled: tagTypesPresentHolder
-	    label: 'Hide Methods'
-	    translateLabel: true
-	    isVisible: editedFileHasSmalltalkSuffix
-	    hideMenuOnActivated: false
-	    indication: hideMethods:
-	  )
-	 )
-	nil
-	nil
+        (
+         (MenuItem
+            label: '-'
+            isVisible: editedFileHasSmalltalkSuffix
+          )
+         (MenuItem
+            enabled: tagTypesPresentHolder
+            label: 'Hide Classes'
+            translateLabel: true
+            isVisible: editedFileHasSmalltalkSuffix
+            hideMenuOnActivated: false
+            indication: hideClasses:
+          )
+         (MenuItem
+            enabled: tagTypesPresentHolder
+            label: 'Hide Methods'
+            translateLabel: true
+            isVisible: editedFileHasSmalltalkSuffix
+            hideMenuOnActivated: false
+            indication: hideMethods:
+          )
+         )
+        nil
+        nil
       )
 
     "Created: / 21-08-2012 / 20:59:28 / cg"
@@ -1829,6 +1878,15 @@
     "Created: / 21-08-2012 / 21:01:45 / cg"
 !
 
+hideObjcClasses
+    ^ tagList hideObjcClasses
+!
+
+hideObjcClasses:aBool
+    tagList hideObjcClasses:aBool.
+    self updateTagList
+!
+
 hideOzClasses
     ^ tagList hideOzClasses
 !
@@ -2250,6 +2308,10 @@
     ^builder booleanValueAspectFor: #editedFileHasLuaSuffix
 !
 
+editedFileHasObjcSuffix
+    ^builder booleanValueAspectFor: #editedFileHasObjcSuffix
+!
+
 editedFileHasOzSuffix
     ^builder booleanValueAspectFor: #editedFileHasOzSuffix
 !
@@ -2428,6 +2490,7 @@
           (editedFileHasEiffelSuffix    ('text/eiffel' 'application/x-eiffel-source'))
           (editedFileHasFortranSuffix   ('text/fortran' 'application/x-fortran-source'))
           (editedFileHasPythonSuffix    ('text/python' 'application/x-python-source'))
+          (editedFileHasObjcSuffix      ('text/objcsrc' 'application/x-objcsrc'))
           (editedFileHasOzSuffix        ('text/oz' 'application/x-oz-source'))
           (editedFileHasLuaSuffix       ('text/lua' 'application/x-lua-source'))
           (editedFileHasLispSuffix      ('text/lisp' 'text/lisp-arc' 'text/scheme' 'application/x-lisp-source' 'application/x-scheme-source') )
--- a/extensions.st	Sat Apr 09 08:55:09 2016 +0100
+++ b/extensions.st	Wed Apr 13 09:20:33 2016 +0100
@@ -441,18 +441,21 @@
 !CharacterArray methodsFor:'inspecting'!
 
 inspector2TabBytes
-
-    ^self newInspector2Tab
+    |bytesShown|
+    
+    "/ ouch - ever tried to inspect a 5Mb string?
+    self size < 10000 ifTrue:[
+        bytesShown := self
+    ] ifFalse:[
+        bytesShown := (self copyTo:10000)
+    ].
+    
+    ^ self newInspector2Tab
         label: 'Bytes';
         priority: 39;
         view: ((HVScrollableView for:EditTextView) 
                 autoHideVerticalScrollBar:true;        
-                contents: (self size < 10000 "/ ouch - ever tried to inspect a 5Mb string?
-                            ifTrue:[
-                                (self hexPrintStringWithSeparator:Character space)
-                            ] ifFalse:[
-                                ((self copyTo:10000) hexPrintStringWithSeparator:Character space),'...'
-                            ]); 
+                contents: (bytesShown asByteArray hexPrintStringWithSeparator:Character space); 
                 yourself)
 
     "Created: / 17-02-2008 / 10:10:50 / janfrog"