]> git.cryptolib.org Git - avr-crypto-lib.git/blob - host/fix-wiki-size.rb
fixing E-Mail-Address & Copyright
[avr-crypto-lib.git] / host / fix-wiki-size.rb
1 #!/usr/bin/ruby
2 # performnce to wiki
3
4 =begin
5     This file is part of the AVR-Crypto-Lib.
6     Copyright (C) 2006-2015 Daniel Otte (bg@nerilex.org)
7
8     This program is free software: you can redistribute it and/or modify
9     it under the terms of the GNU General Public License as published by
10     the Free Software Foundation, either version 3 of the License, or
11     (at your option) any later version.
12
13     This program is distributed in the hope that it will be useful,
14     but WITHOUT ANY WARRANTY; without even the implied warranty of
15     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16     GNU General Public License for more details.
17
18     You should have received a copy of the GNU General Public License
19     along with this program.  If not, see <http://www.gnu.org/licenses/>.
20 =end
21
22
23 require 'rubygems'
24 require 'getopt/std'
25
26 =begin
27 |             Blake-28 ||   C ||   C 
28 | 10916<br> 
29 blake_small: 3494<br> 
30 blake_large: 7142<br> 
31 blake_common: 256<br> 
32 memxor: 24 
33 |   53 || ||  224 ||  512 ||    386 ||  71362 || 1115.03 ||  71893 || || || 
34 |-
35
36 =end
37
38
39 def fix_file(fin, fout, supress)
40   loop do
41     return if fin.eof()
42     comp = Array.new
43     i = 0
44     lb1 = fin.readline()
45     lb2 = fin.readline()
46     begin
47       comp[i] = fin.readline()
48       i += 1
49     end until comp[i-1].match(/^\|/)
50     sum = 0
51     (i-1).times{ |j| sum += comp[j].match(/[^:]*:[\s]*([\d]*)/)[1].to_i}
52     fout.print(lb1.chomp)
53     if supress
54       fout.printf(" || %d |%s", sum, comp.last)    
55     else
56       fout.printf("\n| %d <br>\n", sum)
57       comp.each{ |s| fout.puts(s)}
58     end
59     begin
60       lb1 = fin.readline()
61       fout.puts(lb1)
62     end until lb1.match(/^\|\-/)
63   end
64 end
65
66 ################################################################################
67 # MAIN                                                                         #
68 ################################################################################
69
70 fin = STDIN
71 fout = STDOUT
72
73 opts = Getopt::Std.getopts("s")
74
75 fin  = File.open(ARGV[0], "r") if ARGV.size > 0
76 fout = File.open(ARGV[1], "w") if ARGV.size > 1
77
78 fix_file(fin, fout, opts["s"])
79
80 fin.close  if ARGV.size > 0
81 fout.close if ARGV.size > 1
82