summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornanbor <nanbor@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-06-20 05:10:32 +0000
committernanbor <nanbor@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-06-20 05:10:32 +0000
commitc55a1223e913c285cb16ed10e3dd4e9a93c9ce39 (patch)
tree44af7cdf106e6122e834edf01922b3aef552e8e7
parent881d06e710c3872b9ab1284b3576ea25d38ffcf6 (diff)
downloadATCD-c55a1223e913c285cb16ed10e3dd4e9a93c9ce39.tar.gz
*** empty log message ***
-rwxr-xr-xbin/indent_macros.perl53
1 files changed, 53 insertions, 0 deletions
diff --git a/bin/indent_macros.perl b/bin/indent_macros.perl
new file mode 100755
index 00000000000..b7de22935f8
--- /dev/null
+++ b/bin/indent_macros.perl
@@ -0,0 +1,53 @@
+#!/pkg/gnu/bin/perl -i
+# This perl script re-arrange the macro indentation so it's easier to
+# see the layering relationship.
+# $Id$
+
+$indent = 0;
+
+sub inc_indent
+{
+ $indent += 2;
+}
+
+sub dec_indent
+{
+ $indent -= 2;
+}
+
+sub get_indent
+{
+ $retv = 0;
+ die ("Unbalanced macro pairs\n") if ($indent < 0);
+ $retv = $indent - 1 if ($indent > 0);
+ $retv;
+}
+
+while (<>) {
+ if (/[ \t]*\#[ \t]*((if|el|en|).*)/)
+ {
+ $cont = $1;
+ $temp = $2;
+ if ($temp =~ /if/) {
+ print "#", " " x &get_indent (), $cont,"\n";
+ inc_indent ();
+ }
+ elsif ($temp =~ /el/) {
+ dec_indent ();
+ print "#", " " x &get_indent (), $cont,"\n";
+ inc_indent ();
+ }
+ elsif ($temp =~ /en/) {
+ dec_indent ();
+ print "#", " " x &get_indent (), $cont,"\n";
+ }
+ else {
+ print "#", " " x &get_indent (), $cont,"\n";
+ }
+ }
+ else {
+ print $_;
+ }
+}
+
+die ("Unbalanced macro pairs\n") if ($indent < 0);