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 end until /[*]{10,}.*/.match(l)
29 end until /[*]{10,}.*/.match(l)
33 end until /[=]{5,}.*/.match(l)
37 end until /[=]{5,}.*/.match(l)
40 def get_next_assign(file, i)
43 if($last_assign[i]==nil)
45 return nil if file.eof
46 l = file.gets().strip()
47 end until m=/[\s]*([\w]*)[\s]*=[\s]*([0-9a-fA-F]*).*/.match(l)
51 return nil if file.eof
52 l = file.gets().strip()
53 if not /[^=]+=[^=]+/.match(l)
54 value += l if /^[0-9A-Fa-f]{5}/.match(l)
56 end until /[^=]+=[^=]+/.match(l)
59 m=/[\s]*([\w]*)[\s]*=[\s]*([0-9a-fA-F]*).*/.match($last_assign[i])
63 return nil if file.eof
64 l = file.gets().strip()
65 if not /[^=]+=[^=]+/.match(l)
66 value += l if /^[0-9A-Fa-f]{5}/.match(l)
68 end until /[^=]+=[^=]+/.match(l)
74 def compare(fname1, fname2)
75 file1 = File.new(fname1, "r")
76 file2 = File.new(fname2, "r")
81 # puts("checking set")
82 a = get_next_assign(file1, 0)
83 b = get_next_assign(file2, 1)
84 return if(a==nil or b==nil)
86 puts("") if pos%$linewidth==0 and pos!=0
90 if(a!=b and a!=nil and b!=nil)
92 # puts("a key: "+a[0]+" value: "+a[1])
93 # puts("b key: "+b[0]+" value: "+b[1])
95 end until a==nil or b==nil
100 $last_assign=[nil, nil]
102 if ARGV.size<2 or ARGV.size>3
104 Usage: ruby #{$0} [-q|-v] file1 file2
120 puts("compare("+f1+", "+f2+")")
123 puts("[failed] ("+$error.to_s()+")")