📄 xml805.java
字号:
* <p>By default, do nothing. Application writers may override this * method to take specific actions for each chunk of character data * (such as adding the data to a node or buffer, or printing it to * a file).</p> * * @param ch The characters. * @param start The start position in the character array. * @param length The number of characters to use from the * character array. * @exception org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. * @see org.xml.sax.ContentHandler#characters */ public void characters(char ch[], int start, int length) throws SAXException { if (acceptCharacters) { charBuffer.append(ch, start, length); } else { boolean nonBlank = false; for (int i = 0; i < length; i++) { char c = ch[start + i]; nonBlank = nonBlank || c != ' ' && c != '\n'; } if (nonBlank) { System.out.print("characters size=" + ch.length + " start=" + start + " length=" + length + " {"); for (int i = 0; i < length; i++) System.out.print(ch[start + i]); System.out.println("}"); } } } /** * Receive notification of ignorable whitespace in element content. * * <p>By default, do nothing. Application writers may override this * method to take specific actions for each chunk of ignorable * whitespace (such as adding data to a node or buffer, or printing * it to a file).</p> * * @param ch The whitespace characters. * @param start The start position in the character array. * @param length The number of characters to use from the * character array. * @exception org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. * @see org.xml.sax.ContentHandler#ignorableWhitespace */ public void ignorableWhitespace(char ch[], int start, int length) throws SAXException { int x = 0; } /** * Receive notification of a processing instruction. * * <p>By default, do nothing. Application writers may override this * method in a subclass to take specific actions for each * processing instruction, such as setting status variables or * invoking other methods.</p> * * @param target The processing instruction target. * @param data The processing instruction data, or null if * none is supplied. * @exception org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. * @see org.xml.sax.ContentHandler#processingInstruction */ public void processingInstruction(String target, String data) throws SAXException { int x = 0; } /** * Receive notification of a skipped entity. * * <p>By default, do nothing. Application writers may override this * method in a subclass to take specific actions for each * processing instruction, such as setting status variables or * invoking other methods.</p> * * @param name The name of the skipped entity. * @exception org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. * @see org.xml.sax.ContentHandler#processingInstruction */ public void skippedEntity(String name) throws SAXException { int x = 0; } //////////////////////////////////////////////////////////////////// // Default implementation of the ErrorHandler interface. //////////////////////////////////////////////////////////////////// /** * Receive notification of a parser warning. * * <p>The default implementation does nothing. Application writers * may override this method in a subclass to take specific actions * for each warning, such as inserting the message in a log file or * printing it to the console.</p> * * @param e The warning information encoded as an exception. * @exception org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. * @see org.xml.sax.ErrorHandler#warning * @see org.xml.sax.SAXParseException */ public void warning(SAXParseException e) throws SAXException { System.out.println("warning publicId=" + e.getPublicId() + " systemId=" + e.getSystemId() + " line=" + e.getLineNumber() + " column=" + e.getColumnNumber() + " message=" + e.getMessage() + " exception=" + e.getException()); } /** * Receive notification of a recoverable parser error. * * <p>The default implementation does nothing. Application writers * may override this method in a subclass to take specific actions * for each error, such as inserting the message in a log file or * printing it to the console.</p> * * @param e The error information encoded as an exception. * @exception org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. * @see org.xml.sax.ErrorHandler#warning * @see org.xml.sax.SAXParseException */ public void error(SAXParseException e) throws SAXException { System.out.println("error publicId=" + e.getPublicId() + " systemId=" + e.getSystemId() + " line=" + e.getLineNumber() + " column=" + e.getColumnNumber() + " message=" + e.getMessage() + " exception=" + e.getException()); } /** * Report a fatal XML parsing error. * * <p>The default implementation throws a SAXParseException. * Application writers may override this method in a subclass if * they need to take specific actions for each fatal error (such as * collecting all of the errors into a single report): in any case, * the application must stop all regular processing when this * method is invoked, since the document is no longer reliable, and * the parser may no longer report parsing events.</p> * * @param e The error information encoded as an exception. * @exception org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. * @see org.xml.sax.ErrorHandler#fatalError * @see org.xml.sax.SAXParseException */ public void fatalError(SAXParseException e) throws SAXException { throw e; } } private static class Writer { private static final int INDENT_WIDTH = 4; private final PrintWriter out; private int indent; private boolean indentEmitted; Writer(PrintWriter out) { this.out = out; } private void writeTechnology(Technology t) { Calendar cal = Calendar.getInstance(); cal.setTime(new Date()); header(); pl(""); out.println("<!--"); pl(" *"); pl(" * Electric(tm) VLSI Design System"); pl(" *"); pl(" * File: " + t.techName + ".xml"); pl(" * " + t.techName + " technology description"); pl(" * Generated automatically from a library"); pl(" *"); pl(" * Copyright (c) " + cal.get(Calendar.YEAR) + " Sun Microsystems and Static Free Software"); pl(" *"); pl(" * Electric(tm) is free software; you can redistribute it and/or modify"); pl(" * it under the terms of the GNU General Public License as published by"); pl(" * the Free Software Foundation; either version 2 of the License, or"); pl(" * (at your option) any later version."); pl(" *"); pl(" * Electric(tm) is distributed in the hope that it will be useful,"); pl(" * but WITHOUT ANY WARRANTY; without even the implied warranty of"); pl(" * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the"); pl(" * GNU General Public License for more details."); pl(" *"); pl(" * You should have received a copy of the GNU General Public License"); pl(" * along with Electric(tm); see the file COPYING. If not, write to"); pl(" * the Free Software Foundation, Inc., 59 Temple Place, Suite 330,"); pl(" * Boston, Mass 02111-1307, USA."); pl(" */"); out.println("-->"); l(); b(XmlKeyword.technology); a("name", t.techName); a("class", t.className); l(); a("xmlns", "http://electric.sun.com/Technology"); l(); a("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance"); l(); a("xsi:schemaLocation", "http://electric.sun.com/Technology ../../technology/Technology.xsd"); cl(); l(); bcpel(XmlKeyword.shortName, t.shortTechName); bcpel(XmlKeyword.description, t.description); for (Version version: t.versions) { b(XmlKeyword.version); a("tech", version.techVersion); a("electric", version.electricVersion); el(); } b(XmlKeyword.numMetals); a("min", t.minNumMetals); a("max", t.maxNumMetals); a("default", t.defaultNumMetals); el(); b(XmlKeyword.scale); a("value", t.scaleValue); a("relevant", t.scaleRelevant); el(); b(XmlKeyword.defaultFoundry); a("value", t.defaultFoundry); el(); b(XmlKeyword.minResistance); a("value", t.minResistance); el(); b(XmlKeyword.minCapacitance); a("value", t.minCapacitance); el();// printlnAttribute(" gateLengthSubtraction", gi.gateShrinkage);// printlnAttribute(" gateInclusion", gi.includeGateInResistance);// printlnAttribute(" groundNetInclusion", gi.includeGround); l(); if (t.transparentLayers.size() != 0) { comment("Transparent layers"); for (int i = 0; i < t.transparentLayers.size(); i++) { Color color = t.transparentLayers.get(i); b(XmlKeyword.transparentLayer); a("transparent", i + 1); cl(); bcpel(XmlKeyword.r, color.getRed()); bcpel(XmlKeyword.g, color.getGreen()); bcpel(XmlKeyword.b, color.getBlue()); el(XmlKeyword.transparentLayer); } l(); } comment("**************************************** LAYERS ****************************************"); for (Layer li: t.layers) { writeXml(li); } comment("******************** ARCS ********************"); for (ArcProto ai: t.arcs) { writeXml(ai); l(); } comment("******************** NODES ********************"); for (PrimitiveNode ni: t.nodes) { writeXml(ni); l(); } for (SpiceHeader spiceHeader: t.spiceHeaders) writeSpiceHeaderXml(spiceHeader); writeMenuPaletteXml(t.menuPalette); for (Foundry foundry: t.foundries) writeFoundryXml(foundry); el(XmlKeyword.technology); } private void writeXml(Layer li) { EGraphics desc = li.desc; String funString = null; int funExtra = li.extraFunction; if (funExtra != 0) { final int deplEnhMask = com.sun.electric.technology.Layer.Function.DEPLETION|com.sun.electric.technology.Layer.Function.ENHANCEMENT; if ((funExtra&deplEnhMask) != 0) { funString = com.sun.electric.technology.Layer.Function.getExtraName(funExtra&(deplEnhMask)); funExtra &= ~deplEnhMask; if (funExtra != 0) funString += "_" + com.sun.electric.technology.Layer.Function.getExtraName(funExtra); } else { funString = com.sun.electric.technology.Layer.Function.getExtraName(funExtra); } } b(XmlKeyword.layer); a("name", li.name); a("fun", li.function.name()); a("extraFun", funString); cl(); if (desc.getTransparentLayer() > 0) { b(XmlKeyword.transparentColor); a("transparent", desc.getTransparentLayer()); el(); } else { Color color = desc.getColor(); b(XmlKeyword.opaqueColor); a("r", color.getRed()); a("g", color.getGreen()); a("b", color.getBlue()); el(); } bcpel(XmlKeyword.patternedOnDisplay, desc.isPatternedOnDisplay()); bcpel(XmlKeyword.patternedOnPrinter, desc.isPatternedOnPrinter()); int [] pattern = desc.getPattern(); for(int j=0; j<16; j++) { String p = ""; for(int k=0; k<16; k++) p += (pattern[j] & (1 << (15-k))) != 0 ? 'X' : ' '; bcpel(XmlKeyword.pattern, p); } if (li.desc.getOutlined() != null) bcpel(XmlKeyword.outlined, desc.getOutlined().getConstName()); bcpel(XmlKeyword.opacity, desc.getOpacity()); bcpel(XmlKeyword.foreground, desc.getForeground()); // write the 3D information if (li.thick3D != com.sun.electric.technology.Layer.DEFAULT_THICKNESS || li.height3D != com.sun.electric.technology.Layer.DEFAULT_DISTANCE || (li.mode3D != null && !li.mode3D.equals(com.sun.electric.technology.Layer.DEFAULT_MODE)) || li.factor3D != com.s
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -