~ubuntu-branches/ubuntu/oneiric/electric/oneiric

« back to all changes in this revision

Viewing changes to com/sun/electric/technology/Xml.java

  • Committer: Bazaar Package Importer
  • Author(s): Onkar Shinde
  • Date: 2010-01-09 16:26:04 UTC
  • mfrom: (1.1.4 upstream) (3.1.6 sid)
  • Revision ID: james.westby@ubuntu.com-20100109162604-1ypvmy8ijmlc6oq7
Tags: 8.10-1
* New upstream version.
* debian/control
  - Add libjava3d-java and quilt build dependencies.
  - Update standards version to 3.8.3.
  - Add libjava3d-java as recommends to binary package.
* debian/rules
  - Use quilt patch system instead of simple patchsys.
  - Add java3d related jar files to DEB_JARS.
* debian/patches/*
  - Update as per current upstream source. Convert to quilt.
* debian/ant.properties
  - Do not disable 3D plugin anymore.
  - Use new property to disable compilation of OS X related classes.
* debian/wrappers/electric
  - Add java3d related jar files to runtime classpath.
* debian/README.source
  - Change text to the appropriate one for quilt.

Show diffs side-by-side

added added

removed removed

Lines of Context:
43
43
import java.io.StringWriter;
44
44
import java.net.URL;
45
45
import java.net.URLConnection;
46
 
import java.util.ArrayList;
47
 
import java.util.Arrays;
48
 
import java.util.BitSet;
49
 
import java.util.Calendar;
50
 
import java.util.Date;
51
 
import java.util.HashMap;
52
 
import java.util.LinkedHashMap;
53
 
import java.util.List;
54
 
import java.util.Map;
55
 
import java.util.TreeMap;
 
46
import java.util.*;
56
47
 
57
48
import javax.xml.XMLConstants;
58
49
import javax.xml.parsers.SAXParser;
85
76
        public int maxNumMetals;
86
77
        public int defaultNumMetals;
87
78
        public double scaleValue;
 
79
        public double resolutionValue; // min resolution value allowed by the foundry
88
80
        public boolean scaleRelevant;
89
81
        public String defaultFoundry;
90
82
        public double minResistance;
108
100
            return null;
109
101
        }
110
102
 
 
103
        public Collection<String> getLayerNames()
 
104
        {
 
105
            List<String> l = new ArrayList<String>();
 
106
            for (Layer layer: layers)
 
107
                l.add(layer.name);
 
108
            return l;
 
109
        }
 
110
 
111
111
        public ArcProto findArc(String name) {
112
112
            for (ArcProto arc: arcs) {
113
113
                if (arc.name.equals(name))
136
136
            return null;
137
137
        }
138
138
 
 
139
        public Collection<String> getNodeNames() {
 
140
            List<String> l = new ArrayList<String>();
 
141
            for (PrimitiveNodeGroup nodeGroup: nodeGroups) {
 
142
                for (PrimitiveNode n: nodeGroup.nodes) {
 
143
                    l.add(n.name);
 
144
                }
 
145
            }
 
146
            return l;
 
147
        }
 
148
 
 
149
        /**
 
150
         * Method to find the first PrimitiveNode which would have the given arc
 
151
         */
 
152
        public PrimitiveNode findPinNode(String arc)
 
153
        {
 
154
            for (PrimitiveNodeGroup nodeGroup: nodeGroups)
 
155
            {
 
156
                boolean foundPort = false;
 
157
                for (PrimitivePort p: nodeGroup.ports)
 
158
                {
 
159
                    if(p.portArcs.contains(arc))
 
160
                    {
 
161
                        foundPort = true;
 
162
                        break;
 
163
                    }
 
164
                }
 
165
                if (foundPort) // now checking if there is a pin associated with the arc
 
166
                {
 
167
                    for (PrimitiveNode n: nodeGroup.nodes)
 
168
                    {
 
169
                        if (n.function.isPin())
 
170
                            return n;
 
171
                    }
 
172
                }
 
173
            }
 
174
            return null;
 
175
        }
 
176
 
139
177
        public void writeXml(String fileName) {
140
178
            writeXml(fileName, true, null);
141
179
        }
357
395
        version,
358
396
        numMetals,
359
397
        scale,
 
398
        resolution,
360
399
        defaultFoundry,
361
400
        minResistance,
362
401
        minCapacitance,
