File: documentHeader.pl

package info (click to toggle)
coin3 4.0.6%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 53,416 kB
  • sloc: cpp: 256,463; ansic: 21,309; makefile: 8,662; sh: 3,141; perl: 1,504; lex: 1,372; lisp: 1,247; pascal: 961; xml: 604; yacc: 387; sed: 68
file content (36 lines) | stat: -rw-r--r-- 730 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/perl

use File::Find;
use File::Basename;

chdir(dirname($0));
chdir('..');

while (chomp($header=<>)) {
    $header=basename($header);
    $cppfile=$header;
    $cppfile=~s/(\.h$)/.cpp/;
    $cppfile=~s/SoVRML//;
    $found=0;
    find(\&wanted, '.');
    if (! $found) {
        print "${cppfile} not found\n";
        exit(1);
    }
}

sub wanted {
    if ($_ eq $cppfile) {
      $found=1;
      local $/;
      open(CPPFILE,"<$_");
      $lines=<CPPFILE>;
      close(CPPFILE);
      if (! ($lines=~/\/*!\s+\\file\s+/)) {
          $lines=~s/(#include\s+[<"].*?${header}[>"])/\/*! \\file ${header} *\/\n$1/g;
          open(CPPFILE,">$_");
          print CPPFILE $lines;
          close(CPPFILE);
      }
    }
}