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/>.
24 end until /[*]{10,}.*/.match(l)
27 end until /[*]{10,}.*/.match(l)
30 end until /[=]{5,}.*/.match(l)
33 end until /[=]{5,}.*/.match(l)
36 def get_next_assign(file, i)
39 if($last_assign[i]==nil)
41 return nil if file.eof
42 l = file.gets().strip()
43 end until m=/[\s]*([\w]*)[\s]*=[\s]*([0-9a-fA-F]*).*/.match(l)
47 return nil if file.eof
48 l = file.gets().strip()
49 if not /[^=]+=[^=]+/.match(l)
50 value += l if /^[0-9A-Fa-f]{5}/.match(l)
52 end until /[^=]+=[^=]+/.match(l)
55 m=/[\s]*([\w]*)[\s]*=[\s]*([0-9a-fA-F]*).*/.match($last_assign[i])
59 return nil if file.eof
60 l = file.gets().strip()
61 if not /[^=]+=[^=]+/.match(l)
62 value += l if /^[0-9A-Fa-f]{5}/.match(l)
64 end until /[^=]+=[^=]+/.match(l)
70 def compare(fname1, fname2)
71 file1 = File.new(fname1, "r")
72 file2 = File.new(fname2, "r")
77 # puts("checking set")
78 a = get_next_assign(file1, 0)
79 b = get_next_assign(file2, 1)
80 return if(a==nil or b==nil)
82 puts("") if pos%$linewidth==0 and pos!=0
86 if(a!=b and a!=nil and b!=nil)
88 # puts("a key: "+a[0]+" value: "+a[1])
89 # puts("b key: "+b[0]+" value: "+b[1])
91 end until a==nil or b==nil
96 $last_assign=[nil, nil]
98 if ARGV.size<2 or ARGV.size>3
100 Usage: ruby #{$0} [-q|-v] file1 file2
116 puts("compare("+f1+", "+f2+")")
119 puts("[failed] ("+$error.to_s()+")")