523
562
                   + e.getMessage() + "\n";
524
563
            System.out.println(msg);
525
564
            Job.getUserInterface().showErrorMessage(msg, "Error loading Xml technology");
 
565
        } catch (Error a)
 
566
        {
 
567
            String msg = "Assertion while loading Xml technology " + fileURL;
 
568
            System.out.println(msg);
 
569
            //Job.getUserInterface().showErrorMessage(msg, "Error loading Xml technology");
526
570
        }
527
571
        return null;
528
572
    }
586
630
        private Distance curDistance;
587
631
        private SpiceHeader curSpiceHeader;
588
632
        private Foundry curFoundry;
 
633
        private Collection<String> curLayerNamesList;
 
634
        private Collection<String> curNodeNamesList;
589
635
 
590
636
        private boolean acceptCharacters;
591
637
        private StringBuilder charBuffer = new StringBuilder();
827
873
                case technology:
828
874
                    tech.techName = a("name");
829
875
                    tech.className = a_("class");
 
876
                    if (tech.className != null)
 
877
                    {
 
878
                        int index = tech.className.indexOf(".");
 
879
                        String realName = tech.className;
 
880
                        while (index != -1)
 
881
                        {
 
882
                            realName = realName.substring(index+1);
 
883
                            index = realName.indexOf(".");
 
884
                        }
 
885
                        if (!realName.toLowerCase().equals(tech.techName.toLowerCase()))
 
886
                            System.out.println("Mismatch between techName '" + tech.techName +
 
887
                                "' and className '" + realName + "' in the XML technology file.");
 
888
                    }
830
889
//                    dump = true;
831
890
                    break;
832
891
                case version:
833
 
                    Version version = new Version();
834
 
                    version.techVersion = Integer.parseInt(a("tech"));
835
 
                    version.electricVersion = com.sun.electric.database.text.Version.parseVersion(a("electric"));
836
 
                    tech.versions.add(version);
 
892
                    Version localVersion = new Version();
 
893
                    localVersion.techVersion = Integer.parseInt(a("tech"));
 
894
                    localVersion.electricVersion = com.sun.electric.database.text.Version.parseVersion(a("electric"));
 
895
                    tech.versions.add(localVersion);
837
896
                    break;
838
897
                case numMetals:
839
898
                    tech.minNumMetals = Integer.parseInt(a("min"));
844
903
                    tech.scaleValue = Double.parseDouble(a("value"));
845
904
                    tech.scaleRelevant = Boolean.parseBoolean(a("relevant"));
846
905
                    break;
 
906
                case resolution:
 
907
                    tech.resolutionValue = Double.parseDouble(a("value")); // default is 0;
 
908
                    break;
847
909
                case defaultFoundry:
848
910
                    tech.defaultFoundry = a("value");
849
911
                    break;
1073
1135
                case nodeLayer:
1074
1136
                    curNodeLayer = new NodeLayer();
1075
1137
                    curNodeLayer.layer = a("layer");
1076
 
                    curNodeLayer.style = Poly.Type.valueOf(a("style"));
1077
 
                    String portNum = a_("portNum");
1078
 
                    if (portNum != null)
1079
 
                        curNodeLayer.portNum = Integer.parseInt(portNum);
1080
 
                    String electrical = a_("electrical");
