Author: bdonlan
Date: 2005-01-01 00:49:28 -0500 (Sat, 01 Jan 2005)
New Revision: 498
Added:
trunk/clients/havercurs/doc_copy.pl
Modified:
trunk/
Log:
[EMAIL PROTECTED]: bdonlan | 2005-01-01T05:49:11.074843Z
Added simple script to sync function documentation between headers and source
files
Property changes on: trunk
___________________________________________________________________
Name: svk:merge
- 1f59643a-e6e5-0310-bc24-f7d4c744f460:/haver/local/trunk:10263
27e50396-46e3-0310-8b22-ae223a1f35ce:/local:212
edfcd8bd-4ce7-0310-a97e-bb1efd40edf3:/local:238
+ 1f59643a-e6e5-0310-bc24-f7d4c744f460:/haver/local/trunk:10265
27e50396-46e3-0310-8b22-ae223a1f35ce:/local:212
edfcd8bd-4ce7-0310-a97e-bb1efd40edf3:/local:238
Added: trunk/clients/havercurs/doc_copy.pl
===================================================================
--- trunk/clients/havercurs/doc_copy.pl 2005-01-01 05:15:18 UTC (rev 497)
+++ trunk/clients/havercurs/doc_copy.pl 2005-01-01 05:49:28 UTC (rev 498)
@@ -0,0 +1,68 @@
+#!/usr/bin/perl
+# vim: set ts=4 sw=4 expandtab si ai sta tw=104:
+#
+# doc_copy.pl - copy docstrings from headers to source files
+#
+# Copyright (C) 2004 Bryan Donlan
+#
+# This module is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This module is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this module; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+use strict;
+use warnings;
+use IO::File;
+
+if (@ARGV != 3) {
+ die "Usage: $0 foo.h foo.c foo.c.out";
+}
+
+my %docstrings;
+
+my $fh = new IO::File($ARGV[0], "r") or die "$!";
+
+my $curdoc;
+
+while (<$fh>) {
+ if (defined $curdoc) {
+ if ($_ =~ m{^ \*[^/]}) {
+ $docstrings{$curdoc} .= $_;
+ } else {
+ undef $curdoc;
+ }
+ } else {
+ if ($_ =~ m{^/\*\* (.+)$}) {
+ if (exists $docstrings{$1}) {
+ die "Redefinition of docstring $1";
+ }
+ $curdoc = $1;
+ }
+ }
+}
+
+undef $fh;
+
+my $in = new IO::File($ARGV[1], "r") or die "$!";
+my $out = new IO::File($ARGV[2], "w") or die "$!";
+
+while (<$in>) {
+ print $out $_;
+ next unless m{^/\*\* (.+)$};
+ if (!defined $docstrings{$1}) {
+ warn "Unknown docstring $1";
+ next;
+ }
+ print $out $docstrings{$1};
+ while (($_ = <$in>) =~ m{^ \*[^/]}) {}
+ print $out $_;
+}
Property changes on: trunk/clients/havercurs/doc_copy.pl
___________________________________________________________________
Name: svn:eol-style
+ native