ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitAna/macros/doc/addDesc.sh
Revision: 1.3
Committed: Thu Jul 16 15:41:03 2009 UTC (15 years, 9 months ago) by loizides
Content type: application/x-sh
Branch: MAIN
Changes since 1.2: +42 -17 lines
Log Message:
Improved version.

File Contents

# User Rev Content
1 loizides 1.1 #!/bin/bash
2 loizides 1.3 # $Id: addDesc.sh,v 1.2 2009/07/16 13:39:12 loizides Exp $
3 loizides 1.1
4     hf=$1
5 loizides 1.2
6 loizides 1.3 if test -z "`echo $hf | grep TAM/`"; then
7     sf=`dirname $hf`/`basename $hf .h`.cc
8     sf=`echo $sf | replace interface src`
9    
10     if ! test -e $sf; then
11     echo "Did not find source file for ${hf}, exiting."
12     exit 123;
13     fi
14    
15     if test -e ${sf}.keep; then
16     echo "Modified source file for ${hf} already exists, exiting."
17     exit 123;
18     fi
19    
20     strs="//------------------------------"
21     lnum=`grep -n $strs $hf | cut -d: -f1 | head -n2 | tail -n1`
22    
23     if test -z $lnum; then
24     echo "Did not find header description for ${hf}, exiting."
25     exit 123;
26     fi
27    
28     head -n$lnum $hf > ${sf}.tmp
29     cat $sf | grep -v "// \$Id" >> ${sf}.tmp
30     mv ${sf} ${sf}.keep
31     mv ${sf}.tmp $sf
32     else
33     sf=`dirname $hf`/`basename $hf .h`.cxx
34     sf=`echo $sf | replace interface src`
35    
36     if ! test -e $sf; then
37     echo "Did not find source file for ${hf}, exiting."
38     exit 123;
39     fi
40 loizides 1.2
41 loizides 1.3 if test -e ${sf}.keep; then
42     echo "Modified source file for ${hf} already exists, exiting."
43     exit 123;
44     fi
45 loizides 1.1
46 loizides 1.3 cat $sf | replace "//////////////////////////////////////////////////////////////////////////" "//------------------------------------------------------------------------" > ${sf}.tmp
47     mv ${sf} ${sf}.keep
48     mv ${sf}.tmp $sf
49 loizides 1.1 fi