4 This file is part of the ARM-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/>.
26 end until i>10 or m=/[*]{10,}.*/.match(l)
28 file.seek(0, IO::SEEK_SET)
32 end until /[*]{10,}.*/.match(l)
36 end until /[=]{5,}.*/.match(l)
39 end until /[=]{5,}.*/.match(l)
42 def get_next_assign(file, i)
45 if($last_assign[i]==nil)
47 return nil if file.eof
48 l = file.gets().strip()
49 end until m=/[\s]*([\w]*)[\s]*=[\s]*([0-9a-fA-F]*).*/.match(l)
53 return nil if file.eof
54 l = file.gets().strip()
55 if not /[^=]+=[^=]+/.match(l)
56 value += l if /^[0-9A-Fa-f]{5}/.match(l)
58 end until /[^=]+=[^=]+/.match(l)
61 m=/[\s]*([\w]*)[\s]*=[\s]*([0-9a-fA-F]*).*/.match($last_assign[i])
65 return nil if file.eof
66 l = file.gets().strip()
67 if not /[^=]+=[^=]+/.match(l)
68 value += l if /^[0-9A-Fa-f]{5}/.match(l)
70 end until /[^=]+=[^=]+/.match(l)
76 def compare(fname1, fname2)
77 file1 = File.new(fname1, "r")
78 file2 = File.new(fname2, "r")
83 # puts("checking set")
84 a = get_next_assign(file1, 0)
85 b = get_next_assign(file2, 1)
86 return if(a==nil or b==nil)
88 puts("") if pos%$linewidth==0 and pos!=0
92 if(a!=b and a!=nil and b!=nil)
94 # puts("a key: "+a[0]+" value: "+a[1])
95 # puts("b key: "+b[0]+" value: "+b[1])
97 end until a==nil or b==nil
102 $last_assign=[nil, nil]
104 if ARGV.size<2 or ARGV.size>3
106 Usage: ruby #{$0} [-q|-v] file1 file2
122 puts("compare("+f1+", "+f2+")")
125 puts("[failed] ("+$error.to_s()+")")