Mercurial > hg > aimc
annotate C++/api/html/installdox @ 592:76c6b3fd0a05
First commit. Refer to the api [1] 'Philosophy of the implementation' for information on the approach used to implement CARFAC in C++.
[1] aimc/C++/api/html/index.html
author | flatmax |
---|---|
date | Sat, 09 Feb 2013 23:53:48 +0000 |
parents | |
children |
rev | line source |
---|---|
flatmax@592 | 1 #!/usr/bin/perl |
flatmax@592 | 2 |
flatmax@592 | 3 %subst = ( ); |
flatmax@592 | 4 $quiet = 0; |
flatmax@592 | 5 |
flatmax@592 | 6 while ( @ARGV ) { |
flatmax@592 | 7 $_ = shift @ARGV; |
flatmax@592 | 8 if ( s/^-// ) { |
flatmax@592 | 9 if ( /^l(.*)/ ) { |
flatmax@592 | 10 $v = ($1 eq "") ? shift @ARGV : $1; |
flatmax@592 | 11 ($v =~ /\/$/) || ($v .= "/"); |
flatmax@592 | 12 $_ = $v; |
flatmax@592 | 13 if ( /(.+)\@(.+)/ ) { |
flatmax@592 | 14 if ( exists $subst{$1} ) { |
flatmax@592 | 15 $subst{$1} = $2; |
flatmax@592 | 16 } else { |
flatmax@592 | 17 print STDERR "Unknown tag file $1 given with option -l\n"; |
flatmax@592 | 18 &usage(); |
flatmax@592 | 19 } |
flatmax@592 | 20 } else { |
flatmax@592 | 21 print STDERR "Argument $_ is invalid for option -l\n"; |
flatmax@592 | 22 &usage(); |
flatmax@592 | 23 } |
flatmax@592 | 24 } |
flatmax@592 | 25 elsif ( /^q/ ) { |
flatmax@592 | 26 $quiet = 1; |
flatmax@592 | 27 } |
flatmax@592 | 28 elsif ( /^\?|^h/ ) { |
flatmax@592 | 29 &usage(); |
flatmax@592 | 30 } |
flatmax@592 | 31 else { |
flatmax@592 | 32 print STDERR "Illegal option -$_\n"; |
flatmax@592 | 33 &usage(); |
flatmax@592 | 34 } |
flatmax@592 | 35 } |
flatmax@592 | 36 else { |
flatmax@592 | 37 push (@files, $_ ); |
flatmax@592 | 38 } |
flatmax@592 | 39 } |
flatmax@592 | 40 |
flatmax@592 | 41 foreach $sub (keys %subst) |
flatmax@592 | 42 { |
flatmax@592 | 43 if ( $subst{$sub} eq "" ) |
flatmax@592 | 44 { |
flatmax@592 | 45 print STDERR "No substitute given for tag file `$sub'\n"; |
flatmax@592 | 46 &usage(); |
flatmax@592 | 47 } |
flatmax@592 | 48 elsif ( ! $quiet && $sub ne "_doc" && $sub ne "_cgi" ) |
flatmax@592 | 49 { |
flatmax@592 | 50 print "Substituting $subst{$sub} for each occurrence of tag file $sub\n"; |
flatmax@592 | 51 } |
flatmax@592 | 52 } |
flatmax@592 | 53 |
flatmax@592 | 54 if ( ! @files ) { |
flatmax@592 | 55 if (opendir(D,".")) { |
flatmax@592 | 56 foreach $file ( readdir(D) ) { |
flatmax@592 | 57 $match = ".html"; |
flatmax@592 | 58 next if ( $file =~ /^\.\.?$/ ); |
flatmax@592 | 59 ($file =~ /$match/) && (push @files, $file); |
flatmax@592 | 60 ($file =~ /\.svg/) && (push @files, $file); |
flatmax@592 | 61 ($file =~ "navtree.js") && (push @files, $file); |
flatmax@592 | 62 } |
flatmax@592 | 63 closedir(D); |
flatmax@592 | 64 } |
flatmax@592 | 65 } |
flatmax@592 | 66 |
flatmax@592 | 67 if ( ! @files ) { |
flatmax@592 | 68 print STDERR "Warning: No input files given and none found!\n"; |
flatmax@592 | 69 } |
flatmax@592 | 70 |
flatmax@592 | 71 foreach $f (@files) |
flatmax@592 | 72 { |
flatmax@592 | 73 if ( ! $quiet ) { |
flatmax@592 | 74 print "Editing: $f...\n"; |
flatmax@592 | 75 } |
flatmax@592 | 76 $oldf = $f; |
flatmax@592 | 77 $f .= ".bak"; |
flatmax@592 | 78 unless (rename $oldf,$f) { |
flatmax@592 | 79 print STDERR "Error: cannot rename file $oldf\n"; |
flatmax@592 | 80 exit 1; |
flatmax@592 | 81 } |
flatmax@592 | 82 if (open(F,"<$f")) { |
flatmax@592 | 83 unless (open(G,">$oldf")) { |
flatmax@592 | 84 print STDERR "Error: opening file $oldf for writing\n"; |
flatmax@592 | 85 exit 1; |
flatmax@592 | 86 } |
flatmax@592 | 87 if ($oldf ne "tree.js") { |
flatmax@592 | 88 while (<F>) { |
flatmax@592 | 89 s/doxygen\=\"([^ \"\:\t\>\<]*)\:([^ \"\t\>\<]*)\" (xlink:href|href|src)=\"\2/doxygen\=\"$1:$subst{$1}\" \3=\"$subst{$1}/g; |
flatmax@592 | 90 print G "$_"; |
flatmax@592 | 91 } |
flatmax@592 | 92 } |
flatmax@592 | 93 else { |
flatmax@592 | 94 while (<F>) { |
flatmax@592 | 95 s/\"([^ \"\:\t\>\<]*)\:([^ \"\t\>\<]*)\", \"\2/\"$1:$subst{$1}\" ,\"$subst{$1}/g; |
flatmax@592 | 96 print G "$_"; |
flatmax@592 | 97 } |
flatmax@592 | 98 } |
flatmax@592 | 99 } |
flatmax@592 | 100 else { |
flatmax@592 | 101 print STDERR "Warning file $f does not exist\n"; |
flatmax@592 | 102 } |
flatmax@592 | 103 unlink $f; |
flatmax@592 | 104 } |
flatmax@592 | 105 |
flatmax@592 | 106 sub usage { |
flatmax@592 | 107 print STDERR "Usage: installdox [options] [html-file [html-file ...]]\n"; |
flatmax@592 | 108 print STDERR "Options:\n"; |
flatmax@592 | 109 print STDERR " -l tagfile\@linkName tag file + URL or directory \n"; |
flatmax@592 | 110 print STDERR " -q Quiet mode\n\n"; |
flatmax@592 | 111 exit 1; |
flatmax@592 | 112 } |