summaryrefslogtreecommitdiff
path: root/gtk/genmarshal.pl
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@gtk.org>1998-09-20 14:58:08 +0000
committerOwen Taylor <otaylor@src.gnome.org>1998-09-20 14:58:08 +0000
commit104e5d2cc68e4fa1843edc160ee8a0ebd22333be (patch)
tree0ccfbdf2118343db0061c7db1d62f980a49f67ca /gtk/genmarshal.pl
parentfd69dc379afc5ff7711dee3189deecf62affc0a9 (diff)
downloadgtk+-104e5d2cc68e4fa1843edc160ee8a0ebd22333be.tar.gz
indent other than GNU indent should be OK now.
Sun Sep 20 09:52:39 1998 Owen Taylor <otaylor@gtk.org> * HACKING: indent other than GNU indent should be OK now. * gtk/genmarshal.pl gtk/Makefile.am: Call indent on file instead of piping through indent. If indent wasn't found in ./configure don't bother indenting at all.
Diffstat (limited to 'gtk/genmarshal.pl')
-rwxr-xr-xgtk/genmarshal.pl20
1 files changed, 17 insertions, 3 deletions
diff --git a/gtk/genmarshal.pl b/gtk/genmarshal.pl
index 23c0e4a942..475e4b456b 100755
--- a/gtk/genmarshal.pl
+++ b/gtk/genmarshal.pl
@@ -21,10 +21,20 @@
);
$srcdir = $ENV{'srcdir'} || '.';
+$indent = $ENV{'INDENT'};
+
+sub indent {
+ my $filename = shift;
+ if (defined($indent) && $indent ne "") {
+ system($indent, $filename);
+ # we try the most likely names for backup files
+ system("rm", "-f", "$filename.bak", "$filename~");
+ }
+}
open(IL, "<$srcdir/gtkmarshal.list") || die("Open failed: $!");
-open(OH, "|indent > $srcdir/gtkmarshal.h") || die("Open failed: $!");
-open(OS, "|indent > $srcdir/gtkmarshal.c") || die("Open failed: $!");
+open(OH, ">$srcdir/gtkmarshal.h") || die("Open failed: $!");
+open(OS, ">$srcdir/gtkmarshal.c") || die("Open failed: $!");
print OH <<EOT;
#ifndef __GTKMARSHAL_H__
@@ -44,7 +54,8 @@ EOT
print OS qq(#include "gtkmarshal.h"\n\n);
-while(chomp($aline = <IL>)) {
+while (defined($aline = <IL>)) {
+ chomp $aline;
($retval, $paramlist) = split(/:/, $aline, 2);
@params = split(/\s*,\s*/, $paramlist);
@@ -190,3 +201,6 @@ print OH <<EOT;
EOT
close(IL); close(OH); close(OS);
+
+indent("$srcdir/gtkmarshal.h");
+indent("$srcdir/gtkmarshal.c");