1    /*
2        Copyright (C) 2000  Ralph Hartley
3    
4        This program is free software; you can redistribute it and/or modify
5        it under the terms of the GNU General Public License as published by
6        the Free Software Foundation; either version 2 of the License, or
7        (at your option) any later version.
8    
9        This program is distributed in the hope that it will be useful,
10       but WITHOUT ANY WARRANTY; without even the implied warranty of
11       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12       GNU General Public License for more details.
13   
14       You should have received a copy of the GNU General Public License
15       along with this program; if not, write to the Free Software
16       Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17   */
18   
19   import java.awt.event.*;
20   import java.awt.*;
21   import java.awt.geom.*;
22   import java.util.*;
23   import java.io.*;
24   import java.awt.print.*;
25   import java.awt.image.*;
26   import javax.swing.*;
27   import java.lang.ref.*;
28   
29   public class ConvertSymb {
30   
31     static public void main(String[] args) {
32   
33       ErrorLog log = null;
34   
35       try {
36         System.setErr(log=new ErrorLog());
37       } catch (Exception e2) {
38         System.out.println("Trying to set up the error file itself caused an error");
39         System.out.println("RunID = "+Persist.current.getRunID());
40         e2.printStackTrace();
41       }
42   
43       Persist.restore();
44       log.logMessage();
45       
46       System.out.print(Carto.runversion.getAbout());
47   
48       Object result = null;
49       try {
50         FileInputStream istream = new FileInputStream(args[0]);
51         ObjectInputStream in = new ObjectInputStream(istream);
52         result = in.readObject();
53         istream.close();
54       } catch (Exception e) {
55           ErrorLog.log("Symbol file not sucessfully read: "+args[0]);
56           ErrorLog.exception(e);
57       }
58   
59       if (! (result instanceof Symbol)) {
60         ErrorLog.log("error: "+args[1]+" did not contain Symbol data.");
61         return;
62       }
63   
64   //    Symbol res = (Symbol)result;
65   //    FileDefaultable.sortOut(res.defaults);
66   //    return(res);
67       try {
68         FileOutputStream ostream = new FileOutputStream(args[1]);
69         ObjectOutputStream out = new ObjectOutputStream(ostream);
70         out.writeObject(result);
71         ostream.close();
72       } catch (Exception e) {
73           ErrorLog.log("Symbol file not sucessfully written: "+args[1]);
74           ErrorLog.exception(e);
75       }
76     }
77   
78   }
79