about summary refs log tree commit diff
diff options
context:
space:
mode:
authorLluís Batlle i Rossell <viric@vicerveza.homeunix.net>2011-10-14 07:47:20 +0000
committerLluís Batlle i Rossell <viric@vicerveza.homeunix.net>2011-10-14 07:47:20 +0000
commitdbdfb3d11cb6ea5f3cc5d5ea776d703d51827ed8 (patch)
tree80d634be0382bbd66b185523dd83101b55e11c18
parentdbdcb3fad435fc531e0bfc71e1b93cc0ff5b0882 (diff)
Adding cbrowser. Have cscope on the path to use it (which you should already
have, because otherwise how would you have created the database for cbrowser?)

svn path=/nixpkgs/trunk/; revision=29831
-rw-r--r--pkgs/development/tools/misc/cbrowser/backslashes-quotes.diff49
-rw-r--r--pkgs/development/tools/misc/cbrowser/default.nix34
-rw-r--r--pkgs/top-level/all-packages.nix2
3 files changed, 85 insertions, 0 deletions
diff --git a/pkgs/development/tools/misc/cbrowser/backslashes-quotes.diff b/pkgs/development/tools/misc/cbrowser/backslashes-quotes.diff
new file mode 100644
index 0000000000000..cc42f0745da53
--- /dev/null
+++ b/pkgs/development/tools/misc/cbrowser/backslashes-quotes.diff
@@ -0,0 +1,49 @@
+Based on this:
+http://sourceforge.net/tracker/?func=detail&aid=1493886&group_id=5152&atid=305152
+fix the infinite loops in quote highlight - ID: 1493886
+
+--- cbrowser-0.8-2/ftcllib.tcl	2000-07-04 01:17:43.000000000 +0200
++++ cbrowser-0.8/ftcllib.tcl	2006-05-24 00:39:18.833762522 +0200
+@@ -1290,13 +1290,39 @@
+   foreach {start end} [concat 1.0 [$widget tag ranges comment] end] {
+ 
+     while {[set temp [$widget search -regexp -- $pattern $start $end]] != ""} {
++      set startquote [$widget index "$temp + 1chars"]
+ 
+-      set endquote [$widget search -regexp -- {[^\\]\"} "$temp + 1chars" $end]
++      set temp [$widget index "$startquote + 1chars"]
++      while {1==1} {
++        set endquote [$widget search -regexp -- {\"} $temp $end]
++
++	# The program will not break if a /*C comment*/ is between C quotes.
++	if { $endquote == "" } {
++	  set endquote $startquote
++	  break
++	}
++
++        # look for double backslashes
++	if {[set temp2 [$widget search -regexp -- {\\\\} $temp $endquote]] != ""} {
++	  set temp "$temp2 + 2chars"
++	  continue
++	}
++        
++        # look for \"
++	if {[set temp2 [$widget search -regexp -- {\\\"} $temp $endquote]] != ""} {
++	  set temp "$temp2 + 2chars"
++	  continue
++	}
++
++	break
++      }
+ 
+       if {[strlen $endquote] > 0} {
+-        set start [$widget index "$endquote + 2chars"]
++        set start [$widget index "$endquote + 1chars"]
+ 
+-        $widget tag add quote "$temp + 1chars" $start
++        $widget tag add quote $startquote $start
++      } else {
++        set start [$widget index "$start + 1chars"]
+       }
+     }
+   }
diff --git a/pkgs/development/tools/misc/cbrowser/default.nix b/pkgs/development/tools/misc/cbrowser/default.nix
new file mode 100644
index 0000000000000..50dc907a78043
--- /dev/null
+++ b/pkgs/development/tools/misc/cbrowser/default.nix
@@ -0,0 +1,34 @@
+{ fetchurl, stdenv, cscope, tk, makeWrapper }:
+
+stdenv.mkDerivation rec {
+  name = "cbrowser-0.8";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/cbrowser/cbrowser-0.8.tar.gz";
+    sha256 = "1050mirjab23qsnq3lp3a9vwcbavmh9kznzjm7dr5vkx8b7ffcji";
+  };
+
+  patches = [ ./backslashes-quotes.diff ];
+
+  buildInputs = [ tk makeWrapper ];
+
+  installPhase = ''
+    ensureDir $out/bin $out/share/${name}
+    cp -R * $out/share/${name}/
+
+    makeWrapper $out/share/${name}/cbrowser $out/bin/cbrowser \
+      --prefix PATH : ${tk}/bin
+  '';
+
+  meta = {
+    description = "Tcl/Tk GUI front-end to cscope";
+
+    license = "GPLv2+";
+
+    homepage = http://sourceforge.net/projects/cbrowser/;
+
+    maintainers = with stdenv.lib.maintainers; [viric];
+
+    platforms = with stdenv.lib.platforms; linux;
+  };
+}
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index d4dc2123778d5..1551ff9aba1fe 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -2764,6 +2764,8 @@ let
 
   byacc = callPackage ../development/tools/parsing/byacc { };
 
+  cbrowser = callPackage ../development/tools/misc/cbrowser { };
+
   ccache = callPackage ../development/tools/misc/ccache { };
 
   complexity = callPackage ../development/tools/misc/complexity { };