1081
 
                    if (electrical != null) {
1082
 
                        if (Boolean.parseBoolean(electrical))
1083
 
                            curNodeLayer.inElectricalLayers = true;
1084
 
                        else
1085
 
                            curNodeLayer.inLayers = true;
1086
 
                    } else {
1087
 
                        curNodeLayer.inElectricalLayers = curNodeLayer.inLayers = true;
 
1138
                    if (tech.findLayer(curNodeLayer.layer) == null)
 
1139
                    {
 
1140
                        throw new SAXException("Error: cannot find layer '" + curNodeLayer.layer + "' in primitive node '" +
 
1141
                        curNode.name + "'. Skiping this NodeLayer");
 
1142
                    }
 
1143
                    else
 
1144
                    {
 
1145
                        curNodeLayer.style = Poly.Type.valueOf(a("style"));
 
1146
                        String portNum = a_("portNum");
 
1147
                        if (portNum != null)
 
1148
                            curNodeLayer.portNum = Integer.parseInt(portNum);
 
1149
                        String electrical = a_("electrical");
 
1150
                        if (electrical != null) {
 
1151
                            if (Boolean.parseBoolean(electrical))
 
1152
                                curNodeLayer.inElectricalLayers = true;
 
1153
                            else
 
1154
                                curNodeLayer.inLayers = true;
 
1155
                        } else {
 
1156
                            curNodeLayer.inElectricalLayers = curNodeLayer.inLayers = true;
 
1157
                        }
1088
1158
                    }
1089
1159
                    break;
1090
1160
                case box:
1204
1274
                    curMenuNodeInst.protoName = a("protoName");
1205
1275
                    if (tech.findNode(curMenuNodeInst.protoName) == null)
1206
1276
                        System.out.println("Warning: cannot find node '" + curMenuNodeInst.protoName + "' for component menu");
1207
 
                    curMenuNodeInst.function =  com.sun.electric.technology.PrimitiveNode.Function.valueOf(a("function"));
 
1277
                    curMenuNodeInst.function =  com.sun.electric.technology.PrimitiveNode.Function.findType(a("function"));
 
1278
                    if (curMenuNodeInst.function == null)
 
1279
                        System.out.println("Error: cannot find function '" + a("function") + "' for node '" +
 
1280
                        a("protoName" + "'"));
1208
1281
                    String techBits = a_("techBits");
1209
1282
                    if (techBits != null)
1210
1283
                        curMenuNodeInst.techBits = Integer.parseInt(techBits);
1227
1300
                case LayersRule:
1228
1301
                case NodeLayersRule:
1229
1302
                case NodeRule:
1230
 
                    DRCTemplate.parseXmlElement(curFoundry.rules, key.name(), attributes, localName);
 
1303
                    if (curLayerNamesList == null)
 
1304
                        curLayerNamesList = tech.getLayerNames();
 
1305
                    if (curNodeNamesList == null)
 
1306
                        curNodeNamesList = tech.getNodeNames();
 
1307
                    if (!DRCTemplate.parseXmlElement(curFoundry.rules, curLayerNamesList, curNodeNamesList,
 
1308
                        key.name(), attributes, localName))
 
1309
                        System.out.println("Warning: cannot find layer name in DRC rule '" + key.name());
1231
1310
                    break;
1232
1311
                default:
1233
1312
                    assert key.hasText;
1346
1425
                    case fixedAngle:
1347
1426
                        curArc.fixedAngle = Boolean.parseBoolean(text);
1348
1427
                        break;
1349
 
                    case wipable:
1350
 
                        curArc.wipable = Boolean.parseBoolean(text);
1351
 
                        break;
 
1428
//                    case wipable:
 
1429
//                        curArc.wipable = Boolean.parseBoolean(text);
 
1430
//                        break;
1352
1431
                    case angleIncrement:
1353
1432
                        curArc.angleIncrement = Integer.parseInt(text);
1354
1433
                        break;
1428
1507
                    }
1429
1508
                    break;
1430
1509
                case nodeLayer:
1431
 
                    curNodeGroup.nodeLayers.add(curNodeLayer);
1432
 
                    curNodeLayer = null;
 
1510
                    if (curNodeLayer != null)
 
1511
                    {
 
1512
                        curNodeGroup.nodeLayers.add(curNodeLayer);
 
1513
                        curNodeLayer = null;
 
1514
                    }
1433
1515
                    break;
1434
1516
                case primitivePort:
1435
1517
                    curNodeGroup.ports.add(curPort);
1444
1526
                case spiceHeader:
1445
1527
                case numMetals:
1446
1528
                case scale:
 
1529
                case resolution:
1447
1530
                case defaultFoundry:
1448
1531
                case minResistance:
1449
1532
                case minCapacitance:
1781
1864
            }
1782
1865
            b(XmlKeyword.numMetals); a("min", t.minNumMetals); a("max", t.maxNumMetals); a("default", t.defaultNumMetals); el();
1783
1866
            b(XmlKeyword.scale); a("value", t.scaleValue); a("relevant", Boolean.valueOf(t.scaleRelevant)); el();
 
1867
            b(XmlKeyword.resolution); a("value", t.resolutionValue); el();
1784
1868
            b(XmlKeyword.defaultFoundry); a("value", t.defaultFoundry); el();
1785
1869
            b(XmlKeyword.minResistance); a("value", t.minResistance); el();
1786
1870
            b(XmlKeyword.minCapacitance); a("value", t.minCapacitance); el();