4 This file is part of the AVR-Crypto-Lib.
5 Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
7 This program is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>.
25 lb = file.gets() until /[\s]*Set[\s]*[\d]+[\s]*,[\s]*vector#[\s]*[\d]+[\s]*:[\s]*/.match(lb)
31 if m=/[\s]*([^=]+)[\s]*=[\s]*(.*)/.match(lb)
36 if m=/[\s]*([0-9a-fA-F]+)[\s]*/.match(lb) and lastkey!=nil
37 record[lastkey] += m[1]
45 def check_match(fname1, fname2)
48 if File.directory?(fname1)
51 if File.directory?(fname2)
54 file1 = File.new(fname1, "r");
55 file2 = File.new(fname2, "r");
56 r1 = read_record(file1)
57 r2 = read_record(file2)
61 def get_params_from_fn(fname)
63 if not p = /[^\.]*\.(([\d]+)\.*).*/.match(fname)
66 params = p[1].split(/\./)
70 def get_params_from_fn2(fname)
72 if not p = /[^\.]*\.((-([\d]+))*\.).*/.match(fname)
75 params = p[1].split(/\./)
79 def find_files(fname1, afnames)
82 params = get_params_from_fn(fname1)
84 p = get_params_from_fn2(fn)
85 puts("#{params} ?= #{p}")
94 if ARGV.size<2 or File.directory?(ARGV[0]) or (File.directory?(ARGV[1])==false)
96 Usage: ruby #{$0} file directory [formatstring]
109 files = Dir.entries(ARGV[1])
111 if check_match(ARGV[0], ARGV[1]+fn)
112 printf(fmt, ARGV[0].to_s, ARGV[1]+fn.to_s)
114 # puts("#{ARGV[0]} --> #{ARGV[1]+fn}")