re PR rtl-optimization/23837 (Wrong code with REG_NO_CONFLICT notes (caused by combine))
[gcc.git] / libjava / scripts / MakeDefaultMimeTypes.java
1 /* Copyright (C) 2000, 2003 Free Software Foundation
2
3 This file is part of libgcj.
4
5 This software is copyrighted work licensed under the terms of the
6 Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
7 details. */
8
9 import gnu.gcj.io.MimeTypes;
10 import java.io.IOException;
11 import java.io.FileNotFoundException;
12 import java.util.Hashtable;
13 import java.util.Enumeration;
14 import java.util.NoSuchElementException;
15
16 public class MakeDefaultMimeTypes
17 {
18 private static void fatal (String message)
19 {
20 System.err.println ("MakeDefaultMimeTypes Error: " + message);
21 System.exit (-1);
22 }
23
24 public static void main (String[] args)
25 {
26 Hashtable mime_table = new Hashtable ();
27
28 if (args.length != 1)
29 fatal ("missing mime type filename");
30
31 try {
32 MimeTypes.fillFromFile (mime_table, args[0]);
33 } catch (FileNotFoundException ex) {
34 fatal ("can't open " + args[0]);
35 } catch (IOException ex) {
36 fatal ("error reading " + args[0]);
37 }
38
39 System.out.println ("// Do not edit this file! Create a new version with MakeDefaultMimeTypes.\n\n/* Copyright (C) 2000 Free Software Foundation\n\n This file is part of libgcj.\n\nThis software is copyrighted work licensed under the terms of the\nLibgcj License. Please consult the file \"LIBGCJ_LICENSE\" for\ndetails. */\n\npackage gnu.gcj.io; \n\npublic class DefaultMimeTypes\n{\n public static final String[] types = {");
40
41 Enumeration keys = mime_table.keys();
42 Enumeration values = mime_table.elements();
43
44 // Prepend first element with open bracket
45 StringBuffer result = new StringBuffer("");
46
47 try
48 {
49 result.append(" \""
50 + keys.nextElement().toString()
51 + "\",\t\""
52 + values.nextElement().toString()
53 + "\"\n");
54 }
55 catch (NoSuchElementException ex)
56 {
57 }
58
59 // Prepend subsequent elements with ", "
60 try
61 {
62 while (true)
63 result.append(" , \""
64 + keys.nextElement().toString()
65 + "\",\t\""
66 + values.nextElement().toString()
67 + "\"\n");
68 }
69 catch (NoSuchElementException ex)
70 {
71 }
72
73 // Append last element with closing bracket
74 result.append(" };\n}\n");
75 System.out.println(result);
76 }
77 }