⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 techexplorer.java

📁 The ElectricTM VLSI Design System is an open-source Electronic Design Automation (EDA) system that c
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
/* -*- tab-width: 4 -*- * * Electric(tm) VLSI Design System * * File: TechExplorer.java * Written by: Dmitry Nadezhin, Sun Microsystems. * * Copyright (c) 2003 Sun Microsystems and Static Free Software * * Electric(tm) is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * Electric(tm) is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Electric(tm); see the file COPYING.  If not, write to * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, Mass 02111-1307, USA. */package com.sun.electric.tool.sandbox;import com.sun.electric.database.geometry.DBMath;import com.sun.electric.database.geometry.EGraphics;import com.sun.electric.database.geometry.EPoint;import com.sun.electric.database.geometry.ERectangle;import com.sun.electric.technology.DRCTemplate;import com.sun.electric.technology.EdgeH;import com.sun.electric.technology.EdgeV;import com.sun.electric.technology.Layer;import com.sun.electric.technology.PrimitiveNode;import com.sun.electric.technology.SizeOffset;import com.sun.electric.technology.Technology;import com.sun.electric.technology.Xml;import java.awt.Color;import java.awt.geom.Point2D;import java.awt.geom.Rectangle2D;import java.io.BufferedInputStream;import java.io.BufferedOutputStream;import java.io.DataOutputStream;import java.io.File;import java.io.FileInputStream;import java.io.FileNotFoundException;import java.io.FileOutputStream;import java.io.IOException;import java.io.InputStream;import java.io.PrintWriter;import java.lang.reflect.InvocationTargetException;import java.net.MalformedURLException;import java.util.ArrayList;import java.util.Arrays;import java.util.Collection;import java.util.Collections;import java.util.Iterator;import java.util.List;import java.util.Map;import java.util.prefs.Preferences;/** * Main class of stand-alone process which loads "electric.jar (possibly with old Electric version), * initializes technologies and it and executes different test commands. */public class TechExplorer extends ESandBox {    /**     * @param args the command line arguments     */    public static void main(String[] args) {        try {            String fileName = args[0];            File electricJar = new File(fileName);            if (!electricJar.exists())                throw new FileNotFoundException(fileName);            TechExplorer m = new TechExplorer(electricJar);            InputStream commandStream = System.in;            if (args.length >= 2) {                commandStream = new BufferedInputStream(new FileInputStream(args[1]));            }            m.loop(commandStream);        } catch (Exception e) {            e.printStackTrace();        }    }    private TechExplorer(File electricJar) throws IOException, ClassNotFoundException, MalformedURLException, IllegalAccessException {        super(electricJar.toURI().toURL());    }    public String[] initTechnologies(String args) throws IllegalAccessException, InvocationTargetException {        if (Undo_changesQuiet != null)            Undo_changesQuiet.invoke(null, Boolean.TRUE);        if (Tool_initProjectSettings != null)            Tool_initProjectSettings.invoke(User_getUserTool.invoke(null));//            Tool_initAllTools.invoke(null);        Technology_initAllTechnologies.invoke(null);        List<String> technologies = new ArrayList<String>();        for (Iterator<?> tit = (Iterator)Technology_getTechnologies.invoke(null); tit.hasNext(); ) {            Object tech = tit.next();            String techName = (String)Technology_getTechName.invoke(tech);            technologies.add(techName);        }        return technologies.toArray(new String[technologies.size()]);    }    public void dumpAll(String fileName) throws IllegalAccessException, InvocationTargetException {        for (Iterator<?> tit = (Iterator)Technology_getTechnologies.invoke(null); tit.hasNext(); ) {            Object tech = tit.next();            String techName = (String)Technology_getTechName.invoke(tech);            System.out.println("Technology " + techName);            Xml.Technology t = makeXml(techName);            t.writeXml(fileName.replaceAll("lst", techName + "\\.xml"));        }//        if (Setting_getSettings != null) {//            Collection<?> allSettings = (Collection)Setting_getSettings.invoke(null);//            for (Object setting: allSettings) {//                String xmlPath = (String)Setting_getXmlPath.invoke(setting);//                Preferences prefs = (Preferences)Setting_prefs.get(setting);//                String prefName = (String)Setting_getPrefName.invoke(setting);//                String prefPath = prefs.absolutePath() + "/" + prefName;//                Object factoryValue = Setting_getFactoryValue.invoke(setting);//                assert xmlPath.length() > 0;//            }//        }//        List<?> allPrefs = (List)Pref_allPrefs.get(null);//        for (Object pref: allPrefs) {//            Preferences prefs = (Preferences)Pref_prefs.get(pref);//            String prefName = (String)Pref_getPrefName.invoke(pref);//            String prefPath = prefs.absolutePath() + "/" + prefName;//            boolean isMeaning = Pref_getMeaning != null && Pref_getMeaning.invoke(pref) != null;//            Object factoryValue = Pref_getFactoryValue.invoke(pref);//        }    }    public void dumpPrefs(String fileName) throws IOException {        PrintWriter out = new PrintWriter(fileName);        DataOutputStream dout = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(fileName.replaceAll("\\.lst", "\\.bin"))));        dumpPrefs(out, dout);        out.close();        dout.close();    }    private void dumpPrefs(PrintWriter out, DataOutputStream dout) throws IOException {        try {            String version = (String)Version_getVersion.invoke(null).toString();            out.println("Version " + version); dout.writeUTF(version);            for (Iterator<?> tit = (Iterator)Technology_getTechnologies.invoke(null); tit.hasNext(); ) {                Object tech = tit.next();                String techName = (String)Technology_getTechName.invoke(tech);                assert techName.length() > 0;                out.println("Technology " + techName); dout.writeUTF(techName);                for (Iterator<?> it = (Iterator)Technology_getLayers.invoke(tech); it.hasNext(); ) {                    Object layer = it.next();                    String layerName = (String)Layer_getName.invoke(layer);                    assert layerName.length() > 0;                    Object pseudoLayer = null;                    if (Layer_getPseudoLayer != null)                        pseudoLayer = Layer_getPseudoLayer.invoke(layer);                    out.print("Layer " + layerName); dout.writeUTF(layerName);                    String pseudoLayerName = "";                    if (pseudoLayer != null) {                        pseudoLayerName = (String)Layer_getName.invoke(pseudoLayer);                        assert pseudoLayerName.length() > 0;                        out.print(" " + pseudoLayerName);                    }                    dout.writeUTF(pseudoLayerName);                    out.println();                }                dout.writeUTF("");                for (Iterator<?> it = (Iterator)Technology_getArcs.invoke(tech); it.hasNext(); ) {                    Object ap = it.next();                    String arcName = (String)ArcProto_getName.invoke(ap);                    out.println("Arc " + arcName); dout.writeUTF(arcName);                }                dout.writeUTF("");                for (Iterator<?> it = (Iterator)Technology_getNodes.invoke(tech); it.hasNext(); ) {                    Object pn = it.next();                    String nodeName = (String)PrimitiveNode_getName.invoke(pn);                    out.println("Node " + nodeName); dout.writeUTF(nodeName);                }                dout.writeUTF("");            }            dout.writeUTF("");            if (Setting_getSettings != null) {                Collection<?> allSettings = (Collection)Setting_getSettings.invoke(null);                for (Object setting: allSettings) {                    String xmlPath = (String)Setting_getXmlPath.invoke(setting);                    Preferences prefs = (Preferences)Setting_prefs.get(setting);                    String prefName = (String)Setting_getPrefName.invoke(setting);                    String prefPath = prefs.absolutePath() + "/" + prefName;                    Object factoryValue = Setting_getFactoryValue.invoke(setting);                    out.println("Setting " + xmlPath + " " + prefPath + " <" + factoryValue + ">");                    assert xmlPath.length() > 0;                    dout.writeUTF(xmlPath);                    dout.writeUTF(prefPath);                }            }            dout.writeUTF("");            List<?> allPrefs = (List)Pref_allPrefs.get(null);            for (Object pref: allPrefs) {                Preferences prefs = (Preferences)Pref_prefs.get(pref);                String prefName = (String)Pref_getPrefName.invoke(pref);                String prefPath = prefs.absolutePath() + "/" + prefName;                boolean isMeaning = Pref_getMeaning != null && Pref_getMeaning.invoke(pref) != null;                Object factoryValue = Pref_getFactoryValue.invoke(pref);                out.println((isMeaning ? "Mean " : "Pref ") +  prefPath + " <" + factoryValue + ">");                dout.writeUTF(prefPath); dout.writeBoolean(isMeaning);            }            dout.writeUTF("");        } catch (IllegalAccessException e) {            e.printStackTrace();        } catch (InvocationTargetException e) {            e.printStackTrace();        }    } //    private void dumpShape(Object tech, Object pn) throws IllegalAccessException, InvocationTargetException, InstantiationException {//        Object lib = Library_newInstance.invoke(null, "l", null);//        String cellName = "a;1{lay}";//        Object cell = null;//        if (classCellVersionGroup != null) {//            cell = Cell_lowLevelAllocate.invoke(null, lib);//            Object versionGroup = CellVersionGroup_constructor.newInstance();//            CellVersionGroup_add.invoke(versionGroup, cell);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -