aboutsummaryrefslogtreecommitdiff
path: root/fixtags.pl
diff options
context:
space:
mode:
authorB. Watson <yalhcru@gmail.com>2016-02-04 03:55:58 -0500
committerB. Watson <yalhcru@gmail.com>2016-02-04 03:55:58 -0500
commitb6d1fb91ce749c996230df2e5ae7479759c11b53 (patch)
tree02937e8d8d23d6dce7e7f60f73a8720e118c8804 /fixtags.pl
parent920b831dde1764e84f1846ebe69a8e37483338b8 (diff)
downloadtaipan-b6d1fb91ce749c996230df2e5ae7479759c11b53.tar.gz
finally figured out a way to use ctags with mixed asm/C project
Diffstat (limited to 'fixtags.pl')
-rw-r--r--fixtags.pl25
1 files changed, 25 insertions, 0 deletions
diff --git a/fixtags.pl b/fixtags.pl
new file mode 100644
index 0000000..ce7567f
--- /dev/null
+++ b/fixtags.pl
@@ -0,0 +1,25 @@
+#!/usr/bin/perl -w
+
+# read a ctags file. for every tag found, create its
+# corresponding tag with or without leading _.
+# vim wants the tagfile sorted, so do that, too.
+
+$file = $ARGV[0];
+while(<>) {
+ push @tags, $_;
+ next if /^!/; # skip ctags magic tags
+
+ # skip C #defines
+ my @fields = split '\t';
+ next if $fields[1] =~ /\.c$/ && $fields[3] =~ /^d$/;
+
+ if(/^_/) {
+ s/^_//;
+ } else {
+ s/^/_/;
+ }
+ push @tags, $_;
+}
+
+open OUT, ">$file" or die $!;
+print OUT for sort @tags;