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