Update ooo320-m1
[ooovba.git] / testautomation / tools / hid / hid.pl
blobb29aeea510f539ed8f6fb2557738073a5a815673
1 #**************************************************************************
2 #* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3 #*
4 #* Copyright 2008 by Sun Microsystems, Inc.
5 #*
6 #* OpenOffice.org - a multi-platform office productivity suite
7 #*
8 #* $RCSfile: hid.pl,v $
9 #*
10 #* $Revision: 1.4 $
12 #* last change: $Author: tbo $ $Date: 2008/04/03 10:11:10 $
14 #* This file is part of OpenOffice.org.
16 #* OpenOffice.org is free software: you can redistribute it and/or modify
17 #* it under the terms of the GNU Lesser General Public License version 3
18 #* only, as published by the Free Software Foundation.
20 #* OpenOffice.org is distributed in the hope that it will be useful,
21 #* but WITHOUT ANY WARRANTY; without even the implied warranty of
22 #* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 #* GNU Lesser General Public License version 3 for more details
24 #* (a copy is included in the LICENSE file that accompanied this code).
26 #* You should have received a copy of the GNU Lesser General Public License
27 #* version 3 along with OpenOffice.org. If not, see
28 #* <http://www.openoffice.org/license.html>
29 #* for a copy of the LGPLv3 License.
31 #******************************************************************
33 #* Owner : thorsten.bosbach@sun.com
35 #* short description : Generate a cleaned hid.lst
37 #******************************************************************
39 # syntax : hid.pl Input Output ConstantEntries
40 # usually: hid.pl hid.lst hid.txt const.txt
43 for (@ARGV){print $_."\n";}
44 open (HID,"<".@ARGV[0]) || die "Can't find old HID-file (first argument)";
45 @ary=( <HID> );
46 close HID;
47 open (HID,">".@ARGV[1]) || die "Can't find new HID-file (second argument)";
49 @longnum = @longname = ();
51 for (@ary) {
52 s/MN_VIEW 21//g; # remove slots that are wrong
53 s/MN_INSERT 24//g;
54 s/MN_SUB_TOOLBAR 92//g;
55 s/SID_OBJECT_MIRROR 27085//g;
56 s/UID_SQLERROR_BUTTONMORE 38844//g;
57 s/MN_EXTRA 22//g; # -------------------------------------------
58 s/RID_UNDO_DELETE_WARNING 20558//g;
59 s/.* 01010101010//g;
60 s/ +/ /g; # remove double blanks
61 @x = split(/\s+/) ; # seperate Longnames and HIDs
62 # @x[0]=~ tr/a-z/A-Z/;
63 # @x[1]=~ tr/a-z/A-Z/;
64 $longname[++$#longname] = @x[0];
65 $longnum[++$#longnum] = @x[1];
66 $_=@x[0]." ".@x[1]."\n";
69 @ary = @ary[ sort{ # sort
70 @longnum[$a] <=> @longnum[$b] ||
71 @longname[$a] cmp @longname[$b]
72 }0..$#ary
75 # @ary = grep( !/^ *$/, @ary);
77 #remove double entries
79 $n="";
80 for (@ary) {
81 if ($n eq $_ || $_>0 ){
82 $_="";
84 else{
85 $n=$_;
89 @ary = grep( !/^ *$/, @ary);
91 # to insert the constant entries at the beginning, read it and write it out
92 open (CON,"<".@ARGV[2]) || die "Can't find constant entries-file: const.txt (third argument)";
93 @const=( <CON> );
94 close CON;
95 print HID @const;
97 print HID @ary;
98 close HID;