Tools__TagList.st
branchjv
changeset 12406 1fbd331e4489
parent 12401 4714b9640528
parent 12405 76f9a872362b
child 12431 9f0c59c742d5
--- a/Tools__TagList.st	Mon Feb 04 23:58:23 2013 +0100
+++ b/Tools__TagList.st	Fri Feb 08 08:51:42 2013 +0100
@@ -1621,7 +1621,7 @@
 
     |lcSuffix shellCommand isCSuffix isCPlusPlusSuffix isJavaSuffix isEiffelSuffix isFortranSuffix
      isTCLSuffix isRubySuffix isPythonSuffix isPhpSuffix isJavaScriptSuffix
-     showOnly response suff fn|
+     showOnly response suff fn langValue langOption moreOptions|
 
     ctagsCommand isNil ifTrue:[
         remoteTarget isNil ifTrue:[
@@ -1674,16 +1674,29 @@
         ].
     ].
 
+    ctagsIsExCtags5x ifTrue:[
+        langOption := '--language-force=%1'.
+    ] ifFalse:[ ctagsIsExCtags ifTrue:[
+        langOption := '--lang=%1'.
+    ]].
+
     shellCommand := ctagsCommand.
     (shellCommand includes:Character space) ifTrue:[
         shellCommand := '"',shellCommand,'"'.
     ].
+    moreOptions := ''.
 
     showOnly := self showOnly.
 
     lcSuffix := aFilenameString asFilename suffix asLowercase.
-
     isCSuffix := self class isCSuffix:lcSuffix.
+
+    "/ a hack for temporary files generated by stc
+    lcSuffix = 'sc' ifTrue:[
+        (aFilenameString asFilename asAbsoluteFilename components includes:'stx') ifTrue:[
+            isCSuffix := true
+        ].
+    ].
     isCPlusPlusSuffix := self class isCPlusPlusSuffix:lcSuffix.
 
     (shellCommand notNil and:[(ctagsIsExCtags ? false)]) ifTrue:[
@@ -1718,122 +1731,130 @@
 
         (isCSuffix or:[isCPlusPlusSuffix]) ifTrue:[
             isCPlusPlusSuffix 
-                ifTrue:[ shellCommand := shellCommand, ' --lang=c++']
-                ifFalse:[ shellCommand := shellCommand, ' --lang=c'].
+                ifTrue:[ langValue := 'c++']
+                ifFalse:[ langValue := 'c'].
 
             showOnly == #classes ifTrue:[
-                shellCommand := shellCommand, ' --c-types=c'
+                moreOptions := moreOptions, ' --c-types=c'
             ] ifFalse:[
                 showOnly == #functions ifTrue:[
-                    shellCommand := shellCommand, ' --c-types=f'
+                    moreOptions := moreOptions, ' --c-types=f'
                 ] ifFalse:[
                     showOnly == #functionsAndVariables ifTrue:[
-                        shellCommand := shellCommand, ' --c-types=fv'
+                        moreOptions := moreOptions, ' --c-types=fv'
                     ] ifFalse:[
                         showOnly == #classesFunctionsAndVariables ifTrue:[
-                            shellCommand := shellCommand, ' --c-types=cfv'
+                            moreOptions := moreOptions, ' --c-types=cfv'
                         ] ifFalse:[
                             showOnly == #variables ifTrue:[
-                                shellCommand := shellCommand, ' --c-types=v'
+                                moreOptions := moreOptions, ' --c-types=v'
                             ] ifFalse:[
                                 showOnly == #types ifTrue:[
-                                    shellCommand := shellCommand, ' --c-types=t'
+                                    moreOptions := moreOptions, ' --c-types=t'
                                 ] 
                             ] 
                         ] 
                     ] 
                 ] 
             ]. 
