X-Git-Url: https://git.cryptolib.org/?p=avr-crypto-lib.git;a=blobdiff_plain;f=host%2Ffix-wiki-size.rb;h=4e7ed83211f668cb546af7622dce7c692227ee90;hp=2bc08c841c174d33cf4332b44169565b84d9b7e4;hb=4b5da1dc27a791b5c448274a3db09cd035b33493;hpb=b022a029def51d63f330c12bf07156db294c8958 diff --git a/host/fix-wiki-size.rb b/host/fix-wiki-size.rb index 2bc08c8..4e7ed83 100644 --- a/host/fix-wiki-size.rb +++ b/host/fix-wiki-size.rb @@ -3,7 +3,7 @@ =begin This file is part of the AVR-Crypto-Lib. - Copyright (C) 2009 Daniel Otte (daniel.otte@rub.de) + Copyright (C) 2006-2015 Daniel Otte (bg@nerilex.org) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -19,6 +19,10 @@ along with this program. If not, see . =end + +require 'rubygems' +require 'getopt/std' + =begin | Blake-28 || C || C | 10916
@@ -32,7 +36,7 @@ memxor: 24 =end -def fix_file(fin, fout) +def fix_file(fin, fout, supress) loop do return if fin.eof() comp = Array.new @@ -45,9 +49,13 @@ def fix_file(fin, fout) end until comp[i-1].match(/^\|/) sum = 0 (i-1).times{ |j| sum += comp[j].match(/[^:]*:[\s]*([\d]*)/)[1].to_i} - fout.puts(lb1) - fout.printf("| %d
\n", sum) - comp.each{ |s| fout.puts(s)} + fout.print(lb1.chomp) + if supress + fout.printf(" || %d |%s", sum, comp.last) + else + fout.printf("\n| %d
\n", sum) + comp.each{ |s| fout.puts(s)} + end begin lb1 = fin.readline() fout.puts(lb1) @@ -62,11 +70,12 @@ end fin = STDIN fout = STDOUT +opts = Getopt::Std.getopts("s") fin = File.open(ARGV[0], "r") if ARGV.size > 0 fout = File.open(ARGV[1], "w") if ARGV.size > 1 -fix_file(fin, fout) +fix_file(fin, fout, opts["s"]) fin.close if ARGV.size > 0 fout.close if ARGV.size > 1