-            hideStructMembers == true ifTrue:[ shellCommand := shellCommand, ' --c-types=-m'].
-            hideDefines == true ifTrue:[ shellCommand := shellCommand, ' --c-types=-d' ].
-            hideTypedefs == true ifTrue:[ shellCommand := shellCommand, ' --c-types=-t' ].
-            hideStructures == true ifTrue:[ shellCommand := shellCommand, ' --c-types=-s'].
-            hideVariables == true ifTrue:[ shellCommand := shellCommand, ' --c-types=-v'].
-            hideFunctions == true ifTrue:[ shellCommand := shellCommand, ' --c-types=-f'].
-            hideClasses == true ifTrue:[ shellCommand := shellCommand, ' --c-types=-c'].
+            hideStructMembers == true ifTrue:[ moreOptions := moreOptions, ' --c-types=-m'].
+            hideDefines == true ifTrue:[ moreOptions := moreOptions, ' --c-types=-d' ].
+            hideTypedefs == true ifTrue:[ moreOptions := moreOptions, ' --c-types=-t' ].
+            hideStructures == true ifTrue:[ moreOptions := moreOptions, ' --c-types=-s'].
+            hideVariables == true ifTrue:[ moreOptions := moreOptions, ' --c-types=-v'].
+            hideFunctions == true ifTrue:[ moreOptions := moreOptions, ' --c-types=-f'].
+            hideClasses == true ifTrue:[ moreOptions := moreOptions, ' --c-types=-c'].
         ].
 
         isJavaSuffix ifTrue:[
-            shellCommand := shellCommand, ' --lang=java'.
+            langValue := 'java'.
 
             showOnly == #javaClasses ifTrue:[
-                shellCommand := shellCommand, ' --java-types=c'
+                moreOptions := moreOptions, ' --java-types=c'
             ] ifFalse:[
                 showOnly == #javaMethods ifTrue:[
-                    shellCommand := shellCommand, ' --java-types=m'
+                    moreOptions := moreOptions, ' --java-types=m'
                 ] ifFalse:[
                     showOnly == #javaClassesAndMethods ifTrue:[
-                        shellCommand := shellCommand, ' --java-types=mc'
+                        moreOptions := moreOptions, ' --java-types=mc'
                     ]
                 ]
             ]. 
-            hideJavaClasses == true ifTrue:[ shellCommand := shellCommand, ' --java-types=-c' ].
-            hideJavaMethods == true ifTrue:[ shellCommand := shellCommand, ' --java-types=-m' ].
-            hideJavaInterfaces == true ifTrue:[ shellCommand := shellCommand, ' --java-types=-i' ].
-            hideJavaFields == true ifTrue:[ shellCommand := shellCommand, ' --java-types=-f' ].
-            hideJavaPackages == true ifTrue:[ shellCommand := shellCommand, ' --java-types=-p' ].
+            hideJavaClasses == true ifTrue:[ moreOptions := moreOptions, ' --java-types=-c' ].
+            hideJavaMethods == true ifTrue:[ moreOptions := moreOptions, ' --java-types=-m' ].
+            hideJavaInterfaces == true ifTrue:[ moreOptions := moreOptions, ' --java-types=-i' ].
+            hideJavaFields == true ifTrue:[ moreOptions := moreOptions, ' --java-types=-f' ].
+            hideJavaPackages == true ifTrue:[ moreOptions := moreOptions, ' --java-types=-p' ].
         ].
 
         isEiffelSuffix ifTrue:[
-            shellCommand := shellCommand, ' --lang=eiffel'.
+            langValue := 'eiffel'.
 
             showOnly == #classes ifTrue:[ 
-                shellCommand := shellCommand, ' --eiffel-types=c' 
+                moreOptions := moreOptions, ' --eiffel-types=c' 
             ] ifFalse:[
                 showOnly == #features ifTrue:[
-                    shellCommand := shellCommand, ' --eiffel-types=f'
+                    moreOptions := moreOptions, ' --eiffel-types=f'
                 ]
             ]. 
 "/            hideEiffelClasses == true ifTrue:[
-"/                shellCommand := shellCommand, ' --eiffel-types=-c'
+"/                moreOptions := moreOptions, ' --eiffel-types=-c'
 "/            ].
 "/            hideEiffelFeatures == true ifTrue:[
-"/                shellCommand := shellCommand, ' --eiffel-types=-m'
+"/                moreOptions := moreOptions, ' --eiffel-types=-m'
 "/            ].
         ].
 
         isFortranSuffix ifTrue:[
-            shellCommand := shellCommand, ' --lang=fortran'.
+            langValue := 'fortran'.
 
             showOnly == #functions ifTrue:[
-                shellCommand := shellCommand, ' --fortran-types=f'
+                moreOptions := moreOptions, ' --fortran-types=f'
             ] ifFalse:[
                 showOnly == #interfaces ifTrue:[
-                    shellCommand := shellCommand, ' --fortran-types=i'
+                    moreOptions := moreOptions, ' --fortran-types=i'
                 ] ifFalse:[
                     showOnly == #subroutines ifTrue:[
-                        shellCommand := shellCommand, ' --fortran-types=s'
+                        moreOptions := moreOptions, ' --fortran-types=s'
                     ] ifFalse:[
                         showOnly == #commonBlocks == true ifTrue:[
-                            shellCommand := shellCommand, ' --fortran-types=c'
+                            moreOptions := moreOptions, ' --fortran-types=c'
                         ]
                     ]
                 ]
             ]. 
 "/            hideFortranFunctions == true ifTrue:[
-"/                shellCommand := shellCommand, ' --fortran-types=-f'
+"/                moreOptions := moreOptions, ' --fortran-types=-f'
 "/            ].
 "/            hideFortranInterfaces == true ifTrue:[
-"/                shellCommand := shellCommand, ' --fortran-types=-i'
+"/                moreOptions := moreOptions, ' --fortran-types=-i'
 "/            ].
 "/            hideFortranSubroutines == true ifTrue:[
-"/                shellCommand := shellCommand, ' --fortran-types=-s'
+"/                moreOptions := moreOptions, ' --fortran-types=-s'
 "/            ].
 "/            hideFortranCommonBlocks == true ifTrue:[
-"/                shellCommand := shellCommand, ' --fortran-types=-c'
+"/                moreOptions := moreOptions, ' --fortran-types=-c'
 "/            ].
 "/            hideFortranEntryPoints == true ifTrue:[
-"/                shellCommand := shellCommand, ' --fortran-types=-e'
+"/                moreOptions := moreOptions, ' --fortran-types=-e'
 "/            ].
 "/            hideFortranLabels == true ifTrue:[
-"/                shellCommand := shellCommand, ' --fortran-types=-l'
+"/                moreOptions := moreOptions, ' --fortran-types=-l'
 "/            ].
 "/            hideFortranDerivedTypes == true ifTrue:[
-"/                shellCommand := shellCommand, ' --fortran-types=-t'
+"/                moreOptions := moreOptions, ' --fortran-types=-t'
 "/            ].
         ].
 
 "/            shellCommand := shellCommand, ' -f -'.
+        langValue notNil ifTrue:[
+            langOption notNil ifTrue:[
+                shellCommand := shellCommand , ' ' , (langOption bindWith:langValue)
+            ].
+        ].
+        moreOptions notEmptyOrNil ifTrue:[
+            shellCommand := shellCommand , moreOptions
+        ].
         shellCommand := shellCommand, ' "%1"'.
         remoteTarget notNil ifTrue:[
             ^ (remoteTarget makeRemoteCommandFrom:shellCommand inDirectory:'./').
@@ -2061,7 +2082,7 @@
         list := self getTagListFromFile:aFile usingCommand:shellCmd mode:nil in:aTempDirectory
     ].
 
-    "/ incase ctags could not find anything, try our own, naive fallback (not too bad either)
+    "/ in case ctags could not find anything, try our own, naive fallback (not too bad either)
     list isEmptyOrNil ifTrue:[
         list := self getSimpleTagListFromFile:aFile in:aTempDirectory.
     ].
@@ -3656,11 +3677,11 @@
 !TagList class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/Tools__TagList.st,v 1.22 2013-01-24 17:07:06 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/Tools__TagList.st,v 1.25 2013-01-29 11:10:00 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libtool/Tools__TagList.st,v 1.22 2013-01-24 17:07:06 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/Tools__TagList.st,v 1.25 2013-01-29 11:10:00 cg Exp $'
 !
 
 version_SVN